Impossible OS Docs

Parallel Lanes: the Claude Runner and Three Antigravity Workers

Impossible OS runs the Claude runner on main and three Antigravity CLI (agy) worker lanes, each launched on Gemini 4 Neon at medium effort (agy --model=gemini-4-neon-medium --effort=medium: the lane's model and effort in .conclave/lanes.toml, the same launch as the Resolute-SDK Gemini campaign; a lane whose map model is an orchestrator model, such as gemini-pro-orchestrator-neon, still resolves its variant from ~/.gemini/antigravity-cli/settings.json and gets no --effort), coordinated directly through the local inter-lane bus without going through Heliograph.

Topology

Lane Worktree Branch Role Domain Affinity
main (orchestrator) . (primary tree) main The Claude runner (scripts/run.sh): builds its own sections, integrates worker handoffs at its section boundaries, full builder/tester, pusher, ecosystem gateway Remaining / cross-domain, lifecycle, kernel and boot sections
lane-1 ../impossible-os-lane-1 lane/lane-1 Worker 01-boot-platform through 05-storage-filesystems, 07-networking, 16-architecture-ports
lane-2 ../impossible-os-lane-2 lane/lane-2 Worker 09-desktop-shell, 10-platform-services, 11-apps, 12-user-platform-sdk, 13-tools-accessories
lane-3 ../impossible-os-lane-3 lane/lane-3 Worker 00-infrastructure, 06-desktop-foundation, 08-graphics-ui, 14-host-tools, 15-installer-release, 17-polish-hardening, 18-future-research

Since 2026-11-30 (the Claude Orchestrator switch) main is the Claude runner ([lane.main] engine = "claude"); the three workers run agy. A worker starts only beside a live runner and run.sh start conflicts only with a four-lane writer recorded for main, so the order is bash scripts/run.sh start, then bash scripts/lane.sh start lane-1 (or each worker). Reversal: engine = "agy", model = "gemini-pro-orchestrator-neon" on [lane.main].

Direct Local Communication and Anti-Clash Leases

  • Inter-lane state lives under $XDG_STATE_HOME/impossible-os/lanes/: top-level <lane>.json files hold worker heartbeats and active leased_paths, while bus/ holds claims.json, handoffs.json, ecosystem.json, main.json, and messages/<lane>.jsonl guarded by bus.lock (fcntl.flock). Claims are persisted in claims.json first and worker <lane>.json records are rebuilt/reconciled against them; explicit lane_bus.py ack <lane> --ids ... and flush-before-ack poll --ack prevent lost steering messages on broken pipes.
  • .conclave/lanes.toml, /proc process-ancestry identity checks (lanes.caller_identity()), and scripts/lanes.py enforce branch identity (lane/<lane>), caller identity, and dynamic path leases at commit time through .githooks/pre-commit: a worker cannot commit without an active lease, on a wrong/detached branch, in another worker's worktree, or override with SKIP_LANE_CHECK=1, and main cannot commit over paths held by a live worker until integrate-begin transfers ownership cleanly. (Because all lanes share one OS user account and $XDG_STATE_HOME, process-ancestry and tmux ownership checks guard against accidental cross-lane/cross-clone mixups rather than hostile multi-user escalation.)
  • Workers prefer ready sections matching their domain affinity in scripts/lane_bus.py claim-next and automatically overflow to other disjoint ready sections so all three workers stay busy without file conflicts.
  • Lifecycle code (locks, liveness, signals, deadlines) goes to the Claude Orchestrator on main by default (operator, 2026-11-28): [routing] claude in .conclave/lanes.toml lists it, and lane_bus.py refuses those paths to every worker claim, assignment and lease expansion, including a directory lease that contains one and paths inferred from a section's text (lanes.routed_to_claude, _refuse_claude_routed).
  • Each lane can start independently. If the Orchestrator is offline, a worker may claim and prepare at most one non-overlapping slice (claim-next returns exit 3 with waiting-for-orchestrator once capped) until main integrates it.

Execution Split and Ecosystem Boundaries

  • Workers (lane-1, lane-2, lane-3): implement sections on lane/<lane>, run fast lint/syntax/targeted checks plus Astra plan and round worktree pre-screen passes via scripts/codex-dispatch.sh (verified on handoff via manifest.jsonl, .done status 0, and transcript HIGHEST:/Turn completed checks before main runs its authoritative Astra chain), commit locally with SKIP_COUNT=1 (lint Checks 37 and 42 skip their plan and program-needs halves on a worker commit, because only main may stage the files they would ask for; main's own commits run them in full), and submit scripts/lane_bus.py handoff. Workers inspect ../SDK, ../Brand, sibling apps, todo/imports.json, docs/design/brand-contract.json, TODO-13, and TODO-15 read-only so they know what exists ecosystem-wide, and send immediate mid-slice requests (scripts/lane_bus.py ecosystem-request <lane> --target sdk|brand|apps|heliograph --kind feature|propose|asset|needs|pull|bug --summary "..." [--blocking]) or --ecosystem-request attachments whenever an unbuilt/unsynced SDK or Brand capability is needed. Workers are blocked by .githooks/pre-push from pushing, never run full builds or QEMU smoke matrices, never stamp final [x] rows in todo/, never call helio, and never edit orchestrator-only shared surfaces (todo/imports.json, docs/design/brand-contract.json, docs/design/brand-requests.json, helio.conf, .conclave/lanes.toml, .conclave/reviewers.toml, todo/implementation-plan.md, TODO-13, TODO-15).
  • Orchestrator (main): integrates ready (or interrupted integrating / rolling-back) worker handoffs (integrate-begin -> git merge --ff-only / git cherry-pick -> integrate-record --shas -> full build/tests/QEMU + main-manifest Astra chain -> [x] stamps and todo-plan.py --sync -> push origin/main + ci-wait.py -> integrate-done verifying current main tip, reverse patch-id non-reversion, and byte-exact landing: for every worker file it re-merges the worker's change onto main's blob (git cat-file blob, git merge-file) and requires the result to equal that blob, so a lost final newline, blank line or binary edit is caught; a change that cannot be re-merged cleanly (a conflict, or binary content main rewrote) needs --adapted, the orchestrator's confirmation of a hand resolution; or integrate-rollback-begin -> newest-first revert of persisted integrated_shas -> integrate-reject), dispatches idle workers, and serves as the sole gateway to sibling repositories (helio, scripts/imports.py for Impossible SDK/apps, and docs/design/brand-contract.json / brand-requests.json for Impossible Brand), resolving worker requests with ecosystem-resolve (which notifies the requesting worker directly via ecosystem_resolved). scripts/agy-hook-bridge.py suppresses heliograph_inbox.py in worker sessions while injecting scripts/lane_bus.py hook-inbox into all four lanes. The bridge takes its lane from IMPOSSIBLE_OS_LANE alone, which lane.sh sets in the session environment at launch (unset means main), and finds its checkout by reading .git files, so neither spends a hook's time budget on a process. In PostToolUse every agent dispatch record is written first, in one agent_dispatch_recorder.py call, whatever the budget; optional work runs only in the time left. A failed record or spool write makes the bridge exit 1, and a spooled message is removed only after the output carrying it was written. Claim and assign check and fast-forward a worker checkout under that lane's own lock, never under the bus lock every lane's hooks share.

Self-Healing, Self-Improving, and Direct Operator Steering

  • One lifecycle, repaired by every command: scripts/lane.sh is a thin wrapper over python3 scripts/lanes.py lane <command>, run from the primary checkout (a linked worktree's copy refuses, because the records every checkout shares name the primary checkout as their root), which owns each lane's lifecycle under the lane's flock. Every command (start, stop, attach, watch, send, status, and each heartbeat tick) first runs one reconcile(): it reads what actually exists (each launched process carries IMPOSSIBLE_OS_LANE_PROC=<writer|heartbeat>:<lane>:<token> and this repository's root in its environment; a process is running while its recorded PID has its recorded /proc start time; a zombie is dead; an entry that cannot be read counts as running, so nothing starts beside it and nothing signals it (a process on its way out, which briefly refuses the read of its environment, is waited out rather than called unknown); only the pane process of its own tagged session is ever adopted as a writer or heartbeat, so a tagged helper a crashed writer left behind is not; a recorded PID is kept only while it carries this lane's tag, and where it is reached and stopped (session, socket, pane) is read from the process, never from the record), repairs the lane's one record ($XDG_STATE_HOME/impossible-os/lanes/sessions/<lane>/life.json, written whole and atomically, never edited in place; a malformed one is rebuilt from what exists) and removes this repository's own launch sessions that no live process runs in, then acts in steps that are each safe to repeat. The record has one schema, with one check per field (type, range, a finite time, a string a subprocess can take (no NUL, encodable as an OS argument), an entry's complete shape as a registered process or a launch not yet registered); a field that fails it, or that the schema does not name, is dropped and rebuilt the same way, and a lane with nothing gets no record at all, so no checkout claims a lane it never used. A lane start reconciles with any pending stop still in place (so an interrupted stop is finished first), checks its launch settings, and binds the shared bus only once every refusing check has passed; only finishing a stop clears a stop request, never a start (so a stop published while a start runs is not lost), so a refused start leaves the bus unbound for another clone and the pending stop for the next command to finish. A command that uses a lane (status, send, attach) also restores supervision: an armed lane whose heartbeat is gone gets a new one, so an interrupted start never leaves a writer on its own. A stop first names all its target lanes in one atomic write (sessions/stop-request-<root hash>.json, one per repository, so clones sharing a state directory never act on each other's; a request no lane command wrote is reported as an error, never read as a stop of every lane), then records each lane's stop (stopping) before its teardown (a stop that leaves a lane with nothing removes its record, so no root stays claimed), and whichever lane command reconciles a named or stopping lane next finishes it (a heartbeat tick never does: its lane's heartbeat simply ends; a later start of a lane takes it off the request), so an interrupted stop never leaves a disarmed writer taking input. A launcher stopped by SIGINT, SIGTERM or SIGKILL at any point, or a writer that crashes, is repaired by the next lane command. Each launch gives the writer and the heartbeat a tmux session of their own, named for that launch; both sessions carry the PATH the start checked agy on, and the start records that PATH, the model it resolved and the heartbeat interval in life.json when it arms the lane, so a launch, a restored heartbeat and every recovery run the same executable with the same model and interval whoever issues the command; the writer's pane registers itself (lanes.py lane exec checks under the lane lock that the record names its own PID and launch token, then execs the writer with the same PID and start time), and input goes only to that registered pane. Stop and every rollback kill only the sessions tmux itself tags as this repository's launch sessions for that lane and kind (a recorded name only says which server to ask, so no record field can aim a kill elsewhere; a process is signalled only when /proc tags it as this lane's kind, never because a record names its PID, and an entry that cannot be classified stops the teardown before anything is killed), by exact name, never a window or a pane, and then rescan until no process with the lane's tag remains before releasing ownership, so an operator's windows in any other session (including one carrying a lane's base name) survive. A lane's launcher follows its engine in .conclave/lanes.toml: agy lanes run agy; a claude engine is allowed only on main, where lane.sh start hands the lane to scripts/run.sh start --engine claude (the single-lane runner, which supervises itself) and records no four-lane state, and lane.sh stop first tears down anything the four-lane lifecycle recorded for main (a four-lane writer started before the map changed), then runs scripts/run.sh stop once, last, with no lifecycle lock held. Every numeric lane setting (LANE_STOP_WAIT_SECS, LANE_REAP_SECS, LANE_IDLE_SECS) is read by one parser with one bound each; start and stop refuse an unusable value before they record anything, and finishing or repairing recorded state uses the default instead, so a bad setting never leaves a lane half-stopped. Each lane in the stop request carries when it was requested, and reconcile reads the request once: the stop it finishes is exactly the one it read, a newer stop published meanwhile stays in the request, and a start whose reconcile finished a stop requested after the start began refuses, so the stop that came last wins even when its own command was interrupted; a stop that finds its lane armed again under the lock stops it again before it reports success. The single-lane runner owns its own stop and nothing replays it from another shell or clone (a stop of a claude main reaches it even on a bus another clone owns, where this repository has no four-lane state): an interrupted or failed runner stop is finished by running lane.sh stop again, and run.sh stop refuses from a shell without a tmux client, reports success only once both its sessions are gone, and clears an active run phase whenever the four-lane orchestrator does not own it (so a retried stop clears what an interrupted one left), failing when that clear fails or when whether the orchestrator owns it cannot be told. The single-lane runner's identity (its tmux server and its two session names) is one record, .claude/state/run-identity: run.sh start resolves it under the main-runner lock before any ownership check and records it once every check has passed, right before anything is created (so a refused start leaves none; a start that finds the run already live records it too), and refuses one name for both sessions; the record has one format (three lines, an absolute socket path, two different session names from [A-Za-z0-9_-], all UTF-8, since tmux rewrites . and : in a session name), checked by one validator on whatever a start resolves, before anything is recorded or armed, and on every read, the same way in run-common.sh and lanes.py, and a record that breaks it is refused with what to fix, never read as "no record"; a start checks its saved conversation id before it records or arms anything; a session carrying the four-lane lifecycle tag is never taken for the runner's, whatever its name; every later step (stop, status, attach, its heartbeat, and four-lane admission when it looks for the runner) takes the identity from that record, never from the caller's environment, so a stop, status, attach or lane start from a shell on another server, or without the start's RUN_SESSION overrides, still finds the run. stop removes the record. With main configured for claude, lane.sh attach and watch hand over to run.sh attach and watch. The bus keeps an armed orchestrator's claims through a crash by the same record (lanes.life_armed). status checks bus ownership like every other lane command. A stop of a lane that has nothing (no record, no process, and nothing on this repository's own bus: no worker record, no claim, no main.json for main) writes no record and only retires its request; shared bus records are removed only under the bus lock, after checking the bus is still this repository's, so no stop can leave a record behind to block another clone; a lane that has something was started by its own clone, which bound the bus first. A start checks that the lane's record is this repository's, and that its heartbeat interval is a whole number of seconds from 1 to half the map's stale_secs and at most 86400, the one bound both the start and the record use (the bus declares a lane offline after stale_secs without a beat), before it binds the bus, and records its launch settings only when it arms a disarmed lane. Releasing a stopped lane's bus claims is part of its recorded stop, through lane_bus.py release-stopped <lane>, whose authority is the recorded stop itself, checked under the bus lock (the bus must already be bound to this repository, and the lane's lifecycle record must belong to this repository and show stopping true, armed false and no writer or heartbeat; it deletes only that lane's claims in states a stopped owner does not keep, keeps any claim one of the lane's own saved handoffs can reconnect (left for the orchestrator's reaper), and repairs nothing else, so any caller, a worker included, can finish a stop, while the general reap-stale --apply, which also repairs handoffs, keeps its orchestrator check): a lane stays stopping until the release is confirmed, so whichever command finishes the stop also releases the claims, and a stop whose release failed says so and exits nonzero. lane.sh stop goes on with the other lanes when one fails, and the single-lane runner stop still runs, once, last. Single-lane admission asks lanes.py lane busy, never a tmux session name, and admits run.sh only on its explicit idle answer (exit 3); it answers busy (0) only on positive evidence that a lane process runs or a lane is armed, and "cannot tell" (4) when uncertainty is the only evidence or a lock cannot be had, which admission treats as busy and run.sh stop as a reason to fail and keep the phase.
  • Every lane command runs under one deadline (the single-transaction lane lifecycle): a stop or start gets six times LANE_STOP_WAIT_SECS plus 30 s, every other command 30 s (LANE_COMMAND_SECS overrides it), and every wait it makes, the bus lock, the lane and runner locks, each tmux call, both phases of a process teardown (TERM takes at most half the time left, so KILL always runs) and a claude main's run.sh call, takes at most the time left. A command that runs out of time refuses with exit 2 and gives nothing up. A stop records all its targets in the stop journal in one write before it waits for anything; the journal keeps each lane's latest stop generation (a counter, not a clock), so a start admitted before a stop that has since finished still stays down. Every stop makes sure each target has a detached finisher (lanes.py lane finish-stop <lane>, outside every lane session) before and after it records the request, in one hold of the journal lock, so a stop killed at any step is finished with no other command. A lane has at most one owner and one waiting successor per repository: a stop that finds the owner alive starts the successor, which takes over when the owner leaves and reads the journal afresh, so the owner retires on its own clock (LANE_FINISH_SECS, one hour) and a suspended stop or owner never keeps one waiting. The finisher waits until no stop is running (each stop holds a shared lock for its life), then retries with backoff until the request is consumed. The journal, the lane records and the bus records are read with the bounded, nonblocking record reader, so a FIFO in their place never blocks a stop. A claude main's request is taken out only once both its four-lane teardown and run.sh stop succeeded; on a bus another clone owns, the stop and its finisher take the same decision (worker targets are confirmed empty and retired, the runner is stopped). run.sh runs under coreutils timeout, which ends it and its group at the deadline even if the lane command that called it was killed; a claude start passes the journal generation it was admitted on, and run.sh start refuses under the runner lock when a stop of main came after it (lane stopped-since). Git, bus and phase-guard helpers take only the time left, and a tmux server or session counts as gone only when tmux itself says so (a timeout or a permission error is "cannot tell", and ownership is kept). status all and a heartbeat round read each tmux server once; a teardown always lists afresh.
  • Self-healing and self-aware supervision: scripts/overnight/lane-heartbeat.sh runs lanes.py lane tick <lane> every LANE_HEARTBEAT_SECS: it refreshes the lane's bus heartbeat, preserves armed crash-recovering claims within the backoff recovery window, restarts a dead writer with exponential backoff while armed (escalating a worker's repeated deaths to main as a heal message), writes sessions/<lane>/health.json telemetry, nudges an idle writer in its registered pane only when work is pending and no writable client is attached (or attachment cannot be told), and on main runs lane_bus.py reap-stale --apply to heal abandoned claims, reconcile <lane>.json leases against claims.json, flush crashed landing/ecosystem notifications, or recover interrupted integration/rollback transitions. A recovery takes the main-runner lock before the lane lock, the order run.sh and every lane admission use. lane.sh stop clears a lane's ownership only after confirming its writer and heartbeat are gone. main and operator may send steer instructions via lane_bus.py message; workers direct note|heal|improve|optimize feedback to main.
  • Full keyboard and mouse control across all 5 lanes: Every tmux runner session (single-lane scripts/run.sh for Claude/agy plus all 4 Antigravity lanes in scripts/lane.sh) enforces fail-closed IMPOSSIBLE_OS_PRIMARY_ROOT session ownership, pins its writer pane ID (the single-lane runner in IMPOSSIBLE_OS_WRITER_PANE; each lane in its life.json record, written when the writer's pane registers itself), initializes history-limit 50000 before creating the pane along with mouse on, focus-events on, extended-keys on, and set-clipboard on, attaches read-write (attach, never -r), checks interactive attachment under the lane lock before sending any pinned-pane idle nudge, and supports direct command injection into 1 or all 4 Antigravity lanes via bash scripts/lane.sh send <lane|all> "<instruction>" (refused from worker checkouts or worker process trees).

Launchers and Desktop Shortcuts

bash scripts/lane.sh setup-worktrees
bash scripts/lane.sh start orchestrator    # or lane-1 | lane-2 | lane-3 | all
bash scripts/lane.sh status
bash scripts/lane.sh attach lane-1
bash scripts/lane.sh send all "focus on review findings first"
bash scripts/lane.sh stop all
bash scripts/lane-desktop.sh install       # creates the 4 Desktop Gemini campaign shortcuts

Switching Between Single-Lane Claude Campaign and 4-Lane Gemini

  • Single-lane scripts/run.sh (Claude Code or standalone agy) and 4-lane scripts/lane.sh share RUN_MAIN_LOCK (main-runner.lock) and refuse to start concurrently: stopping all 4 Gemini lanes (bash scripts/lane.sh stop all) clears their armed markers and reaps any abandoned worker or solo main claims before bash scripts/run.sh start, while stopping the single-lane campaign (bash scripts/run.sh stop) clears sequencer-armed and run-session locks before bash scripts/lane.sh start.
  • bash scripts/run.sh start refuses while any 4-lane Gemini session is running/armed or any handoff is mid-integration (integrating / rolling-back); queued ready worker handoffs remain safely parked on their lane/<lane> branches and their leased_paths stay protected from single-lane edits on main until Gemini Orchestrator integrates or releases them.
Impossible OS is free software under the GPL-3.0-only license. Last updated Privacy Edit this page on GitHub