Compare commits

...
Author SHA1 Message Date
dev-driver c99450f322 docs(release): drop the invented-request gap and correct the Slack line
The invented-request problem is addressed for 0.7.0, so it leaves the
known gaps. A Slack channel-mapping change needs a daemon restart; the
page no longer claims disable then enable does or doesn't reload it.
Enabling marks any alerts waiting to post as already seen
(seedBacklogAsHistory, queue-access.ts:106-109, called at
gateway.ts:292), so open exchanges miss them.
2026-10-23 09:00:55 +00:00
dev-driver 7e55c19a53 docs(codex): state that hook trust checks the files only when granted
A later edit to the cached hook scripts keeps the trust OpenRig granted
on first install, as with any hook trusted in Codex. The what's-new page
and the refocus channel reference now say so.
2026-10-23 08:41:28 +00:00
dev-driver 99aaada64c docs(release): 0.7.0 what's new, and a clearer managed-refresh log line
The what's-new page an agent reads after upgrading still described
0.6.12. It now lists what behaves differently from 0.6.14 and what to do
about it: the migrations and settings, the clean-start environment, the
plugin refresh and its copies, quiet hours and modes, rig names in
place of ids, restore and launch changes, the openrig-core plugin's
return to Codex seats with first-install hook trust, changed output, and
the known gaps.

The managed-refresh log line now says the file's previous contents were
preserved before the refresh, not that custom behaviour stopped: it runs
before any write, and a later copy failure can still skip the refresh.
2026-10-23 08:20:32 +00:00
dev-driver ac496208b0 fix(codex): trust only shipped core hooks on first install 2026-10-23 08:16:11 +00:00
dev-driver b3e03ed75b fix(daemon): preserve managed files before startup refresh 2026-10-23 07:06:21 +00:00
dev-driver a1cd9ebf3b fix(codex): keep fresh starts free of automatic plugin review 2026-10-23 06:29:24 +00:00
v-openrig-build 2fec738282 test: compose 0.7.0 candidate with startup identity framing 2026-10-22 09:11:13 +00:00
dev-driver 5380ca1070 Revert "fix(daemon): read a native install's version label as claude with an OS executable witness (#1345)"
This reverts commit 6c31f02706.
2026-10-22 03:36:20 +00:00
dev-driver a892e73df8 fix(daemon): wait for Claude's input box before a fresh seat's startup text (#1730)
A fresh Claude seat could be sent its first startup text before Claude had drawn its input box, and the text was then left unsent.

Now, before a fresh Claude start's first send (through `rig up`, an added or grown seat, `seat launch --fresh`, a continued fresh start or a managed launch), the startup orchestrator looks at the screen until the input box is drawn, using the startup check's own recognizer (`claudeInputBoxDrawn`, from `composerRegion`): at most 25 looks, 200 ms apart. If no box appears in that time, or the screen can't be read, the text is sent as it is today. That fallback is best effort: it doesn't guarantee the text is never sent early, and it isn't a startup pass. Readiness (`checkReady`, `native-resume-probe.ts`) and its callers are unchanged, and restores and later sends don't get this wait.

After the Enter, on every Claude orchestrator send, restore replay included, a screen with text but no input line is now looked at again within the same bound instead of reading unverified at once. If our exact text then shows staged, only the existing exact-own-text, submit-only retry acts; an empty box reads as submitted; a draft, a permission prompt or anything else stays unverified with no further Enter. There's no repaste.

Limits: handover successors start through their own launch and send path, so neither wait covers them. A fresh Claude start can take up to about 5 seconds longer when no box is drawn, and a send whose screen shows no input line after the Enter up to about 5 seconds more. Nothing is refused. Native launch wasn't run; it remains the acceptance check.

+139/-7 in 5 files: source +35/-5, tests +104/-2 (2.97 test lines per added source line).

(cherry picked from commit 5f64645e29)
2026-10-21 23:52:03 +00:00
dev-driver f3fad85e96 chore(release): prepare 0.7.0 version and installer pins 2026-10-21 20:48:22 +00:00
Mike Schwarz 616cecea08 feat(gateway): a person's account when a mode ends, the scheduled end, and the guidance to use them (#1715)
A mode applied with `--until` recorded its end time but nothing ended it, and there was no account of what happened while a person's mode was on.

Now, when a mode ends, by "I'm back" or at the end time they chose, the operator can give the person an account built from the records: the mode and its settings, which of their own newer choices still stand, what's pending or failed, the mode they're in now, each decision made for them and which can't be undone, and what's waiting for them. What no record supports, such as work done or failures elsewhere, is listed as not tracked. A late click on an ask that was already decided says who decided it and what. The operator explains a mode before its first use, and agents that would ask the person read the decision room first.

The account is read-only (`rig gateway human mode account <person> <applicationId>`) and reuses the existing mode, decision and hold reads. It shows only what was that person's: an ask that has since moved to someone else is listed as stale without its current summary or state, and an ask that was delivered to them and handled afterwards isn't listed. The scheduled end is a `mode-scheduled-end` policy on the existing watchdog engine, armed with the application and ending only that application. It creates at most one notice row (`qitem-mode-end-<applicationId>`): to the kernel operator, otherwise the seat that applied the mode if the queue accepts it, otherwise the person's own address as an update. If the person registry can't be read, the notice waits and is sent once it can; if no one can receive it, the job ends and records why. The queue's destination check moved from `startup.ts` into its own module, unchanged, so the timer can use it. The late-click reply goes through the same Slack escaping and redaction as the other replies. `mode apply --until` without `--tz` uses this machine's zone and says so. The guidance is in the kernel operator's `role.md` and `messaging-the-human`, mirrored, with the skill digests regenerated.

Limits: a mode applied with `--until` on main before this change has no timer and still ends only by hand (no published release had `mode apply --until`). The scheduled end runs on the 60-second cadence, and after downtime it ends on the first pass with both times in the account. Without quiet hours, an ask can still be posted between being created and decided; a late click then names the decision. Nothing that works today is refused; the account route's three errors (`application_not_found`, `still_on`, `modes_unavailable`) are its own. Native, real-Slack and operator journeys weren't run.

+948/-44 in 23 files: source +452/-38 (+37/-25 of it the destination check's move), tests +376/-3, guidance, docs and digests +120/-3.
2026-10-21 13:27:12 -07:00
Mike Schwarz 37b5f0242e fix(slack): preserve retained relays and report routing state (#1718)
With Slack forwarding between machines (`forwardChannels`), removing a forward entry could strand the relays a hub had retained, and status didn't show where a channel with no mapping goes.

Now retained relays stay visible and keep retrying the host they came from after their forward entry is removed. Status names the configured local routing fallback and its destination. A disabled connector's status counts all three inbound stores and says retry is paused; an enabled machine that only receives relayed events still reads as awaiting retry. A repeated `rig slack enable` stays a no-op and now says configuration and tokens weren't reloaded, pointing to a daemon restart, which keeps unposted alerts to a person (disabling and re-enabling would mark them seen).

`docs/reference/slack-app-setup.md` explains the pairing credential and says to let relays finish before editing forwarding entries. Zero retained records doesn't prove nothing is in flight. No quiesce step or channel-ownership mechanism is added.

Refs #1711. Tests use real wire, router and store code with synthetic HTTP and sockets, not live Slack or two real machines.

+102/-48 in 8 files: source +31/-38, tests +59/-8, docs +12/-2. Nothing that works today is refused.
2026-10-21 13:25:21 -07:00
Mike Schwarz c4c1aa3d87 docs(gateway): say what quiet hours do now, in the help and the Slack guide (#1720)
`rig gateway human quiet` still said delivery didn't act on quiet hours, which has been wrong since #1606. It now says: while on, routine asks to this person are held, not posted; urgent ones (tagged escalation) still reach them; held asks post once, each on its own, when quiet ends.

`docs/reference/slack-app-setup.md` gains "Quiet hours for a person (optional)", describing current behaviour only: what is held and what isn't (escalations, the operator rung, and the below-posting-level log-only case), that posts already confirmed or partly in Slack finish as themselves, and how held asks are released.

Text only, no behaviour change: one help line and about 20 lines of docs.
2026-10-21 13:00:50 -07:00
Mike Schwarz 5c3f99fed6 fix(daemon): record a cleared prompt as the ladder's own transition (#1719)
#1717 sends repeated watchdog prompt refusals up the wake ladder, and a run of refusals restarts after the ladder sees the seat's prompt clear. It recognised that clear by the alert's resolution text equalling `prompt cleared`. But a closing resolution is appended to any existing text, and `routeToFallback` writes `fallback: <reason>` there while the alert stays open, so after a reroute a real clear wasn't recognised and the next blocked episode at that seat stayed quiet.

Now, when the ladder retires a prompt alert because the prompt read clear, it first appends its own transition (actor `wake-ladder@system`, note `prompt escalation: the seat's prompt read clear`), and the run boundary requires that transition. The transition log is append-only, so a fallback reason can neither produce nor hide it. An alert retired because its episode ended while the prompt stayed blocked writes none, and `findWakeRecovery` and the retirement note are unchanged. The ladder's backoff ignores the new note.

A new case routes an open alert to a fallback, clears, re-blocks and expects one new alert after two refusals; the two-job case stays as the negative control. +23/-7 in 2 files: source +9/-7, tests +14/-0.
2026-10-21 12:52:21 -07:00
Mike Schwarz a2387d48d6 fix(daemon): send repeated watchdog prompt refusals up the wake ladder (#1717)
When a seat sits at a permission or selection prompt, its watchdog reminders are refused, and since #1713 the history records them as `refused`, but nobody was told. In one real case a two-hour reminder was refused six times in ten hours.

Now a reminder refused twice in a row at the same seat's prompt joins that seat's existing prompt alert (`advancePromptRefusals` in `queue-wake-ladder.ts`). It reaches the seat's orchestrator, the source of a `delegates_to` edge into it, or else the operator rung, which reaches a person. One alert per seat lists the job ids beside any queue rows the same prompt blocks, and a reminder that joins an existing alert is named in a transition note without anything being sent again. The blocked seat is never typed into or retried, and the parked-owner reminder is excluded because its refusals already arrive on rows.

The alert stands down when the prompt clears or the job's next attempt isn't a refusal at that seat. Its episode key names where the run starts: the job's latest other entry at that seat, or the seat's latest alert the ladder retired because the prompt read clear, whichever is later. So a run keeps one key however long it gets, a hand-closed alert stays closed, and a prompt that clears and comes back gets a new alert after two new refusals.

Limits: an alert that was routed to a fallback destination before its prompt cleared doesn't mark that clear, so the next blocked episode at that seat stays quiet until a reminder lands (a follow-up fixes it). After about 14 days of uninterrupted refusals, retention can remove the entry the key follows, and the alert repeats once.

+175/-12 in 2 files: source +74/-11 in `queue-wake-ladder.ts`, tests +101/-1.
2026-10-21 12:26:20 -07:00
Mike Schwarz 96e3c6b0f2 fix(daemon): record a refused or failed watchdog delivery as such, not sent (#1713)
`rig watchdog status` showed every watchdog delivery that wasn't held back as `sent`, including a reminder refused because the seat sat at a permission or selection prompt, and one that never reached tmux. A seat waiting at a first-use prompt refused its reminder six times in ten hours, and every attempt read `sent`.

Now a prompt refusal reads `refused`, any other failed delivery reads `failed`, and only a delivered reminder reads `sent`. The reason stays in `evaluationNotes.deliveryReason`.

The one writer of an attempt's outcome (`watchdog-policy-engine.ts`) maps it from the delivery status, using the parked-owner policy's existing refusal rule, now exported. The parked-owner policy skips only `skipped` and `terminal` entries, so it still sees refusals and failures, and its results are unchanged. The send path, its prompt protection, the schedule after an attempt and park wake receipts (which still need a delivered send) are unchanged.

Tests: four cases that pinned a failed or refused attempt as `sent` now expect `failed` or `refused`, and two fixtures write history the way the engine does. +20/-13 in 7 files (source +10/-5).
2026-10-21 11:19:52 -07:00
Mike Schwarz 34c931b325 test: keep Windows user homes inside the fixture (#1712)
On Windows, Node's `os.homedir()` follows `USERPROFILE`, not `HOME`, so the hermetic test setup's check that provider homes stay inside the fixture failed before any test ran, for anyone running the focused tests there.

The setup now sets `USERPROFILE` to the fixture user home on Windows, beside `HOME`, through a small function in the same file. The containment check is unchanged, and macOS and Linux get exactly the assignments they did before. Three cases check the environment the setup selects for each platform.

Test infrastructure only, +13/-1 in 2 files. Not run on real Windows: required CI runs on macOS and Linux.
2026-10-21 10:52:40 -07:00
Nash Aschenbath eed3a0e062 fix(daemon): reject terminal blocked_on queue closures (#1704)
The queue accepted `state=done` with `closureReason=blocked_on` and silently dropped the work it was meant to wait on.

That request is now rejected with HTTP 400 `invalid_closure_reason` before anything changes: no update, transition, nudge or completion effect. The message says `done` is final and shows the command to use instead, `rig queue block <id> --on <child>` (or `rig queue update <id> --state blocked --blocked-on <child>`). The same correction is returned for a row that's already done. Ordinary completions, the other closure reasons, handoffs and `blocked` records with `blocked_on` are unchanged, and existing rows aren't rewritten. The `queue-handoff` skill and the coordination doc now teach the block command for waiting on another item.
2026-10-21 10:10:14 -07:00
Mike Schwarz 6c31f02706 fix(daemon): read a native install's version label as claude with an OS executable witness (#1345)
A Claude seat installed with Claude's native installer on macOS, whose process is named by its version (for example `2.1.300`), is no longer marked as needing attention after a restore that resumed it, and `rig reconcile-session` no longer reports that its pane command doesn't confirm `claude-code`.

A version label stands for `claude` only for an unmanaged seat, and only with an OS executable witness: the pane's one foreground Claude is that version-named process in two samples, the OS reports its executable inside the installer's `versions` folder with a basename equal to its process name, and its command line names `claude` as the program. Managed seats, the managed launch's exact proof, shell labels and `claude` labels are unchanged. A path read that times out ends the witness for the rest of that wait.

Not yet run on a real Mac with the native installer; the tests stub the pane labels and process rows.

Refs #86
2026-10-21 10:07:45 -07:00
Mike Schwarz bad4d652cf fix(slack): reuse failed human notices as queue recovery (#1709)
A failed Slack ask should leave one recovery item for the asking agent. New gateway notices for unrenderable content or Slack `invalid_blocks` now carry the existing `recovery-for:` tag, so the stuck sweep reuses them instead of creating another item and wake. Workflow overdue exceptions keep their separate exception-owner route. A missing notice still permits sweep recovery; existing notices are not backfilled or closed.

Cost: source +7/-4, tests +28. No new registry, query, setting or refusal.
2026-10-21 10:05:46 -07:00
NIKHIL e9db17fbeb fix(cli): say a rig wasn't found in rig ps --host --rig, and list it in the exit codes (#1706)
`rig ps --host <id> --rig <name>` printed `[via host=…]` and an empty list, exiting 0, when that host had no rig of that name, unlike the local `rig ps --rig`.

Now it prints `Rig 'x' not found on host h. List rigs with: rig ps --host h` to stderr and exits 1; a name only an archived rig has points at `--include-archived`, with one extra read on that path only. `--json` keeps its empty result, and the check runs before other filters and `--summary`, so a real rig that a filter empties still lists. A failed rig lookup is reported as the fetch failure it is, not as "not found" (in the node view too). The help lists the exit code.
2026-10-21 09:55:43 -07:00
Mike Schwarz 58862b8c6f docs: let a person's explicit standing instruction decide prompts it covers (#1708)
When a person has told an agent outright that it may answer a kind of permission prompt for them, the kernel operator's guidance (`role.md` step 10) and the rigs skill's "Check it's ready" (both copies) now say the agent may answer the future prompts that instruction covers.

What stays: a yes to one prompt still isn't a yes to the next, the "don't ask again" rule, and step 10's existing permission choices. Nothing changes in code: no automatic yes, no polling, no prompt override and no native setting change.

Text only, +22/-3 in 3 files.
2026-10-21 09:53:38 -07:00
NIKHIL 925b828aa6 fix(cli): size rig snapshot list columns to their values (#1707)
`rig snapshot list` padded its columns to fixed widths (ID 27, Kind 8, Status 10). The `auto-pre-down` snapshot every `rig down` takes is 13 characters, so its Status and Created ran out from under their headings.

Each column now fits its widest value or heading, two spaces apart, and the last column is unpadded. The ids, kinds, statuses and times printed are unchanged; only the spacing differs.
2026-10-21 09:52:46 -07:00
Rudy Mizrahi Celekli 54239572d2 fix(cli): check bundle references have the expected file kind (#1118)
`rig bundle check` reported a directory named like a declared file (for example `README.md`) or a startup file as a readable document, so an invalid bundle passed the file check.

Now each declared path is checked for its kind: a declared file must be a regular file, a local agent ref must be a directory, and skill and resource paths keep their supported file-or-directory shape. A path of the wrong kind gets its own finding that names the kind found and the kind expected, and the check exits 1; a missing, unreadable or outside-folder path keeps its existing message. `openrig-home:` plugin sources are still left to the installing host, as before.
2026-10-21 09:51:25 -07:00
Mike Schwarz 9e7f1f57a5 feat(queue): decide on a person's behalf inside their mode's decision room, recorded as delegated (#1705)
When a person's active mode (asleep, away, out of office) has a decision room, the agent that would otherwise have asked them can now decide inside it with `rig gateway human mode decide`. The decision is recorded on the ask itself as made on the person's behalf, never as their answer: the room as it stood, the deciding agent, the choice and reason, and whether it can be undone. The ask closes, and if it hasn't been posted to them yet, it isn't. `rig gateway human mode room <person>` shows the current room, and `decisions` lists what was decided under one mode for when they're back.

A decision is refused, writing nothing, when there's no active mode or room, when the mode changed since the agent read it, for a permission prompt or an approval gate (by the gate tag or the tier), for anyone but the agent that asked, for a choice the ask didn't offer, and once the person has started answering. Answers a person gives are recorded exactly as before.

Limit: an ask is held back only while quiet hours are on, so with a room and no quiet hours it can reach Slack before the agent decides, and nothing is added to that thread yet.

Cost: source +275/-14, tests +256/-6, docs +3; one migration (a nullable column on queue items); the refusals are all on the new path.

Slice 04-B2 (0.7.0).
2026-10-21 09:39:16 -07:00
Mike Schwarz acf5b168c9 refactor: retry current parked-owner reminders at the input boundary (#1687)
A parked agent holding work could stop getting its reminder indefinitely: an earlier reserved or delivered attempt, or a failed write of its note, blocked every later one.

Now a reminder whose last attempt failed, ended unknown or was never recorded is tried again on the existing watchdog cadence while the seat stays parked, and a note or telemetry failure can't stop a current reminder. Two existing rules stay: a reminder recorded as delivered to the same known occupant isn't repeated until the work changes, and a seat refused at an interactive prompt keeps its existing recovery path instead of being re-sent every pass. Owner rotation counts attempts of every outcome, and an owner past the history window still gets its turn.

The managed-compaction check that already ran when the reminder was evaluated now also runs at the actual paste and Enter, for this reminder only, in ordinary and draft-aware delivery: a compaction that starts after the paste stops the Enter and keeps the honest partial result, instead of sending the reminder into the generic wake ladder. An ordinary /compact keeps its existing behaviour.

Cost: source net -39, tests net +95, docs +7. No new refusal, error code, schema or scheduler.

Slice 22 lane A (0.7.0).
2026-10-21 08:43:29 -07:00
Mike Schwarz 96f6eec53c fix(daemon): keep a launched seat when a one-off --env can't be cleared (#1693)
rig up --env KEY=VALUE adds a variable for one launch, and OpenRig then takes it back out of the tmux session's environment. When that cleanup failed, the launch was treated as failed and the seat that had started fine was torn down.

Now the seat keeps running. The launch warns, naming the variable (never its value) and the tmux command that would remove it, and until then a later terminal in that session would get it. The warning reaches the response and the CLI output on every path, including a launch where every seat stops at an attention gate. The rig-spec reference says so. The old cleanup-error plumbing is removed, so the change is net smaller.

Slice 22 lane D (0.7.0).
2026-10-21 08:14:02 -07:00
Mike Schwarz fcbad7e7e1 perf(daemon): read fresh-occupant relations through the node/type index (#1691)
rig status, the TUI's rig status refresh, the restore preview before rig up or rig restore, and the restore check all wait on readFreshOccupantRelations. It found a rig's seat.fresh_launched events with WHERE rig_id = ? AND type = ?, which only idx_events_rig_seq could serve, so SQLite read every event the rig had ever recorded, payload included. On a copy of a real install's database, the largest rig had 108,217 events (46 MB): 4-6 s per call cold, 33-51 ms warm. The status route makes this read two or three times per request.

The query now goes from the rig's nodes into each node's seat.fresh_launched events through idx_events_node_type_seq, keeping e.rig_id = ?. It takes 0-3 ms either way and returns the same rows: the only writer passes the seat's nodeId, and the event bus fills the node_id column from it. Three test fixtures that inserted these events with a null node_id, which no writer does, now set it as the daemon does.

Slice 22 lane B (0.7.0).
2026-10-21 08:03:14 -07:00
Mike Schwarz 5a44d4099b feat(activity): pi and omp seats read activity from their runner's turn events (#1695)
Since #1684, a pi or omp seat whose screen hadn't changed lately read unknown rather than a false idle, so it got no idle-triggered reminders and didn't count as free capacity. This change gives those seats real evidence from the turn events their runner already posts, through the existing activity service, with no new poller.

An idle or attention boundary from the runner now holds until its next event, so a seat that finished its turn reads idle and parked again. A working boundary expires to unknown after the usual hook window, so a dropped end-of-turn can't hold a seat working forever and a claimed row still becomes stalled-after-claim. A runner's exit reads unknown, turn_start reads active, and omp's non-final agent_end stays working. Each runner post carries a sequence number, so an older Stop that arrives after a newer start is dropped, and at daemon start each seat's newest record by that order is restored, so an idle seat gets its reminders back after a restart. Claude and Codex keep their 15-second window.

Two limits are stated in the PR: after a runner dies without reporting it, the seat keeps reading idle until its next event (the follow-up #1702 adds runner liveness), and the restart restore reads each runner seat's whole activity history once at daemon start (not bounded on a large history; unmeasured).

Slice 22 follow-up to #1684 (0.7.0).
2026-10-21 07:53:56 -07:00
NIKHIL 3ca573b978 fix(cli): say a rig wasn't found when rig ps --rig names no rig (#1690)
rig ps --rig <name> with a name that matches no rig printed "No rigs", "No nodes" or zero totals and exited 0, so a typo read as an empty fleet.

In text mode it now prints "Rig '<name>' not found. List rigs with: rig ps" and exits 1. An archived rig's name gets a pointer to rig ps --rig <name> --include-archived instead. The same holds for --nodes and --summary. --json keeps its empty array, and an existing rig that --filter or --active empties still shows its empty result. The help text's exit codes don't list this case yet; that's a small follow-up.

Thanks to @Nikhi00718 for the fix.
2026-10-21 07:42:56 -07:00
NIKHIL 946accfbf5 fix(cli): resolve a rig name in the MCP tools that take a rig (#1689)
The MCP tools that take a rig sent their argument to the daemon as an id, so an agent using MCP with the rig name it sees got "not found", and rig_down needed an id.

They now resolve it with the same resolveRigHandle the CLI uses, through one helper: an exact id comes first, one active name resolves to its rig, and a name two active rigs share returns isError with the rig_ambiguous object before any request. The tools are rig_down, rig_snapshot_create, rig_snapshot_list, rig_restore, rig_bind, rig_rig_nodes and rig_add.

One result changes: rig_snapshot_list with a handle that matches no rig now returns isError "Rig '<x>' not found" instead of an empty list. A known rig with no snapshots still returns an empty list, and a removed rig's id still lists the snapshots kept for it.

Thanks to @Nikhi00718 for the fix.
2026-10-21 07:42:29 -07:00
Mike Schwarz 85319501b0 feat(gateway): save a person's modes and record applying one, ending only what is still the mode's own (#1656)
A person can now save a mode such as "asleep", "away from desk" or "out of office". A mode holds their availability, their quiet hours and the decisions the team may make for them. They can switch it on, see what it changed, and end it ("I'm back"). Ending puts back only what is still the mode's own change: anything the person changed by hand in the meantime stays as they set it, and an away flag they turned off themselves during the mode stays off.

The commands are rig gateway human mode save | saved | apply | current | end, beside rig gateway human quiet. Each effect shows its real state: active, ended, kept (changed by the person since), pending or failed, and restores still owed from earlier modes stay listed until they're done. The existing rig mode commands are unchanged.

Migration 122 adds three tables (saved modes, applications, per-effect records) and changes no existing table. The registry writers keep a small per-person change record outside the person's file, so a mode can tell its own availability change from a later one with the same value; the file format and older readers are unchanged. The quiet-hours store gains one method that puts back an ended mark, so restoring earlier quiet hours never restarts tonight's quiet if the person had already ended it. A mode never changes permissions, native settings, work posture, lifecycle or the legacy mode bindings.

Refs #1606 and #1649. Slice 04 (0.7.0).
2026-10-21 07:38:31 -07:00
Nash Aschenbath 2d2132df8c fix(slack): persist invalid_blocks rejections per payload (#1703)
#47 reported a Slack notice silently failing with invalid_blocks when an evidence ref was a non-image https link. #89 (in 0.6.11) fixed that cause in the renderer. What remained, as the issue said, was the handling of an explicit rejection: Slack's invalid_blocks response was retried on every replay, failing the same way each time, with nothing telling the agent that sent it.

An explicit invalid_blocks response (HTTP 200 with that error) now leaves a durable rejection for the exact rendered payload (channel, text, blocks and thread), so replays and restarts don't post it again. The queue item stays undelivered, and the source seat gets one notice saying the payload was refused and must change. A corrected payload is a new attempt, and a newer corrected attempt whose response was lost isn't hidden by the older rejection. Transient errors, 429s and outcomes that can't be confirmed keep their existing retry and reconciliation. In a multipart ask, parts already posted stay posted, and a partly rejected ask is never marked delivered.

Thanks to @Aschenbath for the fix.
2026-10-21 07:37:04 -07:00
Dery Ferdika 20e5324658 fix(daemon): keep a stuck-sweep finding open while the ladder only suppresses reporting (#1449)
The stuck sweep stopped reporting a stuck row while the wake ladder held a marker for it, and that suppression had no end: a ladder that stopped working kept the row quiet indefinitely, and a finding whose problem had resolved could stay open.

Now the sweep records, in each pass, which candidates the ladder actually held back (only for the undelivered-wake and unclaimed-obligation kinds, and only where the ladder check is the reason the row is skipped, after the quiet-hours and already-notified filters), and keeps open only those findings. Every other kind resolves as before. The hold lasts at most the longer of 30 minutes and twice the ladder's configured retry interval (queue.wake_retry_interval_seconds, read once per sweep, with the existing 300-second fallback); an exhausted ladder releases at once, and a missing, invalid or future marker time fails open, so the finding is reported. Human-notice findings are never ladder-suppressed, so they resolve as on main.

Two results change: a ladder that has gone stale is reported again (including the operator rung while it waits on the engine), and a finding with a fresh marker stays open while that marker is current.

Thanks to @DeryFerd for the fix and for three careful rounds.
2026-10-21 07:33:30 -07:00
NIKHIL 5a2be9fe14 fix(ps): scope the --host rig view by --rig (#1698)
rig ps --host <h> --rig <name> showed every rig on the host in the rig view: the remote path ignored --rig, while the remote node view (rig ps --nodes) already filtered through the shared handler.

The remote rig view now applies the same name filter as the local view, before --filter, --summary and --limit, in text and --json. For anyone who passed --rig with --host, the output now holds only the named rig, which is what the flag says.

Thanks to @Nikhi00718 for the fix.
2026-10-21 07:17:00 -07:00
Mike Schwarz 0809810821 fix(daemon): let automatic compaction start again after a stopped preparation (#1694)
When a managed compaction preparation stopped on a failure, automatic compaction stayed off for that seat until someone intervened.

Now the automatic poll path can start a fresh attempt (new attempt id and map) once ten minutes have passed since the stop, after the existing gates; within the cooldown the hold stays. Two cases never reopen: a person's cancel stays final even when it arrives after a failure stop, and an attempt whose /compact submission is uncertain (its receipt was lost) is never retried automatically, because a second compaction before anyone knows whether the first landed is the expensive direction. Only an attempt stopped before /compact was sent is eligible.

Slice 22 lane D (0.7.0).
2026-10-21 07:14:17 -07:00
Mike Schwarz a2e6c27f0a fix(daemon): hold only the seat whose required startup file is missing (#1696)
Before this change, one seat whose required startup file was missing stopped the whole rig's restore: every seat stayed down until the file came back.

Now the restore holds only that seat. It isn't launched, its line in the result says why (the missing file, its path and how to fix it), and the rest of the rig restores, reported as partially_restored. Real rig-wide blockers, and a rig whose seats are all held, still stop before anything launches. rig up --existing prints the held seat's explanation on its line, as it already did for seats awaiting a decision. The as-built restore notes no longer list the missing startup file among the rig-wide blockers.

A follow-up is named in the PR: restore-check still treats this per-seat blocker as rig-level.

Slice 22 lane D (0.7.0).
2026-10-21 07:07:57 -07:00
Mike Schwarz cd12ccf4c6 perf(daemon): read health lineage tags once per evaluation (#1699)
/api/health (rig health, the TUI's System > Health) and /api/attention rebuild the health projection on every request. Its passive-ceremony source checked each busy handoff family for closed diagnosis boundaries with a separate full scan of queue_items by tag, and built the full row projection for every hit. On Build's live daemon, /api/health?limit=50 took about 2.1 s with about 32 such families; on a copy of the database, one family's scan took about 37 ms and all families' lineage rows read once take about 26 ms.

closedBoundaries now gets its rows from one read per evaluation (qitem_id and tags where tags mention health-lineage:), grouped by exact health-lineage tag, and no longer builds row projections, since it only used their ids. The 200-row limit and its health_passive_episode_history_truncated error, the transition reads and their limit, and the boundary parsing are unchanged. One difference: a row whose tags aren't valid JSON is skipped, where the old per-family json_each query failed the whole source.

Slice 22 lane B (0.7.0).
2026-10-21 07:04:52 -07:00
Mike Schwarz 685c2324b0 perf(daemon): read restore-usable snapshots by id, data on demand (#1697)
rig status, the TUI's status refresh, the restore preview, and rig restore or rig up without a snapshot id choose a rig's restore source with findLatestRestoreUsable, and restore also looks for a newer usable alternative with selectRestoreUsable. Both read every snapshot of the rig, data included, to choose one. On a copy of a real install's database, ranking the largest rig's 109 snapshots (17 MB of data) took about 206 ms; it now takes about 0.1 ms.

findLatestRestoreUsable now ranks with an id-only query on idx_snapshots_rig, then reads candidates by id until one decodes and is restore-usable (usually the first); the tolerant decode is kept, the winner is decoded once, and a row removed between the ranking and its read is skipped like an unusable one. selectRestoreUsable finds the newer alternative from id and created_at, reading data only for newer rows and stopping at the first usable one. Selection rules and results are unchanged; a new test pins that the rig-wide ranking reads no data, beside the existing selection tests.

Slice 22 lane B (0.7.0).
2026-10-21 06:44:38 -07:00
NIKHIL 95317b7f3c fix(cli): accept a rig name in rig archive, rig unarchive and rig release (#1688)
rig archive, rig unarchive and rig release sent their rig argument to the daemon as an id, so a rig's name answered "not found".

They now resolve it with the same resolveRigHandle that rig grow, rig remove and rig snapshot use. An exact id, including an archived rig's, comes first. A name resolves among active rigs for archive and release, and among archived rigs for unarchive, whose target is archived; resolveRigHandle takes that as an option, and every other caller keeps matching active names only. A name two rigs share stops with their ids before the request (rig_ambiguous with --json), so release --delete acts by name only on a single match. When the rig list can't be read, the handle goes to the daemon as given, as before. archive's "bring it back" hint prints the resolved id. The CLI reference rows say <rig>.

Thanks to @Nikhi00718 for the fix.
2026-10-21 06:29:22 -07:00
NIKHIL 3657af0b59 fix(cli): report a shared rig name as rig_ambiguous JSON in rig restore status --json (#1686)
rig restore status <id> --rig <name> --json, given a name two active rigs share, printed the ambiguity message as plain text on stderr and nothing on stdout, so an agent parsing --json got no JSON.

It now prints the same rig_ambiguous object the other rig-taking commands use under --json ({ ok, code, message, candidates }) and still exits 1. Without --json the text is unchanged. The other callers of the shared lookup (export, snapshot, restore apply) don't read the new candidates field.

Thanks to @Nikhi00718 for the fix.
2026-10-21 06:18:21 -07:00
Mike Schwarz b945a5eed3 fix(ps): a quiet omp seat reads unknown, not idle; one model line per runtime without a reader (#1684)
rig ps --nodes printed idle for omp seats whenever their pane had been quiet, while the daemon's own JSON said their activity was unknown. omp had no activity inventory of its own, so it fell back to the generic floor, where window sampling is authoritative and pane silence becomes idle-at-prompt, even for a seat mid-turn waiting on the model or a long tool call.

omp now gets the positive-only sampling community harnesses already have: a changing pane reads working, and a quiet one reads unknown, never idle. claude-code, codex, pi, terminal and stub keep their inventories.

This changes decisions for a quiet omp seat, not only the table: the parked-owner wake doesn't fire for it, the idle gate skips it, and it isn't counted as free capacity. A claimed row still becomes stalled-after-claim and gets its recovery item, and --wait-for-idle keeps its own probe. That trades false idles (wakes typed into busy panes, capacity counted wrongly) for no idle-triggered reminders on omp until runner turn events are read as evidence.

rig ps also printed one "Model (...)" line per seat for runtimes the model reader doesn't support; two or more such seats of one runtime now share one line listing every configured model with its count. A lone seat keeps its own line, and each seat's model is still in --full and the JSON.

Thanks to @rakoort for the report.
2026-10-21 05:15:21 -07:00
Mike Schwarz 13f324d180 fix: distinguish human notice failures from failed queue wakes (#1685)
When an agent claimed work and then parked it on a person, a human notice that was never posted was reported by the stuck sweep as "wake failed (claimed)" and sent to the agent's orchestrator, which couldn't act on it: the agent wake had worked, and re-waking the agent fixes nothing.

The sweep now files an undelivered-human-notice finding with the human leg, recipient and reason, and routes it to the agent responsible for that notice: the parking agent for a parked row, the asking agent for a direct ask, and the sender of a resolution notice. A stale agent-wake ladder no longer hides it. A genuinely failed agent wake keeps its existing escalation, wording and route, and quiet-hours custody and posted-notice suppression are unchanged. The sweep reports the delivery problem; it doesn't repost notices, re-park work or change what happens to backlog when Slack is enabled.

An already-open "wake failed (claimed)" finding for a row parked on a person stays with the orchestrator under its old wording; treat it as a human-notice failure and forward it to the parking agent rather than re-waking the agent or simply closing it.

Thanks to @rakoort for the report.
2026-10-21 05:05:13 -07:00
NIKHIL 740450d924 fix(cli): accept a rig name in rig shrink and rig expand (#1683)
rig shrink <rig> <pod> and rig expand <rig> <fragment> sent their rig argument to the daemon as an id, so a rig's name answered "Rig not found" for a running rig. rig grow and rig remove, which make the matching member-level changes, already take a name.

Both commands now resolve the argument with the same resolveRigHandle. An id goes to that id, one active name to its rig, and a name two active rigs share stops with their ids before anything changes (rig_ambiguous with --json, the shape rig remove uses). A handle that matches no rig, or a rig list that can't be read, still goes to the daemon as given. The CLI reference rows say <rig>.

Thanks to @Nikhi00718 for the fix.
2026-10-21 04:44:12 -07:00
NIKHIL c6175c4fe6 fix(cli): accept a rig name in rig snapshot, snapshot list, export and restore --rig (#1681)
rig snapshot, rig snapshot list, rig export and rig restore --rig (and restore status) sent their rig argument to the daemon as an id, so a rig's name answered "Rig not found", and rig snapshot list printed "No snapshots".

They now resolve it with the same resolveRigHandle that rig grow and rig remove use. An exact id, including an archived rig's, comes first; one active name resolves to its rig; a name two active rigs share stops with their ids before any snapshot, export or restore request. When the rig list can't be read, the handle goes to the daemon as given, as before. The daemon's cross-rig guard still refuses restoring one rig's snapshot into another.

One result changes for scripts: rig snapshot list <handle> now exits non-zero with "not found" when the rig list was read and no rig matches the handle by id or active name, where it used to print "No snapshots". A known rig with no snapshots still prints "No snapshots", and a removed rig's id still lists the snapshots kept for it. The CLI reference rows say <rig>.

Thanks to @Nikhi00718 for the fix.
2026-10-21 04:43:44 -07:00
Mike Schwarz ea211a1940 fix: retry current queue notifications during recovery (#1677)
A queue notification left failed or unconfirmed could stay unsent across a daemon restart even while its work was still pending. Recovery now makes one new guarded attempt for each current notification, keeping its original envelope and adding a notice that delivery may repeat after an earlier unsuccessful attempt. A notification that was never attempted gets no such notice. Queue changes and lifecycle actions aren't replayed.

The startup drain owns this recovery, including overdue workflow packets that were nudged before; packets without a recorded intent, and overdue work someone already claimed, keep their ordinary reminder. Claims left by an earlier process are reconciled before this process can start sending, so a send already in flight at startup keeps its claim. When a retry fails before writing anything, a notification whose earlier attempt may have landed stays unknown rather than failed.

Startup selects intents for current pending rows only, so history doesn't add per-row work, and one statement labels obsolete pending intents superseded without a send. Each pass has a fixed horizon and attempts each coalesced member once. Live sending claims, known deliveries and held or retired messages are untouched, and the existing recipient, occupant, prompt and draft checks still apply. Recovery runs at startup only; a large current backlog is sent in sequence, and recovery doesn't wait for a seat's compaction restore.
2026-10-21 04:41:19 -07:00
NIKHIL 516d9f2959 fix(cli): skip the thin-transcript note when a small --tail returns every line asked for (#1682)
rig transcript <seat> --tail N printed "note: only N line(s) captured ..." for every N of 5 or less, because the note fired whenever five or fewer non-empty lines were printed. A seat with a long, healthy transcript got it on each --tail 5, --tail 3 or --tail 1, pointing at a renderer problem that wasn't there.

The note now also needs the transcript to have returned fewer lines than were asked for, counting the tail route's default of 50 when --tail is absent or not positive. A thin capture read with the default tail, or with a tail larger than what was captured, still gets the note. Local and --host reads share the check, and --grep is unchanged.

Thanks to @Nikhi00718 for the fix.
2026-10-21 04:29:08 -07:00
Archie 07d4c9802f fix(cli): prune empty parent objects after config reset (#1638)
rig config reset <key> deleted the key but left the parent objects it emptied in the settings file, for example "transport": {}. The daemon's settings store, the other writer of the same file, behaved the same way.

Both now remove each ancestor the reset leaves empty, with the same function in the CLI's ConfigStore and the daemon's SettingsStore. A parent that still holds a sibling key stays, an empty object elsewhere in the file is left alone, and a keyless reset still removes the file. Resetting a feed-host subscription keeps its own early path, as before. config-atomic-write.test.ts, which runs every case for both stores, now expects the pruned result, and each store has unit tests for the prune, the kept sibling and the unrelated empty object.

Thanks to @arxh80 for the fix.
2026-10-21 04:10:25 -07:00
Mike Schwarz 5c6ed3b392 refactor: remove the subscription move record, which nothing acted on (#1672)
An agent could write a record after moving a Codex home's seats between subscriptions (rig provider moves record) and read it back (rig provider moves, rig provider moves show), behind the off-by-default provider.subscription_moves setting. Nothing acted on a record: no projection, health check, scheduler, launch or restore path read the event it wrote. Its only readers were its own read-back commands, the event-type union and the setting's declarations.

The module, its three routes, the three CLI commands, the setting (daemon, CLI and TUI) and the event type are removed, along with the CLI reference rows and the what-you-can-do sentence. Subscription moves themselves are untouched: rig provider status, rig provider precheck and rig provider switch, where the daemon runs a precheck-gated switch.

The openrig-user skill changes in two places. Its reporting step now has the agent report the same facts (home and machine, from and to, the reason, the readings, each seat's result with evidence, and the peers) to whoever asked for the move, as a queue item, instead of writing them to the removed record. Its "Manage subscriptions across a fleet" section applied only when the removed setting was on and the person had asked; it now applies when the person has asked, which remains the opt-in. The skill digests are regenerated.
2026-10-21 03:27:59 -07:00
Mike Schwarz 4ba32a02cf refactor(startup): drop the sha256 digests from startup submission diagnostics (#1675)
Each startup submission observation carried sha256 digests and byte counts of the expected prompt and the observed composer text, plus the first byte where they differed. Nothing read them back: the startup orchestrator reads only the observation's reason to word its warning, and the consumers of node.startup_ready and node.startup_failed read other fields.

The digests, byte counts and first-difference offset are removed from startupSubmissionEvidence(). The mismatch reason now comes from a plain comparison of the same whitespace-stripped texts the digests were taken over, so its values are unchanged. Each observation keeps its reason, the marker and closing-rule lines, the capture sizes and the phase.

Every submission warning and status is unchanged. Staged or clear, confirmation and the guarded Enter-only retry never read a digest. session-transport.ts isn't edited: its submitOnly refusal and the mismatch callback behave as before, and the callback receives the same evidence minus the digest fields.
2026-10-21 03:21:33 -07:00
Mike Schwarz 920941f194 refactor(slack): stop writing a receipt for rig slack verify (#1674)
rig slack verify wrote a started and an observed line to the channel-operations ledger. The only reader was the Connections projection, which turned the newest verify line into the TUI's "last check" line and could set the displayed state to failed or indeterminate. No delivery, readiness or routing decision read it, and a successful check never made the state ready.

verify no longer writes that receipt, and the projection no longer reads it. verify still checks granted scopes and membership of every mapped channel live, prints READY or NOT ready, exits 1 when not ready, and keeps its --json fields. The other ledger writers (enable, disable, configure, binding) keep their receipts, and lines written by earlier versions stay in the ledger and are ignored.

Two results change. --reason and --actor existed only to fill the receipt and are removed, so a script that passes them now gets an unknown-option error; the CLI reference lists --json only. Connections can no longer read failed or indeterminate because of an earlier verify: it shows unverified unless configuration or the running connector says otherwise, and points at rig slack verify --json. verify also no longer refuses when the ledger can't be written.
2026-10-21 03:15:15 -07:00
Mike Schwarz 9a954ff9f0 fix(cli): bundle check leaves openrig-home: plugin paths to the host (#1676)
rig bundle check sent every kind: local plugin source path to an in-bundle file read, so a plugin declared the way the agent-spec reference recommends, openrig-home:plugins/openrig-core, was reported as a declared file that is missing, unreadable or outside the bundle folder. openrig-home: paths are resolved on the host at launch, and their bytes aren't part of a bundle's digest.

A local source path that starts with openrig-home: now takes the existing host-resolved branch (host_resources: not_checked, checked at launch). A genuinely missing bundle-relative path is still a referenced_files finding; the test covers both. A registry check that runs bundle check can now pass a listed team that uses the recommended plugin form.
2026-10-21 02:59:35 -07:00
Mike Schwarz 865e7e2408 refactor(seat): drop the restart report's always-unknown billing route and process mode (#1673)
The rig seat restart report carried two fields that always read unknown: processMode, and billingRoute, which was filled by scanning the restarting process's environment for API-key variable names. Nothing acted on either: only the CLI's printer and the restart JSON read them, and the restart's finished event never stored them.

processMode and the environment-name scan are removed. billingRoute stays in the plan and report as a constant that says it isn't reported, because the human printer in CLIs before 0.7.0 reads its detail without a guard and would otherwise throw after a restart had already run, hiding the account and recovery lines. A comment marks it for removal once those CLIs are gone; the new CLI doesn't print it.

The restart's real checks are unchanged: the credential-store and auth.json account evidence, the startup gate, the approval, sandbox and bypass comparison before stopping, and --verify --expect-account. The --no-daemon line keeps its app-server caveat.
2026-10-21 02:58:41 -07:00
Mike Schwarz 39b182e19b docs(skills): review findings say consequence, path and evidence; simpler selected deep method (#1669)
The review-team skill opened proportionately, then demanded that every claim be verified and that unverified findings go unreported, and its deep method added a context-confidence admission step, every-finding cross-examination and a roundtable everyone had to post to. That turned reviews into rounds.

A material finding now says the user consequence, the affected path and how the reviewer knows (an observed result, source reasoning or an untested concern), and whether this change introduces, exposes or leaves the issue. Severity is kept separate from whether it blocks under the project's own acceptance rules, and a serious untested concern is labelled rather than dropped or turned into an automatic veto. Everyday review opens with two questions: does the change solve the user's problem with a maintainable design, and what about affected contracts, invalid input, state transitions, recovery, consumers and unnecessary duplication. Confidence scores and provider stereotypes are replaced by choosing reviewers for independence, capability and observed work.

For the explicitly selected deep method: reviewers form independent first views from the context and source, the decision owner then asks for evidence or a counterexample only on disagreements that could change the disposition, and the result is one disposition with severity, blocking rationale, evidence limits and any dissent kept visible. There is no fixed number of rounds, no requirement that everyone answer every finding, and preparing context is part of the review, not a gate before it. A protocol the project specifically selected stays controlling. Entry rules and explicit deep-review selection are unchanged; canonical and daemon copies are byte-identical, and the skill digests are regenerated.
2026-10-21 02:44:17 -07:00
Mike Schwarz 0b63f94137 docs(skills): one evidence-applicability rule for verification; refactoring and performance references (#1668)
The verification skill opened proportionately, then demanded fresh evidence in the current message for any claim, mandatory self-execution and a gate before every status, which turned ordinary progress into reruns. It now has one rule: before claiming a verifiable result, inspect evidence that supports that result for the candidate and environment you name; reuse an existing result while its inputs still hold, and rerun the check when they change or are uncertain; say whether you ran it or inspected another owner's evidence. Required project checks still apply, "tests pass" still needs output for the named candidate, and an agent's success message or a diff alone is still not evidence. The rationalization table and the fear paragraph are removed rather than answered with another layer.

The skills router's one-line summary of this skill now says the same, and its line for the review team names grounded findings. Two short cold references are added: refactoring, linked at the development team's build-and-verify step, and performance claims, linked from verification. They adapt methods from Cursor's pstack plugin, with attribution, and set no run count. Canonical and daemon copies are byte-identical, and the skill digests are regenerated.
2026-10-21 02:22:41 -07:00
Mike Schwarz b832a85b94 refactor: make terminal delivery receipts observational (#1667)
A terminal send could be stopped by its own delivery bookkeeping: a reused caller delivery ID, a draft hold that had since cleared, or an unreadable receipt could return an old result or refuse the send before any input was attempted. Receipt readback and the receipt eligibility gate are removed. Each current request makes a new input attempt; the existing per-seat lease still serializes input, and history stays available for held-message inspection as best-effort records that never grant permission to send. The CLI no longer generates deduplication IDs.

Queue wakes are now classified from the transport's own result (sent, input phase and explicit uncertainty reasons), so an interrupted paste or Enter stays indeterminate without a receipt summary. Queue nudges that carry no pre-assigned IDs check their actual queue row and intended destination immediately before input, including when bookkeeping is unavailable; committed wakes keep their frozen identity and blocker checks.

Changed results: reusing a caller ID no longer deduplicates explicit requests; confirmed success stays successful if its ledger update fails, with a warning; a caller abort before paste cancels input even after bookkeeping; a draft that blocks input and can't be saved is reported failed rather than durably held; send responses no longer carry a receipt-derived delivery summary. Human drafts, approval prompts, recipient and conversation identity, and stopped-runtime handling are unchanged, and no refusal is added. docs/reference/seat-delivery.md describes the new behaviour.
2026-10-21 02:21:08 -07:00
Mike Schwarz 6967c552a0 docs(skills): after a compaction restore, one paragraph on how to resume (#1670)
The compaction-restore skill told a restored agent when it may resume (after the read-depth table and the reconnect note exist) but not how. It now ends with a short "Then resume" section: resume the outcome the current instructions, standing duties and assigned work select; use existing records and the recap to recover the next action and the evidence already earned; check uncertain effects before replaying work; don't let available skills or historical suggestions widen scope or create required stages; use authorized help within your remit; and route a missing decision to its owner while continuing unaffected work.

It replaces a guardrail that repeated the skill's own hold check, its post-read check for a new hold, and its reconnect step's "if a hold stands, the next step is waiting". Those three still say a hold binds. The skill digest is regenerated.
2026-10-21 02:07:14 -07:00
Mike Schwarz 23ffc03cb5 fix(daemon): run runtime probes and the skill audit without holding the event loop (#1664)
Four runtime probes ran a blocking execSync inside an async function: the plan preflight, the pod-aware import preflight, the Codex launch and restore profile probe, and the Codex resume probe. Each held the daemon's event loop for the probe's whole run, about 0.4-0.9 s measured and up to 10 s for a hung probe, so health checks and every seat waited behind it. The skills audit also read every SKILL.md synchronously.

The probes now go through one small async helper that runs the same command with the same cwd, environment, 10 s timeout and closed input, under the existing timing sites. A probe that times out still reports ETIMEDOUT. The audit reads with fs/promises, with the same roots, order, shadowing and rejection reasons.

Still synchronous, and not changed here: a named-skill lookup that misses falls back to the full scan, and catalog traversal and YAML parsing stay synchronous (one catalog measured at about 0.1 s per member warm). The two loop-gap tests use a 500 ms threshold. Refs #1653.
2026-10-21 01:59:01 -07:00
Mike Schwarz 4ee6e7a9bd fix(daemon): team agents run ordinary rig commands without a prompt (#1665)
Team agents launched with the team permission default were asked to approve 42 rig commands. They're now asked about 29.

These 15 no longer prompt, since none starts, stops or removes a team or agent: archive, unarchive, adopt, attach, bind, unclaim, release, reconcile-session, config set, config reset, seat continue, seat clean, seat switch-client, seat set-model and seat set-effort.

Two gain a prompt: seat restart, which stops and resumes a seat, and policy permissions apply, which is policy apply under another spelling and previously didn't prompt. The commands that start, stop or remove teams or agents still ask. So do import (its --instantiate mode launches nodes), setup (its --policy path records a permission choice), compact (it replaces a peer's working context), and policy apply and seat set-permissions (an explicit permission choice stays with a person).

The list has one source, TEAM_CLAUDE_ASK in kernel-authority.ts, and the tests write out the expected lists instead of deriving them from it. The adapters-and-runtimes reference describes the new behaviour.
2026-10-21 01:28:03 -07:00
NIKHIL 5b5ed8c04b fix(daemon): reject independent readiness changes before compaction (#1368)
The context monitor could act on a readiness snapshot that another reader had already changed, so a managed compaction could proceed past an independent readiness change. It now rechecks the snapshot before compaction and defers when an independent readiness change has landed, while its own readiness writes don't count against it. A seat whose readiness changed keeps its usage telemetry. A two-session regression test covers one seat's change not affecting another's.

Thanks to @Nikhi00718 for the fix.
2026-10-21 01:03:36 -07:00
Nash Aschenbath 8bad2f5a01 fix(test): isolate provider homes outside native Codex e2e files (#1586)
The test setup left `CLAUDE_CONFIG_DIR` and the passwd home outside the fixture, and exporting `OPENRIG_E2E_REAL_CODEX=1` turned off home isolation for the whole run, so ordinary suites could read or write a developer's real provider homes.

Ordinary suites now stay fixture-scoped even with the real-Codex opt-in exported; the exception is limited to the native Codex end-to-end files. Inherited provider roots (`CODEX_HOME`, `CLAUDE_CONFIG_DIR`) are isolated, while a provider home a test passes explicitly in its `baseEnv` is kept, so scenario environments that set one on purpose still work. Default Codex thread discovery now follows `HOME` (`os.homedir()`) instead of the passwd entry, so it stays inside the fixture too. `docs/as-built/test-layers.md` describes the layers.

Thanks to @AdamWhitehurst for the report and to @Aschenbath for the fix.
2026-10-21 00:57:54 -07:00
Mike Schwarz d2a6704788 fix: retry current watchdog reminders after interrupted accounting (#1666)
A watchdog reminder that was due could be suppressed by its own delivery bookkeeping: an earlier attempt's failed, unknown or delivered record, legacy adoption, or an interrupted digest could make the watchdog return the old result, or skip the whole digest, without calling the transport, so the reminder never arrived.

The watchdog adapter's receipt veto, its legacy adoption and digest prebinding, and the engine's receipt-veto callbacks are removed. A reminder that's currently due now reaches an ordinary idle input prompt with its current continuation, and with a notice that it may repeat if an earlier attempt's outcome was unconfirmed. A digest sends every member that's still due.

What stays: the transport's recipient and conversation checks, approval and draft holds, the current job, park and target-generation checks, scheduler timing and stop controls. Structured continuity actions keep their own idempotence, and an unknown write still reports as unknown. Policy thresholds and conditions are unchanged. `docs/reference/seat-delivery.md` describes the new behaviour.
2026-10-21 00:35:21 -07:00
Mike Schwarz 644c6ddc25 fix: defer parked-owner wake until managed restore finishes (#1662)
A parked-owner watchdog wake could tell an agent to resume its task work after its managed `/compact` boundary but before the restore request, so an agent that obeyed would work from its compaction summary before restoring. The daemon already knows it still owes that seat its turn boundary, restore and audit.

The parked-owner policy now defers that owner's pass while the shared compaction enforcer has a pending post-compact stage, from the submitted `/compact` until the audit prompt is sent. It skips before reserving a wake, so nothing is consumed and the unchanged row is eligible again on a later pass; it keeps checking other owners in the same pass. Explicit cancellation and occupant invalidation also clear the pending stage. Preparation before submission and peer sends are unchanged, and there's no elapsed-time guess or new scheduler. A deferred pass is recorded in the job's history as `managed-compaction-pending`.

The check runs when the policy decides to wake a seat. A wake admitted just before a `/compact` is accepted can still wait on the seat's delivery lease and land after the boundary, because delivery doesn't check again; closing that window belongs with the planned rework of how watchdog wakes are delivered and recorded.
2026-10-21 00:05:13 -07:00
Mike Schwarz 7d49696ade fix: resolve only a profile's named skills; rig up --plan waits like an apply (#1658)
Resolving a member used to read and parse every SKILL.md in every skill folder for its runtime, once per member, synchronously on the daemon's event loop. With tens of thousands of skills in a user folder, `rig up <spec> --plan` stopped `/healthz` and every other request for every seat on the machine for 10 to 20 seconds per plan, and launch and restore paid the same cost. Now a member's resolution looks up only the skills its profile names, at `<root>/<name>/SKILL.md`, in the same root order, and falls back to the full scan only when a named skill isn't found that way, so folders named differently from their skill still resolve and a broken named skill gets the same rejection message. One change in precedence: a folder whose name doesn't match its skill in an earlier root no longer outranks a correctly named folder in a later root.

`rig up --plan` now waits 120 seconds, the same as an apply, locally and with `--host`; it used the client's 5-second default, so a plan with slow profile probes reported a timeout with an unknown outcome while the daemon finished it. If the daemon still doesn't answer a plan, the CLI says the plan created or changed no rig or seat and is safe to run again, and exits 1; with `--json` it prints `ok: false`, `plan: true`, `changed: false` and a message. Locally that covers a timeout; with `--host` it also covers a request that may have arrived without an answer or an unreadable reply. An apply that times out keeps its existing guidance and, with `--host`, `outcomeUnknown: true`.

Other work can still block the daemon during a plan: the runtime profile probes (`execSync` inside an async wrapper, up to 10 seconds each), the managed catalog scan, and the skills listing route.
2026-10-20 23:44:50 -07:00
Mike Schwarz a989009d06 docs: put the quick way first on the getting-started page (#1661)
The getting-started page for people (`docs/reference/quickstart.md`) opened with two short paragraphs and then explained how the pieces fit and what you need before showing any step to take, so on a phone the first screen was all explanation.

The section "The quick way: let your coding agent do it" now comes directly after the introduction, ahead of "How the pieces fit" and "What you need". Only the order changes, plus one pointer: the section's "(see above)" now links to What you need, because the Node.js help it points to comes after it. Headings are unchanged, so every anchor still resolves.
2026-10-20 23:38:16 -07:00
Mike Schwarz 8735358614 fix: allow cancellation of submitted managed compaction (#1660)
A managed compaction whose `/compact` was interrupted (for example, the person kept typing) used to stay at `compact-sent` with an unconfirmed result. `rig compact --cancel` didn't clear it, and every new `rig compact` for that seat was refused as already in progress until the daemon restarted.

Now `--cancel` also disarms an attempt that has already sent `/compact`: the pending turn-boundary, restore and audit steps are cancelled, the attempt keeps its unconfirmed result and its restore-map path, and the cancel sends nothing to the seat. Work from the cancelled attempt that resumes after a wait can no longer type into the seat or bring the stage back. A new explicit `rig compact` then starts a fresh preparation and map, and its `/compact` still waits until the live pane reads idle; a stale idle signal can't stand in for that. Cancelling doesn't start an automatic compaction.

Nothing in the code can tell an attempt that never compacted from one that is compacting slowly, so no expiry or guess was added. If the seat may have compacted, it now gets no restore request on its own: the cancel response and `--cancel` help say to check the pane and, if it compacted or it's unclear, send it a normal restore request naming `preparation.mapPath` (asking it to skip the reading if it didn't compact), because a retry would compact it again.
2026-10-20 23:17:41 -07:00
NIKHIL a6f577c2c7 fix(terminal): number a re-opened Herdr view instead of duplicating its name (#1637)
Every `rig terminal open` with Herdr creates a fresh workspace on purpose. Herdr accepts a duplicate label, so opening the same rig's view three times gave three workspaces all named after the rig, each reported as `ok: true`; the numbered suffix was used only when Herdr refused the label. The Herdr adapter now lists the existing workspaces first and gives a re-opened view the next free number, so each workspace's name is unique. The daemon and TUI tests pin the list-then-create order.
2026-10-20 22:18:19 -07:00
NIKHIL 4ba1291141 fix(refocus): cap the failure reason in a retried refocus label (#1651)
When a post-compaction refocus fails, the next prompt retries it and its label quotes why the last attempt failed. A long reason, such as a traceback from the trace script, used to ride into that label whole. The saved reason is now capped at 300 characters, ending in "…", and the failed attempt's own TRACE GAP line still shows the full text. A test drives a long stderr through the trace and checks both.
2026-10-20 22:14:36 -07:00
Mike Schwarz bf579d5f89 fix(cli): send the real request to a busy daemon; refuse only one confirmed down (#1650)
Commands no longer refuse a daemon that is busy but alive. The CLI's status check before each command refused whenever it couldn't confirm the daemon was healthy, so right after a slow request an ordinary command such as `rig ps --nodes -A`, `rig capture` or `rig context profile` failed in about 128 ms with "Daemon did not respond — it may be busy or stopped". Now a daemon that isn't confirmed down gets the real request, under its normal timeout. A daemon confirmed down (stopped, stale, or a refused probe) keeps the clear "not running" message and start hint, and a probe the OS blocks and a live sibling home keep their own guidance.

When a write then times out, it says the outcome is unknown and to check before any retry, including in the commands that catch their own errors (context, agent-image, specs, scope and fork). Each write is sent once and never retried. `rig start`'s UI health read is bounded at 5 seconds.

`rig up` and `rig start` start a daemon when one is stopped or stale, or for a live sibling home or a blocked probe, as before. They no longer start one for a busy daemon of this home, which used to get a false "already running", or past an explicit HOME-MOVED marker. GitHub bundle imports still require a verified local daemon, and `rig status --json` is unchanged.
2026-10-20 22:06:43 -07:00
Mike Schwarz eb2018f7fc feat(queue): read an ask held for quiet hours honestly in custody (#1649)
An ask that quiet hours held now reads honestly wherever the queue judges it. The stuck sweep, the wake ladder and the waiting view share one read-only custody reader built from the notes the quiet-hours release writes:
- a held ask reads held until quiet ends, and the held text names that end, not the next quiet start;
- a released ask reads released while its post is in flight;
- a release whose post failed reads as a failed release, and the sweep reports it as an undelivered wake until a receipt arrives, including after a later re-dispatch of the same notification;
- a hold whose release job is gone reads orphaned.

An ask blocked on a person shows its quiet custody as its next backstop and keeps its real blocker. The release job writes one dispatch note per release cycle, so an ask returned to quiet and released again reads released. A custody read that fails reads as held for that pass rather than escalating during quiet.
2026-10-20 21:21:44 -07:00
Quentin Machu dd2ef730e7 perf(cli): keep 10000 rows of tmux history in rig setup's managed block (#1264)
`rig setup` wrote `set -g history-limit 50000` into its managed tmux block. It now writes the value of a new setting, `terminal.history_limit`: default 10000, an integer from 2000 to 1000000, overridable with `OPENRIG_TERMINAL_HISTORY_LIMIT`. To keep more, run `rig config set terminal.history_limit 50000` and rerun `rig setup`. A later `history-limit` line of your own in `~/.tmux.conf` still wins.

A running tmux server keeps its old limit until it restarts or you run `tmux source-file ~/.tmux.conf`; before tmux 3.7 that changes new panes only. `rig setup --help`, `rig config --help` and getting-started say so.

At 10000 rows an attached pane and the TUI terminal view keep less scrollback than at 50000, and `rig capture --lines N` reads up to that depth. Transcripts at the default `transcripts.lines` of 1000 are unaffected. The setting appears in the settings API, `rig config` and the TUI's settings view.
2026-10-20 20:33:56 -07:00
Mike Schwarz 0e59307c1b feat(daemon): accept a host's learned self-id on queue forwards (#1642) (#1648)
A queue write addressed to a host's own self-id (`member@rig@<self-id>`, as a reply hint shows it) now reaches that host when the daemon the command reaches has learned that self-id itself. Before, `rig queue create`, `handoff` and `handoff-and-complete` always refused it as an unknown host.

- **Where the learning comes from:** `rig host doctor <alias>` already records the self-id a host reports at its own URL. It now also records that URL. The daemon's shared queue forward reads those bindings from its own home only, and uses one only when the binding's recorded URL equals the host entry's current URL and no conflicting observation was recorded.
- **Precedence:** the daemon's own self-id and local destinations come first, then a registry id, then a declared `hostId`, then an eligible learned binding.
- **Everything else stays refused before any forward:** a binding learned without a URL (every binding from before this change), an entry whose URL changed, a recorded conflict, an SSH entry, or a binding only in the CLI's home. The refusal names the reason and the fix (`rig host doctor <alias>` from the daemon's home, or `--host <alias>`). With no bindings file, the refusal is unchanged.
- **Unchanged:** `rig send`, placement and every other host lookup; there is no resend, retry or new handshake. A matching URL is what makes a binding eligible; it isn't a live identity check.
- **Doctor:** a contradicting observation never attaches its URL to the stored identity, and a recorded conflict stays until the binding is deleted and re-learned.

Bindings learned before this change carry no URL, so they need a fresh `rig host doctor <alias>` from the same home before this applies.

The tests run the compiled CLI as a separate process against real daemon routes and counting remote hosts: an eligible create writes one row; both handoff verbs create one successor and close the source once, and a re-run absorbs; every ineligible case forwards and writes nothing on all three verbs; a dropped answer makes exactly one request with no retry.

Refs #1642
2026-10-20 18:53:09 -07:00
Mike Schwarz f55aecdf02 fix(cli): explain an unknown-host queue refusal and when no row was created (#1642) (#1646)
When `rig queue create`, `rig queue handoff` or `rig queue handoff-and-complete` is refused because the daemon doesn't know the host named in the destination or `--host`, the refusal now says what happened and what to try instead. The refusal itself is unchanged: one write, the same exit code and the same JSON on stdout.

- **A qualified hint, on stderr:** when the daemon refuses the exact host token as unknown and this CLI's own host registry resolves that token to a different entry, the CLI names that entry and shows only the substitution (the address form or `--host <id>`, matching what was given; for create, keeping the same `--id`). It says plainly that this is what the CLI's registry here resolves, which doesn't prove the daemon reached through `OPENRIG_URL` means the same host. Nothing is resent.
- **"No row was created", for create only:** printed only after a refusal that comes before any host is contacted or any row is written (an unknown host, an unsupported transport or an unreadable registry when forwarding, or an unknown destination rig locally). It never appears after a timeout, an indeterminate result, a remote or auth error, an internal error, a dropped connection, or any handoff.
- **Not fixed here:** queue writes still don't accept a host's own self-id as an address, unlike `rig send`.

The tests run the compiled CLI as a separate process against real daemon routes and stores, including an alias that names a different host on the daemon (nothing reaches it), a daemon that declares the self-id (one write, no hint), and both handoff verbs (no successor; the source row unchanged).

Refs #1642
2026-10-20 17:09:41 -07:00
Mike Schwarz b9d8804091 feat(gateway): quiet hours hold routine asks and release them when quiet ends (#1606)
While a person has quiet hours set (`rig gateway human quiet set …`), agents' routine asks to them are held instead of posting. When quiet ends, each one that is still current is released on its own. Urgent asks (escalations) are decided exactly as outside quiet.

- **During quiet:** every routine ask that would post is held, in every delivery class. Nothing posts or mentions, with one exception: a post split into several Slack messages whose first message reached Slack before quiet began may finish its remaining messages in its original thread. Escalations post at once, keep away's 30-minute deferral, and post without a mention for someone who is off.
- **When quiet ends** (at the window's end, on `quiet end` or on `quiet clear`): each held ask that is still current posts through the ordinary Slack path, with its full brief and reply link and no mention. An ask whose situation changed gets a visible disposition on its row instead: closed, replaced by a newer notification, recipient changed, or now below the posting threshold.
- **Carried over:** extending or replacing the window releases nothing early, and an ask already in the 4h or daily digest is held when the digest comes round during quiet.
- **When quiet can't be read:** an ask or digest that was already attempted stays in flight; one never attempted is acknowledged and offered again.
- **Outside quiet:** every decision and the digest are unchanged.

Builds on #1584. The tests use the real delivery engine, dispatch buffer and digest flush with a recording Slack transport; native runs and real Slack were not exercised.
2026-10-20 17:05:03 -07:00
Mike Schwarz 9e6a070cc6 fix: keep proved current stops on existing rig up (#1644)
On `rig up --existing`, an agent its person provably stopped on purpose now stays stopped until they start it themselves, instead of being given a fresh conversation. The founder chose this behaviour.

- **What counts as proof:** the node's newest session is exited with its deliberate-stop flag set, the same session is absent and exited in the snapshot, its native identity matches, and its newest occupant tenure is an original (`initial`) one. A seat that was restored before still qualifies. An older session's stop never holds a newer occupant, and handed-over, adopted, terminal, detached, legacy, missing-tenure or different-identity seats don't get the hold.
- **What the person sees:** preview and apply both name the held seat and the command to start it, `rig seat launch '<logical>@<rig>' --fresh --reason "<why>"`. With no usable saved snapshot, the preview derives the same occupancy the apply's capture would and gives the same reason, writing nothing.
- **Scope:** only explicit existing-rig up, from the CLI and from Explorer. Unattended startup and direct snapshot restore keep today's policy. `rig up --fresh` still starts a fresh conversation on purpose, and the earlier protection for fresh occupants is unchanged. Other seats come back normally and the partial result keeps its shape. Explorer's fresh preview now forwards its selection, matching apply.
- **Known limit:** occupant tenures carry no session reference and are recorded best-effort, so the tenure is tied to the session by recency; after a failed later adopt or handover record, that occupant could be read as the earlier original one. This needs a tenure-ledger write failure.

No new state or schema. The tests use real SQLite and application routes; native lifecycle behaviour was not run.
2026-10-20 16:36:34 -07:00
Mike Schwarz 04a0546236 docs(skills): use a queue write's response; capture a peer only when its screen is needed (#1645)
Three openrig-core skills now say when an agent can rely on what a queue write already returned, and when it should look at a peer's screen, so agents make fewer redundant calls without dropping a check that matters.

- **After a queue write** (`openrig-user`, with a pointer in `queue-handoff`): use the write's response when it shows what you need; create, claim and update return the row, and handoff returns both rows. Read the row back when the response doesn't show it: an INDETERMINATE outcome or `qitem_body_not_saved` (reconcile by the original ID before any retry), compact or truncated output, a transition note or successor the output omits, or downstream evidence such as the recipient's wake or a later claim. A team rule that asks for a read-back still applies.
- **Checking peers** (`forming-an-openrig-mental-model`): start from `rig ps --nodes` and the queue, and capture a peer only when you need to see its screen.

Unchanged: the check before resending after an ambiguous result, identity checks after restore, handover and boot, held-row checks, the operator-relay capture, the capture before answering a prompt, and outcome and consumption verification. The skill digest file is regenerated by `mirror-skills`. Guidance only; no runtime or permission change.
2026-10-20 16:27:08 -07:00
Mike Schwarz d1f9a68cb5 fix(refocus): parse pasted envelopes in linear time (#1643)
The refocus hook that runs on every Claude prompt unwrapped a pasted-content envelope with one regex whose overlapping whitespace and wildcard quantifiers sat ahead of an exact closing tag and the end of input. When the closing tag was missing, or text followed it, a long whitespace run made the match backtrack heavily: two 64,000-space prompts ran the real hook past a 2-second kill.

The parse is now linear: an anchored match of the opening tag and its id, an exact check that the prompt ends with the matching closing tag, a length guard so the two can't overlap, then slice and trim. A prompt that is exactly one complete envelope with a matching id is unwrapped as before; anything else is the prompt as given. Codex prompts are unchanged.

Two real-hook cases (a missing close, and text after the close) now finish in about 33 ms under a 2-second process deadline, and the existing managed-refocus controls (wrapped restore requests, mismatched ids, quoted requests, the post-compaction acknowledgement) keep their results.
2026-10-20 16:06:50 -07:00
Mike Schwarz 9c903e6ba6 docs: name the declared-sender route for a send from outside a seat (#1640)
A `rig send` from a shell outside a managed seat arrives as `<unknown sender>`, and the notice the sender got said to send from a seat shell or state an identity in the body. It now names the two routes that already work.

- **A declared sender:** `rig queue create --source <you>@external --destination <seat> --summary "<one line>" --body-file <file>`. The row records the name as declared (`claimed:v1`), the receiving seat's wake shows it in `From:`, and a person registered with the gateway gets a reply route.
- **Joining a seat:** `eval "$(rig attach --self --rig <rigId> --node <logicalId> --print-env)"`, after which that shell's sends carry the seat's name. `rig attach --help` covers adding the shell as a new member.

Where it's said: the sender notice (it keeps "Follow up and sign it"), `rig send --help`, and both copies of the `rigs` skill, which also say a declared name is a claim, so the attached shell is the route for a team that acts only on seat identity.

Text only; no behaviour changes.
2026-10-20 15:11:55 -07:00
Mike Schwarz 2f4499e742 docs(cli): rig launch leaves a running node alone; point to rig seat launch (#1639)
`rig launch`'s description said "Launch or relaunch a node in a running rig", but a node that's already running is left alone ("already running … (not relaunched)"). The help now says what it does, and points a person who wants a fresh occupant for a running seat to the command that exists.

- **The description:** "Launch a node in a running rig, unless it's already running". The help after the options names `rig seat launch <seat> --fresh --stop --reason <why>`, with `--plan` to preview it.
- **The already-running message** adds one line with a command that runs as printed: `rig seat launch <logicalId>@<rig name>` when the rig was named, else the bare logical id. `--json` output is unchanged.
- **The `openrig-user` skill:** its two `rig launch` lines said "relaunches"; they now say it launches a seat that isn't running and name the same route. The skill's recorded digest in `scripts/skill-edge-digests.generated.json` is updated to match.

Text only; no behaviour changes.
2026-10-20 14:39:24 -07:00
Mike Schwarz bee9d021f4 fix(daemon): a seat added to a running rig gets the rig's culture and startup (#1632)
A seat added to an existing rig by `rig expand`, `rig grow` or add-member didn't get the rig's `culture_file` or its rig-level `startup` files and actions, because after launch the rig's declaration wasn't stored anywhere the expansion could read. Restore replays each seat's stored startup context, so the gap stayed on every later restore.

- **Stored at creation:** migration 121 adds `rigs.startup_layers_json`, holding the spec's `culture_file` and rig `startup` block as declared, plus the absolute root they resolve against. It's written when a rig is created from a spec, the same way the rig's permission policy is stored and inherited.
- **Used for added seats:** when the launching spec declares no rig layers (an added seat), the stored ones are used, resolved against the stored root, on the agent path, the terminal path and first-start retry. Seats declared in the original spec are unchanged. Pod and member files still resolve against the launch's own root.
- **Restore:** a seat added after this change carries the entries in its stored startup context, so its restores keep them.
- **Existing rigs:** nothing is backfilled. Their added seats keep today's behaviour until the rig is next created from its spec.

Not separately tested: the create branch of re-materialization, the terminal path, first-start retry, a stored root that no longer exists, an existing database's migration and a completed restore. The tests cover original launch, then expansion and add-member, then the persisted startup context and the Claude guidance projection. `rig export` dropping these layers is a separate issue (#1631).
2026-10-20 12:59:21 -07:00
NIKHIL 4178169507 fix(refocus): label a retried post-compaction refocus as a retry (#1635)
When a post-compaction refocus fails (a trace gap, a content reference that can't be read, or an output write error), it stays pending and is retried on a later turn. The retry used to be labelled "just compacted — your picture is lossy", so it read as a second compaction and didn't say why the first attempt failed.

It's now labelled "retrying the post-compaction refocus; the last attempt failed: <reason>", for example "trace gap: trace exited 1".

- **The reason** is saved in the refocus state as `pendingFailure` when an attempt fails: the trace's reason first, then a content-reference failure, then the output write error. A successful refocus and a new compaction both clear it.
- **Compatibility:** an older state file without `pendingFailure` keeps the old label until its next failure; a corrupt state is a new baseline, as before.
- **Unchanged:** the trace text, content precedence, thresholds, budgets and the other labels.
2026-10-20 12:53:17 -07:00
Proactiva ccdce88eb6 fix(daemon): probe TCP wait targets without an external nc (#1574)
A rig spec's `services.wait_for` TCP target used to be probed with `nc -z`, so on a machine without `nc` every TCP wait failed. A numeric port is now probed with Node's own socket (connect, idle timeout and error handling, with the socket cleaned up; IPv6 brackets and host names supported).

- **Named ports** such as `db:postgresql` keep exactly today's `nc` command where `nc` exists. That includes names starting with a digit, such as `9pfs`, as long as they contain a letter and don't start with `-`. Without `nc`, a named port fails readiness with "uses a named port, which needs nc on PATH. Install nc or use a numeric port".
- **A malformed target**, such as `host:0`, an out-of-range port or an empty host, now says "is not host:port with a port from 1 to 65535 or a service name" instead of reading like a closed port.
- **An unreachable target** keeps the plain "TCP probe failed: <target>".

Both launch and restore readiness reach the probe through `evaluateWaitTargets`.
2026-10-20 12:27:46 -07:00
Konstantin | Systems & Quant Architect bcee956ec7 fix(daemon): say why the startup proof line was held back (#1623) (#1630)
When a Claude seat's startup prompt can't be confirmed submitted, OpenRig holds back the extra line that asks the agent to run its startup check, so nothing is typed over input that may still be in the box. The warning used to read "Startup proof instruction was not sent: the startup prompt was not confirmed submitted", which looked like a failed start.

It now says that only that one line was held back, that the startup prompt itself was sent, and why its submission couldn't be confirmed: the prompt still looked staged in the input box, the input box couldn't be observed, it didn't clearly show the prompt as submitted, or the guarded Enter retry didn't go through.

The hold-back condition is unchanged; this changes only the warning's text.
2026-10-20 11:58:33 -07:00
Konstantin | Systems & Quant Architect 4e2474ad93 fix(cli): honor --with-source on rig config get (#1618) (#1628)
`rig config get <key> --with-source` printed only the value. `--with-source` is the parent `config` command's option, which Commander accepts on either side of `get`, but `get` never read it. It now reads it from the parent's options, as it already did for `--json`, and prints the same `value<TAB>(source: …)` line as `--show-source`, in both flag positions.

`--json` is still checked first, so `--json --with-source` prints the JSON object as before. Plain `get`, `--show-source` and `--json` are unchanged. A new test drives the real command parsing in both positions.
2026-10-20 10:34:10 -07:00
Solomon Wakhungu 8f66ee4b88 fix(daemon): retain queue wake input-box diagnostics (#1555)
A queue wake used to drop the input-box reading returned by its verified send. The wake now keeps it, and `rig queue show --json` exposes it as `lastNudgeInputBox`, so a wake whose exact text is still in the input box can be told apart from a busy seat or a collapsed paste.

- **Storage:** one nullable column, `queue_items.last_nudge_input_box` (migration 116, registered between 115 and 117), holding only the four structured fields. Every recorded attempt replaces the reading or clears it when none was returned, and delayed and coalesced wakes keep their own send's reading.
- **Latest attempt only:** the stored reading carries its attempt's timestamp and reads as unknown unless that is still the row's latest attempt. So after a downgrade and re-upgrade, an older daemon's later attempt can't show an earlier attempt's reading.
- **Malformed readings:** a reading with a value outside the known seat states or reading kinds, or a non-boolean `sameProcess`, is dropped on write and reads as unknown.
- **Unchanged:** delivery results, pickup and claim presentation, wake scheduling, retries and closure. Compact lists elide the field.

The reading is diagnostic only. It isn't covered by a native terminal run; the stub runtime can't produce verified input-box evidence.

Refs #1278.
2026-10-20 09:52:24 -07:00
Mike Schwarz 7296063795 test: wait for complete shell fixture output (#1627)
Three daemon tests waited only for a shell fixture's output file to exist, then read it. A redirection or `writeFileSync` creates the file before writing it, so a read in between saw an empty file and failed intermittently.

- **`tmux-agent-environment.test.ts`:** `waitFile` keeps its bound but returns only once the file ends in a newline, which all five writers now print last, and it throws on timeout. A fake-timer case checks that an empty or partial file doesn't resolve it.
- **`claude-executable-foreground.test.ts`:** the recorder writes its JSON to a `.part` file and renames it into place.
- **`transcript-seat-env-native.test.ts`:** the fixture writes its environment to a `.part` file and moves it into place.

Test-only; no runtime file changes, and every payload assertion is unchanged.
2026-10-20 09:28:31 -07:00
Mike Schwarz a25cd1c341 fix(daemon): advance owed compaction stages on fresh high usage (#1625)
A post-compaction restore or audit could stay owed while fresh context samples stayed above the trigger threshold, since restore reads can push usage over a low threshold themselves. The enforcer now advances the existing owed stage before the new-trigger threshold and dedup checks, using the same authorization, occupant-generation and idle and delivery guards.

- **Readiness:** for a missing sample or one at or above the threshold, the stage's send uses pane-only readiness, so no hook authorises it. A busy, timer-less or unreadable pane keeps the stage pending until the pane itself reads idle.
- **Unchanged:** below-threshold and ordinary sends; boundary, restore and audit ordering; a refused or retained send leaves the same stage pending; the cooldown and the sample-less path.
- **Changed results:** a fresh high sample can now deliver an already-owed stage instead of returning trigger dedup, and can surface the existing stale-generation result sooner. It doesn't start a second compaction.

**Limit:** an audit completed on a high sample doesn't re-arm automatic compaction, so after a restore that lands at or above the threshold, usage must fall below it before a new trigger. The tests drive the real context monitor, stores, enforcer and transport over inert tmux observations, not a native Claude compaction.
2026-10-20 08:58:05 -07:00
Mike Schwarz ef176945be perf(daemon): read held seats, latest snapshots and recent transitions through their indexes (#1619)
An open `rig tui` refreshes through the rig summary, each rig's nodes and recent transitions, and `rig ps` uses the same inventory read. Three reads behind those routes scanned far more than they return. Each now reads through an index that already exists, with no schema change.

- **A held seat's later restores:** the read now states the restore index's own condition, so SQLite uses it instead of reading every later event of the rig. The two-type filter is unchanged, and a later `restore.outcome_reconciled` still leaves a hold in place.
- **The latest snapshot per rig:** the subquery runs once per rig that has snapshots, not once per snapshot row.
- **Instance-scope recent transitions:** the scope matches each session column on its own covering index and reads ids from the primary-key index (`UNION ALL`, since a `UNION` makes SQLite scan the table to merge in rowid order).

On a copy of a long-lived install's database (1.55M events, 27k queue items), the held-seat read went from 2.25 s cold to 0.3 ms, and recent transitions from 19,897 pages to 913. Old and new queries return identical rows on that copy, and new tests pin each plan from the statements the reads prepare.

Not changed: `rig seat clear-attention`'s restore-history read and the rig status route's fresh-launch read, which don't run on a TUI refresh of a running rig.
2026-10-20 08:41:15 -07:00
NIKHIL 27f0129d41 fix(daemon): report workflow wake recovery attempts truthfully (#1626)
The workflow startup sweep's result field `lostNudgesReissued` becomes `lostNudgeRecoveryAttempts`, and its log line reports "lost-nudge recovery attempt(s)". A retained, delivered or terminal wake intent can go through recovery without sending anything, so the old name and text overstated what happened.

- **The count:** one per pending packet with no recorded nudge attempt, counted just before it's routed through recovery.
- **Unchanged:** delivery behaviour. The result type is internal to the daemon, and startup only logs it.
- **Tests:** the seven durable-intent states assert the new count and log text, with a send only for the pending state.
2026-10-20 08:24:37 -07:00
NIKHIL 753119f2c0 fix(daemon): give recurring watchdog fires distinct delivery identities (#1583)
Recurring watchdog policies now include the job's last fire time in a delivery's identity, so each cadence gets its own receipt. A later fire with identical text is sent instead of being treated as a repeat of the first delivery.

- **Condition-based occurrences** (a policy that records a condition receipt) keep the condition-derived identity, so a stop between recording the evaluation and recording the condition receipt doesn't send again.
- **Unchanged:** periodic-reminder and context-usage-threshold identities, parked-owner suppression, and the park-entry continuation text.
- **Upgrade:** a recurring job's old-format identity is carried separately. Recovery adopts an unfinished old-format attempt only for the cadence that is recovering it, binding it through the existing outbox tags, and a later cadence gets a new identity.

**Limit:** an unmarked pre-upgrade receipt is adopted once, so one due cadence after upgrade can consume an already-accounted old receipt instead of sending. Later cadences use new identities. No new timer, retry, schema or store.
2026-10-20 08:18:16 -07:00
Mike Schwarz 83f32d3ce8 fix(daemon): read fresh-launch fences through the node/type index (#1617)
The fleet-wide inventory read behind `rig ps` and `/api/rigs/summary` (and so each `rig tui` refresh) runs `readReadyFreshLaunchFences`. Since #1527, SQLite planned its `JOIN events … ORDER BY e.seq` as a full scan of the events table: on a long-lived install that was about 75,800 pages per call, 7.5-10.5 s cold and about 0.12 s warm. The per-rig form was already indexed.

`CROSS JOIN` keeps the same inner join and forces SQLite to read `events` through `idx_events_node_type_seq` for each current tenure: about 110 pages and a few milliseconds, with the same rows in the same order. The fence logic is unchanged.

A new plan test captures the fence statements that the fleet and per-rig inventory reads actually prepare and checks that both seek `events` by node and type; it fails on the old query.
2026-10-20 08:08:07 -07:00
Mike Schwarz db91ccd966 fix(daemon): verify wrapper-launched Claude model records with both PIDs (#1624)
The model-divergence check could not verify a Claude seat launched through a shell wrapper: the identity verdict recorded the Claude child's PID, and the current-model reader compared it with the pane's root PID, so every such seat read UNCHECKED.

- **Both PIDs are recorded:** a nullable migration (119) adds the pane root beside the matched native child, written by both the periodic identity reconciler and the rebind verifier. `evidence.observedPanePid` is a new additive field.
- **The reader:** keeps the pane-root equality guard, and when the matched process is not the pane root, requires it to still be a Claude descendant of the current pane root. The generation, boot-time, binding, sidecar, ambiguity and predecessor checks are unchanged, and there is no newest-transcript fallback.
- **Effect:** supported wrapper and child pairs now reach the existing model comparator (MATCH or DIVERGED) instead of UNCHECKED. A replaced or moved child, or a replaced pane root, still gives no answer.
- **Upgrade:** existing verdicts read the new column as empty and keep the old check until the reconciler refreshes them; nothing is guessed from the child PID.

Settling once per generation in the divergence monitor is unchanged.
2026-10-20 08:02:58 -07:00
Adam Whitehurst 771f1b0723 fix(daemon): let the sweepers prove a Claude seat that has no launch record (#1554)
The sweepers (the context monitor's startup normalisation and the send/capture reconcile) now pass a Claude seat's real binding (pane, session, current occupant) and its recorded resume token to the Claude adapter.

- **After a daemon restart, or with no launch record:** a seat left in `attention_required` or `failed` on an auto-mode screen with no "Claude Code v" banner is proved the way `rig seat clear-attention` proves it, and the existing status flip promotes it, without a person clearing attention.
- **On the same daemon:** because the monitor now passes the real binding, a seat whose launch record still matches can also be promoted by the monitor through the existing same-daemon launch proof.
- **A requested-token hold:** when the seat's latest `node.startup_failed` names a requested resume token, a promotion that this no-launch proof makes is held if the observed process is on another conversation. It applies only to such promotions (`provedWithoutLaunch`).
- **Unchanged:** existing screen results, the pending startup-text gate and the transport recovery gates. `continueStartup` is not changed, since delivering saved startup text is a different consequence from changing a status.

**Cost and limits:** for a flagged, banner-less Claude seat with no launch record, each sweeper check makes two process listings and two pane listings, plus up to three PID reads per attempted fallback, and repeats for a seat that keeps failing. There is no process-reader deadline, a transport timeout does not cancel it, and recovery within 30 seconds is not guaranteed. The shared process lister may resolve executable paths.

Refs #1477.
2026-10-20 08:00:07 -07:00
Mike Schwarz 5e89ccf0aa feat(queue): a park wake shows the park's recorded continuation (#1603)
When a parked row's `--wake-after` timer fires, the wake now shows what the owner recorded it would do next, so it doesn't have to open the row to find out.

- **A lone park wake** adds `Recorded continuation: <the continuation, on one line>` and one line of guidance: check the row's current state and blocker first, then resume only that work, or park it again with a wake.
- **A long continuation** is cut at 300 characters and says so, naming `rig queue show <id> --full` for the rest.
- **A digest** (several parks for one seat due in one scheduler pass) previews each row under its own line, then gives the guidance once.
- **Only the current park's continuation shows;** an earlier park's plan never resurfaces.
- **Unchanged:** a park with no recorded continuation, an explicit wake message (sent verbatim, outside digests), other reminders, and timing, receipts, supersession and digest accounting. The stored timer message stays the default, so digest eligibility is the same.
- **After a daemon restart,** a recovered wake keeps the body it was bound with and types nothing new, and its history records that body.

The preview text lives in `park-wake-text.ts` and is added at send time.
2026-10-20 06:47:23 -07:00
Mike Schwarz 76839b261f fix(daemon): restore siblings of a deliberately stopped fresh seat (#1605)
After a fresh-launched seat is deliberately stopped, `rig up <rig> --existing` can now restore its siblings from the newer, accurate pre-down snapshot instead of refusing.

- **The stopped seat stays stopped,** including with no resume token or a `relaunch_fresh` policy. It is reported as awaiting an explicit launch decision.
- **The exception is narrow:** it needs the current fresh-generation relation, the deliberate-stop flag and the exact exited session and native history, with the seat explicitly absent in the snapshot. Stale, foreign and ambiguous snapshots keep their refusals, an earlier all-running snapshot is never chosen, and the saved snapshot format is unchanged.
- **Daemon start** still restores only a kernel whose seats are all detached, so a kernel with a deliberately stopped seat is not brought back automatically.
- **Wording:** the mismatch message now describes current occupant state ("does not match current occupant state") rather than assuming an older occupant. The refusal status and code are unchanged.

The same shared check drives snapshot selection, the `--plan` preview and the restore itself.
2026-10-20 06:38:12 -07:00
Mike Schwarz cf00cda216 test(cli): separate HTTP error cases from chatroom wait deadline (#1609)
Test only. Four `rig chatroom wait` cases in `chatroom.test.ts` check how an HTTP error from the daemon (404, 500, 503 with an empty or null body) is reported. They used a 0.05-second `--timeout`, which could expire before the stubbed error was reported, so the test sometimes saw the timeout instead. They now use 30 seconds, so each ends on the stubbed error. Fractional deadlines are still tested by their own cases.
2026-10-20 06:30:20 -07:00
Mike Schwarz d6038a381c fix(tui): read less often while the activity stream is connected (#1602)
An idle `rig tui` now reads the daemon much less often while its activity stream is connected.

- **Activity pushes:** a burst of activity events leads to at most one refresh per 15 seconds, plus one trailing refresh so the last change still shows.
- **Quiet refresh:** every 5 minutes while the activity stream is connected; every 30 seconds after the stream drops or while it is unavailable, as before.
- **Freshness mark:** the page reads as out of date only after its quiet window plus 30 seconds (60 seconds without the stream, 5.5 minutes with it). A failed read, a read error or a dropped stream still marks it at once.
- **Asked-for refreshes** (navigating, actions, a daemon start) still run immediately.
- **With #1600:** when the TUI and daemon builds differ, no background read runs, a waiting activity refresh is cancelled, and later activity events do not refresh.

TUI only: no daemon change and no new refusal.
2026-10-20 06:27:09 -07:00
Mike Schwarz 783b100460 test(daemon): read the real-shell fixture's files only once its hook has finished (#1608)
Test only. In the real-shell foreground test, the pane hook wrote its status file before the parent and lookup files, and the test read all three as soon as the status file appeared, so a run could read an empty file. The hook now saves the exit status first and writes the status file last, and the test waits for a complete status line before reading the other two. It covers bash, zsh, dash and ksh as before.
2026-10-20 06:21:58 -07:00
Mike Schwarz 6e5a36ae20 test: remove the reply deadline race from tmux client-exit chain (#1607)
Test only. The `tmuxControlExec` case "fails a chain's write whose client ended after an earlier command, without writing the rest to it" raced a 50 ms reply deadline against the test's 50 ms poll, so it could fail with "no reply within 50 ms" instead of the client-ended error. It now runs with a frozen clock (`now: () => 0`), as the load-buffer case already does, and asserts the same outcome.
2026-10-20 06:00:57 -07:00
Mike Schwarz 3ed102d029 fix(tui): stop background refresh when the daemon's build differs (#1600)
A `rig tui` left open through a daemon upgrade or restart now notices when its build differs from the daemon's, and stops reading in the background.

- **On the first connect and every activity-stream reconnect,** the TUI compares its build (the version and commit `rig tui` passes it) with the daemon's `/healthz` `semver` and `commit`.
- **Same build:** nothing changes.
- **Different build:** the status line leads with the action, for example "Restart rig tui: daemon is now 0.6.12 (9e5382dd); auto-refresh off.", and fits an 80-column terminal. The quiet refresh and the activity-stream refreshes stop until the TUI is restarted; a refresh the person asks for, by navigating, still runs.
- **Unknown:** an unstamped TUI (a development build) or a `/healthz` that can't be read changes nothing; a failed read retries twice, 15 seconds apart.

TUI only: no daemon change and no new refusal. An old TUI's reads were the cost a long-open TUI put on a newer daemon; reading less while idle on the same build comes separately.
2026-10-20 05:50:05 -07:00
haralez 7278d5a71c fix(daemon): restore a kernel a reboot left down on daemon start (#1081)
Daemon start restores a managed kernel whose terminals were lost (for example after a reboot), while deliberate stops stay stopped.

- **Startup:** a kernel whose seats are all detached and still bound to their newest sessions is restored in the background through the same snapshot selection and restore pipeline as `rig up kernel --existing`. Live, partly stopped, unclaimed and otherwise indeterminate kernels are left alone, and `OPENRIG_NO_KERNEL=1` stays authoritative. Other rigs keep their explicit start behaviour.
- **Status and `rig start`:** kernel status tells a restore in progress from one that finished and derives readiness from the seats actually running. `rig start` carries on with other rigs while the kernel restores, and exits unsuccessfully with a recovery command if the restore finished without a ready kernel.
- **A stop wins:** `rig down kernel` during the startup restore waits, then stops what the attempt left, keeping the deliberate-stop record. An explicit `rig down` of any rig whose tmux server is gone starts an empty server and probes again, and records the stop and clears the binding only when the session is positively absent; it may leave an empty tmux server running and never launches an agent.
- **Joining:** an equivalent explicit `up`, including one that repeats the saved non-interruptive choice, joins the automatic attempt during or after it while its launched occupants still hold their seats, rechecked after every wait. The Explorer up route shares this.
- **Explicit overrides:** `up --fresh <seats>` replaces only the named seats still held by startup's sessions; after an operator corrects a seat's conversation target, an explicit `up` or `restore` replaces that seat; a different non-interruptive choice after startup launched agents is refused, explaining that the rig must be stopped and the command rerun.

Built and carried through five review rounds by @haralez.
2026-10-20 05:27:59 -07:00
Mike Schwarz 6f493e1361 fix(restart): keep --verify's account check independent of trimmed history (#1589)
`rig seat restart --verify` checks that the restarted seat came back on the expected account by counting new `Account:` lines in the pane. tmux trims old history (10,000 lines by default), so counting from a fixed position could miss or invent a move. The check now records where its baseline sits:

- **Captures that line up:** the baseline counts from the anchor's known position, so trimmed history can't hide or fake a new Account line.
- **Readable captures that don't line up:** it records a whole-pane baseline and compares the whole pane, as before this change.
- **An unreadable capture** stays unknown and verify reports it as not observed.

Process identity, the completed tool turn and the expected-account checks are unchanged. Older restart events keep the old comparison. A whole-pane comparison can still miss a real move after heavy trimming. `capturePaneHistoryParts` reads history size, history and the whole pane in one chained tmux call.
2026-10-20 05:23:03 -07:00
okle100 1f2a670122 fix(terminal): recognize Pi agents in Herdr views (#1592)
Pi seats opened in Herdr through nested tmux attachments now carry the `HERDR_AGENT=pi` hint, so Herdr can recognize them in its Agents pane, as it already does for Claude Code and Codex. The shared layout helper previously supplied hints only for Claude and Codex. Existing attachment commands, quoting and fallback behaviour are unchanged.

The composed-view regression now includes Pi and an unknown-runtime seat beside the existing Claude, Codex, terminal and blank-pane cases.
2026-10-20 05:16:38 -07:00
Mike Schwarz 86607334d6 feat(gateway): store and show a person's quiet hours (#1584)
A person, or the operator agent acting for them, can set quiet hours and read them back:

- `rig gateway human quiet set <person> --daily HH:MM-HH:MM --tz <zone>` (may cross midnight) or `--until HH:MM`; `quiet show`; `quiet end` ("I'm back": ends the quiet that's on now, tomorrow's rule stays); `quiet clear` (removes the rule).
- **The read-back** gives the rule, its timezone, who set it, whether quiet is on now, and the actual next boundary, correct across midnight and daylight-saving changes. A window that falls wholly inside a skipped hour is skipped rather than advertised as the next start.
- **`rig gateway human list`** shows the person's availability (`available`, `focus`, `away` or `off`) and a quiet line; if the daemon can't be reached, the quiet line says so.
- **Without `--tz`**, a successful `quiet set` says which zone it stored and suggests `--tz` for the person's own zone.

Storage is one quiet window per person (migration 118) with a revision, so later work can tell a stale schedule from the current one. This change only stores and shows quiet hours: delivery doesn't act on them yet.
2026-10-20 05:01:09 -07:00
Mike Schwarz 1dec6981b0 docs: name the missing-pane repair where people meet the problem (#1594)
The missing-pane repair (`rig reconcile-session --repair-missing-pane`) is named where people meet the problem:

- **The compaction refusal** for a protected seat with no recorded pane says both fixes refuse while typing protection is on, how to turn it off and back on with the person's agreement, that the repair keeps the session and resume token, and that plain reconcile adopts into a new session row and re-captures the resume token when it can, with conversation continuity unverified.
- **The send refusal** for an unavailable or changed pane names the repair.
- **The as-built CLI reference and the `openrig-user` skill** list `--repair-missing-pane`; the skill's recorded digest is regenerated.
- **`rig config --help`** lists `transport.local_user_guard`, and **`rig ask --help`**'s exit codes cover the `--wake` refusals.

Text and help only; no behaviour change.
2026-10-20 04:54:38 -07:00
Mike Schwarz 0b1d8b3dc1 perf: reuse policy inputs within each proof source watch evaluation (#1601)
Each proof-source watch evaluation reread and parsed a shared ancestor policy once per sibling slice. It now reuses the existing policy reader within that one evaluation, then discards it. Later file events still get a fresh reader; watch boundaries, debounce, judgment checks and evidence reads are unchanged.

The regression drives the watch callback over two missions with eight slices each and compares its revision and invalidations with the uncached readiness result: a shared project policy read goes from 16 to one per event, and a mission manifest from nine to two. Separate cases cover policy edits and overrides, deletion and recreation, a malformed policy, read errors and recovery, and accepted-evidence changes.

This reduces measured fixture work; production latency is not measured here.
2026-10-20 04:35:32 -07:00
Mike Schwarz e257e1def5 fix: give self-attached tmux members a routable team address (#1587)
Self-attached tmux members get a routable team address.

- **Sender and reply:** `rig attach` inside tmux records the display name as the member label and returns the declared team address (`senderAddress`, and the returned `OPENRIG_SESSION_NAME`) while the physical tmux name (`0` or a custom name) stays bound. Delivery, capture, history, whoami, queue ownership and context resolve the team address to the current physical name through one shared rule, so a reply reaches the same pane.
- **Clashes:** a new member whose address equals another current member's, or another member's saved session address (unbound or historical included), is refused before labels, binding, provisioning or events change, with `address_conflict` and a request for another member name.
- **The same seat continuing:** a replacement generation of the same rig name and member (its predecessor archived, or its latest session exited, detached or superseded, with nothing live) is not a clash, so YAML re-import replacement keeps working. The delivery guard follows the same rule.
- **The delivery guard agrees with routing:** the guard's target must be the node current routing selects, so an unrelated exact binding stays ambiguous instead of becoming the guard's target.
- **History:** saved records aren't rewritten; an old exact address still reads the old session's transcript, context and native conversation.
2026-10-20 04:34:18 -07:00
Mike SchwarzandNash Aschenbath 2265e38bdf fix(claude): keep unmanaged executable launches in the foreground (#1593)
Builds on #1200 by @Aschenbath, whose commit is kept unchanged with its authorship, plus one commit for ksh and the dash and ksh test coverage.

An unmanaged Claude launched through a real executable now runs in the foreground of its pane in bash, zsh, sh and dash. The pane reports Claude instead of the shell, so readiness reads correctly for fresh, fork and both resume paths, and the launch's arguments and environment reach Claude unchanged. Aliases, rc functions and wrappers keep their behaviour. Managed launches, Codex and Pi are untouched.

ksh keeps the earlier launch form: ksh doesn't export a leading assignment passed through a function, so the foreground form would drop seat variables such as OPENRIG_HOST, OPENRIG_OCCUPANT_GENERATION, CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN and OPENRIG_RESUME_LAUNCH.

The real-shell test (claude-executable-foreground.test.ts) now also runs its cases in dash and ksh panes.

Refs #1200
Refs #1199

Co-authored-by: Nash Aschenbath <[email protected]>
2026-10-20 04:28:55 -07:00
Mike Schwarz a3805c96f4 docs(context): carry 0.6.13's and 0.6.14's capability map lines to main (#1595)
The capability map that agents read through `rig context get onboarding-width/public-what-you-can-do.md` now carries what 0.6.13 and 0.6.14 added, on main too. Main's copy stopped at the 0.6.12 delta, because each release's map lines are written on its release line. The marker moves to `capability-delta-v0.6.14`.

The added lines cover observation (`rig ps --nodes`'s observed model, roster `show` and `find`), sends and captures (`caller_cancelled`, capture's input-box note), seats and rigs (`rig ask --wake` limited to Claude and Codex, the dotted-name refusal, name-or-ID for `add`, `grow` and `remove`, `rig seat effort` for Pi), Slack catch-up after a connection gap, recovery and compaction (`rig reconcile-session --repair-missing-pane`, manual `rig compact`'s 180-second budget, the refocus work packet switch), `/healthz`'s `euid`, `transport.local_user_guard`, and `rig provider status`'s retained readings.

The reconcile-session line is worded for main: plain reconcile adopts into a new session row and re-captures the resume token when it can, while conversation continuity stays unverified, and both forms refuse while typing protection is on.

Text only; no CHANGELOG, whats-new or version changes.
2026-10-20 04:20:55 -07:00
Mike Schwarz b57fa8c5d3 docs(roadmap): drop the Slack channel map item, shipped in 0.6.13 (#1591)
ROADMAP drops the Slack channel map item (#192): one channel per seat, keyed by channel ID. It's finished, and #192 is closed as completed.

One deleted line; no new roadmap text.
2026-10-20 03:27:37 -07:00
Mike Schwarz 1f7a8b727c docs: ask before starting a team, and group a person's prompts honestly (#1590)
Guidance for the operator and the rigs skill, from first-user runs.

- **Ask before starting a team:** the operator doesn't start a team, including `rig up`, without the person's yes to what it will start. A yes they already gave for that same launch counts, so they aren't asked twice.
- **Approval prompts, grouped honestly:** when a person relays many one-time approvals, the operator passes on only the person's own chosen answer. It re-captures the prompt before relaying, never reuses an answer once the prompt has changed, checks the effect afterwards, and never approves on its own or changes a permission mode.
- The packaged copy of the rigs skill matches its source.
2026-10-20 03:25:09 -07:00
NIKHIL 0c4190a555 fix(daemon): recover workflow wakes through their durable intents (#1582)
Workflow recovery after a daemon restart respects a wake's durable delivery state.

- **Before:** `runWorkflowBootSweep` nudged pending frontier packets directly through `maybeNudge`, before startup reconciled and drained their committed wake intents. A pending intent could be sent twice, and an abandoned or finished attempt could be replayed outside its original delivery ID.
- **Now:** `QueueRepository.recoverLostNudge` goes through the packet's existing wake intent (`deliverWakeIntent`) when there is one, and keeps the legacy nudge for older packets without an intent. An overdue packet already recovered earlier in the same pass gets no second nudge; overdue reporting and exception admission still run.
- **Tests:** a regression with the real SQLite repositories, boot sweep and intent drain in startup's order, covering each intent state and legacy packets with and without an outbox.

Contributed by @Nikhi00718.
2026-10-20 03:19:29 -07:00
Mike Schwarz fecffdc632 feat: make tmux environment inheritance an explicit launch option (#1573)
New agents no longer pick up unrelated values stored in the tmux server's global environment.

- **Default:** new managed agents and handover successors start from the daemon-selected launch environment plus the seat's declared values. Values named by tmux's `update-environment` list (SSH agent and display defaults included) are kept from the daemon; stored server values aren't copied. Generated pane identity and the selected auth and endpoint forwarding are kept.
- **Opt back in:** `terminal.inherit_tmux_environment=true` (default `false`) restores inheritance for setups that rely on server globals. Setup gives informational advice when it detects a custom tmux configuration, without changing the setting.
- **Unchanged:** shell startup and custom default commands still run; running agents and server globals are left alone; existing-command restarts without a new seat environment behave as before.
- **If preparation fails** (Windows, or shell or option inspection unavailable), the previous launch environment is kept with a warning in fresh launch results and the daemon log. It never refuses a launch.

Refs #1178.
2026-10-20 02:51:38 -07:00
Mike Schwarz 8ee24ff6da fix(codex): keep the saved conversation on a transcript-less SessionStart, and prove a resume from Codex's records (#1580)
Codex seat identity is kept, and a Codex resume is proven from Codex's own records.

- **A transcript-less SessionStart:** for a Codex seat, an explicit null transcript path no longer clears the saved conversation, and a generation registered for the node but not current gets `409 generation_mismatch`. A path, an absent key, an empty or malformed value, and Claude, Pi and OMP keep today's behaviour.
- **Resume proof:** with a conversation to prove, the adapter observes the pane's Codex process, reads Codex's records for that process and start time, and re-observes it. A match is resumed. A mismatch is attention naming both conversations. Anything unknown at the window's end is attention with the reason. There's no restart, discard, fresh fallback or longer timeout.
- **Restore join:** the proven process is carried through startup to restore, which compares it with the joined pane's process and reports `attention_required` on a difference.
- **One proof-decision deadline:** late wrapped poll and proof values, or a late match or mismatch, are never accepted. Sleeps request at most the time left. Work already started isn't cancelled, so return can be late.
- **In-place restart:** an unproven resume ends `incomplete` with inspection-first guidance (`rig reconcile-session <seat> --no-launch`), and a mismatch names the conversation that opened. Nothing is retried.
2026-10-20 02:32:39 -07:00
Jay Hemnani 5c6ed05b0d fix(spec): warn when members in different pods derive the same session name (#1058)
Two members in different pods can derive the same session name (pod `a-b` member `c`, and pod `a` member `b-c`, both become `a-b-c@<rig>`). Today validate and plan pass and `rig up` then half-starts the team.

- `rig spec validate` and `rig up --plan` now warn about the collision, naming the shared address, in human and JSON output.
- Nothing is refused: import, `rig up` and a one-member launch behave as before.
- Tests pin the warning and the unchanged launch behaviour.

Contributed by @jayhemnani9910.
2026-10-20 02:04:40 -07:00
Mike Schwarz 33a0fc70e8 test(send): cover the after-send notice and the preparing and compacted stages (#1581)
Follow-up tests for the send-during-compaction notice.

- **preparing:** the preparation prompt was sent and `/compact` not yet: the exact stage and notice.
- **compacted:** compacted, restore not yet requested: the exact stage and notice.
- **after_send:** nothing recorded when the send starts, a compaction recorded by the time it finishes: `observed: after_send` and "when this send finished".

Each send is still delivered. Test-only.
2026-10-20 01:55:19 -07:00
Leon.C f5221d77f4 fix(daemon): clear Claude permission attention after seen dialog resolves (#1376)
A Claude agent stayed marked as needing the person after its permission prompt had been answered.

- A PreToolUse relay and the visible screen (not scrollback) now tell OpenRig the prompt resolved, so the attention mark clears as soon as that's seen.
- In the one case it can't yet tell, an ordinary message to the agent waits until the screen shows the prompt is gone or Claude's turn ends.
- Tests use a recorded Claude 2.1.300 permission screen and cover the clear, the wait and the held-wake escalation.

Contributed by @zichen0116.
2026-10-20 01:54:20 -07:00
Jay Hemnani dc2f5ad825 fix(daemon): look up the active rig, not an archived one with the same name (#1101)
Several lookups read whichever rig matched a name, so an archived rig with the active rig's name could answer instead.

- `rig ask`, `queue create --target-repo`, workflow role resolution, `rig whoami --session` and `rig down`'s restore hint now follow the existing active-over-archived rule: the active rig wins, two active rigs with one name stay ambiguous, and a session still running on an archived rig is still found.
- A queue item's repo check uses the running rig's repos, which the maintainer approved.
- Tests cover each lookup with an archived same-name rig.

Contributed by @jayhemnani9910.
2026-10-20 01:46:13 -07:00
Proactiva 7bfe45d649 test(daemon): say the CLI isn't built when a scenario-local daemon can't start (#1578)
`npm test` builds only the daemon before the workspace tests, so on a fresh clone the scenario tests ran `node <missing rig bin>` and failed with MODULE_NOT_FOUND.

- `spawnScenarioDaemon` checks that the rig bin exists before spawning, and if not, says the CLI isn't built, naming the path and `npm run build` at the root.
- A test pins the message and that nothing is spawned.

Contributed by @PROACTIVA-US.
2026-10-20 01:34:32 -07:00
Proactiva 68ef722498 test(daemon): answer resolveToIpOrNull's unresolvable-host case from a stub resolver (#1577)
A fake-IP or captive resolver answers every name, so the real-DNS `.invalid` case tested the machine's resolver rather than `resolveToIpOrNull`.

- The unresolvable case stubs `dns.promises.lookup` (the property the function calls), so the rejection still goes through the function's own handling; the `{ all: false }` call is pinned.
- A new case covers the function's 5 s timeout with a never-settling lookup and fake timers.
- The real-DNS `localhost` case is kept. Mocks and timers are restored in `finally`.

Test-only. Contributed by @PROACTIVA-US.
2026-10-20 01:34:10 -07:00
Proactiva 3c1f475e2f fix(scripts): name rsync when mirror-skills can't find it, and list it in CONTRIBUTING's setup (#1576)
`npm test` runs `mirror-skills.mjs --check`, which calls rsync, so a fresh clone without rsync failed with a bare ENOENT.

- Every rsync call goes through one wrapper that maps only ENOENT to a message naming rsync and its install commands (Debian/Ubuntu, Fedora, Alpine), with the original error as its cause. Anything else is rethrown unchanged, and the arguments and stdio are byte-identical.
- CONTRIBUTING lists rsync beside Node and tmux.
- A test pins both the missing-rsync message and the unchanged rethrow.

Contributed by @PROACTIVA-US.
2026-10-20 01:33:47 -07:00
Proactiva ef195ebd06 test(daemon): keep the compaction enforcer tests out of /tmp/openrig-test-home and /tmp/h (#1575)
The compaction enforcer writes preparation files under its OpenRig home, so a fixed /tmp home collected state across runs and could fail when that path was a file, belonged to another user, or was shared by a concurrent run.

- One `mkdtemp` home per run, removed in `afterAll`, replaces every `/tmp/openrig-test-home` and `/tmp/h`, including the asserted prompt paths.

Test-only. Contributed by @PROACTIVA-US.
2026-10-20 01:33:24 -07:00
Mike Schwarz 755c66f96a docs: a standard-user Mac Node.js route on the people page; no sandbox-only paths (#1579)
Two fixes from first-user runs.

- **Node.js on a standard-user Mac:** the quickstart's "What you need" now gives the nvm route with its commands (`touch ~/.zshrc`, nvm v0.40.8's install line, a new terminal, then `nvm install 22`), with no administrator password for nvm itself, and says to run `xcode-select --install` if nvm's installer asks for Apple's command line tools. The README and getting-started name the same command.
- **Shell blocks that paste cleanly:** a trailing `# …` note in a shell block becomes arguments to the command in a Mac's default zsh, so those notes in the quickstart and README now sit in the sentence before their block.
- **No sandbox-only paths for the person:** the rigs skill (both copies) says that a file or command given to the person for their own terminal uses a path that exists on their side; a file a sandboxed agent writes under `/tmp` may not.
2026-10-20 00:36:46 -07:00
Mike Schwarz e57325476c feat(codex): load the core plugin's hooks in selected Codex seats through Codex's own install (#1551)
## What a user gets

A Codex seat whose plugin selection includes `openrig-core` can now run the plugin's refocus hooks (UserPromptSubmit and
PostCompact) and its activity relay. Until now Codex never loaded them: OpenRig copied the plugin into a folder Codex
doesn't read. Every other Codex session on the same home, whether an unselected seat or a person's own session, is a
successful no-op for these hooks, even with no `node` on its PATH.

## How it works

1. **Install through Codex itself, only for a selected seat.** With `runtime.codex.hooks_enabled` on, the install runs only
   when a Codex seat's resolved plugin selection includes `openrig-core`:
   - **at that seat's launch, when it starts a conversation:** the same check that sets the seat's
     `OPENRIG_SEAT_PROJECT_DIR`. A resume (a launch with a resume token, or building the in-place restart's resume command)
     never installs;
   - **at boot:** after the plugin is vendored (so it installs the version this daemon ships), when some Codex seat's saved
     selection includes it.

   Launching an unselected Codex seat never installs it. The install:
   - writes a local marketplace manifest beside its vendored plugin (`<plugins>/.agents/plugins/marketplace.json`);
   - runs `codex plugin marketplace add <plugins>`, then `codex plugin add openrig-core@openrig`, under its own
     `CODEX_HOME`.

   It writes nothing into Codex's plugin cache, and no hook trust or hook state.
2. **The person's choice comes first.** Before any install or reinstall, it reads the Codex config files it can see: the
   system `/etc/codex/config.toml`, the user `$CODEX_HOME/config.toml`, and the legacy `/etc/codex/managed_config.toml`.
   - **An explicit `[plugins."openrig-core@openrig"] enabled = false`:** stays disabled.
   - **A `[plugins._default] enabled = false` with no explicit value for the plugin:** stays disabled. Codex applies that
     default, and an install would replace it with an explicit true.
   - **An explicit `enabled = true`:** allows it.
   - **A file that can't be read or parsed:** installs nothing and reports why.
   - **Upgrades follow the same rule.** A new plugin version is reinstalled only while the plugin isn't disabled.
3. **A guard before any interpreter.** Every entry in `hooks/codex.json` starts with
   `test -n "$OPENRIG_SEAT_PROJECT_DIR" && test -f "$OPENRIG_NODE" && test -x "$OPENRIG_NODE" || exit 0`, then
   `exec "$OPENRIG_NODE" …`. OpenRig sets both variables only for a Codex seat that selected the plugin (on fresh launch,
   handover and successor), with `OPENRIG_NODE` the daemon's absolute Node. Codex runs hooks through the login shell, and
   a missing command there would be a failed hook; the guard exits 0 first.
4. **Activity is reported, possibly twice, never zero times.** On Codex the plugin's relay always reports. Whether Codex
   also runs the daemon's own managed relay for an event depends on hook state merged from every user layer (a selected
   profile included) and session flags, and on the handler as written, none of which the plugin can see. So on a selected
   Codex seat with both routes active, each activity event is reported twice. The daemon records both; nothing is lost.

## Changed results

- **Codex seats that selected `openrig-core` get its refocus and activity hooks,** once Codex's exact-hook review admits
  them. Review is still required for each hook.
- **The daemon's Codex `config.toml` gains** `[marketplaces.openrig]` and `[plugins."openrig-core@openrig"] enabled = true`.
  Codex's own install writes them.
- **The plugin's skills become available to every Codex session on that home,** including a person's own sessions.
- **The plugin manifests move to 0.1.16,** so vendoring replaces an older installed copy.
- **Launch can take longer the first time.** When the installed plugin isn't current, the install runs Codex's own CLI
  inside the launch (or boot) path: up to two commands, each with a 120 s limit. It is skipped once the vendored version
  is installed.
- **The person's user config is written, through Codex.** Codex's install writes the person's `$CODEX_HOME/config.toml`
  (the marketplace entry and `enabled = true` for the plugin). OpenRig only writes its own marketplace manifest beside the
  vendored plugin.
- **The plugin's Codex relay entries now pass `--from-plugin`.**

## Known limits

- **A Codex started from inside a selected seat's shell** inherits the seat's variables and acts as that seat. This
  change doesn't add launch isolation.
- **Config OpenRig can't see:** profile, project, session-flag, MDM and cloud-managed config. A disable set only there
  isn't seen before install. Codex itself still honours it when loading the plugin.
- **Duplicate activity:** on a selected Codex seat with the daemon's managed relay active, each activity event
  (SessionStart, UserPromptSubmit, Stop, PermissionRequest) is reported twice, by the managed relay and by the plugin. It
  is never lost, and it doesn't count twice toward promoting the hook rung.
- **Promotion is counted per route:** it's slower when the two routes cover different stretches, never faster.
- **Tested Codex version:** the behaviour was read from Codex's public source at `rust-v0.163.0`. Other versions may differ.


Refs #1341
2026-10-20 00:31:19 -07:00
Rudy Mizrahi Celekli b73e60f8ba fix(daemon): preserve image protection across same-name versions (#1117)
A pinned agent image keeps its protection from deletion when another version shares its image name.

The evidence guard keyed protection by image name, so pinning one version could be overridden by, or leak onto, another version with the same name. It now evaluates protection per version again; the name-based reference and lineage rules are unchanged. Tests cover the guard directly and the library route: deleting the pinned version is refused with "pinned", and the other version still deletes.
2026-10-20 00:27:54 -07:00
Mike Schwarz 5cee219771 feat(restart): refuse a Codex in-place restart on conflicting retained native-thread evidence (#1570)
`rig seat restart --keep-conversation` for a Codex seat now refuses before stopping or typing anything in one case: argv proves the stored conversation, and Codex's own retained logs, read with no detected incompleteness (every versioned database found, opened and queried), name only a different conversation. It returns `resume_binding_unverified` with "Conflicting retained native-thread evidence…".

- **Everything else keeps today's `ok`,** with an additive `currentConversation` note: "no other conversation logged", or "not established: …" for an unreadable database, incomplete discovery, ambiguous evidence, nothing logged, or no CLI thread. Unknown never refuses.
- **How:** an optional `discovery` out-parameter on `resolveCodexDbPaths`, an optional `readability` one on `readCodexThreadIdFromLogs`, and one new method, `resolveWithReadability`. Callers that don't pass them are unchanged.
- **Not added:** new timing, a fresh fallback, automatic repair or an identity gate.
- **Limits:** the read isn't an atomic snapshot; a switch Codex never logged can't be seen; the start-second gate applies.
2026-10-20 00:26:27 -07:00
Daniel_you e21dbd20d9 fix(cli): avoid retaining caller abort listeners (#1097)
A caller can reuse one `AbortSignal` across completed requests without accumulating `abort` listeners. The request signal still follows the caller's cancellation after response headers arrive, which long-lived streams such as workflow follow need.

This replaces the manual listener in `fetchWithTimeout` with `AbortSignal.any`, and adds tests: the caller's listener is released after each settled request, a caller abort still reaches a pending request and a stream after its headers, and a non-Error abort reason is normalized.
2026-10-20 00:24:31 -07:00
Mike Schwarz e66dee7c08 feat(send): tell the sender when a seat was being compacted or restored (#1572)
A send to a seat that's being compacted or restored by OpenRig goes through as it always has, and the sender is now told, so they know to check the reply and follow up.

- **Delivery is unchanged.** `send()` wraps the existing path. With nothing recorded it returns the same result object; failures keep their exact results and statuses.
- **The notice:** when the compaction enforcer has recorded a managed compaction or restore for the seat, the result gains `managedCompaction { stage, observed, notice }`. The stage is preparing, compacting, compacted or restoring; `observed` says whether it was seen when the send started or when it finished. The notice never says the restore has finished.
- **The CLI:** `rig send`, a fan-out send (`--to`, `--pod`, `--rig`) and `rig broadcast` print it as a `Notice:` line under that recipient. Exit codes and `--json` are unchanged.
- **The source:** two synchronous reads of the enforcer's existing in-memory records, each guarded, so the send path gains no I/O or new failure.
- **Not printed yet:** a cross-host single-seat `rig send` over HTTP (its JSON keeps the field), `rig walk`'s per-piece output, and `rig send --verify`'s automatic Enter retry.
2026-10-20 00:18:07 -07:00
Mike Schwarz 99b5f8f243 fix(queue): name each candidate when whoami can't settle current work (#1569)
When `rig queue whoami` can't settle a seat's single current work node but the seat holds in-progress rows, it now says so and names every candidate, instead of showing only a count.

- **The daemon** adds `currentWorkChoice`: an instruction to choose, plus each candidate with its `projects`, `mission`, `slice`, `workNodePath` (or the reason it didn't resolve) and its source `qitemId`. In-progress rows that name no work go under `unknown`. Nothing is selected for the agent.
- **The CLI's plain output** ends with one line per candidate.
- **Unchanged:** `currentWork`, `currentWorkBasis` (the refocus hook reads both) and `--work-candidates`. The field is absent when current work is settled or nothing is in progress.
- **Reuse:** it's built on the existing work-candidates projection. Candidates gain `projects`, and the dedupe key includes them, so two projects' same-named rows stay two candidates.

Today's resolver uses one configured root; the tests feed in the two cross-project ambiguity cases a project-aware resolver would return, and check that both candidates are named.

Refs #1526
2026-10-19 23:05:38 -07:00
Liu XingJian 9e886efe19 TUI: show per-seat reasoning effort with configured/observed provenance (#1529)
The TUI shows each seat's reasoning effort, read-only.

- **The table and detail view** show the effort a managed launch sends, the seat's explicit choice or else the authored value, and where it came from: `seat_choice`, `authored`, or `runtime_default` when no configured level is known. It never guesses what the model ran.
- **The detail page** reads `GET /api/seat/effort/:seatRef` once per refresh. The table makes no per-seat requests.
- **Failure handling:** a daemon's JSON refusal is shown as `report refused <code>` without a read warning; an older daemon's bare 404 reads as unknown with no warning; timeouts, transport errors, malformed refusals and other HTTP errors keep their named error. Other reads through the shared client are unchanged.
- **No write route,** default, permission change or restart is added.
2026-10-19 22:47:35 -07:00
Mike Schwarz cbf480d007 fix(slack): resolve a question only from a reply written after it posts (#1568)
A Slack message the person sent before an agent's question appeared could resolve that question as its answer. Now only a reply written after the question's current post answers it.

- **Early or extra messages** still reach the agent as ordinary messages, correlated to the question, so the agent sees them as context. Nothing stitches messages into one answer.
- **The posted question says so:** "Reply in this thread after this question to answer it. Earlier and extra messages still reach the agent as conversation."
- **A re-park** asks a new question, so a reply to the older one doesn't answer it.
- **Multipart questions:** when the primary part has posted but the final receipt isn't stored yet, the primary post's real Slack timestamp is used.
- **Unknown timing:** when a delivered, correlated current question has no comparable timestamp (for example, a reconciled post with no Slack ts), a later reply still resumes it, with a separate note to the agent that its ordering couldn't be confirmed and a short notice in the person's thread. A reply known to be earlier never resumes it. This is a compatibility trade-off: an actually early reply can resume such a question when its order truly can't be recovered. It isn't proof of timing, of reading, or of approval.
- **Never from weaker evidence:** an older or unkeyed receipt, an unmapped thread or an unreadable store resolves nothing; the park stays with its owner. A failed notice is reported as a failure and retried alone.
- **Unchanged:** direct requests, buttons and structured answers, reactions, and the already-resolved replay.

The tests drive the queue, SQLite, Mission Control and the Slack wire with modelled timestamps. No live Slack account was used.

Refs #822
2026-10-19 22:44:52 -07:00
Mike Schwarz 88112ef01a fix(daemon): report partial launch cleanup failures and valid retry guidance (#1567)
`rig up --env` stops a seat whose one-off value couldn't be removed from its session after the seat started. In a several-seat launch the rest of the team keeps running, so the old advice, "Run it again", would collide with the team that now exists.

- **The new guidance** names the stopped seat's own `rig launch <rig-id> <seat>` command (a pod member's qualified name for pod specs) and says it doesn't reapply the unsaved `--env` values. If those values are needed, `rig down <rig-id> --delete` stops and removes the team this launch just created, and the original `rig up` command can then be run again with `--env`. Nothing is stopped or deleted automatically.
- **Covered:** flat specs, v1 bundles and pod specs, which every built-in team uses. Pod-spec human output now also names the stopped seat, its setting and the reason.
- **One exit code changes:** a pod-spec cleanup partial now exits 1 instead of 0 with `--json` and with `--host`, matching its human output, flat specs and v1 bundles. Single-seat and all-failed launches still exit 2, and lifecycle and status are unchanged.
- **Unchanged:** an all-failed launch still says "Run it again.", an unconfirmed removal still says to check and remove the surviving session first, and NodeLauncher and direct launch are untouched.

The tests run through the real bootstrap, SQLite, the up route and the CLI with an inert tmux boundary. Native provider behaviour wasn't run.

Refs #1511
2026-10-19 22:31:38 -07:00
Mike Schwarz 768e9b5fb6 feat: add an optional Mac local daemon user guard (#1566)
On a Mac with more than one user account, a second user's `rig` commands can reach the first user's daemon on its default port. This adds an optional check, off by default.

- **The setting:** `transport.local_user_guard` (default `false`). When it's on, the CLI's common client checks a local daemon before talking to it.
- **The evidence:** the daemon's `/healthz` now reports its own effective UID as `euid`, beside `pid`. The check reads it twice and corroborates it with `ps -o uid=,lstart= -p <pid>` twice (fixed path, no shell, bounded to 1 s).
- **When it refuses:** only when every read agrees on a UID different from the caller's effective UID. The error names the reported PID and UIDs, and the way out: `rig daemon start --port <unused-port>`, or a deliberate `OPENRIG_URL`.
- **When it permits:** an older daemon with no `euid`, malformed, changing or disagreeing reports, `ps` failing or timing out, a non-loopback URL, or a non-Mac platform all read as unknown and let the call through. A same-user daemon never refuses.
- **What it isn't:** it trusts the daemon's report and corroborates that process; it doesn't prove who owns the socket. It's a partial check against accidental routing, not authentication or user isolation, and identity can change between the check and the connection. Running `sudo rig …` against a user-owned daemon refuses when the guard is on.

With the guard off, kernel readiness resolves the setting once before its wait and keeps the same polling and final status request as before. Each request still reads the setting once. `/healthz` gains the additive `euid` field whether the guard is on or off.

Hosted Mac checks observed an owned listener reporting its UID and an unprivileged `ps` read of another account's process. A live two-account daemon session wasn't run.
2026-10-19 21:44:26 -07:00
Mike Schwarz 95d1303154 fix(daemon): honor rig up --env for flat specs and v1 bundles (#1511)
`rig up --env KEY=VALUE` completed flat-spec and v1-bundle launches without passing the override to their panes. It now goes through the shared launcher, so every first pane gets it. The value isn't saved on the rig or node, and it's removed from tmux session state before later panes start.

Removing it can fail after the first pane has started, and the result now says so:
- **What happens:** the launcher tries to kill the new session. A confirmed kill stops that launch. A failed or throwing kill leaves an unbound session that may still hold the value. Neither is an undone launch or a refusal before any effect.
- **What's reported:** an all-failed flat or v1 launch keeps the value-free guidance naming its session and key. A mixed result reads partial, with that guidance in human output and a non-success exit for human and JSON output, local and remote.

Only this cleanup failure changes how legacy results are aggregated. Pod/v2 launches, plans, launches without an override, restoration and unrelated launch failures are unchanged.

The tests run through the real bootstrap, SQLite, the up route and the CLI, with an inert tmux boundary. Native provider behaviour wasn't run.
2026-10-19 21:34:38 -07:00
Nash Aschenbath 964a4540a9 fix(daemon): share value-taking Codex options across resume parsing (#1448)
Codex resume-token parsing used a narrow option set and skipped only `--add-dir` after `resume`, so a model or directory value could be read as the resumed conversation.

- One shared set of value-taking Codex options now applies before and after `resume` and `fork`: `-a`/`--ask-for-approval`, `-c`/`--config`, `-m`/`--model`, `-p`/`--profile`, `-s`/`--sandbox`, `-C`/`--cd`, `--add-dir`, `--enable`/`--disable`, `--local-provider`, `--remote` and `--remote-auth-token-env`. `--` ends the options, and everything after it is the fresh launch's prompt.
- `-i`/`--image` takes one or more values, up to the next option or `--`. An image value never proves a conversation.
- A positional used with a real `--last` is the prompt and names no conversation. A `--last` after the second positional is prompt text, so `codex resume T explain --last selection` still proves `T`, while `codex resume T --last` proves nothing.
- Mismatch explanations no longer show the values passed to model options.

Known limit: process text loses argv boundaries, so an explicit resume can't be told apart from every multi-word prompt used with a real `--last`. In that shape the leading token is still read as the conversation, as it was before this change, so exact conversation attribution keeps that ambiguity. Only a token equal to the seat's own recorded conversation is ever accepted.

The tests drive the parser and its consumers with flattened `ps` rows. Codex's native CLI wasn't run.
2026-10-19 21:32:04 -07:00
Mike Schwarz 39b4667276 docs: a getting-started page for people, the setup reference for agents, skill first and what OpenRig changes (#1565)
Onboarding docs: let your coding agent set OpenRig up, and say plainly what installing changes.

- **New `docs/reference/quickstart.md`:** the human getting-started page, with a short glossary of the first words a person meets.
- **`docs/reference/getting-started.md`:** a new title and opening for the agent doing the setup; the rest of the page, and every inbound link and `rig context get` lookup into it, is unchanged.
- **README:** the skill-first install block opens "Install and first run", followed by "Install it yourself"; a short box says what installing and starting change on the machine; the Getting started links point to the new page, and Key Concepts links to the glossary.
- **Facts kept current:** the example tags and version sample now match the v0.6.12 install pin.
- **`scripts/check-first-run-references.mjs`:** the first-run references check now also covers the new page.

Docs only; no product behaviour changes.
2026-10-19 21:06:48 -07:00
Mike Schwarz 7a4135369f feat: repair missing tmux pane bindings without adoption (#1564)
Repair a missing tmux pane binding without adopting the session.

- **The problem:** a seat launched by an older OpenRig can have a tmux binding with no pane recorded. Current OpenRig then refuses every send to it ("Managed pane identity unavailable or changed; no input written."). The default `rig reconcile-session` can fix sending, but it adopts the seat into a new session and occupant generation and leaves the new session without a resume token.
- **What changes:** a new opt-in `rig reconcile-session <seat> --repair-missing-pane --no-launch`, backed by its own authenticated endpoint. It acts only on a running launched session whose binding has no pane. It observes the session's sole pane and its PID twice, then, inside the existing delivery guard's checks (no active human input, no pending work, protection off), makes one conditional update of `tmux_pane` and `updated_at`. Session, token, tenure, restore policy, protection and capture records are unchanged, and the result reports the same session id with continuity unverified.
- **Refused, with nothing written:** multiple panes or windows, an unobservable pane, a binding that already has a pane, a change between observations, active work or protection. An older daemon without the endpoint gets "not supported; nothing was changed", and the CLI never falls back to adoption.
- **Unchanged:** the default reconcile and ordinary sends.

The repair records no event; `updated_at` and the command's result are its only trace. A delivery held from before the repair, with the missing pane in its snapshot, still refuses afterwards. Tests use the real service, SQLite, guard and adapter code with inert process effects; no native tmux or provider run.
2026-10-19 20:24:02 -07:00
Mike Schwarz 6d43323070 fix: resolve refocus notes without per-ancestor CLI starts (#1563)
Refocus resolves notes without starting a CLI process for every ancestor.

- **What changes:** the refocusing trace now finds each work ancestor's notes file itself: a readable regular `NOTES.md` first, then `MISSION_NOTES.md`, the same rule and the same path string as the CLI and daemon resolvers. Before, it ran `rig scope resolve-notes` once per ancestor, and on a loaded machine those starts could eat the trace's time budget and end in a trace gap.
- **Unchanged:** symlinks, the readable fallback, custom roots, the gap reported when a resolved file becomes unreadable before it's read, the hook's budgets and settings, and the context content produced. There's no new route, cache, daemon call or setting.
- **Delivery:** both bundled openrig-core manifests move from 0.1.14 to 0.1.15, because an installed plugin is replaced only by a strictly newer version.

Tests compare the script's resolver with both TypeScript resolvers across both names, legacy only, neither, a directory, symlinks and an unreadable file (run under a non-root UID). A delayed-CLI test fails on the old script and passes now. The hook's failure retention, check-mode exit and health receipt are still covered, now through a real outside-root trace failure. Removing these process starts doesn't prove every loaded-machine trace now fits its budget.
2026-10-19 19:14:49 -07:00
Mike Schwarz 6b96962c3e fix: report unsupported ask-wake runtimes before execution (#1561)
`rig ask --wake` reports an unsupported runtime instead of silently attempting a Claude wake.

- **What changes:** seat resolution returns a resume token only for Claude (including the `claude-code` alias) and Codex. A Pi, custom or empty runtime gets a clear refusal and no token. The CLI also checks a raw-id `--runtime` value and the daemon's answer before it calls the wake runner.
- **Seats with no node runtime recorded:** they still resolve when the session itself positively recorded a Claude or Codex id (`claude_id`, `claude_name` or `codex_id`). There's no blanket "unset means Claude" fallback, so a Pi or unknown seat stays refused.
- **Unchanged:** the default Claude wake, the Codex wake, an explicit runtime's precedence over recorded metadata, generation indexing, timeouts and transcript search.

Tests drive the real claim, hook and resolver query path, failing first: unsupported runtimes make no wake-runner call and return no token; recorded Claude and Codex sessions on a node with no runtime still resolve; supported aliases and generation behaviour are preserved. Providers were test doubles; no native wake ran. A client with this fix can't detect an older daemon that already labelled a Pi token as Claude, so seat resolution needs the corrected daemon too.
2026-10-19 19:10:22 -07:00
Mike Schwarz f937bf8a09 fix: keep manual compaction preparation waiting through approvals (#1562)
Manual managed compaction no longer gives up the moment its preparation stops at an ordinary approval prompt.

- **What changes:** while the seat prepares its restore map, a manual compaction now waits through `target_needs_input`, re-observing within the same attempt and deadline. It never answers the approval, types into an attention, busy or unknown screen, holds the input lease while waiting, resends the preparation, or revives a stopped attempt. When the seat becomes idle with its map ready, the one compact goes as before.
- **The budget:** manual preparation now has 180 seconds (was 120), and `rig compact`'s request timeout is 240 seconds (was 180), with help and docs. A caller can therefore wait up to 60 seconds longer than before; this isn't a promise that every preparation finishes. An explicit `--skip-map` request uses the same manual budget; it only drops the map requirement.
- **Unchanged:** generic sends, the automatic preparation budget, map identity, cancellation, occupant and policy checks, the final idle and before-write checks, and uncertain-delivery handling (still no retry).

Tests drive the existing enforcer and a real transport fixture, failing first: attention then idle gives one preparation and one compact; unresolved attention at the deadline gives none; a map between 120 and 180 seconds now completes; expiry stays final; and cancellation, occupant and policy changes, stale markers and uncertain delivery behave as before. These don't establish native preparation, compaction or restore behaviour.
2026-10-19 19:09:02 -07:00
Mike Schwarz c50df081c6 docs(roadmap): drop three items that are done (#275, #194, #182) (#1560)
ROADMAP drops three items that are finished, each with its issue closed as completed:

- Codex seats that can reach the local daemon by default (#275).
- Custom Codex providers such as Bedrock (#194).
- A configurable readiness window for fresh launches (#182).

Deletions only; no new roadmap text.
2026-10-19 18:26:34 -07:00
Mike Schwarz f5185f8341 feat(provider): Codex account readings survive a restart; a passed reset shows an expectation, never a reading (#1535)
A Codex account's allowance readings now survive a daemon restart and a login switch, shown as history rather than as current availability.

- **Storage (migration 117):** one new table, `provider_account_readings`, keyed only by the provider's existing identity key (account id or workspace routing, plus the bucket). The writer stores selected normalized fields only: identity labels, each window's name, duration, used percentage and reset, the limit evidence and the observation time. No raw provider answer, auth file or profile content is stored. Retention is bounded per key: the latest reading, the latest per window, and the latest of each of the last 20 exhaustion episodes. A row whose windows can't be read is skipped on its own and never pruned.
- **What rows show after a restart:** each allowance's last reading comes back as history, labelled "kept from before the daemon restarted at <time>; this login's sign-in hasn't been read since", with the state unknown. It becomes current only when that account is read again; a different account's read, a timeout or a missing sign-in leaves the label in place. A superseded live row keeps "not the latest read". A passed reset shows an expectation, never a reading, and retained windows name the refresh command.
- **Cross-host views** validate the five new row fields; a malformed value makes only that host's usage rows unavailable, with a shape reason, and healthy hosts and hosts without the fields are still served.
- **Projection** holds each allowance's last exhaustion in memory instead of querying the store per projection.
- **The CLI and TUI** print history and sign-in on one row, including a Claude row with no identity yet.

`usage_samples` is unchanged. Native Codex logins, a real daemon restart and multi-machine fan-out weren't run; the tests drive the store, the projection and the cross-host reader with synthetic readings, and an independent QA pass covered restart, reopen and malformed-row cases.
2026-10-19 18:19:46 -07:00
Mike Schwarz a30fd61b3e Advance development main to 0.6.12 and carry its release text (#1558)
Development main now carries the published 0.6.12's versions and release text.

- **Versions:** root, `packages/cli`, `packages/daemon` and `packages/ui` read 0.6.12, and the lockfile matches; `packages/tui` stays 0.1.0.
- **Release text:** the 0.6.12 CHANGELOG section and whats-new entry as published, and `docs/releases/v0.6.12.md`, the published release notes byte for byte.
- **Capability map:** 0.6.12's additions (for example `rig seat set-effort` and `rig usage cost`) alongside main's later entries (`rig seat set-cwd`, the adopted-seat restart note, Pi effort and `rig usage top`).
- **Installer pins:** the README and getting-started now name `v0.6.12`, keeping the standard-user Mac Node route.

The release's two text and version commits are cherry-picked with `-x`; this isn't a merge of `release/0.6.12`, whose source changes main already has whole.
2026-10-19 18:18:14 -07:00
Mike Schwarz 78f0d5d79c test: remove wall-clock expiry from usage host fixtures (#1559)
Daemon CI no longer starts failing when the calendar passes the usage fixture's fixed reset date. The shared loopback-host harness paired a fixed reset (2026-10-20T00:00Z) with the real clock, so after that moment a slow Codex refresh read `level: unknown` instead of `nearing` and `package-tests (daemon)` failed on every branch. The harness now defaults to a fixed fixture clock before its reset; explicit `now` overrides and real slow-request timers are preserved. The same date audit replaces the chat-history test's calendar cutoffs with times relative to its real clock.

Test-only: no product source, dependency or version changes. Verified by a hosted run that reproduced the original failure with the old harness and passed 60 daemon, 24 CLI and 12 TUI tests with the repaired one, covering every identified consumer of the shared harness. This is a scoped audit of date-sensitive fixtures, not a claim that every test is now deterministic.
2026-10-19 17:54:19 -07:00
Mike Schwarz f332ee680f Qualify fresh in-place Claude readiness with the current frame (#1553)
A fresh in-place handover of a Claude seat keeps the retiring occupant's scrollback, so the readiness check could match the old Claude's text and report the successor ready before it started, and the handover packet was typed early. Now a ready result read from that history is qualified with the new launch's current frame, only for the exact launch that asked for it.

- **What waits now:** when the current frame isn't ready, for example a shell with the launch line, the packet waits for the successor. That includes shells whose prompt starts with `❯` when the process list was read and shows no Claude under the pane.
- **What still admits, as today:** a headerless frame that lacks only process proof (bypass, plan or default permission modes), an unreadable process list, an observed but unproven Claude process, unavailable pane identity, and an unavailable current screen. These leave the frame ambiguous and keep today's admission.
- **What refuses:** a positively different session token or runtime under the pane stays a conflict. An unidentified Claude (no token, or an argv the parser can't read) is unknown, not a conflict.
- **Unchanged:** visible gates are still checked first, an old not-ready result is never promoted, and resume and launch callers keep their strict identity rule.

Not covered: once the launched Claude is running, the existing process-proved readiness accepts the same loose `❯` matcher, as before. Native renderer timing and packet consumption weren't run; the tests drive the real handover service, launcher and adapter with modelled process and screen observations, red first against the previous head.

Refs #1544
2026-10-19 17:28:24 -07:00
Mike Schwarz f9e2d14f12 docs: a user-local Node route for a standard Mac user, and what the registry checks decide (#1557)
Two fixes from a first-user run on a Mac with fresh accounts.

- **Node.js for a standard Mac user:** someone who isn't an administrator, or whose Homebrew belongs to another account, can install Node.js in their own home folder with nvm. They run `touch ~/.zshrc` first, because a new Mac account has none and nvm's installer only adds itself to a profile file that already exists. Then they run nvm's install command, open a new terminal, and run `nvm install 22`. No administrator password is needed, and `npm install -g` then installs into the nvm folder. This is in `docs/reference/getting-started.md` and the README. Nothing is claimed about Node.js's own installer for a standard user.
- **What the registry checks decide:** `docs/reference/publishing-a-rig-bundle.md` now says that a submission with a taken name is still received, that a team sharing a listed team's `rig.yaml` name (such as an unchanged copy) passes with a maintainer notice, and that listing is the maintainer's review decision, not the checks'. Registry policy is unchanged.

Text only. The registry wording was read against `tools/registry-check.mjs` and `tools/ci/bundle-check.mjs` at the registry's main.
2026-10-19 16:57:28 -07:00
Mike Schwarz df8238f5d3 fix(daemon): recover missed thread replies and mapped-channel messages (#1536)
## What changes
- **Channels this machine owns:**
  - **Which ones:** the default channel and the channel map's channels. A channel the hub relays to another machine is left to that machine (the owner), so it isn't delivered twice.
  - **Coverage start:** a channel newly recovered starts at adoption, and older history reads as unknown. A landing or seen record isn't scanned coverage, so it never sets a floor that could skip an earlier hole. The default channel of the machine holding the Socket Mode connection keeps its existing seed.
- **Replies in tracked threads:**
  - **Which threads:** threads whose root was posted, or which closed, within the last seven days. A root's age is its Slack timestamp, not the thread map's `opened_at`, which a map rebuild resets; so a rebuild doesn't make an old thread eligible again. An old thread that closed recently is scanned from its root, so this isn't a seven-day history cap.
  - **The cost:** missed replies in older open threads aren't caught up. Live delivery is unchanged.
  - **How they're scanned:** with `conversations.replies`, starting at the root, oldest first, 15 per call (Slack's cap for apps distributed outside the Marketplace).
  - **The checkpoint:** it moves past a reply once it landed, was already delivered, was kept as a dead letter, was refused because its sender isn't admitted, or was skipped as a kind inbound doesn't take. A restart resumes at the last page saved. It's kept in its own file, so a reader of channel checkpoints never meets it.
  - **A thread Slack can't find** (`thread_not_found`) stays incomplete, with no further call, until its mapping changes or the daemon restarts or rewires the connector. That's not taken as proof of deletion, and transient errors still retry.
- **Late answers to decisions:**
  - **How it lands:** a recovered thread reply lands as an ordinary reply row in its thread, marked late with its original time. So does a broadcast reply recovered in a newly covered channel: a mapped channel, or a relayed machine's default channel.
  - **What it never does:** answer the decision, even one that's still open, and even after a dead-letter retry. The row says it wasn't applied, and the seat reads it and decides.
  - **Unchanged:** broadcast replies recovered in the Socket Mode machine's default channel, and every live reply, behave as before. A live envelope can't claim the mark.
- **One budget per pass:**
  - **Limits:** four calls, 100 entries and 15 seconds per pass, as before.
  - **Sharing:** channels and threads take turns call by call, each kind in rotation. A kind with nothing to scan gives its turns to the other.
  - **Rate limits:** a `Retry-After` holds back only the method Slack limited. Every backoff saves whether it came from a 429 (`rateLimited: true` or `false`), and the method hold is rebuilt from the saved deadlines before any source runs, so it survives a restart. A future deadline with no marker, as an older daemon saved every backoff, is treated as a possible 429 and holds its method until that deadline, never extended. Channel history and thread replies stay independent.
- **Machines without their own connection** (a shared app's other machines) recover a channel only when it's one they own and the hub has relayed an event for it. Its coverage starts at that event's local receipt, not the next timer pass. The adoption is saved per channel, so a restart needs no new event, and saved coverage wins over a new floor. A saved adoption never widens what the machine currently owns. A machine nothing is relayed to never reads its channels' history.
- **`rig slack status`:**
  - **The lines:** one per additional channel, with a relayed machine's not-yet-adopted channels shown as waiting. A thread line gives the tracked, scanned and waiting counts, how far behind the oldest is, and the reasons for any thread that's backing off or incomplete.
  - **Counts:** accepted and dead-lettered counts cover the connector's lifetime, including threads that have since left the window.
- **Docs:** `docs/reference/slack-app-setup.md` describes the new scope and its limits.

## Not changed
- **Today's behavior:** the configured channel, its broadcast replies and live inbound behave as before. Relay authentication is unchanged.
- **No new scope or setting:** `channels:history` already covers both methods, and there's no new setting, prompt or polling loop.
- **Out of scope:** threads nobody tracks, older open threads, threads closed more than seven days ago, and history Slack no longer returns aren't recovered.
- **Timing:** with many tracked threads, each one is scanned every few passes, and status says how far behind the oldest is.

## Compatibility
Relay adoption (`relayAdoptedAt`) and the rate-limit marker (`rateLimited`) are optional fields in the existing channel coverage file; there's no new store. An older daemon reads the file, accepts the fields and keeps them when it saves, because its saves spread the existing record. If one is lost anyway, that channel waits for a fresh relayed event and keeps its coverage. Thread coverage (`slack-thread-coverage.json`) is new here and isn't pruned yet.

**A downgrade seam, accepted as a cost:** after a downgrade, an older daemon's spread save keeps a `rateLimited: false` this version wrote. If that older daemon then gets a real 429, it replaces `nextRetryAt` but leaves the stale `false`. After upgrading again inside that `Retry-After` window, recovery trusts the `false` and doesn't restore the method-wide history hold. The affected channel still waits for its own deadline, but other channels can call `conversations.history` inside it. In an uninterrupted pass with a single recovery owner, the first of those calls that receives a 429 restores the shared hold: the steps run one at a time and share one method backoff, and a definite live 429 sets that hold before another source takes its step. That's not a promise of at most one extra call in every case; multiple recovery owners, repeated restarts, lost checkpoint writes or a response not observed as a 429 can each allow more. The pass budget (four calls, 100 entries, 15 seconds) is unchanged. This is a compatibility judgment from the source, with no new product guarantee and no measurement against Slack.

## Changed results and costs
1. **The hub's mapped channels** are recovered from their adoption.
2. **A relayed machine** recovers each configured channel the hub has relayed to it, from that channel's first relayed event's receipt, and across restarts. Main didn't recover on relayed machines.
3. **Thread replies** in threads whose Slack root, or whose close, is within seven days are recovered as late rows that never answer. This selects threads; it isn't a seven-day history cap, so a recently closed old root catches up older replies. **Cost:** missed replies in older open threads aren't caught up. Live delivery is unchanged.
4. **Recovered broadcast replies** in newly covered channels (the hub's mapped channels and every relayed-machine channel) land late and never answer. The Socket Mode machine's default channel and live replies are unchanged.
5. **The default channel's share:** when tracked threads need calls, channels get every other call and rotate among themselves. **Cost:** a default-channel backlog can drain at up to about half main's rate when both kinds are busy. That's an upper share, not a fixed slowdown, and there's no latency or global ordering promise.
6. **A history 429** on any channel holds `conversations.history` for every channel until its deadline, across a restart; a replies 429 does the same for threads. On main a 429 held only the default channel's own retry. **Cost:** an older daemon's unmarked deadline, or a `true` marker it kept after a downgrade, can represent a non-429 failure, so re-upgrading before that deadline can delay `conversations.history` for the recovery owner's channels until that saved deadline. The bound is that particular saved deadline, including a `Retry-After` sent with a non-429 response; there's no fixed maximum, and it can happen again across repeated downgrade cycles. It makes no extra API calls, and thread replies keep their own separate hold, so it isn't a freeze on all Slack calls. A deadline marked `false` holds only its own source.
7. **Status:** per-channel lines, a thread line, connector-lifetime totals including threads that left the window (reset when the connector restarts or rewires), `waiting (no-relayed-event-yet)` per channel on a relayed machine, and changed limit text.
8. **At upgrade:** threads inside the window are scanned from their root once. Replies lost in the last seven days or so (longer for a recently closed old root) land as late rows; ones that already landed are deduplicated by `channel:ts`.

Refs #739.
2026-10-19 15:01:41 -07:00
Solomon Wakhungu 80f74f6086 fix(daemon): allow ordinary retry after completed OMP transient failures (#1550)
An OMP seat whose assistant turn ended with a typed transient provider failure can now take an ordinary retry message after its terminal `agent_end`. Before, the runner kept `runtime_error` as `needs_input`, so the send guard refused the retry as though it could answer an approval prompt.

- **What changes:** when the failure carries a numeric `errorStatus` of 408, 429, 500, 502, 503, 504 or 529 (or OMP's matching statusless retry-exhaustion summary follows it), the attention clears at the terminal `agent_end`, the seat reads idle, and an ordinary send is accepted. The failure stays in the pane and in the activity history. Before the terminal `agent_end`, and at a non-terminal one while OMP retries, nothing changes.
- **What still needs attention:** failures without a typed status (including the prose "529 overloaded"), any other status, denied approvals, rejected input, an earlier untyped or persistent failure in the same turn, retry summaries that don't match the attempt and error, and Pi seats. A failure keeps attention by its status, not by its cause: an authentication or configuration failure whose status is one of the seven releases like any other.
- **Two consequences:** during a sustained provider outage the seat no longer stays in `needs_input` after each exhausted retry, so it stops showing as needing a person; and with OMP retries turned off, a single typed 429 reads idle. No automatic retry is added, and the send guard and wake policies are unchanged.

Checked against OMP v18.2.11 (`e4151593`) source for `errorStatus` and the exhaustion summary; native OMP and provider behaviour weren't run. Tests drive the runner, the activity store and the send guard together, with each status and correlation case.

Thanks to @1solomonwakhungu.
2026-10-19 14:32:21 -07:00
Samuel f8817918b7 feat(daemon): Pi seats honour effort as --thinking, with set-effort and reporting (#1428) (#1528)
Implements the proposal agreed in discussion #1428. Before, a Pi seat's `effort` was stored but never reached Pi, `rig seat set-effort` and `rig seat effort` refused Pi seats, and a Pi seat with `effort` set ran at Pi's default. After, already-authored efforts take effect at each Pi seat's next managed continuation.

- **Launch and resume:** a Pi seat's resolved effort (the seat's own choice, else the spec's `effort`) is sent to Pi as `--thinking <level>` on every managed launch and resume: fresh, successor, handover and restore. Only a value of `set-effort`'s shape is sent; with no value or a value that fails the shape, no flag is sent and Pi uses its own default level. The model string never changes, and OMP command lines are unchanged.
- **`rig seat set-effort` and `--clear`** work on Pi seats. The choice applies at the seat's next managed continuation, and nothing restarts. An unfamiliar level gets a warning, not a refusal.
- **`rig seat effort`** reports a Pi seat four ways: requested, saved, sent at launch (from the identity-verified runner's own command line) and observed (from the level Pi 0.99.0 or later records on this launch's latest successful assistant turn). It reports NOT VERIFIED when it can't tie a turn to this launch.
- **Spec advisory:** an unfamiliar Pi `effort` says the managed launch leaves it out when the value fails the shape check, and that it's sent anyway otherwise.
- **The Pi runner** decides control flags as it parses, so a value that follows a flag is never counted as a flag itself: an OMP `--model` value such as `--approve` now parses, where it was rejected before.

The Pi identity check and the model report are unchanged. Tests cover the builders, the runner's parser, set-effort, the effort report and the spec advisory; the author also checked the flags against real Pi 1.3.0.

Thanks to @smota.
2026-10-19 14:29:55 -07:00
Adam Whitehurst 9c4645905d fix(daemon): forward the pane's editor and display session into managed Claude seats (#1546)
In a managed Claude seat (one started with a native permission mode), Claude's external-editor action (Ctrl+G) opened VS Code instead of the person's `$EDITOR`, and Ctrl+V image paste failed, because the managed launch clears the environment and forwarded only declared names, the terminal names and the locale.

- The launch now also forwards `EDITOR`, `VISUAL`, `DISPLAY` and `XAUTHORITY` by name, expanded in the pane shell like the existing terminal list, so an absent or empty variable stays absent.
- `WAYLAND_DISPLAY` is forwarded as an absolute path: an absolute value is kept, a relative one is joined to the pane's `XDG_RUNTIME_DIR`, and a relative one with no `XDG_RUNTIME_DIR` is left out.
- `XDG_RUNTIME_DIR` and `DBUS_SESSION_BUS_ADDRESS` are not forwarded, so the seat isn't handed the session bus by name. `SSH_AUTH_SOCK`, `TMUX` and `TMUX_PANE` are unchanged.
- Every path that launches or relaunches a managed Claude seat builds its command in one place, so the change covers launch, fresh launch, restore, handover, resume, fork and `rig seat set-permissions`. It takes effect at the seat's next launch.

A `git commit` without `-m` inside such a seat now opens the person's editor, as unmanaged and Codex seats already do. Tests run the generated command in a shell.

Thanks to @AdamWhitehurst.
2026-10-19 14:02:00 -07:00
Mike Schwarz d85429e499 fix: recognise current Claude MCP approval menus across readiness and send (#1549)
A Claude seat sitting at Claude Code 2.1.303's MCP-server approval menu no longer restores as resumed and ready, and an ordinary `rig send` no longer pastes into that dialog. One strict predicate recognizes a complete current MCP menu: its heading, instruction and full warning, at least one checked or unchecked checkbox row (the cursor on any row, an optional "Enable selected" action) and the old or new end footer as the last line. Anything after the footer, such as a later composer or a draft, makes the menu history.

- The native resume assessment applies it at its existing MCP gate, before the active-runtime and verified-identity shortcuts; the older substring matcher stays there unchanged, including its known false positive on an old menu left in history.
- The pane activity classifier uses the same predicate as selection-prompt evidence, ahead of its unchanged selection, permission and idle handling.

Changed results: the two complete current menus (old and 2.1.303 wording) now refuse a no-hook send (409, no input) and read as attention and needs-input in structural activity, the startup permission reader and the full inventory; the 2.1.303 menu now reads `mcp_gate` and not ready. Genuine composers, quoted menus, MCP prose, clipped menus and ordinary permission prompts keep their results, and no working non-dialog frame is newly refused. A fresh running hook still sends into a menu, as before.

Tests drive nine fixed frames through the real assessment, `checkReady`, the startup reader's conversion, the classifier and the loopback send route with recorded paste and key effects, plus cursor, checked-state, single-server, CRLF and missing-part variants. The captures are recreated from the reported 2.1.303 wording, not a native capture, and a full restore wasn't run.

Refs #1541.
2026-10-19 13:54:32 -07:00
Mike Schwarz 8469048209 fix(daemon): pin Node in generated Claude hook commands (#1545)
Claude activity-relay and context-collector commands generated into a project's `.claude/settings.local.json` now use the daemon's quoted absolute Node executable when the managed-command parser recognizes it; other executable names keep today's bare `node` form and its PATH requirement. With a recognized pinned interpreter, a Claude session with an older PATH (started before Node was installed, or under a version manager that moved it) can run these hooks while that interpreter stays installed, instead of showing "node: command not found" on each reply.

- Each path and argument is POSIX-quoted individually. Existing bare-node commands refresh through normal projection and collector provisioning, and a repeat reconcile is byte-identical with no duplicate entries.
- Ownership checks, the plugin's settings-relay deduplication and restore-check matching accept the old and new generated forms together. A person's own wrappers, extra arguments and malformed settings are preserved.
- The plugin does not suppress its own event when the settings interpreter is missing, not executable or a directory, even when the relay script bytes match.
- The bundled core plugin advances from 0.1.13 to 0.1.14 in both manifests, so the existing version authority delivers the changed relay bytes; the CLI version is unchanged.

Limits: a removed or moved interpreter needs a refresh from a healthy runtime. The core plugin's static manifest invocations still call bare `node`, so on a seat whose projection loads the core plugin those Stop hook errors remain until the manifest follow-up, while the pinned settings relay still reports activity. No PATH prepend, shim, new setting, automatic restart or hidden runtime fallback is added. Native reload isn't proven here.

Tests exercise the actual writers (including a `node-22`-named interpreter), legacy and pinned refresh, idempotency, preservation of custom and malformed settings, matcher parity, no-Node-PATH effects and the missing-interpreter plugin fallback.
2026-10-19 13:52:19 -07:00
Mike Schwarz e32a14f951 feat(refocus): bound the work packet's fields, and give its default a per-runtime switch (off on both until proven) (#1542)
The refocus work packet's fields and lists are now bounded, and its default becomes a per-runtime switch that stays off on both runtimes until each is proven. Merging changes nothing a seat sees by default.

- With the packet on, each held or next row's summary, blocker and continuation is folded to one line and cut at 160 characters, with a full-row pointer whenever a field was cut or folded. Lists show at most 20 held and 10 next rows, with the totals (or a lower bound when the daemon itself cut the list) and the list command. Matched section bodies stop at 1,500 characters with a `--depth full` notice; full depth restores section bodies only. These are per-field and per-list bounds, not a total size cap.
- `WORK_PACKET_DEFAULT` is `{ claude: false, codex: false }`, and `OPENRIG_REFOCUS_WORK_PACKET=1/0` overrides it per seat. With the packet off, the hook's output is byte-identical to before.
- Strict current-work selection is unchanged. The parked-baton scenarios move with the bounds: packet on, a seeded fault, and packet off, plus the active control.

Activation per runtime waits for a native check that the packet arrives as input and changes the seat's next action against a packet-off control. Native hook delivery wasn't run here.
2026-10-19 13:23:01 -07:00
Mike Schwarz f86a80285a fix(install): say the CLI is installed and setup is not complete when rig setup isn't ready (#1547)
When `rig setup` (step 4 of the one-line installer) finishes without being ready, the installer now ends with `INSTALLED, SETUP NOT COMPLETE (exit N).` instead of `FAILED [4/4] … (exit 1)`, which read as "OpenRig didn't install" though the CLI was installed and the compatibility check ran. The summary gives the installed CLI path, the Node/SQLite check result (`passed`, or `SKIPPED (not checked; see above)`), a pointer to setup's own "Some steps need attention" list, with a Fix where setup gives one, or to the error that stopped it, and "Fix those, then run rig setup again; the CLI does not need reinstalling."

- Setup's exit status passes through exactly, and setup's own output stays above the summary.
- Steps 1-3 keep their `FAILED [n/4]` line, and a ready setup keeps today's closing line.
- It names no cause that setup's result doesn't establish: a provider check fails for a missing sign-in but also for a probe that timed out or errored, and the installer sees only setup's exit status, so the summary doesn't say "sign in".
- A skipped compatibility check is never reported as passed. Setup's readiness and exit behaviour, provider selection and every other exit status are unchanged, with no extra probe.

The README and getting-started are unchanged on purpose: they show the pinned release's installer, which still ends with `FAILED [4/4]`. They move together with the pin, at the first release tag that contains this script.

Tests: the wrapper tests cover setup exit 1, 40 and a piped run's 43, unchanged early failures, a skipped check and the ready ending; five setup-boundary cases cover sign-in only, a mixed failure, ready, an unselected provider and an uncertain probe.
2026-10-19 13:16:39 -07:00
Mike Schwarz 7b490de5c0 fix: ignore quoted Codex choices above an adjacent normal frame (#1548)
A Codex pane that still shows an old numbered menu in its scrollback no longer refuses an ordinary message when it also shows a complete recognized empty normal composer and its immediately preceding running-status row, separated only by blank lines. Generic numbered-choice evidence above that boundary is treated as history, so those no-hook sends change from refusal to paste plus Enter.

- Drafts, queued input, inline content, missing, clipped or unrecognized frames, and an absent adjacent status keep the existing result.
- Literal permission evidence keeps its full scan and its priority. Current-region choices, permission hooks, fresh-running hooks, paste/Enter and hook freshness are unchanged, and runtime-less and Claude callers are untouched.
- The same frames also stop reading as a current prompt for the other readers of the pane classifier (the Codex permission-prompt reader and the inventory's full-capture fallback); a real permission prompt still takes the literal path.

The ownership rule comes from the parent renderer at Codex 0.160.0 (`a956835d`): stacked dialogs replace the normal status and composer, and inline previews follow the status. It's evidence for that revision and matching complete frames, not a guarantee about every Codex version or arbitrary captured text; an equal-byte synthetic alternative-intent label remains a text-information limit.

A 27-frame fixture ran through the production loopback send route, real SQLite, activity store, delivery guard and tmux input methods, under no hook, a fresh-running hook and a fresh-permission hook, on baseline and candidate: baseline had nine intended failures and the candidate passed all 81. Exactly three no-hook history outcomes change; the other 78 route outcomes and command records match. Native Codex wasn't run.

Refs #1533.
2026-10-19 13:02:55 -07:00
Mike Schwarz 46c5c01d1a docs: correct four onboarding facts (install pin, skill footer, one login, skill disclosure) (#1539)
Four onboarding facts that had drifted, corrected in place. Text only, with no change to the onboarding path.

- The install script pin moves from `v0.6.8` to `v0.6.11`, the newest published release, in `README.md` and `docs/reference/getting-started.md`. Nothing moves these pins automatically.
- The `rigs` skill's footer drops "Written for OpenRig 0.6.7." and keeps the rule that `rig <command> --help` wins when it disagrees with the skill. Both copies stay byte-identical.
- The README and getting-started prerequisites now say one working Claude Code or Codex account is enough: `rig setup --providers` takes either, and the kernel operator adapts the shipped `starter` team to whichever the person has.
- The skill's disclosure of what starting OpenRig and a team writes now names Claude Code workspace trust in `~/.claude.json`, the activity hooks in `.claude/settings.local.json` and a status line there unless the project already has its own. It also says that, unless a permission policy, a per-seat choice or (for Codex) a named profile applies, the kernel's own seats run with an operational default: Codex with `-s danger-full-access -a never`, and Claude Code with its file tools, web fetches and operational commands, including reads under the home folder, allowed without asking.

`npm run test:repo` (docs guard, first-run references, skill mirrors, context packs) and the packaged-skill identity test pass.
2026-10-19 12:47:51 -07:00
Mike Schwarz 5813532c7e feat(provider): each account row carries a sign-in fact from the evidence a refresh already holds (#1508)
Each usage account row (`rig provider status`, its JSON and the TUI's usage view) gains a sign-in fact, `signIn: { state: "usable" | "needs_sign_in" | "unknown", evidence, at }`, read only from the last refresh, never from usage or windows, and kept apart from availability. Nothing decides on it; a test pins three named files (`subscription-moves.ts`, `seat-restart-in-place.ts`, `seat-lifecycle-service.ts`) against reading it, which is a pin on those files, not a proof about every consumer. It ages from `at`, and a daemon restart forgets it.

- Codex: `usable` when the refresh's rate-limit read was answered for the daemon's `CODEX_HOME` login; `needs_sign_in` when `account/read` reported no signed-in account; otherwise `unknown`, with the failure named.
- Claude: `needs_sign_in` only when `claude auth status` reports no login. A stored claude.ai login reads at most `unknown`, because no existing read shows that it works, and nothing new contacts the service.
- Codex's signed-out answer (`account: null`, `requiresOpenaiAuth: true`, then a failed rate-limit read) becomes the named failure `not_signed_in`, from answers the reader already received.

Changed results:
- A row's unavailability reason now prints whenever its availability is `unknown`, windows or not. The TUI gains this here; the CLI already does on main. The rows that visibly gain a line today are Claude rows with windows.
- A new `sign-in:` line follows "current availability" on every row from a daemon that serves the field; a row from an older daemon prints none.

A refresh that identifies no account doesn't set an earlier account's sign-in: account A's row keeps its observation with sign-in `unknown`, and the current home's `needs_sign_in` is served on its own row in the shape the projection already serves with no reading. Superseded rows never claim "not the current login": a resolved Codex row a later read didn't report reads "not the latest read: a later refresh didn't report this row (another login, one it couldn't identify, or this bucket no longer reported)", and a frozen Claude row reads "not the latest read: a later refresh reported another login, or one it couldn't identify". Tests cover each state for both providers, the reader's shapes, success-then-signed-out, the empty-store control, a dropped bucket and a resolved row followed by an unidentified read. The native signed-out response wasn't run.
2026-10-19 12:43:48 -07:00
Adam Whitehurst a58c13b3f0 fix(daemon): prove a Claude launched through a wrapper script by its OS executable path (#1540)
A restored auto-mode Claude seat whose first `claude` on PATH is a `#!` script that `exec`s the real binary now resumes ready with its startup context delivered, instead of ending `attention_required` when its conversation has pushed the "Claude Code v" banner out of the captured text. Before, the managed launch froze the script's real path and accepted only a process with exactly that path, which the running binary never has.

- Today's exact-path match runs first. Only when it finds nothing, and only for a frozen launch file that starts with `#!`, a process can be proved by its OS-reported executable path: absolute, named `claude` or the versioned install layout, and agreeing with the OS process name. The script is read for its first two bytes only, never parsed or executed.
- Every other check still applies: the conversation token, a single Claude in the terminal's foreground group under the pane's own process, two matching samples, and one pane whose PID is unchanged. A script-found process is pinned only after all of them pass, and a later readiness check that needs process proof must match the pinned fingerprint, executable path included. A screen that already proves Claude by itself is accepted as it is today for every launch.
- Native binaries, Nix `wrapProgram` launches and a bare `claude` title keep today's results and fingerprints. The new OS path read happens only while proving a script launch.
- For a script launch the binary it runs can't be known in advance, so it is trusted when first seen and pinned from then on.

Tests cover the wrapper-to-binary case, the pin, each refusal (token, foreground group, ancestry, second candidate, missing or disagreeing path, changed PID, start time or path), overlapping checks before a pin, the script detector's byte cases, and the opt-in path read. macOS and a wrapper that spawns rather than execs Claude weren't run.

Refs #1477.
2026-10-19 12:22:43 -07:00
Mike Schwarz befd941e94 fix(daemon): a ready fresh launch supersedes the old occupant's restore outcome (#1527)
After a failed full restore, replacing the seat's occupant with `rig seat launch --fresh` no longer leaves the seat reading `attention_required` from the old occupant's restore outcome, and `rig seat clear-attention` no longer refuses it with `not_demonstrably_responsive … restore_outcome`.

- Both readers of a seat's restore outcome apply one fence: the event seq of the node's current-generation `seat.fresh_launched` with `status: "ready"`. A restore attempt that started before it describes the retired occupant.
- The inventory (single-rig and fleet) reports `restoreOutcome: "n-a"` for a fenced attempt and takes the lifecycle from the live session. A stored `continuityOutcome` is unchanged.
- Clear-attention finds no restore class for a fenced attempt, so it weighs only startup and pane-identity evidence and never calls the strict reconciler.
- A full restore's attempt starts at its `restore.started` seq; a reconciliation names its attempt by `attemptId`. A zero `attemptId` names none, so the inventory gives it the attempt of the outcome it acknowledges, and clear-attention reads past it as before.
- Nothing is written, and the failed attempt stays in the event history.

There is no fence after an unready or failed fresh launch, a launch from an earlier generation, or two current-generation launches naming different sessions. A restore attempt that starts after the fresh launch applies to the new occupant as usual. Left unresolved on purpose: a subset restore records no start event, so a subset completion after the launch stays current (one before it is fenced); readiness reached after an unready launch, and handover, can't be attributed to the new occupant from the existing records.

Tests in `node-inventory.test.ts`, `seat-attention-reconciler.test.ts` and `seat-fresh-launch.test.ts` cover the fenced and unfenced cases in both readers and the end-to-end fresh launch. With the tests alone on main, the hosted run failed exactly the eight fenced cases.

Refs #116.
2026-10-19 11:20:11 -07:00
Mike Schwarz c02136b33f test: check compact and parked-refocus effects (#1538)
Two regression checks now bind each escaped behaviour to its effect, not to an exit code or rendered text. No product runtime, send, restore or refocus behaviour changes.

- Refocus with parked typed work: the scenario creates a real blocked, typed queue row, asserts its state and tags, runs the shipped refocus hook against the scenario daemon, and asserts on the hook's own emitted context. It runs healthy, seeded and healthy in the installed-scenario job, with an active-row contrast. The seeded fault removes exactly one fallback label in a scratch trace child, and admission requires that exact failing hook-context observation.
- Managed compaction arriving as pasted text: `rig compact` refuses stub runtimes, so a daemon test drives the real enforcer command through a version-bound stub input model into the real precompact hook and asserts its restore-pending marker. An 851-character pasted command must lack the marker despite a successful submission. The model encodes one recorded Claude Code version's behaviour, not a universal threshold.

The existing queue-durability controls and passing scenarios are unchanged, and no required check is added. Two regression-log entries in `docs/as-built/arteries.md` record the escaped promises, the layer that missed each, the new check and its limit. Native compaction and restore, hook scheduling, and agent reading aren't exercised.

Refs #1483. Refs #484.
2026-10-19 10:49:46 -07:00
Mike Schwarz 461f0dae4f fix(daemon): distinguish saved hook channels in restore-check (#1537)
Restore-check now tells apart a saved explicit Claude activity resource, a saved selected core-plugin relay, and neither known OpenRig channel, instead of calling every seat without the explicit resource deliberately hookless. It's a diagnostic correction; it doesn't establish a fix for the reported native incident.

- A saved explicit resource keeps its existing settings and relay findings, and a configured plugin never masks them.
- A saved, readable core-plugin relay reads green as configuration evidence, with native loading and execution unverified.
- Missing, malformed or unreadable selected core assets, or disabled or malformed local settings, read as a yellow caveat. A broken selected plugin adds that caveat while keeping a fully projected resource's evidence.
- With neither saved channel, a resolvable current selection of hooks reads yellow "stale selection", an unknown selection reads yellow "selection unknown", and a resolvable selection without hooks reads green "not applicable" for these known OpenRig channels only.

The added yellow checks can turn otherwise-green output into `restorable_with_caveats` or `ready_with_caveats`. The CLI still exits 0 and offers no repair command, and existing blockers and unknown causes keep their priority. Desired-spec comparison works only for absolute `path:` references; `local:` and other unresolved references read "selection unknown", not stale. A frequent caveat doesn't mean hooks are broken or a seat needs a relaunch. Nothing about restore selection, launch, adoption, hook execution or required actions changes.

Tests cover the hook-selection matrix, the restore-check service and routes, including a fully projected resource with a broken selected plugin, with the restore fixture preserving the original token request, saved context, user settings and hooks, and no startup replay.

Refs #1530.
2026-10-19 10:31:43 -07:00
Mike Schwarz 1bbe81f428 fix: use community-harness names across public and runtime interfaces (#1518)
Community-maintained harnesses use one naming family throughout OpenRig: `rig community-harness list`, `/api/community-harnesses`, presets under `$OPENRIG_HOME/community-harnesses/`, and `communityHarness` selection and status fields. Rig specs keep `runtime`, existing preset runtime names and the built-in runtimes.

- The old command, route, directory discovery and JSON names have no public alias. Existing preset files are left untouched and aren't moved or discovered from the old directory.
- The database column and migration 114 are unchanged and map to the new domain field. Launch-only handling, unconfirmed identity, screen-only activity and the resume/fork refusal are preserved.
- Saved snapshots get a narrow read-only decoder: a nonempty legacy `agentApp` string supplies `communityHarness` only when the new key is absent, and a present new key wins, including an explicit null or a malformed value. Reads preserve the stored bytes, the old key is removed from returned objects, and new capture never writes it. This is storage compatibility, not an old public alias.

Tests cover 11 snapshot-boundary cases (readers, precedence, malformed legacy values, unchanged stored bytes, new-key-only serialization) and five naming and storage cases (API and preset-directory isolation, untouched old preset files, migration 114 fresh and already applied, partial-schema reads). Native harness behaviour isn't exercised; synthetic fixtures stand in for it.
2026-10-19 10:24:02 -07:00
Adam Whitehurst 3e65d10dde fix(tui): open a terminal in the Herdr the shared TUI is viewed from (#1356)
From the shared TUI (`rig tui --shared`) viewed in a Herdr pane, opening a seat's terminal printed `Unrecognised or unavailable hosting terminal: "unknown"` and opened nothing. On Linux it now opens the view in the Herdr of the tmux client that was active last, which is normally the person looking at it.

The TUI runs in the daemon's tmux server, so the person's Herdr markers sit on their tmux client and never reached it. When the TUI isn't itself in Herdr, `open-window.ts` lists the clients attached to its tmux session. If exactly one interactive client was active last, it reads only `TERM_PROGRAM` and the `HERDR_*` markers from that client's environment and passes them to the `rig terminal open --window` child in place of its own.

- Last active is a hint, not the sender of the key: it can belong to a different viewer, and input sent with `send-keys` or by a control-mode client marks no client active. The docs and the code comment say so.
- Every case without a single last-active Herdr client keeps today's result: no client, a tie in the same second, an unreadable or non-Herdr newest client (an older client is never used instead), control-mode clients, and macOS and other platforms. A newest client in a different Herdr session gets the existing endpoint refusal. There's no new refusal or message.
- The CLI is unchanged, so ordinary `rig terminal open` callers keep their environment and desktop-terminal choice.

Tests cover the real read path against a tmux shim and Herdr-marked processes, including ties, unreadable and non-Herdr newest clients, control-mode clients and a failing tmux. `docs/reference/getting-started.md` describes the behaviour.
2026-10-19 09:49:27 -07:00
Mike Schwarz 8273a7578f fix(daemon): let current idle frames outrank terminal redraws (#1521)
A current, complete Claude or Codex idle frame no longer has its served `agentActivity` rewritten to `running` just because the terminal repaints. The existing cached capture and idle-layout reader supply the evidence; a generic footer, a stale capture, a wrong target or runtime, or a terminal write in or after the capture's second keeps the existing fallback.

- The frame carries a lower bound on when its bytes were taken: recorded before a single read, and before a whole batch (a batch miss takes a fresh per-seat start). It counts only when that start falls in a later second than tmux's last write, and only while it is under 5 seconds old. A later poll with no new write doesn't invalidate it, and a delayed read can't renew old bytes.
- The idle hook is bypassed only while motion is running, so quiet seats keep the hook's source, reason and event time.
- Current running and needs-input hooks, usage-limit precedence and the existing fallback without a qualifying frame are unchanged. There is no new poller, capture, cadence or silence threshold.

This changes the served `agentActivity` used by JSON, activity filters and graph consumers. It doesn't rewrite the separate activity value that human `ps` and TUI labels may prefer. The agy seats reported in #824 are unchanged: this adds the precedence rule a future agy idle reader could use, without adding that reader. #824 stays open.

Tests use retained Claude Code 2.1.296 and Codex 0.160.0 frames with edited live and streaming rows, and cover later polls without writes, quiet-hook provenance, and deferred single and batch captures through the real structural and motion services.

Refs #824.
2026-10-19 09:12:03 -07:00
Mike Schwarz 5ec271f981 fix(daemon): a send whose caller went away while it waited never types later (#1513)
`POST /api/transport/send` didn't pass the request's abort signal to the transport. A `rig send --wait-for-idle` whose caller went away (Ctrl-C, or its own timeout) kept waiting in the daemon, and when the seat went idle it typed the text and pressed Enter, though nobody was waiting for the result.

- `/send` and `/broadcast` pass the request's signal to the transport; the server aborts it when the client closes early.
- Before any input, a cancel ends the send as `caller_cancelled`, with `sent: false` and `inputPhase: "not_reached"`, and nothing is typed then or later. This covers a request that arrives already cancelled, the idle waits (including a readiness observation still pending, whose late result is ignored, so the seat's lease is released as soon as the cancellation is seen), the steps before input, and the Enter-only send used by `rig send`'s staged-text retry and `rig walk`. A cancelled Enter-only send types no conversation text and no Enter, though leaving copy mode may already have sent tmux's `send-keys -X cancel`.
- A cancel while queued for the seat's lease is seen when the lease is granted, and the send ends before anything is written or recorded.
- A retry whose delivery id already has a record reports that record's real outcome even if the caller has gone.
- The last check runs inside the tmux adapter immediately before `paste-buffer`, and is reported as `not_reached`, not `attempted`.
- After input may have started, the signal is ignored: Enter is sent as today and the result stays `attempted` or `written`.
- Queue wakes, committed outbox deliveries, draft-aware deliveries once their record is committed, and retained typing-guard delivery are not tied to the caller. Managed preparation keeps its `preparation_cancelled` result.

Changed results: a cancelled `--wait-for-idle` send that used to type later now never types (the unreceived response is HTTP 409 `caller_cancelled`); a broadcast recipient that wasn't started reads `caller_cancelled` and counts among the failed recipients, with its outbox row recorded as failed.
2026-10-19 08:36:49 -07:00
Mike Schwarz a1f6a808d0 fix(daemon): node detail reports a guidance block's installed file only from evidence (#1523)
`GET /api/rigs/:rigId/nodes/:logicalId` lists a seat's `installedResources`. For a guidance resource it reported the spec's `target` as the installed path, though `target` is never used to write: the runtime merges guidance into its own file (the rig's Claude managed-blocks file, `CLAUDE.md` by default, or `AGENTS.md` for Codex). A Claude seat declaring `target: AGENTS.md` was reported as installed in `AGENTS.md` while the block was in `CLAUDE.md`.

For guidance entries:
- `targetPath` is the runtime's file only while that file holds an ordered, complete managed block with the resource's id (its BEGIN marker followed later by its END, in the current or older form). Otherwise it's `""`, not guessed. This is evidence about the file at the node's current cwd: no launch cwd is recorded, so it can't tell this seat's write from a block with the same id written there by something else.
- `declaredTarget` carries the spec's `target`, when there is one.
- `effectiveTarget` carries the file the runtime would merge into, when the runtime has one (Claude, Codex).

Other resources are unchanged. The per-runtime file rule now comes from one function shared with restore's guidance check, and restore's own block classification is unchanged. Nothing is written or cleaned up; only the report changes.

Tests in `node-inventory.test.ts` use real files: a declared `AGENTS.md` on a Claude seat; a runtime file without the block; the rig's `CLAUDE.local.md`, Codex's `AGENTS.md` and the older markers; no claim for an unknown runtime, an `append` merge or a half-written block; no claim for a reversed marker pair or an orphan END, in either form; and a changed cwd whose file lacks the block.

Refs #64.
2026-10-19 07:56:04 -07:00
Mike Schwarz b8942a1ae4 fix(specs): mark the shipped agent specs' per-seat role file as their role orientation (#1522)
The 15 shipped agent specs that deliver a per-seat role file (`guidance/role.md`, sent at startup) now mark that startup entry `orientation: role`. After a seat's next fresh launch from these specs, `rig queue whoami --json` reports its role binding, and refocus names the role file after compaction. Before this the role read as `not-declared`. Delivery is unchanged: the same file, sent the same way, once.

None of these specs ever projected a role into a shared `CLAUDE.md` or `AGENTS.md`: their profiles select no role guidance, and the unused role guidance declarations stay so a profile that imports them keeps working.

The startup guide now explains how to find and remove, by hand, a leftover shared `role` block that a kernel installed before 0.6.5 may have left in a working directory's guidance file, only after each seat sharing that directory reports its own role. Nothing is edited automatically.

A test resolves every profile of all 15 specs and checks the marker, with resources, startup files and actions otherwise unchanged.

Refs #64.
2026-10-19 07:24:07 -07:00
Rudy Mizrahi Celekli 6d7ec6b189 fix(tui): show open human updates in Feed (#1054)
The TUI Feed now shows open queue updates addressed to a person (pending, in progress or blocked) as informational cards, even when no Slack delivery receipt exists. Critical and urgent updates come before routine ones, with their original priority and detail. The update window is bounded and reports its own coverage, and reading the Feed doesn't change queue state.

Current updates and delivery history keep distinct identities, so the same queue item doesn't show as two cards, and historical receipt details are kept. Decision and blocker selection and the receipt-history endpoint are unchanged.

The critical-first ranking follows the approach in #1055 by @Aschenbath.
2026-10-19 06:56:26 -07:00
Mike Schwarz 0f52427488 fix(cli): give working cmux doctor remedies (#1514)
`rig doctor`'s cmux warnings now point to the setting that works: in cmux Settings > Automation, choose "Automation mode" for Socket Control Mode, or set `automation.socketControlMode` to `automation` in `~/.config/cmux/cmux.json` (older versions use `~/.config/cmux/settings.json`), then run `rig doctor` again. cmux reloads saved settings itself and doctor re-probes on each run, so no daemon restart is needed. The `rig setup` step, which no longer changes cmux settings, is gone.

When `~/.config/cmux/settings.json` doesn't set the key, the shell and daemon warnings now say that doctor assumes cmux's default `cmuxOnly` and doesn't read `cmux.json`, instead of stating cmux's mode as fact. An unreadable settings file asks for its JSON to be repaired rather than removed, and a probe that fails only in the daemon says so without guessing a cause. Detection is unchanged.

Refs #9.
2026-10-19 06:50:10 -07:00
ivanenev ad912ba93a fix(daemon): print the Pi/OMP runner READY marker once per ready transition (#1401)
The Pi/OMP runner now prints its READY marker only when it moves into the ready state. If another successful state reply arrives while the runner is already ready, no second READY line is printed. An error that clears the ready state still lets the next accepted reply announce READY again. The session identity update is unchanged and runs outside this display guard.

This is a defensive guard: no retained trace shows a repeated READY line.

Text streaming is unchanged in behaviour. The existing check that appends only string `text_delta` events is now named `hasDelta`, and a new test keeps cumulative snapshot events from being appended between deltas.
2026-10-19 06:41:42 -07:00
Mike Schwarz 4090676119 fix(daemon): a seat restart names the Codex startup gate that stopped it (#1502)
A Codex seat restart that stops at a native startup screen now names it. The launch result carries the resume probe's gate code, and the restart report adds `account.startupGateKind` beside `account.startupGate`, which stays a string or null. For four named gates (hook review, trust, model selection and update) the remaining step names the decision waiting in the pane, says it is for the person or an authorised operator, and gives the recovery command. OpenRig makes none of those decisions.

The report follows the newest screen OpenRig observed: the message, `startupGate` and step describe that screen, not an older one. The one input the resume check may type is the update prompt's skip key (3), at most once. The named and generic steps say whether it was sent, or tried and failed, and a failed send says its effect is unknown. The sign-in and no-saved-session steps keep their own text.

Restart execution is unchanged: no new capture, poll, retry, key or refusal. The plan and every report, successful ones included, gain two JSON fields: `codexNoDaemonFlag`, launch evidence only, and `processMode`, which is `unknown` today and never inferred from the flag. The CLI prints the gate kind and those two lines.
2026-10-19 06:23:41 -07:00
Devulapalli Naga Sri Vaishnavi 92abe2a589 fix(daemon): clear workflow completion marker on redrive (#1517)
When a failed workflow was redriven, the instance reopened as `active` but kept the failure time in `completedAt`, so the API and the web UI showed a running redrive as completed.

The instance store's frontier update now clears the completion time whenever the next status is `active` or `waiting`. A terminal status still keeps its existing time when no new one is supplied. A regression assertion covers the redrive.
2026-10-19 06:18:57 -07:00
Mike Schwarz bf1462263f docs(reference): link community-built Rig HQ viewer (#1515)
The getting-started guide now has a short "Built by the community" list, after the section on viewing your team. Its first entry is Rig HQ by dmelo, a read-only pixel-office viewer for rigs, seats, attention and queue handoffs, which its author reports testing with OpenRig 0.6.5.

The list says that these tools are maintained by their authors, that we haven't tested them, and that it doesn't promise support or compatibility with your OpenRig version. Setup and support questions go to each tool's repository.
2026-10-19 06:17:54 -07:00
ivanenev ae65fe7865 fix(cli): resolve rig names to ULIDs in grow and remove commands (#1407)
`rig grow <rig>` and `rig remove <rig>` now accept a rig name as well as an id, through the shared resolver `rig add` already uses. An exact id resolves first, even when a rig's name equals that string. A name that more than one active rig shares is refused before any change, listing the candidate ids. If the rig list can't be read, the commands fall back to treating the input as an id, and the error says the list couldn't be read and suggests passing the rig id (`rig ps --json`).

Before this change a rig name was passed straight through as an id and failed with not found.

Tests cover a name, an ambiguous name, an exact id and an unreadable rig list for both commands.
2026-10-19 05:31:05 -07:00
Mike Schwarz 2e5242bc16 docs(daemon): give supported remedies for protected projections (#1512)
The warning for a protected projection target now names only remedies that exist: fold the operator edit into the spec source, or move the edited target aside before the next projection. It no longer tells the operator to re-run projection with `--force`, which no command offers; force is an internal parameter that no CLI option or route passes. The `hash_conflict` warning already named the same two remedies, so the two branches now agree.

No flag is added, and protection, conflict classification and the internal force path are unchanged. Two code comments now distinguish internal force from operator commands. The test checks that the warning names both remedies and doesn't mention `--force`.
2026-10-19 05:29:41 -07:00
Mike Schwarz 96f007e8de docs: make machine effects and recovery guidance accurate (#1510)
README's "What OpenRig changes on your machine" now matches the writers it describes: startup writes Codex's managed config only when a Codex seat is recorded (otherwise it removes stale managed hooks), the first Codex launch ensures the config, a user's own Claude status-line command wins, and the warning about settings files is narrowed to the writers that actually recover unreadable files, without a product-wide preservation guarantee.

Error and help text now point to steps that exist:
- the protected-compaction refusal for an unrecorded pane names `rig reconcile-session <session> --no-launch`, notes that it records a new claimed session row with unverified conversation continuity, keeps input protection on, and points to `rig context get help` when the pane can't be resolved;
- `rig provider` prints the daemon's error message instead of a bare code, and prints a seat's unavailable reason even when it has windows;
- `rig scope --workspace` help states that a missing tree falls back to the configured root except for `mission create`, which creates the named tree, and `approve`, which refuses;
- config help tells a complete `--full` payload apart from the usual projections, including `queue transitions --full` and whoami's `--all-peers`;
- Pi cost switches are described as taking effect at a seat's next launch or resume, provider usage windows as off by default with the command to enable them, and cost history as `--json` only.

Human output and help text only: JSON output, exit codes, behaviour and path selection are unchanged.
2026-10-19 05:28:42 -07:00
Mike Schwarz edd0a967e6 docs: an adopted seat's in-place restart refuses, and which conversation a restart can prove (#1509)
`rig seat restart --keep-conversation --help` and the capability map's restart entry now describe today's behaviour for an adopted seat, one OpenRig didn't launch: an in-place restart refuses with `claimed_session`.

They also say which conversation a restart can prove. The stored conversation must match the one the running Codex's command line names, or, when it names none, the only one Codex has logged since it started. OpenRig can't tell which conversation Codex is on now, so if the conversation was changed inside the running Codex, the restart may refuse or resume the earlier one; check the pane with `rig capture <seat>` first.

Text only; no behaviour changes. The generated context packs check clean.
2026-10-19 03:48:28 -07:00
Mike Schwarz bcb0438b67 fix(daemon): due parked-row reminders for one seat go as one message per scheduler pass (#1507)
When several `--wake-after` timers for one seat's parked rows fall due in the same watchdog scheduler pass, the seat now gets one message naming every row and its summary, instead of one interruption per row.

What's grouped: an ordinary parked-row reminder, a one-shot timer that serves exactly one live parked row and carries the default message. Unchanged: a single due reminder (same text, same delivery ID, same path), a timer with a custom `--wake-message`, a watchdog shared by or attached to several rows, a repeating wait, a provider-limit timer, every other policy, and `evaluate` called outside the scheduler. Grouping is within one pass only: nothing is postponed, jittered or re-cadenced, and reminders that fall due in different passes still arrive separately.

Before every send in a seat's group, each remaining held reminder is checked again (job still active, the stale-park guard, still eligible to join a digest), with nothing awaited between the check and the send. A reminder that already has a delivery record of its own, including a lone send cut short before it was accounted, goes alone through its own delivery ID and reads the earlier receipt back without writing. A digest whose members can't all be bound because one already has a record is refused before any input, and no member is accounted as attempted. A storage error while binding is reported as a failed attempt for every member, as a lone wake's storage error before input is today.

Every member is bound to the one attempt before any input: one outbox entry per member under its own delivery ID, committed and claimed in one transaction, then one send through the session transport and typing-guard handling. If the daemon stops or accounting fails before every member is recorded, the next pass accounts each attempted member from that record; an attempted member is never sent again, alone or in a new digest, and a reminder that was never attempted still goes. Each member keeps its own history row (its own line plus the digest's ID and size), schedule, actionable state, "park wake fired" receipt and one-shot retirement; a retained, failed or timed-out attempt is accounted to each member as a lone reminder's would be. A stop is honoured before every send, between seats and within a seat's group: the send in flight finishes and is accounted, and every reminder not yet sent stays due.

The watchdog's delivery moves from `startup.ts` into `domain/watchdog-delivery.ts`. Costs: one outbox existence check per remaining eligible member, and the full digest text stored in each member's outbox row; a held digest lists once per member in `rig seat held-messages`.

Tests: `watchdog-park-reminder-digest.test.ts` (15 cases through `createDaemon`) and `watchdog-delivery-guarded.test.ts` (3 cases on the real outbox and draft-aware transport, including a lone send cut short and the store reopened). Nothing is sent to a live seat.
2026-10-19 03:26:15 -07:00
Mike Schwarz aa097e6dc8 docs(context): compare machines' token use with rig usage top over one window (#1505)
The capability map now names `rig usage top` next to `rig usage series`, and how to compare token use across machines with it: run it on each machine, or against each machine's daemon with `OPENRIG_URL`, back to back, with the same `--window`, no `--top`, and `--json`.

For each machine the agent reports the host, the window and its `sinceIso` (each daemon counts from its own clock), how many seats were ranked and over what span, the unknown seats and their reasons, and each seat's runtime, declared `model` and last observed model (`modelObservation`) from `rig ps --nodes -A --json`. A seat that has reported usage before but has no usable samples in the window is listed as unknown with its reason, never as zero; a seat that has never reported usage is in neither list, so the agent names each seat that `rig ps --nodes -A --json` shows and `rig usage top` doesn't as not covered. Machines aren't added into one total unless they cover the same seats over the same span.

No collector, endpoint or command is added. Docs only: the generated context packs and their mirrors check clean.
2026-10-19 02:28:05 -07:00
Mike Schwarz 191371d064 chore(text): say "harness" and "community harness", not "agent app", in user-visible text (#1506)
User-visible text now says "harness" for the agent software around a model and "community harness" for a harness someone outside OpenRig maintains and installs as a preset. "Runtime" stays the broad category: the rig spec's `runtime` field and the TUI's runtime column, which also cover terminals and stubs.

Changed wording: `rig agent-app`'s help and list output, the `rig ps` line for a community-harness seat ("Community harness (<seat>): …"), launch warnings, the fork, resume and start errors, the readiness reason, preset problems shown by `rig agent-app list`, `rig ps` and `rig up` preflight, the restore decision and error, one startup error, `docs/reference/agent-startup-guide.md` and `ROADMAP.md`. The human sentence in `agentApp.needsInput` now reads "from the screen only: no harness prompt pattern".

`docs/reference/topology-naming.md` gains a table of what a seat runs: runtime, harness, community harness and terminal.

Unchanged: the `rig agent-app` command, `GET /api/agent-apps`, the `agent-apps` preset folder, the `agent-app` runtime ID, the `agentApp` key, the `app_not_running` code, migration 114 and the `sessions.agent_app` column, and every decision code and condition. Internal identifiers keep their names until that code is next changed.

Tests: three test files update their expected messages. The rendered docs and this branch's CLI help weren't checked by running them.
2026-10-19 02:13:19 -07:00
yohannv 05b1c0580e perf(daemon): read the process table from /proc on Linux instead of forking ps (#1385)
On Linux the daemon now reads the process table from `/proc`, on a worker thread of its own, instead of forking `ps`. Native process lineage and the resume-metadata refresher both call one `readProcessTable()`; other platforms keep running the same `ps` as before, in the C locale.

The rows are the ones `ps -Ao pid,ppid,pgid,tpgid,ucomm,lstart,command` prints in the C locale: the task name cut at 15 bytes, `lstart` from `btime` plus the start time in ticks, `[name]` (and ` <defunct>` for a zombie) for a process without a command line, control characters as `.` and each byte of a non-ASCII character as `?`. Callers asking while a read is in flight share it; a later call reads again. The files are read on the worker thread and sent to the event loop in parts of 100 pids, so a `cmdline` read that waits on its process's memory lock holds that thread, not the event loop. If the reader thread is lost, only the reads sent to it are rejected.

Failure behaviour: a pid whose `stat` is gone (ENOENT, ESRCH) or hidden from the daemon's user (EPERM, EACCES) is left out, and a `cmdline` that can't otherwise be read keeps its process as `[name]`. Any other `stat` read error rejects the whole table read, and callers handle it as they handle a `ps` that fails: the strict census rejects, and best-effort listing returns no rows. This is stricter than `ps`, which skips one unreadable pid and lists the rest, so for a per-pid fault such as EIO an observation can lose otherwise readable processes that `ps` would have returned.

Measured by the author on Linux 7.0 with 238 processes: a table read went from about 69 ms of CPU and a fork of the daemon to about 8.4 ms and no fork. In a Linux container the event loop stays busy about 1.3 ms per read, against 5-6 ms with `ps`.

Tests: a fake `/proc` helper runs the process-table scenarios through the `/proc` path on any CI platform, including a gone `stat` that's left out and another `stat` error that rejects the read. Not run: a native Linux comparison under hidepid or with a real per-pid fault. macOS keeps `ps`, unchanged.
2026-10-19 02:08:23 -07:00
Mike Schwarz 876f74941a fix(provider): a Claude account's availability stays unknown until its seats' readings are linked to it (#1504)
A joined Claude account row no longer reports `currentAvailability: "known"` from readings it can't attribute to that account.

The row joins the freshest status-line sample across seats to the daemon's last `claude auth status` login. A sample records a seat, a window, a percentage and a reset, but no account, and nothing links a seat's reading to the login it used when it sampled. So two situations read exactly like the right account: a seat on a different login whose window has the same reset, and a seat still on an earlier login after the daemon's login changed. In both, the row read "known" for an account whose room it hadn't measured.

Changed result: with `provider.usage_windows` on (it's off by default), the joined Claude row's `currentAvailability` is now `"unknown"`, with `unavailableReason` "no sample-time link between these seats' readings and this login: a seat on another login, or still on an earlier one, reads the same, so this account's availability isn't known from them". Until a sample-time seat-to-account binding exists, that applies to every joined Claude row. "Unknown" isn't zero allowance, and it changes nothing about running work.

The reason is in the structured row (JSON and the cross-host shape). The CLI and TUI print `unavailableReason` only for a row with no windows, so with windows present they show "current availability: unknown" with the existing identity note, not the new sentence.

Unchanged: each window's reading and the seat it came from, the identity caveat that the seats aren't proven to share this login, the differing-reset guard, the frozen rows for earlier logins, and other providers.

Tests: two cases in `provider-claude-usage.test.ts`, the same reset on another login and a seat still on an earlier login, both of which read "known" before this change and read "unknown" with the reason after it. One existing assertion changes from `known` to `unknown` plus the reason; that is the changed result. These are hermetic input cases; a native two-login check was not run.
2026-10-19 00:54:42 -07:00
NIKHIL edc5bc75fc fix(daemon): refuse a managed launch whose session name tmux would rename (#1500)
Managed launch preflight now refuses a session name tmux would rename, before any session is created.

A rig name ends every seat's session name (`{pod}-{member}@{name}`), and tmux replaces `.` with `_` in a session name. So a rig named `demo.v2` launched a seat that OpenRig recorded as `[email protected]` while it ran in a tmux session called `dev-impl@demo_v2`. Every later probe on the recorded name failed (`can't find pane: v2`), so the seat couldn't be observed or reached, and its tmux session was left behind. The new error names the rewritten session and says to use a rig name without dots.

Where the check runs:
- the pod path, `preflightValidatedSpec`: `rig up`, adding a member to an existing rig, first-start retry, bundle install and bootstrap, expand, and the preflight preview;
- the legacy path, `RigSpecPreflight.check`, before `NodeLauncher.launchNode`. Its tmux collision probe now skips a name this check already rejected, because a real `has-session` on a dotted target fails with `can't find pane` and would throw before the clear error is returned. Ordinary names are probed as before, and a real collision is still reported.

An existing dotted rig gets this error when a member is added or a first start is retried. Unchanged: materialize-only (`rig import --materialize-only` and `rig adopt`), which creates no session and still creates a dotted rig; explicit attach; restore and stored identities; spec validation, spec review and bundle assembly; and session-name parsing and its character set. Paths that launch without preflight, such as `rig seat launch`, handover, restart and restore, aren't touched by this change.

Tests: `tmux-renamed-session-preflight.test.ts` covers pod `rig up`, legacy instantiate and adding a member to a dotted rig, each refused before `createSession`, with controls for names without dots, validation and review; materializing a dotted spec without creating a session; and the legacy probe skip, with an ordinary collision still reported. `retry-first-start.test.ts` covers the first-start retry, and `pod-bundle-assembler.test.ts` keeps a dotted rig assembling into a bundle. The tmux rename itself was observed on tmux 3.6 only; the check is a string check and doesn't call tmux.
2026-10-18 23:49:46 -07:00
Mike SchwarzandNash Aschenbath 2fbc425da2 feat(seat): save an existing seat's launch directory (carries #1154) (#1498)
`rig seat set-cwd <seat> --cwd <absolute-path> --reason <text>` saves an existing seat's working directory for its next fresh launch or rebuild handover. The seat's node, address, queue and history stay as they are. Until now the only routes were recreating the seat, which loses its history and handover lineage, or editing the database by hand.

This carries #1154 by Aschenbath, in the smaller shape its review asked for. Their work is the validation, the audited save with its concurrent-change check, the read-only destination check, the route, the CLI verb and `launch_cwd` in `rig seat status`.

What it does:
- Saves the directory and a `node.cwd_changed` audit event (from, to, reason, operator) in one transaction, with a concurrent-change check.
- Creates the folder if it's missing and writes nothing else there. The next launch writes the startup files, as it does today.
- Before saving, it reads, without writing, the enumerated resource copies and startup skills that launch would place there. It refuses with `cwd_destination_conflict`, naming the paths, for an operator-edited file, an unrecorded file with different content, or two sources for one destination. That's stricter than launch, and it's a point-in-time check, not a guarantee against later changes; at adoption, launch applies its own policy. A refusal can leave the new folder created. An agent app takes no startup files, so none are checked for it.

What it doesn't do:
- The saved directory doesn't move the running process. Adopt it with `rig seat launch <seat> --fresh --stop --reason <text>` (a blank conversation) or `rig seat handover <seat> --source rebuild --reason <text>` (carries durable context). An in-place Codex restart isn't adoption: it keeps the directory it observes from the running process.
- Until then, background work can already use the saved directory. For a running Claude seat, collector provisioning writes `.openrig/context-collector.cjs` and merges `.claude/settings.local.json` there, under its existing preservation rules, and managed compaction, manual or automatic, asks the seat to write its restore map there, which may be outside its current workspace. These are examples, not every consumer. Adopting promptly is guidance, not a guard against a poll or compaction that runs first.
- Before adopting, `rig down`/`rig up` or a fork handover resumes the existing conversation in the saved directory, and Claude keeps conversations per project directory, so the resume may not find it (not run natively). Files in the old directory are left as they are.

Tests: `seat-set-cwd.test.ts` (35 tests; real SQLite and the Claude, Codex, Pi, OMP and stub file adapters) covers the save and its event, symlinked destinations, refusals with no seat, custody or startup-file change (invalid input, missing or malformed startup context, an ambiguous seat, and destination conflicts for each runtime and resource kind), concurrent changes and audit-write failure leaving the old directory saved, the typing guard, and a community agent app's seat. The route, CLI lifecycle, handover-source and stub CLI journey tests pass. Native Claude or Codex conversation resume across directories was not run.

Refs #1154
Refs #762

Co-authored-by: Nash Aschenbath <[email protected]>
2026-10-18 23:19:29 -07:00
NIKHIL 5a9339aab6 fix(daemon): trim each state name in GET /api/queue/list (#1501)
`GET /api/queue/list` now trims each comma-separated state name, so a spaced list such as `rig queue list --state "pending, in-progress"` (or the MCP `rig_queue_list` tool with the same value) returns both states' rows instead of only the pending ones.

Everything else keeps today's results: a name that isn't a queue state still matches no rows, alone or beside a known name; an explicit filter of only spaces or commas still matches nothing; and an absent `state` or an empty `state=` keeps its default, on the plain and `attention=1` paths and with `activeOnly`. This is a partial whitespace fix: a misspelt state still answers an empty list.

The new test covers the spaced and padded lists and each preserved case on both list paths, including with `activeOnly`.
2026-10-18 22:48:32 -07:00
Mike Schwarz 6e94b00f61 fix(daemon): keep managed /compact short enough to run, send it only to an idle seat, and report it truthfully (#1483)
Managed `/compact` on Claude seats runs as a command again, waits for an idle seat, and reports honestly what happened to it.

Since 0.6.10 the managed `/compact` grew past what Claude Code takes as a slash command in one bracketed paste (a native comparison on Claude Code 2.1.282: 792 characters ran, 850 arrived as pasted text), so compactions arrived as text and didn't run while the attempt read as delivered. The automatic path also didn't wait for an idle seat.

The change:
- A 600 UTF-16 code-unit budget for the command. It always keeps the managed-compaction prefix the hooks recognise and a short trust note, then the map path and the policy's instruction if they fit. What doesn't fit moves to the restore map or the restore request, including the full trust-channel note. Bracketed paste is kept.
- Automatic `/compact` waits for a pane-confirmed idle seat, as the manual path does, within the existing preparation deadline.
- A new `compact` result (`not_sent`, `submitted_unconfirmed`, `uncertain`) beside the preparation prompt's `delivery`, in the compaction state, the trigger route and the CLI. `stage` values are unchanged, and nothing claims compaction ran.

Changed results against main:
1. Shared transport: a guarded send whose text was written before an exception returns `sent: true` / `outcome: failed` / `inputPhase: written` (it returned `sent: false`); an issued but unconfirmed write returns `outcome: failed` / `inputPhase: attempted`. For an issued-write exception with no `code`, `rig send` gets HTTP 409 and exits 1, where it got 500 and exited 2. Queue classification is unchanged.
2. An established pre-input `draft_*` refusal ends automatic compaction as `not_sent`; a refusal after a paste stays `uncertain`.
3. An attempted or written `/compact` ends `uncertain`, with no automatic replay. Only a known pre-input idle deferral re-arms.
4. `--skip-map`: the restore request names a map completed at the attempt's path (final file, then `.tmp`, matched on the marker); otherwise it says no map was required.
5. Wording on every send: a failed Enter receipt says the submission outcome is unconfirmed, not "not submitted"; "Enter was not sent" only when the throw came before the Enter key reached the adapter.
6. Automatic `/compact` waits for a pane-confirmed idle seat.
7. A compaction-only refusal, `pane_unknown_protected`, for a running draft-aware seat whose binding records no tmux pane, on both paths, before any preparation or `/compact`. The manual trigger answers HTTP 409 where it answered 502, `rig compact` exits 1 where it exited 2, and the response carries no `preparation` or `compact` field for this refusal. A fresh attempt leaves no outbox rows or input effects; an attempt already under way is stopped and keeps its earlier `compact` evidence, and no old outbox rows are cleared. The check reads the guard's mode the way an automatic lease chooses it (desired draft-aware, else effective), so during a mode switch the manual path's refusal reason can differ; nothing is written to the seat either way.

The premise behind item 7 was corrected in review: compaction never reached a protected seat with no recorded pane, idle or busy, because the input layer already refuses every write to a managed seat without a known pane. So the refusal removes nothing that works; it makes that case explicit and stops it leaving held `/compact` copies.

Tests run through the real `SessionTransport` with a recording tmux, real draft-aware delivery and an outbox on a migrated database, including a real zero-input transport refusal and the pinned pane-less cases. Native compaction was not run on the build machine; the 600-character budget leaves about 190 characters of margin under the measured 792.

Refs #27
2026-10-18 22:17:32 -07:00
Mike Schwarz 0463591b8a feat: show last observed occupant model in ps and roster (#1493)
`rig ps --nodes` and `rig roster show/find` report the current occupant's last observed native model separately from its configured model, with the evidence source and native record time.

Claude and Pi identify assistant-response evidence; Codex identifies recorded turn configuration. Missing, stale-occupant or ambiguous evidence stays UNKNOWN, with no fallback to the configured model and without transcript contents or paths.

Inventory reads use two bulk pane snapshots and a shared process census. Unchanged file facts are cached by occupant and record identity and metadata, while current-record selection and the final occupant checks still run. Duplicate roster routes keep the agreed registry fields when only model observations disagree. Compact JSON uses `[model, source, native-record-time]`, with explicit UNKNOWN reasons; full JSON keeps the complete labelled object.

Unknown reasons for the final read: a failed final PID lookup or an unavailable final bulk snapshot gives `native-read-unavailable` with a null model, and a null final PID or a pane missing from a successful bulk map gives `pane-unavailable`. Only an observed generation, name, binding or PID disagreement gives `occupant-changed-during-read`. Identity is still revalidated after the final await.

Known limit: bulk pane queries avoid per-seat tmux queries, but total work still scales with seat count. Selection, stat and metadata work remain, and growing records invalidate cached facts and trigger synchronous bounded reads and parsing for the affected seats. The 8 MiB Codex scan span is neither a fleet latency budget nor an aggregate I/O bound, and the fixture checks are not a fleet performance measurement.

Tests cover final-await turnover, the final direct and bulk read failures, unchanged-file caching with append and replacement invalidation, bulk inventory costs, roster preservation, and realistic observed and UNKNOWN payloads under the unchanged compact-size guard.
2026-10-18 21:02:15 -07:00
Mike Schwarz 9cbd6e8142 feat(capture): say which input-box text is likely a harness suggestion (#1490)
`rig capture` now says which text in a Claude Code or Codex seat's input box is likely a harness suggestion (ghost text) rather than something the person typed.

A plain capture drops the cursor position and the faint styling that tell a suggestion from a draft, so an agent could take a faint suggested `/compact` in another seat's box for the person's unsent draft. For Claude Code and Codex seats, capture now reads the visible screen once with styling, with the cursor read before and after, and describes only the input box it recognizes: Claude Code's prompt row inside its frame, or Codex's box.

What changes against main:
- `rig capture --json`, the capture route when the request asks (`inputBox: true`), and the MCP capture tool gain an `inputBox` field for Claude Code and Codex seats: `status`, `confidence`, `cursor`, the `input` and `suggestion` regions, `evidence` and `hint`. Other seats, and callers that don't ask (the send path's staged check, `rig walk`, the web preview routes and attention recovery), are unchanged.
- `rig capture` prints one stderr note for an agent seat whose input box isn't confirmed empty, and its help gains one bullet. Stdout is unchanged.
- Requests that ask make up to three more read-only tmux reads per agent seat. A single capture's box reads are bounded at 1 s, and a rig or pod capture shares one 1 s budget across its seats; seats past it report the box unread.
- The `mission-slice-sop` skill's ghost-text gotcha points agents to the note, and its edge digest is updated.
- Local `rig capture` asks, so slow tmux can add about one second of box reads to an ordinary capture. The budget bounds the box reads, not the whole request, so a capture already close to the client's 5 s timeout can now cross it.
- A box read that hits the budget isn't cancelled. At most one per request carries on, read-only, until tmux answers.

An empty box reads empty with high confidence only when the cursor is steady inside it. A cursor outside the box, one that moved during the read, or one that couldn't be read gives `unknown`, and a single cursor reading can only lower confidence. It's a heuristic: a whole frame drawn in output can still be recognized as a box, and the field is evidence for an agent, not the person's intent.

Tests run the rules on recorded Claude Code 2.1.296 and Codex 0.160.0 frames with styling and cursor added per case, including the empty and partial-cursor cases. Route cases check that the box is read only when asked, and that a rig capture's reads share one budget: the input-box reads consume about one second in the fake-timer route fixture, whose content capture is immediate.
2026-10-18 20:53:41 -07:00
alxledesma e564b6caab fix(ui): an aborted workflow no longer shows COMPLETED (#1276)
An aborted workflow instance now shows ⊘ ABORTED on /workflows and in a spec's runs band, instead of ○ COMPLETED. The UI's workflow status type now includes the daemon's `aborted` status, and the status chip has an ABORTED case before its fallback. Aborted instances keep their existing ranking alongside completed ones.

The instance page's position card and the /workflows header count still treat aborted as on main.

Verified with a render test: an aborted row reads ABORTED and not COMPLETED, a completed row still reads COMPLETED, and the ranking is unchanged. Not checked in a browser against a live daemon.
2026-10-18 20:30:32 -07:00
Mike Schwarz c64c4e6df1 docs(rigs): label measured tmux self-attach effects (#1496)
The rigs skill's join offer now says which tmux effects were hand-tested and which come from the source, and what the agent's address is inside tmux.

Inside tmux on 0.6.11, the agent tells the person that its sender and reply address is their existing tmux session name, even a number like `0`: `rig attach --self` returns that address, `rig whoami` confirms it, and `--display-name` does not change it.

The tmux effects list is relabelled against a hand test on 0.6.11. Transcript recording and, for Claude Code, writing `.openrig/context-collector.cjs` and `.claude/settings.local.json` for the status line were observed. Other agents typing into the window, `rig down` closing the tmux session, and updating an existing `.claude/settings.local.json` while keeping its custom status line stay labelled as from the source. Before, every tmux effect was labelled from the source.

The plain-shell recommendation and its effects are unchanged, and the packaged copy is identical. Text only.
2026-10-18 19:54:57 -07:00
Mike SchwarzandNash Aschenbath ecaa3032ac fix(daemon): route human custody findings to the closing agent (carries #1177) (#1495)
When an agent closes a human decision and its successor can't be verified, the new custody finding now goes to the agent that closed it, not to the person. The owner comes from the actual closing transition, including archived history and handed-off closures; later notes and notification receipts don't transfer it. When the closer is human, system machinery, missing or not admitted by this host's queue, the finding goes to the asking agent if its address is admitted, and otherwise to the original destination. Human identity is judged independently of terminal bindings, through the queue's existing address check. An agent destination keeps its existing route.

Changed result: newly created dangling-closure and successor-verification-required findings for a human destination route to the closing agent (or the asking agent) where they went to the person before. Existing findings keep their routes and deduplication.

When the human registry can't be read, a custody candidate whose owner can't be classified keeps its original destination, with one log line naming it. A pass with no finding to save for an <name>@external person keeps routing agent-bound work and closing repaired findings. A pass that must save a finding for an <name>@external person still fails at that finding, as before; findings not yet created in that pass, and the closing of repaired findings, wait for the next pass that completes, which then creates the finding for the closer. The as-built coordination-primitive doc describes this.

Verified with the sweep and queue tests, including a red-then-green handed-off closure case and the @external outage case. Live Slack delivery wasn't exercised.

Refs #514

Co-authored-by: Nash Aschenbath <[email protected]>
2026-10-18 19:54:12 -07:00
Mike Schwarz 4a867bdf43 fix(daemon): recognize current Codex folder trust prompts (#1494)
Codex's current `Trust this folder?` panel (the heading plus the numbered `Trust and continue` choice) is now recognized as a workspace-trust gate, as the older wording already was. Readiness and resume report that trust approval is pending instead of a false ready or unknown boot progress. That holds when an earlier composer, status footer or Codex header sits above the panel, and when a heading-only fragment follows it; the latest complete panel decides. A later composer or model status footer still supersedes an old panel, with the existing whole-text footer match kept, and the older wording keeps its matching and its place after the active-session check.

Changed results:
1. A live current-format trust panel now reads trust_gate: alone, with Quit selected, followed by a heading-only fragment, or below an earlier composer, status footer or Codex header. Before, it read awaiting_runtime, or resumed when an earlier composer sat above it. A resumed reading let startup text and Enter reach the panel, where Enter means "Trust and continue".
2. Three screens that were already not ready now name trust as the reason: a stale panel and composer followed by an unindented or one-space footer after a single blank line, and a quoted complete panel above a live numbered approval prompt.

The fixture is Codex's own rust-v0.156.1 trust-directory snapshot. Verified with fixture-driven classifier tests and mocked adapter readiness and resume, including that no trust-choice input is sent; no live Codex run.

Refs #227
2026-10-18 18:49:32 -07:00
Mike Schwarz 0149d01cd1 Recommend joining the team before the first operator message (#1492)
When a person's own Claude Code or Codex sets up OpenRig, the rigs skill now has it offer to join this session to the team before its first message to the operator, so the operator sees a named teammate instead of "unknown sender". The person says yes or no, and on a no the operator handoff carries on.

In a plain shell the agent recommends joining, and the list says what was measured there: joining names the member and its messages, writes no files in the project or personal settings, other agents reply through the task queue because they can't type into the window, and stopping the team leaves the session running.

Inside tmux the agent offers joining as optional, and the list says what the code does there (from source, not hand-tested): other agents can type into the window, stopping the team (`rig down`) also closes that tmux session, and it can record the session's transcript and, for Claude Code, write a status-line collector into the project.

The first-contact command names where the kernel's rig ID comes from (`rig ps --json`). Everything else in the skill is unchanged, and the packaged copy is identical. Text only.
2026-10-18 17:59:44 -07:00
Mike Schwarz 61b4d1a816 Guard bundled harness login files and record explicit inclusion (#1488)
A rig bundle can be shared, and anyone with it can read what's inside, so `rig bundle create` no longer packs a harness login file by accident. It refuses `.claude/.credentials.json`, `.codex/auth.json` and `.pi/agent/auth.json`, at the top of an agent folder or carried project or nested anywhere inside one, and the message names the file, says anyone with the bundle could read it, and says how to fix it: remove it and build again, or, only if recipients should have this login (for example, your own internal test bundle) and its owner agrees, recreate with `--include-login-files`.

That opt-in is off by default. It records the exact archive paths of the login files actually included (`included_login_files` in the manifest), and verify, unpack, inspect, the install plan and bootstrap accept only those recorded paths, each with a visible notice. An unrecorded login file, an extra file, a malformed, directory, wildcard or traversal record, or a hash mismatch still fails. The record is the creator's unsigned declaration, not proof of consent, trusted origin or safe credentials. There's no machine setting, force or wildcard.

The check extends the existing shared sensitive-file predicate and integrity verifier, so ordinary `auth.json` files elsewhere and other harness files are unaffected. One fixed-time ordinary v2 bundle and one v1 bundle were checked byte-identical to main's.

Changed results:
1. A bundle that contains one of the three login files, created today without the flag, is now refused, and no archive is written.
2. Existing archives that hold one of those files without a record now fail verify, unpack and install (install returns 400, even with --force or --skip-version-check). Inspection stays a 200 diagnostic with integrity false, and the CLI exits 2.
3. The CLI author check now reports login-file findings, and the CLI and web bundle inspector now show integrity errors.
4. Inspecting a v1 bundle whose manifest can't be parsed or normalized now returns the 200 diagnostic ("Invalid v1 manifest: …"), the same as v2 already did, where it used to fail with 500. Install, verify and unpack are unchanged for those.

Notices and errors name paths, never file contents.
2026-10-18 17:45:04 -07:00
Mike Schwarz a3b726a975 docs(readme): clarify that only the older web UI is in maintenance mode (#1491)
The README's overview line read as if the whole project were in maintenance mode. It now says that OpenRig itself is under active development, and that only the older React web UI is in maintenance mode, with best-effort support. One line, text only.

Refs #55
2026-10-18 17:16:18 -07:00
Mike Schwarz 48fe7827ec ci: run existing Linux checks on main pushes (#1487)
Tests now runs on every push to main, so the commit main actually lands on gets a direct check after each merge. Until now only pull requests and manual dispatches ran it, and main's health after a merge was inferred from later PR runs.

- A push to main runs the four existing Ubuntu jobs on the pushed commit: build-and-package, typecheck, repo-checks and installed-scenario. The macOS package-tests matrix doesn't run on push (`if: ${{ github.event_name != 'push' }}`), and its skipped state isn't a pass.
- Pull-request and manual runs are unchanged: all eight jobs, with the same names, so the required checks are unaffected.
- The concurrency group now includes the event name (`tests-<event>-<ref>`). Main pushes still coalesce among themselves, so a burst of merges runs about one full Linux pass rather than one per tip. A push can't cancel a manual run on main or any PR run.

What this does and doesn't prove: Linux checks of main after merges, not full cross-platform testing, and not every intermediate tip. A cancelled or skipped main run stays untested. No ruleset, required check, job body, macOS job or third-party action changes.
2026-10-18 16:41:51 -07:00
Mike Schwarz d4741c9dc3 fix(refocus): a selectable time budget, and a failure report that survives slow attempts (#1475)
A seat can give a slow refocus trace more time, and a slow attempt is reported honestly. This is a budget-and-reporting change, not full refocus parity.

The switch is `OPENRIG_REFOCUS_BUDGET_MS` in a seat's environment, from 4,500 ms (the default, today's behaviour) to 52,000 ms. With a budget set, each lookup's cap scales with it (the trace gets about 23 s at 52 s) and every lookup is clipped to what's left, so a slow attempt ends as a reported gap. A single 45 s trace isn't provided. With no budget set, the lookups keep their fixed 2 s caps and the old-CLI `whoami` retry.

Changed results:
1. The five `refocus.cjs` registrations (both harnesses) allow 60 s instead of 5 s, so a refocus hook that hangs outside its lookups can hold a prompt for up to 60 s. Every other hook keeps its registration, including Claude's PreCompact at 30 s.
2. A default fire whose lookups together pass 5 s now completes (about 6 s in the measured case) where it used to be killed with nothing delivered. The timing depends on which lookups are slow and on the old-CLI retry, so default outcomes aren't identical to before.
3. openrig-core moves from 0.1.12 to 0.1.13 in both manifests, carrying only this hook change, its registrations and its doc, so existing vendored installs pick it up through the normal update path.
4. Not resolved: two hook runs for the same seat and occupant are still not serialized. If they overlap, a PostCompact recorded during a delivery can be lost, and one refocus can be delivered twice. Tests reproduce this between hook processes and characterize it. Whether a harness overlaps these events for one session isn't established, so the gap is open, not shown to be safe.
5. The failure report gets its own 1.5 s after the attempt's lookups, measured from the actual elapsed time, so the third failure of a slow default attempt now files its issue where it used to be cut off. An unconfirmed report keeps its id for the next attempt, as before.

`docs/reference/refocus-channel.md` documents the budget, the registrations and the unresolved overlap.
2026-10-18 16:24:10 -07:00
Mike Schwarz ce7f89cc3c docs(skills): brief another agent according to the model it runs (#1486)
Agents in an OpenRig team now brief a peer according to the model it runs. `delegating-work` has a new section, "Check what kind of agent you're handing it to". Before handing over open-ended work, check the peer's model: `rig ps --nodes --json` shows each seat's declared model (`model`, or `null` when none is declared), and a declared model can differ from the running one, so ask the seat when unsure.

A goal-oriented model gets the goal, why it matters, what good looks like, the requirements and the context, and finds the route itself. Other models, and any model you can't identify, get smaller, clearer pieces with steps, boundaries and a result you can check. A model the rule doesn't place goes in the second group until you know where it sits. Never tell a model which group it's in. "Hand over intent, not instructions" now splits by model class.

The `openrig-skills` router line and one `queue-handoff` checklist line point to the section, and the skill mirror and edge digests are regenerated. openrig-core moves from 0.1.11 to 0.1.12 in both manifests, so existing installs pick up the change. Text only.
2026-10-18 15:30:18 -07:00
Mike Schwarz f3a5e41abd fix(tui): keep helpers working after the start directory is deleted (#1485)
TUI helper actions keep working after the folder `rig tui` started in is deleted. The TUI passes an explicit working folder to the eight helper processes it starts: the timezone setting, the crash-cart probe, three daemon-start forms, local reading, spec launch and terminal-window open. One small resolver keeps the current folder while it exists. If the folder is gone (`ENOENT` or `ENOTDIR`), it uses the home folder. For any other error it leaves the folder unset, so the helper inherits it as before. The TUI itself never changes folder. Arguments, environment, the explicit launch folder and error handling are unchanged.

Results that change for the same input:
- With the start folder deleted, the helpers run in the home folder, where they failed with `ENOENT: uv_cwd` until the TUI restarted.
- A folder deleted and recreated at the same path now gives a helper the new folder, where it inherited the old one.

Refs #1479.
2026-10-18 15:25:09 -07:00
b65d51009c feat(daemon): add single-attempt draft-aware typing guard (re-landed from #1072) (#1481)
A seat can now opt into a draft-aware typing guard: `rig seat set-typing-guard <seat> --mode draft-aware`. Every seat stays off by default. In this mode, automatic input checks the seat's input box just before typing and again before Enter. A seat with an unsubmitted draft isn't typed over: the delivery is held or refused with its reason, and nothing is retried automatically. `hold` keeps its current behaviour, and the legacy on/off setting maps to hold or off.

This re-lands Nash Aschenbath's reviewed work from #1072 on current main, with commits also from Mr-Neutr0n (whose commits carry the name Harikrishna KP). The original commits, with their authorship, stay on this pull request's branch and in #1072. The squash adds a merge of main with its conflict choices, a helper rename that merge needed, test updates, and one follow-up: a draft-aware seat now skips the idle wait outside the seat's lease, as a hold-mode seat already does, so a draft or an unreadable input gets its immediate result.

Limits that ship with it:
- Off by default isn't inert. Migration 100 and the shared transport and startup changes apply to every seat.
- In draft-aware mode, an empty input waits for idle inside the seat's lease, which can delay other work for the same seat. The empty-input test starts from an idle seat, so lease occupancy during a long busy wait wasn't measured.
- Turning draft-aware off between the input snapshot and the lease can still take that in-lease wait. This was read from source, not exercised.
- The gap between the last observation of the input box and typing remains. There's no guarantee against text a person types at that moment, and no automatic retry or replay of uncertain input.
- Native harness behaviour isn't newly proved here. The evidence is in-process tests and CI.

Refs #1072

Co-authored-by: Nash Aschenbath <[email protected]>
Co-authored-by: Harikrishna KP <[email protected]>
Co-authored-by: Mr-Neutr0n <[email protected]>
2026-10-18 14:47:20 -07:00
Mike Schwarz 9e35893616 fix(daemon): avoid false divergence for Claude model pins (#1482)
The model-divergence monitor reported a divergence for Claude seats that were running exactly the model their pin asked for, in two cases: a pin carrying the `[1m]` context-window option, and the `fable` alias, which named an older model.

For Claude seats only (runtime `claude-code`), one recognized trailing `[1m]` on either side is now set aside before the existing comparison, so `claude-opus-5-5[1m]` matches an effective `claude-opus-5-5`. Other suffixes, embedded text, partial or unknown aliases and every other runtime stay literal. The shared alias map now names `fable` as `claude-fable-5-1`, for both the comparison and the spec advisory. Pi's pin readings are unchanged, and real divergences still alert with the original pin and effective strings.

Results that change for the same input:
- A Claude pin with `[1m]` whose model matches the effective one: no divergence notice, where the monitor reported one.
- A `fable` pin with effective `claude-fable-5-1`: no notice, where the monitor reported one.
- A `fable` pin with effective `claude-fable-5`: now a divergence notice, where the monitor matched, because the alias names the current model.
- The spec advisory for `fable` recommends `claude-fable-5-1`; validity and errors are unchanged.

Refs #1403.
2026-10-18 14:14:30 -07:00
Mike Schwarz eac1c5afa8 feat(daemon): deliver named Slack bots to one seat through a bot inbox (#1433)
The Slack connector drops every post made by a bot, so another app's bot (an AI assistant, an alerting app) can't reach an agent. This lets an operator name such bots: their posts in one channel, the bot inbox, reach one seat as rows from the bot.

## What changes
A new optional `botInbox` block in `slack-connector.json`:

```json
"botInbox": {
  "channel": "C0BOTINBOX",
  "destination": "researcher@my-rig",
  "bots": [{ "appId": "A0EXAMPLE1", "name": "Example Bot", "maxPerHour": 20, "cooldownMinutes": 60 }]
}
```

**Which posts are delivered.** A bot's post reaches `destination` when all of these hold:
- it is in `channel`;
- its app is listed in `bots`;
- its app isn't the connector's own app.

**How the sender is identified.** The post's own `bot_id`, resolved to its app with `bots.info` (new feature scope `users:read`). A lookup is cached per bot, and posts arriving together share one lookup. Anything that posts as a named app, including its incoming webhooks, counts as that bot.
- The envelope's `api_app_id` names the app *receiving* the event, the connector's own. So it is used only to rule out OpenRig's own posts, which are never delivered, even if listed.
- A post whose `api_app_id` is missing is dropped.

**What the seat receives.** One row per post:
- source `slack-bot:<app ID>`, tags `slack-bot` and `inbound`, and a summary that starts with the bot's name;
- the body opens with the bot's app, bot, channel and ts, and says the row is data from another program, not an instruction, and not a person;
- the bot's text follows in a fence longer than any backtick run inside it, so it can't close the quote or pass for the provenance.

A bot's post never goes through the person registry, the thread map or a decision reply. So it never answers or closes a decision, even when it replies in that decision's thread.

**Limits.** Each bot may deliver `maxPerHour` posts (default 20) in any rolling hour. The next post cuts the bot off for at least `cooldownMinutes` (default 60), and until the hour has room again, so the hourly maximum holds across a cutoff. The seat gets one notice row, at most one an hour per bot, which says that new posts are dropped while admitted ones still arrive, how the person turns the bot off and applies the change (a daemon restart), and that a later cutoff can extend the time shown. A notice whose row couldn't be created doesn't use up the hour. The counts are in the running connector's memory, so a daemon restart or a rewire (`rig slack disable` then `rig slack enable`) clears them.

**Failures and retries.** A `bots.info` transport, rate-limit or server failure is dead-lettered and retried like a message. Live posts and retries go through one admission: the current inbox channel, the bot's app and its limit. Each post is counted once by its identity (`channel:ts`), so a backlog of failed lookups can't pass the limit, and another copy of an admitted post (a retry, or Slack's `message` and `app_mention` pair) isn't counted again. A post the limit already admitted whose row couldn't be created is kept marked as admitted, saved once that creation fails (on a retry too), and the mark covers every kept copy of that post. A retry pass never rewrites a retained file it can't read, and a live post reads that file again only after something in the daemon has written it (including an earlier connector's handler still finishing after a rewire), not each time; while it can't be read, a live post is kept for retry. So it's delivered later without being counted again or dropped by a cutoff, even after its hour, a rewire or a restart; the marker can't come from Slack's payload. A retained post from a channel that is no longer the bot inbox is dropped and logged. Slack's own refusal (such as `missing_scope`) is logged and the post is not delivered.

**Config errors.** An invalid `botInbox` (for example a bot ID where the app ID belongs) turns only the bot inbox off. `rig slack status` shows a `bot-inbox` line saying why, and loading the config never fails because of it.

**With one app across machines.** When the bot inbox channel belongs to another machine, the hub relays the bot's post there untouched, like any event in that channel, and that machine's own bot inbox delivers it: the relayed envelope carries the receiving app, and the relayed post is checked as a fresh one, with any admission marker in its payload cleared. A relay retry whose file can't be read again is left for the next pass and logged, as the event and click retries are.

## Result changes against main
- **A named bot's post in the bot inbox:** main drops it (`bot_id`); now it lands on `destination`.
- **The app manifest** asks for one more feature scope, `users:read`.
- **Readiness:** `rig slack status` gains a `bot-inbox` line when a `botInbox` block is set.
- **Unchanged:**
  - without `botInbox`, every bot post is dropped exactly as before;
  - other bots, and named bots outside the inbox channel, are dropped as before;
  - people's messages, including people writing in the bot inbox channel, take the existing path.

## Limits
- **Edits and deletions are not delivered.** A bot that writes its answer by editing one message delivers only that message's first version.
- **Attachments on a bot's post** are named in the row, not copied.
- **`rig slack verify`** checks neither `users:read` nor membership in the bot inbox channel.
- **Missed-message recovery** doesn't cover the bot inbox.
- **No reply route yet:** the seat can't answer the bot; the person asks it in Slack.

## Tests
`packages/daemon/test/slack-named-bots.test.ts`, committed before the change. CI is linked in the PR conversation.
- **Through `handleEnvelope` to the queue row:**
  - a named bot delivered as the bot;
  - a bot reply in a decision's thread doesn't call the decision resolver, while a person's same reply does;
  - an unnamed bot dropped and its app ID logged;
  - OpenRig's own app dropped even when listed;
  - a missing receiving app dropped;
  - `bot_profile` and the envelope's app ignored as identity;
  - named bots outside the inbox dropped without a lookup;
  - no `botInbox` means every bot is dropped;
  - edits dropped;
  - a `message` and `app_mention` pair landing once, with one lookup;
  - a refused lookup not retried;
  - a transport failure dead-lettered and landed on retry;
  - the cut-off, its single notice and the return after the cooldown;
  - an admitted post kept past its hour through a cutoff, and across a rewire with the new hour already used, then delivered;
  - an admission granted on a retry that stops before the pass ends, and an unadmitted plus an admitted copy of one post across a rewire;
  - an unreadable final re-read after the marked copy is saved, a live post while the retained file can't be read, and one file read for several live posts. These run on an in-memory file adapter, not a daemon kill or a real disk failure;
  - a notice that couldn't be created leaving the hour's notice free;
  - a person's message in the inbox channel staying on the person path.
- **Also:** the rolling hour, the config checks and readiness row, loading an invalid block, the `users:read` scope, and the `bots.info` request and its retry classification.

## Also changed against the shared-app relay
- A relay retry pass whose final re-read of its retained file fails now leaves that file untouched, through the same shared batch replacement the bot and event passes use, rather than replacing it from a lenient read. Envelopes already sent may be retried and rely on the receiver's dedupe: a possible duplicate, not a loss.
- The named-bot and relay suites are separate; no single test composes a named bot through a two-machine relay, and real Slack across two machines was not run.
2026-10-18 14:12:42 -07:00
Mike Schwarz 421b90180e feat(bundle): opt in to service archives with durable targets (#1474)
An opted-in v2 service bundle can now carry its declared Compose file, show the archived per-service declarations before anything runs, and install into a lasting `--target` through the existing service boot, readiness and seat-launch machinery.

It is off by default. `bundle.services_enabled` (or `OPENRIG_BUNDLE_SERVICES_ENABLED`) gates compose-file packing, the per-service view, target admission and prospective target plans; the daemon reads it on each request. With it off, archive contents, the inspect view and the services refusal are as before, except that the new typed key appears, default `false`, in the config list and help.

With it on:
- Create copies only the declared Compose file, at its relative path, through the existing containment rules; no `.env`, no recursive copy. A missing declared file still creates the archive and shows as unresolved.
- Inspect shows each service's image, declared ports and privileges, environment names (never values), mounts, health and wait targets and down policy, with YAML merge keys resolved, host values left unresolved, and every other declared key listed as "Also declared, not summarized". It describes the archive, not an effective deployment.
- Apply with a target uses the existing materialisation, Compose boot and readiness, and content routing before the first seat launches. The archive path keeps the full service result and the replaced generations, so rollback, recovery retention and inherited project protection behave as on the folder path.
- Plan with a target runs the existing conflict and live-team checks and shows the prospective services without writing target files or starting services; a plan over a running team of the same name is refused, as apply is. Without a target, plan and apply keep the services refusal.

Native archive-to-Vault proof on a real Docker host is not run; coverage uses real archives, routes and SQLite with inert service and seat adapters.
2026-10-18 14:06:51 -07:00
Rudy Mizrahi Celekli 042e81358b fix(daemon): rate a provider window only within its current window (#1473)
The burn view rated a provider window from the span's first and last readings, so a five-hour window that reset inside the span showed a cross-window rate, often a negative one (for example `five_hour: 5% (-42.5%/h)`).

A provider window is now rated only from the readings that share the latest reading's window, using the daemon's existing `sameReset` (moved unchanged into `provider/usage-windows.ts` and exported; the Claude usage-window code imports it and computes exactly as before). With fewer than two readings in that window there is no rate, and a falling reading within one window still gives none. Samples without `resets_at` match each other, so a series with no reset times is rated as before.

Results that change for the same input (each replaces a wrong value):
- A falling reading across a reset with one reading in the new window: no rate, where the view showed a negative one.
- A falling reading across a reset with two or more readings in the new window: the current window's measured rate, where the view showed a negative cross-window figure.
- A rising reading across a reset with one reading in the new window: no rate, where the view showed a cross-window figure.
- A rising reading across a reset with two or more readings in the new window: the current window's rate, where the view showed a cross-window figure.
- A falling reading within one window: no rate, where the view showed a negative one.

The first and last readings, the reset time and the token figures are unchanged.
2026-10-18 13:11:46 -07:00
Mike Schwarz f557667c51 feat(daemon): one Slack app across machines, routed by channel (#1436)
One OpenRig Slack app can now serve several machines, routed by channel. A message in a machine's channel reaches that machine's Kernel Operator; a message in a rig's channel reaches that rig's representative or a seat you name; and the answer and later updates come back to the same Slack thread, naming the machine, rig and agent.

Refs #192

## How it works
A Slack app delivers each event to one of its connections, so one machine, the hub, holds the app's Socket Mode connection. Every machine keeps its own gateway: its human registry, thread map, decisions, dedupe and receipts stay local, and it posts its own replies with the app's bot token.

**The hub relays.**
- For a channel another machine owns (`forwardChannels: [{ channel, host }]` in `slack-connector.json`), the hub relays the event, reaction or button click untouched to that machine's daemon, over its http host entry (`rig host pair`), with the token that entry holds.
- A failed relay is kept with its host and retried on the dead-letter cadence, after the hub's own kept events and clicks. After one failed send to a host, its other relays wait for the next pass. A relay that keeps failing is retried with no limit, since dropping it would lose a person's message. `rig slack status` counts it in the backlog.

**Machines without the app-level token.**
- They open no connection. Their connector builds its router anyway, and the new `POST /api/gateway/slack/forwarded` runs a relayed envelope through it.
- That route checks the daemon's auth bearer when one is set, and never relays an envelope again. It trusts its caller for where an event came from: there's no Slack signature on a relayed event, so the sender lookup there isn't proof of a fresh act in Slack.
- `rig slack status` reports `relayedInbound`: that the machine can take relayed events, and how many have arrived.
- These machines drain their own retained events on the socket's five-minute cadence.

**Answers return to the person's thread.**
- A person's top-level message becomes the root of its answer: a thread mapping at its own channel and ts, marked as the person's, and stamped on their row so a rebuild restores it. The row is tagged `slack-thread-root`. A reaction on that message isn't a reaction to an ask.
- When the seat it reached replies with `--reply-to` that row, the answer and later updates post under the person's message, in the channel they used, even if that seat's items otherwise post to another channel. A reply that fails the root's checks (another seat, another person, a closed root) keeps the replying seat's own channel.
- Roots OpenRig posts keep the channel map's remap rule.
- A button click finds its decision by its channel (from the payload or its container) and ts, and whether an update already shares a root is judged for that root: by its channel, or, for an older record that names no channel, by the root the update's post actually landed in (its channel and ts); when that isn't recorded, it counts as shared, as on `main`.

**Channel routing.**
- A person's new message in a rig's channel reaches the rig's representative, its one `delegates_to` root, at the root's current session. A new `inbound` field on a channel-map entry names another seat: `rig slack channel-map set my-rig C0... --inbound lead@my-rig`.
- Everything else goes to `inboundDestination` as before. That covers the default channel (a rig entry there only sends that rig's posts there, unless it names `inbound`), a seat entry's channel, an ambiguous channel, and a rig whose representative can't be found. A seat entry alone doesn't make its channel a seat's inbox.

**Every post names its machine:** `from <seat> on <host id>`, unless the sender's session already carries a host.

## Changed results against main
1. **A reply to a top-level message threads under it.** A person's top-level message now mints a thread root, so a `--reply-to` answer from the seat it reached posts in that thread instead of top-level (`root-missing`). An answer from another seat still posts top-level, now as `root-other-seat`.
2. **Rig channels route to the rig.** A new message in a channel mapped to a rig goes to the rig's representative when one is found, where main sent every new message to `inboundDestination`.
3. **Posts name the machine.** The sender line reads `from <seat> on <host id>` when the daemon has a host id.
4. **`inbound` is a known channel-map field.** It was an unsupported newer field, so the tests that used it as their example now use a hypothetical `policy` field.
5. **Thread roots are keyed by channel and ts.** Migration 115 rebuilds `thread_seat_map` with that key and an `origin` (posted or person); existing roots are kept as posted. Two roots with one ts in different channels no longer share a row.
6. **A fallback names the root's owner first.** When a `--reply-to` reference belongs to another seat or person and also sits in another channel, the recorded reason is `root-other-seat` or `root-other-human`, not `root-other-channel`.
7. **New, only when configured:** `forwardChannels` on a hub, a `forward-channels` readiness line, the relay route, and a connector running with only the bot token, which builds its router without a socket and reports `relayedInbound`.

## Upgrade note
An existing channel-map entry for a rig, on that rig's own channel, now takes the channel's new messages for the rig's representative. A rig entry on the connector's default channel doesn't move that channel's new messages.

## Limits
- **The bot token goes on every participating machine,** and the app-level token on the hub only.
- **Hub coverage:** `rig slack verify` on the hub doesn't check membership in relayed channels, and missed-message recovery covers the hub's default channel only.
- **Handoffs:** an answer from a seat other than the one the message reached still posts top-level.
- **Relayed events** are trusted from the daemon caller, and a relay a machine keeps refusing is retried with no limit.
- **An update posted through the delivery digest** records no thread part, so for an older record that names no channel its root counts as shared, as on `main`.
- **The thread-part lookup** for those older records is an unindexed scan of `thread_part_map`, run only when a decision with its own open root posts.

## What the tests cover, and at what layer
- `slack-shared-foundation-wire.test.ts` runs two machines' wires in one process with Slack faked. The hub's fetch stub hands a relayed envelope straight to the other machine's wire (`acceptForwarded`); it doesn't go through the HTTP route or its middleware, and both machines share one host id there. It covers: a machine channel reaching that machine's Kernel Operator, with the answer and a later update in the person's thread naming the machine; a rig channel reaching its configured seat, a changed seat taking the next message, and the answer returning to the person's channel; the hub's own channel staying on the hub; an unregistered sender still refused; and a machine without its own connection reporting relayed events.
- `slack-shared-foundation.test.ts` covers the receiving route and its bearer separately, with a stub subsystem, plus the representative, resolver and router; minting; the relay, its retry, its loop guard, and messages, reactions and clicks; the forwarder over the registry; the config checks, the machine label and `channel-map set --inbound`; a rig entry on the default channel; and the retry order.
- `slack-reply-to-thread.test.ts` and `slack-thread-routing.test.ts` cover roots per channel, a reaction on a person's own message, a failed reference keeping the replying seat's channel, the person's root stamp and its rebuild, a click that names its channel only in its container, the migration keeping existing roots, and an older record's shared root judged by where its update's post landed, including a retained replay into another channel and a post that never landed. The migration's upgrade test is synthetic (one closed root in an in-memory database).
- Real Slack on two real machines was not run.
2026-10-18 13:04:49 -07:00
Samuel 21f5cae3a0 fix(daemon): Pi model-pin check reads a :<thinking level> suffix as Pi does (#1403)
A Pi pin such as `lab/y:high` names a model and a thinking level. The model-divergence check compared the whole pin with the recorded model, so it reported a divergence for a seat running exactly what its pin asked for.

The check now reads the pin as Pi does. When the whole pin is a model id that the seat's `models.json` defines, it's read literally first, then with the suffix as a level, which is Pi's order. A missing `models.json` keeps the suffix reading, so an ordinary suffixed pin still matches its record.

When `models.json` can't be read, is malformed or is over the size cap, the record is compared with every reading of the pin first. A record that matches none still gets the existing divergence notice. A record that matches a reading stays pending and warns once that it is unchecked, because the file that decides which reading Pi used can't be read.

Results that change for the same input:
- A suffixed pin whose record matches the pin without its suffix: no divergence notice, where the check reported one.
- With an unreadable `models.json`, a record that matches only the pin without its suffix: pending with an unchecked warning, where the check reported a divergence.
- With an unreadable `models.json`, a record equal to the whole suffixed pin: pending with an unchecked warning, where the check settled silently.
2026-10-18 12:48:47 -07:00
Mike Schwarz 0376204bea docs(skills): offer Codex users one removable rules file for six OpenRig commands (#1467)
Codex's default sandbox can't reach OpenRig's daemon or tmux, so Codex asks the person to approve OpenRig commands, and sometimes reports a sandbox failure instead of asking.

The `rigs` skill now makes one offer, once, to someone using Codex, right after step 2 starts OpenRig's daemon. It offers to let six coordination command families (`rig ps`, `rig capture`, `rig send`, `rig queue`, `rig status` and `rig whoami`) run without a prompt, through one removable rules file in the person's real Codex folder. The agent shows the actual path first.
- **No, or no answer:** nothing is written.
- **Yes:** the agent follows the existing `applying-a-permission-policy` procedure. It reads the existing rules, keeps any stricter rule, changes no sandbox or approval setting, and creates the file only if it doesn't exist.
- **Undo:** removes only the lines it added.

When the person chose install-only or no team, the daemon isn't started just to make the offer. Both copies of the skill are identical.
2026-10-18 11:52:14 -07:00
Mike Schwarz 977dab86a5 feat(provider): a durable record of subscription moves, and the guidance for the agent that makes them (#1450)
Adds a durable record of subscription moves: which home's account was switched, which seats were restarted and verified, what readings the decision used, and what's still unconfirmed. It's a typed, append-only record over the existing event log, with `rig provider moves record|list|show` and matching daemon routes. The reads use the existing `(node_id, type, seq)` index.

It's switched off by default: `provider.subscription_moves`, enabled with `rig config set provider.subscription_moves true` or `OPENRIG_PROVIDER_SUBSCRIPTION_MOVES=true`. With it off, the move routes answer 409 with how to turn it on and write nothing. Existing provider reads, `rig auth switch`, seat restarts and other provider routes are unchanged.

The `openrig-user` skill gains a section for managing subscriptions across a fleet, which applies only when the switch is on and the person has asked. A move restarts each chosen seat with `rig seat restart --keep-conversation --reason`, then checks it with `--verify --expect-account` after a real turn; `--verify` only checks. A record needs evidence for `moved`, `missing` for `unconfirmed` or `unknown`, and at least one reading. A peers-only move is recorded with `seats: []`. A body `operator` is recorded as a claimed identity when no transport identity is present.
2026-10-18 11:35:31 -07:00
Rudy Mizrahi Celekli 10ed20ca55 fix(daemon): keep emoji whole in shortened notification bodies, slice stories and history excerpts (#1472)
Three daemon helpers shortened text with `s.slice(0, n)` plus `…`: `truncateBody` for human-gate notification bodies (280), the slice-story `truncate` (100 and 60), and `truncateExcerpt` for `rig ask` excerpts (240). When an emoji straddled the cut, the result carried a lone UTF-16 surrogate, which shows as a replacement character in notifications, the UI and JSON consumers.

All three now go through one small helper, `sliceWhole(text, end)` in `domain/text-cut.ts`, which takes one unit less when the cut would land between the halves of a surrogate pair. Each result is the same length as before, or one unit shorter. Tests cover the helper and the notification body.
2026-10-18 11:34:25 -07:00
Rudy Mizrahi Celekli ca1ee6986f fix(daemon): keep a member's mechanic when re-serializing a rig spec (#1464)
A pod member's `mechanic` (the per-member continuity mechanic) was carried by `RigSpecSchema.normalize` but never emitted by `RigSpecCodec.serialize`, so any parse, normalize and serialize path dropped it. Bundle assembly re-serializes `rig.yaml`, so a bundled rig lost a member-level mechanic.

`serialize` now emits `mechanic` beside `compaction_strategy` when it's set. Specs without one serialize byte-identically.

Result that changes for the same input: a bundled member that declares `mechanic: B` while its profile (or the spec default) declares `A` now restores with `B`, matching a direct launch from the same spec; before, the bundle dropped `B` and the seat used `A`. Unchanged: the export from a running rig still doesn't reconstruct member `mechanic` or `compaction_strategy`, and members with no mechanic behave as before.
2026-10-18 11:05:57 -07:00
Rudy Mizrahi Celekli 27dd43d5f4 fix(tui): keep combining marks when matching heading anchors (#1471)
The TUI file reader resolves `#anchor` with `headingSlug`, which kept only `[\p{L}\p{N}_\-\s]` and so removed every combining mark. A heading such as `## हिन्दी` (vowel signs and virama are marks) or a decomposed `## Café` got a slug no link uses, and the reader showed "Heading not found".

`headingSlug` now keeps combining marks (`\p{M}`), including variation selectors. github-slugger's rule keeps marks too; parity with the live github.com site is inferred, not checked.

Results that change for the same input:
- A heading containing a combining mark or U+FE0F gets a different slug, so a link written against the old stripped form (for example `#cafe` for a decomposed `Café`, or `#-configuration` for `⚙️ Configuration`) no longer reaches it.
- Duplicate-suffix targets can move. For the two headings `## Cafe` followed by U+0301 and then `## Cafe`, the old slugs were `cafe` and `cafe-1`. They are now `café` (decomposed) and `cafe`, so `#cafe` now reaches the second heading, and `#cafe-1` no longer exists.
- Headings without marks keep their base slug. A missing anchor still opens the file from the start.
2026-10-18 11:05:37 -07:00
Rudy Mizrahi Celekli 2021c0fbea fix(cli): warn when a watchdog cadence is read as a different number (#1463)
`rig watchdog register` reads `--interval-seconds`, `--active-wake-interval-seconds` and `--scan-interval-seconds` with `parseInt(value, 10)`, so a mistyped cadence quietly becomes a different number: `5m` becomes 5, `1.5` becomes 1 and `1e3` becomes 1.

The command keeps that parsing, the numbers it sends, the handling of omitted options, the daemon's answers and the exit codes exactly as before. It now prints one line on stderr when the conversion changes the value's meaning, naming the flag, the value as typed and the seconds it's read as, and says "is not a number" for a value that doesn't parse. Equal forms such as `5`, `05`, `0` and `-5` stay quiet. Stdout, including `--json`, is unchanged, and the warning never claims a job was registered. This doesn't validate cadences strictly or refuse any input.

Tests cover all three flags, quiet equal values, each lossy value with the original number still sent, a required `abc` keeping the daemon's refusal, and clean `--json` output.
2026-10-18 10:58:59 -07:00
Rudy Mizrahi Celekli a6b5987325 fix(tui): stop Help palette selection at the last command so up moves after overshooting (#1469)
In Help, the `palette-move` reducer clamped the selection only at 0. Help and the Enter handler clamped it only for display, so holding down past the last command kept raising the stored selection, and the following up presses did nothing visible until it came back in range.

The reducer now also clamps at the last match for the current query, counted with the same `filterPalette` call Help renders. Context only dims entries and never removes them, so the count is the same in every context. An empty match list keeps the selection at 0. A test overshoots and checks the first up press moves.
2026-10-18 10:54:27 -07:00
Rudy Mizrahi Celekli bcdbb004b1 fix(cli): point restore's not-found hint at the real snapshot list syntax (#1466)
When `rig restore <snapshot> --rig <rig>` got a 404, its hint said `List snapshots with: rig snapshot list --rig <rig>`. `rig snapshot list` takes the rig id as a positional argument and has no `--rig` option, so the suggested command failed with an unknown-option error.

The hint now reads `rig snapshot list <rig>`. The existing 404 test extracts the hinted command and runs it through the snapshot command. Only the hint's text changes.
2026-10-18 10:54:06 -07:00
NIKHIL 3f14873131 fix(daemon): preserve queue work arriving during seat removal (#1459)
Removal checked for active work before awaiting the tmux kill, then deleted the node without checking again, so queue work written during the kill stayed addressed to a seat that no longer existed.

Removal now rechecks with the same query after the kill and inside the topology transaction. Late work is rerouted through the existing explicit-fallback routing. When there is no usable fallback, the node is kept (stopped, not running), and the result reports the work. A pod shrink can report partial results.

The fallback is revalidated only when work actually needs it: the up-front explicit-fallback check is unchanged, and a removal or shrink with no work involved completes exactly as before, even if an unused fallback has stopped. `removeNode` and the shrink's member removal now share one function.

Results that change for the same input:
- Late work during the kill with no usable fallback: the node is kept and the work reported (409 with the real code), where it used to be removed with the work stranded. This includes late work arriving while the explicit fallback stops running.
- A failure after earlier effects keeps the real failure code and reports every effect already made (rerouted work, removed members, stopped sessions), and no longer says no changes were made. Failed results carry `sessionsKilled` and `nodes`.
2026-10-18 10:46:30 -07:00
Rudy Mizrahi Celekli a6cb9de4b0 fix(daemon): answer 400, not 500, for an unbindable limit on queue overdue and usage series (#1456)
A positive `limit` of 2^63 or more reached SQLite's `LIMIT ?` on `/api/queue/overdue` and `/api/telemetry/usage/series` and failed with a 500. Both routes now bound it through the shared `SQL_LIMIT_BOUND` in `query-limit.ts` and answer 400.

On `/overdue` the bound applies after the route's existing normalization, so only the positive value actually sent to SQL is checked. Negatives, zero, non-numbers and values that parse to Infinity still get the default list, as before. The tests compare the returned rows, not only the status, for the preserved cases.
2026-10-18 10:45:36 -07:00
Rudy Mizrahi Celekli 49b12a0ce3 fix: treat an empty OPENRIG_HOME as unset in the TUI socket, terminal token and crash-cart (#1470)
Three readers used `OPENRIG_HOME ?? <default>`, so an exported-but-empty `OPENRIG_HOME` made a home relative to the working directory: the CLI terminal token (`terminalAuthHeaders` read `./terminal-token`), `rig crash-cart` (which read `daemon.json` and the database from the cwd) and the TUI control socket (`<start dir>/run/tui-<id>.sock`). The CLI already selected the daemon endpoint through `getOpenRigHome()`, which treats an empty value as unset, so the token and the endpoint could come from different homes.

The two CLI sites now use `getOpenRigHome()`. The TUI uses `OPENRIG_HOME || ~/.openrig` inline, since it doesn't depend on the CLI package.

Results that change for the same input:
- With `OPENRIG_HOME` unset or empty and `RIGGED_HOME` set, the terminal token and `rig crash-cart` read the `RIGGED_HOME` home (with its deprecation warning), as endpoint selection already did. If that home has no token, no authorization header is sent.
- With neither `OPENRIG_HOME` nor `HOME` set, the token path is the OS home's `.openrig` instead of a path relative to the working directory.
- With an empty `OPENRIG_HOME`, the default home's token is sent to the endpoint already selected (including an explicitly configured remote one), where previously no token, or a file in the working directory, was used.
- The TUI socket moves from `<start dir>/run/` to the home's `run/`. Its access follows that directory's permissions and the umask; this change adds no new permission setting.
- A long home path can now reach the existing socket-path length limit, which a short start directory used to avoid. The same limit already applies when `OPENRIG_HOME` is unset.

Explicit bearer and socket overrides are unchanged. Tests cover the empty-home token and crash-cart paths and the TUI socket path.
2026-10-18 10:02:44 -07:00
Rudy Mizrahi Celekli 4e52a20e41 fix(daemon): allow literal dots in agent-image file paths (#1465)
The agent-image manifest parser and `AgentImageLibraryService.install` refused any file path containing two consecutive dots (`path.includes("..")`), so ordinary names like `notes/v1..final.md` or `release..notes.md` were rejected with `manifest_invalid`, though they aren't traversal.

Both checks now use the context-pack form, `path.split(/[\\/]/).includes("..")`: only a whole `..` segment, with either separator, is refused, and a leading `/` is still refused. `../x.md`, `a/../b.md`, `a/..` and the backslash form stay refused. Install still validates every path before writing into a freshly created target directory. Tests cover the accepted dotted names, the refused traversal forms and the installed bytes.
2026-10-18 09:52:04 -07:00
Devulapalli Naga Sri Vaishnavi 133743149c fix(cli): note when a context usage filter needs --nodes (#1437)
A `--filter contextUsage.percent` or `--filter contextUsage.state` on `rig ps` without `--nodes` applies only at the node tier, so at the rig tier it silently did nothing. `rig ps` now prints one notice to stderr in that case: "Notice: --filter <key> is node-level and was not applied at the rig tier; use --nodes to apply it." Stdout and the exit status stay exactly as before, including the JSON envelope, the stopped-rig table and the empty-match message. With `--nodes`, the filter applies as before, and malformed filters keep their existing errors.

Over `--host`, HTTP prints the notice once, and SSH relays the remote's notice without a second local copy. The help text says the filter is node-level. Tests pin main's filtered JSON, text and empty-result output, and the single notice, locally and over `--host`.
2026-10-18 08:37:23 -07:00
Mike Schwarz bc0e44bff2 docs(skills): an opt-in wake for an attached app that can run background commands (#1444)
Adds a "Wake on new work" section to the `openrig-user` skill for an agent in an attached app that can run background shell commands. It's an opt-in loop that polls `rig queue list --owned --state pending` until pending owned work appears or a deadline passes, then wakes the agent through the app's own background-command completion.

The loop reports what it saw. New owned work prints `NEW WORK` and exits 0. If every poll failed (no seat identity, or the daemon down), it says it couldn't check for work and exits 1, with the next step: run `rig queue list --owned` to see why before starting the wait again. If checking stopped working after an earlier success, it names the time of the first failure since the last successful poll and exits 1. A failure followed by a successful poll stays quiet: the deadline prints "No new work before the deadline" and exits 0 only when the last poll succeeded. The deadline is checked between polls, not as a hard process timeout.

The skill's limits line and identity step are updated, and the skill digests are regenerated. Tests run the `sh` block extracted from the shipped skill against the built CLI and real queue routes: a wake, failed polls then a wake, claimed work, another seat's work, never checked, stopped mid-wait, and recovered. The native desktop run is not covered here.
2026-10-18 08:24:02 -07:00
Rudy Mizrahi Celekli 245b6519b0 fix(ui): keep emoji whole in shortened activity event previews (#1454)
`formatEventPayload` shortens activity-event previews with `shorten`, which returned `s.slice(0, max - 1) + "…"`. When an emoji straddled the cut, the preview ended in a lone UTF-16 surrogate, which the feed showed as a replacement glyph, for both the 200-character summary and the 40-character key=value preview.

When the last kept unit is a high surrogate, `shorten` now keeps `max - 2` units instead, so the emoji is dropped whole and the result stays within `max`. Output is unchanged whenever no high surrogate sits at the cut. This keeps surrogate pairs whole; a ZWJ sequence or flag can still be cut between code points. A test covers both preview paths.
2026-10-18 08:09:41 -07:00
Rudy Mizrahi Celekli 9ba4f01f9a fix(scope): pair a proof drop's folded evidence refs in the Scopes view (#1461)
`rig proof add` writes a proof drop's C1 header with `YAML.stringify`, which folds a long plain scalar onto an indented continuation line. The Scopes view's `fmList` in `scope-view-projection.ts` read only the first line of each list item, so a folded text evidence ref no longer equalled its contract item and showed as unpaired, while Review's `parseC1Header` paired the same drop.

`fmList` now parses the header as YAML first, mapping an array value to strings with blanks dropped, the same list conversion `parseC1Header` uses for `evidences`, and falls back to the old line reader when the header doesn't parse. Two other results change with it. An unquoted numeric-looking ref is now a YAML number, so `- 1.10` reads as "1.1"; quote such a ref to keep its exact text (refs written by `rig proof add` are already quoted). An inline YAML comment after a ref (`- R1 # note`) is no longer part of the ref. This aligns the evidence-list conversion only: the fallback on malformed YAML, the other scalar fields and media handling still differ between the two views. A test covers a folded evidence ref.
2026-10-18 08:01:33 -07:00
Rudy Mizrahi Celekli 31fb0043e3 fix(scope): read 1) mini-requirements in the Scopes view like 1. ones (#1460)
A slice whose mini-requirements use `1)` numbering showed no mini-requirements in the Scopes view (`miniRequirements: []`), because the projection in `scope-view-projection.ts` matched only `^\d+\.`. The shared authored-item grammar (`hasAuthoredNumberedItem` in `scaffold-placeholder.ts`, `\d+[.)]`) treats these as authored items, so Review and the scope audit counted them while the Scopes view showed none.

The projection now accepts `N.` and `N)` alike, with continuation lines folded the same way. Every `N.` item reads as before; `N)` items now appear in place. A test rewrites the fixture's items to `1)` and expects the same two items.
2026-10-18 08:00:37 -07:00
Rudy Mizrahi Celekli b4f13b52d7 fix(tui): ignore horizontal wheel notches instead of scrolling vertically (#1458)
`resolveMouseAction` treated every SGR wheel code (`button & 64`) as vertical and read only bit 0 for its direction, so a sideways trackpad swipe or tilt-wheel (66 for wheel left, 67 for wheel right) scrolled the pane under the pointer: 66 scrolled up by 3 and 67 down by 3. On a trackpad, a mostly horizontal gesture jumped the Explorer selection or the content pane.

Wheel codes with bit 1 set now return `null`, and the main loop ignores them, as it does for any non-click. Vertical notches, including ones with shift, meta or ctrl bits, behave as before; no modifier or motion bit sets bit 1. Tests cover 66, 67 and their modified forms in both panes, plus a modified vertical notch that still scrolls.
2026-10-18 07:59:32 -07:00
Rudy Mizrahi Celekli 7832a80c1e fix(daemon): probe IPv6 http hosts without URL brackets in GET /api/hosts (#1457)
`GET /api/hosts` probed an `http` host with `net.connect({ host: new URL(host.url).hostname })`. For an IPv6 literal such as `http://[::1]:7433` or a tailnet `http://[fd7a:115c:a1e0::…]:7433`, WHATWG `URL.hostname` keeps the brackets, so `net.connect` failed its lookup and the host showed `status: "unreachable"` even while its daemon was up.

The probe now strips the brackets when they wrap the whole hostname, as the CLI's host probe already does. Hostnames, IPv4 addresses and SSH hosts are probed exactly as before. The new test listens on `::1` and expects the host to read reachable; on a machine without an IPv6 loopback it returns early without checking.
2026-10-18 07:58:55 -07:00
NIKHIL 0d31ee1dd2 fix(daemon): atomically promote inbox entries into queue work (#1451)
Promoting an inbox entry into queue work used two separate transactions: `InboxHandler.absorb` awaited `queueRepo.create` (which committed the task and notified `queue.created`) and only then updated the inbox entry and wrote `inbox.absorbed`. Overlapping absorbs of one pending entry could each create a task, a failed inbox update left an orphan task behind and let a retry create another, and a `queue.created` subscriber could read the entry as still pending.

Absorption now runs the reread, the queue insertion (through the queue's existing `createWithinTransaction`, with the same validation, transition, provenance and `queue.created` payload as an ordinary create), the inbox update and both events in one `EventBus.withNotifyEnvelope` transaction. Overlapping absorbs now produce one task and later calls return its id; a failed update rolls everything back, and the entry can be absorbed again. The two events and their payloads are unchanged. Two observable differences: a subscriber that reads the entry on `queue.created` now sees it absorbed, and an event emitted by a `queue.created` subscriber is now delivered after `inbox.absorbed` rather than before it. `InboxHandler` now also requires its database, event bus and queue repository to share one database handle, as production already does.
2026-10-18 07:56:42 -07:00
Rudy Mizrahi Celekli 1ffa50d8f9 fix(daemon): match chat search keywords literally, not as LIKE wildcards (#1455)
`ChatRepository.searchChat`, which backs the chat half of `rig ask`'s history evidence, put each keyword into `body LIKE '%<kw>%'` with no `ESCAPE`, so `_` and `%` in a keyword acted as SQL wildcards. Keywords are now escaped (`\`, `%`, `_`) and matched with `ESCAPE '\'`.

This narrows some results on purpose. `rate_limit` used to match "rate limit" and "rate-limit" as well as "rate_limit", and now matches only the literal spelling. `100%` used to match any body containing "100" (such as "1000 tokens"), and now matches only "100%". A keyword with a backslash matches as before. Pipe-separated OR keywords and the existing case, order and limit behaviour are unchanged. Through `rig ask`, keywords shorter than three characters are dropped before this search, so a lone `_` or `%` never reaches it there. Tests cover `rate_limit`, `100%`, a backslash and an OR combination.
2026-10-18 07:43:10 -07:00
Rudy Mizrahi Celekli b6e3a2d666 fix(tui): keep emoji whole when Scopes, Pulse and Execution rows are cut to width (#1453)
#1112 kept an emoji whole in `detail.ts`'s row wrapper, but the Scopes (`semantic`, `wrapText`), Pulse (`laneCell`) and Execution (`clip`, `fitSegs`, `wrapWords`) cut sites still sliced by UTF-16 units, so a row cut right after a high surrogate printed a lone surrogate (a replacement glyph) before the `…`, and a hard-wrapped value could split an emoji across two rows.

Adds `sliceWhole` to `detail.ts`, which backs off one unit when a cut would land inside a surrogate pair, and all six sites now call it. Clipped and fitted rows stay within their width. This keeps surrogate pairs whole; a ZWJ sequence or flag can still be cut between code points, as before. At a width of 1, the hard-wrap fallback emits a word's first astral character whole (two UTF-16 units) rather than half of it. Tests cover a Scopes title, a Scopes hard wrap and a Pulse label.
2026-10-18 07:37:07 -07:00
Rudy Mizrahi Celekli f6d940756a fix(daemon): read an empty compose ps JSON array as no services (#1452)
On Compose releases whose `ps --format json` prints a JSON array, a project with no containers prints `[]`. `ComposeServicesAdapter.status()` parsed that to an empty list and then reported "docker compose ps returned unparseable JSON output", so `captureReceipt` threw during snapshot capture for a rig whose services were stopped or not created, and the no-wait-targets boot path returned `compose_status_failed`.

`status()` now reads a payload that is exactly an empty array (whitespace allowed) as `{ ok: true, services: [] }`, the same answer it already gave for empty output from line-format releases. Non-empty arrays, one-object-per-line output, empty output and unparseable output behave as before. A test covers the empty-array case.
2026-10-18 07:36:27 -07:00
Mike Schwarz 1e94939281 test(daemon): wait for reader descendant PID disappearance (#1447)
The network-default reader test now waits up to two seconds for its orphaned descendant's PID to disappear, instead of requiring that immediately when the bounded process-group cleanup returns. `stopGroup` sends EOF, TERM and KILL to the reader's group with finite waits and then waits for the direct child's exit; the grandchild isn't a child the test runner reaps, so a one-shot `kill(pid, 0)` asked for more than the function promises. A missed cleanup still fails: the fixture's 60-second descendant dies only by the group signals, so it outlasts the poll. Production code is unchanged.
2026-10-18 06:29:59 -07:00
Mike Schwarz 6f2751a1f6 test(daemon): check fresh transcript capture after a failed kill (#1443)
The failed-kill transcript test no longer requires a quiet pane's last-capture timestamp to advance within two seconds. Rotation deliberately skips full reads of unchanged panes, so that timestamp can legitimately stay unchanged while the rotator is still active.

After the simulated kill failure, the test now checks that a marker isn't in the transcript, writes it to its private tmux pane, and waits for the transcript to contain it. Only the rotator writes the transcript file, so this checks that capture actually continued after teardown returned. The successful-kill case and its stopped-rotation assertions are unchanged, and production code is unchanged.
2026-10-18 04:58:58 -07:00
Samuel 68cd2f4383 fix(daemon): Pi model-pin check reads only the current runner's own record (#1349)
The model-divergence monitor now has an effective-model reader for Pi seats, so a pinned Pi seat is checked. A match settles the seat for its occupant generation. A real mismatch raises the divergence notice, with delivery attempted to the rig's orch seats, the operator and oversight (Slack deferred). Anything ambiguous or unavailable stays unknown: the seat stays pending with its usual warning, and nothing is refused.

- **Which session file:** it's read only when the occupant's generation and boot time are known and the node has a canonical pane binding; the runner sidecar is ready, not exited, and carries a launch id; the pane's own process reads as a shell; exactly one process under the pane is the runner, a direct child of that shell, whose command starts in `buildPiRunnerCommand`'s exact order with the adapter's own entry path and state root, with each identity flag once and no `--runtime`; its launch id equals the sidecar's; and the session file resolves under the seat's `sessions` folder.
- **Which record:** the newest determinate assistant record that is the session's own (a fork's inherited entries don't count), stamped after both the occupant's boot and the runner's start, with the starting second excluded. Error and aborted turns are skipped.
- **Pins:** through the existing `canonicalModelPin`. A pin that isn't a complete `provider/model` id, or a record without a provider, stays unknown.

Limits: the check matches the supported managed-launch shape from `ps` command text, not the exact argument list, so it doesn't prove the daemon started the runner. A runner typed by hand at the pane's prompt, or one argument containing the whole expected text, reads the same. Unlisted shells, whitespace in a shell's path and identity-flag text inside a quoted path stay unknown. It compares Pi's recorded model identity, not provider-side model substitution or a later `/model` change after the generation settled.
2026-10-18 04:51:26 -07:00
Mike SchwarzandNash Aschenbath 8bf6d7448a fix(codex): keep a fork's startup context when its child id arrives late, verified at launch and on continue (#1438)
A Codex seat that forks another conversation (`session_source: fork`) no longer loses its role when Codex records the new child's id late. The launch waits up to `runtime.readiness_timeout_seconds` (30 s by default; main gave up after about 5 s) for a verified child: the pane's foreground process forks the requested parent, and its own native record, matched to its start time, supplies the id. Only then is the id saved and the role sent. If no verified child appears in time, the seat stops at `attention_required` with its startup context kept, and `rig seat continue <seat>` re-verifies the child, saves its id and delivers the role exactly once, never replaying an attempted delivery.

- At launch, a reused PID's older record, a child of a different parent, a background process and a helper with `codex` only in its arguments now leave the context pending, where main saved an id and sent the role.
- A fork child whose record shares its start second is accepted only from the one process instance that logged nothing earlier. A retired instance with earlier history, or two instances first seen in that second, are refused. Residual: a lone retained retired conversation id first seen in the child's start second can still resolve if the child reuses its PID in that second, before the child logs.
- An unreadable log stops new same-second candidates from being added, and an identity answer that arrives after the launch deadline is ignored.
- Unchanged: a seat handover with `--source fork:<seat>` keeps main's capture and pending-id path, and fresh launches, resumes and a fresh `rig seat continue` behave as before.

Builds on Aschenbath's #1158: the recovery design, the fork-process check, the `continue` extension and most of the tests are theirs.

Refs #1158
Refs #317

Co-authored-by: Nash Aschenbath <[email protected]>
2026-10-18 04:12:37 -07:00
Dery Ferdika 816c539292 test(scenarios): cover a daemon restart keeping the team row honest with a stub scenario (#1440)
Adds `daemon-restart-preserves-team-identity.yaml`, which runs `up`, `ps`, a daemon restart, `ps`, `down` and `ps` through the shipped CLI against the two-seat stub topology. The post-restart read pins that the same rig is still one running team with exactly two running seats, not archived, so a restart that loses the team's row, or changes its seat counts or status, fails there. The `match` form can't reject an extra running row for the same rig name, and the scenario header says so.

The scenario joins the `installed-scenario` CI job as a passing-only case beside `transcript` and `capture`: a `daemon-restart` entry in `PASSING_CASES` in `packages/test-system/ci/result.mjs`, and the same name in `scripts/run-pr-scenarios.sh`'s `PASSING_CASES` and `--case`. It runs in healthy mode only, in the same container and limits, and only a clean PASS of the named scenario counts. Like the other passing-only cases, it has no planted-failure run in CI.

`docs/as-built/test-layers.md` counts the new scenario, names the four scenarios the CI job runs and the three that stay local-runner-only, and marks the `daemon` help-wanted row partial.

Test files and docs only; no product code changes.
2026-10-18 04:09:04 -07:00
Mike Schwarz 1c437a4efd feat(cli): queue tools on the MCP server, so a seat without a shell can delegate and read answers (#1441)
An agent in an app with no shell (an MCP client such as Claude Desktop's Chat tab) can now take part in a team: `rig mcp serve` gains five queue tools over the routes `rig queue` already uses.

- `rig_queue_create`, `rig_queue_show`, `rig_queue_list`, `rig_queue_claim` and `rig_queue_update` act as the seat set once in the server's environment (`OPENRIG_SESSION_NAME`); no tool call names a sender, and `owned` is scoped to that seat.
- `rig_queue_show` returns the item with its transitions, so the assignee's closing note is the answer to a delegated task.
- A create that times out names its request id and says to check `show` before retrying with the same id.
- The tool descriptions say what the routes do: `rig_queue_list` without `state` returns open items (`all` adds closed ones), and a `state` filter returns exactly those states; a `rig_queue_update` timed wake is delivered only to a seat with a terminal, so an attached app's item just waits until it's checked.
- The `openrig-user` skill describes attaching once, giving the person the MCP entry without editing their settings, delegating, reading the answer by id, and the current limit that nothing wakes that agent yet.

The original 18 MCP tools are unchanged. A Code-tab agent with a shell keeps the whole `rig` CLI.
2026-10-18 03:39:38 -07:00
Mike Schwarz 3ece551bfe fix(daemon): a Pi or OMP seat at a bare shell reads as an identity mismatch (#1391)
A Pi or OMP seat whose agent has exited to a bare shell now reads as an identity mismatch that needs attention, the same as a Claude or Codex seat in that state. Until now it read as `verified`, so the seat looked running and healthy.

- The shared classifier treats a bare shell (bash, -zsh, sh, fish, dash, -csh, tcsh) under a Pi or OMP seat as a mismatch, and both identity writers record `process_identity_mismatch`; ksh and the rest of the known-shell vocabulary are unchanged.
- Downstream, as for any seat in attention: role routing excludes the seat, restore checks and fresh re-checks report attention, a headless `rig start --json` preview exits 1 as it does for any attention candidate, and an explicit archive without `--force` follows the existing soft-archive rule. A clear-attention request while the shell remains is refused as not demonstrably responsive; restore reconciliation's refusal code for these seats becomes `process_lineage_mismatch`.
- The supported Pi and OMP launch shapes normally reach `node` by the time readiness succeeds, but any later check can still see a shell, before launch or after the agent exits.
- Terminal seats, Claude and Codex controls, ambiguous, unreadable and missing panes keep their existing results.

The branch merges main with #1392 and #1398, which change neither the classifier's inputs nor any Pi or OMP verdict.
2026-10-18 03:14:59 -07:00
Mike Schwarz 3e4a5ce704 docs: clarify skill installation and Codex Linux setup (#1431)
Getting-started now gives explicit Claude Code and Codex commands for reading the `rigs` skill, pinned to the release tag that matches the installed `rig --version`, so the skill isn't silently taken from main and the agent isn't left unspecified.

- `rig --version` prints the version and a commit, for example `0.6.11 (379f0a0d)`; the tag is `v0.6.11`.
- The skill is in the repository from v0.6.6; an older install uses that tag or upgrades first.
- One Linux prerequisite line links the recorded bubblewrap loopback error to OpenAI's sandbox prerequisites, and leaves AppArmor changes to the machine's owner.

Documentation only: no preflight, configuration or command changes.
2026-10-18 03:00:43 -07:00
Devulapalli Naga Sri Vaishnavi f5586ad31a fix(daemon): recheck workflow content after mtime rewind (#1363)
The workflow spec scanner now treats a file as changed when either its mtime or its ctime is later than the cached entry, so a spec restored or copied with an older mtime (`cp -p`, `rsync -a`, `tar x`, `touch -d`) is read again instead of keeping a stale cache entry.

- A cache entry newer than both timestamps is used with no read, as before.
- A same-second entry still takes the content-hash comparison.
- Anything newer is read through the cache.

Cost: a metadata-only change (chmod, chown, rename, xattr) moves ctime without changing content, so that file is re-read and re-parsed on each scan until its content changes. Unchanged files keep today's cost.
2026-10-18 02:54:27 -07:00
NIKHIL eabc816e58 fix(daemon): record a stopped watchdog's last fire attempt (#1439)
A watchdog job that is stopped or made terminal while a delivery is in flight now records that attempt in `last_fire_at`, matching its delivery history. On main, the active-state filter skipped the whole update, so `rig watchdog` kept showing the previous fire time for that job.

- The `state = 'active'` condition now guards only `last_evaluation_at`. A retired job keeps its due boundary, schedule, state and retirement reason, and no queue wake is attempted for it.
- The stamp is the attempt's evaluation time, recorded whether the delivery succeeded or failed; it is not a delivery receipt. Delivery history already kept the attempt.
- An active job's update is unchanged, as is the unscheduled branch.

The only visible change is the last fire time shown for a stopped or terminal job. Four tests cover stopped and terminal jobs with successful and failed deliveries. Refs #1435.
2026-10-18 02:16:40 -07:00
Mike Schwarz ab18ce092d docs(skills): smooth the Codex route's first day (network checks, rig setup, Workshop's configuration) (#1434)
Three first-day frictions on the Codex route into OpenRig, fixed in guidance.

- **A false "sign in again":** in a sandbox without network access, such as Codex's default one, `gh auth status` reports a valid login as an invalid token. Step 1 of the `rigs` skill now says to re-run a check that needs the network with network access before telling the person to sign in again or fix anything. The person's sandbox settings are left as they are.
- **Setup skipped:** the install step ran `rig preflight` and `rig doctor`, so `rig setup` and its default Herdr install never happened. It now runs `rig setup --providers codex` (or `claude`, or `both`), first saying what setup does: it checks Node, tmux and the logins, installs tmux (with Homebrew, when present) or the chosen harness (with npm) if either is missing, installs Herdr unless the person declines it (`--no-herdr`), and adds an OpenRig block to `~/.tmux.conf`. It doesn't start the daemon. Then `rig doctor`.
- **Workshop's configurations:** the kernel operator's offer now names the listing's configurations (`recommended`, `all-claude`, `all-codex` and others) and offers the one that fits the providers the person has.

`skills/rigs/SKILL.md` and its packaged copy stay byte-identical (`rigs-global-skill.test.ts`). No code changes.
2026-10-18 02:04:07 -07:00
Dery Ferdika be1f15c04e fix(cli): fall back to the user's home when HOME is unset in resolveCodexHome (#1418)
`rig auth` and the daemon's Codex auth reader now find the same `.codex` folder when `HOME` is unset or empty, instead of one relative to whatever directory they run in.

- When `HOME` is unset or empty, the fallback root is the account's home from the OS account database (`os.userInfo().homedir`), because `os.homedir()` returns a set `HOME` even when it's empty. If no home can be found, the result is as before, with no new error.
- A nonempty `CODEX_HOME` wins, then a nonempty `HOME`, with relative values kept as given.
- The same small change is in the CLI (`packages/cli/src/lib/codex-auth.ts`) and the daemon's metadata reader (`codex-auth-reader.ts`); the daemon doesn't import the CLI.
- The provider service's two display values for the seats' launch environment are unchanged, since they mirror how seats are launched.

Tests cover an unset and an empty `HOME` with a controlled account home, the CLI and the daemon reader resolving the same folder, and explicit `CODEX_HOME` and `HOME` unchanged.
2026-10-18 01:03:08 -07:00
NIKHIL 4b69fe2c78 fix(daemon): preserve blocker wakes during delivery (#1435)
A waiting row keeps its next wake when its blocker changes, or it is handed onward, while an earlier notification is still sending. Before, the old send's completion overwrote the wake-now schedule and recorded the newer blocker evidence as already presented, so that notification never came.

- Delivery completion compares the job's schedule (spec, interval and due boundary) with the snapshot taken before the send, and acknowledges only an unchanged one. A revised schedule stays due, and the next tick sends it.
- `last_fire_at` is still stamped on every fire, so the next send gets a distinct occurrence and the attempt stays in watchdog history.
- Plain reminders and active-wake jobs never get a schedule revision mid-send, so they complete as before.
- Two bookkeeping results change: a job that becomes inactive during its send keeps its previous fire and evaluation stamps and writes no wake receipt, and an attempt whose schedule changed mid-send writes no receipt on the row; history keeps both attempts.

Tests cover a successful send, a failed send and an onward handoff, each with a second send and no repeat after acknowledgement, plus the repository's comparison cases. No schema or setting changes.
2026-10-18 00:58:24 -07:00
Mike Schwarz 15d62b4ad9 docs: align contributor skill workflow with in-repo homes (#1432)
The contributor docs now describe the skill workflow #1396 introduced: edit a shipped skill's one in-repo home, run `npm run mirror-skills` to regenerate its other copies and refresh the digests, then run `npm run mirror-skills:check` and commit the result.

- `CONTRIBUTING.md` no longer tells contributors to edit every copy, or says the full apply needs maintainer-only inputs.
- `docs/as-built/test-layers.md` describes what `--check` covers: skill homes, generated copies, layout and digests, including publishability and home/copy consistency.
- `ARCHITECTURE.md`'s "Generated files" sentence names `npm run mirror-skills` as the way the skill-edge digests are refreshed, matching its "A shipped skill" recipe; the digest-only step is gone.

No scripts, skill content, generated files or policy inputs change.
2026-10-18 00:55:19 -07:00
Mike Schwarzanddajiaohuang dc2221e098 fix(cli): create and read a project's missions under its declared missions.root (#1430)
Mission creation with an explicit workspace (`--workspace P` or `OPENRIG_WORK_ROOT=P`) now creates the mission under that workspace, and `rig scope` reads it back from the same place.

- A named workspace that doesn't exist yet is created at that path by the mission's own recursive `mkdir`, after rendering and validation; nothing is written to the configured root. A path that is a file fails with the filesystem's `ENOTDIR`.
- A project's declared, existing `missions.root` (in `project.yaml`) wins over a conventional `missions/` folder for every command that resolves a workspace: slice create, ship, close and move, progress, stage, verified, repair and approve, and the reads ls, show, graph, audit and `rig proof`. `--workspace P/missions` still names a conventional tree directly.
- Unchanged: with no workspace named, the configured root is used; the other commands still fall back to the configured root when the named workspace has no missions tree, as before, and `approve` still refuses that case.

Builds on dajiaohuang's #104, whose fix and tests are the core of this change.

Refs #104

Co-authored-by: dajiaohuang <[email protected]>
2026-10-18 00:08:20 -07:00
Mike Schwarz af7f660884 fix(skills): regenerate product skills from their one in-repo home (#1396)
Product skills now regenerate from one editable home inside this repository, so a skill fix is made once and the apply can't replace reviewed text with an outside copy.

- Each skill has one home: its spec copy when it has a spec edge, otherwise its plugin copy. `scripts/skill-edge-layout.generated.json` still lists which copies each skill has, and every other copy is generated from the home.
- The apply reads nothing outside the repository. `OPENRIG_SKILL_CANON_ROOT` is no longer needed; when it's set, the script says it's ignored.
- The apply can't erase a home. Every read and write is planned and every home is staged before any output is replaced, an output that overlaps a home is refused, and a home is never written. On an edge that holds homes, an undeclared skill is left in place and listed.
- The sanitization and leak rules now check the home. Generated copies stay byte-identical to it, and each generated file takes its home's mode.
- `--check` compares every generated copy with its home and reports `copy-diverged`, `copy-missing` or `copy-extra`, even after the digests are refreshed.
- `skills/README.md` and `ARCHITECTURE.md` describe the in-repo source.

One content change: `metadata.openrig.transfer_test: pending` is removed from `openrig-software-factory/SKILL.md` (its spec home and `_canonical` copy, with both digests updated). The sanitizer already strips that key from public copies, and nothing in the product reads it.

Directory modes aren't restored from homes; only file modes are.
2026-10-17 23:41:00 -07:00
Mike Schwarz 32d2828da8 docs(cli): clarify ask wake seat and session targets (#1426)
`rig ask <rig> "…" --wake` now says which targets reach a seat. A seat is `member@rig`, and `member@rig@N` picks a generation (1 is the newest); a value without `@` goes to the runtime unchanged as a session ID or title, so a bare member name isn't resolved within `<rig>`. The old `seat[@gen]|token` placeholder didn't define a seat.

- The help, its examples and two tests (the help text, and a bare title passed through unchanged).
- `docs/as-built/cli-reference.md` declares `--wake <target>` with the same forms.
- The shipped `orienting-to-an-inherited-seat` and `retiring-and-inheriting-a-seat` skills use the same forms; the first now says seat targets resolve from the seat's `sessions` rows, newest first, and that a two-part `x@2` is a seat name, not a generation. Their digests are regenerated.

Routing, refusals and results are unchanged.
2026-10-17 22:36:30 -07:00
Mike Schwarz 5f93e16576 fix(daemon): a row its owner's own repeating reminder serves isn't parked-stranded (#1424)
A blocked row parked on its owner's own repeating reminder no longer reads as stranded once that reminder has fired, so the parked-owner consumer stops sending the owner a second wake on top of the reminder that is already reaching it.

Parked diagnosis counts such a held row as healthy only when all of this holds, from existing records:
- the row's latest armed wake is an attached watchdog job, and the row hasn't left `blocked` since that arm (a later park with no wake doesn't inherit it);
- the job is an active `periodic-reminder`, not a queue-wait job, targeting the row's current destination;
- the row's fire since this park delivered `ok`;
- the job's latest evaluation (newest by `evaluated_at`, then `history_id`) is a sent delivery with status `ok` to the row's current destination.

Anything else keeps today's result: before the first fire, a stopped, deleted or retargeted job, another policy, a failed, retained, refused or skipped latest evaluation, a delivery to another seat or an unrecorded target, missing history, a one-shot timer, a blocker, or no wake. The held row shows `servedByOwnReminder: true` in `rig parked`. Only parked diagnosis and its consumers change (`rig parked`, the activity parked view, the parked-owner consumer); the park wake status, the waiting views, the stuck sweep and the wake ladder read exactly as before, and no schema, job or cadence changes.

Tradeoff: delivery is not consumption. An owner whose own reminder keeps delivering but who never acts no longer gets the parked-owner wake or the parked-list warning; the reminder itself keeps firing. If the owner sits at an approval prompt, escalation waits until a later reminder evaluation records the refusal or failure, after which the existing consumer and ladder run; that delay is read from source, not measured, and depends on scan and wake cadence. A benign skip (for example a busy target) as the latest evaluation withholds the exemption until the next delivered fire.
2026-10-17 22:35:29 -07:00
Mike Schwarz 6ba31f198f test(daemon): drive the overdue-reply tmux-control test by its injected clock (#1427)
The tmux-control test "drops a client once the reply at the head of its line is overdue, and starts a new one for the next command" failed intermittently in CI: its 50 ms reply timeout met `vi.waitFor`'s default 50 ms polling, so a reply sometimes arrived just after the product correctly judged it overdue, and the read fell through to the spawned fallback.

The test now passes the exec's existing injected clock (`options.now`) and moves it itself: it holds still while writing to the first client, moves forward by the timeout to make that client's head overdue, and holds still for the next client. The real watch timer still has to fire for the drop. Every assertion is unchanged, no fake timers are used, and production source is untouched.
2026-10-17 22:11:15 -07:00
Mike Schwarz b60e054345 fix(cli): print an explicit existing-rig restore hint after down (#1425)
After `rig down` stops a rig, the printed restore hint is now `rig up '<name>' --existing`, with the name shell-quoted as one argument.

- The old `rig up <name>` didn't restore a stopped rig whose name also matches a library spec, such as Workshop: `rig up` refuses that as ambiguous and itself suggests `--existing`. With no library match, both forms restore the same rig.
- The line now matches `rig down`'s own help and the restore-check hint.
- A name that isn't unique still prints `rig restore <snapshot> --rig <id>`, as before.
2026-10-17 22:00:56 -07:00
Adam Whitehurst 7e6a60a901 fix(daemon): keep watching a Claude resume that is still starting (#1359)
Keep watching a Claude resume that is still starting.

- When a restored Claude seat hasn't drawn its screen at the end of the unchanged 3.2 s quick window and the boot is still in progress, the Claude adapter keeps polling for the rest of `runtime.readiness_timeout_seconds` (30 s by default, 1 to 600), as the Codex adapter does.
- Claude's screen appears: the seat is `resumed`. It doesn't: the seat ends `attention_required` ("Claude resume did not finish within Ns; Claude may still be starting, so the launch was kept"), with the pane kept and the attempted resume token recorded as an attempt, not certified. It is never `resumed` because a process is alive.
- Only a boot in progress extends the wait. A real gate (login, trust, MCP approval, unproven auto-mode identity), a missing conversation and a resume-selection prompt keep their results. A different occupant (another conversation's Claude, a stable Codex, or a ready-looking screen whose lineage failed the check) keeps today's `failed` result, checked at the window's end, about once a second during the longer wait, and once more at its end.
- At settings of 1, 2 or 3 s no extra polls fit, but an unresolved boot still ends `attention_required` rather than the ordinary token-losing failure.
- With provider-prompt auto-driving on (off by default), a trust prompt during the longer wait gets Enter only when the occupant check shows this launch's own Claude.
- With #1417 on main, a screen showing only Claude's "Not logged in · Run /login" footer is no longer a login gate; during a slow resume it now waits the readiness bound like any boot in progress and, if unresolved, ends `attention_required` with the attempted token kept, where main ends "timed out". A current login refusal still stops early and fails as before.

What it costs:
- The bound is the existing readiness setting, so raising it for slow fresh launches also lengthens this wait. It counts polls from the adapter's verification, not from the launch, so read it as about the setting, not a wall-clock promise (about 31 s a seat at the default in the author's live run).
- Restore starts seats one after another, so the cost adds up per seat that never starts Claude (about 95 s for three at the default, measured by the author; an illustration, not a limit).
- `rig up` and `rig launch` wait 120 s for the daemon, so a few stuck seats can pass it. A client timeout with exit 1 is not a rollback: check `rig ps` before running the command again. The two commands word that timeout differently.
- The later readiness wait (`waitForReady`) runs only after the adapter succeeds; its first check runs straight away, so it adds no backoff sleep when that first check reads ready.
- During the longer wait, the shell and occupant checks run about once a second (about 80 process listings over a 30 s bound), plus the quick window's two tmux reads per extra poll.

Not in this change: Claude's screen recognition (#86 stays open); the older `adapters/claude-resume.ts`; any other runtime.

For #1351.
2026-10-17 20:59:52 -07:00
Mike Schwarz 7d6ce1350b docs: refresh the contributor roadmap (#1423)
Refresh the contributor roadmap for people looking for something to help with.

- Where to look: links the roadmap board (what's being worked on, by release and theme) and the repository's contribute page (issues labelled `good first issue`).
- How to help, step 1: comment on an item's issue to say you're working on it and coordinate with others; a maintainer can assign you to make that visible. The tie rule for equivalent pull requests is unchanged.
- More agent apps: a short note replaces the list of specific apps; the design discussion is #43.
- Removed the "merged stage in the project view" item, since #402 is closed.

Docs only.
2026-10-17 18:14:35 -07:00
Mike Schwarz a76a9d14d5 feat: run a community agent app in a seat from a small data preset (#1392)
Run a community agent app in a seat from a small data preset.

- A rig member's `runtime` can name an app installed as one YAML file, `$OPENRIG_HOME/agent-apps/<name>.yaml` (format, name, command, maintainer, limits). The six built-in runtime names are reserved, and shell syntax in the command (including `!` outside single quotes) makes a preset unusable.
- Only a seat launched through the preset path is treated as a community app. The selection is recorded on that session (`sessions.agent_app`, migration 114); it survives a daemon restart, a snapshot and restore, and the preset's removal, and a different occupant doesn't inherit it. A free-text self-attached seat behaves as before, even after a same-named preset appears.
- `rig agent-app list` and `GET /api/agent-apps` list presets, and `rig ps --nodes` labels the seat with its maintainer and limits. Identity reads unconfirmed. Activity comes only from the screen, and a quiet screen reads unknown, not idle.
- Messages use the existing `rig send` path and its protections. Resume and fork are refused as unsupported, and a restore without `--fresh` starts nothing. A missing or unusable preset is refused at preflight with the existing unsupported-runtime text plus the reason.
- Claude Code, Codex, Pi, OMP, terminal and stub seats are unchanged.

Known limits:
- The web UI still colours a quiet app's seat as idle.
- A multi-line `rig send` reaches an app that reads one line per turn as several inputs.
- Identity stays unconfirmed, not a mismatch, after the app exits to a shell.
- Activity can switch between working and unknown at sampling boundaries.
- Whether the new column exists is cached per database connection; a schema change on a live connection would need a reopen. The daemon migrates before any reader starts.
- Native app runs: not run.
2026-10-17 18:01:25 -07:00
Mike Schwarz 0e2dd8c4e2 Advance development main to 0.6.11 and carry its release text (#1420)
Advance development main to 0.6.11 and carry its release text.

- 0.6.11 is published from release/0.6.11 (tag v0.6.11). This is the release's own version and text commit (af1b61bf, #1253) cherry-picked onto main, equal to it file by file.
- The root, cli, daemon and ui package files and the lockfile read 0.6.11; no dependency, script or lifecycle field changes.
- CHANGELOG.md and docs/reference/whats-new.md equal the published tag's files; the capability page gains 0.6.11's lines and keeps main's later ones.
- No code carries: the release branch's code commits are already on main.
2026-10-17 17:00:36 -07:00
Adam Whitehurst e79cb2a108 fix(daemon): a failed lineage check says which check failed, not the pane label (#1398)
Say which lineage check failed, printing only what the check can vouch for.

- A failed lineage check names the check that failed (for example the recorded against the launched conversation) instead of the pane's foreground label.
- Printed values are only the seat's own record (its first eight characters), the pane id and the foreground command, with control characters replaced by ?. A conversation read from a launch's arguments is described, not printed.
- A process that only names a Claude executable is described as found and unverified, and the Codex launcher chain is described by what was read.
- Every check's accept/refuse result, the equality and rotation checks, and the codes are unchanged; the launch identity check keeps its explanation in the caller's message.
- Refs #1196.
2026-10-17 16:59:02 -07:00
Mike Schwarz f5e92db44f fix(daemon): read only a current Claude login refusal as login_required (#1417)
Read only a current Claude login refusal as login_required, not the footer.

- The persistent "Not logged in · Run /login" footer alone no longer selects login_required. Readiness means ready for input: the existing TUI, process and identity checks decide it, not authentication or a successful provider call.
- A current refusal keeps failed/login_required at the same place in the order: the latest response after the last submitted prompt is exactly "Not logged in · Please run /login", "Login expired · Please run /login" or "OAuth token revoked · Please run /login". Older scrollback, a newer reply or prompt, and quoted text don't count, within the limits below.
- A real 401 outside those three strings reads ready for input, with or without the footer.

Known limits:
- A current refusal without the footer now reads login_required; main needed the footer.
- A quoted line exactly at a result row's position reads as a result row.
- Joining a response's short-indented wrapped rows can assemble a refusal from two logical lines, and a footer indented six cells or fewer can join a real refusal and break the match.
- With no input box drawn, a just-submitted /login with no result yet can't be told from a typed one.
- A tool result whose first row is exactly a refusal still counts after a blank row or a continuation indented seven or more cells.
- If a resumed pane redraws an old refusal as its last response, the resume probes read login_required; not verified natively.
- Once a seat's stored startup status is ready, nothing automatic re-checks it; a later refusal shows wherever the pane is read again.
- No captured fixture shows how Claude draws a refusal; an unmarked refusal doesn't count.

Refs #1405.
2026-10-17 16:44:22 -07:00
yohannv f41740137f perf(daemon): #1384's review follow-ups: one code path for a row's delivery ledger, the human registry loaded once per listing (#1389)
One code path for a row's delivery ledger; the human registry loaded once per listing.

- Listings and single rows derive the delivery ledger through the same pure functions (`currentDeliveryEpisode`, `ledgerOf`).
- A listing loads the human registry at most once, and reads only each row's latest owner notice and its latest outbound one when that is older.
- A single row (`show`, `deliveryOutcomeFor`, `findUndelivered`, the sweeps) reads its receipts after its episode, as on main.
- Accepted, measured: a listing's waiting view reuses the listing's earlier ledger and owner reads, so it is not a snapshot of the whole call; with a destination change, a newly observed waiting owner can pair with the earlier ledger. Both converge on the next read.
- Accepted, source-derived and not measured: a listing works out every row's episode before any ledger reads the clock, so a legacy gateway-owned row just inside the 120-second window can list never-posted when a later row's registry load crosses it. The next read converges.
- Refs #1384.
2026-10-17 15:15:38 -07:00
yohannv 1341aa1ef1 feat(daemon): /api/events takes ?replay=<n|all> and streams its replay 500 events at a time (#1387)
Let /api/events clients choose how much history to replay.

- `replay=0` attaches live only; `replay=<n>` (ASCII digits) replays the newest n events, scoped by rig when one is given; `replay=all` replays the whole log.
- The replay is read in pages of 500 events up to the newest event at subscribe, and events that arrive meanwhile are buffered and delivered once, in order, before live mode.
- Any other `replay` value, and any count too large to represent, keeps main's full replay. `Last-Event-ID` is parsed as on main and takes precedence over `replay`.
- Cursor reads and paging now run inside the cleanup that unsubscribes the client.
- Refs #1386.
2026-10-17 15:07:56 -07:00
yohannv 68fafba04e perf(daemon): an opt-in single tmux control-mode client instead of a new tmux client per command (#1383)
Drive tmux through one control-mode client, opt-in.

- With `OPENRIG_TMUX_CONTROL=1`, the daemon routes its bounded set of tmux commands through one long-lived `tmux -C` client instead of starting a new tmux client for each command. Without it, the default, the daemon starts clients as before.
- The control client marks its own rows and drops only those from listings, and leaves its own session out of the first listing.
- A line with no end yet is bounded in bytes. The keep-alive check confirms no default-shell ran, on any platform.
- Refs #1382: the issue's single control-mode client, as an opt-in for now.
2026-10-17 14:51:05 -07:00
yohannv cc09855c3f perf(cli): load only the command being run and enable Node's compile cache (#1380)
Load only the command being run, and keep main's locality proof.

- The CLI registers its commands lazily, so a named command loads only its own module. `rig --help` and completion still see every command.
- The `rig` wrapper enables Node's on-disk compile cache through the no-argument `module.enableCompileCache()` (added in Node v22.8.0; the cache itself dates to v22.1.0), so `NODE_COMPILE_CACHE` and `NODE_DISABLE_COMPILE_CACHE` still apply. A cache failure stays a quiet optimisation failure, and older runtimes skip the call.
- Locality and identity keep main's behaviour. `client.ts` and `daemon-lifecycle.ts` differ from main only by lazy imports, so every new client proves its endpoint's locality itself at its first request.
- The change folds in #1381.
2026-10-17 14:49:19 -07:00
Rudy Mizrahi Celekli 550b68335e fix: share CRLF frontmatter boundaries across policy and review readers (#1402)
Share one CRLF-aware frontmatter boundary across the policy and review readers.

- One small helper finds where a frontmatter block starts and ends, with LF or CRLF line endings. The CLI and daemon permission policy spec parsers, the C1 proof composer, the review gatherer and the Scopes view use it. YAML parsing and schema validation are unchanged, and the CLI and daemon copies stay byte-identical.
- LF input gets exactly the previous result in every reader, including body bytes, offsets and closing lines such as `----` or `---suffix` (the rest of the line goes to the body).
- A valid custom permission policy saved with CRLF now resolves like its LF form. A fresh launch takes its declared posture (`full_bypass`, `auto` or the floor) instead of the advisory floor it got when the file failed to parse. Restore re-derives the declared posture instead of keeping the saved one, in either direction. Unreadable or schema-invalid policies keep the fallback, and none, builtin and absent policies are unchanged.
- `rig policy` resolves a CRLF custom policy instead of reporting it invalid, `rig policy show` no longer calls a CRLF config-surface policy advisory, preflight names the declared posture, and a bundle's access summary shows the declared access.
- CRLF C1 proof headers are read, so their verdict and `evidences:` count, and media references come from the body. CRLF review README headers are read. Scopes view list items, mini-requirements and locked-artifact paths are read. Parsing a header doesn't accept evidence or approve anything; existing audit and judgment rules still apply.

Replaces #1337, #1338, #1339 and #1343.
2026-10-17 13:02:39 -07:00
Adam Whitehurst b8e2d1dbdc fix(daemon): load the openrig-core plugin's hooks into Claude seats (#1344)
Load the openrig-core plugin's hooks into Claude seats.

- The daemon projected openrig-core into a folder Claude doesn't load, so its hooks never ran in a Claude seat.
- A Claude seat whose resolved plugin selection includes the shipped openrig-core plugin now starts with `CLAUDE_CODE_PLUGIN_DIRS` pointing at the vendored copy, on fresh launch, restore and handover, including the managed `env -i` launch. A seat that didn't select it launches as before.
- `OPENRIG_SEAT_PROJECT_DIR` carries the seat's launch folder on every launch path. The four hook entry points compare it with Claude's `CLAUDE_PROJECT_DIR` before any post, marker or write, so a nested Claude started in another project doesn't act as the seat.
- The comparison uses `fs.realpathSync.native`, so a folder typed in another letter case on a case-insensitive macOS volume still matches. Linux results are unchanged.
2026-10-17 12:59:39 -07:00
Mike Schwarz 6c1794c2de docs(getting-started): say how to add a newline when Shift+Enter submits in a Claude Code seat (#1404)
Say how to add a newline when Shift+Enter submits in a Claude Code seat.

- One row in the getting-started table of what can interrupt the OpenRig view: whether Shift+Enter reaches Claude Code as its own key depends on the terminal and on tmux's extended-key support and settings.
- To add a newline anyway, press Ctrl+J, or type `\` and then press Enter. The row links Claude Code's tmux configuration guide and the tmux manual's `extended-keys` and `terminal-features` entries.
- It changes no tmux option, configuration or launch behaviour.

Refs #1394.
2026-10-17 12:58:23 -07:00
NIKHIL 877bc53669 fix(daemon): preserve current custody on stale unclaim (#1379)
Preserve current custody on a stale unclaim.

- Unclaim re-checks the latest session and current binding inside its detach transaction. If a replacement appears during the unguarded tmux cleanup, it returns 409 without changing database custody or emitting a detach event. The message names the session and says OpenRig's tmux metadata may already have been cleared.
- A retry on a seat that is already fully released keeps main's result, including persisting and notifying `session.detached` on every call.
- Unclaim and release run under typing protection through a custody-only lease. The lease grants no typing, input or launch authority.
- A release without `--delete` captures its targets before waiting, releases the unchanged ones, and reports a target that changed through the existing partial result. Already-detached claimed seats stay in `released`.
- A release with `--delete` validates the whole captured set before any effect. Membership and session ids are re-read in its deletion transaction, so a seat added or reclaimed during cleanup keeps the rig.
2026-10-17 12:15:45 -07:00
Shravan Sumanthanan 465ac18af6 fix(queue): guide callers to verified handoff and flag self-target closures (Refs #318) (#1358)
Guide callers to a verified handoff, and flag self-target closures.

- A row whose closure names an unverified handoff carries command advice: use `rig queue handoff` or `handoff-and-complete`. A local handoff is atomic. Across hosts the successor is created first and the source closed after, and an uncertain result is reconciled by its exact id, since re-running the same handoff is idempotent.
- A malformed `chain_of_record` on a candidate successor is skipped by a `json_valid` guard instead of dropping the advice.
- The stuck sweep reports a dangling closure for an otherwise eligible local row whose closure targets itself.
- The advisory and the sweep share one read-only lineage check, `hasLinkedSuccessor`. Each keeps its own result when the lookup fails.
- The 24-hour window, the existing recorded-handoff and explicit-verification exceptions, row state and write acceptance are unchanged.

Refs #318.
2026-10-17 12:09:12 -07:00
Adam Whitehurst 32f61bf7af fix(daemon): forward the pane's TERM_PROGRAM into managed Claude seats so Shift+Enter inserts a newline (#1399)
Forward the pane's TERM_PROGRAM into managed Claude seats.

- A managed Claude seat (one launched with a native permission mode) starts Claude through `/usr/bin/env -i`, which forwarded `TERM`, `COLORTERM` and the locale but not `TERM_PROGRAM`. Without it, Claude never asked tmux for extended keys, so Shift+Enter submitted the prompt.
- The launch now also forwards `TERM_PROGRAM` and `TERM_PROGRAM_VERSION`, expanded in the pane shell like the existing terminal list (`${KEY:+"KEY=$KEY"}`): an unset or empty value stays absent.
- `TMUX` and `TMUX_PANE` are deliberately not forwarded. Explicit seat-environment values and reserved names keep their results, and unmanaged Claude and Codex launches are unchanged.
- Shift+Enter inserting a newline also needs `extended-keys` on in the person's tmux configuration, as for any program in tmux.

Refs #1394.
2026-10-17 12:06:05 -07:00
Adam Whitehurst fd15f410a2 fix(queue): show a body preview in RECENT for a row with no summary (#1393)
Show a body preview in RECENT for a row with no summary.

- `recent-transitions` entries gain `bodyPreview`, derived at read time: the first non-blank line of the body's first 2,000 characters, cut at 240 code points. It is null when the row has a non-blank summary, an empty body, or no such line. `summary` keeps the authored subject, and no other field changes.
- The TUI's RECENT tab shows the preview for a summary-less row, the rig-focused view included, instead of "no work served".
- The body is read only when the summary is blank by the same rule as JavaScript `trim()`, for at most 20 entries a call. An embedded NUL ends the preview, and a NUL before any text gives null.

Refs #1353.
2026-10-17 12:04:11 -07:00
Adam Whitehurst a2a37b165b fix(daemon): name a Claude pane a shell only when an idle shell is proven (#1395)
Name a Claude pane a shell only when an idle shell is proven.

- OpenRig starts Claude through a launch script, so the pane command reads `sh` while Claude starts or runs. Three places decided "returned to a shell" from that label alone.
- `checkReady`: an unproven shell label now reports `awaiting_runtime` ("a launch script may still be starting Claude"). The readiness loop treats both codes alike, so only a timed-out start's wording changes.
- `observeSeat`: the same accurate wording; the state stays `attention_required`, which the TUI uses to offer the pane.
- The restore reconcile precondition keeps `pane_not_usable`, with the new wording for an unproven shell.
- `reconcile-session`: no runtime-drift note when the pane's process tree holds the node's runtime (Claude or Codex).
- A pane that is a proven idle shell still reads "returned to a shell". Each check uses the existing `verifyPaneIdleShell`.

Refs #1351, #1199.
2026-10-17 10:54:04 -07:00
Adam Whitehurst 0915430b0d docs(queue): say --summary is the row's subject and carry the queue rules in the shipped skills (#1354)
Teach `--summary` as every queue row's subject, and carry the queue rules in the shipped skills.

- `rig queue create`, `handoff` and `handoff-and-complete` help, and the missing-summary warning, describe `--summary` as the subject shown on RECENT, the story and the needs-you view.
- `queue-handoff` gains an "Every queue row" section: `--summary`, the `project:`/`mission:`/`slice:` tags, `handoff-and-complete`, closing what you hold. A handoff keeps the source row's tags unless `--tags` or `--gate` is passed, either of which replaces them, so repeat the scope tags in `--tags` with `--gate`. A repository test pins that rule for both verbs.
- `mission-slice-sop` gains a "Records" section that points to `docs/reference/sdlc-conventions.md` and keeps one rule it lacks: editing judged evidence turns the judgment `unknown`.
- `sdlc-conventions.md` A2 gains a paragraph on `stage:` and `verified:`.
- Existing `rig queue` examples in skills, starter cultures, the factory craft file and the capability map gain `--summary`, and the scope tags for project work.

Text only, apart from the new tests.
2026-10-17 09:57:30 -07:00
Adam Whitehurst 85a4350ea0 fix(daemon): report a Claude resume as returned to the shell only when the process tree shows it (#1357)
A Claude resume reads "returned to shell" only when the process tree shows the pane's shell idle.

- OpenRig starts every Claude seat through a launch script, so tmux names `sh` or `bash` as the pane command while Claude runs. That word alone can't say Claude is gone.
- `verifyResumeLaunch`'s final check now asks the existing `observeClaudeDelivery` with `unknownKeepsIdle: false`: two samples with the same fingerprint must show the pane's shell holding the terminal with nothing under it.
- Otherwise, with Claude or its launch script still under the pane, the resume gets the existing "timed out waiting for Claude to become active" result. The seat is still marked failed; the message and the `retry_fresh` hint change.
- A binding with no pane to observe keeps the old behaviour.

Refs #1351.
2026-10-17 09:44:34 -07:00
Shravan Sumanthanan 3053354ca8 fix(daemon): verify idle shell before reporting returned_to_shell in checkReady (#79) (#1373)
Codex's `checkReady` decides a shell pane with the existing idle-shell rule before reporting `returned_to_shell`.

- When the static probe reads `returned_to_shell`, `checkReady` calls `verifyPaneIdleShell`: two matching samples of the pane's process tree, the rule legacy restore uses. A proven idle shell keeps `returned_to_shell`; anything else reports `awaiting_runtime`, saying a launch script may still be starting Codex.
- That covers a shell wrapper still starting Codex, another process in the foreground, and unavailable or changing process evidence, which main reported as `returned_to_shell`.
- Readiness doesn't change: neither code stops a wait, so the startup and successor waits poll on both alike. Only the not-ready code and reason, and a timed-out start's final message, change.
- `session-transport.ts` is unchanged.

Refs #79.
2026-10-17 08:00:34 -07:00
yohannv 84c87ab5b0 perf(daemon): read a queue listing's delivery ledgers in one pass instead of per row, so queue list takes half the time (#1384)
A queue listing builds its rows' delivery ledgers in one pass instead of per row.

- `QueueTransitionLog.ownerNotificationsForQitems` reads every owner-notification transition of the listed rows in one statement. `QueueRepository.deliveryOutcomesFor` reads their receipt notes in a second and loads the human registry at most once. `list()` uses it; `show`, the sweeps and every other caller keep `deliveryOutcomeFor`.
- Both paths run one shared derivation (`currentDeliveryEpisode`, `ledgerOf`); only their reads differ.
- This batches the ledger enrichment only. A full listing still makes other per-row reads.

On a synthetic 2,000-row board (3 calls each), compact listings went from a median of about 2,047 ms to 670 ms and full listings from about 4,657 ms to 3,154 ms. 64 steady-state repository, HTTP and CLI-parser cases match main in complete output. The author measured about 486 ms to 240 ms on a 450-item copy of a real database, with identical JSON.

The page and its ledgers are separate reads, as on main, so neither is a single snapshot. With another SQLite connection committing during a listing, two results can differ from main for that call: a destination move after the page read can leave `posted` where main returns no ledger, and a receipt committed during the registry load can read `never-posted` where main sees it. Both converge on the next read. For items with long histories the batch holds all their historical owner-notification and receipt rows while it derives.
2026-10-17 06:23:28 -07:00
Mike Schwarz 45bff69113 fix(cli): rig create --json says why a create failed (#1378)
An agent running `rig create --json` now learns why a create failed: the failure JSON carries `detail`, the same string the text output prints.

- `detail` comes from the existing chain: the daemon's `errors` joined with "; ", else `message`, else `error`, else the seat's own error, else `Create failed (HTTP <status>)`.
- It's the key `rig grow --json` already uses, so both commands put the reason in the same place.
- Additive only: no field is removed or renamed, a successful create's JSON has no `detail` and is otherwise unchanged, and the exit codes are unchanged.

Tests: four failure cases check that `detail` equals the printed line and the exit code is 1; one success case checks there's no `detail`. The tests-only commit fails exactly those four cases.
2026-10-17 03:43:13 -07:00
Samuel Smith 3319c19110 test(daemon): preserve concurrency in native transcript suite (#1377)
The native silent-change transcript suite runs its 13 cases concurrently, as it was declared.

- With the locked Vitest 3.2.4, `describe.concurrent.skipIf(cond)` returns the base suite, so the concurrency flag was dropped and the cases ran one after another. `describe.skipIf(cond).concurrent` keeps both the skip and concurrency.
- Without native tmux the suite is still skipped.
- Each case uses its own tmux server socket, session name, temporary root and database. Vitest's default cap runs at most five at once.
- Test-only; assertions and timing windows are unchanged.

On CI at this head the file's 13 cases took about 56 s (run 39020941765), against about 205 s serially on an earlier run. Different PRs and runners, so that comparison is indicative only.
2026-10-17 03:09:45 -07:00
Mike Schwarz 0103d36030 perf(snapshots): check for a changed seat before the restore-source lookup (#1375)
A periodic snapshot tick where no refreshed seat stopped or was replaced no longer reads and sorts every snapshot of the rig.

- The scheduler checks for a stopped or replaced running seat first and calls `findLatestRestoreUsable` only when one exists; the tick still skips only when both hold, so the decision is unchanged.
- `findLatestRestoreUsable` only reads, so not calling it changes nothing else. A lookup failure is still treated as "no earlier snapshot" and the tick captures; the first usable snapshot and the partial-teardown case behave as before.
- No index, cache or ranking.

Tests: `periodic-snapshot-scheduler.test.ts` gains a stable-tick case (no restore-source read) and a lookup-failure case that now reaches the failing lookup.
2026-10-17 02:32:14 -07:00
Mike Schwarz 512b34b6c0 fix(daemon): resolve an otherwise-unknown readiness dependency by a slice's unique SPEC ID (#1372)
Mission readiness resolves a dependency named by a slice's SPEC frontmatter `id:`, so scaffolded slices whose dependencies use that id no longer read as unknown.

- `readMissionReadiness` keeps main's exact member match first. Only when it finds nothing does it read each active member's declared id (SPEC.md, then README.md, through the existing node-file precedence and the slice indexer's frontmatter parser), once per call, and it uses a member only when exactly one declares the name.
- An ambiguous, missing or unreadable id, or an inactive member, still gives main's `dependency_missing`, and the mission stays unknown.
- A mission whose names all match exactly does no extra reads and gives the same result.
- Changed results: a mission that read unknown because of such a name now computes its state from the slices, and dependency eligibility and `next_up` follow; a cycle reached through a SPEC-id edge now reports `dependency_cycle` instead of an unknown dependency, with the state still unknown; and a newly resolved dependency can surface a deeper issue main never reached.
- Every readiness consumer reads it through this shared reader.

Tests: `mission-readiness-spec-identity.test.ts` (new; the run without the fix fails the three expected cases).
2026-10-17 02:07:48 -07:00
Mike Schwarz 854040d6f6 perf(daemon): read closed prompt episodes once per wake-ladder tick (#1369)
The wake ladder reads closed prompt-refusal alerts once per tick instead of once per open episode.

- On the first episode that reaches the check, one `MATERIALIZED` read collects the `json_each` values of closed alert rows, using the old lookup's predicates (terminal state, `json_valid`, the alert tag as a value) plus a `LIKE` pre-filter that only widens the candidate rows. Each episode then checks `prompt-episode:<key>` against that set.
- Same results: the pre-filter drops no row the old query accepted, set membership matches SQL `value = ?` for every value type `json_each` returns, the episode loop has no await or write, and a read failure surfaces at the same first episode. A tick with no open episode runs no read.
- Cost: one pre-filtered scan per tick with at least one open episode, and a transient per-tick set of the closed alerts' tag values. No migration, index, cache or write.

On a synthetic board with 20 open episodes, closed-alert reads per tick go from 20 to 1 and the tick from about 1.8 s to about 0.35 s (one paired run, not a latency distribution).

Tests: `prompt-blocked-alert.test.ts` (18 outcome cases identical before and after; a new count case fails before the fix).
2026-10-17 02:01:20 -07:00
Mike Schwarz 07f91adf25 fix(daemon): keep a managed launch's recorded --no-daemon in the printed Codex resume command (#1371)
A Codex seat's printed resume command keeps `--no-daemon` when the seat's last managed launch used it, so pasting the command doesn't start a second Codex app-server under the seat's identity.

- `applied_launch_observations` gains a nullable `daemon_opt_out` (migration 113). A Codex managed launch (fresh, fork, resume, the legacy restore) records `true` when its probe found `--no-daemon` and it added it, `false` when the probe found no such option, and nothing when no probe ran. `readCurrentDaemonOptOuts()` reads every node's choice in one query, with the same latest-tenure, invalidations-excluded rule as `readCurrent`.
- Printed commands: recorded `true` puts `--no-daemon` right after `codex`; recorded `false` prints the previous command byte for byte; nothing recorded prints the previous command plus a guidance note in the node detail ("If `codex --help` lists --no-daemon, add it right after `codex`"). That covers seats launched before this change and successors not started by a managed launch; nothing is inherited from a predecessor.
- Consumers: `rig ps --nodes` `resumeCommand`, the node detail's recovery guidance (token resume, `--last` picker, no-token summary) and the UI that renders them. No probe runs on any read path.
- An older daemon on a migrated database leaves the column NULL and ignores it; a newer daemon reading older rows treats NULL as unrecorded.

Tests: `codex-resume-command-daemon-flag.test.ts` (new; 10 of its 11 cases fail without the fix, and the legacy case passes), and the shared test fixture gains migration 113.
2026-10-17 01:55:23 -07:00
Mike Schwarz 95c48750a7 fix: honor explicit interactive send bytes and keys (#1366)
Explicit `rig send --dangerously-interact` now types its payload as keys in every readiness state, across local, fan-out, SSH and HTTP delivery.

- The CLI's empty-message check lets any non-empty explicit payload through, so a lone CR, tab or space is sent; zero length is still refused. ESC was already accepted and now acts as ESC instead of a bracketed paste followed by Enter. Ordinary sends, raw sends without interaction and broadcast keep their trimmed-empty check.
- Transport takes the existing unbracketed `TmuxAdapter` path for explicit input whatever the readiness, and the existing `promptAnswerStaged` check decides any Enter: only a complete answer visibly staged in a recognized Claude Code or Codex input gets one. Multi-line and `--context` payloads are typed with their line feeds and get no Enter, a leading composer shortcut acts as that shortcut, and other runtimes never get an inferred Enter (include CR in the payload to send an Enter key). Native runtime effects, including what a line feed does, were not measured.
- Changed result: if the recipient's binding changes between typing and the Enter, the bytes have been sent and the result is `target_runtime_conflict` with no Enter, where the previous code had already pressed Enter. It is the existing recipient check, reached before the Enter in these states.
- Every explicit send records an audit event with the observed readiness, actor and reason; an audit record is not proof of delivery. A detected prompt keeps the existing reason and audit prerequisites; in other states an unavailable audit adds an advisory to an accepted send. With `--verify`, explicit sends read unchecked, and verify never retries or submits.

Tests: `prompt-answer-delivery.test.ts`, `transport-routes.test.ts`, `send.test.ts` and `cross-host-http.test.ts`, red before the fix and green after.
2026-10-17 01:47:56 -07:00
Mike Schwarz 62cac8f566 docs(readme): point agents working on OpenRig to the developing-openrig skill (#1370)
An agent working in a plain clone of OpenRig now finds its starting map from the README.

- One line in the Community list: the `developing-openrig` skill in `.agents/skills/` (Claude Code: `.claude/skills/`) and CONTRIBUTING.md. Both paths exist.
- A README line rather than a tracked root `AGENTS.md`: Codex and Pi seats write OpenRig's managed block into the working directory's `AGENTS.md`, so a tracked one would leave every contributor clone that runs one of those seats with a modified file.

Text only.
2026-10-17 01:10:21 -07:00
Devulapalli Naga Sri Vaishnavi d88a6c5a8b fix(snapshots): preserve pre-down recovery during periodic refresh (#1147)
A periodic snapshot taken while `rig down` is stopping a rig no longer outranks the full pre-down snapshot, so a restore picks the complete team.

- After its refresh, the periodic scheduler asks the existing restore-usability selector whether the rig already has a usable restore source, just before the skip decision. When a seat stopped or was replaced during the refresh and one exists (the pre-down written during that refresh counts), the tick skips its capture. The code from that read to the capture is synchronous.
- Any usable snapshot kind enables the skip, so a restore that writes `pre_restore` and replaces seats inside one refresh is also skipped for that tick. The next eligible tick captures; repeated churn can defer it again, there's no cap on consecutive skips, and a crash before a later capture can miss the replacement state.
- A failed lookup counts as no earlier snapshot, so the rig still gets its capture.
- Not covered: a tick that starts after teardown has already stopped some seats can still publish a partial set.
- The first usable replacement capture on a rig with no earlier snapshot is kept.

Tests: `periodic-snapshot-scheduler.test.ts` (a partial-teardown case and a lookup-failure case), and the census test's stub.
2026-10-17 00:37:54 -07:00
Mike Schwarz c336df24d3 fix(daemon): roll back a legacy resume on a shell label only when the shell is proven idle (#1364)
A legacy (pod-less) restore no longer rolls back a Claude or Codex resume that is still starting just because tmux names the foreground `sh`.

- `verifyPaneIdleShell` in `native-process-lineage.ts` is the Claude delivery check's idle-shell rule, extracted unchanged (`idleShellRoot`, which `observeClaudeDelivery` now calls): over two samples, the pane's own shell owns the foreground, nothing else is in its group, and it's the same shell both times. A missing, failed or changing listing isn't idle.
- Both legacy resumes (`claude-resume.ts`, `codex-resume.ts`) return `retry_fresh` on a shell label only when that check holds. Otherwise they return `attention_required` with the evidence, and the restore keeps the seat with its pane, binding and token.
- Kept as before: a positive missing conversation, a proven return to the shell, auth and selection attention, exact-token and readiness requirements, and the deliberate fresh choice.
- Changed results: a launch wrapper still starting, or an unknown or changing listing, is now kept for attention instead of rolled back; a real return to the shell that the listing can't prove (a shell without job control) is kept too; and a live Claude on another conversation behind `sh` now gets `attention_required` instead of `retry_fresh`, so the restore no longer kills that live process.
- Cost: up to two process listings once per resume wait, only when the final observation shows a shell.

Tests: `legacy-restore-shell-label.test.ts` (new), and updates to the Claude and Codex resume tests.

Refs #1357.
2026-10-17 00:17:26 -07:00
NIKHIL 9cf42212e9 fix(daemon): discard compaction observations after lifecycle changes (#1365)
Automatic compaction no longer acts on a context observation whose seat changed while the poll waited.

- The context monitor compares each seat's eligible-session snapshot (session id, name and status, runtime, resume token, cwd, the binding's id, session, pane, window and update time, the newest occupant generation and the newest startup event) before reading it, and the compaction enforcer checks the same snapshot again inside the existing delivery lease, on both the sampled path and the pending-stage drain. A mismatch skips with `stale_observation`.
- So a reading taken before a stop, replacement, handover, pane change or new startup attempt can't start or advance preparation for whoever holds the seat afterwards, and a stopped or retired seat's queued drain isn't advanced.
- A same-occupant change to a compared field (a resume-token rotation, a cwd, window or startup-sequence change, a binding update) also defers that observation. A later current observation proceeds if its other gates allow; repeated changes can defer it again, and a skipped sample isn't filled in later. Manual initiation is unchanged.
- Cost: up to two extra point queries per seat per poll.

Tests: `context-monitor-compaction-race.test.ts`.
2026-10-17 00:15:03 -07:00
Mike Schwarz e81e261416 fix(seat): observe the replacement identity before finalizing an in-place restart (#1361)
A Codex in-place restart could report `native_unknown` when its resume screen was ready before the native process was visible. The restart now checks the existing strict identity and secondary observations immediately, then resamples within the existing finite timing budget.

- Defaults allow 31 evaluations and 30 yields of 100 ms, through the class's injected timing. It's not a hard three-second deadline: each attempt's process and tmux reads add time, so a restart that never verifies takes a few seconds longer than before.
- Each successful strict attempt still needs two fresh matching process observations and the existing secondary condition from the same attempt; an earlier negative observation never counts as proof.
- Only observation repeats: signals, launch preparation, the resume send and the respawn run once, exceptions keep their finalization, and the direct-native pane hold is restored only after final proof. Shared identity APIs and the secondary's cached-array behaviour are unchanged.
- Each attempt keeps its existing binding and verdict write, so during the window a seat can briefly show attention (and be skipped by workflow role selection) before the final result replaces it.
- Exhaustion remains `native_unknown`; success remains `restarted_account_unverified`, never account verification.

Tests: 19 new cases in `seat-restart-in-place.test.ts` (both restart shapes, delayed and invalid evidence, sample drift, pane joins, secondary failure, verdict writes, one launch and final event, held-pane restoration).

Refs #1196.
2026-10-16 23:51:52 -07:00
Rudy Mizrahi Celekli 6705936f07 fix(daemon): answer 400, not 500, when a route's JSON body is null (#1342)
A request whose JSON body is literally `null` now goes through the existing central body handling instead of crashing a route with a 500.

- `trackJsonBodyParseErrors` treats a parse result of `null` as a tracked body error, and `jsonBodyErrorHandler` answers it with 400 `{"error":"invalid_json","message":"Request body must be a JSON object, not null."}`. The check is `=== null` only: arrays, scalars, objects, empty and malformed bodies take the same path as before, and every other error mapping is unchanged. Only the synthetic error is marked, so a route's own `TypeError` still reaches the 500 path.
- Routes that read the body bare (`ask`, transport send, capture and broadcast, both spec reviews, and the seat typing-guard and held-message routes) answer 400 `invalid_json` for `null` where they answered 500.
- Routes that catch a body error now treat `null` like an empty or malformed body: their own 400 (activity events, review freeze), their own default (a `null` snapshot POST takes a manual snapshot), or the same result as before where `null` already worked (the gateway, the `rig:<id>` terminal alias, the provider usage refresh, env teardown and the explicit null fallbacks).
- For API consumers, three existing 400s change code or message for a `null` body: activity's Pi usage (`invalid_pi_usage` to `invalid_json`), the provider switch (its object-required message to its invalid-JSON message), and terminal open (`view_required` to `body_invalid`).

Tests: `json-body-error.test.ts`.
2026-10-16 23:45:00 -07:00
Mike Schwarz b7e4e61bd2 test: give compaction packets a fixture-scoped default folder in the shared setup (#1362)
The shared test setup now gives compaction packets a fixture-scoped default folder, so no test can write into `/tmp/claude-compaction-restore`, the folder real seats use, by forgetting to set its own.

- `test/hermetic-env.setup.ts`, loaded first by the daemon, TUI and CLI suites, sets `OPENRIG_COMPACTION_OUT_ROOT` to `compaction-packets` under the fixture home, right after `OPENRIG_HOME`. The setup's existing exit and signal cleanup removes the home, so the folder goes with it.
- An explicit per-test root (#1352's runner tests, `vi.stubEnv`) still overrides it, and an ambient value in the environment that runs the suite no longer reaches tests.
- `packages/daemon/test/hermetic-env.test.ts` checks that the default is under the fixture-scoped home and isn't the `/tmp` folder.

Tests only; no product code changes.
2026-10-16 23:41:29 -07:00
Luis Araya e66457038f feat(daemon): allow updating queue summary without state transition (#1270)
`rig queue update <id> --summary "..."` with no state change now corrects a row's operator-visible summary in any state, including a pending human-intent row with no blocker.

- Only the summary changes: state, blocker, owner, body, evidence, tags, claim, wakes and history stay as they were. The correction is recorded as one transition: the supplied note with "(summary updated)" appended, or "summary updated" when there's no note (no doubled marker).
- Malformed summaries (empty, whitespace-only, or not a string) are refused with no write, alone or with a note; `null` alone is refused as before, and `null` with a note stays an ordinary note append, as on main.
- An explicit state together with a summary on a terminal row (`done`, `canceled`, `handed-off`) is refused as on main; every other explicit state write and same-state rule keeps main's result, including the claim gate.
- The check lives in the state-preserving branch of `QueueRepository.update`, before any write; create, handoff and park keep their own summary handling.
- The CLI's `--summary` help says it can be used on its own.

Tests: `queue-summary-update.test.ts`.
2026-10-16 23:00:50 -07:00
Adam Whitehurst 844b94f1e5 fix(cli): show --summary in the reply hint on rig send (#1355)
The reply hint under a message from an `@external` sender now reads `↩ Reply if needed: rig queue create --destination <sender> --summary "<one line>" --body "..." --verify`, so a reply copied from it gets a subject.

- Changed together in the CLI's `wrapSendBody` (`send.ts`) and the daemon's `wrapPaneEnvelope` (`pane-envelope.ts`), the twin renderers kept byte-identical, with each twin's test updated.
- The non-external `↩ Reply: rig send <sender> "..."` line is unchanged; no code parses the reply line.
2026-10-16 22:44:45 -07:00
Adam Whitehurst 260edc0e1d test(daemon): keep the stub compaction tests out of /tmp/claude-compaction-restore (#1352)
Four daemon tests ran the real precompact hook without `OPENRIG_COMPACTION_OUT_ROOT`, so the hook wrote packets into `/tmp/claude-compaction-restore`, the folder real seats' packets use.

- `stub-compaction.test.ts` sets the variable per test with `vi.stubEnv` and clears it after; `stub-runner-compaction-e2e.test.ts`, `stub-runner-determinism.test.ts` and `stub-runner-restore-e2e.test.ts` add it to the runner child's environment.
- Each points at `<its own temp dir>/packets`, which is already removed after each test, and each test that runs the hook asserts the packet's folder is that root, so a dropped assignment fails the test.
- Tests only; no product code changes.
2026-10-16 22:43:13 -07:00
Rudy Mizrahi Celekli 3a871cb68c fix(daemon): answer client-fixable queue park/close refusals with 400 instead of 500 (#1319)
Queue update refusals the caller can fix now answer HTTP 400 instead of 500: `errorResponse` in `routes/queue.ts` maps eleven `QueueRepositoryError` codes to 400 just before the 500 fallback.

- Eleven mapped codes; seven are current HTTP refusals of the update route (`wake_not_admitted`, `wake_ambiguous`, `wake_after_invalid`, `closure_fields_not_admitted`, `blocked_on_not_admitted`, `wake_watchdog_not_live`, `wake_watchdog_target_mismatch`). The other four (`wake_max_invalid`, the two `wake_message_*` codes and `wake_self_blocker`) need fields the public route doesn't forward.
- Six queue-update input classes change the CLI's exit from 2 to 1, in normal and JSON output, with the same body and no extra write. `--wake-after 0s` is still refused locally before any request (exit 1). `rig queue block` reaches the mapping on its relevant wake-option paths.
- `blocker_not_found`, `blocker_not_live` and `blocker_malformed` stay 500 / exit 2, so not every 500 here is a server fault.
- A 400 means correct or refresh the request: a missing, inactive or mismatched watchdog may reflect changed state, not a caller mistake.
- Scripts that branch specifically on exit 2 or a 5xx for these refusals will see the change.

Tests: `queue-client-error-status.test.ts`.
2026-10-16 22:41:55 -07:00
NIKHIL 8f5aa564e2 fix(usage): separate native session counter baselines (#1348)
`rig usage top` (and `/usage/top`) now measures token movement and resets within one counter history: the same node, usage source and native session. A new conversation's starting total, or a switch of source on the same node, is no longer counted as burn or as a reset.

What changes for the same samples:
- `tokensDelta` and `tokensPerHour` fall wherever an upward jump across a session or source boundary used to count as burn; the time span is unchanged, so rankings can reorder.
- `resets` counts only drops within one history.
- A seat with at most one in-window sample per history now shows `unknown: insufficient_samples` instead of a rank.
- Samples with no session id share one history per node and source; on a schema without the session columns, only the source split applies.

The key change is in `computeTopBurn` (`usage-series.ts`), the one place these deltas are computed. Tests: `usage-native-session-burn.test.ts` and a wiring case in `usage-samples-wiring.test.ts`. Refs #774.
2026-10-16 22:40:09 -07:00
Rudy Mizrahi Celekli 57f2d7183d fix(daemon): report a blank YAML list item as a validation error instead of a 500 (#1318)
A blank YAML list item (`- `) in an agent spec, a rig spec or a startup file now gets an ordinary validation error at its path ("`<path>[i]`: must be an object") instead of a TypeError thrown out of the validator to its caller.

- The guarded sites: in `agent-manifest.ts`, resource entries, `imports`, plugin resources, the id bookkeeping and `runtime_resources`; in `rigspec-schema.ts`, `wait_for`, `surfaces.urls`, `surfaces.commands` and `checkpoints`; in `startup-validation.ts`, startup `files`.
- A scalar or list item at those sites was already rejected on main. It now gets the same "must be an object" message, and some follow-on messages are dropped. No input main accepts is refused.
- Each guard is local to its site; there's no new shared validator layer and no new rule for valid input.
- Tests: `blank-yaml-list-item.test.ts`.
2026-10-16 22:24:37 -07:00
Adam Whitehurst e0c65c41e4 docs(reference): say how a Codex seat compacts and how to size it (#1340)
The agent startup guide gains a "Codex compaction and sizing" section, and the `compaction_strategy` rows in `rig-spec.md` and `agent-spec.md` point at it.

- OpenRig's managed compaction (`rig compact`, the `policies.claude_compaction.*` policy, and the jobs the `managed-compaction` and `apprentice-handover` strategies create) runs only for Claude Code seats; a Codex seat compacts with Codex's own automatic compaction.
- It shows where to read a model's window in Codex's catalog (`codex debug models`), with the numbers for one model given as Codex 0.162.1's, and how to set `model_auto_compact_token_limit` for seats only: put it in a Codex profile file and name the profile with `codex_config_profile`, which OpenRig passes as `-p <name>` on fresh, fork and resume launches.
- It names the cost trade-off, says not to raise `model_context_window` toward `max_context_window` to avoid compaction, marks its example value as an example, and states no default trigger point, since Codex's reference doesn't give one.
- Codex's behaviour is described as Codex's and version-scoped; nothing about it was newly measured here. Docs only.
2026-10-15 18:09:33 -07:00
Mike Schwarz 37134d058f docs(rig-spec): say a HOME value reaches Pi's agent (#1335)
`docs/reference/rig-spec.md` said that Pi's agent process "keeps the baseline `HOME`", which reads as if Pi ignored a `HOME` value. The Pi runner copies `HOME` from its own environment into the agent's, and only OMP replaces it, so the sentence now says that Pi's agent process receives the runner's `HOME` and that a spec or one-off `HOME` value that reaches the runner is passed to Pi. The OMP clause and the rest of the list are unchanged. Text only; nothing was newly measured.
2026-10-15 17:29:51 -07:00
Coder8124 187426dbd6 fix(daemon): say when usage series' since/until isn't a date or time (#1305)
`GET /api/telemetry/usage/series` and `rig usage series` now say when `since` or `until` isn't recognised as a date or time. The response gains an optional `advisories` entry for each such bound (since "<value>" was not recognised as a date or time; the existing text comparison against captured_at was used), and the human CLI prints each on stderr as a `note:` line, including when the result is empty.

- The usage query is unchanged: status, rows, order and exit code match main for every bound, and a full timestamp with a zone still uses the existing instant comparison.
- A date or time, or a leading part of one such as `2026-10-14T09` or `2026-10-14`, gets no advisory, and neither does an empty or omitted bound.
- With `--json` the advisory is inside the single payload, and a response without one gains no field.
- It uses the advisory helper `time-bound-advisory.ts` already on main, byte for byte. The helper doesn't range-check a zone offset, so a malformed offset such as `+99:99` gets no advisory; the query is unaffected.
2026-10-15 16:50:49 -07:00
Adam Whitehurst 2abc3f710f feat(rig): env: in rig.yaml at rig and member level, and rig up --env, reach every seat (#1294)
rig.yaml takes an optional `env:` block at the rig level and on each member; a seat gets the rig's values with its member's laid over them, name by name. They apply on first launch, on restore (`rig up <rig-name>`) and to a handover successor, reach Claude Code seats through their cleared environment, and `rig export` writes them back. `rig up <spec> --env KEY=VALUE` (repeatable) sets or overrides a value for that launch only. Names match `^[A-Z_][A-Z0-9_]*$`, `OPENRIG_*` names are reserved, and values must be non-empty. Migration 111 adds `rigs.env_json` and `nodes.env_json`.

- The values are not secret. They are stored in OpenRig's database and rig snapshots and copied by `rig export` and bundles, so a secret written there by mistake travels with the spec, and they are visible to local processes while a seat is created.
- Managed Claude keeps its own `PATH`, `HOME` and `CLAUDE_CONFIG_DIR`, and Codex keeps its own executable and `CODEX_HOME`. Pi and OMP agent processes get only the names the runner passes; OMP's gets its seat state directory as `HOME`.
- A one-off value, from `--env` or a valid `envOverride` that the `/api/up` and bundle-install routes hand to a launch, stays with the terminal its launch creates. The launch then takes it back out of the tmux session, so a restore or handover successor starts from the spec. If that cleanup fails, the launch stops with `seat_env_cleanup_failed`; the first pane has already started, so nothing is undone. The launch then removes the session it just created and says whether removal was confirmed; if not, it names the session to check and remove. The message carries no value or tmux text.
- Known edge, from reading the code and not measured: for a managed Claude seat, a one-off name the spec doesn't declare stays on the session's name list, so a later pane in that session that gets a value for that name from the tmux server's own environment can forward it where a launch without the one-off would omit it. The first launch's one-off value itself is not passed on.
- A handover reads and writes no session environment, so it keeps main's result, and seats without `env` launch, restore and hand over as before. Existing `/api/up` and `/api/bundles/install` requests keep main's answers, and an `envOverride` they can't use is ignored as before; the CLI checks `--env` itself and refuses it with a restore or a topology.
2026-10-15 16:47:21 -07:00
Coder8124 0350ed16d0 fix(daemon): say when bundle history's since isn't a date or time (#1306)
`GET /api/bundles/history` and `rig bundle history` now say when `since` isn't recognised as a date or time. The response gains an optional `advisories` entry (since "<value>" was not recognised as a date or time; the existing text comparison against installedAt was used), and the human CLI prints it on stderr as a `Note:` line, including when the result is empty.

- The history filter is unchanged: `since` is still compared as text against `installedAt`, so status, records, order, total and exit code match main for every bound.
- A date or time, or a leading part of one such as `2026-10-14T09` or `2026-10-14`, gets no advisory, and neither does an empty or omitted `since`.
- With `--json` the advisory is inside the single payload, and a response without one gains no field.
- The shared helper `time-bound-advisory.ts` doesn't range-check a zone offset, so a malformed offset such as `+99:99` gets no advisory. Filtering is unaffected.
2026-10-15 16:13:54 -07:00
Mike Schwarz fa3b35b2bc fix(daemon): stamp the cross-host handoff close with the sender's provenance (#1333)
A queue handoff or handoff-and-complete to a seat on another registered host now records the sender's identity provenance on the source row's closing transition: the same stamp a local handoff records (transport, claimed, relay or origin-unknown). Before, that transition stored no provenance, and two readers treat an unstamped transition as one the daemon wrote itself:
- a later fallback's search for the line its reroute wrote could stop at a crafted close naming the reroute's actor and note, and replace a line of an outcome the user had saved;
- the Slack reply-to readers could take a crafted close claiming the daemon's actor and a reply-choice note as the daemon's own choice.

- This is an interpretation change: a request-authored cross-host close is no longer read as an internal fallback or reply-to record. An accepted handoff's status, destination and source state, successor creation, same-target retry and idempotent re-drive are unchanged, and the forwarded create does not carry the stamp.
- The close's blocker propagation now receives the same provenance a local handoff passes. For a row the close unparks, the wake's outbox entry stores that stamp; nothing reads it and delivery is unchanged. The auto-unpark transition itself stays unstamped, as before.
- Rows stored before this change keep no provenance and are not migrated, so an unstamped close already on disk is still read as before.
- Tests cover both routes with a header and a body-claimed identity, the idempotent re-drive, the fallback sequence, the reply-to readers and archiving. The nine new cases fail without the fix.
2026-10-15 16:11:14 -07:00
Quentin Machu cba86cffcc perf(daemon): skip captures of panes that have not written (#1262)
The daemon's transcript rotation and structural sweep now read a pane only when it has written since the last read (tmux `window_activity`), when its pane key changed (window and pane size, pane id and pid, history size and bytes, cursor position), when the transcript file changed, or once its last real capture is past a 10 s full-read threshold. Otherwise they keep the transcript and verdict they hold and record a check time. A seat with no activity reading (an older tmux, a failed or slow listing) is read on main's cadence.

- Capture times stay the real capture's. A skip records only a separate check time, which extends freshness but is never shown or stored as a capture time; a failed capture clears it.
- One `list-windows` runs at a time, shared by rotation and the sweep, and it stays owned until its child settles, so a slow listing no longer starts overlapping children.
- Accepted tradeoff: the pane key is advisory. When it misses a change, or a quiet pane's capture starts failing, the stale transcript or verdict stays visible until the next full read: the 10 s threshold plus the next eligible step and actual scheduling and capture delays, where main notices at the next sweep. There is no fixed ceiling. In a bounded real-tmux comparison with about 1 s sampling, a modelled missed key change matched a fresh read after about 8-9 s on this change and about 1 s on main.
- The same delay applies to limit ordering: if a pane's attention prompt was captured before a later at_limit event and the pane has printed nothing since, at_limit stays visible until a new real full capture, where main shows the attention verdict after the next sweep. This happens without any key miss.
- The new silent-change test waits 9 s after a seat's first capture before each operation, so it shows each case agreeing with a fresh read near the forced full read. It does not show that the key detected each operation.
- `#{history_bytes}` adds a small per-listing cost on large histories; reviewers measured it on synthetic panes only. The throughput and latency figures in the PR description are the author's measurements.
2026-10-15 15:45:26 -07:00
Adam Whitehurst 3dea35b3a9 feat(cli): store an outcome with rig queue update --state <closing> --resolution <text> (#1292)
`rig queue update <id> --state done|canceled|denied|failed|handed-off --resolution "<text>"` stores the text in the row's `resolution` field in the same write as the close, exactly as sent (multi-line and Unicode included), and `rig queue show` returns it. On main, nothing a user could run wrote a closed row's `resolution`.

- The daemon uses `resolution` only when it is non-blank text on an update that closes an open row. Every other request keeps main's answer and effects: a move to pending, in-progress or blocked, an acknowledged reopen, a note-only update, a repeat close, a close on an already-closed row, blank text and a non-string value.
- If the field already holds text, the new outcome goes after it on its own line. A reopened row keeps its first outcome, and a second close appends its own.
- The CLI checks `--resolution` locally: it needs a closing `--state` and non-blank text, or it prints a usage error and exits 1 without contacting the daemon.
- A later fallback (`rig queue fallback`, `rig remove --fallback`, `rig shrink --fallback`) keeps a stored outcome whole and replaces only the line the reroute itself last wrote. That line is found from the row's own transitions, live and archived, through the per-row index. Only a transition the reroute wrote in-process, with no identity provenance, counts; a note-only update that carries the same actor and note is not taken for it. A field that only fallbacks wrote keeps main's replacement for every reason the route accepts.
- Disclosed cost: a row that was rerouted, then closed and reopened, keeps its earlier fallback line when the field holds more than that line, so a later fallback adds a line instead of replacing it. No text is lost.
- The reroute lookup is synchronous and bounded by the row's own transition history, not by the size of the table.
2026-10-15 15:06:13 -07:00
Rudy Mizrahi Celekli 610f24f872 fix(daemon): read a CRLF SPEC.md's frontmatter intent (#1316)
`frontmatterIntent` in `current-work.ts` now accepts `\r?\n` before the closing `---` and splits the block on `/\r?\n/`. On main the frontmatter block matched, but the `\r` left on each line made the `intent:` pattern fail, so the intent came back null.

- LF input and lone CR characters are unchanged.
- A test covers a CRLF SPEC.md.
2026-10-15 15:02:06 -07:00
Rudy Mizrahi Celekli e24254b78f fix(scope): parse CRLF checkbox blocks in the logical-checkbox twin (#1315)
Both copies of `logical-checkbox.ts` (CLI and daemon) now split on `/\r?\n/`. On main, the `\r` left on each line of a CRLF file made the checkbox pattern fail, so a CRLF block yielded zero items.

- LF input and lone CR characters are unchanged, and the two copies stay byte-identical.
- The callers that find the checkbox section already tolerated `\r`, so they now get the items.
- Tests cover CRLF in both copies.
2026-10-15 15:01:44 -07:00
Rudy Mizrahi Celekli 794af927bf fix(daemon): parse CRLF PROGRESS.md files in the progress indexer (#1314)
`progress-indexer.ts` now splits on `/\r?\n/` instead of `"\n"`. On main, every line of a CRLF `PROGRESS.md` kept its `\r`, so the title, heading and checkbox-row patterns failed and the file read as empty.

- LF files and lone CR characters are unchanged. In a mixed file, the CRLF lines now parse too.
- A test covers a CRLF file.
2026-10-15 15:01:22 -07:00
Rudy Mizrahi Celekli 3e0072ae2f fix(daemon): send non-ASCII ntfy titles as RFC 2047 encoded words (#1317)
The ntfy adapter now sends a `Title` that contains any character outside printable ASCII as an RFC 2047 encoded word (`=?UTF-8?B?…?=`), which ntfy decodes. On main, a character above U+00FF made the request fail, so the notification was never delivered, and a Latin-1-only title (for example "Café") arrived as raw bytes that ntfy shows with a replacement character.

- Printable ASCII titles, including an empty one, are sent byte-identical to main.
- Title truncation now counts code points rather than UTF-16 units, so a long title is never cut inside a surrogate pair.
- A tab is encoded and decodes to the same tab. Any other control character, which made main's request fail, is now encoded and delivered as part of the title.
- CR and LF are still replaced with spaces first, so no title can add or split a header.
- A long title is sent as one encoded word, which can exceed RFC 2047's 75-character limit; ntfy decodes it whole. `Click` and `Tags` are unchanged.
2026-10-15 14:57:21 -07:00
Rudy Mizrahi Celekli 74dd0b02e6 fix(daemon): normalize a bare agent spec profile key as an empty profile instead of crashing (#1320)
`normalizeAgentSpec` now passes `profileRaw ?? {}` to `normalizeProfile`, so a bare profile key (`profiles: default:` with nothing after it, which YAML reads as null) normalizes as an empty profile, the same as `default: {}`. On main that spec validated and then threw `Cannot read properties of null (reading 'uses')` wherever the agent was resolved or bundled.

- `validateAgentSpec` is unchanged, and scalar and list profile values keep main's validation and normalized result.
- Tests cover a bare key, `{}`, a scalar, a list and a populated profile.
2026-10-15 13:56:16 -07:00
Adam Whitehurst 828da9c645 fix(daemon): relaunch an ordinary terminal seat fresh on restore instead of asking for --fresh (#1328)
A `builtin:terminal` seat no longer stops at `awaiting-decision` on every restore after its first. Restore, the restore plan preview and the pre-restore replay check now read `resume_if_possible` as `relaunch_fresh` (`effectiveRestorePolicy` in `restore-policy.ts`) for an ordinary terminal seat only: its saved and current runtime are both `terminal`, and no recorded session for it carries a nonblank resume token. Such a seat restores `fresh-primed` with no decision asked, and its startup actions run again, whether `resume_if_possible` came from the column default or was set explicitly.

- Every other seat keeps main's result. A seat with a recorded resume token still waits for a decision with no new session when it is absent at capture, and keeps main's resume path, with no startup replay, when its occupant resolves. A seat whose saved and current runtime differ, with no saved startup context, waits and launches nothing in the preview, restore and the replay check alike. The runtime-mismatch and ambiguity stops, `--fresh`, explicit non-resume policies and the absent-seat history check are unchanged.
- A required startup file missing for an ordinary terminal seat now fails pre-restore validation (`required_startup_file_missing`, or `startup_owner_root_missing`) and blocks the whole restore before any launch (`not_attempted`), as listing that seat with `--fresh` already does. On main that seat waited for a decision and the rest of the rig restored.
- Preview only: a tokenless terminal saved with an explicit `relaunch_fresh` or `checkpoint_only` policy now forecasts `freshRequired: false`. The restore itself is unchanged.
- A recorded resume token that is only whitespace now counts as no token for this rule, so such a terminal restores fresh and runs its startup again where main took its resume path. This case is read from source, not measured.
- `rig-spec.md` describes the rule and the runtime, identity and replay prerequisites that still apply.
2026-10-15 13:17:32 -07:00
Adam Whitehurst 19ee3e03a3 fix(daemon): resolve a slice: tag by the slice's frontmatter id as well as its directory name (#1331)
A queue row tagged `slice:<id>`, where `<id>` is the `id:` in a slice's SPEC.md frontmatter, is now read as that slice in the slice index and the review gatherer, as a row tagged with the slice's directory name already is: it appears on the slice's Queue tab, in its agents band and attention, and counts for its derived phase.

- An id resolves only when exactly one slice folder under the indexer's roots declares it (the same mission and name under two roots counts once) and no slice folder has that name. An id claimed by two slices, for example a copied SPEC, resolves nowhere, and a tag that is a directory name keeps meaning that directory.
- The id-to-directory map is built with the slice listing and refreshed when the listing's cache expires or is invalidated, so a changed `id:` or a moved slice can take until then to show.
- `docs/reference/project-workspace.md` says either form resolves.

Changed results for existing data:
- A row tagged only with a slice's unique id now counts for that slice. Before, it counted for no slice, and a human-gate row tagged that way appeared in neither the slice's nor the mission's attention.
- The first such row makes its mission use the typed-row rule, as a directory-tagged row already does: slices with no typed rows stop showing rows they matched only through the mission id or the default rail, and the tagged slice shows its typed rows instead of fallback rows. Rows matching a slice's own name or an explicit rail still show, and no row is deleted.
- A slice with a locked spec or authored PRD whose only active rows are id-tagged can now read `building`.

The execution view's existing resolver is unchanged and can still pick a different slice when ids collide.
2026-10-15 12:53:39 -07:00
Adam Whitehurst 12cd5acdc5 feat(workflow): write a preferred target as member@{rig} to resolve it against the bound rig (#1293)
A workflow's `preferred_targets` entry can be written `member@{rig}`. When an instance is bound to a rig (`--rig`, or a registered spec default), the trailing `{rig}` resolves to that rig, so one cached spec routes each bound instance's work to its own rig through later hops, failure and exception packets, ordinary and occurrence-local resume, and a database reopen. The cached spec itself stays literal.

- Only a trailing `@{rig}` is replaced, through one helper shared by binding, the validator and exception readiness. Braces in the member part or a partial rig name stay literal.
- Without a binding, the target stays literal and is handled by the normal resolution and queue admission at the step that selects it. Starts whose entry resolves still start, including ones with `{rig}` only in a later or unused role or a second preferred target, and an explicit entry owner keeps its precedence. An unbound placeholder-only start keeps main's 400 `unknown_destination_rig` with the instance and packet rolled back, and an unresolved later hop fails at that hop with the same 400.
- Unbound `validate` reads a `{rig}` target as `unregistered`, saying it needs a bound rig or a literal rig name. Once bound, the resolved target uses the existing readiness check.
- The slice view shows a bound instance's `{rig}` target as the seat it routed to.
2026-10-15 11:44:57 -07:00
Alan Dampog c67e1154b2 fix(cli): rig start --last keeps down a rig that was stopped on purpose (#1238)
`rig start --last` leaves a rig down when it was stopped on purpose, and says how to bring it back. Before, `--last` restored every non-kernel rig that wasn't running and had a usable snapshot, and `rig down` writes a pre-down snapshot, so a rig taken down on purpose came back at the next `rig start --last`.

- Under `--last` only, each candidate's seats are read from `GET /api/rigs/:id/nodes`. A rig is kept down when at least one seat was launched and every launched seat reports `intentionallyStopped: true` (recorded by `rig down` and `rig seat stop`). The output names it, "stopped on purpose (with rig down or rig seat stop)", with `rig start --rigs <rig>`; `--json` carries `keptDown: [{ rigName, restoreCommand }]`.
- Anything else restores as before: a seat that is plain `exited` without the flag, a seat the boot reconciler marked `detached` after tmux was lost, a mix of flagged and unflagged seats, and a daemon that doesn't report the flag.
- When a rig's seat statuses can't be read, it is still selected for restore, with a `seat_status_unreadable` warning on stderr and in `--json` `warnings`; status and exit code are unchanged.
- `--all`, `--rigs <name>` and the interactive picker are unchanged, and a partly running rig still reports `rig_not_stopped`.
- The `openrig-user` skill describes the deliberate-stop exception and the unreadable-status warning.
2026-10-15 11:05:52 -07:00
Shravan Sumanthanan b79bd3576a test(daemon,cli): canonicalize mkdtempSync roots via realpathSync for Darwin test portability (#1330)
On macOS, `os.tmpdir()` under the default `TMPDIR` is in `/var/folders/...`, and `/var` is a symlink to `/private/var`. Three test suites built fixture roots with `mkdtempSync` and compared them with paths the product had already canonicalized, so they failed when run locally on a Mac. They now wrap `mkdtempSync` in `realpathSync`:

- `pod-bundle-assembler.test.ts`: the read and file-mode expectations used the non-canonical root, while the assembler passes the realpath it checked. The explicit symlinked-root case still runs.
- `pi-runner-path-native.test.ts`: the shim compared `$PWD`, which `/bin/sh` sets from the physical directory, with the non-canonical temp path.
- `context-git-shallow.test.ts`: the checkout the product records is canonical (`realpath` of the checkout and of `git rev-parse --show-toplevel`), and the test expected the caller's spelling.

CI already canonicalizes its `TMPDIR` before the package tests, which is why these pass there unchanged. No product code changes.
2026-10-15 10:55:28 -07:00
Adam Whitehurst 2b643d8c44 feat(workflow): stamp project, mission and slice tags on an instance's packets (#1273)
A workflow instance can carry a project, mission and slice scope, and every packet it creates gets those tags, so workflow packets list on their slice's Queue tab in the Projects view.

- `rig workflow instantiate` and `rig workflow run` take `--project`, `--mission`, `--slice` and `--tags`. The scope is stored on the instance (migration 110 adds a nullable `workflow_instances.scope_json`) and stamped after the system tags on every packet the instance creates. Instances without a scope, including every existing one, keep exactly their old tags.
- `rig workflow instantiate-lifecycle` takes the project and mission from the identity it compiles. A compiled step's packets get the slice that step was compiled from. A step an authored graph names maps to a slice by exact directory name, then by a `metadata.id` exactly one active slice claims; anything else gets project and mission tags only, with an advisory where it's ambiguous. An identity that can't be a tag is left off with an advisory, and the lifecycle still instantiates. Slice metadata the lifecycle doesn't run is read only leniently, for step names.
- `POST /api/workflow/instantiate` reads a `scope` object. A valid one naming a catalogued project is applied. One the route can't apply (a project the catalog doesn't declare, a conflicting, reserved or malformed tag or id, or a `scope` that is null, an array or a string) is ignored, as main ignored the key: the route creates one unscoped instance with main's tags, records nothing the scope named, and lists a "Scope not applied" advisory naming the instance. A failure unrelated to the scope still fails.
- The cost: a project id only the daemon can check, such as a mistyped `--project`, creates unscoped work. `instantiate` and `run` print a warning on stderr that names the instance (also under `--json`, where stdout stays parseable) and say UNSCOPED; nothing retries automatically, so running the command again creates a second instance. What the CLI can check itself (an id of the wrong shape, a reserved or contradicting tag) is a usage error before anything is sent.
- The daemon package exports `./workflow-scope` (the scope normalizer and its error) for the CLI's own checks.
2026-10-15 10:32:10 -07:00
Adam Whitehurst 686724bca8 fix(daemon): retry a staged startup prompt twice and recognize more Claude footers (#1295)
A startup prompt that is still staged after its first Enter now gets up to two guarded retries. Each retry presses Enter only and never re-types; it rechecks the full staged text first, and a changed draft or a refused retry stops it. Each extra retry waits about 200 ms.

The startup check recognises more of Claude's footer lines: a mode bar starting with `⏵⏵` or `⏸` (including one cut short in a narrow pane), the `paste again to expand` hint with or without its effort suffix, and Vim's `-- INSERT --`, alone or ahead of another footer.

The composer's closing rule is now the lowest rule below the input line, and only when a recognised footer follows it. Otherwise the submission reads unverified. So a prompt whose own text contains a rule followed by a footer-like line can't stand in for the composer's frame and read as submitted.

Limitation: a rule-shaped row drawn below a recognised footer (for example a status row) leaves the boundary unverified. A cleared prompt then reads unverified with a warning, and a staged prompt gets the warning without the automatic retry main attempted. Because the submission isn't confirmed, an enabled Claude proof-instruction send is also skipped by the existing guard, with its warning (from reading the source; not measured). How often such a row appears in Claude or a user's status line isn't known. Startup still reports ready, and no new failed-startup state is added.
2026-10-15 10:14:14 -07:00
Adam Whitehurst 5d71c57776 feat(cli): show a closed queue row's closing note and reason in rig queue show --full (#1290)
`rig queue show <id> --full` now shows how a closed row ended. For a row in done, handed-off, canceled, denied or failed, it adds a `closingTransition` block with the state, closure reason, closure target, who closed it, when, and the note. The block is the transition that moved the row into its closed state: a note added afterwards doesn't replace it, and a reopened row has none until it closes again.

Open rows look as before, and every existing field of the queue item response is unchanged. Plain `rig queue show` prints the same fields; for a closed row with a closing block, its `readView` reports `complete: false`, lists `closingTransition` in `omittedFields` with a pointer to `--full`, and counts the block in `fullJsonBytes`.
2026-10-15 09:01:31 -07:00
Adam Whitehurst 4707eb4254 fix(cli): seed a new mission as planned, outside the proof rollup until activated (#1289)
`rig scope mission create` now writes `metadata.status: planned` in the new mission's `mission.yaml`, for ordinary and release missions alike. Before, it wrote no status.

A `planned` mission stays outside the project's proof rollup, which counts only `active` and `release-candidate` missions, so creating a mission doesn't change a project's readiness. It counts once someone sets its status to `active` or `release-candidate`; accepting its slices alone doesn't bring it in, and nothing changes the status automatically. Because the mission now has a phase, operating-posture reads and mission-scope posture writes for it work, using the existing binding or the human-led default, where before they reported the phase as missing. Missions created before this change keep no status.
2026-10-15 08:58:06 -07:00
Adam Whitehurst f121133bb6 fix(tui): label the scopes proof header as accepted or paired (#1288)
The scopes view's PROOF header now says what its count means: `a/t accepted` when a judgment policy is configured and the slice has no readiness issues, green exactly when the daemon reports the slice ready, and `n/m paired` in every other case.

At detail widths of 70 or more, where the labelled header line doesn't fit, STATE, PROOF and LOCKS now stack the way the narrow layout already does instead of the line being cut, so the lock state always shows in full. When the line fits, and below 70, the layout is unchanged.
2026-10-15 08:49:23 -07:00
Adam Whitehurst 70fd9d8d94 fix(daemon): count a row parked on an external gate as a waiting lane (#1303)
The Projects view now shows a slice whose work is parked on an outside dependency. A queue row in state blocked whose `blocked_on` is an `external:` gate appears as a waiting lane for its slice, with `waiting: {on}`, instead of nothing. The strip, the slice card and the lane page call it a waiting row with what it waits on, and its `next` line points at that wait; the `assignment` wording stays for in-progress lanes. A waiting lane adds no "activity unconfirmed" entry, the parked row still reads as parked, never stalled, and its wake is untouched. An in-progress lane on the same slice wins, and `lanes_live` doesn't count waiting lanes.

Rows parked on a qitem, a human seat, or a `fold:` or `auth:` gate are not lanes. The slice card also finds a lane that names the slice by its directory (`slice:<dir>`), as the neighbouring lookups already did. Choosing the default mission is unchanged.
2026-10-15 08:47:27 -07:00
Daniel Kuykendall IV fb64a9592c fix(policy): let rig policy apply change an existing seat's policy (#1285)
`rig policy apply <policy> --seat <seat>` now changes an existing seat's stored permission policy without re-creating the seat. It records the new policy, its provenance and a `node.policy_changed` audit event in one transaction; the running process and the rig spec file are unchanged.

Restore, resume and launches that read the seat's stored state use the stored policy, unless an explicit native selection (`rig seat set-permissions`) takes precedence. `rig up` by a saved rig name uses it; a launch from a spec that declares a policy replaces it with the spec's policy, which later restores then use. `--seat none` sets an explicit floor for that seat and doesn't inherit the rig's policy. Afterwards, a `rig launch --retry-startup-from` file has to carry the new policy.

`--seat` accepts the built-in policies and `none`, and an ambiguous seat name is refused without a change.
2026-10-15 08:35:15 -07:00
Alan Dampog f95670e068 fix(daemon): report Codex resume capture failures and keep retrying null tokens (#1284)
When the daemon can't capture a Codex seat's resume token, it now logs why, once per reason, without the token, the thread ID or the exception text. A process-listing failure during claim adoption or a handover capture now records a redacted skip event with reason `process_unreadable`; before, it was swallowed with no event. `rig down` still records and prints its warning when Codex discovery fails, as before.

Daemon shutdown now cancels Codex captures that are still running, so no token is written after the daemon stops. The asynchronous waits in one adoption attempt are bounded at two seconds, so on a slow host adoption can end before its eight tries; synchronous SQLite reads are not bounded by it. Retrying is unchanged: every periodic snapshot tick and every manual null-fill makes one attempt for each Codex seat without a token, and a pending fork ID fills the same way.
2026-10-15 08:23:02 -07:00
NIKHIL 34a64aed01 fix(daemon): discard watchdog evaluations after job retirement (#1325)
A watchdog job that is stopped, ended by its park's completion, or retired with its seat's generation while a scheduler pass is already running no longer delivers. Before, the pass worked from a snapshot of active jobs, so a job stopped after the pass selected it, or while its policy was still running, could still deliver, record a fire and become actionable, and a late result could replace the reason the stop recorded.

The engine now re-reads the job's stored state when it starts evaluating a selected job and again after the job's policy returns. If the job is no longer active, it returns a quiet skip and writes nothing, so the job's recorded state and reason stand, with no late delivery, fire record, history, event, evaluation stamp, actionable change or wake attempt. Active jobs, including ones rescheduled or edited while their policy runs, behave as before. A delivery that has already started still completes as before, and a context-usage transcript binding made before the policy runs is kept.
2026-10-15 06:32:58 -07:00
Mike Schwarz 010cf6b6d4 perf(queue): read recent queue activity newest first within the scope's items (#1326)
The queue's recent-activity read (`GET /api/queue/recent-transitions`, which the TUI uses) no longer works out every transition's predecessor across all live and archived queue history and sorts it on each call. It now resolves the scope's items once and walks a new `(ts, transition_id, qitem_id)` index on the live and archive transition tables newest first, stopping at the limit, and looks up each row's predecessor by transition ID.

The results are unchanged: the same rows, order, predecessor rule across live and archived history, limit handling and errors. Only the work per call changes. An independent check compared main and this change on the same databases, including reopened items, timestamp ties, escaped rig names and archived rigs, and found byte-identical responses.

Migration 112 adds the two indexes. An existing install builds them once when it upgrades, and afterwards each new transition and each archived row maintains one more index entry. On synthetic queue databases at two sizes, every timed read ran faster than main: ordinary instance and rig reads about 2 to 7 times faster, a sparse rig's read about 2.4 to 2.7 times faster, and reads that match nothing about 3 times faster. The indexes took 10.5 to 14.2 MB at the smaller size and 21 to 25 MB at twice that. These are synthetic measurements, not figures from a live install.
2026-10-15 06:18:37 -07:00
yohannv fd097bfdfa fix(daemon): stop a seat's transcript capture once its session ends (#1281)
When a seat's session ended (seat stop, seat clean, `rig down` teardown or a launch rollback), its transcript capture kept running. Now capture stops once the session's latest row is `exited`, and a transcript read never restarts it. Unclaiming a seat whose session is still running keeps its capture, and a re-claim keeps one rotation.

The saved transcript stays readable after the session ends: tail, grep and full return the saved text, and their ingest health reports `degraded` / `capture_stale` at any file age, where main reported `live` / `capture_fresh`. A live seat is unchanged: a recent capture reads `live`, and a stale capture keeps the 503 and its warning. Missing (404), unreadable and empty (503) files keep their status codes, and an ended session's unreadable-file error no longer reports capture as live. Node and pod removal still return not found, and redaction is unchanged.
2026-10-15 04:04:43 -07:00
Shravan Sumanthanan bf0e5fcdc9 fix(daemon): reconcile startup readiness on session interaction (Refs #7) (#1236)
A seat whose startup readiness check failed for a recoverable reason (a readiness timeout, or a gate cleared after its startup actions were delivered) kept reading as failed, or as needing attention, after it had reached a working prompt. Now a successful `send` or `capture` to that session re-runs the runtime's readiness check, and when it passes the seat becomes ready once, with one `node.startup_ready` event and a completion stamp. The `ContextMonitor` poll is unchanged.

Recovery happens only when the current attempt's `node.startup_failed` event records a readiness-stage failure with no remaining work; a failure without that structured stage stays failed and isn't probed. The check's result is written in one transaction that first confirms the attempt is still the latest, so a newer attempt that starts or fails while the check is out is never overwritten. For a Claude seat, the stored session must match the attempt's requested resume identity, be a verified rotation from it, or follow an explicit fresh launch; otherwise, including a failure event without the requested identity fields, the seat moves to `attention_required` with no completion stamp. `node.startup_failed` now also records the failure stage, whether work remains, and the requested resume token and type. Known limit: a Claude seat whose resume fell back to a fresh launch can be left at `attention_required` rather than `ready`.
2026-10-15 03:03:26 -07:00
Woohyuck Jeong fe49c128f3 fix(daemon): read artifact-pool frontmatter from CRLF files and EOF closers (#1322)
An artifact-pool watchdog (`artifact-pool-ready`, `edge-artifact-required`) read an artifact's frontmatter only when the file used LF line endings and had a newline after the closing `---`. A ready artifact saved with CRLF endings, or ending right after the closing `---`, lost its frontmatter, so with `include_statuses: [ready]` it was dropped and the waiting seat was never woken. Now both shapes read like an LF file with the same content; a line that only starts with `---` still doesn't close the block, and the raw bytes passed on are unchanged. One further change, from reading the source rather than measuring it: a frontmatter that is empty (`---` followed at once by `---`) now ends there, as an empty block, and the text after it is body. Before, the next `---` line in the body (a Markdown horizontal rule, for example) was taken as the closer and the body text in between was parsed as metadata. So a pool with no status filter can now include such a file where it was dropped as malformed; a status-filtered pool now excludes it rather than reading a status out of its body; and an edge target scan now keeps it, so its raw text can count toward the target mentioning the source key and suppress a wake that the old drop allowed.
2026-10-15 02:10:43 -07:00
Mike Schwarz 8daf6a43df feat(cli): rig launch takes a rig name as well as its ID (#1312)
`rig launch` used to need a rig's ID; a name was passed through unresolved and the daemon answered not-found. Now it resolves the handle first, locally and with `--host` or a selected host, on the single, subset, plan and first-start retry routes: an exact ID wins (archived IDs and ID-looking names included), then a unique active name; an ambiguous name stops before anything is sent and lists the candidate IDs; a missing handle, or a lookup that fails or returns an unusable list, sends the raw handle exactly as before. Each launch makes that one lookup first. `rig down --host` uses the same remote lookup, so its results change only for host lists that hold malformed rows: an exact ID or unique active name no longer crashes on an unrelated null row and posts the down for that rig; a missing or archived-only name, or an ambiguous one, with a null row gives the existing error (read from source, not measured); a response that isn't a list gives a readable error and sends nothing; a name carried only by a row without a rig ID is not found and sends nothing; and a row without a rig ID that shares a name still counts toward that name's ambiguity, as before. Local `rig down` and `rig add` are unchanged. The PR also updates the CLI reference, the openrig-user and topology skills and the capability page, and regenerates the generated skill-edge digest.
2026-10-15 01:57:10 -07:00
Leon.C 63f7b4caab fix(daemon): confirm Codex human prompts before reporting attention (#943)
A Codex `PermissionRequest` hook is now recorded as a pending request, keyed by the hook's `turn_id`, and becomes `needs_input` only when a pane read shows a real approval or selection prompt, so a request that Codex's auto-review resolves within seconds no longer marks the seat as needing a person. An unreadable pane still reaches `needs_input` after the grace period, labelled `permission_request_unverified`, and checks back off after a negative read. Each accepted request bumps a per-seat permission revision; an all-clear from a pane read that began before a newer or repeated request is discarded, so it can't retire that request's alert, while a later fresh clear still passes. The `rig send` guard, prompt answers and the reactive tap treat a pending request accordingly, and a send to a readable, empty Codex composer still goes through. openrig-core moves from 0.1.9 to 0.1.10 in both plugin manifests. Refs #896 (the Codex case; the Claude Code case there stays open).
2026-10-14 23:45:49 -07:00
Mike Schwarz e367b5fbe8 fix(claude): leave a project's settings or MCP file that can't be used as a JSON object as it is (#1311)
A launch used to replace a project's `.claude/settings.local.json` or `.mcp.json` with the spec's fragment whenever the existing file wasn't a valid JSON object, silently dropping the owner's content. Now, when the target can't be read, isn't valid JSON, or holds an array, number, string, boolean or null, the file is left byte-for-byte, the fragment entry is reported as `skipped` (never copied to `.claude/extensions`), and the launch result carries one warning naming the file, a fixed reason (no file content) and the fragment that wasn't applied; once the file is fixed, the next fresh launch applies it. A skipped entry doesn't fail the launch, so a target that is write-only, unreadable or a directory no longer stops the start either. Valid objects merge as before; missing, empty and whitespace-only files get the fragment; a malformed source fragment and write failures after a successful read still fail the entry. The context collector also leaves a non-object settings file alone, so the status line isn't installed for that seat.
2026-10-14 23:35:25 -07:00
alxledesma 8c03cf5716 docs(queue): say which fields answer pane delivery, and test a woken, claimed and closed task (#165) (#1277)
The coordination-primitive note says which fields answer pane delivery for a queue task. A claimed task that is later closed still reads `claimed` only when its stored result was unconfirmed (`delivered-ack-pending` or `indeterminate:…`); a `verified` or `failed:…` result reads as stored. `rig queue create --verify` prints "Terminal receipt unconfirmed, but the seat has claimed the item (claimed)." only for such an unconfirmed, claimed item, and "A claim shows the seat took the item; it does not prove the body was read." for any claimed item. A CLI test drives a woken, claimed and closed task through the real path. Refs #165 (the deliveryOutcome half).
2026-10-14 22:55:58 -07:00
haralez 5605d4a81d fix(daemon): clean up a consumed launch script with /bin/rm, then PATH rm (#1310)
A consumed tmux launch script now removes itself with `/bin/rm -f -- '<path>' 2>/dev/null || command rm -f -- '<path>' || true`, before the unchanged launch line. Where `/bin/rm` exists, the script is removed by it as before, and no PATH `rm` runs. Where it doesn't, POSIX shells (sh, dash, bash, zsh) remove the script through the receiving shell's PATH `rm`, bypassing aliases and functions, and because the line ends in `|| true`, a sourced shell under `set -e` still reaches the launch command, which main's failed `/bin/rm` stopped. Sourced fish without `/bin/rm` keeps main's result: the script remains, fish prints its unknown-command line, and the launch runs once. The launch runs exactly once with its own exit status; the quoted path, `-f --` and exec mode are unchanged.
2026-10-14 22:55:26 -07:00
Adam Whitehurst aa95c23390 fix(daemon): end running runtime probe groups when the daemon stops (#1301)
When the daemon stops, through the shutdown phase or the early startup-signal handler, running runtime probe groups are ended, and a probe the stop ended rejects with `ProbeStoppedError` whatever its exit code, so it never counts as an answer and a saved verified version row is unchanged. The `rig up` preflight's runtime version checks (Claude, Codex, OMP and Pi) now run through the same bounded probe with its 30 s limit; they had no limit before, so a slow but working check now fails there. A check that hits the limit reports "`<bin> --version` didn't answer within 30 s", with no runtime output, no "not available" and no install hint: a blocking error for Claude, Codex and OMP, and the same text as a warning for Pi, which keeps launching. Other failures keep their wording.
2026-10-14 22:06:12 -07:00
Adam Whitehurst e48cbeb750 fix(daemon): write the Codex config only when a Codex seat exists or launches (#1297)
A daemon with no Codex seat recorded (no `nodes` row with runtime `codex`) no longer writes the Codex feature flag, the managed activity-hooks block or the hook trust records into `<CODEX_HOME>/config.toml` at boot, so an isolated daemon that still carries the real `CODEX_HOME` leaves the user's file alone. The writes move to `CodexRuntimeAdapter.ensureManagedConfig()`: startup calls it when Codex seats are recorded, and every Codex launch, resume and fork calls it first, including a legacy no-pod restore through `CodexResumeAdapter`. A failure there warns and doesn't block the launch, as at boot. With `runtime.codex.hooks_enabled` false, every boot still strips OpenRig's managed block, with or without a Codex seat, writing only when the block is present. With hooks enabled and no Codex seat, a block an earlier daemon wrote stays until a Codex seat launches, and a seatless boot no longer runs the `codex --version` probe.
2026-10-14 21:23:03 -07:00
Adam Whitehurst f0b7d9e67e fix(daemon): show a reported merge in the lineage and count it only when linked to the built commit (#1302)
A queue row tagged `merged:<pr>` is a recorded report of a merge. The execution view shows it beside the merged rung (`folded.merge_report`: PR, row, `recorded_at` and whether it's linked) and in the basis text, distinct from ancestry. It changes the merged answer only when the same row also carries `candidate:<sha>` that resolves to the slice's built commit and ancestry answered false (for example a squash merge); then the basis says the merge was reported for that candidate, not verified. No candidate, an unresolvable candidate, an unusable declared integration ref, no repository context or a failed merge-base keep ancestry's answer, and rows carrying `merged:` are not used to choose the built candidate. `recorded_at` is when the row recorded the merge, not when it happened. `docs/reference/sdlc-conventions.md` describes the convention.
2026-10-14 21:02:35 -07:00
Mike Schwarz 0f1d719c3f docs(mode): mark the legacy mode fields that nothing in OpenRig acts on yet (#1307)
The human output of `rig mode effective`, `rig mode defaults`, the `rig mode set` preview and confirmed read-back now marks the seven legacy record fields (`autonomy_scope`, `heartbeat_cadence`, `inspection_depth`, `update_detail`, `escalation_threshold`, `concurrency_limit`, `permission_prompt_posture`) and `expiry_or_stale_rule` as `(stored; not applied)`, with one legend line, since nothing in OpenRig acts on them yet; `rig mode set --help` says the same for their options. `scope` (the binding key) and `evidence_citation` (read into the posture's evidence) stay unmarked, and the served default stale rule on `defaults` reads `(not applied)`. JSON output, `rig mode show`, mode names, values, validation and storage are unchanged. `docs/reference/scoped-operating-posture.md` now says a saved legacy mode and a posture are kept side by side at one target, and lists the marked fields.
2026-10-14 20:44:35 -07:00
Coder8124 9afcfd5855 fix(daemon): leave tmux copy mode before delivering a send (#912)
When a send targets a tmux pane that is in a mode (copy mode, for example), the transport leaves the mode once and then delivers the message, instead of typing it into the mode where it is lost. A pane still in its mode after one cancel is refused (HTTP 409, `pane_in_mode`), and a pane whose mode can't be read sends as before. Both tmux calls go through the argv command path. A person reading that pane's scrollback is returned to the bottom when a message arrives. Refs #331.
2026-10-14 20:06:19 -07:00
Wu Shuwen 97dbf1fc45 docs(reference): keep a custom Claude status line with context collection (#1308)
Adds `docs/reference/claude-status-line.md`, linked from the README's Claude notes: why a user-level Claude status line doesn't show in a seat's directory (the seat's `.claude/settings.local.json` takes precedence), that OpenRig keeps a custom nonempty status-line command since 0.6.5 and what is lost without the collector, a POSIX-shell wrapper that feeds the same input to the collector and a custom renderer, and how to check after an upgrade or instance change that collection is still current. Docs only. Refs #1272.
2026-10-14 20:03:20 -07:00
Coder8124 2cfc5fa017 fix(cli): exit non-zero when rig ask names an unknown rig (#1202)
`rig ask` exits 1 when the daemon resolves no rig for the name given (unknown, or ambiguous across more than one rig); its guidance and JSON output are unchanged, so a shell caller can branch on an unresolved target. A found rig with little or no evidence still exits 0, and the `--wake` path is unchanged. `rig ask --help` now lists exit 1 as the daemon not running, or the rig unknown or ambiguous. A script under `set -e` or chained with `&&` that treated an unresolved name as success now stops there.
2026-10-14 19:50:24 -07:00
Adam Whitehurst 72865f7962 fix(test): remove fixture homes and test temp dirs when the vitest worker ends (#1300)
The shared vitest setup (`test/hermetic-env.setup.ts`) removes the fixture `OPENRIG_HOME` and its sibling user home that a worker created when the worker ends: on a normal exit, and on SIGTERM, SIGINT or SIGHUP, after which it re-raises the signal so the worker still ends by it. Only a home this process created and marked is removed, and a failed removal is ignored. In daemon and CLI runs each worker also gets its own `TMPDIR`, removed with the homes, so tests that make temp directories under `os.tmpdir()` leave nothing behind. The tui keeps the `TMPDIR` it was given (`OPENRIG_TEST_KEEP_TMPDIR=1` in its vitest config), because its socket tests size paths to it. Tests only.
2026-10-14 19:26:49 -07:00
Adam Whitehurst 03d0d64f09 fix(daemon): bind a queue row to a mission by its mission: tag first (#1304)
In a named mission's execution view, a queue row with one or more `mission:` tags binds only to the missions those tags name exactly (the mission's directory name or id, ASCII case folded as SQL LIKE does). A row with no `mission:` tag keeps the existing tag-or-body-mention binding, and the default view with no mission named is unchanged. The wave-map lookup uses the same exact-tag rule. A tagged row that used to reach another mission's view through a body mention or another tag no longer contributes there (its lanes, built candidate and merged facts); a row tagged with both missions binds to both. This stops another mission's commit showing as a slice's built candidate when two missions share a slice name.
2026-10-14 19:23:14 -07:00
Adam Whitehurst 33dcc0f5a9 feat(daemon): warn at startup when an isolated OPENRIG_HOME still carries the real HOME or CODEX_HOME (#1299)
At startup the daemon logs one advisory to stderr (and so to `daemon.log`) when `OPENRIG_HOME` isn't the account's default `.openrig` but `HOME`, or `CODEX_HOME` (explicit, or derived as `<HOME>/.codex`), resolves outside the isolation root. The line names the variables that leak and their paths and says the daemon is starting anyway. The default layout and a scratch `HOME` carrying its own `.openrig` and `.codex` log nothing. Advisory only: the daemon always starts, and every lookup that can fail is contained.
2026-10-14 19:17:21 -07:00
Adam Whitehurst 96c0632ea3 fix(test): resolve codex and claude to stubs under the daemon test setup (#1298)
The root test setup (`test/hermetic-env.setup.ts`, used by the daemon and TUI suites) and `prepareHermeticEnv` put stub `codex` and `claude` executables first on PATH, so tests resolve those names to stubs instead of a developer's real runtimes. The stubs answer `--version` (Codex 0.139.0, Claude 2.1.0) and `--help`. Under `OPENRIG_E2E_REAL_CODEX=1` the stubs are skipped, so the real-Codex end-to-end tests keep using the real binary. Native tests that install their own runtime and pass an explicit launch PATH are unaffected. Tests only; no shipped code changes.
2026-10-14 18:07:08 -07:00
Adam Whitehurst 0c27e69867 fix(cli): allow rig add and single-node launch two minutes to complete (#1287)
`rig add` and single-node `rig launch` (including `--retry-startup-from`) pass a per-request 120 s timeout to the daemon, the same wait subset launches and `rig up` already use. A slow but successful start now returns its real result instead of "timed out, outcome unknown" after 5 s. A start the daemon fails still reports as soon as it answers, and a hung daemon still ends with the same "outcome unknown" error, after 120 s instead of 5 s, with one write and no retry. `--plan`, `--host`, the subset launch and the client's default for every other request keep their deadlines.
2026-10-14 17:38:44 -07:00
Adam Whitehurst 9122dad969 feat(cli): add --json to rig status (#1291)
`rig status --json` prints one machine-readable object with five keys: `daemon`, `kernel`, `workspaceRoot`, `rigs` and `cmux`, each read from the same source the text view uses, and `null` for a section that wasn't read. A stopped or stale daemon reports `reachable: false` with the guard message and lifecycle; an unverified one reports `reachable: null`; a running but unhealthy one reports `healthy: false` with its reason. A rig-summary failure keeps exit 1 and adds an `error` field alongside the sections that were read. Without `--json`, the text output and exit codes are unchanged.
2026-10-14 17:09:18 -07:00
Mike Schwarz ae660d347b fix(collector): don't rewrite the seat's settings when the status line is already in place (#1286)
The context collector's status-line provisioning skips its write to `.claude/settings.local.json` when the status line already holds the collector's command with `type: "command"`, because that write would reproduce the same parsed settings. The context poll (about every 30 seconds per running Claude seat), startup delivery, claim and self-attach no longer rewrite an unchanged file, and another writer's key order and spacing are kept. A missing, empty, older, stale or differently typed collector line is still installed or refreshed, a user's own status line and an unparseable file are still left untouched, a non-object value is still replaced, and the collector script is still copied on each call. A needed write is still an unlocked read-modify-write. New tests cover the two no-write cases and ten controls, and the restore test now expects no write on an unchanged poll and exactly one write, keeping the selected hooks, when the command is stale.
2026-10-14 16:46:51 -07:00
Mike Schwarz 53ab9e02f7 fix(mode): the preview reads an unusable successful answer as unknown (#1283)
The `rig mode set` preview (without --confirm) reads a successful daemon answer it can't use as unknown. A 200 counts as known only when `writeTarget` is a non-empty string, `bindings` is an array, and each binding has a string id and a mode in the CLI's existing mode list, which equals the daemon's eight supported names. Otherwise the preview says "currently: UNKNOWN (the daemon's answer was malformed)", and the JSON reports current and displaces as unknown, instead of an empty displacement. A named target with no bindings is still a known absence. The proposal display, exit code 2, no write on preview, confirmed writes and every other command are unchanged.
2026-10-14 15:49:13 -07:00
Mike Schwarz e2b72e92e6 fix(daemon): OMP catch-up above one RPC frame, over negotiated protocol v2 (#1279)
An OMP seat's restore catch-up, and the refresh after each turn, no longer fail once the session's history passes 1 MiB. Under OMP's protocol v1 every get_entries reply over 1 MiB came back as "RPC response exceeded the transport limit", and the durable cursor stayed where it was. When OMP's ready frame advertises protocol v2, the runner now sends negotiate_protocol before get_state and the catch-up, and a new decoder (omp-rpc-frame.ts, written from OMP's documented contract, docs/rpc.md at v18.5.0, commit 9348320c) reassembles chunked replies and events up to OMP's 64 MiB ceiling. The declared length is checked against the limit before any bytes are kept; a physical line over 1 MiB, a chunk count over 256, bad or non-canonical base64, bad UTF-8, a non-object result, and an interleaved or interrupted sequence (including a null, array, non-JSON or blank line while a sequence is pending) each drop the frame with an explicit error line and leave the cursor in place, and a later valid reply recovers. A refused negotiation stays on v1 with one notice line. Pi, and an OMP that doesn't advertise v2, are unchanged. A reply above 64 MiB still fails, as OMP's own ceiling, and the post-turn refresh now transfers and reassembles the whole history each turn up to that ceiling. Checked against real OMP 18.5.0 with no model requests and no prompt: 0.6.10 and main fail the catch-up with the transport-limit error, and at this head the catch-up reaches the last entry. Not exercised against real OMP: the refresh after a real turn, and whether real agent events carry entry ids. Refs #1275.
2026-10-14 15:36:52 -07:00
Mike Schwarz d4f24dddbb feat(compaction): managed compaction turns off Claude's idle compaction for the sessions it launches (#1282)
When managed compaction is enabled with a threshold the compaction enforcer accepts, OpenRig now adds `idleCompaction: false` to the one `--settings` JSON of every Claude session it launches (fresh, fork, resume and restore; ordinary, kernel, team-default and full-bypass seats), so Claude Code's own idle compaction doesn't compact those sessions outside OpenRig's prepared sequence. The key is merged into the existing settings value, never a second flag, and a launch that had none gets exactly one. "Active" uses the enforcer's own threshold check, and the policy is read at each launch through the existing settings resolver. With the policy off, or for non-Claude runtimes, the launch command is unchanged. A lower-precedence `idleCompaction: true` is overridden for these launches; managed Claude settings still win. `autoCompactEnabled` and `DISABLE_AUTO_COMPACT` are untouched, and no native fallback is claimed. Claude Code before 2.1.290 ignores the key. A policy change reaches a session at its next launch, in both directions. The session-compaction skill and the as-built note describe this.
2026-10-14 15:33:00 -07:00
Mike Schwarz 4aa410c708 fix(mode): a saved mode and an operating posture are kept side by side at one target (#1274)
Each rig-mode target now keeps one saved mode and one operating posture. A write replaces only its own kind, so a posture no longer replaces a saved mode, or the reverse. Migration 109 changes the unique index from (scope, target) to (scope, target, kind), and every stored row keeps its id and record. `rig mode effective` keeps its primary binding and adds the other kind when it also applies; `rig mode show` lists both. `rig mode unset` where both are kept removes the latest set one and names the one still kept, so the other kind can become effective afterwards. `--category` removes exactly one through a new route; a daemon that predates categories doesn't have that route, so it removes nothing and the CLI exits 1. The preview asks the daemon where the write would land and what it would replace, and says the current state is UNKNOWN when that isn't reported: an older daemon, a refused or failed read, or a reply missing its write target or bindings. Mode names, posture canonicalisation and the legacy read and delete paths are unchanged.
2026-10-14 14:18:19 -07:00
Quentin Machu b1c78c6cae perf(daemon): read queue obligations once per pass (#1263)
The daemon's parked-owner pass, and its open-id read, now list a seat's open queue obligations through a new QueueRepository.listOpenObligations query instead of the full list() projection. It applies the same filter, ordering (ts_created descending) and limit that list() applies for that pass, and returns only the id, state and summary the pass reads, so the pass no longer builds full queue items for every open row. As before, rows created in the same millisecond have no tiebreaker. The Claude self-report status path is unchanged. Part of a follow-up set to #1241 and #1242.
2026-10-14 13:13:06 -07:00
haralez acd1c2c345 fix(cli): allow subset launches two minutes to complete (#1271)
A local subset launch (rig launch <rig> --seats ..., without --plan) now gives the daemon up to 120 seconds to answer, the same deadline rig up uses, instead of the client's 5-second default. A subset launch that took longer than 5 seconds used to end in a timeout error; it now returns the real result. Previews (--plan), single-node launches, remote --host launches and the client default keep their existing deadlines. Past 120 seconds the shared CLI error still reports the outcome as unknown and says to check before retrying; nothing is retried. Tests pin each deadline, one write per launch, and a 6-second response on the non-preview subset path.
2026-10-14 12:32:59 -07:00
alxledesma b2f31b966e feat(daemon): verify Claude Code and Codex sends by their input box (off by default) (#1267)
Adds an opt-in setting, transport.verify_input_box (env OPENRIG_TRANSPORT_VERIFY_INPUT_BOX), off by default, within the scope agreed in Discussion #1249. With it off, nothing changes: no new tmux call, stage or result field. With it on, a --verify send to a Claude Code or Codex seat, queue wakes and the attention probe included, reads verified only when four things hold: the capture before the paste matches an idle layout recorded from Claude Code 2.1.296 or Codex 0.160.0 and names no other client version; one extra read after the existing 200 ms pause shows exactly the sent text in the input box with its word boundaries kept (runs of whitespace compare as one space, and a row break counts as a space only where the box's text must have whitespace there, otherwise the box reads ambiguous); the capture after Enter shows the box empty; and the pane process and the seat's binding are unchanged. Anything else reads rendered-unconfirmed with ok true, and a new additive inputBox field says which case it was. An audited prompt answer reads no box, so its inputBox reads unchecked and the send stays unconfirmed. The feature only reports: nothing is refused, retried, re-sent or paused, the existing guards and main's default matcher are unchanged, and other runtimes keep today's path. Each extra read has a 500 ms deadline budget. On Claude Code a multi-line text collapses to a paste label, so envelopes and queue wakes to Claude stay unconfirmed; such a wake records delivered-ack-pending, and a pending, unclaimed handoff with no pickup evidence can enter the existing escalation path after queue.wake_unconfirmed_window_minutes without being re-sent. The recorded layouts, their versioned fixtures and how to add one are documented in the as-built transport doc and the fixture README.
2026-10-14 12:22:30 -07:00
Mike Schwarz 4a4cbfd2bb docs(watch): a Codex reading pinned by key and email stays usable when another login shares the account (#1268)
keeping-a-watch.md's usage warning now keeps a pinned Codex reading usable when another login shares the account. When a second machine signs into the same Codex account under a different login email, the served answer marks the person's own item's linkage unknown, because another login's item shares its key; the page had treated every unknown linkage as can't-tell, so a usable reading was discarded and a low allowance could go unwarned. For Codex, the one item matching the recorded key and the recorded non-empty email is the person's: its own fresh, selected-window reading whose level is not unknown is usable whether its linkage reads unknown or same, and the operator tells the person the other login's observations are unlinked, from the item's notes. A null key, no recorded email, and no or several matches stay can't-tell, and a changed email is not followed: the person sets the watch again. The freshness and level rules and the identity and configured-seat caveats are unchanged. A new doc-test case runs the page's exact command with the same account under another login, finds the pinned item exactly once with its note, checks it has a usable window, and checks the task body's new line.
2026-10-14 08:44:50 -07:00
Mike Schwarz ee022e829c docs(watch): keeping-a-watch teaches a person's low-allowance warning from the served usage (#1266)
keeping-a-watch.md gains "A usage warning", which teaches the operator to set a person's low-allowance watch from the served usage. The check is rig provider status --all-hosts --json, which serves memory only and starts no read; --refresh stays a deliberate step the person asks for. The page covers choosing the allowance, window and threshold; the served fields (source machine and times, remaining versus used, freshness and level with their reasons, resetsAt, a failed refresh per provider beside older evidence, one allowance across machines never summed, configured seat links versus observed seat facts, and linkage); and the decision on each fire. A usable reading is a fresh observation of the chosen window whose level is not unknown: met is the lowest usable reading below the threshold, reported with its machine, observedAt and resetsAt, and can't-tell keeps the page's once-then-quiet rule with its reason. A Codex allowance is matched by key and login email on every check, and machines that disagree are said plainly. An example task body uses placeholders only. A new CLI test runs the page's exact command against loopback daemons, including a Claude host whose seats disagree, and checks that every field path and name the page uses is served. No product code changes.
2026-10-14 07:55:43 -07:00
Mike Schwarz fc41b27374 test(provider): usage across hosts, tests for the remaining cross-host outcomes (#1265)
Adds direct tests for the cross-host usage outcomes that had none. An agreeing duplicate allowance is one entry in rig provider status --all-hosts and the TUI's all-hosts view, never a sum; Codex accounts with the same email but different account ids stay two allowances, in the grouping and through the served route; the CLI's all-hosts view only GETs and starts no read on any host; the CLI's --refresh and a Claude refresh leg succeed when a read takes longer than 5 s; and a bounds test built from the real constants checks that each provider's worst-case read and cleanup fits its refresh leg, and each leg and view fits the CLI's waits. To let that test import the real values, the CLI's 20 s and 75 s cross-host waits move to module scope, the Codex reader's 2 s grace and the TUI's 20 s view wait become named constants, and the Claude reader's grace is exported; values and call sites are unchanged. The test harness's Claude fake gains an optional delay.
2026-10-14 06:48:25 -07:00
Mike Schwarz d8fb6ea9e2 feat(tui): System → Cost, each seat's reported cost beside its tokens (read-only) (#1261)
Adds System → Cost to the TUI, and the cost command. It reads GET /api/telemetry/usage/cost through the TUI's daemon client and shows each seat's reported cost beside its tokens. Each seat's head line is the same as rig usage cost prints; the details carry kind, source, window, Claude resets and freshness, Pi entry classes (inherited and unknown-origin shown apart, not counted), all four token counts, coverage, and any provider charge in full beside the estimate, never added to it. Positive sub-cent amounts show as <$0.01, Codex shows tokens without dollars, and nothing is summed across seats; the header says it covers this host's daemon only and isn't an invoice. An older daemon (404), a failed re-read after a good one (kept and marked stale), an empty store and a response whose seats aren't cost entries each say so. The page only reads; other pages are unchanged.
2026-10-14 05:02:22 -07:00
Mike Schwarz 6448f6bfcf feat(tui): System → Usage · all hosts, the registered hosts' usage windows as each holds them (read-only) (#1259)
Adds System → Usage · all hosts to the TUI, and the usage-hosts command. It draws the daemon's cross-host usage view (GET /api/provider/usage/hosts) as each registered host serves it: each host's status and usage reason, failed refresh legs beside the kept observations, skipped entries and the registry state, one entry per allowance with its linkage and notes, each host's rows through the existing Usage row lines, and seats per host. Nothing is grouped, summed or re-timed in the TUI. The page reads by GET only, with a 20 s wait, and re-reads the memory-only view every 30 s while open; a 5xx or unreachable daemon keeps the previous view marked retained, and a 404 or 409 replaces it. It never starts a refresh. A seat's "differs from" line is drawn whenever it's served, as the CLI prints it, and the shared CLI and TUI parity facts now cover seat accounts. Single-host System → Usage is unchanged.
2026-10-14 02:59:54 -07:00
Mike Schwarz a5d5fef4ca feat(seat): per-seat reasoning effort: rig seat set-effort, launches read it, rig seat effort reports it four ways (#1209)
Adds a per-seat reasoning effort choice. rig seat set-effort saves a seat's explicit choice (migration 104) and --clear removes it; rig seat effort reports the effort in force and where it came from. A seat's latest explicit choice applies to its launches until it is cleared, and clearing returns to the spec or default. A restore reads the live seat's choice by logical id, so a seat removed and grown back keeps its saved choice over an older snapshot, and the restore says when it used the saved choice instead of the snapshot's. An in-place Codex restart still refuses an effort change unless the change comes from the saved choice; after --clear, such a restart can still refuse until the seat's next ordinary launch.
2026-10-14 02:57:12 -07:00
haralez a1c9c8d1ad fix(daemon): stop incompatible restore runtimes before launch (#1190)
When a seat's current runtime doesn't match the runtime its snapshot was started with, restore now stops that seat before launching anything: "No session was started for this seat. Restore a snapshot whose saved startup runtime matches the seat's current runtime." Missing or empty runtime information alone doesn't trigger the stop, and the earlier resume-token-type refusal is removed. The live runtime is used only for this pre-launch comparison; after launch, restore keeps reading the saved snapshot node as before. rig up --plan resolves a seat's saved node by logical id, so after a seat is removed and grown back the plan reports the same stop as the restore, shows the saved history, and doesn't suggest --fresh where it wouldn't help. For a regrown seat restored from a legacy snapshot with the same runtime and a saved session, the plan now forecasts resuming that session instead of requiring --fresh.
2026-10-14 02:15:04 -07:00
haralez 35e83cebda fix(daemon): re-seat the Claude context collector by rename so a read-only asset keeps working (#1251)
When the packaged Claude context collector or activity relay was read-only, copying the new version over it failed with EACCES, and the seat's context meter read unknown. The daemon now re-seats these assets by copying into an exclusively created sibling staging file and renaming it over the destination, so a read-only asset is replaced and keeps its mode. When the staging file can't be created, for example a writable collector under a directory that isn't writable, it falls back to the in-place copy main already does, so readings and relay updates keep working there as before. That fallback keeps the in-place copy's non-atomic semantics and reports its own error if it fails. A failure after staging exists is not retried in place, and cleanup removes only the staging path this call created. Refs #1250.
2026-10-14 01:20:22 -07:00
Mike Schwarz 68c8363bbb fix(whoami): over SSH --host, the full-peer-list hint names the host and identity (#1248)
With compact output on, rig whoami --json --host <h> trims the peer list and its peersNote names a command for the full list. That command dropped --host, so running it showed the local host's peers. It now keeps --host and the identity, so it reaches the same remote host and identity. The rewrite is bound to the note's own value: the top-level peersNote must appear exactly once in the raw output in its canonical JSON form, only that span is rewritten, and the result must parse back to the original object with only peersNote changed; otherwise the output passes through unchanged. Escaped, nested, duplicated or string-embedded copies are left alone. It composes with the existing forwarding of --full over SSH.
2026-10-14 00:49:02 -07:00
Mike Schwarz 22bd7e2358 fix(daemon): preserve explicit stop intent through rig down (#1254)
rig down now records the existing deliberate-stop intent (markIntentionallyStopped) together with clearing the binding, instead of clearing the intent when it marks a session exited, so a seat stopped on purpose stays recognisably stopped. After the live kills it also records the intent for the latest exited or detached session of a seat when tmux confirms the session is absent and its binding is missing or unchanged; an unavailable probe, a foreign binding or a newly rebound occupant is left as it was, and a fault in that pass doesn't change the command's result, exit code or output. Display consequences, through the existing rollup: a full down reads stopped instead of recoverable; in a partial down the remaining seats read running (the command still exits 2 with the failed kill in errors[] and the failed seat stays bound and unmarked); an already-detached seat confirmed absent reads exited, its dead attach hint is cleared and the rig's live-agent presence becomes false instead of unknown. restoreLifecycleState and restore selection are unchanged; native resume metadata and explicit recovery remain. Refs #1238.
2026-10-14 00:41:31 -07:00
Mike Schwarz 71668c43c2 test(usage): wait for the Pi parent read's outcome in R4-F2, not a fixed tick count (#1255)
Test-only fix for a load-sensitive wait in packages/daemon/test/pi-usage-cost.test.ts ("R4-F2 with the runner's real reader"). The test asserted the cost view six setTimeout(0) ticks after a refresh, while the runner's parent read (real async file I/O) can finish later on a loaded machine, so it could see own: 2 instead of own: 3. It now counts the parent reads it starts, waits with the file's bounded eventually helper until each has answered (the broken parent with null) before rewriting the file, and then waits for the stored outcome. The broken-parent state is therefore read from a finished read, and the third refresh starts a fresh read of the valid file. Every assertion, every broken-parent variant (empty, malformed, torn, a bad id) and the real file I/O are kept; no product code changes.
2026-10-14 00:20:55 -07:00
Mike Schwarz 1dcecdf940 feat(usage): usage windows across registered hosts, read and refreshed on request (off by default) (#1246)
Lets a person ask which usage allowance is running low across their registered machines, in one answer. GET /api/provider/usage/hosts reads each registered http host's existing /api/provider/status over the existing host transport and bearer handling (5 s per host, four at a time, an answer within 15 s with any host not yet heard from listed as such), groups the rows by allowance identity without summing them (same, conflict, unknown or single), and reports every host's status and whether it serves usage windows (served, off, older or unavailable). An explicit refresh asks each machine to read its logins now, one bounded leg per host. Bearers never appear in the answer or the CLI output. Off by default (provider.usage_windows); nothing is stored. Every identity is checked against the keys the CLI reads, so a host serving a malformed identity reads as unavailable while the others are served; a missing reason, detail or note prints plainly. Single-host rig provider output is unchanged. Part of 0.7.0 slice 01; the TUI view follows separately.
2026-10-13 23:56:36 -07:00
Quentin Machu 288e13a3c4 perf(daemon): batch transcript captures (#1242)
Transcript rotation made one tmux capture-pane call per seat on its own timer. It now runs on one shared tick and captures up to 24 seats per tmux call, chained, using the existing capturePanesContent. Each chain carries a per-call random marker that splits the output, so one pane's text can't land in another seat's transcript, and each entry keeps the time its own chunk was read. The tmux argv exec gets a 64 MiB output bound (TMUX_MAX_BUFFER), which only the tmux adapter uses; 24 panes of 1000 lines don't fit exec's 1 MiB default. Recognised failures keep their paths: no server or no reachable socket captures nothing, with no per-pane forks; an oversized output or a session or pane gone since the listing halves the chunk, and a lone failing session is read on its own. Any other chain error, including one where the listing fails too, leaves the chunk to per-pane reads, which is main's result at the cost of the chain and the listing: 26 execs a round for a 24-pane chunk whose chain always fails, where main makes 24. The adaptive idle backoff and live settings are unchanged. Part 2 of 2 for the daemon's tmux polling cost, based on the shell-free tmux exec; refs #161.
2026-10-13 22:44:27 -07:00
Mike Schwarz c4adbffedd daemon: a hung runtime version probe no longer stops startup from listening (#1211)
A daemon whose codex hangs on --version now still starts. On a start with no cached runtime version, startup used to wait for codex --version and then --help with no time limit before opening its HTTP listener, so a hung codex meant /healthz never answered; rig bootstrap was held the same way. Each --version and --help probe now has a 30 s limit (RUNTIME_PROBE_TIMEOUT_MS). Past it, the probe's whole process group gets TERM, then KILL, then a bounded wait for the reap; the runtime is recorded as an error naming the timeout; and --help isn't tried after a --version timeout. Startup then carries on and listens, answering /healthz after about 33 s under a hung codex instead of never. Bootstrap's summary now reports a runtime that wasn't found separately from one that was found but failed its check. Healthy probes behave and print as before.
2026-10-13 22:33:03 -07:00
Rudy Mizrahi Celekli 013a50d5f2 fix(cli): forward whoami full output over SSH (#1231)
rig whoami --host <host> --full, and its alias --verbose, now forward --full to the remote CLI over SSH, so the caller gets the remote's full identity, peers, workspace and context output; before, the flag was accepted locally and dropped from the SSH argument list. A remote older than v0.4.0 has no --full and exits 1 with "unknown option --full" where it previously printed its default output. Nothing else in local or remote whoami output changes. The regression drives the real command with the SSH runner stubbed, with node, session, JSON, bare remote and local controls.
2026-10-13 22:01:08 -07:00
Mike Schwarz 674783300a feat(usage): OpenRouter's actual charge for a Pi request, beside its estimate (off by default) (#1244)
A Pi seat can show OpenRouter's actual charge for its requests beside Pi's model-priced estimate. It's off by default, behind usage.pi_openrouter_charge (env OPENRIG_USAGE_PI_OPENROUTER_CHARGE), works alongside usage.pi_cost_facts, and is read at each Pi launch and resume. Each persisted Pi entry records its request API and response ID; for an openai-completions request the runner looks up that generation at OpenRouter's fixed endpoint, with the key only in the Authorization header, no redirects, a bounded body and a timeout, and checks that the reply names the same generation. The charge sits beside the estimate and is never added to it. Migration 108 stores one outcome per entry, insert-or-ignore, so replay, catch-up and restart never count it twice, and a charged outcome is final. A failed lookup retries within a cap and then reads "charge unavailable", keeping the estimate; a failed post of an outcome retries on its own, and after five unacknowledged posts the runner says storage couldn't be confirmed. A reply field containing the lookup key is never stored or shown. A charge is looked up only when the request's credential is established as the forwarded key: an extension seen at any point, a credential-bearing models.json OpenRouter entry, an unclassifiable credential source, or any unreadable reading keeps every later entry unavailable for that runner process, and entries persisted before the runner's first observation are unavailable. models.json is read as Pi 0.87.1 reads it (line comments and trailing commas). Rows stored before migration 108 gain their correlation fields from a replay that agrees with every stored fact field, and never with a disagreeing value. With the setting never turned on, rig usage cost output is unchanged. The Pi launch notice, which is always active, now reports the environment key for a credential-free provider entry and classifies Pi-style commented models.json files instead of reading them as unknown; a key's presence there is not proof of authentication.
2026-10-13 20:37:55 -07:00
Quentin Machu ce6b4a8537 perf(daemon): run tmux without a shell (#1241)
Every tmux call the daemon made on Linux and macOS started two processes, /bin/sh and then tmux. It now runs tmux directly by argv from a cached path, one process per call; Windows already used the argv path. The tmux arguments don't change, and a test checks every adapter call site's argv against the shell's own parsing of the old command string. When the cached tmux can't be started at all (a spawn error, so nothing ran), the call goes once through the existing /bin/sh path and the cache is cleared, so the next call looks tmux up again: a tmux script without #! runs, and a first PATH entry whose interpreter is missing gives the same result as main on that host's shell. A tmux that ran and failed is never run again. OPENRIG_TMUX_SHELL=1 at daemon start keeps every tmux call on the shell, as before. Part 1 of 2 for the daemon's tmux polling cost; refs #161.
2026-10-13 18:04:36 -07:00
Mike Schwarz db26d3f450 test(daemon): wait on conditions, not clocks, in three timing tests (#1245)
Three daemon tests failed on pull requests that never touched them. Tests only: no product code changes, and every existing assertion stays. In session-transport, the wait-for-idle hook test now fakes Date, setTimeout and clearTimeout and injects a sleep that advances them, like the file's two other 1 ms expiry tests, so a slow first observation no longer misses a 1 ms wall-clock deadline; it also asserts two attempts, 1 ms waited and a single sleep(1). It checks that fresh UserPromptSubmit evidence reads as running and then expires; a slow observation finishing late stays covered by the file's real-timer tests. In transcript-capture-native, the fixed 200 ms setup wait becomes a wait of up to 10 s for health to first read live and capture_fresh, then the same 25 s window runs with the same checks, and the timeout goes from 35 s to 45 s. No threshold is widened: the product's own margin inside that window is about 0.8 s, so a lapse on a loaded host still reports something real. In ps-summary-stall-red, the teardown prints the measured worst /healthz time on every run, pass or fail, including when an earlier step throws; N, the probe pacing, the 250 ms budget and every assertion are unchanged, with no retries.
2026-10-13 16:15:03 -07:00
Mike Schwarz aff8b887d3 feat(usage): Pi cost from persisted session entries, counted once, fork history kept apart (off by default) (#1237)
Pi seats reported no cost. With usage.pi_cost_facts on (off by default, read at each launch), the Pi runner now records the model-priced cost estimate from Pi's persisted session entries, using the get_entries requests it already makes, and rig usage cost shows it. Each entry is counted once across replay, catch-up, restart and repeated refreshes: migration 107 stores one row per Pi session and entry id, insert-or-ignore. Live message updates never add to the durable total. All five usage-bearing kinds Pi 0.87.1 records are counted, including usage from errored and aborted turns, and an entry with no reported cost is named rather than counted as zero. Entries a fork copied from its parent session are kept apart as inherited: an entry stamped before the fork header is inherited, and one stamped in the header's exact millisecond is decided by the parent session's entry ids. The parent is read only on such a tie, in the background, opened non-blocking, as a regular file with a size cap enforced on the same handle. Its ids are used only when the read is proven complete: it reaches the end of the file at exactly the size the file had when opened, that size is unchanged afterwards, and every line is a whole, valid entry. A parent that is growing, shrinking or mid-write leaves the tie unknown and out of the total, and a later refresh reads again; when the read completes, the latest batch is reported again so a tie that arrived meanwhile settles. With no readable header, origin is unknown and kept apart. With the switch off, nothing is posted and rig usage cost is byte-identical. Pi versions other than 0.87.1 are unverified.
2026-10-13 13:54:16 -07:00
Mike Schwarz 1f00596324 feat(tui): System → Usage shows this daemon's usage windows and seat accounts (read-only) (#1243)
The usage windows and seat accounts that rig provider status prints weren't visible in the TUI. System now has a Usage page, beside Health, Configuration and Connections, and a usage command. It reads GET /api/provider/status, the same read model the CLI prints, and reads the config browser only when the model carries no usage block, to tell a switched-off daemon from one that doesn't serve usage. It never calls the refresh or switch routes and never reads the logins itself; the page header says how to read them now with rig provider status --refresh. Each usage row shows identity and bucket, the served seats value, and per window the remaining percentage, level and freshness on separate lines with their reasons, reset and observation times as served, a failed refresh beside the kept reading, and unresolved or earlier rows labelled. An absent value shows as ?, never zero, and nothing is deduplicated, matched or re-timed in the client. Seat accounts show as configured (registry or default login) or unknown, with whether a profile is saved shown as unknown when it can't be told, and allowances never linked to seats. A switched-off or older daemon, a 404 and a 503 each say so, a previous answer is kept and marked after a failed re-read, and other sections keep working. The view covers this host's daemon only; it is not fleet-wide and doesn't prove which login a running session uses.
2026-10-13 13:50:31 -07:00
Mike Schwarz 172be2a1d0 fix(slack): cut long tag values in a gate's context line so the gate still posts (#1240)
The context line that names a parked gate's workflow, instance and step had no length bound, so a very long hand-written tag could make Slack reject the whole post. Each tag value is now redacted, then cut to 80 characters, then escaped. A longer value keeps its first 32 and last 33 characters around an ellipsis and ends with " #" and the first 12 hex characters of the SHA-256 of the whole redacted value, so labels that differ at the start or end stay visibly distinct, and a collision between labels that differ only in the middle is unlikely, not impossible. A redaction marker is kept whole or left out, never split, and no mention, link or escape syntax is split by the cut. Near the post's size limit the line falls back to the instance alone, then is left out, where the post was refused before. Values of 80 or fewer and generated instance ids are shown whole, as before.
2026-10-13 13:48:52 -07:00
Mike Schwarz 9c1d444f37 feat(provider): show each seat's configured account while usage windows are on (#1235)
The provider view could say which account an allowance belonged to, but not which account each seat was set up to use, and it called every Claude seat and every Codex seat without a registry row "a seat with no bound account". While provider.usage_windows is on, the read model now carries seatAccounts, one row per live seat, and rig provider status prints a SEATS section. Each row keeps three facts apart. Configured: a registry profile name and its recorded time (whether that profile is saved on this host is true, false, or unknown when the folder can't be read), the daemon's default login home (an empty CLAUDE_CONFIG_DIR resolves per seat, as at launch), or unknown with the exact gap (an unreadable or malformed registry is unknown, not a default login). Observed: for Claude, the seat's own latest status-line samples and when it last reported; a difference from another seat is shown only for current, fresh readings. Allowance: never linked to a seat, with the reason. Stale registry rows, runtime and rig mismatches and shared session names are shown as notes. Only profile names and error codes are read; profile contents never are. With the switch off, output is byte-identical, and existing bindings and usage rows are unchanged.
2026-10-13 11:54:34 -07:00
Dery Ferdika 63fb6d7184 fix(daemon): refuse a scope-audit mission that escapes the slices root (#1221)
GET /api/scope/audit?mission=<name> joined the name onto the slices root and audited whatever existed there, so a name like ../outside read and reported on a folder outside the root. The route keeps that same joined target and now answers the existing 404 mission_not_found when the target, lexically normalized, is outside the root, using the existing isPathInsideRoot comparison (path.relative, separator-safe, so a filesystem-root slices root keeps its children). Names that stay inside are unchanged, including a leading-slash name, which still means a folder under the root, and an inner ".." that lands back inside. This is lexical containment, not a symlink rule, and its target rule differs from the scope-approve write route's. The CLI's own local audit is untouched. Tests cover the escape and the preserved names.
2026-10-13 10:52:46 -07:00
akushonkamen 91398757a5 fix(daemon): render a human-seat workflow gate as the question, not the agent packet (#1143)
A workflow gate parked on a human seat posted the seat's whole agent packet to Slack (the workflow title, instance and step lines, the objective and the continuation command), while the person approving the gate needs the headline and the question. A blocked gate row with a summary now renders as the question: the summary as the headline, the ask, the evidence through the existing link or media path, and one context line naming the workflow, instance and step from the row's own tags, so two open instances of one gate are told apart. Without a summary the packet stays as the fallback. The row and its body are unchanged for the seat that resumes; tag text passes through the same escaping as the rest of the message; other rows render as before. Reported by @tianqizhao0704 in #1013.
2026-10-13 10:39:40 -07:00
Rudy Mizrahi Celekli 72c41a2837 fix(tooling): decode Git quoted paths in portability reports (#1230)
The portability report takes file names from git diff headers. With Git's default core.quotePath, a non-ASCII name came out C-quoted ("caf\303\251.md"), and a name with spaces kept Git's trailing tab, so findings pointed at paths that don't exist. The report's diff now runs with -c core.quotePath=false and strips the trailing tab, so UTF-8 names and names with spaces are reported as their real paths. Names Git still quotes (control characters, quotes, backslashes) stay quoted, now without the "+++ " prefix. A native-Git test sets the repository's quotePath both ways and checks the reported locations.
2026-10-13 10:08:56 -07:00
Rudy Mizrahi Celekli 5b411a6e8e fix(context): allow literal dots in file path segments (#1234)
The CLI install validator, the daemon manifest parser and the library's file resolver refused any context pack path containing `..`, so ordinary names such as `notes..md`, `..notes.md` or `versions..docs/v1..v2.md` failed with "must be a relative path inside the pack (no '..' segments ...)". They now refuse a path segment (split on `/` and `\`) that is exactly `..`, which is the rule their error text states and the one the HTTP route, the profile source resolver and the git source already apply. Absolute and leading-slash paths, lexical containment, bundle realpath containment and install's refusal of symlinks are unchanged, and parent, nested, mixed-separator and URL-encoded traversal stay refused. Tests cover the new names through install, parse, scan and resolve, and traversal at all three checks; the package-time generator's test now uses a real `../escape.md` case. Not covered: `rig context get pack/<file>` still refuses a file name that starts with `..` (its pack-reference parsing is unchanged), and Windows was not run natively.
2026-10-13 09:16:22 -07:00
Mike Schwarz ea5dd85b8d feat(usage): report Claude's cost estimate and Codex's no-cost note beside tokens (rig usage cost) (#1233)
The Claude statusline input already carries `cost.total_cost_usd`; the sidecar now keeps it, and the existing context sample path (sidecar, context store, the 30 s monitor tick, slice 01's `usage_samples` series) carries it with the native session id. A new `rig usage cost` view (and its telemetry route) reports per seat: for Claude, a cumulative client-side estimate bound to that native session since its last reset, labelled with its source, window and coverage ("not an invoice"), with resets counted and each restarting the window, never summed, and older values kept in `rig usage series`; for Codex, tokens with the note that the inspected method (token_count events) reports no cost, never a dollar conversion. No cost, a non-number, a stale estimate, a series without the new columns, a sample with no session, or an unknown source each reads as not reported, stale or unknown, never $0; a real estimate under half a cent prints "<$0.01". Migration 105 adds two nullable columns (`native_session_id`, `client_cost_estimate_usd`) to `usage_samples`; existing rows are untouched, and migrations are recorded by name, so later-numbered ones still apply. Existing fields and text outputs are unchanged; `rig usage series` JSON gains those two additive keys (null on older rows), and the `rig usage` help lists the new `cost` command. No totals across seats, budget steering or account change. Refs slice 02 (K5, K6).
2026-10-13 08:41:36 -07:00
Rem Kim f07ddfe381 fix(cli): keep the Slack wait in queue create --verify for aregistered person with a pane (#1085)
A registered person can also be a seat with its own pane. The destination resolver classes that address `pane-bound`, so `rig queue create --verify` reported only the terminal wake, even though the gateway may also post the row to that person in Slack. `GET /api/queue/:qitemId` now also returns `ownerNotificationLevel`, the level on the row's latest owner-notification transition (the one the Slack selector keys on), or null. When the terminal side applies and that level is set, or a gateway receipt already exists, `--verify` adds a `gateway` result: `posted`, a failure with its detail, or `still-pending` at the bound. The terminal side (`outcome`, `wakeResult`, `claim`) is reported as before, `humanReadership` stays unknown, and the wait keeps its 30 s default bound. "This is not a failed handoff" is no longer shown when Slack reports a failed delivery. A seat with no owner-notification level settles at once with no `gateway` field; gateway-routable destinations, registered aliases and `@external` keep the existing path; the create request, `--id` and `--no-nudge` are unchanged. With `output.compact` on, the short receipt keeps the whole `delivery` result, Slack side included. Refs #1029.
2026-10-13 08:13:31 -07:00
Rudy Mizrahi Celekli bf5d2b5f72 fix(gate): close probe connections before releasing the lane (#1229)
The gate-lane lock holds its lane by binding a local TCP port. Its server had no connection handler, so an idle local connection to that port (a port probe, `nc`, a monitor) kept `server.close()` waiting: the gate couldn't finish releasing its lane, and couldn't exit, until that connection dropped. The server now destroys each accepted socket at once. The bind is still the lock, so a live owner is never released early and a waiter still acquires the lane after release, now promptly. A test holds the lane, opens and keeps a client connection, and checks that release completes and the lane can be acquired again.
2026-10-13 08:08:14 -07:00
Rudy Mizrahi Celekli 6d5f6c54ab fix(cli): report byte counts from Apple openrsync (#1232)
macOS ships Apple's openrsync as `/usr/bin/rsync`, and its `--stats` output reads `Total transferred file size: 20 B`. The parser accepted only GNU rsync's `bytes`, so on macOS `bytesTransferred` stayed undefined: `rig file copy --json` printed `null` and the human summary left the count out. The parser now accepts `bytes` or `B` followed by a word boundary. GNU output is unchanged, units it doesn't understand (`KB`, `MB`, `KiB`) stay undefined rather than becoming a wrong number, and the rsync command and its arguments are unchanged. The count is shown only; nothing decides on it. A unit test covers openrsync's form and the unsupported units, and a native test copies a real file with whichever rsync the runner has and checks the byte count.
2026-10-13 07:52:15 -07:00
Mike Schwarz 904fa99bc5 whoami: a bounded, edge-first peer list in compact --json (output.compact) (#1225)
With `output.compact` on, `rig whoami --json` lists at most `output.whoami_peers` peers (a new setting, default 8, env `OPENRIG_OUTPUT_WHOAMI_PEERS`), so the identity call every seat makes at boot stays small as a rig grows. Selection is edge-first: peers with an edge to or from the seat, then peers in the seat's pod, then the rest, each in the daemon's roster order; `edges` stays complete. When the bound cuts the list, `peersNote` says how many are shown out of how many, the order, the bound and the exact command that lists them all (with the same `--node-id` or `--session`), and an additive `peersOmitted` gives the count. A rig within the bound passes through unchanged plus `peersOmitted: 0`. Error answers print exactly as before. The new `--all-peers` prints today's compact output byte for byte and is forwarded on the SSH `--host` path; the remote's note names its own command. With the switch off (the default), every form is byte-identical to before, and `--full` and plain text are unchanged. The setting is registered like `output.compact` (CLI store, daemon twin, help, TUI label), and the `output.compact` help line now names queue writes, `queue show`, `queue transitions` and whoami peers. The startup guidance, the identity hint, two openrig-core skills, the capability map and three shipped team cultures add one conditional sentence naming `--all-peers`, true with the switch on or off. The daemon's `/api/whoami` is unchanged. Refs slice 15 P5.
2026-10-13 07:48:06 -07:00
Rudy Mizrahi Celekli 8add46c40c fix(slack): preserve interaction reply provenance (#1228)
When a person answers an ask with a Slack button, or reacts to an ask that's already resolved, the queue row those paths create already identifies the ask (it records the answer against it and names it in the row body). The row now also carries that identity as its `inReplyTo`, so a seat's `--reply-to` follow-up goes through the existing reply-to choice and posts in the ask's thread instead of at channel top level, the way follow-ups to typed thread replies already do. A reaction to a still-pending human gate still neither answers nor closes it, and its follow-up stays top-level, now recorded as `reference-has-live-gate`. Sender registration, the per-person answer check, unmapped, closed and superseded roots, and every refusal are unchanged. The follow-ups are ordinary thread replies: no `reply_broadcast` and no new mention, so they no longer show at channel top level. Tests drive the real inbound socket handler, queue and outbound delivery with a fixture Slack transport: a button answer and a resolved-ask reaction thread their follow-ups, and a live-gate reaction leaves the gate pending with a top-level follow-up.
2026-10-13 07:34:55 -07:00
Luis Araya eb6bc2574d docs(slack): clarify manifest YAML pasting and creation steps (#158) (#1207)
When Slack's create-from-manifest dialog opens from `rig slack manifest --url` without the manifest, the person can paste the plain `rig slack manifest` output into Slack's YAML tab instead. `rig slack manifest --help` now says so, and the Slack setup guide adds that fallback to step 1. Step 2 now says that if Create stays disabled, go Back and check that a development workspace is selected and the manifest step shows no error, which matches Slack's documented flow (workspace picked before Next) without claiming a cause. Help text and docs only; command output is unchanged. A test checks the new help line. Refs #158.
2026-10-13 07:09:15 -07:00
JUSHUANGHUI LI 3200322ea9 fix(daemon): preserve complete lines in transcript tails (#1227)
`rig transcript <seat> --tail N` reads the transcript backwards in 16 KiB chunks and stopped once it had counted N newlines. When the file ends with a newline, that final newline counted toward N, so a chunk that began mid-line could stop one line early and return the first line cut. The reader now also needs the newline that starts the first requested line when the file ends with one, unless it reaches the start of the file. Files without a trailing newline, empty files, files shorter than N, N of 0 and CRLF endings read as before; when the chunk already starts at a line start, it may read one extra chunk and returns the same lines. The tail route (`rig transcript --tail`, the cross-host route and the UI's tail view) is the only consumer. A regression writes a 20 KB line followed by seven prompts and checks that `--tail 1` returns the whole line, with and without a trailing newline.
2026-10-13 07:06:59 -07:00
Mike Schwarz 59fbd38677 fix(cli): a capture cut by --lines says activity unknown, not idle (#1226)
`rig capture --lines N` prints the last N lines of a pane, so a busy seat's activity indicator, drawn above the input box, can fall among the lines left out and the cut pane looks like an idle prompt. When `--lines N` left earlier lines out, the capture now says activity is unknown and where it is known: `--json` adds `activity: "unknown"` and `activityNote` ("lines cut; busy or idle not shown here; see rig ps --nodes or --history-plus-pane"), and the stderr note adds `; activity unknown: rig ps --nodes`. The note stays apart from the captured content: stderr for plain output, separate fields in JSON. Nothing changes when nothing was cut, for the default capture, or with `--history-plus-pane`, and capture never reported activity, so no known fact is replaced. CLI-only: the daemon capture route, the shared tmux adapter and their consumers (delivery checks, activity classification, resume) are untouched; local and HTTP cross-host captures share the cut, so both carry the note. Tests cover a busy Claude pane (the default and `--history-plus-pane` keep "esc to interrupt", a `--lines 3` cut reports unknown), the nothing-cut, default and `--rig` cases without an `activity` field, and the updated notes.
2026-10-13 06:57:23 -07:00
Mike Schwarz 5a4e750880 feat(queue): compact queue show and transitions behind output.compact (off by default) (#1224)
Behind the existing `output.compact` setting (off by default), `rig queue show` and `rig queue transitions` print a shorter default. `show` keeps the status fields, `pickup`, `waiting`, `blockedOn`, `closureReason`, the body preview, its marker and `readView` at today's paths, even when null; any other empty field is left out and counted as one `readView.omittedFields` entry, with a notice naming `rig queue show <id> --full --json`. `transitions` keeps the latest transitions, five in all and oldest first, always including the transition that set the current state or closure; the count of earlier transitions and the `--full` command go to stderr in plain and `--json` output, so the array stays clean through `jq` and the notice stays visible. A new `transitions --full` prints the whole log. With the switch off, with `--full`, and on error responses, both commands print exactly what they printed before, and exit codes are unchanged. No daemon route, response shape or setting changes. Tests cover both commands with the switch on and off, the kept fields, the disposition older than the latest five, the stderr notice, and the full reads.
2026-10-13 05:57:18 -07:00
Mike Schwarz 7510731d2a queue: a retained wake never consumes a one-shot park timer, original or shared (#1222)
For one-shot park timers, a `retained` attempt (the typing guard held the wake back) is no longer recorded as the timer's one fire. `findBlockedQitemsByWatchdog` keeps the binding after a retained fire, so the next attempt is recorded by `recordWatchdogWakeAttempt`; for the timer's own task the first non-retained attempt (ok or failed) retires the job (`park_timer_fired_once`), and for an attached task it consumes the attachment. `findLiveQitemsByAttachedWatchdog` no longer consumes an attachment on a retained fire, while a failed fire still does. `getStatus` keeps a retained one-shot `live` and not `unconsumed`, with `phase: fired` and `deliveryStatus: retained` in its history. There is no retry limit or deadline: retained attempts stay eligible at the configured interval. After a non-retained attempt on a generated job whose original park has ended, `recordWatchdogWakeAttempt` retires the job at once when the pre-delivery guard's reason applies (`park_timer_target_terminal`), instead of at its next check, so a later `--wake-watchdog` attach to it is refused (`wake_watchdog_not_live`) where it was accepted in that window before. Readers of the status after a retained attempt now see a live timer: the wake ladder defers to it, `rig queue parked` no longer flags the row, and leaving the set-aside state or a new park retires the old timer at once. Repeating queue-wait timers, standalone operator watchdogs, current-park selection, supersession and the ending of the original park are unchanged, and nothing bypasses permissions, the typing guard or the outbox. `keeping-a-watch.md` describes the retry and states that this is not a delivery guarantee. Tests cover the timer's own task and a shared timer through retained, ok and failed attempts, status, supersession, park endings, a late attach after consumption, and controls for repeating queue-wait timers and a standalone watchdog.
2026-10-13 04:55:18 -07:00
XTLine 740faeb06a fix(cli): resolve bootstrap spec paths in caller directory (#1213)
`rig bootstrap` (plan and apply) and `rig requirements` sent a relative spec path to the daemon as typed, so the daemon resolved it in its own working directory rather than the caller's. Both commands now ask the daemon status whether the target is the daemon this home started locally (a recorded pid from this home's `daemon.json`); only then is a path-like spec resolved against the caller's directory before it is sent. For every other target, an explicit `OPENRIG_URL` or `RIGGED_URL` (loopback and tunnels included), a configured or default host, or a local daemon without this home's record, the spec string is sent unchanged, so a remote daemon keeps resolving it in its own directory and a POSIX absolute path from a Windows caller isn't rewritten. Catalog lookups, the unlisted fallback and its ambiguity refusal, and `.rigbundle` handling are unchanged. Tests cover a recorded local daemon with relative and absolute paths, both URL variables with relative and nested paths, a Windows-style caller, stateless targets, recorded state over a configured host, stale state, catalog and fallback cases with an explicit URL, and the bundle controls.
2026-10-13 04:47:13 -07:00
Mike Schwarz ff70847174 fix(handover): a Codex fork whose new id isn't captured yet commits with the id pending (#1216)
`rig seat handover <codex seat> --source fork:<seat>` failed at start_agent with "codex fork: could not capture new post-fork thread id" whenever the adapter's immediate thread-id capture missed, after the retiree had already been stopped and the fork was running in its pane. Now, only when the caller is a seat handover (`ForkSource.pendingIdAllowed`), a missed capture returns ok without a resume token: the ready successor commits with no token, the parent's and the retiree's tokens are never copied, and `sourceOutcome` reports `forkId: "pending"` with the limit (until the fork's own id is recorded, exact resumption isn't established, a restore can't resume that conversation, and what restore does follows the seat's restore policy; `rig ps --nodes --json` shows whether an id has been recorded). A launch-time answer equal to the fork source's id or the retiring occupant's recorded id counts as not captured, checked separately. The late capture (`ResumeMetadataRefresher`, fill-null) never takes an id another session row holds for a forked occupant (`SessionRegistry.isForkClaimingHeldToken`). A spec member's `session_source: fork` and an agent-image fork keep the error and rollback on a missed capture, and launches that capture their own distinct id are unchanged; readiness, error and auth checks and the capture window are unchanged. An older CLI prints the handover without the pending fields; `--json` keeps them. Hermetic tests cover the handover with and without capture, parent and retiree answers including a cross-seat fork, the late capture, and the member and agent-image paths; no real Codex was run.
2026-10-13 04:11:13 -07:00
Mike Schwarz ca2cefafaa fix(daemon): recognise Codex composer in send verification (#1220)
Send verification now takes a prompt class: `countEnvelopeOccurrences`, `verificationTranscript` and the input-line finder receive the shared composer class (`❯›»`) when the target runtime is `codex`, and the earlier `❯›` for every other runtime, including an unknown or null one. On a Codex 0.153 pane whose prompt is `»`, text still in the composer no longer counts as delivered, and a submitted envelope, an envelope after a reply and an envelope followed by a flat transcript boundary are confirmed. Verification on every other runtime is unchanged, as are envelope equality, indentation, terminal verification and the Claude-only styled-frame, question and composer helpers. Known limit on Codex panes: a `»`-led line below the live input is read as a boundary, as `›` already is, so constructed draft and quotation shapes (including an assistant quotation of a complete envelope) can read delivered, and a flat submitted message containing a `»`-led line can read unconfirmed; how often native renders show these is not measured. Delivered confirms visible transcript growth, not consumption; unconfirmed means inspect the pane rather than resend. Tests cover the Codex `»` matrix, five Claude draft and quotation regressions, three Claude flat-message controls and a null-runtime control, through public `SessionTransport.send` with real SQLite repositories and scripted captures.
2026-10-13 04:00:51 -07:00
Mike Schwarz ff5d0cb259 fix(restore): keep a Claude pane that exits to its shell; roll back only a missing conversation (#1218)
A failed harness launch can now carry `missingConversation: true`, set only when the runtime itself reports that the requested conversation doesn't exist: Claude's "no conversation found" in the resume wait and on the final read after it (checked before the shell branch), Codex's "no saved session found", and Pi's missing session file. The startup orchestrator passes the mark through `fail()`, and the pod-aware resume branch of the restore orchestrator rolls the seat back to zero sessions and reports the original session unresumable only when `recovery` is `retry_fresh` and the mark is set. Before, `retry_fresh` alone triggered the rollback, so a Claude that went back to its shell for any other reason was killed, lost its pane and the error output on it, and was told its conversation was unresumable. That case now keeps the result it had before the rollback was added: failed, with the pane and its binding kept. `retry_fresh` is unchanged for its other readers. New restore tests assert the four outcomes (generic exit, missing conversation, attention, success), including whether the session is killed, the session state and the binding, and two adapter tests cover a report first seen on the final read and a generic shell exit. Effects on the terminal are mocked; no native runtime or physical scrollback was exercised.
2026-10-13 03:15:05 -07:00
Mike Schwarz c1143b55b4 gateway: with nobody registered, say so instead of reporting a missing registry projection (#1219)
When the human registry's projection file is missing and its fragments hold nobody, `loadHumanRegistry` still fails, now with "no human configured yet — register one: rig gateway human add …", the wording `rig gateway human list` already prints for an empty registry, and an internal `noHumans` flag. For that case only, the queue's refusal says the person can't be admitted because no human is registered yet, and its hint says to register them with `rig gateway human add` rather than repair a projection or downgrade the destination to an agent seat. The refusal code `human_registry_unavailable`, the 400 status and the reply's keys are unchanged; `registryProjectionError`, which nothing reads, is no longer set in the empty case. A registry with fragments whose projection is missing, drifted or malformed keeps its current message and hint. The gateway routes' 503 message, the Slack inbound refusal log and the health context show the new wording for the empty case, and every caller's decision is unchanged.
2026-10-13 03:13:09 -07:00
Mike Schwarz 005b0e051d docs: point the kernel operator at keeping-a-watch when a person asks to watch something or be reminded (#1217)
The kernel operator's role guidance gains one trigger line: when a person asks it, in any words, to watch something or remind them, it reads `$OPENRIG_HOME/reference/keeping-a-watch.md` first and follows it. The page is staged into every installed home at daemon start. The page itself now says that a handoff to another session closes the task and retires its timer, so the new owner sets the watch aside again; that the operator's own `--wake-after` timers list as `periodic-reminder` in `rig watchdog list` but are one-shot and retire after a fire; and the two exceptions: a held-back delivery leaves the timer live, and a timer another task shares through `--wake-watchdog` stays live for that task when this task is handed off or stopped, and still retires after its one fire. Every step on the page was exercised on an isolated private daemon from a packaged build; a native run with a real operator is not yet done.
2026-10-13 02:38:36 -07:00
hari 40e13fad53 fix(transport): share one composer prompt matcher set (incl. Codex ») (#635)
The prompt glyphs that delivery recognises (Claude Code's `❯`, Codex's `›` and `»`) now come from one shared, runtime-scoped set in `composer-prompts.ts`, exported as `@openrig/daemon/composer-prompts`. The delivery checks in `session-transport.ts`, the startup submission evidence and the CLI's `send` use it. `promptAnswerStaged`, which decides whether to press Enter after typing an answer to a prompt, now finds the runtime's own input line with that set, so an explicit answer at a Codex `»` prompt gets its Enter. It keeps full equality against the answer, the input's closing boundary (a blank line for Codex, a rule line for Claude Code), the refusal of a numbered choice written `1.` or `1)`, and the refusal for an unknown runtime. A line starting with another runtime's glyph below the input's closing boundary no longer blocks an Enter for an exactly matching answer.
2026-10-13 02:22:55 -07:00
Mike Schwarz 0799613f66 Read Claude's usage windows in rig provider status (off by default) (#1197)
With the `provider.usage_windows` switch on (off by default), the USAGE section of `rig provider status` shows the Claude login's usage windows beside Codex's. Each window is the freshest status-line sample across Claude seats, at the sample's own time and naming its seat; an idle seat ages to stale, and seats whose fresh samples disagree on a reset make the level unknown, with each seat's own used percentage, reset and observation time shown. Identity comes from `claude auth status --json`, run only on an explicit refresh, by absolute path, in its own process group with stdin closed, bounded at 10 s and reaped; it is keyed by organisation and email and held in memory only. Facts are taken only from an exit-0 answer; Claude's documented logged-out answer (exit 1 with `loggedIn: false`) is `not_logged_in`, and any other nonzero exit is `auth_status_failed`. Rows are labelled as not proven to be the same login. A later read marks earlier rows stale for both providers. With the switch off, output equals main's.
2026-10-13 01:57:08 -07:00
Mike Schwarz b100b4ef7e fix(seat): restart in place accepts a Codex that OpenRig launched through its staged script (#1212)
OpenRig launches Codex by typing `/bin/sh <staged script>` into the seat's shell, so the pane runs shell, then sh, then the node launcher, then codex. The in-place restart accepted only Codex as the pane's root, or Codex whose parent is the pane's root shell, so it refused every OpenRig-launched Codex seat with `pane_shape_unknown` and stopped nothing. The `shell_backed` shape now also accepts one staged link between them: a process with exactly two arguments, argv[0] `/bin/sh` or `sh`, and an absolute path whose basename matches the tmux adapter's staged-script name. On macOS, where `/bin/sh` is a shim, the process name may be sh, bash, dash or zsh. The generator and the matcher share one prefix and suffix. It's a name check, not proof that OpenRig created the script. Every other shape still refuses, and the bound-pane, resume-identity, settings-drift and typing gates are unchanged.
2026-10-13 00:54:28 -07:00
XTLine 40a216182c fix(daemon): skip empty Pi and OMP error diagnostics (#1208)
A failed Pi or OMP turn picked its diagnostic with `??`: the first of `errorMessage`, `error` and `finalError` that wasn't null or undefined. It then cleaned that one field and printed "request failed" when the result was empty or not a string. An empty, whitespace-only, control-only or non-string earlier field therefore hid a useful later one. `errorNotice` now cleans each candidate in main's order and shows the first non-empty result. Where main showed text, the same field and text are shown. Field order, the 400-character limit, the credential guidance, success detection and duplicate-notice handling are unchanged.
2026-10-13 00:18:20 -07:00
XTLine ed5f56a913 fix(daemon): target current session for resume token writes (#1204)
After the wall clock moved backwards within a running daemon, `rig seat set-resume-token` could write to a superseded session. The canonical-name context lookup ordered by `created_at`, while node inventory selects the newest session ID. It returned success, left the current session's token unchanged, and attributed the audit event to the old row. The lookup now orders by session ID, which the registry's module-level monotonic factory issues for both registration paths, so the write target and the audit agree with inventory. With a forward clock the selected row is unchanged for both callers (the resume-token write and the generation-record read). A rollback that spans a daemon restart can still pick the older row, as main and inventory do.
2026-10-13 00:07:10 -07:00
XTLine 8d0ce8e7ea fix(daemon): clarify historical seat-clean recovery (#1206)
When `rig seat clean` found a live session that wasn't the seat's latest managed session, it advised "Stop a live seat first with: rig seat stop". `rig seat stop` targets the latest session, so following that advice could stop a newer occupant and leave the actual blocker alive. For an adopted session, stop refuses. The refusal now chooses its guidance by comparing the live session with the seat's latest row. A current managed session keeps main's exact advice. Any other session is named, shell-quoted for `rig capture --`, with advice to end it only if it's no longer needed and to retry. The refusal code, message, early return and every cleanup, stop, launch and liveness decision are unchanged.
2026-10-12 23:51:13 -07:00
XTLine fc426d212c fix(tui): align terminal previews with window width (#1205)
The TUI's Open terminals previewed the view without a width, while the window opener composes the plan with the measured width. On a terminal at least 120 columns wide, the unchanged `saved:kernel` view therefore got a different plan and was refused as changed. `previewTerminal` now appends `viewportColumns` when stdout is a TTY and the width is a positive safe integer. Unknown or invalid widths send main's request. Below 120 columns the daemon composes the same narrow layout, so the plan hash is unchanged. Provider selection, the plan hash and the changed-plan refusal are untouched, and a genuine topology or liveness change is still refused.
2026-10-12 23:50:18 -07:00
Nash Aschenbath cb79b8c980 fix: distinguish intentional seat stops in rig health (#1192)
Stopping an on-demand seat with `rig seat stop` made an otherwise healthy running rig show degraded in `rig ps` and the TUI. A standalone stop whose kill tmux confirms now records a durable stop intent on the current session, written in the existing stop and audit transaction; the health rollup treats that seat as intentionally stopped, so live siblings keep the rig running while the stopped seat and the process counts stay visible. Later status writes clear the intent, a replacement binding disqualifies it, a crash still degrades the rig, and legacy exits default to unintended.

Restore selection keeps its existing meaning: the rig summary also exposes the full per-seat lifecycle as restoreLifecycleState, and `rig start` uses it for both the candidate filter and the later already-running check, so `rig start --last` and `--rigs <rig>` still list a partly running rig and report rig_not_stopped. The internal stop during `rig seat launch --fresh --stop` records no intent, so a refused replacement leaves the rig degraded, as before.

Refs #401.
2026-10-12 20:55:28 -07:00
Coder8124 d09d54b5e2 fix(cli): refuse an unbindable rig daemon start --port with a clear error (#1201)
`rig daemon start --port abc` or `--port 99999` reached the preflight port check and failed with Node's raw error ("Port should be >= 0 and < 65536 ... NaN"), and a negative port was forwarded to a spawned daemon that then failed. The CLI now checks the parsed port before preflight or startup and, for a value outside [0, 65535] or not a number, prints "Invalid --port: must be an integer in [0, 65535], got ..." and exits 1. The parse itself is unchanged (`parseInt`, base 10, as the daemon.port config key), so every value that starts a daemon today, including 0 and 8080x, still does.
2026-10-12 20:52:30 -07:00
Coder8124 857065cd66 fix(daemon): show a Codex seat's captured thread id in whoami (#911)
The whoami runtime context hard-coded threadId to null for Codex, so a correctly bound Codex seat looked unbound in `rig whoami --full --json`. It now reads the latest session row for the node and returns its resume token as the thread id only when the token is a Codex id whose last probe found it resumable; any other state returns null, so an attempted resume, a failed probe or a successor without a captured token never shows a wrong or borrowed id. The Claude read is unchanged and now shares the same latest-row helper.
2026-10-12 20:48:24 -07:00
Mike Schwarz 39565e7815 feat(seat): restart a Codex seat in place on its home's current account (rig seat restart --keep-conversation) (#1196)
Adds `rig seat restart <seat> --keep-conversation` for Codex seats: an in-place restart that keeps the conversation and the pane, so the seat starts again on whatever account its Codex home now holds, without a fresh launch or a fork.

Before stopping the seat it proves which conversation is running, and `--plan` shows the result without side effects. It shows whether the seat is working, waiting for input or unknown, and leaves the timing to the operator. Pending model or effort changes can't ride along with the restart. A shell-backed seat gets back exactly the command it was running; a direct-native pane is held (remain-on-exit set and read back) before any signal, and a failed hold signals nothing. After a failed stop or respawn, the result reports the pane and process state actually observed. Peers sharing the Codex home are reported and never touched. Every restart is recorded, and a started record older than the daemon's own start is reported as stale rather than blocking.

`--verify` reports moved only when an Account line printed after the restart matches the expected account and a tool turn has completed after it; otherwise the account stays unverified. Account lines are compared by per-line counts across the whole pane, stored as digests, never as text.
2026-10-12 19:27:13 -07:00
XTLine d0d8fad608 fix(activity): keep current usage limits visible (#1185)
A current Codex usage limit was masked whenever the terminal redrew. Inventory now keeps the typed unknown/usage_limit reading while the limit is current, compact `rig ps` text and JSON keep the reason, and the web activity labels show "usage limit". Stale or generation-mismatched limits still yield to current activity, and newer permission prompts, blocked visuals and startup errors keep their priority. Sending a message while a limit is shown no longer triggers a prompt override.

The banner detector recognizes the banner above a draft or an indented composer, and a limit clears only on positive recovery evidence: a newer turn-status row after the last submitted prompt, or a readable frame with no banner. Failed, blank and unrecognized captures never clear it, and nothing typed in an unsent draft, including its continuation lines, counts as recovery.

Known limitation: an old banner followed by a submitted prompt and assistant output, with no turn-status row and no composer below, keeps the limit and renews it after it ages out; main lets it age out. This frame has not been observed in a real session, and the same text can be an unsent draft above footer text.

Refs #763 and #824.
2026-10-12 19:16:54 -07:00
Mike Schwarz bdc19878fc refactor(daemon): shared pieces for an in-place Codex restart, no behaviour change (#1195)
Extracts shared pieces that an in-place Codex restart will use, with no change in behaviour.

The Codex adapter's launch preparation (model, effort and profile arguments, posture and network decision, profile preflight, team workspace, daemon support) moves unchanged into prepareLaunch, with resumeCore and seatCommand around it, and gains buildResumeCommand and verifyResumeInPane for composing and checking a resume without sending it. The handover's TERM, wait and KILL cutover moves into pane-cutover.ts unchanged, with handover's remain-on-exit handling left as it was. tmux gains getPaneLocalOption, restorePaneOption and a pid-targeted signal, and the process-lineage module exports two thin wrappers over its existing parsers. None of the new functions has a caller yet. Every existing launch, resume, fork and handover gives the same commands and results as before.
2026-10-12 15:49:42 -07:00
Mike Schwarz 335ceb0ec3 Show Codex usage windows in rig provider status (off by default) (#1194)
rig provider status had no Codex usage windows: the provider service never called Codex's rate-limit read, so Codex rows carried no windows.

Behind a new setting, provider.usage_windows (off by default), rig provider status --refresh makes one bounded native read (codex app-server, account/read and account/rateLimits/read, 35 s, started with plugins and apps off) and shows the active login's windows: remaining, reset, observation time, freshness (fresh, stale, unavailable, aged from each observation) kept separate from level (nearing at 80%, exhausted at 100% or with the provider's limit evidence). Overlapping refreshes share one read, ordinary reads and wake-ladder ticks read memory only, and a timeout stops the reader's whole process group. Each row is keyed by the usage account id, else the workspace id from account/read, else it stays an unresolved row of its own; email is never identity. A failed refresh keeps the last reading with its original time beside the failure, and current availability reads unknown. Saved profiles that weren't read are named as not read. With the setting off, every existing route and printer is unchanged.
2026-10-12 15:37:15 -07:00
XTLine fec7772d05 fix(daemon): discard readiness results after lifecycle changes (#1188)
The context monitor probes readiness in the background and then wrote its result unconditionally, so a delayed result could overwrite a newer startup attempt: a pending or restarted seat became attention_required, or a newly failed retry became ready.

It now snapshots the eligible session (status, startup completion, binding, occupant generation and the latest startup event), compares a fresh read before probing, and compares again inside an immediate write transaction that also does the write; any change drops that poll's result and the next poll decides. An unchanged seat gets exactly the result it gets today, including one whose binding's tmux session differs from the recorded session name. The usage-sampling test now uses the canonical migrations.
2026-10-12 09:57:40 -07:00
Duncan L 76a4b33559 fix(daemon): roll back expired sessions to awaiting-decision on resume (#1191)
After a restart, a pod-aware restore that asked to resume a session the provider no longer has (Claude "no conversation found", Codex "no saved session", a missing Pi session file) launched the seat, got a retry-fresh answer from the harness, and reported a failed launch, leaving the launched session and pane behind.

The startup result now carries the adapter's recovery hint, and restore treats retry_fresh there the way it already does on its legacy and fresh-continuity paths: it rolls the blank session back (the launched row is superseded, the prior binding and statuses are restored, the pane is removed) and leaves the seat awaiting a decision: "The blank session was rolled back; no session is running. Re-run with --fresh <seat>". Successful resumes and other failures are unchanged, and nothing starts a fresh conversation without an explicit choice.
2026-10-12 09:04:53 -07:00
XTLine 31779f7384 fix(queue): report generic handed-off custody gaps (#1189)
A generic rig queue update <id> --state handed-off --closure-reason handed_off_to --closure-target <seat> returned success with no successor and neither the unverified-custody advisory nor the stuck-sweep diagnostic, because both paths treated every handed-off row as a verified handoff. Reopened rows re-closed toward a new target hit the same gap.

Both paths now apply the existing custody check to handed-off rows unless the row records a matching handoff: a local handoff, the deterministic cross-host successor id, or the older recorded <seat>@<host> closure that a cross-host re-drive keeps. Done and canceled rows are unchanged. It stays reporting-only: no write result, state or exit code changes. The sweep reads its candidates through the existing time and row-id indexes.

Known limit: after a reopen, a generic re-close naming the same seat on another host stays quiet, since the row records the seat but not the host; main reports nothing for handed-off rows.

Refs #318.
2026-10-12 08:07:53 -07:00
XTLine 17707d65fb fix(daemon): align ps session selection with inventory (#1186)
After a backward wall-clock step within a running daemon, rig ps could say stopped while node inventory showed a running replacement, or subtract a confirmed-missing replacement from a healthy sibling's count, because the summary picked each node's latest session by creation time while inventory picks it by registration order.

The summary now counts inventory's effectively running registrations and takes uptime from the same set: the earliest start among the latest running sessions that aren't confirmed missing. Wherever the two orders agree, the count and status are unchanged; a node whose latest session is stored running but confirmed missing no longer adds uptime, so a stopped rig no longer shows an uptime. The per-rig running-count query is replaced by one batched lookup.
2026-10-12 08:02:34 -07:00
XTLine dbc8abe607 fix(slack): recover broadcast replies after connection gaps (#1187)
Live inbound already accepted Slack thread replies sent with "Also send to channel" (thread_broadcast), but channel recovery skipped every threaded message and checkpointed past them, so a broadcast reply sent during a connection gap was never delivered.

Recovery now admits broadcast replies from the configured default channel's history. They take the existing path: sender admission, bot and subtype rejection, the fixed duplicate identity, exact thread routing and the durable retry, with the usual late-delivery marker. A reply seen live and again in recovery lands once. Ordinary (non-broadcast) thread replies and other channels stay outside recovery. The setup reference and the recovery status text describe the new scope.

Refs #739, which stays open for non-broadcast thread replies.
2026-10-12 06:14:18 -07:00
Shravan Sumanthanan f06e626b4c fix(daemon): recognize Claude auto, bypass, and plan mode footers as idle (#808) (#1179)
An idle Claude seat in auto mode, bypass permissions or plan mode (with or without the vim INSERT marker) showed a mode footer that the activity classifier didn't recognise, so the seat read as unknown instead of idle. The footer check now recognises those modes.

Mid-work evidence still takes precedence, and Codex panes are unchanged. The unframed-composer and earlier-selection checks keep the default footer's end-of-line anchor, so a default-mode footer followed by more text reads as it does today there. A negative test covers that case.

Reported in #808.
2026-10-12 05:52:27 -07:00
Emmanuel Ruiz ada3678219 docs(skills): draw the line between the rigs and openrig-skills descr… (#1174)
The rigs and openrig-skills descriptions both claimed getting a rig back, a watchdog wake and an OpenRig upgrade, and neither named the other, so the wording of a request decided which skill loaded.

They now divide by who is asking. rigs is a person in their own Claude Code or Codex session: install, set up, start, update, getting back to or re-attaching to their agents (including bringing a stopped team back), sharing or joining a team. openrig-skills is an agent already running inside a rig: fleet recovery, seat handover, watchdog wakes, in-rig upgrades and the rest of the index. Each description names the other in one clause.

Only the two description lines change. The package, plugin, canonical and shared-spec copies and scripts/skill-edge-digests.generated.json are regenerated from the sources.

Reported in #1171.
2026-10-12 05:12:55 -07:00
Shravan Sumanthanan 9109360f57 test(tui): restore user homedir in default socket path limit test (#1182)
The default socket-path test measures the real home directory again instead of the hermetic test home, which on macOS pushed the path past the 100-byte socket limit, so the test failed there for a reason production never meets. Test only; `OPENRIG_HOME` is restored afterwards.
2026-10-12 04:54:07 -07:00
Vaibhav Hajare 3b31636f59 fix(daemon): report original wait value in rewait timeout (#1183)
When a `--wait-for-idle` send re-waits inside the delivery lease and then times out, the message names the configured wait value instead of the leftover budget. The budget, deadline, lease, reason codes and every other timeout message are unchanged.

Follow-up to #1103, as lab1207 offered there.
2026-10-12 04:53:07 -07:00
Rudy Mizrahi Celekli 19202e6b4f fix(scope): prevent parallel slice creates from reusing IDs (#1007)
Parallel `rig scope slice create` calls reserve different slice numbers without a mission lock, daemon or new setting, and numbers are never reused, including after a failed create or a deleted folder. Each create keeps a manifest's authored members, orders and active flags, adds its own entry, and repairs only unfinished registrations it can prove; older unlisted folders are never enrolled.

Changed results to know: a slice number is never reused once claimed; a hidden per-slice claim marker stays in `slices/`; under heavy concurrency a stale write can still omit an entry from `mission.yaml` (the slice folder stays on disk); and a failed create on a mission with no id yet leaves the newly written id in its README.
2026-10-12 04:52:07 -07:00
Samuel 3bc921233e fix(daemon): extract fallback error diagnostics from message and event in pi-runner (#1181)
When a Pi turn fails and the provider puts its reason under `message.error`, `event.error` or `event.finalError` instead of `message.errorMessage`, the seat's error notice shows that reason instead of "request failed", through the same cleaning and 400-character limit as before. A null or missing `errorMessage` falls through to the new fields; an empty or non-string value still reads "request failed".
2026-10-12 04:04:53 -07:00
Mike Schwarz 5a947d02c4 Short receipts for queue writes, behind an off-by-default switch (#1137)
Queue writes (create, claim, unclaim, update, block, handoff, handoff-and-complete) can print a short receipt instead of the whole row when `output.compact` is switched on. It's off by default: with it off, or with `--full`, every write prints exactly what it does today.

Off by default: the receipt projection, and a `/healthz` read that settles `--host` locality for a compact receipt. Always present: the `--full` option on the seven write verbs (no effect while the switch is off), the `output.compact` key in `rig config`, the settings route and the TUI, one read of the setting on a write without `--full`, and the `unknown_target_repo` refusal message now naming `rig whoami --full --json | jq .workspace.repos` (same status and code). No migrations.
2026-10-12 03:54:25 -07:00
Mike Schwarz 4e14d01b8b fix(queue): bound held and next work candidates separately (refocus packet, off by default) (#1066)
With the refocus work packet switched on (`OPENRIG_REFOCUS_WORK_PACKET`, off by default), a seat's held (blocked) and next (pending) lists are read separately, each capped at 50, so a blocked task can't be pushed out of "held" by newer pending ones, and the refocus script names which list was capped. With the packet off, nothing changes.
2026-10-12 02:29:56 -07:00
Mike SchwarzandMarius Sabaliauskas bf75d81bea fix(launch): rig up warns when it defaults to / (from #226 by @Marius-prog) (#1150)
When `rig up` picks `/` itself as the launch folder (no `--cwd`, run from `/`), it prints one warning on stderr saying why and how to launch in the project instead. A launch at `/` is neither newly allowed nor refused: it was already permitted, and it can still fail for other reasons.

`rig up` warns when it defaults to `/`, from @Marius-prog's #226 (https://github.com/mvschwarz/openrig/pull/226) (Marius Sabaliauskas); finished by the OpenRig team in #1150, where his original commit is kept.

Co-authored-by: Marius Sabaliauskas <[email protected]>
2026-10-12 02:28:11 -07:00
Mike SchwarzandAlan Dampog 845733bb3d fix(tmux): keep the launching session's identity out of seats (finishes #771, by @adampog) (#1151)
A seat no longer inherits the launching Claude Code or Herdr session's identity variables (such as `CLAUDECODE` and `CLAUDE_CODE_EXECPATH`), whether the daemon starts the tmux server or joins one. The cleanup restarts only the seat's own pane, and a tmux error in it warns instead of failing a launch that works today.

Seats no longer inherit the launching Claude Code or Herdr session's identity, from @adampog's #771 (https://github.com/mvschwarz/openrig/pull/771) (Alan Dampog); finished by the OpenRig team in #1151, where his original commits are kept.

Co-authored-by: Alan Dampog <[email protected]>
2026-10-12 02:27:27 -07:00
Mike Schwarz 7837fc596b test: wait for the pane's shell to exit before removing the isolation test's directory (#1169)
The isolation test waits, bounded at 5 s, for the pane's shell (the pid its rc recorded) to exit before removing its directory, so a slow shell exit no longer fails the cleanup with ENOTEMPTY on macOS. A cleanup timeout is reported by name without hiding an earlier failure, and the directory is always removed. Assertions unchanged; test only.
2026-10-12 02:13:04 -07:00
Mike Schwarz a5c22b0e78 fix(tui): disclose capped queue samples through topology and Pulse (#1175)
When a queue list reaches its cap or fails to load, the TUI's instance, rig, pod and seat views and Pulse say the count is a sample or a lower bound. A seat missing from a partial sample reads as unknown work, genuinely empty data still reads empty, and a row that appears in two lists counts once. No new reads, and no daemon, query or setting change; the caps the TUI assumes (100, and 50 for pending) are a stated limit.

Refs #1172, #1173.
2026-10-12 02:12:07 -07:00
9eac92c244 fix(proof): resolve project-qualified scopes through the workspace catalog (finishes #136, by @korallis) (#1149)
`rig proof` and scope readiness resolve a project-qualified scope (`<project>:<path>`) through the workspace catalog, bounded by that project's own root, and readiness agrees with `rig proof show`. Existing colon paths still resolve as written, and an unavailable project gets the same 409 by prefix or `--project`.

Changed readiness meaning: a catalogued project's readiness uses that project's own slice, mission or project policy, not a nesting ancestor's. Where none applies, the policy reads null (a slice with no judgment configuration can read legacy, and retained receipts whose scope or policy no longer match can read unknown), and rebinding a project without a manifest to a new scope root can change its revision identity.

Project-qualified proof scopes by @korallis (Lee Barry), with @dajiaohuang, from #136 (https://github.com/mvschwarz/openrig/pull/136); finished by the OpenRig team in #1149, where their original commits are kept.

Co-authored-by: Lee Barry <[email protected]>
Co-authored-by: dajiaohuang <[email protected]>
2026-10-12 02:11:20 -07:00
Mike SchwarzandMartin 0b128f7467 test: make the daemon and cli suites pass on Linux (finishes #83, by @mvdpoel) (#1148)
The daemon and CLI test suites pass on Linux: inode-swap tests no longer depend on inode-number reuse, a timed-out staging step's whole process group is killed, and the relay test checks the committed mode. Tests only.

Linux suite fixes by @mvdpoel (Martin), from #83 (https://github.com/mvschwarz/openrig/pull/83); finished by the OpenRig team in #1148, where his original commits are kept.

Co-authored-by: Martin <[email protected]>
2026-10-12 02:10:15 -07:00
Mike Schwarz 14f96bfd0a docs(reference): keeping a watch for a person with today's queue commands (0.7.0 easy watchdogs, off by default) (#1064)
A reference page for keeping a watch for a person with today's queue commands: the operator keeps a watch as a queue task, arms the timer with a blocked wake, re-arms it, and tells the person through the registered channel. No product code changes; a test checks that every command and option the page names exists.
2026-10-12 02:05:47 -07:00
Mike Schwarz c50c8e2b92 fix(cli): report a claimed row's unconfirmed wake as claimed from queue create --verify (#1168)
`rig queue create --verify` reports `claimed` for an agent row the seat has already claimed whose wake render wasn't confirmed, instead of `indeterminate`; the exit code is unchanged. A script that matches a closed list of outcomes meets one new value.
2026-10-12 02:04:54 -07:00
Mike Schwarz 2bc91a70d2 fix(daemon): a forked Claude seat names its own session id at launch (#1144)
A Claude Code seat started with `rig fork`, or a `session_source: fork` seat, launches naming its own session id, so strict restore and strict clear-attention can prove it as its own conversation instead of reading a mismatch. A newly recognized ambiguous fork chain keeps the existing warn-and-send result without claiming either conversation verified, and other conflicts are unchanged.
2026-10-12 02:02:51 -07:00
Mike Schwarz 43ecc58917 fix(watchdog): don't re-wake a parked seat for unchanged rows (#1142)
A parked seat is no longer woken again for the same rows when nothing about them changed since its last wake. The parked-owner consumer used to end a wake episode whenever the seat read not parked, including while it was simply working, so the next park with the same rows sent the same wake again. An unknown or old-format open episode still deduplicates until it closes.
2026-10-12 02:02:03 -07:00
haralez d8b92928d6 fix(daemon): verify indented multiline message renders (#1145)
`rig send --verify` confirms multiline agent messages whose continuation lines the agent indents. It compares the whole message block with whitespace collapsed, counts only new matches between the two captures, and leaves the current composer out, so a staged message, or one that only shares a long opening, still reads unconfirmed. Raw and terminal sends keep the existing 40-character prefix match. A program that prints a message without indenting its continuation lines and then prints output directly after it at the same indent reads unconfirmed; Claude and Codex both indent.
2026-10-12 02:00:43 -07:00
Quentin Machu 001c070ecb fix(tui): read the seat queue on drilled Topology views so Q / WORK / NOW fill (#1173)
The TUI's Topology table reads the seat queue again on drilled views, so the Q, WORK and NOW columns fill: Q is a seat's open-item count, WORK its slice and NOW its current item. The queue is read only on a seat's page and the table tab, so the graph and health tabs make no extra calls.

Reported by @Quentin-M in #1172.
2026-10-12 01:07:42 -07:00
XTLine 94d3f5207c feat(cli): preview fresh seat launches without mutation (#1156)
`rig seat launch --fresh --plan` previews a fresh seat launch without changing anything: it reads only and exits 0. Every refusal keeps its existing error code, and when an earlier occupant is still live the message names its session and warns that the stop command acts on the seat's latest session.

Refs #889.
2026-10-12 01:06:07 -07:00
Quentin Machu c4936fe96f feat(spec): expand ~ and $VAR in a member's cwd (#1153)
A member's cwd in a rig spec can use ~ and $VAR. The path is used as written when it exists and expanded only when it doesn't, so every cwd that resolves today keeps its result, in launch, profile resolution and the legacy preflight. When the path still doesn't exist, the message names the expanded path.
2026-10-12 01:04:23 -07:00
haralez 081088fb07 fix(daemon): don't silently fresh-prime a stopped seat that has a resume token (#1141)
Restoring a snapshot taken while a seat was stopped no longer starts that seat fresh without a word when its restore policy is resume_if_possible and earlier history holds a resume token. The seat reports awaiting-decision before any session starts, other seats restore as usual, and the apply path and every restore forecast agree. The message recommends a deliberate per-seat fresh start with the exact command and says the recorded token is unverified.
2026-10-12 01:01:33 -07:00
Dery Ferdika 7bd0e01b2f fix(config): refuse daemon ports that can't be bound (#1140)
`rig config set` refuses a daemon port that can't be bound (such as -1, 65536 or 99999) instead of storing it, and a config file that already holds one resolves to the default with a warning instead of crashing the daemon at its next start. Ports 0 and 65535, quoted in-range ports and every value that resolves to a usable port today keep their result; the ui.preview settings are unchanged.
2026-10-12 01:00:15 -07:00
Rudy Mizrahi Celekli 77d9b9e30d fix(discovery): match agent executable names exactly (#1133)
Pane discovery recognizes an agent by its exact executable name, including the 15- and 16-character names Linux and macOS truncate to and claude.exe, so an unrelated process whose name merely contains "claude" or "codex" falls to the banner check instead of being taken for an agent.
2026-10-12 00:58:49 -07:00
Rudy Mizrahi Celekli 46243bcf99 fix(watchdog): validate all scheduler cadences before persistence (#1131)
Watchdog jobs validate every scheduler cadence before saving: values that crashed with a 500 when stored (empty or nested arrays, booleans, single-element arrays holding a non-scalar, and scan values outside SQLite's 64-bit integer range) get a named interval_invalid error before anything is written. Every cadence that works today, including zero and negative values, keeps its result.
2026-10-12 00:57:38 -07:00
Rudy Mizrahi Celekli cbcac27911 fix(wake): refuse generations that cannot index a tenure (#1129)
The wake resolver converts the requested generation to a number once and checks it, so a generation that can't index a tenure (a fraction, or text that isn't a number) gets the existing unresolved reply instead of a crash. Every generation that resolves today, including omitted, null and numeric strings, keeps its result.
2026-10-12 00:56:31 -07:00
Rudy Mizrahi Celekli 1ff21ef8cf fix(daemon): validate chat request envelopes before persistence (#1122)
Chat send and topic requests that crashed with a 500 (a null payload, a non-string sender, or an object or boolean body or topic with no array involved) now get a clear 400 before any message is stored or event emitted. Array, numeric and null-as-absent values keep their existing results.
2026-10-12 00:55:15 -07:00
Rudy Mizrahi Celekli 0b01b8819d fix(ci): run portability reports through symlinked paths (#1109)
The portability report runs its command-line entry point when started through a symlink or a path containing spaces or #, comparing decoded real file paths as the packaging script already does.
2026-10-12 00:53:13 -07:00
Vaibhav Hajare b8de1d468d fix(daemon): wait for idle outside the seat delivery lease (#1103)
`--wait-for-idle` waits outside the seat's delivery lease and re-checks readiness inside it, so a long wait no longer holds up other senders to the same seat.

Refs #1084, reported by @z4cc, who also reviewed this change with six tests.
2026-10-12 00:51:17 -07:00
Mike Schwarz 3001cc4366 chore(daemon): describe restore-guidance behaviour in its comments (#1170)
Reword the restore-guidance and restore-orchestrator comments, and two matching test comments, to explain the behaviour without internal references: an exact resume replays no startup content, except that missing managed guidance blocks are put back before the harness starts; existing blocks are never rewritten. Comments only.
2026-10-11 15:33:04 -07:00
Mike Schwarz 18c0a0fd67 docs: 0.6.10 what-changed note, capability map and changelog (#1166)
The 0.6.10 CHANGELOG section, the packaged what's-new note and the capability map (marker capability-delta-v0.6.10), bound to the release content and its two regression fixes. Text only.
2026-10-11 15:05:56 -07:00
Mike Schwarz a186bdaa22 Advance development main to version 0.6.10 (#1164)
Advance development main to version 0.6.10: the version fields in package.json, packages/cli, packages/daemon, packages/ui and package-lock.json.
2026-10-11 13:45:02 -07:00
Mike Schwarz dfe51eea3c fix(tui): preview Open terminals with the composition the window opener checks (#1167)
The TUI previewed Open terminals with no provider, which can now choose cmux, while the window opener previews and checks the Herdr composition, so the plans differed and the open refused on a machine without Herdr where cmux is running. The TUI preview now asks for provider=herdr, the composition the window opener checks. The launch still omits the provider, so a missing Herdr falls back to plain tmux; the plan check is unchanged; a provider-less open outside a window keeps choosing cmux. A new CLI test runs the real daemon routes, TUI preview and window opener for each case.
2026-10-11 13:44:14 -07:00
Mike Schwarz 8376d39014 fix(views): match the activity lens's rig filter literally too (#1165)
The activity lens builds its own rig clause and received the escaped rig pattern without an ESCAPE clause, so `rig view show activity --rig <name>` returned no rows for rig names containing `_`. It now uses the same `ESCAPE '\'` as the other lenses, and the literal-rig-filter test runs each name against both `recently-active` and `activity`.
2026-10-11 13:11:23 -07:00
Rudy Mizrahi Celekli 67efb11121 fix(packages): match guidance closing markers after their opening (#1135)
Guidance installs pair a closing managed-block marker only with its opening marker.
2026-10-11 12:39:13 -07:00
Rudy Mizrahi Celekli a460fa27fa fix(codex): preserve whitespace in Git metadata paths (#1134)
Codex Git metadata paths keep their whitespace.
2026-10-11 12:38:57 -07:00
Rudy Mizrahi Celekli 4d2bbb9ec1 fix(bootstrap): list same-second runs in newest-first order (#1132)
Bootstrap runs started in the same second list newest first.
2026-10-11 12:38:42 -07:00
Rudy Mizrahi Celekli b0564afb9a fix(progress): exclude fenced examples from task totals (#1128)
Progress task totals exclude fenced examples.
2026-10-11 12:38:27 -07:00
Rudy Mizrahi Celekli 423cee84f3 fix(history): preserve literal keywords in chat searches (#1127)
Chat history searches treat keywords literally.
2026-10-11 12:38:10 -07:00
Rudy Mizrahi Celekli ec1e718c54 fix(views): match rig filters as literal session suffixes (#1126)
View rig filters match as literal session-name suffixes.
2026-10-11 12:37:47 -07:00
Rudy Mizrahi Celekli cda6e18e27 fix(scope): resolve detail sections through the shared Markdown parser (#1125)
Scope detail sections resolve through the shared Markdown parser.
2026-10-11 12:37:32 -07:00
Rudy Mizrahi Celekli 360c47bd82 fix(daemon): retain Codex context samples across quota-only records (#1124)
Codex context samples are kept across quota-only records.
2026-10-11 12:37:16 -07:00
Rudy Mizrahi Celekli 404fd9590e fix(daemon): truncate file reads at complete UTF-8 boundaries (#1119)
File reads truncate at a complete UTF-8 character boundary.
2026-10-11 12:37:02 -07:00
Rudy Mizrahi Celekli f694382321 fix(daemon): include complete windows in top burn aggregates (#1116)
Top burn aggregates in rig usage include complete windows.
2026-10-11 12:36:47 -07:00
Rudy Mizrahi Celekli 85b4f4311b fix(cli): read CRLF queue files in heartbeat reports (#1120)
Heartbeat reports read queue files with CRLF line endings.
2026-10-11 12:36:32 -07:00
Rudy Mizrahi Celekli 76163deb04 fix(cli): sort heartbeat proofs with consistent UTC timestamps (#1121)
Heartbeat proofs sort by consistent UTC timestamps.
2026-10-11 12:36:13 -07:00
Rudy Mizrahi Celekli 45713f3276 fix(scope): require a readable successor file before delta expiry (#1123)
A capability delta expires only when its successor file is readable.
2026-10-11 12:35:58 -07:00
Rudy Mizrahi Celekli ade359a38c fix(cli): preserve environment rig lookup HTTP errors (#1115)
rig env keeps the HTTP error from a rig lookup.
2026-10-11 12:35:43 -07:00
Rudy Mizrahi Celekli 693c26f24e fix(tui): skip fenced examples when resolving file anchors (#1114)
TUI file anchors skip examples inside fenced code blocks.
2026-10-11 12:35:27 -07:00
Rudy Mizrahi Celekli 0ccaa38d8e fix(tui): page through local directory selections (#1113)
Local directory selections in the TUI page through the list.
2026-10-11 12:35:12 -07:00
Rudy Mizrahi Celekli 878d150e4e fix(tui): preserve emoji across detail row boundaries (#1112)
TUI detail rows keep an emoji intact across a row boundary.
2026-10-11 12:34:57 -07:00
Rudy Mizrahi Celekli 35a99b2ea2 fix(tui): treat CRLF input as a single activation (#1111)
The TUI treats a CRLF Enter as one activation.
2026-10-11 12:34:38 -07:00
Rudy Mizrahi Celekli 7f0bf31fa9 fix(scope): update fields inside exact frontmatter delimiters (#1110)
Frontmatter updates stay inside the exact --- delimiters: a YAML key that starts with --- is no longer taken as the closing delimiter.
2026-10-11 12:34:23 -07:00
Rudy Mizrahi Celekli e1403c2d37 fix(scope): locate progress sections by their H2 heading (#1107)
Progress edits locate a section by its H2 heading.
2026-10-11 12:34:07 -07:00
Rudy Mizrahi Celekli 916e1bbeb3 fix(cli): respect the option terminator in error output (#1106)
CLI error output respects the option terminator (--).
2026-10-11 12:33:52 -07:00
Rudy Mizrahi Celekli 8145c49fe8 fix(ci): keep header-shaped added text in its diff hunk (#1108)
The portability report keeps added text that begins like a diff file header (for example "++ b/") inside its hunk instead of reading it as a new file.
2026-10-11 12:33:37 -07:00
Rudy Mizrahi Celekli dfde2bab01 fix(repo): preserve exact tracked documentation paths (#1105)
The docs guard now checks tracked documentation paths exactly as Git lists them, including Git-quoted Unicode or newline filenames.
2026-10-11 12:33:11 -07:00
haralez bed4d4580f fix(daemon): prove a resumed Claude seat whose session id changed (#1080)
A Claude seat restored with --resume T1 that Claude Code continues under a new session id can be proved again instead of staying attention_required. OpenRig records the rotation only for the process its own launch observed, bound to that process and used once, and accepts it as a separate clause after the unchanged exact-token checks. Migration 101 adds the rotation record.

Refs https://github.com/mvschwarz/openrig/discussions/1077
2026-10-10 21:48:46 -07:00
xwcq 1754628ae5 fix(daemon): show confirmed missing tmux sessions as detached (#1074)
When tmux confirms a registered seat's session is gone, rig ps --nodes, rig seat status and the TUI show the seat as detached, with the cause and recovery in human output. It's a read projection: stored session status, occupant history, archive and cmux attach behave as before.
2026-10-10 19:56:42 -07:00
Coder8124 caa6c09c5e fix(queue): resolve an unconfirmed nudge result to claimed when the row is claimed (#1094)
Once a seat claims a row, an unconfirmed wake result (delivered-ack-pending or indeterminate) reads claimed from the claim on, telling "delivered and acted on" apart from "delivered, unknown". Other results stay as recorded, a send is never promoted to verified, and the wake ladder is unchanged.

Refs #165
2026-10-10 19:55:15 -07:00
Coder8124 bc92469e77 fix(daemon): return 400, not 500, for a non-numeric ?limit= (#586)
A ?limit= the daemon can't use returns 400 instead of 500 on the chat, projects, queue, stream and views routes. One shared parser keeps today's reading (-1, 0 and 10abc still work) and refuses only a non-number or a magnitude SQLite can't bind.
2026-10-10 19:54:16 -07:00
Mike Schwarz 5a0c238f74 fix(daemon): Claude strict finder refuses a non-runtime launcher's token over a conflicting child (#1091)
Strict restore no longer accepts a non-runtime launcher's --resume X as exact proof when the Claude it started is positively witnessed naming a different conversation. Every other shape keeps main's result, including an unreadable child executable and the opaque-child case, which remain disclosed limits.

Refs #1079
2026-10-10 19:49:17 -07:00
Mike Schwarz 66a13ca46b docs(operator): say what a team launch changes in the person's folder, before they agree (#1086)
Before a team launches into the person's own project, the operator says what the launch writes there and what that changes for the person's own agent in that folder, and offers a separate copy instead. Text only.
2026-10-10 19:38:50 -07:00
Mike Schwarz e50a13c2dc fix(daemon): resolve a Codex launcher chain the way Claude's is resolved (Refs #1079) (#1088)
A Codex seat whose codex command is a launcher that spawns the real Codex, rather than exec'ing it, is reached again by rig send and queue wakes, as on 0.5.17: the Codex path walks the launcher chain the way the Claude path already does.

Refs #1079
2026-10-10 19:33:09 -07:00
Mike Schwarz 3df44055b4 docs(teams): tell the person which seat is waiting on a prompt, and what it asks (#1087)
When a team seat stops at a prompt in a pane the person isn't watching, the operator's and the team leads' guidance has the agent the person talks to say which seat is waiting, what it asks and how to reach it. Text only.
2026-10-10 19:22:41 -07:00
Mike Schwarz 62ee49149c fix(queue): keep the summary in the compact list, and leave elided fields out (#1096)
The compact views of rig queue list, rig queue overdue and rig queue undelivered show every row's summary and leave out the fields they elide, instead of printing them as null or empty, so a search of a listing for a row's summary finds the row.
2026-10-10 19:17:23 -07:00
Mike Schwarz b8b625817d fix(terminal): print attach commands for the tmux server the daemon's sessions are on (#1083)
When the daemon runs inside tmux on a non-default socket, the attach commands OpenRig prints name that tmux server, taken from the daemon's own TMUX, so they reach the sessions instead of reporting no sessions. With no TMUX, commands are unchanged.
2026-10-10 19:10:12 -07:00
Mike Schwarz db8e6dd0db fix: report exited agents in preserved launch panes (#1070)
When an agent exits normally but its tmux pane stays alive at a shell, rig launch for that seat reports "Session alive, agent not running", names the preserved session and the ways back, instead of counting the seat as already running. Live agents, opaque wrappers, unavailable process observations and terminal seats are unchanged.
2026-10-10 19:08:45 -07:00
Coder8124 1319609fdb feat(daemon): opt-in setting to keep agent-to-agent escalations out of the human's Slack (#1090)
A new opt-in setting, queue.wake_human_rung (always by default, unchanged). With explicit-only, a wake ladder that runs out of rungs for an agent-to-agent baton ends at the open escalation row instead of posting a human-required alert to the person's Slack, and the baton's history records why.

Refs #811
2026-10-10 19:07:16 -07:00
Mike Schwarz 9d0be982b0 fix(slack): tell the person in the thread when a decision click isn't recorded (#1067)
When a Slack decision click can't be recorded, the person gets a short reply in the thread saying so and what to do, instead of silence. Click handling is unchanged, and a replayed click confirms the stored answer once.
2026-10-10 19:04:03 -07:00
Adam Whitehurst f2e0ebd3fe fix(cli): recognise a Herdr pane by Herdr's own markers (#1130)
rig terminal open from a tmux started inside a Herdr pane opens the view in that Herdr. Herdr is recognised by its full set of pane markers (HERDR_ENV=1 with HERDR_PANE_ID and HERDR_SOCKET_PATH) as well as TERM_PROGRAM; the CI and SSH checks still run first, and plain tmux is unchanged.
2026-10-10 19:03:15 -07:00
Mike Schwarz 7d9ce5c264 fix(transport): a Claude prompt suggestion is not a person's draft (#1139)
A Claude seat whose input line holds only Claude's own faint prompt suggestion is no longer treated as holding a person's draft, so delivery to it isn't refused. The verdict comes from one styled capture, only the current input line is checked, and the suggestion must match the whole line exactly. Typed or pasted text, placeholders, unstyled captures and wrapped suggestions are read exactly as before.
2026-10-10 19:02:13 -07:00
Mike Schwarz daa2fff7d9 fix(cli): rig capture --lines N shows the last N lines (#1136)
rig capture --lines N prints at most the last N lines of the pane, after dropping empty rows below its content, with a stderr note when earlier lines are left out. --json reports the returned count plus requestedLines and omittedLines, and --history-plus-pane keeps the old output. Without --lines, output is unchanged.
2026-10-10 19:01:08 -07:00
Mike Schwarz d36982fdea docs(teams): keep a team's own first steps and checks from stopping for approval (#1082)
Starter and factory team guidance tells agents to write their first steps and checks in forms the team's default permissions already allow, so a team's own commands don't stop for the person's approval in accept-edits mode. Text only.
2026-10-10 19:00:11 -07:00
Mike Schwarz 4058495cac fix: the first hour of an install tells the truth (#1065)
Four first-hour fixes from a first install on a fresh Mac. rig setup --providers claude|codex|both leaves an unchosen provider uninstalled and reports it Not selected; a chosen provider's failure still fails, and setup without the option is unchanged. A first rig daemon start no longer prints tmux's "error connecting" line. Setup's next steps say starting OpenRig and handing the person to the operator are part of the install. The operator's first copy no longer stops for an approval prompt.
2026-10-10 18:58:25 -07:00
Dery Ferdika e8f32eed6b test(scenarios): cover the rig up round trip with a stub scenario (#1092)
A stub scenario covers the rig up round trip through the shipped CLI (up, ps, down, ps, up with the same spec, ps): the same rig name comes back as one running team. Test and docs only.
2026-10-10 18:56:45 -07:00
JUSHUANGHUI LI e4422def1f fix(transcripts): compare redraws with the next cleaned line (#1104)
The transcript tail's final filter compares each line with the actual next remaining line rather than an index into the unfiltered array, so it no longer drops valid percent-ending output or keeps prompt redraw duplicates after status lines are removed.
2026-10-10 18:55:50 -07:00
Jay Hemnani 43983e67b2 fix(cli): read the workflow instantiate and project results the daemon returns (#1102)
The summary after rig workflow instantiate and rig workflow project reads the fields the daemon returns (the instance's id and status, the entry, next and closed prior packet ids), so a created workflow no longer shows "(no instance id)".
2026-10-10 18:55:05 -07:00
Mike Schwarz 115f973fbe fix(terminal): fall back to cmux when no provider is named and Herdr isn't there (#1071)
When no terminal provider is named, as from the TUI's open-terminal action, the terminal service tries Herdr first and falls back to cmux when Herdr isn't installed or answering, instead of failing with herdr_unavailable. With neither available, the honest failure and the attach commands are unchanged.

Refs #1069
2026-10-10 18:53:11 -07:00
Mike Schwarz a6efb5b461 fix(restore): put back a resumed seat's missing guidance before it starts (#1068)
After rig down and rig up --existing, a seat that resumes its own conversation gets its role, culture and SOP guidance put back in CLAUDE.md, CLAUDE.local.md or AGENTS.md before it starts. If some of that guidance can't be put back, the restore says so instead of fully_restored.
2026-10-10 18:50:50 -07:00
Mike Schwarz 484c329daa Stop the queue recovery and dedup lookups scanning every row (#1073)
The queue's recovery lookup and the stuck sweep's dedup check read a small partial index instead of parsing every queue row, so the daemon stays responsive as the queue grows. Migration 099 is additive and index-only: one partial index over rows whose tags could carry a recovery or stuck-sweep tag.
2026-10-10 18:49:18 -07:00
Mike Schwarz 82b7b56813 fix(cli): allow first daemon startup after a timed-out probe (#1061)
A first rig daemon start can proceed when an unused loopback port silently drops the health probe (seen on WSL2). A timed-out port that is actually held is refused by an exclusive bind check before the instance is initialized or a daemon is spawned; an answering listener and a recorded unresponsive daemon keep their existing refusals. Occupied-port errors name the port, and child-exit errors come only from that child's own log bytes.

Refs https://github.com/mvschwarz/openrig/discussions/1049
2026-10-10 18:47:27 -07:00
Vaibhav Hajare e5b6fbc651 fix(daemon): detect Codex usage-limit banner as typed at_limit (#973)
A Codex seat showing its usage-limit banner at the bottom of its pane is recorded as a typed at_limit observation, so seat status shows the usage limit instead of idle and provider signals receive the event. Its state stays unknown, never waiting on a person, and a stale observation falls back to the normal reading.

Refs #763
2026-10-10 18:45:51 -07:00
Rem Kim 30e846c4b6 fix(cli): report a seat's wake receipt and claim from queue create --verify (#1029)
rig queue create --verify for a seat destination no longer waits for a gateway receipt a seat never gets. It reports the saved row, the wake result and any claim separately, and human readership only for a person.

Refs #766
2026-10-10 18:44:18 -07:00
Rem Kim f7158c9a8a fix(cli): let rig add take the rig name, not only its id (#1027)
rig add accepts a rig name as well as its id, resolved like rig down: an exact id first across all rigs including archived, then a single active rig with that name. A name shared by two active rigs is refused before anything is added, with the matching ids. An unreadable summary falls back to the id-only path, and with a remote host selected names aren't resolved locally.
2026-10-10 18:42:53 -07:00
JUSHUANGHUI LI f9c1e899cc fix(cli): preserve usage HTTP errors in JSON output (#1075)
With --json, rig usage top and rig usage series print the daemon's HTTP error body as JSON on stdout instead of a plain line on stderr. Exit codes and plain output are unchanged.
2026-10-10 18:41:18 -07:00
Jay Hemnani 7cd2666156 fix(chat): return the newest messages when chat history is limited (#1057)
A limited chat history with no starting point returns the newest messages instead of the oldest, still oldest-to-newest. With a since or after starting point it pages forward from there, as before.
2026-10-10 18:40:11 -07:00
haralez d97ad032a1 fix(cli): say why rig start skipped an existing kernel and how to bring it back (#1060)
When a rig named kernel already exists, the daemon reports the kernel as skipped with detail "kernel rig already managed" on every start. rig start now names that reason and prints how to bring the kernel back (rig up kernel --existing) instead of the --no-kernel or test-mode message. The opt-out message and JSON output are unchanged.
2026-10-10 18:37:45 -07:00
Mike Schwarz 4b48ca21a9 docs: 0.6.9 what-changed note, capability map and changelog (#1063)
The 0.6.9 what-changed note, capability map and changelog, for the ten changes on main since 0.6.8, with migration 098 named, the Slack retry backlog counted as records, the first-install gap bound to 0.6.8 and how far it got, and the cross-host send budget and chatroom retry classes stated exactly.
2026-10-09 01:55:10 -07:00
Mike Schwarz 7c603da3ee Advance development main to version 0.6.9 (#1062)
Version fields only: 0.6.8 to 0.6.9 in the root, cli, daemon and ui package.json files and the matching package-lock.json entries. No dependency changes.
2026-10-09 01:23:12 -07:00
Mike Schwarz f6bdf107f7 fix(slack): detect a Socket Mode connection that stops delivering, and replace it (#1052)
A Slack Socket Mode connection that says connected while events have stopped is noticed and replaced, by Slack's server pings and by the echo of OpenRig's own posts once a connection has shown it receives them. A replacement opens the new connection before closing the old one, at most once every 5 minutes, and rig slack status and the connections view say whether delivery is confirmed.
2026-10-09 01:15:02 -07:00
Mike Schwarz 5eb57cc166 feat(refocus): carry the seat's actual work as text (off by default) (#1043)
With the refocus work switch on, a seat's refocus can carry its actual current work as text, and the queue route can return work candidates when asked. Off by default: with the switch off, every path behaves as before. Migration 098 adds a (qitem_id, transition_id) index on queue transitions; no existing query is slower, and a 0.6.8 daemon still opens the database.

Refs #949
2026-10-09 00:39:55 -07:00
Mike Schwarz 14b59f7e5c fix(slack): don't post a retained notification for a row that has closed (#1051)
A retained Slack notification whose row has since closed no longer posts late after a restart, retry or re-enable; the row gets one "dropped" note instead. Notifications for rows that are still open, parked ones included, still replay and post, and decision-resolved notices and digests are unchanged.
2026-10-09 00:38:22 -07:00
Mike Schwarz a29dfbcf9e fix(slack): keep typed answers on structured decisions (#1045)
A typed Slack reply to a structured decision is kept as the person's own words. It's stored as an object marked as a typed reply, holding the text, how it was placed and how many questions were left, while a click stays a plain option id, so typed text can never read as a clicked option. The formatter labels typed answers honestly, and the write stays one transaction with no double fill on redelivery.

Refs #1037
2026-10-09 00:13:32 -07:00
Mike Schwarz 98f1cfcc33 fix(cli): never report a delivered cross-host send as failed (#1048)
A cross-host rig send over HTTP waits 30 s (plus any --wait-for-idle). When it can't tell whether the remote delivered, it reports Delivery UNCONFIRMED and asks to check the target before any resend, instead of reporting unreachable. Unreachable is kept for errors that prove the request never arrived; local sends and the ssh relay are unchanged.
2026-10-09 00:00:34 -07:00
Mike Schwarz 9e3581cba1 fix(cli): keep a long chatroom wait going through a slow or restarting daemon (#1047)
A long rig chatroom wait keeps going through slow or briefly failed polls, including a daemon timeout or a connection dropped during a restart, until its own deadline. A real error such as an unknown room still ends it at once and names the error, and a deadline end says so. The deadline stays exact.
2026-10-09 00:00:02 -07:00
Mike Schwarz 978ee52e7a fix(kernel): report a recovered kernel as ready, and list each kernel seat once (#1044)
A kernel whose boot failed reads as recovered, and rig status as ready, only when every seat in the kernel spec the boot used has a node with a ready session; if the expected-seat list can't be read, the failure stays current. Each kernel seat is listed once.

Refs #1042
2026-10-08 23:59:32 -07:00
Dery Ferdika 7d177fa12d fix(slack): report the durable inbound dead-letter backlog in status (#1036)
rig slack status reports the durable inbound dead-letter backlog: the inbound Slack events kept for retry after a processing failure. When the dead-letter file can't be read, the plain output says unknown, and --json and HTTP report a null count, so an unreadable file never reads as an empty backlog. Read-only; no delivery path changes.
2026-10-08 23:57:40 -07:00
haralez be5f5fcdb1 fix(daemon): recognise a Nix-wrapped Claude as the seat runtime (#1053)
A Claude seat started through the nixpkgs wrapper reads as the seat's runtime instead of attention_required. The wrapper's process names only select a process for an OS path read; identity still requires a Nix store claude-code output's own .claude-(un)wrapped binary and every existing check (session token, foreground process group, frozen launch executable).
2026-10-08 23:56:17 -07:00
Goheer b047fbf15b fix(cli,daemon): stamp the workspace the caller named on scope approve (#997)
rig scope approve --workspace <dir> stamps the workspace the caller named. The CLI sends the root it resolved the target in, and the daemon uses it when it's an absolute path to an existing directory. A --workspace or OPENRIG_WORK_ROOT that names a tree with no missions folder stops with an error naming that source and its fix, and writes nothing. Clients that send no root keep the daemon's configured root.

Refs #995
2026-10-08 23:54:56 -07:00
Mike Schwarz aa126c74d5 docs: bring the as-built and reference docs to the 0.6.8 cut (#1041)
The README, reference and as-built documents are refreshed to the 0.6.8 cut.
2026-10-08 15:06:42 -07:00
Mike Schwarz f1f31cce50 docs: 0.6.8 what-changed note, capability map and changelog (#1039)
What's new and the CHANGELOG for 0.6.8, and the capability map bound to the 0.6.8 capability delta.
2026-10-08 15:06:21 -07:00
Mike Schwarz 68150ad9fc Advance development main to version 0.6.8 (#1038)
Development main moves to version 0.6.8 for the 0.6.8 release.
2026-10-08 14:49:39 -07:00
Mike Schwarz e8f0ab340d fix(daemon): drain a pending post-compact stage on a stale sample (#1035)
After OpenRig's managed compaction, a quiet seat now gets its restore request even when its usage sample is stale or unknown, and never while it's still compacting.
2026-10-08 14:29:32 -07:00
Luis Araya 4f7626e64d feat(cli): support --plan on single-target nodeRef in rig launch (#887) (#1023)
rig launch <rigId> <nodeRef> --plan previews a single-seat relaunch, including that the other seats stay unchanged, and launches nothing; a daemon that can't report that says so and exits non-zero instead of showing the wrong preview.
2026-10-08 12:32:32 -07:00
Mike Schwarz c502584b18 fix(build): prepare CLI and TUI build output with Node instead of POSIX tools (originally #956 by @dajiaohuang) (#1033)
The CLI and TUI builds prepare their output with Node instead of POSIX shell tools, so building works in a plain Windows shell. Originally contributed by @dajiaohuang in #956.
2026-10-08 12:29:43 -07:00
Mike Schwarz dc234f0de0 fix(skills): a catalog skill with uncommitted content blocks only itself (#1031)
One catalog skill with uncommitted edits no longer stops every seat's skills from installing: that skill is skipped and named in a warning, clean skills install their committed bytes, and seat launch carries on.
2026-10-08 12:28:24 -07:00
Dery Ferdika 9dd1b02948 fix(slack): honor a short Retry-After on chat.postMessage with one bounded retry (#1026)
A Slack post that gets a short rate limit (Retry-After of 10 seconds or less) waits and retries once, and a gateway restart during the wait cancels the pending retry so the message is never posted twice.
2026-10-08 11:51:13 -07:00
Rem Kim ee2caa7773 fix(queue): show the qitem summary in the wake nudge (#1028)
A seat's wake nudge now shows the queue row's summary on one line, so the seat sees what arrived before reading its queue.
2026-10-08 10:42:44 -07:00
Devulapalli Naga Sri Vaishnavi 8a0b46fee3 fix(shutdown): capture snapshot after resume discovery failure (#1030)
rig down still takes its pre-down recovery snapshot when one seat's resume-metadata discovery fails, instead of skipping the whole capture.
2026-10-08 10:35:45 -07:00
pr0xc3nt4ur1 e31c976e51 fix(daemon): recognize Claude Remote Control launch args in identity checks (#1025)
A Claude seat launched with Remote Control (--remote-control <title> or --remote-control=<title>) now confirms its identity through the exact session token instead of staying in attention.
2026-10-08 09:46:13 -07:00
Mike Schwarz a001444d7f fix(cli): never let rig launch --plan launch on a daemon older than 0.5.9 (#1024)
rig launch --plan refuses, without sending anything, a daemon too old to honour plan (before 0.5.9), and exits non-zero with a clear message if an answer shows a launch instead of a plan.
2026-10-08 09:44:33 -07:00
Tianqi Zhao f8eb5c0cd2 fix(daemon): reject workflow steps that allow no exit that can finish them (#1012)
rig workflow validate now reports step_cannot_finish (an error) for a step whose allowed exits leave out done and whose handoff has no next step, instead of letting the workflow stall there at runtime.
2026-10-08 08:44:36 -07:00
Tianqi Zhao 8e39778789 fix(slack): answer a person's thread reply in that thread (#822) (#1021)
A reply a person types inside a Slack thread OpenRig opened now records the thread's owning item as its reply-to, so the seat's answer posts in that thread; a top-level message still gets a new message. Refs #822.
2026-10-08 07:57:57 -07:00
Mike Schwarz 29c2a56104 fix(tui): keep typed verbs whole on an empty command line (#1020)
Keep typed commands whole in the TUI: the footer key is now F and the Scopes keys M and N, so feed, find, mission, narrative and needs can be typed from an empty command line. A test types every verb through the input handler.
2026-10-08 07:03:11 -07:00
Andrew Barnes a79568a08a fix(cli): preserve UTF-8 BOM in proof file bodies (#270)
rig proof add --file keeps a leading UTF-8 byte-order mark in the artifact body; invalid UTF-8 is still refused.
2026-10-08 06:44:58 -07:00
Rudy Mizrahi Celekli c34233c072 fix(scope): accept generated slice ordinals above 99 in audit (#1016)
rig scope audit accepts slice folders numbered 100 and above, as scope slice create makes them; single-digit and non-numeric names are still reported.
2026-10-08 06:35:51 -07:00
Luis Araya 83510564cb fix(tui): accept j and k as down and up aliases when command line is empty (#883) (#1019)
In the TUI, j and k move the selection down and up when the command line is empty, like the arrow keys; once the line has text they are ordinary characters.
2026-10-08 06:31:57 -07:00
Dery Ferdika 9f89fdbe45 fix(slack): enforce the Slack host gate inside downloadPrivateFile (#1006)
Check the Slack host inside the private-file download itself, so the bot token is only ever sent to Slack. The check is the existing one, moved; the one caller is unchanged.
2026-10-08 06:25:47 -07:00
Mike Schwarz 376e653b9d docs(reference): make topology naming predictable (#1000)
Add a topology naming reference and point the RigSpec, bundle, onboarding and authoring guidance at it, so new teams name pods and seats by purpose, domain and role. Existing rigs and aliases stay supported. Text only.
2026-10-08 05:37:20 -07:00
Mike Schwarz 60749d1570 docs(as-built): delta pass to the 0.6.7 cut 2caac7dd (#1015)
Restamp the as-built docs to the 0.6.7 source 2caac7dd: moved citations re-checked, and the CLI reference matched to the 0.6.7 command surface. Text only.
2026-10-08 05:01:26 -07:00
Mike Schwarz b3c3c8575f docs: add the 0.6.7 section to the changelog (#1014)
Add the 0.6.7 section to CHANGELOG.md. Text only.
2026-10-08 04:51:25 -07:00
Mike Schwarz 824f80ce75 docs: bring the what-changed note and capability map to 0.6.7 (#1010)
Bring the agents' what-changed note and the capability map to 0.6.7: what behaves differently after an upgrade and what to do, and the map bound to the 0.6.7 capability delta. Text only.
2026-10-08 04:44:28 -07:00
Mike Schwarz aa16224637 docs(0.6.7): bring the README and reference docs to the 0.6.7 cut (#1009)
Bring the README and docs/reference to the 0.6.7 cut: install links point at v0.6.7, and every changed statement matches the source. Text only.
2026-10-08 04:23:45 -07:00
Mike Schwarz 2caac7dd1b Advance development main to version 0.6.7 (#1005)
Advance development main to version 0.6.7 (version fields only).
2026-10-08 03:30:00 -07:00
Mike Schwarz 75d90b5070 fix(daemon): keep a waiting question held when its pane can't be read (#1001)
A wake holds instead of typing into a seat whose latest valid hook says it waits on a person when the pane can't be read; the ladder escalates a held wake from the same evidence, and a later valid hook that shows the seat moved on ends the episode.
2026-10-08 03:28:57 -07:00
Rudy Mizrahi Celekli 114cdb1554 fix(scope): resolve hinted slices past unrelated directories (#1004)
A bare slice name with --mission resolves past an unrelated same-named folder in the workspace or missions root; explicit paths, active-over-closed priority and the original error when nothing matches are unchanged.
2026-10-08 02:24:18 -07:00
Rudy Mizrahi Celekli 7bdc073677 fix(scope): check slice edits with literal Git paths (#1003)
Scope close, ship and move check the slice's path for edits with literal pathspecs, so a workspace folder named with pathspec syntax neither falsely refuses a clean slice nor misses edits inside it.
2026-10-08 02:08:52 -07:00
Mike Schwarz 72087f3aa0 docs(skills): teach seats to write their recap before a handover (#1002)
The handover, retirement and compaction skills teach seats to write their recap with rig context recap-write before a handover, compaction or long pause, with the format the recap store checks. Refs #996.
2026-10-08 02:06:52 -07:00
Mike Schwarz 770489c2f5 docs: recover kernel seats that fail at first start on a crashing tmux (#999)
Getting started covers kernel seats that all fail at the first start on a tmux whose server exits on capture-pane: a throwaway-socket check, the reporter's recovery when no kernel seat is still running, and why a later start doesn't retry them. Refs #980.
2026-10-08 01:30:47 -07:00
Mike Schwarz da5e9a927a Open the OpenRig TUI and operator as the handoff after install, sized to the person's terminal (#998)
After install the agent opens the OpenRig TUI and operator as the handoff, sized to the person's terminal (operator alone under 120 columns, 50/50 from 120, an openrig kernel space inside Herdr), reusing a space only under its own name with live attached panes. Supersedes #989, #990 and #992.
2026-10-08 01:12:02 -07:00
Rudy Mizrahi Celekli de374b4855 fix(scope): update frontmatter fields by decoded YAML key (#979)
Scope commands update frontmatter fields by decoded YAML key, keeping the rest of the block as authored; frontmatter that isn't a valid YAML mapping is written as before, with a warning naming the file.
2026-10-08 00:49:36 -07:00
Mike Schwarz 56bfc498fc docs(kernel): prefer WebFetch for listing page text (#994)
The kernel operator reads /rigs listing pages with WebFetch, so the person isn't stopped at a permission prompt.
2026-10-07 23:18:40 -07:00
Mike Schwarz 406e7c1a90 test(daemon): close two timing races that redden unrelated CI runs (#993)
Two daemon tests no longer race their teardown or the clock, so unrelated CI runs stop going red.
2026-10-07 23:15:45 -07:00
Mike Schwarz 69ecce4336 fix(chat): escape C1 control characters in the since echo (#991)
The chat-history since echo escapes C1 control characters too, so a rejected value can't carry a terminal escape. Refs #930.
2026-10-07 22:59:46 -07:00
Dery Ferdika ad956fb4a9 fix(chat): refuse a chat history since value SQLite cannot parse (#930)
A chat-history since value that can't be read as a time gets a clear 400 instead of an empty list; an empty since still means no filter.
2026-10-07 22:37:58 -07:00
Mike Schwarz dbfc5a556b docs(rigs): drop the macOS-prompt warning for the first view (#988)
The rigs skill stops warning about two macOS prompts on the first view, which no longer appear when the view opens in the agent's own terminal.
2026-10-07 22:31:00 -07:00
Mike Schwarz 5fab9ae802 fix(codex): disable startup update checks for managed launches (#986)
Codex seats launched by OpenRig skip Codex's startup update check with a launch-local setting; the person's own Codex config is untouched.
2026-10-07 22:20:10 -07:00
Mike Schwarz a621069811 fix(daemon): let a seat be handed over again into its own pane (#987)
A seat can be handed over again into its own pane; the handover re-claims the seat's own session row instead of refusing it as claimed. Refs #981.
2026-10-07 22:16:46 -07:00
Mike Schwarz 8f80086275 fix(terminal): lead the welcome view with the operator (#978)
The default kernel view opens the operator full width first, with the dashboard and advisor one tab or window away.
2026-10-07 22:12:29 -07:00
Mike Schwarz 9e08c89db6 fix(cli): name the file in bundle check output; name bundles after the rig (#985)
rig bundle check names the file in each human finding, and rig bundle create names the bundle after the team, while teams installed under the earlier default names still refresh in place.
2026-10-07 22:09:33 -07:00
Mike Schwarz 1f69831f9e fix(tui): resolve rig, host, pod and agent addresses from any page (#984)
TUI addresses typed on any page resolve on Topology once its read settles, instead of reporting a false "no such rig".
2026-10-07 21:22:53 -07:00
Mike Schwarz 85e0a10dc3 fix(kernel): allow routine inspection commands in Claude sessions (#983)
The kernel operator allows the operational helpers its routine inspection uses, so a person's first minutes aren't stopped by permission prompts.
2026-10-07 21:14:56 -07:00
Mike Schwarz 4fa8a73035 docs(rigs): relay the operator's questions to the person (#982)
The rigs skill has the person's agent relay the operator's questions instead of leaving them unseen in the operator's pane.
2026-10-07 20:52:28 -07:00
Rudy Mizrahi Celekli 817ca07c85 fix(scope): read rollback snapshots before changing composition (#976)
rig scope close, ship and move read README snapshots before changing mission composition.
2026-10-07 20:20:56 -07:00
Rudy Mizrahi Celekli 4176538318 fix(scope): preserve literal values during template substitution (#977)
rig scope scaffolds keep authored titles and intents literally during template substitution.
2026-10-07 17:51:38 -07:00
Rudy Mizrahi Celekli 1a7b886c20 fix(scope): protect Git move path operands (#974)
rig scope moves pass -- before git mv path operands, so workspace paths beginning with a dash work.
2026-10-07 17:44:09 -07:00
Rudy Mizrahi Celekli 69acd45b58 fix(context): preserve Markdown block boundaries in addresses (#962)
Context addresses respect Markdown block boundaries, and recap writes keep working with blank headings.
2026-10-07 17:43:43 -07:00
Mike Schwarz 33f80efeaa fix(terminal): start OpenRig Herdr views with the sidebar collapsed (#969)
OpenRig's herdr view starts with the sidebar collapsed via a private copy of the person's settings, falling back to the ordinary launch on any config problem.
2026-10-07 17:34:14 -07:00
Mike Schwarz 2467b4ee60 fix(daemon): deliver refocus on wrapped restore requests (#975)
The refocus hook delivers the trace on wrapped restore requests; restore guidance consumes the delivered trace; openrig-core 0.1.8.
2026-10-07 17:33:45 -07:00
Mike Schwarz 680a210bd3 docs: point installing agents to the rigs skill instead of restating it (#971)
Installing agents are pointed to the rigs skill instead of a restated copy; the recovery relays the command OpenRig prints.
2026-10-07 16:27:21 -07:00
Mike Schwarz aec75a2644 fix(cli): open welcome views in the hosting terminal (#970)
rig terminal open opens the welcome view in the hosting terminal (Terminal, Ghostty, Linux terminals) and gives every other host a definite no-window result with the command to run.
2026-10-07 16:26:31 -07:00
Mike Schwarz edf4b21de9 docs: run refocus traces as one plain command (#972)
Refocus and restore guidance run the trace as one plain command with literal paths and read files separately; openrig-core 0.1.7.
2026-10-07 16:09:44 -07:00
Mike Schwarz 770f8e195e feat(daemon): install the rigs skill globally, refreshed on each upgrade (#967)
The daemon installs the rigs skill globally at OpenRig's version, refreshed on each upgrade; a parity test keeps the packaged copy identical to skills/rigs.
2026-10-07 15:29:05 -07:00
Mike Schwarz 97372ac132 fix(daemon): publish completed compaction restore maps (#965)
Managed Claude compaction: the agent writes the temp restore map, and the daemon publishes it, so preparation needs no shell rename; openrig-core 0.1.6.
2026-10-07 15:08:07 -07:00
Rudy Mizrahi Celekli 343b4337c3 fix(cli): cancel chat wait requests at the command deadline (#968)
rig chatroom waits cancel their in-flight request at the command deadline.
2026-10-07 14:50:49 -07:00
Mike Schwarz b61be0d37b docs(rigs): load the rigs skill when the person asks to see their agents (#964)
The rigs skill loads when a person asks to see their agents, and warns about the two first-open macOS prompts.
2026-10-07 14:28:00 -07:00
Mike Schwarz fe23026fae docs: WSL2 is the Windows route; name both Pi credential routes (#963)
WSL2 is documented as the supported Windows route, and the Pi credential line names both routes.
2026-10-07 14:14:52 -07:00
Tianqi Zhao f88322bb9b fix(daemon): retry a Slack socket that fails or stalls before it opens (#942)
A Slack socket that fails or stalls before it opens is retried, and stopping the gateway still completes.
2026-10-07 14:13:29 -07:00
Mike Schwarz 64e4d652ed fix(cli): reuse Herdr views when opening another window (#957)
Repeated window opens reuse the existing herdr view when its plan matches, instead of adding duplicate spaces; a changed plan gets a fresh space with the stale one named.
2026-10-07 13:43:28 -07:00
Mike Schwarz a5f039590d docs: add a user's reported WSL2 setup to the getting-started guide (#960)
The getting-started guide records WSL2 as one user's reported working setup, not a supported platform.
2026-10-07 13:22:49 -07:00
Mike Schwarz 134f128eb6 fix(gateway): stop pointing the one-human messages at release 0.5.7 (#961)
The one-human gateway messages stop pointing at release 0.5.7 and name rig gateway human remove instead.
2026-10-07 13:17:48 -07:00
Mike Schwarz b577daf022 fix(tui): open terminal views with the desktop launcher (#959)
The TUI's Open terminals action uses the desktop launcher, and on a remote or headless daemon it leads the person to the preview's attach commands.
2026-10-07 13:12:57 -07:00
Mike Schwarz 66314bc808 fix(cli): leave Terminal window sizing to the user (#958)
rig terminal open leaves Terminal.app window size and position to the person; OpenRig no longer requests a resize that could reach their existing window.
2026-10-07 12:51:24 -07:00
Peter Amiri 1af1b2abd4 feat: an optional Slack channel map for outbound posts (#192, part 1) (#944)
An optional Slack channel map routes outbound posts per channel, with channel-map and verify commands; part 1 of #192 (outbound only).
2026-10-07 12:40:21 -07:00
Mike Schwarz 67426bc185 fix: align inventory startup status with current identity (#940)
Seat status follows the current occupant: stale predecessor observations and delayed absence probes no longer mark a healthy successor as needing attention, and restore-check names the right recovery. Refs #888.
2026-10-07 12:39:00 -07:00
JUSHUANGHUI LI 1ed008420a fix(daemon): restore fresh occupants after a clean rig down (#955)
rig up restores a cleanly stopped rig whose seats were freshly launched.
2026-10-07 12:27:59 -07:00
Mike Schwarz ff0de7b9da docs: make the welcome screen discoverable from help (#950)
Help, setup output and docs make the welcome screen discoverable: on a desktop the agent opens it with rig terminal open saved:kernel --window; over headless SSH it gives the attach command.
2026-10-07 12:16:23 -07:00
Mike Schwarz feb6ed94fd fix(cli): open the terminal window by default (#954)
rig terminal open requests a desktop terminal window by default; explicit providers keep the existing-workspace route, and an outcome whose reply was lost is reported as unconfirmed.
2026-10-07 11:53:49 -07:00
Mike Schwarz baddd0a87d fix(daemon): preserve Claude identity through inline settings (#933)
Inline Claude settings JSON stays one value when OpenRig reads a seat's command line, so the real session option is found and the seat keeps its identity. Refs #921.
2026-10-07 11:46:51 -07:00
Mike Schwarz 2a513ce7cd Fetch Git context without catalog history and read the standalone registry (#951)
Adding the world fetches only the current commit, not the catalog's history, and readers use the standalone openrig-registry.
2026-10-07 11:19:50 -07:00
Mike Schwarz 722689d18d fix(cli): request a readable welcome window size (#952)
The welcome window opens at a readable size where the terminal allows it, without ever resizing the person's existing windows.
2026-10-07 10:56:39 -07:00
Mike Schwarz 3adf7718d2 feat(daemon): a reaction on any part of a long ask reaches the seat that asked (#947)
A reaction on any part of a long ask reaches the seat that asked, and a one-message ask that already landed is acknowledged instead of refused. Refs #899
2026-10-07 10:43:08 -07:00
Mike Schwarz c0fcc73a51 Show first-team choices on the shared TUI graph (#948)
The operator shows each first-team choice on the shared TUI graph before the person picks, with a named text fallback.
2026-10-07 10:31:38 -07:00
Mike Schwarz 227b954128 fix(daemon,tui): show a parked row's wake when it will fire, never as 1970 (#946)
A parked row's wake is shown when it will fire, never as 1970 or a wrong due-now; one due rule serves the scheduler, the projections and the TUI.
2026-10-07 09:30:23 -07:00
Mike Schwarz 6cdb203054 Install Herdr and open the welcome view in a new terminal (#936)
Setup installs herdr by default and rig terminal open --window opens the welcome view in a new terminal, so the person copies no command; a failed herdr install is a warning and setup continues.
2026-10-07 09:26:53 -07:00
Peter Amiri 72ce7e7ae5 fix(cli): report an invalid --wake-after duration instead of exiting silently (#945)
An invalid --wake-after duration now prints a clear error instead of exiting silently; exit codes are unchanged.
2026-10-07 09:26:29 -07:00
Mike Schwarz 036e8aef52 fix(daemon): allow Claude team help and equivalent command spellings (#927)
Team Claude seats run help commands and ordinary spellings of allowed commands without prompts, while real lifecycle actions still ask. Refs #915
2026-10-07 09:18:52 -07:00
Mike Schwarz b4ba38bc14 fix(daemon): post a long ask to Slack in parts instead of refusing it (#929)
A Slack ask longer than one message is posted in parts instead of being refused, and a retry keeps the same split so no text is posted twice. Refs #897
2026-10-07 09:10:56 -07:00
Mike Schwarz 69f1a3ef8a fix(pi): report version and managed credential readiness before launch (#938)
Pi preflight reports the observed version and whether the managed seat has a stored credential, advisory only; no credential value is printed and a version or probe failure no longer stops launch.
2026-10-07 08:57:35 -07:00
Vaibhav Hajare 2a23437766 fix(daemon): first periodic-reminder interval measured from registration (#860)
A periodic reminder's first fire comes one interval after registration; a wait pending before an upgrade still fires at once.
2026-10-07 07:47:19 -07:00
Rudy Mizrahi Celekli f145780fbb fix(usage): keep context histories scoped to live node incarnations (#835)
Context polling skips non-running sessions in archived rigs; running seats are still polled.
2026-10-07 07:46:15 -07:00
Rudy Mizrahi Celekli 23a1669106 Resolve workflow source files in the invoking CLI directory (#845)
A bare workflow name resolves to a local path only when it names a file; a same-named folder stays a bare name.
2026-10-07 07:45:31 -07:00
Rudy Mizrahi Celekli 09c4a44cbc Stop workflow watch when an instance is already aborted (#847)
Workflow watch stops with exit 3 when an instance is already aborted, and the help says so.
2026-10-07 07:42:48 -07:00
Mike Schwarz 475ccabeca feat(daemon): deliver a Slack reaction on an ask to the seat that asked (#931)
A registered person's reaction on an ask's own Slack message reaches the seat that asked, once, without answering it.
2026-10-07 03:21:32 -07:00
Mike Schwarz 7a4a21780d docs: clear the last old team names from comments and a preview (#941)
Code comments and a hidden preview no longer name the retired openrig-velocity rig.
2026-10-07 03:09:29 -07:00
Mike Schwarz 2ef93ad324 fix(refocus): deliver during restore and surface repeated failures (#928)
Refocus after a managed compaction waits for the restore request (bounded at ten minutes), detects failure from the trace's exit status, reports repeated failures once, and seeds the bare refocusing skill.
2026-10-07 03:02:48 -07:00
Mike Schwarz 8209b81c19 fix: stop defaulting to a rig that no longer exists (#937)
Defaults no longer name the retired openrig-velocity rig: the advisor session defaults to the kernel advisor, and restore-packet defaults to the caller's own rig and the seat's LEARNED.md.
2026-10-07 02:42:54 -07:00
Mike Schwarz ab32dde66e docs: point prompt-weary users to Workshop (#939)
README, getting-started and the operator's guidance point people slowed by permission prompts to the workshop, and say what its broad access means.
2026-10-07 01:52:42 -07:00
Mike Schwarz 64bbcb3b1f docs: ship a what-changed note for agents on an upgraded install (#934)
Ships a what-changed note for agents on an upgraded install, reachable through rig context and pointed to from the help guide and the upgrade skill.
2026-10-07 01:45:03 -07:00
Mike Schwarz d1d6eb9ed8 docs(operator): explain first-run checks and complete shutdown (#932)
The operator checks health with plain commands, stops teams rig by rig with kernel last and hands off the final daemon stop, and relays rig up's untracked-file warnings.
2026-10-07 01:32:44 -07:00
Mike Schwarz 90cae3a570 docs: drop old team names and "queue row" from shipped text (#935)
CLI help examples and three reference pages use current team names and plain terms instead of retired names and "queue row".
2026-10-07 01:18:23 -07:00
Mike Schwarz 960011982c fix(cli): align setup and doctor authentication checks (#924)
rig doctor reuses setup's local authentication checks, so the two agree; existing doctor checks are unchanged, and the footer notes that only selected harnesses need a login.
2026-10-07 00:57:43 -07:00
Mike Schwarz baba1f608b fix(daemon): align shared bootstrap refusal responses (#926)
A bundle target-file conflict returns 400 target_conflict from /api/bundles/install, as /api/up does, instead of a 500; refusal decisions are unchanged.
2026-10-06 23:58:24 -07:00
Mike Schwarz dffb996bab fix: preserve product policy during skill regeneration (#925)
Regeneration reads the product's generated JSON as its source, so a stale canon file can no longer silently revert the skill lists.
2026-10-06 23:52:41 -07:00
Mike Schwarz 3cdb3eb478 docs: publish the one-command install with a stable link (#917)
Publishes the one-command install with a stable link and a dry-run preview in the README, getting-started and help.
2026-10-06 23:43:25 -07:00
Mike Schwarz b482b83bb0 docs: installer close text, the operator's Codex update line, and permission text for the team default (#916)
Shipped text for 0.6.7: the installer close lines in the packaged guide, the operator's Codex update line, and setup and policy wording that matches the team default.
2026-10-06 23:42:44 -07:00
Mike Schwarz ee3b6c03d5 test(cli): make fractional chatroom deadlines deterministic (#923)
The chatroom fractional-deadline tests use a controlled clock, so they no longer fail intermittently.
2026-10-06 23:32:45 -07:00
Mike Schwarz d648fca087 feat(cli): show agent activity before stopping a rig (#922)
rig down prints the agents it stops and what each was doing (or unknown), as one line of facts before stopping.
2026-10-06 23:32:30 -07:00
Mike Schwarz 6840cd7d55 docs(specs): the starter and factory leads publish their team's roster (#918)
The starter and factory leads publish their team's roster at first start, so rig roster list and find know the built-in teams.
2026-10-06 23:26:50 -07:00
Mike Schwarz cd79a6bd05 fix(daemon): keep generated core Codex plugin files out of Git (#919)
Generated-file hygiene recognises the namespaced .codex/plugins/shared:openrig-core folder, so OpenRig's generated Codex plugin folder no longer shows as untracked.
2026-10-06 23:18:35 -07:00
Mike Schwarz 4472577a11 fix(substance): allow the exact compaction path template (#920)
The substance scanner can exempt an exact reviewed line (allowed_context_lines), so the compaction path's template line in the shipped restore skills is no longer a false finding.
2026-10-06 23:17:44 -07:00
Coder8124 0615de266f fix(daemon): ingest Slack thread_broadcast replies as thread replies (#910)
Slack thread replies sent with "Also send to #channel" (thread_broadcast) reach the seat that owns the thread, like any thread reply.
2026-10-06 21:56:53 -07:00
Coder8124 5561a05be5 test(daemon): fix a race in the native transcript capture test (#913)
The native transcript test waits for both copies of a typed line (echo and cat output) before comparing, so a capture between them no longer fails it intermittently.
2026-10-06 21:56:37 -07:00
Mike Schwarz 9ad13828aa docs(skills): rigs carries an install through to the team's result on 0.6.6 (#909)
The rigs skill carries an install through to the team's result on 0.6.6: it offers the OpenRig view, gives the goal to the kernel's operator, and follows the work back to the person.
2026-10-06 21:26:34 -07:00
Mike Schwarz a7fed6313a fix(daemon): keep $ sequences literal when managed blocks are re-projected (#908)
Managed guidance and config blocks keep $$, $&, $` and $' literal when they are re-projected, instead of expanding them on every relaunch.
2026-10-06 20:36:00 -07:00
Mike Schwarz b00a536b82 fix: contain terminal WebSocket attach failures (#907)
A rejected web-terminal attach closes only that viewer with 1011 instead of exiting the daemon, and the failed broker is disposed so a retry starts fresh.
2026-10-06 20:31:29 -07:00
Mike Schwarz 98e643b6d0 docs(onboarding): refresh the capability map to 0.6.6 (#905)
Refreshes the capability map agents read to the 0.6.6 release commit 2620dea8, and says the running-team check comes before target files are written, here and in the bundle reference.
2026-10-06 20:29:43 -07:00
Mike Schwarz 0146f6a03f docs: add the 0.6.6 section to the changelog (#906)
Adds the 0.6.6 section to the changelog.
2026-10-06 19:59:03 -07:00
Mike Schwarz 51bd931ed6 docs: bring the reference docs to the 0.6.6 cut (#903)
Brings the README and the reference docs to the 0.6.6 release commit 2620dea8: claims checked against source at that commit, schema-2 and legacy bundle installs described separately, the permission-default exceptions kept in the short summaries, and plain wording for in-flight Slack work.
2026-10-06 19:58:38 -07:00
Rudy Mizrahi Celekli 14884db714 Preserve spaces in observed Codex process home paths (#851)
The Codex thread-id lookup reads HOME up to the next variable in ps output, so a home folder with spaces resolves.
2026-10-06 19:41:22 -07:00
Rudy Mizrahi Celekli bb9e8a93b0 fix(rigspec): validate malformed canonical topology containers (#846)
Malformed pods, members, edges or roots in a canonical rig spec get an indexed "must be an object" error instead of an internal validator error.
2026-10-06 19:41:01 -07:00
Rudy Mizrahi Celekli 6bce9b2e74 fix(retention): prune snapshot histories without overflowing SQLite parameters (#836)
Snapshot pruning deletes with one statement instead of one bound parameter per row, so large prunes no longer exceed SQLite's variable limit.
2026-10-06 19:40:42 -07:00
Mike Schwarz b1fadc518f docs(as-built): delta pass to the 0.6.6 cut 2620dea8 (#902)
Brings the as-built documentation to the 0.6.6 release commit 2620dea8: claims checked against source at that commit, citations renumbered, the CLI reference regenerated from help at the cut, and each document stamped last-verified-against-source: 2620dea8. Describes 0.6.6, not later main.
2026-10-06 19:27:47 -07:00
Rudy Mizrahi Celekli 2c708f8b6c fix(routes): preserve identity parameters after Hono decoding (#844)
Route parameters for seats, sessions, rigs, agent images and the terminal socket are decoded once (Hono already decodes them), so a name containing % no longer fails with a 500 or resolves to a different target.
2026-10-06 19:09:52 -07:00
Rudy Mizrahi Celekli 23da0752d1 fix(daemon): quote projected Claude collector paths (#852)
The Claude status-line collector command shell-quotes its paths, so a project or state path with a space or apostrophe no longer stops context usage from reaching compaction and health.
2026-10-06 19:09:36 -07:00
Rudy Mizrahi Celekli 77cbc8c2ad Read native Codex text blocks in predecessor recaps (#848)
The seat handover recap reads Codex input_text and output_text blocks, so a Codex successor no longer gets an empty recap.
2026-10-06 19:08:46 -07:00
Rudy Mizrahi Celekli 1864743130 fix(transcripts): read coherent captures during atomic publication (#843)
Transcript tail and grep read the size and bytes from the same open file, so a read during rotation no longer mixes two copies of the transcript.
2026-10-06 19:08:29 -07:00
Mike Schwarz f2b7fbf459 fix(daemon): bind bundle replacement to its install folder (#901)
Reinstalling a stopped team replaces conflicting files only in the folder that generation was installed into, recorded at materialization; a copied bundle.yaml elsewhere no longer authorizes replacement. Older generations and ones created directly from rig.yaml keep the manifest-only check until their next bundle install.
2026-10-06 19:06:27 -07:00
Rudy Mizrahi Celekli e6c9573761 test(compaction): isolate ordering assertion from fixture deadline (#849)
Test-only: a compaction ordering test freezes the clock so the fixture's preparation deadline can't expire first on a busy runner.
2026-10-06 18:50:20 -07:00
Rudy Mizrahi Celekli 6cb1017aad fix(usage): compare equivalent ISO cutoffs at stored precision (#840)
rig usage series --since/--until bounds are normalised to the stored UTC millisecond form, so a bound with a timezone offset or without milliseconds filters correctly.
2026-10-06 18:50:02 -07:00
Mike Schwarz 75be285838 fix(daemon): quote the Claude resume token in the launch command (#798)
The Claude adapter's non-managed launch quotes the resume token, so a token containing shell syntax stays one argument, matching the restore path and the --model and --effort arguments. The managed launch is unchanged.
2026-10-06 18:27:37 -07:00
Rudy Mizrahi Celekli b0e27eacec fix(codex): retain actionable evidence from the final resume observation (#759)
The Codex resume check's final observation keeps a no-saved-session or attention-required result instead of falling through to the generic shell or timeout fallback.
2026-10-06 18:09:22 -07:00
Rudy Mizrahi Celekli 7ddf5e94ec fix(cli): allow terminal opens to finish healthy provider page calls (#758)
rig terminal open waits up to 45 seconds for the daemon to finish opening tiles, so a healthy multi-page open no longer reports a false timeout.
2026-10-06 18:09:04 -07:00
Rudy Mizrahi Celekli e35d541754 fix(cli): return operation exit codes for remote rig teardown (#756)
A remote rig down that reports teardown errors now exits 2, matching a local rig down, instead of exiting 0. An already-stopped rig still exits 0.
2026-10-06 18:08:44 -07:00
Rudy Mizrahi Celekli 5dadaf0359 fix(chat): preserve message order across history and live delivery (#760)
A chat watcher now receives buffered history before newer live messages; the phase switch to live delivery happens after the drain.
2026-10-06 18:06:37 -07:00
Rudy Mizrahi Celekli 8d047cacae fix(workflows): preserve explicit failure occurrence selection on resume (#757)
rig workflow resume with a failure ID that matches no open failure now refuses with an error naming it, instead of retrying a different step.
2026-10-06 18:06:22 -07:00
Rudy Mizrahi Celekli d2348948f3 fix(packages): resolve package sources and targets from the caller directory (#754)
rig package validate, plan and install resolve relative package paths and the default --target . from the caller's directory instead of the daemon's.
2026-10-06 18:06:07 -07:00
Rudy Mizrahi Celekli 70985f1108 fix(retention): preserve watchdog history at tied retention boundaries (#753)
Watchdog history retention keeps rows that tie at the keep boundary instead of deleting the whole tied group, so a job keeps at least its configured count.
2026-10-06 18:05:51 -07:00
Rudy Mizrahi Celekli 9ed83cf7ba fix(tmux): preserve literal session names in discovery and capture (#752)
Discovered and claimed tmux session names keep their literal form, including a pipe or leading and trailing spaces, in discovery and capture, so activity for those sessions isn't lost.
2026-10-06 18:04:08 -07:00
Rudy Mizrahi Celekli fd068ea495 fix(tmux): read launch metadata from the exact session (#755)
Launch-metadata reads now address the exact tmux session, so a session whose name prefixes another can't pick up that neighbour's identity. A missing target still falls back to the prior launch command.
2026-10-06 18:03:46 -07:00
Mike Schwarz 23bc9681ea fix: keep Claude activity relay outside project cleanup (#870)
The Claude activity relay now lives in the OpenRig instance (state/claude-activity-hooks/activity-relay.cjs), so a project cleanup can't remove it while its hook stays configured. Restore-check inspects the same place. Legacy project-local commands are replaced on the next projection, and user hooks are kept.

Refs #875
2026-10-06 18:00:16 -07:00
opencode13241-eng 96b79fd311 feat(daemon): derive folded rung against arrangement.source.integration_ref (#682)
The execution view derives a mission's folded rung against the arrangement's declared source.integration_ref. The declared reference is recorded before composition validation, so after a composition error the folded rung reads indeterminate naming that ref instead of testing against main.

Refs #402
2026-10-06 17:55:16 -07:00
Mike Schwarz 6e8a6d936a fix(daemon): count non-empty segments for project-root depth (#857)
Working-directory project selection measured a project root's depth by splitting on the path separator, which counted an empty segment for the filesystem root, so / and /a both measured 2. A catalog declaring / beside /a then reported a tie from inside /a. Depth now counts non-empty segments; ordering among other roots is unchanged and a genuine tie still asks for --project.
2026-10-06 17:52:09 -07:00
Mike Schwarz 49c60b4938 fix(skills): stop rig skill audit failing on OpenRig's own shipped files (#807)
rig skill audit stops failing on OpenRig's own shipped files. A skill copy that matches the same-named skill in an installed plugin byte for byte is reported as bundled from that plugin. Outside an OpenRig source checkout, the mirror-drift check reports skipped instead of failing; in a source checkout it runs as before.

Refs #802
2026-10-06 17:51:27 -07:00
awss 9ba09105e1 fix(workflow): rerun dependents when a routed-back step hands off again (#817)
A workflow step that was routed back and hands off again now reruns its dependents instead of leaving them satisfied by the earlier pass. Re-entry is ordered by append order, not closed_at, so a clock step-back can't skip a gate.
2026-10-06 17:50:08 -07:00
Mike Schwarz f0cde45616 fix(skills): keep a plugin copy whose source changed instead of failing a sharing seat (#819)
A seat sharing a projected plugin skill copy keeps it, with a plugin_skill_kept launch warning, when the plugin's source changed or moved, instead of failing the loadout. Only records owned by the same plugin are kept; the next launch that selects the plugin refreshes the copy.

Refs #815
2026-10-06 17:49:14 -07:00
Dery Ferdika b57d66a20d fix(bundles): always run the bundle manifest safety pre-check on install (#876)
The bundle install's manifest pre-check (unpack, parse bundle.yaml, schema-aware manifest validation) now always runs. --skip-version-check and --force keep skipping only the compatibility and conflict checks. A valid bundle installs as before; an invalid manifest that the install path would have rejected later now fails up front with a clear message.
2026-10-06 17:48:16 -07:00
Rudy Mizrahi Celekli 82b9ed72f7 fix(queue): clear stale blockers when claiming an item (#761)
Claiming a blocked queue item clears its former blocker together with the park-timer retirement, so the in-progress row and its waiting view show the claimant instead of the old gate. An escalation refresh on a claimed in-progress row keeps the retained claim gate.
2026-10-06 17:46:28 -07:00
bobbiejaxn 69bdf4d489 fix(daemon): forward MINIMAX_API_KEY to minimax/* Pi seats (#891)
Pi seats on minimax/* models can now receive MINIMAX_API_KEY from the daemon. The key crosses only when the operator names it in recovery.provider_auth_env_allowlist and it is set in the daemon's environment. The Pi child gets it only for minimax models; an allowlisted key is also in seat launch environments, as with the other Pi provider keys.

Refs #863
2026-10-06 17:45:27 -07:00
Mike Schwarz 5f7378a7cf fix(daemon): only observed needs-input evidence clears a seat's prompt (#885)
A needs-input zero clears a seat's prompt only when observed evidence supplied it; otherwise the hook store decides, so a seat at an approval prompt stays counted after a daemon restart or a hook-source downgrade. The wake ladder retires a prompt episode only on evidence observed after the refusal.

Refs #879
2026-10-06 17:43:44 -07:00
Mike Schwarz 2620dea84e docs(kernel): give the operator the raw registry link for the workshop pin (#900)
The operator reads the workshop's pinned commit from the live registry link, fetched fresh, and knows why.
2026-10-06 17:20:49 -07:00
Mike Schwarz a622adaaf1 docs(cli): say what stopping or restarting a live team does before agents run it (#895)
Help text and agent guidance say plainly what stopping or restarting a team does to live work, what to check first, and how to bring it back.
2026-10-06 16:14:53 -07:00
Mike Schwarz 141513eba4 Add scoped team launch permission defaults (#893)
OpenRig team agents launch able to run ordinary rig commands, read the project and run its tests without permission prompts, while starting, stopping and reshaping teams still asks, and the operator's permission advice matches that default.
2026-10-06 15:51:52 -07:00
Mike Schwarz 34a11aebd9 feat: carry authored non-interruptive defaults through bundle installation (#892)
A rig can declare its non-interruptive launch choice, bundle installation carries it to launch, and the before-install view says plainly when a team runs with broad access.
2026-10-06 15:26:02 -07:00
Mike Schwarz 2bbe82a501 Clarify first-session permission choices and conversation entry (#890)
The operator recommends a scoped permission option to someone unsure and explains what keeping prompts costs, and the CLI help separates the status dashboard from the operator's conversation.
2026-10-06 14:07:17 -07:00
Mike Schwarz 5d7d741b0e fix(cli): keep operator handoff visible after incomplete setup (#886)
rig setup keeps the route to the operator visible after a dry run or an incomplete setup, before the optional permission menu and in JSON as nextSteps, without claiming setup is ready.
2026-10-06 10:37:09 -07:00
Mike Schwarz d6f54149dc fix: show team choices and handoff reminders in command results (#884)
Built-in starter and factory previews name all three first teams, and terminal-open results for interactive team views say where to talk about the work and ask whether the person can see the team.
2026-10-06 09:32:46 -07:00
Mike Schwarz 5aef027024 fix(skills): rigs carries on from install to a team doing the work (#881)
The rigs skill carries on from install to a team doing the person's work: it starts the daemon, asks the goal, offers and starts a small team on a yes, and hands the goal to the owning seat, reading the result back instead of doing the work itself.
2026-10-06 08:02:36 -07:00
Mike Schwarz 2b75ae0557 docs: have the operator connect users to their team view (#880)
After launching a team, the operator makes sure the person can see it: it says where to look, or relays the team's attach commands unchanged when the view can't open, explains dashboard versus the lead's pane, and asks whether they can see the team.
2026-10-06 07:49:20 -07:00
Mike Schwarz 52b5c86a2b fix: connect the install handoff to the operator conversation (#878)
The installing agent can now get the person to the operator's conversation without herdr or cmux: the install guidance gives an exact tmux attach command (safe from inside tmux), says rig tui --shared is the dashboard, and forwards later goals to the operator; a failed terminal view open lists the attach commands in its notes.
2026-10-06 05:33:36 -07:00
Mike Schwarz 2456a57205 fix: make bundle reinstalls actionable and preserve stopped-team edits (#877)
Installing a bundle for a team that is already installed now reports what is installed and the real choices (use it, stop and replace it, or cancel); a running team is refused before any write, and a stopped team is replaced in its own install folder with conflicting files backed up and the old generation archived, while other folders keep the first-install response.
2026-10-06 05:10:12 -07:00
Mike Schwarz 27c79fb6a4 fix(tui): disambiguate rig and agent specs with the same name (#874)
The TUI opens the spec the person chose when a team and an agent share a name: a bare name prefers the team, and explorer rows, detail links, member links, spec-of and Launch keep the selected kind.
2026-10-06 03:46:00 -07:00
Mike Schwarz 493669bc23 docs: finish installation with a kernel operator handoff (#873)
An agent installing OpenRig now keeps the kernel, treats installation as complete when the person is talking to the operator, and hands the person's goal and folder to the operator instead of building it: daemon start help, setup's next steps (launch commands labelled as the manual path), getting-started, the onboarding guidance, the operator's start steps and rig start's skipped-kernel message.
2026-10-06 03:38:18 -07:00
Mike Schwarz bf10c3976a feat(skills): add the rigs skill, a route into OpenRig (#872)
Adds the rigs skill at skills/rigs/SKILL.md, installable with npx skills add mvschwarz/openrig --skill rigs: it installs OpenRig if missing, starts or joins a team with existing commands, and explains how a session outside tmux keeps its identity and reads replies through the queue.
2026-10-06 03:12:00 -07:00
Mike Schwarz 289894e28d test: check shipped first-run references against product catalogs (#869)
npm run test:repo now checks that every team, seat address, skill, rig command and path named in the shipped first-run text exists, reporting file and line for any miss; external workshop references are reported as unchecked.
2026-10-06 02:10:02 -07:00
Mike Schwarz 200606a514 docs: say the new team names in shipped text (#866)
Shipped docs, skills, help and onboarding text now name the new built-in teams: starter, workshop and factory, plus the code-review, research and pm shelf. first-project is mentioned only as starter's old name, Codex-only readers are pointed to the kernel operator to adapt a team, and secrets-manager stays listed as built in. Skill mirrors and edge digests are regenerated.
2026-10-06 01:47:57 -07:00
Mike Schwarz 44e47baacb fix: keep secrets-manager built in (#868)
secrets-manager stays a built-in team: its rig.yaml returns unchanged, so it is listed and launched as before, and the library and packing tests expect it again.
2026-10-06 01:46:57 -07:00
Mike Schwarz f18d3d870d feat(tui): show rig specs as graphs with Launch (#867)
A rig spec in the TUI now opens on the same graph an installed rig's graph tab draws, built from the served spec graph. A Launch action asks for an absolute working folder, shows the exact command, and runs the ordinary rig up through the same CLI, returning to the TUI on Enter. Ctrl-C during a launch interrupts rig up without closing the TUI.
2026-10-06 01:40:37 -07:00
Mike Schwarz b4548482cf docs(kernel): the operator asks the goal first and offers three teams (#862)
The kernel operator asks the person's goal first, then offers starter, workshop and factory with one recommendation and a diagram from each team's spec. On a machine without a provider a built-in team needs, it writes an adapted copy of the whole spec folder under the same team name. The workshop installs once in ~/rigs/workshop. The operator launches only on a yes, reports readiness honestly, shows the new team without taking over the person's terminal, and hands the original goal to the team's lead.
2026-10-06 01:24:16 -07:00
Mike Schwarz 866ac40ea9 docs(specs): the team lead's first move, and the factory advisor's role (#865)
The starter builder and the factory lead start from the goal the kernel operator hands them instead of asking again. For real continuing work they reuse a matching mission or record one light mission and slice with rig scope, then offer to plan and build; a question gets a direct answer. The factory advisor works as the idea and intent partner and hands outcomes to the lead. Each is a required startup file delivered as text at launch and restore.
2026-10-06 01:23:15 -07:00
Mike Schwarz d1e9d5e5d7 feat: simplify the built-in team shelf and keep first-project compatible (#864)
The built-in team shelf now offers starter, factory, code-review, research and pm, alongside the unchanged kernel. Starter has a Claude builder and a Codex reviewer; factory has a lead, an advisor, build, QA, design and two reviewers, with the advisor reusing the PM agent through its own profile. first-project still starts starter, after exact library IDs and names, and says the team's providers changed and how a Codex-only machine adapts it. The folders of removed or renamed teams keep their CULTURE.md so existing rigs restore after upgrade. The implementer and QA defaults and the recommended skill routing no longer select test-driven development; the optional skill remains for existing user specs. factory-rsi and secrets-manager move toward openrig-world bundles.
2026-10-06 01:04:22 -07:00
Mike Schwarz 5b05076b82 fix(codex): recognize the current update menu header (#861)
Codex 0.160.0 shows its update menu with the header "Update available · <from> → <to>", which OpenRig's update-menu recognition did not accept, so a Codex seat stopped at the menu at launch and timed out. Both recognizers now accept the current header as well as the old one. A copied header above a live prompt is not treated as a menu; the existing skip safeguards are unchanged.
2026-10-06 00:12:38 -07:00
Mike Schwarz decf641773 feat(kernel): the operator greets first and helps pick a first team; allow two provider checks (#858)
After install, the kernel operator is the first agent a person talks to. On first contact it greets them, asks what they want to work on and helps them pick a first-project starter: it shows the team from its real spec, plans it in their own project folder and launches only after they say yes, then reports honest readiness. The advisor no longer introduces itself. Kernel Claude seats may now run claude auth status and codex login status without an approval prompt; nothing else in their permissions changes.
2026-10-05 22:56:15 -07:00
Mike Schwarz 5653be8492 docs: offer the kernel view before the first project team (#859)
After setup, the guided path now reaches the OpenRig view before any starter team: check the selected login, start the daemon if needed, read the kernel's actual state, and ask "Open the OpenRig view now?". Yes opens a new space without taking over the current terminal; No and SSH get the command for later. The person then tells the operator their goal and chooses a first project team. Setup's closing steps, the getting-started guide, help and the installing-agent onboarding say the same thing; started is not called ready.
2026-10-05 22:32:58 -07:00
Mike Schwarz 71276237ce fix(terminal): show all kernel conversation roles by default (#854)
The default saved:kernel view now opens TUI, advisor and operator on every kernel, including single-runtime ones, where the operator was previously hidden. The default view draws them as one row of three columns on herdr and cmux; saved views and other views keep the existing grid. Guide, help, setup and onboarding text describe the same view.
2026-10-05 22:12:43 -07:00
Mike Schwarz ed9dc3d7c3 docs(as-built): correct five citation line numbers stamped to 82eb4bed (#856)
Corrects five source citation line numbers in the as-built architecture pages (stamped to 82eb4bed): two reversed ranges, one range that stopped short, and two single-line references that pointed at the wrong line. The behavior each sentence describes is unchanged.
2026-10-05 22:02:01 -07:00
Mike Schwarz d3ae73b2f2 fix(cli): state the limits of doctor readiness output (#855)
rig doctor ended a run with no failures with "System checks look good." even when WARN or SKIP rows remained, and nothing said it does not check provider logins or whether agents can work. Its help now names what it checks. The closing line points at any WARN or SKIP rows and says this is not an end-to-end readiness verdict. It then names the selected providers' status commands and how to look at the team. JSON output, checks and exit codes are unchanged.
2026-10-05 22:01:42 -07:00
Mike Schwarz 7a6105470b fix(install): clarify supported Node installation advice (#853)
The install wrapper's Node advice suggested the distribution package manager without saying that it can supply an unsupported Node version. On stock Ubuntu, apt gives Node 18, which the package's compatibility check rejects. The plan and the missing-prerequisite message now name Node.js 22 or 24, say to check node --version, and point to the official installer or the getting-started guide's Linux route. Commands, checks and exit statuses are unchanged.
2026-10-05 21:50:34 -07:00
Mike Schwarz 47bfadfa77 fix(cli): name failed setup steps in closing guidance (#842)
When rig setup ends with failed steps, it now names each failed step and its fix (for example a harness that isn't logged in, with its login command) instead of only pointing to rig doctor, which checks the system but not harness logins. It also says that only the harnesses selected for the project need a login. Exit codes and JSON structure are unchanged.
2026-10-05 21:07:31 -07:00
Mike Schwarz 0f2ea7dfac fix(install): run the installed compatibility checker explicitly (#841)
npm 11 and later can skip @openrig/cli's postinstall script, which checks that Node.js and the SQLite binding work together. The one-line installer now runs that checker itself after installing the package, stops with the checker's own output and exit if it fails, and says plainly when the checker could not be found. Nothing on the machine is changed to make the check pass.
2026-10-05 20:54:10 -07:00
Mike Schwarz 572dba831d docs: Node on Linux, the npm 11 install-scripts warning, and cmux on macOS only (#839)
From a blank-machine install on Ubuntu 24.04: the README and getting-started now name a Linux route to a supported Node.js (nvm or NodeSource, since the distribution's own may be 18), say cmux is macOS-only and optional, and explain that npm 11 and later can skip the CLI's postinstall Node.js and SQLite check with an install-scripts warning, which is expected, and how to run that check directly.
2026-10-05 20:47:22 -07:00
Mike Schwarz 09384907cb feat(install): add an explicit one-line setup wrapper (#832)
Adds scripts/install.sh, an opt-in one-line installer over the existing commands. It prints what it will do, installs the published CLI, previews and then applies rig setup, and on failure names the step and keeps the command's own output and exit status. --dry-run only prints the plan. It uses the newly installed rig even if an older one is earlier on PATH, and it is safe to pipe into sh. It discloses setup's broader effects (provider tools, tmux and cmux defaults; on macOS setup may start cmux) and does not log in, choose permissions, launch a team or open a kernel conversation. The manual install instructions are unchanged.
2026-10-05 20:18:04 -07:00
Mike Schwarz e6aaeb6ccc docs(tui): explain copying wrapped attachment commands (#833)
When the TUI shows plain-terminal attach commands because Herdr is unavailable, it now tells the person to widen the terminal until a wrapped command fits on one line before copying it. Tests cover the warning at the narrow detail width and the exact local attach command.
2026-10-05 20:17:34 -07:00
Mike Schwarz a60bf42b97 feat(terminal): provide a default kernel conversation view (#830)
`rig terminal open saved:kernel` now works without editing YAML. With no saved kernel view, OpenRig builds one in memory from the installed kernel's actual bindings (advisor, operator and TUI; advisor and TUI for a single-runtime kernel) and opens it through the existing view and provider path. Missing or unbound roles are named absent with a reason; if nothing can attach, the result names every missing role instead of opening an empty view. A user's own kernel view still wins, and opening never starts, restarts or restores a seat. Getting started, help, the README, setup's closing guidance and onboarding now point to the command.
2026-10-05 20:17:11 -07:00
Mike Schwarz 35d55ae286 fix(tui): give attachment commands when Herdr is unavailable (#831)
When Herdr is unavailable on the selected daemon, the TUI's terminal preview no longer stops at a dead end. It names the daemon and view, says to open a new terminal on the machine running that daemon, and lists each member's exact attach command (the composer's own pane command, with ssh -t for remote members). Nothing opens automatically.
2026-10-05 19:53:12 -07:00
Mike Schwarz fcef78aba5 docs(contributing): point contributors' agents at what already exists (#829)
Wires the contributor path to maps that already exist. developing-openrig's "Find your way" now points at the full rig --help list, the known problems in docs/reference/help.md, ROADMAP.md and the shipped skills index. It gives the capability map's checkout path, and after "How we judge changes" says where to look. CONTRIBUTING asks contributors to search issues and Discussions and check ROADMAP.md before proposing a feature. The openrig-skills and openrig-architect skills now send "changing OpenRig itself" to developing-openrig instead of a skill that does not exist. All mirrored copies and their edge digests stay in step.
2026-10-05 19:30:12 -07:00
Mike Schwarz e64c3aa667 docs(skills): point contributors at the capability map first (#828)
Adds a first row to the contributor skill's "Find your way" table pointing at the capability map (rig context get onboarding-width/public-what-you-can-do.md), so a contributor's agent checks what OpenRig already does before proposing a new command or calling a gap a defect. Both skill copies (.claude and .agents) stay identical.
2026-10-05 19:09:18 -07:00
Mike Schwarz 0ee020f1a6 docs(skills): ask whether an agent could do it before adding code (#827)
Adds one bullet to the contributor skill's "How we judge changes": OpenRig runs on agents working in context with tools, so before adding code for a behaviour, ask whether an agent with the right instructions and existing commands could do it; a skill or a page of guidance is often the better change. Both skill copies (.claude and .agents) stay identical.
2026-10-05 18:09:08 -07:00
Mike Schwarz b02986a534 docs(as-built): verify the A-D as-built pages against 82eb4bed (#826)
Restamps the 13 as-built A-D pages to 82eb4bed. Citations move with their source: 174 line numbers are renumbered, and one cited block grows by a line. Adds the kernel operational default (who gets it, the Claude allow list, Codex full_bypass, the per-launch decision, the floor fallback, the kernel_default status source) and the plugin skills now carried in the managed loadout with their three warnings. Updates the file counts that changed.
2026-10-05 16:33:49 -07:00
Mike Schwarz 2fa61d1efe docs: cut delta to 82eb4bed (the kernel's launch default, the Codex network clause) (#825)
Brings four reference pages up to the 0.6.6 candidate: kernel seats launch with an operational default (Claude acceptEdits plus a per-launch allow list including reads under home; Codex -s danger-full-access -a never) unless a policy, per-seat choice or named Codex profile applies. getting-started now says Codex network access is added only when Codex answers that no configuration layer or managed requirement governs it, and the launch is unchanged otherwise.
2026-10-05 16:17:39 -07:00
Mike Schwarz 82eb4bed0f docs: open a new kernel conversation space after installation (#821)
After installation, the installing agent tells the person it will open a terminal so they can see their OpenRig agents, then opens a new space with existing tools: herdr, else cmux, else a plain terminal window. The first space shows the kernel advisor, the operator agent and the OpenRig TUI for a dual kernel, or the advisor and the TUI for a single-runtime kernel; it never takes over the installing agent's terminal or an existing space. Getting started gives the same steps as exact commands for a person, with session names taken from the kernel inventory, and on a headless or SSH target it says so and gives the exact attach command. The README, help, onboarding guide and setup's final text point to it.
2026-10-05 15:49:59 -07:00
Mike Schwarz 236f9a0c75 fix(kernel): apply per-launch operational authority (#820)
Seats of the rig named kernel get an operational launch default, carried through fresh launch, continue, restore and same-seat handover. Claude launches in acceptEdits with per-launch allowances for Skill, file tools and operational command families, including reads under the user's home; it is not bypass mode, and explicit ask and deny rules still apply. Its file tools are not workspace-limited for writes. Codex launches with danger-full-access and approvals never: unsandboxed host access within the OS user's rights, not a command allowlist. Explicit seat choices, authored policies and named Codex profiles keep their meaning, other rigs keep their defaults, and if the kernel lookup cannot run the launch keeps its prior permission behaviour. The kernel's culture and role guidance explain how to hold this authority and the lifecycle consequences of down, restore and import.
2026-10-05 15:48:56 -07:00
Mike Schwarz 0757c7a812 docs(agent-spec): a selected plugin's skills reach Claude Code and Codex seats (#823)
The agent-spec plugins row now says that Claude Code and Codex don't read skills from a projected plugin folder, so when a seat is instantiated a selected plugin's skills are also projected into its skill folder (.claude/skills/<name> or .agents/skills/<name>) under their plain names, and that a same-named folder OpenRig doesn't own, ignoring letter case, is left alone with a plugin_skill_kept warning.
2026-10-05 15:44:22 -07:00
Mike Schwarz a3b3592978 fix(tui): open work views without requiring a running rig (#818)
After a successful catalog read, the TUI now opens its ordinary work views even when no rig is fully running, so a person who has just installed OpenRig reaches their team without a hidden extra key. Start and return stays reachable for setup and recovery, nothing is started, resumed or reset by opening views, degraded and unavailable states stay visible, and any key the person presses still ends automatic entry.
2026-10-05 14:57:47 -07:00
Mike Schwarz ddedb97658 perf(daemon): keep display metadata out of recent-history sorts (#816)
The recent-transitions read no longer carries tags, summaries and session display columns through the scoped history window, the LAG and the final sort. Display metadata is looked up only for the newest qualifying rows, in the same statement and read snapshot. The scope-eligibility joins, the full per-item live and archive sequence, ordering and normalisation are unchanged, and so are the returned rows. The history scan and its sorts still grow with history; this reduces the working set.
2026-10-05 14:35:51 -07:00
Mike Schwarz d1c72756e8 fix(skills): deliver selected plugin skills to Claude Code and Codex seats (#815)
A selected plugin's skills now reach Claude Code and Codex seats: they are projected into the project skill folders through the managed skill loadout, under their plain names, when a seat is instantiated. An edited, kept or unreadable plugin copy never blocks a reconcile or a launch: it is kept with a warning, and a deselected edited copy is left in place unmanaged. A plugin skills path that is a file or unreadable gives no plugin skills and a warning. An existing user folder that matches a plugin skill's name ignoring case is treated as the user's and left alone. Catalog skills that do not come from a plugin behave as before.

Scope: instantiate paths only. Seats that already exist get the plugin skills when they are next freshly instantiated; continue and restore reconciliation is later work.
2026-10-05 14:13:01 -07:00
Mike Schwarz e80efb7150 fix(daemon): read Claude's other permission-mode footers below status warnings as idle (#814)
When one of Claude Code's status warnings (for example a failed auto-update, tmux focus events or a usage-limit notice) sits below the footer, an idle seat in any permission mode (default, auto, plan, bypass permissions, with or without vim mode) now reads idle. Before, only the exact accept-edits footer did, so rig compact refused those seats and send --wait-for-idle timed out. A draft in the composer keeps its existing reading. A status line showing a running hook ("running PostToolUse hook · 3m 12s") now reads as active work instead of idle. Refs #808.
2026-10-05 12:57:58 -07:00
Dery Ferdika 8f29405f5e fix(claude): quote authored fork parent ids on the default launch path (#773)
On the default (non-managed) Claude launch path, the fork command now passes the parent session id through the existing shellQuote helper, like the --model and --effort values beside it. An authored fork parent id therefore stays a single literal argument when the pane's shell runs the command. Valid ids produce the same arguments as before; managed Claude and Codex already quoted this value.

Thanks to @DeryFerd for the change.
2026-10-05 12:40:05 -07:00
Mike Schwarz a9d3e05fd7 fix(cli): start the local daemon for context add (#784)
rig context add now starts the local daemon when it isn't running, using the same local daemon-ensure path as other commands, instead of stopping with "Daemon not running". An explicitly selected remote host still wins over a leftover local daemon.json, and commands that don't need a daemon are unchanged. A selected host is normalized the same way as the client URL before deciding whether it's local, so LOCALHOST and IPv6 loopback spellings (::1, [::1], the expanded form) count as local.
2026-10-05 11:57:10 -07:00
Mike Schwarz da230f5b00 docs(bundle): say rig names on openrig.dev/rigs are unique (#810)
The publishing guide's "Submit it to openrig.dev/rigs" section now says rig names are unique on the site. If registry/<your-team>.yaml already exists, the registry check says the name is taken; choose a distinct one, for example <taken-name>-<your-name>.
2026-10-05 10:14:02 -07:00
Mike Schwarz 03d6f7baa2 docs(tui): complete the Escape order (external links, health view) (#806)
packages/tui/README.md: complete the Escape order for ordinary browsing, from an after-merge source check. Escape clears typed command text first; with history it returns from a spec detail, an open file or an external link and restores the previous filter; otherwise it closes an open health view, then clears a filter, then goes back (resolveEscapeAction, packages/tui/src/input.ts). Text only; no behaviour change.
2026-10-05 05:42:03 -07:00
Mike Schwarz e428972a18 docs(as-built): correct five architecture claims from the post-merge check (#805)
Five corrections to the as-built architecture pages from an after-merge source check at fcaf1f8e. Text only.

- content-surfaces: a non-empty files or progress root value is not validated; malformed entries are skipped silently, so a malformed value can leave no configured roots.
- mission-control: a missing annotation, destinationSession or decision returns 400; a drop without reason is refused by the audit record and currently returns 500; resolve answers 409 qitem_not_leg1_parked for an item not parked on a human seat.
- coordination-primitive: transport:v1 is recorded only for a direct request from a known origin; otherwise origin-unknown:v1, relay:v1 or claimed:v1.
- workflow-runtime: a revision may change exception_routing, which applies to future occurrences only.
- living-notes-review: the TUI calls only the fleet review read.
2026-10-05 05:30:29 -07:00
Mike Schwarz e894d72e5b docs(as-built): correct four test-layers claims from the post-merge check (#804)
Four corrections to docs/as-built/test-layers.md from an after-merge source check at fcaf1f8e. Text only.

- OPENRIG_REAL_CLAUDE_INTEGRATION=1 enables only a placeholder that checks the parent id format; no real-Claude fork test exists yet.
- Without tmux, some tmux tests skip and others fail; the release-tag tests skip without local tags unless CI=true.
- The stub carries the resolved floor or full_bypass posture, including one from permission_policy, into its runner, but ignores non-interruptive launches and does not exercise native permissions.
- rig seat launch <seat> --fresh needs --reason.
2026-10-05 05:15:17 -07:00
Mike Schwarz 38d47b7e83 docs: Docs Verify follow-ups for #796 (TUI Escape) and #799 (For You page) (#803)
Corrections from after-merge source checks of the TUI README and one web UI as-built page. Text only; no behaviour change.

- packages/tui/README.md: Escape first cancels command editing; on a spec detail page or an open file it then goes back and the list keeps its filter; elsewhere it clears an active filter before going back.
- docs/as-built/ui/project-and-for-you.md: queue-derived cards supersede only matching action-required or approval event cards; only the workspace and mission headers show the remote host chip; the maintenance-notice dismissal is persisted alongside the theme choice.
2026-10-05 05:15:00 -07:00
Mike Schwarz 2ef409adb8 docs(as-built): verify the coordination and work pages against fcaf1f8e (#793)
As-built coordination and work pages re-verified against fcaf1f8e for 0.6.6. Text only.

- coordination-primitive: create and handoff return the committed row and deliver a staged wake intent after commit (#776); identity provenance on every write route; closure-field and blocker rules; the stuck sweep's routing and custody check; queue retention scope; route surface.
- workflow-runtime: how each exit closes its packet, human gates park the owner's packet on the human seat, keepalives and the boot sweep, exception classes, resume and abort effects, graph revision rules.
- workspace-primitive: a new section on the project catalog and project selection; slice indexing by folder name and slice: tags; the doctor's eight checks.
- mission-control, living-notes-review, content-surfaces: my-queue resolution, verb validation, actor provenance, notification triggers; approval never fires the freeze; file asset preview headers, health-summary constants versus settings.
2026-10-05 04:48:27 -07:00
Mike Schwarz e923ce66f5 docs(as-built): refresh the web UI pages against main (#799)
The web UI as-built pages re-verified against main 104b78ee for 0.6.6 (previous stamps were from May). Facts only; the web UI is in maintenance mode. Text only.

- project-and-for-you: the classifier (human-gate gives approval), the attention merge and decision-first sort, the removed storytelling band, tab sets and defaults, the rewritten Dashboard.
- topology: TerminalLauncher, RigGraph for rig and pod scopes, rigs expanded by default.
- shell-and-routing: four missing routes, the /slices/$name redirect target, skill detail without FileViewer.
- library-specs-and-design-system: the Library page shape, seat details at /topology/seat/..., themes and the Pi and OMP marks.
- ui.md: the index stamp.
2026-10-05 04:40:23 -07:00
Mike Schwarz 32adf26cb1 docs: apply Docs Verify follow-ups for the #782, #788, #789 and #791 refresh PRs (#797)
Corrections from after-merge source checks of the README and the spec, context and startup references. Text only.

- README: a local rig bundle install needs --target (rig up and GitHub links default to the current directory); the Codex network default applies only when Codex confirms nothing sets or restricts it; builtin:auto keeps a named Codex profile and Pi's resource trust.
- agent-spec: filesystem skill discovery is for Claude Code and Codex (Pi uses only the skills folder beside the RigSpec; OMP does none); the auto hint also installs content starting # SKILL as a skill.
- agent-state-taxonomy and agent-startup-guide: the STARTUP, ORIENTED and RESTORE columns need rig ps --nodes --full.
- lore-routing, refocus-channel, project-workspace: rig context profile needs --situation; the light refocus trace previews about 800 characters of each LEARNED.md; a matching --project without a catalog reports selectedBy explicit.
2026-10-05 04:40:04 -07:00
Mike Schwarz f6358a2a7b docs: refresh ARCHITECTURE, DESIGN and the TUI and test-system READMEs against main (#796)
ARCHITECTURE, DESIGN and two package READMEs re-verified against main for 0.6.6. Text only.

- ARCHITECTURE.md: counts at c750304f (94 migrations through 095, 87 commands, 21 daemon exports, 15 scenarios, six runtime adapters with OMP extending Pi), middleware order, the four CI scenario cases, and current pointers.
- docs/DESIGN.md: the web UI is in maintenance mode; the dark token set and the three themes (default system); Pi and Oh My Pi marks.
- packages/tui/README.md: eight sections, one runtime dependency (yaml), rig tui and --shared, rig terminal open takes a view, nine tab names, the socket commands query.
- packages/test-system/README.md: fifteen scenarios, the transcript and capture cases run in CI healthy only, folder layout, and the four later scenarios carry planted negatives instead of seed steps.
2026-10-05 04:32:23 -07:00
Mike Schwarz ca208a692f docs(reference): correct claims from the post-merge checks of #783 and #785 (#795)
Five corrections from after-merge source checks of the operations and process references, each re-read at a350c59b. Text only.

- stream-classifier-worker: when the worker's own deadline fires first, the attempt records a retryable error or exhaustion, not an abstention.
- slack-app-setup: rig slack enable needs a readable human registry; a missing or invalid one is refused, and unregistered senders are not delivered.
- sdlc-conventions: an invalid C1 header is a medium finding (all stay advisory); slice create registers in mission.yaml only when the manifest exists; media without a covering proof artifact shows missing.
2026-10-05 04:32:06 -07:00
Mike Schwarz 9be129624e docs(as-built): verify test layers and arteries against fcaf1f8e (#794)
As-built test-layers and arteries re-verified for 0.6.6 (stamp fcaf1f8e; the running-inside-a-seat note reflects #780). Text only.

- test-layers: the cli, daemon and TUI suites share the root hermetic setup from #780 (selector scrub, fixture home, fetch guard, HOME/XDG/CODEX_HOME redirect unless OPENRIG_E2E_REAL_CODEX=1); gated real-provider tests; the TUI layer; launch through the seat launch environment, which no scenario reaches; scenario coverage, run-pr-scenarios options and the stale README notes updated.
- arteries: launch now includes seat-launch-environment.ts and the configurable readiness window; restore-check fixed by #139 and #328; migration ordering by name; addressing and rendered-delivery scenario coverage is partial.
2026-10-05 04:31:53 -07:00
Mike Schwarz 23f08bbd31 docs(as-built): tighten eight core-page statements against a350c59b (#790)
Eight corrections to the core as-built pages, each checked at a350c59b. Text only.

- adapters-and-runtimes: Codex with auto keeps a selected native profile, otherwise the workspace-write floor.
- agent-spec-and-startup: only the remaining after_ready actions run after interactive files; node.startup_proof_skipped is recorded only on fresh launches.
- architecture-rules-and-event-system: default sends never wait on busy or unknown, while --wait-for-idle opts into a bounded wait that can return unsent; delivery from the log applies inside withNotifyEnvelope, and legacy callers notify after commit; ANSI is stripped for tail and grep, not full reads.
- transport-and-transcripts: --dangerously-interact persists an audit record before sending and refuses without it; ANSI wording matches.
- daemon-core: transcripts are bounded periodic capture-pane snapshots, not pipe-pane.
2026-10-05 04:31:38 -07:00
Mike Schwarz b9ea007fab docs(as-built): correct profile seat atoms, handover reason, loadout and compaction auth (#792)
Four corrections from an after-merge source check of two as-built pages, each confirmed at a350c59b. Text only.

- plugin-agent-image-context-pack: rig and seat selectors supply a default seat:LEARNED.md atom only to named profiles that request seat context; rig skill loadout --runtime inspects and reconciles only with --apply, and rig skill audit is a separate read-only audit; the compaction routes use the terminal bearer middleware, which passes through when no token is configured.
- lifecycle-snapshot-restore: rig seat handover requires --reason (dry run included).
2026-10-05 04:01:31 -07:00
Mike Schwarz fda7cebde1 docs: correct six claims Docs Verify found in the bundle and first-run refresh (#791)
Six corrections from an after-merge source check of the bundle and first-run references, each confirmed at source. Text only.

- rig-bundle: identical target files avoid a target-content conflict but the rig-name check still applies; a carried pack is named by its archive folder.
- agent-startup-guide: the Claude submission check is bounded and can leave a seat ready with its submission unverified or staged; one final readiness recheck after delivery; rig seat launch --fresh needs --reason, and --stop to replace a live occupant.
- getting-started: --non-interruptive hides the Codex notices only when OpenRig itself selects full bypass.
- developing: which CI jobs run npm ci and build.
2026-10-05 04:01:06 -07:00
Mike Schwarz 104b78eef3 docs(projects): refresh the project, context and chain-file references against main (#789)
Projects, context and chain-file references re-verified against main (aa4ee793) for 0.6.6. Text only.

- chain-file-convention and legacy-topology-migration: CRAFT.md and ORCHESTRATION-CRAFT.md are chain names; startup delivers the rig spec's culture_file; the walkers also read NOTES.md and fall back to README.md; the legacy topology fallback covers only rig context trace (refocus trace, seat: atoms and handover priming read topology.root only); only product-team ships topology defaults today.
- refocus-channel: the content file is set in the harness environment (specs have no env key); a LEARNED.md practice reaches running seats through the refocus trace, a CRAFT.md practice only through configured refocus content; hook time limits.
- project-workspace: install never overwrites an existing project folder; work-install without a catalog; slice: tags are the authoritative queue-to-slice link, with mention-matching as the fallback.
- knowledge-maturity, lore-routing, mission-install, planning-dial: which commands enforce stage values, the rig and seat grant flags, walk's --seat-grant and --runtime, and where approved-spec-dial is recorded and shown.

Commands checked against the help inventory of a clean build of a350c59b.
2026-10-05 03:44:09 -07:00
Mike Schwarz c750304f73 docs: refresh the README, CONTRIBUTING, SUPPORT and SECURITY facts against main (#782)
Front-door documents re-verified against main for 0.6.6. Facts only; structure, voice and the README anchor are unchanged.

- README: rig setup installs a missing harness (and cmux on macOS); rig seat continue for a seat stopped at a prompt; the npm install table names rig and openrig-tui and adds a bundle-install row; Codex network access on the plain sandbox; the OPENRIG_YOLO, builtin:auto and --non-interruptive launch effects; restore outcomes, bundle links and checks, and the default culture; later release notes in CHANGELOG.md.
- CONTRIBUTING: tmux version in bug reports, the docs guard, context packs not committed, the UI suite runs in CI, and the skills locations.
- SUPPORT: the agent help page URL, the support email already published in help.md, and tmux and harness details in bug reports.
- SECURITY: the provider and project files OpenRig writes, and the tmux and cmux edits made by rig setup.
2026-10-05 03:36:51 -07:00
Mike Schwarz 7ba28077fb docs(specs): refresh the RigSpec, AgentSpec, edge, posture and state references against main (#788)
Specs and permissions references re-verified against main (fcaf1f8e) for 0.6.6. Text only.

- agent-spec: every example now validates (hooks are refused; plugins carry them); effort, mechanic, import version matching, qualified and unqualified resolution, wider skill resolution at launch, plugin projection per runtime, guidance target and merge as applied, and the shipped agents table.
- rig-spec: version and permission_policy rules, workspace, member fields (effort, permission_policy, role, compaction_strategy, mechanic, session_source, starter_ref), restore_policy narrowing; checkpoint hooks and continuity_policy are stored but not acted on in this version; unknown keys are refused.
- edge-types: spawned_by direction corrected; delegates_to also names the queue escalation target; the Attach line does not use edges.
- scoped-operating-posture and agent-state-taxonomy: store-unavailable answers 503, multi-project selection order, which axes are served today, and the other state vocabularies on the same surfaces.

Commands checked against the help inventory of a clean build of a350c59b.
2026-10-05 03:34:58 -07:00
Mike Schwarz f1dc6207e7 docs(as-built): verify the core architecture pages against a350c59b (#787)
As-built core pages re-verified against a350c59b for 0.6.6. Text only.

- adapters-and-runtimes: a new Launch posture section (builtinLaunchPosture and resolvePermissionPolicyAttachment in policy-ref.ts, bound per seat in rigspec-instantiator.ts; bundle-behaviour.ts is the read-only preview), Claude and Codex posture flags (Codex full_bypass adds -a never), non-interruptive arguments, legacy resume adapters, managed launch and bootstrap, terminal providers, and readiness attention codes.
- agent-spec-and-startup: the startup sequence as the code runs it (permission selection, identity prompt, checked Claude startup text, startup proof, rig seat continue), the startup file chain, and a Specialist rosters section.
- architecture-rules-and-event-system: startup, delivery and launch invariants and a Telemetry read surface section.
- daemon-core: counts (94 migrations through 095, 87 commands), AppDeps construction order and middleware order.
- transport-and-transcripts: the send flow (delivery lease and held messages, pane-ID writes, CLI --verify) and transcript capture.
- codemap: the launch-posture, rosters and telemetry rows point at the new sections.

Changed citations were checked by printing each source line at a350c59b.
2026-10-05 03:32:41 -07:00
Mike Schwarz 3db2b16741 docs(reference): refresh the process guides against main (#785)
Four process guides re-verified against main for 0.6.6. Text only.

- sdlc-conventions: wave composition reads mission.yaml arrangement.waves, with the wave-map queue row only as the fallback when mission.yaml is missing or malformed; slice.yaml execution.depends_on takes precedence; the audit is rig scope audit --mission and exits 1 only on high-severity structural findings; the proof-lock does not fire a freeze; plan-lock --locked-artifacts and --re-approve described; scaffold outputs updated; stale section references fixed.
- product-journey-sdlc: selections carry explicit edges, some file must name the catalog, references resolve from the Git root of the repository holding the catalog YAML, and rig workflow guidance reads the effective selection.
- product-management-pass and release-boundary: the slice-create --intent flag and where the capability delta lives and expires.

Commands and flags checked against the help inventory of a clean build of a350c59b.
2026-10-05 03:30:54 -07:00
Mike Schwarz 6ce7ec2089 docs(reference): refresh the operations references against main (#783)
Seven operations references re-verified against main for 0.6.6. Text only.

- browser-access: the web UI works over http on the daemon port at any accepted address, including the Tailscale name; OPENRIG_ALLOWED_ORIGINS is needed only for a UI served another way, such as https through your own domain.
- slack-app-setup: invite the bot before rig slack verify, and register a human with rig gateway human add before rig slack enable, which refuses without one; verify warns on missing feature scopes.
- health-diagnosis, host-resources, inventory-request-diagnostics, stream-classifier-worker, telemetry: fields, bounds and stop conditions corrected to match the code.

Commands and flags checked against the help inventory of a clean build of a350c59b.
2026-10-05 03:29:32 -07:00
Mike Schwarz 33eaeda30f test: isolate inherited OpenRig instance selectors across Node suites (#780)
Node test suites run inside an OpenRig seat no longer inherit that seat's instance. The daemon and TUI suites now use the same fixture-home and fetch-guard setup as the CLI suite (test/hermetic-env.setup.ts). OPENRIG_* and RIGGED_* instance selectors are cleared before product imports, so tests cannot reach the person's OpenRig home, database or daemon endpoint.

Ordinary runs also redirect HOME and the XDG directories and clear CODEX_HOME. With OPENRIG_E2E_REAL_CODEX=1, the real HOME, CODEX_HOME and XDG directories are kept, so the opt-in real-Codex tests run as before. Explicit fixture overrides set after setup still apply.

Test-only; no product code changes. Controls against disposable outer audit, SQLite and HTTP targets fail with the old setup and pass with the new one. Not covered: subprocess globals and hardcoded filesystem targets outside the fetch guard.
2026-10-05 03:25:13 -07:00
Mike Schwarz aa4ee793cd docs(as-built): verify lifecycle, packaging and content-library pages against a350c59b (#781)
Re-verifies `docs/as-built/architecture/lifecycle-snapshot-restore.md`, `packaging-bootstrap-bundles.md` and `plugin-agent-image-context-pack.md` against main `a350c59b` and restamps them. Corrects restore-check's verdicts (an `unknown` branch and a `restore-preconditions` check), where a pod-aware bundle's content is routed (inside bootstrap, before any seat launches) and how guided compaction holds `/compact` behind a restore map, and adds the features since the old stamps, including topology rosters, restore receipts, `rig seat continue`, seat handover, GitHub folder links, `rig bundle check`, configurations and package identity, System World, recaps, skill loadouts, `rig compact` and `rig fork`. Part of the 0.6.6 developer documentation refresh. Text only.
2026-10-05 03:14:04 -07:00
Mike Schwarz fcaf1f8ee8 docs(first-run): refresh getting started, the startup guide, help and launch docs against main (#779)
Refreshes `docs/reference/getting-started.md`, `agent-startup-guide.md`, `help.md`, `developing.md`, `worktree-builds.md` and `non-interruptive-mode.md` against main. Corrects a `rig seat set-permissions` example that didn't resolve, the startup layer order (culture before rig), the documented `resources.hooks`, which validation now refuses, and a known problem fixed in 0.6.5. Adds the recovery path after a startup gate (`rig seat continue`, the startup attention line), Claude's bypass warning and `--non-interruptive`, `builtin:auto`, the readiness window and startup proof, and `npm ci` plus build for development. Commands checked against a help capture of `a350c59b`. Part of the 0.6.6 developer documentation refresh. Text only.
2026-10-05 02:42:45 -07:00
Mike Schwarz 596b389506 docs(as-built): regenerate the CLI reference from the a350c59b command tree (#778)
Regenerates `docs/as-built/cli-reference.md` from a help capture of main `a350c59b`: 87 top-level registrations, 352 registered commands and 1,072 options (previously 85, 341 and 1,026). New since the last stamp: `rig bundle check`, `rig bundle configurations`, `bundle create --preset`, `rig seat continue`, `rig roster`, `rig telemetry`, and new options on `up`, `bundle`, `bootstrap`, `ps` and `seat set-permissions`. All 10 repeatable options are now marked. Part of the 0.6.6 developer documentation refresh. Text only.
2026-10-05 02:36:11 -07:00
Mike Schwarz 04c7ed81be docs(bundles): refresh the bundle reference, formats and publishing guide against main (#777)
Refreshes `docs/reference/rig-bundle.md`, `bundle-formats.md` and `publishing-a-rig-bundle.md` against main `a350c59b`: adds the flags they were missing (GitHub links, `--non-interruptive`, the install pre-check overrides, `--allow-drift`), states what `--plan` does and doesn't do, notes that `rig up` on a local archive skips the install pre-checks and audit, removes duplicated sections, and adds to the publishing guide what the optional `bundle.yaml` and `configurations.yaml` hold, what `rig bundle check` checks and exits with, the full-commit-ID rule for links, and what links need. Every command and flag was checked against a help capture of that commit. Part of the 0.6.6 developer documentation refresh. Text only.
2026-10-05 02:35:42 -07:00
Mike Schwarz 49013002b5 fix(queue): return persistence receipts before wake delivery (#776)
`rig queue create`, `rig queue handoff` and `rig queue handoff-and-complete` return their committed queue state without waiting for a slow terminal wake. Ordinary create stages the existing deterministic wake intent inside its transaction; all three schedule delivery after commit, reusing the existing intent claim, finalize and startup recovery. A crash between commit and delivery leaves a pending intent that recovery drains once; an abandoned send stays indeterminate and is never replayed automatically.

If create can't retain the wake intent, including when the target's held-message quota is full, partial intent writes roll back, the task is still saved, and the receipt reports `failed:wake not retained: <reason>`. No quota is bypassed and no retry is added.

The receipt now confirms persistence, not notification: its `lastNudgeResult` is normally null at receipt time, and the wake result is read later with `rig queue show <id>`. Client-minted IDs, same-ID reconciliation and the changed-body warning, `--no-nudge`, explicit `--verify`, forwarded target acknowledgement and the best-effort path for callers without an outbox are unchanged. No exactly-once delivery is promised.

Refs #766
2026-10-05 02:27:49 -07:00
Mike Schwarz 763f4237e8 docs(as-built): verify the index, codemap and navigation pages against a350c59b (#775)
Re-verifies the as-built index (`docs/as-built/README.md`), `codemap.md`, the architecture navigation page and `frontmatter-schema.md` against main `a350c59b` and restamps them. The codemap adds a "Newer entry points" table naming the source starting points for GitHub-link bundle sources, `rig bundle check`, `builtin:auto` and the other built-in permission policies, non-interruptive launch arguments, the instance YOLO setting, `rig seat continue`, `rig context work-install`, rosters and telemetry, each with its nearest module page. Part of the 0.6.6 developer documentation refresh. Text only.
2026-10-05 01:57:24 -07:00
Wu Shuwen 9b88b118d5 fix(daemon): isolate default Compose projects per rig (#481)
Distinct rigs whose names sanitize to the same string no longer share a default Compose project. A new rig's default project is derived from its rig ID; an explicit `services.project_name` is kept; and a re-import that replaces stopped generations inherits the project of its actual predecessor from the existing archive operation.

If the replaced generations recorded conflicting Compose projects and the new spec sets none, import stops before starting any service with `compose_project_conflict` (HTTP 409 on the import route), naming the conflicting generations and projects and how to set `services.project_name` and retry. No menu or prompt is involved.

Teardown of an archived rig no longer stops a Compose project that a live rig of the same name still records. It keeps the project and reports "kept project … still used by rig …" as a teardown error, so a local `rig down` exits 2 in that case, as it does for other teardown errors. Two live generations never skip each other's teardown. Rollback limits are unchanged: restoring selected configuration fields is not a full database or Compose-volume rollback.
2026-10-05 01:45:05 -07:00
adampog a350c59b5a fix(setup): make --dry-run report macOS-only steps as skipped off macOS (#769)
Off macOS, `rig setup --dry-run` said the `brew` and `cmux_install` steps "would be attempted", but the real run skips both there. The dry run now reports them as skipped with the real run's own messages, which become shared constants. macOS output, step statuses and exit codes are unchanged; only those two messages differ off macOS, including in `--json`. If cmux is already installed off macOS, the real run checks it, while the dry run still reports it as skipped.
2026-10-05 00:39:17 -07:00
adampog c36c983581 fix(scope): quote mission name in NOTES.md frontmatter (#768)
A mission name containing `: `, `#`, quotes or a leading `-` wrote NOTES.md frontmatter that YAML can't parse, so `rig workspace validate` rejected the new mission. The built-in NOTES template now writes `name:` with `JSON.stringify`, which is a valid YAML double-quoted scalar for any name, so every newly scaffolded NOTES.md quotes it. Plain names read back unchanged, names YAML would have typed (`1.0`, `true`) now stay strings, and existing NOTES.md files aren't rewritten. The same applies when a mission's intent sentence is used as its name. A custom `OPENRIG_NOTES_TEMPLATE` keeps `{{mission_name}}` and can use the new `{{mission_name_yaml}}`.
2026-10-05 00:39:01 -07:00
adampog 4f3952e0c1 fix(kernel): stop asserting the user's OS in advisor startup context (#770)
The kernel advisor's startup context said "The user is on macOS". OpenRig runs on macOS and Linux, so the context now says not to assume which, and to check (for example `uname -s`) when it matters. Text only.
2026-10-05 00:38:42 -07:00
Mike Schwarz 80531b3225 docs(onboarding): work-install stops only when several projects stay ambiguous (#772)
Onboarding 02 said `rig context work-install` stops with `project_required` whenever several projects are declared. Since the work-install selection order landed, it first picks by the calling seat's rig and the working directory, and stops only when more than one candidate remains. The paragraph now says so and points to the selection order in `$OPENRIG_HOME/reference/project-workspace.md`, which the daemon copies from `docs/reference/` at start. Text only.
2026-10-04 23:38:14 -07:00
Mike Schwarz b5a9deafd5 test: retain issue 728 reporter picker captures (#765)
Adds the issue #728 reporter's Claude Code 2.1.289 question-picker capture from macOS (a 160x50 pane; the posted excerpt is lines 17-33, and the other rows are blank) and their one-line constructed wrapped-description variant as fixtures. Both classify as `attention` / `selection_prompt` with `❯ 1. us-east` as evidence, at 12 and 13 non-blank lines from the bottom. The variant is the shape that returned `unknown` on 0.6.4. Test-only; product code is unchanged.
2026-10-04 22:28:52 -07:00
Travis Powell 2cc9de9579 fix(daemon): send an OMP seat the endpoint its provider key is scoped to when set (#744)
An OMP seat whose model is written as `provider/id` for anthropic, openai or litellm now receives that provider's base URL (`ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL`, `LITELLM_BASE_URL`) alongside its key. Before, `collectAllowlistedProviderAuthEnv` dropped `LITELLM_BASE_URL` at launch even when it was allowlisted, and `buildPiChildEnv` dropped all three at the OMP child, so OMP on a LiteLLM proxy failed to start and OMP seats behind an Anthropic- or OpenAI-compatible gateway went to the provider directly.

A new `OMP_PROVIDER_EXTRA_ENV_VARS` map names these variables, and both gates read it. They differ on purpose. The launch gate admits each name in `recovery.provider_auth_env_allowlist` for any OMP seat, when the daemon holds a value; each name stands alone, so an endpoint can be admitted without its key, for a keyless local proxy. The OMP child forwards an endpoint only to a seat whose declared provider matches, taking it from the runner's environment.

Behaviour change for existing setups: a daemon that already allowlists `ANTHROPIC_BASE_URL` or `OPENAI_BASE_URL` for a Claude Code or Codex gateway now sends OMP `anthropic/…` and `openai/…` seats to that gateway too; before this change they went direct.

Other OMP providers get no endpoint variable, and nothing new reaches Pi, Claude Code or Codex seats. Seven new tests.
2026-10-04 21:57:57 -07:00
Dery Ferdika c31c58051c fix(cli): bound the rig host pair --timeout so the wait cannot be infinite (#734)
`resolvePairTimeoutMs` keeps the existing resolution of `rig host pair --timeout` (blank, 0 and non-numeric values use the 600 s default; values below 1 s use 1 s) and caps the result at 2,147,483,647 ms, the ceiling `rig ask --wake-timeout` already uses. A timeout of `Infinity` or an overflowing number such as `1e306` no longer leaves the wait unbounded when the target stops answering. A finite value above about 24.9 days is also shortened to the cap.

No input is refused and exit codes are unchanged. Outside `--json`, a note names the bound when it applies.

With a reachable target the pairing request still expires after 10 minutes. A target that has lost the request, for example after a restart, answers `pair_unknown`, which the loop keeps polling until the timeout; that is unchanged here.
2026-10-04 21:45:29 -07:00
Mike Schwarz bd82e19960 docs(reference): submit a rig as a file in registry/submissions/ (#751)
Section 6 of the publishing guide now tells a submitter to add one file, registry/submissions/<your-team>.yaml, to openrig-world with three fields: repository (the GitHub repository URL), folder (the folder holding rig.yaml, or . for the repository root) and ref (a branch, tag or commit). The registry check accepts that file and says the submission was received. Opening an issue with the same three things still works. A maintainer then writes the full entry in the registry-entry.v1 format defined in the bundle formats reference.
2026-10-04 18:59:44 -07:00
Mike Schwarz ad0b39f2b9 docs(reference): add the guide to publishing a rig bundle (#750)
Adds docs/reference/publishing-a-rig-bundle.md: how to lay out a shareable rig bundle folder, check it with rig bundle check, share it as a GitHub folder link at a full commit, inspect and install from that link (rig bundle inspect, rig up with --target and --cwd), choose a configuration with --preset or --seat, and submit it to openrig.dev/rigs through the openrig-world registry, including what review promises. It ends with a block of instructions to give an agent that builds a bundle.

The commands match the shipped CLI; the registry entry format is defined in the bundle formats reference. The guide is installed with the other reference documents under the OpenRig home's reference folder.
2026-10-04 18:29:21 -07:00
Mike Schwarz f53558d982 fix(startup): confirm a Claude startup prompt accepted after the first look (#747)
Claude Code 2.1.289 can still show a just-submitted startup prompt as its collapsed paste label, [Pasted text #N +M lines], when OpenRig looks 200 ms after pressing Enter, and accept the prompt a moment later. The single look read that as an unconfirmed submission, so the startup-proof instruction was withheld and some seats did not orient.

When the first look shows that collapsed label alone, with M equal to the newline count of the text OpenRig pasted, OpenRig now re-observes the composer every 200 ms for up to 25 looks until it reads clear (including the queued-message placeholder) or staged. Staged still goes to the existing content-guarded Enter-only retry, followed by a single look. A person's draft, ghost text, a collapsed paste of another length, OpenRig's paste inside a draft, or any other mismatch keeps its first-look verdict with no wait, as before. No key is pressed beyond the existing retry. Each send waits at most once, about five seconds plus capture time; Codex and Pi are unchanged. When the result stays unverified after that wait, the diagnostic keeps both the first and the last look.

A person clearing a collapsed paste of the same line count inside that window would still read as submitted; the instruction would then go into an empty composer, not over their input. The trigger depends on Claude's current collapsed-paste label; if a later version changes it, the previous behavior returns (instruction withheld, with a warning). Follows up #743.
2026-10-04 17:33:05 -07:00
Mike Schwarz 3a906f5baf fix(cli): show startup attention and continuation guidance (#748)
Human output from rig up on a bundle link and from rig bundle install now lists each seat that needs startup attention, with the daemon's existing reason. When that seat has pending startup context, the reason ends with the command to finish it: After resolving it in <session>, run: rig seat continue <session>. Previously these commands printed only Status: partial, and the continue step was visible only in rig ps --nodes.

When rig seat continue is refused because no verified pending delivery exists, the human message now points at rig seat status for the seat's current state and says plainly that the response cannot tell an already-delivered context from one that was never pending.

JSON output, status values, exit codes, the daemon, the TUI and event names are unchanged.
2026-10-04 17:02:37 -07:00
Mike Schwarz 4f17654bfc fix: report skipped restore hooks and honor populated plans (#746)
When a restore cannot reapply a Claude seat's saved activity hooks (the relay or manifest is unavailable, or the settings file cannot be parsed), the restore now reports that as a warning instead of skipping silently. Restore status, the HTTP result and the exit code are unchanged, and existing settings are left as they were.

The Claude projection skip now requires both preserved startup context and an empty plan, so a populated preserved plan still projects, and fresh launches, including deliberate profile removal, are unchanged.

The lifecycle snapshot and restore as-built page now says that restore replays no startup files, actions, guidance or skills, except that the saved Claude activity-hook selection is reapplied before native resume, with a warning when that is skipped. Refs #273.
2026-10-04 16:40:34 -07:00
Mike Schwarz a8306cc96e fix: recognize current tall Claude question pickers (#745)
A tall Claude question picker can put its highlighted choice outside the recent-line scan, so an ordinary message could reach paste and Enter and become the answer when pane evidence is the only readiness signal. The current dialog is now recognized by its terminal navigation footer at the bottom of the captured view, joined to the contiguous option and description block above it, with columns preserved. Such a send is refused before input with the existing selection-prompt result. The general prompt window stays at twelve lines, and capture count and send policy do not change.

A picker left in history above a later, complete, empty Claude composer with a recognized mode bar or hint (accept edits, bypass permissions, auto, plan or shortcuts) now counts as finished, which removes a narrow false refusal; an arbitrary line under that frame does not clear it. Draft handling is unchanged. Fresh runtime hooks still take precedence, and ordinary sends to unknown or running seats remain advisory-and-send, so this does not protect picker screens bypassed by those fresh-hook paths.

Recognition is tied to the Claude Code 2.1.289 layout captured natively at 160 and 100 columns; other layouts fall back to the previous behavior. Committed fixtures keep only the dialog and dismissed-result bytes from those captures. Refs #728.
2026-10-04 16:25:39 -07:00
Mike Schwarz 106dbf867f fix: continue pending startup after Claude consent (#740)
A fresh Claude seat that stops at Claude's bypass-permissions consent dialog now keeps its startup context and is reported as needing attention. After the person reviews and accepts the warning in that pane, rig seat continue <seat> delivers the pending startup context in the same conversation, without relaunching. The existing TUI continuation remains available.

The continue hint now appears for every fresh-launch attention gate that has pending context, including login and workspace trust, and the human rig ps views print the full instruction outside the table so it is not clipped; JSON output is unchanged apart from the hint inside the existing error text. Runtime readiness no longer marks startup ready while this occupant has known pending context, so a seat no longer reads ready without having received its startup text.

The continuation reuses the existing occupant checks and consumes pending delivery before sending, so repeated calls do not replay it; a command timeout reports an unknown outcome without retrying. Ordinary sends, queue delivery, the delivery guard and explicit wait-for-idle do not read startup status and are unchanged. Recognition is bound to the retained English consent menu, not every Claude version or layout.
2026-10-04 16:18:51 -07:00
Mike Schwarz 6525f5f02f Recover Slack channel messages after connection gaps and report scan coverage (#742)
Slack messages posted while the connector was disconnected could stay in channel history without reaching OpenRig. On reconnect and on the existing periodic retry, the daemon now scans available top-level messages in the configured channel and passes them through the existing admission, routing, attachment and queue path. Recovered rows say they arrived late and carry the original posting time.

A durable per-channel checkpoint keeps unfinished pagination across restarts. Live events cannot advance it; a page advances only after each message lands, is confirmed as a duplicate, receives a policy disposition or reaches dead-letter custody. An upgraded install starts once from the newest retained channel landing, with older history reported as unknown; without landing evidence, coverage starts at feature adoption. Slack plan limits qualify older history without stopping delivery of the available page, and that limitation stays visible in status after restart. New scan intervals end five seconds before the local clock so recent posts can become visible; transport and server failures become eligible for retry after five seconds, and an explicit Retry-After is honored.

rig slack status keeps its local configuration output and adds bounded daemon observations: socket state, scanned and pending interval, recovery limits, retry time and per-connector counts, with ISO times for people and exact Slack timestamps in JSON. It calls no Slack API. No new dependency, migration, setup step or outbound message. Thread-reply catch-up and dead-connection detection remain open on the issue. Refs #739.
2026-10-04 15:57:46 -07:00
Mike Schwarz 5bf44c14a9 fix: restore startup proof delivery with Claude transient paste hints (#743)
Claude Code 2.1.289 can show a transient paste hint or the queued-message placeholder below its input box right after a startup prompt is submitted. The startup submission check did not recognize those frames, so submission stayed unverified and the startup-proof instruction was never sent; orientation then depended on the model acting without it.

The recognizer now accepts the transient paste hint, including the observed medium effort indicator, and treats the exact queued-message placeholder as an empty composer. A non-empty exact match against the expected text is checked first and still reads as staged. Collapsed pastes, unrelated drafts, ghost suggestions, other effort indicators and missing captures stay unverified. The proof-send gate and the guarded retry are unchanged: the instruction is sent only after a confirmed submission.

Replaying 143 retained Claude frames: 42 move from unverified to clear, 97 stay clear, and the four collapsed-paste and ghost frames stay unverified. This proves frame recognition, not native orientation; a real-harness run confirms that separately. Follows up #719.
2026-10-04 15:49:12 -07:00
Mike Schwarz a89c7f3400 fix: recognize idle Claude composers above status warnings (#735)
Claude can leave update, tmux-focus and weekly-usage warnings below its input box. After a resume these could hide a ready composer from an explicit wait-for-idle send. A complete empty input frame is now recognized across the supported warnings, with columns preserved so an indented multiline draft continuation cannot read as an empty prompt.

A visible composer or mode hint no longer proves the turn is finished. The current-block check covers framed composers and unframed empty Claude prompts with accept-edits, bypass-permissions, plan-mode or shortcuts hints; current timed work stays active through indented task rows, and a scan that exhausts its 20 lines inside that block returns unknown. Warning-suffixed idle requires a complete input frame.

Ordinary sends to running or unknown seats keep their advisory behavior and explicit wait-for-idle keeps its deadline. Hook precedence, SessionStart handling, occupant generation, input operations and Codex legacy-footer precedence are unchanged. Native Linux runs at an earlier head passed the first guarded send after resume, and their retained idle screens still classify idle at this head; no native run was repeated at the final head. Refs #273; based on merged #731.
2026-10-04 15:35:13 -07:00
Mike Schwarz 934b8e3b8b fix: check remaining Claude startup files and surface warnings (#736)
Remaining Claude startup files now use the same submission check as the initial prompt (one paste per body and at most the existing content-guarded Enter-only retry). A prompt that is still staged or unverified after that is reported as a warning on rig seat launch, restore status and receipts, import, bootstrap and the TUI, naming the pane to press Enter in only when staging was actually observed; warnings accumulate across later successes and failures.

The TUI shows multi-line launch warnings as wrapped, scrollable action details that survive layout changes and automatic background re-anchoring (intentional navigation dismisses them), and a failed follow-up status read keeps the successful launch result and its warnings without replaying the launch. Post-delivery readiness uncertainty has its own label for every runtime.

Readiness, exit statuses, async restore HTTP 202 and joined-resume identity rules are unchanged. The check adds about 200 ms per newly checked file when clear, and another 200 ms after a retry. Refs #729.
2026-10-04 15:13:54 -07:00
Mike Schwarz 44cf9b3d59 docs: clarify non-interruptive launch guidance and bundle assists (#741)
Clarifies the non-interruptive launch guidance and defines bundle-status assists.

- docs/reference/non-interruptive-mode.md: non-interruptive applies to builtin:yolo, a full_bypass flag policy or an explicit full_bypass selection; to turn it off, stop the rig with rig down <rig-name>, then run rig up <rig-name> --existing --no-non-interruptive (a running rig is refused before the saved choice changes).
- The --no-non-interruptive help on rig up and rig bundle install, and the launch summary, say the same.
- The before-install bundle view names rig bundle install <archive-or-link> --non-interruptive and says it doesn't check whether you've already accepted the warning on this machine.
- docs/reference/bundle-formats.md defines an assist: one action a person or the test runner took to get past a problem during the run, such as restarting a seat or re-running a command; following the bundle's own documented steps doesn't count.

No launch or status logic changes.
2026-10-04 15:02:42 -07:00
Mike Schwarz 6f783f67e1 feat: show non-interruptive availability in bundle views (#738)
Adds two optional facts to the bundle-behaviour v1 view: firstRunWarnings.claudeBypass (Claude Code asks once per machine to accept its bypass-permissions warning) for full-bypass Claude seats, and nonInterruptive: available for full-bypass Claude and Codex seats, matching the scope of rig up/rig bundle install --non-interruptive. They describe what is available, never a selected option or the host's acceptance state; nativeEffect stays unknown. Pi, terminal seats and unresolved policies carry neither. The CLI view renders the new lines only when the facts are present, so older views validate and render unchanged.
2026-10-04 14:42:02 -07:00
Mike Schwarz 1460b2fae4 feat: persist explicit non-interruptive rig launches (#737)
Adds an opt-in --non-interruptive option to rig up and rig bundle install (including GitHub links). For seats with declared full bypass (builtin:yolo, a full_bypass flag policy, or an explicit full_bypass selection), OpenRig passes per-launch flags so Claude Code's bypass-permissions warning and Codex's full-access and GPT-5.1 migration notices don't stop the seat: Claude --settings with skipDangerousModePermissionPrompt, Codex -c notice keys. Nothing is written to the person's settings files; launching without the option brings the warnings back. The GPT-5.1-Codex-Max notice is not suppressed.

The choice is saved on the rig (migration 095 adds a non_interruptive column, existing rigs off) and carried into later launches, restore, resume, forks and handovers; --no-non-interruptive clears it, omitting the flag keeps it, and --plan never changes it. A launch.non_interruptive operator setting (default false) applies to new rigs; the CLI flag wins. The default launch path is unchanged.
2026-10-04 14:28:48 -07:00
Mike Schwarz e1d9fec9da Document builtin:auto in the RigSpec permission policy field (#733)
docs: list builtin:auto in rig-spec.md's permission_policy row and the built-in policies prose, matching the five built-ins since #680.
2026-10-04 13:00:00 -07:00
Mike Schwarz 6c6a8aa1b4 Advance development main to version 0.6.6 (#732)
Development builds from main now report 0.6.6, so the contributor bundle's min_cli_version 0.6.6 check accepts a CLI built from main. Updates the root, CLI, daemon and UI package versions and their lockfile entries; TUI keeps its independent 0.1.0; dependency resolutions and CHANGELOG.md are unchanged. Published 0.6.5 remains the current release; this does not publish or tag anything.
2026-10-04 12:59:42 -07:00
Mike Schwarz 2affb18647 fix: preserve Claude activity hooks across native restore (#731)
A Claude seat restored with rig up --existing keeps its selected activity hooks: an exact restore re-applies only the saved claude_activity_hooks selection before the native resume (legacy and pod-aware) and no longer strips the hooks through an empty contained projection. No guidance, skills, startup files or actions are replayed, and profile changes made since launch aren't applied on a contained resume. Seats whose hooks an earlier restore stripped get them back on their next contained resume.

Native result (Linux, Claude 2.1.220, one run per case): hooks restored before the resumed process was first observed, and retained through fresh, down and up, with the same conversations and current-generation SessionStart events. The first rig send --wait-for-idle after resume still returned no_activity_signal in both cases; that is not fixed by this change. Refs #273.
2026-10-04 12:50:31 -07:00
Dery Ferdika c3c213eb51 fix(package): reject a path in an export name before planning (#725)
Refuses a package export name only when the path the install planner would write for it lands outside the selected install target. The check runs at the planner's own join for skills and agents on Claude and Codex, using path.relative from the target, and fails the plan with an ordinary plan error before anything is written. The tested contained destinations still install, including leading-slash, drive-letter-like, backslash, shallow '..' and empty agent names. Limits: validation alone still accepts such a manifest (refusal happens at plan and install), and this is lexical export-name checking only (no symlink containment).

Thanks to @DeryFerd.
2026-10-04 12:11:12 -07:00
Shravan Sumanthanan 30ff3dc5b9 feat(permissions): express declarative first-launch postures via permission_policy (#611) (#680)
Adds a first-launch auto posture through permission_policy: the built-in policy builtin:auto, or launch_posture: auto in a custom policy, at rig or member level. Claude seats launch with --permission-mode auto; Codex and Pi have no auto mode and launch at the floor, and rig seat status says why. Restore and handover keep using the seat's current policy (pod-aware restore included); NativePermissionStore.apply() re-applies only an explicit per-seat selection, plus auto for Claude when the binding's own posture is auto. rig policy list and show include auto, the before-install view reports it per runtime, and the rig-spec policy table has a builtin:auto row.

Thanks to @shravansumanthanan. Requested in #611.
2026-10-04 11:50:46 -07:00
Mike Schwarz 4ef185adf0 fix: verify version-labelled Claude panes during rebind (#730)
A Claude pane labelled with its native version (for example 2.1.289) now completes a fresh launch or clears an identity mismatch when the existing process verifier proves the saved token, foreground process, ancestry, OS executable path and stable identity across two samples. The non-strict rebind previously rejected that label as ambiguous without checking the process. The label alone is never identity evidence; a missing token stays non-positive; strict restore and periodic identity polling are unchanged.

Refs #273 (symptom 2 and the identity branch of 4).
2026-10-04 11:07:13 -07:00
Mike Schwarz 824cd1d2ab Bound Git hygiene listings to generated-file paths (#727)
Each worktree's Git listing in the generated-file hygiene helper is limited to the cwd-relative .codex/plugins/openrig-core/ directory, plus the owning worktree's exact new guidance paths for the tracked-file check, using literal pathspecs with icase where that worktree's core.ignorecase is true. A large ignored tree (node_modules, build output) no longer overflows the 2 MiB listing buffer and skips the exclusions. The ownership rules, warnings, buffer and five-second budget are unchanged.
2026-10-04 09:57:16 -07:00
Mike Schwarz 6dc29e2534 feat(daemon): add bounded inventory request correlation (#726)
Inventory requests that carry a valid X-OpenRig-Diagnostic-Attempt UUIDv4 now produce bounded, metadata-only request-phase records: server arrival, Hono entry, handler entry and exit, the root list's SQL span, response finish/close/abort, and dated event-loop delay from the existing 250 ms tick. They reuse the existing Node request listener, first middleware, slow-operation worker and rotated private log; there is no new timer, endpoint, dependency or migration. Admissions, active traces, phases, age, record size and writer backlog are capped, and loss is counted instead of delaying or refusing requests. Untokened requests are unchanged. Root GET /api/rigs joins the route timing aggregate. Legacy slow-operation outcome ok remains an observation-completion marker, not HTTP success.
2026-10-04 09:48:33 -07:00
Mike Schwarz 63aecb85f9 Warn on generated guidance and limit automatic Git exclusions (#721)
OpenRig keeps the files it newly creates under .codex/plugins/openrig-core/ out of a user's Git changes by appending exact, escaped entries to Git's own info/exclude in an OpenRig block; existing exclude bytes are preserved, and tracked, pre-existing or case-conflicting paths in this or a linked worktree are left visible with a warning. Newly created AGENTS.md, CLAUDE.md and CLAUDE.local.md stay visible: launch warns that the file is untracked and gives the optional exclude line, because Git shares info/exclude across linked worktrees. Git probes run once per worktree under one five-second budget; a timeout or failure warns and never refuses projection or launch. Warnings are returned through projection, startup and instantiation results. Entries persist after their files; existing entries are not removed, and plugin retirement at teardown is not included.
2026-10-04 09:16:27 -07:00
Mike Schwarz c3d29553a4 fix: verify shell-wrapped version-named Claude processes (#724)
Native Claude installs can report a version-named process (for example 2.1.289) with argv0 claude. Behind the classic launch wrapper's nested shell, the strict identity check rejected them, so seats showed attention required and rig seat clear-attention could not clear a stale failed restore. For those otherwise-unresolved candidates only, OpenRig now reads the executable path from the OS (/proc/<pid>/exe on Linux; one bounded proc_pidpath call through /usr/bin/osascript on macOS) and accepts the process when the path is the native installer's versions layout with a basename matching the process name, or the executable OpenRig launched. A version string alone is not accepted; token, foreground, ancestry and two-sample checks are unchanged. rig seat clear-attention help distinguishes it from reconcile-session. Refs #273.
2026-10-04 08:57:13 -07:00
Mike Schwarz e63784e8f7 Label per-seat facts in bundle behaviour previews (#723)
The before-install view labels per-seat lines with their seat. Runtime and login needs and per-seat unknown-before-launch entries gain an optional seat (pod.member) in openrig.bundle-behaviour/v1, and the human output prefixes them, and the existing also-runs entries, with the seat. Bundle-wide facts stay unlabelled, and views without the field print as before.
2026-10-04 08:32:19 -07:00
Mike Schwarz dcbbd78f5a fix: name seats in bundle skill precedence warnings (#722)
The skill_bundle_precedence launch warning is prefixed with the seat's session name and states that the managed catalog was not changed; the projection receipt detail now reads "projected exact selected source bytes". Selection and projection behaviour are unchanged.
2026-10-04 08:32:05 -07:00
Mike Schwarz ce7ed5c63c fix(startup): ask Claude seats to run the startup proof in their own turn (#719)
Claude seats now receive one short line after a delivered startup challenge, once the startup prompt is confirmed submitted: OpenRig, which launched this seat, asks it to read its startup text and run the startup-proof command from its orientation challenge. The line carries no challenge id or answer. It is not sent when the preceding submission is unconfirmed or staged, and a failed send is recorded as a warning. Ready and oriented remain separate; Codex seats and launches without a challenge are unchanged.
2026-10-04 08:25:57 -07:00
Mike Schwarz 73d6635390 feat(bundle): show declared setup preconditions before installation (#717)
A bundle's bundle.yaml can declare preconditions: [{name, commands?}]. Create carries them into the archive manifest for local and link builds, and the before-install view lists each as a need (kind precondition, status not_checked, with sourceRefs and the ordered commands); bundle-formats.md documents that the commands run in order in one shell and the install command runs where they leave it. OpenRig never executes them and adds no prerequisite check. A malformed preconditions block produces a create warning and is omitted instead of refusing the build; commands containing shell operators are kept with a warning. Package digest, configuration and source identity are unchanged; the archive hash covers the manifest.
2026-10-04 08:16:26 -07:00
Mike Schwarz 5f024424f1 fix: preserve selected bundle skill precedence through launch (#720)
A skill that a profile explicitly selects from inside its own agent spec's folder (an installed bundle, a rig folder, or an imported spec) now wins over a differing managed-catalog copy of the same identity, instead of failing the seat with skill_identity_conflict. Launch returns a skill_bundle_precedence warning naming both sources. The selected bytes and modes reach Claude/Codex managed reconciliation and Pi projection; the catalog is not written, unrelated selections are unchanged, and operator-edit protection still applies. Discovered and unselected copies still defer to the catalog. A qualified selection such as lib:shared is no longer matched against a catalog skill named shared; both are selected and project to separate targets.
2026-10-04 08:07:28 -07:00
Mike Schwarz dce8c90f41 Fix packaged bundle assembler identity and link failure output (#718)
The daemon's version helper prefers the build stamp, so packaged installs report their real version instead of unknown: bundle create records it as the assembler and provenance version, the before-install view and install audit name it, and GET /version returns it. Development runs keep the package.json fallback. A packaged daemon no longer refuses a bundle that declares a minimum daemon version merely because its own version read as unknown; only an actually older daemon is refused. rig bundle install and rig up print the daemon's error list as readable lines; JSON output and exit codes are unchanged. rig up --help names GitHub folder links.
2026-10-04 07:49:32 -07:00
Mike Schwarz 5c2d6e5394 fix(terminal): run tiles with the daemon's tmux and report panes that exit at once (#715)
Terminal tiles run tmux through the absolute path the daemon resolves, so a terminal provider with a narrower PATH keeps the tile attached instead of losing it; remote SSH commands still use the remote tmux. After a herdr page is laid out, one pane-list read marks a seat degraded only when the page's tab is confirmed and that seat's label is missing while another seat's label matches, or when only the layout's own filler panes remain; unclear or unreadable listings keep seats opened with a note. Seats with blank labels are never attributed. If every seat pane exits and herdr leaves unlabelled blank panes, the seats are still reported opened; the tmux-path fix removes the cause seen in the report.
2026-10-04 07:39:26 -07:00
Rudy Mizrahi Celekli 9cc1d58112 fix(daemon): require explicit boolean consent for service volume deletion (#668)
The env teardown route selects volume removal only when volumes is the JSON boolean true. Strings, numbers, null, and absent or malformed bodies take the ordinary teardown path instead of being coerced to true. No new 400 responses are added. Teardown without the override still follows the rig's configured down policy.
2026-10-04 07:28:24 -07:00
Rudy Mizrahi Celekli 7fd8d3f9d3 fix(compose): retain an explicit zero log tail (#673)
Compose service logs now pass --tail only for finite values, so an explicit zero reaches Compose as --tail 0, while undefined and NaN omit the flag as before.
2026-10-04 07:27:47 -07:00
Rudy Mizrahi Celekli c31fa2689b fix(cli): display successful empty rig captures correctly (#671)
A successful rig capture with empty content now prints empty output instead of "(error: no content)", for both the local --rig path and the --host HTTP path. Exit status is unchanged.
2026-10-04 07:27:33 -07:00
Mike Schwarz 22a4bb1342 Show archive behaviour before bundle installation (#710)
bundle inspect, and the plan and apply previews of bundle install and up, now describe what an archive will do before installation, in the openrig.bundle-behaviour/v1 format: the team, declared permission posture (posture[].permissionPrompts: off, on or default where stated), supplied files, startup actions, writes, outside addresses, needs, and what is unknown before launch. The view is derived only from the archive's files, cites its sources, and is informational: existing installation checks still decide the result. JSON output remains one result, and an unavailable description is reported as not_generated without changing a successful inspection.
2026-10-04 07:21:46 -07:00
Dery Ferdika 99077a8308 fix(bundles): contain a v1 bundle's project block like the v2 validator (#716)
Schema-1 (legacy) bundle manifests now run validateProjectBlock, as schema-2 manifests already do. A hand-written legacy bundle can no longer pass a project.id or project.path that escapes the projects root or the bundle root to install. Manifests without a project block are unchanged.
2026-10-04 07:14:17 -07:00
Mike Schwarz 3d54d2e646 feat(bundles): import GitHub folder links and check authoring rules (#708)
rig bundle create, inspect, install and up accept a public GitHub folder link: the ref resolves once to a full commit, which is fetched with Git configuration, hooks, helpers and prompts disabled; the declared configuration is applied to an owned copy, and the existing bundler builds one archive. Output carries source, configuration ID, package digest, archive hash and assembler. On the link path, symlinks anywhere in the fetched checkout and agent, import and legacy package references must stay inside the checkout, or the import is refused and its folder removed. rig bundle check <folder> reports authoring findings without contacting a daemon. Existing path commands are unchanged.
2026-10-04 06:56:00 -07:00
Mike Schwarz 874e5212a3 fix(posture): pick a mission-only row's project the way work-install does (#712)
Operating posture now picks a project the way work-install does when a row carries no project: the rig's recorded association, then the seat's working folder, then the only unclaimed catalog entry. So a mission-linked row no longer reads unknown just because a bundle install added a second project. The inference moved from the CLI into the daemon's project catalog, and both use it; an ambiguous case still reads unknown with its candidates. Posture records how the project was chosen in its sources.
2026-10-04 06:50:15 -07:00
Mike Schwarz 441e7d1fc6 fix(cli): bootstrap rig bundles through stable installation (#709)
rig bootstrap <team>.rigbundle now installs through the existing bundle-install route instead of parsing the archive as a YAML spec: it materializes to --target (default: the current directory), takes --cwd for the agents' working folder, plans with the same 120-second budget as bundle install, and accepts --skip-version-check and --force. YAML specs and library names keep their existing bootstrap flow.
2026-10-04 06:39:35 -07:00
Mike Schwarz 591f80dfd5 docs: use npm ci for a fresh clone and each worktree (#714)
CONTRIBUTING.md and docs/reference/worktree-builds.md now set up a fresh clone or worktree with npm ci, which installs the locked versions without rewriting package-lock.json, as CI does. npm install <package> stays the way to add or change a dependency, with the lockfile committed alongside.
2026-10-04 06:38:01 -07:00
Mike Schwarz aeb67bd0c7 fix(daemon): deliver complete bundle-local skills to Pi and shared profiles (#705)
A bundle can carry complete skills under skills/<name>/SKILL.md, with their helpers and references, and select them through profiles.*.uses.skills. Pi seats now discover the installed bundle's own skills folder and project selected skills into the seat's directory with executable modes preserved, and re-applying a directory skill refreshes changed, missing or new helpers. Skill existence is checked at resolution, when the installed pool is available; a missing selected skill still fails before launch. Claude and Codex keep their existing discovery and plugin routes.
2026-10-04 06:22:38 -07:00
Mike Schwarz 9e2c584040 docs(rig-spec): describe each built-in permission policy (#713)
Adds a 'Built-in permission policies' section to docs/reference/rig-spec.md: what builtin:locked, standard, open and yolo allow, ask about and deny; what each runtime launches with; that config-surface policies are recorded and take effect once translated into the runtime's native settings; how a custom policy file is written; and Claude Code's own first-run and root checks for bypass mode.
2026-10-04 06:19:01 -07:00
Mike Schwarz 0cfcf5f888 feat(cli): build a bundle in a declared configuration (#704)
rig bundle create --preset <name> | --seat pod.member=runtime builds one of the configurations a bundle declares in configurations.yaml beside rig.yaml, applying the chosen runtimes and profiles to an owned copy of the rig folder (never the author's), and records the configuration ID in the manifest outside the package digest. rig bundle configurations lists the declared presets with their configuration IDs. An undeclared choice, an inconsistent configurations.yaml, or a recommended preset that differs from rig.yaml is refused before anything is built. Plain create is unchanged.
2026-10-04 05:51:58 -07:00
Dery Ferdika 78b8b34ce7 fix(daemon): route bundle inspect through the shared archive safety scan (#695)
Inspect now runs the same unsafe-entry scan as install, through one shared helper, so rig bundle inspect predicts rig bundle install truthfully: an archive install would refuse (symlinks, hard links, absolute or drive-absolute paths, forward or backslash traversal) is reported as unsafe instead of being extracted. Install's refusals are unchanged; an entry that breaks several rules now reports its first reason.
2026-10-04 05:50:30 -07:00
Mike Schwarz 0bebb00d15 docs(bundles): freeze the v1 bundle formats and identity definitions (#702)
Adds docs/reference/bundle-formats.md and v1 JSON schemas, with passing and failing fixtures, for the shared bundle formats: declared configurations, the before-install behaviour view, run records, the public status file and registry entries. Defines the configuration ID and the package digest with its stated coverage, and exports configurationId() and packageDigest() from @openrig/daemon/bundle-identity with shared test vectors.
2026-10-04 05:20:38 -07:00
Mike Schwarz 4a7f422d01 fix(cli): accept the daemon context-pack helper suffixes (#706)
The CLI's context-pack pre-check now accepts .mjs and .py helper files, matching the suffixes the daemon's manifest parser already accepts, so rig context add no longer refuses a pack the daemon would install.
2026-10-04 05:09:33 -07:00
Mike Schwarz 23a562f0bd feat(bundles): register a bundle's project and associate its rig on install (#700)
rig bundle create --project-dir carries a project folder (project.yaml and its Markdown) in the bundle, and install registers that project before any seat launches: it materialises the folder at <workspace.projects_root>/<id>/ (never the user's clone) and records the rig's association in the workspace catalog (workspace.catalog_path). An existing catalog is never rewritten: the entry is appended as text in the file's own indentation and line endings, or a one-line rigs edit is made, each re-parse-checked, and the write is atomic and keeps the file's mode and any symlink. Conflicts (an id taken by another root, the same folder under another id, a rig claimed elsewhere, an unappendable shape, or a workspace project.yaml using the bundle's id) change nothing on disk and print the exact entry to add. rig bundle inspect shows the carried project and packs.
2026-10-04 04:54:59 -07:00
Mike Schwarz 7978b36bfd feat(bundles): carry a context pack from outside the rig folder (#694)
rig bundle create --context-pack <dir> carries a referenced context pack into the bundle: its manifest plus only the files it declares, so a pack at a repository root works. On install the pack is routed by its manifest name: copied when absent, reused when identical, and kept untouched when a different pack of that name is installed (for example a rig context add --git install), with a warning that names the rig context rm command to switch. It never merges into an installed pack. Install's human output prints each entry that wasn't routed with its detail.
2026-10-04 04:30:07 -07:00
Mike Schwarz 910bf9f14a chore: sync main version and changelog with 0.6.5 (#701)
Bring main's package versions to the published 0.6.5 (root, CLI, daemon and UI package.json, and package-lock.json) and add the 0.6.4 and 0.6.5 entries to CHANGELOG.md from their published release notes.
2026-10-04 04:14:10 -07:00
Mike Schwarz e1440f20b4 feat(cli): find specialists through read-only rosters (#697)
Add rig roster list, show and find to discover recommended specialists from authored JSON rosters in <workspace.root>/rosters (or --folder). Show and find match members to live seats at read time by host self-id and exact seat address, report the configured model separately from an unknown observed model, and keep missing, stale and unreachable observations visible. Rosters only recommend whom to contact; they never assign work or rewrite files. The inventory read uses a new rig ps --no-cleanup flag so it never removes stale daemon state; ordinary rig ps is unchanged. Non-regular roster entries such as a FIFO are skipped with a warning.
2026-10-04 04:04:41 -07:00
Mike Schwarz c5b64e344c fix(bundles): route a bundle's contents before its seats launch (#692)
Bundle contents (context packs, skills, plugins, workflow specs, agent images) are now routed in a pre-launch step, after the rig record exists and before any seat starts, for both rig bundle install and rig up <bundle>. The live context library is rescanned so routed packs are served on the first turn, and packs the library rejects are reported. Routing problems become warnings and a failed route_bundle_contents stage in the response, the CLI output, MCP and the audit; they never refuse or roll back a rig, and nothing in the step can throw past the instantiator. rig bundle install gains --cwd, also honoured by --plan. The web UI's bundle screens don't show the new warnings.
2026-10-04 03:53:15 -07:00
Mike Schwarz e6a73eac20 fix(daemon): read the configured project catalog in operating posture (#693)
Operating posture (rig mode, attention and the passive health check) now reads the project catalog named by workspace.catalog_path when it is set, through the shared catalog selector, instead of always reading workspace.yaml in the workspace root. With no explicit setting it keeps its default, the workspace.yaml beside the resolved workspace, so symlinked workspaces behave as before. A missing project root now reads project_root_missing instead of a raw ENOENT, and the catalog file no longer has the old 64 KiB read cap.
2026-10-04 03:48:50 -07:00
Mike Schwarz 0ee9d100f7 feat: add bounded telemetry metadata reads and CLI (#696)
Add bounded, versioned metadata reads for telemetry consumers: GET /api/telemetry/v1/events, /queue-transitions and /nodes/:id/tenures, with rig telemetry events|transitions|tenures as single-page CLI readers. Each read bounds the rows and bytes it touches before filtering, selects explicit metadata columns only (no event payloads, notes, queue bodies, commands or environment), uses fixed-window opaque cursors, and names gaps instead of reporting missing history as empty: deleted or retained-floor history, a daemon restart, and withheld oversized fields. No schema change, writer, poller or subscription. docs/reference/telemetry.md describes the contract, including that a daemon restart invalidates a following cursor.
2026-10-04 03:35:04 -07:00
Mike Schwarz efa809b780 test: cover delivery, rig scope and stream replay with stub journeys (#698)
Add an integration test with three stub-rig journeys through the real CLI, daemon, SQLite and tmux: an addressed send renders in the target pane and not its sibling; rig scope listings are exact for the current rig, an explicit rig and all rigs; a tagged stream item replays after a daemon restart and a retried emit is idempotent. Document the journeys and their limits in the test-layer guide. No product change.
2026-10-04 03:02:46 -07:00
Mike Schwarz 7a9019d775 fix(daemon): keep compaction preparation in the workspace and report its effects (#685)
Managed Claude compaction keeps its restore map in the seat's registered workspace, under .openrig/compaction/preparation/<session>/<attempt>/RESTORE-MAP.md, and a generated .gitignore there keeps git add -A from committing private working context. The .gitignore is created only if absent and is never overwritten; an existing file is only read and checked. If the workspace is missing, relative or unwritable, or the folder can't be prepared safely, the map stays in the instance home as before. A failed compaction now says whether its preparation turn was delivered, uncertain or not sent, with the attempt and map path. The bundled restore skill follows the exact path in the request. openrig-core plugin manifests advance to 0.1.4.
2026-10-04 03:01:47 -07:00
Mike Schwarz eb0251100d feat(cli): list a project's declared worlds in work-install (#691)
A project.yaml can now declare install.worlds, an ordered list of world names to read after System World. rig context work-install lists them in order with the command to read each one; it does not deliver them or check that they exist. Invalid entries and later duplicates are skipped with a warning. When the key is absent, output is unchanged. System World's own selection parsing is shared and stays strict.
2026-10-04 02:34:58 -07:00
Mike Schwarz 4792688de9 feat(cli): select the work-install project by rig association or working directory (#690)
When rig context work-install is not told which project to use, it now chooses in this order: the project the rig is recorded against, then the project whose root most deeply contains the working directory, then the only catalog entry that no rig claims. The JSON position reports which step chose (selectedBy). If none applies, it still reports project_required with the candidates. Explicit --project and a single catalog entry behave as before, and no new refusal is added.
2026-10-04 02:34:37 -07:00
Mike Schwarz db56023533 fix(cli): allow an explicit operator for seat permissions (#689)
rig seat set-permissions now works from a plain shell: --operator names who made the change when there is no OpenRig session header. When the header is present it still wins. A missing identity, mode or reason each gets its own error. The permission record, the audit event and the effect (future launches only) are unchanged.
2026-10-04 02:33:58 -07:00
Mike Schwarz b4d467810d fix(cli): list project candidates with exact commands in work-install text mode (#688)
When rig context work-install cannot choose a project (project_required or project_not_found), text mode now prints each candidate with the exact command to select it (rig context work-install --project <id>, plus any --mission or --slice given). JSON output keeps candidates and adds a commands array. The exit code is unchanged.
2026-10-04 02:09:43 -07:00
Mike Schwarz 4f0e0dee61 fix(daemon): discover a workspace context-pack folder created after startup (#686)
A workspace context-pack folder created after the daemon starts is now discovered by the next rig context sync, without a restart. The daemon registers the configured workspace pack root whether or not it exists yet; the library already skips a root that is absent, so nothing changes until the folder appears. Precedence and the write target are unchanged.
2026-10-04 01:47:26 -07:00
Mike Schwarz d2707daafa fix(startup): recheck readiness after bundled prompts (#684)
After startup context is sent, the final readiness check now also runs when the bundled identity prompt, a restore preload or startup actions were sent, not only when startup files remain. A trust panel or other attention gate that shows up after those sends now reports attention_required instead of ready. If the check itself is unavailable, startup finishes ready with an unverified submission warning instead of claiming a gate. The initial readiness wait, send order and refusals are unchanged.
2026-10-04 01:37:38 -07:00
Mike Schwarz 89dc45e178 fix(skills): point compact-plan at claude-compaction-restore and drop dangling skill references (#683)
rig compact-plan's next step now names the claude-compaction-restore skill, which ships and covers preparing a restore map, compacting one seat and auditing the restore; it used to name claude-compact-in-place, which does not exist. Five sibling skill names with no shipped target (mental-model-ha, scope-recovery, composable-priming-packs, pre-maintenance-agent-preservation, writing-skills-for-openrig) are removed from the shared spec skills and their public mirror, and the edge digests are regenerated. No plugin skill changes.
2026-10-04 01:37:01 -07:00
Mike Schwarz 6bdbed2b2e fix(daemon): recognize Claude effort in identity proof (#681)
A Claude seat launched with --effort now passes exact identity proof. Both argv readers in native-process-lineage.ts skip --effort <value> and --effort=<value> like the other launch options, so clear-attention can re-verify a shell-wrapped seat whose binding declares effort, and delivery no longer warns about unverified identity for it. Unknown arguments still give no positive proof. Three test rows cover the separated and equals forms and an unknown-flag control through strict proof and delivery.

Refs #197
2026-10-04 00:47:35 -07:00
Rudy Mizrahi Celekli 07da904fa7 fix(mcp): keep the daemon endpoint reached by the lifecycle probe (#676)
rig mcp serve now builds its daemon client from the same URL its lifecycle probe reached, through the shared getDaemonUrl helper every other CLI command uses. With OPENRIG_URL or a configured host pointing at a non-local daemon, MCP tool calls, including rig_up, rig_down and rig_restore, now go to that daemon instead of the local one, and IPv6 or specific-address binds work. An explicit --port still targets 127.0.0.1.
2026-10-04 00:17:36 -07:00
Rudy Mizrahi Celekli cd3fa344b4 fix(slack): retain new records after an interrupted JSONL append (#669)
The Slack gateway's JSONL state stores now start each appended record on a new line, so a record written after an interrupted append (a torn last line from a crash or full disk) is kept instead of being glued onto the unparseable fragment and lost. Every reader already skips blank lines. This protects the inbound dead-letter store's owed retries and the seen-event stores against loss or duplicate delivery after a partial write.
2026-10-04 00:05:35 -07:00
Mike Schwarz 9e24dff936 docs(onboarding): teach the route to a project's declared context (#679)
The shipped start-up text and the restore and reorientation skills now teach how an agent reaches its project's declared context: rig context work-install lists what the project declares (intent, context files, skills), the agent reads the ones its task needs, and --deliver prints them all. When several projects are declared it stops with project_required, rig context work-install --json lists their ids, and the agent picks one with --project instead of guessing. The placement skill gains a section on project knowledge: product facts, project judgment and machine-local state, and where each belongs.
2026-10-03 23:56:36 -07:00
Rudy Mizrahi Celekli 00897f0766 fix(transcripts): normalize backspace runs without splitting Unicode characters (#677)
Transcript tail and grep output now apply backspaces per Unicode code point, so a backspace removes exactly one character and never splits an emoji into a lone surrogate. Full transcripts, which restore uses, are unchanged.
2026-10-03 23:55:59 -07:00
Rudy Mizrahi Celekli e024a94538 fix(env): recover from a malformed cached service receipt (#675)
GET /api/env no longer fails with a 500 when the cached service receipt is malformed: the cache is parsed inside the existing error handling, the response reports the receipt as unavailable with a parse error, and the next successful probe replaces it.
2026-10-03 23:55:43 -07:00
Rudy Mizrahi Celekli a60ab60d72 fix(cli): refuse nonregular experiment inputs without waiting (#670)
The experimental project input reader opens its file non-blocking, so a named pipe with no writer is refused immediately by the existing bounded-regular-file check instead of hanging the command. Regular files read as before.
2026-10-03 23:55:26 -07:00
Rudy Mizrahi Celekli d0ae339c23 fix(mcp): close the stdio server when input ends (#674)
rig mcp serve now finishes cleanly when its stdin ends: it stops on input end, on the transport closing, or on SIGINT/SIGTERM, removes its listeners and always closes the server. End of input now exits 0 instead of leaving an unsettled wait (exit 13).
2026-10-03 23:55:12 -07:00
Mike Schwarz c17014ed14 fix(daemon): retain seat routing for Pi launches and resumes (#666)
Pi fresh launches, forks and resumes now reassert the seat's OpenRig instance and identity after the pane shell reads its startup files, using the same SeatLaunchEnvironment as Claude and Codex, so a pane rc can no longer point Pi's rig calls at another daemon. Unsupported pane shells and unavailable metadata keep the previous command. If a long temporary path prevents staging and the wrapped command exceeds the direct-input limit, Pi resends the original command, and routing stays best effort for that fallback. The Pi child environment filter, per-seat agent and session directories, resume-file selection and OMP behaviour are unchanged.
2026-10-03 23:44:27 -07:00
Mike Schwarz d3bb161755 fix(transport): convey explicit prompt answers without paste framing (#663)
For an audited rig send --dangerously-interact answer, the transport now types the answer through the existing file and buffer transfer without bracketed-paste framing, so a numbered menu receives the intended key instead of confirming whichever option has focus. Enter is added only when the complete answer is still visible in the runtime's recognized text input (Claude's composer above its rule, or Codex's composer up to its blank line), so an answer the prompt already consumed cannot answer the next prompt. With --verify, the CLI's own explicit-interaction intent stops any automatic submit retry and reports the daemon's disposition when available. Ordinary sends keep bracketed paste, Enter and their repair. Upgrade the CLI and restart the daemon: an older CLI with a newer daemon may still press one guarded Enter. Runtimes other than Claude and Codex get no added Enter and are reported unverified. Builds on zichen0116's typed-answer approach in #602. Refs #519.
2026-10-03 23:23:52 -07:00
Mike Schwarz 91a5070ada fix(daemon): explain managed Pi credential configuration at failure (#667)
When a managed Pi seat fails because no API key is configured for its provider, the runner's existing error line now names the route that already works: set the provider's key in the daemon environment, add it to recovery.provider_auth_env_allowlist and restart the daemon, and use a provider-prefixed model, then relaunch the seat. It notes that default Pi logins are not shared with managed seats. A provider outside the known map is pointed at the seat's PI_CODING_AGENT_DIR. The hint names variables and settings only, never values. The ERROR prefix, readiness, exit and OMP output are unchanged.
2026-10-03 22:56:36 -07:00
Devulapalli Naga Sri Vaishnavi 028c70d642 fix(shutdown): preserve guidance still used by live seats (#662)
When rig down cannot confirm a seat stopped (a failed kill or an unavailable tmux transport), teardown no longer strips that seat's managed OpenRig guidance from CLAUDE.md, the selected CLAUDE.local.md or AGENTS.md, and no longer deletes a guidance-only file the surviving seat still uses. A sibling that stopped successfully no longer strips a shared file first, and ordinary teardown applies the existing file-identity protection for files shared with another non-archived rig, as archived-rig cleanup already did. A later successful shutdown of the same rig cleans its file normally. Limit: while another non-archived rig keeps a node in the same folder, the shared file keeps its OpenRig blocks until that rig is archived or removed, or the next launch rewrites the same blocks. Kill, probe, refresh, snapshot and launch behaviour are unchanged.
2026-10-03 22:24:14 -07:00
Coder8124 a8141f22c3 fix(project): let shadow-drain and shadow-stop name an actor outside a seat (#665)
rig project shadow-drain and shadow-stop accept --actor, so an operator shell outside a managed seat can name who is acting. The daemon's /shadow/drain and /shadow/stop routes read an optional body actor through the same sender check the other project routes use: a session header still wins, and a request with neither is still refused with actor_required. shadow-status is unchanged.
2026-10-03 22:14:40 -07:00
Mike Schwarz 7591ee7820 fix(queue): clarify required blocker and external gate guidance (#664)
rig queue block now says that --on <blocker> is always required, and that the wake is chosen with --wake-watchdog, --wake-after, or a live blocker qitem. When a park names a qitem that is not on this daemon, the blocker_not_found message now says so and adds that a row stored on another host can be parked on with a typed gate such as external:<host>/<id> plus --wake-watchdog or --wake-after. The error code, payload, HTTP status and CLI exit are unchanged; there is no lookup or cross-host call.
2026-10-03 22:14:16 -07:00
Mike Schwarz 1d26bcf24b fix(cli): explain seat identity misses on the reached daemon (#660)
When rig whoami or rig health --self reaches a daemon that does not know the seat's node or session, the not-found error now carries a hint naming the reached daemon and its URL, when known, and asks the user to compare OPENRIG_URL and OPENRIG_HOME in this shell with the daemon that launched the seat. The original error, status and exit code are unchanged. The hint makes one best-effort /healthz read on the same client with a one-second timeout, and omits URL credentials, query and fragment. Routing and environment propagation are unchanged.
2026-10-03 21:15:43 -07:00
Mike Schwarz 3425e9d207 fix(daemon): save the current Claude conversation before shutdown (#658)
Before the shutdown snapshot, a classic Claude seat's current conversation ID is read from Claude's own session file for the stable foreground process, so after /clear a later restart resumes the conversation the user is actually in rather than the pre-clear one. The read requires a matching seat name, a file written at or after the process started, a valid token and an unchanged process observation. Missing or ambiguous evidence keeps the existing shutdown behavior, and the existing provenance rules still protect hook, operator and adoption tokens. An archived rig whose name is now used by another live rig is not refreshed, so it keeps its own saved conversation. An unchanged token keeps its provenance. Shutdown now adds two process observations and synchronous file reads, which are not time-bounded.
2026-10-03 21:09:19 -07:00
Mike Schwarz ced90ff9c4 fix(pi): defer PATH lookup to the pane and explain incompatible CLI flags (#655)
A Pi installed only on the pane's PATH no longer fails the daemon-side preflight: a Pi missing from the daemon PATH now warns, and the pane launch decides, so a really missing Pi still fails clearly with ENOENT and exit 127. Pi is spawned by name with native PATH lookup, so symlink launchers that dispatch on their name, project-aware shims, relative and empty PATH entries, and fallback past a launcher with a missing interpreter behave as before. When Pi rejects OpenRig's managed flags at startup, the runner adds installation guidance and a version when known; the optional version probe is hard-killed after three seconds and never prevents a working launch. The runner also handles an early stdin pipe closure. OMP's early-exit reporting is unchanged.
2026-10-03 21:02:07 -07:00
Mike Schwarz b4a68d1c0b fix(launch): preserve Claude function lookup in fish panes (#657)
In a fish pane, a classic Claude launch now sources the staged launch script in the pane's own fish when a fixed pre-launch probe shows fish accepts leading VAR=value assignments (fish 3.1 and later), so a claude defined only as a fish function or alias launches as it did when the launch was typed directly into the pane. Older fish, launch commands or paths containing a backslash, and wrappers too long for the safe input bound keep the existing /bin/sh staging, so anything that launched before still launches the same way. The probe uses /bin/sh -c :, which exists wherever the fallback already works, including macOS. Other shells, other runtimes and managed launches are unchanged; nushell stays on /bin/sh.
2026-10-03 20:47:49 -07:00
Solomon Wakhungu 53195656c7 fix(daemon): report how OMP exited during startup instead of guessing why (#646)
When OMP exits before its RPC transport starts, the runner now reports the phase and how OMP exited (exit code or signal) with OMP's last stderr lines, instead of asserting it was not a credential problem. OMP also exits that way when it has no usable model credentials, so the old message could point an operator the wrong way. The exit is recorded once OMP's stdio drains, or one second after OMP exits if a child process holds it open. Pi's behaviour is unchanged, and its early-exit test now waits for the runner's first request so it does not race the runner's first write. Closes #616.
2026-10-03 19:16:34 -07:00
Mike Schwarz f475fc3cff Keep the assigned session ID for fresh Claude launches (#656)
A fresh Claude launch now records the session ID OpenRig assigned with --session-id, instead of the first session file in the Claude config folder whose name matches. Two live seats with the same name sharing one config folder could otherwise record each other's ID, so a later resume opened the wrong conversation. The fork path, which has no assigned ID, still matches by name; that limit is unchanged. Tests cover a single matching file, another same-name seat listed first, and only the other seat's file.
2026-10-03 19:09:59 -07:00
Mike Schwarz 3c8a20e3d8 fix: keep acknowledged continuity unverified without restore proof (#652)
Acknowledging a working seat made inventory infer resumed, even when no evidence established that its original conversation resumed. This keeps the restore acknowledgment (operator_recovered) but leaves inferred continuity null unless the winning reconciliation carries strict restore proof bound to the same rig, node, attempt and completion receipt. rig seat status shows null as "unverified", including for seats that were never restored and have no explicit continuity outcome.

Explicit stored continuity values keep their precedence. A running acknowledged seat stays running, and applicable identity mismatches still require attention. Clear-attention decisions, recovery, delivery, tokens and lifecycle actions are unchanged. Restore-start reads are eligible for the existing node/type index, with a scan fallback when that optional index is absent, and no per-seat receipt queries are added. The user guide sentence that described the old behavior is corrected; plugin versions are unchanged.
2026-10-03 17:27:31 -07:00
Mike Schwarz f0113149b7 Show daemon and recovery guidance for missing queue items (#654)
When a queue item ID is not found on the daemon the CLI is talking to, the ten queue item commands (claim, unclaim, update, block, resolve, handoff, handoff-and-complete, fallback, show and transitions) now add a hint to the existing qitem_not_found error. The hint names the daemon by the host ID it reports, or says the ID is unavailable, and adds: if the item came from another host, run rig host list, then OPENRIG_URL='<daemon-url>' rig queue show '<id>' --full --json.

The error field, HTTP status and exit code are unchanged; the hint is an additional field. The host ID comes from one bounded read of the same daemon's health endpoint, made only after a not-found answer. Nothing is searched, no host is inferred from the ID, and writes are never replayed.
2026-10-03 17:26:47 -07:00
Mike Schwarz f8c070a5bf Restore explicit HTML and inline SVG asset previews (#653)
Explicit render=1 HTML previews again load without the script-free CSP, frame restrictions or nosniff, and SVG assets are served inline without forced attachment. This also restores the earlier header behavior for external script assets used by a preview.

Rendered HTML and directly opened SVG can run scripts in the daemon's origin. Default HTML remains text/plain. Authorization, the allowlist, path containment, response bodies, content types and range handling are unchanged from this change's base.

Validation: 63 focused route and header controls passed on the equivalent reviewed files, including full and partial JavaScript responses; the two new JavaScript controls failed against the previous route. No real-browser run was performed.
2026-10-03 17:21:29 -07:00
NIKHIL 0fe2cc3f35 fix(daemon): make launch readiness window configurable (#643)
The harness readiness window used by launch, restore and seat handover is now configurable as runtime.readinessTimeoutSeconds (env OPENRIG_RUNTIME_READINESS_TIMEOUT_SECONDS). The default stays exactly 30 seconds, and precedence is env, then config file, then default, through the existing settings store; rig config set applies to the next launch without a restart.

rig config set accepts integers from 1 to 600. An invalid env or file value falls back with a warning. If the settings read itself fails (for example a config.json that is no longer valid JSON), launch and handover fall back to 30 seconds with one stderr warning instead of failing. The handover timeout message now names the window it waited.

Refs #182. Contributed by Nikhi00718.
2026-10-03 16:58:53 -07:00
Mike Schwarz b345706b65 docs: explain seat attention checks and token correction (#651)
rig seat clear-attention now explains which attention class remains unresolved and how to correct a known native token before checking the live evidence again. The CLI help and the openrig-user skill distinguish operator acknowledgment from verified conversation continuity, describe the earlier identity-check path, and say which clears write audit events. The token example supplies stdin explicitly.

This is guidance only: clear decisions, error codes and recovery behavior are unchanged. It does not fix the separate projection that can still show resumed after an acknowledgment. The plugin version is unchanged.
2026-10-03 16:44:24 -07:00
Mike Schwarz 3929e6d6a6 fix(cli): restore numeric-prefix chatroom timeout compatibility (#650)
rig chatroom wait --timeout accepts numeric-prefix values again. It tries Number first and uses parseFloat only when that produces NaN. Blank, non-finite and negative values are still rejected before any request; plain numeric, scientific, hexadecimal and fractional values keep their current behavior.

These are numeric-prefix seconds, not unit conversion: 2m means 2 seconds, 500ms means 500 seconds, and 1h means 1 second. Use plain numeric seconds, for example --timeout 120 for two minutes.

Refs #355.
2026-10-03 16:37:16 -07:00
Mike Schwarz 28ced738de fix(daemon): use one browser boundary and remove the pairing cap (#648)
Browser clients could pass the daemon's primary Host/Origin check and then be rejected by a second API or terminal WebSocket Origin check with different rules. This change uses the existing primary boundary consistently and removes the fixed refusal at 20 active host-pairing requests on both sides of pairing.

The removed checks are not equivalent predicates. Requests they rejected can now reach the existing route authentication, including explicitly configured non-HTTP Origin entries and configured cross-origin clients, normalized parse-equivalent Origins, and the enabled daemon UI's terminal upgrade on an accepted non-loopback host or IP without a terminal token. OPENRIG_ALLOWED_ORIGINS is now read once when the primary boundary is constructed.

The primary boundary still runs before the affected routes and token authentication is retained; its accepted IP/host rules, configured allowances and no-Origin behavior are unchanged. This is not a claim of universal DNS-rebinding protection or browser isolation. The standalone terminal registrar is token-only; its production mount supplies the browser boundary.

Pairing keeps its authorization, human approval, single-use handover, expiry, requester sanitation and failure cleanup, with no replacement cap. Pending durable approval rows can accumulate: expiry and arrival-triggered pruning clean the in-memory maps, not those rows. Notification URL handling is unchanged.

Not exercised: a real browser, a real tailnet, live pairing, Windows, sustained load.
2026-10-03 16:24:36 -07:00
Mike Schwarz db3aef8f2a fix(package): remove redundant deferred role-hook warnings (#649)
rig package validate and rig package plan stop printing the duplicated warning about deferred role-hook references, and the optional warnings field leaves the validate/plan API and CLI output. Manifest validity, exit status, manifest errors and meaningful deferred plan entries are unchanged.

This package path does not install hooks today. A stale hook reference again gets no warning and no deferred entry. The role-hook validation requested in #477 is not implemented here.

Refs #477, #478.
2026-10-03 16:23:51 -07:00
Coder8124 85ed428291 fix(queue): reject a non-numeric whoami recentLimit with 400, not 500 (#647)
A non-numeric recentLimit on the queue whoami route (for example abc) reached SQLite as LIMIT NULL and failed with a datatype mismatch. It now returns 400 "recentLimit must be a number".

Values that parseInt reads today (5, 1.5, 2x, -1) behave exactly as before, with the existing 1..200 clamp. An absent or empty value still uses the default. The new route test covers abc (400) and 5, 1.5, 2x and -1 (200).

Contributed by Coder8124.
2026-10-03 16:07:11 -07:00
Mike Schwarz 53f2b5d9d0 fix(queue): resume wake retries after prompt clears (#644)
After an operator-route prompt alert was positively cleared by its producer, the wake ladder's ownership check handed the original row back, but the executing ladder still skipped every terminal recovery and the readback still reported it resolved. A claimed failed-class original, or a pending failed or retained baton, then received no further retries. Ownership, execution and readback now share one predicate: a terminal recovery is skipped unless it is a prompt alert retired by its own producer with the exact retirement note, in which case the original's ordinary wake continues.

Manually closed alerts, unknown prompt states and every other terminal recovery remain held as before. A continued wake draws from the original row's existing retry count, cap and destination budget, and an exhausted original stays exhausted; nothing is reset and no watcher is added. The ordinary claimed case still gets one wake, and the readback now reports the actual eligible retry with the same interval and cap as execution. Timings in the tests are virtual; no production timing is claimed.

Refs #81
2026-10-03 15:24:57 -07:00
Mike Schwarz 69d3aa9d49 fix(compaction): diagnose missing generation before preparation (#645)
A map-required compaction preparation for a seat whose current occupant has no generation could never succeed: the map it waits for cannot be matched to a null generation, so the request ran out its full budget and failed. Preparation now checks both existing generation resolvers first and, when neither yields an identity, stops immediately with a reason that names the condition and the supported recovery: run rig reconcile-session '<session>' --no-launch, then start a new rig compact attempt. No preparation prompt is sent in that case.

Nothing else changes: skip-map still works with no generation, an active attempt still cannot be taken over, the 120 s manual and 180 s HTTP budgets are unchanged, and cancel, expiry, disable, late-map and stale-generation handling stay as they were. The fix never invents an identity, reconciles a seat on its own, or rearms a stopped attempt; only a new deliberate attempt after reconciliation freezes a new generation and map.

Refs #610
2026-10-03 15:23:06 -07:00
Mike Schwarz 67e81ec9bb perf(slack): defer full queue views until notification selection (#642)
The Slack outbound sweep built the full queue view (pickup, waiting and recovery state, activity and delivery ledger) for every active row before checking whether that row's owner notification had already been delivered. Selection now reads active row IDs with the same filter, order and million-row cap, keeps the existing latest-notification and exact-receipt checks, and builds the full view only for rows that still need delivery. Slack projection, human-alert filtering, receipts, seen state and dispatch are unchanged; a row that is gone or no longer active is not posted, and a failed read still fails the sweep rather than counting as delivered.

In a synthetic 200-row queue with 2 undelivered notifications, full views fall from 200 to 2 and the median sweep from about 335 ms to about 27 ms. When every active row carries an undelivered notification the extra point reads make the sweep roughly 9-11% slower. It is still a scan of all active rows, delivery remains at-least-once, and no live CPU or health improvement is claimed. Enable-time seeding and the delivery digest use the same selection and keep their behavior.

Refs #161

Based on korallis/agent-stack#139 by korallis and Lee.
2026-10-03 14:35:23 -07:00
Rudy Mizrahi Celekli 7748b87d43 fix(cli): retain saved rig specs after failed export writes (#640)
A failed rig export write could replace the saved rig.yaml with partial output. Export now uses the config store's existing staged write, moved into one shared helper: complete content is written beside the target and renamed into place, so a failed data write leaves the previous file intact and removes the staged copy. File modes, POSIX ownership, symlink following and the fallback for unwritable directories or busy targets are kept, and write-only destinations are accepted.

A destination that already exists and is not a regular file, such as a pipe behind /dev/stdout, a FIFO or a device, is written directly as before, so streams and devices are never replaced. The config store keeps the same behavior through the shared helper. Tests cover partial-write failure through the real export command, FIFO and stream destinations, symlinks and long file names. No ACL preservation or power-loss durability is claimed.

Contributed by @rudycelekli.
2026-10-03 13:59:45 -07:00
Mike Schwarz 20b3b48855 fix(restore-check): share restore preconditions and report unavailable inputs (#636)
restore-check now runs restore's own pre-restore validation instead of reporting green for a rig that restore would refuse. The validator moves unchanged into a shared module; restore keeps calling it at the same point with the same messages, order and refusals. restore-check runs it once per rig on the snapshot that rig up --existing would choose: refusals show red, warnings alone show yellow, and an empty result is green, bounded to what was checked. It never captures or invents a snapshot.

When there is no usable current-occupant snapshot, restore-check reuses ordinary up's existing current-state rehydrate eligibility: an eligible stopped or partial rig keeps its down or partial status and the rig up --existing suggestion, with the restore inputs shown yellow as not inspected; an ineligible rig shows up's own blockers in red; a missing rig or a read error stays a named unknown for that rig only. In the overall verdict a known red now wins over an unrelated unknown (exit 1 before exit 2), while each rig's own status and the counts remain visible.

Composed rig status skips the added validation for rigs whose seats are all running and ready; explicit restore-check always runs it. Query counts per assessed rig are documented in the PR; the full snapshot history is still read for stopped rigs, which is follow-up work. P2 spec-root corrections and launch-record rig_id are out of scope.

Refs #130
2026-10-03 13:46:33 -07:00
Mike Schwarz b89fcad7c0 fix(codex): honor explicitly selected home across managed paths (#638)
An explicit CODEX_HOME was honored by daemon startup writers but not by every managed path. Launch, resume, fork and legacy commands, profile and capability probes, thread-id and context-usage readers, and plugin-cache discovery now all use the same selected home, including when a pane's shell rc sets a different value. An empty CODEX_HOME is treated as unset at the first startup read, so every consumer uses the default home; whitespace and relative values keep their existing startup refusal. The setup disclosure names the selected config path and its default.

This is opt-in: with CODEX_HOME unset, a second install still shares ~/.codex. Auth commands keep the caller's root, and no authentication, history or settings are copied or migrated.

Upgrade note: if your shell rc sets a CODEX_HOME different from the daemon's, align them (or unset the daemon's) before upgrading; existing seats otherwise resume under the daemon's home, where their earlier Codex thread isn't.
2026-10-03 13:17:00 -07:00
Rudy Mizrahi Celekli 1ed5bcceda fix(cli): preserve blank lines in transcript rendering (#639)
rig transcript printed the daemon's captured text with every empty line removed, collapsing paragraphs and blank lines inside code blocks. The renderer now prints every line except the trailing split sentinel, whose newline console.log already supplies, so leading, consecutive and interior blank lines survive and no extra final blank line is added. The near-empty-transcript hint still counts only non-empty lines. --json and --grep output are unchanged; the remote --host path shares the renderer and gets the same fix. A regression test covers leading, consecutive and interior blank lines, including inside a fenced code block.

Contributed by @rudycelekli.
2026-10-03 12:35:53 -07:00
JUSHUANGHUI LI 47ae99d74e fix(cli): surface chat history HTTP errors (#476)
rig chatroom history and rig chatroom wait now surface HTTP errors from the chat history API instead of hiding them.

- history: with --json, the body is printed as before and the exit code is 1. In plain mode, the error (or "Failed (HTTP n)") goes to stderr and the exit code is 1, instead of "No messages." with exit 0.
- wait: the first HTTP error is reported and the command exits 1, instead of polling until the timeout.
- Successful output is unchanged.
2026-10-03 11:35:38 -07:00
Mike Schwarz 8bed067878 fix(daemon): describe the actual compaction preparation deadline (#633)
Compaction preparation prompts now describe what is actually happening.

- Manual requests name manual mode and make no threshold claim. They give the preparation deadline in UTC and the time remaining when the request was built (not guaranteed on receipt), and say that delivery, writing the full restore map and becoming idle share that deadline.
- Automatic requests say their 25-minute ceiling starts after preparation delivery returns, with no invented absolute time.
- The preparation_incomplete reason now covers the map and the idle wait, including expiry after a completed map.
- Timing values, the restore-map prerequisite and marker, guards, cancellation, expiry and disarming are unchanged.

Refs #610.
2026-10-03 10:37:35 -07:00
Mike Schwarz acd31a90b5 fix(startup): distinguish unrecognized composer boundaries (#634)
When OpenRig can't verify that a startup prompt was submitted, the warning now says why. "Unrecognized composer boundary" means the capture was available but the composer's marker or closing rule wasn't found. The existing extracted-text-mismatch wording is kept for real mismatches. A text-free reason label is added to the startup diagnostics.

- Applies at the initial and the after-retry observation.
- Wording and diagnostics only: the composer classifier, transport, guarded-Enter matching, verdicts, waits, retries and captures are unchanged.
- No prompt or reply text in the warning or the event fields.

Recording footer-shape metadata for unrecognized layouts is a possible follow-up, not part of this change.
2026-10-03 10:19:53 -07:00
Mike Schwarz 350eb7ba98 fix(bootstrap): record the rig a pod-aware launch produced (#632)
Pod-aware launches now record which rig they created. The bootstrap run row gets rig_id on the pod-aware success path, as the legacy flat and all-attention paths already did, so a modern rig can be traced back to the spec it was launched from.

- Applies to completed and mixed (partial) pod-aware runs. Failed runs have no rig and are unchanged.
- Launch behavior, responses and side-effect order are unchanged. GET /api/bootstrap now shows rigId for these runs.
- No migration. Earlier runs stay without a rig_id.

Refs #130.
2026-10-03 10:18:37 -07:00
Mike Schwarz d116467692 fix(restore-check): report an unlocated rig spec as not checked, not red (#631)
restore-check no longer reports red when a rig's spec isn't under <shared-docs>/rigs/<rig>. That folder is the only place it looks, nothing in the product writes there, and restore itself never reads the spec, so the red was false.

- A missing <root>/rigs/<rig> is now yellow "not checked", naming the path it looked for and saying no launch spec location could be established.
- A present spec stays green. A folder without rig.yaml stays yellow.
- No new status value, and every other check reaches the verdict unchanged. When this was the only finding, rig restore-check now exits 0 (restorable with caveats) instead of 1, per its documented exit contract.
- Restore, its refusals and the recovery plan are unchanged.

Refs #130 (its spec-location part).
2026-10-03 10:04:10 -07:00
Mike Schwarz 7de30c9592 fix: preserve interactive shell lookup for classic Claude launches (#628)
Classic (non-managed) Claude launches resolve claude through the pane's interactive shell again, so a claude defined only as an rc alias or function starts, as it did before #618.

- For recognized POSIX pane shells (bash, zsh, sh, dash, ksh), the staged command is sourced in a subshell of the pane shell, and public seat metadata uses leading assignments. #618's metadata correction and its rig-only PATH entry are kept, and the variables don't leak into the pane shell.
- Every other or unreadable shell (fish, nushell, unknown, failed read) keeps #618's /bin/sh staging. An rc-only claude alias or function there stays unresolved, as at #618.
- Long commands stay protected: the typed invocation is about 115 bytes for a 4 KiB command, and the full command stays in a private 0600 file that is removed after use.
- Managed Claude and Codex launch paths are unchanged.

Bash only was executed (real tmux, offline recorder, native identity stubbed). Fish and nushell were checked through reported-shell selection, not native runs.

Refs #618.
2026-10-03 09:43:50 -07:00
Mike Schwarz c550bfaa39 chore: make the asset CSP comments match the shipped headers (#630)
Comment-only follow-up to #462: the asset route's comments now match the shipped headers. Every asset response carries nosniff. Rendered HTML gets a script-free CSP under the web UI's fail-closed rule. SVG is served as an attachment, so opening one directly downloads it, while <img> embedding is unaffected. The previous "advisory, not a gate" wording and the threat narrative are removed. No code changes.

Refs #462.
2026-10-03 09:24:39 -07:00
Sunil 3dd8bc776f security: add response headers to /api/files/asset for active content types (#462)
/api/files/asset responses now carry X-Content-Type-Options: nosniff.

- Rendered HTML (the ?render=1 view of .html files) is served with a Content-Security-Policy that runs no scripts, opens no connections and can't be framed. Inline styles and same-origin images still render.
- SVG files are served as attachments with a UTF-8 filename*, so opening one directly downloads it. <img> embedding is unaffected.
- Image, video and range replies are otherwise unchanged.

The route serves only the web UI. The transcript-search change from an earlier revision is not part of this PR.
2026-10-03 08:51:30 -07:00
Mike Schwarz ec5e77aaff fix: escalate prompt-blocked work through the existing operator route (#619)
When a wake to a parked owner is refused because the seat is at an interactive prompt, the outstanding work now reaches the existing orchestrator/operator escalation path, and nothing is typed into the blocked seat. One aggregate per episode carries the affected rows and owns their continuation. The original is not retried or exhausted by the generic ladder, and its waiting readback reports the delegated recovery. The alert retires when the prompt positively clears or the work closes.

- Clearing needs a newer state from an authoritative needs-input-capable observation. Default Codex trial hooks and generic sampling-only seats never report a blocked prompt, so they get no prompt alert yet.
- Shared operator seam: missing human bindings, unavailable registry reads and gateway dispatch refusals now stay unresolved and are re-resolved on the existing cadence, instead of exhausting as undeliverable. Unchanged unresolved decisions add no sends or notes, and old exhausted episodes stay closed. Aggregate bodies include member summaries. Accepted or deferred delivery stays gateway-owned.
- Robustness: prompt-pass faults are logged without stopping the existing ladder. New JSON-membership reads ignore malformed tags. An unreadable candidate or member holds only its own destination for that tick and can't retire an alert.
- Composes with the guard-refused retry path from #623: an open prompt recovery owns both retry and escalation.

Refs #81.
2026-10-03 08:05:00 -07:00
Mike Schwarz f027fdebb5 fix(health): preserve available findings when one source fails (#626)
Health sources are read independently, so one source that fails or exceeds its limit no longer makes every health read fail. A failed source is reported as unavailable, with its name and reason. A bounded source is reported as partial, with its actual census. The other sources keep reporting, and a missing source is never shown as healthy or zero. Disabled detectors are skipped and leave no stale result.

- Attention reads the coverage of the same health read. It marks health unavailable or partial, names the affected source, and keeps the working sources' current items.
- The TUI keeps current items. During an outage it re-shows earlier items that depend on the unavailable source, under the named outage. A successful partial window replaces the previous one, and recovery clears the outage.
- No limit, threshold, policy, schema or collector changed.

Known limit: earlier items are retained under the overall health dependency, not per source, so during one source's outage an item another source has since dropped can stay visible, marked as from an incomplete feed.

Refs #613.
2026-10-03 08:01:44 -07:00
Mike Schwarz 393297e10c fix: resolve built-in core plugin from configured OpenRig home (#627)
The built-in shared agent spec now names its core plugin as openrig-home:plugins/openrig-core, so it resolves under the daemon's configured OpenRig home (OPENRIG_HOME, else RIGGED_HOME, else ~/.openrig) instead of always under ~/.openrig.

- Default installs resolve to the same path as before.
- An instance with a non-default home now loads the plugin copy the daemon seeded there.
- A planner regression test loads the real built-in spec under a temporary home and checks the resolved path. The starter-library expectation follows the new spelling.

The openrig-home: form needs a daemon that supports it. The built-in spec ships with that daemon.
2026-10-03 07:25:01 -07:00
Dery Ferdika 4f3b766aa5 fix(daemon): keep a guard-refused wake's retry path for unclaimed batons (#344) (#623)
When the typing guard refuses a wake (the seat is protected from typed input, so OpenRig retains the nudge instead of typing it), an unclaimed baton keeps its retry path instead of sitting stranded until someone nudges it by hand.

- queue-recovery counts a retained: nudge attempt as newer evidence, like failed:, so a terminal recovery written before the refusal no longer hides the row.
- The wake ladder treats retained: as a retryable failed-mode wake only for pending, unclaimed batons. Claimed rows keep the previous classification, so the parked-owner path still owns them.
- Retries reuse the row's delivery id. The first retry re-probes the guard, later retries read back as retained, and the row then escalates through the existing rungs. Retry cadence, budget, attempt cap and exhaustion are unchanged. Nothing is typed into the guarded seat.

Refs #344.
2026-10-03 07:19:21 -07:00
Shravan Sumanthanan 5862bafdce fix(daemon): sweep seat-target closures without successors (Refs #318) (#604)
The stuck sweep's custody detector now also covers seat-address closures. A row closed done or canceled with closure_reason handed_off_to toward a seat (not a qitem id), and with no successor carrying lineage to it, raises a custody finding instead of going unnoticed. Handed-off rows are skipped, because a transactional handoff always creates its successor.

- Scope: each tick scans done and canceled closures updated within a fixed 24-hour window, plus rows that still carry an open finding, so history from before an upgrade doesn't raise waking findings. There's no configuration key for the window.
- Successor detection requires direct lineage (handed_off_from or chain_of_record), so unrelated work for the same seat doesn't suppress a finding.
- The verification recipe uses rig queue list --destination.

Refs #318.
2026-10-03 07:14:33 -07:00
Mike Schwarz 043b1bb3b4 fix: preserve OpenRig seat environment after shell startup (#618)
Seat launches re-assert OpenRig's own public variables after the user's shell startup files run, so a pane rc can no longer override OPENRIG_HOME, OPENRIG_URL, the node id, session name, runtime or occupant generation. Only an explicit allowlist is typed; credentials and provider keys keep their tmux environment channel, and an OPENRIG_URL carrying userinfo, a query or a fragment is left out of the typed line.

- PATH: one OpenRig-owned directory, $OPENRIG_HOME/run/seat-bin/<sha256 of the daemon's paired CLI path>, holding only a rig link to the daemon's own CLI, goes first; the rest of the user's PATH order is unchanged. Unexpected contents in that directory are preserved and the launch falls back.
- Codex: an npm-installed Codex and its env-node interpreter resolve on the capability-probe PATH; child tools get the user's PATH.
- Fail-open: if the paired CLI, the tmux environment read, the identity or the node check is unavailable, the launch uses the previous command with one fixed log line. No new refusal.
- Nushell panes keep the previous literal command.

Limits: non-managed Claude launches now run from a /bin/sh script, so `claude` must be an executable on PATH (the native installer's ~/.local/bin/claude is); a legacy install reached only through a shell alias or function is not resolved, fallback included. A stray entry in the seat-bin directory disables the correction for that install (it fails open). Not exercised on a real provider, tmux, macOS or Nushell session.

Reviewed independently: Claude source review and Codex executed review (red/green controls including the npm Codex interpreter case, concurrent alias creation and rc overrides), both MERGE-READY at this head; CI 8/8.
2026-10-03 06:47:15 -07:00
Mike Schwarz a24471af62 fix(daemon): prevent remaining bare tmux targets from selecting prefix siblings (#625)
Refs #612. The remaining tmux commands that address a seat by name now use exact targets, completing the change begun for capture and probes. respawnPane, setRemainOnExit, isPaneDead, getPaneCursorPosition, readPaneLastActivity, setSessionOption and getSessionOption use the exact pane form (set-option and show-option take a target pane even for session-scoped options), and switchClient uses the exact session form. The seat-switch service qualifies its window lookup and its final switch target, so a session that disappears after the probes cannot switch a client to a prefix-named sibling; its public target is unchanged. Before this, a missing session could have a sibling respawned, read, re-optioned or switched to. Live names, tmux ids and explicit targets behave as before.
2026-10-03 06:28:16 -07:00
Mike Schwarz 63838b2ad2 fix: show unavailable idle ceiling when no seats capture (#624)
Refs #556. When no seat is rotating transcripts, the transcript capture stats report the idle ceiling as null, like the active interval, and rig ps --resources shows it as unavailable instead of 0 ms. The host resources reference explains the default 3-second idle ceiling: the 10-second freshness window minus the 1-second hint lookup, the 5-second capture result deadline and 1 second of timer spacing, never below the configured active interval. It makes no CPU or child-process lifetime promise.
2026-10-03 05:57:06 -07:00
Rudy Mizrahi Celekli 7e9452d266 fix(config): preserve usable settings after partial writes (#576)
Settings writes from the CLI config store and the daemon settings store keep the existing file usable when an update fails partway. Each store stages the new content beside the target and renames it into place, preserving owner, group and mode, so a failed staged write or rename (including ENOSPC or EIO) leaves the original byte-identical. An existing target is first opened for writing without truncation, so a read-only settings file is refused as before. Where the directory doesn't allow temporary entries, ownership, mode or rename (EACCES, EPERM, EBUSY), the update falls back to writing in place, as before, with that path's existing partial-write limit. instance-layout.md describes the behaviour, including that a hard-linked second name keeps referring to the previous file after an atomic replace.
2026-10-03 05:45:28 -07:00
Rudy Mizrahi Celekli 835e420608 feat(daemon): adaptive transcript capture and host resource visibility (#556)
Transcript capture adapts to seat activity, and rig ps can show host resource use. Active seats keep the configured poll cadence. Idle seats back off, but the next idle capture is scheduled from the last successful completion and capped by a ceiling derived from the shared 10-second freshness window, the hint lookup and a 5-second capture result deadline, so an idle seat's transcript stays fresh even when one capture is slow. A capture that fails or outlives its deadline counts as a failure, never refreshes freshness and is not written late, and captures for a seat cannot overlap. The existing capture_stale response is unchanged. rig ps --resources reports capture cadence and host resource figures.
2026-10-03 05:41:03 -07:00
Mike Schwarz b20af404be fix(daemon): address the exact tmux session when capturing, reading its environment or piping it (#614)
Refs #612. tmux commands that address a seat by name now use tmux's exact target forms, so a session that has ended can no longer be resolved by tmux's prefix fallback to a sibling whose name starts the same way. Pane commands use =name: and session commands use =name, for capturePaneContent, capturePaneScreen, hasSessionEnv, startPipePane, stopPipePane, getPaneCommand, getPanePid, setWindowOption, resizeWindow, and the unguarded detach-client and kill-session in killSessionUnchecked. Before this, with the target gone, a capture read the sibling's screen, readiness and resume probes read the sibling's command and pid, window options and size were changed on the sibling, and an unguarded kill could kill the sibling. tmux ids (%N, @N, $N) and explicit targets containing ':' pass through unchanged, so the guarded kill still uses the immutable session id. listWindows, isPaneDead, getPaneCursorPosition, readPaneLastActivity, setSessionOption, getSessionOption, setRemainOnExit, respawnPane and switchClient are listed for follow-up.
2026-10-03 05:25:40 -07:00
Rudy Mizrahi Celekli 39ee4751dc fix(compact-plan): reject incomplete daemon inventory (#579)
rig compact-plan no longer treats an incomplete daemon inventory as a complete one. For a fleet plan, a rig whose node read fails is left out and reported in incompleteRigs with its HTTP status, invalid_inventory or request_failed; the plan is built from the rigs that read successfully, text output prints a partial-plan warning on stderr, JSON always carries incompleteRigs, and the exit code is 1 when anything is incomplete. A failed read for an explicit --rig, or of the process list, still fails with exit 2 and no plan.
2026-10-03 05:21:51 -07:00
Mike Schwarz 3650524101 fix: resolve plugin paths from configured OpenRig home (#620)
AgentSpec plugin resource paths gain an openrig-home: form, resolved under the daemon's configured OpenRig home (OPENRIG_HOME, else the legacy RIGGED_HOME, else ~/.openrig) rather than the user's home directory, so a rig running under a non-default OpenRig home loads the plugin copy its daemon seeds. The suffix must be relative; an absolute suffix is refused, and the planning error reaches the instantiation result. Absolute, ~ and spec-relative paths are unchanged. The agent-spec reference documents the four path forms.
2026-10-03 05:18:37 -07:00
Mike Schwarz f88f590f75 test(queue): make the closure-overdue dedup test bite on any date; fix two doc line refs (#622)
Refs #490. The minimal-schema closure-overdue dedup test now sets the claim to max(UTC day start, now minus 5 minutes), so the events written with datetime('now') always fall on the claim's UTC date. A text timestamp comparison or an unescaped LIKE match therefore fails the test on any date, not only on the day it was written. The architecture event-system doc's types.ts citations are updated to the RigEvent union's end at line 311 and RestoreNodeResult.status at line 473.
2026-10-03 05:11:14 -07:00
Mike Schwarz 050878b027 test(scenarios): run the transcript and capture stub scenarios in CI (#621)
The installed-scenario CI job now also runs the transcript-reads-addressed-seat and capture-returns-addressed-seat stub scenarios once each, healthy only, after the six baton runs and through the same per-container block. A new verifier accepts only a clean PASS of the named scenario: one ledger record equal to the result, the scenario SHA-256, exit 0, and no error, seed or fault. The baton verifier is unchanged. run-pr-scenarios.sh gains --case transcript|capture, and a lost-baton mode with a passing-only case is refused. Planted failures for these scenarios stay as per-PR evidence and are not run in CI. The job name and required checks are unchanged; on this PR the job took 4m08s against a 3m42s baseline. test-layers.md and the CI README describe the new CI and local split.
2026-10-03 05:10:59 -07:00
Mike Schwarz 12cef7594d fix(startup): retain bounded submission mismatch evidence (#617)
When a fresh Claude seat's startup check cannot positively match its staged prompt, node.startup_ready now carries bounded diagnostics for each unverified startup send, and node.startup_failed carries them if a later step fails. Each record names the startup attempt, the send's order and source, the observation phase and what the single guarded retry did, and compares expected and observed text by normalized byte count and SHA-256 with the first differing byte offset and the marker and closing-rule positions in the capture. No prompt text or excerpt is stored, because startup actions and files are not classified for credentials. The full positive match before the one guarded Enter, the unverified result for ambiguous or unavailable observations, and the startup outcome are unchanged, and a failing diagnostic sink cannot change them. No extra capture or pane write is added.
2026-10-03 05:06:33 -07:00
Shravan Sumanthanan c0ca7d8759 fix(daemon): produce qitem.closure_overdue and retire mission_control.view_refreshed (#490) (#593)
Resolves #490. The daemon now produces qitem.closure_overdue: the stuck sweep records it once per claim episode for an overdue claimed item, with a closure-overdue transition by daemon@system, and a re-claim starts a new episode. Deduplication matches the exact qitemId with json_extract and compares timestamps with julianday on the path without queue_transitions. A failed overdue write is logged and does not drop the sweep finding. The overdue-claim finding shows the claimant's last note rather than the daemon's overdue note. mission_control.view_refreshed, which nothing produced, is retired from the declared events and its consumers, and the event-system and mission-control docs are updated.
2026-10-03 04:48:31 -07:00
Toan Nguyen 73e8ef81e5 fix(ps): count arbitrated needs-input in the rig attention total (#180)
Refs #81. The rig attention total in rig ps now counts a seat waiting at needs-input using the same arbitrated answer as the seat row. A positive needs-input count counts. An authoritative clear from needs-input chrome, lifecycle hooks or self-report does not count. When no authoritative source has answered, the hook store decides, as before, so a live permission request on a seat with hooks at trial or sampling only still counts. A stale hook no longer outweighs an authoritative clear. Display only: no delivery, refusal or notification behaviour changes.
2026-10-03 04:38:02 -07:00
Mike Schwarz 42c60fa466 docs: say the capture scenario overlaps member names, not full seat names (#615)
The capture stub scenario's wording now matches what it tests. The member names overlap by prefix (impl and impl2, or dev-impl and dev-impl2 with the pod); the full seat names do not. The scenario catches a capture that resolves the seat by a prefix match on its member name and takes the first hit, or any resolver that returns the same pane for both seats. It does not exercise a prefix match on the full seat name. The text changes are in test-layers.md, the scenario header and the stub topology comment.
2026-10-03 04:37:48 -07:00
Mike Schwarz a4eb66f9fb test(scenarios): cover rig capture with a prefix-overlap stub scenario (#612)
Adds a stub scenario for rig capture with two seats whose member names overlap by prefix (dev-impl and dev-impl2). Each seat's stub script prints its own token, and each expect step captures one full seat name through the shipped rig capture --json and requires that seat's token, so a capture that resolves the seat by member-name prefix or by first match fails at the intended step. A capture that returns both panes is not detected, because contains has no absence form. The scenario uses env.stub_scripts, so it runs locally in host mode; the installed-scenario CI job and container mode do not execute it, like the transcript scenario. test-layers.md now counts 15 scenarios and 7 topologies, separates the scenarios that run in CI from those run locally, and lists the capture row's remaining gaps.
2026-10-03 03:32:32 -07:00
amyrmahdy c513420164 docs: note why rig setup changes cmux's socketControlMode (#609)
The README's rig setup row now says why setup changes cmux's automation.socketControlMode: cmux defaults it to cmuxOnly, which only accepts processes started inside cmux and so blocks OpenRig's control, so setup switches it to automation.
2026-10-03 03:32:19 -07:00
Mike Schwarz c6e90d69fe fix(compaction): wait for an attempt-bound restore map (#610)
Managed Claude compaction could submit /compact before its preparation request had produced a restore map: automatic mode treated delivery as completion, and manual mode only waited for idle. Preparation is now bound to an attempt and occupant and waits for the exact map named in the prompt, published atomically with an attempt-specific completion marker that establishes identity, not map quality. Unfinished attempts end on expiry, cancellation or an observed policy disable, and a usage dip below the threshold keeps the same attempt and deadline. Ordinary messages stay available while preparation waits, and the final paste and Enter recheck the attempt and recipient. Automatic preparation waits up to 25 minutes on the existing polls; manual map and idle waits share the existing 120-second budget, and the CLI HTTP timeout stays 180 seconds. rig compact <session> --state shows the attempt and deadline with the usual terminal auth, --cancel ends preparation, and an explicit retry creates a fresh attempt. --skip-map skips only the artifact requirement for one manual request. Known pre-write failures retry a bounded number of times; uncertain delivery or compact results are not replayed. Cancellation is checked before each observation and after it returns, inside the single wait-for-idle deadline; it cannot interrupt a read or undo input already issued. An unprepared seat may now reach its context limit rather than compact automatically, and attempt state stays in memory, so a disarm does not survive a daemon restart.
2026-10-03 03:21:07 -07:00
Mike Schwarz 887063afdd fix(daemon): allow Claude sends after conversation rotation (#607)
Fixes #596. Ordinary Claude delivery now warns and proceeds when the only disagreement is between the stored conversation token and the historical launch argv, so a seat stays reachable after an in-process conversation reset. Neither token is promoted to verified identity, and the warning says the current conversation is unverified. This also applies to a settings-before or settings-after session-id mismatch, a plain wrong token and a lone mismatched launcher shim when token disagreement is the only objection; some of those can be a different conversation. Positive conflicts still refuse: a different native runtime, mixed named identities or incompatible live lineages, a changed process fingerprint, occupant, pane or send-time binding changes, and positive idle-shell evidence. Strict startup and resume selectors and hook precedence are unchanged, and restore can remain attention_required while an ordinary send proceeds with a warning. A change detected after paste can still leave one paste and block Enter.
2026-10-03 02:14:36 -07:00
Mike Schwarz e198f97da6 fix(daemon): producer-link advisory reports only what it observed (#606)
When a send cannot tell what a seat is doing, the producer-link advisory now reports only what it observed. OPENRIG_RUNTIME is checked as a relay prerequisite alongside the URL and token. Names missing from the tmux session environment are reported as seat-env UNKNOWN rather than DOWN with a relaunch instruction, because a managed launch passes them through an env-prefixed command; the agent process environment is not read. Hook age is checked before recency, so an old prior-tenure hook reads as STALE with its generation stated. "OK" applies only to a recent hook from the live occupant's own generation; a recent hook from a prior or unverifiable generation says so and keeps the environment note. With no stored hook, the advisory no longer blames ingest and lists the possible causes instead. A node-inventory comment is corrected, and AgentActivityStore.freshnessMs becomes a public read-only field so the diagnostic uses the store's own window. Attribution, generation and freshness rules for decisions, the endpoint-file fallback and the send behaviour are unchanged, and checks remain presence-only.
2026-10-03 02:11:47 -07:00
Mike Schwarz 4fb037ae20 fix(daemon): wait-for-idle retries an unknown observation within its deadline (#603)
waitForIdle used to fail on the first unknown activity reading, so rig send --wait-for-idle and the compaction stages refused idle Claude seats whose last hook was old or from a prior generation. An unknown reading is now retried like busy within the caller's one absolute deadline, and it never authorizes a send. No observation starts after the deadline, each awaited observation is raced against the remaining time, and a result that completes late is discarded rather than accepted (the read is abandoned, not cancelled). At expiry the result names the last state actually observed in time: target_activity_unknown or wait_for_idle_timeout. Positive needs-input still refuses at once, and the identity, binding and final-send checks still run before paste and Enter. Ordinary sends without a wait and the startup and restore probes are unchanged. The context monitor's serial post-compact stages can now wait up to their existing timeouts on unknown readings.
2026-10-03 01:55:01 -07:00
Duc Nguyen 4552b1613f fix(cli): preserve full rig names in ps table (#600)
rig ps --full (and --verbose) clipped rig names over 24 characters and ran columns into the footnotes. With --full, each column now widens to its content's display width, measured with string-width so CJK, emoji and combining marks align; the default compact table keeps its previous total width, takes the new two-space column separators out of the fixed widths, and cuts by display width on grapheme boundaries with an ellipsis. A blank line now separates the table from its footnotes only when footnotes follow. JSON output is unchanged.

Adds the runtime dependency string-width ^8.3.0 (with get-east-asian-width, strip-ansi and ansi-regex; all MIT, no install scripts).

Fixes #590
2026-10-03 01:49:16 -07:00
Mike Schwarz 1a3ffc245e feat(daemon): give Codex seats network inside workspace-write unless Codex reports an opt-out (#608)
Codex seats launched with OpenRig's plain workspace-write floor could not reach the local daemon, because Codex's sandbox defaults network access off. Before such a launch, OpenRig now runs one short-lived codex app-server with the seat's own executable, HOME, CODEX_HOME and cwd, reads config/read (with layers) and configRequirements/read, and adds -c sandbox_workspace_write.network_access=true to that launch only when Codex reports no explicit setting from any layer and no requirement pins it. Any explicit user, project, managed or requirements value wins.

The reader is reader-only (plugins and apps disabled), has a finite deadline, checks RPC results rather than exit codes, cleans up only its own descendants, and never blocks the daemon's event loop. Named profiles, legacy YOLO and full bypass are not read and their commands are unchanged. A deadline, RPC error, unknown shape, missing binary or unsupported selection adds nothing and the original launch proceeds, which may leave network off. Codex startup may write its own state files under CODEX_HOME, read its auth store and fetch managed policy; the read and the launch are not atomic. These are disclosed in the docs.

Refs #275
2026-10-03 01:42:12 -07:00
Shravan Sumanthanan 236b1b17b4 fix(daemon): resolve same-second checkpoint queries by insertion order (#474) (#601)
Checkpoint created_at has one-second precision, so getLatestCheckpoint and getCheckpointsForNode returned an arbitrary row when several checkpoints shared a second. They now order by created_at and then rowid (latest insert last for the list, first for latest), the same tie-break the snapshot and package repositories already use.
2026-10-03 00:49:37 -07:00
Solomon Wakhungu 22d5b62f23 test(daemon): make the real-Codex e2e tests opt-in (#599)
Two daemon e2e tests (seat-handover-model-fidelity and seat-lifecycle-set-model-resume) used to launch a real Codex whenever tmux, codex and a Codex auth file happened to exist, so an ordinary package test run could spend the signed-in account's quota. Each preflight now returns false first unless OPENRIG_E2E_REAL_CODEX is exactly 1, before any tmux, codex or auth probe, and afterAll starts nothing when the run did not opt in. With the variable unset, 0 or true, both files are discovered and skipped; with 1, the original checks and assertions run unchanged. Test files only; no product code.

Thanks to @1solomonwakhungu for the fix, carried over from their fork.
2026-10-03 00:25:12 -07:00
Mike Schwarz 72fedeed7a fix(daemon): retry staged Claude startup prompts (#598)
A fresh Claude seat could be reported ready while its startup prompt was still sitting unsent in the composer, so a person had to press Enter. After the existing paste and Enter, startup now captures the pane once (200 lines) and, only when the whole whitespace-normalized expected body is positively matched inside a recognized composer, sends one guarded submit-only Enter through SessionTransport with the existing target and lease checks, then observes once more. There is no re-paste, no loop and at most one extra Enter.

A prompt still staged after that is not a startup failure: StartupResult and node.startup_ready carry submission.status=staged with the warning 'Startup prompt still staged in <pane>; press Enter in that pane', and the seat keeps running. A different body sharing the header, stale echo, partial or opaque renders, unknown layouts and unavailable captures get no automatic retry and are reported as unverified. The challenge-only prompt stays best-effort. Other submit-only callers keep their 50-line capture and their unchanged matcher.
2026-10-03 00:11:06 -07:00
Coder8124 ad74c81426 fix(daemon): answer 400, not 500, for a malformed JSON request body (#587)
A malformed JSON request body used to surface as a bare 500 from any daemon route. A middleware registered first now tracks SyntaxErrors thrown by c.req.json() for the current request, and the app error handler maps only those to 400 invalid_json. Every other error follows Hono's default path unchanged: errors carrying getResponse (such as the delivery guard's typed 409 refusals) keep their status, body and headers, and anything else, including a SyntaxError from stored data, stays a logged 500. Routes that catch their own bad body keep their own response, and the existing sub-app error handlers are unchanged.
2026-10-03 00:05:44 -07:00
Mike Schwarz 1c6de1255c fix(daemon): keep a queue write addressed to this daemon's own host id local (#588)
A queue handoff or handoff-and-complete addressed to the receiving daemon's own exact host id (case-sensitive, never a null self id) now takes the ordinary local path instead of forwarding to itself over HTTP. Cross-host forwarding to any other host is the byte-identical call.

Upgrade compatibility: when a self-addressed retry finds the deterministic successor that a pre-upgrade self-forward already committed, it runs the receiving create in process (the same input checks via a shared createInputRefusal, the primary-key absorb with qitem_id_reuse for a different sender, and the qitem_body_not_saved warning for a changed body) and then the existing cross-host close, so a retry gives 2 rows and 1 send. Refusals on that path return the receiver's 4xx directly (409 qitem_id_reuse, 400 body is required or unknown_target_repo) instead of the old 502 wrapper, so the CLI exits 1 instead of 2 for them; both are non-zero. The /create route's own behaviour is unchanged. coordination-primitive.md is updated.
2026-10-02 23:58:58 -07:00
Mike Schwarz 8b79355963 feat(skills): claude-compaction-restore writes a restore map and reads by ranked tiers (#591)
Rewrites the claude-compaction-restore skill around a restore map. Before compacting, a seat writes a short summary, how things connect, and a ranked reading list in its seat folder, and publishes the summary as its seat recap. After compacting, it re-enters the world, reads its newest map, and reads down the ranked list to its class's tier: about 100k of real context for most seats and about 200k for orchestrators, planners and leads, scaled for smaller windows. Restore packet files and the session JSONL are lookups, not reading lists. The read-depth audit counts harness re-attached files as not yet read.

The daemon's post-compaction restore and audit prompts are aligned with the skill: the restore prompt says to read the newest restore map and use the packet as a lookup, the JSONL rebuild fallback applies only when there is no map, and the audit prompt names the required set instead of asking for every file. The previous skill text is kept as reference/SKILL-v1.md, marked superseded. openrig-core goes from 0.1.2 to 0.1.3 so upgraded installs receive the change; edge digests are regenerated.
2026-10-02 23:41:04 -07:00
Mike Schwarz 193253a657 fix(context): post-compaction profile skips an absent seat recap with a warning (#597)
A post-compaction context profile used to fail entirely when the seat had no RECAP.md, so a freshly compacted seat got none of its world atoms. In the post-compaction situation only, a seat recap that is genuinely absent (lstat ENOENT under an existing seat directory) is now skipped: the response lists it in skipped and adds the warning 'no seat recap for <seat>@<rig>; read your newest restore map'. A dangling link, a missing seat directory, an unconfigured root and every other atom still fail, and a handover with no recap still fails loud. The recap piece now carries its file write time (writtenAt), shown in the CLI framing header as 'written <ISO>', so an old recap is visible as old. rig context profile and rig walk --through-profile print profile warnings to stderr; stdout piece text is unchanged.
2026-10-02 23:38:39 -07:00
Mike Schwarz e5c5ded7cb fix(daemon): leave an already-provisioned Claude state file unwritten (#595)
provisionClaudeState used to rewrite the whole Claude state file on every startup delivery, including after launch, even when nothing changed. Since #592, a classic seat can provision the daemon-selected CLAUDE_CONFIG_DIR/.claude.json, which live Claude processes and other seats share. A changed flag now decides the write: a trust key is updated only when hasTrustDialogAccepted is not true, hasCompletedOnboarding only when it is not true, and with neither changed the function returns before mkdirp and writeFile. A real change still writes once, preserving every other field. Malformed-state preservation, the managed and two-home classic paths and the launch command are unchanged. Temp-file-plus-rename is not added, because the adapter fs interface has no rename; the remaining writes keep the existing cross-process risk.

Refs #592
2026-10-02 23:07:51 -07:00
Mike Schwarz b4b3c96f17 fix(daemon): bootstrap a classic Claude seat in the daemon's selected home too (#592)
A classic (no permissionMode) Claude seat types claude into its pane shell, which inherits the tmux server environment, so the bootstrap cannot see which config home the child reads. When the daemon selects CLAUDE_CONFIG_DIR, bootstrap now provisions both HOME/.claude.json and the selected directory's .claude.json (de-duplicated when equal), setting only hasCompletedOnboarding and the workspace trust flag and preserving every other field. Malformed state in one file is preserved with a warning and does not stop the other. The managed explicit-mode path still writes only its selected home, and the launch command is unchanged. This replaces the exactly-one-file rule from #565 for classic seats.

Known follow-up: the state write is unconditional and not atomic, which was already true for HOME/.claude.json; skipping unchanged writes is tracked separately.
2026-10-02 22:49:07 -07:00
NIKHIL a8c1c37581 fix(daemon): recover stale same-name rig generations (#513)
Recover stale same-name rig generations. A failed rig up could leave an archived same-name duplicate that blocked or confused later runs. rig up now prefers an active same-name rig and falls back to a sole archived one; tearing down an archived duplicate never probes or kills a session owned by a live rig, and shared guidance files are protected by physical identity, recomputed at each cleanup step. Teardown no longer treats an unreachable tmux as proof a session is absent: it keeps the rig and reports the cause. Fixes #487.
2026-10-02 22:37:38 -07:00
Rudy Mizrahi Celekli 0d794d0baa fix(agent-images): publish complete round-trippable snapshots (#580)
Publish complete, round-trippable agent images. Agent image install wrote its discovery manifest before its members, so an interrupted install could be discovered as a complete image, and unquoted notes could lose scalar identity on round trip. Members are now written before the manifest, string fields are written so they round-trip exactly, and a creator that wins a race after the existing-target check gets the existing typed image_referenced refusal instead of overwriting another install.
2026-10-02 22:29:44 -07:00
Rudy Mizrahi Celekli f0fcc2840e fix(profiles): distinguish unreadable sources from dangling links (#585)
Distinguish unreadable profile sources from dangling symlinks. Profile loading reported any read failure on a symlinked source as a dangling symlink. It now reports a dangling symlink only when the path is a symlink and its target is missing, and otherwise reports the actual read error.
2026-10-02 22:22:22 -07:00
Rudy Mizrahi Celekli a5d9a1cf25 fix(context): stage local installations before publishing them (#583)
Stage local context-pack installs before publishing them. A local rig context add copied straight into the library, so a failed copy could leave a partial pack. It now copies into a temporary folder inside the library root and renames it into place, removing the staging folder on failure; an existing destination is still refused before anything is written.
2026-10-02 22:22:06 -07:00
Rudy Mizrahi Celekli b95d976002 fix(telemetry): derive burn rates from measured in-window counters (#582)
Derive burn rates from measured intervals. Usage burn-rate computation treated a missing counter as zero, producing a fake reset followed by a whole-total burn. Samples with missing counters are now excluded before deltas are computed, too few measured samples report insufficient_samples instead of a rate, and the time window's upper bound is inclusive.
2026-10-02 22:21:47 -07:00
Rudy Mizrahi Celekli 3be4cd50d4 fix(start): reject failed restore discovery (#578)
Report failed restore discovery in rig start. A non-200 from the rig summary read during rig start was treated as the list of rigs to restore. It now goes to the existing error path, which prints the HTTP status and exits 1; daemon and kernel startup before discovery are unchanged.
2026-10-02 22:21:32 -07:00
Rudy Mizrahi Celekli c2329136b8 fix(cli): reject failed library inventory reads (#577)
Report failed library inventory reads instead of listing them as empty. plugin list, agent-image list, context list and specs ls treated any daemon response as the inventory, so a 401 or 503 error object read as an empty or garbled list. They now raise on a non-200 status, and each command's existing error path prints the message and exits 1.
2026-10-02 22:21:06 -07:00
Rudy Mizrahi Celekli d5a255ef96 fix(context): resolve legally indented Markdown headings (#584)
Resolve legally indented Markdown headings in context lookups. CommonMark allows up to three leading spaces before an ATX heading, but heading-address lookups only matched headings at column 0. Indented headings now resolve; lines inside fenced code blocks are still ignored, and existing lookups are unchanged.
2026-10-02 22:16:53 -07:00
Rudy Mizrahi Celekli 852b480628 fix(transcripts): ensure tail reads progress on damaged UTF-8 (#581)
Ensure the transcript tail reader makes progress on damaged UTF-8. The backward chunked tail reader skipped any number of leading UTF-8 continuation bytes and pushed them back, so a chunk of continuation bytes, or a file starting with one, re-read the same range forever, blocking the synchronous read. The skip is now capped at three bytes and nothing is pushed back at offset 0, so every pass makes progress; valid UTF-8 output is unchanged.
2026-10-02 22:16:28 -07:00
Rudy Mizrahi Celekli 1670e6e611 fix(tui): bound activity stream header waits (#546)
Bound the TUI activity stream's opening wait and reconnect after temporary opening failures. Opening the daemon activity stream had no header deadline, and any fetch error turned live updates off for the rest of the TUI process. Opening now has a 5 s header deadline; timeouts, network errors and aborts reject into the existing drop, backoff (1 s doubling to 30 s) and reconnect loop, while definitive non-OK or non-event-stream answers still stop retrying. An established stream is not bound by the opening deadline.
2026-10-02 20:53:40 -07:00
Wu Shuwen f45e0cef51 fix(daemon): reject separators in session components (#473)
Reject @ in pod and member session-name components. A pod or member ID containing @ produced a session name whose pod/member part could not be separated from the rig name. Preflight, member creation and launch now refuse such pod and member names with a message naming the field; rig names may still contain @. Schema validation is unchanged, and docs/reference/rig-spec.md now explains that rig spec validate passes such a spec while preflight and import refuse it. Fixes #472.
2026-10-02 20:26:13 -07:00
Wu Shuwen 66fe3d2716 Warn about stale deferred role hook references (#478)
Warn about stale deferred role hook references. A role's hooks: entry that names a hook absent from exports.hooks used to pass validation silently and drop out of the plan. Package validation and planning now report it as a warning naming the role and the reference; the manifest stays valid, because hooks in the package path are deferred and never installed, so validate, plan, install, bootstrap and bundle flows are unaffected. Refs #477.
2026-10-02 20:25:33 -07:00
Wu Shuwen 977537aa00 fix(daemon): keep read-only bundle sources writable in staging (#575)
Keep read-only bundle sources writable in staging. Pod bundle staging copied each file with its source mode, so a read-only (0444/0555) agent.yaml or script produced a read-only staged copy, and a later rewrite of that vendored path (for example import-ref rewriting) failed with EACCES. Staged copies now get the source mode plus owner read/write. Execute and group/other bits are preserved, source files are never modified, and archived modes are unchanged because the portable tar writer already normalizes them. Fixes #574.
2026-10-02 20:16:25 -07:00
Coder8124 9bd60b8c01 fix(daemon): treat a Claude launcher shim chain as one runtime for delivery (#563) (#567)
Treat a Claude launcher shim chain as one runtime for delivery identity. A Claude seat started through a launcher shim was refused for every rig send, because delivery inspected only a single process. Delivery now reads the whole shim chain: the session is verified when the real Claude process names the expected session, a shim token that agrees cannot certify an unknown child (unknown still delivers with a warning), and any explicitly different session token, whether on the process or a lone shim, is refused as a conflict. The strict identity check used at startup, resume and restore is unchanged; --settings parsing applies to delivery only. Fixes #563.
2026-10-02 20:15:16 -07:00
Vaibhav Hajare 0f687e63d9 test(daemon): pin exact-match session probe (#573)
Test-only: pin tmux has-session's exact-match target (=<name>) in the adapter tests, so a future refactor cannot silently fall back to prefix matching. Also covers the absence classification for a missing exact session. No production code changes.
2026-10-02 20:13:54 -07:00
Vaibhav Hajare a5b8f84e81 fix(daemon): hash same-second check the way the cache hashes (#572)
The workflow spec scanner's same-second unchanged check hashed raw file bytes while the cache stores a UTF-8 text digest, so a file that is not clean UTF-8 never matched and was re-parsed on every scan. Hash the decoded text the same way the cache does. Clean UTF-8 files produce the same digest as before. Adds a scanner test with a non-UTF-8 byte pinned into the cached second. Refs #445.
2026-10-02 20:13:31 -07:00
Mike Schwarz 595b705f2d docs(as-built): refresh six maps after source drift (#571)
Re-verifies six as-built pages against b6d37bfa after recent merges: moved source anchors, the local spec validation helper, 93 migration files ending at 094, footprint and test-file counts. Docs only.
2026-10-02 18:49:53 -07:00
Mike Schwarz b6d37bfadc docs(as-built): align selected maps to one verified source snapshot (#570)
Re-verifies and restamps 19 as-built pages against one source commit (25412287): moved anchors, counts and named-Enter mentions updated, and portable grep in the README inventory commands. arteries.md, test-layers.md and the five web UI pages keep their own verification stamps. Docs only.
2026-10-02 18:30:13 -07:00
Mike Schwarz eeca3e02a7 fix(daemon): avoid sorting latest usage-sample lookups (#569)
Adds migration 094 with two partial indexes so the latest usage sample lookups (context and window lanes) use an index search instead of a temporary sort. Query text and insertion-order deduplication are unchanged. Cost: one extra index entry per sample and a one-time index build on upgrade. Based on the query-plan finding in korallis/agent-stack#137. Refs #161.
2026-10-02 18:17:31 -07:00
Mike Schwarz 0a4f761d5d fix(plugins): deliver bundled updates with openrig-core 0.1.2 (#568)
Advances the bundled openrig-core plugin to 0.1.2 so upgraded installs receive every bundled hook and skill change made since 0.6.4; with equal versions, version-preserving vendoring kept the old installed files, so those changes reached fresh installs only. Removed bundle files are not pruned, existing seats and projections do not hot-reload, and later plugin content changes after 0.1.2 ships need their own version decision.
2026-10-02 18:16:19 -07:00
Mike Schwarz 9a89e1732d fix(cli): validate rig specs without a daemon (#566)
rig spec validate now validates locally without a running daemon, using the same validator as the daemon HTTP /validate route; help says so, and rig spec preflight still uses the daemon. Unexpected validator errors are reported as internal errors, never as an invalid spec, and the HTTP route keeps its existing status codes. Docs and help only otherwise.
2026-10-02 18:09:23 -07:00
Mike Schwarz 35a255237a Retain per-seat role orientation without shared kernel role blocks (#562)
Adds an optional orientation: role marker for per-seat role startup files. Queue whoami returns the calling seat's marked role entries, and the refocus hook renders them within its existing budget. The three kernel specs stop using a shared role resource. Failures read as unknown rather than missing. An unknown orientation value is rejected because the field selects role bindings. This proves emitted instructions and paths offline only; whether a native model retains its role is unverified. Refs #64.
2026-10-02 17:57:22 -07:00
Mike Schwarz 254122872c fix: align Claude bootstrap with the selected configuration home (#565)
When a Claude seat uses an explicitly selected CLAUDE_CONFIG_DIR, OpenRig now writes its onboarding and workspace-trust bootstrap to that selected home, so the seat is not stranded at first-run screens. The classic launch (permissionMode omitted) keeps its existing home; a binding without a working directory uses the same stored-node selection as the launch; malformed existing state is preserved with a warning. The rig setup and README disclosures now name the right file. Native sign-in and Keychain behaviour are not verified. Refs #154.
2026-10-02 17:50:20 -07:00
Mike Schwarz b2bda7443c fix: preserve USER and LOGNAME in seat launch environments (#564)
Seats now receive the daemon's USER and LOGNAME at launch and on handover successors, including Pi and OMP runners. Nothing is derived when the daemon lacks them, and provider auth and HOME policy are unchanged. Whether this resolves the macOS Keychain sign-in symptom reported on issue 154 is not verified. Refs #154.
2026-10-02 17:49:41 -07:00
Mike Schwarz 07f3367d8a docs: refresh CLI inventory and backend as-built maps (#560)
Refreshes the CLI reference with a command inventory derived from the registered command tree, plus the workflow-runtime, living-notes-review, content-surfaces and frontmatter-schema as-built modules against the current source. Docs only.
2026-10-02 17:33:18 -07:00
Luis Araya 207a7ffbca fix(daemon): submit with named Enter key instead of C-m (#496) (#540)
Submits with tmux's named Enter key instead of C-m at every submit site (shared transport, startup adapters, claim, handover, startup orchestrator), so terminals that encode C-m differently from Enter still submit. Message text is still sent literally; only the submit key changes. Thanks to @Totopo27.
2026-10-02 17:31:21 -07:00
Mike Schwarz 073b93a92d docs(as-built): refresh packaging and content library maps (#561)
Refreshes the as-built packaging/bootstrap/bundles and plugin/agent-image/context-pack/compaction maps against the current source, including sibling routing after bundle install, version-preserving plugin vendoring and generation-scoped compaction continuation. Docs only.
2026-10-02 17:09:02 -07:00
Mike Schwarz 3606452a8a docs(as-built): refresh module indexes and architecture navigation (#558)
Refreshes the as-built README module index, codemap and architecture navigation page against the current source. Web UI pages are explicitly marked as not reverified by this update; each module keeps its own verification stamp. Docs only.
2026-10-02 17:08:39 -07:00
Mike Schwarz be95cb035b test: cover addressed stub transcript reads (#559)
Adds a stub scenario proving that each of two seats exposes its own scripted output through the shipped rig transcript --tail 200 --json path, with a planted content-omission control that fails at the intended assertion. Updates the test-layers help-wanted map to show transcript as partially covered. Test and docs only; no production change.
2026-10-02 16:56:01 -07:00
Mike Schwarz 1389de2bab fix(daemon): recognize Claude wrappers when clearing attention (#554)
Manual clear (rig seat clear-attention) now recognises a native Claude process behind its shell wrapper. It carries the saved resume token when one exists, and with no saved token it accepts stable positive runtime evidence for the current pane, which proves occupancy, not conversation identity. Strict restore and exact-token checks are unchanged, a wrong saved token never falls back, and periodic sweeps keep using one batched tmux read. Refs #197.
2026-10-02 16:08:43 -07:00
Mike Schwarz 4cb9f23248 fix(views): keep requests responsive during execution Git checks (#557)
The execution view's git checks now run as awaited asynchronous calls, so a slow git command no longer blocks the daemon's other requests (health, queue, other views). The 5-second per-call timeout and the merged, unknown and N/A results are unchanged; SQL views stay synchronous.
2026-10-02 15:56:45 -07:00
Mike Schwarz 712a61fbcc fix(tui): separate current evidence from retained proof rounds (#553)
The TUI's proof view now shows the current judgment's evidence first and lists every retained proof drop, including superseded rounds, under 'Retained proof drops — all rounds'. Only an explicit previous chain marks a judgment as corrected; no proof history is changed.
2026-10-02 15:28:34 -07:00
Mike Schwarz 384223e9a5 fix(views): distinguish project progress from daemon adoption (#552)
For a selected project, the execution view's daemon-adoption ("live") rung now reads N/A with an explicit basis, because that rung describes the OpenRig daemon's own source, not project deployment. The unscoped view keeps its daemon lineage rules, and a missing git object never establishes N/A.
2026-10-02 15:06:56 -07:00
Mike Schwarz 474df87f87 fix(daemon): keep managed Claude restore readiness truthful (#520)
Managed Claude restores recognise a headerless ready prompt, including bypass mode, only when the exact launched process and saved conversation identity agree, and readiness checks reuse that proof. If native identity disappears or stored resume metadata conflicts during the final startup/join checks, restore reports attention consistently; the final join updates readiness only on the exact still-current running session, preserving protected metadata and replacement sessions. Component and adapter tests with synthetic native observations; installed Claude Code behaviour is not verified here. Refs #86.
2026-10-02 15:03:29 -07:00
Rudy Mizrahi Celekli c78c980a06 fix(transcripts): retain repeated boundary markers once (#545)
Transcript rotation now keeps each distinct structural boundary marker once instead of re-promoting every matching line, so an unchanged pane no longer grows its transcript file on every capture tick. Captured scrollback is left untouched.
2026-10-02 15:00:53 -07:00
Rudy Mizrahi Celekli 2b63d69145 fix(shutdown): keep capture until seat termination is confirmed (#538)
Rig teardown now stops a seat's transcript capture only after its tmux session is confirmed terminated or already gone. When a kill fails and the seat is still alive, its transcript keeps updating; deletion is still blocked by kill failures as before.
2026-10-02 14:39:57 -07:00
Rudy Mizrahi Celekli b1e271e7ce fix(tmux): keep daemon transcript defaults out of seat overrides (#536)
New tmux seats no longer inherit the daemon's resolved transcript line-count and poll-interval values as overrides: those two variables start empty in each new session, so a seat's config.json takes effect at the next daemon restart. Explicit seat values still win, and running sessions and the daemon's own capture settings are unchanged. Refs #161.
2026-10-02 14:39:12 -07:00
Rudy Mizrahi Celekli 0c24607bcc fix(shutdown): report unsuccessful Compose teardown (#533)
Rig teardown now reports a Compose teardown that returns failure, in both the already-stopped and live branches, as a 'Service teardown warning'. Teardown and deletion still proceed; the CLI shows the warning and exits 2, where it used to report success.
2026-10-02 14:31:06 -07:00
Rudy Mizrahi Celekli d546d07f04 fix(tui): close rejected activity stream responses (#543)
The TUI now cancels the body of a rejected activity-stream response and of a page read that fails with 5xx, so a response the server keeps open no longer holds its connection. Accepted streams and returned results are unchanged.
2026-10-02 14:30:02 -07:00
Rudy Mizrahi Celekli 8a2602275a fix(tui): preserve standard SSE notification framing (#535)
The TUI's live-event stream parser now follows standard SSE framing: CRLF, bare CR and multi-line data fields are handled, and a frame larger than 1 MiB is dropped and the stream reconnects. The daemon's current single-line notifications parse exactly as before.
2026-10-02 14:19:43 -07:00
Rudy Mizrahi Celekli f8c30f13fd fix(tui): require primary clicks for control activation (#549)
Only a primary-button press now activates TUI and startup controls. Mouse wheel, middle and right presses over a control no longer activate it; wheel scrolling in the normal view and keyboard input are unchanged.
2026-10-02 14:04:26 -07:00
Wu Shuwen c720e2053f fix(daemon): reject out-of-range usage windows (#483)
An out-of-range window_hours on the usage top route now returns a 400 explaining the supported range, instead of a 500 from an invalid date. Normal windows take the same path as before.
2026-10-02 13:55:01 -07:00
Rudy Mizrahi Celekli 8b75297b17 fix(snapshots): preserve long periodic snapshot intervals (#548)
Periodic snapshot intervals longer than the native timer limit (about 24.8 days), such as monthly, no longer overflow and fire about every millisecond. Long intervals are now scheduled in chunks within the timer limit, and shorter intervals keep their existing timer.

Closes #547.
2026-10-02 13:17:59 -07:00
Mike Schwarz ecc936014c docs: add a contributor roadmap (#539)
Adds ROADMAP.md: a short public roadmap of community-suggested and small items, with the issues and Discussions where each is tracked and how to help.
2026-10-02 13:15:59 -07:00
Wu Shuwen 8135136953 fix(daemon): skip auto-compaction for stale context (#464)
Automatic compaction no longer acts on a stale context sample. A high reading older than the freshness window sends nothing; a fresh reading exactly at the threshold still sends the preparation and then /compact; and a pending restore stage pauses while the sample is stale and resumes the same stage when it is fresh again. A sample timestamped in the future is not treated as fresh.

Closes #463.
2026-10-02 12:58:39 -07:00
Wu Shuwen 783d22b50c fix(daemon): scope Slack inbound dedup by channel (#452)
Slack inbound dedup is now scoped by channel: the in-flight guard, the durable seen mark and the dead-letter skip all use channel plus timestamp, so identical timestamps in two channels are no longer treated as one event. Attachment files carry a per-message identity digest, so same-timestamp uploads with the same filename in different channels keep separate bytes. Queue item IDs are derived as before.

Closes #450.
2026-10-02 12:52:48 -07:00
Devulapalli Naga Sri Vaishnavi 88165fb77e fix(queue): preserve shared watchdogs across park transitions (#505)
A watchdog shared by several parked rows now survives the park transitions of the row that created its timer. Only rows still parked whose latest unfired wake is this job keep it alive; after a re-park, retirement and backoff follow the current owner. A failed delivery from a shared repeating timer keeps its retry instead of being consumed, and successful delivery and same-job reattachment behave as before.
2026-10-02 12:37:38 -07:00
Mike Schwarz decc0bbe93 fix(bundle): contain rig files by resolved directory boundary (#507)
Pod bundle assembly now contains rig files by their resolved directory boundary. A culture, docs or startup file that is a symlink resolving outside the selected rig folder (including a sibling folder whose name only shares the rig's prefix) is refused, with a message to copy the file into the rig. Links that stay inside the rig and a symlinked rig root still bundle, and external agent references keep their existing behaviour.
2026-10-02 12:32:57 -07:00
Rudy Mizrahi Celekli 9a26e3afcb fix(gateway): preserve humans when queue enumeration fails (#531)
rig gateway human remove no longer treats a failed or malformed queue read as an empty board. An HTTP error reply or a non-array body from the queue list now takes the command's existing unchecked-board path and refuses, with or without --force, as connection failures already did; --force still archives despite known in-flight items and records each one. A healthy empty board still removes as before.

Closes #529.
2026-10-02 12:27:45 -07:00
Rudy Mizrahi Celekli 447dd828f7 fix(events): serialize subscriber-generated fanout (#527)
A subscriber's nested emit no longer reorders or duplicates live events: nested notifications and envelope drains wait until every current subscriber has received the parent event, then the existing durable-row drain delivers children in order. A throwing subscriber is still isolated, and an ordinary outer emit still drains before returning.

Closes #526.
2026-10-02 12:24:22 -07:00
ookami ed275c360b fix(daemon): avoid premature readiness timeouts (#530)
Readiness polling during seat start and handover successor launch now uses the whole configured allowance: the backoff is capped at the time remaining, and a final probe runs at the deadline, instead of giving up at the 15-second backoff boundary inside a 30-second window. Initial delay, cap and default timeout are unchanged; an unknown or false probe still never counts as ready, and a late attention result is now classified as attention.

Closes #525.
2026-10-02 12:23:33 -07:00
Rudy Mizrahi Celekli f4ea676d62 fix(paths): recognize contained dot-prefix directories (#524)
Paths under a directory whose name starts with dots (for example ..cache) now count as inside their root, in launch cwd resolution, rig up's path-form spec handling and restore-check evidence. A real parent traversal (..) and a sibling that only shares the root's name prefix still count as outside.

As a result, the existing rule for a launch cwd inside the OpenRig installation now also applies to dot-prefixed folders there when no cwd override is given; an explicit --cwd still works as before.

Closes #494.
2026-10-02 11:58:06 -07:00
ookami bdfc58aeab fix(daemon): report unknown CLI capabilities without false stale warnings (#523)
Mission Control reports an unknown CLI version as unknown instead of a hard-coded 0.2.0, so the fleet view no longer flags every rig as running a stale CLI. A rig counts as stale only when a known version is reported as outdated; field support and version age are tracked separately, and the fleet views gain an unknown-capability count. No new lookup runs at startup.

Closes #488.
2026-10-02 11:52:24 -07:00
Wu Shuwen 70d0bdbf1d fix(daemon): recognize workspace paths starting with dots (#459)
Workspace paths whose directory names start with dots (for example ..cache) are now recognised as inside their workspace root, in both the workspace resolver and the workspace doctor. Paths that really sit outside, including a sibling whose name only shares the root's prefix, still count as outside.

Closes #458.
2026-10-02 11:39:19 -07:00
Mike Schwarz 658bfcb4f6 fix(daemon): keep workflow versions that unfinished work still uses (#512)
When a workflow file is deleted or renamed, the spec cache now keeps every version that an unfinished workflow (active, waiting or failed) still uses, instead of deleting it. Kept versions stay out of the library and discovery, and a later scan removes them once no unfinished work needs them. A rename moves the cached version to its new path.

A parse error at a kept version's path is recorded as a separate diagnostic (named by its full path if the basename is taken) and never rewrites the kept version, and one file's diagnostic failure no longer stops the rest of the folder scan. Versions already removed on existing installs are not restored, and a version blanked by the earlier diagnostic writer is still not readable by name and version.

Refs #511.
2026-10-02 11:12:01 -07:00
Mike Schwarz cd435a5a99 fix(refocus): fewer rig calls per trace so it fits its 2 s budget (#499)
The refocus hook spends fewer rig calls per trace so it fits its time budget. Roots come from one rig config read, made only when they are missing; the seat is taken from the canonical session name when its folder exists. The config read gets only the time left in a shared budget that reserves the configured-content lookup, and is skipped when little is left. No timeout value changes.
2026-10-02 11:00:31 -07:00
Nishil Rathod 6949b0e1a2 fix(daemon): keep literal = session names exact in tmux discovery (#515)
Discovery keeps literal session names that start with "=" exact: window and pane lookups use tmux's exact-target form, so sessions named "lit" and "=lit" each resolve to their own panes. The reported session name stays the raw name.

Closes #492.
2026-10-02 10:56:19 -07:00
Luis Araya 5e90ad4407 fix(daemon): bracket IPv6 hosts in daemon-side endpoint URLs (#493) (#509)
Daemon-side endpoint URLs now bracket IPv6 hosts through one shared formatter: the crash-cart health and guard checks, the startup-proof request, the activity endpoint, and the Pi and stub runners. IPv4, DNS and already-bracketed hosts keep their form; scoped and malformed hosts stay rejected.

Closes #493.
2026-10-02 10:55:55 -07:00
Wu Shuwen f16a0f3376 fix(daemon): bound active HTTP streams during shutdown (#324)
End active and late-opening SSE responses during shutdown while allowing ordinary requests the existing drain budget. Preserve timed-out receipts when connections do not finish, and update startup tracking tests. Closes #166.
2026-10-02 10:52:43 -07:00
Wu Shuwen a02e25aed9 fix(daemon): preserve terminal env for Claude seats (#326)
Forward the managed Claude launch terminal and locale values from the receiving pane while preserving the isolated environment and capability-query boundary.
2026-10-02 10:49:07 -07:00
Mike Schwarz 90970a9275 fix(daemon): avoid stuck findings for posted human asks (#518)
Skip the unclaimed sweep for pending asks whose current human-notification episode has a posted receipt. Keep the original ask visible and preserve other recovery paths. Existing receipt-trust semantics remain unchanged. Refs #514.
2026-10-02 10:02:48 -07:00
Mike Schwarz 716d13a968 fix(daemon): keep cached workflow versions through a spec parse error (#508)
Recording a workflow spec parse error no longer rewrites an existing cached version; it updates or adds a separate error row. Repairing the file clears only diagnostic-only rows; error rows that still hold a stored spec are kept so the old version stays recoverable. A file restored to its cached bytes is skipped again on the next scan. Refs #503.
2026-10-02 06:49:13 -07:00
Mike Schwarz 098f4848f9 docs(skills): remove unshipped inherited-seat references (#510)
The shipped orienting-to-an-inherited-seat skill no longer names two companion skills that do not exist; its edge digest is regenerated.
2026-10-02 06:37:20 -07:00
Mike Schwarz 23c1c701c0 fix(cli): tell a blocked daemon connection apart from a stopped daemon (#504)
When a rig command cannot reach the daemon because the machine blocked the connection (EPERM or EACCES, for example a Codex sandbox), the CLI now says so, keeps the OS cause code, and points to the offline help section instead of telling the user to start a daemon that may be running. A stopped daemon still gets the start advice. Refs #275.
2026-10-02 06:37:04 -07:00
Mike Schwarz 8c242e979b fix(daemon): keep a user's Claude status line and settings intact (#497)
A Claude seat whose cwd is a shared repository no longer replaces that repository's own statusLine command. Only commands OpenRig itself wrote are refreshed; anything else, including multi-line commands, is left as the user wrote it. Refs #421.
2026-10-02 06:36:23 -07:00
Mike Schwarz d0d1113f7c fix(daemon): skip a Claude sidecar older than the pane's Claude process (#500)
Resume-token capture, the refresher's null-fill and its periodic re-stamp ignore a status-line sidecar sampled before the Claude process now running in the seat's pane started, so a seat cannot record or keep refreshing an earlier session's id. Unknown timing captures as before. Stored tokens are not checked, cleared or repaired.
2026-10-02 06:36:05 -07:00
Luis Araya d7cbe27d67 fix(daemon): select newest bounded page in recent-observations (#489) (#506)
The mission-control recent-observations view reads the newest 50 stream items instead of the oldest 50.
2026-10-02 06:07:20 -07:00
Luis Araya cb863a056e fix(daemon): return 400 on unknown audit action verb (#491) (#501)
GET /api/mission-control/audit with an unknown action verb returns a 400 with a clear message instead of a 500; known verbs are unchanged.
2026-10-02 06:06:40 -07:00
Mike Schwarz 37dccd6612 test(scenarios): cover rig down and rendered rig send with stub scenarios (#502)
Adds two behavioural stub scenarios to the library: rig down stops every seat of a rig, and rig send renders the message in the addressed pane (rendered text only). The test-layers help-wanted list is updated, including the runner's current limits.
2026-10-02 06:04:54 -07:00
Shravan Sumanthanan 88f1ef78f7 feat(spec): add per-seat reasoning effort configuration for Claude and Codex (#75) (#320)
Seats can declare a reasoning effort for Claude Code and Codex. It is stored on the seat (migration 092) and survives restore, fresh relaunch, handover and set-model; removing it clears it; a first-start retry with effort is no longer refused. Seats without effort behave exactly as before.
2026-10-02 05:37:46 -07:00
Mike Schwarz 9146d034f1 fix(queue): preserve create identity and report unsaved retry bodies (#495)
rig queue create allocates its ID before sending and, if the outcome is unknown, prints that ID with how to check for the row and retry safely with the same ID and payload; a retry with the same ID but a different body returns the original row with a warning that the new body was not saved. A stopped daemon gets the rig daemon status / start hint.
2026-10-02 05:15:40 -07:00
Mike Schwarz 2dd2c3bc61 docs(as-built): regenerate daemon-core against current source (#446)
The as-built daemon-core module is regenerated against current source: file and route counts, migrations, MCP tools and every code anchor match the stamped commit.
2026-10-02 05:03:53 -07:00
Mike Schwarz ca3fb37370 docs(reference): say pull-request CI runs the UI suite (#485)
docs/reference/developing.md says every pull request runs the UI package tests as a required check, while local npm test leaves them out (run npm run test:ui); the portability report is the advisory check.
2026-10-02 05:03:39 -07:00
Mike Schwarz f463030202 fix(skills): use topology.root in the shipped composer (#486)
The shipped openrig-operating-model composer reads topology.root, the configuration key the CLI supports, so its roots and up commands resolve the topology tree without an environment override.
2026-10-02 05:02:45 -07:00
Mike Schwarz c883c721c9 fix(refocus): explain an unresolved work node and fall back to the work root when no baton is held (#484)
The refocus hook names why a seat's current work could not be resolved, and falls back to the work root only when the seat holds no typed in-progress work; a failed lookup is reported as unknown.
2026-10-02 05:02:27 -07:00
Mike Schwarz bba9648bbd fix(daemon): isolate runtime version probes from stale cwd (#471)
Runtime version checks run from the current working directory when it still exists and fall back to the filesystem root when it has been removed, so preflight no longer reports a missing install for a healthy Pi or OMP. Covers rig up preflight, import and bootstrap planning.
2026-10-02 05:02:02 -07:00
Vaibhav Hajare 79ed7ff588 fix(cli): bracket IPv6 hosts in daemon endpoint URLs (#461)
The CLI brackets IPv6 daemon hosts in every daemon URL it builds, so commands like rig doctor work against a daemon listening on ::1.
2026-10-02 05:01:38 -07:00
Rudy Mizrahi Celekli fb31f39650 fix(tmux): probe canonical session names without prefix matching (#449)
tmux session lookups are exact: a session whose name literally starts with '=' resolves to its own pane, so removing it kills the right pane and leaves a plain-named neighbour alone.
2026-10-02 05:01:02 -07:00
Rudy Mizrahi Celekli 78ab5ceb93 fix(workflow): round-trip colon-bearing versions without Library ID collisions (#441)
Workflow versions that contain a colon get an opaque library ID, so two such versions stay distinct and round-trip; every other ID is unchanged.
2026-10-02 05:00:36 -07:00
Mike Schwarzanddev50-planner bff0142eae docs(as-built): regenerate four work and coordination modules against current source (#470)
coordination-primitive, mission-control, workspace-primitive and
lifecycle-snapshot-restore are checked at e6a391b6: every cited path, symbol,
line and count, with each count beside the command that produces it. Corrects
the qitem id format, cross-host closure targets, closure reasons and outbox
states; the mission-control verbs, web route and notification defaults; the
workspace, missions and projects routes and workspace_json writers; and the
restore outcomes, session selection and restore-check shape. Removes
citations of the superseded architecture.md.

Co-authored-by: dev50-planner <[email protected]>
2026-10-02 03:50:13 -07:00
Mike Schwarzanddev50-planner 75dba3a878 docs(reference): document the Pi seat agent directory, custom models and environment (#469)
Adds a Pi section to rig-spec.md: each seat's agent directory under
$OPENRIG_HOME/state/pi/<session>/agent (set as PI_CODING_AGENT_DIR), where
Pi reads an operator-authored models.json, and the environment the Pi
process receives, as the runner builds it.

Co-authored-by: dev50-planner <[email protected]>
2026-10-02 03:49:46 -07:00
Mike Schwarzanddev50-planner c9c9e200a5 docs: correct developer docs, the capability page and known problems against source (#468)
* docs: correct developer docs, the capability page and known problems against source

Checked against source at e6a391b6:
- developing.md: pull requests run .github/workflows/tests.yml; test:repo
  also builds the daemon and checks context-pack generation.
- rig-spec.md: lists the stub runtime and what it is.
- The onboarding capability page: execution view --project, the three
  first-project recipes, per-seat permission and typing-guard verbs, the
  rig policy permissions namespace, and the web UI being off by default.
- help.md known problems: matched to the open issues and to what main fixes.
- test-system README, scripts README, ROUTING and evals README: match the
  scenario runner, stub launch scripts and eval cases as they exist.

* docs(test-system): say the scenario runner has no proof binding

rig proof show exists. The proof surface is reserved because no scenario
surface reads it (readSurface throws UnboundSurfaceError) and the validator
rejects it (RESERVED_SURFACES).

---------

Co-authored-by: dev50-planner <[email protected]>
2026-10-02 03:49:11 -07:00
Rudy Mizrahi Celekli d410075e48 fix(workflow): recover repaired diagnostic rows in place (#442)
* fix(workflow): recover repaired diagnostic rows in place

Signed-off-by: Rudy Celekli <[email protected]>

* fix(workflow): type optional diagnostic cache columns

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 02:05:50 -07:00
Mike Schwarzandv-openrig-build b7ec2f8092 docs(skills): repair references in shipped public guidance (#467)
Co-authored-by: v-openrig-build <[email protected]>
2026-10-02 02:05:28 -07:00
Rudy Mizrahi Celekli 875d359a3f fix(workflow): refresh changed files within the cache second (#435)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 01:52:20 -07:00
Rudy Mizrahi Celekli 6872516960 fix(execution): include supported README mission and slice nodes (#438)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 01:38:44 -07:00
Rudy Mizrahi Celekli 032a5e2f29 fix(queue): rebase approved handoff advisory onto current main (#341)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 01:38:24 -07:00
Mike Schwarzanddev50-planner ad59ac9d0c docs(as-built): regenerate four daemon architecture modules against current source (#454)
adapters-and-runtimes, agent-spec-and-startup, architecture-rules-and-event-system
and transport-and-transcripts are checked at 264fade9: every cited path, symbol,
line and count, with each count beside the command that produces it. Corrects
the runtime adapter set, startup and restore states, the RigEvent union, the
transcript capture mechanism, the chat and send behaviour and the MCP tool count,
and removes citations of the superseded architecture.md.

Co-authored-by: dev50-planner <[email protected]>
2026-10-02 01:30:47 -07:00
Rudy Mizrahi Celekli 0b14b07329 fix(terminal): preserve UTF-8 across pipe polling boundaries (#456)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 01:30:28 -07:00
Rudy Mizrahi Celekli f37b25f4ef fix(provider): report when all exhausted windows reset (#455)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 01:30:05 -07:00
Wu Shuwen e6a391b66c fix(daemon): verify Claude resume lineage when pane identity is opaque (#335)
* fix(daemon): trust exact Claude resume lineage

* fix(daemon): verify wrapped Claude composer identity

* fix(restore): require strict foreground resume proof

* fix(daemon): reject failed headerless reconciliation proof

* test(daemon): retain inconclusive resume after main update
2026-10-02 01:17:14 -07:00
Wu Shuwen 0a108305f4 fix(restore-check): use SQLite queue and selected Claude hooks (#130) (#328)
* fix(restore): inspect current queue and hook stores (#130)

* fix(restore-check): match the exact projected Claude hook command

* fix(daemon): retain caveats for unusable activity hooks
2026-10-02 01:14:12 -07:00
Wu Shuwen ebfd05f13a fix(daemon): preserve executable modes in rig bundles (#321)
* fix(daemon): preserve executable modes in rig bundles

* fix(daemon): preserve restrictive bundle file modes
2026-10-02 00:52:21 -07:00
GoheerandClaude Opus 5 e41f4653dd fix(daemon): parse the Host header so IPv6 same-host Origin checks match (#411)
Both Origin checks took the hostname from the Host header with
`split(":")[0]`. For a bracketed IPv6 authority like `[fd7a::1]:7433` that
yields `[fd7a`, so the same-host comparison could never match and the web UI
opened at a non-loopback IPv6 address had its own requests refused.

Add `hostHeaderHostname()` next to the /api guard and use it in both places.
It parses the header with URL rules, matching the normalization
`new URL(origin).hostname` already applies to the Origin side, so brackets,
case and zero compression all compare equal. Values that are not a bare
host[:port] (userinfo, a path, a query or a fragment) return "", which never
matches an Origin, so a crafted Host cannot widen the same-host comparison.

Fixes #405

Co-authored-by: Claude Opus 5 <[email protected]>
2026-10-02 00:49:17 -07:00
Mike Schwarzandv-openrig-build 1cb80c3d6b test(proof): wait for the source watcher to report a status-only change (#448)
"invalidates proof sources when only mission status changes" starts
watchProofSources and writes the manifest in the same tick. On macOS, fs.watch
arms its recursive FSEvents stream asynchronously, so a write made before the
stream is live is never reported. The test then saw zero events for the whole
5-second window, which failed intermittently on loaded CI runners.

Rewrite the unchanged draft bytes until the watcher reports. The proof basis
changes once, so the test still asserts exactly one proof.sources_changed
event and one invalidation. Product behaviour is unchanged; the watcher's
quiet refresh already repairs a missed early event.

Claude-Session: https://claude.ai/code/session_0111rhBDUYTL2n3Dbr2HDJf1

Co-authored-by: v-openrig-build <[email protected]>
2026-10-02 00:48:58 -07:00
Rudy Mizrahi Celekli 72191c5729 fix(tui): preserve literal command argument whitespace (#443)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:43:20 -07:00
Duc Nguyen fed59d6d14 fix(tmux): detach seat views before destroying the session (#187)
* fix(tmux): detach seat views before destroying the session

An operator detach-on-destroy off switches a herdr attach onto another
live session when that seat is killed. Pin the option on fresh sessions
and detach clients before kill-session. An unexpected detach failure
stops that session's kill instead of being reported as success.

* test(tmux): expect detach-client before kill on the argv path

The #167 argv sequence test still listed only kill-session, so daemon package tests failed after detach-first teardown.
2026-10-02 00:22:12 -07:00
Rudy Mizrahi Celekli 264fade906 fix(cli): honor external queue sources as declared body claims (#440)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:19:40 -07:00
Rudy Mizrahi Celekli 5887d3b996 fix(proof): read slice-local review artifacts in project views (#427)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:11:54 -07:00
Rudy Mizrahi Celekli 48f6cce716 fix(tmux): confirm exited session absence during termination (#431)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:10:33 -07:00
Rudy Mizrahi Celekli e39060db49 fix(cli): preserve daemon health and home evidence in guards (#439)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:08:06 -07:00
Rudy Mizrahi Celekli b27190f1aa fix(cli): distinguish kernel wait deadlines from terminal failures (#437)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:07:48 -07:00
Rudy Mizrahi Celekli 263e4dd82d fix(context): preserve physical pack custody across configured root aliases (#436)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:07:08 -07:00
Rudy Mizrahi Celekli 62d548a9d9 fix(queue): advise on unmatched local destination seats (#337)
* fix(queue): validate persisted destination seat membership

Signed-off-by: Rudy Celekli <[email protected]>

* fix(queue): advise on unmatched local destination seats

Signed-off-by: Rudy Celekli <[email protected]>

* test(queue): keep missing rig fixtures independent of human registry

Signed-off-by: Rudy Celekli <[email protected]>

* fix(queue): advise on dotted pod logical ID destinations

Signed-off-by: Rudy Celekli <[email protected]>

* fix(queue): keep destination advice best effort

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:06:35 -07:00
Rudy Mizrahi Celekli 51dc6c97e5 fix(cli): recognize dotted registered hosts in file operands (#368)
* fix(file): resolve dotted host qualifiers in copy operands

Signed-off-by: Rudy Celekli <[email protected]>

* test(pi): publish offline fixture readiness after its receipt

Signed-off-by: Rudy Celekli <[email protected]>

* fix(cli): preserve local dotted file operands

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:03:32 -07:00
Rudy Mizrahi Celekli 74b8b46f5c fix(slack): reconcile ambiguous posts across bounded history pages (#395)
* fix(slack): reconcile across bounded history pages

Signed-off-by: Rudy Celekli <[email protected]>

* fix(slack): retry after bounded partial reconciliation scans

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:01:44 -07:00
Rudy Mizrahi Celekli 5197fb9483 fix(workflows): restrict cache removal to the scanned folder (#433)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:00:49 -07:00
Rudy Mizrahi Celekli 75acf5510e fix(tui): keep refreshed local reader selection in bounds (#434)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:00:25 -07:00
Rudy Mizrahi Celekli 4fbf56c0c6 fix(tui): decode application-cursor arrow keys (#429)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-02 00:00:07 -07:00
Rudy Mizrahi Celekli 907d104339 fix(tui): show superseding arrangement in source cards (#428)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 23:59:30 -07:00
Rudy Mizrahi Celekli 1c89408e38 fix(proof): watch the owning project for nested mission roots (#373)
* fix(proof): watch the owning project for nested mission roots

Signed-off-by: Rudy Celekli <[email protected]>

* fix(proof): constrain recursive source watching

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 23:59:07 -07:00
Rudy Mizrahi Celekli e16076bd3a fix(scope): recognize CRLF frontmatter delimiters (#378)
* fix(scope): read CRLF frontmatter without losing authored IDs

Signed-off-by: Rudy Celekli <[email protected]>

* test(scope): pin complete frontmatter closing delimiters

Signed-off-by: Rudy Celekli <[email protected]>

* fix(scope): retain whitespace on frontmatter delimiters

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 23:58:27 -07:00
Rudy Mizrahi Celekli ccf4027e11 fix(cli): report failed operating-mode citation reads (#426)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 23:58:04 -07:00
008c9faada fix(daemon): bring 0.6.4's browser boundary, legacy-launch retention and browser docs to main (#407)
* fix(restore): retain inconclusive legacy Claude launches (#346)

Co-authored-by: v-openrig-build <[email protected]>
(cherry picked from commit eef01465a3)

* fix(daemon): check target name and browser origin once on /api (#358)

The daemon now checks every /api request once, before any route or cross-host read-through runs, including WebSocket upgrades.

- Target names: localhost, IP literals, this machine's own names and its own MagicDNS name are accepted without setup; other names are refused with a remedy (OPENRIG_ALLOWED_HOSTS, or a configured bearer token, which waives only the name check).
- Browser origins: when present, an Origin must be the built-in UI's own origin (with the web UI enabled) or listed in OPENRIG_ALLOWED_ORIGINS; a token never overrides an origin refusal.
- Host and Origin are read from the raw request headers, so duplicate or empty values are refused rather than collapsed.
- Refusals are a 403 with a one-sentence remedy and code; rig ps and the TUI now show it. Refusal logging is sanitized, bounded and deduplicated.
- Route-level authorization is unchanged.

Adapted for main: the existing /api Origin guard (apiOriginProtection) and the
terminal WebSocket Origin check stay in place. The boundary is mounted before the
Origin guard, so its refusal codes and remedies are what callers see; the terminal
route and its tests are unchanged from main.

(cherry picked from commit 7d77d73b9c)

* docs: add browser access reference (#372)

Adds docs/reference/browser-access.md (which addresses and browser pages the
daemon accepts, the two allowances, refusal remedies and limits) and links it
from the help guide's daemon-access section.

Co-authored-by: dev50-planner <[email protected]>
(cherry picked from commit a3cc6c8a10)

* test(daemon): expect the browser boundary's refusal from the real app

On the real daemon app the /api browser boundary now runs before the Origin
guard, so a cross-origin browser request is refused with the boundary's code
(browser_origin_refused) and remedy. The status stays 403; the middleware-level
cases of the Origin guard are unchanged.

* docs(reference): name the allowed origin the web UI needs at other names

On main the terminal WebSocket check and the /api Origin guard stay in place
alongside the browser boundary, so the web UI opened at a non-loopback name or
address needs that page's exact origin in OPENRIG_ALLOWED_ORIGINS.

---------

Co-authored-by: v-openrig-build <[email protected]>
Co-authored-by: dev50-planner <[email protected]>
2026-10-01 21:19:03 -07:00
Mike Schwarzanddev50-planner 5b0a8ccc96 docs: the scenario runner drops an ambient TMUX instead of refusing it (#408)
run-scenarios.mjs builds the scaffold environment from HOME, PATH and TERM
only, so an ambient TMUX and daemon variables are dropped and running from
inside tmux is safe. ARCHITECTURE.md and the runner's header said it refuses
to start inside tmux.

Co-authored-by: dev50-planner <[email protected]>
2026-10-01 21:15:12 -07:00
Mike SchwarzandOpenRig contributors 1f555fb84b docs(skills): route simple seat additions to rig grow (#406)
The topology skill named rig expand four times and rig grow never, and
openrig-user only showed fragment-based additions. Point simple additions
(default agent spec, one runtime, one cwd, optionally a new pod) at rig grow,
and say when a fragment with rig expand or rig add is still needed.

openrig-user also documented rig add with the wrong arguments and a
rig add-member alias that does not exist; both are corrected.

Co-authored-by: OpenRig contributors <[email protected]>
2026-10-01 20:59:43 -07:00
Rudy Mizrahi Celekli d7e716c909 fix(cli): probe IPv6 hosts without URL brackets (#398)
* fix(host): probe IPv6 status addresses without URL brackets

Signed-off-by: Rudy Celekli <[email protected]>

* test(pi): publish offline fixture readiness after its receipt

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:48:23 -07:00
Rudy Mizrahi Celekli 34277827c8 fix(cli): preserve remote daemon health verdicts in host doctor (#396)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:44:37 -07:00
Rudy Mizrahi Celekli d000fb2bb8 fix(slack): preserve complete inbound human briefs (#397)
* fix(slack): retain complete inbound human message bodies

Signed-off-by: Rudy Celekli <[email protected]>

* test(slack): type the inbound event retry store

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:33:33 -07:00
Rudy Mizrahi Celekli 67c4851ea3 test(pi): publish offline fixture readiness after its receipt (#392)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:28:58 -07:00
Rudy Mizrahi Celekli b5e2947a45 fix(cli): report environment status HTTP failures (#382)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:28:49 -07:00
Rudy Mizrahi Celekli 81c4d1054f fix(cli): bound workflow stream connection waits (#381)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:28:39 -07:00
Rudy Mizrahi Celekli 68ea8325cf fix(tui): back off repeated notification stream drops (#380)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:28:27 -07:00
Rudy Mizrahi Celekli 570f362748 fix(cli): parse YAML context names when installing local packs (#370)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:28:18 -07:00
Rudy Mizrahi Celekli b9ed6bf79b fix(missions): complete the authored manifest status (#386)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:28:07 -07:00
Rudy Mizrahi Celekli 14c37af4f6 fix(proof): prepare evidence against the owning project root (#394)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:27:57 -07:00
Rudy Mizrahi Celekli 529ccd61ff fix(proof): remove temporary receipts after write failures (#383)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:27:47 -07:00
Rudy Mizrahi Celekli 9cb0934846 fix(proof): include mission status in readiness revisions (#366)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:27:38 -07:00
Rudy Mizrahi Celekli d797d63f8e fix(skills): retain fenced examples in shipped markdown resolver (#388)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:22:26 -07:00
Rudy Mizrahi Celekli b5bbdfcf2d fix(terminal): preserve remote session quoting across SSH shells (#369)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:22:08 -07:00
Rudy Mizrahi Celekli b75e9cde04 fix(slack): settle inbound completion when stopping reconnect backoff (#387)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:21:21 -07:00
Rudy Mizrahi Celekli a46f7312c0 fix(slack): retain concurrent dead letters across retry snapshots (#377)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:20:58 -07:00
Rudy Mizrahi Celekli 50f747bc4a fix(slack): contain dead-letter retry storage errors (#390)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:16:12 -07:00
Rudy Mizrahi Celekli e6828b73e1 fix(slack): resolve matching quoted env-file secrets (#376)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 18:15:41 -07:00
Rudy Mizrahi Celekli 6b60035416 fix(hosts): reject unreadable remote response bodies (#336)
* fix(hosts): reject unreadable remote response bodies

Signed-off-by: Rudy Celekli <[email protected]>

* fix(queue): preserve indeterminate forwarded write guidance

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 17:35:31 -07:00
Luis Araya b43ff0d6fd fix(cli): bound kernel readiness HTTP fetch and reads to remaining deadline (#359) (#363) 2026-10-01 17:32:32 -07:00
Mike SchwarzandOpenRig contributors 71e66bfa25 fix(daemon): evaluate the busiest ceremony families past the family limit (#357)
* fix(daemon): evaluate the busiest ceremony families past the family limit

When more than 200 handoff families had queue activity in the observation
window, the passive ceremony source threw health_passive_family_limit. Health
reads combine all sources, so the whole projection failed: `rig health` and
the TUI HEALTH view returned an error instead of any finding, including
context pressure, and the scheduled evaluation recorded only that error.

Past the limit the source now evaluates the 200 families with the most queue
transitions in the window, breaking ties by lineage ID. A family qualifies by
its transition count, so this keeps every family that could qualify unless
more than 200 do. Families at or below the limit are evaluated exactly as
before.

The result says it is partial. The health list and `rig health policy`
(engine.lastEvaluation.coverage) report the source's total, evaluated and
omitted counts, the limit and the order. `rig health` and the TUI HEALTH view
mark it PARTIAL. Omitted families were not evaluated and are never presented
as healthy.

* fix(daemon): report the scheduled evaluation's own coverage

The scheduled evaluation read the passive source's latest coverage after the
whole evaluation finished. A health read served while it awaited delivery
replaced that coverage, so the evaluation reported another read's counts.
When diagnosis policy is disabled, no read happens, and it reported coverage
left by an earlier request.

The evaluation now snapshots coverage right after its own read and returns it
with the result; a skipped evaluation returns null. The TUI summary line puts
PARTIAL before the variable-length finding summary, so a narrow line cannot
truncate it away.

---------

Co-authored-by: OpenRig contributors <[email protected]>
2026-10-01 16:34:09 -07:00
71506f6ed9 fix(cli): validate rig ask --wake-timeout before handing it to execFile (#356)
* fix(cli): validate rig ask --wake-timeout before handing it to execFile

`--wake-timeout abc` became NaN and `--wake-timeout 1.0005` became
1000.5ms. execFile rejects both with ERR_OUT_OF_RANGE, so the wake
crashed with a stack trace (and printed no JSON under --json). Reject a
non-finite value with a clear message before any daemon or runtime
call, and round the timeout to whole milliseconds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(cli): bound rig ask --wake-timeout to what a Node timer honours

Review follow-up: `--wake-timeout 1e308` passed the finite-seconds check
but overflowed to Infinity ms, which execFile still rejects. And any
value of 2^31 ms or more (about 24.8 days) is run by Node's timer after
1ms, so the wake was killed at once and reported as timed out. Check the
converted milliseconds against 2^31-1 before any daemon or runner call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Coder8124 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-10-01 16:19:59 -07:00
8983aece22 fix(cli): reject a non-numeric chatroom wait --timeout instead of spinning (#355)
`rig chatroom wait --timeout abc` parsed to NaN. Neither timeout check
ever fired and the poll slept Math.min(3000, NaN), which Node runs as
~1ms, so the command polled the daemon's chat history in a tight loop
forever. Validate --timeout up front and exit 1 with a clear message
before contacting the daemon.

Co-authored-by: Coder8124 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-10-01 16:19:37 -07:00
Luis Araya fecd5979c1 docs(gateway): clarify connectorRef and secretsRef in gateway human add (#312) (#354) 2026-10-01 15:27:04 -07:00
Luis Araya f9e0df86ec fix(cli): clarify that rig seat handover performs mutation unless --dry-run (#315) (#351) 2026-10-01 14:58:17 -07:00
Luis Araya 60ffa7dd8b fix(tui): distinguish retired and deferred slices from planned (#343) (#350) 2026-10-01 14:57:12 -07:00
Luis Araya fde9a50eb2 fix(cli): return early on unverified daemon status (#342) (#349) 2026-10-01 14:09:29 -07:00
Mike Schwarzandv-openrig-build 5c13e08fd6 test(omp): give the OMP adapter test the staged launch path (#347)
OmpRuntimeAdapter and OmpResumeAdapter extend the Pi adapters. Since #212,
Pi-family launches send the runner command through
TmuxAdapter.sendShellCommand instead of sendText followed by Enter. #35's
CI ran before #212 merged, so its test mock only had sendText and sendKeys.
On main, all five OMP adapter tests fail with "this.tmux.sendShellCommand
is not a function".

OMP shares the Pi runner, so it should inherit Pi's launch transport. This
is a test-only change: the fake tmux now exposes sendShellCommand, and the
three assertions read the launch command from it.

Refs #35
Refs #212

Claude-Session: https://claude.ai/code/session_0111rhBDUYTL2n3Dbr2HDJf1

Co-authored-by: v-openrig-build <[email protected]>
2026-10-01 13:01:55 -07:00
MelonSmasher 93f8d4abba feat: add isolated Oh My Pi runtime adapter (#35)
Add `runtime: omp` as a managed runtime that runs Oh My Pi through
OpenRig's RPC runner, separate from `runtime: pi`.

Runner and launch:
- Share the Pi RPC runner with OMP-specific launch arguments, approval
  mode (`always-ask` floor, `yolo` under a full-bypass policy), and a
  deny-by-default environment allowlist.
- Isolate each seat under `$OPENRIG_HOME/state/omp/<seat>` with a per-seat
  HOME so OMP never reads the operator's `~/.omp` or `~/.env`. Resolve the
  real `omp` binary first so version-manager shims keep working.
- Cancel headless approval/input requests and keep the seat in
  needing-attention until the next agent run; surface rejected prompts and
  in-turn model/provider errors once per turn.

Identity and resume:
- Persist the OMP session file as the resume token only once it exists on
  disk and matches the seat's own session file; retry identity delivery
  until the daemon confirms the token.
- Validate the persisted seat runtime and session name on identity hooks,
  and report `tokenPersisted` from the stored state for RPC runtimes.
- Capture and resume OMP session files through claim, handover, and
  restore paths.

Recognition and docs:
- Recognize OMP in RigSpec validation, preflight (`omp --version`),
  runtime verification, session fingerprinting, and discovery.
- Document OMP state, credentials, approval posture, model errors, and
  restore in the RigSpec reference; add OMP UI branding.
2026-10-01 10:54:19 -07:00
Rudy Mizrahi Celekli a7e7598f69 fix(seat): resolve status by durable canonical coordinates (#340)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 10:43:12 -07:00
Rudy Mizrahi Celekli 8ef26dc009 fix(scope): align progress scaffolds with proof acceptance (#338)
* fix(scope): align progress scaffolds with proof authority

Signed-off-by: Rudy Celekli <[email protected]>

* test(scope): preserve legacy progress editing with outcome scaffolds

Signed-off-by: Rudy Celekli <[email protected]>

* test(progress): retain persisted scaffold classifier fixtures

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 10:34:44 -07:00
Rudy Mizrahi Celekli 28ca2476a6 fix(scope): refuse stale mission composition plans (#339)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 10:17:34 -07:00
Rudy Mizrahi Celekli e0de9f1bc4 fix(cli): report missing optional Slack feature scopes (#334)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 10:11:25 -07:00
Rudy Mizrahi Celekli b83b97fa44 fix(slack): enforce inbound file limits while streaming (#333)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 10:07:54 -07:00
Rudy Mizrahi Celekli a45e18ecf1 fix(slack): return actionable registry enable errors (#332)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 10:07:45 -07:00
Rudy Mizrahi Celekli a2ebf97719 fix(daemon): Preserve recap continuity when publication fails (#209)
* fix(daemon): preserve current recap when replacement publication fails

Signed-off-by: Rudy Celekli <[email protected]>

* fix(daemon): copy recap archives when hard links are unsupported

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 10:03:46 -07:00
Rudy Mizrahi Celekli 95d7a1b878 fix(pi): stage long launch commands outside canonical tty input (#212)
* fix(pi): stage long launch commands outside canonical tty input

Signed-off-by: Rudy Celekli <[email protected]>

* test(pi): use staged command helper in fork fixture

Signed-off-by: Rudy Celekli <[email protected]>

* fix(pi): preserve live readiness and short-command launch paths

Signed-off-by: Rudy Celekli <[email protected]>

* fix(pi): fall back to direct launch under long temporary paths

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 10:00:16 -07:00
Rudy Mizrahi Celekli 3ff5eff0fc fix(daemon): retire stopped session oracle evidence (#288)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 09:57:18 -07:00
Rudy Mizrahi Celekli 4068baf1a2 fix(plugin): include built-in agents in reverse usage (#262)
* fix(plugin): include library roots in reverse usage

Signed-off-by: Rudy Celekli <[email protected]>

* fix(plugin): retain cold legacy spec roots at startup

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 09:56:10 -07:00
Wu Shuwen e1baed7b87 fix(cli): render remote up error bodies (#329) 2026-10-01 09:50:11 -07:00
Rudy Mizrahi Celekli 1d250d7420 fix(daemon): Ignore watchdog receipts for superseded queue parks (#210)
* fix(daemon): ignore superseded park bindings in watchdog receipts

Signed-off-by: Rudy Celekli <[email protected]>

* fix(queue): preserve shared watchdog current bindings

Signed-off-by: Rudy Celekli <[email protected]>

* fix(queue): retain timer lifecycle after watchdog reattachment

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 09:48:31 -07:00
cdc22865fd refactor(daemon): use the shared SQLite time parser in three more places (#330)
health-detectors.ts, snapshot-repository.ts and restore-plan-preview.ts each
kept a private copy of the SQLite-stamp-to-UTC conversion that sqlite-time.ts
now provides. The copies had drifted:

- restore-plan-preview always appended "Z", so an already-zoned ISO
  last-verified stamp became "...ZZ", parsed to NaN, and skipped the
  freshness check: a 2h-old token showed as present instead of stale.
- health-detectors treated any value containing "T" as zoned, so a
  zone-less ISO value would have been read as host-local time.

All writers currently store datetime('now') stamps, so neither drift was
reachable in production; this removes the traps rather than fixing a live
bug. Adds a restore-plan-preview case for the ISO stamp (fails before this
change) and a helper case for the T-separated zone-less form.

Co-authored-by: Coder8124 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-10-01 09:47:25 -07:00
Rudy Mizrahi Celekli 7d43151ec5 fix(daemon): Compile lifecycles under configured mission roots (#211)
* fix(daemon): resolve lifecycle projects from configured mission roots

Signed-off-by: Rudy Celekli <[email protected]>

* fix(daemon): preserve missing lifecycle manifest response

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 09:46:25 -07:00
Rudy Mizrahi Celekli aeb8816010 fix: Preserve UTF-8 commands split across control socket chunks (#203)
* fix(tui): decode control commands across UTF-8 chunks

Signed-off-by: Rudy Celekli <[email protected]>

* test(tui): keep UTF-8 control sockets in private temporary directory

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 09:46:18 -07:00
Rudy Mizrahi Celekli 2a697d45ba docs(services): clarify HTTP readiness response semantics (#214)
* fix(daemon): require 2xx service readiness responses

Signed-off-by: Rudy Celekli <[email protected]>

* docs(services): clarify HTTP readiness response semantics

Signed-off-by: Rudy Celekli <[email protected]>

* docs(services): distinguish HTTP wait success from app readiness

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 09:46:09 -07:00
Rudy Mizrahi Celekli a36fa1a4e2 fix(restore): skip non-object JSONL records (#291)
* fix(restore): skip non-record JSON values in both transcript parsers

Signed-off-by: Rudy Celekli <[email protected]>

* fix(cli): skip non-object records during restore runtime detection

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 09:44:16 -07:00
Mike Schwarzandv-openrig-build bd41d7b181 fix(daemon): carry native Claude delivery onto main (#327)
Carry the accepted repair from #310 while preserving main's Codex activity guards and exact restored-identity reconciliation.

Refs #197

Co-authored-by: v-openrig-build <[email protected]>
2026-10-01 09:35:03 -07:00
Wu Shuwen 6f7d6a4ee4 fix(daemon): relaunch after stopping the last seat (#325) 2026-10-01 08:51:21 -07:00
Wu Shuwen dc6ab9eed5 docs(cli): clarify context trace seat value (#323) 2026-10-01 08:03:13 -07:00
Wu Shuwen e5681fc4c8 docs(cli): clarify broadcast pod scope (#322) 2026-10-01 08:02:51 -07:00
Shravan Sumanthanan 065df99929 fix(security): prevent temporary file permission leaks, DNS rebinding on terminal WS, and path traversal in bundle unpacking (#292)
* fix(security): enforce mode 0600 and exclusive creation on sendText temporary files

* fix(security): prevent DNS rebinding terminal hijack and add OPENRIG_ALLOWED_ORIGINS support in terminal WebSocket

* fix(security): reject backslash path traversal and Windows drive absolute paths in bundle unpacking

* fix(security): tighten loopback IP and URL origin matching in terminal-ws

* fix(security): only unlink temporary file in sendText if created by this call
2026-10-01 07:40:25 -07:00
KorallisandClaude Opus 5.5 51676aa204 perf(daemon): capture every seat's pane in a few tmux calls per structural sweep (#308) (#309)
* perf(daemon): capture every seat's pane in a few tmux calls per structural sweep (#308)

The structural activity sweep forked one `tmux capture-pane` per running seat
every tick; each fork blocks the event loop ~12-20 ms at ~1 GB RSS, and a
73-seat host spent about a third of its main thread in spawn (#308).

TmuxAdapter.capturePanesContent: one `list-sessions`, then the live sessions
in chained calls of at most 24 (`display-message` marker unique to the call,
then `capture-pane`, exact `=<name>:` targets), each pane's text identical to
capturePaneContent's. A missing session maps to null without a fork. tmux
stops a chain at its first failing command, so a failing chunk is split in
half and retried: an output over the exec buffer fits, and a session gone
since the listing is isolated and left to the per-seat read. No listing ->
null -> the sweep reads per seat as before.

The sweep uses it once per tick: 1 + ceil(live/24) calls instead of one per
seat (72 live seats: 4 instead of 72). pollSeat takes the prefetched text and
otherwise captures per seat; MF1 (a null capture invalidates) and MF2
(single-flight) are unchanged. Exact targets also resolve a session name with
a ".", which `-t <name>` reads as window.pane.

Tests: the adapter against a fake tmux with real chain semantics in both the
shell-string and argv modes (listing + one call, missing -> null, chunks of
24, a vanished session isolated, an over-buffer chunk split, no listing ->
null, marker nonce), and the sweep (one batch, MF1, per-seat fallback).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* docs(daemon): doc comments on the batched capture helpers (review)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(daemon): a batched capture keeps its own time; a slow later chunk can't renew it (review)

The sweep waited for every batch and then stamped each pane's text as observed
"now", so a slow later chunk renewed older captures as fresh: an idle pane's
5.2 s-old active text was projected as running where main lets it expire.

capturePanesContent returns { text, capturedAt } per target, capturedAt being
when that target's own chunk was read (missing sessions: the listing time);
it takes the service's clock. pollSeat stores that time as observedAt, so the
freshness window ages each capture from when it was actually read.

Tests: a slow second chunk gets its own later capturedAt while the first
chunk keeps its earlier one (both exec modes); after a 5.2 s sweep an early
capture is past the 5 s window and is not served, while a fresh one is.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-01 07:36:51 -07:00
KorallisandClaude Opus 5.5 9dc0c3f1e3 fix(queue): a human-closed row's resolved notice opens no delivery episode (never-posted after a posted ALERT) (#296)
* fix(queue): a human-decision-resolved notice on a closed row opens no delivery episode

Rows a human closed by a direct Slack reply read deliveryOutcome=never-posted although their ALERT was posted. The close
writes a human-decision-resolved owner notification, which the Slack outbound never posts (listHumanAlerts lists active
rows only). The ledger took it as the current episode, found no receipt for its key, and reported never-posted after the
post window. On a row that is no longer active, the episode now falls back to the latest outbound notice
(human-required / human-update). Active rows are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(queue): judge a resolved notice by its own transition, and resolve the closing human (review)

Maintainer review: the fallback used the row's CURRENT state, so a resolved
NOTICE that was really posted (or transport-failed) while the row was active
lost its outcome once an agent later closed the row. The fallback now applies
only when the resolved notice's own transition closed the row, i.e. a human's
direct reply closing it; a notice written while the row stayed active keeps
its own outcome whatever happens to the row later.

CodeRabbit: after the fallback the recipient came from the row's current
destination, so an agent's row that had been parked on the human (its
destination the agent, blocked_on cleared by the close) read inactive. The
recipient is now the human who closed it (the resolved notice's actor).

Tests: "notice posted while active, then the agent closes the row" for posted
and transport-failed receipts; an agent's row parked on the human, ALERT
posted, closed by the human's reply -> posted.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-01 07:22:42 -07:00
Mike SchwarzandOpenRig contributors 451e373165 fix(cli): replace proof artifacts without writing through links (#314)
* fix(cli): replace proof artifacts without writing through links

`rig proof add --replace` opened the existing artifact name with the "w"
flag. That follows a symlink and truncates a shared inode, so replacing
an artifact name that was a symlink or hard link overwrote the other
path's bytes, including files outside the slice and proof media.

--replace now writes a uniquely named staging file next to the artifact,
created exclusively, and renames it over the name. The old link or inode
is never opened for writing, so other paths keep their bytes. A failed
write or rename leaves the target as it was and removes only the staging
file this call created; the original error is reported. A self-sourced
replace still works because the source is read before the write. The
non-replace path keeps its exclusive-create refusal.

The replaced artifact is a new inode with default permissions. There is
no fsync, so this is a directory-entry swap, not a crash-durability
guarantee.

* fix(cli): keep artifact permissions and the first failure on proof replace

An explicit --replace of an existing regular artifact now carries its
permission bits onto the staging file before the swap, so a replacement
never broadens access (a 0600 artifact stays 0600; a read-only artifact
is replaced and stays read-only). A symlinked or new name still gets
default permissions.

The write and close failures are collected separately: the first one is
reported and a later close failure is a warning. A close failure on its
own still refuses the rename, and the target keeps its bytes either way.

* fix(cli): create the proof replace staging file no wider than the artifact

The exclusive staging open now passes the replaced artifact's permission
bits (or the default 0666 for a symlinked or new name) as its creation
mode, so the staging file is never created wider than the artifact it
replaces. The fchmod still sets the exact bits regardless of umask.

---------

Co-authored-by: OpenRig contributors <[email protected]>
2026-10-01 06:23:13 -07:00
6a2b804c23 fix(daemon): Codex 0.157/0.158 idle composer (#100) plus a far Working row reads active (#295)
* fix(daemon): recognise the Codex 0.157 empty-composer placeholder as idle

Codex 0.157 renders a fixed placeholder in the empty composer
(`› Ask Codex to do anything`, codex-rs/tui/src/chatwidget.rs `PLACEHOLDER`)
and its footer (`← for agents · ? for shortcuts`) no longer carries the
`· Context [` status bar. Once the activity hook ages out
(AGENT_ACTIVITY_FRESHNESS_MS), send readiness falls back to the pane probe,
which classifies an idle Codex 0.157 seat as `unknown`; with --wait-for-idle
every send to such a seat is refused as `target_activity_unknown`.

The placeholder and footer look the same idle and mid-turn. Mid-turn the
status row (`Working … esc to interrupt`) normally sits above the composer,
so the pattern only counts through MID_WORK_PATTERNS. Codex hides that row
while it streams assistant output, so classifySendReadiness also refuses to
let a placeholder-only idle verdict override a display-fresh (<5min)
running/needs_input runtime hook: a running turn stays running until its hook
ages out. An `unknown` hook (e.g. SessionStart) does not block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(daemon): a Codex placeholder composer with a Working row anywhere above it is active (0.158)

Codex 0.158 keeps the 0.157 placeholder (`› Ask Codex to do anything`); its
footer is a status line plus `? for shortcuts`, so the placeholder pattern
covers it. But its status row (`Working … esc to interrupt`) can sit more than
8 non-blank lines above the composer when queued or incoming message blocks
come in between. The mid-work check only looks at the last 8 lines, and an idle
prompt line then falls through to idle_prompt, so a busy seat read idle, and
with its hook aged out a --wait-for-idle send landed mid-turn.

Under the placeholder, a mid-work line anywhere in the capture now gives
agent_active / mid_work_pattern with that line as evidence. A bare prompt keeps
today's stale-scrollback behaviour. Tests: 0.158 idle and busy pane tails
(redacted from live seats), the far Working row (classifier and a
--wait-for-idle send with an aged-out hook), and a bare prompt with stale
Working text beyond the window still idle.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(daemon): only Codex's turn-status row counts as busy beyond the 8-line window (review)

The long-range scan under the placeholder matched the generic Working pattern
anywhere in the capture, so completed output such as "• Working directory:
/tmp/project" or "• Working tree is clean." more than eight lines up made an
idle composer read busy, and a --wait-for-idle send timed out. At that range
only the turn-status row now counts: a bullet, a header (Working, or the
reasoning summary Codex shows in its place), then "(<elapsed> • esc to
interrupt)". The 8-line generic check is unchanged.

Tests: both completed-prose cases read idle; a far status row under a
reasoning-summary header reads active; a send with "Working tree is clean."
far above the placeholder is delivered.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Oskar Stępniak <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-10-01 05:42:45 -07:00
KorallisandClaude Opus 5.5 394613e95e fix(slack): read a local attachment through one descriptor (follow-up to #298) (#305)
CodeRabbit on #298: defaultReadLocalImage resolved the path twice, statSync
for the checks and readFileSync for the bytes, so the file checked need not be
the file sent. Now the path is opened once (O_RDONLY | O_NONBLOCK, so a FIFO
can't block the open; it is refused as not a regular file), fstat'ed, and read
from the same descriptor, bounded by the size just checked; the descriptor is
always closed.

Tests: the reader opens the path once and never calls statSync/readFileSync on
it; a FIFO with an attachment extension returns "not a regular file" without
waiting for a writer.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-01 05:39:56 -07:00
Mike Schwarzandv-openrig-build 3fba553a2f docs: describe OpenRig teams as persistent in the npm and Context7 descriptions (#304)
Co-authored-by: v-openrig-build <[email protected]>
2026-10-01 05:11:25 -07:00
Sahil 7ca2724101 feat(slack): clickable questions on human decisions (#193) (#195)
* feat(slack): structured questions with clickable options on human decisions (#193)

- `rig queue create --human-questions-file`: 1-4 questions, 2-4 options each
  (one may be recommended), validated at create; stored by migration 091.
- Slack renders each question as a button row with a complete text fallback;
  a typed thread reply still answers ("Other").
- A block_actions click records that answer on the item; once every question
  is answered the answers are final, one reply row lands on the seat and the
  decision resolves like a typed reply. Failed hand-backs are dead-lettered
  and retried; each click is confirmed in the thread.
- App manifest turns on interactivity (Socket Mode, no request URL); setup
  doc and messaging-the-human skill updated.

* fix(slack): own-key answer lookup; require a human destination for questions(#193)

* fix(slack): redact secrets in answer acknowledgements (#193)
2026-10-01 04:51:28 -07:00
Mike Schwarzandv-openrig-build 29a72ad324 fix(gateway): redact secrets in the Slack file-upload title (#302)
The file title sent with files.completeUploadExternal was the queue summary
(or the file name) as is, while the message text carrying the same summary
already went through redactSecrets. A secret in a row summary was therefore
hidden in the text but shown as the uploaded file's title. The title now
goes through the same redaction. Slack does not parse file titles as mrkdwn,
so the text's control-syntax escaping is not applied to it.

Fixes #300

Claude-Session: https://claude.ai/code/session_01V8RzdrMhGkYLV4rn96kNMN

Co-authored-by: v-openrig-build <[email protected]>
2026-10-01 04:37:17 -07:00
Mike SchwarzandOpenRig contributors d0623e06cb feat(daemon): turn the web UI and its terminal WebSocket off by default (#301)
The daemon no longer serves the web UI's pages, assets and SPA routes, or
registers the web-terminal WebSocket, unless `ui.enabled` is true. Turn them
on with `rig config set ui.enabled true`, then stop and start the daemon.
While the UI is off, a page request answers 404 with those steps, and
`rig ui open` asks the running daemon and prints the same steps instead of
opening the page.

The /api routes, /healthz and the HTTP terminal routes (open, views, preview,
status) answer as before. The guard that ran in front of the HTTP terminal
routes through the WebSocket route still runs when the WebSocket is absent.

Co-authored-by: OpenRig contributors <[email protected]>
2026-10-01 04:34:43 -07:00
KorallisandClaude Opus 5.5 9648c59fe5 fix(slack): form-encode the external-upload calls; attach local video and PDF (#298)
An update row's local evidenceRef screenshot delivered as text only: the daemon
logged "ATTACHMENT upload-url FAILED ...: invalid_arguments (text delivered;
attachment missing)". files.getUploadURLExternal was sent as a JSON POST.
Slack's reference lists JSON for it, but the method reads form fields only and
answers a JSON body with invalid_arguments ("missing required field: length /
filename").

- callWebApi gets a "form-post" shape: url-encoded fields, objects/arrays as
  JSON strings, the way Slack's own Web API client sends every call. Both
  files.getUploadURLExternal and files.completeUploadExternal use it; the
  JSON-POST family (auth.test, apps.connections.open, chat.postMessage) is
  unchanged.
- Local attachments (LOCAL_ATTACHMENT_EXT): the image types plus .mp4, .webm,
  .mov and .pdf, at most 50 MiB (stat before read). LOCAL_IMAGE_EXT still gates
  https Block Kit image blocks (#47), so a video URL never becomes one.
- The byte upload's default timeout grows with the size (15 s + 1 s / 512 KiB).
- An attachment that can't be sent (over the cap, missing, not a regular file)
  logs "ATTACHMENT skipped ... (text delivered; attachment missing)" instead of
  being silently dropped; a non-attachment ref (e.g. PROOF.md) stays silent.

Tests: the slack-images fake now answers a JSON getUploadURLExternal with
invalid_arguments, as live; form shapes for both upload methods; video through
the three legs; the reader's allowlist, cap boundary and skip reasons.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-01 04:29:30 -07:00
Mike Schwarzandv-openrig-build 9480978770 docs: describe OpenRig as a network of agents in the README, npm and Context7 (#297)
The README opening now says what OpenRig is in one sentence (open-source
software for building and running your own network of agents) and closes
with the line about the AI civilization experiments. The npm package
description and the Context7 description use the same short summary:
"Build your own network of agents from Claude Code, Codex and Pi:
long-running teams with roles, shared context and owned work."

Co-authored-by: v-openrig-build <[email protected]>
2026-10-01 04:15:12 -07:00
Sahil 5fe41efa7c feat(slack): let an update post into an earlier item's thread (--reply-to) (#96) (#155)
* feat(slack): let an update post into an earlier item's thread (--reply-to) (#96)

`rig queue create --human-intent update --reply-to <qitemId>` posts the
update under the earlier item's Slack thread instead of a new top-level
post. Decisions keep their own threads.

- Refused with named errors: without --human-intent update
  (reply_to_requires_update), unknown item (reply_to_not_found), or while
  the earlier item still waits on the human (reply_to_open_decision).
- The thread choice is recorded once, before the first post, so retries
  and --verify agree. Only daemon-written records are trusted.
- A missing, closed, other-channel or other-human root falls back to a
  new post; --verify reports threaded: false with the reason.
- If an item is parked on the human again after an update shared its root,
  the new decision gets a fresh root, and a reply in the older root no
  longer answers it.

* fix(slack): address #155 review — seat check, thread_ts ordering, multi-thread tests

- --reply-to falls back with root-other-seat when the root belongs to a
  different seat, so a human reply can't reach the wrong agent. The
  messaging-the-human skill now says to send the update from the seat
  that owns the thread.
- The newest root of a conversation is Slack's latest thread_ts, not
  opened_at, which a rebuild resets. This applies to all outbound thread
  reuse, not only --reply-to.
- Pin that a reply in an older thread of a conversation no longer
  answers its current decision, without --reply-to.
- Pin that the resolved-decision notice never takes the root away from a
  later --reply-to update (Slack-answered decision and resolved park).

* fix(slack): post a --reply-to update top-level instead of refusing it (#155 review)

An update whose --reply-to item still waits on the human is no longer
refused at create time (reply_to_open_decision is gone). Delivery already
falls back: it posts the update as a new top-level message and records
why on the row, so --verify reports threaded: false with
reference-has-live-gate. A missing thread already fell back the same way
(root-missing).

- Still refused: --reply-to without --human-intent update
  (reply_to_requires_update), and an id naming no qitem on this host
  (reply_to_not_found).
- Tests: create accepts a reference with an open decision or a row parked
  on the human; delivery posts both top-level with the fallback reason.
- CLI help and the messaging-the-human skill describe the fallback;
  skill edge digests regenerated.
2026-10-01 04:12:53 -07:00
KorallisandClaude Opus 5.5 c40dbac0c1 perf(daemon): one tmux call per sweep for seat window activity and pane identity (#161) (#293)
The 1 Hz seat-activity sweep ran one `tmux display-message` per seat, and the
identity sweep a getPanePid + getPaneCommand per seat (plus getPanePid again per
native-process sample). At 87 seats that was ~85 tmux spawns/s from the
activity sweep alone and most of the daemon's event-loop time.

- TmuxAdapter.readAllSessionWindowActivity(): one `list-windows -a`, each
  session's CURRENT window activity: the value `display-message -t <session>`
  reads.
- TmuxAdapter.readAllPaneProcesses(): one `list-panes -a`, pane pid + current
  command.
Both use the adapter's argv seam and TMUX_FIELD_SEPARATOR, with the free-text
field (session name, command) last so a separator inside it stays intact.

The sweeps read once and look each seat up, falling back to the per-seat read
on a miss or a failed batch. Direct pollSeat calls still read per target.
Cadence, debounce, arbitration and #169's generation checks are unchanged; each
native-process sample takes its own list-panes, so samples stay independent.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-01 03:58:23 -07:00
Rudy Mizrahi Celekli 3e1c3b0108 fix(scope): reject self dependencies before scaffolding (#286)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 03:20:16 -07:00
Mike Schwarzanddev-driver bb5d17223a fix(daemon): retain bound Claude auto identity across restore (#294)
Co-authored-by: dev-driver <dev-driver@openrig-build>
2026-10-01 03:01:43 -07:00
Mike Schwarzandv-openrig-build 8c4b30bee8 docs(onboarding): tell both doghouse failures and hand over intent, not instructions (#289)
Onboarding piece 01 told only half of the doghouse story: the build that
over-grows (now a light that needs power, not a lock) and then asked "How
big is the dog?", which belongs to the other half. It now tells both: the
moon base, stopped by "does the thing actually need this?", and the tidy
doghouse whose door the dog can't fit through, stopped by "how big is the
dog?". A short paragraph adds that shared understanding of the goal, not
tighter instructions, is what prevents both.

Piece 02's ending becomes "When you need more": the capability map is read
when needed rather than by every seat, a world pack is for planning and
routing work, and the world template is pointed to for people setting one up.

The delegating-work skill gains "Hand over intent, not instructions".

Co-authored-by: v-openrig-build <[email protected]>
2026-10-01 02:28:22 -07:00
Rudy Mizrahi Celekli 82dbc01443 fix(daemon): Select the latest inserted same-second restore snapshot (#206)
* fix(daemon): rank same-second restore snapshots by insertion order

Signed-off-by: Rudy Celekli <[email protected]>

* fix(daemon): handle a restore source pruned between selection reads

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 02:20:39 -07:00
Rudy Mizrahi Celekli 5f33183055 fix(config): report filesystem failures when resetting configuration (#284)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 02:11:25 -07:00
Rudy Mizrahi Celekli 22622b8981 fix: Preserve running TUI control sockets during a second launch (#205)
* fix(tui): preserve live control sockets when launching

Signed-off-by: Rudy Celekli <[email protected]>

* test(tui): keep collision sockets inside isolated temporary root

Signed-off-by: Rudy Celekli <[email protected]>

* fix(tui): serialize stale control socket recovery

Signed-off-by: Rudy Celekli <[email protected]>

* fix(tui): keep standalone terminals usable on socket collisions

Signed-off-by: Rudy Celekli <[email protected]>

* test(tui): build child-process entrypoints before package tests

Signed-off-by: Rudy Celekli <[email protected]>

* fix(tui): recover reservations abandoned by killed launchers

Signed-off-by: Rudy Celekli <[email protected]>

* fix(tui): expose the complete selected control endpoint for copying

Signed-off-by: Rudy Celekli <[email protected]>

* test(tui): verify recovered endpoint without assuming inode allocation

Signed-off-by: Rudy Celekli <[email protected]>

* test(tui): size long socket fixture from byte budget

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 01:51:34 -07:00
Mike SchwarzandOpenRig contributors 809c338843 fix(cli): report a mutating handover's timeout as an unknown outcome (#198)
A mutating `rig seat handover` (and `rig handover`, which shares it) waits up to
120 s for the daemon (#260). When the client reaches that bound the daemon may
still be working, so the handover's outcome is unknown, but the CLI surfaced only
a raw transport timeout (reported in korallis/agent-stack#32).

The CLI now prints "handover outcome unknown" in text and JSON, exits 1, and
makes no second request. It tells the user to inspect the seat before any new
handover, and that a result shown there may belong to an earlier attempt.
A completed or refused handover, a connection failure, and dry-run behave as
before.

Co-authored-by: OpenRig contributors <[email protected]>
2026-10-01 01:26:01 -07:00
Rudy Mizrahi Celekli d70c5995a6 fix(bundle): retain recovery exports for inaccessible declared skill paths (#274)
Signed-off-by: Rudy Celekli <[email protected]>
2026-10-01 00:58:15 -07:00
Mike Schwarzandv-openrig-build 792ef42e5f docs: add contributor maps and a developing-openrig skill (#282)
* docs: add contributor maps and a developing-openrig skill

Add ARCHITECTURE.md (packages, request path, counts with the commands that
produce them, where to add a command, route, migration, adapter, skill,
context pack or scenario), docs/as-built/arteries.md (high-impact areas,
their dependents and past regressions) and docs/as-built/test-layers.md
(what to run before a pull request and what each layer proves).

Add a repo-local developing-openrig skill for Claude Code (.claude/skills)
and Codex (.agents/skills) that routes to these maps, with narrow .gitignore
exceptions so only that skill is tracked. Point CONTRIBUTING.md at the maps
and correct its skill-mirror instructions. Replace the private-host paragraph
in the shipped openrig-skills router with a pointer to the repository skill.

* docs: correct six factual points from review

Newest as-built markers; skills may have one or several copies; the host
scenario runner drops rather than refuses TMUX and daemon variables;
scenario-10 declares its own normaliser; the managed Claude launch applies
only with an explicit permission mode; Dockerfile.scenarios is layered by
run-pr-scenarios.sh. Also tighten several wordings the review flagged.

---------

Co-authored-by: v-openrig-build <[email protected]>
2026-10-01 00:49:21 -07:00
Leon.C 94a68a3d77 fix(daemon): render non-image https evidenceRef as a plain link, not an image block (#89)
* fix(daemon): render non-image https evidenceRef as a plain link, not an image block

* fix(daemon): validate Slack evidence rendering boundaries
2026-10-01 00:39:34 -07:00
Shravan Sumanthanan 274e05fdc2 fix(security): prevent SSRF in notifications, drive-by CSRF on API, and pairing queue flooding (#149)
* fix(security): origin guard on /api/*, target URL validation, pairing hygiene, and UTC test fix

- API Origin protection: add apiOriginProtection middleware rejecting unauthorized browser Origin headers on /api/* routes to prevent drive-by web pages posting to the local daemon.
- Notification target URL validation: refuse non-HTTP(S) schemes and embedded URL credentials with clear startup errors and URL credential redaction, set redirect: 'error' on webhook delivery, and preserve self-hosted notifier support on localhost/LAN.
- Pairing hygiene: synchronously reserve capacity before awaited calls to prevent race conditions exceeding MAX_PENDING_PAIRS, prune requests only after a 1-hour grace window past PAIR_TTL_MS so waiting clients receive status 'expired', and sanitize requester strings.
- Timezone test fix: use parseSqliteUtcMs in effective-model-occupant-identity.test.ts to eliminate non-UTC test failure.

* fix(notifications): log warning and disable on invalid target URL, drop redirect error

* fix(notifications): support basic auth credentials in webhook and ntfy URLs

* fix(notifications): safely decode URI components in target URLs falling back on URIError
2026-10-01 00:30:29 -07:00
Mike Schwarzandv-openrig-build 07dab0761d fix(daemon): shipped startup files and resources follow the running install (#261) (#269) (#281)
* fix(daemon): deliver built-in startup files from the running install (#261)

Built-in startup files (CULTURE-default.md, openrig-start.md and the two
onboarding files) are stored per seat as absolute paths inside the install
that created the seat. After an upgrade removes that install (mise and other
versioned managers), every fresh launch rolled back with ENOENT, and restore
blocked on the missing required file. While the old install remained, seats
kept receiving the old version's shipped guidance.

Fresh launch (SeatLifecycleService.readStartupContext) and restore
(pre-validation and replay) now re-anchor a stored file to the running
daemon's assets when it is a recognized built-in: one of the four logical
names, stored at exactly <ownerRoot>/<known relative path>, with ownerRoot a
daemon/assets directory. Custom rig and agent files, including a same-named
CULTURE-default.md, are delivered exactly as stored. Required/appliesOn/
delivery metadata is unchanged, a missing current built-in still fails
honestly, and a same-native resume still replays nothing.

Refs #261

* fix(daemon): project shipped-spec resources from the running install (#261)

Kernel and library agents ship inside the install, so their stored projection
entries (agent guidance, shared runtime settings/MCP fragments) also point
into the install that created the rig. After that install is removed, a fresh
launch still rolled back in projection, before startup-file delivery.

Fresh launch and restore (pre-validation drift checks and replay) now
re-anchor a stored projection entry to the running install's daemon/specs when
both its sourcePath and its resource path lie under the same OpenRig install's
daemon/specs (packaged @openrig/cli/daemon/specs or a packages/daemon/specs
checkout). A resource stored elsewhere, such as the openrig-core plugin under
~/.openrig/plugins, user specs, or a folder merely named daemon/specs, is
projected exactly as stored. Identifiers, category, target, merge behavior and
the existing skill exclusion are unchanged; a resource missing from the
running version keeps the existing failure or warning.

Refs #261

* fix(daemon): own-key built-in lookup; restore-check judges the running paths (#261)

The built-in name lookup used a plain object, so a custom startup file named
constructor, toString or __proto__ matched an inherited key and fresh launch
threw on a valid seat (review finding on be599a64). Use a Map.

RestoreCheckService.checkStartupContext checked and reported the stored
paths directly, so a seat whose old install was removed showed missing
required inputs that replay no longer uses, and named stale paths in its
evidence and remediation. It now applies the same resolvers to the inspected
context and uses the resolved paths in both the predicates and the reported
text. The red/yellow rule, genuinely missing current or custom files, and
missing/malformed/probe-error handling are unchanged. The route's context
reader passes ownerRoot and sourcePath through so the resolvers can apply.

Refs #261

* fix(daemon): shipped-spec startup files follow the running install (#261)

Kernel and library seats also store their rig culture and agent startup files
(culture/CULTURE.md, guidance/role.md, startup/context.md) as absolute paths
inside the install's daemon/specs. With the projection fixed, a kernel created
by a removed install still rolled back on the culture file, and its post-launch
role/context would have followed.

The startup-file resolver now also re-anchors a stored startup file whose
ownerRoot and absolutePath both lie under the same recognized install's
daemon/specs, using the same mapping as projection entries. It applies through
fresh launch (pre- and post-launch delivery), restore replay and
pre-validation, and restore-check. Custom, external and plugin paths, and all
required/applicability/delivery metadata, are unchanged; a file missing from
the running version still fails or warns honestly.

Refs #261

* fix(daemon): re-anchor dev-checkout paths only when missing (#261)

A daemon running from one install remapped every recognized shipped path,
including ones stored from a developer checkout (packages/daemon/...). Those
files can be newer than, or absent from, the running install, so a present
file was remapped to a missing running path and the launch rolled back
(review finding, confirmed by both reviewers).

Packaged installs (@openrig/cli/daemon/...) still re-anchor even while the
stored file exists, so seats never keep an old version's shipped content.
Dev-checkout files re-anchor only when the stored file is missing. Recognition
is limited to those two layouts for built-in assets too. Each consumer passes
its own existence check (restore fsOps, restore-check deps; fresh launch uses
the filesystem).

Refs #261

* fix(daemon): leave legacy persisted startup shapes as stored (#261)

Snapshots and contexts persisted by older versions can lack ownerRoot on
startup files or sourcePath on projection entries. The #261 resolvers called
path.resolve on those fields, which threw, so restore reported restore_error
instead of its real outcome; restore pre-validation walks projection entries
even for an exact resume (CI: restore-honesty-d1-d6 D6a, 4 failures).

Entries without a string root or path are now returned exactly as stored,
which is their pre-#261 behavior.

Refs #261

---------

Co-authored-by: v-openrig-build <[email protected]>
2026-10-01 00:06:13 -07:00
Mike Schwarzanddev-driver d1ba4ee71e fix(cli): honor the recorded daemon endpoint for local commands (#266) (#279)
* fix(cli): use current home daemon endpoint for local clients

* fix(cli): retain recorded endpoint after daemon exit

---------


(cherry picked from commit cdf5fff724)

Co-authored-by: dev-driver <dev-driver@openrig-build>
2026-09-30 23:37:14 -07:00
Mike SchwarzandOpenRig contributors 6963421604 fix: give the managed Claude capability query room before refusing a launch (#278)
A managed Claude launch with an explicit permission mode first runs
`claude --help` to read the supported modes. The query was killed after one
second, so a valid but slow help refused the launch with "capability query
failed". The daemon now allows five seconds; a hung query still ends at that
bound with the same refusal. `rig seat set-permissions` waits up to 10 seconds
and a mutating `rig seat handover` gets the existing 120-second launch window,
so the daemon's answer arrives before the client deadline.

Port of #271 from release/0.6.4 (squash bfa66821). Original author:
dev50-driver; one-line S03 test finisher: dev60-driver.

Refs #260

Co-authored-by: OpenRig contributors <[email protected]>
2026-09-30 23:32:01 -07:00
Mike SchwarzandOpenRig contributors b24ef4f6f6 fix(daemon): keep binary files byte-identical in rig bundles (#276)
Bundle create read every vendored agent-package file, and the declared
culture, docs and startup files, as UTF-8 text and wrote it back as UTF-8.
Any byte sequence that is not valid UTF-8 became U+FFFD, and the integrity
manifest was hashed from the changed copy, so inspect and install verified
the corrupted bytes as intact.

Copy those files as bytes: the pod assembler reads them with readFileBuffer
and writes the same bytes, and the install-side skills and workflow-spec
routers copy with fs.copyFileSync. Rewriting rig.yaml and agent.yaml import
refs stays a text operation.

Port of #257 from release/0.6.4 (squash 2174b11e). The async test change in
that squash is already on main via #268 and is not repeated here.

Fixes #245

Co-authored-by: OpenRig contributors <[email protected]>
2026-09-30 23:31:44 -07:00
Mike SchwarzandOpenRig contributors 15763c46bb fix(daemon): relaunch a sole seat after fresh --stop ends its tmux server (#277)
Stopping the server's last session ends tmux's server, so launchFresh's
later probes saw transport_unavailable and refused with tmux_probe_failed
after the occupant was already stopped. After its own successful stop,
launchFresh now restores an empty server with the existing startServer()
(a no-op while the server is up; no session is invented), so the
classified probes get a positive answer. Transport, permission,
collision, claimed-seat and wrong-pane refusals are unchanged.

Port of #267 from release/0.6.4 (squash fa770114), without its RC-only
CHANGELOG notes.

Refs #265

Co-authored-by: OpenRig contributors <[email protected]>
2026-09-30 23:31:26 -07:00
MelonSmasher 217b5282f8 fix: report identity hook tokenPersisted from stored state (#40) 2026-09-30 23:04:20 -07:00
Mike Schwarzandv-openrig-build 700e6a05be fix(cli): include the repository README in the npm package (#272)
The npm page for @openrig/cli shows "No README data found" because the
published package root has no README.md. The CLI build already copies the
root LICENSE into the package; it now copies the root README.md the same
way, and the generated copy is ignored like LICENSE. The packaging test
now also checks that npm pack carries README.md byte-for-byte.

Co-authored-by: v-openrig-build <[email protected]>
2026-09-30 23:02:03 -07:00
Rudy Mizrahi Celekli 11b14d0150 fix(bundle): warn about unresolved skills in recovery exports (#259)
* fix(bundle): refuse missing declared agent skills

Signed-off-by: Rudy Celekli <[email protected]>

* fix(bundle): preserve recovery exports with unresolved skill warnings

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 22:44:37 -07:00
Rudy Mizrahi Celekli 76ef4d9b13 fix(daemon): compare chat history cutoffs as UTC instants (#208)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 21:37:59 -07:00
Rudy Mizrahi Celekli 02a3ca7bf2 fix(tui): cancel activity streams opened after shutdown (#204)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 21:37:43 -07:00
Rudy Mizrahi Celekli 0ab94672de fix(gate): reject invalid exclusion expiry dates (#199)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 21:37:26 -07:00
Rudy Mizrahi Celekli e1139e2276 fix(daemon): probe bracketed IPv6 service targets (#215)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 21:37:09 -07:00
Rudy Mizrahi Celekli 25ee889495 fix(daemon): reject failed Pi startup RPC responses (#213)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 21:29:43 -07:00
Mike Schwarzanddev-driver 964b904fd2 fix(daemon): prove managed Claude identity through shell wrappers (#264)
* fix(daemon): prove managed Claude identity during restore

* fix(daemon): sample Claude lineage only for shell labels

* test(daemon): distinguish bare shells from unusable Claude panes

* fix(identity): retain unavailable final Claude command observation

---------

Co-authored-by: dev-driver <dev-driver@openrig-build>
2026-09-30 21:28:33 -07:00
Rudy Mizrahi Celekli 662288d791 fix(tmux): preserve delimiters in pane working directories (#216)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 21:19:35 -07:00
Mike SchwarzandOpenRig contributors 030227c5d1 test(daemon): assert async ps samplers stay pending through a microtask drain (#268)
The three anti-sync discriminators in list-processes-async.test.ts raced a
0ms timer against the sampler's result. Timer order is not a valid guarantee
of async execution: in a local probe, a 70ms synchronous stall after spawning
a single-PID `ps eww` let the result settle before the 0ms timer in most
trials. The CI failure of this test is consistent with that race; the CI
timing itself was not measured.

Assert instead that the returned promise is still pending after draining 20
microtask ticks: an async execFile cannot settle without an event-loop turn,
while a synchronous ps inside the call settles within a few ticks. The real
rows and HOME assertions are unchanged.

Refs #245

Co-authored-by: OpenRig contributors <[email protected]>
2026-09-30 21:08:42 -07:00
Rudy Mizrahi Celekli e0b135ca43 fix(daemon): tolerate unusable snapshots during restore selection (#207)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 20:54:31 -07:00
Rudy Mizrahi Celekli bc8c608506 fix(cli): fail bootstrap and requirements on client errors (#202)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 20:46:15 -07:00
Rudy Mizrahi Celekli b730558413 fix(gate): reject ephemeral and invalid mutex ports (#200)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 20:45:57 -07:00
Rudy Mizrahi Celekli 650b96bb4e fix(daemon): keep truncated ntfy titles ASCII (#217)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 20:45:38 -07:00
Rudy Mizrahi Celekli ed9dc62f5a fix(daemon): require every Compose replica to be healthy (#218)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 20:45:17 -07:00
Rudy Mizrahi Celekli b4a05d279a fix(scope): warn about dependencies left behind by slice moves (#263)
Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 19:49:38 -07:00
Ege 1347d825c3 fix(daemon): create parent directory when packing bundle to missing path (#258) 2026-09-30 19:21:09 -07:00
Rudy Mizrahi Celekli 3691134c5b fix: Render terminal-open HTTP errors before consuming open results (#229)
* fix(cli): render terminal open HTTP errors before results

Signed-off-by: Rudy Celekli <[email protected]>

* fix(cli): select terminal result printer by response shape

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
2026-09-30 18:38:25 -07:00
Mike SchwarzandOpenRig contributors de9ec4f7ee test(cli): accept a pre-release version in the CLI --version check (#255)
client.test.ts expected only MAJOR.MINOR.PATCH, so the 0.6.4-rc.1 candidate failed
Tests run 36798254083. Allow an optional pre-release suffix and keep the anchors and the
optional (commit[, dirty]) stamp. Test-only.

Co-authored-by: OpenRig contributors <[email protected]>
2026-09-30 18:35:57 -07:00
c1ff76635e test: bind scenario seeds and exercise the library baton in CI (#243)
* test: bind scenario seeds and exercise the library baton in CI

* test: run named scenarios through a remote Docker executor

* test: bound and clean up the testbed image-load check

---------

Co-authored-by: dev-driver <dev-driver@openrig-build>
Co-authored-by: dev-qa <dev-qa@openrig-build>
2026-09-30 17:55:20 -07:00
2060 changed files with 224487 additions and 19588 deletions

No files matched your search

@@ -0,0 +1,75 @@
---
name: developing-openrig
description: "Use when changing OpenRig's own source in a clone of the openrig repository: finding which package or file owns a behaviour, choosing which tests to run, testing a change without disturbing the OpenRig daemon your own session runs on, judging whether a diff touches a high-risk area, or preparing a pull request. Not for operating rigs (openrig-skills) or designing rig topologies."
---
# Developing OpenRig
This skill is a map to the other maps. Each one is incomplete and may be stale: where a map and the code disagree, the
code is right, and fixing the map is a welcome contribution.
## First: which OpenRig are you in?
If you are an agent running inside OpenRig, two different OpenRigs are in play:
- **The installed one runs your session.** `rig --version` and `rig daemon status` describe it.
- **The checkout is what you're changing.** `git rev-parse HEAD` describes it.
Restarting the installed daemon does not run your checkout, and stopping it stops the agents running on it, including
you. Test your change with the repo's own harnesses, which start a private daemon and tmux server (see "Test it" below),
not by restarting the daemon you live in.
## Find your way
| You want to know | Read | How much to trust it |
|---|---|---|
| What OpenRig can already do, before you decide something is missing | `rig context get onboarding-width/public-what-you-can-do.md`; in this checkout, `packages/daemon/context-packs-src/onboarding-width/public-what-you-can-do.md` (the installed copy can differ) | The capability map; check it before proposing a new command or calling a gap a defect |
| Whether a `rig` command already exists | `rig --help`: the full command list, before you decide a command is missing | The running binary; read the whole list, not only the command you expected |
| Whether a problem is already known | The "Known problems to compare against" section of [`docs/reference/help.md`](../../../docs/reference/help.md) | Lists known issues by symptom; check an issue's current status before relying on it |
| Whether a feature is already planned | [`ROADMAP.md`](../../../ROADMAP.md) | Check it before proposing a feature |
| How the packages fit, the request path, where to add a command, route, migration, adapter, skill, context pack or scenario | [`ARCHITECTURE.md`](../../../ARCHITECTURE.md) | Checked against the commit it names; counts come with the command to refresh them |
| Whether your change touches a high-risk area, what depends on it, what broke there before | [`docs/as-built/arteries.md`](../../../docs/as-built/arteries.md) | Incomplete by design: absence from it doesn't make a change safe |
| What to run before you push, and what each layer can and can't prove | [`docs/as-built/test-layers.md`](../../../docs/as-built/test-layers.md) | Checked against the commit it names |
| The exact behaviour of a `rig` command | `rig <command> --help` on the running binary, then `packages/cli/src/commands/` | The binary and the code win over any document |
| A subsystem in depth | [`docs/as-built/`](../../../docs/as-built/README.md) | Each module names the commit it was last checked against in `last-verified-against-source`; compare that marker with `git log` before relying on it |
| Rig spec, agent spec and other user-facing reference | [`docs/reference/`](../../../docs/reference/) | Ships to every user; if you find drift, fix it there |
| Which shipped skill covers a task | [`skills/_canonical/core/openrig-skills/SKILL.md`](../../../skills/_canonical/core/openrig-skills/SKILL.md) | The index of the skills that ship with OpenRig |
| How to open a good pull request, and what review looks like | [`CONTRIBUTING.md`](../../../CONTRIBUTING.md) | Current |
If none of these answers your question, search the code before inventing an answer. A missing map is worth an issue.
## Before you change an artery
If your diff touches anything in `arteries.md` (message delivery, launch and resume, the queue, rig identity, skill
projection, process observation, migrations, restore):
1. Read the artery row: what depends on it, and the past regressions listed there.
2. Describe the downstream effect in your pull request, not just the diff.
3. Add or extend a stub-agent scenario, or say precisely why the stub can't exercise it and what you ran instead.
## Test it
The short version is `npm run build`, `npm run lint`, `npm test`. `test-layers.md` has the full ladder, including the
stub-agent scenarios, which run the real CLI, daemon, tmux and SQLite with scripted agents and no model cost.
- The scenario runner starts its own daemon and tmux server and drops your session's `TMUX` and daemon variables, so
it won't touch the daemon your session runs on.
- A stub proves OpenRig's own plumbing, not how Claude Code or Codex behave. Say which you exercised.
## How we judge changes
OpenRig is a coordination layer for a trusted environment: it should help agents and people keep work flowing.
- A change that removes friction, or makes state more truthful, is usually welcome.
- OpenRig runs on agents working in context with tools. Before adding code for a behaviour, ask whether an agent with
the right instructions and today's commands could do it. A skill or a page of guidance is often the better change.
- Where to look: the capability map above, and the `agent-operated-workflows` skill, which ships in the
`openrig-core` plugin (`packages/daemon/assets/plugins/openrig-core/skills/agent-operated-workflows/SKILL.md`).
- A change that adds a refusal, a prompt or a required step needs the concrete case in CONTRIBUTING.md: who is
harmed, how, and what it costs everyone else.
- One concern per pull request. Keep the diff reviewable in one sitting.
## When the map is wrong
Fix it in the same pull request, or open an issue. Update a document's `last-verified-against-source` marker only when
you have actually checked it against that commit.
@@ -0,0 +1,75 @@
---
name: developing-openrig
description: "Use when changing OpenRig's own source in a clone of the openrig repository: finding which package or file owns a behaviour, choosing which tests to run, testing a change without disturbing the OpenRig daemon your own session runs on, judging whether a diff touches a high-risk area, or preparing a pull request. Not for operating rigs (openrig-skills) or designing rig topologies."
---
# Developing OpenRig
This skill is a map to the other maps. Each one is incomplete and may be stale: where a map and the code disagree, the
code is right, and fixing the map is a welcome contribution.
## First: which OpenRig are you in?
If you are an agent running inside OpenRig, two different OpenRigs are in play:
- **The installed one runs your session.** `rig --version` and `rig daemon status` describe it.
- **The checkout is what you're changing.** `git rev-parse HEAD` describes it.
Restarting the installed daemon does not run your checkout, and stopping it stops the agents running on it, including
you. Test your change with the repo's own harnesses, which start a private daemon and tmux server (see "Test it" below),
not by restarting the daemon you live in.
## Find your way
| You want to know | Read | How much to trust it |
|---|---|---|
| What OpenRig can already do, before you decide something is missing | `rig context get onboarding-width/public-what-you-can-do.md`; in this checkout, `packages/daemon/context-packs-src/onboarding-width/public-what-you-can-do.md` (the installed copy can differ) | The capability map; check it before proposing a new command or calling a gap a defect |
| Whether a `rig` command already exists | `rig --help`: the full command list, before you decide a command is missing | The running binary; read the whole list, not only the command you expected |
| Whether a problem is already known | The "Known problems to compare against" section of [`docs/reference/help.md`](../../../docs/reference/help.md) | Lists known issues by symptom; check an issue's current status before relying on it |
| Whether a feature is already planned | [`ROADMAP.md`](../../../ROADMAP.md) | Check it before proposing a feature |
| How the packages fit, the request path, where to add a command, route, migration, adapter, skill, context pack or scenario | [`ARCHITECTURE.md`](../../../ARCHITECTURE.md) | Checked against the commit it names; counts come with the command to refresh them |
| Whether your change touches a high-risk area, what depends on it, what broke there before | [`docs/as-built/arteries.md`](../../../docs/as-built/arteries.md) | Incomplete by design: absence from it doesn't make a change safe |
| What to run before you push, and what each layer can and can't prove | [`docs/as-built/test-layers.md`](../../../docs/as-built/test-layers.md) | Checked against the commit it names |
| The exact behaviour of a `rig` command | `rig <command> --help` on the running binary, then `packages/cli/src/commands/` | The binary and the code win over any document |
| A subsystem in depth | [`docs/as-built/`](../../../docs/as-built/README.md) | Each module names the commit it was last checked against in `last-verified-against-source`; compare that marker with `git log` before relying on it |
| Rig spec, agent spec and other user-facing reference | [`docs/reference/`](../../../docs/reference/) | Ships to every user; if you find drift, fix it there |
| Which shipped skill covers a task | [`skills/_canonical/core/openrig-skills/SKILL.md`](../../../skills/_canonical/core/openrig-skills/SKILL.md) | The index of the skills that ship with OpenRig |
| How to open a good pull request, and what review looks like | [`CONTRIBUTING.md`](../../../CONTRIBUTING.md) | Current |
If none of these answers your question, search the code before inventing an answer. A missing map is worth an issue.
## Before you change an artery
If your diff touches anything in `arteries.md` (message delivery, launch and resume, the queue, rig identity, skill
projection, process observation, migrations, restore):
1. Read the artery row: what depends on it, and the past regressions listed there.
2. Describe the downstream effect in your pull request, not just the diff.
3. Add or extend a stub-agent scenario, or say precisely why the stub can't exercise it and what you ran instead.
## Test it
The short version is `npm run build`, `npm run lint`, `npm test`. `test-layers.md` has the full ladder, including the
stub-agent scenarios, which run the real CLI, daemon, tmux and SQLite with scripted agents and no model cost.
- The scenario runner starts its own daemon and tmux server and drops your session's `TMUX` and daemon variables, so
it won't touch the daemon your session runs on.
- A stub proves OpenRig's own plumbing, not how Claude Code or Codex behave. Say which you exercised.
## How we judge changes
OpenRig is a coordination layer for a trusted environment: it should help agents and people keep work flowing.
- A change that removes friction, or makes state more truthful, is usually welcome.
- OpenRig runs on agents working in context with tools. Before adding code for a behaviour, ask whether an agent with
the right instructions and today's commands could do it. A skill or a page of guidance is often the better change.
- Where to look: the capability map above, and the `agent-operated-workflows` skill, which ships in the
`openrig-core` plugin (`packages/daemon/assets/plugins/openrig-core/skills/agent-operated-workflows/SKILL.md`).
- A change that adds a refusal, a prompt or a required step needs the concrete case in CONTRIBUTING.md: who is
harmed, how, and what it costs everyone else.
- One concern per pull request. Keep the diff reviewable in one sitting.
## When the map is wrong
Fix it in the same pull request, or open an issue. Update a document's `last-verified-against-source` marker only when
you have actually checked it against that commit.
+4 -1
View File
@@ -4,9 +4,12 @@
troubleshooting. An index linking to agent-friendly documentation is at
https://openrig.dev/llms.txt.
- **Agents helping a user:** read [docs/reference/help.md](../docs/reference/help.md), or run `rig context get help`.
The same guide is at https://www.openrig.dev/help/agents.
- **Email:** hello@openrig.dev, which needs no GitHub account.
- **Questions:** [Discussions › Q&A](https://github.com/mvschwarz/openrig/discussions/categories/q-a).
- **Bugs:** [open an issue](https://github.com/mvschwarz/openrig/issues/new/choose) with the bug
template. Include `rig --version`, your OS and Node versions, and relevant redacted command output.
template. Include `rig --version`, your OS, Node and tmux versions, the harnesses involved, and
relevant redacted command output.
Reports are public: remove credentials, private prompts and personal information.
- **Ideas and setups:** [Ideas](https://github.com/mvschwarz/openrig/discussions/categories/ideas)
and [Show and tell](https://github.com/mvschwarz/openrig/discussions/categories/show-and-tell).
+4 -1
View File
@@ -6,6 +6,8 @@ name: Tests
# Package suites deny external networking; scenario runtime has no external route.
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
@@ -14,7 +16,7 @@ permissions:
contents: read
concurrency:
group: tests-${{ github.ref }}
group: tests-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
@@ -75,6 +77,7 @@ jobs:
- run: npm run test:repo
package-tests:
if: ${{ github.event_name != 'push' }}
# macOS, the platform OpenRig runs on: several daemon and cli tests read macOS ps columns,
# file-inode behaviour and release tags.
runs-on: macos-latest
+8 -2
View File
@@ -22,8 +22,14 @@ notes/*
*.sqlite-wal
*.sqlite.pre-reboot-backup
.openrig/
.claude
.agents
.claude/*
!.claude/skills/
.claude/skills/*
!.claude/skills/developing-openrig/
.agents/*
!.agents/skills/
.agents/skills/*
!.agents/skills/developing-openrig/
.openrig
.worktrees/
+333
View File
@@ -0,0 +1,333 @@
# OpenRig architecture
> **This map is not the territory.** It is a zoomed-out guide for finding your way around the
> code. It is incomplete by design and it may be stale. Where it disagrees with the code, the code
> is right; please fix the page. Every path, symbol, count and command below was checked against
> commit `c750304f` (0.6.6 development). Each count shows the command that produced it, so you
> can re-run it.
## What OpenRig is
OpenRig runs a team of coding agents on your machine as one system. A local daemon keeps the team's
state in SQLite and runs each agent as an ordinary Claude Code or Codex session (or a plain
terminal, a Pi or Oh My Pi (OMP) runner, or a scripted test stub) inside tmux. People and agents drive it through the
`rig` CLI, a terminal UI (TUI) and an MCP server, all of which talk to the daemon over local HTTP.
The agents themselves are unmodified. What OpenRig adds is the coordination around them: launching
and restoring agents, delivering messages, keeping durable work in a queue, and giving each agent
the right skills and context.
## Packages
| Directory | Package | What it is | How it ships |
|---|---|---|---|
| `packages/daemon` | `@openrig/daemon` (private) | The daemon: HTTP routes, domain services, SQLite migrations, runtime adapters, built-in specs, skills, plugins, static context-pack sources | Copied into `@openrig/cli` |
| `packages/cli` | `@openrig/cli` | The `rig` command, the MCP server, daemon start and stop | The only published package |
| `packages/tui` | `@openrig/tui` (private) | The terminal UI | Copied into `@openrig/cli`; opened by `rig tui`, by bare `rig` in a terminal, or by the `openrig-tui` bin |
| `packages/ui` | `@openrig/ui` (private) | The React web UI, in **maintenance mode**: it still ships and runs, but gets no new feature work. The CLI and TUI are the supported surfaces | Built files copied into `@openrig/cli` and served by the daemon |
| `packages/test-system` | none (not an npm workspace) | The stub-agent scenario library, the CI scenario harness, live-model eval cases | Not shipped |
**What bundles what.** `packages/cli/package.json` publishes `LICENSE`, `dist`, `daemon`, `ui`,
`tui` and `scripts`. `scripts/build-package.sh` (the CLI's `prepublishOnly`) builds the daemon, UI,
TUI and CLI, then assembles them inside `packages/cli/`: the daemon's `dist`, `assets`, `specs` and
`policies`, the generated context packs and a copy of `docs/reference/` go under `daemon/`; the UI
build goes to `ui/dist`; the TUI build goes to `tui/dist`. So `docs/reference/` ships to every
user; `docs/as-built/` and this file do not.
**Sharing code between packages.** The CLI and TUI import daemon code only through the subpaths in
the `exports` field of `packages/daemon/package.json` (21 at this commit), for example
`@openrig/daemon/attention`, which points at `packages/daemon/src/attention-surface.ts`. The CLI
uses 19 of them and the TUI uses 2. In development they resolve through the npm workspace. At
package time `scripts/rewrite-daemon-imports.mjs` rewrites them to the shipped `daemon/dist` copy
and fails the build on a specifier with no `exports` entry. To share new daemon code, add a
`*-surface.ts` file and an `exports` entry.
## The request path
```
rig (CLI) TUI MCP server (rig mcp serve, stdio)
\ | /
+---- HTTP to the daemon (port 7433 by default) --------------+
|
packages/daemon/src/server.ts createApp(): context middleware, /healthz, app.route("/api/...")
|
packages/daemon/src/routes/ one Hono router per area; reads services with c.get(...)
|
packages/daemon/src/domain/ services, repositories, orchestrators, event bus
/ | \
SQLite (db/) tmux (adapters/tmux.ts) runtime adapters (adapters/*-adapter.ts)
claude-code, codex, pi, omp, terminal, stub
```
**Inside the daemon** (`packages/daemon/src/`):
- **Startup.** `index.ts` is the process entry: it resolves where to listen, starts the server and
runs the periodic queue sweeps. It calls `createDaemon()` in `startup.ts`, which opens the
database (`db/connection.ts`: WAL mode, foreign keys on), runs `migrate(db, ALL_MIGRATIONS)`,
constructs every service and adapter, and passes them to `createAppWithWebSocket(deps)` in
`server.ts`.
- **`server.ts`.** In `createApp(deps)`, an early `app.use("*", ...)` middleware (after the
request-phase observer and the JSON body-parse tracker) puts each
service on the request context (`c.set("<name>" as never, deps.<name>)`), serves `/healthz`, and
mounts each router with `app.route("/api/<area>", ...)`. Unknown `/api/*` paths get a JSON 404;
other GET requests serve the web UI's built files.
- **`routes/`.** Thin handlers. For example, `routes/ps.ts` reads `psProjectionService` from the
context and returns its entries as JSON. `routes/terminal-ws.ts` registers the terminal
WebSocket, and `routes/require-sender-identity.ts` is a shared helper rather than a router.
- **`domain/`.** The behaviour: repositories over SQLite (`rig-repository.ts`,
`queue-repository.ts`, `session-registry.ts`), orchestration (`startup-orchestrator.ts`,
`node-launcher.ts`, `rigspec-instantiator.ts`), message delivery (`session-transport.ts`,
`seat-delivery-guard.ts`) and events (`event-bus.ts`). Larger areas have their own
subdirectories, such as `gateway/`, `provider/`, `policies/`, `scope/`, `context-packs/` and
`mission-control/`.
- **`adapters/`.** The outside world. `tmux.ts` wraps tmux. The six `RuntimeAdapter`
implementations (OMP's extends Pi's) launch each runtime and project skills and files into it. `cmux.ts` and
`compose-services-adapter.ts` cover other integrations.
- **`db/`.** `connection.ts`, `migrate.ts`, `all-migrations.ts` and `migrations/`.
- **`middleware/auth-bearer-token.ts`.** The bearer-token check for operator write routes, plus
the loopback and Tailscale bind detection used at startup.
- **Live updates** go out as server-sent events: `routes/events.ts` uses Hono's `streamSSE`, and
the TUI subscribes to `/api/activity/events`.
- **State** lives in `$OPENRIG_HOME` (default `~/.openrig`). The database is `openrig.sqlite`
there (`daemon-db-path.ts`).
**The clients:**
- **CLI.** `createProgram()` in `packages/cli/src/index.ts` registers every top-level command;
the commands live in `packages/cli/src/commands/`. Most are thin clients: they call a daemon route
through `DaemonClient` (`packages/cli/src/client.ts`) and render the result. A few lifecycle
helpers open the database file directly. Bare `rig` in a terminal opens the TUI
(`packages/cli/src/front-door.ts`).
- **MCP.** `createMcpServer(client)` in `packages/cli/src/mcp-server.ts` registers the tools over
the same `DaemonClient`. `rig mcp serve` (`packages/cli/src/commands/mcp.ts`) runs it on stdio.
- **TUI.** `packages/tui/src/daemon-client.ts` is its only HTTP module. It reads existing daemon
projections, for example `/api/ps`, `/api/rigs/summary` and `/api/queue/list`, and the
`/api/activity/events` stream when the daemon offers it. The daemon URL comes from `--url`,
`OPENRIG_URL`, or `http://127.0.0.1:7433`. Agents can drive a running TUI through its control
socket (`packages/tui/src/socket-server.ts`).
- **Web UI.** Served by the daemon from the bundled `ui/dist`.
**In a development checkout,** `rig daemon start` prefers `packages/daemon/dist` over the bundled
copy (`resolveDaemonPath` in `packages/cli/src/daemon-lifecycle.ts`), and the TUI launcher prefers
`packages/tui/dist` (`packages/cli/src/front-door.ts`). Rebuild the package you changed. A daemon
that is already running keeps running the code it started with.
## Key counts
At commit `c750304f`. Run these from the repository root to refresh them.
| What | Count | Command |
|---|---|---|
| Database migrations | 94 files (latest: `095_rig_non_interruptive.ts`; there is no 093) | `git ls-files packages/daemon/src/db/migrations \| wc -l` |
| Files in `routes/` | 67 | `git ls-files packages/daemon/src/routes \| wc -l` |
| ... of which create a Hono router | 65 | `git grep -l 'new Hono' -- packages/daemon/src/routes \| wc -l` |
| `app.route(...)` mounts in `server.ts` | 69 | `grep -c 'app.route(' packages/daemon/src/server.ts` |
| Top-level `rig` commands | 87 | `grep -c 'program.addCommand(' packages/cli/src/index.ts` |
| Runtime adapters | 6 (`claude-code`, `codex`, `pi`, `omp`, `terminal`, `stub`); the command counts 5 because `OmpRuntimeAdapter` extends `PiRuntimeAdapter` | `git grep -l 'implements RuntimeAdapter' packages/daemon/src \| wc -l` |
| MCP tools | 18 | `grep -c 'server.tool(' packages/cli/src/mcp-server.ts` |
| Daemon `exports` subpaths | 21 | `node -p 'Object.keys(require("./packages/daemon/package.json").exports).length'` |
| Library scenarios | 15 | `grep -l '^scenario:' packages/test-system/scenarios/*.yaml \| wc -l` |
## Where to add things
Each recipe names the files to touch. Read a neighbouring example before you start; the code is
the authority.
### A CLI command
1. Create `packages/cli/src/commands/<name>.ts` exporting a function that returns a commander
`Command` and takes optional injected dependencies. `packages/cli/src/commands/unarchive.ts`
is a short example.
2. In the action, get the daemon with `getDaemonStatus(...)` and `daemonStatusGuard(status)`
(`packages/cli/src/daemon-lifecycle.ts`), then call it with
`new DaemonClient(getDaemonUrl(status))` (`packages/cli/src/client.ts`). Offer `--json` for
agents, and set `process.exitCode` on failure.
3. Register it in `createProgram()` in `packages/cli/src/index.ts` with
`program.addCommand(...)`. If it takes injected dependencies, add them to `ProgramDeps` in the
same file.
4. Add `packages/cli/test/<name>.test.ts`. `packages/cli/test/archive.test.ts` shows how tests
inject mocked lifecycle dependencies.
5. If the command needs new daemon behaviour, add a route as well.
### A daemon route
1. Create `packages/daemon/src/routes/<area>.ts` with a Hono router. Both styles exist: a
constant (`export const psRoutes = new Hono()` in `routes/ps.ts`) and a factory
(`whoamiRoutes()` in `routes/whoami.ts`).
2. Read services from the request context with `c.get("<name>" as never)`. Keep the behaviour in
`packages/daemon/src/domain/`.
3. Mount it in `createApp()` in `packages/daemon/src/server.ts` with
`app.route("/api/<area>", ...)`, above the `/api/*` 404 catch-all.
4. A new service needs three more edits: a field on `AppDeps` and a `c.set(...)` line in
`server.ts`, and its construction in `createDaemon()` in `packages/daemon/src/startup.ts`.
5. Test it the way `packages/daemon/test/whoami-routes.test.ts` does: build a small Hono app,
`c.set` the service, mount the router and call `app.request(...)`. `createFullTestDb()` in
`packages/daemon/test/helpers/test-app.ts` gives you an in-memory database migrated with the
test fixture list (`migrationsForFullTestDb`).
### A database migration
1. Create `packages/daemon/src/db/migrations/<NNN>_<name>.ts` exporting a `Migration`
(`{ name: "<NNN>_<name>.sql", sql: "..." }`; the type is in `packages/daemon/src/db/migrate.ts`).
`089_classification_identity_provenance.ts` is a one-line example.
2. Take the next number after the highest on `main` (095 at this commit). Parallel pull requests
often pick the same number, so check again and renumber if `main` moved before you merge.
3. Import it in `packages/daemon/src/db/all-migrations.ts` and append it to `ALL_MIGRATIONS`.
Startup runs exactly that list (`startup-migrations-mirror.test.ts` pins this).
4. Add it to `migrationsForFullTestDb` in `packages/daemon/test/helpers/test-app.ts`, or list it in
`migrationsForFullTestDbExclusions` with a reason. `migration-fixture-parity.test.ts` fails
otherwise.
5. `migrate()` sorts migrations by name and records each applied name in `schema_migrations`, so
an install that already applied a migration never runs it again. Editing a migration that has
shipped changes nothing for those installs; add a new one instead. A long-lived install applies
every new migration on its next start, against real data.
### A runtime adapter
1. Implement `RuntimeAdapter` from `packages/daemon/src/domain/runtime-adapter.ts`: `runtime`,
`listInstalled`, `project`, `deliverStartup`, `launchHarness` and `checkReady`. The smallest
implementation is `packages/daemon/src/adapters/terminal-adapter.ts`; the scripted test double
is `stub-runtime-adapter.ts`.
2. Register it in `packages/daemon/src/startup.ts`. The adapter maps are keyed by runtime name:
`adapters:` (for the pod instantiator) and `runtimeAdapters:`. The context monitor has its own
map for the runtimes it samples.
3. Accept the runtime name in rig spec validation: `SUPPORTED_RUNTIMES` in
`packages/daemon/src/domain/rigspec-preflight.ts`. Other runtime lists, such as `RuntimeHint` in
`domain/discovery-types.ts` and `LEGACY_KNOWN_RUNTIMES` in `domain/rigspec-schema.ts`, may need
it too; search for an existing runtime name such as `"pi"` to find them.
4. Launch, projection and readiness are arteries. Read
[docs/as-built/arteries.md](docs/as-built/arteries.md) first.
### A shipped skill
Skills ship from three copies in this repository (the "edges"), listed in
`scripts/skill-edge-layout.generated.json`:
| Edge | Path | Layout |
|---|---|---|
| `spec` | `packages/daemon/specs/agents/shared/skills/` | by category (`core`, `pm`, `pods`, `process`) |
| `plugin` | `packages/daemon/assets/plugins/openrig-core/skills/` | flat |
| `canonical` | `skills/_canonical/` | public mirror of the `spec` copy |
Each skill in the layout file lists which edges carry it. At this commit, 33 skills are in `spec`
and `canonical`, 17 only in `plugin`, and 2 in all three.
- Each skill has one editable home: its `spec` copy when it has a `spec` edge, otherwise its
`plugin` copy. Its other edges are generated from that home.
- `npm run mirror-skills:check` (part of `npm test`) hashes every file in each edge and compares the
hashes with `scripts/skill-edge-digests.generated.json`. It also fails on a `SKILL.md` the layout
does not list, on a generated copy that differs from its home, and on a home holding text the
public copies would drop.
- The full apply, `npm run mirror-skills`, regenerates every generated copy from its home and
refreshes the digests. It reads nothing outside the repository and never writes to a home.
- **To fix a skill:** edit its home, run `npm run mirror-skills`, then run
`npm run mirror-skills:check`.
- **To add a skill:** open an issue first. Its layout entry is generated from files that are not
in this repository.
- Every shipped skill also becomes a context pack at package time (next recipe).
### A context pack
- **Static packs** are hand-written: a directory under `packages/daemon/context-packs-src/<name>/`
with a `manifest.yaml` and its files. Keep `version: "0"` in the manifest; the generator stamps
the package version. A pack file may be a symlink to a file under `docs/reference/`, so a
reference document has one source (for example `help/help.md` points to
`docs/reference/help.md`). Any other symlink fails the build. There are 5 static packs at this
commit.
- **Generated packs** go to `packages/daemon/context-packs/`, which is gitignored and never edited
by hand. `scripts/generate-context-packs.mjs` builds it at package time from every shipped skill
and every static pack.
- `npm run generate-context-packs:check` (part of `npm test`) validates every pack through the
daemon's own manifest parser, so build the daemon first. It also runs the leak scan over the
static sources, including the `docs/reference/` files they link to.
- The daemon serves the shipped packs through `rig context get`; `startup.ts` registers the bundled
directory as its built-in root.
### A scenario
Scenarios run the real CLI, daemon, tmux and SQLite with scripted stub agents (`runtime: stub`)
and no model cost.
1. Add `packages/test-system/scenarios/<defect-class>.yaml`, named for the class of bug it
catches. Topology fixtures sit beside it (`*-stub.yaml`).
2. The format is checked by `validateScenario` in
`packages/daemon/test/helpers/scenario-schema.ts`. Step verbs: `up`, `down`, `send`, `restart`,
`restore`, `emit`, `mutate`, `policy`, `seed_regression`, `daemon`, plus `expect`. `expect` may
only read shipped surfaces: `ps`, `queue`, `stream`, `scope`, `pane`, `transcript`,
`tui_socket`, `policy_provenance`.
3. Today the runner binds `up`, `down`, `send`, `restart` and `daemon`. `restore`, `emit`,
`mutate` and `policy` fail with `UnboundActionError`, and `seed_regression` needs a fault
controller (`packages/daemon/test/helpers/scenario-real-deps.ts`).
4. Write a header comment naming the defect class and the seed: what a seeded regression plants,
and which `expect` must catch it. A scenario counts only as a pair: it passes on healthy code
and fails on the seeded run (`packages/test-system/README.md`).
5. **Run it on your machine** after `npm run build`:
`node --import tsx packages/daemon/scripts/run-scenarios.mjs <file.yaml>`. It uses a private
daemon and a private tmux server, and builds its environment from `HOME`, `PATH` and `TERM`
only, so your session's `TMUX` and daemon variables are dropped and it is safe to run from
inside tmux, including an agent's pane. It supplies no fault controller, so a
`seed_regression` step fails there; the seeded pair runs in the container path.
6. **CI.** The `installed-scenario` job runs `scripts/run-pr-scenarios.sh` in disposable,
network-less containers built from the packed package. It runs four cases: `fixture` and `library`
(`queue-baton-survives-restart.yaml`), each with a healthy run and a seeded lost-baton run, plus
`transcript` and `capture`, healthy runs only. Adding a seeded case means changing three files:
the `--case` list in `scripts/run-pr-scenarios.sh`, `CASES` in
`packages/test-system/ci/result.mjs`, and the fault controller in
`packages/test-system/ci/run.mjs`; a healthy-only case goes in `PASSING_CASES` in the first two
and needs no fault controller. [docs/as-built/test-layers.md](docs/as-built/test-layers.md)
covers both run modes, running a case on your own Docker host, and what a stub can and cannot
prove.
## Guards you will meet
`npm test` runs `test:repo` (builds the daemon, runs `node --test scripts/*.test.mjs`, the docs
guard, `mirror-skills --check` and `generate-context-packs --check`) and then the daemon, CLI and
TUI suites. `npm run test:ui` runs the web UI suite separately. `npm run lint` typechecks all four
packages.
- **Docs guard** (`scripts/check-docs-guard.mjs`). Under `docs/`, git may track only
`docs/as-built/`, `docs/reference/`, `docs/releases/` and exactly `docs/DESIGN.md`;
`.gitignore` ignores the rest of `docs/`. Remember that `docs/reference/` ships inside the npm
package, and the daemon copies its Markdown files to `$OPENRIG_HOME/reference/` when it
starts. Files in `docs/as-built/` carry a `last-verified-against-source` commit in their
frontmatter.
- **Internal-leak guard** (`scripts/internal-leak-scanner.mjs`, with rules in
`scripts/internal-tokens.generated.json`). It refuses maintainer-internal names and paths in
content that ships. It runs in `generate-context-packs.mjs` (static pack sources, on every
`npm test`), in the full skill mirror apply (each public skill), in `scripts/build-package.sh`
(the daemon `specs/` tree before it is copied into the package), and in the release-time
substance gate (`scripts/check-substance-gate.mjs`, `npm run gate:substance`) over the packed
CLI. No workflow runs it over a pull request's whole diff.
- **Portability report** (`.github/workflows/portability-report.yml`, running
`scripts/portability-report.mjs`). On each pull request it lists added lines containing
machine-specific values: credentials, home and temporary paths, network addresses, email
addresses. It never fails the job; you read it and decide.
- **Generated files.** Do not hand-edit `scripts/*.generated.json` or anything under
`packages/daemon/context-packs/`. The skill-edge digests are refreshed by
`npm run mirror-skills` (see "A shipped skill").
The internal-token rules support optional `allowed_context_lines` for reviewed generic
examples: the complete line must match exactly, including indentation and case. Unlike
`allowed_context_substrings`, this does not exempt a line with added or substituted text;
internal-path checks and the substance gate's human-review dispositions still apply.
- **Hosted CI** (`.github/workflows/tests.yml`): `build-and-package`, `typecheck`, `repo-checks`,
`package-tests` (macOS; daemon, CLI, TUI and UI suites with no credentials and no external
network) and `installed-scenario`.
## Pointers
- [CONTRIBUTING.md](CONTRIBUTING.md): setup, what a pull request needs, what to expect from review.
- [docs/reference/developing.md](docs/reference/developing.md): which checks block and which are
advisory, and what `.github/workflows/tests.yml` runs.
- [docs/reference/worktree-builds.md](docs/reference/worktree-builds.md): building in a git
worktree, with its own `npm ci` rather than a symlinked `node_modules`.
- [docs/reference/](docs/reference/): user and operator reference; it ships with the package.
- [docs/as-built/](docs/as-built/README.md): module-by-module descriptions of the system. **These
are being re-verified for 0.6.6.** Each page's `last-verified-against-source` names the commit it was
checked against; until a page is re-verified, treat its counts as historical. Use them for
orientation, then check the code.
- [docs/as-built/test-layers.md](docs/as-built/test-layers.md): what each test layer covers and
what it cannot catch.
- [docs/as-built/arteries.md](docs/as-built/arteries.md): the areas where a small change has a
large effect, what depends on them, and what broke there before.
- [packages/test-system/ci/README.md](packages/test-system/ci/README.md): the CI scenario job.
- [docs/releases/](docs/releases/) and [CHANGELOG.md](CHANGELOG.md): release history, written by
the maintainers at release time.
+1913
View File
File diff suppressed because it is too large. Load diff
+36 -13
View File
@@ -8,12 +8,12 @@ change in with the least friction on both sides.
## Before you start
- **Bugs:** open an issue with the bug template. Include your OpenRig version (`rig --version`),
OS, Node version, which harnesses are involved (or none), and the relevant command and output.
OS, Node and tmux versions, which harnesses are involved (or none), and the relevant command and output.
Reports are public: remove credentials, private prompts, personal details and private paths
before posting. Share a small reproduction rather than a full transcript or instance dump.
- **Features and behaviour changes:** open an issue or a Discussion in *Ideas* first. A short
"what I am trying to do and what stops me" saves both of us a rewrite. Small, obvious fixes do
not need an issue.
- **Features and behaviour changes:** open an issue or a Discussion in *Ideas* first. Search issues
and Discussions, and check ROADMAP.md, before proposing a feature. A short "what I am trying to do
and what stops me" saves both of us a rewrite. Small, obvious fixes do not need an issue.
- **Questions:** use [Discussions › Q&A](https://github.com/mvschwarz/openrig/discussions/categories/q-a),
not an issue.
@@ -40,22 +40,37 @@ repository, and we're happy to link to it.
## Setting up
Node `^22 || ^24` and a working `tmux` are required. Then:
Node `^22 || ^24`, a working `tmux` and `rsync` are required. macOS includes `rsync`; many Linux
installs don't (`sudo apt-get install rsync` on Debian or Ubuntu). `npm test` and `npm run mirror-skills`
use it. Then:
```bash
git clone https://github.com/mvschwarz/openrig.git
cd openrig
npm install
npm ci # exactly what package-lock.json records
npm run build # all workspaces
npm test # repo checks + daemon, cli, tui test suites
npm run lint # typecheck every package
```
`npm ci` installs the locked versions and never rewrites `package-lock.json`, which is what CI
runs too. Use `npm install <package>` only when you're adding or changing a dependency, and commit
the lockfile change with it.
`npm test` builds the daemon and runs repository checks before the package suites. Read the
specific failure: `npm run mirror-skills` updates skill mirrors, and
`npm run generate-context-packs` updates generated packs. Use them when their source changed and
review the generated diff; neither command fixes every documentation failure. The UI unit-test
suite is advisory and separate: `npm run test:ui`.
specific failure. Each shipped skill has one editable home in this repository (see
["A shipped skill" in ARCHITECTURE.md](ARCHITECTURE.md#a-shipped-skill)). Edit its home, run
`npm run mirror-skills` to regenerate its other copies and refresh the digests, then run
`npm run mirror-skills:check` and commit the result. The apply reads nothing outside the repository.
The repository checks include a docs guard: a
tracked file under `docs/` must be in `docs/as-built/`, `docs/reference/` or `docs/releases/`
(`docs/DESIGN.md` is the one exception). They check that shipped first-run text names only teams, skills and
commands that exist, and they validate the context-pack sources;
`npm run generate-context-packs` rebuilds the generated packs locally, which aren't committed.
The UI unit-test suite is separate from `npm test`: run `npm run test:ui`. CI runs it on every pull
request as `package-tests (ui)`, so a change has to pass it.
[docs/as-built/test-layers.md](docs/as-built/test-layers.md) lists every test layer, what CI runs,
and what each layer can and cannot prove.
For hands-on development, read the [check requirements](docs/reference/developing.md),
[worktree setup](docs/reference/worktree-builds.md), and
@@ -77,7 +92,7 @@ your working copy.
- Do not bump versions.
- Match the surrounding style. `npm run lint` typechecks; it does not format code.
- Write commit messages in the form the log already uses: `fix(cli): …`, `feat(daemon): …`,
`docs(reference): …`, `harness: …`.
`docs(reference): …`, `test: …`.
## The pull request
@@ -103,8 +118,16 @@ clarifying question or run the reproduction; a maintainer makes the merge decisi
## Where things live
- **Start here:** [ARCHITECTURE.md](ARCHITECTURE.md) maps the packages, the request path, and where to
add a command, route, migration, adapter, skill, context pack or scenario.
[docs/as-built/arteries.md](docs/as-built/arteries.md) lists the areas where a small change has a
large effect; if your change touches one, read it first.
- **Using a coding agent?** Claude Code and Codex load the repository's `developing-openrig` skill
when they work in this checkout (`.claude/skills/` and `.agents/skills/`). It points at the maps
above and at what to run before you push.
- Repository reference: `docs/reference/`; user documentation: [openrig.dev/docs](https://openrig.dev/docs).
- Skills: `packages/daemon/specs/agents/shared/skills/` and plugin skills under
`packages/daemon/assets/plugins/`; static context-pack sources: `packages/daemon/context-packs-src/`.
- Skills: `packages/daemon/specs/agents/shared/skills/`, plugin skills under
`packages/daemon/assets/plugins/`, and `skills/_canonical/`; static context-pack sources:
`packages/daemon/context-packs-src/`.
Generated packs live in `packages/daemon/context-packs/` and are not hand-edited or committed.
- Releases: [GitHub Releases](https://github.com/mvschwarz/openrig/releases) and npm `@openrig/cli`.
+229 -76
View File
@@ -4,21 +4,80 @@
A harness wraps a model. A rig wraps your harnesses. Define your agent team in YAML, boot it with one command. Claude Code and Codex in the same rig, managed as one system.
OpenRig turns AI coding agents from a pile of terminal sessions into a persistent, organized team. Talk to a lead agent about the outcome you want; it can coordinate specialists across teams and bring you results and decisions that need your attention. Start with a repository and one useful change, then keep the team's work and context at the same addresses.
OpenRig is open-source software for building and running your own network of agents. It turns AI coding agents from a pile of terminal sessions into a persistent, organized team. Talk to a lead agent about the outcome you want; it can coordinate specialists across teams and bring you results and decisions that need your attention. Start with a repository and one useful change, then keep the team's work and context at the same addresses.
**Guide:** [Getting started](docs/reference/getting-started.md) · **Stuck?** [Help](docs/reference/help.md) · **Questions:** [Q&A](https://github.com/mvschwarz/openrig/discussions/92) · **Updates and demos:** [@_feralmachine on X](https://x.com/_feralmachine)
It's the open-source system behind my AI civilization experiments.
**Guide:** [Getting started](docs/reference/quickstart.md) · **Stuck?** [Help](docs/reference/help.md) · **Questions:** [Q&A](https://github.com/mvschwarz/openrig/discussions/92) · **Updates and demos:** [@_feralmachine on X](https://x.com/_feralmachine)
## See it running
![The OpenRig TUI: the build rig as a graph, then as a table of seats with runtime, model, context and state, then one seat in detail (real recording, 10 seconds)](assets/readme/openrig-agents-working.gif)
**Start here:** [the guided first-use path](docs/reference/getting-started.md): install, launch a two-agent team in your repository, and get one reviewed change.
**Start here:** [the guided first-use path](docs/reference/quickstart.md): install, talk to the kernel operator, then choose a team for your first useful change.
Not setting this up today? Get the next walkthrough and occasional OpenRig updates → https://openrig.dev/follow
## Install and first run
Requires Node.js 22 or 24 and tmux, on macOS or Linux. On a Mac with Apple silicon, use Node.js 22 ([compatibility history](docs/releases/v0.5.15.md#known-compatibility-limitation)). Native Windows is not supported yet, and WSL2 has not been tested. Launching a rig writes provider hooks and workspace trust settings. Before running the commands below, read [what OpenRig changes on your machine](#what-openrig-changes-on-your-machine) and back up the relevant files.
**Let your coding agent set it up.** First check that `node --version` shows 22 or 24: the command below needs
Node.js and the `npx` that comes with it. Then, in your project folder, add OpenRig's `rigs` skill to the agent you
use:
```sh
# Claude Code
npx skills add https://github.com/mvschwarz/openrig/tree/v0.7.0/skills/rigs --skill rigs --agent claude-code
# Codex
npx skills add https://github.com/mvschwarz/openrig/tree/v0.7.0/skills/rigs --skill rigs --agent codex
```
Then type `/rigs` in Claude Code, or `$rigs` in Codex, and say what you want built. The skill has your agent tell
you what it will run and change before it does, install OpenRig, open the OpenRig view and pass your goal to
OpenRig's operator.
You need Node.js 22 or 24 (22 on Apple silicon), tmux, macOS or Linux (WSL2 on Windows), and Claude Code or Codex
signed in. One provider is enough to start.
Already have OpenRig? Use the tag that matches `rig --version`, or upgrade first.
Prefer to type the commands yourself? [Install it yourself ↓](#install-it-yourself)
Requires Node.js 22 or 24 and tmux, on macOS or Linux, and one working Claude Code or Codex account: one is enough, since the kernel operator adapts the shipped `starter` team to whichever you have. On Linux, the distribution's own Node.js can be older (Ubuntu 24.04's is 18); install a supported version with [nvm](https://github.com/nvm-sh/nvm) (`nvm install 22`) or NodeSource. On a Mac with Apple silicon, use Node.js 22 ([compatibility history](docs/releases/v0.5.15.md#known-compatibility-limitation)). On a Mac where you aren't an administrator, or where Homebrew belongs to another account (its `brew install` is refused), install Node.js in your own home folder with [nvm](https://github.com/nvm-sh/nvm): run `touch ~/.zshrc` (a new Mac account has none, and nvm's installer only adds itself to a profile file that already exists), then nvm's install command, for nvm v0.40.8 `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash` ([nvm's page](https://github.com/nvm-sh/nvm#install--update-script) has the newest), open a new terminal, and run `nvm install 22`. nvm itself needs no administrator password, and `npm install -g` then installs into your nvm folder. If nvm's installer says you need Apple's command line tools, run `xcode-select --install`, then its install command again. On Windows, use WSL2, the Windows route OpenRig supports; native Windows isn't supported. OpenRig's automated tests don't run on WSL2 yet; see [one user's working setup](docs/reference/getting-started.md#wsl2-a-reported-working-setup).
> **What OpenRig changes on your machine**
> - **Install:** `@openrig/cli` goes in globally with npm.
> - **Setup:** `rig setup` adds an OpenRig block to `~/.tmux.conf`. It can install tmux (with Homebrew on macOS), and
> Herdr unless you pass `--no-herdr`. Plain `rig setup`, which is what the one-command install runs, checks both
> Claude Code and Codex and may install a missing one; `rig setup --providers claude` (or `codex`) limits it to
> yours.
> - **Starting OpenRig, for the coding agent you use** (paths are the usual defaults):
> - Codex: hooks and trust in `~/.codex/config.toml`.
> - Claude Code: workspace trust in `~/.claude.json`, and activity hooks in the project's
> `.claude/settings.local.json`, plus a status line unless you already have your own.
> - Discovery skills go in `~/.claude/skills` and `~/.agents/skills`.
> - **Starting a team in your project:** adds managed guidance to `AGENTS.md` or `CLAUDE.md`, plus the team's skills
> and plugins.
> - **Permissions:** by default, OpenRig's own kernel gets broader permissions than a project team gets by default.
> On Codex that's full access with no approval prompts (`-s danger-full-access -a never`). On Claude Code, its file
> tools, web fetches and operational commands, including reads under your home folder, run without asking. A
> permission policy, per-agent choice or Codex profile changes that. What your team can do depends on the team you
> choose and your settings; `workshop`, for example, ships with broad access.
> - **Backups:** OpenRig doesn't guarantee it can preserve or roll back these files, so back them up first.
>
> [Everything OpenRig writes, and why →](https://github.com/mvschwarz/openrig#what-openrig-changes-on-your-machine)
### Install it yourself
This runs OpenRig's install script from the `v0.7.0` release. It checks Node.js and npm, installs the latest published `@openrig/cli` with `npm install -g`, runs the Node.js and SQLite check, then runs `rig setup --dry-run` and `rig setup`. The first line prints that plan and changes nothing:
```bash
curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.0/scripts/install.sh | sh -s -- --dry-run
curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.0/scripts/install.sh | sh
```
If a provider isn't signed in yet, the last step reports `FAILED [4/4]`, and `rig setup` lists the sign-in under "Some steps need attention". If the only remaining failures are provider sign-ins, the install steps finished; sign in to each selected provider as below and continue.
**Or step by step:**
```bash
npm install -g @openrig/cli
@@ -27,46 +86,103 @@ rig setup --dry-run
To install with Bun instead, run `bun add -g @openrig/cli`. OpenRig still runs on Node.js, so install Node.js 22 as well. Bun may block this package's postinstall script, in which case the Node.js and SQLite check described under [what OpenRig changes on your machine](#what-openrig-changes-on-your-machine) does not run at install time.
Choose the working account you already have: **Claude Code, Codex, or both**. Reuse an explicit choice; no second subscription is required. `rig setup --dry-run` previews the broader setup, but applying `rig setup` checks both harnesses and cmux. It is optional for the [selected-provider path](docs/reference/getting-started.md#choose-your-providers).
npm 11 and later can skip that postinstall script and print `npm warn install-scripts` naming `@openrig/cli`. That's expected: the CLI still works, and only the Node.js and SQLite check was skipped. To run it yourself, use `node "$(npm root -g)/@openrig/cli/scripts/check-abi.mjs"`; `rig doctor` checks the Node.js version only.
Before launching, your agent asks once: **“Allow your agents to run OpenRig commands without repeated permission prompts?” Yes — recommended / No — keep prompts.** This covers every `rig` command, including starting/stopping agents and configuration, at personal project scope unless you explicitly choose user-wide sessions. It is not global YOLO or permission to invent work. On Yes, the agent [adds and verifies native rules](docs/reference/getting-started.md#have-your-agent-configure-permissions); No or no answer leaves settings unchanged. An existing explicit choice is reused. Say “Undo the OpenRig command allowances added by this setup” to remove only its additions.
Choose the working account you already have: **Claude Code, Codex, or both**. Reuse an explicit choice; no second subscription is required. `rig setup --dry-run` previews the broader setup; applying `rig setup` checks both harnesses and installs a missing one, plus Herdr unless declined with `--no-herdr`. Pass the choice with `--providers claude` or `--providers codex` so the other reads not selected instead of failed. The one-command install above doesn't know the choice, so it installs and checks both; for one provider, go step by step and run `rig setup --providers <choice>`. On macOS, the installing agent offers Ghostty once. Setup leaves an existing cmux installation alone. It is optional for the [selected-provider path](docs/reference/getting-started.md#choose-your-providers).
A team seat with no permission policy, per-seat choice or (for Codex) named profile launches with OpenRig's [team default](docs/reference/rig-spec.md#team-launch-defaults): Claude runs ordinary `rig` commands, project reads and common tests without prompting, while lifecycle commands such as `rig up` and `rig down` still ask; Codex also gets the OpenRig workspace and its pod's state directory as writable directories. Before launching, your agent recommends keeping that default, and offers to remember selected OpenRig commands in your native settings only if you want that, at personal project scope unless you explicitly choose user-wide sessions. It is not global YOLO or permission to invent work. On Yes, the agent [adds and verifies native rules](docs/reference/getting-started.md#have-your-agent-configure-permissions); No or no answer keeps the team default and leaves settings unchanged. An existing explicit choice is reused. Say “Undo the OpenRig command allowances added by this setup” to remove only its additions.
If permission prompts are slowing you down, consider the
[workshop bundle](https://openrig.dev/rigs/workshop). It ships with broad access
and [non-interruptive mode](docs/reference/non-interruptive-mode.md): its agents
bypass permission prompts and supported harness warning dialogs. The listing
and before-install view explain that access before you choose it.
Check `tmux -V` and only your selected CLI/login: `claude --version` plus
`claude auth status`, or `codex --version` plus `codex login status`. If needed,
sign in once with `claude auth login` or `codex login`; do not install or log in
to an unused provider.
| Team | Starter | Models |
| --- | --- | --- |
| Two Codex agents | `first-project` | Both `gpt-6-astra` (unchanged) |
| Two Claude agents | `first-project-claude` | Configured native Claude default |
| Claude owner + Codex checker | `first-project-mixed` | Claude default + `gpt-6-astra` |
### Your agent opens OpenRig for you
All three use the same owner/checker roles and task. Show the selected runtime,
configured model and command before launch; confirm the account supports the
model instead of silently falling back. The kernel starts automatically and
selects from available authenticated providers independently of these two project
agents. A missing unused provider is not a setup requirement.
After installing, your agent opens the OpenRig TUI and the operator for you. To get back to them later, ask your
agent for OpenRig or your agents in any words. After checking the selected login, it starts the daemon if it's stopped
and opens the view:
```sh
rig daemon start
rig terminal open saved:kernel --window
```
`--window` opens a new terminal tab or window itself, or a space in your current
Herdr session. Below 120 measured columns,
the **operator** fills the first page; from 120, the dashboard and operator share
it equally. The advisor has a separate tab or tmux window.
An installing agent can run it from its shell on the daemon's
desktop; the person copies nothing. It uses Herdr when installed, otherwise
the same layout in plain tmux, and preserves existing conversations. `rig tui`
is the team dashboard. Installation is finished when you are talking to the
operator; if you choose to talk later, that handoff remains pending.
If setup stops, read the named step: missing tools and selected-provider logins
need their specific setup action. A harness permission rule, sandbox or automatic
permission decision can also block the installing agent's command. The agent
should name the command and reported reason, then help you resolve that specific
step within your chosen permissions. A permission refusal is not an OpenRig
installation result.
The desktop may need an Automation approval; SSH/headless sessions may have no
display. Herdr can show first-run panels, and an 80×24 window can cramp the view.
Follow [the OpenRig view checks and next steps](docs/reference/getting-started.md#what-can-interrupt-installation-and-the-openrig-view).
Herdr is visible only inside a terminal you can see. Changing the shared TUI to
`:terminals` does not open that terminal. The agent checks the visible window when
it has desktop access and says what it could not verify otherwise. Over headless
SSH, it asks you to open a new terminal window or tab and gives the exact connection
and attachment command for the current view. If you choose a manual attachment
after a failure,
ask the installing agent for the exact command using your current operator
session; run that in a new terminal window.
The kernel's operator helps you pick a first team. It asks what you want to build,
recommends one of three, and fits it to the providers you have.
| Team | Talk to | Agents and purpose |
| --- | --- | --- |
| `starter` | `dev-build@starter` | A Claude Code builder and Codex reviewer for one bounded change |
| `workshop` | `orch-lead@workshop` | A lead, builder, QA and reviewer for ongoing work in one repository; a rig bundle the operator installs from its pinned listing |
| `factory` | `orch-lead@factory` | Seven: a lead, advisor, build, QA, design and two independent reviewers for sustained product work |
As shipped, `starter` uses both Claude Code and Codex. With only one of them, ask
the kernel operator to adapt it: it writes a copy of the team for your providers
under the same name. [The naming guide](docs/reference/topology-naming.md) explains
how their pods and roles grow and how to name your own team. `first-project` is
starter's old name and still starts it,
unless you already have a rig named `first-project` or `starter`: then it refuses
and names the `rig up <name> --existing` command that brings that rig back.
Show the selected runtime, configured model and command before launch; confirm the
account supports the model instead of silently falling back. The kernel starts
automatically and selects from available authenticated providers independently of
these teams. A missing unused provider is not a setup requirement.
To launch the starter yourself instead (the manual path, without the operator):
```bash
cd /path/to/your/repository
starter=first-project # or first-project-claude or first-project-mixed
rig specs preview "$starter" --kind rig
rig up "$starter" --cwd . --plan
rig up "$starter" --cwd .
rig tui --shared
rig specs preview starter --kind rig
rig up starter --cwd . --plan
rig up starter --cwd .
```
The kernel provides separate operational support and the shared dashboard. To detach without stopping the dashboard, press Ctrl-b then d; `rig tui --shared` returns to that view. Plain `rig tui` opens an independent view. Closing a viewing terminal does not mean you should relaunch the team.
To see your agents, use `rig terminal open saved:kernel --window`. If that window cannot open, `rig tui --shared` is the named dashboard-only fallback; it does not show the operator conversation. The installing agent should resolve or explain the window failure, not finish by suggesting a command for you to type. Closing a viewing terminal does not mean you should relaunch the team.
Check project-seat readiness with `rig ps --nodes --rig "$starter"` and resolve any authentication, trust or permission prompt before assigning work. Then give the owner one bounded outcome from your repository:
Check project-seat readiness with `rig ps --nodes --rig starter` and resolve any authentication, trust or permission prompt before assigning work. If a seat stopped at such a prompt before its startup context arrived, `rig ps` shows the `rig seat continue <seat>` command that delivers it once the prompt is answered. Then give the builder one bounded outcome from your repository:
```bash
rig send "dev-owner@$starter" 'Implement <one useful change>. Track the task in the queue and return its ID. Keep it local, verify the behavior, ask dev-check in this rig to check the exact candidate, and record the result and how I can try it.'
rig queue list --destination "dev-owner@$starter" --limit 1000
rig send dev-build@starter 'Implement <one useful change>. Track the task in the queue and return its ID. Keep it local, verify the behavior, ask dev-review in this rig to check the exact candidate, and record the result and how I can try it.'
rig queue list --destination dev-build@starter --limit 1000
```
Sending a message does not itself create a queue item; the owner records the task. Read the final artifact and the review of its exact candidate, then return to the same owner for the next change. [The guided first-use path](docs/reference/getting-started.md) covers readiness, a useful task, a reviewed result, Herdr/cmux terminals and recovery.
Sending a message does not itself create a queue item; the builder records the task. Read the final artifact and the review of its exact candidate, then return to the same builder for the next change. [The guided first-use path](docs/reference/getting-started.md) covers readiness, a useful task, a reviewed result, Herdr/cmux terminals and recovery.
Not setting this up today? Get the next walkthrough and occasional OpenRig updates → https://openrig.dev/follow
@@ -75,6 +191,7 @@ Not setting this up today? Get the next walkthrough and occasional OpenRig updat
- **Questions:** [Discussions › Q&A](https://github.com/mvschwarz/openrig/discussions/categories/q-a)
- **Bugs and feature requests:** [open an issue](https://github.com/mvschwarz/openrig/issues/new/choose)
- **Contributing:** [CONTRIBUTING.md](CONTRIBUTING.md) · [Code of Conduct](CODE_OF_CONDUCT.md) · [Security policy](SECURITY.md) · [Getting help](.github/SUPPORT.md)
- **Working on OpenRig with a coding agent?** Start with the `developing-openrig` skill in `.agents/skills/` (Claude Code: `.claude/skills/`) and [CONTRIBUTING.md](CONTRIBUTING.md).
- **Videos:** [youtube.com/@openrig](https://www.youtube.com/@openrig)
- **Releases:** [GitHub Releases](https://github.com/mvschwarz/openrig/releases) and npm `@openrig/cli`
@@ -89,31 +206,42 @@ using a published package, since repository guidance can be ahead of npm.
| When | What changes and why |
| --- | --- |
| **npm installation** | Installs the CLI, bundled components and dependencies under your npm prefix (with Bun, under Bun's global directory). OpenRig's postinstall checks the Node.js version and that the SQLite module loads; Bun may block this script. It does not run daemon or provider setup. |
| **`rig setup`** | Attempts missing tools and writes an OpenRig block in `~/.tmux.conf` for mouse support and scrollback. On macOS it can install cmux and enable its automation socket control in `~/.config/cmux/settings.json`. `--full` adds workstation tools. `--dry-run` shows setup's plan without applying it. |
| **Daemon startup** | Creates/updates instance state under `OPENRIG_HOME` (normally `~/.openrig`), including its database and managed plugin resources. Seeds the `openrig-skills` discovery skill in `~/.claude/skills` and `~/.agents/skills`, subject to existing version ownership. With `runtime.codex.hooks_enabled` enabled (the default), writes Codex hook configuration and trust records as described below—even before a rig launches. |
| **Rig/seat launch and attachment** | Creates tmux sessions, supplies seat identity and daemon connection environment, and projects selected guidance, skills, plugins and runtime resources into the workspace. Managed startup pre-trusts the workspace. Claude context collection can also be provisioned for attached sessions and refreshed during monitoring. |
| **Explicit permission configuration** | The built-in bootstrap does **not** add `rig` command allow rules. Agent-guided setup recommends Yes and requires your actual answer before the agent [adds rules at your chosen scope](docs/reference/getting-started.md#have-your-agent-configure-permissions). No/no answer preserves settings; existing choices and stricter rules remain relevant. Broader access is separate. |
| **npm installation** | Installs the CLI (`rig` and `openrig-tui`), bundled components and dependencies under your npm prefix (with Bun, under Bun's global directory). OpenRig's postinstall checks the Node.js version and that the SQLite module loads; Bun may block this script. It does not run daemon or provider setup. |
| **`rig setup`** | Attempts missing tools and writes an OpenRig block in `~/.tmux.conf` for mouse support and scrollback. Installs herdr by default on macOS and Linux unless declined with `--no-herdr`; an unavailable herdr install is a warning. On macOS the installing agent offers Ghostty, and `--ghostty` attempts it after acceptance. Existing cmux settings are left unchanged. `--full` adds workstation tools. `--dry-run` shows setup's plan without applying it. |
| **Daemon startup** | Creates/updates instance state under `OPENRIG_HOME` (normally `~/.openrig`), including its database and managed plugin resources. Seeds the `openrig-skills` discovery skill, the `refocusing` skill and the person-facing `rigs` skill in `~/.claude/skills` and `~/.agents/skills`, subject to existing version ownership. When a Codex seat is already recorded and `runtime.codex.hooks_enabled` is enabled (the default), ensures its hook configuration and trust records as described below. With no recorded Codex seat, enabled hooks wait for its first launch; disabled hooks still remove a stale OpenRig-managed hook block, if present. |
| **Rig/seat launch and attachment** | Creates tmux sessions, supplies seat identity and daemon connection environment, and projects selected guidance, skills, plugins and runtime resources into the workspace. Managed startup pre-trusts the workspace. Claude context collection can also be provisioned for attached sessions and refreshed during monitoring. In a Git repository, newly created files under `.codex/plugins/shared:openrig-core/` (or the unqualified `.codex/plugins/openrig-core/`) are added to the repository's Git `info/exclude` inside an `# BEGIN OpenRig generated files` block; new `AGENTS.md`, `CLAUDE.md` and `CLAUDE.local.md` files stay visible with a warning. |
| **Bundle install** (`rig bundle install`, or `rig up` with a `.rigbundle` or GitHub link) | Writes the bundle's files into the install target: `--target`, or the current directory for `rig up` and for a GitHub link. `rig bundle install` with a local archive needs `--target`. Routes its declared skills, plugins and context packs into your libraries. A GitHub link's archive is kept under `OPENRIG_HOME/bundle-imports/`, and installs are recorded in `OPENRIG_HOME/bundle-audit.jsonl`. A bundle that carries a project creates it under `workspace.projects_root` and records it, with the rig's association, in the workspace catalog. |
| **Explicit permission configuration** | The built-in bootstrap does **not** add `rig` command allow rules to your settings files; a team seat with no permission policy, per-seat choice or (for Codex) named profile gets the per-launch [team default](docs/reference/rig-spec.md#team-launch-defaults) instead. Agent-guided setup recommends keeping it and requires your actual answer before the agent [adds remembered rules at your chosen scope](docs/reference/getting-started.md#have-your-agent-configure-permissions). No/no answer keeps the team default and preserves settings; existing choices and stricter rules remain relevant. Broader access is separate. |
The provider files are separate from instance state. Here `~` means the daemon
user's home; changing `OPENRIG_HOME` alone does not isolate provider configuration.
- **Claude Code:** managed startup writes workspace trust and onboarding completion
to `~/.claude.json`. In the workspace, `.claude/settings.local.json` receives
- **Claude Code:** startup writes workspace trust and onboarding completion.
With an explicit permission mode, it uses the launch-selected `HOME/.claude.json`,
or `<CLAUDE_CONFIG_DIR>/.claude.json` when that variable is set. Classic startup
writes `HOME/.claude.json`, and also `<CLAUDE_CONFIG_DIR>/.claude.json` when the
daemon has that variable set. In the workspace, `.claude/settings.local.json` receives
the context collector's `statusLine` command and selected activity hooks;
helper scripts live under `.openrig/`. Selected settings/MCP resources can also
a user's own status-line command is preserved, so it can prevent collector
installation. Selected settings resources can still replace overlapping keys.
The collector script lives under `.openrig/`, and the activity-hook relay under
the instance's `state/claude-activity-hooks/`. Selected settings/MCP resources can also
change that settings file and `.mcp.json`. The shared settings resource sets
`permissions.defaultMode` to `acceptEdits` and enables Exa/Context7 MCP entries;
selected MCP resources configure those external services. Built-in bootstrap
no longer writes a command allowlist to `~/.claude/settings.json` or removes
older allowances. The trust writer uses the daemon home, so a custom
`CLAUDE_CONFIG_DIR` is not a general relocation of these writes.
older allowances. `CLAUDE_CONFIG_DIR` does not relocate the project-local writes.
To keep your own status line alongside the collector, see
[Custom Claude status line](docs/reference/claude-status-line.md).
- **Codex:** writes the daemon's `CODEX_HOME/config.toml` (normally
`~/.codex/config.toml`). Startup enables hooks, adds the OpenRig activity relay
commands and pre-writes trust hashes for those commands. Seat startup adds
`~/.codex/config.toml`). With hooks enabled, daemon startup ensures the OpenRig
activity relay commands and their trust hashes when a Codex seat is already
recorded; otherwise the first Codex launch does so. With hooks disabled, startup
can remove a stale OpenRig-managed hook block even without a Codex seat. Seat startup adds
`trust_level = "trusted"` for the workspace; selected config resources can
add MCP settings. Recognized update notices can be skipped during launch,
recording the skipped version in Codex's cache; this is not an update install.
add MCP settings. Managed launches pass `-c check_for_update_on_startup=false`,
which writes no config; a recognized update notice that still appears can be
skipped, recording the skipped version in Codex's cache; this is not an update install.
Activity relays send event type/subtype, seat/runtime identity, timestamps and
native session identity to the configured OpenRig daemon's `/api/activity/hooks`
@@ -128,14 +256,38 @@ Managed launches supply `HOME`, `CODEX_HOME` and `OPENRIG_*` identity/connection
variables. Claude uses `--permission-mode acceptEdits` and defaults to the classic
renderer for terminal scrollback. Codex uses `-s workspace-write` unless a named
profile governs its sandbox; the default does not force an approval-policy flag.
On that plain launch OpenRig first asks Codex for its own configuration and adds
`-c sandbox_workspace_write.network_access=true` only when Codex answers that no
configuration layer sets network access and no managed requirement could restrict
it, so the seat can reach the local daemon. If Codex can't be asked or doesn't
answer in time, the launch is left unchanged.
Fresh Codex launches also add writable access to the workspace's `.git` and the
pod's shared queue-state directory with `--add-dir`; the shared root comes from
`OPENRIG_SHARED_DOCS_ROOT` or `~/.openrig/shared-docs`.
A team seat with no permission policy, per-seat choice or (for Codex) named
profile also gets the per-launch team default: Claude gets `--settings` allowing
ordinary `rig` commands, project reads and common tests, with a session-only
PreToolUse hook that asks before lifecycle commands, and Codex also gets the
OpenRig workspace root as a writable directory. Neither writes a permission file.
Seats of the rig named `kernel` launch with an operational default instead,
unless a permission policy, a per-seat choice or (for Codex) a named profile
applies: Claude in `acceptEdits` with a per-launch allow list for its file tools,
web fetches and operational commands (including reads under your home folder),
and Codex with `-s danger-full-access -a never`. Neither writes a permission file.
YOLO is **off by default**. An explicitly selected full-bypass policy selects
Claude's `--dangerously-skip-permissions` or Codex's
`-s danger-full-access -a never`. The legacy environment-only `OPENRIG_YOLO=1`
path still selects only Codex's sandbox; a resolved policy overrides that
environment setting.
path, with no policy attached, selects Claude's bypass flag, Pi's `--approve` and
Codex's `-s danger-full-access` without `-a never`; a resolved policy overrides
that environment setting. The `builtin:auto` policy launches Claude with
`--permission-mode auto`; Codex and Pi seats launch as they do without a policy (a
named Codex profile still governs its sandbox, and Pi keeps its configured
resource trust).
`--non-interruptive` on `rig up` or `rig bundle install` additionally passes
per-launch flags to full-bypass seats so Claude's bypass warning and Codex's
full-access and GPT-5.1 migration notices don't stop startup; it writes nothing to
their settings files and is saved on the rig. See
[non-interruptive mode](docs/reference/non-interruptive-mode.md).
Permission mode controls native execution permissions; work posture is separate
project guidance. Use `rig policy permissions list|show|current|apply` for rig
@@ -151,9 +303,12 @@ separates the desired selection from the last launch arguments; neither proves
native enforcement. See the [permission guide](docs/reference/getting-started.md#per-seat-permission-mode).
Managed hook blocks target OpenRig's entries and retain unrelated hooks, but
trust entries, selected resource keys and Claude's existing status-line command
can be replaced. Some writers recover unreadable settings as empty objects;
this is not a complete preservation or rollback guarantee. Back up relevant
trust entries and selected resource keys can be replaced. Claude's collector,
activity-hook and JSON resource writers leave unreadable or malformed settings
untouched; this is not a product-wide preservation guarantee. Codex's workspace
trust writer can treat an unreadable `config.toml` as empty and write a new trust
configuration. Read-modify-write operations can also race other writers; there
is no complete preservation or rollback guarantee. Back up relevant
files before first use. Daemon/bootstrap writes are automatic and do not each
have an interactive preview; `rig setup --dry-run` does not preview every later
startup effect.
@@ -174,29 +329,22 @@ OpenRig is a multi-agent harness — it manages the system that coding agents fo
Every agent runs in a tmux session you can attach to, inspect, and work with directly.
## Starter Rigs
## Teams
Use `first-project`, `first-project-claude`, or `first-project-mixed` for the
same focused first-use path on your selected providers. `product-team` is an optional
larger product-development example:
Three teams grow with you, and the kernel operator helps you pick one:
- **`starter`**: a builder and a reviewer for one bounded change.
- **`workshop`**: a lead, a builder, QA and a reviewer for ongoing work in one repository. It's a rig bundle, installed from its pinned listing.
- **`factory`**: seven agents (a lead, an advisor, build, QA, design and two independent reviewers) for sustained product work. You bring ideas to the advisor, and the lead runs the team.
```bash
rig specs preview product-team --kind rig
rig up product-team
rig specs preview factory --kind rig
rig up factory
```
Use it when you want a larger product squad: two orchestrators, implementation, QA, design, and two independent reviewers.
Specialist teams: `code-review` (two independent reviews), `research` (an analyst and a synthesizer) and `pm` (a product lead, a researcher and a builder for prototypes).
For a smaller starter, use `conveyor`:
```bash
rig specs preview conveyor --kind rig
rig up conveyor
```
`conveyor` is a four-seat starter mixing Claude Code and Codex. It shows a handoff path through intake, planning, build, and review; `first-project` remains the smaller two-seat starting point.
Also ships: `implementation-pair`, `adversarial-review`, `research-team`, and `secrets-manager` (HashiCorp Vault managed by a specialist agent).
Also built in: `secrets-manager`, a HashiCorp Vault instance run by a specialist agent.
Browse the library:
@@ -206,7 +354,7 @@ rig specs ls
## How It Works
OpenRig is a local daemon + CLI + terminal UI + MCP server, built on tmux. The older React web UI remains in maintenance mode with best-effort support.
OpenRig is a local daemon + CLI + terminal UI + MCP server, built on tmux. OpenRig itself is under active development; only the older React web UI is in maintenance mode, with best-effort support.
```
CLI / TUI / MCP
@@ -221,7 +369,7 @@ Hono HTTP daemon
- **CLI**: Commands for both humans and agents to launch teams, inspect state, send messages, track owned work, and manage context.
- **TUI**: Topology explorer, table and graph views, seat details, Specs, Projects, Terminals, Feed, and System. Navigate with the keyboard, mouse, or command bar.
- **MCP**: Tools so agents can manage their own topology (`rig_up`, `rig_ps`, `rig_send`, `rig_chatroom_send`, etc.)
- **Runtimes**: Native Claude Code and Codex sessions, terminal nodes, and a Pi adapter using an RPC runner inside a terminal pane.
- **Runtimes**: Native Claude Code and Codex sessions, terminal nodes, and Pi and Oh My Pi via RPC runners.
## Terminal UI and Workspaces
@@ -234,21 +382,23 @@ The TUI shows the team's coordination state; herdr and cmux show the actual agen
With herdr installed and connected, open the starter's terminals together:
```bash
rig terminal open first-project --provider herdr
rig terminal open starter --provider herdr
```
For cmux, use `--provider cmux`. In the TUI, a rig's detail view has a `term ▸ rig <name>` link that opens every running seat of that rig in the default terminal provider; with herdr that is up to 16 seats per tab, in a workspace named after the rig. The underlying sessions remain accessible through tmux. See the [terminal workspace guide](docs/reference/getting-started.md#share-the-dashboard-and-return-to-it) for setup and returning to an existing view.
For cmux, use `--provider cmux`. In the TUI, a rig's detail view has an `Open terminals ▸ rig <name>` link that opens a terminal view of the running seats of that rig (in a new window or tab, or the current Herdr session), laid out with herdr when installed, otherwise plain tmux; with herdr that is up to 16 seats per tab, in a workspace named after the rig. A seat it can't attach is reported as absent or degraded. The underlying sessions remain accessible through tmux. See the [terminal workspace guide](docs/reference/getting-started.md#share-the-dashboard-and-return-to-it) for setup and returning to an existing view.
## Key Concepts
The first words you meet, in plain language: [What these words mean](docs/reference/quickstart.md#what-these-words-mean).
- **RigSpec**: Declarative multi-agent harness definition in YAML. Pods, members, edges, continuity policies, culture file.
- **AgentSpec**: Reusable agent blueprint with skills, guidance, hooks, profiles, and startup contracts.
- **Seat**: A stable role and address in a rig, such as `dev-owner@first-project`. The conversation occupying it can change while its identity and authored context remain.
- **Seat**: A stable role and address in a rig, such as `dev-build@starter`. The conversation occupying it can change while its identity and authored context remain.
- **Pod**: A group of related seats with shared guidance and context. Each agent still has its own context window.
- **Discovery**: `rig discover` fingerprints existing tmux sessions. `rig adopt` brings them under management.
- **Snapshot/Restore**: `rig down --snapshot` captures full state. `rig up <name>` restores from latest snapshot. Restore reports per-node outcomes (resumed, fresh, or failed).
- **RigBundle**: Portable archive with vendored AgentSpecs and SHA-256 integrity. Share topologies across machines.
- **Culture**: CULTURE.md sets coordination norms for the group. Research rigs get exploratory culture. Implementation rigs get conservative, trust-but-verify culture.
- **Snapshot/Restore**: `rig down --snapshot` captures full state. `rig up <name>` restores from latest snapshot. Restore reports per-node outcomes: resumed, fresh-primed, awaiting-decision (the original conversation can't resume; choose `--fresh`), attention_required, or failed.
- **RigBundle**: Portable archive with vendored AgentSpecs and SHA-256 integrity. Share topologies across machines. `rig up`, `rig bundle create`, `inspect` and `install` also take a GitHub folder link, `rig bundle check` checks a folder before you share it, and `rig bundle inspect` shows what a bundle will do before you install it. See [publishing a rig bundle](docs/reference/publishing-a-rig-bundle.md).
- **Culture**: A rig's `CULTURE.md` (its `culture_file`) sets coordination norms for the group, on top of OpenRig's default culture, which every seat receives.
## Agent-Managed Software
@@ -264,7 +414,7 @@ Requires Docker for service-backed rigs.
## Upgrading an existing instance
For an existing installation, follow the [upgrade procedure](skills/_canonical/core/openrig-upgrade/SKILL.md) and the [0.5.14 release notes](docs/releases/v0.5.14.md). Preserve live seats during the upgrade; `rig down` is not an upgrade step. Upgrading to 0.6.0 also requires Node.js 22 or 24: see [Moving off Node 20](#moving-off-node-20) and the [0.6.0 release notes](docs/releases/v0.6.0.md).
For an existing installation, follow the [upgrade procedure](skills/_canonical/core/openrig-upgrade/SKILL.md) and the [0.5.14 release notes](docs/releases/v0.5.14.md); notes for later releases are in [CHANGELOG.md](CHANGELOG.md). Preserve live seats during the upgrade; `rig down` is not an upgrade step. Upgrading to 0.6.0 also requires Node.js 22 or 24: see [Moving off Node 20](#moving-off-node-20) and the [0.6.0 release notes](docs/releases/v0.6.0.md).
### Moving off Node 20
@@ -329,13 +479,16 @@ The helper never removes the legacy telemetry or library. Retirement follows
separate stable runtime, writer, reader, and recovery proof. Daemon, database,
seat, plugin, and release lifecycle actions remain agent-owned.
## Requirements
- Node.js 22 or 24 (the supported versions in this release). Node 20 is no
longer supported. Node 26 and other versions are untested. On a Mac with Apple
silicon, use Node.js 22: see the [compatibility history](docs/releases/v0.5.15.md#known-compatibility-limitation).
- tmux
- macOS or Linux. Native Windows is not supported yet, and WSL2 has not been tested
- macOS or Linux. On Windows, use WSL2, the Windows route OpenRig supports; native
Windows isn't supported. OpenRig's automated tests don't run on WSL2 yet; one user's
working setup is in the [getting-started guide](docs/reference/getting-started.md#wsl2-a-reported-working-setup)
Optional:
- herdr or cmux for terminal workspaces showing the agents together
@@ -343,9 +496,9 @@ Optional:
## Setup and Troubleshooting
- `rig setup` attempts core machine preparation: tmux, cmux, Claude Code, Codex, and tmux defaults. It reports what it tried and what actually succeeded. If something fails, it gives the local agent enough context to finish the job.
- `rig setup --full` attempts a broader operator workstation setup (jq, gh) on top of core.
- `rig doctor` inspects current system health and helps diagnose problems after setup. Use it when something stops working or after machine changes.
- `rig setup` attempts core machine preparation: it installs a missing Claude Code or Codex and writes tmux defaults. It installs Herdr by default on macOS and Linux; use `--no-herdr` if you decline it. On macOS it also installs a missing tmux with an existing Homebrew; elsewhere install tmux yourself (setup only checks it). On a Mac, the installing agent offers Ghostty once; accepting uses `rig setup --ghostty`, and declining leaves Terminal.app available. Existing cmux settings are preserved. It reports what it tried and what actually succeeded. If something fails, it gives the local agent enough context to finish the job.
- `rig setup --full` attempts a broader operator workstation setup (jq, gh, via Homebrew, so macOS only) on top of core.
- `rig doctor` inspects current system health and helps diagnose problems after setup. Use it when something stops working or after machine changes. It shares setup's local provider login checks. These do not prove provider acceptance or a working agent; also inspect `rig ps --nodes --rig <rig>`.
Both commands support `--json` for agent-driven workflows.
@@ -353,7 +506,7 @@ Before setup or managed launch, review [what OpenRig changes on your machine](#w
Already-running adopted sessions may need restart before they pick up newly written runtime config.
**For agents:** First ask which available provider(s) the user wants, reusing an explicit choice. Recommend the working account they already have and follow the selected-provider guide above. Offer core setup (`rig setup`) or the fuller workstation path (`rig setup --full`) only when they want those additional tools. Inspect the result with `--json` and use `rig doctor` to finish any remaining machine-specific issues. When OpenRig itself misbehaves, read [docs/reference/help.md](docs/reference/help.md) (installed agents can run `rig context get help`; the same text is at [openrig.dev/help/agents](https://www.openrig.dev/help/agents)): it covers the next step, known problems, and how to reach the team if you're still stuck.
**For agents:** First ask which available provider(s) the user wants, reusing an explicit choice, and pass it to setup (`rig setup --providers claude`, `codex` or `both`). Recommend the working account they already have and follow the selected-provider guide above. Offer core setup (`rig setup`) or the fuller workstation path (`rig setup --full`) only when they want those additional tools. Inspect the result with `--json` and use `rig doctor` to finish any remaining machine-specific issues. Starting OpenRig and opening its view are the last steps of installing, not extras, so do them without stopping to ask whether to go on: start the daemon if it is stopped, open the OpenRig TUI and operator for them (say so, then run `rig terminal open saved:kernel --window --json`; no commands for the person to copy), and hand the person's goal and project folder to the kernel operator ([installing-agent handoff](docs/reference/getting-started.md#installing-agent-handoff)). Installation is finished when the person is talking to the operator; don't implement the project yourself. When OpenRig itself misbehaves, read [docs/reference/help.md](docs/reference/help.md) (installed agents can run `rig context get help`; the same text is at [openrig.dev/help/agents](https://www.openrig.dev/help/agents)): it covers the next step, known problems, and how to reach the team if you're still stuck.
## Comparison with Claude Managed Agents
+45
View File
@@ -0,0 +1,45 @@
# Roadmap
These are things we'd welcome help with. Most came from the community, and most are small enough for one pull request.
This isn't a schedule or a promise: we release often, and an item ships when a good change for it lands.
To see what's being worked on, by release and theme, open the [OpenRig roadmap board](https://github.com/users/mvschwarz/projects/1).
Issues labelled `good first issue` are also listed on the [contribute page](https://github.com/mvschwarz/openrig/contribute).
## How to help
1. Pick an item and comment on its issue to say you're working on it and coordinate with others. A maintainer can assign
you to make that work visible. If it has no issue yet, open one first.
2. Read `CONTRIBUTING.md`, and ask your agent to use the `developing-openrig` skill. It's a map of how OpenRig is
built, tested and changed.
3. Open a pull request that says what a user gets and how you verified it.
If more than one pull request arrives for the same item, we take the best one, and the first equivalent one breaks a
tie. Feel free to coordinate on the issue first.
## Testing
- **Behavioural scenarios for more command families.** `docs/as-built/test-layers.md` has a "Help wanted" list of
`rig` command families that have no scenario yet, each with a suggested first check. One family per pull request is
ideal.
## Agents and runtimes
- **Operator recovery for Pi and Oh My Pi seats** (#41).
- **More harnesses:** we're working out one way for any coding-agent CLI to plug into OpenRig. More on this soon
(design discussion: #43).
## Slack
- **A DM or private channel for single-user setups** (#313).
## Reliability and everyday use
- **Draft-aware delivery** (#48): automated sends wait while someone is typing in a seat, or a seat can be set to
inbox-only.
- **A host-aware resource budget for seats** (#80).
- **Predictable `rig up` over a stopped rig with the same name.**
- **Codex seats that leave a repository's tracked `AGENTS.md` alone** (related: #64).
- **Install and run on Node 26.**
Bugs aren't listed here. Please file them as issues; anything labelled `good first issue` is a good place to start.
+5 -1
View File
@@ -9,7 +9,11 @@ Include the affected version even when reporting a problem in an older installat
## What OpenRig touches
OpenRig runs a local daemon, drives coding agents in tmux sessions on your machine, and writes
configuration for those harnesses (for example under `~/.claude` and `~/.codex`). The README
configuration for those harnesses, including workspace trust records and executable hooks: for
example `~/.claude.json`, skills under `~/.claude`, `$CODEX_HOME/config.toml` (default `~/.codex`),
and, in the project, `.claude/settings.local.json`, `.mcp.json` and managed blocks in `CLAUDE.md`,
`CLAUDE.local.md` or `AGENTS.md`. `rig setup` also edits `~/.tmux.conf` and, on macOS, cmux's
settings. OpenRig's own state lives under `$OPENRIG_HOME` (default `~/.openrig`). The README
section [What OpenRig changes on your machine](README.md#what-openrig-changes-on-your-machine)
describes these effects and the trust/permission choices. Unexpected access, disclosure or
permission changes are useful reports; include what you expected and what you observed.
+2 -2
View File
@@ -2,7 +2,7 @@
"url": "https://context7.com/mvschwarz/openrig",
"public_key": "pk_HcRwWEoFBsmU1mo5VIvWw",
"projectTitle": "OpenRig",
"description": "OpenRig is an open-source multi-agent harness: define a team of Claude Code and Codex agents in YAML, boot it with the rig CLI, and coordinate the agents through tmux sessions, a durable queue and a local daemon.",
"description": "Build your own network of agents from Claude Code, Codex and Pi: persistent teams with roles, shared context and owned work.",
"folders": [],
"excludeFolders": [
"docs/releases",
@@ -18,7 +18,7 @@
],
"excludeFiles": [],
"rules": [
"Install with npm install -g @openrig/cli. OpenRig requires Node.js 22 or 24 and tmux; the first-project starter also requires an authenticated Codex CLI.",
"Install with npm install -g @openrig/cli. OpenRig requires Node.js 22 or 24, tmux, and Claude Code or Codex signed in. The starter team uses both, and the kernel operator adapts it when you have only one.",
"Preview before launching: rig specs preview <spec>, then rig up <spec> --cwd . --plan, then rig up <spec> --cwd .",
"Check seat readiness with rig ps --nodes --rig <rig>, not only daemon health from rig status.",
"Inside a rig, an agent runs rig whoami --json first and treats its output as its identity.",
+1
View File
@@ -4,4 +4,5 @@ ARG TESTBED_IMAGE
FROM ${TESTBED_IMAGE}
COPY runner.mjs /opt/openrig-testbed/runner.mjs
COPY scenarios/ /opt/openrig-testbed/scenarios/
COPY library/ /opt/openrig-testbed/library/
CMD ["node", "/opt/openrig-testbed/runner.mjs", "healthy"]
+12
View File
@@ -4,6 +4,10 @@ This document captures the current OpenRig visual system so the product can be
recreated, extended, or translated into other media without reverse-engineering
the UI from code.
It describes the web UI in `packages/ui`, which is in maintenance mode (see
`docs/reference/developing.md`). The terminal UI has its own theme layer in
`packages/tui/src/theme.ts`.
## Essence
OpenRig is a local control plane for multi-agent work. The interface should feel
@@ -82,6 +86,12 @@ terminal emulator.
The canonical tokens live in `packages/ui/src/globals.css` and are surfaced to
Tailwind in `packages/ui/tailwind.config.ts`.
The values below are the light set (`:root`). A `.dark` block in the same file
redeclares the same names for Vellum Dark. The theme selector offers Vellum
Light, Vellum Dark and System (`packages/ui/src/lib/theme.ts`). With no stored
choice the UI follows the operating system's color scheme (`system`); the choice
is stored under the `openrig.theme` local-storage key.
Paper:
- `--background: 47 20% 97%` - base paper, `#faf9f5`
@@ -230,6 +240,8 @@ Runtime marks:
- Claude: pixel-style Claude mark, label `Claude`
- Codex: Codex CLI terminal-circle mark, label `Codex`
- Pi: blue rounded-square π mark, label `Pi`
- Oh My Pi: violet rounded-square π mark, label `Oh My Pi` (short label `OMP`)
- Terminal: compact terminal glyph, label `TTY` or `Terminal`
- Unknown: neutral fallback
+78 -74
View File
@@ -1,101 +1,105 @@
---
kind: as-built
title: As-Built Docs — Map of Territory + Module Index
title: As-Built Docs — Module Index
status: active
topics: [knowledge-and-context, observability]
domains: [engineering-advisor, operating-advisor, product-advisor]
applies-when: |
Starting any technical task that needs the shipped OpenRig system as it
actually is. Read this first to learn what the as-built tree contains and
which module to open; then go to codemap.md for use-case navigation or
straight to the named module.
siblings: [codemap.md, cli-reference.md, frontmatter-schema.md]
Starting a technical task and choosing the as-built module or source entry
point to read. This index describes the document tree; each module carries
its own source-verification stamp.
siblings: [codemap.md, arteries.md, test-layers.md, cli-reference.md, frontmatter-schema.md]
prerequisite-reads: []
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# OpenRig As-Built Docs
# OpenRig as-built docs
OpenRig is a local control plane for multi-agent coding topologies — a
multi-agent harness that manages your Claude Code and Codex sessions as a
single system, with a daemon (`@openrig/daemon`), a CLI (`@openrig/cli`), a UI
(`@openrig/ui`), and an MCP server all sitting on one SQLite-backed core. This
tree is the **source-verified** description of that system as it actually
ships — every load-bearing claim is grounded to `packages/*/src` at a named
commit, not to memory, chat, or older docs.
These pages describe the code and point to its owning files. This index was checked against
main commit `e8f0ab340db773392ec8be75b072d1c0f3068a50`. A linked module's
`last-verified-against-source` is its own verification boundary; updating this index does not
revalidate that module or identify a running daemon or published package.
> Verified against source at HEAD `7eaf524c` (`git describe` →
> `v0.3.1-6-g7eaf524c`). Package version is **0.3.1** across all three
> packages; HEAD carries 6 commits of unreleased 0.3.2 work, no `v0.3.2` tag.
For the repository overview and contributor recipes, start with [ARCHITECTURE.md](../../ARCHITECTURE.md).
Use [codemap.md](codemap.md) to locate source, [arteries.md](arteries.md) to identify dependent
paths before a change, and [test-layers.md](test-layers.md) to choose checks.
## How this tree is organized
## Repository surfaces
The as-built corpus was modularized (slice 08, `context-architecture-v1`) from
two monolithic files into a folder of thematic modules, each independently
loadable, each frontmatter-tagged for retrieval, each ≤300 lines (author-mode
modules with no prior prose may run to ≤400 — see the slice-08 ACK).
The npm workspaces are `packages/daemon`, `packages/cli`, `packages/tui`, and `packages/ui`
([root package manifest](../../package.json)). The daemon provides the SQLite-backed HTTP
services; CLI, TUI and MCP clients consume them. Runtime adapters include Claude Code, Codex,
Pi, OMP, terminal and stub implementations under `packages/daemon/src/adapters/`.
```
docs/as-built/
├── README.md ← you are here: map-of-territory + index
├── codemap.md ← navigation index (use-case lookup, source-root pointers)
├── frontmatter-schema.md← the frontmatter convention these docs follow
├── cli-reference.md ← full rig CLI surface (kept whole)
├── architecture/ ← 14 backend/runtime modules
└── ui/ ← 4 operator-surface modules
```
`docs/DESIGN.md` (the canonical visual / brand / design-system spec) **stays
at the repo `docs/` root** by design — it is referenced by many existing
`docs/DESIGN.md` paths and carries no source drift. This tree points at it
(see `ui/library-specs-and-design-system.md`); it is not copied here.
The CLI package contains the assembled daemon, TUI and web UI. User reference documents ship
from `docs/reference/`; this as-built tree is developer documentation. The assembly is in
[scripts/build-package.sh](../../scripts/build-package.sh), with the published file list in
[packages/cli/package.json](../../packages/cli/package.json).
## Module index
### `architecture/` — backend, daemon, runtime
### Daemon and runtime
| Module | What it covers |
| Module | Read for |
|---|---|
| [daemon-core.md](architecture/daemon-core.md) | How the daemon boots, `createDaemon` wiring, the SQLite schema/40-migration set, the route-mount surface. |
| [adapters-and-runtimes.md](architecture/adapters-and-runtimes.md) | The five-method RuntimeAdapter contract, the Claude/Codex/Terminal adapters (launch/resume/fork in tmux), and the resume-honesty layer (honest resumed-vs-fresh assessment). |
| [coordination-primitive.md](architecture/coordination-primitive.md) | PL-004 Phase A stream/queue/inbox/outbox; the hot-potato closure contract; where queue closure is enforced. |
| [workflow-runtime.md](architecture/workflow-runtime.md) | PL-004 Phase D Workflow Runtime — spec cache, instance state, step trails, transactional-scribe projection, watchdog policies. |
| [mission-control.md](architecture/mission-control.md) | PL-005 queue-observability surface — seven views, seven write verbs, action audit, bearer-token middleware. |
| [agent-spec-and-startup.md](architecture/agent-spec-and-startup.md) | AgentSpec/RigSpec types, profile resolution, additive startup layering, StartupOrchestrator, whoami/materialize/bind/adopt identity. |
| [lifecycle-snapshot-restore.md](architecture/lifecycle-snapshot-restore.md) | Snapshot capture, honest restore (resume vs rebuild vs fresh), restore-honesty enforcement, restore-check / restore-packet probes. |
| [transport-and-transcripts.md](architecture/transport-and-transcripts.md) | rig send/capture/broadcast over tmux, pipe-pane transcript capture + search, durable SQLite chat, `rig ask`, MCP-name vs tmux-key distinction. |
| [workspace-primitive.md](architecture/workspace-primitive.md) | The PL-007 typed workspace declaration (root/repos/defaultRepo/knowledgeRoot), migrations 038/039, per-item repo-scope gating, file-backed missions/slices indexing. |
| [content-surfaces.md](architecture/content-surfaces.md) | The operator-allowlisted file browser, atomic conflict-checked writes + JSONL edit audit, PROGRESS.md tree indexer, the one-screen Steering composer. |
| [living-notes-review.md](architecture/living-notes-review.md) | **v0.4.4** — the Living Notes review surface: the ONE `ComposedSliceReview` (intent→plan→delivered) projection, pure composer + gatherer, staged-approval locks, C1-bound `verified`, `/api/review/*` routes, freeze export, ranged media serving, and the SDLC on-disk convention it projects. |
| [plugin-agent-image-context-pack.md](architecture/plugin-agent-image-context-pack.md) | The filesystem-canonical content layer — plugin discovery, agent images, context packs, the Claude auto-compaction policy enforcer. |
| [packaging-bootstrap-bundles.md](architecture/packaging-bootstrap-bundles.md) | Bundle assembly (schema-v2 pod bundles + legacy v1), bundle create/inspect/install + `/api/up`, the staged BootstrapOrchestrator, legacy install seams. |
| [architecture-rules-and-event-system.md](architecture/architecture-rules-and-event-system.md) | The cross-cutting invariants — the 25 architecture rules, the RigEvent union + SSE delivery, intentional compatibility limits. |
| [daemon-core.md](architecture/daemon-core.md) | Process startup, service wiring, database migrations and HTTP mounts. |
| [adapters-and-runtimes.md](architecture/adapters-and-runtimes.md) | Runtime adapter methods, harness launch/resume and native-session checks. |
| [agent-spec-and-startup.md](architecture/agent-spec-and-startup.md) | Spec resolution, resource projection, startup delivery and identity. |
| [coordination-primitive.md](architecture/coordination-primitive.md) | Stream, queue, inbox/outbox, handoff and closure. |
| [workflow-runtime.md](architecture/workflow-runtime.md) | Workflow specifications, instances, projection, trails and watchdog policies. |
| [mission-control.md](architecture/mission-control.md) | Queue observations, actions and their audit records. |
| [lifecycle-snapshot-restore.md](architecture/lifecycle-snapshot-restore.md) | Snapshot capture, restore decisions and continuity checks. |
| [transport-and-transcripts.md](architecture/transport-and-transcripts.md) | Session messaging, capture, transcripts, chat and ask. |
| [workspace-primitive.md](architecture/workspace-primitive.md) | Workspace and repository declarations, project resolution and scope. |
| [content-surfaces.md](architecture/content-surfaces.md) | File reads/writes, path checks, progress indexing and steering composition. |
| [living-notes-review.md](architecture/living-notes-review.md) | Review gathering/composition, proof records, approvals, export and media. |
| [plugin-agent-image-context-pack.md](architecture/plugin-agent-image-context-pack.md) | Plugin discovery, agent images, context packs and compaction policy. |
| [packaging-bootstrap-bundles.md](architecture/packaging-bootstrap-bundles.md) | Package assembly, reusable topology bundles and bootstrap/install paths. |
| [architecture-rules-and-event-system.md](architecture/architecture-rules-and-event-system.md) | Cross-cutting invariants, events and compatibility notes. |
### `ui/` — operator surfaces
### Navigation, checks and reference
| Module | What it covers |
| Document | Read for |
|---|---|
| [shell-and-routing.md](ui/shell-and-routing.md) | The UI shell (rail / Explorer / center workspace / drawer / preview stack), the actual route tree the shipped UI mounts, the shared detail drawer + event consumption. |
| [topology.md](ui/topology.md) | The topology surface — host hybrid graph, table/terminal views, activity-ring / hot-potato visual language, terminal-preview popovers, navigation/overlay contracts. |
| [project-and-for-you.md](ui/project-and-for-you.md) | The operator destination surfaces — the For-You attention feed (5-card classifier + verb actions), the Project workspace/mission/slice scope pages, the Dashboard landing on the vellum brand system. |
| [library-specs-and-design-system.md](ui/library-specs-and-design-system.md) | The Library (`/specs`) UI — specs/skills/plugins/agent-images surfaces, the spec-review + spec-library + live-identity flows, the design-system pointer. |
| [codemap.md](codemap.md) | Question-to-module navigation and source entry points. |
| [arteries.md](arteries.md) | Code paths where changes affect several subsystems. |
| [test-layers.md](test-layers.md) | Test scope, isolation, scenarios and hosted CI. |
| [cli-reference.md](cli-reference.md) | CLI commands and options; confirm changing details in `packages/cli/src/index.ts` and command help. |
| [frontmatter-schema.md](frontmatter-schema.md) | Metadata fields used by these documents. |
| [architecture.md](architecture.md) | Compatibility pointer from the former monolithic architecture page. |
| [DESIGN.md](../DESIGN.md) | Visual and design-system specification. |
### Root docs
### Web UI reference
| Doc | What it covers |
Each page below carries its own verification stamp. This index checks that the pages exist, not
their contents.
| Document | Topic |
|---|---|
| [codemap.md](codemap.md) | Navigation index — module map, structural relationship diagram, fast-lookup-by-use-case, source-root pointer table. Start here when you know *what* you need but not *which module*. |
| [cli-reference.md](cli-reference.md) | The full `rig` CLI surface — command groups, subcommands, flags, JSON output, cross-host, coordination primitives. Kept as one doc (slice-08 Q4). |
| [frontmatter-schema.md](frontmatter-schema.md) | Which frontmatter convention governs every doc in this tree, plus the one as-built-unique field (`last-verified-against-source`). |
| `../DESIGN.md` | The canonical visual / brand / design-system spec (lives at `docs/` root by design; pointer only — not duplicated here). |
| [ui.md](ui.md) | Compatibility pointer to the UI modules. |
| [shell-and-routing.md](ui/shell-and-routing.md) | Web UI shell and routing. |
| [topology.md](ui/topology.md) | Web topology views. |
| [project-and-for-you.md](ui/project-and-for-you.md) | Project and attention surfaces. |
| [library-specs-and-design-system.md](ui/library-specs-and-design-system.md) | Library/spec views and design-system pointers. |
## Source-grounding contract
For the terminal UI, start at `packages/tui/src/main.ts`, its HTTP client
`packages/tui/src/daemon-client.ts`, and the TUI sections of [test-layers.md](test-layers.md).
Every module declares `last-verified-against-source: <commit-sha>` — the
commit its claims were checked against. Load-bearing corrections are recorded
inline with an auditable annotation (`> Drift-fix Dx — said X; corrected to Y;
slice-00 §z; re-confirmed <file:line> @HEAD`). OPEN items (counts that are
definitional or runtime-only) are carried verbatim, never smoothed. The
schema is defined in [frontmatter-schema.md](frontmatter-schema.md) and the
governing convention is `openrig-work/conventions/frontmatter-for-context/`.
## Derive the document inventory
At the named commit there are **26 Markdown files**: **14** under `architecture/`, **4** under
`ui/`, and **8** at the root of this tree (including both compatibility pointers). Reproduce
these counts from the repository root:
```bash
source_commit=e8f0ab340db773392ec8be75b072d1c0f3068a50
git ls-tree -r --name-only "$source_commit" -- docs/as-built | grep -E '\.md$' | wc -l
git ls-tree -r --name-only "$source_commit" -- docs/as-built/architecture | grep -E '\.md$' | wc -l
git ls-tree -r --name-only "$source_commit" -- docs/as-built/ui | grep -E '\.md$' | wc -l
git ls-tree -r --name-only "$source_commit" -- docs/as-built | grep -E '^docs/as-built/[^/]+\.md$' | wc -l
```
Read a module's source stamp and prerequisite pointers before relying on it. Source code at the
named commit is the authority when prose disagrees; [frontmatter-schema.md](frontmatter-schema.md)
describes how the stamp is represented.
+33 -42
View File
@@ -1,57 +1,48 @@
---
kind: as-built
title: architecture.md — Reorganized into the Modular As-Built Tree (Redirect Stub)
title: Architecture — Module Navigation
status: superseded
topics: [knowledge-and-context]
domains: [engineering-advisor, operating-advisor, product-advisor]
applies-when: |
You followed an old reference to docs/as-built/architecture.md. The monolith
was reorganized (slice-08, context-architecture-v1) into a folder of thematic
modules. Go to README.md (map of territory) or codemap.md (use-case lookup),
then the named module.
siblings: [README.md, codemap.md, ui.md]
Following an older link to docs/as-built/architecture.md. Use the repository
overview or the current as-built module index linked here.
siblings: [README.md, codemap.md, arteries.md, test-layers.md, ui.md]
prerequisite-reads: []
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# architecture.md was reorganized into the modular as-built tree
# Architecture module navigation
This single-file monolith was split into a folder of independently-loadable,
frontmatter-tagged thematic modules (slice-08, `context-architecture-v1`). The
canonical as-built description of the shipped daemon/runtime now lives in
`architecture/`. This stub is a forwarding pointer so old references still
resolve.
This compatibility page points to the modular documentation. Its links were checked against main
`e8f0ab340db773392ec8be75b072d1c0f3068a50`; the linked pages retain their own source stamps.
**Start here:**
- [Repository architecture](../../ARCHITECTURE.md): package boundaries, request flow, derived
source counts and contributor recipes.
- [As-built index](README.md): the complete module inventory, including the existing web UI references.
- [Codemap](codemap.md): questions mapped to modules and source entry points.
- [Arteries](arteries.md): dependencies to inspect before changing shared runtime paths.
- [Test layers](test-layers.md): the checks available and what they establish.
- [`./README.md`](./README.md) — the map of territory and full module index.
- [`./codemap.md`](./codemap.md) — navigation index: use-case lookup table and
source-root pointers. Use this when you know *what* you need but not *which*
module.
## Daemon and runtime starting points
## Where the major content went
The architecture content is now the **14 modules under `architecture/`**
(13 from the slice-08 reorg + `living-notes-review.md`, added v0.4.4):
| Module | What moved here |
| Topic | Module |
|---|---|
| [`architecture/daemon-core.md`](architecture/daemon-core.md) | Daemon boot, `createDaemon` wiring, the SQLite schema/migration set, the route-mount surface, system overview, package boundaries. |
| [`architecture/adapters-and-runtimes.md`](architecture/adapters-and-runtimes.md) | The five-method RuntimeAdapter contract; Claude/Codex/Terminal adapters; the **Resume honesty** layer (§ Resume honesty). |
| [`architecture/coordination-primitive.md`](architecture/coordination-primitive.md) | PL-004 Phase A stream/queue/inbox/outbox; the hot-potato closure contract; durable handoff. |
| [`architecture/workflow-runtime.md`](architecture/workflow-runtime.md) | PL-004 Phase D Workflow Runtime — spec cache, instance state, step trails, transactional-scribe, watchdog policies. |
| [`architecture/mission-control.md`](architecture/mission-control.md) | PL-005 Mission Control / Queue Observability — the `/api/mission-control/*` surface, seven views, seven write verbs, action audit, bearer-token middleware. |
| [`architecture/agent-spec-and-startup.md`](architecture/agent-spec-and-startup.md) | AgentSpec/RigSpec types, profile resolution, additive startup layering, StartupOrchestrator, whoami/materialize/bind/adopt. |
| [`architecture/lifecycle-snapshot-restore.md`](architecture/lifecycle-snapshot-restore.md) | Snapshot capture, honest restore (resume vs rebuild vs fresh), the verbatim restore-honesty rules, restore-check / restore-packet probes. |
| [`architecture/transport-and-transcripts.md`](architecture/transport-and-transcripts.md) | rig send/capture/broadcast over tmux, transcript capture + search, durable SQLite chat, `rig ask`, MCP-name vs tmux-key. |
| [`architecture/workspace-primitive.md`](architecture/workspace-primitive.md) | The PL-007 typed workspace declaration, migrations 038/039, per-item repo-scope gating, file-backed missions/slices indexing. |
| [`architecture/content-surfaces.md`](architecture/content-surfaces.md) | The operator-allowlisted file browser, atomic conflict-checked writes + edit audit, the PROGRESS.md tree indexer, the Steering composer. |
| [`architecture/plugin-agent-image-context-pack.md`](architecture/plugin-agent-image-context-pack.md) | Plugin discovery, agent images, context packs, the Claude auto-compaction enforcer. |
| [`architecture/packaging-bootstrap-bundles.md`](architecture/packaging-bootstrap-bundles.md) | Bundle assembly (schema-v2 + legacy v1), bundle create/inspect/install + `/api/up`, the staged BootstrapOrchestrator, legacy install seams. |
| [`architecture/architecture-rules-and-event-system.md`](architecture/architecture-rules-and-event-system.md) | The cross-cutting invariants — the 25 architecture rules (incl. **rule 15**, restore honesty), the RigEvent union + SSE delivery, intentional compatibility limits. |
| [`architecture/living-notes-review.md`](architecture/living-notes-review.md) | **Added v0.4.4** (not part of the original monolith): the Living Notes review surface — the one intent→plan→delivered projection, staged-approval locks, proof artifacts, freeze export, ranged media serving. |
| Boot, HTTP services and database wiring | [Daemon core](architecture/daemon-core.md) |
| Harness adapters and native session continuity | [Adapters and runtimes](architecture/adapters-and-runtimes.md) |
| Spec resolution, projection and launch | [Agent spec and startup](architecture/agent-spec-and-startup.md) |
| Durable queue and messaging state | [Coordination](architecture/coordination-primitive.md) |
| Workflow execution and watchdog policies | [Workflow runtime](architecture/workflow-runtime.md) |
| Queue observations and operator actions | [Mission control](architecture/mission-control.md) |
| Snapshot and restore | [Lifecycle](architecture/lifecycle-snapshot-restore.md) |
| Messaging, capture and transcripts | [Transport and transcripts](architecture/transport-and-transcripts.md) |
| Project and repository scope | [Workspace](architecture/workspace-primitive.md) |
| Files, progress and steering | [Content surfaces](architecture/content-surfaces.md) |
| Review, proof and approvals | [Living notes and review](architecture/living-notes-review.md) |
| Plugin discovery, images and context | [Plugins, agent images and context packs](architecture/plugin-agent-image-context-pack.md) |
| Distribution, bundles and bootstrap | [Packaging and bundles](architecture/packaging-bootstrap-bundles.md) |
| Events and cross-cutting invariants | [Architecture rules and events](architecture/architecture-rules-and-event-system.md) |
The UI half of the old `### UI architecture` section is now the **4 modules
under `ui/`** (see [`ui.md`](ui.md), also a redirect stub, and the `ui/` index
in [`./README.md`](./README.md)).
Older web UI links continue through [ui.md](ui.md). For terminal UI source, use the
[package entry points in the codemap](codemap.md#package-entry-points).
@@ -1,228 +1,430 @@
---
kind: as-built
title: Adapters and Runtimes — Claude/Codex/Terminal, tmux/cmux, Resume Honesty
title: Adapters and Runtimes — Claude/Codex/Pi/Stub/Terminal, tmux/cmux, Resume Honesty
status: active
topics: [agent-runtime, runtime-control]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Need the runtime-adapter contract — how OpenRig launches and resumes a
Claude Code, Codex, or terminal harness inside tmux, what the five adapter
methods do, or how the daemon honestly assesses whether a harness actually
resumed vs fresh-launched (the resume-honesty layer).
Claude Code, Codex, Pi, Oh My Pi, stub or terminal harness inside tmux, what
the five required adapter methods do, or how the daemon honestly assesses
whether a harness actually resumed vs fresh-launched (the resume-honesty
layer).
siblings: [daemon-core.md, agent-spec-and-startup.md, lifecycle-snapshot-restore.md]
prerequisite-reads: [../README.md, daemon-core.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Adapters and Runtimes
How OpenRig drives the agent harnesses. The daemon never talks to Claude Code,
Codex, or a shell directly — it talks to a `RuntimeAdapter`. Three adapters
implement one five-method contract; a separate resume-honesty layer answers the
question "did this harness *actually* resume, or did it silently fresh-launch?"
truthfully rather than optimistically.
How OpenRig drives the agent harnesses. Pod-aware launches go through a
`RuntimeAdapter`: five adapter classes implement one contract of five required
methods. Legacy (non-pod-aware) restore resumes through separate resume
adapters (`ClaudeResumeAdapter`, `CodexResumeAdapter`, `PiResumeAdapter` and
`OmpResumeAdapter` in `packages/daemon/src/adapters/*-resume.ts`), which are not
`RuntimeAdapter`s. A separate resume-honesty layer answers the question "did
this harness *actually* resume, or did it silently fresh-launch?" truthfully
rather than optimistically.
> Verified against source at HEAD `7eaf524c` (`git describe` →
> `v0.3.1-6-g7eaf524c`). All source in this module is **present at `v0.3.0`**
> (`git cat-file -e v0.3.0:<path>` for all 7 files → present) — the adapter
> layer is core reboot-era machinery, **not** a 0.3.x feature; do not
> back-attribute (§10.8 version-attribution proof technique).
> Drift-fix (scope) — `architecture.md` §5 "Runtime adapters" carries **no
> slice-00 numeric drift** (proposed-structure §4.2: "adapter contract is
> current"). The corrections below are *precision* refinements where the source
> is more specific than the prose, not stale-count fixes. Each is annotated
> inline and re-confirmed at HEAD.
> Verified against source at main `e8f0ab340db773392ec8be75b072d1c0f3068a50`. Each count below sits beside the
> command that produces it; run the command from the repository root to refresh
> it.
## 1. The five-method RuntimeAdapter contract
`RuntimeAdapter` is `packages/daemon/src/domain/runtime-adapter.ts:127`
`RuntimeAdapter` is `packages/daemon/src/domain/runtime-adapter.ts:143`
(`interface RuntimeAdapter`). Every adapter declares a `readonly runtime`
string and implements exactly five methods (`runtime-adapter.ts:128–153`):
string (`runtime-adapter.ts:146`) and implements five required methods
(`runtime-adapter.ts:152–176`; **5** =
`sed -n '/^export interface RuntimeAdapter/,/^}/p' packages/daemon/src/domain/runtime-adapter.ts | grep -c -E '^ [a-zA-Z]+\('`):
| Method | Signature (`runtime-adapter.ts`) | Responsibility |
|---|---|---|
| `listInstalled` | `(binding)` `:131` | List currently installed/projected resources for a node. |
| `project` | `(plan, binding)` `:134` | Project resources from a `ProjectionPlan` to the runtime's target locations. |
| `deliverStartup` | `(files, binding)` `:137` | Deliver resolved startup files to the runtime. |
| `launchHarness` | `(binding, opts)` `:147` | Launch the harness inside the bound tmux session; return a resume token. |
| `checkReady` | `(binding)` `:153` | Probe whether the harness is responsive and ready. |
| `listInstalled` | `(binding)` `:153` | List currently installed/projected resources for a node. |
| `project` | `(plan, binding)` `:156` | Project resources from a `ProjectionPlan` to the runtime's target locations. |
| `deliverStartup` | `(files, binding, sendInteractiveText?)` `:160` | Deliver resolved startup files to the runtime. The startup orchestrator passes the optional third argument for Claude Code only, so Claude's `send_text` files go through the checked send described in `agent-spec-and-startup.md`. |
| `launchHarness` | `(binding, opts)` `:170` | Launch the harness inside the bound tmux session; return a resume token. |
| `checkReady` | `(binding)` `:176` | Probe whether the harness is responsive and ready. |
The interface also has two optional members: `claudeManagedLaunch` (`:145`)
and `skillTargetPath?()` (`:150`), implemented by `PiRuntimeAdapter`
(`pi-runtime-adapter.ts:118`) and overridden by `OmpRuntimeAdapter`
(`omp-runtime-adapter.ts:12`).
Startup *action* execution (`slash_command` / `send_text`) is explicitly **not**
part of this contract — the contract docstring (`runtime-adapter.ts:121–125`)
part of this contract — the contract docstring (`runtime-adapter.ts:137–142`)
states actions belong to the `StartupOrchestrator` *after* `checkReady()`. The
orchestrator delivery split is in `agent-spec-and-startup.md`.
### `launchHarness` opts and the fork seam
`launchHarness` opts is `{ name: string; resumeToken?: string; forkSource?:
ForkSource }` (`runtime-adapter.ts:147–150`).
ForkSource }` (`runtime-adapter.ts:172`).
> Drift-fix (precision) — `architecture.md` §4 said `launchHarness(binding,
> opts: { name, resumeToken? })`. Source adds a third, mutually-exclusive
> `forkSource` field. Per the contract docstring (`runtime-adapter.ts:142–146`)
> `resumeToken` and `forkSource` are mutually exclusive — if both are provided
> the adapter **must refuse** with a clear error, not guess; `forkSource`
> triggers a fork and the captured token is the NEW post-fork token, never the
> parent. `ForkSource` is `runtime-adapter.ts:116` (`kind: "native_id" |
> "artifact_path" | "name" | "last"`; v1 MVP accepts `native_id` only — other
> shapes rejected at schema validation, docstring `:106–119`).
Per the contract docstring (`runtime-adapter.ts:162–169`) `resumeToken` and
`forkSource` are mutually exclusive — if both are provided the adapter **must
refuse** with a clear error, not guess; `forkSource` triggers a fork and the
captured token is the NEW post-fork token, never the parent. `ForkSource` is
`runtime-adapter.ts:132` (`kind: "native_id" | "artifact_path" | "name" |
"last"`, `:133`; v1 MVP accepts `native_id` only — other shapes rejected at
schema validation, docstring `:122–131`, and by the Claude, Codex and Pi
adapters themselves).
### `HarnessLaunchResult` is a discriminated union with an honest failure arm
> Drift-fix (precision) — `architecture.md` §4 said `HarnessLaunchResult` is
> `{ ok, resumeToken?, resumeType?, error? }` (a single optional-field shape).
> Source is a **discriminated union** (`runtime-adapter.ts:81–86`):
> `| { ok: true; resumeToken?; resumeType? }`
> `| { ok: false; error: string; recovery?: HarnessLaunchRecovery; evidence? }`.
> The failure arm carries a typed `recovery` hint
> (`HarnessLaunchRecovery = "retry_fresh" | "attention_required"`,
> `:79`) and optional `evidence` (last-N pane lines, flowed through to
> `RestoreNodeResult.attentionEvidence` for `attention_required` outcomes,
> `:83–86`). This is the honest-failure shape, not a smoothed optional `error`.
`HarnessLaunchResult` is a **discriminated union** (`runtime-adapter.ts:97–102`):
`| { ok: true; resumeToken?; resumeType?; appliedLaunch? }`
`| { ok: false; error: string; recovery?: HarnessLaunchRecovery; evidence? }`.
The failure arm carries a typed `recovery` hint
(`HarnessLaunchRecovery = "retry_fresh" | "attention_required"`, `:95`) and
optional `evidence` (last-N pane lines, flowed through to
`RestoreNodeResult.attentionEvidence` for `attention_required` outcomes,
`:99–102`). This is the honest-failure shape, not a smoothed optional `error`.
## 2. The three adapters
Readiness has its own attention codes (`runtime-adapter.ts:74–87`):
`trust_gate`, `hook_trust_gate`, `update_gate`, `login_required`, `mcp_gate`,
`bypass_consent_gate`, `codex_auth_refusal` and `codex_client_incompatible`.
When `checkReady` reports one, the readiness wait returns at once and startup
ends `attention_required`.
All three live under `packages/daemon/src/adapters/` and implement
`RuntimeAdapter` (Architecture Rule 1: zero Hono in `adapters/`).
## 2. The runtime adapters
### ClaudeCodeAdapter (`claude-code-adapter.ts:41`)
**5** classes implement `RuntimeAdapter`
(`git grep -l 'implements RuntimeAdapter' packages/daemon/src | wc -l`):
`ClaudeCodeAdapter`, `CodexRuntimeAdapter`, `PiRuntimeAdapter`,
`StubRuntimeAdapter` and `TerminalAdapter`. All live under
`packages/daemon/src/adapters/` (Architecture Rule 1: **0** files there import
Hono, `git grep -l 'from "hono' -- packages/daemon/src/adapters | wc -l`).
`OmpRuntimeAdapter` (Oh My Pi) extends `PiRuntimeAdapter`, so the daemon wires
**6** runtime keys — `claude-code`, `codex`, `pi`, `omp`, `stub`, `terminal`
(`startup.ts:989`, and the same map at `:1259`;
`grep 'adapters: {' packages/daemon/src/startup.ts | grep -o -E '"[a-z-]+": ' | wc -l`).
- `readonly runtime = "claude-code"` (`:42`).
- **Projects** to `.claude/` targets: `guidance_merge` → `<cwd>/CLAUDE.md`
(`:127`); `skill_install` → `<cwd>/.claude/skills/<name>/` (`:71,133`);
subagents → `.claude/agents`, plugins → `.claude/plugins/<id>`,
runtime resources → `.claude/extensions/<id>`, settings fragments merged
into `.claude/settings.local.json` (`:388–400`).
- **Launches** (`:213–215`): fresh = `claude <permissionMode> --session-id
<generatedId> --name <name>`; resume = `claude <permissionMode> --resume
<token> --name <name>`; fork = `claude <permissionMode> --resume <parentId>
--fork-session --name <seat>` (`:188`).
> Drift-fix (precision) — `architecture.md` §5 said only "launches via
> `claude --name <name>`, resumes via `claude --resume <token>`". Source
> shows fresh launch uses an explicit `--session-id` (so a deterministic
> resume token exists immediately) and the fork branch exists. Re-confirmed
> `claude-code-adapter.ts:188,213–215` @HEAD.
- **Readiness** (`checkReady`, `:239`): verifies tmux session alive, captures
40 pane lines + pane command, delegates to `assessNativeResumeProbe` (§3);
ready only when probe `status === "resumed"`. The resume-launch verification
loop `verifyResumeLaunch` retries up to **16 attempts** (`:273`), failing
loudly with `recovery: "retry_fresh"` on `no_conversation_found`
(`:284–289`) — no silent fresh fallback.
### Launch posture
### CodexRuntimeAdapter (`codex-runtime-adapter.ts:37`)
A seat's launch posture is `floor`, `auto` or `full_bypass`. It comes from the
member's or rig's `permission_policy`: `builtinLaunchPosture()`
(`packages/daemon/src/domain/permission-policy/policy-ref.ts:165`) maps
`builtin:yolo` to `full_bypass`, `builtin:auto` to `auto`, and every other
built-in (`locked`, `standard`, `open`) to `floor`.
`resolvePermissionPolicyAttachment()` (`:172`) resolves the attachment, and
`rigspec-instantiator.ts` binds the result: the member attachment
(`resolveMemberPolicyAttachment`, `:1922`), then the persisted node or rig
attachment (`:2007`), then the floor, set on the binding as `launchPosture`
(`:2159`). `NativePermissionStore.apply()`
(`native-permission-store.ts:238`) then overlays a seat's explicit
`rig seat set-permissions` choice, or the kernel operational or team default
described below. `bundle-behaviour.ts` is the read-only
preview of the same mapping for an unopened bundle (see
`packaging-bootstrap-bundles.md`).
- `readonly runtime = "codex"` (`:38`).
`packages/daemon/src/adapters/yolo-mode.ts` turns the posture into flags:
- **Claude Code** (`claudePostureFlag`): an explicit `permissionMode` becomes
`--permission-mode <mode>` (`:43`); `auto` becomes
`--permission-mode auto` (`:47`); `full_bypass` becomes
`--dangerously-skip-permissions`; otherwise the floor is
`--permission-mode acceptEdits` (`:50`). For a seat with no resolved
posture, the instance-wide YOLO setting `OPENRIG_YOLO=1` (`:27`; off by
default) selects the bypass; a resolved posture always wins (`:26`).
- **Codex** (`codexPostureArg`, `:62`): `full_bypass` becomes
`-s danger-full-access -a never` (`:67`); for a seat with no resolved
posture, `OPENRIG_YOLO=1` becomes `-s danger-full-access`; otherwise the
seat's `-p <profile>` or `-s workspace-write`. Codex with `auto` gets the
same: its selected profile, or the `-s workspace-write` floor without one.
**Non-interruptive mode** (`nonInterruptiveArgs()` in
`packages/daemon/src/adapters/non-interruptive.ts:12`) adds per-launch
arguments only for a `full_bypass` seat whose rig has it on
(`rigs.non_interruptive`): Claude Code gets
`--settings '{"skipDangerousModePermissionPrompt":true}'` (unless an explicit
non-bypass `permissionMode` is set), and Codex gets
`-c notice.hide_full_access_warning=true -c notice.hide_gpt5_1_migration_prompt=true`.
It never changes permissions or native settings files. `rig up
--non-interruptive` and `--no-non-interruptive` save the choice; otherwise the
rig spec's `non_interruptive`, then the setting `launch.non_interruptive`,
supplies the default (`packages/daemon/src/domain/bootstrap-orchestrator.ts:739`).
**Kernel operational default.** `NativePermissionStore.launchOverride()`
(`native-permission-store.ts:47`) gives a Claude Code or Codex seat in the
persisted rig named `kernel` operational launch arguments when the seat has no
explicit permission choice, its member and rig declare no permission policy,
and (for Codex) it has no `-p` profile (`launchDefault`, `:28`). Fresh start,
continue, restore and handover all take this decision per launch.
`operationalLaunchArgs()` (`packages/daemon/src/adapters/kernel-authority.ts:56`)
then replaces the non-interruptive arguments for that seat:
- Claude Code keeps the floor, `--permission-mode acceptEdits`, and gets
`--settings` whose `permissions.allow` is `KERNEL_CLAUDE_ALLOW`
(`:9`): `Skill`, `Read`, `Edit`, `Write`, `Glob`, `Grep`, `WebFetch`, `Bash(<command>:*)`
for 39 operational commands (`rig`, `tmux`, `node`, `npm`, `git`, `ssh`, `python3` and
others), `Bash(command -v:*)` (`:16`), two read-only provider login checks (`Bash(claude auth status:*)`,
`Bash(codex login status:*)`, `:18`), and `Read(~/**)` (`:19`), plus the `PreToolUse`
hook described under the team default. It is not
the bypass flag, and the user's own ask and deny rules still apply.
- Codex gets the `full_bypass` posture, `-s danger-full-access -a never`, plus
the two notice flags above.
It writes no settings file. If the rig lookup fails, the seat keeps its floor.
`rig seat status` reports the source as "kernel operational default"
(`kernel_default`, `native-permission-store.ts:182`).
**Team default.** Under the same conditions, a Claude Code or Codex seat in any
other rig gets `teamPermissionDefault` instead (`native-permission-store.ts:38`,
`:56`), on the same launch paths. A Claude Code seat at the floor with no native
permission mode keeps `--permission-mode acceptEdits` and gets
`--settings` (`kernel-authority.ts:64–66`):
`TEAM_CLAUDE_ALLOW` (`:33`) is `Skill`, `Read(./**)`, `Glob`, `Grep`,
`Bash(rig:*)`, eight read-only shell commands and 17 test-runner commands, and
`TEAM_CLAUDE_ASK` (`:40`) asks before 29 `rig` commands: the 23 that start, stop or
remove teams or agents (such as `up`, `down`, `seat stop`, `seat restart` and `bundle install`),
and six kept for a person: `import` (its `--instantiate` mode launches nodes), `seat
set-permissions` and `policy apply` under both spellings (an explicit permission choice),
`setup` (kept for its `--policy` path, which records one; a prefix rule can't tell that path
from ordinary setup, so ordinary setup prompts too), and `compact` (it replaces a peer's
working context). Other `rig` commands fall under the `Bash(rig:*)` allowance. The list was
42 before: 15 commands were removed and 2 added (`seat restart` and `policy permissions
apply`), 13 fewer prompts. The settings carry the allow list and a
`PreToolUse` Bash hook, `packages/daemon/assets/claude-team-permissions.cjs`, that applies
both lists (`kernel-authority.ts:43–53`): it asks before a lifecycle command unless the
command only asks for `--help` or `-h`, allows a simple literal command that matches an
allow rule, and otherwise leaves the decision to Claude (`claude-team-permissions.cjs:234`,
`:240`). Without the hook file, the settings carry both lists as plain `allow` and `ask`
rules (`kernel-authority.ts:46`). A Codex seat launching at
`-s workspace-write` gets `--add-dir` for the workspace root (`workspace.root`)
and its pod's state directory, each created first and skipped with a warning if
it is the home directory or an ancestor of it
(`packages/daemon/src/domain/codex-team-workspace.ts:18`), on fresh, fork and
resume launches (`codex-runtime-adapter.ts:378`, `codex-resume.ts:103`).
### ClaudeCodeAdapter (`claude-code-adapter.ts:55`)
- `readonly runtime = "claude-code"` (`:56`).
- **Projects** to `.claude/` targets: guidance managed blocks →
`<cwd>/CLAUDE.md` by default (`:194`, `:501`; default at
`domain/managed-blocks.ts:17`, and the rig may select `CLAUDE.local.md`
instead with `managed_blocks: { claude-code: <file> }`,
`managed-blocks.ts:15`); `skill_install` → `<cwd>/.claude/skills/<name>/`
(`:200`, `:582`); subagents → `.claude/agents`, plugins →
`.claude/plugins/<id>` (only plugins that apply to Claude), runtime
resources → `.claude/extensions/<id>` (`:584–586`); settings fragments
merged into `.claude/settings.local.json` (`:594`) and MCP fragments into
`<cwd>/.mcp.json` (`:597`).
- **Launches**: fresh = `claude <posture> --session-id <generatedId> --name
<name>` (`:329`); resume = `claude <posture> --resume <token> --name <name>`
(`:328`); fork = `claude <posture> --resume <parentId> --fork-session
--session-id <generatedId> --name <seat>`, which needs Claude Code 2.0.73 or
later. `<posture>` is the flag above plus any non-interruptive,
kernel operational or team default argument. Each command may carry a `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1`
env prefix (`yolo-mode.ts:101–103`; on by default, off with
`OPENRIG_CLAUDE_DISABLE_ALTERNATE_SCREEN=0`), a `--model <model>` argument
(`:275`) and `--effort <effort>` (`:277`). A fresh launch and a fork both
return the generated `--session-id` as their `claude_id` token, so a forked
seat's process names its own conversation and strict proof can verify it.
Neither reads Claude's session files back.
- **Managed launch.** When the binding selects a native permission mode, the
command comes from `ClaudeManagedLaunch.prepare()`
(`domain/claude-managed-launch.ts:97`), which resolves `claude` on the
managed `PATH`, validates the mode against `claude --help` (5-second limit),
and launches through `/usr/bin/env -i` with only the seat's environment
(`PATH`, `HOME`, an optional `CLAUDE_CONFIG_DIR`, the OpenRig seat identity
and forwarded keys).
- **Managed bootstrap.** Before delivery the adapter marks the seat's working
directory as trusted and onboarding as completed in Claude's state file,
writing only when a flag is missing (`provisionManagedBootstrap`, `:697`).
It writes no permission settings. The Codex adapter does the same for
project trust in its `config.toml` (`codex-runtime-adapter.ts:736`).
- **Readiness** (`checkReady`, `:356`): verifies tmux session alive (`:361`),
captures the pane command and 40 pane lines, and assesses them with
`assessNativeResumeProbe` (§3) through `assessManagedProbe` (called `:368`,
defined `:386`); ready only when probe `status === "resumed"`. The
resume-launch verification loop `verifyResumeLaunch` (`:420`) retries up to
**16 attempts** (`:422`), failing loudly with `recovery: "retry_fresh"` on
`no_conversation_found` (`:429–434`) and with `recovery:
"attention_required"` plus pane evidence on an `attention_required` probe
(`:444–450`) — the adapter never relaunches on its own.
### CodexRuntimeAdapter (`codex-runtime-adapter.ts:65`)
- `readonly runtime = "codex"` (`:66`).
- **Projects** to `.agents/` targets: `guidance_merge` → `<cwd>/AGENTS.md`
(`:139,330`); `skill_install` → `<cwd>/.agents/skills/<name>/` (`:89,145`);
skills resolve under `.agents/skills/<id>` (`:377`).
- **Launches/resumes** (`:205,225–226`): fresh launch then capture a fresh
thread id; resume = `codex<profileArg> resume<queueStateDirArg> <token>`;
fork = `codex<profileArg> fork<queueStateDirArg> <parentId>` (`:205`). On
success returns `{ ok: true, resumeToken: threadId, resumeType: "codex_id" }`
(`:222,245,250`).
> Drift-fix (precision) — `architecture.md` §5 said "launches via `codex`,
> resumes via `codex resume <threadId>`". Source confirms the `codex resume
> <token>` shape (`:226`) and adds the fork branch + the
> `resumeType: "codex_id"` tag. Re-confirmed @HEAD.
(`:309`, `:576`); `skill_install` → `<cwd>/.agents/skills/<name>/` (`:315`);
skills resolve under `.agents/skills/<id>` (`:664`); plugins go to
`.codex/plugins/<id>` (`:667`).
- **Launches/resumes**: fresh = `codex[ --no-daemon]<posture>[<network>] -C
<cwd> …` (`:442`), then capture a fresh thread id (`:460`); resume is built
by `buildCodexResumeCore` (`:441`) as `codex<daemon><posture> resume
[<queueStateDirArg>] <token>` (`native-resume-probe.ts:81`); fork =
`codex<posture> fork<queueStateDirArg> <parentId>` (`:411`). `--no-daemon`
(`:389`) comes first, and only when `codex --help` lists it
(`domain/codex-daemon-support.ts`; an unreadable answer refuses the launch).
`-m <model>` (`:356`) and `-c 'model_reasoning_effort="<effort>"'`
(`:358`) are added when selected. With a thread id it returns `{ ok: true,
resumeToken: threadId, resumeType: "codex_id" }` (`:428`, `:457`, `:463`); a
fresh launch whose thread id is not captured returns `{ ok: true }` with its
applied launch but no token (`:466`). Every Codex launch, fresh, fork or resume,
also carries `-c check_for_update_on_startup=false`, so a managed seat leaves Codex
upgrades to the operator (`kernel-authority.ts:60`, added to the posture at
`codex-runtime-adapter.ts:363`).
- **Network default.** On the plain `-s workspace-write` floor,
`domain/codex-network-default.ts` asks a one-shot `codex app-server` for the
effective configuration; when it allows it, the launch adds
`-c sandbox_workspace_write.network_access=true` (`:19`). Otherwise it adds
nothing.
- Refuses `resumeToken` + `forkSource` together with a clear error
(`:180–181`) — honors the mutual-exclusivity contract.
(`:350–351`) — honors the mutual-exclusivity contract.
### TerminalAdapter (`terminal-adapter.ts:19`)
- `readonly runtime = "terminal"` (`:20`).
- **All operations are no-ops** — "the shell IS the harness"
(`terminal-adapter.ts:15`): no-op `project`/`deliverStartup`/`launchHarness`
(`:34`), and `checkReady` returns ready immediately as soon as the tmux
session exists (`:47`). Used for infrastructure nodes — servers, log tails,
build watchers. (A terminal node cannot fork; the runtime-adapter docstring
notes fork-unsupported adapters refuse with a runtime-mismatch error,
`runtime-adapter.ts:113–115`.)
- **All operations are no-ops** — "the shell is immediately interactive"
(`terminal-adapter.ts:15`): no-op `project`/`deliverStartup`, a
`launchHarness` (`:34`) that returns `{ ok: true }`, and a `checkReady` that
returns ready unconditionally (`:47–48`). Used for infrastructure nodes. A
terminal node cannot fork: `launchHarness` refuses a `forkSource` with a
clear error (`:38–42`), as the runtime-adapter docstring requires of
adapters without fork (`runtime-adapter.ts:129–130`).
These three are constructed by `createDaemon` step 4 (`startup.ts`; see
`daemon-core.md` §4 "Startup sequence").
### Pi, Oh My Pi and stub adapters
- `PiRuntimeAdapter` (`pi-runtime-adapter.ts:64`), `runtime` `"pi"` (`:65`).
- `OmpRuntimeAdapter` (`omp-runtime-adapter.ts:7`) extends it with
`runtime = "omp"` (`:8`).
- `StubRuntimeAdapter` (`stub-runtime-adapter.ts:69`), `runtime` defaulting to
`"stub"` (`:81`).
Pi and stub launch an OpenRig runner inside the seat's tmux pane (header
comments `pi-runtime-adapter.ts:1–10`, `stub-runtime-adapter.ts:1–14`). Pi
and Oh My Pi support fork and report `pi_session_file` or `omp_session_file`
resume tokens; the stub refuses fork and reports `stub_session`.
`createDaemon` constructs the adapters (`startup.ts:778`, `:779`, `:782`,
`:783`, `:788`) and creates the terminal adapter inline in the runtime adapter
maps (`startup.ts:989`, `:1259`); see `daemon-core.md` §4 "Startup sequence".
### Terminal providers
Opening a seat in a terminal app goes through `TerminalProvider`s under
`packages/daemon/src/domain/terminal/`, served by `/api/terminal`:
`HerdrAdapter` (`herdr-adapter.ts:351`), the default
(`terminal-service.ts:55–58`), and `CmuxProviderAdapter`
(`cmux-provider-adapter.ts:52`), which is best effort and refuses with
`cmux_unavailable` when cmux is not connected. A request that names no
provider takes the first of Herdr, then cmux, that is available and alive,
and stays on Herdr when neither is (`providerNameFor`,
`terminal-service.ts:175`); a named provider is used as named. These place existing tmux
sessions in views; they do not launch harnesses.
## 3. Resume honesty
The daemon does not assume a harness resumed just because the launch command
ran. Three domain files (`packages/daemon/src/domain/`, all present @v0.3.0)
make resume assessment honest:
ran. Three domain files (`packages/daemon/src/domain/`) carry the resume
assessment:
### `native-resume-probe.ts`
`assessNativeResumeProbe(input)` (`native-resume-probe.ts:43`) reads pane
`assessNativeResumeProbe(input)` (`native-resume-probe.ts:84`) reads pane
command + pane content and returns one of four honest statuses
(`NativeResumeProbeStatus`, `:6`):
(`NativeResumeProbeStatus`, `:7`):
- `resumed` — runtime-specific indicators confirm a resumed session.
- `failed` — terminal failure (e.g. Claude printed "No conversation found" →
code `no_conversation_found`, `:51–57`).
code `no_conversation_found`, `:99–104`).
- `inconclusive` — we don't know yet (e.g. Claude trust gate, code
`trust_gate`, `:65–70`).
`trust_gate`, `:113–118`).
- `attention_required` — alive and recoverable but **needs operator action**
(e.g. Claude resume-selection prompt, code `claude_resume_selection_prompt`,
`:58–64`). This is the proxy for "an operator must choose the conversation";
it is *distinct* from `inconclusive` and `failed` (docstring `:3–5`).
`:106–111`). This is the proxy for "an operator must choose the
conversation"; it is *distinct* from `inconclusive` and `failed` (comment
`:4–6`).
`buildNativeResumeCommand` (`:27`) builds the resume command per runtime:
claude → `claude --resume <token> [--name <name>]` (`:35`); codex → `codex
resume <token>` (`:38`); other runtimes → `null` (`:40`).
Other codes include `bypass_consent_gate`, `mcp_gate`, `login_required` and
`returned_to_shell` for Claude, and `codex_client_incompatible`,
`no_saved_session`, `codex_auth_refusal` and `model_selection_gate` for Codex;
an unknown runtime gets `unsupported_runtime`. For Claude, `assessManagedProbe`
upgrades an auto-mode or composer-only screen to `resumed` only after a stable
native process match on a single pane.
This is Architecture Rule 15 in code: a failed resume is FAILED loudly; there
is no automatic fresh fallback (the adapter's `verifyResumeLaunch` returns
`ok:false` with a `retry_fresh` recovery hint, never a silent relaunch).
`buildNativeResumeCommand` (`:32`) builds the resume command per runtime:
claude → `claude --resume <token> [--name <name>]` (`:41`); codex →
`buildCodexResumeCore` (`:44`), i.e. `codex<posture> resume <token>`
(`:81`); other runtimes → `null` (`:46`).
At the adapter level (Architecture Rule 15, §4), the adapter's
`verifyResumeLaunch` returns `ok:false` with a `retry_fresh` recovery hint and
never relaunches itself. Acting on that hint is the caller's choice:
`StartupOrchestrator` retries once fresh on `retry_fresh` unless the caller
passes `allowFreshFallback: false` (`startup-orchestrator.ts:319–330`), and the
restore orchestrator passes `false` when a pod-aware node requested resume
(`restore-orchestrator.ts:1224`).
### `resume-metadata-refresher.ts`
`ResumeMetadataRefresher` (`resume-metadata-refresher.ts:37`). Post-launch
resume-token capture: `refresh(sessions)` (`:62`) skips sessions that already
have a `resumeToken` (`:65`), and for `claude-code` sessions with a token runs
a `probeClaudeResume` returning `"resumable" | "not_resumable" |
"inconclusive"` (`:31,74–75`) — a real launch of the resume command in a
throwaway probe tmux session (`:106–111`), not a metadata guess.
`ResumeMetadataRefresher` (`resume-metadata-refresher.ts:59`) records which
sessions can be resumed, without overwriting a token it can't re-derive
exactly. `refresh(sessions, opts?)` (`:124`) works in two modes:
- **At shutdown** (default): a Codex session without a token gets its thread
id captured. For a Claude session with a token, it first reads Claude's live
per-process session file, and only if that read fails runs
`probeClaudeResume` (`:216`) — a real launch of the resume command in a
throwaway probe tmux session (`rigged-refresh-<name>-<ts>`, `:301`),
returning `"resumable" | "not_resumable" | "inconclusive"`. The probe result
is recorded without clearing the token.
- **`fillNullOnly`** (`:127`): a missing Claude token is filled from the
status-line sidecar, and a present Claude or Codex token is re-stamped
resumable only when it matches what the runtime reports. No probe runs.
### `codex-thread-id.ts`
Codex thread-id extraction (`codex-thread-id.ts`). Reads the Codex thread id
from the Codex *logs* SQLite databases under `~/.codex/`:
`readCodexThreadIdFromCandidateHomes(...)` (`:22`) →
`readCodexThreadIdFromLogs(...)` (`:49`) → `resolveCodexLogDbPaths(homeDir)`
(`:79`) which globs `<homeDir>/.codex/logs_<N>.sqlite` (`:84–89`,
regex `^logs_(\d+)\.sqlite$`) and falls back to `logs_1.sqlite` (`:97`).
Uses `better-sqlite3` (`:5`). Resolves the home dir by the harness PID
(`defaultResolveHomeDirByPid`, `:9`).
from the Codex *logs* SQLite databases in the Codex home (`CODEX_HOME` when
set, else `~/.codex`, `:40`): `readCodexThreadIdFromCandidateHomes(...)`
(`:34`) → `readCodexThreadIdFromLogs(...)` (`:244`) →
`resolveCodexDbPaths(homeDir, kind)` (`:302`), which globs
`logs_<N>.sqlite` (`:308`) and falls back to `logs_1.sqlite`. The logged
thread ids are then checked against the `threads` table in `state_<N>.sqlite`
(falling back to `state_5.sqlite`, `:320`; query `:269–280`); an id is
returned only when exactly one CLI conversation matches (`:282`). Uses
`better-sqlite3` (`:6`). Resolves the home dir by the harness PID
(`defaultResolveHomeDirByPid`, `:16`).
> Precision note — `architecture.md` §5 "Resume honesty" says codex thread IDs
> come from "the Codex SQLite database". Source is more specific: the
> per-version Codex *logs* DBs `~/.codex/logs_N.sqlite`. Stated precisely here;
> re-confirmed `codex-thread-id.ts:79–97` @HEAD.
## 4. Relevant Architecture Rules
## 4. Relevant Architecture Rules (source-verified at HEAD)
The rule texts live in `architecture-rules-and-event-system.md` §1; this
section cites them by number with the adapter-level evidence checked for this
module.
From `architecture.md` §7 (re-confirmed against the source cited inline):
- **Rule 5** — Runtime is member-authoritative in the pod-aware model.
- **Rule 13** — Readiness checking is a retry loop with exponential backoff and
a configurable timeout, using adapter-specific probes (Claude TUI indicator,
Codex ready message, terminal immediate). Re-confirmed: `checkReady`
delegates to `assessNativeResumeProbe`; the retry loop is
`claude-code-adapter.ts:273` (16 attempts).
- **Rule 14** — Resume states are locked: `resumed` / `rebuilt` / `fresh`;
`rebuilt` = new process assembled from artifacts. (The probe layer adds
`inconclusive` / `attention_required` as honest *transient* states, not
outcomes — see §3.)
- **Rule 15** — Restore honesty: failed resume is FAILED loudly; no automatic
fresh fallback; fresh launch is an explicit follow-up only. Enforced in code
by §2/§3 (`verifyResumeLaunch` returns `ok:false`, never relaunches).
- **Rule 1** — §2: **0** files in `adapters/` import Hono.
- **Rule 5** — restore picks a node's adapter by that node's own runtime: the
saved startup context's runtime, else the node's (`restore-orchestrator.ts:1115–1116`),
used to choose the replay adapter (`:1138`).
- **Rule 13** — the readiness loop is `StartupOrchestrator.waitForReady`
(`startup-orchestrator.ts:562`; 1 s doubling to a 16 s cap), which calls each
adapter's `checkReady` (§2). The timeout comes from the
`runtime.readiness_timeout_seconds` setting (default 30, range 1–600,
`domain/readiness-timeout.ts:3`).
- **Rule 14** — the probe's `attention_required` (§3) reaches the restore
result through `HarnessLaunchResult.recovery` and `evidence` (§1), which
become `RestoreNodeResult.status` (`types.ts:457`, `:475`) and
`attentionEvidence` (`types.ts:478`). A startup's `continuityOutcome` is a
separate field that also allows `forked` (`startup-orchestrator.ts:101`).
- **Rule 15** — adapters return `ok:false` and never relaunch (§2, §3);
restore passes `allowFreshFallback: false` for pod-aware resume
(`restore-orchestrator.ts:1224`), and a resume that concludes failed rolls
back to zero sessions as `awaiting-decision` (`restore-orchestrator.ts:1055`,
`:1243`).
## See also
- `daemon-core.md` — where `createDaemon` constructs the three adapters.
- `daemon-core.md` — where `createDaemon` constructs the runtime adapters.
- `agent-spec-and-startup.md` — the `StartupOrchestrator` that calls these
adapters and owns startup-action execution after `checkReady()`.
- `lifecycle-snapshot-restore.md` — how persisted resume tokens flow into
snapshot/restore (resume vs rebuild vs fresh).
- `architecture-rules-and-event-system.md` — the full architecture rule list.
- Source roots: `packages/daemon/src/domain/runtime-adapter.ts`,
`packages/daemon/src/adapters/{claude-code-adapter,codex-runtime-adapter,terminal-adapter}.ts`,
`packages/daemon/src/domain/{native-resume-probe,resume-metadata-refresher,codex-thread-id}.ts`.
`packages/daemon/src/adapters/{claude-code-adapter,codex-runtime-adapter,pi-runtime-adapter,omp-runtime-adapter,stub-runtime-adapter,terminal-adapter,yolo-mode,non-interruptive,kernel-authority}.ts`,
`packages/daemon/src/domain/{native-resume-probe,resume-metadata-refresher,codex-thread-id,claude-managed-launch,codex-network-default,native-permission-store}.ts`,
`packages/daemon/src/domain/permission-policy/policy-ref.ts`.
@@ -11,83 +11,92 @@ applies-when: |
resolve and preserve identity.
siblings: [daemon-core.md, adapters-and-runtimes.md, lifecycle-snapshot-restore.md, packaging-bootstrap-bundles.md]
prerequisite-reads: [../README.md, daemon-core.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Agent/Rig Spec, Resolution, Startup, Identity
How the daemon turns authored YAML specs into a resolved, projected, launched,
and identity-addressable topology. The spec-and-startup contract: parse →
resolve → project → deliver → launch → wait → persist replay context.
resolve → project → deliver pre-launch files → persist replay context → launch
→ wait → deliver post-launch files.
> Verified against source at HEAD `7eaf524c` (`git describe` →
> `v0.3.1-6-g7eaf524c`). Package version is **0.3.1** across all three
> packages (slice-00 §1.1). Source feed located by `architecture.md` headings
> (§4 Canonical Reboot Types, §5 Domain Services, §6 Execution Flows, §7
> Architecture Rules) per slice-08 §10.1 — line numbers are advisory only.
> Verified against source at main `e8f0ab340db773392ec8be75b072d1c0f3068a50`. `domain/…` and `routes/…` paths
> are under `packages/daemon/src/`; a bare file name such as
> `rigspec-schema.ts:119` is in `packages/daemon/src/domain/`. Each count sits
> beside the command that produces it; run the command from the repository
> root to refresh it.
## 1. Canonical spec and topology types
(`architecture.md` §4 "Spec and topology")
- **AgentSpec** (`types.ts:941`) — parsed from `agent.yaml`
(`agent-resolver.ts:150`). Owns imports, defaults, startup, resources, and
profiles. Canonical parse/normalize/validate is `domain/agent-manifest.ts`.
- **RigSpec** (`types.ts:1172`) — canonical pod-aware rig topology. Uses
`version: "0.2"` and `pods[]`; owns cross-pod `edges[]`, rig-level startup
overlays, and `cultureFile`, plus the optional `summary`, `permissionPolicy`,
`nonInterruptive`, `managedBlocks`, `docs`, `services` and `workspace` fields.
An authored `non_interruptive` must be a boolean (`rigspec-schema.ts:179`) and
sets the rig's saved non-interruptive choice at instantiation unless an
explicit launch option is given (`rigspec-instantiator.ts:1345`).
- **AgentSpec** — parsed from `agent.yaml`. Owns imports, defaults, startup,
resources, and profiles. Canonical parse/normalize/validate is
`domain/agent-manifest.ts`.
- **RigSpec** — canonical pod-aware rig topology. Uses `version: "0.2"` and
`pods[]`; owns cross-pod `edges[]`, rig-level startup overlays, and
`cultureFile`.
`version` is the spec-schema version, not the package version. It is not a
code constant: `RigSpecSchema.validate` requires only a non-empty string
(`rigspec-schema.ts:119`) and `RigSpecSchema.normalize` carries the authored
value through (`rigspec-schema.ts:253`). `"0.2"` is the canonical authored
value, and the pod-aware exporter writes it (`rigspec-exporter.ts:223`).
> Drift-fix D-spec-version — `architecture.md` §4 says RigSpec
> "Uses `version: "0.2"`". This is the **spec-schema version, NOT the
> package version** — a different versioning axis from the 0.3.1 package
> version. The value is NOT a code constant: `rigspec-schema.ts:52`
> validates `version` only as a "required non-empty string"
> (`if (!obj["version"] || typeof obj["version"] !== "string")`); `:163`
> carries it through as `raw["version"] as string`. `"0.2"` is the
> canonical authored value, correctly described as a schema axis. Do NOT
> "correct" it toward 0.3.1 (slice-08 §4.6 binding). Re-confirmed
> `rigspec-schema.ts:52,163` @HEAD.
- **RigServicesSpec** — optional `services` block on a pod-aware RigSpec.
Shipped kind is Compose-backed env management with `composeFile`,
`projectName?`, `profiles?`, `downPolicy?`, `waitFor?`, `surfaces?`,
`checkpoints?`.
- **RigSpecPod** — pod-local bounded context with `members[]`, pod-local
`edges[]`, pod startup, optional continuity policy.
- **RigSpecPodMember** — member-level runtime/startup surface: `agentRef`,
`profile`, `runtime`, `model?`, `cwd`, `restorePolicy?`, member startup
overlays.
- **Pod** — persisted DB entity for a pod.
- **ContinuityState** — persisted live continuity row keyed by
`podId + nodeId`.
- **RigServicesSpec** (`types.ts:1221`) — optional `services` block on a
pod-aware RigSpec. Shipped kind is Compose-backed env management
(`kind: "compose"`) with `composeFile`, `projectName?`, `profiles?`,
`downPolicy?`, `waitFor?`, `surfaces?`, `checkpoints?`.
- **RigSpecPod** (`types.ts:1128`) — pod-local bounded context with
`members[]`, pod-local `edges[]`, pod startup, optional continuity policy.
- **RigSpecPodMember** (`types.ts:1072`) — member-level runtime/startup
surface: `agentRef`, `profile`, `runtime`, `model?`, `effort?`, `cwd`, `restorePolicy?`,
member startup overlays (`startup?`), plus `label?`, `codexConfigProfile?`,
`role?`, `permissionPolicy?`, `compactionStrategy?`, `mechanic?`,
`sessionSource?` and `starterRef?`.
- **Pod** (`types.ts:10`) — persisted DB entity for a pod.
- **ContinuityState** (`types.ts:20`) — persisted live continuity row keyed by
`podId + nodeId` (`PRIMARY KEY (pod_id, node_id)`,
`packages/daemon/src/db/migrations/014_agentspec_reboot.ts:24`).
## 2. Execution and projection types
(`architecture.md` §4 "Execution and restore" — restore/snapshot members are
detailed in `lifecycle-snapshot-restore.md`; the spec/projection members live
here)
Restore/snapshot types are detailed in `lifecycle-snapshot-restore.md`; the
spec/projection types live here.
- **ResolvedNodeConfig** — output of profile resolution. Carries effective
runtime/model/cwd, narrowed restore policy, selected resources, layered
startup block, resolved spec identity.
- **ProjectionPlan** — runtime projection plan for a node: runtime, cwd,
projection entries, startup block, diagnostics, conflict/no-op
classifications.
- **RuntimeAdapter** — the five-method contract (adapter detail in
`adapters-and-runtimes.md`): `listInstalled(binding)`
(`runtime-adapter.ts:131`), `project(plan, binding)` (`:134`),
`deliverStartup(files, binding)` (`:137`), `launchHarness(binding, opts)`
(`:147`), `checkReady(binding)` (`:153`). Re-confirmed @HEAD — the contract
is current.
- **HarnessLaunchResult** — `{ ok, resumeToken?, resumeType?, error? }`
returned by `launchHarness`.
- **StartupOrchestrator** — drives the full startup sequence (§4 below).
- **ResolvedNodeConfig** (`profile-resolver.ts:33`) — output of profile
resolution. Carries effective runtime/model/effort/cwd, narrowed restore policy,
selected resources, layered startup block, resolved spec identity, and the
resolved compaction strategy, continuity mechanic, lifecycle, activity and
skill loadout.
- **ProjectionPlan** (`projection-planner.ts:42`) — runtime projection plan for
a node: runtime, cwd, projection entries, startup block, diagnostics,
conflict/no-op classifications.
- **RuntimeAdapter** (`runtime-adapter.ts:143`) — the five-method contract
(adapter detail in `adapters-and-runtimes.md`): `listInstalled(binding)`
(`runtime-adapter.ts:153`), `project(plan, binding)` (`:156`),
`deliverStartup(files, binding, sendInteractiveText?)` (`:160`),
`launchHarness(binding, opts)` (`:170`), `checkReady(binding)` (`:176`). The
interface also declares an optional `claudeManagedLaunch` property (`:145`)
and an optional method, `skillTargetPath?(...)` (`:150`). Required methods:
**5**
(`sed -n '/^export interface RuntimeAdapter /,/^}/p' packages/daemon/src/domain/runtime-adapter.ts | grep -c -E '^ [a-zA-Z]+\('`).
- **HarnessLaunchResult** (`runtime-adapter.ts:97`) — returned by
`launchHarness`: either `{ ok: true, resumeToken?, resumeType?,
appliedLaunch? }` or `{ ok: false, error, recovery?, evidence? }`, where
`recovery` is `"retry_fresh"` or `"attention_required"` (`:95`).
- **StartupOrchestrator** (`startup-orchestrator.ts:140`) — drives the full
startup sequence (§4 below).
## 3. Parsing, validation, resolution pipeline
(`architecture.md` §5 "Parsing and validation" + "Resolution pipeline"; all
under `packages/daemon/src/domain/`, zero Hono imports per Architecture Rule 1)
All of the files below are under `packages/daemon/src/domain/`, and none of
them imports Hono: **0**
(`git grep -l '"hono' -- packages/daemon/src/domain/{agent-manifest,rigspec-schema,rigspec-codec,startup-validation,path-safety,spec-validation-service,spec-review-service,agent-resolver,agent-preflight,profile-resolver,startup-resolver,projection-planner}.ts | wc -l`).
**Parse / validate:**
@@ -110,115 +119,216 @@ under `packages/daemon/src/domain/`, zero Hono imports per Architecture Rule 1)
- `startup-resolver.ts` — additive startup layering.
- `projection-planner.ts` — runtime resource projection planning.
All eleven files re-confirmed present in `packages/daemon/src/domain/` @HEAD.
## 4. Startup orchestration (the spec-startup contract)
(`architecture.md` §4 "StartupOrchestrator" + §5 "Startup, runtime, and
instantiation" + §7 Architecture Rule 6)
`StartupOrchestrator.startNode` (`startup-orchestrator.ts:172`, a thin wrapper
over `startNodeWithWarnings`, `:178`) drives, in source order: apply the seat's
permission selection and the rig's non-interruptive setting to the binding
(`NativePermissionStore.apply`, `:183`; `:193`) → mark pending (`:209`) and
select the startup proof (`:210`) → project resources (`:224`) → deliver
pre-launch files (`:266`) → persist startup context (`:282`) → launch harness,
recording any resume token (`:301`, `:313`) → wait for ready (`:384`) → deliver
the session identity prompt and interactive files (`:420`, `:473`) → execute
`after_files` then the remaining `after_ready` actions (`:495`, `:502`; see
the resume preload below) → check readiness
again and, for a Claude resume, that the launched session agrees with the
requested token (`:507`–`535`) → mark ready (`:538`). The class doc comment
(`startup-orchestrator.ts:120`–`139`) lists ten steps; the code persists the
startup context before the harness launch.
`StartupOrchestrator` (`domain/startup-orchestrator.ts`) drives:
mark pending → project resources → deliver pre-launch files → launch harness
→ wait for ready → deliver interactive files → execute actions → persist
context → mark ready.
**Pre-launch vs interactive delivery split** — the load-bearing seam,
re-confirmed at source:
**Pre-launch vs interactive delivery split** — the load-bearing seam:
- Pre-launch (filesystem, before harness boot): `guidance_merge`,
`skill_install` (`startup-orchestrator.ts:78,167` — "Deliver pre-launch
files (guidance_merge, skill_install → filesystem)").
`skill_install` (`startup-orchestrator.ts:126` — "Deliver pre-launch files
(guidance_merge, skill_install → filesystem)"; delivered at `:266`). Any
file that is not `send_text` is delivered here.
- Post-launch (TUI, after harness is ready): `send_text`
(`startup-orchestrator.ts:82,160,263` — partition by concrete hint at
`:141`, deliver after readiness at `:263`).
(`startup-orchestrator.ts:130`; held for post-launch and delivered after
readiness at `:473`). Rebuild artifacts are put in front of these files.
- **Fresh launch:** the builtin `session_identity` action
(`rigspec-instantiator.ts:2655`) is sent as one turn together with the first
`send_text` file (`deliverInitialSessionPrompt`, `startup-orchestrator.ts:663`).
- **Resume, fork or rebuild:** applicable `after_ready` `send_text` actions are
sent ahead of the first `send_text` file as one turn.
The orchestrator persists replay context including the resume token for future
restores (consumed by `lifecycle-snapshot-restore.md`).
The orchestrator persists replay context for future restores (consumed by
`lifecycle-snapshot-restore.md`): the projection entries, resolved startup
files, startup actions and runtime go to `node_startup_context`
(`startup-orchestrator.ts:282`), and a resume token returned by the launch is
written to the session row (`updateResumeToken`, `:313`).
**Architecture Rule 6 — startup layering is additive and ordered** (carried
verbatim, `architecture.md` §7): (1) agent base, (2) profile, (3) rig culture
**Checked startup text (Claude Code).** Interactive text for a Claude seat goes
through `sendInteractiveText` (`:777`): paste, wait 200 ms, press Enter, wait
200 ms, then read 200 lines of the pane. `inspectStartupStagedText`
(`startup-submission-evidence.ts:36`) classifies the composer as clear, staged
or unverified. While the composer shows Claude's own collapsed-paste label for
this text (`startupOwnCollapsedPaste`, `:49`), `settleOwnPaste`
(`startup-orchestrator.ts:867`) looks again, up to 25 times 200 ms apart,
without pressing anything. Text still staged gets one guarded Enter-only retry
(`:823`), and then a "press Enter in that pane" warning (`:836`). An
unverified or staged result is a warning, never a startup failure, and is
reported in a `submission` block on `node.startup_ready` and on the result.
**Startup proof.** A seat can be `ready` without being oriented.
`resolveStartupProof` (`startup-resolver.ts:81`) selects the last applicable
authored `startup_proof` action; the default is none. For a fresh launch on a
non-terminal runtime in `authenticated` mode, the orchestrator issues a
challenge after readiness (`issueStartupChallenge`, `startup-proof.ts:90`),
recorded as `node.startup_challenged` with a hash of the resolved startup files.
The expected answer is derived from the challenge and that hash
(`computeExpectedAnswer`, `:53`) and is never stored. The challenge text is
appended to the identity prompt, or sent on its own when there is no identity
action (`startup-orchestrator.ts:487`). On Claude, a short proof instruction
line (`STARTUP_PROOF_INSTRUCTION_LINE`, `startup-proof.ts:63`) is sent only
after the startup prompt was confirmed submitted (`sendProofInstruction`,
`startup-orchestrator.ts:760`). The seat answers with
`rig startup-proof submit --challenge-id … --answer …`
(`packages/cli/src/commands/startup-proof.ts:99`), which posts to the activity
hook route (`routes/activity.ts:239`); `verifyStartupProof`
(`startup-proof.ts:133`) records `node.startup_proof_verified` or
`node.startup_proof_rejected`. Orientation status is derived from those events
(`startup-proof.ts:239`), never from `startup_status`. Other fresh launches (no
proof selected, or a terminal runtime) record `node.startup_proof_skipped`
(`startup-orchestrator.ts:374`); resume, fork and rebuild keep the existing proof
history.
**Pending startup context and `rig seat continue`.** When a fresh launch stops at
a native prompt before its context is delivered, `fail()` (`:806`) marks the
failure `freshContextPending` and adds "run: rig seat continue <session>". A
Codex fork whose own id isn't verified at launch, or whose readiness times out,
ends `attention_required` with `forkContextPending` (its parent token) instead:
the role waits, and nothing is saved for an unverified child.
`canContinueStartup` (`:764`, using `readPendingStartupContext`, `:46`) allows
continuation only while that failure is the occupant's latest startup event.
`continueStartup` (`seat-lifecycle-service.ts:723`) re-checks the binding,
pane and runtime, then runs startup again on the same conversation without
relaunching the harness. A fork continuation first re-verifies the child with
`captureForkIdentity` (`codex-runtime-adapter.ts:668`; `startup-orchestrator.ts:559`)
and needs the exact pending event it started from; a fresh continuation keeps
the plain "still pending" check. It is reached by `rig seat continue`,
`POST /api/seat/continue/:seatRef` and the per-seat startup route's `continue`
action (`routes/startup.ts:159`).
**Startup layering is additive and ordered** (`resolveStartup`,
`startup-resolver.ts:15`–`22`): (1) agent base, (2) profile, (3) rig culture
file, (4) rig startup, (5) pod startup, (6) member startup, (7) operator debug
append. This is the spec-startup contract's invariant; the full 25-rule list
lives in `architecture-rules-and-event-system.md`.
append. Files and actions are concatenated in that order with no
deduplication (`startup-resolver.ts:24`). This is the spec-startup contract's
invariant; the cross-cutting architecture rules are collected in
`architecture-rules-and-event-system.md`.
**Startup action constraints** (`architecture.md` §7 "Current startup action
constraints"): no shell startup actions; action types are `slash_command` and
`send_text` only; non-idempotent actions must not apply on restore; retrying
failed startup is handled as restore.
The launch path takes only the actions from `resolveStartup`. It builds the
startup *file* chain itself (`buildResolvedStartupFiles`,
`rigspec-instantiator.ts:2518`), in this order: agent base, profile, the shipped
`CULTURE-default.md` floor (`:327`), the rig `culture_file`, rig, pod, member,
the shipped `openrig-start.md` (`:2572`), and, for fresh launches when enabled,
the onboarding files (`:2582`). Managed-block guidance is deduplicated, and a
`starter_ref` layer is put in front when a member names one (`:2243`).
**Remote import constraints** (§7): the reboot supports `local:...` and
`path:/abs/...`. Remote `agent_ref` sources remain unsupported and fail in
preflight.
**Startup action constraints** (`startup-validation.ts`): startup entries must
be files (`:22`); no shell startup actions (`:65`); action types are
`slash_command`, `send_text` and `startup_proof` (`:7`), and a `startup_proof`
action must be idempotent with a value of `authenticated` or `none` (`:73`);
non-idempotent actions must not apply on restore (`:100`). Retrying a failed
startup is handled as a restore, which is why the orchestrator skips
non-idempotent actions on restore (`startup-orchestrator.ts:634`,
"retry-as-restore safety"). The exception is
`PodRigInstantiator.retryFirstStart` (`rigspec-instantiator.ts:1147`), which
re-runs a first start that failed at projection, before any harness launch.
**Remote import constraints**: `agent_ref` and AgentSpec imports accept
`local:<relative path>` and `path:<absolute path>` only
(`rigspec-schema.ts:41`, `agent-manifest.ts:40`); a terminal member uses the
`builtin:terminal` sentinel (`rigspec-schema.ts:532`). Remote `agent_ref`
sources remain unsupported: RigSpec validation rejects them
(`rigspec-schema.ts:563`), `rigPreflight` runs that validation
(`rigspec-preflight.ts:252`), and the resolver refuses a remote import again
(`agent-resolver.ts:203`).
## 5. Instantiation, preflight, export
(`architecture.md` §5 "Startup, runtime, and instantiation" + §6 "RigSpec
import / validate / preflight / export")
- `runtime-adapter.ts` — adapter contract + bridge types.
- `rigspec-preflight.ts` — dual-stack legacy preflight plus rebooted
`rigPreflight(...)`.
- `rigspec-instantiator.ts` — dual-stack `RigInstantiator` plus
`PodRigInstantiator`.
- `rigspec-preflight.ts` — dual-stack legacy preflight (`RigSpecPreflight`,
`rigspec-preflight.ts:26`) plus rebooted `rigPreflight(...)` (`:246`).
- `rigspec-instantiator.ts` — dual-stack `RigInstantiator`
(`rigspec-instantiator.ts:33`) plus `PodRigInstantiator` (`:475`).
- `rigspec-exporter.ts` — dual-format live rig export to YAML/JSON.
- `pod-repository.ts` — pod CRUD plus live continuity-state CRUD.
`routes/rigspec.ts` is the dual-format seam: validate
`routes/rigspec.ts` is the dual-format seam; a parsed spec with a `pods` array
takes the pod-aware path (`routes/rigspec.ts:83`): validate
(pod-aware → `RigSpecSchema.validate`; legacy → `LegacyRigSpecSchema.validate`),
preflight (`rigPreflight({ rigSpecYaml, rigRoot, fsOps })` vs
preflight (`rigPreflight({ rigSpecYaml, rigRoot, … })` vs
`RigSpecPreflight.check(spec)`), import
(`podInstantiator.instantiate(yaml, rigRoot)` vs
(`podInstantiator.instantiate(yaml, rigRoot, …)` vs
`RigInstantiator.instantiate(spec)`), export (pod-aware exports canonical
`version: "0.2"` RigSpec; legacy exports flat-node v1).
`version: "0.2"` RigSpec; legacy exports flat-node `schemaVersion: 1`,
`rigspec-exporter.ts:105`).
The import validation route delegates to `validateRigSpecImport`
(`routes/rigspec.ts:215–223`, `spec-validation-service.ts:10–19`). The same
helper powers local `rig spec validate` without contacting the daemon
(`packages/cli/src/commands/rig.ts:204–207`); it selects the pod-aware or legacy
validator and distinguishes YAML parse failures from validator exceptions.
## 6. Identity: whoami, materialize, bind, adopt
(`architecture.md` §6 "Whoami and adopted-session parity flow" +
"Materialize / bind / adopt flow")
**Whoami resolution** — the daemon owns the truth surface through
`/api/whoami` (`routes/whoami.ts`); tmux metadata is an adopted-session
anchor, not sovereign truth. `whoami-service.ts:8` declares
`resolvedBy: "node_id" | "session_name"`. The route requires `nodeId` or
`sessionName` (`routes/whoami.ts:10-15`). Resolution order:
explicit `--node-id` → explicit `--session` → env vars → tmux metadata →
raw tmux session-name fallback.
`sessionName` (`routes/whoami.ts:19`–`23`). The CLI resolves identity
(`packages/cli/src/commands/whoami.ts:142`–`148`) in this order: explicit
`--node-id` → explicit `--session` → env vars (`OPENRIG_NODE_ID` /
`OPENRIG_SESSION_NAME`, or the legacy `RIGGED_NODE_ID` /
`RIGGED_SESSION_NAME`, `whoami.ts:158`) → tmux metadata → raw tmux
session-name fallback.
- Managed sessions prefer projected `OPENRIG_NODE_ID` /
`OPENRIG_SESSION_NAME`.
- Adopted sessions use tmux-owned metadata written at claim/bind time.
`OPENRIG_SESSION_NAME`, set when the tmux session is created
(`node-launcher.ts:143`–`144`).
- Adopted sessions use tmux-owned metadata written at bind time.
> Drift-nuance D5 (the careful axis — see also `transport-and-transcripts.md`):
> the tmux metadata keys `@rigged_node_id` / `@rigged_session_name` /
> `@rigged_rig_id` / `@rigged_rig_name` / `@rigged_logical_id` in
> `architecture.md` §6 are **CORRECT as-is** and were verified literally at
> source — `claim-service.ts:77-81` writes exactly these `@rigged_*` keys;
> `claim-service.ts` and `rig-lifecycle-service.ts` read them. This is a
> SEPARATE axis from MCP tool names (which are `rig_*`, slice-00 §1.4). Do
> NOT blanket-replace `rigged` → `rig` (banked
> `feedback_release_prep_three_layer_depersonalization`: the rename was
> scoped, not global). The tmux metadata keys were NOT renamed.
> Re-confirmed `claim-service.ts:77-81` @HEAD.
The tmux metadata keys use the `@rigged_` prefix:
`ClaimService.setRiggedMetadata` writes `@rigged_node_id` /
`@rigged_session_name` / `@rigged_rig_id` / `@rigged_rig_name` /
`@rigged_logical_id` (`claim-service.ts:182`–`186`), called from `bind`,
`reconcileSession` and `createAndBindToPod`;
`RigLifecycleService.unclaimSession` clears the same five keys
(`rig-lifecycle-service.ts:209`–`213`); and `rig whoami` reads
`@rigged_node_id` and `@rigged_session_name`
(`packages/cli/src/commands/whoami.ts:173`, `:179`). MCP tool names use a
different prefix, `rig_*` (`packages/cli/src/mcp-server.ts`).
**Materialize / bind / adopt** (`architecture.md` §6): `POST
/api/rigs/import/materialize` creates a pod-aware topology without launching
sessions; `POST /api/discovery/:id/bind` attaches a discovered live session to
an existing logical node; `POST /api/discovery/:id/adopt` is the composite
**Materialize / bind / adopt**: `POST /api/rigs/import/materialize`
(`routes/rigspec.ts:176`) creates a pod-aware topology without launching
sessions and refuses a legacy spec (`routes/rigspec.ts:189`);
`POST /api/discovery/:id/bind` (`routes/discovery.ts:77`) attaches a
discovered live session to an existing logical node (`logicalId`), or creates
a member in a pod (`podNamespace` + `memberName`) and binds it;
`POST /api/discovery/:id/adopt` (`routes/discovery.ts:139`) is the composite
route (bind to existing node, or create a new member in a target pod and bind
immediately). CLI mirrors via `rig bind` / `rig adopt`. Authored pod namespace
is preserved through adoption so logical ids stay
`${podNamespace}.${memberName}` (Architecture Rule 24: adopted-session parity
is tmux-metadata parity, not fake env-var parity).
immediately). On the CLI, `rig bind` calls the bind route
(`packages/cli/src/commands/bind.ts:56`), and `rig adopt` materializes the
topology and then calls the bind route for each session
(`packages/cli/src/commands/adopt.ts:163`, `:212`). Authored pod namespace is
preserved through adoption so logical ids stay `${podNamespace}.${memberName}`
(`claim-service.ts:663`). Adopted-session parity is tmux-metadata parity, not
fake env-var parity.
## OPEN / carried items
## 7. Specialist rosters
- **D-spec-version (resolved-as-correct):** RigSpec `version: "0.2"` is the
spec-schema axis, validated only as a non-empty string in source. Documented,
not "corrected".
- **D5 (careful, resolved-as-correct for this module):** tmux `@rigged_*`
metadata keys are literally still `@rigged_*` at HEAD — architecture.md §6 is
accurate. The MCP-tool-name `rigged_*` drift lands in
`transport-and-transcripts.md`.
A roster is an authored list of recommended specialist seats, kept outside the
specs. `rig roster list`, `show <id>` and `find <query>`
(`packages/cli/src/commands/roster.ts`) read version-1 roster JSON files from
`<workspace.root>/rosters/` (or `--folder`); they are read-only and need no
daemon route. Each roster names a purpose and a curator, and each member names
a seat, host, capabilities, engagement, `use_when` and `why`. `show` and
`find` add current observations of each member by matching host and seat
against `rig ps --nodes`, read from the configured daemon and again across
registered hosts, and report a gap rather than guessing when no node matches. A roster is a
recommendation, not an assignment or an authority. It is unrelated to the
topology roster a snapshot records (see `lifecycle-snapshot-restore.md`).
## See also
@@ -226,7 +336,8 @@ is tmux-metadata parity, not fake env-var parity).
- `adapters-and-runtimes.md` — the five-method RuntimeAdapter contract detail.
- `lifecycle-snapshot-restore.md` — snapshot/restore consumes persisted replay
context.
- `architecture-rules-and-event-system.md` — the full 25 architecture rules.
- `architecture-rules-and-event-system.md` — the cross-cutting architecture
rules.
- Source roots: `packages/daemon/src/domain/{agent-manifest,rigspec-schema,
profile-resolver,startup-orchestrator,whoami-service,claim-service}.ts`,
`packages/daemon/src/routes/{rigspec,whoami}.ts`.
@@ -11,8 +11,8 @@ applies-when: |
compatibility limits that still describe the shipped system.
siblings: [daemon-core.md, coordination-primitive.md]
prerequisite-reads: [../README.md, daemon-core.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Architecture Invariants, Event System, Compatibility Notes
@@ -21,20 +21,25 @@ This module collects the cross-cutting invariants that do not belong to any
single subsystem: the architecture rules the codebase holds itself to, the
event-system shape, and the intentional compatibility limits.
> Verified against source at HEAD `7eaf524c` (`git describe` →
> `v0.3.1-6-g7eaf524c`); package version **0.3.1** across all three packages
> (slice-00 §1.1). HEAD carries 6 commits of unreleased 0.3.2 work; no
> `v0.3.2` tag exists.
> Verified against source at main `e8f0ab340db773392ec8be75b072d1c0f3068a50`. Each count below sits beside the
> command that produces it; run the command from the repository root to refresh
> it.
## 1. Architecture rules
These are the invariants the codebase is built to preserve (`architecture.md`
§7). Rule 6 (startup layering) and rule 7 (restore-policy narrowing) are the
spec/startup contract — see `agent-spec-and-startup.md` for their flow detail;
they are restated here as system-level invariants.
These are the invariants the codebase is built to preserve. Rule 6 (startup
layering) and rule 7 (restore-policy narrowing) are the spec/startup contract —
see `agent-spec-and-startup.md` for their flow detail; they are restated here as
system-level invariants.
1. Zero Hono in `domain/` and `adapters/`.
2. Routes depend on the domain; the domain never depends on routes.
1. No runtime Hono in `domain/` and `adapters/`. `adapters/` has none; `domain/`
has type-only Hono imports (`import type`) in **4** files
(`git grep -l 'from "hono' -- packages/daemon/src/domain packages/daemon/src/adapters | wc -l`).
2. Routes depend on the domain; the domain does not depend on routes at
runtime. **1** type-only import crosses back:
`domain/project-classifier.ts:1` imports `IdentityProvenance` from
`routes/require-sender-identity.js`
(`git grep -lE 'from "(\.\./)+routes/' -- packages/daemon/src/domain packages/daemon/src/adapters | wc -l`).
3. Shared DB-handle invariants are enforced at construction time.
4. The reboot is engine-first: domain services land before public-surface
rewiring.
@@ -50,31 +55,52 @@ they are restated here as system-level invariants.
in the owning artifact.
10. Restore replay uses classification-free projection intent, not stale
startup-time `no_op` / conflict classifications.
11. Startup status is explicit session state: `pending`, `ready`, `failed`.
11. Startup status is explicit session state: `pending`, `ready`,
`attention_required`, `failed` (`types.ts:102`).
12. Session recency depends on monotonic ULIDs: `session-registry.ts` uses
`monotonicFactory()`; restore selects the newest session by max ULID.
`monotonicFactory()`. Restore does not pick the newest session by max
ULID; it resolves the active occupant recorded in the snapshot
(`resolveActiveSnapshotSession`, `active-occupant.ts:74`, called at
`restore-orchestrator.ts:774` and `:971`).
13. Readiness checking is a retry loop with exponential backoff and
configurable timeout, using adapter-specific probes (Claude TUI
indicator, Codex ready message, terminal immediate).
14. Resume states are locked: `resumed` / `rebuilt` / `fresh`. `rebuilt` =
14. Restore outcome states are a fixed set (`RestoreNodeResult.status`,
`types.ts:475`): `resumed`, `rebuilt`, `fresh-primed`,
`awaiting-decision`, `attention_required`, `failed`, plus
`operator_recovered` (set only by later reconciliation) and `fresh`
(retained only for the legacy continuity-restoring skip path). `rebuilt` =
new process assembled from artifacts.
15. Restore honesty: failed resume is FAILED loudly. No automatic fresh
fallback. Fresh launch is explicit follow-up only.
15. Restore honesty: a failed resume stops loudly as `awaiting-decision`, with
the blank session rolled back and no session running
(`restore-orchestrator.ts:1055`). No automatic fresh fallback. Fresh launch
is explicit follow-up only (`rig up --fresh <seats...>`,
`packages/cli/src/commands/up.ts:99`).
16. Post-command handoff required on `up`, `down`, `restore`,
`snapshot create`: what happened + current state + next action.
17. Session naming: `{pod}-{member}@{rig}` — human-authored,
system-validated. No generation, no slugification.
18. Communication: tmux is transport, not truth. `send/capture/broadcast`
wrap tmux reliably with honest errors.
19. Transcripts: raw capture via pipe-pane, ANSI strip on read. `rg`
19. Transcripts: bounded capture — a periodic `tmux capture-pane` snapshot of
the trailing lines (default 1000, every 2 s for an active seat) replaces
the transcript file, replacing pipe-pane (`transcript-rotation.ts:3`,
`:27`–`28`; started at `node-launcher.ts:181`). An idle seat is captured
less often, within the 10-second freshness window (`:29`–`33`,
`:162`–`163`), and the file is rewritten only when the captured bytes
change (`:270`). `readTail` and `grep` strip ANSI; `readFull` returns the
content unfiltered. `rig ask` transcript search: `rg`
preferred, `grep -E` fallback.
20. Config precedence: CLI flag > env var > config file
(`~/.openrig/config.json`, with legacy fallback from
`~/.rigged/config.json`) > default.
(`~/.openrig/config.json`, or `$OPENRIG_HOME/config.json` when
`OPENRIG_HOME` is set; `packages/cli/src/config-store.ts:939`) > default.
21. Semi-deterministic calibration: build what agents use constantly. Agent
handles edge cases from error messages.
22. `rig ask` is context engineering: gathers evidence, does NOT call an
external LLM. The agent IS the LLM.
external LLM. The agent IS the LLM. The exception is the explicit `--wake`
flag (`packages/cli/src/commands/ask.ts:88`), which runs one headless
question against an existing agent session (`codex exec resume` or
`claude -p --resume`, `packages/cli/src/ask-wake.ts:58`–`60`).
23. Spec library truth is YAML on disk; daemon owns the structured
review/index/cache layer.
24. Adopted-session parity is tmux-metadata parity, not fake env-var parity.
@@ -84,133 +110,201 @@ they are restated here as system-level invariants.
### Startup action constraints
- No shell startup actions.
- Action types are `slash_command` and `send_text` only.
- Action types are `slash_command`, `send_text` and `startup_proof` only
(`startup-validation.ts:7`).
- Non-idempotent actions must not apply on restore.
- Retrying failed startup is handled as restore.
### Remote import constraints
The reboot supports `local:...` and `path:/abs/...` agent refs. Remote
`agent_ref` sources remain unsupported and fail in preflight
(`architecture.md` §7 "Remote import constraints"; restated in compat note 1).
`agent_ref` sources remain unsupported and fail in preflight (schema
validation, `rigspec-schema.ts:563`; restated in compat note 1).
### Startup, delivery and launch invariants
These hold across the startup, transport and adapter code and are stated in its
comments:
- **`ready` is not "submitted" and not "oriented".** A seat can reach
`startupStatus: ready` while its startup text is unverified or still staged;
`node.startup_ready` carries a `submission` block saying which
(`types.ts:220`). Orientation is a separate, challenge-verified proof:
`ready` never means oriented (`types.ts:222`–`227`). See
`agent-spec-and-startup.md`.
- **Default sends never block on busy or unknown.** `--wait-for-idle` is the
caller's opt-in to wait, and a failed wait returns without sending. Otherwise
only positive evidence of an open
picker or approval prompt refuses a send; a busy or unknown seat gets the
message with an advisory warning (`session-transport.ts:1427`–`1433`). The
audited `--dangerously-interact` override is the only way past an open prompt.
- **Non-interruptive mode is per-launch flags only.** It never changes
permissions or native settings files, applies only to full-bypass Claude Code
and Codex seats, and is saved per rig, off by default
(`adapters/non-interruptive.ts:9`–`26`; `rigs.non_interruptive`, migration
`095`). A rig spec can author it as `non_interruptive` (`rigspec-schema.ts:179`).
- **Inside a notify envelope, events are delivered from the log.** Within
`withNotifyEnvelope` (`event-bus.ts:106`–`112`), every event persisted through
the event bus must be registered before the callback returns; after commit
the bus delivers the committed rows from the log, and an unreadable row
emits `event.delivery_poisoned`. Legacy callers outside an envelope persist
inside their own transaction and notify subscribers explicitly after commit
(`persistWithinTransaction`, `:70`; for example `node-launcher.ts:241`).
## 2. Event system
The daemon's event surface is the single `RigEvent` discriminated union.
> Drift-fix D8 / OPEN-4 (carried verbatim, slice-00): `architecture.md` §8
> says "PL-004 Phase A adds 9 coordination events" and (in §3) "Existing 32
> PL-004 events" / "Existing 20 PL-004 events" — internally inconsistent
> contested PL-004 sub-counts. **Do NOT carry the 9 / 32 / 20 figures.** The
> `architecture.md` §8 "Currently emitted in production code" / "Present in
> the union but not yet emitted" lists also predate 0.3.x and are stale. The
> union shape below is re-derived from source at HEAD, not migrated.
`RigEvent` is declared at `packages/daemon/src/domain/types.ts:108`
(`export type RigEvent =`) and runs through `types.ts:313`. It has **98 union
members** declaring **99** `type` literals: one member (`types.ts:109`) carries
both `proof.judged` and `proof.sources_changed`.
`RigEvent` is declared at `packages/daemon/src/domain/types.ts:94`
(`export type RigEvent =`) and runs through `types.ts:218`. It has **73
union members** (slice-00 §1.8, re-confirmed at HEAD:
`grep -cE '^\s*\| \{ type:'` over L94–218 = 73). Every one of the 73
declared `type:` literals is also constructed somewhere in
`packages/daemon/src/{domain,routes}` (re-verified at HEAD: the set of
`type: "<x>"` literals in domain+routes exactly equals the 73 union members
— zero union-only-but-never-referenced types).
- Members:
`sed -n '/^export type RigEvent =/,/^export type PersistedEvent/p' packages/daemon/src/domain/types.ts | grep -c 'type: "'`
- Type literals:
`sed -n '/^export type RigEvent =/,/^export type PersistedEvent/p' packages/daemon/src/domain/types.ts | grep -oE '"[a-z_]+(\.[a-z_]+)+"' | sort -u | wc -l`
### Per-prefix event families (grep-verified at HEAD)
**96** of the 99 literals appear as a `type: "<x>"` literal somewhere in
`packages/daemon/src` outside `types.ts` (mostly in `domain/` and `routes/`;
`seat.model_divergence` is built in `startup.ts`). **3** are declared but never
constructed: `session.status_changed`, `continuity.sync`, and `continuity.degraded`
(per #490, `qitem.closure_overdue` is produced by `QueueRepository.recordClosureOverdue`
when swept by `queue-stuck-sweep`, and `mission_control.view_refreshed` was retired).
List them with:
Each count below is a fresh, primary-source-grep-verified, explicitly-labeled
per-prefix family count over the union body
(`types.ts:94–218`) — NOT the contested PL-004 sub-count (OPEN-4 ruling:
labeled grep-verified family counts are ground truth; the `9`/`32`/`20`
figures are forbidden).
`for t in $(sed -n '/^export type RigEvent =/,/^export type PersistedEvent/p' packages/daemon/src/domain/types.ts | grep -oE '"[a-z_]+(\.[a-z_]+)+"' | tr -d '"'); do git grep -q -F "type: \"$t\"" -- packages/daemon/src ':!packages/daemon/src/domain/types.ts' || echo "$t"; done`
| Prefix | Members | Sample / role |
### Per-prefix event families
Each count below is the number of `type` literals per prefix in the union body
(`types.ts:108`–`313`):
`sed -n '/^export type RigEvent =/,/^export type PersistedEvent/p' packages/daemon/src/domain/types.ts | grep -oE '"[a-z_]+(\.[a-z_]+)+"' | tr -d '"' | cut -d. -f1 | sort | uniq -c | sort -rn`.
| Prefix | Types | Sample / role |
|---|---|---|
| `node.*` | 7 | `node.added` (`types.ts:97`) … `node.startup_failed` (`:139`) — lifecycle/startup |
| `workflow.*` | 6 | PL-004 Phase D workflow runtime (detail in `workflow-runtime.md`) |
| `watchdog.*` | 5 | `watchdog.evaluation_fired` (`:187`) … `watchdog.job_stopped` (`:191`) — PL-004 Phase C |
| `rig.*` | 5 | `rig.created` / `rig.deleted` / `rig.imported` / `rig.stopped` / `rig.expanded` (`:151`) |
| `queue.*` | 5 | PL-004 Phase A queue lifecycle (`:156`–`:159`, `:169`; detail in `coordination-primitive.md`) |
| `node.*` | 15 | `node.added` (`types.ts:126`) … `node.startup_proof_rejected` (`:229`) — lifecycle/startup |
| `workflow.*` | 8 | workflow runtime (detail in `workflow-runtime.md`) |
| `session.*` | 8 | session discovery / status / detach / vanish / stop / clean / resume-token audit |
| `rig.*` | 7 | `rig.created` / `rig.deleted` / `rig.imported` / `rig.stopped` / `rig.archived` / `rig.unarchived` / `rig.expanded` (`:241`) |
| `watchdog.*` | 5 | `watchdog.evaluation_fired` (`:280`) … `watchdog.job_stopped` (`:284`) |
| `seat.*` | 5 | `seat.model_divergence` (`:115`) … `seat.handover_completed` (`:200`) — model divergence, fresh launch, attention clear, handover |
| `queue.*` | 5 | queue lifecycle (`:249`–`:252`, `:262`; detail in `coordination-primitive.md`) |
| `package.*` | 5 | legacy package/install engine events |
| `mission_control.*` | 5 | PL-005 audit/notification (`:212`–`:218`; detail in `mission-control.md`) |
| `mission_control.*` | 4 | audit/notification (`:308`–`:313`; detail in `mission-control.md`) |
| `bootstrap.*` | 5 | legacy bootstrap-run events |
| `session.*` | 4 | session discovery / status / detach / vanish |
| `classifier.*` | 4 | PL-004 Phase B classifier-lease lifecycle |
| `restore.*` | 3 | restore start/complete/reconcile (detail in `lifecycle-snapshot-restore.md`) |
| `qitem.*` | 2 | `qitem.fallback_routed` (`:160`), `qitem.closure_overdue` (`:161`) |
| `pod.*` | 2 | `pod.created` (`:135`), `pod.deleted` (`:136`) |
| `inbox.*` | 2 | `inbox.absorbed` (`:162`), `inbox.denied` (`:163`) |
| `continuity.*` | 2 | `continuity.sync` (`:140`), `continuity.degraded` (`:141`) |
| singletons | 11 | one member each: `workflow_spec.*`, `view.*`, `stream.*` (`:155`), `snapshot.*`, `seat.*`, `project.*`, `kernel.*`, `chat.*` (`:149`), `bundle.*`, `binding.*`, `agent.*` |
| `restore.*` | 4 | restore start/complete/subset-complete/reconcile (detail in `lifecycle-snapshot-restore.md`) |
| `classifier.*` | 4 | classifier-lease lifecycle |
| `qitem.*` | 2 | `qitem.fallback_routed` (`:253`), `qitem.closure_overdue` (`:254`) |
| `proof.*` | 2 | `proof.judged`, `proof.sources_changed` — one union member (`:109`) |
| `pod.*` | 2 | `pod.created` (`:215`), `pod.deleted` (`:216`) |
| `inbox.*` | 2 | `inbox.absorbed` (`:255`), `inbox.denied` (`:256`) |
| `continuity.*` | 2 | `continuity.sync` (`:230`), `continuity.degraded` (`:231`) |
| `agent.*` | 2 | `agent.activity` (`:151`), `agent.session_identity` (`:158`) |
| singletons | 12 | one type each: `workflow_spec.*`, `view.*`, `transport.*` (`:155`), `topology.*` (`:138`), `stream.*` (`:245`), `snapshot.*`, `project.*`, `kernel.*`, `event.*` (`:110`), `chat.*` (`:239`), `bundle.*`, `binding.*` |
Family counts sum to 73 (15 multi-member families totalling 62 + 11
singletons), re-confirmed at HEAD.
Family counts sum to 99 type literals (18 multi-type families totalling 87 +
12 singletons).
### Emission and delivery
Events are constructed and emitted via `eventBus.emit({ type: ... })` across
domain services (`stream-store.ts`, `workflow-runtime.ts`,
`restore-orchestrator.ts`, `node-launcher.ts`, etc.) and route handlers. The
event log is append-only and SQLite-backed.
Events are emitted via `eventBus.emit({ type: ... })` (`event-bus.ts:57`) or,
inside a caller-managed transaction, `eventBus.persistWithinTransaction(...)`
(`event-bus.ts:70`) with subscribers notified after commit — across domain
services (`stream-store.ts`, `workflow-runtime.ts`, `restore-orchestrator.ts`,
`node-launcher.ts`, etc.) and route handlers. The event log is append-only and
SQLite-backed.
Three SSE delivery surfaces (re-confirmed at HEAD):
SSE delivery surfaces include the following. The daemon has **11**
`streamSSE(` call sites across **10** files in `packages/daemon/src/routes/`
(`git grep -o 'streamSSE(' -- packages/daemon/src/routes | wc -l`;
`git grep -l 'streamSSE(' -- packages/daemon/src/routes | wc -l`).
- `GET /api/events` — global stream of all events (`server.ts:457`
`app.route("/api/events", eventsRoute)`).
- `GET /api/stream/watch` — new stream items (`routes/stream.ts:117`).
- `GET /api/events` — global stream of all events (`server.ts:730`
`app.route("/api/events", eventsRoute)`); `?rigId=` keeps one rig's. Each
event's SSE `id` is its `seq`. Before going live, a connection replays
stored events, read and written 500 at a time (`routes/events.ts`):
- with a `Last-Event-ID` header (an `EventSource` sends it when it
reconnects), every event after that `seq`, whatever `replay` says;
- otherwise `?replay=<n>`: the newest `n` events (of the rig, with
`rigId`); `replay=0` starts from now; `replay=all`, no `replay`, a
count past the log's size, or any other value, replays the whole log.
Either way the replay ends at the newest event stored as the connection
subscribes; the events stored meanwhile were buffered and follow it, each
once and in order, before the stream goes live.
- `GET /api/stream/watch` — new stream items (`routes/stream.ts:194`).
- `GET /api/queue/watch` — queue/inbox coordination events
(`routes/queue.ts:357`).
(`routes/queue.ts:1054`, with a `/sse` alias at `:1055`).
- The chat SSE stream `GET /api/rigs/:rigId/chat/watch` delivers
`chat.message` for one rig (rig-scoped; see compat note 6).
`chat.message` for one rig (`routes/chat.ts:82`, mounted at `server.ts:782`;
rig-scoped; see compat note 6).
- The other SSE routes are activity events and the watch or `sse` routes for
mission control, projects, views, watchdog and workflow; list them with
`git grep -n 'streamSSE(' -- packages/daemon/src/routes`.
> OPEN-4 (carried verbatim, slice-00): the precise PL-004-only vs PL-005-only
> sub-partition is NOT asserted here. `architecture.md`'s `32`/`20`/`9`
> figures are internally inconsistent and not reconcilable without
> classifying all 73 members by introducing slice — flagged, not smoothed.
> The grep-verified per-prefix family counts above are the substituted ground
> truth.
### Telemetry read surface
`/api/telemetry` (`server.ts:822`; `routes/telemetry.ts`) is a read-only,
paged view over the event log and queue history, built by
`readTelemetryPage()` in `packages/daemon/src/domain/finite-telemetry.ts`. It
serves three streams: `GET /api/telemetry/v1/events`, `/v1/queue-transitions`
(active and archived transitions) and `/v1/nodes/:nodeId/tenures` (a node's
occupant tenures). Each page is one read with no writes or subscription,
bounded at 128 rows and 128 KiB (`TELEMETRY_LIMITS`), and resumed with a
cursor. Rows carry metadata only, never event payloads, notes or bodies, and
the response names gaps in the history it could not vouch for (for example a
daemon restart boundary or rows before the retained floor) instead of
presenting a partial history as complete. The page records the source host and
the daemon's boot epoch. Bad input returns `400 telemetry_invalid_request`; a
failed read returns `503 telemetry_read_unavailable`. The same route also
serves the usage series behind `rig usage` (`/usage/series`, `/usage/top`).
`rig telemetry events|transitions|tenures`
(`packages/cli/src/commands/telemetry.ts`) prints one bounded page.
## 3. Remaining compatibility notes
Intentional limits that still describe the shipped system (`architecture.md`
§11), verified as still-current at HEAD:
Intentional limits that still describe the shipped system:
1. Remote `agent_ref` imports remain unsupported (see §1 remote import
constraints).
2. Startup actions remain intentionally constrained (`slash_command`,
`send_text`).
`send_text`, `startup_proof`).
3. Legacy compatibility seams still ship for pre-reboot data and v1
artifacts.
4. `rig ask` gathers context only — does not call an external LLM (rule 22).
5. Transcript search prefers `rg`, falls back to `grep -E`; quality/perf
varies by backend.
4. `rig ask` gathers context only — does not call an external LLM — unless
`--wake` is passed (rule 22).
5. `rig ask` transcript search prefers `rg`, falls back to `grep -E`
(`history-query.ts:252`, `:267`); quality/perf varies by backend.
6. Chat is rig-scoped only — no cross-rig channels or DMs.
7. `--verify` on `rig send` checks pane content for message visibility but
can produce false positives from pre-existing matching content. Known
limitation.
7. `--verify` on `rig send` reports what the pane shows, not agent
acknowledgement. By default it compares the message (whole for a
header-carrying send, the first 40 characters for a raw one) in captures
before and after the send, leaving out the current input box; with
`transport.verify_input_box` on, Claude Code and Codex sends are verified
only for a seat proven idle before the paste and on input-box evidence; a
busy or unknown seat reads unconfirmed (`transport-and-transcripts.md` §3
step 5).
When it cannot confirm, it reports `rendered-unconfirmed`, not a failure.
8. Terminal node readiness is shell-ready only — no service health probes.
9. `rig env down --volumes` exists in the CLI surface, but the explicit
daemon-side override is not fully plumbed through yet.
10. Managed-app service surfaces are descriptive only — OpenRig does not
auto-inject service URLs/tokens into agent prompts beyond authored
startup/context files.
11. Specialist delegation is conventional, not automatic — addressed by
9. Managed-app service surfaces are descriptive only — OpenRig does not
auto-inject service URLs/tokens into agent prompts beyond authored
startup/context files.
10. Specialist delegation is conventional, not automatic — addressed by
session name or normal communication surfaces.
## 4. Cross-references
`architecture.md` §12 names itself the architecture-level source of truth and
points at `codemap.md` for file-by-file structure. Under the modular
as-built, that role is distributed: this module owns the invariants + event
shape; the source-of-truth pointer is the rewritten `../codemap.md`
navigation index.
Under the modular as-built, this module owns the invariants and event shape;
`../codemap.md` is the navigation index for file-by-file structure.
## See also
- `daemon-core.md` — wiring, DB, migrations, startup; footprint drift-fixes.
- `coordination-primitive.md` — PL-004 Phase A queue/stream/inbox/outbox
events.
- `workflow-runtime.md` — PL-004 Phase D `workflow.*` events.
- `mission-control.md` — PL-005 `mission_control.*` events.
- `daemon-core.md` — wiring, DB, migrations, startup.
- `coordination-primitive.md` — queue/stream/inbox/outbox events.
- `workflow-runtime.md` — `workflow.*` events.
- `mission-control.md` — `mission_control.*` events.
- Source roots: `packages/daemon/src/domain/types.ts` (RigEvent union),
`packages/daemon/src/domain/event-bus.ts` (emit/persist),
`packages/daemon/src/routes/{stream,queue}.ts` (SSE watch),
`packages/daemon/src/server.ts` (`/api/events`).
+151 -280
View File
@@ -1,320 +1,191 @@
---
kind: as-built
title: Content Surfaces — Files Browser, Atomic Write, Progress Tree, Steering Composer
title: Content Surfaces — Files, Progress, Steering, and Health
status: active
topics: [observability, specification-and-bundles]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Need to know how the operator-allowlisted file browser enforces path
safety, how atomic conflict-checked writes + the JSONL edit audit work,
how the workspace PROGRESS.md tree is indexed, or how the one-screen
Steering surface (priority stack + roadmap rail + lane rails + health
gates) is composed. Author-mode module — no prior architecture.md prose;
every load-bearing claim is sourced to file:line at HEAD.
siblings: [workspace-primitive.md, daemon-core.md, ../ui/project-and-for-you.md]
prerequisite-reads: [../README.md, workspace-primitive.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
Tracing allowlisted file access, conflict-checked writes, progress indexing,
steering composition, or the daemon health-summary endpoints.
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Content Surfaces — Files Browser, Atomic Write, Progress Tree, Steering Composer
# Content Surfaces — Files, Progress, Steering, and Health
> **See also (v0.4.4):** the Living Notes review surface — the composed
> intent→plan→delivered projection over this same allowlisted content layer —
> is documented in [`living-notes-review.md`](living-notes-review.md).
Source snapshot: `e8f0ab340db773392ec8be75b072d1c0f3068a50`. This describes the source at that commit;
it does not establish the version or behavior of a running daemon.
The daemon exposes filesystem content through the files, progress, and
steering route families. Health summaries read existing daemon state. These
are separate projections with separate configuration; configuring one root
is not a universal filesystem-access policy.
The **content surfaces** are the operator-allowlisted, filesystem-canonical
read/write layer that the Project / Steering UI sits on: a fail-closed file
browser, an atomic conflict-checked write service with a JSONL edit audit,
the recursive PROGRESS.md tree indexer, and the one-screen Steering composer
(+ its compact health-summary gates). None adds SQLite state.
## Configuration and wiring
> **AUTHOR-FROM-SOURCE module.** No prior `architecture.md` prose exists for
> this. Every load-bearing claim carries `> Source: <file:line> @HEAD`;
> ambiguity is declared as an OPEN item, never smoothed. Paths are relative
> to `packages/daemon/src/` unless prefixed `packages/` or `docs/`.
>
> Verified at HEAD `7eaf524c` (`git describe` → `v0.3.1-6-g7eaf524c`).
> Package version **0.3.1**; HEAD carries 6 unreleased release-0.3.2
> commits; no `v0.3.2` tag (daemon-core.md; slice-00 §1.1).
>
> **SPLIT NOTE (§10.6).** This is the content-surfaces half of the
> `workspace-and-content-primitives` SPLIT (sibling `workspace-primitive.md`
> carries the workspace primitive + migrations 038/039 +
> missions/projects/slices). See `workspace-primitive.md` § header SPLIT
> NOTE for the §10.6 rationale and the transparent-noted-deviation
> disclosure.
[`startup.ts`](../../../packages/daemon/src/startup.ts) constructs
`SettingsStore`, decodes `cfg.filesAllowlistRaw` and `cfg.progressScanRootsRaw`,
and injects `FileWriteService`, `ProgressIndexer`, and `SteeringComposer`.
The write service exists only when the decoded file allowlist is nonempty.
Its audit path is explicitly `${OPENRIG_HOME}/file-edit-audit.jsonl`.
## 0. Release attribution (forensic proof — read first)
[`SettingsStore`](../../../packages/daemon/src/domain/user-settings/settings-store.ts)
resolves environment overrides, then settings-file values, then defaults.
`files.allowlist` and `progress.scan_roots` both default to
`workspace:<resolved-workspace-root>`. Their environment overrides are
`OPENRIG_FILES_ALLOWLIST` and `OPENRIG_PROGRESS_SCAN_ROOTS`. Thus, an unset
or empty environment variable, or an empty settings-file value, does **not**
imply an empty allowlist in normal daemon startup. A non-empty value is not
validated: the decoders silently skip malformed entries (no `name:` prefix, or
a relative path), so a malformed value can leave no configured roots. Some source comments and route hints still say
otherwise or point only at the environment variable. The standalone `readAllowlistFromEnv` helper has different inputs
and retains its legacy environment fallback.
Per §10.8, re-verified at HEAD via `git cat-file -e <tag>:<path>`:
Roots use comma-separated `name:/absolute/path` pairs. The decoders skip
invalid pairs, canonicalize existing paths, and let the last duplicate name
win. See [`decodeAllowlist`](../../../packages/daemon/src/domain/files/path-safety.ts)
and [`decodeProgressScanRoots`](../../../packages/daemon/src/domain/progress/progress-indexer.ts).
| Subsystem | Release | Forensic proof @HEAD |
|---|---|---|
| `domain/files/{path-safety,file-write-service}.ts` | **≤0.3.0** | `v0.3.0:<path>` → present |
| `domain/progress/progress-indexer.ts` | **≤0.3.0** | `v0.3.0:<path>` → present |
| `domain/steering/{steering-composer,health-summary}.ts` | **≤0.3.0** | `v0.3.0:<path>` → present |
| `routes/{files,progress,steering,health-summary}.ts` | **≤0.3.0** | `v0.3.0:<path>` → present |
## Path resolution and reads
> Source: §10.8 proof re-run at HEAD `7eaf524c` — every listed path
> resolves at `v0.3.0` (no failures). All content surfaces are
> **≤0.3.0** features (UI Enhancement Pack v0 + Operator Surface
> Reconciliation v0; slice-00 0.3.0-GT §1.7 "Files / Markdown /
> Progress / Proofs" confirms the cluster shipped 0.3.0). Do **not**
> back-attribute any of these to 0.3.1 — the gap is missing
> architecture.md prose, not a new feature.
[`resolveAllowedPath`](../../../packages/daemon/src/domain/files/path-safety.ts)
requires a configured root, rejects `..` path segments and absolute relative
paths, resolves existing symlinks, and checks containment with a path-separator
boundary. An empty relative path denotes the root. If realpath fails, the
helper falls back to the resolved candidate; file/directory helpers then
perform a stat check. These are the implemented checks, not a claim of
race-free isolation against concurrent filesystem changes.
## 1. Path safety — the fail-closed allowlist (UI Enhancement Pack v0)
[`readAllowedFile`](../../../packages/daemon/src/domain/files/file-read.ts)
is shared by the HTTP reader and the local TUI reader. It returns content,
absolute and root-relative resolved paths, mtime, full-file SHA-256, size,
binary classification, and truncation metadata. The returned text is capped
at **1,048,576 bytes**, but the full file is read and hashed. The cap limits
the response, not the memory required to read the file. The TUI's local
reader runs as a CLI subprocess without the daemon: it resolves
`files.allowlist` from the CLI configuration, offers four fixed workspace
targets as roots, and hides dot-prefixed entries in listings
(`packages/cli/src/local-reading.ts`).
The file browser is gated by a daemon-enforced, **fail-closed** allowlist.
Roots are decoded from `OPENRIG_FILES_ALLOWLIST` (env), comma-separated
`<name>:<absolute-path>` pairs (legacy fallback `RIGGED_FILES_ALLOWLIST`
via `||` so an empty string falls through). Invalid pairs (no colon, empty
name, non-absolute path) are **silently skipped**; duplicate names →
last-wins. Empty/unset → no roots → routes return an empty list with a
structured "configure OPENRIG_FILES_ALLOWLIST" hint. The safe default after
a fresh install is **nothing allowlisted**.
## Writes and audit
> Source: `domain/files/path-safety.ts:50-51` (env vars),
> `:60-93` (`decodeAllowlist` / `readAllowlistFromEnv`; silent-skip
> L67-71, last-wins L78, `||` fallback comment L89-91) @HEAD.
[`FileWriteService.writeAtomic`](../../../packages/daemon/src/domain/files/file-write-service.ts)
reads the existing target and compares **both** the expected mtime and content
hash. A mismatch raises `WriteConflictError` with the current values. It then
writes a temporary file in the same directory, preserves the target's
ordinary permission bits, fsyncs the temporary file, and renames it over the
target. This is optimistic conflict detection; it does not hold a lock over
the read/compare/replace sequence.
`resolveAllowedPath(allowlist, rootName, relativePath)` is the load-bearing
guard. Algorithm: (1) reject unknown root (`root_unknown`); (2) reject
expressed-intent `..` segments **before** filesystem resolution
(`path_escape`) — segment-split so `foo..bar` is not a false positive;
(3) reject an absolute `relativePath` (`path_invalid`); (4) resolve
symlinks via `fs.realpathSync` and reject when the realpath does not start
with `<canonicalRoot><sep>` (`path_escape`) — a `path.sep` boundary so
`/foo/bar` does not match `/foo/bar-other`; (5) `path === ""` resolves to
the root itself (so callers can list the root). Symlinks **inside** the
tree resolve normally; symlinks pointing **outside** are escape attempts.
A non-existent candidate falls back to the unresolved path so the
subsequent stat surfaces the absence with a specific code.
`resolveAllowedFile` / `resolveAllowedDirectory` add a stat assertion
(`not_a_file` / `not_a_directory`).
`createAtomic` handles new files. It creates and fsyncs a temporary file, then
uses an exclusive hard link to establish the target. If the target already
exists, it returns the `target_exists` error instead of overwriting it.
`createAtomic` is used by the Living Notes freeze export, and `writeAtomic`
also backs the freeze-time `MISSION_BRIEF.md` spine update; both append to the
same audit file.
> Source: `domain/files/path-safety.ts:95-171` (`resolveAllowedPath`;
> `..`-before-fs L124-140, absolute-reject L141-147, sep-boundary
> L158-169, empty-path base case in the doc-comment L108-110),
> `:173-225` (file/dir convenience asserts) @HEAD.
Both operations append a JSONL audit record containing actor/provenance,
paths, timestamps, hashes, and byte-count delta. An audit append failure
raises `audit_write_failed` **after the content has landed**; the write is not
rolled back. The service appends records without implementing rotation.
The service's standalone default is under the user's `.openrig` directory;
daemon startup overrides it with the active OpenRig home as described above.
## 2. Atomic write + JSONL audit (UI Enhancement Pack v0 item 4)
## HTTP surface
`FileWriteService.writeAtomic(req)` is the operator-actionable write surface
for `STEERING.md` / `PROGRESS.md` / spec YAML / any allowlisted file.
Sequence: (1) resolve target under allowlist (reuses §1 path-safety);
(2) re-stat + re-hash the target — if `mtime !== expectedMtime` OR
`contentHash !== expectedContentHash`, throw `WriteConflictError` carrying
the **current** mtime + hash for the UI to surface (optimistic-concurrency,
not a lock); (3) write to a temp file in the **same directory** (PID +
random suffix so concurrent writes don't collide); (4) `fsync` the temp fd
for durability before the rename; (5) atomic `renameSync` over the target
(single inode swap on POSIX — readers see old or new, never partial);
(6) recompute mtime + hash + byte delta; (7) append one JSONL audit row.
[`server.ts`](../../../packages/daemon/src/server.ts) mounts these families.
All of them sit behind the daemon's `/api/*` browser boundary
(`middleware/browser-boundary.ts`), which accepts only known host names, and
browser `Origin`s only from the daemon's own UI or `OPENRIG_ALLOWED_ORIGINS`;
the file allowlist is a separate check.
[`filesRoutes`](../../../packages/daemon/src/routes/files.ts) implements:
> Source: `domain/files/file-write-service.ts:9-25` (documented
> atomic-write semantics), `:111-212` (`writeAtomic`; conflict-detect
> L129-135, same-dir temp L137-141, fsync L146, atomic rename L161)
> @HEAD.
| Method and path | Result / important behavior |
|---|---|
| `GET /api/files/roots` | Configured roots; an empty list carries a setup hint. |
| `GET /api/files/list?root=…&path=…` | Directory entries with metadata, including dotfiles. |
| `GET /api/files/read?root=…&path=…` | `readAllowedFile` result. |
| `GET /api/files/asset?root=…&path=…` | Raw asset; single byte-range support (`206`, invalid range `416`), five-minute cache. HTML and source files default to plain text and unknown types to `application/octet-stream`; `render=1` opts into HTML rendering. SVG is served as `image/svg+xml`. A `render=1` HTML preview or an SVG is served with no content-security or frame headers, so it can run script in the daemon's origin (`routes/files.ts:153–157`). |
| `POST /api/files/write` | Requires root, path, string content, expected mtime and hash. Stale reads return `409 write_conflict`; an absent write service returns `503`. |
The audit file is `~/.openrig/file-edit-audit.jsonl` by default
(`HOME`/`USERPROFILE` → `/tmp` fallback). **Append-only; never rotates at
v0.** A failed audit append throws `FileWriteError("audit_write_failed")`
but does **NOT** undo the landed write — the user's edit succeeded; an
audit-system flake must not silently revert canon. (The route still
surfaces it as a 500 so the failure is honest, not swallowed.)
Writes resolve actor/provenance through `resolveActorWithDeferral`. Missing
route dependencies return `503`; unknown roots and invalid paths return
`400`. A failed stat returns `404` on reads, lists and assets; on a write, a
missing or unreadable target returns `500 stat_failed`, because
`POST /api/files/write` only replaces existing files
(`domain/files/file-write-service.ts:120–128`; `routes/files.ts:264–265`). An
audit failure can return `500` even though the file write succeeded, so an
error is not proof of no effect.
> Source: `domain/files/file-write-service.ts:87-91` (default path +
> fallback), `:24-25` (never-rotates-at-v0), `:182-204` (audit append;
> "does NOT undo the write" comment L183-184) @HEAD.
## Progress indexing
## 3. Files routes — browse + read + asset + write
[`ProgressIndexer.scan`](../../../packages/daemon/src/domain/progress/progress-indexer.ts)
walks configured roots on each request, to a default maximum depth of **6**.
It skips dot-prefixed entries and named build/dependency directories, and
collects regular `PROGRESS.md` and `STEERING.md` files. Unreadable directories
and files are skipped. Consequently, an empty scan does not prove all files
were readable.
`filesRoutes()` (mounted `server.ts:507` as `/api/files`). All routes are
**literal** (no `/:param` catchall) so order doesn't matter for shadowing
(Phase A R1 SSE lesson):
The parser skips frontmatter, takes the first H1 as the title, turns
H2–H4 headings into hierarchy rows, and reads checkbox rows as `[x]`/`[X]`
= done, `[~]` = blocked, and `[ ]` = active. Checkbox depth uses two-space
indentation; headings use heading depth. Per-file and aggregate counts cover
checkbox rows. This is a progress-text projection, not proof readiness.
- `GET /roots` — allowlist root list (or `{roots:[], hint}` when none).
- `GET /list?root&path` — directory entries (dirs first, then files,
name-sorted; dotfiles always included — allowlisting a root expresses
inspection intent).
- `GET /read?root&path` — file content + `mtime` + `contentHash` (SHA-256)
+ `size`. **Content is capped at `FILE_READ_TRUNCATION_BYTES` (1 MB)** but
the hash is computed over the **FULL** file so atomic-write conflict
detection stays honest even on a truncated read; response carries
`truncated` / `truncatedAtBytes` / `totalBytes`.
- `GET /asset?root&path` — raw bytes for embedded images/video/pdf (inferred
`Content-Type`, 5-min cache). **v0.4.4 (OPR.0.4.4.20 FR-5):** serves HTTP
**byte ranges** — single-range form, `206` + `Content-Range` +
`Accept-Ranges: bytes` (malformed/unsatisfiable → `416`) — the
iOS-Safari-class media-playback requirement; and `.html` renders as
`text/html` ONLY under the explicit `?render=1` opt-in (text/plain stays
the default). The slice proof-asset route (`/api/slices/:name/proof-asset/*`)
carries the same range semantics (living-notes corrective). See
[`living-notes-review.md`](living-notes-review.md) §5.
- `POST /write` — atomic write (§2); 503 when no write service
(`OPENRIG_FILES_ALLOWLIST` empty); 409 `write_conflict` on stale
mtime/hash with the current values for the UI's refresh prompt.
[`GET /api/progress/tree`](../../../packages/daemon/src/routes/progress.ts)
returns the scan. Missing indexer or empty configured roots returns `503`.
503 `files_routes_unavailable` when the allowlist dep is unwired.
Path-safety errors map to HTTP per code (`root_unknown`/`path_*` → 400,
`stat_failed` → 404).
## Steering composition
> Source: `routes/files.ts:51-242` (handlers; route-order comment
> L17-19, truncation L139-154, write 503/409 L187-191/L225-231,
> path-safety→HTTP `:61-69`); `FILE_READ_TRUNCATION_BYTES = 1_048_576`
> `:49`; mounted `server.ts:507`; CLI: no `rig files` verb — files are
> a UI-only surface @HEAD.
[`steeringOptsFromSettings`](../../../packages/daemon/src/domain/steering/steering-composer.ts)
combines resolved workspace settings with `OPENRIG_STEERING_WORKSPACE`,
`OPENRIG_STEERING_PATH`, `OPENRIG_ROADMAP_PATH`, and
`OPENRIG_DELIVERY_READY_DIR` overrides. `SteeringComposer.compose` reads:
> **§10.7 route-reality (source-verified at `packages/ui/src/routes.tsx`):**
> `/files` is a **REAL route** (`FilesWorkspace`) the Phase-8.1 survey
> MISSED. There is **NO `/markdown` route** — markdown rendering is a
> *component* inside file / drawer surfaces, not a navigable destination.
>
> Source: `packages/ui/src/routes.tsx:192-195` (`path: "/files"` +
> `FilesWorkspace`); grep-confirmed no `path: "/markdown"` declaration
> anywhere in routes.tsx @HEAD.
| Field | Source and selection |
|---|---|
| `priorityStack` | Verbatim `STEERING.md`, mtime, and byte count. |
| `roadmapRail` | `roadmap/PROGRESS.md` `[ ]`/`[x]` rows (`[~]` rows are not read); the first unchecked row is marked next. |
| `laneRails` | Every `PROGRESS.md` and `STEERING.md` under `delivery-ready`, using a depth-3 `ProgressIndexer` (lane ID `mode-N` for `mode-N/PROGRESS.md`, else the relative path); first non-done/non-blocked checkbox is next pull. Default top 3 prefers non-done rows, then fills with done rows. |
## 4. Progress tree indexer (UI Enhancement Pack v0 item 1B)
Missing/unreadable sections become `unavailableSources`. `isReady` means at
least one path resolves; it does not guarantee that every read succeeds.
[`GET /api/steering`](../../../packages/daemon/src/routes/steering.ts)
returns `503` when the composer is absent or no source path resolves. Because
`workspace.steering_path` always has a value (default
`<workspace.root>/STEERING.md`), the daemon's composer is normally ready, and
a missing `STEERING.md` appears as a `priorityStack` read failure in
`unavailableSources` with a `200`, not a `503`.
Queue and health state are fetched through their own endpoints.
`ProgressIndexer` walks operator-allowlisted scan roots
(`OPENRIG_PROGRESS_SCAN_ROOTS`, same `<name>:<abs-path>` shape as the file
allowlist; legacy `RIGGED_PROGRESS_SCAN_ROOTS`), finds **`PROGRESS.md` AND
`STEERING.md`** files (STEERING.md is anchored as the constraint-frame node
per OSR v0 Item 2; the row-machinery is filename-agnostic), and parses each
into a checkbox-hierarchy tree. Recursion is depth-bounded (default 6 —
enough for mission/lane/slice nesting without descending into
`node_modules`/`.git`/`.worktrees`/`dist`/`build`/`.turbo`/`.next` or
dotfiles). Checkbox status: `[x]` → `done`, `[~]` → `blocked`, `[ ]` →
`active`; headings (`##`–`####`) become hierarchy rows; depth from
2-space indent or heading level. Per-file `counts` + a scan-wide
`aggregate`. **In-memory walk per request; no caching at v0** (bounded by
the operator's allowlist scope).
## Health summaries
> Source: `domain/progress/progress-indexer.ts:79-84` (STEERING anchor +
> env vars), `:81` (SKIP_DIRS), `:71` (`DEFAULT_MAX_DEPTH = 6`),
> `:218-235` (checkbox status mapping), `:204-215` (heading rows),
> `:21-23` (no-caching-at-v0) @HEAD.
[`healthSummaryRoutes`](../../../packages/daemon/src/routes/health-summary.ts)
exposes four reads under `/api/health-summary`:
`progressRoutes()` (mounted `server.ts:508` as `/api/progress`):
`GET /tree` — the indexed hierarchy; 503 `progress_indexer_unavailable`
when unwired; 503 `progress_scan_roots_not_configured` + setup hint when
no roots.
| Suffix | Source |
|---|---|
| `/nodes` | `computeNodeHealthSummary`: node inventory aggregated across rigs, grouped by session/lifecycle status, with an attention-required count. |
| `/context` | `computeContextHealthSummary`: `context_usage` rows grouped by urgency and sample freshness. |
| `/version` | `getDaemonVersion`: the build-stamped version, else the daemon package version, else `unknown`; always `200`. |
| `/gateway` | The injected gateway subsystem's `status()`; `503` if unavailable. |
> Source: `routes/progress.ts:18-40` (handler; 503s L29-35); mounted
> `server.ts:508` @HEAD.
`/nodes` and `/context` return `503 health_summary_unavailable` when the rig
repository is not wired.
> **§10.7 route-reality:** `/progress` is a **`<Navigate to="/project" />`
> redirect-stub** — the progress system lives at the daemon
> `/api/progress` route, but the UI URL folds into Project tabs (Phase 3).
>
> Source: `packages/ui/src/routes.tsx:464-468` ("folds into Project tabs
> (Phase 3) — redirect to /project") @HEAD.
The [context aggregation](../../../packages/daemon/src/domain/steering/health-summary.ts)
uses **80%** for critical, **60%** for warning, and **300 seconds** for
freshness. These are constants in this module: they do not follow the
`health.context_pressure.*` settings (defaults 95% and 99%) that the health
detectors use, so the two surfaces can disagree about the same session. A missing usage value is unknown; a missing timestamp has no
freshness sample. The SQL read catches errors and falls back to an empty
sample set, so zero counts alone are not a database-health guarantee.
## 5. Steering composer (Operator Surface Reconciliation v0 item 1)
## Related source
`SteeringComposer.compose()` is the **one-screen composed steering surface**.
It is deliberately narrow: it composes only the **filesystem-derived**
pieces; the UI fetches PL-005 queue views (in-motion / loop-state) and
health gates via their own existing endpoints so the composer stays
testable. Three sources, all resolved from a single workspace root
(`OPENRIG_STEERING_WORKSPACE`; per-piece overrides
`OPENRIG_STEERING_PATH` / `OPENRIG_ROADMAP_PATH` /
`OPENRIG_DELIVERY_READY_DIR` trump the root-derived defaults; legacy
`RIGGED_STEERING_WORKSPACE`):
- **priorityStack** — verbatim `STEERING.md` content + mtime + byteCount.
- **roadmapRail** — `roadmap/PROGRESS.md` checkbox rows; detects `PL-XXX`
rail-item codes; marks the **first unchecked** item as `isNextUnchecked`.
- **laneRails** — `delivery-ready/mode-{N}/PROGRESS.md` per-lane: reuses
`ProgressIndexer` (maxDepth 3) for identical checkbox semantics to the
Progress view; "next pull" = first non-done, non-blocked row (Priority
Rail Rule — shelf/queue recency does NOT override); top-N (default 3)
prefers active+blocked, falls back to done only to fill N.
Missing sources are reported in `unavailableSources` (each names the env
var that would resolve it) rather than failing the whole payload.
`isReady()` is true when **at least one** source resolves.
> Source: `domain/steering/steering-composer.ts:1-25` (narrow-by-design
> rationale + 3-source list), `:103-119` (env vars +
> `steeringOptsFromEnv`), `:155-169` (`isReady` / `compose`), `:198-250`
> (roadmap rail; next-unchecked L231-235), `:282-316` (lane next-pull
> L288-289, top-N L293-296), `RAIL_CODE_REGEX` `:346` @HEAD.
`steeringRoutes()` (mounted `server.ts:510` as `/api/steering`):
`GET /` — the composed payload; 503 `steering_composer_unavailable` when
unwired; 503 `steering_workspace_not_configured` + a hint pointing at
`rig config init-workspace` / `workspace.steering_path` /
`OPENRIG_STEERING_PATH` when no source resolves.
> Source: `routes/steering.ts:18-34` (handler; 503s L23-29); mounted
> `server.ts:510` @HEAD.
> **§10.7 route-reality:** `/steering` is a **`<Navigate to="/project" />`
> redirect-stub** — the composer lives at daemon `/api/steering`; the UI
> URL folds into the Project workspace overview tab (Phase 3).
>
> Source: `packages/ui/src/routes.tsx:470-474` ("folds into Project
> workspace overview tab (Phase 3) — redirect to /project") @HEAD.
## 6. Health-summary aggregator (OSR v0 item 1F)
`computeNodeHealthSummary` / `computeContextHealthSummary` are the compact
health gates on the steering surface — **daemon-side aggregation, not a CLI
shell-out** (no per-request subprocess). Node summary: cross-rig roll-up of
`sessionStatus` + `lifecycleState` via `getNodeInventory` per rig, with an
`attentionRequired` tally. Context summary: reads `context_usage` directly
(ContextUsageStore exposes per-node accessors only; listing all rows is a
steering-surface concern) and buckets by urgency
(`usedPercentage` ≥80 critical / ≥60 warning / else low / null unknown) +
freshness (`sampledAt` age vs 300 s → fresh/stale/none). A missing
`context_usage` table (test harness without the migration) yields an empty
summary, not an error.
> Source: `domain/steering/health-summary.ts:44-46` (thresholds:
> `FRESHNESS_THRESHOLD_S=300`, `URGENCY_CRITICAL_PCT=80`,
> `URGENCY_WARNING_PCT=60`), `:48-66` (node roll-up), `:75-117`
> (context roll-up; table-absent → empty L81-84) @HEAD.
`healthSummaryRoutes()` (mounted `server.ts:511` as `/api/health-summary`):
`GET /nodes`, `GET /context`; 503 `health_summary_unavailable` when the
rigRepo dep is unwired.
> Source: `routes/health-summary.ts:23-44` (handlers; 503 L33,L40);
> mounted `server.ts:511` @HEAD.
## 7. Cross-cutting properties
- **Filesystem-canonical, no new SQLite:** all four surfaces read/write the
filesystem + the JSONL audit; health-summary reads existing
`context_usage` only. No content-surface migration
(`progress-indexer.ts:21-23`; `health-summary.ts:81-84`) @HEAD.
- **Fail-closed, honest errors:** path-safety rejects every escape attempt
before fs resolution; write conflicts surface the current mtime/hash for
an explicit refresh; missing config returns 503 + a setup hint naming the
exact env var — never a silent empty success
(`path-safety.ts:124-169`; `file-write-service.ts:129-135`;
`routes/steering.ts:25-29`) @HEAD.
- **Atomic-or-nothing writes:** same-directory temp + fsync + atomic rename;
a rename failure leaves the target untouched (never a partial write)
(`file-write-service.ts:160-172`) @HEAD.
- **Composer narrowness is deliberate:** the steering composer owns only
filesystem-derived pieces; queue/health come from their own endpoints —
keeps it testable (`steering-composer.ts:6-16`) @HEAD.
## OPEN items (carried, not smoothed)
- **OPEN-A** — the JSONL edit audit at `~/.openrig/file-edit-audit.jsonl`
**never rotates at v0** by explicit design
(`file-write-service.ts:24-25`); unbounded growth is a known accepted v0
state (PRD § Item 4 defers rotation), stated here rather than smoothed.
- **OPEN-B** — `OPENRIG_FILES_ALLOWLIST` vs `OPENRIG_PROGRESS_SCAN_ROOTS`
vs `OPENRIG_STEERING_WORKSPACE` are three independent operator-config
surfaces with the same encoding but separate resolution; there is no
single "workspace allowlist" that unifies them at v0. Source-real;
noted, not reconciled.
- No slice-00 numeric-drift OPEN (1–5) applies — this module carries no
migration-count / route-group / PL-004-event-count claim.
- [Living Notes review](living-notes-review.md) composes proof and scope content.
- [Workspace primitive](workspace-primitive.md) covers workspace identity.
- [File-path tests](../../../packages/daemon/test/files-path-safety.test.ts),
[progress tests](../../../packages/daemon/test/progress-indexer.test.ts), and
[steering tests](../../../packages/daemon/test/steering-composer.test.ts)
exercise these helpers; their presence is not a runtime verification claim.
@@ -1,6 +1,6 @@
---
kind: as-built
title: Coordination Primitive — Stream/Queue/Inbox/Outbox (PL-004 Phase A)
title: Coordination Primitive — Stream/Queue/Inbox/Outbox
status: active
topics: [coordination, observability]
domains: [engineering-advisor, operating-advisor, orchestrator]
@@ -10,57 +10,77 @@ applies-when: |
transactional handoff guarantee, or where queue closure is enforced.
siblings: [workflow-runtime.md, mission-control.md, daemon-core.md]
prerequisite-reads: [../README.md, daemon-core.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Coordination Primitive — Stream/Queue/Inbox/Outbox (PL-004 Phase A)
# Coordination Primitive — Stream/Queue/Inbox/Outbox
The PL-004 Phase A coordination primitive is the SQLite-canonical
durable-work layer the daemon exposes through `/api/stream` and `/api/queue`.
It replaces the POC filesystem `rigx queue` / `rigx stream` path for
daemon-backed work; the POC filesystem path remains untouched and the daemon
`rig queue` / `rig stream` write only to SQLite (`architecture.md` §5 L651).
The coordination primitive is the SQLite-canonical durable-work layer the
daemon exposes through `/api/stream` and `/api/queue`. It replaces the POC
filesystem `rigx queue` / `rigx stream` path for daemon-backed work; the POC
filesystem path remains untouched, and the daemon-backed `rig queue` /
`rig stream` commands operate only through the daemon HTTP API, so they write
only to SQLite (`packages/cli/src/commands/queue.ts:19`,
`packages/cli/src/commands/stream.ts:11`).
> Verified against source at HEAD `7eaf524c`.
> Verified against source at main `e8f0ab340db773392ec8be75b072d1c0f3068a50`. Each count below sits beside the
> command that produces it; run the command from the repository root to refresh
> it.
## 1. The five host-scoped tables
Five host-scoped tables back the primitive (`architecture.md` §3 L416–438;
migrations re-confirmed at HEAD `packages/daemon/src/db/migrations/`):
Five host-scoped tables back the primitive, one per migration `023`–`027` in
`packages/daemon/src/db/migrations/` (**5** tables:
`cat packages/daemon/src/db/migrations/02[3-7]_*.ts | grep -c 'CREATE TABLE'`):
- **`stream_items`** (`023_stream_items.ts`) — L1 append-only intake/audit
root. Columns: `stream_item_id` (ULID PK), `ts_emitted`,
root. Columns: `stream_item_id` (TEXT PK; a ULID unless the caller supplies
one, `packages/daemon/src/domain/stream-store.ts:88`), `ts_emitted`,
`stream_sort_key`, `source_session`, `body`, `format` (default `text`),
`hint_type`, `hint_urgency`, `hint_destination`, `hint_tags` (JSON),
`interrupt`, `archived_at`. Items immutable after emit (only `archived_at`
may be set).
- **`queue_items`** (`024_queue_items.ts`) — L3 owned-work queue. `qitem_id`
is TEXT PK preserving the POC `qitem-YYYYMMDDHHMMSS-<hex>` shape. State
enum (8 values): `pending | in-progress | done | blocked | failed |
denied | canceled | handed-off`. Carries `closure_reason`,
`closure_target`, `closure_required_at`, `chain_of_record` (JSON),
`blocked_on`, `handed_off_to`/`handed_off_from`, nudge/heartbeat fields.
`interrupt`, `archived_at`, and `identity_provenance` (added by
`067_i3_identity_provenance.ts`). Items immutable after emit (only
`archived_at` may be set, `stream-store.ts:217`).
- **`queue_items`** (`024_queue_items.ts`) — L3 owned-work queue.
Unless `--id` is supplied, the CLI generates the create request's `qitem_id` (TEXT PK) before sending as `qitem-<UTC YYYYMMDDHHMMSS>-<16 hex>` (64 random bits) and prints it to stderr as a request identity, not proof of persistence; reuse that ID with `--id` and the unchanged payload after an unknown outcome, while daemon callers without an ID still use `newQitemId()` and its `qitem-<UTC YYYYMMDDHHMMSS>-<8 hex>` form.
State enum (**8** values, `QUEUE_STATES` at `queue-repository.ts:33`;
`sed -n '/^export const QUEUE_STATES/,/] as const/p' packages/daemon/src/domain/queue-repository.ts | grep -c '^ "'`):
`pending | in-progress | done | blocked | failed | denied | canceled |
handed-off`. Carries `closure_reason`, `closure_target`,
`closure_required_at`, `chain_of_record` (JSON), `blocked_on`,
`handed_off_to`/`handed_off_from`, nudge/heartbeat columns.
- **`queue_transitions`** (`025_queue_transitions.ts`) — L3 append-only
transition log; authoritative audit trail for state evolution. No
UPDATE/DELETE from domain code.
transition log; authoritative audit trail for state evolution. Domain code
never updates its rows. The one delete is the retention runner, which moves
every transition of a terminal item whose last transition is older than the
retention window into `queue_transitions_archive`
(`054_queue_transitions_archive.ts`), insert and delete in one transaction
(`packages/daemon/src/domain/queue-retention.ts:203`). Only `done` and
`handed-off` items are archived; the default window is 30 days, and items
still on a live workflow frontier are skipped (`queue-retention.ts:69`–`75`,
`:158`–`171`).
- **`inbox_entries`** (`026_inbox_entries.ts`) — mailbox-style asynchronous
deposit; idempotent on `inbox_id`. State: `pending | absorbed | denied`.
- **`outbox_entries`** (`027_outbox_entries.ts`) — sender-side audit;
symmetric to inbox; idempotent on `outbox_id`. Delivery state:
`pending | delivered | failed`.
deposit; idempotent on `inbox_id`. State: `pending | absorbed | denied`
(`INBOX_STATES`, `inbox-handler.ts:5`).
- **`outbox_entries`** (`027_outbox_entries.ts`) — sender-side record;
symmetric to inbox; idempotent on `outbox_id`. Delivery state (**7** values,
`OUTBOX_DELIVERY_STATES` at `outbox-handler.ts:28`;
`grep '^export const OUTBOX_DELIVERY_STATES' packages/daemon/src/domain/outbox-handler.ts | grep -o '"[a-z]*"' | wc -l`):
`pending | sending | delivered | failed | indeterminate | retained |
retired`.
> Drift-fix D3 — `architecture.md` §3 L243 frames the schema as "27
> migrations (22 existing plus 5 added by PL-004 Phase A)". The 5 PL-004
> Phase A coordination tables (`023`–`027`) are still correct as a *range*,
> but the headline migration count is **40**, not 27 (slice-00 §1.3,
> re-confirmed at HEAD: `startup.ts:206` 40-element `migrate()` array; full
> drift-fix authority and the correction live in `daemon-core.md`).
These five are migrations `023`–`027` of the daemon's **96**
(`git ls-files packages/daemon/src/db/migrations | wc -l`), applied in the
order of `ALL_MIGRATIONS` (`packages/daemon/src/db/all-migrations.ts:107`).
Later migrations add columns to these tables; `daemon-core.md` covers the
migration set.
## 2. The six host-scoped services
Six host-scoped domain services implement the layer (`architecture.md` §5
L649–658; files re-confirmed in `packages/daemon/src/domain/` at HEAD).
Six host-scoped domain services in `packages/daemon/src/domain/` implement the
layer (**6** files:
`ls packages/daemon/src/domain/{stream-store,queue-repository,queue-transition-log,hot-potato-enforcer,inbox-handler,outbox-handler}.ts | wc -l`).
Routes import these; services are Hono-free:
- **`stream-store.ts`** — L1 stream: idempotent emit (on `stream_item_id`),
@@ -68,175 +88,347 @@ Routes import these; services are Hono-free:
and inclusive time-window filters, soft archive. `direction=latest` applies
every filter before taking the newest bounded page, then returns that page
chronologically.
- **`queue-repository.ts`** — L3 queue: create, claim/unclaim, update
(general state mutator with hot-potato strict-rejection on `done`),
transactional handoff (close source as `handed-off` plus create new owned
qitem in a single transaction), pod-fallback rerouting, overdue lookup,
nudge/heartbeat tracking. Cross-rig validation hook exposed as
`validateRig` constructor option.
- **`queue-repository.ts`** — L3 queue: create (`:1391`), claim/unclaim
(`:2186`, `:2271`), update (general state mutator with hot-potato
strict-rejection on `done`, `:2334`), transactional handoff (close source as
`handed-off` plus create new owned qitem in a single transaction, `:1656`;
`handoffAndComplete`, `:1833`, closes the source as `done` instead),
pod-fallback rerouting (`routeToFallback`, `:3678`), overdue lookup
(`findOverdue`, `:3378`), nudge-result tracking (`recordNudgeAttempt`,
`:3663`). Nothing in the daemon writes the `last_heartbeat` column
(`queue-pickup.ts:16`). Cross-rig validation hook exposed as `validateRig`
constructor option (`queue-repository.ts:717`).
- **`queue-transition-log.ts`** — append-only state-transition log; used by
`queue-repository.ts`, exposed read-only on
`queue_repository.transitionLog`.
`queue-repository.ts`, exposed as the read-only property
`QueueRepository.transitionLog` (`queue-repository.ts:666`).
- **`hot-potato-enforcer.ts`** — pure validator for the load-bearing API
contract (see §3).
- **`inbox-handler.ts`** — mailbox handler: authenticated drop (idempotent
on `inbox_id`), absorb (promotes a pending entry to a `queue_item`,
idempotent), deny (records reason). Auth check is a pluggable constructor
hook.
- **`outbox-handler.ts`** — sender-side outbox: idempotent record, mark
delivered/failed, list. Emits no event-bus events (pure audit).
- **`inbox-handler.ts`** — mailbox handler: drop (idempotent on `inbox_id`,
`:100`), absorb (promotes a pending entry to a `queue_item`, idempotent,
`:155`), deny (records reason, `:215`). The handler has no auth hook
(`inbox-handler.ts:71`); identity comes from the route. `POST /inbox/drop`
takes the sender only from the `X-OpenRig-Session` header through
`requireSenderIdentity` (`routes/queue.ts:1094`) and answers 400
`actor_required` without it. Absorb and deny (`:1121`, `:1135`) use the
header when present; otherwise they accept the body's `receiverSession` and
record it as `claimed:v1` (`routes/require-sender-identity.ts:83`–`92`).
- **`outbox-handler.ts`** — sender-side outbox: idempotent record (`:130`),
delivery-state marks (`markDelivered` `:239`, `markFailed` `:256`,
`markIndeterminate` `:280`), list (`listForSender` `:339`). It also holds the
queue's durable wake intents (ids prefixed `wake-intent-`, `:15`) and the
messages the seat delivery guard retains (`retain` `:181`, `retire` `:217`),
so it is not audit-only. Emits no event-bus events.
Create, handoff and handoff-and-complete return the committed row without
waiting for terminal delivery. Each stages a deterministic
`wake-intent-<qitem>` outbox row in its transaction and delivers it after
commit (`queue-repository.ts:1412`–`1424`, `:1475`–`1483`). The returned
`lastNudgeResult` is therefore normally null; `rig queue show <id>` reads the
wake result later. If create cannot retain the intent, the task is still saved
and the row records `failed:wake not retained: <reason>`. Startup reconciles
and drains intents left pending by a crash once (`startup.ts:2361`–`2362`).
`maybeNudge` remains only as the path for a repository with no outbox.
**Which field answers "did it reach them".** `deliveryOutcome` is the gateway
(human-delivery) ledger, derived at read time
(`QueueRepository.deliveryOutcomeFor`): `posted` or `transport-failed` from the
row's Slack receipt notes, or `never-posted` when a gateway-routed row still
has no receipt once the post window has passed. A task delivered only to an
agent's pane has no such receipt, so it reads `null`. A task that also has a
gateway or human-notification side can carry a value, and the CLI then reports
that gateway side too. For the pane side, read:
- `lastNudgeWireResult`: the wake send's result as stored (for example
`verified`, `delivered-ack-pending`, `indeterminate:…`, `retained:…`,
`failed:…`). A claim never rewrites it; a later wake replaces it.
- `lastNudgeResult`: the result as presented. It is the stored result, except
that a claimed row whose stored result is `delivered-ack-pending` or
`indeterminate:…` reads `claimed` (`presentedNudgeResult`). Unclaiming shows
the stored result again.
- `claimedAt`: when the destination claimed the row. Closing doesn't clear it.
- `pickup`: the derived pickup receipt (`unclaimed`, `working`,
`stalled-after-claim`, `parked`, `terminal`), computed at read time.
A claim isn't proof that the body was read or that the terminal render was
verified, and closing a task isn't a new delivery receipt: a claimed task that
is later closed still reads `claimed` when its stored result was unconfirmed
(`delivered-ack-pending` or `indeterminate:…`); a `verified` or `failed:…`
result reads as stored. For such an unconfirmed, claimed item,
`rig queue create --verify` says "Terminal receipt unconfirmed, but the seat
has claimed the item (claimed)."; for any claimed item it adds "A claim shows
the seat took the item; it does not prove the body was read."
(`terminalDeliveryResult`, `packages/cli/src/commands/queue.ts`).
The standing detector in `queue-stuck-sweep.ts` creates findings through the
queue repository, with `evidenceRef: rig queue show <source-qitem-id>` pointing
to the underlying durable work row. This satisfies the existing human-route
evidence contract without changing destination resolution: an admitted finding
can still be unroutable. Repeated detections refresh the existing finding;
when the source condition resolves, the sweep closes its own finding.
to the underlying durable work row. Unclaimed and undelivered findings go to
the destination's orchestrator when one is derivable, otherwise to the
destination itself, and that seat may be dead. Overdue claims go to their
destination. Repeated detections reuse the existing finding without changing
its route; when the source condition resolves, the sweep closes its own finding.
The sweep reports six finding kinds. Its custody check covers closures that
name a successor qitem or a seat (`closure_reason = handed_off_to`) in the last
24 hours, plus older closures with open findings. A seat target is satisfied by
a local successor carrying this row's lineage, and any target by a
`custody-verified: <target> …` note on the closed row. A new custody finding for
a human destination goes to the agent that closed the item, using the closing
transition from active or archived history. Later notes and notification
receipts do not change that owner. If the closing actor is missing, human, system
machinery or not admitted by this host's queue, the asking agent receives the
finding if its address is admitted. Human identity includes reserved references
and registered aliases, independent of terminal bindings. Admission uses the
queue's existing address check and does not require a live seat. An agent
destination keeps its existing route; if neither closer nor source is an admitted
agent, the human destination remains the durable fallback. This routing does not
change custody verification or suppress unresolved findings.
If the human registry is unavailable when a custody candidate's owner needs
classification, that candidate keeps its original destination, and one log line
per candidate names it and the registry error. This doesn't infer an agent
identity from an unreadable registry, which may not exist before the first human
is registered. In a pass with no finding to save for a `<name>@external` person,
which includes an install with no registry yet, work bound for agents keeps
routing and repaired findings still close. Such a finding still needs the
registry to admit it when it's saved, so during an outage a pass that must save
one fails at that finding, as it did before this routing. Findings not yet
created in that pass, and the closing of repaired findings, wait for the next
pass that completes. Once the registry can be read again, the next pass creates
the finding and routes it to the closer. Registry recovery restores owner refinement
for new findings; existing findings keep their established route. Reserved human
references and legacy agent names keep their known classifications without a
registry read.
## 3. The hot-potato closure contract (where queue closure is enforced)
`hot-potato-enforcer.ts` is the pure validator for the load-bearing API
contract. Re-confirmed at HEAD (`hot-potato-enforcer.ts:10–24`):
contract. `validateClosure` (`hot-potato-enforcer.ts:59`) checks a transition
against `CLOSURE_REASONS` (`:18`; **7** values:
`sed -n '/^export const CLOSURE_REASONS/,/] as const/p' packages/daemon/src/domain/hot-potato-enforcer.ts | grep -c '^ "'`):
`state=done` requires `closure_reason ∈ {handed_off_to, blocked_on, denied,
canceled, no-follow-on, escalation}`. The reasons
`handed_off_to | blocked_on | escalation` additionally require
`closure_target`:
`state=done` requires `closure_reason ∈ {handed_off_to, denied,
canceled, no-follow-on, escalation, superseded}`. The reasons
`handed_off_to | escalation` additionally require
`closure_target` (`:86`):
- `handed_off_to` — work continues with a different seat (`closure_target` =
new owner).
- `blocked_on` — work is parked pending another qitem (`closure_target` =
blocker `qitem_id`).
- `blocked_on` — an active `state=blocked` park record, rejected with `state=done`.
To wait for a qitem, use `rig queue block <id> --on <child>` or
`rig queue update <id> --state blocked --blocked-on <child>`; the item returns
to pending when its blocker completes.
- `denied` — receiver rejected the work (`closure_target` = reason text).
- `canceled` — sender or receiver withdrew (`closure_target` = note).
- `no-follow-on` — terminal completion, nothing else needed.
- `escalation` — kicked up to a higher tier (`closure_target` = escalation
target).
- `superseded` — the row was replaced by cancel-and-replace
(`closure_target` = the successor qitem). The update path records it on
`state=canceled` and refuses it there without a `closure_target`
(`queue-repository.ts:2629`).
Tier→SLA mapping for `closure_required_at` also lives in
`hot-potato-enforcer.ts`. This validator is invoked by
`QueueRepository.update()` (and `updateWithinTransaction()`), so closure is
enforced at the daemon transaction boundary — the workflow runtime
*projects* on closure but does not gate it (see `workflow-runtime.md`).
`hot-potato-enforcer.ts` (`TIER_SLA_SECONDS`, `:115`). This validator is
invoked by `QueueRepository.update()` (and `updateWithinTransaction()`), both
through the call at `queue-repository.ts:2531`, so closure is enforced at the
daemon transaction boundary — the workflow runtime *projects* on closure but
does not otherwise gate it (see `workflow-runtime.md`). The one
workflow-aware check is in the queue: `update()` refuses a terminal close of a
live workflow frontier packet from a non-workflow verb
(`workflow_frontier_packet`, `queue-repository.ts:2557`), through a predicate
startup injects. "Terminal" there is the queue's terminal set, `done` and
`handed-off` (`queue-repository.ts:52`).
## 3b. Cross-host queue routing (v0.4.6 — OPR.0.4.6.MH3)
Closure fields are stored only on `state=done`, the park record (`blocked`
with `blocked_on`), the handoff close (`handed-off` with `handed_off_to`) and
the superseded cancel; any other transition carrying them is refused with
`closure_fields_not_admitted`, and `blocked_on` outside `blocked` with
`blocked_on_not_admitted`. A `done`, `canceled` or `handed-off` row accepts a
note without a state change as an append-only transition; moving it to
another state requires an explicit reopen with a note. A `qitem-` blocker must
exist and be live on this daemon; when a blocker leaves the active states,
each row parked on it follows the blocker's handoff successor or returns to
`pending` with a durable wake (`queue-repository.ts:2407`–`2529`,
`:2612`–`2656`, `:2931`–`3008`). Claiming a parked row clears its
`blocked_on`; the claim transition keeps the former gate as a `closure_target`
audit pointer with no closure reason, which a re-park without `--blocked-on`
reuses (`queue-repository.ts:2233`–`2254`, `:2571`–`2577`).
`human-route-enforcer.ts` is a second pure validator at the same boundary: a
`human-gate` row, a row addressed to a human seat, or a park on one must carry
`summary` and `evidence_ref`.
The queue's two coordination WRITE verbs — **create + handoff(-and-complete)
only** — are host-aware: a write body may carry an out-of-band `hostId`
envelope (BR-1 — session strings stay `member@rig` everywhere; the 3-part
`agent@rig@host` form is CLI input sugar that never leaves the CLI edge).
The mechanism **generalizes the shipped mission-control forward-then-strip
WRITE template** (`routes/mission-control.ts` § remote action): one shared
route-layer helper (`forwardQueueWrite`, `routes/queue.ts`) resolves the
host registry daemon-side (bearers never reach the caller), rejects
ssh-declared hosts (`unsupported-transport` — the daemon→daemon path is
http-only, because it is what fires the remote nudge), strips `hostId`, and
forwards the WHOLE body via `remoteJsonRequest` under a named write-class
deadline (`QUEUE_FORWARD_TIMEOUT_MS`). The origin's response returns
verbatim; transport failures map to a structured host-named taxonomy
(`remote_queue_write_failed`: unknown-host / unsupported-transport /
unreachable / auth-failed / remote-error). No local row is ever written on
the cross-host path.
## 3b. Cross-host queue routing
Three queue write routes are host-aware — `POST /create`,
`POST /:qitemId/handoff` and `POST /:qitemId/handoff-and-complete` (**3**:
`grep -c '!resolvesToLocalHost(body.hostId, getSelfHostId())' packages/daemon/src/routes/queue.ts`):
a write body may carry an out-of-band `hostId` envelope. The destination
session stays `member@rig`; the 3-part `agent@rig@host` form is CLI input
sugar that `resolveQueueHostDestination`
(`packages/cli/src/commands/queue.ts:394`) splits into the destination and
`hostId` before the request leaves the CLI. The same split applies to
`--host <id>`; queue verbs never follow `rig host select`, and naming two
different hosts is refused with `host_qualifier_conflict`. The mechanism
follows the forward-then-strip shape of mission-control's remote action
(`routes/mission-control.ts:352`): one shared route-layer helper
(`forwardQueueWrite`, `routes/queue.ts:214`) resolves the host registry
daemon-side (bearers never reach the caller), rejects ssh-declared hosts
(`unsupported-transport` — the daemon→daemon path is http-only), and forwards
the whole body, with `hostId` stripped, via `remoteJsonRequest` (`:248`) under
a named write-class deadline (`QUEUE_FORWARD_TIMEOUT_MS`, `:41`). The origin's
response returns verbatim; failures map to a structured host-named error
(`remote_queue_write_failed`, HTTP 502, `:234`) whose `failureClass` is one of
registry / unknown-host / unsupported-transport / unreachable / auth-failed /
remote-error. No local row is ever written on the cross-host path.
**The model: origin-owns-the-record, at-least-once + idempotent,
message-passing closure (never 2PC).**
- **Origin-owns-the-record.** The qitem lives in the TARGET host's DB; that
row is THE record. The target daemon's OWN `maybeNudge` fires on ITS local
tmux (the forwarded body includes the `nudge` flag) — the sending daemon
never reaches across a host boundary.
- **Idempotency (arch Q-a).** The forwarding daemon MINTS the `qitemId`
before the first forward, so every retry carries the same id; dedup rides
the existing `qitem_id TEXT PRIMARY KEY`. On PK conflict the origin
returns the stored row when identity fields match (idempotent absorb) and
a structured `qitem_id_reuse` error when they differ
(`QueueRepository.create()` catch-path + `isQitemPrimaryKeyConflict`).
- **Cross-host handoff choreography (arch Q-c).** The local atomic
close+create cannot span two DBs, so the route-layer choreography
(`crossHostHandoff`, `routes/queue.ts`) runs: successor-create on the
target host FIRST (via the one forward helper), local source-close SECOND
(`QueueRepository.closeCrossHostHandoffSource`) — never the reverse. A
crash between the two leaves a live duplicate that the idempotent re-drive
converges; the reverse order would leave a closed source pointing at a
successor that does not exist (a dropped potato — the one forbidden
outcome). The successor id is DERIVED, not minted:
`deriveCrossHostSuccessorId(source, destination, host)` →
`qitem-xh-<sha256[:16]>` — a pure stateless function, so a re-drive
re-derives the same id across daemon restarts and absorbs on the target
PK. *(Named residual, inherent to the at-least-once/no-2PC fence: a
re-drive naming a DIFFERENT destination derives a different id and cannot
absorb the earlier successor — that orphan stays visible via the chain +
provenance tags; the source-close conflict check surfaces the
row is THE record. The target daemon wakes the destination on ITS local
tmux: its own `create` stages a durable wake intent and delivers it after
commit (§2; the forwarded body carries the `nudge` flag) — the sending
daemon never reaches across a host boundary. Before forwarding, the
forwarding daemon stamps its own host id, when it has one, onto the source
session (`stampSelfHostSuffix`, `queue-repository.ts:548`; called at
`routes/queue.ts:378` and `:509`), so the target row records the sender as
`member@rig@<forwarding host>`.
- **Idempotency.** On create, the forwarding daemon mints the `qitemId` before
the forward unless the caller supplied one (`routes/queue.ts:501`). The
forward is a single request, so a retry dedups only when it carries the same
id (a caller re-sending `--id`, or a handoff re-drive, whose successor id is
derived). Dedup rides the existing `qitem_id TEXT PRIMARY KEY`. On PK
conflict the origin returns the stored row when destination and source
match (idempotent absorb) and a structured `qitem_id_reuse` error (409) when
they differ (`QueueRepository.create()` catch path,
`queue-repository.ts:1431`–`1472`, with `isQitemPrimaryKeyConflict`,
`:461`). When destination and source match but the body differs, the stored
row is returned unchanged with `createWarning: qitem_body_not_saved`; the
supplied body is not saved (`:1450`–`1454`).
- **Cross-host handoff choreography.** The local atomic close+create cannot
span two DBs, so the route-layer choreography (`crossHostHandoff`,
`routes/queue.ts:316`) runs: successor-create on the target host FIRST (via
the one forward helper, `:397`), local source-close SECOND
(`QueueRepository.closeCrossHostHandoffSource`, `queue-repository.ts:2031`)
— never the reverse. A crash between the two leaves a live duplicate that
the idempotent re-drive converges; the reverse order would leave a closed
source pointing at a successor that does not exist (a dropped potato — the
one forbidden outcome). The successor id is DERIVED, not minted:
`deriveCrossHostSuccessorId(source, destination, host)`
(`queue-repository.ts:489`) → `qitem-xh-<sha256[:16]>` — a pure stateless
function, so a re-drive re-derives the same id across daemon restarts and
absorbs on the target PK. *(Residual, inherent to at-least-once delivery
without 2PC: a re-drive naming a DIFFERENT destination derives a different
id and cannot absorb the earlier successor — that orphan stays visible via
the chain + provenance tags; the source-close conflict check surfaces the
disagreement.)*
- **Closure across the boundary.** The source closes with
`closure_reason=handed_off_to` and `closure_target=member@rig@<host>` —
the 3-part form is legal THERE because `closure_target` is OPAQUE
audit/display metadata, presence-checked and never parsed for routing
(arch R1; any PR parsing it as a session string is a spec violation).
The exemption spans exactly the `closure_target` column on `queue_items`
and its verbatim mirror on `queue_transitions` — nothing else. In
particular the transition log's free-text `transition_note` is a durable
carrier too: the minted cross-host close note names the 2-part
`toSession` only (rev1-r2 B1). `handed_off_to` and every other
session-string carrier stay 2-part.
`closure_reason=handed_off_to` and
`closure_target=<successor qitem id>@<host>` (`routes/queue.ts:351`); a
source already closed with the older `member@rig@<host>` target keeps it,
and a re-drive matches against it (`:352`–`356`). `closure_target` is OPAQUE
audit metadata, never parsed for routing; the standing stuck sweep reads it
only to check successor custody (`queue-stuck-sweep.ts:519`–`554`). The
host-qualified key appears only in the `closure_target` column on
`queue_items` and its verbatim mirror on `queue_transitions`: the minted
cross-host close note names the 2-part `toSession` only
(`queue-repository.ts:2087`), and `handed_off_to` and the
`queue.handed_off` event stay 2-part.
Re-drive semantics: already-terminal + MATCHING `closure_target` = absorb;
MISMATCH = structured `cross_host_close_conflict` (409). The successor
carries `chain_of_record = [...source.chain, source.qitemId]` — A-side ids
are opaque lineage identifiers on B (arch R2b; they do not dereference in
B's DB) — plus provenance tags `cross-host` + `from-host:<self-declared
name>` (honest best-effort, not authenticated identity).
- **Boundary discipline.** Claim / update / inbox stay local-by-principle
(after a cross-host handoff the successor lives where its worker lives);
sender-side ops on a forwarded item are a named follow-up. The local
(no-host) paths are byte-identical to pre-MH-3 behavior; the hot-potato
validation contract (§3) is unweakened across the boundary.
MISMATCH = structured `cross_host_close_conflict` (409), checked in the route
before any forward (`routes/queue.ts:359`) and again in the repository. The
successor carries `chain_of_record = [...source.chain, source.qitemId]`
(`routes/queue.ts:384`) — A-side ids are opaque lineage identifiers on B
(they do not dereference in B's DB) — plus provenance tags `cross-host` +
`from-host:<self-declared name>` (the forwarding daemon's OS hostname,
`routes/queue.ts:54`; honest best-effort, not authenticated identity).
- **Boundary discipline.** Claim, update and inbox routes take no `hostId` and
stay local (after a cross-host handoff the successor lives where its worker
lives). Without a `hostId`, with `local`, or with this daemon's own resolved
host id (an exact, case-sensitive match), create and handoff take the
local path; a self-addressed handoff whose deterministic cross-host
successor an earlier self-forward already created runs that cross-host
create and close in process. The
hot-potato validation contract (§3) is unweakened across the boundary: the
cross-host close always records `handed_off_to` with a target.
## 4. Coordination events
> Drift-fix D8 / OPEN-4 (carried verbatim, slice-00): `architecture.md`
> §3 L394 says "Existing 32 PL-004 events untouched" and L410 says "Existing
> 20 PL-004 events are unchanged" — these two body claims are internally
> inconsistent with each other and predate 0.3.x. **Do NOT carry either
> number.** The current `RigEvent` union (`packages/daemon/src/domain/types.ts:94`)
> has **73 union members** total (slice-00 §1.8, re-confirmed at HEAD:
> `grep -cE '^\s*\| \{ type: ' = 73`). A precise PL-004-only vs PL-005-only
> sub-partition is not reconcilable from static inspection without
> classifying all 73 members by introducing slice; slice-00 OPEN-4 flags
> this and it is carried, not smoothed.
The `RigEvent` union (`packages/daemon/src/domain/types.ts:108`) has **98**
members
(`sed -n '/^export type RigEvent =/,/^export type PersistedEvent/p' packages/daemon/src/domain/types.ts | grep -c 'type: "'`);
this module covers only the coordination families below.
Coordination events emitted by these services (re-confirmed in
`domain/types.ts` at HEAD): `stream.emitted` (StreamStore.emit,
`types.ts:155`); `queue.created` / `queue.handed_off` / `queue.claimed` /
`queue.unclaimed` / `qitem.fallback_routed` / `qitem.closure_overdue`
(QueueRepository); `inbox.absorbed` (`types.ts:162`) / `inbox.denied`
(InboxHandler). `architecture.md` §8 L987–990 listed these as "9
coordination events"; the count of the broader `stream|queue|inbox|qitem`
event family at HEAD is 10 (`stream` 1 + `queue` 5 + `inbox` 2 + `qitem` 2)
— stated as a re-derived family count, not as a contested PL-004 sub-count
(OPEN-4).
Coordination events emitted by these services: `stream.emitted`
(`StreamStore.emit`, declared at `types.ts:245`); `queue.created` /
`queue.handed_off` / `queue.claimed` / `queue.unclaimed` / `queue.updated` /
`qitem.fallback_routed` / `qitem.closure_overdue` (QueueRepository); `inbox.absorbed` (`types.ts:255`) /
`inbox.denied` (InboxHandler). `qitem.closure_overdue` (`types.ts:254`) is
emitted by `QueueRepository.recordClosureOverdue` when swept by `queue-stuck-sweep`
and passed through the queue watch filter (**2** files contain its literal:
`git grep -l -F 'type: "qitem.closure_overdue"' -- packages/daemon/src | wc -l`).
The `stream|queue|inbox|qitem` families declare **10** event types (`stream` 1
+ `queue` 5 + `inbox` 2 + `qitem` 2;
`sed -n '/^export type RigEvent =/,/^export type PersistedEvent/p' packages/daemon/src/domain/types.ts | grep -oE '"(stream|queue|inbox|qitem)\.[a-z_]+"' | sort -u | wc -l`).
Two SSE surfaces stream coordination events: `/api/stream/watch`
(aliased `/api/stream/sse`, `routes/stream.ts:117–118`) for new stream
items, and `/api/queue/watch` for queue/inbox events. The event log remains
append-only and SQLite-backed. `rig stream watch` is a thin, single-connection
consumer of `/api/stream/sse`; it does not add a daemon route or reconnect
policy.
Two SSE surfaces stream coordination events (**2**:
`cat packages/daemon/src/routes/stream.ts packages/daemon/src/routes/queue.ts | grep -c 'return streamSSE('`):
`/api/stream/watch` (aliased `/api/stream/sse`, `routes/stream.ts:194`–`195`),
which first replays up to 50 unarchived items in chronological order (the
oldest, `:174`–`181`) and then streams new items, and `/api/queue/watch`
(aliased `/api/queue/sse`, `routes/queue.ts:1054`–`1055`) for queue/inbox
events — every coordination type except `stream.emitted` and `queue.updated`
(filter at `routes/queue.ts:1031`–`1038`). The event log remains append-only and
SQLite-backed. `rig stream watch` is a thin, single-connection consumer of
`/api/stream/sse` (`packages/cli/src/commands/stream.ts:191`); it does not add
a daemon route or reconnect policy.
## 5. Route surface
- `/api/stream` (`server.ts:489`) — `POST /emit` (`routes/stream.ts:24`),
`GET /list` (`:56`, including `sourceSession`, `hintDestination`, `hintTag`,
`since`, and `until` filters), `GET /watch` + `/sse` SSE (`:117`),
`GET /:streamItemId` (`:121`), `POST /:streamItemId/archive` (`:130`).
- `/api/queue` (`server.ts:490`) — `POST /create` (`routes/queue.ts:99`),
`POST /:qitemId/claim` (`:144`), `POST /:qitemId/unclaim` (`:157`),
`POST /:qitemId/update` (`:170`), plus handoff/list/watch surfaces.
The TUI FEED reads `/api/attention` for human requests and current explicit
human-addressed updates. Its independent update query filters open states and
strict human destinations before the 1001-row sentinel, serves at most 1000
updates with critical then urgent rows first, and requires no transport receipt. These local
FYIs create no approval obligation. `/api/queue/human-updates` remains confirmed
delivery history; the TUI suppresses a history card when the same queue item is
in the current update window. Current-update coverage is independent of the
receipt window, so an unavailable current reader cannot retain closed delivery
history beyond a successful history read. Both reads leave queue state intact.
- `/api/stream` (`server.ts:783`) — `POST /emit` (`routes/stream.ts:56`),
`GET /list` (`:91`, including `sourceSession`, `hintDestination`, `hintTag`,
`since`, `until` and `direction` filters), `GET /watch` + `/sse` SSE
(`:194`), `GET /:streamItemId` (`:198`), `POST /:streamItemId/archive`
(`:207`).
- `/api/queue` (`server.ts:784`) — `POST /create` (`routes/queue.ts:450`),
`POST /:qitemId/claim` (`:545`), `POST /:qitemId/unclaim` (`:561`),
`POST /:qitemId/update` (`:600`), plus handoff (`:650`, `:732`),
`POST /:qitemId/fallback` (`:808`), list (`:902`) and watch (`:1054`)
surfaces; reads `GET /whoami`, `/attention-aggregate`, `/human-updates`,
`/overdue`, `/undelivered`, `/recent-transitions`, `/:qitemId/transitions`
and `/:qitemId` (`:822`–`1067`); inbox routes `POST /inbox/drop`,
`/inbox/:id/absorb`, `/inbox/:id/deny` and `GET /inbox/pending`,
`/inbox/list` (`:1076`–`1152`); outbox routes `POST /outbox/record` and
`GET /outbox/list` (`:1161`, `:1190`).
Every write route derives its actor through `requireSenderIdentity`
(`routes/require-sender-identity.ts:76`): the `X-OpenRig-Session` header wins
over a body actor. On a direct request from a known origin it is recorded as
`transport:v1`; `resolveRecordedProvenance` (`:199`) instead records
`origin-unknown:v1` when the origin-unknown marker is set or a relayed request
carried `origin-unknown:v1` (`:207`), `relay:v1` for a relayed request that
carried `transport:v1`, and `claimed:v1` for other relayed requests. Without the
header, the
body actor is recorded as `claimed:v1`; with neither (or, for inbox drop,
without the header) the route answers 400 `actor_required`. The stamp lands in
`identity_provenance` on transitions, inbox, outbox and stream rows
(migrations `067`, `082`).
## See also
- `daemon-core.md` — daemon wiring, the 40-migration set, route surface.
- `workflow-runtime.md` — PL-004 Phase D runtime that projects on closure.
- `mission-control.md` — PL-005 queue observability over `queue_items`.
- `daemon-core.md` — daemon wiring, the migration set, route surface.
- `workflow-runtime.md` — the workflow runtime that projects on closure.
- `mission-control.md` — queue observability over `queue_items`.
- Source roots: `packages/daemon/src/domain/{stream-store,queue-repository,
queue-transition-log,hot-potato-enforcer,inbox-handler,outbox-handler}.ts`,
`packages/daemon/src/routes/{stream,queue}.ts`.
+159 -177
View File
@@ -9,252 +9,234 @@ applies-when: |
graph, the SQLite schema/migration set, or the route-mount surface.
siblings: [coordination-primitive.md, agent-spec-and-startup.md, lifecycle-snapshot-restore.md]
prerequisite-reads: [../README.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Daemon Core — Wiring, DB, Migrations, Startup
OpenRig is a local control plane for multi-agent coding topologies. The daemon
(`@openrig/daemon`) is the framework-free SQLite-backed core that the CLI
(`@openrig/cli`), UI (`@openrig/ui`), and MCP server all sit on top of.
(`@openrig/cli`), the terminal UI (`@openrig/tui`), the web UI (`@openrig/ui`)
and the MCP server all sit on top of.
> Verified against source at HEAD `7eaf524c` (`git describe` →
> `v0.3.1-6-g7eaf524c`). Current package version is **0.3.1** across all three
> packages (`package.json` root `"version": "0.3.1"`; slice-00 §1.1). HEAD
> carries 6 commits of unreleased release-0.3.2 work; no `v0.3.2` tag exists.
> Verified against source at main `e8f0ab340db773392ec8be75b072d1c0f3068a50`. Each count below sits beside the
> command that produces it; run the command from the repository root to refresh
> it.
## 1. System overview
The system has six architectural layers (`architecture.md` §1 L23–30):
For what OpenRig is and how its packages fit together, read `ARCHITECTURE.md` at
the repository root. This module covers the daemon's own wiring.
1. **AgentSpec / pod-aware core** — spec parsing, resolution, precedence,
startup orchestration, snapshot/restore, bundles.
2. **Operator and topology layer** — harness auto-launch, node inventory,
session naming, infrastructure nodes, explorer UI, existing-rig power-on,
auto-snapshot, post-command handoff.
3. **Communication and history layer** — transcript capture (pipe-pane),
communication primitives (send/capture/broadcast), config/preflight,
`rig ask` context packs, durable rig chat.
4. **Authoring and identity layer** — spec review + spec library, `whoami`,
adopted-session tmux-metadata parity, bind/materialize/adopt workflows.
5. **Rig environment layer** — rig-scoped services records, Compose-backed
service orchestration, readiness gates, env snapshot/restore integration.
6. **Agent-managed software layer** — managed-app classification, app-focused
browse/review/runtime UI, and the canonical `secrets-manager` example.
### Source footprint at `e8f0ab340db773392ec8be75b072d1c0f3068a50`
Legacy flat-node/package flows remain for backward compatibility.
The footprint counts use non-test TypeScript files under each package's `src/`
(tests live in separate `packages/*/test/` directories):
`find <dir> -type f \( -name '*.ts' -o -name '*.tsx' \) ! -name '*.test.*' | wc -l`.
### Verified source footprint at HEAD `7eaf524c`
> Drift-fix D1/D6 — `architecture.md` L6,11 said `OpenRig v0.2.0` /
> "Current v0.2.0 release verification" and L7 said `376` source files. Both
> are a frozen pre-v0.2.0-era header (slice-00 §1.9 — last edited `72982bb2`,
> 2026-03-30). Corrected to the values below.
| Metric | Value @ HEAD | Source (independently re-confirmed) |
| Metric | Count | Directory or command |
|---|---|---|
| Package version | **0.3.1** (HEAD +6 unreleased 0.3.2 commits) | slice-00 §1.1; `package.json:version` |
| Total source footprint | **601** files | slice-00 §1.6; `find packages/*/src` non-test = 279+87+235 |
| Daemon footprint | **279** total / **173** domain / **49** route mounts (46 route files) / **11** adapters / **40** migrations | slice-00 §1.5/§1.6; `find packages/daemon/src` non-test |
| CLI footprint | **87** files | slice-00 §1.6; `find packages/cli/src` non-test |
| UI footprint | **235** files | slice-00 §1.6; `find packages/ui/src` `.ts`+`.tsx` non-test |
| All packages | **1205** | `packages/*/src` |
| Daemon | **660** (**431** under `domain/`, **29** under `adapters/`) | `packages/daemon/src`, `…/src/domain`, `…/src/adapters` |
| CLI | **174** | `packages/cli/src` |
| Web UI | **304** | `packages/ui/src` |
| TUI | **67** | `packages/tui/src` |
| Database migrations | **96** (`001_core_schema.ts` … `097_thread_part_map.ts`; no `093`) | `git ls-files packages/daemon/src/db/migrations \| wc -l` |
| Files in `routes/` | **68**, of which **65** create a Hono router | `git ls-files packages/daemon/src/routes \| wc -l`; `git grep -l 'new Hono' -- packages/daemon/src/routes \| wc -l` |
| `app.route(...)` mounts in `server.ts` | **69** | `grep -c 'app.route(' packages/daemon/src/server.ts` |
| Top-level `rig` commands | **87** | `grep -c 'program.addCommand(' packages/cli/src/index.ts` |
| MCP tools | **18**, all named `rig_*` | `grep -c 'server.tool(' packages/cli/src/mcp-server.ts` |
| Runtime adapter classes | **5**: Claude Code, Codex, Pi, Stub, Terminal | `git grep -l 'implements RuntimeAdapter' packages/daemon/src \| wc -l` |
> Footprint counts use the `find packages/*/src -type f \( -name '*.ts' -o
> -name '*.tsx' \) ! -name '*.test.*'` predicate (tests live in separate
> `packages/*/test/` dirs). Counts are reproducible with that predicate; a
> different counting convention shifts absolute numbers (slice-00 OPEN-5).
`OmpRuntimeAdapter` (Oh My Pi) extends `PiRuntimeAdapter`, so the daemon wires
six runtime keys — `claude-code`, `codex`, `pi`, `omp`, `stub`, `terminal`
(`startup.ts:989`).
### The stack
> Drift-fix D2 — `architecture.md` L37,125 said `CLI (53 command groups)`.
> Corrected to **58** at HEAD (slice-00 §1.2: 53 at v0.2.0 tag, 56 at v0.3.0,
> 57 at v0.3.1, **58 at HEAD** — the 58th is `scopeCommand()` added post-0.3.1
> by `0b77cba4`, re-confirmed `index.ts:20,187`).
>
> Drift-fix D4 — `architecture.md` L40 said `31 route groups` and L76 said
> "`createApp()` now mounts 22 route groups". Corrected to **49 `app.route()`
> mounts + 4 dedicated handlers** (slice-00 §1.5; re-confirmed `server.ts`
> 49×`app.route(` L450–513, plus `app.get("/healthz")` :446,
> `handleExportYaml` :461, `handleExportJson` :462, `app.get("*")` :519).
> Carry slice-00 **OPEN-2**: "route-group count is definitional" — there is
> no single canonical "route group" definition in source; reported as mount
> count + dedicated handlers.
>
> Drift-fix D3 — `architecture.md` L54 said `SQLite state (36 migrations)`.
> Corrected to **40** (slice-00 §1.3; re-confirmed below).
```text
CLI (58 command groups) / UI (explorer + workspace + drawer) / MCP (17 tools)
CLI (87 top-level commands) / TUI / web UI / MCP (23 tools)
|
v
Hono daemon routes (49 app.route() mounts + 4 dedicated health/export/static handlers)
Hono daemon routes (69 app.route() mounts + direct handlers for /healthz,
spec export, unknown /api paths and the static UI)
|
+-- dual-format route adapters (legacy v1 + rebooted v0.2)
+-- rigspec routes (pod-aware and legacy spec formats)
+-- env routes (status / logs / down)
+-- transport routes (send/capture/broadcast)
+-- transcript routes (tail/grep)
+-- ask routes (context evidence packs)
+-- transport routes (send / capture / broadcast)
+-- transcript routes (tail / grep)
+-- ask routes (context evidence)
+-- chat routes (durable rig messaging + SSE)
+-- spec review/library routes (managed-app enrichment + compose preview)
+-- whoami identity + context-usage route
+-- coordination routes (stream / queue / workflow / mission-control)
+-- spec review / spec library routes
+-- whoami identity route
+-- coordination routes (stream / queue / workflow / mission control)
|
v
Framework-free domain services (173 daemon domain files)
Framework-free domain services (431 files under packages/daemon/src/domain)
|
+-- SQLite state (40 migrations)
+-- SQLite state (96 migrations)
+-- tmux / cmux / resume adapters
+-- runtime adapters (Claude Code / Codex / Terminal)
+-- RigEnv substrate (compose adapter, readiness, orchestrator)
+-- runtime adapters (Claude Code / Codex / Pi / Oh My Pi / Stub / Terminal)
+-- rig environment services (compose adapter, service readiness, orchestrator)
+-- transport / transcript / chat / ask layers
+-- whoami identity service
+-- whoami identity service (including context usage)
```
The core product loop: `down (auto-snapshot) → up <rig-name> (auto-restore) →
handoff → inspect/attach → work → repeat`.
> MCP tool count is **17** (`rig_*`) — slice-00 §1.4 confirms the count is
> correct and the names are `rig_*` (NOT `rigged_*`; the `rigged_*` text in
> `architecture.md` §2 is stale — the rename predates v0.2.0). Per-occurrence
> verification of any `rigged_*` reference lands in `transport-and-transcripts.md`
> (D5); the tmux `@rigged_*` metadata keys are a separate axis, not blanket-replaced.
## 2. Database schema
> Drift-fix D3 — `architecture.md` L243 said "27 migrations (22 existing plus
> 5 added by PL-004 Phase A)" and L1002 repeated "27 migrations"; the §1 stack
> diagram L54 said "36 migrations". All corrected to **40** migrations
> (`001`–`040`). Triangulated (slice-00 §1.3, re-confirmed at HEAD): (1)
> filesystem `packages/daemon/src/db/migrations/[0-9][0-9][0-9]_*.ts` → 40
> files, `001_core_schema.ts` … `040_workflow_specs_diagnostic.ts`; (2)
> `startup.ts:206` `migrate(db, [...])` passes a 40-element schema array
> (`coreSchema` … `workflowSpecsDiagnosticSchema`); (3) `migrate.ts:13`
> applies them sorted by name, tracked in `schema_migrations`.
The migrations live in `packages/daemon/src/db/migrations/` (96 files,
`001_core_schema.ts` … `097_thread_part_map.ts`, with no `093`).
`ALL_MIGRATIONS` (`packages/daemon/src/db/all-migrations.ts:107`) lists all 96, and `createDaemon`
applies them with `migrate(db, ALL_MIGRATIONS)` (`startup.ts:298`). `migrate.ts`
sorts them by name (`:29`) and records each applied name in `schema_migrations`
(`:15`).
### Core state tables (`001_core_schema.ts`)
### Core state tables
`rigs` (topology container, `001_core_schema.ts:7`), `nodes` (logical node
identity, `:17`), `edges` (logical topology relationships, `:30`), plus
`bindings` (physical tmux/cmux surface attachment), `sessions` (live execution
state), `events` (append-only event log), `snapshots` (serialized rig state),
`checkpoints` (per-node recovery state). `architecture.md` §3 L247–289.
identity, `:17`) and `edges` (logical topology relationships, `:30`); then
`bindings` (physical tmux/cmux surface attachment) and `sessions` (live
execution state) in `002_bindings_sessions.ts`, `events` (append-only event log)
in `003_events.ts`, `snapshots` (serialized rig state) in `004_snapshots.ts`, and
`checkpoints` (per-node recovery state) in `005_checkpoints.ts`.
### Reboot-era schema
### Pod-aware schema
- `014_agentspec_reboot.ts` — reboot schema shape; adds `pods`,
`continuity_state`, and reboot columns on `nodes`/`sessions`/`checkpoints`
(`pod_id`, `agent_ref`, `resolved_spec_*`, `startup_status`,
`continuity_source`). `architecture.md` §3 L253–289.
- `014_agentspec_reboot.ts` — the pod-aware schema; adds the `pods` and
`continuity_state` tables and pod-aware columns on `nodes`, `sessions` and
`checkpoints`.
- `015_startup_context.ts` — persisted startup replay context for restore.
- `016_chat_messages.ts` — durable rig-scoped chat (SQLite-backed; transcripts
remain filesystem-backed via pipe-pane).
remain filesystem-backed, written by bounded periodic `capture-pane` snapshots;
see `transport-and-transcripts.md`).
- `017_pod_namespace.ts` — first-class authored pod namespace for export/adoption.
- `018_context_usage.ts` — per-node context-usage snapshots.
- `019_external_cli_attachment.ts` — binding-row extension for external CLI attach.
- `020_rig_services.ts` — rig-scoped environment record for service-backed rigs.
- `021_seat_handover_observability.ts`, `022_node_codex_config_profile.ts`.
### Coordination / PL-004 / PL-005 / workspace migrations
### Coordination, workflow, mission control and workspace migrations
- `023_stream_items.ts` … `027_outbox_entries.ts` — PL-004 Phase A
coordination tables (detail in `coordination-primitive.md`).
- `023_stream_items.ts` … `027_outbox_entries.ts` — the coordination tables
(stream, queue, queue transitions, inbox, outbox; detail in
`coordination-primitive.md`).
- `028_project_classifications.ts`, `029_classifier_leases.ts`,
`030_views_custom.ts` — PL-004 Phase B classifier + view tables. (Note:
`architecture.md` L361 said "028 through 030"; the middle migration is
literally `029_classifier_leases.ts` — re-confirmed at HEAD.)
- `031_watchdog_jobs.ts`, `032_watchdog_history.ts` — PL-004 Phase C watchdog.
`030_views_custom.ts` — classifier and view tables.
- `031_watchdog_jobs.ts`, `032_watchdog_history.ts` — watchdog tables.
- `033_workflow_specs.ts`, `034_workflow_instances.ts`,
`035_workflow_step_trails.ts` — PL-004 Phase D Workflow Runtime tables
(detail in `workflow-runtime.md`). `036_watchdog_policy_enum_extension.ts`
is a documenting no-op.
- `037_mission_control_actions.ts` — PL-005 Phase A audit table
(`037_mission_control_actions.ts:54` `CREATE TABLE … mission_control_actions`;
detail in `mission-control.md`).
- `038_workspace_primitive.ts`, `039_queue_target_repo.ts` — PL-007 typed
workspace primitive (`bab24bf7`).
- `040_workflow_specs_diagnostic.ts` — slice-11 (`f68f453a`); an
`ALTER TABLE ADD COLUMN` adding parser/validator diagnostic columns to
`workflow_specs` (no new table). **Net-new since `architecture.md` was last
edited** — slice-00 §1.3 provenance; carried into `workflow-runtime.md`.
`035_workflow_step_trails.ts` — workflow runtime tables (detail in
`workflow-runtime.md`). `036_watchdog_policy_enum_extension.ts` runs no DDL (its
SQL is a no-op `SELECT 1 WHERE 0`); it documents an enum extension.
- `037_mission_control_actions.ts` — the mission control audit table
(`037_mission_control_actions.ts:58`; detail in `mission-control.md`).
- `038_workspace_primitive.ts`, `039_queue_target_repo.ts` — the typed workspace
primitive.
- `040_workflow_specs_diagnostic.ts` — `ALTER TABLE workflow_specs ADD COLUMN`
for parser/validator diagnostics (no new table).
Legacy package/bootstrap/discovery tables (`packages`, `package_installs`,
`install_journal`, `bootstrap_runs`, `bootstrap_actions`,
`runtime_verifications`, `discovered_sessions`) remain active.
Migrations `041`–`092` and `094`–`097` continue in the same directory; list them with
`git ls-files packages/daemon/src/db/migrations`. `095_rig_non_interruptive.ts` adds
`rigs.non_interruptive` (0 or 1, default 0), the saved per-rig choice behind
`rig up --non-interruptive`; `096_rig_install_root.ts` adds `rigs.install_root`, the rig's
bundle materialization folder (`rig-repository.ts:169`). The newest, `097_thread_part_map.ts`,
adds `thread_part_map`, which maps each message OpenRig posts into an ask's Slack thread to
that ask and its seat.
The package, bootstrap and discovery tables remain: `packages`
(`008_packages.ts`), `package_installs` and `install_journal`
(`009_install_journal.ts`), `bootstrap_runs`, `bootstrap_actions` and
`runtime_verifications` (`011_bootstrap.ts`), and `discovered_sessions`
(`012_discovery.ts`).
## 3. Route-mount surface
`createApp(deps)` (`packages/daemon/src/server.ts:295`) mounts **49**
`app.route()` route-group mounts (`server.ts` L450–513) plus 4 dedicated
non-route handlers: `GET /healthz` (`:446`), `GET /api/rigs/:rigId/spec`
(`handleExportYaml`, `:461`), `GET /api/rigs/:rigId/spec.json`
(`handleExportJson`, `:462`), and the static/deep-link `app.get("*")`
catch-all (`:519`).
`createApp(deps)` (`packages/daemon/src/server.ts:442`) mounts **69**
`app.route()` route groups (`server.ts:723`–`839`) plus direct handlers:
`GET /healthz` (`:664`), `GET /api/rigs/:rigId/spec` (`handleExportYaml`,
`:735`), `GET /api/rigs/:rigId/spec.json` (`handleExportJson`, `:736`), a JSON
`404 not_found` for any other `/api/*` path (`:844`), and the static/deep-link
`app.get("*")` catch-all (`:853`).
> OPEN-2 (carried verbatim, slice-00): the route-group "count" is definitional
> — "49" is the count of `app.route()` mounts in `server.ts`. The older
> "31 route groups" / "createApp now mounts 22 route groups" framing
> (`architecture.md` L40,76) used a different, smaller accounting. Independent
> corroboration: `packages/daemon/src/routes/` has 46 non-test route `.ts`
> files (some groups composed from shared modules; the 49 mounts are the
> authoritative count of mounted groups — slice-00 §1.5).
The 69 is the count of `app.route(` lines in `server.ts`; `packages/daemon/src/routes/`
has 68 files, 65 of which create a Hono router.
Mount families include reboot-era rig/session/spec routes plus the coordination
routes (`/api/stream` `server.ts:489`, `/api/queue` `:490`,
`/api/workflow` `:495`, `missionControlRoutes(...)` `:498`),
`/api/health-summary` (`:511`), `/api/rigs/:rigId/env` (`:512`), and
`/api/restore-check` (`:513`).
Mount families include the rig, session and spec routes plus the coordination
routes (`/api/stream` `server.ts:783`, `/api/queue` `:784`, `/api/workflow`
`:789`, `missionControlRoutes(...)` `:792`), `/api/seat` (`:781`, the seat
lifecycle verbs such as handover, launch, continue, stop and the typing guard),
`/api/startup` (`:747`), `/api/terminal` (`:809`), `/api/telemetry` (`:822`),
`/api/health-summary` (`:829`), `/api/rigs/:rigId/env` (`:835`) and
`/api/restore-check` (`:836`). List every mount with
`grep -n 'app.route(' packages/daemon/src/server.ts`.
Before the routes, `createApp` installs middleware in this order: the request-phase
observer (`:497`), JSON body-parse error tracking, which turns a malformed body into
`400 invalid_json` (`:499`), dependency injection, route timing, slow-operation
recording, the browser boundary on `/api/*` (`:647`, Host and Origin checks; see
`OPENRIG_ALLOWED_HOSTS` and `OPENRIG_ALLOWED_ORIGINS`), and host read-through.
`createAppWithWebSocket(deps)` (`server.ts:893`) sets `enableNodeWebSocket` and
calls `createApp`; the terminal WebSocket is registered only when the web UI is
also enabled (`server.ts:756`). Otherwise only its bearer-auth handler is
registered (`registerTerminalAuthOnly`, `:762`).
## 4. Startup sequence (`createDaemon`)
`createDaemon(opts?)` is `packages/daemon/src/startup.ts:203` (async,
returns `DaemonResult`). It returns `{ app, db, deps, contextMonitor }`
(`startup.ts:1204`). The sequence (`architecture.md` §9 L1000–1028,
corrected against source):
`createDaemon(opts?)` is `packages/daemon/src/startup.ts:287` (async, returns
`DaemonResult`). It returns `{ app, db, deps, contextMonitor, eventLoopMonitor,
injectWebSocket }` (`startup.ts:2506`). In source order, it:
1. Open SQLite and run **all 40 migrations** (`startup.ts:206`
`migrate(db, [coreSchema … workflowSpecsDiagnosticSchema])` — a 40-element
array; `architecture.md` L1002 said "27 migrations (22 existing plus the 5
PL-004 Phase A coordination tables)" — corrected to 40, drift-fix D3).
2. Construct core repositories and legacy services.
3. Construct package/bootstrap/discovery services.
4. Construct rebooted startup/runtime services: `StartupOrchestrator`,
`ClaudeCodeAdapter`, `CodexRuntimeAdapter`, `TerminalAdapter`,
`PodRigInstantiator`, `PodBundleSourceResolver`.
5. Construct rig environment services: `ComposeServicesAdapter`,
`ServiceOrchestrator`.
6. Construct operator/transport/history services: `TranscriptStore`,
`SessionTransport`, `ChatRepository`, `AskService` (with `HistoryQuery`),
`ResumeMetadataRefresher`, `ContextUsageStore`, `ContextMonitor`,
`NodeInventory`.
7. Construct authoring/identity/managed-app services: `SpecReviewService`,
`SpecLibraryService`, `WhoamiService`.
8. Construct `BootstrapOrchestrator` with both legacy and rebooted seams.
9. Construct PL-004 Phase A coordination services from a shared
`QueueRepository` instance (so `InboxHandler.absorb()` and `/api/queue`
write to the same repo): `StreamStore`, `QueueRepository`, `InboxHandler`,
`OutboxHandler`.
10. Build `AppDeps`, enforce shared-DB invariants, and call
`createApp(deps)` (`startup.ts:1202`) to mount the full route tree.
1. Opens SQLite and applies all 96 migrations (`migrate(db, ALL_MIGRATIONS)`,
`startup.ts:298`).
2. Constructs the coordination stores early: `StreamStore` (`:330`),
`QueueRepository` (`:428`) and `OutboxHandler` (`:443`).
3. Constructs `TranscriptStore` (`:555`) and the rig environment services
`ComposeServicesAdapter` and `ServiceOrchestrator` (`:644`–`645`).
4. Constructs `StartupOrchestrator` (`:776`) and the runtime adapters:
`ClaudeCodeAdapter` (`:778`), `CodexRuntimeAdapter` (`:779`),
`PiRuntimeAdapter` (`:782`), `OmpRuntimeAdapter` (`:783`) and
`StubRuntimeAdapter` (`:788`); the terminal adapter is created inline in the
runtime adapter maps (`:989`, `:1259`).
5. Constructs `PodRigInstantiator` (`:985`), `PodBundleSourceResolver` (`:1014`)
and `BootstrapOrchestrator` (`:1016`).
6. Constructs `ContextUsageStore` (`:1095`), `ResumeMetadataRefresher`
(`:1129`), `SpecReviewService` (`:1154`) and `WhoamiService` (`:1157`).
7. Builds `AppDeps` (`const deps: AppDeps`, `:1191`). `SessionTransport`
(`:1262`), `ChatRepository` (`:1296`), `InboxHandler` (`:1300`), `AskService`
(`:1349`) and `SpecLibraryService` (`:1387`) are constructed inside that
object literal. `InboxHandler` receives the same queue repository instance
(`queueRepoInstance`) that serves `/api/queue`, so absorbed inbox items and the
queue route write to one store.
8. Constructs `ContextMonitor` (`:2407`), then assigns later fields onto `deps`
(among them the terminal service, the request-phase observer and the gateway
subsystem).
9. Calls `createAppWithWebSocket(deps)` (`startup.ts:2504`) to mount the full
route tree.
The daemon entrypoint `packages/daemon/src/index.ts:36` calls
`createDaemon({ dbPath, bearerToken })`.
Node inventory is a set of functions (`getNodeInventory` and friends in
`domain/node-inventory.ts`), imported where needed rather than constructed at
startup.
## 5. Test and verification state
The daemon entrypoint `packages/daemon/src/index.ts:306` calls
`createDaemon({ dbPath, bearerToken, terminalBearerToken, … })`.
> Drift-fix D7 / OPEN-3 (carried verbatim, slice-00): `architecture.md` L12,13
> and §10 L1036–1046 assert daemon `2561/2561` / CLI `794/794` / total
> `2422/2422` test pass counts and per-package file counts (`127`/`37`/`37`).
> **These are runtime claims and are NOT re-run here** — a read-only static
> trace counted `*.test.ts` files only: daemon **255**, cli **234**
> (slice-00 §1.7; ui test-file count not separately gathered). Pass tallies
> are marked `unverified-runtime-claim`; do not assert them as current. To
> assert pass counts, run `pnpm/npm test` and re-verify.
## 5. Test files
A static count of tracked test files at `e8f0ab340db773392ec8be75b072d1c0f3068a50` (no pass counts are claimed
here; CI runs the suites in `.github/workflows/tests.yml`): daemon **927**,
CLI **261**, web UI **198**, TUI **105**
(`git ls-files 'packages/<package>/**/*.test.ts' 'packages/<package>/**/*.test.tsx' | wc -l`).
## See also
- `coordination-primitive.md` — PL-004 Phase A stream/queue/inbox/outbox.
- `ARCHITECTURE.md` (repository root) — what OpenRig is and where to add things.
- `coordination-primitive.md` — the stream/queue/inbox/outbox coordination layer.
- `agent-spec-and-startup.md` — spec parsing/resolution/startup contract.
- `lifecycle-snapshot-restore.md` — snapshot/restore/continuity.
- Source roots: `packages/daemon/src/{startup.ts,server.ts,index.ts}`,
`packages/daemon/src/db/{all-migrations.ts,migrate.ts}`,
`packages/daemon/src/db/migrations/`, `packages/cli/src/index.ts`.
@@ -6,12 +6,13 @@ topics: [continuity, runtime-control]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Need to know how OpenRig captures a snapshot, restores a rig (resume vs
rebuild vs fresh), enforces restore honesty, consults live continuity state,
or how the daemon-side restore-check / restore-packet readiness probes work.
rebuild vs fresh-primed vs stop-and-ask), enforces restore honesty, consults
live continuity state, or how the daemon-side restore-check readiness probe
and the CLI restore-packet command work.
siblings: [daemon-core.md, agent-spec-and-startup.md, transport-and-transcripts.md]
prerequisite-reads: [../README.md, agent-spec-and-startup.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Lifecycle — Snapshot, Restore, Continuity
@@ -21,194 +22,380 @@ The durable-state half of the core product loop:
captures serialized rig state; restore replays it honestly (no silent
fresh-fallback); restore-check is a separate read-only readiness probe.
> Verified against source at HEAD `7eaf524c` (`git describe` →
> `v0.3.1-6-g7eaf524c`). Package version **0.3.1** (slice-00 §1.1). Source
> located by `architecture.md` headings (§4 Execution and restore, §5
> Snapshot/restore/continuity, §6 Snapshot/restore + Auto-snapshot, §7 rules)
> per slice-08 §10.1 — line numbers advisory only. This module is a pure
> split EXCEPT §6 (restore-check/restore-packet) which is the D15
> author-from-source piece — flagged explicitly there.
> Verified against source at main `e8f0ab340db773392ec8be75b072d1c0f3068a50`. Each count below sits beside the
> command that produces it; run the command from the repository root to refresh
> it.
## 1. Snapshot / restore / continuity types
(`architecture.md` §4 "Execution and restore" — spec/projection members live
in `agent-spec-and-startup.md`; the snapshot/restore members live here)
All in `packages/daemon/src/domain/types.ts`. The spec/projection types live in
`agent-spec-and-startup.md`; the snapshot/restore types live here.
- **NodeRestoreOutcome** — `"resumed" | "rebuilt" | "fresh" | "failed" |
"n-a"` — the locked restore vocabulary. Re-confirmed at source:
`restore-orchestrator.ts:725-726` sets `baseStatus = "resumed"` on a
resumed harness; `:763` sets `"rebuilt"` when a checkpoint is replayed; the
outcome union appears at `:944` (`{ kind: "resumed" }` … ).
- **SnapshotData** — current serialized snapshot payload. Reboot extensions
are optional for older-snapshot compatibility: `pods?`,
`continuityStates?`, `nodeStartupContext?`.
- **NodeStartupSnapshot** — persisted restore replay input:
- **NodeRestoreOutcome** (`types.ts:500`) — the per-node restore outcome
projected into `rig ps`. **9** values
(`grep '^export type NodeRestoreOutcome' packages/daemon/src/domain/types.ts | grep -o '"[^"]*"' | wc -l`):
`resumed`, `rebuilt`, `fresh`, `fresh-primed`, `awaiting-decision`,
`failed`, `attention_required`, `operator_recovered`, `n-a`. The restore
result itself, `RestoreNodeResult.status` (`types.ts:475`), has the same
values without `n-a`: **8**
(`grep -E '^ status: "resumed"' packages/daemon/src/domain/types.ts | grep -o '"[^"]*"' | wc -l`).
Where `restore-orchestrator.ts` sets each one:
- `resumed` — `baseStatus = "resumed"` after a legacy resume (`:1030`); the
status is returned only by `finishJoinedResume` (defined `:1320`, called
`:1244` and `:1311`, returning `resumed` at `:1380`) after it has rebound
and verified the pane; otherwise that becomes `attention_required`
(`:1352`, `:1376`).
- `rebuilt` — a checkpoint file was written (`:1090`).
- `fresh-primed` — the default for a deliberate non-resume launch
(`:987`).
- `fresh` — only the skip path for a pod node whose live continuity state
is already `restoring` (`:785`).
- `awaiting-decision` — the seat could not resume and nothing is running:
before launch (`:820`), or after launch once the blank session is rolled
back (`:1026`, `:1048`, `:1061`, `:1077`, `:1236`).
- `attention_required` — a live session waiting on a runtime prompt
(`:1039`, `:1262`) or a harness that never started (`:1125`).
- `failed` — occupant ambiguity (`:772`, `:969`), launch failure (`:911`),
a checkpoint that cannot be delivered (`:1086`, `:1092`), a missing
required startup file (`:1161`), or a startup error (`:1271`, `:1282`,
`:1292`, `:1300`).
- `operator_recovered` — only from later reconciliation,
`reconcileNodeRuntimeTruth` (`:1590`, event at `:1727`).
- **RestoreRigResult** (`types.ts:444`) — the rig-level rollup, **4** values
(`grep '^export type RestoreRigResult' packages/daemon/src/domain/types.ts | grep -o '"[^"]*"' | wc -l`):
`fully_restored`, `partially_restored`, `failed`, `not_attempted`.
`rollupRestoreRigResult` (`restore-orchestrator.ts:81`) produces only the
first three; `not_attempted` is set when pre-restore validation fails
(`:281`).
- **SnapshotData** (`types.ts:351`) — the serialized snapshot payload. It has
**7** optional fields, kept optional so older snapshots still load
(`sed -n '/^export interface SnapshotData/,/^}/p' packages/daemon/src/domain/types.ts | grep -c '?:'`):
`activeSessionIdByNode?`, `activeOccupantsByNode?`, `topologyRoster?`,
`pods?`, `continuityStates?`, `nodeStartupContext?`, `envReceipt?`.
- **NodeStartupSnapshot** (`types.ts:344`) — persisted restore replay input:
classification-free projection entries, resolved startup files, startup
actions, runtime.
- **PersistedProjectionEntry** — the classification-free restore replay seam:
persists only entry identity + source metadata, NOT stale `classification`,
`conflicts`, or `noOps` (Architecture Rule 10).
- **PersistedProjectionEntry** (`types.ts:332`) — the classification-free
restore replay seam: persists only entry identity + source metadata, NOT
stale `classification`, `conflicts`, or `noOps` (Architecture Rule 10).
Restore rebuilds each entry as `safe_projection` with empty `conflicts` and
`noOps` (`restore-orchestrator.ts:1177`, `:1182`, `:1183`).
## 2. Snapshot, restore, continuity domain services
(`architecture.md` §5 "Snapshot, restore, and continuity")
All under `packages/daemon/src/domain/`:
- `checkpoint-store.ts` — checkpoint persistence with pod/continuity context.
- `snapshot-capture.ts` — captures pods, continuity state, startup replay
context, and latest env receipt. Re-confirmed: `snapshot-capture.ts:66-77`
pulls `pods`, `continuity_state`, and `node_startup_context` rows per rig.
- `snapshot-repository.ts` — snapshot CRUD.
context, the latest env receipt, the active-occupant maps and the intended
topology roster. `captureSnapshot` (`:60`) derives the occupant maps
(`:73–79`), resolves the roster (`:81–90`), then reads `pods` (`:96`),
`continuity_state` (`:100`) and `node_startup_context` (`:106`) rows per rig
and the env receipt (`:116–123`).
- `snapshot-repository.ts` — snapshot CRUD and restore-source selection:
`findLatestRestoreUsable` (`:72`) and `selectRestoreUsable` (`:94`), which
accept only snapshots that pass `isRestoreUsableSnapshotData` (`:250`).
- `restore-orchestrator.ts` — resume, checkpoint delivery, startup replay,
live continuity consultation, topology ordering, and RigEnv boot gating
before agent restore.
live continuity consultation, topology ordering (`computeRestorePlan`,
`:676`, ordering only `delegates_to` and `spawned_by` edges, `:71`, among
the roster's intended nodes, `:677`), and service boot gating before agent
restore (`serviceOrchestrator.boot`, `:331`).
- `restore-preconditions.ts` — `validatePreRestore` (`:7`), the one
pre-restore validation shared by restore and restore-check (§3, §5.1).
- `restore-topology.ts` — `resolveSnapshotRestoreTopology` (`:12`), which
splits a snapshot's nodes into intended and excluded (§3).
- `restore-attempt-receipt.ts` — `deriveRestoreAttemptReceipt` (`:42`), the
read-only per-attempt receipt (§4).
- `rehydrate-eligibility.ts` — `snapshotMatchesCurrentOccupants` (`:20`) and
`assessCurrentStateRehydrateEligibility` (`:69`), shared by `routes/up.ts`
and `routes/restore-check.ts`.
- `active-occupant.ts` — the shared rule for which snapshot session row is a
node's occupant (`resolveActiveSnapshotSession`, `:73`).
## 3. Restore flow and restore honesty
(`architecture.md` §6 "Snapshot / restore" + §7 rules 7/14/15/16)
Restore behavior, each point checked in `restore-orchestrator.ts`:
Restore behavior, each point re-confirmed at `restore-orchestrator.ts`:
- Reads the newest session by **monotonic ULID**, not timestamp alone
(`:700` — "Find the NEWEST session for this node. ULIDs are monotonic, so
latest = max id").
- Selects the snapshot with `selectRestoreUsable` even when a snapshot id is
given (`:251–252`), so wrong-rig and unusable snapshots are refused before
any mutation. The selection (`RestoreSnapshotSelection`, `types.ts:396`)
records whether it was explicit or automatic, why, and any newer usable
alternative; it is carried on the result and on `restore.started`.
- Restores only the nodes the snapshot's topology roster intends
(`SnapshotData.topologyRoster`, `types.ts:370`). The roster comes from the
latest `topology.roster_recorded` event (`snapshot-capture.ts:171`), from
`rig snapshot <rigId> --intended-seats` (`packages/cli/src/commands/snapshot.ts:20`),
or, for older snapshots, all current nodes. `resolveSnapshotRestoreTopology`
(`restore-topology.ts:12`) reports every other node as excluded with reason
`historical_not_in_intended_roster` (`:27`); the result carries
`intendedRoster` and `excludedNodes` (`types.ts:440–441`).
- Resolves each node's occupant from the snapshot's recorded active-occupant
maps, not by picking the newest session row
(`resolveActiveSnapshotSession`, `active-occupant.ts:74`, called at
`restore-orchestrator.ts:774` and `:971`). An ambiguous occupant fails the
node loudly (`activeOccupantAmbiguityError`, `active-occupant.ts:97`).
- Consults live `continuity_state`; preserves state when a node is already
`restoring` (`:611-615` — `SELECT status FROM continuity_state …`; if
`status === "restoring"` the node is skipped with a warning).
`restoring` (`:777–791` — `SELECT status FROM continuity_state …` at
`:780`; if `status === "restoring"` the node is skipped with a warning and
reported as `fresh`, `:783–785`; `degraded` only adds a warning).
- Reuses the seat's durably bound tmux session name when the prior binding
has a usable one (`:840`), and otherwise falls back to the derived name
with a warning (`:869`).
- Replays restore-safe startup using persisted startup context;
prefilters missing optional artifacts into warnings; **hard-fails a node if
a required startup file is missing** (`:799` — status `"failed"`, error
"Missing required startup files: …").
- Writes a **transcript boundary marker before re-launch** (`:652` — "Write
transcript boundary marker BEFORE launch (before pipe-pane attaches)").
- Refuses to restore over live sessions (`:168` — `rig_not_stopped`: "Rig …
has live sessions. Stop the rig with 'rig down' before restoring").
- Uses `nativeResumeProbe` to honestly assess whether the harness actually
resumed (`:857` continuity-outcome reconciliation).
a required startup file is missing** (`:1161` — status `"failed"`, error
"Missing required startup files: …"). Before any mutation,
`validatePreRestore` (`restore-preconditions.ts:7`, called from
`RestoreOrchestrator.restore`) finds a node that will consume replay and is
missing a required startup file (`required_startup_file_missing`, or
`startup_owner_root_missing`). Restore holds only that node: it is not
launched and is reported `failed` ("Not launched: …" with the blocker's
message and remediation), and the rest of the rig restores. When every node
the restore would launch is held, or for any other blocker, the whole restore
stops before any mutation (outcome `pre_restore_validation_failed`). Its other
blockers are `invalid_snapshot_data` (`restore-preconditions.ts:27`),
`invalid_topology_roster` (`:78`), `checkpoint_missing_node_cwd` (`:91`),
`service_rig_root_missing` (`:187`) and `service_compose_file_missing`
(`:197`). The `/api/up` route returns
that outcome as HTTP 409 with `status: "not_attempted"`
(`routes/up.ts:162`). A node that resumes its exact native session replays
no startup files, actions, guidance or skills (`replayContained`,
`restore-orchestrator.ts:1114`); its saved Claude activity-hook selection
is reapplied before native resume. A skipped hook reapply adds a warning
without changing the restore outcome.
- Writes a **transcript boundary marker before re-launch**
(`writeBoundaryMarker`, `:900`, called before `launchNode` at `:911`) when
the transcript store is enabled.
- Refuses to restore over live sessions (`:259–262` — `rig_not_stopped`: "Rig …
has live sessions. Stop the rig with 'rig down' before restoring, or use the
latest auto-pre-down snapshot."). A tmux probe that fails also blocks it
(`classifyRunningSessions`, `:612`).
- Checks that the harness actually resumed. The resume adapters judge the
pane with `assessNativeResumeProbe` (`domain/native-resume-probe.ts:84`). A
pod-aware resume counts as resumed only when startup reports `resumed`
continuity or the launched session row carries the snapshot's resume type
and token (`launchedSessionMatchesSnapshotResume`,
`restore-orchestrator.ts:1390`); a reported `fresh` continuity without that
proof rolls back to `awaiting-decision` (`:1228–1245`).
- Saves a `rig up --non-interruptive` or `--no-non-interruptive` choice on
the rig only after the live-session check and pre-restore validation pass
(`:301`); see [adapters-and-runtimes.md](adapters-and-runtimes.md) for the
launch flags.
**Restore-honesty rules (carried verbatim, `architecture.md` §7):**
`launchNodeSubset` (`:392`) and `launchSingleNode` restore chosen seats rather
than the whole rig; unlike a full restore, a failed tmux probe there proceeds
with a `liveness_probe_unknown` warning (`:517`).
- Rule 7 — restore-policy narrowing is one-way only:
`resume_if_possible` → `relaunch_fresh` → `checkpoint_only`.
- Rule 14 — resume states are locked: `resumed` / `rebuilt` / `fresh`.
`rebuilt` = new process assembled from artifacts.
- Rule 15 — failed resume is FAILED loudly. No automatic fresh fallback.
Fresh launch is explicit follow-up only.
- Rule 16 — post-command handoff required on `up`, `down`, `restore`,
`snapshot create`: what happened + current state + next action.
**Restore-honesty rules** (texts in `architecture-rules-and-event-system.md`;
cited here by number with the code that carries them):
(The full 25-rule list lives in `architecture-rules-and-event-system.md`.)
- Rule 7 — `RESTORE_POLICY_LEVEL`
(`packages/daemon/src/domain/profile-resolver.ts:106`) orders the three
policies, and `resolveRestorePolicy` (`profile-resolver.ts:589`) rejects a
profile or member value that broadens it.
- Rule 14 — the outcome set is `RestoreNodeResult.status` (`types.ts:475`,
§1); `rebuilt` is set only when a checkpoint is written
(`restore-orchestrator.ts:1097`).
- Rule 15 — in `restore-orchestrator.ts`, a `resume_if_possible` seat with a
session but no token stops as `awaiting-decision` before launch unless
`--fresh` names it (`:812–831`); a failed resume kills the blank session
(`rollbackToZeroSession`, `:940`) and returns `awaiting-decision`
(`:1055`); pod-aware resume passes
`allowFreshFallback: !(isPodAware && resumeRequested)` (`:1224`). Fresh
launch is explicit: `rig up --existing <rig> --fresh <seats...>`
(`packages/cli/src/commands/up.ts:99`). On a terminal, `rig up` asks
yes or no for each `awaiting-decision` seat and re-posts with the accepted
seats as fresh (`up.ts:589`).
- Rule 16 — `rig down` prints the snapshot id and a restore command
(`packages/cli/src/commands/down.ts:293–303`); `rig up` on an existing rig
prints per-node statuses and the attach command
(`packages/cli/src/commands/up.ts:554–587`).
(The full rule list lives in `architecture-rules-and-event-system.md`.)
## 4. Auto-snapshot and existing-rig power-on
(`architecture.md` §6 "Auto-snapshot and existing-rig power-on")
- `rig down <rig>` (name or id, `packages/cli/src/commands/down.ts:144`)
first prints the rig's recorded agent sessions and their activity, best
effort and only without `--json` (`showAgentsBeforeDown`, `down.ts:28`), then
auto-captures an `auto-pre-down` snapshot before teardown when the rig has
live sessions (`packages/daemon/src/domain/rig-teardown.ts:117`, capture
at `:128`, after refreshing resume metadata at `:119`; an already-stopped
rig returns at `:93–115` without one).
- `rig up <rig-name>`: a source with no `/` and no
`.yaml`/`.yml`/`.rigbundle`/`.rigtopology` extension is a rig name
(`packages/daemon/src/domain/up-command-router.ts:49–50`). The CLI refuses
a name that matches only archived rigs, with `rig unarchive` guidance
(`packages/cli/src/commands/up.ts:256`). It then checks the spec library
unless `--existing` is given, and refuses a name that matches both
(`up.ts:306–325`); when `first-project` resolves to the built-in `starter`
spec, the archived and existing-rig checks also apply to `starter`
(`up.ts:314–317`). The daemon finds the rig by name, preferring unarchived
rigs (`packages/daemon/src/routes/up.ts:223–226`), and restores from
`selectRestoreUsable` (`routes/up.ts:106`), which prefers the newest
`auto-pre-down` or `auto-periodic` snapshot, then the newest other usable
one (`snapshot-repository.ts:75`).
- `rig up <rig-name> --plan` is a read-only restore preview that never
captures a snapshot (`routes/up.ts:127`).
- If no usable snapshot exists, or the chosen one names an older occupant
(`snapshotMatchesCurrentOccupants`, `routes/up.ts:110`), `rig up` captures
an `auto-rehydrate` snapshot of current DB state when that state is
eligible (`routes/up.ts:137–146`). Otherwise it errors with code
`no_snapshot` and guidance ("… current DB state is insufficient for
rehydrate. Start fresh with: rig up <spec-path>", `routes/up.ts:118–123`).
- Post-command handoff: `down` output includes the snapshot ID and
`To restore: rig up <name>` (or `rig restore <snapshotId> --rig <rigId>`
when the name is not unique); `up` output includes node statuses and an
`Attach:` command (anchors under Rule 16 above).
- `rig restore status <attemptId> --rig <rigId>`
(`packages/cli/src/commands/restore.ts:120`) reads
`GET /api/rigs/:rigId/restore/status/:attemptId`
(`packages/daemon/src/routes/snapshots.ts:76`). `deriveRestoreAttemptReceipt`
(`restore-attempt-receipt.ts:42`) folds that attempt's events into a
per-node view without writing anything.
- `rig down <rigId>` auto-captures an `auto-pre-down` snapshot before
teardown.
- `rig up <rig-name>` (no file extension) searches for an existing rig by
name and restores from the latest `auto-pre-down` snapshot.
- If no snapshot: error with guidance ("No saved snapshot for rig 'X'. Boot
from a spec or bundle path.").
- Post-command handoff: `down` output includes snapshot ID + restore command;
`up` output includes node statuses + attach command.
### Single-seat recovery and handover
## 5. Daemon-side restore-check / restore-packet — AUTHORED FROM SOURCE (D15)
- **`rig seat continue <seat>`** — when a fresh launch stops at a native
prompt before its startup context is delivered, the startup orchestrator
fails it as `attention_required` and adds "run: rig seat continue
<session>" (`startup-orchestrator.ts:822`). The command
(`packages/cli/src/commands/seat.ts:816`) calls
`POST /api/seat/continue/:seatRef` (`routes/seat.ts:367`), which runs
`continueStartup` (`seat-lifecycle-service.ts:723`): it re-checks the
binding, pane and runtime, then delivers the pending context to the same
conversation without relaunching. In a restore, a pod-aware seat in this
state reports `attention_required` (`restore-orchestrator.ts:1265`). See
[agent-spec-and-startup.md](agent-spec-and-startup.md) for the startup side.
- **Per-seat startup decision** — `POST /api/startup/:rigId/:logicalId`
(`routes/startup.ts:142`) takes `resume`, `start`, `fresh` or `continue`
for one seat. `resume` captures an eligibility-checked `auto-rehydrate`
snapshot when none exists and goes through `launchSingleNode`.
- **Seat handover** — `rig seat handover <seat> --source
fresh|rebuild|fork:<id>|discovered:<id> --reason <reason> [--dry-run]`
(the reason is required, dry run included; without it the command exits 2
before contacting the daemon)
(`packages/cli/src/commands/seat.ts:364`) calls
`POST /api/seat/handover/:seatRef` (`routes/seat.ts:94`), which runs
`SeatHandoverService.handover` (`seat-handover-service.ts:266`).
`SuccessorSessionLauncher` (`successor-session-launcher.ts:92`) respawns
the same pane in place, so the session name stays the same. The fresh
source delivers a daemon-built restore packet (`buildRestorePacket`,
`seat-handover-service.ts:1151`), which is separate from the CLI
`rig restore-packet` below. The rebuild source primes from the seat's
durable chain (`buildRebuildPrimingChain`, `rebuild-priming-chain.ts:22`).
> **D15 author bit (flagged per slice-08 §4.7 binding):** `restore-check` and
> `restore-packet` have NO `architecture.md` narrative. This section is the
> one author-from-source piece in this otherwise pure-split module — authored
> at the slice-00 forensic bar from `routes/restore-check.ts` +
> `domain/restore-check-service.ts` + `commands/restore-packet.ts`, file:line
> cited, version-attribution forensically checked.
>
> **Version attribution (forensic):** restore-check is NOT a 0.3.1 feature.
> `routes/restore-check.ts` first-created `277e279c` ("feat: native rig
> restore-check command", 2026-04-23, pre-0.3.0); present at both `v0.3.0`
> and `v0.3.1` git trees (`git ls-tree` confirmed). `restore-packet`
> first-created `23f2921e` ("Restore-Packet vertical M2a", 2026-05-01),
> likewise present at v0.3.0 and v0.3.1. The gap is missing
> architecture.md *prose*, not a version-attribution drift.
## 5. Daemon-side restore-check and CLI restore-packet
### 5.1 `rig restore-check` — readiness probe
`GET /api/restore-check?rig=<name>&noQueue=<bool>&noHooks=<bool>`
(`routes/restore-check.ts:131`). The route assembles a framework-free
`RestoreCheckDeps` (`:138-168`) over existing daemon projections —
`listRigs` from `rigRepo`, `getNodeInventory` (joining `node_id` by
`logical_id`, `:21-26,143-149`), `getStartupContext` (reads
`GET /api/restore-check?rig=<name>&noQueue=true&noHooks=true&compact=1&ready=1`
(`routes/restore-check.ts:220–221`). The route calls
`createRestoreCheckService` (`:151`), which assembles a framework-free
`RestoreCheckDeps` (`:155–216`) over existing daemon projections —
`listRigs` from `rigRepo` (`:175–178`), `getNodeInventory` (joining
`node_id` by `logical_id`, `:26–31`, `:179–185`), `getStartupContext` (reads
`node_startup_context`, parses `projection_entries_json` /
`resolved_files_json` / `startup_actions_json`, `:44-128`), `hasSnapshot`
/ `getLatestSnapshot` from `snapshotRepo`, and `probeDaemonHealth`
(self-evident: "We're inside the daemon — if this route is responding,
daemon is healthy", `:160-163`). It then runs
`new RestoreCheckService(deps).check(...)` (`:170-171`).
`resolved_files_json` / `startup_actions_json`, `:49–143`), `hasSnapshot`
/ `getLatestSnapshot` from `snapshotRepo` (`:189–195`), `getRestoreInputs`
(`:196–207`), `probeQueueStore` (`:158–170`), `getClaudeActivityHookEvents`
(`:171–174`), and `probeDaemonHealth` (self-evident: "We're inside the
daemon — if this route is responding, daemon is healthy", `:208–211`). It
then runs `service.check(...)` (`:231–232`).
`RestoreCheckService.check()` (`restore-check-service.ts:244`) layers:
`RestoreCheckService.check()` (`restore-check-service.ts:259`) layers:
1. **Host checks** — `checkDaemonReachable` (probe-throw → `verdict:
unknown`, NOT `not_restorable`, `:252-259`), `checkStateDirWritable`
(`:261`), `checkHostInfraDeclaration` (`:262`, impl `:406`).
2. **Rig enumeration** — `listRigs()` throw → `buildUnknown` (`:267-274`);
`--rig` filter; unknown rig → red `rig.<name>.exists` (`:276-284`).
3. **Per-rig checks** — `checkSnapshot` (`:290`, impl `:675`),
`checkSpecPresent` (`:295`).
4. **Per-seat checks** — `checkSeatReadiness` (`:311`), `checkStartupContext`
(`:315`, impl `:763`; `unknownChecks` → `buildUnknown`),
`checkTranscript` (`:325`), `checkResumePath` (`:329`), and unless opted
out: `checkQueueFile` (`:334`, gated by `--no-queue`, impl `:870`) and
`checkHooks` (`:339`, gated by `--no-hooks`, impl `:896`).
5. **Verdict** — `buildResult` aggregates: any red → `not_restorable`; any
yellow → `restorable_with_caveats`; else `restorable`; probe-uninspectable
→ `unknown` (`:1074-1085`, `:1362-1379`). Plus a `RecoveryPlan`
(`buildRecovery`, `:1186`) and a `RepairStep[]` packet
(`buildRepairPacket`, `:1392`; `null` when fully restorable).
unknown`, NOT `not_restorable`, `:270–280`), `checkStateDirWritable`
(`:282`, impl `:498`), `checkHostInfraDeclaration` (`:283`, impl `:515`).
2. **Rig enumeration** — `listRigs()` throw → `buildUnknown` (`:286–295`);
`--rig` filter; unknown rig → red `rig.<name>.exists` (`:297–305`).
3. **Per-rig checks** — `checkSnapshot` (`:311`, impl `:784`),
`checkSpecPresent` (`:316`, impl `:1161`), and
`rig.<name>.restore-preconditions` (`checkRestorePreconditions`, `:338`,
impl `:422`). The last runs the same `validatePreRestore` that restore
runs (`:446`) on the inputs from `getRestoreInputs`: red on a blocker,
yellow on a warning, green otherwise. Without a usable snapshot it is
yellow when current-state rehydrate is eligible and red when it isn't;
when the inputs can't be read it is yellow and the rig's rollup becomes
`unknown` (see Verdict). The rig-status route sets
`recoveryOnly` (`routes/rigs.ts:272`), which skips this check when every
seat is ready (`restore-check-service.ts:337`).
4. **Per-seat checks** — `checkSeatReadiness` (`:346`), `checkStartupContext`
(`:360`, impl `:886`; `unknownChecks` → `buildUnknown`, `:361–366`),
`checkTranscript` (`:382`), `checkResumePath` (`:386`), and unless opted
out: the daemon SQLite `queue_items` availability probe `checkQueueStore`
(`:390–394`, gated by `--no-queue`; impl `:1007`) and `checkHooks`
(`:395–399`, gated by `--no-hooks`; impl `:1030`). Queue continuity is
represented by the shared daemon store; an empty queue is valid
(`routes/restore-check.ts:160–163`). Claude hook readiness follows the
persisted `claude_activity_hooks` runtime-resource selection
(`restore-check-service.ts:1053–1060`) and the adapter's projection: the
hook settings in the seat CWD and the activity relay under the OpenRig
home's `state/claude-activity-hooks/` (`restore-check-service.ts:1071–1072`). A seat
that deliberately omits that resource is not applicable. In compact mode
without `ready=1`, a seat whose readiness check is green gets only the
startup-context check (`restore-check-service.ts:358`, `:368–380`); that
check still counts toward the verdict.
5. **Verdict** — `buildResult` (`:1205`) aggregates: any red →
`not_restorable`; else any rig rollup with status `unknown` → `unknown`
(`:1223–1224`); else any yellow → `restorable_with_caveats`; else
`restorable` (`:1220–1229`). A rig rollup is `unknown` when its restore
inputs could not be read (`:1549–1551`). A probe that can't be inspected
at all also gives `unknown` (`buildUnknown`, `:1238`). Plus a
`RecoveryPlan` (`buildRecovery`, `:1342`) and a `RepairStep[]` packet
(`buildRepairPacket`, `:1581`; `null` when fully restorable, `:1582`).
The result shape is `RestoreCheckResult` (`restore-check-service.ts:120-130`):
The result shape is `RestoreCheckResult` (`restore-check-service.ts:148–160`):
`verdict`, `readiness`, `continuity`, `rigs[]`, `hostInfra`, `recovery`,
`counts {red,yellow,green}`, `checks[]`, `repairPacket`.
`counts {red,yellow,green}`, `classCounts`, `checks[]`, `repairPacket`. With
`compact=1` the route returns a reduced body (`routes/restore-check.ts:234–261`).
**Honest-error design (slice-00 bar):** a daemon-probe *exception* produces
**Honest-error design:** a daemon-probe *exception* produces
`verdict: unknown` (uninspectable state), distinct from a daemon
definitely-down state which is `red` / `not_restorable`
(`restore-check-service.ts:249-259`). The route's catch-all returns the same
`unknown`-shaped body with HTTP 500 + a `probe.error` red check
(`routes/restore-check.ts:174-222`). `CheckEntry.remediationSafe` defaults to
`false` (conservative — unclassified remediations are NOT
auto-execution-safe, `restore-check-service.ts:18-24`).
(`restore-check-service.ts:270–280`, `checkDaemonReachable` `:476–496`). The
route's catch-all returns the same `unknown`-shaped body with HTTP 500 + a
`probe.error` red check (`routes/restore-check.ts:264–312`).
`CheckEntry.remediationSafe` defaults to `false` (conservative —
unclassified remediations are NOT auto-execution-safe,
`restore-check-service.ts:23–28`, applied at `:1596`).
CLI surface (`cli-reference.md` `### rig restore-check`):
`rig restore-check [--rig <name>] [--no-queue] [--no-hooks] [--json]`. Exit
codes: `0` restorable (or with caveats), `1` not restorable (red), `2`
unknown / probe error.
CLI surface (`../cli-reference.md` `### restore-check`; options in
`packages/cli/src/commands/restore-check.ts:222–227`):
`rig restore-check [--rig <name>] [--full] [--ready] [--no-queue] [--no-hooks] [--json]`.
Output is compact unless `--full` (`:313`). Exit codes: `0` restorable (or
with caveats), `1` not restorable (red), `2` unknown / probe error
(`:214–217`). When the daemon is down, the CLI builds a local
`not_restorable` result and exits 1 (`:269`).
### 5.2 `rig restore-packet` — cross-runtime restore packet
CLI-side, no daemon route. `commands/restore-packet.ts` (528 lines)
implements three subcommands (`cli-reference.md` `### rig restore-packet`):
`write [options]` (generate a packet directory from a source session or JSONL
file, with `omitted-records` accounting), `read <packet-dir> [--json]`
(render contents; non-mutating), `validate <packet-dir> [--json]` (validate
against the v0 schema; non-mutating). Packet shape is the cross-runtime v0
standard — Claude Code and Codex transcripts both supported via runtime
parsers + redaction.
## OPEN / carried items
- **D15 (author-from-source, completed):** restore-check / restore-packet
authored from source above; flagged as the single author bit in this
module. Version attribution forensically resolved (both pre-0.3.0; the gap
was missing prose, not drift).
- No slice-00 numeric drift applies to this module's split content (the
footprint/migration/route counts land in `daemon-core.md`).
CLI-side, no restore-packet daemon route. `commands/restore-packet.ts`
(**541** lines, `wc -l < packages/cli/src/commands/restore-packet.ts`)
implements **3** subcommands
(`grep -c 'cmd.command(' packages/cli/src/commands/restore-packet.ts`;
`../cli-reference.md` `### restore-packet`): `write [options]` (`:218`;
generate a packet directory from a source session or JSONL file, with
`omitted-records` accounting; `--source-session` reads the transcript from the
daemon's `/api/transcripts/<session>/full`, `:156`), `read <packet-dir> [--json]`
(`:373`; render contents; non-mutating), `validate <packet-dir> [--json]`
(`:452`; validate against the v0 schema; non-mutating). Packet shape is the
cross-runtime v0 standard — Claude Code and Codex transcripts both supported
via runtime parsers + redaction (`packages/cli/src/restore-packet/`).
## See also
- `agent-spec-and-startup.md` — StartupOrchestrator persists the replay
context that restore consumes.
- `daemon-core.md` — `/api/restore-check` is one of the 49 route mounts
(`server.ts:513`).
- `daemon-core.md` — `/api/restore-check` is one of the **69** route mounts
in `server.ts` (`grep -c 'app.route(' packages/daemon/src/server.ts`),
mounted at `server.ts:836`.
- `transport-and-transcripts.md` — transcript boundary markers written on
restore.
- Source roots: `packages/daemon/src/domain/{restore-orchestrator,
snapshot-capture,snapshot-repository,checkpoint-store,
restore-check-service}.ts`, `packages/daemon/src/routes/restore-check.ts`,
`packages/cli/src/commands/restore-packet.ts`.
restore-preconditions,restore-topology,restore-attempt-receipt,
rehydrate-eligibility,snapshot-capture,snapshot-repository,checkpoint-store,
active-occupant,restore-check-service}.ts`,
`packages/daemon/src/routes/{restore-check,up,snapshots}.ts`,
`packages/cli/src/commands/{restore-packet,restore-check,restore}.ts`.
+176 -176
View File
@@ -1,205 +1,205 @@
---
kind: as-built
title: Living Notes Review Surface — the intent→plan→delivered projection
title: Living Notes — Composed Review and Frozen Exports
status: active
topics: [knowledge-and-context, observability, sdlc]
domains: [engineering-advisor, operating-advisor, product-advisor]
topics: [observability, knowledge-and-context]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Working on or consuming the composed slice/mission review surface — the
/api/review/* routes, the ComposedSliceReview contract, the on-disk SDLC
convention it projects, staged-approval locks, proof artifacts and the C1
header, the freeze export, media serving for review evidence, or the
cross-host FLEET aggregate (/api/review/fleet, the fleet composer's
union/one-count seam, v0.4.6 MH-5).
siblings: [content-surfaces.md, workspace-primitive.md, mission-control.md]
prerequisite-reads: [workspace-primitive.md]
last-verified-against-source: c8341f72
last-updated: 2026-07-08
Tracing slice, mission, rig, or fleet review data back to scope documents,
proof artifacts, judgments, queue state, or frozen exports.
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Living Notes review surface (v0.4.4)
# Living Notes — Composed Review and Frozen Exports
The review surface is a **pure projection of on-disk markdown into one
reviewable structure per slice**: INTENT → PLAN → DELIVERED. Agents change
files; the daemon re-projects; nothing here writes product state except the
two deliberate approval stamps and the freeze export. Shipped across the
0.4.4 living-notes slices (19 signal layer, 20 composer/surfaces, 22 rig
agents altitude, 23 SDLC operationalization) and the **corrective rebuild**
(2026-07-05/06) that collapsed the surface to the one structure described
here. Everything below is verified at `bb5ad219`.
Source snapshot: `e8f0ab340db773392ec8be75b072d1c0f3068a50`. This describes the source at that commit;
it does not establish the version or behavior of a running daemon.
## 1. The ONE contract — `ComposedSliceReview`
Living Notes builds review payloads from existing documents and recorded
state. The composition layer does not make an agent judgment or contact an
agent to obtain one. Its output distinguishes intent, plan, delivered proof,
attention, agents, and source lineage.
`packages/daemon/src/domain/review/types.ts` defines the read contract every
consumer shares (slice Review tab, mission U5 row expansion, For-You
expansion — never a second endpoint per consumer):
## Read and compose boundaries
- **identity + phase**: `slice`, `sliceId`, `title`, `missionId`, `phase`
(five-way, derived read-time: `locked > review > building > spec > intent`,
`derivePhase` in `compose.ts`), `laneLabel` (SS14 vocabulary INTENT / PLAN /
BUILD / REVIEW / LOCKED).
- **`intent`**: `{text, media[], ssotPath, degrade}` — the slice README's
`## Intent` section verbatim (`extractSection`), plus any media it embeds.
- **`plan`**: `{concise: {text, media[]}, lockedArtifacts[], lock, ssotPath}` —
the PRD's pinned `## Mini-requirements` tier + planned mockups; the pinned
artifact set is a **frontmatter READ** (`locked-artifacts:` list on the
slice README — no new write machinery); `lock` is the spec-scope
staged-approval stamp (§3).
- **`delivered`**: `{items[], extraProof[], lock, proofDirPath}` — the
redesigned join (§4): each `## Proof contract` deliverable paired with its
curated proof media and QA's recorded comparison signal. `lock` is the
delivery-scope stamp; `proofDirPath` is the drill-in door to the full
fix-loop history.
- **KEPT orthogonal bands**: `needsYou` (two sources, one queue: agent-routed
items ∪ derived ▲ exceptions with inline evidence), `agents`
(scope-parameterized `slice:<id> | mission:<id> | rig` — one contract, all
scopes), `lineage` (`VerifyLineage`: candidate/merge/tip facts + the four
gate `VerdictCell`s rendering recorded tokens verbatim), `defects`
(out-of-slice media refs surfaced, never silently dropped), `composedAt`.
[`ReviewGatherer`](../../../packages/daemon/src/domain/review/gather.ts)
performs filesystem, database, telemetry, and optional Git reads.
[`compose.ts`](../../../packages/daemon/src/domain/review/compose.ts) turns
those inputs into the contracts defined in
[`types.ts`](../../../packages/daemon/src/domain/review/types.ts), including
`ComposedSliceReview`, `ComposedMissionReview`, and `ComposedRigAgents`.
**Deleted by the corrective (2026-07-05, founder-blocked original):** the
four parallel renderable structures (`sections`, `acceptance`, `compare`,
`join`) and the coequal `green` field. They do not exist in the types, the
composer output, the UI hook, or the fixtures; the daemon route tests assert
the keys are ABSENT on the wire (`test/review-composer.test.ts`,
`test/review-routes.test.ts`). Recorded-verdict green survives in exactly two
places: the per-deliverable `verified` signal (§4) and the mission ledger's
completion fact (§6) — never a slice-review structure.
`gatherSlice` uses `resolveNodeFileVia` to select the scope node document,
reads `IMPLEMENTATION-PRD.md` and `PROOF.md`, and loads the `proof/` artifacts.
It also gathers approval stamps, locked artifacts, tagged queue attention,
agents, workflow exceptions, and `readSliceReadiness`. A current `SPEC.md`
is carried distinctly from a legacy `README.md`; the composer does not
blindly treat every file as an interchangeable source.
## 2. Composer + gatherer split
[`readProofArtifacts`](../../../packages/daemon/src/domain/review/proof-io.ts)
reads sorted top-level `.md` files in `proof/`, parses their headers with
`parseC1Header`, and uses file mtime as `droppedAt`. Missing directories and
unreadable entries yield no artifact for those entries. No claim that all
possible evidence was discovered follows from that read.
- `compose.ts` is **PURE**: `(gathered inputs) → composed doc`; identical
inputs (including caller-supplied `nowIso`/git facts) produce byte-identical
output — idempotence holds by construction and is pinned by tests.
- `gather.ts` (`ReviewGatherer`) is the impure shell: reads slice docs +
`proof/*.md` artifacts from disk, attention/agent rows from SQLite,
approval stamps from frontmatter (cross-checked against the audit log, §3),
git lineage facts from the workspace default repo. Every unreadable source
degrades honestly (nulls / "unknown") — the composer renders the named
degrade, never invented content.
`composeMission` batches slice-index membership reads, gathers each slice,
and composes a mission board, completion ledger, attention union, agents,
and brief spine. `composeRig` reads queue/activity state and reports current
holders, recent holders, overdue work, settled work, and workflow exceptions.
"Recent" is the current UTC day; overdue is in-progress slice-tagged work past
`closure_required_at`; settled is today's `handed_off_to` transitions; and
attention is any active item that is `human-gate`, addressed to a `human…`
session, or blocked on one (`gather.ts`). Of the three review reads, the TUI
calls only `/fleet`, from its broad hydration (`packages/tui/src/hydrate.ts`);
its client also defines methods for `/agents` and `/rig`, which nothing in the
TUI calls.
## 3. The two locks = the shipped staged-approval stamps
## Slice source selection and phase
`plan.lock` and `delivered.lock` are projections of the **staged-approval
verb** (`rig scope slice|mission approve --scope spec|delivery` — see
cli-reference "SDLC control plane verbs"): frontmatter stamps
(`approved-spec-by/-at`, `approved-by/-at`) written daemon-side together with
an append-only `mission_control_actions` audit row (no half-stamp). The
gatherer cross-checks each stamp against the pinned scope-approval
`audit_notes_json` shape (`approval_scope` + scope identity); a stamp with no
matching row projects `auditVerified: false` and renders as an UNVERIFIED
stamp — visible, never a block. Approval is freeze/sign-off, **never**
proven-green (BR-6).
In [`composeSliceReview`](../../../packages/daemon/src/domain/review/compose.ts),
intent comes from the node document's `Intent` section. Placeholder-only
intent is treated as absent. Mini-requirements use current `SPEC.md` when
present; legacy selection can fall back from a pristine scaffold PRD section
to authored README material. Proof-contract selection delegates to
`selectProofContractBody` through `extractProofContractSelected`.
## 4. DELIVERED — promised ↔ curated proof ↔ verified
The phase is derived by `derivePhase`, in this precedence order:
`composeDelivered` joins the PRD's `## Proof contract` checkbox items
(`extractProofContract`; an optional markdown image on the checkbox line
becomes the deliverable's `plannedRef` mockup) to the C1-headed proof
artifacts in `<slice>/proof/`:
| Phase | Signal |
|---|---|
| `locked` | Delivery approval stamp. |
| `review` | Recorded verdict or claimed proof pass. |
| `building` | Real proof artifacts, or active queue work paired with an authored/locked spec. |
| `spec` | Authored structure or a spec approval stamp. |
| `intent` | None of the above. |
- An artifact **covers** a deliverable when its C1 `evidences:` list names the
item (exact text or 1-based index).
- `verified` binds to the shipped C1 fields, never mere presence:
**verified** = a covering `qa|adjudication` artifact records the comparison
(`self_check`) AND its recorded verdict is passing; **unverified** = some
covering artifact without a passing recorded QA comparison (QA's
why-kicked-back `note` still surfaces); **missing** = promised, nothing
delivered. All three are render states — fail-open by construction.
- The curated proof set is the covering artifacts' body media refs
(`ProofArtifact.mediaRefs`, populated by `rig proof add --media` or markdown
refs in the artifact body), normalized slice-relative; refs escaping the
slice dir become `defects` findings and are never served or inlined.
Unmapped-artifact media renders bounded as `extraProof`.
- The ▲ insufficient-proof NEEDS-YOU exception fires from the delivered
MISSING count (`deriveExceptions`).
File presence alone is insufficient: a scaffolded `PROOF.md` is not build
evidence, and a tracking queue item alone does not promote an unplanned
slice. Phase and proof readiness are separate output fields.
## 5. Routes, freeze, media serving
## Delivered items and current judgments
- `packages/daemon/src/routes/review.ts`, mounted at `/api/review`
(`server.ts` route mounts): `GET /slice/:name`, `GET /mission/:name`,
`GET /rig` (the OPR.0.4.4.22 rig-agents altitude root), `GET
/agents?scope=slice:<id>|mission:<id>|rig`, `POST /freeze`.
- **Freeze** (`freeze.ts`): the ONE synchronous compose-and-freeze path,
invoked after the delivery stamp + audit row commit. Renders the composed
review to a single self-contained HTML file (`REVIEW-<id>-<date>.html` in
the slice dir): CSS inline, images data-URI-inlined under slice-dir
containment (resolve-prefix + realpath — a traversal/symlink ref renders
the muted outside-slice branch, never inlined), video by link + poster.
Exclusive-create through the allowlist-governed atomic write service;
re-invocation is an idempotent no-op; a failed render never un-approves.
Legacy missions carrying `MISSION_BRIEF.md` may still receive the
section-scoped brief-spine fold; new scaffolds do not create that retired
web-UI-era file.
- **Media serving** for review evidence is ranged on BOTH asset route
families (iOS-Safari-class players require `206`): `GET /api/files/asset`
(`routes/files.ts` — single-range parse, `206`/`416`, `Accept-Ranges:
bytes`; `.html` renders as text/html only under the explicit `?render=1`
opt-in) and `GET /api/slices/:name/proof-asset/*` (`routes/slices.ts` —
same range semantics via `fileAssetResponse`, added by the corrective QA
fixback; immutable-cache posture retained).
`extractProofContract` reads logical checkbox items, retaining authored raw
text for identity. `proofItemIdentity` uses an explicit `proof-item` marker
when supplied, otherwise an ID derived from the item's text. In the legacy
artifact join, `evidences` references match a promised item's exact display
text or its one-based index.
## 6. Mission + rig altitudes
`composeDelivered` pairs each promise with curated media and a verification
state:
`composeMissionReview` consumes `{review, green}` entries per slice: the
board (stage-specific cells re-bound to the collapsed contract — spec-stamp
state, delivered n/m, GREEN·merge pair, stamp), the completion **ledger**
(a query over the slice set, never an authored list; `green` here is the
recorded-verdict fact from `computeRecordedGreen` — regime 1 = four passing
gate verdicts, regime 2 = passing adjudication), `cutComplete` (TRUE only
when every in-cut slice is green AND merged AND has zero open needs-human
items), and the union NEEDS-YOU (distinct identities — one item seen from N
altitudes is one item). `composeRigAgents` serves the standalone rig
altitude (roster ∪ recently-holding, park/health/settled from the queue
transitions log).
- With configured [proof readiness](../../../packages/daemon/src/domain/proof/judgments.ts),
the matching current item must be `accepted`, and readiness must have no
issues, to render `verified`. The note reports the current judgment state
or why it is unavailable.
- Without configured readiness, a winning covering `qa` or `adjudication`
artifact with a non-null `self_check` and a passing verdict supplies legacy
verification. The note explicitly labels it **item revision unbound**.
- Other covering artifacts are `unverified`; no covering evidence/judgment
is `missing`. Unmapped artifact media appears separately as `extraProof`.
## 7. The FLEET altitude — the cross-host aggregate SIBLING (v0.4.6, OPR.0.4.6.MH5)
This distinction matters after a proof contract changes: a legacy PASS
header is not automatically a current revision-bound judgment. Approval
stamps are also not a substitute for the delivered-item join.
`GET /api/review/fleet` aggregates every registered host's composed ▲/● set
into one manage-by-exception glance. It is a **sibling aggregate endpoint**,
never a fourth `AgentsScope` value (arch Q2): the scope grammar stays
exactly `slice:* | mission:* | rig`, and the local composer stays a pure
function over local state. `domain/review/fleet-compose.ts` is the ONE
review-domain module allowed to import hosts transport/registry — a
boundary enforced mechanically by the `review-import-audit` static test
(the zero-I/O `fanout-contract` types module is the sole allowlisted
hosts import elsewhere).
## Approval, attention, and lineage
**Fan-out-the-composed-set (arch Q1):** the ▲ kinds are time-derived on
their own host's clock, so the fleet root fans out each host's
ALREADY-COMPOSED rig root (`GET /api/review/rig` over `remoteJsonRequest`,
concurrent under the named read-class deadline; the local host joins
in-process via the same gatherer — zero self-transport) and only **unions +
host-dimensions + counts**. It never recomputes exception truth (the
composer is clock-free by test pin), so cross-host clock skew can never
distort a ▲. Per-host failures degrade to the closed `PerHostStatus`
honesty contract; a failed host's counts are ABSENT from its
`FleetHostRollup` — absent-not-zero, in the type.
`ReviewGatherer.gatherApproval` reads `approved-spec-by`/`approved-spec-at`
and `approved-by`/`approved-at`, alongside matching `mission_control_actions`
approval audit records. The resulting locks preserve who/when/audit facts.
A frontmatter stamp with no matching `approve` audit row still locks the
phase, but carries `auditVerified: false`, and the frozen export shows it as
an UNVERIFIED stamp. The approval writer is the separate
[`scope-approve` route](../../../packages/daemon/src/routes/scope-approve.ts).
**One-count across the fleet (arch Q4):** the dedup `Set` lives in the
fleet composer — the one place — keyed `hostId|identity` (rendered verbatim
on the expanded drawer); within-host multi-altitude visibility collapses to
one row with `seenFrom` provenance; an MH-3-forwarded qitem lives only in
its origin host's DB, so no double-count by construction.
`composeNeedsYou` combines recorded queue attention with derived exceptions;
`deriveWorkflowExceptions` adds workflow-specific observations. When
readiness is not configured, a slice whose `PROOF.md` claims PASS without a
recorded green verdict also gets a `confirm-faithful` needs-you item. Mission
composition deduplicates attention identities across slice and mission views.
Media references outside the slice's relative-path contract produce defect
entries instead of disappearing silently.
**Composition pins the seam (arch Q3, the rule of thumb):** sidedness and
caller pick the TRANSPORT seam (MH-4's CLI-direct verbs); when COMPOSITION
exists — the fleet union/one-count is a correctness rule — the seam pins
daemon-side: ONE composer, one endpoint, every consumer (the `/fleet` route
page and the FLEET band today via the shared `useFleet` hook; the TUI/CLI
fleet consumers as named follow-ups) reads the same one. UI cadence is the
bounded named `FLEET_POLL_INTERVAL_MS` with the feed-cadence-class floor,
and the ambient band gates its FETCH on fleet existence (the FS-1 amplifier
discipline; enable-at-scale remains the FS-1 release-validation gate). Read
+ surface only: acting on a remote host's item rides MH-3/MH-4.
Git facts are optional. [`startup.ts`](../../../packages/daemon/src/startup.ts)
passes `OPENRIG_REVIEW_GIT_REPO` to the gatherer. The gatherer reads that
repository's `HEAD`, searches merge messages keyed by scope ID, and computes
ancestry/behind facts when possible. Each git read has a 4-second timeout; the
merge search looks for `Merge <id>` in `HEAD` history and needs the scope's
frontmatter `id`; the behind-tip count is computed only for unmerged slices
with a candidate SHA. Unavailable facts remain unknown; this is not a fresh
remote GitHub merge-status query.
## 8. The on-disk convention it projects (SDLC control plane)
`composeMissionReview` derives `cutComplete` from a nonempty ledger in which
every slice is green, has a merge SHA, and has no needs-human items. Configured
slice readiness supplies the green predicate; otherwise recorded verdicts
do. With configured readiness, a slice's board cell also shows the proof
readiness state and revision. That computed field is not itself a
publication or higher-level outcome decision.
The surface projects the markdown-control-plane shapes operationalized by
OPR.0.4.4.23 — conventions SSOT `docs/reference/sdlc-conventions.md`:
`## Intent` (README) / `## Mini-requirements` + `## Proof contract` (PRD) /
`proof/` C1-headed artifacts + `PROOF.md`, scaffolded for every template kind
by `rig scope slice create` and checked advisory-only by `rig scope audit`
(+ the `rig doctor` SDLC row). The UI half of this surface (the slice Review
tab, mission board, For-You approve+chat) is documented in
[`../ui/project-and-for-you.md`](../ui/project-and-for-you.md).
## HTTP routes
[`reviewRoutes`](../../../packages/daemon/src/routes/review.ts), mounted at
`/api/review` by [`server.ts`](../../../packages/daemon/src/server.ts):
| Method and suffix | Payload / behavior |
|---|---|
| `GET /slice/:name` | Composed slice plus proof-source observation. |
| `GET /mission/:name` | Composed mission plus proof-source observation. |
| `GET /agents?scope=…` | Agents band; scope is `slice:<id>`, `mission:<id>`, or `rig`. |
| `GET /rig` | Local rig review root. |
| `GET /fleet` | Local and registered remote host review union. |
| `POST /freeze` | Compose and export an approved slice; body requires `scope: slice` and `name`. |
Missing gatherer returns `503`; invalid agents scope returns `400`; unknown
slice/mission returns `404`. Fleet is a sibling aggregate, not another value
of the agents-scope parameter.
## Freeze and media
Nothing invokes the freeze automatically: `POST /api/scope/approve` writes
the stamp and audit row and always returns `freezeFired: false`
(`domain/scope/scope-approve.ts:326`), and the route comment that says the
approve flow invokes the freeze describes wiring that does not exist. A
frozen export exists only after something calls `POST /api/review/freeze`.
[`freezeSliceExport`](../../../packages/daemon/src/domain/review/freeze.ts)
requires a delivery lock and an allowlisted slice directory. It writes
`REVIEW-<scope-id-or-name>-<approval-date>.html` through
`FileWriteService.createAtomic`. An existing target is treated as already
frozen; it is not rewritten. A failed export does not undo approval. The
route needs the file write service (a non-empty `files.allowlist`; otherwise
503) and returns 409 `stamp_missing` without a delivery stamp, 403
`allowlist_missing` outside every allowlist root, and 500 otherwise; success
returns `{ ok, path, alreadyFrozen, briefWrite }` (`routes/review.ts`).
The export embeds contained images as data URIs and links videos with an
optional poster. `containedMediaPath` checks both resolved paths and existing
symlink targets against the slice directory. Unavailable/outside media gets
an explicit rendered message.
After a new freeze, the route may update the generated spine in a conforming
`MISSION_BRIEF.md` through the conflict-checked file writer. A malformed brief
is skipped, and brief-write failures are reported without undoing the export.
The [`slices` routes](../../../packages/daemon/src/routes/slices.ts) separately
serve proof assets; [`files` asset serving](content-surfaces.md) has its own
allowlist and range behavior.
## Fleet composition
[`composeFleet`](../../../packages/daemon/src/domain/review/fleet-compose.ts)
composes local data in-process and reads registered hosts' composed rig
payloads. Its default fan-out concurrency is **4**, with a shared
**4-second** read budget. Synchronous local work cannot be preempted by that
timer; elapsed local work reduces the remaining remote budget.
Each remote host is read through its own `GET /api/review/rig`: SSH-only
registry entries report `unsupported-transport`, auth refusals report
`auth-failed`, and timeouts, malformed payloads and other errors report
`unreachable`.
`unionFleet` keys attention by host plus item identity and retains host
status. Unavailable hosts have absent counts, not synthetic zeros. A missing
registry produces a local-only result; an unreadable existing registry is
reported. Host-derived time/status facts are carried through, not recomputed
as if every host shared one clock.
+217 -111
View File
@@ -1,164 +1,270 @@
---
kind: as-built
title: Mission Control — Queue Observability + 7-Verb Contract (PL-005)
title: Mission Control — Queue Observability + Verb Contract
status: active
topics: [coordination, observability]
domains: [engineering-advisor, operating-advisor, orchestrator, human-operator]
applies-when: |
Need to know how the daemon-backed Mission Control surface works — the
seven views, the seven write verbs, the action audit table, the
bearer-token middleware, or how queue observability maps to PL-004 sources.
seven views, the eight write verbs, the action audit table, the
bearer-token middleware, or how queue observability maps to the
coordination primitive's sources.
siblings: [coordination-primitive.md, workflow-runtime.md, ../ui/project-and-for-you.md]
prerequisite-reads: [../README.md, coordination-primitive.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Mission Control — Queue Observability + 7-Verb Contract (PL-005)
# Mission Control — Queue Observability + Verb Contract
Mission Control (PL-005) is the daemon-backed queue-observability surface: an
integrated product UI inside the existing shell (a top-level `/mission-control`
route, NOT a new managed app) over the PL-004 Phase A coordination primitive.
Per the PRD acceptance criteria: seven views, seven verbs, first-class human
seats, recent-ships=10, and a daemon-backed action audit table; no
old-dashboard migration/cutover (`architecture.md` §3 L368, L390).
Mission Control is the daemon's queue-observability and operator-action
surface, mounted at `/api/mission-control` over the coordination primitive's
`queue_items` and `stream_items` (see `coordination-primitive.md`). It has
seven views, eight verbs, a recent-ships cap of 10
(`mission-control-read-layer.ts:107`), and a daemon-backed action audit
table. In the web UI the old `/mission-control` page now redirects to
`/for-you`, and the For You feed carries the verb actions (§6).
> Verified against source at HEAD `7eaf524c`. Mission Control is PL-005 (an
> early-0.3.0 graft); plugins and Claude auto-compaction are 0.3.1 features
> and are NOT back-attributed here (slice-00 0.3.0-ground-truth seams a/row-7).
> Verified against source at main `e8f0ab340db773392ec8be75b072d1c0f3068a50`. A bare file name such as
> `mission-control-read-layer.ts:31` is in
> `packages/daemon/src/domain/mission-control/`; `domain/…`, `routes/…`,
> `middleware/…`, `db/…`, `index.ts`, `server.ts` and `startup.ts` are under
> `packages/daemon/src/`. Each count sits beside the command that produces
> it; run the command from the repository root to refresh it.
## 1. The seven views
`MISSION_CONTROL_VIEWS` is the canonical view list (re-confirmed at HEAD
`packages/daemon/src/domain/mission-control/mission-control-read-layer.ts:32–42`):
`my-queue`, `human-gate`, `fleet`, `active-work`, `recent-ships`,
`recently-active`, `recent-observations`.
`MISSION_CONTROL_VIEWS` is the canonical view list
(`mission-control-read-layer.ts:31–39`): `my-queue`, `human-gate`, `fleet`,
`active-work`, `recent-ships`, `recently-active`, `recent-observations`.
All seven return rows in the load-bearing 9-field phone-friendly content
model (rig/mission name, current phase,
active|idle|attention|blocked|degraded, next-action,
Views: **7** — `sed -n '/^export const MISSION_CONTROL_VIEWS = \[/,/\] as const;/p' packages/daemon/src/domain/mission-control/mission-control-read-layer.ts | grep -c '^ "'`
All seven return rows in the 9-field phone-friendly content model,
`CompactStatusRow` (`mission-control-read-layer.ts:60`): rig/mission name,
current phase, active|idle|attention|blocked|degraded, next-action,
pending-human-decision, read-cost, last-update timestamp,
confidence/freshness, evidence link). The model is non-negotiable across all
7 views; UI may render compact, JSON preserves all 9 (`architecture.md` §3
L370).
confidence/freshness, evidence link. The type's doc comment
(`mission-control-read-layer.ts:43–59`) makes the model non-negotiable across
all seven views: UI may render compact, JSON preserves all nine. Four further
optional fields carry the queue item's id and context.
`MissionControlReadLayer` maps each view to its source-of-truth path
(`mission-control-read-layer.ts:4–14`, re-confirmed at HEAD):
Required row fields: **9** — `sed -n '/^export interface CompactStatusRow {/,/^}/p' packages/daemon/src/domain/mission-control/mission-control-read-layer.ts | grep -c -E '^ [a-zA-Z]+:'`
- `my-queue` / `human-gate` / `active-work` / `recent-ships` query PL-004
Phase A `queue_items` via `QueueRepository`.
- `fleet` consumes the per-rig CLI capability cache + queue summary.
- `recently-active` delegates to PL-004 Phase B
`ViewProjector.show("recently-active")`.
- `recent-observations` reads PL-004 Phase A `stream_items` via
`StreamStore`.
`MissionControlReadLayer.readView` (`mission-control-read-layer.ts:143`) maps
each view to its source:
Filesystem fallbacks (`~/.openrig/stream/<date>.jsonl`, raw queue file grep)
are graceful-degradation aids, NOT the primary path (`architecture.md` §3
L378).
- `my-queue` / `human-gate` / `active-work` / `recent-ships` query
`queue_items` via `QueueRepository`. `my-queue` uses the `operatorSession`
query parameter when given, else `workspace.operator_seat_name` (default
empty), else the only registered human; when none is found, or more than
one, it returns no rows and a `degradedFields` note rather than widening the
view (`mission-control-read-layer.ts:137–141`, `:166–168`;
`routes/mission-control.ts:521`).
- `fleet` calls `MissionControlFleetCliCapability.rollupFleet()`
(`mission-control-read-layer.ts:197`;
`mission-control-fleet-cli-capability.ts:109`), which walks the rig
registry (`:110`), summarises each rig's `queue_items` (`:135`), and runs a
per-rig CLI capability probe (`makeLocalCliCapabilityProbe`, `:77`, wired
at `startup.ts:1597`).
- `recently-active` delegates to the view projector's built-in
`ViewProjector.show("recently-active")` (`mission-control-read-layer.ts:246`).
- `recent-observations` reads the latest 50 `stream_items` via `StreamStore`
with `direction: "latest"` (`mission-control-read-layer.ts:265–268`).
> Scope note (slice-00 0.3.0-ground-truth OPEN-3, carried): the exact
> For-You verb subset is an unresolved velocity slice-01 ruling. This module
> describes the **system-level** 7-verb vocabulary (proven, slice-00
> §1.6/seam-c). It does NOT enumerate a For-You-surface subset — that
> surface is described in `../ui/project-and-for-you.md` when authored.
There is no filesystem fallback. When no `StreamStore` is wired,
`recent-observations` returns no rows with
`sourceFallback: "stream-store-not-wired"`
(`mission-control-read-layer.ts:258–262`), and `fleet` always reports
`sourceFallback: "daemon-internal-projection"`
(`mission-control-fleet-cli-capability.ts:156`).
## 2. The seven verbs (the write contract)
> Scope note: this module describes the daemon's verb vocabulary. It does
> NOT enumerate which verbs the For You cards offer; that surface is
> described in `../ui/project-and-for-you.md`. The terminal UI opened by bare
> `rig` or `rig tui` is called the "mission-control TUI" in source
> (`packages/tui/README.md:1`), but it does not call these routes.
The seven verbs execute through the load-bearing
`MissionControlWriteContract` (re-confirmed at HEAD
`packages/daemon/src/domain/mission-control/mission-control-write-contract.ts:27–36`):
## 2. The eight verbs (the write contract)
`MISSION_CONTROL_VERBS` (`mission-control-action-log.ts:14–26`) is the verb
list. The verbs execute through `MissionControlWriteContract.act`
(`mission-control-write-contract.ts:131`); the closure mapping is
`verbToClosure` (`:509`).
Verbs: **8** — `sed -n '/^export const MISSION_CONTROL_VERBS = \[/,/\] as const;/p' packages/daemon/src/domain/mission-control/mission-control-action-log.ts | grep -c '^ "'`
| Verb | Effect |
|---|---|
| `approve` | `state="done"`, `closure_reason="no-follow-on"` |
| `deny` | `state="done"`, `closure_reason="denied"` |
| `route` | `state="done"`, `closure_reason="handed_off_to"`, `closure_target`+`handed_off_to`=route target; creates new qitem at the route target (1-hop) |
| `route` | `state="handed-off"`, `closure_reason="handed_off_to"`, `closure_target`+`handed_off_to`=route target; creates a new queue item at the route target (1-hop) |
| `annotate` | no queue mutation; audit record only |
| `hold` | `state="blocked"`, `closure_reason="blocked_on"` |
| `drop` | `state="done"`, `closure_reason="canceled"` |
| `handoff` | the 4-step shape (see below) |
| `handoff` | same closure and new destination item as `route`; the 4-step shape (see below) |
| `resolve` | only for a `blocked` item parked on a human seat: moves it to `in-progress` with the required decision text as the transition note; no closure and no new item (`:369`, `:386`, `:410–411`). After commit it sends a best-effort nudge with the decision text to the item's owner unless `notify: false` (`:450–467`); the CLI wrapper is `rig queue resolve <qitemId> --decision <text>` (`packages/cli/src/commands/queue.ts:828`) |
Each verb is one atomic daemon transaction: queue mutation via
`QueueRepository.updateWithinTransaction()` (which preserves Phase A
hot-potato closure validation — see `coordination-primitive.md` §3) + an
audit row in `mission_control_actions` + a persisted
`mission_control.action_executed` event, all in one `db.transaction`. The
4-step `handoff` shape (source-update + destination-create + opt-in
best-effort notify + audit-record append) is verified atomic; notify failure
does NOT roll back durable mutations (PRD invariant). Failure-injection rolls
back source closure + audit row + new qitem together (`architecture.md` §3
L380; `mission-control-write-contract.ts:5,15`).
`annotate` requires `annotation`, `hold` and `drop` require `reason`, `route`
and `handoff` require `destinationSession`, and `resolve` requires a non-empty
`decision`. A missing `annotation`, `destinationSession` or `decision` returns
400. A `drop` without `reason` passes the queue closure check and is refused by
the audit record instead; the wrapped `reason_required` error has no status
mapping, so it returns 500 (`mission-control-action-log.ts:128–133`,
`mission-control-write-contract.ts:245–248`). Items already `done` or
`handed-off` are refused with 409 `qitem_already_terminal`, except under
`resolve`, which answers 409 `qitem_not_leg1_parked` for any item not parked on
a human seat. An unknown item returns 404 `qitem_not_found`
(`routes/mission-control.ts:240–251`, `:330–341`).
Each verb is one atomic daemon transaction: the queue mutation via
`QueueRepository.updateWithinTransaction()` (`domain/queue-repository.ts:2371`,
which keeps the hot-potato closure validation — see
`coordination-primitive.md` §3), an audit row in `mission_control_actions`
(`mission-control-write-contract.ts:207`), and a persisted
`mission_control.action_executed` event (`:225`), all in one
`db.transaction`. For every verb except `annotate`, that transaction is
opened by `EventBus.withNotifyEnvelope` (`:157`; `domain/event-bus.ts:112`,
`:126`); `annotate` opens `db.transaction` itself
(`mission-control-write-contract.ts:308`).
The 4-step `handoff` shape (source-update + destination-create + best-effort
notify + audit-record append) is shared by `route`. The destination item is
created in the same transaction (`createWithinTransaction`, `:173`), along
with the successor's wake intent (`stageWakeIntent`, `:195`, checked by
`assertTerminalClosureHasIntent`, `:242`). The wake itself runs after commit
(`deliverWakeForSuccessor`, `:264`). It is on unless the caller passes
`notify: false` (`domain/queue-repository.ts:1182`), and a notify failure
does NOT roll back durable mutations (`mission-control-write-contract.ts:272–275`).
A failed destination create rolls back the source closure, the audit row and
the new item together
(`packages/daemon/test/mission-control-write-contract.test.ts:220`).
## 3. The action audit table
`mission_control_actions` (`037_mission_control_actions.ts:54` `CREATE TABLE
IF NOT EXISTS mission_control_actions`) is append-only at the API surface:
it records every operator action through Mission Control with before/after
qitem snapshots for forensic reconstruction. Columns include `action_verb`
(TEXT, app-layer enum enforcement, `:56`) and `acted_at` (TEXT NOT NULL ISO
timestamp); indexes `(acted_at DESC, action_verb)`,
`(qitem_id, acted_at DESC)`, `(actor_session, acted_at DESC)`
(`037_mission_control_actions.ts:28–44`). Phase B added NO migrations — this
Phase A table is the only data source (`architecture.md` §3 L364, L392).
`mission_control_actions` (`db/migrations/037_mission_control_actions.ts:58`
`CREATE TABLE IF NOT EXISTS mission_control_actions`) is append-only at the
API surface: `record()` is the only writer `MissionControlActionLog` exposes
(`mission-control-action-log.ts:113`). It records every operator action
through Mission Control with before/after queue item snapshots for forensic
reconstruction. Columns include `action_verb` (TEXT, app-layer enum
enforcement, `037_mission_control_actions.ts:60`) and `acted_at` (TEXT NOT
NULL ISO timestamp, `037_mission_control_actions.ts:63`);
indexes `(acted_at DESC, action_verb)`, `(qitem_id, acted_at DESC)`,
`(actor_session, acted_at DESC)` (`037_mission_control_actions.ts:72–77`).
One later migration adds a nullable `identity_provenance` column
(`db/migrations/065_identity_provenance.ts:18`). The acting session comes
from the `X-OpenRig-Session` header when present (the CLI sends it); a
headerless browser request falls back to the body `actorSession`. The row
records how the actor was established: `transport:v1`, `relay:v1` for a
forwarded request, `claimed:v1` for a headerless body actor, or
`origin-unknown:v1` (`routes/mission-control.ts:347–351`;
`routes/require-sender-identity.ts:120`).
## 4. PL-005 Phase B — bearer middleware, notifications, audit browse
Scope approvals (`POST /api/scope/approve`) also append `approve` rows through
the same `MissionControlActionLog`, with `qitem_id` null and the scope target
in `audit_notes_json` (`domain/scope/scope-approve.ts:292`). The audit browse
(§4) reads only this table.
Phase B extends the daemon Mission Control surface:
## 4. Bearer middleware, notifications, audit browse
- **Bearer-token middleware** —
`packages/daemon/src/middleware/auth-bearer-token.ts` (re-confirmed at
HEAD: header `auth-bearer-token.ts:1–9` "PL-005 Phase B"). Constant-time
bearer comparison via Node `crypto.timingSafeEqual`; the daemon refuses to
start with a non-loopback bind interface AND an empty bearer config
(startup-side check). Bearer enforced on the write verbs:
`app.post("/action", requireAuth)` (`routes/mission-control.ts:294`) and
`app.post("/notifications/test", requireAuth)` (`:295`). v0 is bearer-on-write;
no OAuth/SSO/per-user model.
- **Bearer-token middleware** — `middleware/auth-bearer-token.ts`.
Constant-time comparison via Node `crypto.timingSafeEqual`
(`constantTimeEqual`, `:36`, `:50`). `authBearerTokenMiddleware` (`:93`)
passes every request through when no token is configured (`:98`). The
token comes from `OPENRIG_AUTH_BEARER_TOKEN` (`index.ts:288`). The daemon
refuses to start when the bind host is set explicitly, is neither loopback
nor Tailscale (a hostname is resolved first), and no bearer token is set
(`assertBindAuthInvariant`, `auth-bearer-token.ts:240`, called at
`index.ts:296`). Bearer enforced on the write routes:
`app.post("/action", requireAuth)` (`routes/mission-control.ts:307`) and
`app.post("/notifications/test", requireAuth)` (`:308`). Reads are not
bearer-gated. It is one static token; no OAuth/SSO/per-user model
(`auth-bearer-token.ts:11–14`). Every Mission Control request, read or
write, first passes the daemon's `/api/*` browser boundary
(`server.ts:647`; `middleware/browser-boundary.ts`): only known target host
names, and, when an `Origin` header is present, only the daemon's own UI
origin or an `OPENRIG_ALLOWED_ORIGINS` entry. A valid bearer token waives
only the host-name check.
- **Notification dispatcher** — two adapters
(`notification-adapter-ntfy.ts` default + `notification-adapter-webhook.ts`
alternate; selected via `OPENRIG_NOTIFICATIONS_MECHANISM` env) plus
`notification-dispatcher.ts` (re-confirmed in
`domain/mission-control/`). ntfy.sh recommended for the operator's phone
via tailnet.
- **Read-only audit-history browse** — `audit-browse.ts` over
`mission_control_actions`, exposed at `GET /api/mission-control/audit`
(`routes/mission-control.ts:346`) with filters and `(limit, before_id)`
pagination cursored on SQLite `rowid` (`architecture.md` §3 L392).
(`notification-adapter-ntfy.ts`, `notification-adapter-webhook.ts`) plus
`notification-dispatcher.ts`. `OPENRIG_NOTIFICATIONS_MECHANISM` selects
`ntfy`, `webhook` or `none`, and the default is `none`
(`startup.ts:1642`). A dispatcher starts only when
`OPENRIG_NOTIFICATIONS_TARGET` is also set (`:1643`, `:1650`) and the
target URL passes validation (`:1661`); an unrecognized mechanism with a
target set throws during daemon startup (`:1656–1659`). The ntfy adapter
posts to a topic URL that the ntfy phone app subscribes to
(`notification-adapter-ntfy.ts:1–6`). Notifications fire when a
`human-gate` queue item is created, and also on each completed verb when
`OPENRIG_NOTIFICATIONS_INCLUDE_VERB_COMPLETION=1` (`startup.ts:1648–1649`);
each item, trigger and mechanism is sent at most once per daemon run
(`notification-dispatcher.ts:119–134`, `:156–158`). `POST
/notifications/test` returns 503 `notifications_unconfigured` when no
dispatcher is running (`routes/mission-control.ts:481–492`).
Adapters: **2** — `git grep -l 'implements NotificationAdapter' -- packages/daemon/src | wc -l`
- **Read-only audit-history browse** — `MissionControlAuditBrowse.query`
(`audit-browse.ts:78`) over `mission_control_actions`, exposed at
`GET /api/mission-control/audit` (`routes/mission-control.ts:441`) with
filters (including `scope_tier`, `scope_id`, `scope_path` and
`approval_scope` for scope-approval rows) and `(limit, before_id)`
pagination cursored on SQLite `rowid` (`audit-browse.ts:134`); the page size
defaults to 50 and is capped at 200 (`audit-browse.ts:61–62`).
## 5. Mission Control events
> Drift-fix D8 / OPEN-4 (carried verbatim, slice-00): `architecture.md` §3
> L394 says "Existing 32 PL-004 events untouched" — internally inconsistent
> with §3 L410's "20" and predates 0.3.x. **Do NOT carry either number.**
> The current `RigEvent` union (`packages/daemon/src/domain/types.ts:94`)
> has **73 members** total (slice-00 §1.8, re-confirmed at HEAD); the
> additive `mission_control.*` events are described below WITHOUT asserting
> a contested PL-004 sub-count.
The `RigEvent` union starts at `domain/types.ts:108`; its four
`mission_control.*` members are at `domain/types.ts:308–313`.
Re-confirmed `domain/types.ts:212–218`: Phase A added
`mission_control.action_executed`, `mission_control.cli_drift_detected`,
`mission_control.view_refreshed`; Phase B added
`mission_control.notification_sent`, `mission_control.notification_failed`
(5 `mission_control.*` members at HEAD).
`RigEvent` members: **98** — `sed -n '/^export type RigEvent =/,/^export type PersistedEvent/p' packages/daemon/src/domain/types.ts | grep -c 'type: "'`
`mission_control.*` members: **4** — `sed -n '/^export type RigEvent =/,/^export type PersistedEvent/p' packages/daemon/src/domain/types.ts | grep -c 'type: "mission_control\.'`
- `mission_control.action_executed` — written by the write contract
(`mission-control-write-contract.ts:225`).
- `mission_control.cli_drift_detected` — emitted by the fleet capability
probe (`mission-control-fleet-cli-capability.ts:171`).
- `mission_control.notification_sent` / `mission_control.notification_failed`
— emitted by the notification dispatcher (`notification-dispatcher.ts:174`,
`:184`).
- *(retired)* `mission_control.view_refreshed` — retired per #490; views are
read-on-demand queries without background refresh caching.
## 6. Route surface
`missionControlRoutes({ bearerToken })` is mounted at `server.ts:498`. Key
routes (`routes/mission-control.ts`): `GET /views` (`:245`),
`GET /cli-capabilities` (`:250`), `POST /action` (`:298`, auth-gated),
`GET /audit` (`:346`), `POST /notifications/test` (auth-gated), plus an SSE
surface. The integrated UI is the `/mission-control` top-level route in
`packages/ui/src/routes.tsx` mounting `MissionControlSurface`
(`architecture.md` §3 L390); UI detail lands in
`../ui/project-and-for-you.md`.
`missionControlRoutes({ bearerToken })` is mounted at `/api/mission-control`
(`server.ts:790–793`). Routes (`routes/mission-control.ts`): `GET /views`
(`:259`), `GET /cli-capabilities` (`:264`), `GET /destinations` (`:276`),
`GET /sse` and its alias `GET /watch` (`:303–304`; they forward
`action_executed` and `cli_drift_detected` events,
`:289–291`), `POST /action` (`:314`, auth-gated), `GET /audit` (`:441`),
`POST /notifications/test` (`:481`, auth-gated), and `GET /views/:view-name`
(`:509`).
`POST /action` accepts an optional `hostId`: for a non-local host it forwards
the same verb to that host's daemon (http-transport host entries only; 10 s
timeout). The origin host writes the audit row and nothing is written
locally; a forwarding failure returns 502 `remote_action_failed` with a
`failureClass` (`routes/mission-control.ts:13`, `:352–414`).
In the web UI (`packages/ui/src/routes.tsx`), `/mission-control` is a
redirect to `/for-you` (`:495–500`). `/for-you` renders the For You `Feed`
(`:130–134`), whose cards call `POST /action` through `VerbActions`
(`packages/ui/src/components/for-you/FeedCard.tsx:13`), and `/search` renders
`AuditHistoryView` over `GET /audit` (`routes.tsx:304–308`).
`MissionControlSurface`
(`packages/ui/src/components/mission-control/MissionControlSurface.tsx:9`)
still exists and renders the same `Feed`, but nothing imports it. UI detail
lands in `../ui/project-and-for-you.md`.
## See also
- `coordination-primitive.md` — the PL-004 Phase A `queue_items`/`stream_items`
sources Mission Control reads, and the hot-potato closure contract verbs honor.
- `workflow-runtime.md` — PL-004 Phase D transactional-scribe runtime.
- `../ui/project-and-for-you.md` — the UI surface counterpart (authored phase).
- `coordination-primitive.md` — the `queue_items`/`stream_items` sources
Mission Control reads, and the hot-potato closure contract verbs honor.
- `workflow-runtime.md` — the workflow transactional-scribe runtime.
- `../ui/project-and-for-you.md` — the For You feed that carries the verb
actions in the web UI.
- Source roots: `packages/daemon/src/domain/mission-control/`,
`packages/daemon/src/middleware/auth-bearer-token.ts`,
`packages/daemon/src/routes/mission-control.ts`,
@@ -5,139 +5,310 @@ status: active
topics: [specification-and-bundles, release-and-versioning]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Need to know how rig/pod bundles are assembled (schema-version-2 vs legacy
v1), how bundle create/inspect/install and /api/up route across source kinds,
the staged BootstrapOrchestrator plan/apply flow, or which legacy install-
engine seams still ship for pre-reboot data.
Locate npm package assembly, topology-bundle creation and validation,
source routing, bootstrap plan/apply, or the retained package install engine.
siblings: [agent-spec-and-startup.md, plugin-agent-image-context-pack.md]
prerequisite-reads: [../README.md, agent-spec-and-startup.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Packaging, Bootstrap, Bundles, Legacy Install Engine
# Packaging, bootstrap and bundles
How OpenRig packages a topology into a shareable bundle and reconstitutes it
on another host. Fully dual-format: schema-version-2 pod bundles plus legacy
v1 artifacts, routed deterministically by the bootstrap orchestrator.
This module describes source at main commit
`e8f0ab340db773392ec8be75b072d1c0f3068a50`. Source paths below are repository-relative.
An npm CLI artifact and a `.rigbundle` have different builders and consumers; neither
source verification nor archive integrity establishes that a daemon has adopted an artifact.
> Verified against source at HEAD `7eaf524c` (`git describe` →
> `v0.3.1-6-g7eaf524c`). Package version **0.3.1** (slice-00 §1.1). Source
> located by `architecture.md` headings (§5 Bundles/bootstrap/legacy
> compatibility, §6 Bundle create/inspect/install + /api/up, §11 Compat
> note 3) per slice-08 §10.1 — line numbers advisory only.
## npm CLI assembly
## 1. Bundle, bootstrap, legacy domain services
`scripts/build-package.sh` builds the daemon, web UI, TUI and CLI, then assembles their
outputs under `packages/cli`. The publishable file list and binary declarations live in
`packages/cli/package.json`.
(`architecture.md` §5 "Bundles, bootstrap, and legacy compatibility")
The assembler writes generated `BUILD_INFO` modules into the daemon and CLI outputs with
the package version, Git commit, dirty flag and build time. The dirty check covers tracked
and untracked inputs under `packages/` and `scripts/`; it is not a whole-worktree status
claim.
- `pod-bundle-assembler.ts` — schema-version-2 bundle assembler.
Re-confirmed: emits `schemaVersion: 2` (`pod-bundle-assembler.ts:167`).
- `bundle-types.ts` — v1 and v2 manifest types plus parse/validate/serialize.
Re-confirmed: v2 `PodBundleManifest` type carries `schemaVersion: 2`
(`:23`); `validatePodBundleManifest` rejects unless `schema_version === 2`
(`:38`); `serializePodBundleManifest` writes `schema_version: 2` (`:62`);
`parsePodBundleManifest` (`:87`); legacy path
`validateLegacyBundleManifest` (`:143`) — both formats live in one file.
- `bundle-source-resolver.ts` — `LegacyBundleSourceResolver`
(`bundle-source-resolver.ts:25`) plus `PodBundleSourceResolver` (`:132`).
- `bootstrap-orchestrator.ts` — staged bootstrap flow with direct pod-aware
rig and v2 bundle delegation. `BootstrapMode = "plan" | "apply"`
(`bootstrap-orchestrator.ts:26`).
- `up-command-router.ts` — spec/bundle source classification for `/api/up`.
`SourceKind = "rig_spec" | "rig_bundle" | "rig_name"`
(`up-command-router.ts:6`).
The same script:
All re-confirmed present in `packages/daemon/src/domain/` @HEAD.
- Generates shipped context packs through `scripts/generate-context-packs.mjs`.
- Copies daemon output, assets, specs, context packs, policies and `docs/reference/`.
- Checks the specs staging input with `scripts/check-internal-leak-guard.mjs` and writes
the staged substance-root inventory into the package.
- Copies the web UI and TUI outputs.
- Runs `scripts/rewrite-daemon-imports.mjs` so staged CLI/TUI JavaScript resolves the
shipped daemon output rather than an unpublished workspace package.
## 2. Bundle create / inspect / install
This is the build layout. Native dependency installation and consumer runtime behavior need
their own checks; this document does not infer them from a successful assembly.
(`architecture.md` §6 "Bundle create / inspect / install")
## Topology-bundle creation
`routes/bundles.ts` is fully dual-format:
`packages/daemon/src/routes/bundles.ts` mounts create, inspect, install and history handlers
under `/api/bundles` (the mount is in `packages/daemon/src/server.ts`).
- **create** — detects a pod-aware RigSpec and uses `PodBundleAssembler`
(accepts an optional `rigRoot`); legacy create still uses
`LegacyBundleAssembler`.
- **inspect** — safely extracts the archive, detects `schema_version`; v2
returns `schemaVersion: 2`, `agents[]`, and integrity data; v1 returns the
legacy manifest shape.
- **install** — uses the full bootstrap plan/apply; bootstrap peeks the
manifest and routes deterministically to `pod_bundle` or `rig_bundle`.
Re-confirmed at source: `bootstrap-orchestrator.ts:134-143` — when
`sourceKind === "rig_bundle"` it unpacks to a temp peek dir, reads
`bundle.yaml`, and calls `parsePodBundleManifest(...)` to detect the
schema version before routing.
The create handler validates the source spec before comparing it with recorded live topology.
A divergent spec is refused unless the request explicitly allows drift; an allowed divergence
is recorded in the bundle's provenance notes. The exported spec is not silently rewritten
from live state.
## 3. `/api/up` source routing
| Source shape | Builder and output |
|---|---|
| Pod-aware rig spec | `packages/daemon/src/domain/pod-bundle-assembler.ts`: `PodBundleAssembler.assemble()` produces schema-version-2 metadata, vendors resolved agent trees, and rewrites agent references to local paths. |
| Legacy rig spec | `packages/daemon/src/domain/bundle-assembler.ts`: `LegacyBundleAssembler` (imported as `BundleAssembler` by the route) collects the referenced legacy packages and produces the legacy manifest shape. |
(`architecture.md` §6 "`/api/up`")
The pod builder collects culture, docs and startup material, preserves file bytes, and skips
vendoring the terminal sentinel as an agent. A copied file keeps its source mode with owner
read and write added. Required document collection failures stop assembly; missing declared
skills can instead produce warnings, which are also written into the provenance notes.
Inspect the builder's collection helpers when changing these distinctions.
`UpCommandRouter` + `BootstrapOrchestrator` own:
Both route branches can consume a source-root `bundle.yaml` to carry declared skills,
plugins, workflow specs, context packs, agent images and preconditions into staging before
computing integrity. Manifest types, validation and serialization are in
`packages/daemon/src/domain/bundle-types.ts`. Provenance and compatibility are metadata;
provenance is not an author signature.
- direct pod-aware rig specs,
- legacy rig specs,
- v1 bundle installs,
- v2 pod-bundle installs.
Preconditions are carried as data. Commands containing shell operators produce a warning,
inspect reports the block, and the behaviour view lists it under needs. The install and
bootstrap code do not reference preconditions.
Plan mode and apply mode both work across those source kinds.
Two more inputs are accepted only for a pod-aware spec; the legacy branch refuses them with
a 400:
> Definitional note (carried, not a numeric drift) — `architecture.md` §6
> describes bootstrap routing to `pod_bundle` / `rig_bundle`. The
> `UpCommandRouter` *classification* enum is `SourceKind = "rig_spec" |
> "rig_bundle" | "rig_name"` (`up-command-router.ts:6`); the
> `pod_bundle`-vs-`rig_bundle` distinction is resolved one layer deeper in
> `bootstrap-orchestrator.ts` by peeking the manifest schema version
> (`:134-143`). Both statements are accurate at different layers; documented
> here so the layering is explicit rather than appearing contradictory.
- `--context-pack <dir>` (`vendorContextPackDir()` in
`packages/daemon/src/domain/bundle-carried-context-pack.ts`) carries a pack's
`manifest.yaml` and its declared files to `context-packs/<manifest name>/`. The pack may
sit outside the rig folder.
- `--project-dir <dir>` (`vendorProjectDir()` in
`packages/daemon/src/domain/bundle-carried-project.ts`) carries a folder with a
`project.yaml` to `project/`.
## 4. Legacy install engine (still ships)
Create also refuses content it must not ship. `computeIntegrity()` in
`packages/daemon/src/domain/bundle-integrity.ts` throws on sensitive paths (`.env` files,
`*.pem`, `*.key`, `*.p12`, `credentials.*`, `tokens.*`, `.git/` and `node_modules/`).
`assertShippableSubstance()` in `packages/daemon/src/domain/agent-resolver.ts` runs on
vendored content and on the final staging tree, and refuses text containing
`substrate/shared-docs/` and files declaring `taxonomy: lore`.
(`architecture.md` §5 "Legacy systems that still ship" + §11 compat note 3)
### Configurations and package identity
These pre-reboot seams remain active for backward compatibility:
A bundle folder may declare alternate team configurations in `configurations.yaml` beside
`rig.yaml` (`packages/cli/src/lib/bundle-configuration.ts`). `rig bundle configurations
<spec>` lists them. `rig bundle create --preset <name>` or `--seat <member=runtime>` resolves
one and stages a copy of the rig folder in a temporary directory with the chosen runtimes and
profiles, so the author's folder is never changed. With a GitHub folder link, `rig up`,
`rig bundle create`, `inspect` and `install` take the same two options and stage a copy of the
whole checkout (`importGitHubBundle()` in `packages/cli/src/lib/bundle-source.ts`).
- package install engine: `package-install-service.ts`,
`package-manifest.ts`, `package-repository.ts`, `install-engine.ts`,
`conflict-detector.ts`, `role-resolver.ts` (all re-confirmed present
@HEAD).
- bootstrap and requirement-probe support.
- discovery and claim services.
- tmux/cmux adapters and resume adapters.
`packages/daemon/src/domain/bundle-identity.ts` defines the two identity values:
> Drift-check D-pkg — `architecture.md` §5/§6 carries no slice-00 numeric
> drift in this content; the v2 bundle-assembler + dual-format flows were
> verified accurate at HEAD (§1–§3 above). The footprint/migration counts
> that ARE stale land in `daemon-core.md`, not here.
- `configurationId()`: every member's `pod.member=runtime`, sorted and joined with `,`.
Create computes it from the normalized spec and returns a 400 if the client sent a
different one.
- `packageDigest()`: SHA-256 over the sorted `integrity.files` entries (coverage label
`openrig.package-digest/v1`). It covers every packaged file's bytes; it does not cover
`bundle.yaml`, the junk files the integrity walk skips, or file modes.
Compat note 3 (carried verbatim, `architecture.md` §11): "Legacy
compatibility seams still ship for pre-reboot data and v1 artifacts." (The
full §11 list lives in `architecture-rules-and-event-system.md`.)
Create and inspect responses carry the source, configuration ID, package digest, archive
hash and assembler version.
> Provenance note (carried, not asserted): `bootstrap-orchestrator.ts:3-5`
> still imports `LegacyRigSpec` / `LegacyRigSpecCodec` / `LegacyRigSpecSchema`
> with in-source `TODO: AS-T08b — migrate to pod-aware RigSpec` markers, and
> `:16` `TODO: AS-T12 — migrate to pod-aware bundle source resolver`. The
> legacy seam is intentional, in-progress migration scaffolding — recorded
> as-is, not smoothed.
### Archive checks
## OPEN / carried items
`packages/daemon/src/domain/bundle-archive.ts` owns `pack()` and `unpack()`;
`packages/daemon/src/domain/bundle-integrity.ts` owns the per-file integrity map.
- **D-pkg (resolved-as-current):** no slice-00 numeric drift in this
module's split content; v2 assembler + dual-format flows verified accurate
at HEAD. Bundle-routing layering documented explicitly to pre-empt an
apparent §6-vs-source contradiction.
- Legacy-migration TODOs carried from source verbatim (AS-T08b / AS-T12).
Packing requires a `.rigbundle` output path, sorts entries, uses portable tar metadata, a
fixed tar timestamp and gzip level 9, and writes a sibling SHA-256 file. Unpacking checks that
digest, rejects archive links and unsafe entry paths before extraction, requires
`bundle.yaml` and its integrity section, and verifies the extracted file inventory. Hashes
establish consistency with the supplied manifest and digest; they do not authenticate
whoever supplied both.
## See also
The inspect handler does not call `unpack()`, because it must report a broken bundle rather
than refuse it. It reports a missing or mismatched digest as `digestValid: false`, applies the
same unsafe-entry pre-scan (`collectUnsafeArchiveEntries()`) and extraction filter, and runs
`verifyIntegrity()` to report an `integrityResult`. A syntactically valid manifest alone is
not an inspected archive.
- `agent-spec-and-startup.md` — `RigInstantiator` / `PodRigInstantiator` and
the dual-format spec seam that bundles wrap.
- `plugin-agent-image-context-pack.md` — the 0.3.0/0.3.1 reusable
starter-state / content-provenance cluster (authored separately in 8.4b).
- `daemon-core.md` — `/api/up` + `/api/bundles` are among the 49 route
mounts; `BootstrapOrchestrator` is constructed in the createDaemon
sequence.
- Source roots: `packages/daemon/src/domain/{pod-bundle-assembler,
bundle-types,bundle-source-resolver,bootstrap-orchestrator,
up-command-router}.ts`, `packages/daemon/src/routes/{bundles,up}.ts`.
Inspect also returns a behaviour view, `describeBundleBehaviour()` in
`packages/daemon/src/domain/bundle-behaviour.ts` (schema `openrig.bundle-behaviour/v1`). It
reads the extracted archive only, through `bundle-behaviour-inspect.ts` (regular UTF-8 files,
at most 1 MiB each and 8 MiB in total, opened without following links). It lists the team,
each seat's permission posture, the files seats are told to read, what else runs, where
content is written, literal outside addresses, needs, and what can't be known before launch.
A schema-1 archive gets `state: not_generated`. Posture comes from the member's or rig's
`permission_policy`: `builtin:yolo` is full bypass and `builtin:auto` is auto, both by launch
flag; `builtin:locked`, `builtin:standard` and `builtin:open` are configuration; a policy file
is read from the archive or marked unresolved; no policy means the product default. A rig-level
`non_interruptive` boolean is reported on each full-bypass Claude Code or Codex seat as
`nonInterruptiveDefault`, and `true` drops the Claude bypass first-run warning. The CLI prints
the view before `rig bundle install` and `rig up` as diagnostics only; it never changes the
request or the exit code.
## Source routing and bootstrap
`packages/daemon/src/domain/up-command-router.ts` classifies a source as
`rig_spec`, `rig_bundle`, `rig_name` or `topology`. It recognizes named rigs,
spec paths, `.rigbundle`, `.rigtopology`, and YAML with a top-level rigs list;
extensionless paths also have content detection.
`packages/daemon/src/routes/up.ts` then selects the execution path:
| Input | Consumer |
|---|---|
| Existing rig name | Existing-rig restore path; unarchived rigs of that name are preferred. |
| Single rig spec or bundle | `BootstrapOrchestrator.bootstrap()` in `packages/daemon/src/domain/bootstrap-orchestrator.ts`. |
| Topology manifest | `MultiRigLauncher`, with a single-rig bootstrap or remote-up leaf per entry. |
Topology plan mode is rejected. Placement belongs on the individual topology entries; a
top-level host flag is rejected. The selected topology parser/route also rejects nested
topologies, existing-rig-name entries and `.rigbundle` entries: topology entries are spec
paths only. This is narrower than the single-rig `up` surface.
Bootstrap distinguishes pod-aware and legacy specs, and inspects a bundle manifest to choose
`PodBundleSourceResolver` or `LegacyBundleSourceResolver` from
`packages/daemon/src/domain/bundle-source-resolver.ts`. Thus the router's
`rig_bundle` kind does not imply a legacy manifest.
For pod-aware specs, plan mode validates and runs preflight probes; apply delegates to
`PodRigInstantiator`. Plan mode still records a bootstrap run/result: it is not a pure
file read. Apply reports partial completion when nodes fail or require attention, preserving
the created rig identity rather than claiming every member launched. Apply's non-interruptive
choice is the request's, else the spec's top-level `non_interruptive`, else the
`launch.non_interruptive` setting.
### Durable install target
Bundle apply requires an explicit target root at the HTTP boundary. The CLI supplies the
current directory as the default for `rig up <file>.rigbundle` and for a GitHub link through
`rig up` or `rig bundle install`. `rig bundle install` with a local `.rigbundle` sends no
default, so apply without `--target` gets a 400. For a pod bundle,
`materializePodBundle()` copies the verified extraction into that durable root before
instantiation, so local agent references and relative working directories survive removal
of the extraction directory. It checks destination conflicts before copying, preserves
identical files, and refuses differing files or incompatible destination types.
When an unarchived or running team already has the bundle's rig name (`bundleInstallContext()`
in `packages/daemon/src/domain/bundle-install-context.ts`), pod-bundle apply refuses before
writing if any of them is running. If the target is that team's own install folder (its
`bundle.yaml` names the offered schema-2 bundle, or `my-bundle` or `github-bundle`, the default
names before 0.6.7, and it is the folder recorded in `rigs.install_root` when any of those teams
recorded one; `isExistingBundleTarget()`), bootstrap first
confirms the old sessions are stopped; materialization then copies each conflicting path to a
`bundle-backups/reinstall-*` folder under the OpenRig home, with a `RESTORE.json`, before
replacing it, and leaves unrelated files in place. Any other target keeps the conflict refusal.
The instantiator archives the stopped earlier generation. Pod-bundle apply records the
target's real path as the new rig's `install_root` (migration `096`).
Pod bundles containing service definitions are refused by bootstrap; their service path
requires a stable spec directory. Direct spec bootstrap has separate service prelaunch
handling. See [agent-spec-and-startup.md](agent-spec-and-startup.md) for instantiation.
## GitHub folder links and the bundle check
`packages/cli/src/lib/bundle-source.ts` lets `rig up`, `rig bundle create`, `inspect` and
`install` take a GitHub folder link (`isGitHubBundleLink()`). Only a credential-free
`https://github.com/owner/repo[/tree/<ref>/<folder>]` link is accepted. The ref is resolved to
the longest matching branch or tag, or taken as a full commit hash. The import:
- needs a healthy local daemon whose `selfHostId` matches the local origin;
- runs Git with credential helpers, hooks and non-HTTPS protocols disabled;
- shallow-fetches the exact commit into `bundle-imports/` under the OpenRig home, requires a
`rig.yaml` in the folder, and refuses symlinks or agent and package references that resolve
outside the checkout;
- posts the folder to `/api/bundles/create` with the source recorded in provenance, refuses a
response without a package digest or with a different source commit, and writes
`source.json` and `build.json` in the import folder.
`rig bundle check <folder>` (`checkBundleFolder()` in `packages/cli/src/lib/bundle-check.ts`)
is an advisory, file-read-only check against `openrig.bundle-standard/v1`; it makes no daemon,
launch or provider call. Its rules are `pod_aware_rig`, `readme_in_docs`, `referenced_files`,
`portable_agents`, `minimum_versions`, `configurations` and `credential_paths` (a filename scan
bounded at 10,000 entries that skips `.git`, `node_modules` and symlinks). `readme_coverage`
and `embedded_secrets` are always reported as not checked, and host-resolved resources are
reported as checked at launch (`host_resources`). Any finding sets exit code 1.
## Install checks and content routing
The install handler in `packages/daemon/src/routes/bundles.ts` obtains a source-path
lock, reads validated metadata, checks compatibility, and checks a declared rig name
against same-name rigs with running sessions before bootstrap; a stopped team of that name
doesn't block it. A conflict returns a 400 with `status: "not_attempted"`, the installed team
and the offered bundle, and three choices: use the existing team, stop it and retry to replace
it, or cancel. The compatibility override `skipVersionCheck` and name-conflict override `force`
are explicit request fields; neither skips the metadata pass, which always validates the
manifest.
`packages/daemon/src/domain/bundle-conflict-detector.ts` implements the rig-name check.
It is not a complete agent, port or filesystem collision audit; a missing rig name supplies
no name comparison. Target-file conflicts are handled separately by materialization.
Skipping these prechecks does not skip archive validation in bootstrap.
Declared content is routed by `routeBundleContents()` in
`packages/daemon/src/domain/bundle-content-routing.ts`, which unpacks the bundle once and
routes each kind independently. When it runs depends on the bundle schema:
- **Pod-aware (schema 2):** bootstrap runs it as `PodRigInstantiator`'s prelaunch hook, after
the rig record exists and before any seat launches, so every seat's first turn can see the
content.
- **Legacy (schema 1):** there is no hook, so the install route routes after bootstrap, and
only when the status is `completed`.
| Manifest content | Destination |
|---|---|
| `skills` | The OpenRig `packages` cache, stripping the legacy `packages/` prefix; this does not import a complete harness skill into the managed skill catalog. |
| `plugins` | The OpenRig `plugins` root, through local plugin references. |
| `workflow_specs` | `workflows/` beneath the resolved `workspaceSpecsRoot`. If that setting is empty, this kind is recorded as a routing failure. |
| `context_packs` | The configured `context.root`, matching context-library discovery. |
| `agent_images` | The OpenRig `agent-images` root; declarations address image directories containing a manifest. |
| `project` | Registered in the workspace catalog (`workspace.catalog_path`) with the rig associated, and its files placed under `workspace.projects_root/<id>` (`registerBundleProject()` in `packages/daemon/src/domain/workspace/project-registration.ts`). A conflict changes nothing and is a routing failure. |
Context packs are never merged into an installed pack of the same name: an identical one is
reported as `already_installed`, a different one is kept unchanged as `kept_existing`. After
routing, the live context library rescans, and a routed pack it can't load becomes a routing
failure.
The per-kind implementations are the `bundle-skills-router.ts`, `bundle-plugins-router.ts`,
`bundle-workflow-specs-router.ts`, `bundle-context-packs-router.ts` and
`bundle-agent-images-router.ts` files under `packages/daemon/src/domain/`. Routing is best
effort in both cases: the hook always lets the launch continue, and a failure never rolls back
or fails the install. Failures appear in the result's `routingFailures` and `warnings`, in a
`route_bundle_contents` stage for the hook, and in the install audit record.
Install audit records are appended best effort to `bundle-audit.jsonl` under the OpenRig
home; the history endpoint reads that audit. Bootstrap run state and action journals are
separate, repository-backed records.
## Legacy package install path
The legacy path remains executable, not just an archive parser.
`packages/daemon/src/routes/packages.ts` is mounted at `/api/packages`, and legacy
bootstrap calls `PackageInstallService` in
`packages/daemon/src/domain/package-install-service.ts`.
The source chain is package resolution/manifest validation, planning and conflict policy,
then apply/verification with repository records:
- `resolvePackage()` in `packages/daemon/src/domain/package-resolve-helper.ts`, which reads
and validates through `package-manifest.ts`. `package-resolver.ts` supplies the types; its
`PackageResolver` class has no production caller.
- `packages/daemon/src/domain/install-planner.ts`, `conflict-detector.ts` and
`install-policy.ts`. The planner refuses any planned destination outside the install
target.
- `packages/daemon/src/domain/install-engine.ts`, `install-verifier.ts`,
`install-repository.ts` and `package-repository.ts`.
Legacy bootstrap also probes requirements and records staged outcomes before rig
instantiation. A failed package installation prevents that path from importing the rig.
This compatibility implementation does not imply that pod-aware bundles use the same
package-install stages.
## Related maps
- [plugin-agent-image-context-pack.md](plugin-agent-image-context-pack.md): content library
consumers and their state boundaries.
- [daemon-core.md](daemon-core.md): bootstrap construction and HTTP wiring.
- [agent-spec-and-startup.md](agent-spec-and-startup.md): spec resolution, projection and launch.
@@ -5,353 +5,329 @@ status: active
topics: [extension-and-user-workspace, continuity, skill-management]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Need to know how OpenRig discovers plugins, captures/forks agent images,
assembles/sends context packs, or how the Claude auto-compaction enforcer
decides to send /compact. Author-mode module — no prior architecture.md
prose; every claim is sourced to file:line at HEAD.
Locate plugin discovery and vendoring, context-pack addressing/composition,
agent-image capture/fork/protection, or Claude guided-compaction behavior.
siblings: [packaging-bootstrap-bundles.md, agent-spec-and-startup.md]
prerequisite-reads: [../README.md, agent-spec-and-startup.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Content Layer — Plugins, Agent Images, Context Packs, Compaction Policy
# Content libraries and compaction
Four filesystem-canonical content primitives the daemon discovers and
serves: **plugins**, **agent images**, **context packs**, and the **Claude
auto-compaction policy enforcer**. None adds SQLite state — all are
filesystem-canonical with in-memory daemon caches.
This module describes source at main commit
`e8f0ab340db773392ec8be75b072d1c0f3068a50`. Source paths below are repository-relative.
Context packs, plugins and agent images have filesystem-backed content and daemon-side
discovery. Their consumers can read database identity, mutate files, deliver messages or
launch sessions; the whole layer is not a read-only catalog.
> **AUTHOR-FROM-SOURCE module.** No prior `architecture.md` prose exists
> for this. Every load-bearing claim carries `> Source: <file:line>
> @HEAD`; ambiguity is declared as an OPEN item, never smoothed. Paths are
> relative to `packages/daemon/src/` unless prefixed `docs/`.
>
> Verified at HEAD `7eaf524c` (`git describe` → `v0.3.1-6-g7eaf524c`).
> Package version **0.3.1**; HEAD carries 6 unreleased release-0.3.2
> commits; no `v0.3.2` tag (daemon-core.md; slice-00 §1.1).
## Context packs
## 0. Release attribution (forensic seam — read first)
`packages/daemon/src/domain/context-packs/context-pack-library-service.ts` implements
`ContextPackLibraryService`. A pack contains `manifest.yaml` and declared members.
Its path-like ref is the lookup identity, independently of the manifest name/version;
the entry ID is `context-pack:<ref>`.
Re-verified at HEAD via `git cat-file -e <tag>:<path>`:
### Discovery and mutation
| Subsystem | Release | Forensic proof @HEAD |
|---|---|---|
| Context packs | **0.3.0** | `v0.3.0:domain/context-packs/context-pack-library-service.ts` → present (slice-00 0.3.0-GT §1.9) |
| Agent images | **0.3.0** | `v0.3.0:domain/agent-images/agent-image-library-service.ts` → present (slice-00 0.3.0-GT §1.9) |
| Plugins | **0.3.1, NOT 0.3.0** | `v0.3.0:domain/plugin-discovery-service.ts` → **ABSENT**; `v0.3.1:` → present (slice-00 0.3.0-GT seam (a); map row 5) |
| Claude auto-compaction | **0.3.1 headline, no 0.3.0 antecedent** | `v0.3.0:domain/claude-compaction-enforcer.ts` → **ABSENT**; `v0.3.1:` → present (slice-00 0.3.0-GT map row 7) |
Startup in `packages/daemon/src/startup.ts` configures the shipped context-pack root (when
it exists), the resolved `context.root` and its `system` root, followed by the
workspace-local `.openrig/context-packs` root. The workspace root is registered even before
it exists, so a folder created later is found by the next sync; it is left out only when it
is the same path as one of the other two. The library scans recursively, stops descending
when it finds a pack manifest, skips `.tmp-add-*` staging folders, and does not follow
directory symlinks.
> Source: re-run at HEAD `7eaf524c` —
> `git cat-file -e v0.3.0:packages/daemon/src/domain/plugin-discovery-service.ts`
> and `...claude-compaction-enforcer.ts` both fail ("exists on disk, but
> not in 'v0.3.0'"); the two 0.3.0 library services resolve at `v0.3.0`.
> Code present on disk at HEAD does NOT make plugins/compaction a 0.3.0
> feature — ancestry is truth; the same-calendar-day commit date is the
> forensic trap slice-00 0.3.0-GT seam (a) warns about.
The first configured root to encounter a physical pack owns that directory. For distinct
physical packs with the same ref, the later root wins. This distinction prevents overlapping
roots from giving the same physical pack a second address. Scan replaces the in-memory ref
index and reports malformed packs instead of indexing them.
**Do not back-attribute plugins or compaction to 0.3.0.** The CLI
reference already encodes this ("## Plugin Inspection (v0.3.1)").
`composeFromFiles()` creates a durable pack after validating its ref, destination and
sources. `removeByRef()` removes the selected pack directory and rescans, but refuses
shipped builtin packs. Library mutation and lookup share ref validation.
> Source: `docs/as-built/cli-reference.md:943` @HEAD.
`packages/daemon/src/domain/context-packs/manifest-parser.ts` parses manifests.
Its supported file suffixes include Markdown/YAML/text and `.sh`, `.ts`, `.mjs`,
`.py` helper assets. Those assets are served as text; pack assembly does not execute them.
The parser also validates atom metadata and named profiles.
## 1. Context packs (PL-014) — 0.3.0
### Assembly, addresses and profiles
A **context pack** is a directory of `manifest.yaml` + included markdown /
yaml / txt files: operator-authored, library-discoverable, reviewable, and
composable. The `rig context` noun is delivery-free. No SQLite tables;
in-memory cache at daemon scope.
These are separate projections:
> Source: `domain/context-packs/context-pack-types.ts:1-11` @HEAD.
| Operation | Source and behavior |
|---|---|
| Framed pack preview | `packages/daemon/src/domain/context-packs/bundle-assembler.ts`, `assembleBundle()`: pack/file headers, file metadata, token estimates and `missingFiles`. Missing members are reported and skipped; a failed read of a present member raises an error. |
| Plain file composition | The same file's `assemblePlainFiles()`: present files in declared order, separated by two newlines, without framing or trimming their bytes. |
| Addressed read | `packages/daemon/src/routes/context-packs.ts`, `/library/resolve-address`: longest matching pack-ref prefix, a declared file, then optional H2/H3 heading selection through `packages/daemon/src/domain/markdown-address.ts`. |
| Situation profile | `packages/daemon/src/domain/context-packs/profile-composer.ts`, `composeProfile()`: select atoms, close dependencies, order and resolve each piece. |
| Named profile | The same file's `composeNamedProfile()`: declared phases select atoms or supplied work/seat context, preserving phase IDs in the result. |
`ContextPackLibraryService.scan()` walks roots, parses each
`manifest.yaml`, replaces the in-memory index; collisions are
**last-wins** in discovery order (workspace > user_file > builtin).
Startup wires the builtin root (`../context-packs`, first), the configured
user-file root (`context.root`, default `$OPENRIG_HOME/context`), its
`system/` child as the canonical System World root, and the workspace-local
`<workspaceRoot>/.openrig/context-packs` root when present + distinct. A pack is
addressed by its path-like **ref** (e.g. `packs/compaction-restore`), which is
its unique identity; the opaque entry id is `context-pack:<ref>` (a UI routing
key). Colon-id `context-pack:<name>:<version>` addressing and the `/library/:id`
routes were removed in Slice-03 Atom 5. Resolution is by ref only through
`getByRef` and the read/delete/preview/pieces route family. Startup accepts
ordinary files only and rejects context-pack expansion; compose a durable ref
first, then use a dedicated delivery verb when delivery is intended.
Situation composition selects fresh atoms for `fresh`, fresh plus handover atoms for
`handover`, and post-compaction plus handover atoms for `post-compaction`. Runtime
selection is Claude or Codex, with `any` atoms applicable to either. Required atoms join
the selection; missing dependencies or runtime-incompatible dependencies fail composition.
The output is ordered by atom order, then ID. Profile-only atoms are excluded from ordinary
situation selection, but the dependency closure doesn't check that flag, so one can still join
as a dependency of a selected atom. Post-compaction composition skips an absent
`seat:RECAP.md` and reports it as skipped instead of failing.
> Source: `domain/context-packs/context-pack-library-service.ts:59-94`
> (scan; last-wins L79-81), `:31-33` (id); `startup.ts`
> (`contextPackLibrary` construction) @HEAD.
The profile route resolves configured tree sources through
`packages/daemon/src/domain/context-packs/profile-source-resolver.ts`.
Seat context requires explicit rig and seat selectors. Mission/slice selectors and named
profile context requirements are validated before reading those trees. The default
project/mission/slice walk is bounded to the conventional single-project workspace layout
and fresh situation; it is not an arbitrary project-catalog resolver.
The parser is pure (no fs; caller passes raw YAML). It rejects malformed
YAML, missing `name`/`version`, non-array `files`, per-file path traversal
(`..`/leading `/`), and unsupported suffixes (`.md .markdown .yaml .yml
.txt`); `version` coerced to string. Per-file token estimate is
`ceil(bytes/4)`.
Each resolved piece names its address/source and reports estimated tokens. A token budget
reports overage and drop candidates without silently truncating the profile. Atom
`regions` are metadata; the profile endpoint has no region-subset selector.
> Source: `domain/context-packs/manifest-parser.ts:11` (suffixes),
> `:13-121` (rejects; traversal `:83-89`); token estimate
> `context-pack-library-service.ts:46-48` @HEAD.
### HTTP and CLI boundaries
`assembleBundle` concatenates files into one paste-ready string framed
`# OpenRig Context Pack: <name> v<version>` + optional purpose + `## File:
<path> (role: <role>)` headers. Missing files are **skipped and surfaced
in `missingFiles`** (operator repair), not a hard fail; a present-but-
unreadable file throws `file_read_failed`.
`packages/daemon/src/server.ts` mounts `contextPacksRoutes()` at
`/api/context-packs`. Its library handlers cover list, sync, compose, read/delete by ref,
preview, pieces, addressed reads and profile composition.
> Source: `domain/context-packs/bundle-assembler.ts:38-39` (prefixes),
> `:73-100` (missing skip L74-76; read-fail throw L81-87) @HEAD.
`packages/cli/src/commands/context.ts` implements `rig context`, including `list`, `show`,
`preview`, `get`, `profile`, `compose`, `add`, `rm` and `sync`, plus `work-install`, `trace`,
`source inspect|update` and `recap-write`. The library read/compose routes do not themselves
send a pack to a running seat. Several verbs write: `add` installs into `context.root` (from
a folder, a URL, or Git with `--git`), `source update` fetches and merges a Git-installed pack
and resyncs, `work-install --apply-skills` reconciles skill projections, and `recap-write`
writes a seat recap. Inspect the selected CLI verb before treating a context command as
read-only. `rig context work-install` resolves a project position and its declared context
without the daemon; [workspace-primitive.md](workspace-primitive.md) covers project
resolution.
`contextPacksRoutes()` exposes a ref-primary, delivery-free library surface:
`GET /library`, `POST /library/sync`, `POST /library/compose`,
`GET/DELETE /library/by-ref`, `GET /library/by-ref/preview`, and
`GET /library/by-ref/pieces`. Preview returns the assembled review shape;
pieces returns ordered member contents plus the whole plain text and byte size.
There is no pack-owned delivery route. CLI library verbs are
`rig context compose|list|show|preview|sync|add|rm`; delivery belongs to
`rig send --context`, `rig broadcast --context`, `rig walk --through`, and
`rig queue create --body-context`.
On a profile read, the route adds each piece's `sha256` and provenance, with a warning when a
piece's bytes come from outside the granted folder. Rig and seat selectors grant the seat's
folder as a source root and supply a default `seat:LEARNED.md` atom to named profiles whose
phases request seat context. An ordinary situation profile includes that file only when the
pack authors a seat atom; the selectors alone don't add it.
> Source: `routes/context-packs.ts` (complete route table);
> `domain/startup-validation.ts` (file-only startup contract);
> `packages/cli/src/commands/context.ts`, `send.ts`, `broadcast.ts`,
> `walk.ts`, and `queue.ts` @HEAD.
### System World, seat recaps and skill loadouts
## 2. Agent images (PL-016) — 0.3.0
`packages/daemon/src/domain/system-world.ts` reads the System World manifest (schema
`openrig.system-world/v0alpha1`): an id, a version, the context packs every seat starts from,
and system skills. The `context.system_world` setting selects the default manifest at
`system/system-world.yaml` under `context.root`, disables it, or names another manifest file.
The default (`openrig-default`) names the `onboarding-width` and `world-public` packs and no
skills; it is seeded when missing.
An **agent image** is a snapshot bundle of a productive seat's resumable
state: runtime-specific resume token (Claude `resume_token` / Codex
`thread_id`), source-seat lineage, optional cwd-deltas + notes. Consumable
by AgentSpec `session_source: mode: agent_image`. Filesystem-canonical at
`~/.openrig/agent-images/<name>/` + workspace-local; **no SQLite tables**.
`rig context recap-write --rig <rig> --seat <seat> --file <file>` writes the seat's
`RECAP.md` through `packages/daemon/src/domain/context-packs/seat-recap-store.ts`. The previous
recap is kept byte-for-byte under `recap-superseded/`. A recap that isn't addressable Markdown
is refused; the other content checks are advisory.
> Source: `domain/agent-images/agent-image-types.ts:1-13` @HEAD.
`packages/daemon/src/domain/skill-catalog.ts` resolves a seat's skill loadout from the
catalog at `skills.root` (`catalog.yaml`, schema `openrig.skill-catalog/v1`) and the system,
topology and project selections. It projects skills into `<cwd>/.claude/skills` or
`<cwd>/.agents/skills` and tracks what it owns in
`<cwd>/.openrig/skill-loadouts/<runtime>.json`. Each projection reports `current`, `missing`,
`shadowed`, `stale` or `conflicting`. `rig skill loadout --runtime <runtime>` inspects the
composed projection and reconciles it only with `--apply`; `rig skill audit` is a separate
read-only provenance and freshness audit. Launch applies the selected loadout per seat.
`AgentImageLibraryService` mirrors `ContextPackLibraryService` (scan / list
/ get / last-wins) with three source-stated differences: `sourceResumeToken`
passes through to consumers (instantiator consumes; operator surfaces
redact); `stats.json` is a separate mutable file updated atomically on
fork-count increment; a `.pinned` sentinel pins from prune. Id
`agent-image:<name>:<version>`.
For a Claude Code or Codex seat, the profile resolver also adds each selected plugin's skills to
that loadout (`packages/daemon/src/domain/profile-resolver.ts:309–330`, with
`resolvePluginSkills()` at `skill-catalog.ts:460`). Neither runtime reads skills from the plugin
folder projected into the working directory. The skills are projected under their plain names,
and a skill the profile already selects keeps its source. A kept plugin copy (an edited or
user-owned one, or OpenRig's own copy whose plugin source changed or moved after the loadout
was resolved, `skill-catalog.ts:1060–1068`) gives a `plugin_skill_kept` warning, and an unreadable one gives
`plugin_skill_skipped`. If plugin skills can't be projected at all, the seat starts without them
and gets a `plugin_skills_not_projected` warning (`rigspec-instantiator.ts:2045`).
> Source: `domain/agent-images/agent-image-library-service.ts:5-14`
> (3-difference comment), `:38-41` (id) @HEAD.
## Agent images and forks
`discoverResumeToken(db, sourceSession)` queries `sessions` then `nodes`
and returns a typed failure (`session_not_found`/`runtime_unsupported`)
rather than fabricating a token; only `claude-code`/`codex` have a native
fork primitive. Claude prefers `context_usage.session_id` over persisted
`sessions.resume_token`; Codex uses `resume_token`, falling back to a
binding's `external_session_name` for `external_cli` seats; returns
`nativeId: null` honestly when none.
`packages/daemon/src/domain/agent-images/agent-image-library-service.ts` implements
`AgentImageLibraryService`. Startup registers the OpenRig `agent-images` root and,
when present, the workspace-local `.openrig/agent-images` root. Entries are keyed by
`agent-image:<name>:<version>`, with later discovery roots replacing identical IDs.
Content is a manifest plus optional files; `stats.json` holds usage data and `.pinned`
marks protection from ordinary deletion/pruning.
> Source: `domain/agent-images/resume-token-discovery.ts:37-85` (honest
> null L84; Claude pref L64-69; external_cli L78-83); honesty comment
> `:9-10` @HEAD.
Capture and consumption depend on live identity as well as library files:
`SnapshotCapturer.capture()` routes through `discoverResumeToken`, throws
`AgentImageError` on failure or missing native id (no fabricated token, no
auto-fallback to fresh), writes manifest + empty `stats.json` via
`install()`, re-scans. Captured `nodeCwd` → manifest `source_cwd` so the
Use-as-starter snippet emits `cwd:` (fork starts in the parent's directory
where Claude's project-dir-scoped jsonl lives); the daemon does NOT
override cwd at fork dispatch.
- `packages/daemon/src/domain/agent-images/resume-token-discovery.ts`:
`discoverResumeToken()` reads session/node/binding state. It supports Claude Code and
Codex. Claude prefers matching context-usage identity; Codex prefers the persisted resume
token, then an external-CLI binding. Absent native identity remains absent.
- `packages/daemon/src/domain/agent-images/snapshot-capturer.ts`:
`SnapshotCapturer.capture()` refuses unsupported or missing native identity, writes
an image manifest/files and rescans. It records the source working directory when known.
- `packages/daemon/src/routes/agent-images.ts`:
`POST /fork` composes native identity discovery with an add-member operation. The
default path makes no image. The keep-image path captures and pins one before launch,
and reports that retained image even if launch fails.
> Source: `domain/agent-images/snapshot-capturer.ts:60-104` (throw
> L65-79; source_cwd L88-93; install+scan L101-102);
> `routes/agent-images.ts:256-265` (no-cwd-override contract) @HEAD.
Library/snapshot responses redact `sourceResumeToken`; the fork composer builds its
native-ID session source inside the daemon rather than returning that field to the caller.
This describes these response projections, not secrecy of every field in an image manifest.
**Evidence guard (CATASTROPHIC-bounce; fails closed).**
`evaluateProtection()` protects an image from deletion if ANY: pinned;
referenced by an active `agent.yaml`; referenced by a rig spec; or a
lineage descendant of a protected image (transitive, fixed-point
iteration). Spec-root scanning parses YAML structure (not string-grep)
and is deliberately conservative — false positives (over-protection)
acceptable; false negatives = catastrophic data loss. `--force` /
`?force=true` overrides.
`recordConsumption()` accepts a separate fork-count flag: consumption intent can update
last-use time without incrementing successful forks. Inspect the instantiation caller as
well as library statistics when assessing whether a launch succeeded.
> Source: `domain/agent-images/evidence-guard.ts:1-16` (bounce +
> fail-closed), `:53-115` (direct + transitive; fixed point L92-112),
> `:117-122` (conservative) @HEAD.
`packages/daemon/src/domain/agent-images/evidence-guard.ts` implements
`evaluateProtection()`: pins, parsed spec references and descendants of protected images
contribute protection reasons. The route applies the guard to deletion/pruning unless
`force` is explicit. Prune defaults to dry-run. Its protection view depends on the supplied
spec roots; it is not an inventory of every reference anywhere on the host.
**Resume-token redaction at route boundary (LOAD-BEARING).**
`/api/agent-images` redacts `sourceResumeToken` → `"(redacted)"` on every
operator-facing path; tokens are **never returned over the wire**; only
the in-process rigspec-instantiator consumes the real token.
The guard keys its result by image name, not version: every version of one name gets the
status computed for the last-listed version, carrying that version's image ID. The delete
route looks up by image ID, so on delete only that last-listed version of a name is matched,
and its other versions are deleted without `force` even when pinned. `rig agent-image prune`
sends a dry run unless `--force` is given, and `--force` also overrides the guard, so a
guarded real prune is reachable only through the HTTP route.
> Source: `routes/agent-images.ts:15-17` + `:44-46` (`redactResumeToken`),
> applied `:60`,`:67`,`:94`,`:161`; slice-00 0.3.0-GT §1.9 flags this
> LOAD-BEARING @HEAD.
The routes mount at `/api/agent-images` and expose list/sync, snapshot/fork,
entry/preview, pin/unpin, delete and prune.
`packages/cli/src/commands/agent-image.ts` owns the image library commands. The top-level
`rig fork` verb (`packages/cli/src/commands/fork.ts`) drives `POST /fork`; `--keep-image`
also captures a pinned image. Forking a Claude Code seat needs Claude Code 2.0.73 or later,
because the fork is launched with its own `--session-id`.
`agentImagesRoutes()` (mounted `server.ts:483-485`): `GET /library`,
`POST /library/sync`, `GET /library/:id`, `GET /library/:id/preview`,
`POST /library/:id/pin`, `POST /library/:id/unpin`,
`DELETE /library/:id` (evidence-guarded unless `force=true`),
`POST /snapshot`, `POST /prune` (**dry-run by default**,
`dryRun !== false`); guard `specRoots` injected via
`deps.agentImageSpecRoots`. CLI: `rig agent-image
list|show|preview|create|delete|pin|unpin|prune|sync`.
## Plugins
> Source: `routes/agent-images.ts:54-250` (table; prune default L112;
> delete-guard L224-239); `server.ts:483-485`;
> `docs/as-built/cli-reference.md:895-912` @HEAD.
### Discovery and inspection
## 3. Plugins (plugin-primitive Phase 3a) — **0.3.1, NOT 0.3.0**
`packages/daemon/src/domain/plugin-discovery-service.ts` discovers plugins from:
> **Forensic trap (slice-00 0.3.0-GT seam (a)):** the plugin-discovery
> file's first-creating commit is dated the same day as the 0.3.0 release
> commit but is NOT an ancestor of `v0.3.0`. Plugins are **0.3.1**.
> Re-confirmed at HEAD by the §0 tag-presence test.
| Source kind | Directory shape |
|---|---|
| `vendored` | OpenRig plugins root, one plugin directory per entry. |
| `claude-cache` | Claude cache, grouped by marketplace/plugin/version. |
| `codex-cache` | Codex cache, grouped by marketplace/plugin/version. |
| `rig-cwd` | `.claude/plugins` and `.codex/plugins` beneath supplied working-directory roots. |
`PluginDiscoveryService` is a read-only filesystem aggregator — no SQLite,
no mutation routes (SC-29 EXCEPTION #8, declared verbatim in the source
header). It scans four source kinds, unioned with provenance labels:
vendored (`~/.openrig/plugins/<id>/`), Claude cache
(`~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/`), Codex cache
(same under `~/.codex`), and rig-cwd (`<cwd>/.claude/plugins/*` +
`<cwd>/.codex/plugins/*`). Detection = presence of
`.claude-plugin/plugin.json` and/or `.codex-plugin/plugin.json` (declares
`runtimes`). Slice 28 added `skillCount` (readdir of `<plugin>/skills/`)
to the list response so the index page avoids an N+1 detail fetch
(SC-29 EXCEPTION #11, verbatim).
Detection uses the Claude/Codex plugin manifests. `listPlugins()` returns runtime/source
metadata; `getPlugin()` adds manifests, skills, hooks and MCP detail.
`findUsedBy()` scans agent YAML in configured spec-library roots for plugin declarations
and profile references. These references describe authored specs, not proof of a running
harness loading a plugin.
> Source: `domain/plugin-discovery-service.ts:1-29` (SC-29 #8 + scan
> desc), `:39` (4-kind `PluginSourceKind`), `listPlugins` `:205-276`
> (4 scan blocks), `scanCwdBundledPlugins` `:283-307`, `detectPlugin`
> `:393-453` (marker rule L399-404; `skillCount` L433-451 + #11
> L75-80) @HEAD.
The service constructor is not read-only: it retires obsolete refocus hook registrations
from the older bundled plugin and rejects duplicate vendored hook registrations across
providers. Cached plugin versions are excluded from that duplicate-provider check. Startup
constructs the service while building the daemon's dependencies and doesn't catch that
rejection, so a duplicate vendored hook stops daemon creation.
`getPlugin(id)` returns detail (manifests + skills + hooks + MCP servers);
`rig-cwd:` ids are self-resolvable (parses the cwd out of the id prefix
and re-scans so `/api/plugins/:id` does not 404 on an id `?cwd=`
returned). `findUsedBy(id)` walks `agent.yaml` files parsing YAML
structure (not string-grep — comments don't false-positive) to collect
`resources.plugins[].id` + referencing profiles.
`packages/daemon/src/routes/plugins.ts` exposes GET-only inspection at `/api/plugins`:
list, detail, used-by and file list/read. The file routes use the discovered plugin root as
their path allowlist. `?cwd=` supplies rig-cwd discovery roots.
At this pin, the route's source filter accepts vendored, Claude-cache and Codex-cache only;
`source=rig-cwd` is not applied as a filter, even though the service supports that kind.
> Source: `domain/plugin-discovery-service.ts:309-369` (getPlugin;
> rig-cwd self-resolve L310-321), `extractCwdFromRigCwdId` `:466-479`,
> `findUsedBy` `:371-389`, `readResourcesPlugins` `:599-615`,
> `readProfilesUsingPlugin` `:617-633` (structure-not-grep `:20-23`)
> @HEAD.
### Vendoring and projection
`PluginVendorService.ensureLatest()` runs `ensureVendored` (hash-skip
idempotent copy from `packages/daemon/assets/plugins/<name>/` to
`~/.openrig/plugins/<name>/`) then `attemptAutoFetch`
(`github.com/mvschwarz/openrig-plugins`, 5s timeout,
**404/network/timeout tolerated silently** — vendored is ALWAYS the
fallback; upstream repo intentionally empty at v0 so 404 is normal-state;
NO tarball extraction at v0). Wired at startup for `openrig-core`.
`packages/daemon/src/domain/plugin-vendor-service.ts` owns `PluginVendorService`.
`ensureVendored()` seeds absent plugins or advances an older numeric manifest version.
Equal/newer installed versions preserve installed bytes; equal versions can reconcile file
modes on byte-identical files. Missing target version authority is preserved rather than
overwritten; invalid or conflicting manifest versions are errors. Advancing a version writes
changed files but never deletes files the new version dropped.
> Source: `domain/plugin-vendor-service.ts:1-24`, `ensureVendored`
> `:80-103` (hash-skip L97-99), `attemptAutoFetch` `:111-131`
> (404-tolerant L116-117; no-extract L123-125), `ensureLatest`
> `:138-141`; `startup.ts:434-472` @HEAD.
`ensureSkillGlobally()` projects a named plugin skill using a vendor-version marker.
An existing unversioned global skill remains externally owned. Startup wires this service
and its filesystem implementation; inspect that wiring when changing projection roots. At
startup only `openrig-core` is vendored, and its `openrig-skills` and `refocusing` skills are
projected globally into `~/.claude/skills` and `~/.agents/skills`
(`packages/daemon/src/startup.ts:877–886`). The packaged `rigs` skill
(`packages/daemon/assets/skills/rigs`) is not a plugin skill: `ensureSkillDirGlobally()`
projects it into the same roots under the daemon version, so each upgrade refreshes it
(`startup.ts:891–899`). A failed global projection is logged and does not stop startup.
`pluginsRoutes()` (mounted `server.ts:478`, read-only): `GET /` (filters
`?runtime=`, `?source=`, `?cwd=`), `GET /:id/used-by`,
`GET /:id/files/list?path=`, `GET /:id/files/read?path=` (slice 28
docs-browser), `GET /:id`. Literal sub-paths are mounted **before** the
bare `/:id` catchall (route-order discipline). The files endpoints reuse
the path-safety machinery with the discovered plugin's absolute path as a
synthetic single-root allowlist (operator need not declare plugin paths
in `OPENRIG_FILES_ALLOWLIST`; plugin folders read-only at v0 so the
content hash is informational). CLI: `rig plugin
list|show|used-by|validate`; no `install` verb at v0 (deferred to 0.3.2).
`ensureLatest()` performs local vendoring before `attemptAutoFetch()`. The latter
requests a release asset with a bounded timeout and logs failures; even its successful
response path does not extract/install the fetched archive at this pin. This does not
establish whether an upstream release asset currently exists.
> Source: `routes/plugins.ts:29-39` + `:107-231` (table; before-catchall
> L128-130/L141-142; `pluginRootAllowlist` :74-92; read-only-hash
> L182-184); `server.ts:478`;
> `docs/as-built/cli-reference.md:943-963` @HEAD.
`packages/cli/src/commands/plugin.ts` implements `rig plugin
list|show|used-by|validate`. Discovery, vendoring and a runtime's projected plugin tree
are distinct steps; see [agent-spec-and-startup.md](agent-spec-and-startup.md) for launch.
> **OPEN-A** — `parseSourceFilter` (`routes/plugins.ts:69-72`) accepts
> only `vendored|claude-cache|codex-cache`; it does NOT accept `rig-cwd`
> though `PluginSourceKind` (`domain/plugin-discovery-service.ts:39`) and
> `ListPluginsOpts.sourceFilter` include it. `?source=rig-cwd` is
> silently dropped at the route while `?cwd=` still surfaces rig-cwd
> entries unfiltered. Stated as-is; intent (rig-cwd reachable only via
> `?cwd=`) vs filter-gap is not resolvable from source alone.
## Claude guided compaction
## 4. Claude auto-compaction enforcer (slice 27) — **0.3.1 headline**
`packages/daemon/src/domain/claude-compaction-enforcer.ts` implements
`ClaudeCompactionEnforcer`. Startup shares one instance between `ContextMonitor`
and the manual-compaction route consumers.
`packages/daemon/src/domain/user-settings/settings-store.ts` resolves the
`policies.claude_compaction.*` settings; automatic compaction defaults to disabled.
> **No 0.3.0 antecedent (slice-00 0.3.0-GT map row 7).** The enforcer
> file is absent at `v0.3.0`, present at `v0.3.1` (§0).
`maybeAutoCompact()` applies the delivery guard when one exists and the runtime is Claude
Code. Its implementation requires Claude Code, observed usage and a valid integer threshold
(default 80). Above-threshold automatic work additionally checks enablement, the
post-restore cooldown (10 minutes), the deduplication window (60 seconds) and the
already-triggered latch; an active manual attempt also blocks it.
`ClaudeCompactionEnforcer.maybeAutoCompact()` decides per seat whether
`ContextMonitor` should send `/compact`, driven by operator
`policies.claude_compaction.*` settings. Decoupled from `ContextMonitor`
scheduling; `ContextMonitor` is constructed with the enforcer at startup.
While the policy is enabled with a valid threshold (`managedCompactionActive` in
`packages/daemon/src/adapters/kernel-authority.ts`, using the enforcer's exported `isValidThresholdPercent`),
`operationalLaunchArgs` merges `idleCompaction: false` into the Claude launch's one `--settings` value, adding one
when there is none. Fresh launch, fork, resume (`claude-code-adapter.ts`) and restore (`claude-resume.ts`) all build
their Claude arguments there. The policy is read at each launch; a running session keeps the settings it was launched
with. Claude Code before 2.1.290 ignores the key, Claude's managed settings take precedence over `--settings`, and
`autoCompactEnabled` is not set.
> Source: `domain/claude-compaction-enforcer.ts:7-12`, `maybeAutoCompact`
> `:205-331`; `startup.ts:1191-1199` (enforcer →
> `new ContextMonitor(db, contextUsageStore, claudeAdapter,
> compactionEnforcer)`) @HEAD.
`/compact` is held behind a preparation attempt:
**Defensive contract** (source classifies compaction lifecycle as
load-bearing per the banked permission-layer foot-gun rule):
1. The first above-threshold tick starts an attempt with its own ID, the seat's occupant
generation, a restore-map path and a completion marker, then sends only the prep prompt.
An unknown occupant generation stops the attempt at once.
2. The agent writes `RESTORE-MAP.md.tmp` with its file-edit tool, completion marker last.
Later ticks return `preparation_pending` until that exact map is complete. The map path is under the seat's working directory
(`.openrig/compaction/preparation/<session>/<attempt>/`, with a `.gitignore` of `*`) when
that is writable, otherwise under `compaction/preparation/` in the OpenRig home.
3. The daemon atomically renames the completed temp file to `RESTORE-MAP.md` in its existing
final send checks, after rechecking the attempt and occupant. An already-complete final map
remains compatible. Only then is `/compact` sent, with the final map path appended to the
compact instruction. Publication failure cannot authorize `/compact`.
4. The continuation then runs below the threshold: turn boundary, restore prompt, then a
read-depth audit prompt (each item marked `FULL`, `PARTIAL` or `NOT_READ`), one stage per
poll tick. A seat refreshes its usage sample only when it takes a turn, so when the sample is
stale, unknown or has no percentage and a stage is pending, the monitor drains that stage
without one (`context-monitor.ts:175`, `claude-compaction-enforcer.ts:436`). Only a fresh,
known sample can start a compaction. The sample-less drain reads readiness from the pane alone
and counts a timer-less live status row, such as `✻ Compacting conversation…`, as work
(`session-transport.ts:153-161`); a recent hook showing work or a waiting person still
refuses. It records no width receipt, because the only figure would be the pre-compact one.
- **Opt-in, default-off:** `enabled=false` → never triggers.
- **Runtime filter:** triggers only when `runtime === "claude-code"`.
- **Invalid-policy = disabled:** a hand-edited non-integer / out-of-
`[1,100]` `thresholdPercent` is treated as disabled (safer-failure).
- **Re-arm via threshold crossing:** session must drop below threshold
before another auto-compact fires; window state NOT persisted (restart
resets — safer-failure direction).
- **Send-failure graceful-degrade:** returns `{ triggered: false,
reason: "send_failed" }`, never throws; dedup timestamp set only on
successful send so a transient failure retries next tick.
An automatic attempt has a 25-minute ceiling that starts once the prep is delivered. A stale
occupant generation, the policy becoming disabled, or the deadline passing stops it. A prep
that clearly wasn't sent is retried at most three times; an uncertain prep or `/compact` is
never replayed.
> Source: `domain/claude-compaction-enforcer.ts:14-44` (risk-class +
> contract), runtime `:206-208`, invalid-policy `:224-232`,
> dedup/threshold `:285-300`, send-fail `:312-314`/`:323-325` @HEAD.
The restore prompt names a restore-pending marker at
`compaction/restore-pending/<session>.json` in the OpenRig home, which the `openrig-core`
PreCompact hook writes. A per-seat `compaction/post-compact-extra/<session>.md` is preferred
over the global extra file, and an extra file that declares a different seat is refused.
**Active handshake state machine** (Claude hooks can supply context but
do not create a new assistant turn): (1) **pre-compact prep** — first
eligible above-threshold tick sends a normal user-channel prep prompt;
state → `prep_prompt_sent`. (2) **/compact** — next eligible tick sends
`/compact <instruction> + trust-channel bridge note`; sets dedup
timestamp + `triggeredAboveThreshold`; queues post stage
`turn_boundary`. (3) **post-compact, below threshold** — staged sends
`turn_boundary` (ack-only) → `restore_prompt` (points at the pending
marker `<openrigHome>/compaction/restore-pending/<key>.json`, transcript
/ session-id fallbacks) → `compliance_prompt` (read-depth audit); final
stage sets post-restore cooldown + clears the above-threshold latch.
`rig compact <session>` (`packages/cli/src/commands/compact.ts`) runs the same sequence
manually through `/api/compaction/trigger`, `cancel` and `state`, which use the terminal
bearer-token middleware; it passes every request through when no token is configured.
`--skip-map` skips the map requirement once, `--cancel` ends the preparation, and `--state`
shows the attempt, its expected map and its deadline. Ordinary approval prompts during preparation can be answered within that same deadline; OpenRig waits without answering them. A manual attempt has 180 seconds for
preparation and the idle wait.
> Source: `domain/claude-compaction-enforcer.ts:71-77` (compact+bridge),
> `:79-98` (prep), `:108-145` (restore + marker path), `:147-163`
> (compliance), `:165-171` (turn boundary), state machine `:233-330`
> (below-threshold L233-283; above-threshold L302-330) @HEAD.
The below-threshold continuation checks policy enablement too, except for an explicitly
operator-initiated manual sequence. A known occupant-generation mismatch invalidates the
queued stages; an unknown generation does not prove a match. Failed or retained sends
do not advance the stage. The manual trigger shares this continuation while having its
own initiation checks.
Policy fields via `SettingsStore.resolveClaudeCompactionPolicy()`:
`enabled`, `thresholdPercent`, `preCompactInstruction`,
`compactInstruction`, `messageInline`, `messageFilePath`,
`postRestoreAuditInstruction` — each backed by a
`policies.claude_compaction.*` key + `OPENRIG_POLICIES_CLAUDE_COMPACTION_*`
env override. Defaults: dedup `60_000` ms; post-compact restore cooldown
`10 * 60_000` ms.
Stage, deduplication, cooldown and preparation-attempt maps are in memory; the restore maps
are files. Startup supplies live generation
resolution and a post-restore callback that records a managed-width receipt, so the wider
operation also has persistent effects. Do not infer durable lifecycle completion from
a library read or one successfully queued message.
> Source: `domain/user-settings/settings-store.ts:553-565` (resolver),
> keys `:97-103`, env `:145-151`;
> `domain/claude-compaction-enforcer.ts:45-46` (default windows) @HEAD.
## Related maps
## 5. Cross-cutting properties
- **Filesystem-canonical, no new SQLite** across all four; daemon caches
in-memory; compaction window state intentionally not persisted
(context-pack-types.ts:8-11; agent-image-types.ts:12-13;
routes/plugins.ts:6; claude-compaction-enforcer.ts:26-29) @HEAD.
- **Honest failure, no fabrication** — discovery returns null; capturer
throws; enforcer degrades + never throws; evidence guard fails closed
(resume-token-discovery.ts:9-10; snapshot-capturer.ts:11-12;
claude-compaction-enforcer.ts:30-33; evidence-guard.ts:16) @HEAD.
- **503-when-unprovisioned** is the uniform route pattern when the
backing service is absent from context (routes/context-packs.ts:31;
routes/agent-images.ts:59; routes/plugins.ts:113) @HEAD.
## OPEN items (carried, not smoothed)
- **OPEN-A** — plugin `?source=` filter omits `rig-cwd` (§3); intent vs
filter-gap unresolvable from source.
- No slice-00 numeric-drift OPEN (1–5) applies — this module carries no
migration / route-group / PL-004-event counts. Slice-00 0.3.0-GT
OPEN-3 (For-You verb subset) is out of scope (UI surface, not
content-layer).
- [packaging-bootstrap-bundles.md](packaging-bootstrap-bundles.md): bundle export and
routing into content libraries.
- [agent-spec-and-startup.md](agent-spec-and-startup.md): context/resource projection
and image consumption during launch.
- [lifecycle-snapshot-restore.md](lifecycle-snapshot-restore.md): broader continuity flows.
@@ -5,238 +5,522 @@ status: active
topics: [coordination, observability]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Need to know how rig send/capture/broadcast works, how pipe-pane transcript
capture and rg/grep search behave, how durable rig chat (SQLite + SSE) is
modeled, what rig ask gathers, or the exact MCP-tool-name vs tmux-metadata-key
naming distinction.
Need to know how rig send/capture/broadcast works, how transcript capture
(periodic tmux capture-pane) and rg/grep search behave, how durable rig chat
(SQLite + SSE) is modeled, what rig ask gathers, or the exact MCP-tool-name
vs tmux-metadata-key naming distinction.
siblings: [daemon-core.md, lifecycle-snapshot-restore.md]
prerequisite-reads: [../README.md, daemon-core.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Transport, Transcripts, Chat, Ask
The communication-and-history layer: tmux is transport, not truth. Send/
capture/broadcast wrap tmux with honest errors; transcripts are raw pipe-pane
captures; chat is daemon-backed SQLite; `rig ask` gathers evidence but never
calls an LLM.
capture/broadcast wrap tmux with honest errors; transcripts are bounded
`tmux capture-pane` snapshots written to files; chat is daemon-backed SQLite;
the daemon's `rig ask` service gathers evidence and never calls an LLM.
> Verified against source at HEAD `7eaf524c` (`git describe` →
> `v0.3.1-6-g7eaf524c`). Package version **0.3.1** (slice-00 §1.1). Source
> located by `architecture.md` headings (§5 Transport and communication, §6
> Communication/Transcript/Chat flows, §11 Compat notes) per slice-08 §10.1
> — line numbers advisory only.
> Verified against source at main `e8f0ab340db773392ec8be75b072d1c0f3068a50`. Each count below sits beside the
> command that produces it; run the command from the repository root to refresh
> it.
## 1. The naming axes (D5 — read this first)
## 1. The naming axes (read this first)
This module carries the D5 drift, which has **two independent axes** that
must NOT be conflated or blanket-replaced (banked
`feedback_release_prep_three_layer_depersonalization`: the rename was scoped,
not global). Per-occurrence source verification:
Two independent naming axes meet in this layer. They must not be conflated or
blanket-replaced: `rigged` → `rig` is a per-occurrence question, not a global
substitution.
**Axis 1 — MCP tool names: `rig_*` (architecture.md is STALE → corrected).**
slice-00 §1.4 confirms all 17 MCP tools are `rig_*`. The `rigged_*`
references in `architecture.md` are stale text from a rename that predates
v0.2.0:
**Axis 1 — MCP tool names are `rig_*`.** `packages/cli/src/mcp-server.ts`
registers **23** tools, all named `rig_*`
(`grep -c 'server.tool(' packages/cli/src/mcp-server.ts`), including
`rig_rig_nodes` (`mcp-server.ts:290`), `rig_send` (`:307`),
`rig_capture` (`:341`), `rig_chatroom_send` (`:366`) and `rig_chatroom_watch`
(`:402`), and the five queue tools `rig_queue_create`, `_show`, `_list`, `_claim`
and `_update`. No `rigged_*` name other than the tmux keys below remains in product
source: **0** hits
(`git grep -n 'rigged_' -- ':(glob)packages/*/src/**' | grep -v -c '@rigged_'`).
> Drift-fix D5 (MCP-tool-name axis) — `architecture.md` §5 `node-inventory.ts`
> description says MCP `rigged_rig_nodes`; §6 chat flow says MCP
> `rigged_chatroom_send` + `rigged_chatroom_watch`. Corrected to **`rig_*`**.
> Re-confirmed at source: `mcp-server.ts:288` registers `"rig_rig_nodes"`,
> `:305` `"rig_send"`, `:339` `"rig_capture"`, `:364` `"rig_chatroom_send"`,
> `"rig_chatroom_watch"` (tool #17). Zero `rigged_chatroom_send` /
> `rigged_send` / `rigged_rig_nodes` in non-test product source (grep clean
> @HEAD). slice-00 §1.4; the rename landed in `b183c50c` pre-v0.2.0.
**Axis 2 — tmux metadata keys: `@rigged_*` (architecture.md is CORRECT → do
NOT change).** The tmux metadata keys written at claim/bind time are a
SEPARATE thing from MCP tool names and were NOT renamed:
> Drift-nuance D5 (tmux-metadata-key axis) — `architecture.md` §6 "Whoami
> and adopted-session parity flow" lists `@rigged_node_id`,
> `@rigged_session_name`, `@rigged_rig_id`, `@rigged_rig_name`,
> `@rigged_logical_id`. These are **CORRECT as-is** — verified literally at
> source: `claim-service.ts:77-81` writes exactly these five `@rigged_*`
> keys. Do NOT blanket-sed `rigged` → `rig`; this is a per-occurrence
> verify, not a global substitution. (The metadata-key axis is detailed in
> `agent-spec-and-startup.md` §6.) Re-confirmed `claim-service.ts:77-81`
> @HEAD.
**Axis 2 — tmux metadata keys are `@rigged_*`, and are correct as-is.** The
tmux metadata keys written at claim/bind time are a separate thing from MCP
tool names and were not renamed. `setRiggedMetadata` in
`packages/daemon/src/domain/claim-service.ts:182`–`186` writes exactly **5**
keys (`grep -c '@rigged_' packages/daemon/src/domain/claim-service.ts`):
`@rigged_node_id`, `@rigged_session_name`, `@rigged_rig_id`,
`@rigged_rig_name`, `@rigged_logical_id`. Do not blanket-sed `rigged` → `rig`.
The metadata-key axis is detailed in `agent-spec-and-startup.md` (identity:
whoami, bind, adopt).
## 2. Transport and communication domain services
(`architecture.md` §5 "Transport and communication")
All under `packages/daemon/src/domain/`:
- `session-transport.ts` — communication primitives: send/capture/broadcast
with session resolution (canonical + legacy names), mid-work detection,
honest error reporting, pod/rig/global targeting.
- `transcript-store.ts` — pipe-pane transcript management: ANSI stripping on
read, boundary markers, readTail, grep. Filesystem-backed, NOT SQLite.
- `history-query.ts` — transcript + chat search. Prefers `rg` when
available, falls back to `grep -E`, surfaces which backend was used.
Re-confirmed: `history-query.ts:7` `backend: "rg" | "grep" | "none"`;
`:103` execs `rg -i --no-filename -e <pattern>`; `:108` returns
`backend: "rg"`.
with session resolution, send-readiness classification (interactive-prompt
and mid-work detection), honest error reporting, and list/pod/rig/global
targeting.
- `transcript-store.ts` — transcript file management: path convention, ANSI
stripping for tail and grep reads, boundary markers, `readTail`, `readFull`, `grep`.
Filesystem-backed, NOT SQLite. The capture that writes the files is
`transcript-rotation.ts` (§4).
- `history-query.ts` — transcript + chat search. Prefers `rg`, falls back to
`grep -E`, surfaces which backend was used: `history-query.ts:8`
`backend: "rg" | "grep" | "none"`; `:252` runs
`rg -i --no-filename -e <pattern>` over the rig's transcript directory;
`:267` falls back to `grep -E -i -h -e <pattern>`.
- `ask-service.ts` — context-engineering evidence pack: gathers rig summary
plus transcript excerpts, chat excerpts, insufficiency state, guidance.
Does NOT call an external LLM.
- `chat-repository.ts` — durable rig-scoped chat: CRUD for `chat_messages`
table, SSE-compatible event emission.
- `chat-repository.ts` — durable rig-scoped chat over the `chat_messages`
table (`send`, `sendTopic`, `history`, `latest`, `searchChat`, `clear`). The
repository emits no events: `routes/chat.ts` emits `chat.message` on the
event bus after each send or topic, and `/watch` streams those as SSE.
Routes: `routes/{transport,transcripts,ask,chat,whoami}.ts` — all confirmed
present @HEAD.
Routes: `packages/daemon/src/routes/{transport,transcripts,ask,chat,whoami}.ts`
— all present.
## 3. Communication flow
(`architecture.md` §6 "Communication flow")
`rig send <session> "message"` → CLI → `POST /api/transport/send` →
`SessionTransport`:
`SessionTransport.send()`:
1. Resolve session name (canonical or legacy; by session/rig/pod/global).
2. Check mid-work state (unless `--force`) — re-confirmed
`session-transport.ts:136-141` (`findPatternEvidence(recentLines,
MID_WORK_PATTERNS)`); legacy mid-work check at `:666`.
3. Two-step tmux send: a unique file/buffer pasted with `paste-buffer -d -r -p` at every payload size → ~200ms delay → separate `C-m`. Bracketed paste preserves multiline input in supporting TUIs; the payload never enters a shell argument. A successful paste proves transport execution, not runtime consumption.
(`session-transport.ts:717` submits `C-m`).
4. Optional `--verify`: capture post-send pane, check message visibility
(`session-transport.ts:305` `verify?`; `:694` `if (opts?.verify)`).
5. Honest result with reason on failure.
1. Resolve the session name (`resolveBySessionName`,
`session-transport.ts:963`): not found → 404; the same name in more than
one rig → 409. A tmux probe of the session can also refuse it as missing or
tmux as unavailable (`:1317`–`1334`). Pod, rig, global and `--to` list
targets go through `POST /api/transport/broadcast`, which resolves them
with `resolveSessions` and sends to each recipient in turn.
2. Take the seat's delivery lease. Every write runs under a per-seat,
serialized lease from the seat delivery guard, installed at daemon start
(`send`, `:1155`). With the seat's typing guard on, the message is held
instead of typed: the result is `outcome: "retained"` with HTTP 200
(`routes/transport.ts:115`); operators use `rig seat set-typing-guard` and
`rig seat held-messages`. This same typing guard has `off` (default),
`draft-aware`, and `hold` modes. The legacy enabled boolean selects hold/off.
`DraftAwareDelivery` makes one attempt for opted-in seats and immediately returns
the exact refusal reason and original held IDs when input is unavailable.
Migration `100_typing_guard_modes` extends existing guard/audit rows and adds
non-executable receipt metadata to the original outbox; it creates no tables
or retry scheduler. Combined wakes preserve every original ID/body.
Legacy storage bits fail safe to hold on rollback; newer legacy audit writes
supersede older saved modes on re-upgrade, including same-value writes.
3. Classify send readiness. Only a positive interactive-prompt reading
(`needs_input`) refuses, with `target_needs_input`
(`session-transport.ts:1482`), unless the caller passes
`--dangerously-interact --reason`; that override persists an audit record
before sending and refuses the send if it can't
(`prompt_override_audit_unavailable`, `:1471`). A pane that reads `unknown` while the seat's
latest runtime hook says it waits on a person reads as `needs_input` (`session-transport.ts:1878–1889`). A mid-work reading (`running`, from a
fresh runtime hook or the pane's mid-work patterns,
`findPatternEvidence(recentLines, [...MID_WORK_PATTERNS, CLAUDE_LIVE_STATUS_PATTERN])`,
`:311–315`) or an `unknown` one proceeds with an advisory `warning` (`:1495`,
`:1503`). `--force` has no effect on this path, and combining it with
`--wait-for-idle` is refused with 400 (`routes/transport.ts:66`–`73`).
4. Two-step tmux send: a unique file/buffer pasted with `paste-buffer -d -r -p`
(`packages/daemon/src/adapters/tmux.ts:625`) → ~200ms delay
(`session-transport.ts:1558`) → separate named `Enter` (`session-transport.ts:1573–1578`). The paste
targets the seat's registered pane ID, not the session name, and is refused
with no input written if the session no longer holds exactly that pane.
Bracketed paste preserves multiline input in supporting TUIs; the payload
never enters a shell argument. A `--dangerously-interact` answer is pasted
without `-p` (`session-transport.ts:1541`) and Enter is pressed only if the
whole answer is still staged (`:1562`–`1570`). A successful paste proves
transport execution, not runtime consumption.
The transport's prompt reader uses the shared `composer-prompts.ts` matchers
from Mr-Neutr0n's #635. Its cursor-aware extension preserves capture styling
and excludes a wholly dim autocomplete suffix after the cursor. The daemon
directly depends on `string-width` to compare Unicode terminal cell widths
with cursor positions and exact staged text; a dependency hoisted from the
TUI would not declare this daemon runtime requirement. Default seats retain
their existing advisory recognition and staged-text verification behavior.
For draft-aware seats, `TmuxAdapter` checks the current composer after buffer
preparation and again immediately before keys. The delivery lease records
the pasted text and any observed collapsed-paste label; Enter requires that
owned input. Late human input, changed recipients or stopped queue wakes refuse
further input or hold the message; ambiguous writes remain indeterminate. Nothing
is retried automatically. Unicode cell widths use the daemon's direct
`string-width` dependency. See [per-seat terminal delivery](../../reference/seat-delivery.md)
for activation, persistence, inspection and lifecycle tradeoffs.
5. Optional `--verify`: capture the last 30 pane lines before the paste and,
500 ms after Enter, again, leaving out the current input box (the last
prompt line and its continuation, `verificationTranscript`). A send
carrying OpenRig's From/To header is matched as the whole message with
whitespace normalized (`countEnvelopeOccurrences`); a raw send is matched
by its first 40 characters (`verificationSnippet`). More occurrences after
the send report `outcome: "delivered"`; otherwise the outcome is
`rendered-unconfirmed`: text and Enter landed but the capture could not
re-confirm the render, which is not a failure. The outcome values are
`delivered`, `rendered-unconfirmed`, `failed` and `retained`.
With `transport.verify_input_box` on (off by default), a Claude Code or
Codex send is verified only when the seat was proven idle before the paste
and the input box shows the message, and is unconfirmed otherwise:
Architecture Rule 18 (carried, `architecture.md` §7): tmux is transport, not
truth — `send/capture/broadcast` wrap tmux reliably with honest errors.
- **Seat idle before the paste** (`readSeatBeforePaste`). The `--verify`
capture taken before the paste (the whole screen) must match an idle
allow-list (`SEAT_IDLE_SHAPES`) built from real Claude Code 2.1.296 and
Codex 0.160.0 frames and, where no frame was captured, from the Claude
Code 2.1.296 bundle, the Codex 0.160.0 source and OpenRig's own launch
code. Claude Code: the empty box or its `Try "…"` suggestion between two
rules; the opening rule plain, or carrying this seat's own session name
the way Claude Code draws `--name` (`─…─ <session> ─`, or `──` as in
earlier versions, as wide as the closing rule; OpenRig launches every
Claude seat with `--name`); the footer row of the seat's permission
posture, one for each mode OpenRig can launch: bypass
(`⏵⏵ bypass permissions on (shift+tab to cycle) · ← for agents`), accept
edits (OpenRig's default), auto, don't ask, plan, and default
(`⏸ manual mode on · ← for agents`); no statusLine row between the
closing rule and the footer (OpenRig's statusLine collector prints
nothing); a blank, effort or tmux-notice row above the box; and above
that, in the status slot, the completion row of the seat's last turn
(`✻ <verb> for <duration> · done <time>` at column 0, matched by the
Claude Code 2.1.296 bundle's grammar: one of its eight past-tense verbs,
its duration format, and the time of a turn finished today on a 12- or
24-hour en-US clock). A blank slot counts only under that completion
row, with only blank rows between them (as in the fullscreen renderer),
or, before the first turn, under the last row of the Claude Code v2.1.296
welcome banner. OpenRig launches Claude in the classic renderer, where the
box follows the transcript, so an idle seat that has finished a turn
shows that turn's completion row in the slot; real frames of idle seats
OpenRig launched show it. A configured statusLine, which OpenRig installs
on every Claude seat, makes Claude Code drop the footer's hints, so a
running turn draws the same footer row as an idle one, without
`esc to interrupt`: the status slot is what tells them apart. The 2.1.296
bundle draws the live status row (the spinner) there only while no
streamed text with a complete line is on screen
(`isLoading && (!hasDisplayedStreamingText || tailBlank || …)`); while
streamed text is shown it draws nothing in its place, and the last
streamed row moves into the slot. That row never matches the completion
row, because Claude Code draws a message behind its `●` column. The
bundle does not show that the last streamed row is never blank, so a
blank slot under transcript text reads `unknown`: that case is left
unconfirmed rather than read as idle. Codex: the empty box over its
status line and a `? for shortcuts` hint row, with the completion row or
the fresh session's greeting as the last row above the box. The
completion row is matched by the grammar Codex 0.160.0 prints it with
(`Worked for <elapsed> • <time>`, a 12- or 24-hour clock, a date before
the time on another day, runtime metrics after it). No row anywhere may
be a running, streaming, queued, pending-input or paste-hint row (a live
status row, `esc to interrupt`, `paste again to expand`, a queued label,
Codex's pending-input headers or `↳` rows, a spinner). Any other frame,
including every running, streaming, steer-preview, paste-hint or unknown
layout, another seat's name, a statusLine that prints a row, a background
shell in the footer and a fullscreen renderer with a statusLine (which
reserves a row for it), reads `seat: not-idle` or
`unknown`, and the send reads unconfirmed. This holds when a running turn
hides its signal (Codex hides its `• Working` row while it streams;
Claude Code shows only `paste again to expand` in its footer for 8 s
after a paste, and no `esc to interrupt` under a statusLine). So a send to
a busy or unknown seat always reads unconfirmed.
### 3b. Cross-host coordination verbs (v0.4.6 — OPR.0.4.6.MH4)
**Versions.** The layouts were recorded from Claude Code 2.1.296 and
Codex 0.160.0 (the versioned frames under
`packages/daemon/test/fixtures/input-box/`, with their limits in that
folder's README). A frame that visibly names another client version reads
`unknown` before the paste and `unrecognized` in the box: Claude Code's
welcome banner (`Claude Code v2.1.297`), Codex's session header
(`>_ OpenAI Codex (v0.161.0)`) or its update notice, whose first version
is the running one (`Update available! 0.159.0 -> …`). Most frames
show no version (the banner and header scroll away), and there a matching
layout is evidence about the layout only, not proof of the client
version: another version that draws the same rows reads the same. There is
no version discovery and no extra read for it.
Which Claude seats OpenRig launches can verify: an idle Claude Code
seat in any posture OpenRig launches, after any number of turns, whose
status slot holds its last turn's completion row as above, or a fresh
seat whose slot is blank under the welcome banner. It reads `unknown`
when that row is anything else: a blank row under transcript text, a
completion row with more after the time (a still-running note, hidden
messages, a budget), the weekday or date of a turn that finished on an
earlier day, another locale's or a custom time format, an interrupted
turn, or a row printed after the turn. And only a text Claude Code shows
inline in its box can verify (see the box reading below): a multi-line
text, which includes every `rig send` envelope and every queue wake,
collapses to a paste label and stays unconfirmed.
- **The box held exactly this message before Enter.** One extra capture
between the paste and Enter must show exactly the sent text in the input
box with its word boundaries kept (`readInputBox`, `boxHoldsText`): runs
of whitespace, including Unicode spaces, compare as one space, so a box
holding `nowhere` is not the text `now here`. A row break counts as a
space only where it must be whitespace of the box's text. Claude Code
2.1.296 wraps its input at spaces only (wrap-ansi). Codex 0.160.0 wraps
it with textwrap (FirstFit, UAX #14 break opportunities, the hyphen
splitter), which also breaks with no space drawn after a hyphen or a
slash and between ideographs. So a break counts where the next row's
first word would have fit on the row before it (both wrappers fill a row
first, so the text has a line break there), or where it falls between
two ASCII letters or digits, or before a hyphen, a slash, a closing
bracket or `.,:;!?`, and the two words it separates, joined, fit in the
box's widest row, but only after a row whose text starts at its first
cell with a printable ASCII character and whose last word is ASCII
letters, digits, `'` and `.,:;` only. Codex keeps a word that fits in a
row whole only where the word starts on a row that already holds text:
a row holding only indentation absorbs the next word and splits it
where the row fills, and a word after a hyphen or a slash can be split
the same way in a row that took the next textwrap line. So on Codex a
split between two letters is not always the text's space; after an
indented row, or after a last word with a break opportunity inside it,
only the first rule reads the break. The first rule has one known
residual on Codex, found in a model of the rust-v0.160.0 source, not in
a live capture: once an indented row has absorbed and split a word, the
re-pass can end a later row early at a hyphen, so a break with no
whitespace can pass the first rule. Every such box in that model also
holds the earlier split after the indented row, which reads `ambiguous`,
so the box never reads `exact`. The widest row is counted in
printable ASCII cells only, so combining marks, joiners and zero-width
characters never widen it. Any other break, and a break inside a word of
the text, reads `ambiguous` and the send stays unconfirmed. A collapsed paste label, Claude's
queued-messages label or `Try "…"` suggestion, or another draft is never
the message. The default `--verify` matcher above is unchanged.
- **The box is empty after Enter on the same pane process.** The capture
after Enter must show the box empty, with the pane process
(`#{pane_pid}`) and the seat's binding unchanged.
The result's `inputBox: { seat, before, after, sameProcess }` says which
reading failed. An empty box reads `queued` instead of `empty` where the
frames say the message may wait behind a turn: Codex's pending-input rows
or a row under its running-turn status, or a running turn in the frame
read before Enter (Codex's `• Working` row; for Claude Code,
`esc to interrupt` or a live status row above the box, including above a
box of several rows). The verdict uses these readings: verified needs
`empty`, so for a seat that was idle before the paste they are the only
check that rejects a message queued behind a turn that started after the
pre-paste capture. An audited prompt answer (step 4) reads no box: with
the setting on its `inputBox` reads `unchecked` for `seat`, `before` and
`after`, `sameProcess` is `false` (it stays a boolean), and the send reads
unconfirmed, whatever the default matcher would say.
It reports only: the seat is read from the capture `--verify` already
takes, and none of the extra reads decides whether Enter is sent. Each has
a 500 ms deadline, which is a budget, not a guarantee: the pre-Enter read
comes after the existing 200 ms wait and can add about 500 ms before
Enter, and the post-Enter process read can add about another 500 ms
before the reply. A read that misses its deadline reads `unavailable`, the
send stays unconfirmed, and Enter is still sent once. With a deliberately
slowed screen read, review measured about 718 to 721 ms from paste to
Enter, against about 216 to 219 ms on main under the same slowdown.
Limits: the seat is read once, before the paste, and Enter
follows about 200 ms later. A turn can start in that window, from a person
typing in the pane or from the agent itself (Claude Code and Codex start
turns on their own when a background task finishes, a scheduled wake-up
fires or a teammate's message arrives). Such a turn is caught only when
the frame read before Enter shows it; a Codex turn already streaming
there hides its `• Working` row and is not seen. An empty box after an
exact one means the box was cleared, normally by our Enter; a clear by
something else at that moment (a person's C-c) looks the same, and so
does a text the TUI runs as a command (a Claude Code `/command`, a Codex
`!command`), which clears the box without the model reading a message.
`#{pane_pid}` is the pane's root process (the shell for most launches), so
an agent restarted under the same shell is not caught by the pane process
check, and the same pane and binding are not proof of the same native
conversation.
An empty box means the TUI took the text, not that the model read it.
Consumers see only the report. With the setting on, a queue wake that
reads unconfirmed records the existing `delivered-ack-pending` state, as
an unconfirmed wake does today. Every queue wake to Claude Code is
unconfirmed under the setting, because its multi-line envelope collapses
to a paste label, and so is a wake to a busy or not-proven-idle Claude
Code or Codex seat. A pending, unclaimed handoff with no pickup evidence
can then enter the wake ladder's existing escalation path after
`queue.wake_unconfirmed_window_minutes` (default 30). It is not blindly
re-sent: the ladder's unconfirmed path skips its retry rung
(`queue-wake-ladder.ts`), and nothing in the send path retries or
re-sends.
6. CLI `--verify` goes further (`packages/cli/src/commands/send.ts:596`): it
looks for the text still unsubmitted at the prompt, makes one guarded
Enter-only retry through the daemon's `submitOnly` path
(`session-transport.ts:1344`, which refuses with `staged_mismatch` unless the
pane shows the expected staged text), and ends `staged-not-consumed` with
exit code 1 if it is still there.
7. Honest result with reason on failure. Reasons missing from the send
route's status map (among them the runtime-identity refusals) are returned
with HTTP 500 (`routes/transport.ts:118`–`140`).
The sender comes from the `X-OpenRig-Session` header; an unsigned send gets an
unknown-sender notice. The CLI adds a From/To envelope, and the daemon appends
a delivered-latency note for delays of 10 s or more.
Architecture rule 18 (`architecture-rules-and-event-system.md`): tmux is
transport, not truth — `send/capture/broadcast` wrap tmux reliably with honest
errors.
The daemon runs tmux without a shell: argv straight to the tmux binary found on
`PATH`. `OPENRIG_TMUX_SHELL=1` at daemon start runs every tmux call through
`/bin/sh` instead (Linux and macOS; Windows always uses argv). A binary that
can't be started at all (a script without `#!`, a missing interpreter) runs
through `/bin/sh -c 'exec "$0" "$@"' tmux …`, which finds tmux as the shell
path does; nothing ran before, so no command runs twice. The resolved path is
cached, so a different tmux installed earlier on `PATH` takes effect after a
daemon restart.
### 3b. Cross-host coordination verbs
`rig send/capture/transcript/broadcast --host <id>` (and the `agent@rig@host`
target sugar on the session-target verbs) cross the host boundary with **zero
daemon-side changes** — the remote daemon's existing local routes do all the
work; the only net-new is the CLI transport branch.
target sugar on the session-target verbs) cross the host boundary through the
remote daemon's ordinary local routes; the cross-host logic is in the CLI.
- **The seam principle (arch-ruled): SIDEDNESS + CALLER pick the seam.**
ONE-SIDED remote ops from a BEARER-CAPABLE caller (the CLI resolves the
registry bearer locally) go **CLI-DIRECT** via the shipped
`runRemoteHttpOp` — one hop, no local-daemon involvement (the
`ps --all-hosts` precedent). TWO-SIDED ops (MH-3's queue handoff closes the
local source and creates the remote successor — the local daemon owns half
the transaction) or BEARER-INCAPABLE callers (the browser: MC-action,
MH-2's read-through) use the **daemon-side forward-then-strip**. MH-4's
four verbs are pure one-sided remote ops from the CLI.
- **Transport is dictated by the host entry (ssh XOR http), never a
per-call choice:** ssh hosts keep the shipped shell-out byte-verbatim for
send/capture; http hosts (the `pair` front door's kind) take the
CLI-direct branch to `POST /api/transport/send|capture|broadcast` /
`GET /api/transcripts/*` with the SAME bodies/paths the local CLI builds
(one route, two callers = wrap parity by construction). transcript and
broadcast are http-only (no ssh path exists for them); a wrong-transport
verb dies with the structured requirement error — never a fallback.
- **Terminal-bearer posture (named limitation, v0 — `/api/transport/*`
ONLY):** the remote's transport routes (send/capture/broadcast) gate on
ITS TERMINAL bearer class (`OPENRIG_TERMINAL_BEARER_TOKEN`, default null →
pass-through; the tailnet is the auth boundary by design), while the CLI
presents the REGISTRY bearer from `hosts.yaml` when one is configured;
for a URL-only anonymous host the `Authorization` header is omitted.
A remote enforcing a
DIFFERENT terminal bearer surfaces as the structured `permission-gate`
step (never a hang, never silent). Remedy: set the remote terminal bearer
equal to the paired registry bearer, or rely on the tailnet boundary.
**The transcript read is DELIBERATELY outside this class (arch n2):**
`/api/transcripts/*` mounts UNGATED (`server.ts` — the shipped open-route
posture; daemon-local trust boundary with route-level credential
redaction as the protective primitive), so a wrong terminal bearer that
permission-gates `send --host` does NOT gate `transcript --host` — the
read keeps succeeding, and the proof matrix must not treat the auth-fail
class as uniform across the four verbs. A coherent transcript-read auth
policy across tail/grep/full is a named future slice per
`routes/transcripts.ts`'s own comment (orch approved-option-a).
Bearer-class unification is likewise a NAMED follow-up, not v0 (no
un-asked auth machinery).
- **BR-1 holds:** the 3-part form is CLI-edge sugar only (suffix must match
a REGISTERED host id, else passthrough + a loud host hint); every session
string that reaches any daemon stays `member@rig`; the host travels
out-of-band. Durable cross-host coordination stays MH-3's queue — MH-4
adds no queue surface.
- **Sidedness and caller pick the seam.** One-sided remote operations from a
caller that can resolve the registry bearer locally (the CLI) go
**CLI-direct** through `runRemoteHttpOp`
(`packages/cli/src/remote-host-ops.ts:25`) — one hop, no local-daemon
involvement, as `rig ps --all-hosts` does. Two-sided operations (a
cross-host queue handoff closes the local source and creates the remote
successor, so the local daemon owns half the transaction) and callers
without the bearer (the browser: Mission Control actions and the `?host=`
read-through) go through the local daemon, which forwards to the remote.
These four verbs are one-sided remote operations from the CLI.
- **The host entry dictates the transport (ssh or http), never a per-call
choice.** ssh hosts shell out over ssh for send/capture
(`packages/cli/src/cross-host-executor.ts`); http hosts (the kind
`rig host pair` registers) go CLI-direct to
`POST /api/transport/send|capture|broadcast` / `GET /api/transcripts/*` with
the same bodies and paths the local CLI uses. transcript and broadcast are
http-only (no ssh path exists for them); on an ssh host they fail with a
structured error naming the transport requirement
(`remote-host-ops.ts:47`), never a fallback.
- **Terminal-bearer posture (`/api/transport/*` only).** The remote's
transport routes (send/capture/broadcast) gate on its terminal bearer
(`routes/transport.ts:26`; `OPENRIG_TERMINAL_BEARER_TOKEN`,
`packages/daemon/src/index.ts:291`). With no token configured the
middleware passes every request through
(`packages/daemon/src/middleware/auth-bearer-token.ts:99`) — the tailnet is
the auth boundary by design — except that a daemon bound to an explicit
address that is neither local nor tailnet falls back to
`OPENRIG_AUTH_BEARER_TOKEN`
(`index.ts:297`). The CLI presents the registry bearer from `hosts.yaml`
when one is configured; for a URL-only anonymous host the `Authorization`
header is omitted. A remote enforcing a different terminal bearer answers
401, which surfaces as the structured `permission-gate` step
(`packages/cli/src/host-registry.ts:53`) — never a hang, never silent.
Remedy: set the remote terminal bearer equal to the paired registry bearer,
or rely on the tailnet boundary. **The transcript read is deliberately
outside this class:** `/api/transcripts/*` mounts with no bearer middleware
(`packages/daemon/src/server.ts:748`, beside the gated `/api/transport` at
`:749`), and credential-shaped text is redacted on the `/full` route only
(`routes/transcripts.ts:292`). So a wrong terminal bearer that
permission-gates `send --host` does NOT gate `transcript --host` — the read
keeps succeeding for a Host name the remote's browser boundary accepts
(`server.ts:647`; it applies to every `/api/*` route), and the auth-failure
class is not uniform across the four verbs. The route's own comment (`routes/transcripts.ts:250`) leaves a
coherent transcript-read auth policy across tail/grep/full for later.
- **The 3-part form is CLI-edge sugar only.** `resolveCrossHostTarget`
(`packages/cli/src/cross-host-target.ts:58`) strips the suffix only when it
resolves to a registered host, or equals this host's own id, which routes
home (`:95`; only `rig send` passes the self id,
`packages/cli/src/commands/send.ts:398`, so `capture` and `transcript` treat
their own id as unknown); otherwise the string passes through unchanged with a loud
host hint. Every session string that reaches any daemon stays
`member@rig`; the host travels out-of-band. Durable cross-host
coordination stays the queue's cross-host routing
(`coordination-primitive.md`); these four verbs add no queue surface.
## 4. Transcript flow
(`architecture.md` §6 "Transcript flow")
1. `NodeLauncher` starts `pipe-pane` immediately after tmux session creation
(before harness boot).
2. Raw terminal output streams to
`~/.openrig/transcripts/{rig-name}/{session-name}.log`.
3. `TranscriptStore` owns path convention, ANSI stripping on read, boundary
markers, `readTail`, `grep`.
1. `NodeLauncher` starts transcript rotation right after tmux session
creation, before the harness boots
(`NodeLauncher`, `startTranscriptRotation`).
2. Each rotation tick captures the trailing lines and atomically overwrites
(temp file + rename in `startTranscriptRotation`)
`transcripts/{rig-name}/{session-name}.log` under the OpenRig home (or
the `transcripts.path` setting). It skips the write when the captured bytes
are unchanged. Defaults: 1000 trailing lines every 2 s
(`DEFAULT_TRANSCRIPT_LINES`, `DEFAULT_TRANSCRIPT_POLL_INTERVAL_MS`); an idle seat is captured less often,
within the 10-second freshness window. Both are tunable with
`OPENRIG_TRANSCRIPTS_LINES` and `OPENRIG_TRANSCRIPTS_POLL_INTERVAL_SECONDS`
or the matching `transcripts.*` settings. This bounded capture replaced the
earlier `tmux pipe-pane` stream (see the header comment of `transcript-rotation.ts`), so the file
holds a trailing window, not the whole session. Sessions on one adapter
tick on one shared timer, and the captures due in a tick share
`capturePanesContent`: one chained call per chunk of 24, with a
`list-sessions` started beside it on every batch, whose result is consulted
only when the chain fails, each chunk on its own (`captureBatch` in
`transcript-rotation.ts` → `capturePanesContent` in `adapters/tmux.ts`).
A session the batch leaves out, a lone due session, or a pane or window
target reads per target with `capturePaneContent` (`adapters/tmux.ts`).
3. `TranscriptStore` owns path convention, ANSI stripping for `readTail` and
`grep`, boundary
markers, `readTail`, `readFull`, `grep`. `readFull` returns the raw bytes
(`TranscriptStore.readFull`); the `/full` route redacts them. The transcript
routes check capture health first and can start capture lazily for a seat
that has none.
4. `rig transcript <session> --tail N / --grep "pattern"` provides
agent-facing access.
5. On restore: a boundary marker is written before re-launch; pipe-pane
reconnects to the same file (append). (Restore-side detail in
`lifecycle-snapshot-restore.md` §3.)
5. On restore: a `--- SESSION BOUNDARY: … ---` marker is written before
re-launch (`RestoreOrchestrator`); each rotation tick keeps each
distinct boundary line once, as a header above the fresh capture
(`startTranscriptRotation`, boundary header). (Restore-side detail in
`lifecycle-snapshot-restore.md`.)
6. `rig ask` gathers rig summary plus transcript excerpts, chat excerpts,
insufficiency state, and guidance.
Architecture Rule 19 (carried): transcripts are raw capture via pipe-pane,
ANSI strip on read; `rg` preferred, `grep -E` fallback. Rule 22: `rig ask`
is context engineering — gathers evidence, does NOT call an external LLM;
the agent IS the LLM.
Architecture rule 19, as the code implements it: transcripts are a bounded
`capture-pane` snapshot (not pipe-pane), ANSI-stripped on tail and grep reads; `rg`
preferred, `grep -E` fallback. Rule 22: the daemon's `rig ask` is context
engineering — it gathers evidence and does NOT call an external LLM; the
agent IS the LLM. The one exception is the explicit CLI flag `rig ask --wake`
(`packages/cli/src/commands/ask.ts:88`), which runs a headless resume of a
Claude or Codex session (`claude -p --resume` / `codex exec resume`,
`packages/cli/src/ask-wake.ts:58`–`60`) to answer one question.
## 5. Chat flow
(`architecture.md` §6 "Chat flow")
1. `rig chatroom send <rig> "message"` → `POST
/api/rigs/:rigId/chat/send` → `ChatRepository.addMessage()`.
/api/rigs/:rigId/chat/send` → `ChatRepository.send()`
(`routes/chat.ts:43`); the route then emits `chat.message` (`:45`).
2. SSE: `GET /api/rigs/:rigId/chat/watch` delivers real-time messages.
3. History: `GET /api/rigs/:rigId/chat/history` returns full channel
history; `POST /api/rigs/:rigId/chat/topic` persists topic markers.
4. UI: chat-room tab in the rig drawer.
5. MCP: **`rig_chatroom_send` + `rig_chatroom_watch`** (D5 axis-1 correction
— `architecture.md` §6 said `rigged_*`; source `mcp-server.ts:364` +
tool #17).
3. History: `GET /api/rigs/:rigId/chat/history` returns channel history in id
order, 100 messages unless `limit` says otherwise
(`chat-repository.ts:68`), filterable by `topic`, `after`, `since` and
`sender` (a `since` SQLite cannot parse is refused with 400,
`routes/chat.ts:73`); `POST /api/rigs/:rigId/chat/topic` persists topic markers.
4. UI: a `RigChatPanel` component exists
(`packages/ui/src/components/RigChatPanel.tsx`), but no UI view mounts it:
**1** file under `packages/ui/src` names it, its own
(`git grep -l 'RigChatPanel' -- packages/ui/src | wc -l`).
5. MCP: **`rig_chatroom_send` + `rig_chatroom_watch`** (`mcp-server.ts:366`,
`:402`).
6. Source of truth: daemon-backed SQLite (`chat_messages` table), NOT tmux
scrollback.
**ChatMessage** type (`architecture.md` §4): durable rig-scoped message —
**ChatMessage** type (`chat-repository.ts:6`): durable rig-scoped message —
`id`, `rigId`, `sender`, `kind`, `body`, `topic`, `createdAt`.
## 6. Compatibility notes (carried verbatim, `architecture.md` §11)
## 6. Compatibility notes
The intentional limits in this layer:
The intentional limits in this layer (numbered as in
`architecture-rules-and-event-system.md`):
- Note 4 — `rig ask` gathers context only; does not call an external LLM.
The agent reasons about the gathered evidence.
- Note 4 — the daemon's `rig ask` gathers context only; it does not call an
external LLM. The agent reasons about the gathered evidence. Only the
explicit `--wake` flag executes a runtime (§4).
- Note 5 — transcript search prefers `rg` but falls back to `grep -E`;
search quality/performance varies by backend.
- Note 6 — chat is rig-scoped only: no cross-rig channels or DMs.
- Note 7 — `--verify` on `rig send` checks pane content for message
visibility but can produce false positives from pre-existing matching
content. Known limitation.
- Note 7 — `--verify` on `rig send` reports what the pane shows, not agent
acknowledgement. By default it compares the message (whole for a
header-carrying send, the first 40 characters for a raw one) in captures
before and after the send, leaving out the current input box; with
`transport.verify_input_box` on, Claude Code and Codex sends are verified
only for a seat proven idle before the paste and on input-box evidence; a
busy or unknown seat reads unconfirmed (§3 step 5). When it cannot confirm,
it reports `rendered-unconfirmed`, not a failure.
(The full §11 compatibility-notes list lives in
(The full compatibility-notes list lives in
`architecture-rules-and-event-system.md`.)
## OPEN / carried items
- **D5 (the careful one — resolved per-occurrence, NOT blanket-replaced):**
Axis 1 (MCP tool names) corrected `rigged_*` → `rig_*` (3 sites: §5
node-inventory, §6 chat flow ×2). Axis 2 (tmux `@rigged_*` metadata keys)
verified literally correct at `claim-service.ts:77-81` and left unchanged.
No slice-00 numeric drift applies to this module's split content.
## See also
- `daemon-core.md` — transport/transcript/chat/ask are among the 49 route
mounts; MCP tool count (17, `rig_*`) is anchored there.
- `agent-spec-and-startup.md` §6 — the tmux `@rigged_*` metadata-key axis
detail (whoami/adopt).
- `lifecycle-snapshot-restore.md` §3 — restore-side transcript boundary
- `daemon-core.md` — the route-mount surface these routes sit in, and the MCP
tool count.
- `agent-spec-and-startup.md` — the tmux `@rigged_*` metadata-key axis detail
(whoami/adopt).
- `lifecycle-snapshot-restore.md` — restore-side transcript boundary
markers.
- `coordination-primitive.md` §3b — MH-3's cross-host QUEUE routing (the
two-sided daemon-forward twin of §3b's one-sided CLI-direct verbs).
- `cli-reference.md` § Cross-host execution — the per-verb transport
capability table, parse rules, and http failure taxonomy (MH-3 + MH-4).
- Source roots: `packages/daemon/src/domain/{session-transport,
transcript-store,history-query,ask-service,chat-repository}.ts`,
- `coordination-primitive.md` — cross-host queue routing (the two-sided
daemon-forward twin of §3b's one-sided CLI-direct verbs).
- `../cli-reference.md` — each verb's registered `--host <id>` option; run
`rig <verb> --help` for its cross-host behaviour.
- Source roots: `packages/daemon/src/domain/{session-transport,transcript-store,transcript-rotation,history-query,ask-service,chat-repository}.ts`,
`packages/daemon/src/routes/{transport,transcripts,ask,chat}.ts`,
`packages/cli/src/mcp-server.ts`,
`packages/cli/src/{remote-host-ops,cross-host-target,cross-host-executor}.ts` (v0.4.6 MH-4).
`packages/cli/src/{remote-host-ops,cross-host-target,cross-host-executor,ask-wake}.ts`.
+266 -458
View File
@@ -1,509 +1,317 @@
---
kind: as-built
title: Workflow Runtime + Watchdog Policies (PL-004 Phase C/D)
title: Workflow Runtime — Specs, Packets, and Lifecycle Graphs
status: active
topics: [coordination, runtime-control]
topics: [orchestration, coordination]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Need to know how the daemon-native Workflow Runtime works — workflow specs
cache, instance state, step trails, the transactional-scribe projection
contract, or the watchdog policy set including workflow-keepalive.
siblings: [coordination-primitive.md, mission-control.md]
prerequisite-reads: [../README.md, coordination-primitive.md]
last-verified-against-source: slice/opr-0.4.6.wf2-spec-language tip (base d18907ed — WF-1 merged)
last-updated: 2026-07-06
Following workflow validation, instantiation, projection, routing, failure
recovery, lifecycle graph revisions, or the corresponding CLI/API.
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Workflow Runtime + Watchdog Policies (PL-004 Phase C/D)
# Workflow Runtime — Specs, Packets, and Lifecycle Graphs
The daemon-native Workflow Runtime (PL-004 Phase D) turns an intended
sequence of work into durable SQLite state: declarative workflow specs, live
instance state, append-only step trails, and the load-bearing
transactional-scribe contract. The PRD §L4 operating model is
owner-as-author semantically plus workflow-as-transactional-scribe
mechanically (`architecture.md` §3 L398).
Source snapshot: `e8f0ab340db773392ec8be75b072d1c0f3068a50`. This describes the source at that commit;
it does not establish the version or behavior of a running daemon.
> Verified against source at HEAD `7eaf524c`.
A workflow binds a specification to durable queue packets. The daemon
records the instance, its current frontier, and the step trail; agents supply
step outcomes and evidence. Serial workflows and dependency graphs share
this runtime. The engine checks declared fields and recorded state; it does
not judge the substance of a referenced proof document.
## 1. The three Phase D tables (+ the diagnostic addition)
## Source map
Re-confirmed at HEAD in `packages/daemon/src/db/migrations/`:
All paths in this table are under `packages/daemon/src/`.
- **`workflow_specs`** (`033_workflow_specs.ts:33` `CREATE TABLE … workflow_specs`)
— a read-through cache of human-authored markdown/YAML spec files. Sources
are workspace-surface; the daemon caches by `(name, version)` with a
content `source_hash` so valid operator edits to the spec file win at next
read (workspace-surface reconciliation). Spec authoring stays
markdown-authoritative; the cache exists for fast lookup and runtime
resolution (`architecture.md` §3 L400).
- **`workflow_instances`** (`034_workflow_instances.ts:45` `CREATE TABLE …
workflow_instances`) — live state per running workflow: `status`
(`active|waiting|completed|failed`), `current_frontier_json` (active qitem
ids), `hop_count` (loop-guard counter), `last_continuation_decision_json`.
Instances survive daemon restart from SQLite — no filesystem
reconciliation (`architecture.md` §3 L402).
- **`workflow_step_trails`** (`035_workflow_step_trails.ts:32` `CREATE TABLE …
workflow_step_trails`) — append-only history of meaningful step
transitions. Every closure produces one trail row pairing the prior qitem
with the next qitem (null on terminal). `WorkflowStepTrailLog.record()` is
the only writer (`architecture.md` §3 L404).
- **`040_workflow_specs_diagnostic.ts`** — slice-11 (`f68f453a`,
slice-00 §1.3 provenance). An `ALTER TABLE ADD COLUMN` adding
parser/validator diagnostic columns to `workflow_specs` (**no new table,
no constraint changes beyond a DEFAULT**; the cache carries the
parse/validation diagnostic for the UI to render — `040_..._diagnostic.ts:5–25`).
**This migration is net-new since `architecture.md` was last edited** and
is not described in any prior as-built doc (slice-00 §1.3 — `f68f453a`
postdates the §3 body) — authored here from source per the slice-08
drift-to-fix register.
| File / symbol | Responsibility |
|---|---|
| [`domain/workflow-types.ts`](../../../packages/daemon/src/domain/workflow-types.ts) | Spec, instance, trail, frontier, and failure-occurrence contracts. |
| [`WorkflowSpecCache`](../../../packages/daemon/src/domain/workflow-spec-cache.ts) | YAML parsing, source-hash cache, stored specs, diagnostics and retention. |
| [`WorkflowValidator`](../../../packages/daemon/src/domain/workflow-validator.ts) | Roles, exits, routing/dependency edges, pins, cycles, and advisories. |
| [`WorkflowRuntime`](../../../packages/daemon/src/domain/workflow-runtime.ts) | Instantiation, inspection, routing, resume, abort, and lifecycle facade. |
| [`WorkflowProjector`](../../../packages/daemon/src/domain/workflow-projector.ts) | Close the current step and update its successor/frontier state. |
| [`WorkflowInstanceStore`](../../../packages/daemon/src/domain/workflow-instance-store.ts) | Instances, guarded updates, frontier bindings, and failure occurrences. |
| [`WorkflowStepTrailLog`](../../../packages/daemon/src/domain/workflow-step-trail-log.ts) | Append/read step history. |
| [`workflow-reconciliation.ts`](../../../packages/daemon/src/domain/workflow-reconciliation.ts) | Inspect graph changes, apply explicit revisions, recover operation receipts. |
| [`workflow-keepalive.ts`](../../../packages/daemon/src/domain/policies/workflow-keepalive.ts) | Watchdog evaluation and reminders. |
`036_watchdog_policy_enum_extension.ts` is a documenting no-op that records
the Phase D watchdog enum extension (Phase C uses application-layer
enforcement via the `PHASE_D_POLICIES` array, so no DDL is needed —
`architecture.md` §3 L363).
## Specification and cache
## 2. The transactional-scribe contract
`parseWorkflowSpec` parses the `workflow` document and checks known key sets.
`WorkflowValidator.validate` then checks relationships between roles, steps,
exits, and targets. The exits are `handoff`, `waiting`, `done`, and `failed`.
An exit-specific `next_hop.on` mapping takes precedence over structural
routing; without a mapping, `resolveNextStep` considers `forbid`, suggested
roles, `require`, and then the next array element.
The load-bearing Phase D guarantee is implemented in
`WorkflowProjector.project()` (`packages/daemon/src/domain/workflow-projector.ts`).
Re-confirmed at HEAD: the projector header (`workflow-projector.ts:1–20`)
declares "transactional-scribe contract" and `project()` runs a single
`db.transaction` (`workflow-projector.ts:184` `const txn = this.db.transaction(...)`).
Inside that one transaction:
The language includes `harness`, `host`, singular `gate`, `depends_on`, typed
`acceptance`, and waiting re-presentation settings. At this pin,
`WORKFLOW_AGENT_HARNESSES` contains only `claude-code` and `codex`; support for
another runtime elsewhere in OpenRig does not add it to this pin's workflow
harness grammar. Nonlocal host pins can validate as registered names but
`instantiate` still rejects execution with `host_pin_remote_unsupported`.
This is a workflow-step restriction, not a claim that all queue traffic is
local-only.
1. Close the current packet (state mutation on `queue_items`).
2. Create the next-step packet (`QueueRepository.createWithinTransaction()`,
`workflow-projector.ts:230`).
3. Record the trail entry.
4. Update the instance frontier + status.
5. Persist workflow events.
A step whose `allowed_exits` can neither finish it nor route it on is refused as
`step_cannot_finish` (`workflow-validator.ts:223-236`): its exits leave out `done`, none is
mapped in `next_hop.on`, and it allows no `handoff` that routes on. In a dependency graph,
allowing `handoff` is enough, because handoff completes a sink. `instantiate` refuses any spec
with a validation error.
Either everything commits or everything rolls back; lost handoffs are
impossible by design. Post-commit, subscribers are notified and the next
owner is nudged (`architecture.md` §3 L406).
`allowed_exits` and `max_hops` affect validation/projection. In contrast,
`continuation_required`, `preserve_lineage`, `closure_required`, closure
messages, `skill_refs`, and `spawn_budget` produce
`declared_not_enforced_v1` advisories. Legacy `gates: []` and
`next_hop.mode: prefer` are rejected by the parser rather than silently
accepted. Prerequisite cycles are rejected; a routing cycle requires a
`max_hops` declaration and is distinct from a prerequisite cycle.
`re_present_after_seconds` compiles to the queue's park timer on an unrouted
`waiting` exit, and `re_present_max_seconds` turns it into a repeating
reminder with backoff (`workflow-projector.ts:534`–`549`); a step that cannot
reach `waiting`, or that maps `waiting` to a branch, fails validation
(`waiting_re_presentation_unreachable`).
`WorkflowRuntime` (`packages/daemon/src/domain/workflow-runtime.ts:61`
`export class WorkflowRuntime`) is the orchestration class above the
projector.
`WorkflowSpecCache.readThrough` parses the source file, hashes it, and
updates the `(name, version)` cache row. Full `spec_json` preserves fields
that the older scalar columns cannot represent. A same-name/same-version
source edit can update that cache row; the version label alone is not an
immutable content pin. `getByNameVersion` is the runtime lookup.
Diagnostic-only rows, moved sources, and versions retained for unfinished
work have separate paths in `readThrough`, `writeDiagnostic`, and
`isPinnedByUnfinishedWork`.
**Phase D scope boundary** (`architecture.md` §3 L412): excludes multi-hop
chaining, gate-return-sweep, and the closure-enforcement path. The daemon's
transactional state remains the closure authority via Phase A's hot-potato
strict-rejection (see `coordination-primitive.md` §3); the workflow runtime
**projects on closure, it does not gate closure**.
## Durable state
## 3. The workflow-keepalive watchdog policy
The migration files record the storage evolution; they are not a count of
all database migrations:
`workflow-keepalive` is the Phase C-deferred watchdog policy, a TypeScript
port of the POC `lib/policies/workflow-keepalive.mjs` adapted to read SQLite
(`packages/daemon/src/domain/policies/workflow-keepalive.ts:1–5`).
Re-confirmed at HEAD (`workflow-keepalive.ts:5–16`):
| Migration | Workflow state introduced |
|---|---|
| [`033`](../../../packages/daemon/src/db/migrations/033_workflow_specs.ts), [`034`](../../../packages/daemon/src/db/migrations/034_workflow_instances.ts), [`035`](../../../packages/daemon/src/db/migrations/035_workflow_step_trails.ts) | Spec cache, instances/frontier/current step, and append-only trail API. |
| [`040`](../../../packages/daemon/src/db/migrations/040_workflow_specs_diagnostic.ts), [`050`](../../../packages/daemon/src/db/migrations/050_workflow_spec_json.ts) | Cache diagnostics and complete parsed spec JSON. |
| [`049`](../../../packages/daemon/src/db/migrations/049_workflow_instance_version.ts), [`051`](../../../packages/daemon/src/db/migrations/051_workflow_resume.ts), [`052`](../../../packages/daemon/src/db/migrations/052_workflow_instance_bound_rig.ts) | Optimistic version guard, resume/hop baseline, and bound rig. |
| [`079`](../../../packages/daemon/src/db/migrations/079_workflow_lifecycle_parallel.ts) | Lifecycle operation key/digest/binding, packet-to-step frontier bindings, and failure occurrences. |
- **LOAD-BEARING:** it MUST read `workflow_instances` directly via SQLite —
never the markdown source.
- Eligibility: `status === "active" || status === "waiting"`. Else
`action=terminal, reason="workflow_not_active"`.
- Frontier empty + no fallback target: skip with `reason="empty_frontier"`.
- Resolves frontier qitem owners by querying `queue_items`; combines with
explicit observer/created-by targets; sends to the first resolved target.
Current instance states include `active`, `waiting`, `completed`, `failed`,
and `aborted`. A multi-packet frontier needs packet-to-step bindings; a
single `current_step_id` cannot describe all parallel work.
The watchdog supervision tree itself (PL-004 Phase C, `031_watchdog_jobs.ts` /
`032_watchdog_history.ts`) records only meaningful evaluations; quiet skip
reasons (`not_due`, `no_actionable_artifacts`, `active_wake_not_due`) are
NOT recorded and do NOT emit `watchdog.*` events — POC parity so agents are
not woken about scheduler polls (`architecture.md` §3 L362). The Phase D
policy enum extends Phase C's three values with `workflow-keepalive`.
## Instantiation and owner selection
## 4. Workflow events
`WorkflowRuntime.instantiate` resolves a cached spec name or explicit path,
validates it, resolves the rig and the entry owner, then creates the instance
and its single entry packet (for `steps[0]`) through the transactional
event/queue path (`workflow-runtime.ts:433`, `:757`). The entry packet gets a
best-effort post-commit nudge with no staged wake intent (`:843`–`845`); its
keepalive, armed in the same transaction, and the boot sweep cover a lost
entry nudge. An explicit
unknown `targetRig` fails; an unknown spec-default rig produces an advisory
and falls back to unbound operation. A bound rig without a required declared
role is a different error.
> Drift-fix D8 / OPEN-4 (carried verbatim, slice-00): `architecture.md` §3
> L410 says "Existing 20 PL-004 events are unchanged" — internally
> inconsistent with L394's "32 PL-004 events untouched". **Do NOT carry
> either number.** The current `RigEvent` union
> (`packages/daemon/src/domain/types.ts:94`) has **73 members** total
> (slice-00 §1.8, re-confirmed at HEAD). The additive Phase D `workflow.*`
> events are described below WITHOUT asserting a contested PL-004 sub-count.
`resolveDefaultOwner` uses declared `preferred_targets` first, applying a
harness match when pinned. With no preferred targets and a bound rig, it uses
[`selectRoleSeat`](../../../packages/daemon/src/domain/workflow-role-resolver.ts):
a running managed agent with the declared role and required runtime, ordered
by pending-only backlog and then canonical coordinate. Infrastructure and
unresolvable/adopted coordinates do not become implicit replacement agents.
Explicit owner overrides are reconciled with harness pins. Declared
`preferred_targets` are not checked for liveness; validate and instantiate
only warn (`role_no_live_preferred_target`) when none of a role's targets has
a running session. A structured gate compiles by target kind (`compileGate`):
for a human-seat target, the packet goes to the gated step's own owner and is
parked `blocked_on` that human seat in the same transaction (summary and
`evidence_ref` required), and the instance waits until the park is resolved;
for a declared role, an ordinary packet goes to that handler role's seat
(`workflow-projector.ts:1659`–`1778`).
Phase D extends `RigEvent` with the additive `workflow.*` events
(re-confirmed `domain/types.ts:196–201`): `workflow.instantiated`,
`workflow.step_closed`, `workflow.next_qitem_projected`,
`workflow.completed`, `workflow.failed`, `workflow.routing_table_changed`
(6 members; a separate `workflow_spec` event also exists in the union).
A `preferred_targets` entry may end in `@{rig}`, for example `watcher@{rig}`.
When the instance is bound to a rig (`--rig`, or the spec's `target.rig`
default), the trailing `{rig}` becomes that rig, so one reusable spec addresses
that rig's member, including a `builtin:terminal` member. Only a trailing
`@{rig}` is the form: braces in the member part or a partial rig name
(`ops-{rig}@rig-a`, `ops-watcher@prefix-{rig}`) stay literal. Literal
`member@rig` entries are unchanged. With no bound rig the entry stays literal
and is handled like any other destination, at the step that selects it: a
selected `member@{rig}` is refused as an unknown destination rig
(`unknown_destination_rig`), and `rig workflow validate` reports such an
exception target as `unregistered`. A `{rig}` in a role that is never selected,
or in a preferred target that is not selected, does not stop an instantiate.
The cached spec keeps the literal `{rig}`; the expansion is computed from the
instance's stored `bound_rig` each time its spec is read, so later hand-offs,
resume and exception routing use the same target
(`workflow-rig-placeholder.ts`, `WorkflowSpecCache.getForInstance`). A
terminal member cannot act on a nudge, so it must poll its own queue for the
packet.
## 5. Route surface
Instantiation also emits advisories for missing members in otherwise
registered target rigs. That member check is advisory and does not imply
all preferred targets received a live-readiness test.
`/api/workflow` (`server.ts:495`) — `POST /validate`
(`routes/workflow.ts:82`), `POST /instantiate` (`:93`,
`getRuntime(c).instantiate(...)`), `POST /project` (`:118`,
`getRuntime(c).project(...)` — the transactional-scribe entry),
`GET /:instance_id/trace` (instance + trail), `POST /:instance_id/continue`
(idempotent inspect). Surface enumerated `routes/workflow.ts:21–28`.
Cross-ref: the `rig workflow` CLI surface — see `../cli-reference.md`.
## Projection, waiting, and concurrency
## 6. The WF-1 failure envelope (OPR.0.4.6.WF1)
`WorkflowProjector.project` checks active/waiting status, frontier membership,
packet-to-step identity, allowed exits, and applicable evidence requirements.
For a successful advance, queue closure, successor creation, trail entries,
frontier/version updates, durable events, and wake intent staging share the
transactional notification envelope. Terminal delivery happens after the
commit, and the runtime awaits it, so project, route, resume and exception
responses return after the delivery attempt; a terminal close without its
successor's staged intent rolls back. A committed packet or staged wake is
not evidence that its recipient consumed the message.
Added on top of the kept Phase D core (nothing above was re-specced;
FR-1 regression tests pin it):
Each exit closes the packet through the queue's own closure path
(`updateWithinTransaction`, hot-potato rules intact): `handoff` records
`handed-off` with `handed_off_to` the next owner; `waiting` records `blocked`
with `blocked_on` the supplied blocker, or `external-gate` when none is given;
`done` records `done` with `no-follow-on`; and `failed` records `done` with
`denied` and the result note as target (`workflow-projector.ts:1571`–`1631`).
A dependency-graph handoff that fans out to more than one successor, or to
none, closes the packet `done` with `no-follow-on`.
- **Step deadlines (FR-2, derived — never stored):**
`workflow-deadline.ts` classifies every active|waiting instance's
frontier packet by anchor — claimed w/ `closure_required_at` ·
claimed w/ NULL deadline (`claimed_at` + threshold; workflow packets
ship tier `mode2`, which has no SLA entry) · never-claimed
(`created_at` + threshold) · unclaimed-after-claim (`created_at`;
unclaim NULLs `claimed_at`). `WORKFLOW_STEP_STUCK_THRESHOLD_SECONDS`
(4h, = the routine-tier SLA) is THE single threshold home; WF-5
binds to it. Stuck self-clears on normal re-projection.
- **Keepalive auto-arm (FR-3):** instantiate + every handoff ensure
ONE per-instance `workflow-keepalive` watchdog job INSIDE the scribe
transaction; terminal exits disarm it. Auto-armed jobs carry
`context.deadline_gated: true` — quiet while healthy, and their
overdue send targets the stuck packet's owner with re-project
steering. Operator-registered jobs keep exact POC always-send parity.
- **Boot sweep (FR-4):** `workflow-boot-sweep.ts` at daemon startup —
re-arms missing keepalives, reissues LOST post-commit nudges
(pending frontier packet with `last_nudge_attempt` NULL = the
commit-then-crash window, detected from the nudge ledger), surfaces
stuck instances; one summary log line.
- **Real idempotency (FR-5):** waiting-replay ABSORPTION under the
full closure-intent identity (exit/packet/step/actor/resultNote/
effective-blocker/evidence deep-equal) — exact replay = zero writes;
any mismatch = a new decision via the normal path. Migration 049
adds `workflow_instances.version`: every guarded advance bumps it
`WHERE version = ?`; a stale writer gets structured
`instance_version_conflict` and its whole transaction rolls back.
- **max_hops enforced (FR-6):** compared at projection via
`exceedsMaxHops(hopCount, baseline, maxHops)` (v1 baseline = 0; the
baseline is WF-5's resume seam). Exceeding converts the handoff to
an honest structured failure (packet closed, instance failed, guard
evidence in trail + `workflow.failed`). Migration 050 adds
`workflow_specs.spec_json` — before it, `loop_guards`/`invariants`/
`closure`/`entry` were silently DROPPED at projection-time
rehydration (column-only rebuild); legacy rows self-heal on
readThrough and degrade VISIBLY (named once-per-spec advisory).
- **Validation (FR-7):** `parseWorkflowSpec` rejects unknown keys loud
at every level against EXPORTED closed keysets (WF-2 extends them);
the validator walks reachability/cycles over the projector's own
exported `resolveNextStep` — unreachable steps fail; a cycle without
`max_hops` fails naming the fix; with it, sanctioned.
- **`continue` honesty (FR-8):** relabeled to its real read-only
inspector semantics everywhere (CLI description/outcome, route
comment); `project` remains the sole advance write path.
- **The v2 dispositions (FR-9):** every declared-but-unenforced key —
`invariants.{continuation_required,preserve_lineage,closure_required}`,
`closure.*`, step `gates[]`, role `skill_refs`, `next_hop.mode:
prefer`, `loop_guards.spawn_budget` — produces the fail-open
`declared_not_enforced_v1` validator advisory (warning; never
blocks). `spawn_budget`'s advisory names its WF-2/WF-6
parallel-frontier acceptance pointer (arch ruling 2026-07-06).
`fallbackSynthesis` (instance column, never written) is dispositioned
in the `workflow-types.ts` JSDoc.
Both executors absorb an identical waiting replay by matching the stored
closure intent; changed wait data is a new decision. A consumed terminal
packet is no longer on the frontier and is refused. On the serial path a
routed close moves the frontier to the new packet and leaves the instance
`active`, or `waiting` when the target step is gated; an unrouted `waiting`
keeps the closed packet on the frontier so the keepalive can find its owner;
`failed` sets `failed`, and `done` with nothing left sets `completed`. A
dependency graph is `waiting` while every frontier packet is blocked, and
`failed` when the frontier empties with an unresolved occurrence.
`max_hops` constrains routing relative to the current drive's baseline: a
route that would exceed it becomes a `failed` exit with a `max_hops_exceeded`
note and evidence, the packet closes and no successor is created
(`workflow-projector.ts:419`–`443`); resume establishes a new bounded drive
rather than erasing history.
## 7. The WF-2 spec language (OPR.0.4.6.WF2)
Presence of `depends_on` selects `projectDependencyGraph`. It uses durable
packet bindings to advance eligible successors and record per-occurrence
failures without treating an unrelated live branch as completed. A step's
completion counts only while it is later, in trail append order, than its
prerequisites' latest completions, so a prerequisite re-run through a routed
exit sends its dependents round again (`workflow-projector.ts:1004`–`1019`).
Inspection reports unknown bindings rather than inventing a step from trail order.
WF-2 grows the language the ratified WF-1 engine speaks. ONE named
engine extension (branch execution); everything else is language +
compilation onto shipped seams.
The injected [`createWorkflowFrontierPredicate`](../../../packages/daemon/src/domain/workflow-frontier-guard.ts)
lets the queue refuse ordinary terminal closure of live workflow packets.
Workflow mutations use the explicit workflow path; the queue does not need
to import the workflow domain to evaluate that predicate.
**Conditional-on-outcome branching (FR-1).** A step may declare
`next_hop.on: {<exit>: <step-id>}` — branch keys are the recorded exit
enum ONLY (`handoff|waiting|done|failed`; closed set, enforced at
parse — `spec_branch_key_invalid`). A MAPPED exit routes to its target
INSIDE the same scribe transaction: next qitem created in-txn, instance
stays ACTIVE bound to the target, hop count + version guard bumped
identically to a linear advance, and the taken branch recorded
ADDITIVELY (`lastContinuationDecision.branchTaken` + the trail row's
`closure_evidence.branch_taken`) — never in `closure_reason` (closed
Phase-A enum). An UNMAPPED `failed`/`done` stays terminal exactly as
before; unmapped `waiting` stays a park. The `max_hops` guard fires on
ANY route (branch routes create the canonical remediation cycles);
cycle detection at validation runs over the structural ∪ branch edge
union and requires a declared `max_hops` to sanction any cycle.
Routing seam: `resolveNextStep(spec, step, recordedExit?)` — one
exported function, structural default when no exit supplied (the
validator's path).
## Recovery operations
**Per-step `harness:` pin (FR-2).** `claude-code | codex` (agent
harnesses only — `terminal` rejected at parse with a teaching error; Pi
joins in 0.4.7). Owner resolution picks the first `preferred_target`
whose node `runtime` column matches (`nodeRuntimeOf`: latest session →
node join); no match = structured `harness_pin_unsatisfied` naming the
pin + every candidate's runtime. Explicit owner overrides are
reconciled too — an override can never silently defeat a pin. Static
check at instantiate for every pinned step; re-checked at each route.
`WorkflowRuntime` distinguishes these operations:
**Per-step `host:` pin (FR-3).** `local`/absent = full execution today.
A registry id validates against `~/.openrig/hosts.yaml` (daemon
read-only twin; unknown id = `host_not_registered` naming registered
ids) but a remote pin fails loud at INSTANTIATE with
`host_pin_remote_unsupported` naming the MH-3 boundary + workaround —
the queue is local-only until MH-3; no qitem is ever minted into a
queue that cannot route it, and there is no silent local fallback.
| Operation | Meaning |
|---|---|
| `route` | Replace a current packet's owner while retaining the step. This is not step advancement. Multiple frontier packets require an explicit packet selection. |
| `resume` | Redrive failed work to a newly resolved owner, recording the optional `--decision` text. A serial instance must be `failed` (`instance_not_failed`). Resume re-resolves the owner rather than copying it, re-bases `hops_baseline`, increments `resume_count`, and closes that occurrence's open exception items. Dependency failures use occurrence identity; multiple unresolved failures require selection. Identical occurrence/decision replay returns the recorded redrive, while changed decision bytes conflict. |
| `abort` | Explicitly stop unfinished work with an actor and reason: cancels every frontier packet, records a `failed` trail row per packet, sets `aborted`, and emits `workflow.failed` with reason `aborted: <reason>`. Refused only for `completed` or `aborted` instances. |
| `continue` | Read-only inspection of instance, trail, guidance, reconciliation, frontier, failures, unknowns, and boundary obligations. It does not mechanically advance a step. |
**Structured step-level `gate:` (FR-5 — the socket; WF-5 owns
semantics).** Singular per step, closed keyset `{target, summary,
evidence_ref}`. HUMAN target (the shipped human-seat predicate) →
compiles to a human-routed item (tier `human-gate` + summary +
evidence_ref — the shipped 0.4.4 write path), resolved by the shipped
`resolve` verb; HANDLER-ROLE target → an ordinary agent item to the
role's resolved seat. Routing INTO a gated step creates the gate item
as the frontier packet and parks the instance `waiting`; resolve/close
continues the flow from that step (the WF-1 unpark — no restart). A
gated ENTRY step parks from birth.
## Deadlines and exceptions
**Dispositions (FR-4) — the inert third state is dead.** The legacy
step `gates: [...]` string list is REMOVED at parse
(`spec_gates_removed`, what/why/fix naming the new `gate:` object);
`next_hop.mode: prefer` is REMOVED at parse
(`spec_prefer_mode_removed` — it never had distinct behavior).
`skill_refs` / `closure.*` / `invariants.{continuation_required,
preserve_lineage,closure_required}` keep their WF-1 FR-9 explicitly-v2
advisories; `spawn_budget` stays explicitly-v2 (WF-6/parallel-frontier
acceptance pointer). Every key is consumed, removed, or
machine-readably advisory — zero silently-inert keys.
[`evaluateStepDeadline`](../../../packages/daemon/src/domain/workflow-deadline.ts)
derives overdue state from frontier queue rows. Claimed work uses its closure
deadline, otherwise its claim time plus **4 hours** (creation time if the
claim time is absent). Pending work uses creation time plus **4 hours**.
Blocked waits are not overdue under this evaluator. This is a diagnostic,
not a substitute for packet existence or binding checks.
**Versioning honesty (FR-6).** New strictness lands at
`parseWorkflowSpec` (the only seam that sees raw keys; the WF-1
exported closed keysets extended with `harness`/`host`/`gate` +
`next_hop.on`) and applies at validate/instantiate/re-parse. A LIVE
instance pinned to a pre-WF-2 spec version keeps executing un-failed
(project() has no validation gate, by design; stored `spec_json` blobs
missing the new optional fields read fine); the same spec FILE
re-validated fails under the new rules.
Instantiate and every routed projection arm a `workflow-keepalive` watchdog
job in the same transaction (one per live packet for dependency graphs, one
per instance for serial specs), evaluated every 15 minutes and quiet until the
step is overdue (`workflow-keepalive-arming.ts:38`). At each daemon start the
boot sweep re-arms keepalives for live instances, re-nudges pending frontier
packets that were never nudged, and surfaces overdue instances
(`workflow-boot-sweep.ts`). Neither path advances a step.
**Hand-authorability (FR-6).** Three shipped example shapes at
`packages/daemon/src/builtins/workflow-specs/`: `linear-build.yaml`
(zero WF-2 features — the zero-regression reference),
`gated-release.yaml` (human gate + harness pins),
`branched-remediation.yaml` (bounded failed-path remediation loop).
There are three exception classes: `unmapped_failed`, `stuck_overdue` and
`human_gate_trip` (`workflow-exception.ts:34`–`38`). An unrouted `failed`
exit creates one urgent `workflow-exception` queue item in the same
transaction, with evidence `rig workflow trace <instance>` and a body naming
the `rig workflow resume` command; a human gate's own parked packet carries the
`human_gate_trip` identity, so no second item is created.
**The composed RSI example (OPR.0.4.6.FAC2).** `factory-rsi.yaml` is the
single-rig recursive-self-improvement factory MVP: it composes the branch +
gate + guard primitives into the inner loop — `plan → implement → qa_check →
review → release_prep` — where `qa_check`/`review` branch `failed` back to
`implement` (bounded remediation) and `release_prep` (the release-manager
prepares artifacts, un-gated) hands off to a human-gated `release_signoff`.
Dogfood is decoupled from this gated loop: the dogfood seat runs out-of-band
against the shipped product and feeds its findings into the next plan (the RSI
edge, ungated). The remediation loops are sanctioned only by the enforceable
`loop_guards.max_hops`; a trip is a WF-5 exception (orchestrator-first via
`exception_routing`). It targets the shipped `factory-rsi` launch starter
(`specs/rigs/launch/factory-rsi/`) whose seats pin 1:1 to its roles via
`preferred_targets` — the v0 hardcode seam, no binding layer.
[`resolveExceptionRoute`](../../../packages/daemon/src/domain/workflow-exception-router.ts)
selects per-class configuration, then workflow default, host default, and
finally orchestrator-first behavior. An unresolved orchestrator route falls
back to registered-human selection. A human gate is intrinsically human
routed. Agent-routed exceptions use the ordinary workflow tier; human-routed
ones use `human-gate`.
## The CLI surface (OPR.0.4.6.WF3)
[`workflow-human-destination.ts`](../../../packages/daemon/src/domain/workflow-human-destination.ts)
handles human selection: the registered human named by
`workspace.operator_seat_name`, or the only registered human when it is unset;
any other case fails with `workflow_human_destination_unavailable` (409). The
host default dial is the setting `workflow.exception_routing`
(`orchestrator` or `human_only`), read per exception. A valid agent route need
not have a human fallback configured. If fallback is needed, missing/ambiguous selection is an explicit
error, not an invented destination. Failure admission is transactional;
overdue detection is handled by boot/keepalive paths. Runtime reconciliation
closes recovered overdue occurrences against their own packets, preserving
unresolved siblings and unknown provenance.
WF-3 made the CLI the primary human/agent driving surface. Render-side
by rule (BR-2): `run`/`watch` consume the shipped SSE endpoints
(snapshot-first-then-stream, priorQitemId dedup, reconnect → announced
poll fallback, outcome-as-exit-code: 0 completed / 3 failed);
`trace`/`list`/`show` human modes are formatted (argo-shape tree, ps-
mechanics columns, ATTN markers) while `--json` stays byte-stable;
`status` composes the needs-attention rollup CLI-SIDE from the
API-carried `instance.deadline` classification (one threshold home —
the CLI never recomputes a class). The two daemon additions:
## Project lifecycle graphs
- **`route`** (`POST /api/workflow/:id/route`, runtime `route()`):
close+recreate+rebind in ONE scribe transaction — honest
`handed_off_to` closure with provenance, successor recreate (same
step; `current_step_id` unchanged; no hop bump — route is not an
advance), frontier rebind under the version guard, keepalive
re-target in-txn. Advance-authority revocation is STRUCTURAL: the
old packet leaves the frontier in the transaction, so a zombie
owner's stale `project` hits the shipped `packet_not_on_frontier`
409.
- **The frontier close-path guard** (`workflow-frontier-guard.ts` →
INJECTED into `QueueRepository` at startup; the queue never imports
the workflow domain): terminal closure of a live frontier packet
from non-workflow verbs rejects `workflow_frontier_packet` with a
what/why/fix naming `rig workflow project` / `route`. Workflow
writers pass `viaWorkflowVerb`; non-workflow qitems see zero new
behavior.
`compileLifecycle` delegates to
[`compileProjectLifecycle`](../../../packages/daemon/src/domain/project-lifecycle-compiler.ts).
`instantiateLifecycle` requires an operation key and compiled input digest.
An exact replay retrieves the recorded instance/entry packet; changed input
under the same key conflicts. Compilation and an eligible result do not by
themselves launch work.
## The exception + human-gate model (OPR.0.4.6.WF5)
`inspectGraph`, `reviseGraph`, and `recoverGraphOperation` in
[`workflow-reconciliation.ts`](../../../packages/daemon/src/domain/workflow-reconciliation.ts)
separate inspection from explicit graph revision and operation recovery.
Inspection reports `current`, `source-only`, `compatible`, `incompatible`,
`unavailable` or `unbound`. Only a live, manifest-bound instance whose specs
are explicit dependency graphs without `next_hop.on` can be revised; a
revision may add steps and change unstarted ones, but may not remove steps,
touch a step with completed, live or failed work, drop a required obligation
or its order, change workflow-wide fields other than `exception_routing`, or
add an unstarted step with no outstanding prerequisite. A changed
`exception_routing` applies to future occurrences only; existing obligations
keep their owners. Applying needs the inspected version and digest, an
operation key, an actor and a reason; the receipt is kept in the instance's
`revisionHistory`, and replaying the same key with a different decision is
refused with `lifecycle_revision_conflict` (`workflow-reconciliation.ts:12`,
`:113`–`223`).
`guidance` reads context and current packet information without interpreting
an agent's substantive judgment.
The deterministic engine's exception layer: the happy path stays
orchestrator-free and PROVEN so; every exception becomes exactly one
durable attention item the moment it exists; the responder resolves it
and the flow resumes from where it stopped.
For lifecycle steps that require a receipt, a `done`/`handoff` projection
requires an `evidence_ref`. Typed acceptance gates additionally compare the
submitted candidate, allowed verdict, and evidence reference against the
step declaration. These are mechanical identity/presence checks; the
projector does not read the referenced prose to decide whether the work is
good or ready to publish.
- **The taxonomy** (`workflow-exception.ts`): three closed classes as
pure predicates over recorded state — `unmapped_failed` (recorded
`status=failed`; a WF-2-mapped `failed` routes to remediation and is
NOT an exception), `stuck_overdue` (the WF-1 deadline evaluator's
verdict consumed verbatim — the single threshold home), and
`human_gate_trip` (WF-2 HUMAN gates; the compiled park IS the item).
Handler-role gate-trips are deterministic handoffs, not exceptions —
classes (a)/(b) backstop the handler's own step. The occurrence key
is the recorded packet id of the episode: re-detections dedupe,
resolve+resume closes, a fresh packet is a NEW occurrence.
- **The maturity dial** (`workflow-exception-router.ts` + the
`exception_routing` spec grammar + the `workflow.exception_routing`
settings key): target resolution = spec per-class → spec default →
host dynamic key → ORCHESTRATOR-FIRST (the declared orchestrator
role via the same `preferred_targets` pick step owners use) →
registered-human selection (`workflow-human-destination.ts`). THE TIER SPLIT: `human-gate` rides
ONLY human-routed positions — an orchestrator-routed item carries
the ordinary tier so the shipped attention union (which matches on
tier regardless of destination) never leaks it into NEEDS-YOU. The
shipped attention predicate is untouched.
- **Class (a) born-in-txn**: serial failure and unhandled dependency-branch
failure share exception admission. The failed packet, dependency occurrence,
owning item and staged wake commit together, even while an unrelated frontier
keeps the instance active. Mapped remediation remains ordinary workflow work;
an unmapped or max-hop failure requires an owner. An agent destination rejected
as an unknown rig tries registered-human selection. Selection, admission,
or storage failure rolls back the close; it never commits a phantom
human alert. Other errors retain their original diagnosis. **Class (b) at detection**: the boot sweep and the keepalive
evaluation call the injected ensurer (`workflow-exception-
escalation.ts`) — occurrence-deduped against OPEN items by tag
query, scoped to the exact workflow, instance and packet; the crash-surviving
sweep re-creates a missed item. Normal projection, keepalive (including
healthy/terminal returns), and boot (including completed instances) reconcile
each overdue item's own packet. A resolved wait, completion or obsolete
frontier packet closes only that occurrence with a retained transition;
an overdue sibling stays open. Unknown provenance is retained. A later
overdue episode can create a fresh item even when it reuses the same packet.
- **Human selection and failure**: the existing `workspace.operator_seat_name`
setting selects a registered human; when unset, exactly one registered human
is required. No `human@host` alias is invented and no arbitrary choice is made
among several humans. The setting and registry are read at fallback time,
so a valid configured agent route needs no human registry. Missing, ambiguous,
invalid or unavailable selection produces `workflow_human_destination_unavailable`
(HTTP 409 for failed projection). Fix the registration/selection and retry.
Detection-time admission failures are logged by boot and included in the
keepalive's existing owner nudge and evaluation notes; later detection retries.
A registered destination still uses the gateway's ordinary delivery rules and
receipt ledger. Admission is not proof of posting or readership.
A capability inventory or detector instance-binding read failure propagates
instead of becoming a no-match:
failed projection returns HTTP 500 and rolls back its packet, instance and
history writes; overdue detection surfaces the read error without an exception
item. An evidenced no-match still uses registered-human selection.
- **`resume`** (`POST /api/workflow/:id/resume`, runtime `resume()`,
`rig workflow resume`): redrive semantics in ONE scribe transaction —
failed→active REBOUND to the recorded failed step; the owner is
RE-RESOLVED through the projection resolver (never copied from the
stale destination — resume is the one sanctioned re-resolution
point); `--decision` lands durably in the redrive packet; the
occurrence's open items close with provenance; the trail is
preserved, never rewritten. For a dependency graph, `--occurrence <failed-qitem-id>`
selects the episode (required with several unresolved failures). Its resolution,
redrive packet/wake and exact instance/occurrence exception closure share one
transaction; siblings remain intact. An identical occurrence/decision retry
returns the existing redrive; changed decision bytes conflict without mutation.
THE LIVELOCK RAIL (migration 051):
`hops_baseline` re-anchors the max_hops guard at resume so each
redrive gets exactly one bounded window; `resume_count` is the
recorded redrive fact; re-exceeding raises an honest NEW occurrence.
- **The workflow-aware ▲ band** (`review/compose.ts
deriveWorkflowExceptions` + the gatherer source): the missing-item
backstop row, the stuck row with evaluator evidence, the
frontier-non-open ANOMALY row (detection behind WF-3 FR-6's
prevention), and THE AWARENESS ROW — an orchestrator-routed
exception renders holder + age in the human band (one identity, two
projections, count = 1); human-routed items render nothing there
(the ● item is the row). Recomposition clears on state-exit.
## CLI and HTTP surface
## The workflow ↔ rig binding layer (OPR.0.4.6.FAC1)
The [CLI inventory](../cli-reference.md#workflow) lists every registered
`rig workflow` subcommand and option. The implementation is
[`packages/cli/src/commands/workflow.ts`](../../../packages/cli/src/commands/workflow.ts).
The [`workflow` routes](../../../packages/daemon/src/routes/workflow.ts)
are mounted under `/api/workflow`:
Run any workflow on any rig that can support it, without editing the
spec — the self-driving factory's binding substrate. Three seams:
| Method | Suffixes |
|---|---|
| `POST` | `/validate`, `/compile`, `/instantiate`, `/instantiate-lifecycle`, `/project` |
| `GET` | `/list`, `/specs`, `/operations/:key`, `/:instance_id`, `/:instance_id/trace`, `/:instance_id/guidance`, `/:instance_id/revision` |
| `POST` | `/:instance_id/route`, `/:instance_id/resume`, `/:instance_id/abort`, `/:instance_id/continue`, `/:instance_id/revision` |
| `GET` | `/sse`, `/watch` (same live event stream handler) |
- **A1 — bind at instantiation** (migration 052,
`workflow_instances.bound_rig`): the effective binding =
`--rig`/`targetRig` override `?? spec.target.rig ?? null`; the spec
field stays a DEFAULT (no routing path reads it — display only). The
rig NAME persists (the durable operator-space coordinate); name→id
re-resolves fresh at each resolution site — a vanished rig fails loud
(`bound_rig_not_found`), never silently. NULL = unbound =
byte-identical pre-FAC-1 behavior. **Unknown-rig validation SPLITS by
PROVENANCE** (arch ruling 2026-07-07, target-rig zero-regression):
an explicit operator `--rig`/`targetRig` is AUTHORITATIVE — unknown →
`bound_rig_unknown` HARD-FAIL before any mutation; a spec-default
`target.rig` is ADVISORY (authored under the pre-FAC-1 regime where the
field was ignored at runtime) — unknown → DEGRADE to unbound + a LOUD
`advisories` notice on the instantiate result (surfaced by route + CLI
stderr), never a hard-fail. This preserves AC-1 zero-regression for
shipped/example specs that declare a descriptive `target.rig` AND route
via `preferred_targets` (e.g. `conveyor`): they instantiate exactly as
pre-FAC-1. A spec that genuinely needs a bound rig still fails loudly,
per-step (entry at instantiate, later role-only steps at projection) —
the degrade is to honest per-step failure with a heads-up, never to
silence.
- **A2 — role→seat capability resolution**
(`workflow-role-resolver.ts` pure policy +
`workflow-role-context.ts` lazy sync snapshot): TIER 3 inside
`resolveDefaultOwner`, activating ONLY when a role declares zero
`preferred_targets` AND the instance is bound. Tier order is sacred:
explicit owner → gate compile → declared `preferred_targets`
(byte-identical, never inventory-filtered) → capability → loud null.
The CLOSED fact set: role (`nodes.role`, declared per pod member —
seat-side, opt-in) · nodeKind · lifecycleState (`running` only) ·
runtime (harness-pin aware) · sync `pendingWorkCount` (pending-only
backlog) · the derived canonical coordinate. Async
`attachAgentActivity`/tmux probes are structurally absent from the
transaction. Managed seats only: adopted seats are excluded LOUDLY
(`adopted_seat_not_role_resolvable_v1`). Selection = least backlog,
plain-codepoint coordinate tiebreak (`driver10@rig < driver2@rig`).
Resolution runs ONCE at step-close (after the frontier + absorption
guards — replays perform zero inventory reads) and records as the
packet destination; the WF-5 resume is the one re-resolution point,
now capability-aware. All SIX owner-resolution sites carry the
context: projector next-step, human-gate parked-packet owner,
handler-role gate destination (no-targets + bound → capability),
runtime entry (live + recorded), the eager instantiate loop
(STRUCTURAL zero-role-coverage check only — `bound_rig_role_uncovered`;
no live resolution of future steps; a warming rig instantiates), and
resume. The WF-5 exception dial's orchestrator-role position resolves
capability-aware on the bound rig at both homes (in-txn class-(a) +
detection-time class-(b)), then uses registered-human selection if no
agent resolves. Failures are loud-with-candidates: structured
per-candidate disqualifiers + a named zero-candidate message; never a
spawn, never auto-`add_member`, never a dead-seat route. Additive
`owner_resolution` trail evidence records `{mode, role, boundRig?,
seat}` per routing decision.
- **A3 — roles bind to SEATS, never occupants**: the ONE string rule —
the derived canonical coordinate `{pod}-{member}@{rig}` is both the
tiebreak key and the recorded destination, so an agent handover
behind the seat never strands the workflow (raw occupant-era session
names are never recorded as role-resolution destinations).
The stream carries the 8 `workflow.*` events (`instantiated`, `step_closed`,
`next_qitem_projected`, `completed`, `failed`, `resumed`,
`routing_table_changed`, `revised`); it is not a general queue stream or a
stored-history replay. Route error mapping distinguishes missing
records, authoring errors, state/version conflicts, and internal failures.
See the source mapping before assigning a meaning to a nonzero CLI result.
## The member-exists instantiate advisory (OPR.0.4.6.FAC3 — engine bit)
The queue transport validates the RIG of a destination, never the member
(`topologyValidateRig` is rig-exists-only by design — hardening it would
gate every queue write and break legitimate non-managed destinations),
so a declared `preferred_target` naming a registered rig but a typo'd or
stale MEMBER would mint an orphan packet, visible only later as a WF-5
stuck exception. FAC-3 catches it at the earliest knowable moment: at
instantiate, for every step-referenced role (each step's `actor_role`
plus a handler gate's target role — the same reference set the
structural coverage check walks), each declared `preferred_target` that
parses CANONICAL and names a rig registered on this daemon is probed
for member existence (`rigMemberExists` beside `rigDeclaresRole` —
sync SQL, the derived canonical coordinate per the FAC-1 Q5 one-string
rule, existence at ANY lifecycle state and node kind; liveness stays
projection's business). An unknown member yields ONE aggregated
advisory per unique target — naming every declaring step/role pair, the
consequence (the work will not be claimed; it will surface as a stuck
exception), and the fix hint — pushed into the shipped
`InstantiateResult.advisories` list (the FAC-1 `target.rig`-degrade
surface: one list, now two producers; rendered by the route body + CLI
stderr, zero new surface). ADVISORY-NEVER-DENY: instantiate always
proceeds. Skips (in order): human-seat refs (classified BEFORE parse,
the queue-gate archetype), non-canonical raw/adopted destinations (the
inventory cannot vouch for them), unregistered rigs (the transport
already rejects those loudly at queue-write — no double advisory).
## See also
- `coordination-primitive.md` — PL-004 Phase A; the closure authority the
runtime projects against.
- `mission-control.md` — PL-005 queue observability + 7-verb contract.
- Source roots: `packages/daemon/src/domain/{workflow-projector,
workflow-runtime,workflow-instance-store,workflow-spec-cache,
workflow-step-trail-log,workflow-validator}.ts`,
`packages/daemon/src/domain/policies/workflow-keepalive.ts`,
`packages/daemon/src/domain/{workflow-exception,workflow-exception-router,
workflow-exception-escalation}.ts`, `packages/daemon/src/routes/workflow.ts`.
For authoring examples and project-level boundaries, use
[product journey SDLC](../../reference/product-journey-sdlc.md) and
[release boundaries](../../reference/release-boundary.md).
+477 -285
View File
@@ -9,92 +9,80 @@ applies-when: |
defaultRepo / knowledgeRoot), how that block is persisted and resolved into
whoami / node-inventory, how per-item target_repo scope is validated, or how
the file-backed missions/slices tree is indexed and projected into the
Project UI. Author-mode module — no prior architecture.md prose; every
load-bearing claim is sourced to file:line at HEAD.
Project UI.
siblings: [content-surfaces.md, daemon-core.md, ../ui/project-and-for-you.md]
prerequisite-reads: [../README.md, daemon-core.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Workspace Primitive — RigSpec.workspace, Migrations 038/039, Missions/Projects/Slices
The **workspace primitive (PL-007)** is the typed declaration that lets a rig
name *where its work lives* — a workspace root, a set of named repos with
kinds, an optional default repo, and an optional knowledge root — and have
that surface through `whoami` / node-inventory and gate per-item repo scope.
Alongside it, a **file-backed missions/slices tree** is indexed read-only and
projected into the Project UI's mission / slice surfaces.
The **workspace primitive** is the typed declaration that lets a rig name
*where its work lives* — a workspace root, a set of named repos with kinds, an
optional default repo, and an optional knowledge root — and have that surface
through `whoami` / node-inventory and gate per-item repo scope. Alongside it, a
**file-backed missions/slices tree** is indexed read-only and projected into
the Project UI's mission / slice surfaces.
> **AUTHOR-FROM-SOURCE module.** No prior `architecture.md` prose exists for
> this. Every load-bearing claim carries `> Source: <file:line> @HEAD`;
> ambiguity is declared as an OPEN item, never smoothed. Paths are relative to
> `packages/daemon/src/` unless prefixed `packages/` or `docs/`.
>
> Verified at HEAD `7eaf524c` (`git describe` → `v0.3.1-6-g7eaf524c`).
> Package version **0.3.1**; HEAD carries 6 unreleased release-0.3.2 commits;
> no `v0.3.2` tag (daemon-core.md; slice-00 §1.1).
>
> **SPLIT NOTE (§10.6).** The honest source-grounded scope of
> `workspace-and-content-primitives` (proposed-structure.md §4.9 / D13)
> exceeds ~400 lines across two distinct subsystem clusters with distinct
> source roots. Per the §10.6 SPLIT DIRECTIVE it is split by subsystem
> cluster into this module (workspace primitive + migrations 038/039 +
> missions/projects/slices) and the sibling `content-surfaces.md`
> (files/markdown/progress/steering). This is a transparent noted deviation
> from ratified Q7 "18", a faithful application of the founder's own
> ratified Q3 principle ("distinct primitive / distinct source root →
> split"); surfaced at the slice-08 review gate, not a mid-execution
> interrupt.
> Paths are relative to `packages/daemon/src/` unless prefixed `packages/` or
> `docs/`. Verified against source at main `e8f0ab340db773392ec8be75b072d1c0f3068a50`. Each count sits beside
> the command that produces it; run the commands from the repository root.
> The files / markdown / progress / steering surfaces are in the sibling
> `content-surfaces.md`.
## 0. Release attribution (forensic proof — read first)
## 0. Release attribution
Per §10.8, re-verified at HEAD via `git cat-file -e <tag>:<path>`:
Checked with `git cat-file -e <tag>:packages/daemon/src/<path>`. The table
records when each file first appeared; most have changed since.
| Subsystem | Release | Forensic proof @HEAD |
| Subsystem | First release | Check |
|---|---|---|
| `domain/workspace/{workspace-resolver,frontmatter-validator,default-workspace-scaffold}.ts` | **≤0.3.0** | `v0.3.0:<path>` → present |
| migrations `038_workspace_primitive.ts`, `039_queue_target_repo.ts` | **≤0.3.0** | `v0.3.0:<path>` → present |
| `domain/slices/{slice-indexer,slice-detail-projector}.ts` | **≤0.3.0** | `v0.3.0:<path>` → present |
| `routes/{workspace,slices,projects}.ts` | **≤0.3.0** | `v0.3.0:<path>` → present |
| `domain/workspace/getting-started-narrative.ts` | **0.3.1** | `v0.3.0:` → **ABSENT**; `v0.3.1:` → present |
| `routes/missions.ts` | **0.3.1** | `v0.3.0:` → **ABSENT**; `v0.3.1:` → present |
| `domain/workspace/{workspace-resolver,frontmatter-validator,default-workspace-scaffold}.ts` | **≤0.3.0** | present at `v0.3.0` |
| migrations `038_workspace_primitive.ts`, `039_queue_target_repo.ts` | **≤0.3.0** | present at `v0.3.0` |
| `domain/slices/{slice-indexer,slice-detail-projector}.ts` | **≤0.3.0** | present at `v0.3.0` |
| `routes/{workspace,slices,projects}.ts` | **≤0.3.0** | present at `v0.3.0` |
| `domain/workspace/getting-started-narrative.ts` | **0.3.1** | absent at `v0.3.0`; present at `v0.3.1` |
| `routes/missions.ts` | **0.3.1** | absent at `v0.3.0`; present at `v0.3.1` |
| `domain/workspace/workspace-doctor.ts` | **0.3.2** | absent at `v0.3.1`; present at `v0.3.2` |
> Source: §10.8 proof re-run at HEAD `7eaf524c` —
> `git cat-file -e v0.3.0:packages/daemon/src/domain/workspace/getting-started-narrative.ts`
> and `...routes/missions.ts` both fail ("exists on disk, but not in
> 'v0.3.0'"); all other listed paths resolve at `v0.3.0`. The workspace
> primitive itself is a **0.3.0** feature (slice-00 0.3.0-GT §1.4, PL-007,
> migrations 038/039) — do not back-attribute it to 0.3.1. The
> `missions` route + the getting-started narrative scaffold are the
> **0.3.1** additions layered on top (slice 12 mission scope; slice 21
> onboarding-conveyor).
The workspace primitive itself (declaration, resolver, validator, migrations
038/039) is a **0.3.0** feature — do not back-attribute it to 0.3.1. The
`missions` route and the getting-started narrative are **0.3.1** additions;
the workspace doctor is **0.3.2**.
slice-00 0.3.0-GT §1.4 independently confirms the primitive shipped 0.3.0:
workspace-primitive merge `2ce54abc` (PL-007) with migrations
`038_workspace_primitive` + `039_queue_target_repo`, "fresh databases apply
migrations through `039_queue_target_repo`".
`getting-started-narrative.ts` is still in the tree, but nothing imports it:
**0** files reference it (`git grep -l 'workspace/getting-started-narrative' -- packages | wc -l`).
Workspace initialization no longer seeds a getting-started mission (§3).
## 1. The typed workspace declaration (PL-007) — 0.3.0
## 1. The typed workspace declaration — 0.3.0
`RigSpec.workspace` is an **optional** typed block. Rigs without it stay valid;
`whoami` / node-inventory return a null workspace block in that case.
> Source: `domain/types.ts:762-770` (`WorkspaceSpec`), `:751-758`
> (`WorkspaceRepoSpec`), `:780` (`RigSpec.workspace?`) @HEAD.
> Source: `domain/types.ts:1163–1170` (`WorkspaceSpec`), `:1153–1159`
> (`WorkspaceRepoSpec`), `:1188` (`RigSpec.workspace?`).
| Field | Shape | Notes |
|---|---|---|
| `workspaceRoot` | string | Verbatim from spec |
| `repos[]` | `{ name, path, kind }[]` | `path` resolved to absolute at parse time; authors may declare relative to `workspaceRoot` in YAML |
| `repos[]` | `{ name, path, kind }[]` | `path` resolved to absolute at parse time (`domain/rigspec-schema.ts:361–363`); authors may declare it relative to `workspaceRoot` in YAML |
| `defaultRepo?` | string | active repo when no env override / cwd match |
| `knowledgeRoot?` | string | treated as `kind=knowledge` when surfaced |
`WorkspaceKind` is a closed 5-member union: `user`, `project`, `knowledge`,
`lab`, `delivery`.
`WorkspaceKind` is a closed union of **5** members
(`grep '^export const WORKSPACE_KINDS' packages/daemon/src/domain/types.ts | grep -o '"[a-z]*"' | wc -l`):
`user`, `project`, `knowledge`, `lab`, `delivery`.
> Source: `domain/types.ts:748-749` (`WORKSPACE_KINDS` /
> `WorkspaceKind`) @HEAD.
> Source: `domain/types.ts:1149–1150` (`WORKSPACE_KINDS` / `WorkspaceKind`).
In YAML the block is spelled `workspace: { workspace_root, repos: [{ name,
path, kind }], default_repo?, knowledge_root? }`. Validation requires a
non-empty `workspace_root`, a `repos` array whose names are unique and whose
`kind` is one of the five kinds, a `default_repo` that names a declared repo,
and a non-empty `knowledge_root` when present.
> Source: `domain/rigspec-schema.ts:288–347`.
### 1.1 Persistence — migration 038 + RigRepository
@@ -102,9 +90,9 @@ Migration **038** adds `workspace_json TEXT` to the `rigs` table. It holds the
typed `RigSpec.workspace` block as JSON when a rig declares one; NULL for rigs
without a workspace block.
> Source: `db/migrations/038_workspace_primitive.ts:16-21`
> (`ALTER TABLE rigs ADD COLUMN workspace_json TEXT`); doc-comment
> `:3-14` @HEAD.
> Source: `db/migrations/038_workspace_primitive.ts:16–21`
> (`ALTER TABLE rigs ADD COLUMN workspace_json TEXT` at `:19`); doc comment
> `:3–15`.
`RigRepository.setRigWorkspace(rigId, workspace)` persists it (UPDATE
`workspace_json` + `updated_at`); `getRigWorkspace(rigId)` reads it back,
@@ -113,302 +101,506 @@ are **defensive no-ops** when the column is absent (`hasRigColumn` probe) —
older test fixtures that bypass the canonical migration list don't have the
column; the setter's contract is "best-effort persistence".
> Source: `domain/rig-repository.ts:98-105` (setter, column probe
> L99), `:106-117` (getter; parse-fail → null L114-116) @HEAD.
> Source: `domain/rig-repository.ts:184–189` (setter; column probe `:185`),
> `:192–202` (getter; probe `:193`; parse failure → null `:199–201`);
> `hasRigColumn` `:347`.
The instantiator persists the block at rig-create time **only when declared**:
The block is written only when declared. **3** call sites write it
(`git grep -n 'setRigWorkspace(' -- packages/daemon/src | grep -v 'rig-repository.ts' | wc -l`):
the instantiator's two rig-persist paths, `materializeValidatedSpec` and
`instantiateOnce`, each guarded by `if (rigSpec.workspace)`; and the
workspace-only import route `POST /api/rigs/import/workspace`
(`rig import --workspace-only --target-rig <rigId>`), which validates and
normalizes the block and writes it only when it differs from the stored one.
> Source: `domain/rigspec-instantiator.ts:653-655` (`if
> (rigSpec.workspace) … setRigWorkspace(rigId, rigSpec.workspace)`) @HEAD.
> Source: `domain/rigspec-instantiator.ts:619` (`materializeValidatedSpec`),
> `:655–657`; `:1260` (`instantiateOnce`), `:1349–1351`;
> `routes/rigspec.ts:134–173` (validation `:158`; compare-and-write
> `:168–170`), mounted `server.ts:734`; CLI
> `packages/cli/src/commands/import.ts:82`.
### 1.2 Runtime resolution — workspace-resolver
`resolveWorkspaceContext({ spec, cwd, envOverride })` (consumed by
`whoami-service`) returns the `WhoamiWorkspaceBlock` or `null` when no spec.
`activeRepo` resolution: an `envOverride` (non-empty, trimmed) wins
**verbatim** — even an unknown repo name is honored, because operators set
`OPENRIG_TARGET_REPO` consciously (PL-007 PRD § Item 3); otherwise
`defaultRepo` is used **only if it names a declared repo**. `knowledgeKind`
is `"knowledge"` when `knowledgeRoot` is declared, else `null`.
`activeRepo` resolution: a non-blank `envOverride` wins **verbatim** — even an
unknown repo name is honored, because operators set `OPENRIG_TARGET_REPO`
consciously (the comment at `workspace-resolver.ts:35–36`); otherwise `defaultRepo` is used **only
if it names a declared repo**. `knowledgeKind` is `"knowledge"` when
`knowledgeRoot` is declared, else `null`. The resolver accepts `cwd` but does
not use it (`workspace-resolver.ts:31`), so `rig whoami` reports the env
override or the declared `defaultRepo`, never the repo containing the seat's
working directory; node-inventory's per-node `activeRepo` (below) is the one
that follows cwd.
> Source: `domain/workspace/workspace-resolver.ts:26-52` (resolver;
> env-override-verbatim L34-43, including the "honored verbatim"
> comment L35-36) @HEAD.
> Source: `domain/workspace/workspace-resolver.ts:26–52` (resolver; null
> without a spec `:32`; env override `:39–40`; declared `defaultRepo`
> `:41–42`; `knowledgeKind` `:50`).
`whoami-service` reads the persisted spec and resolves with the query's
`targetRepoOverride`, falling back to `process.env["OPENRIG_TARGET_REPO"]`:
`targetRepoOverride`, falling back to the daemon's own
`process.env["OPENRIG_TARGET_REPO"]`. `rig whoami` forwards the caller's
`OPENRIG_TARGET_REPO` as `?targetRepo=`, which the route passes on as
`targetRepoOverride`.
> Source: `domain/whoami-service.ts:319-324` (`getRigWorkspace` +
> `resolveWorkspaceContext`, env fallback L323); `whoami` returns
> `workspace` in its payload `:335` @HEAD.
> Source: `domain/whoami-service.ts:333–338` (`getRigWorkspace` +
> `resolveWorkspaceContext`, env fallback `:337`); `whoami` returns
> `workspace` in its payload `:350`; `routes/whoami.ts:29`;
> `packages/cli/src/commands/whoami.ts:281–282`.
`resolveNodeWorkspace({ spec, cwd })` (consumed by `node-inventory`) derives a
per-node `NodeWorkspaceInfo` by walking the node's `cwd` up the directory
tree for the **longest-prefix repo path** that contains it; falls back to
`knowledge` when cwd is under `knowledgeRoot`, then to the rig's
`defaultRepo` when cwd doesn't resolve. Containment uses a `path.relative`
boundary check (not a string `startsWith`) so `/foo/bar` does not match
`/foo/bar-other`.
per-node `NodeWorkspaceInfo` by picking the **longest declared repo path that
contains** the node's `cwd`. When no repo contains it, `kind` falls back to
`knowledge` if cwd is under `knowledgeRoot`; `activeRepo` then falls back to
the rig's `defaultRepo` (taking that repo's kind if `kind` is still unset).
Containment uses a `path.relative` boundary check (not a string `startsWith`)
so `/foo/bar` does not match `/foo/bar-other`. Node-inventory reads
`workspace_json` with its own queries rather than through `RigRepository`.
> Source: `domain/workspace/workspace-resolver.ts:57-95`
> (longest-prefix L67-73; knowledge fallback L77-79; default-repo
> fallback L82-88), `isInside` `:97-103`;
> `domain/node-inventory.ts:397` (`workspace: resolveNodeWorkspace(...)`),
> `:434-437` (`NodeWorkspaceInfo`) @HEAD.
> Source: `domain/workspace/workspace-resolver.ts:57–95` (longest match
> `:67–73`; knowledge fallback `:77–79`; default-repo fallback `:82–88`),
> `isInside` `:97–103`; `domain/node-inventory.ts:705`
> (`workspace: resolveNodeWorkspace(...)`), readers `:790–799`
> (`readRigWorkspaceJson`) and `:716–726` (`readAllRigWorkspaceJson`,
> batched); `NodeWorkspaceInfo` `domain/types.ts:795–799`.
### 1.3 Per-item repo scope — migration 039 + queue validation
Migration **039** adds `target_repo TEXT` to `queue_items` plus
`idx_queue_items_target_repo`. It carries the per-item typed repo scope when
an operator passes `--target-repo <name>`; NULL when the qitem is
unambiguous against the rig's `default_repo` or no workspace is declared.
Mission Control views surface the field for cross-rig handoff clarity.
`idx_queue_items_target_repo`. Per the migration's comment it carries the
per-item typed repo scope when an operator passes `--target-repo <name>`; it
is NULL when the item is unambiguous against the rig's `default_repo` or no
workspace is declared, and Mission Control views surface the field for
cross-rig handoff clarity. At M nothing in the daemon's Mission Control code
reads it; the UI shows it as "Target repo" in the queue item viewer's full
detail (`packages/ui/src/components/drawer-viewers/QueueItemViewer.tsx:157`).
> Source: `db/migrations/039_queue_target_repo.ts:16-22`
> (`ALTER TABLE queue_items ADD COLUMN target_repo TEXT` +
> `CREATE INDEX … idx_queue_items_target_repo`); doc-comment
> `:3-14` @HEAD.
> Source: `db/migrations/039_queue_target_repo.ts:16–22`
> (`ALTER TABLE queue_items ADD COLUMN target_repo TEXT` at `:19`;
> `CREATE INDEX … idx_queue_items_target_repo` at `039_queue_target_repo.ts:20`); doc comment
> `:3–15`; CLI flag `packages/cli/src/commands/queue.ts:461`.
The queue route validates `target_repo` at the route layer against the
**source rig's** `RigSpec.workspace.repos[]`: it parses the rig name out of
`source_session` (`<member>@<rig>`), looks up the rig, reads
`getRigWorkspace`, and rejects an unknown repo with `unknown_target_repo` +
the known-repo list. It **fails open** (`{ ok: true }`) when there is no
rigRepo, no parseable rig, the rig is unknown, or no workspace is declared —
validation only bites when a workspace actively declares repos.
`validateTargetRepo` checks an explicit `targetRepo` against the **source
rig's** `RigSpec.workspace.repos[]`: it parses the source session with
`parseSessionName`, looks the rig up by name, reads `getRigWorkspace`, and
rejects an unknown repo with 400 `unknown_target_repo` plus the `knownRepos`
list. It **fails open** (`{ ok: true }`) when there is no rigRepo, the session
is not a canonical `<member>@<rig>` name, the rig is unknown, or no workspace
is declared — validation only bites when a workspace actively declares repos.
> Source: `routes/queue.ts:49-57` (fail-open guards), `:55`
> (`getRigWorkspace`), `:58-66` (`unknown_target_repo` +
> `knownRepos`) @HEAD.
It runs on **3** routes (`grep -c 'validateTargetRepo(c,' packages/daemon/src/routes/queue.ts`):
`POST /create` (through the shared `createInputRefusal` check, which also
requires `destinationSession` and `body`), `POST /:qitemId/handoff` and
`POST /:qitemId/handoff-and-complete`, each before any cross-host forwarding,
because the source rig's workspace lives on the source host.
`createInputRefusal` also runs in the in-process create that finishes a
handoff an earlier self-forward started (a `hostId` equal to this daemon's own
id). A handoff that inherits the source row's `targetRepo` without an override
is not re-validated.
## 2. Workspace HTTP route — frontmatter validator (0.3.0)
`--target-repo` is accepted by `rig queue create`, `handoff` and
`handoff-and-complete`. `rig queue list --target-repo <name>`
(`GET /api/queue/list?targetRepo=`) filters rows by exact `target_repo`
match; the filter is skipped when the column is absent.
`workspaceRoutes()` (mounted `server.ts:491` as `/api/workspace`) exposes a
**single read-only endpoint** at v0:
> Source: `routes/queue.ts:96–123` (fail-open guards `:102`, `:106`, `:109`,
> `:112`; `getRigWorkspace` `:111`; `unknown_target_repo` + `knownRepos`
> `:114–120`); `createInputRefusal` `:128–141` (call `:136`), used by
> `/create` `:490` and the self-forward create `:436`; handoff calls `:679`,
> `:758` in handlers `:650`, `:732` (`/create` handler `:450`); ordering note
> `:482–489`; inherited value `:676–677`, `domain/queue-repository.ts:1691`,
> `:1868`; list filter `routes/queue.ts:906`,
> `domain/queue-repository.ts:3236–3238`, CLI
> `packages/cli/src/commands/queue.ts:1143`; mounted `server.ts:784`.
`POST /api/workspace/validate` — body `{ root, workspaceKind?, recursive?,
requireFrontmatter?, maxFiles? }`; returns a `FrontmatterValidationReport`.
`root` is required (400 `root_required`); an out-of-vocabulary
`workspaceKind` is rejected 400 `invalid_workspace_kind`; validator throws
→ 500 `validate_failed`. **No filesystem mutation.**
## 2. Workspace HTTP route — frontmatter validator and doctor
> Source: `routes/workspace.ts:23-65` (handler; root-required L35-37;
> kind-enum L39-47; 500 L59-62); mounted `server.ts:491` @HEAD.
`workspaceRoutes()` (mounted `server.ts:785` as `/api/workspace`) exposes **2**
endpoints (`grep -c -E 'app\.(get|post)\(' packages/daemon/src/routes/workspace.ts`).
**Neither mutates the filesystem.**
`validateWorkspaceFrontmatter()` walks a root, parses each `.md` file's
YAML frontmatter (delimited `---` on the first line), and emits a structured
gap report — **advisory only, never modifies files**. Gap kinds:
- `POST /api/workspace/validate` — body `{ root, workspaceKind?, recursive?,
requireFrontmatter?, maxFiles? }`; returns a `FrontmatterValidationReport`.
`root` is required (400 `root_required`); an out-of-vocabulary
`workspaceKind` is rejected 400 `invalid_workspace_kind`; validator throws →
500 `validate_failed`.
- `POST /api/workspace/doctor` — runs `runWorkspaceDoctor` against the
daemon's resolved `workspace.root`, or a `workspaceRoot` given in the body,
and returns its report. 503 `settings_unavailable` without a settings
store; 500 `doctor_failed` when it throws. The doctor runs **8** checks in
order (root reachable, missions folder, file allowlist, daemon points at
this workspace, config changed since start, optional slice docs, mission
notes, SDLC convention sections), each `ok`/`warn`/`fail` with a fix hint,
plus a summary count. With a body `workspaceRoot`, missions are checked at
`<workspaceRoot>/missions`. (The orchestrator's own doc comment still says
7.)
> Source: `routes/workspace.ts:16` (no mutation), `:37–74` (validate;
> root-required `:46–48`; kind check `:50–58`; 500 `:72`), `:85–160`
> (doctor; 503 `:87`; missions root from the body `:115–118`;
> `runWorkspaceDoctor` call `:145`; 500 `:158`);
> `domain/workspace/workspace-doctor.ts:643–685` (the 8 checks; comment
> `:636`); mounted `server.ts:785`.
`validateWorkspaceFrontmatter()` walks a root, parses each `.md` file's YAML
frontmatter (delimited `---` on the first line), and emits a structured gap
report — **advisory only, never modifies files**. There are **4** gap kinds
(`sed -n '/^export type FrontmatterGapKind/,/;$/p' packages/daemon/src/domain/workspace/frontmatter-validator.ts | grep -c '^ | '`):
`missing-required-field`, `unrecognized-status-value`, `parse-error`,
`missing-frontmatter`. Per-kind required fields: `user`/`project` →
`["doc"]`; `knowledge`/`lab`/`delivery` → `["doc","status","created","owner"]`.
Valid `status` enum: `active|draft|archived|superseded`. Default behavior
skips files without `---` silently (informal notes) unless
`requireFrontmatter`; recurses by default; skips `node_modules` / `.git` /
`.worktrees` / `dist` / `build`; hard cap `maxFiles` default 10000.
`missing-frontmatter`. Per-kind required fields (checked only when a kind is
given): `user`/`project` → `["doc"]`; `knowledge`/`lab`/`delivery` →
`["doc","status","created","owner"]`. The `status` enum has **4** values
(`grep '^const VALID_STATUS_VALUES' packages/daemon/src/domain/workspace/frontmatter-validator.ts | grep -o '"[a-z]*"' | wc -l`):
`active|draft|archived|superseded`. Default behavior skips files without
`---` silently (informal notes) unless `requireFrontmatter`; recurses by
default; skips `node_modules` / `.git` / `.worktrees` / `dist` / `build`;
hard cap `maxFiles` default 10000.
> Source: `domain/workspace/frontmatter-validator.ts:53` (status enum),
> `:56-62` (per-kind required), `:23-27` (gap kinds), `:90-122` (walk;
> skip-dirs L105-111), `:160-172` (missing-frontmatter behavior),
> `:201-226` (required + status check) @HEAD.
> Source: `domain/workspace/frontmatter-validator.ts:12` (advisory), `:23–27`
> (gap kinds), `:53` (status enum), `:56–62` (per-kind required), `:81–83`
> (defaults), `:90–121` (walk; skip-dirs `:105–111`), `:160–172`
> (missing-frontmatter behavior), `:201–226` (required + status check), `:239`
> (opening delimiter).
CLI surface: `rig workspace validate [root]` — v0 is intentionally narrow
(`validate` only); future versions add typed-kind authoring on the same
walker.
CLI surface: `rig workspace validate [root]` and `rig workspace doctor`.
> Source: `docs/as-built/cli-reference.md:931-941` @HEAD.
> Source: `packages/cli/src/commands/workspace.ts:86` (`validate`), `:146`
> (`doctor`); `docs/as-built/cli-reference.md#workspace`.
## 3. Default project-workspace scaffold
`workspaceScaffoldDirs()` / `workspaceScaffoldFiles()` produce the
repo-ready default workspace (`~/.openrig/workspace/` or `--root`). The same
scaffold is used **idempotently by daemon startup**. It emits exactly two
directories (`missions/`, `exhaust/`) and four files (`SPEC.md`,
`project.yaml`, `workspace.yaml`, `.gitignore`). The catalog points its
single default project at `.`; `project.yaml` owns project intent and mission
discovery and exposes empty `install.context` / `install.skills` selectors.
The ignore file excludes `exhaust/` and local `.openrig/` projection state
while keeping authored project context versionable.
`workspaceScaffoldDirs()` / `workspaceScaffoldFiles()` produce the repo-ready
default workspace (`~/.openrig/workspace/`, the default `workspace.root`, or
`--root`). It emits exactly **2** directories
(`grep '^const WORKSPACE_DIRS' packages/daemon/src/domain/workspace/default-workspace-scaffold.ts | grep -o '"[a-z]*"' | wc -l`):
`missions/`, `exhaust/`; and **4** files
(`sed -n '/^export function workspaceScaffoldFiles/,/^}/p' packages/daemon/src/domain/workspace/default-workspace-scaffold.ts | grep -c 'relPath: "'`):
`SPEC.md`, `project.yaml`, `workspace.yaml`, `.gitignore`. The catalog
(`workspace.yaml`) points its single `default` project at `.`; `project.yaml`
names `SPEC.md` as project intent, roots mission discovery at `missions`, and
exposes empty `install.context` / `install.skills` selectors. The ignore file
excludes `exhaust/` and local `.openrig/` projection state while keeping
authored project context versionable.
The workspace owner is called by the shared instance initializer used by CLI
daemon start and direct daemon first start. The initializer is additive. It
never deletes or overwrites an existing file;
the retained `--force` spelling is a compatibility no-op for overwrite
behavior. CLI and daemon scaffolds are byte-parity pinned. Mission and slice
content is created explicitly through `rig scope`, not seeded by workspace
initialization. Instance context, System World, skill source, runtime state,
and the retired `artifacts/`, `evidence/`, `progress/`, `field-notes/`,
`dogfood-evidence/`, `README.md`, and `STEERING.md` entries are not emitted.
`ensureDefaultWorkspace()` applies the scaffold additively: it creates only
missing paths and never deletes or overwrites an existing file. It checks
every managed path first; if one exists with the wrong kind (a file where a
directory belongs, or the reverse) it writes nothing and returns `ok: false`
with the conflicts. Its callers are the shared instance initializer
`ensureOpenRigInstance()`, which both CLI daemon start and direct daemon start
run (so the scaffold is reconciled on every start); `rig config
init-workspace`; and `POST /api/config/init-workspace` (409
`init_workspace_conflict`). The retained `--force` spelling is a
compatibility no-op. The CLI command re-exports the daemon's owner from
`@openrig/daemon/instance-initialization` rather than keeping its own copy,
and a parity test pins the CLI and daemon layouts as byte-identical. Mission
and slice content is created explicitly through `rig scope`, not seeded by
workspace initialization. Instance context, System World, skill source,
runtime state, and the retired `artifacts/`, `evidence/`, `progress/`,
`field-notes/`, `dogfood-evidence/`, `README.md`, and `STEERING.md` entries
are not emitted.
> Source: `domain/workspace/default-workspace-scaffold.ts`
> (`workspaceScaffoldDirs`, `workspaceScaffoldFiles`); CLI
> `domain/instance-initialization.ts`; daemon `index.ts`; CLI
> `packages/cli/src/daemon-lifecycle.ts` and
> `packages/cli/src/commands/config-init-workspace.ts` (`runInitWorkspace`);
> parity: `packages/daemon/test/getting-started-narrative-parity.test.ts`
> @HEAD.
> Source: `domain/workspace/default-workspace-scaffold.ts:7` (dirs),
> `:20–30` (`project.yaml`), `:32–36` (`workspace.yaml`), `:38–41`
> (`.gitignore`), `:43–54` (`workspaceScaffoldDirs`,
> `workspaceScaffoldFiles`), `:100–153` (`ensureDefaultWorkspace`; conflicts
> checked before writes `:117–135`; write-if-missing `:140`);
> `domain/instance-initialization.ts:39` (`ensureOpenRigInstance`; default
> workspace root `:44`; dry-run plan `:83`; apply `:103`); default
> `workspace.root` `domain/user-settings/settings-store.ts:28–31`; daemon
> `index.ts:250`; CLI `packages/cli/src/daemon-lifecycle.ts:658`;
> `packages/cli/src/commands/config-init-workspace.ts:10` (import), `:13`
> (re-export), `:28` (`--force`), `:56–67` (`runInitWorkspace`);
> `routes/config.ts:56–65`, mounted `server.ts:772`; `rig scope`
> `packages/cli/src/commands/scope.ts:2071`; parity
> `packages/daemon/test/getting-started-narrative-parity.test.ts:15–25`,
> retired entries `:43–57`.
### 3.1 The workspace catalog and project selection
`workspace.yaml` at `workspace.catalog_path` (default
`<workspace.root>/workspace.yaml`) lists `projects[]`, each with a string `id`,
a `root` relative to the catalog file, and an optional `rigs` list naming the
rigs that work in that project. With one entry, that project is selected
implicitly. With several, `rig context work-install` and the daemon's
operating posture use an explicit `--project` first, then the calling rig's
`rigs` association, then the unique deepest project root that contains the
working directory, then the only entry no rig claims; otherwise they stop with
`project_required` and the candidate ids. Duplicate ids are refused
(`project_identity_ambiguous`), and a root that does not exist gives
`project_root_missing`.
Installing a bundle that carries a project places it at
`<workspace.projects_root>/<id>/` (default `<workspace.root>/projects`) and
records it in the catalog before the rig's seats launch: a new entry is
appended as text, or the rig is added to an entry's `rigs` list. Existing
catalog bytes are never rewritten; a conflict writes nothing for that part and
reports the exact line to add.
Daemon reads accept `?project=<id>`, resolved by `selectedProject()`: the id
must be in the catalog (or be the single uncatalogued workspace project, whose
id comes from its `project.yaml` or defaults to `workspace`), the project's
`project.yaml` `missions.root` must stay inside the project, and a supplied
`?projectRoot` must still match. Every failure answers 409 with its code.
`GET /api/scopes/projects` lists the projects with their missions roots.
> Source: `domain/workspace/project-catalog.ts:16–25` (`readProjectCatalog`),
> `:26–37` (`selectCatalogProject`), `:66–79` (`inferCatalogProject`, steps
> 3–5); `domain/user-settings/settings-store.ts:489–490`
> (`workspace.projects_root`, `workspace.catalog_path`);
> `domain/workspace/project-registration.ts:6–29` (rules), `:36–37`
> (projects root), `:181` (`registerBundleProject`), called from
> `domain/bundle-content-routing.ts:184`; `domain/workspace/project-read.ts:44–60`
> (`projectEntry`), `:61–69` (`listProjects`), `:70–81` (`selectedProject`),
> `:83–84` (409); `routes/scopes.ts:34`, mounted `server.ts:820`.
## 4. File-backed missions / slices tree
### 4.1 SliceIndexer (Slice Story View v0) — 0.3.0
### 4.1 SliceIndexer — 0.3.0
`SliceIndexer` reads slice folders from a configured filesystem root. The
**default workspace contract** is
`workspace/missions/<mission>/slices/<slice>`; explicitly configured flat
roots (`workspace/slices/<slice>`) remain supported for compatibility.
`SliceIndexer` reads slice folders from configured filesystem roots. The
**default workspace contract** is `workspace/missions/<mission>/slices/<slice>`;
flat roots (`workspace/slices/<slice>`) remain supported for compatibility.
A nested `slices/` child folder makes the parent a mission
(`missionId = <mission-folder>`); a bare folder is a flat slice
(`missionId = null`). NO new SQLite migration, NO new event type: read-only
projection over existing tables (`queue_items`, `queue_transitions`,
`mission_control_actions`) + dogfood-evidence directories. Time-bounded
listing + detail caches (`invalidate()` drops both). `isReady()` is true
when any configured slice root exists on disk.
(`missionId = null`). Startup builds the indexer on `workspace.slices_root`
(default `<workspace.root>/missions`) and adds `<workspace.root>/missions` and
`<workspace.root>/slices` as extra roots. NO new SQLite migration, NO new event
type: read-only projection over existing tables (`queue_items`,
`queue_transitions`, `mission_control_actions`) + dogfood-evidence
directories. Listing, detail and mission-status caches are time-bounded (60 s
default); `invalidate()` drops all three plus the queue-membership index.
Besides the TTL, every unscoped list or detail read first compares a basis
built from each mission's `mission.yaml` text and `slices/` listing and drops
the caches when it changes. When the indexer is ready, startup also watches the
workspace and invalidates the indexer when proof sources change, emitting
`proof.sources_changed`.
`isReady()` is true when any configured slice root exists on disk. A set
`OPENRIG_SLICES_ROOT` still takes precedence over `workspace.slices_root`.
> Source: `domain/slices/slice-indexer.ts:1-14` (contract + no-new-state),
> `:174-176` (`isReady`), `:179-182` (`invalidate`), `:212-256`
> (`readSliceLocations`; nested-vs-flat L233-253), `:62-89`
> (`SliceListEntry` shape: `missionId` / `slicePath` / `qitemIds` /
> `proofPacket`) @HEAD.
Slices are keyed by folder name alone: when two missions (or two roots) hold a
slice with the same name, only the first one walked is indexed, and
`/api/slices/:name` and `/project/slice/$sliceId` address it by that bare
name. The project-scoped read (`?project=…&mission=…`, §4.3) is the one path
that selects by mission. A slice's `qitemIds` come first from rows tagged
`slice:<id>`, then from the legacy match on the rail item or slice name; in a
project-scoped indexer only rows tagged `project:<id>` count, so untagged
historical rows are not attributed to a selected project.
### 4.2 SliceDetailProjector (Slice Story View v0 + v1) — 0.3.0
> Source: `domain/slices/slice-indexer.ts:2–15` (contract + no new state),
> `:238` (TTL), `:297–299` (`isReady`), `:331–336` (`invalidate`),
> `:457–472` (`reconcileComposition`), `:476–521` (`readSliceLocations`;
> first name wins `:478–483`; nested-vs-flat `:495–517`), `:61–88`
> (`SliceRecord`: `missionId` `:65`, `slicePath` `:67`, `qitemIds` `:77`,
> `proofPacket` `:81`), `:90–111` (`SliceListEntry`, which carries
> `qitemCount` / `hasProofPacket` instead), `:865–875` and `:936–946` (queue
> membership; project filter `:870`, `:942`); `domain/workspace/project-catalog.ts:132–138`
> (`belongsToProject`); startup `startup.ts:1705`, `:1718` (`OPENRIG_SLICES_ROOT`
> first), `:1725–1730`, `:1743–1748`, proof-source watch `:1762–1765`
> (`domain/proof/source-watch.ts:16`); default
> `domain/user-settings/settings-store.ts:486`.
### 4.2 SliceDetailProjector — 0.3.0
Given a `SliceRecord`, the projector assembles the full per-slice payload
across six tabs (Story, Acceptance, Decisions, Docs, Tests/Verification,
Topology). Read-only; composes already-shipped tables +
Topology) — **6** tab keys in `SliceDetailPayload`
(`sed -n '/^export interface SliceDetailPayload/,/^}/p' packages/daemon/src/domain/slices/slice-detail-projector.ts | grep -c -E '^ (story|acceptance|decisions|docs|tests|topology):'`),
plus a `readiness` field. Read-only; composes already-shipped tables +
`workflow_specs`/`workflow_instances`/`workflow_step_trails` + slice docs on
disk + dogfood-evidence. **v1 removed the v0 hardcoded legacy phase enum**
disk + dogfood-evidence. **v1 removed the v0 hardcoded legacy phase taxonomy**
(`discovery`/`product-lab`/`delivery`/…): `StoryEvent.phase` is now an
open-ended string-or-null — the spec-defined `step.id` when bound to a
`workflow_instance`, else `null` (UI groups under "Untagged"). When no
workflow runtime is constructed the projector silently degrades to v0
behavior (`workflowBinding=null`, `specGraph=null`).
behavior (`workflowBinding`, `specGraph`, `phaseDefinitions` and
`currentStep` all `null`).
> Source: `domain/slices/slice-detail-projector.ts:1-21` (six-tab
> contract + v1 enrichment), `:18-21` (v0 phase enum REMOVED at v1);
> startup degrade-path `startup.ts:1063-1076` (projector built with
> `workflowRuntime?.specCache`; comment L1064-1071) @HEAD.
> Source: `domain/slices/slice-detail-projector.ts:1–20` (six-tab contract +
> v1 enrichment), `:16–20` (v0 phase taxonomy removed), `:64`
> (`StoryEvent.phase`), `:177–203` (`SliceDetailPayload`), `:205–213`
> (optional `workflowSpecCache`); startup degrade path
> `startup.ts:1749–1760` (comment `:1749–1755`;
> `workflowSpecCache: workflowRuntime?.specCache` `:1759`).
### 4.3 Slices routes — 0.3.0
`slicesRoutes()` (mounted `server.ts:501` as `/api/slices`):
`GET /` (filter `all|active|done|blocked`, default `all`; `?refresh=1`
invalidates; optional `?boundToWorkflow=<name>:<version>` lens narrows to
slices bound to a workflow instance), `POST /refresh` (drops both indexer
caches — no daemon restart), `GET /:name/proof-asset/*` (path-traversal
guarded; immutable 1-day cache), `GET /:name/doc/*` (markdown for the Docs
tab; traversal guarded), `GET /:name` (full per-tab payload). 503
`slices_indexer_unavailable` when unwired; 503 `slices_root_not_configured`
+ setup hint when not ready. **Route-order discipline:** literal `/` /
`/refresh` / `/:name/proof-asset/*` / `/:name/doc/*` are registered BEFORE
the dynamic `/:name` so they are not shadowed.
`slicesRoutes()` (mounted `server.ts:803` as `/api/slices`) registers **5**
handlers (`grep -c -E 'app\.(get|post)\(' packages/daemon/src/routes/slices.ts`):
> Source: `routes/slices.ts:31-177` (handlers; route-order L34-35,
> L101-102, L109-113, L166-167; 503s L38-44; `boundToWorkflow`
> L60-86); mounted `server.ts:501` @HEAD.
- `GET /` — filter `all|active|done|blocked` (default `all`; anything else is
400 `filter_invalid`); `?refresh=1` (or `true`) invalidates first; optional
`?boundToWorkflow=<name>:<version>` lens narrows to slices bound to a
workflow instance (400 `boundToWorkflow_invalid` without the colon). Each
slice row carries `readiness`, and a `missions` sidecar carries authored
mission status and readiness. Rows sort by last activity, newest first.
- `POST /refresh` — drops the indexer caches, no daemon restart.
- `GET /:name/proof-asset/*` — serves a proof asset from the slice's matched
dogfood-evidence directory; rejects `..` (400); `Cache-Control: public,
max-age=86400`; byte ranges (206 / 416).
- `GET /:name/doc/*` — markdown for the Docs tab; rejects `..`.
- `GET /:name` — full per-tab payload. With `?project=<id>` it also requires
`?mission=<id>` (400 `exact_mission_and_slice_required`) and reads through
an indexer scoped to that project's missions root.
### 4.4 Missions route — **0.3.1** (slice 12 + slice 13 + slice 18)
503 `slices_indexer_unavailable` when unwired; on `GET /`, 503
`slices_root_not_configured` + setup hint when not ready. **Route-order
discipline:** literal `/` / `/refresh` / `/:name/proof-asset/*` /
`/:name/doc/*` are registered BEFORE the dynamic `/:name` so they are not
shadowed.
`missionsRoutes()` (mounted `server.ts:505` as `/api/missions`) is the
mission scope data layer. `GET /:missionId` returns
`{ missionId, missionPath, slices, workflow_spec, topology, status }` —
slices filtered from the SliceIndexer by `missionId`; `missionPath` derived
by going up two levels from any slice's `slicePath`; `workflow_spec` parsed
lazily from `<missionPath>/README.md` frontmatter (same `parseWorkflowSpecRef`
helper the slice-indexer uses); `topology.specGraph` projected via
`projectSpecGraph(spec, null)` when the spec is cached, `{ specGraph: null }`
when declared-but-not-cached, `null` when nothing declared; `status` read
from README frontmatter. `POST /:missionId/complete` writes
`status: complete` to the mission README frontmatter (idempotent; preserves
unrelated fields) — the daemon is the audit-trail surface, the UI keeps an
optimistic localStorage mirror. 404 `mission_not_found` when no slices match.
> Source: `routes/slices.ts:33–198` (handlers; route-order comments
> `:36–37`, `:118`, `:126–127`, `:175`; 503s `:40–46`; filters `:31`,
> `:47–53`; refresh `:54–57`; `boundToWorkflow` `:67–93`; readiness +
> `missions` sidecar `:99–110`; `/refresh` `:119–124`; proof asset
> `:131–154`, cache header `:235`, ranges `:237–266`; doc `:158–173`;
> project scope `:180–190`); mounted `server.ts:803`.
> Source: `routes/missions.ts:39-118` (handlers), `:124-142`
> (`writeMissionStatusComplete`), `:148-150` (`computeMissionPath`
> up-two-levels), `:171-177` (`readMissionWorkflowSpec`), `:205-215`
> (`computeMissionTopology`); mounted `server.ts:505`; §0 proof:
> `routes/missions.ts` ABSENT@v0.3.0 ⇒ **0.3.1** @HEAD.
### 4.4 Missions route — 0.3.1
### 4.5 Projects route — Coordination L2 classifier (PL-004 Phase B) — 0.3.0
`missionsRoutes()` (mounted `server.ts:814` as `/api/missions`) is the
mission scope data layer, with **2** handlers
(`grep -c -E 'app\.(get|post)\(' packages/daemon/src/routes/missions.ts`).
`projectsRoutes()` (mounted `server.ts:492` as `/api/projects`) backs the
`rig project` CLI verb — this is the **PL-004 Phase B project *classifier***
(lease lifecycle + idempotent classify + operator-verb reclaim + SSE), NOT
the Project *workspace UI* (that is the slices/missions surface above; the
naming overlap is a documented seam). Endpoints: `POST /lease/acquire`
(optional `evaluateDeadnessFirst` clears stale/dead leases first),
`POST /lease/heartbeat`, `POST /reclaim-classifier`, `POST /project`
(idempotent on `stream_item_id`), `GET /lease`, `GET /list`,
`GET /sse` + `GET /watch` (SSE), `GET /:projectId`. **Route-order
discipline:** literal `/lease`, `/list`, `/sse`, `/watch` are registered
BEFORE the bare `/:projectId` catchall (Phase A R1 SSE lesson).
`GET /:missionId` returns
`{ missionId, missionPath, readiness, slices, workflow_spec, topology, status }`:
> Source: `routes/projects.ts:18-194` (handlers; route-order note
> L15-17, L140-141, L158-159, L185); error-code → HTTP mapping
> `:31-52`; mounted `server.ts:492` @HEAD.
- `slices` — filtered from the SliceIndexer by `missionId`, each with its
`readiness`;
- `missionPath` — two levels up from any slice's `slicePath`;
- `workflow_spec` — parsed from the frontmatter of the mission's node file
(`SPEC.md`, else legacy `README.md`) with the same `parseWorkflowSpecRef`
helper the slice-indexer exports;
- `topology.specGraph` — projected via `projectSpecGraph(spec, null)` when the
spec is cached; `{ specGraph: null }` when declared but not cached (or no
cache is wired); `null` when nothing is declared;
- `readiness` — the mission's proof readiness;
- `status` — `metadata.status` from `mission.yaml` when present, else the
node file's `status` frontmatter.
## 5. UI route-reality (§10.7 — source-verified at routes.tsx@HEAD)
`POST /:missionId/complete` sets the mission status to `complete`:
`metadata.status` in `mission.yaml` when the manifest exists (other fields and
comments kept), otherwise the `status` line in the node file's frontmatter
(creating `SPEC.md` when the mission has no node file). It is idempotent.
After a successful write it drops the indexer's mission-status cache so the
next `/api/slices` read sees the new status. The daemon is the audit-trail surface; the UI keeps an
optimistic localStorage mirror. 404 `mission_not_found` when no slices match;
500 `mission_complete_write_failed` on a write error.
`packages/ui/src/routes.tsx` is **542 lines** and uses TanStack Router
(`createRoute({ path, component })` objects), NOT JSX `<Route>`. The
Phase-8.1 survey's grep-derived missions/projects expectations are
corrected here against routes.tsx reality:
> Source: `routes/missions.ts:45–88` (GET; 503s `:46–64`; 404 `:68–70`;
> readiness + status `:77–78`; response `:79–87`), `:95–125` (complete; 500
> `:110–117`; cache drop `:123`), `:132–163` (`writeMissionStatusComplete`;
> manifest `:133–141`; node file `:145–162`), `:169–171`
> (`computeMissionPath` up two levels), `:179–186` (`readMissionStatus`),
> `:192–198` (`readMissionWorkflowSpec`), `:226–236`
> (`computeMissionTopology`); node-file precedence
> `domain/scope/node-file.ts:17`; readiness
> `domain/proof/judgments.ts:288–295`; UI mirror
> `packages/ui/src/hooks/useCompletedMissions.ts:15`; mounted `server.ts:814`;
> §0: `routes/missions.ts` absent at `v0.3.0` ⇒ **0.3.1**.
| Survey expectation | routes.tsx@HEAD reality | routes.tsx:NN |
### 4.5 Projects route — stream classifier — 0.3.0
`projectsRoutes()` (mounted `server.ts:786` as `/api/projects`) backs the
`rig project` CLI verb — the **stream-item classifier** (lease lifecycle +
idempotent classify + operator-verb reclaim + attempt ledger + SSE), NOT the
Project *workspace UI* (that is the slices/missions surface above; the naming
overlap is a documented seam). Endpoints:
- `GET /worker-sources` — requires `?project=<id>`, a workspace catalog
project;
- `GET /shadow`, `POST /shadow/drain`, `POST /shadow/stop` (the last two take
an optional body `{ actor }`);
- `POST /lease/acquire` (optional `evaluateDeadnessFirst` clears stale/dead
leases first), `POST /lease/heartbeat`, `POST /reclaim-classifier`;
- `POST /project` (idempotent on `stream_item_id`);
- `POST /attempts/begin`, `POST /attempts/:attemptId/abstain`,
`POST /attempts/:attemptId/fail`, `GET /eligible`;
- `GET /lease`, `GET /list`, `GET /sse` + `GET /watch` (SSE);
- `GET /:projectId`.
**Route-order discipline:** every literal path is registered BEFORE the bare
`/:projectId` catchall, which comes last.
> Source: `routes/projects.ts:27–375` (handlers; route-order notes `:25`,
> `:240`, `:309`, `:322`, `:339–340`, `:366`); worker sources `:98–109`;
> shadow `:111–127`; lease / reclaim / project `:129–237`
> (`evaluateDeadnessFirst` `:142–144`); attempts and eligible `:239–306`;
> lease and list `:308–336`; SSE `:338–364`; `/:projectId` `:366–372`;
> error-code → HTTP mapping `:58–95`; CLI
> `packages/cli/src/commands/project.ts:46`; mounted `server.ts:786`.
## 5. UI route reality — source-verified at routes.tsx
`packages/ui/src/routes.tsx` is **605** lines (`wc -l < packages/ui/src/routes.tsx`)
and uses TanStack Router (`createRoute({ path, component })` objects), NOT JSX
`<Route>` (**0** matches: `grep -c '<Route' packages/ui/src/routes.tsx`). The
mission / project / slice destinations as they exist:
| Path | routes.tsx reality | routes.tsx:NN |
|---|---|---|
| `/project` (workspace) | **REAL route** — `WorkspaceScopePage` | `:128-131` |
| `/project/mission/$missionId` | **REAL route** — `MissionScopePage` | `:134-137` |
| `/project/slice/$sliceId` | **REAL route** — `SliceScopePage` | `:140-143` |
| `/files` | **REAL route** — `FilesWorkspace` (see content-surfaces.md) | `:192-195` |
| `/mission-control` | **`<Navigate to="/for-you" />`** redirect-stub (DELETED per SC-18; the Mission Control *system* lives at daemon/PL-005, not a UI destination) | `:440-444` |
| `/slices` | **`<Navigate to="/project" />`** redirect-stub (DELETED per project-tree.md) | `:447-451` |
| `/slices/$name` | **`<Navigate to="/project/slice/$sliceId" />`** redirect-stub | `:453-460` |
| `/progress` | **`<Navigate to="/project" />`** redirect-stub (folds into Project tabs, Phase 3) | `:464-468` |
| `/steering` | **`<Navigate to="/project" />`** redirect-stub (folds into Project workspace overview tab, Phase 3) | `:470-474` |
| `/missions` (top-level) | **NO route** — missions are reached only via `/project/mission/$missionId` | (absent) |
| `/markdown` | **NO route** — markdown is a component in file/drawer surfaces, not a destination (see content-surfaces.md §4) | (absent) |
| `/project` (workspace) | **REAL route** — `WorkspaceScopePage` | `:136–140` |
| `/project/mission/$missionId` | **REAL route** — `MissionScopePage` | `:142–146` |
| `/project/slice/$sliceId` | **REAL route** — `SliceScopePage` | `:148–152` |
| `/files` | **REAL route** — `FilesWorkspace` (see content-surfaces.md) | `:248–252` |
| `/mission-control` | **`<Navigate to="/for-you" />`** redirect-stub (the Mission Control *system* lives in the daemon at `/api/mission-control`, not as a UI destination) | `:496–500` |
| `/slices` | **`<Navigate to="/project" />`** redirect-stub | `:503–507` |
| `/slices/$name` | **`<Navigate to="/project/slice/$sliceId" />`** redirect-stub | `:509–516` |
| `/progress` | **`<Navigate to="/project" />`** redirect-stub (folds into Project tabs) | `:519–523` |
| `/steering` | **`<Navigate to="/project" />`** redirect-stub (folds into the Project workspace overview tab) | `:526–530` |
| `/missions` (top-level) | **NO route** — missions are reached only via `/project/mission/$missionId` | absent: **0** (`grep -c 'path: "/missions"' packages/ui/src/routes.tsx`) |
| `/markdown` | **NO route** — markdown is a component in file/drawer surfaces, not a destination (see content-surfaces.md) | absent: **0** (`grep -c 'path: "/markdown"' packages/ui/src/routes.tsx`) |
> Source: `packages/ui/src/routes.tsx:90-195` (real routes),
> `:435-474` (redirect-stub block; each `<Navigate>` + DELETED/folds
> comment), `:476-490` (route tree) @HEAD. Grep-confirmed absent:
> no `path: "/missions"` / `path: "/markdown"` declaration anywhere
> in routes.tsx @HEAD.
> Source: `packages/ui/src/routes.tsx:136–152` (project routes), `:248–252`
> (`/files`), `:484–530` (redirect block, which also redirects `/context` to
> `/topology`), `:539–597` (route tree); `/api/mission-control` mounted
> `packages/daemon/src/server.ts:790–793`.
Net §10.7 ruling: the daemon `/api/missions` + `/api/slices` +
`/api/projects` routes are real and load-bearing; the **operator-facing UI**
consumes them through `/project*` destinations only. `/mission-control`,
`/slices`, `/progress`, `/steering` are redirect-stubs (the systems exist at
the daemon layer, the URLs were collapsed into `/project` / `/for-you`).
Net: the daemon `/api/missions` + `/api/slices` + `/api/projects` routes are
real. The **operator-facing UI** consumes the missions and slices routes
through the `/project*` destinations; it does not call `/api/projects`
(**0** files: `git grep -l '/api/projects' -- packages/ui/src | wc -l`).
`/mission-control`, `/slices`, `/progress`, `/steering` are redirect-stubs
(the systems exist at the daemon layer; the URLs were collapsed into
`/project` / `/for-you`).
> Source: `packages/ui/src/hooks/useMission.ts:51` (`/api/missions`),
> `packages/ui/src/hooks/useSlices.ts:84` (`/api/slices`).
## 6. Cross-cutting properties
- **Optional + valid-without:** rigs without a `workspace` block stay valid;
whoami / node-inventory / queue-target-repo all return null / fail-open
(`workspace-resolver.ts:32`; `rig-repository.ts:99,107`;
`routes/queue.ts:55`) @HEAD.
- **Defensive column probes:** every `workspace_json` / `target_repo` access
guards on column presence so partial test fixtures don't crash
(`rig-repository.ts:99,107`; migrations 038/039 ship separately so a
fixture can apply only the half it needs — `038.ts:11-14`) @HEAD.
whoami / node-inventory return null and queue target-repo validation fails
open (`workspace-resolver.ts:32`, `:62`; `rig-repository.ts:185`, `:193`;
`routes/queue.ts:112`).
- **Defensive column access:** `RigRepository` probes for `workspace_json`
(`rig-repository.ts:185`, `:193`), node-inventory's own reads fall back to
null on error (`node-inventory.ts:724`, `:796–798`), and the queue
repository detects `target_repo` (`queue-repository.ts:758`), so partial
test fixtures don't crash. Migrations 038/039 ship separately so a fixture
can apply only the half it needs (`038_workspace_primitive.ts:12–14`).
- **Read-only projection, no new state for the tree:** SliceIndexer /
SliceDetailProjector add NO migration / event type; only the workspace
declaration (038) + per-item scope (039) touch SQLite
(`slice-indexer.ts:12-14`) @HEAD.
- **Advisory, never mutates:** the frontmatter validator and the
init-workspace scaffold never delete operator content
(`frontmatter-validator.ts:12-13`; `config-init-workspace.ts:12-16`) @HEAD.
(`slice-indexer.ts:14–15`).
- **Advisory, never deletes:** the frontmatter validator never modifies files
(`frontmatter-validator.ts:12`), and the workspace scaffold never deletes or
overwrites operator content (`default-workspace-scaffold.ts:140`;
`packages/cli/src/commands/config-init-workspace.ts:18`).
## OPEN items (carried, not smoothed)
## Open items
- **OPEN-A** — `resolveWorkspaceContext` honors an `envOverride`
**verbatim even when it names no declared repo** (`workspace-resolver.ts:34-43`,
by explicit PL-007 PRD § Item 3 design), whereas the queue route
**rejects** an unknown `target_repo` against the same `repos[]`
(`routes/queue.ts:58-66`). These two surfaces apply opposite policies to
an unknown repo name (whoami trusts the operator; queue validates). Stated
as-is — the asymmetry is source-real and intentional per the cited
comments, but the divergence is not reconciled in source.
- **OPEN-B** — the `/api/projects` *classifier* (PL-004 Phase B) and the
`/project*` *workspace UI* (slices/missions) share the word "project" but
are unrelated subsystems. Documented as a naming seam; no source defect.
- No slice-00 numeric-drift OPEN (1–5) applies — this module carries no
migration-count / route-group / PL-004-event-count claim (those land in
daemon-core / coordination-primitive / architecture-rules).
- `resolveWorkspaceContext` honors an `envOverride` **verbatim even when it
names no declared repo** (`workspace-resolver.ts:39–40`), whereas the queue
route **rejects** an unknown `target_repo` against the same `repos[]`
(`routes/queue.ts:114–120`). These two surfaces apply opposite policies to
an unknown repo name (whoami trusts the operator; queue validates). The
resolver's comment at `workspace-resolver.ts:35–36` states the verbatim behavior is intended, but
the comment line before it (`workspace-resolver.ts:34`) and `whoami-service.ts:331–332` describe
a repo-name check that the code does not perform. Stated as-is; the
divergence is not reconciled in source.
- The `/api/projects` *classifier* and the `/project*` *workspace UI*
(slices/missions) share the word "project" but are different subsystems.
Both accept a workspace catalog project as `?project=<id>`
(`routes/projects.ts:105`; `routes/slices.ts:181`). Documented as a naming
seam; no source defect.
+114
View File
@@ -0,0 +1,114 @@
---
kind: as-built
title: Arteries — where a small change has a large effect
status: active
applies-when: |
You are about to change, or review a change to, an area that many other paths depend on:
message delivery, launch and resume, the queue, rig identity, skill projection, native
process observation, migrations, or restore. Read this to see what depends on the area and
what broke there before, then go and read the code.
siblings: [README.md, test-layers.md]
prerequisite-reads: [../../ARCHITECTURE.md]
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Arteries: where a small change has a large effect
## Read this first: this map is not the territory
- **This page is a zoomed-out view, not a description of OpenRig.** It names a few areas where
small changes caused large regressions before. OpenRig is much larger than this page. Code,
behaviour and risk that are not listed here exist, and some of it is riskier than anything below.
- **It is incomplete by construction.** A pull request is not safe because its files are missing
from this list.
- **It may be stale.** It was checked against commit `e8f0ab34`. Files and dependencies move. If
this page and the code disagree, the code is right; fix the page.
- **Use it to change altitude, then go to the ground:** read the code, run the commands, check the
behaviour. When you are lost, go and look rather than leaning on this page.
## The arteries
Paths are relative to `packages/`. The key files are entry points, not the full extent of each
area.
| Artery | Key files | What depends on it | Past regressions and lessons |
|---|---|---|---|
| **Message delivery to seats** | `daemon/src/domain/session-transport.ts`, `daemon/src/domain/seat-delivery-guard.ts`, `daemon/src/adapters/tmux.ts` | Every `rig send`, queue wake, nudge, watchdog wake and handoff | #150 (the fix for #142) stopped typing into a bare shell. It then refused managed Codex seats (fixed by #171 before release) and every Claude seat launched with an explicit permission mode, which shipped in 0.6.2 as #197 (fixed by #220). The delivery guard's rule that a name must resolve to exactly one target, added in #109 (0.6.0), was involved in #141 (fixed by #151), the delivery half of #174 (fixed by #181) and #188 (fixed by #189). Since #310/#327, a Claude seat whose runtime can't be observed still receives ordinary messages with a warning; only a plain idle shell or the wrong recipient is refused. |
| **Launch, relaunch, resume** | `daemon/src/adapters/claude-code-adapter.ts`, `daemon/src/domain/claude-managed-launch.ts`, `daemon/src/adapters/codex-runtime-adapter.ts`, `daemon/src/domain/codex-daemon-support.ts`, `daemon/src/adapters/pi-runtime-adapter.ts`, `daemon/src/domain/seat-launch-environment.ts`, `daemon/src/domain/native-resume-probe.ts`, `daemon/src/domain/startup-orchestrator.ts` | Every seat start, restore and permission mode, plus the non-interruptive, `permission_policy`, effort, kernel operational-authority and team permission-default settings that each launch and resume command carries | Always setting `CLAUDE_CONFIG_DIR` gave explicit-mode Claude seats a blank config (#154). #225 fixed which config home is selected, and #565 writes the onboarding and trust bootstrap into that home. Codex seats launch with `--no-daemon` only when `codex --help` shows support (#69, #77); when support is unknown, OpenRig refuses to launch, so a failing or slow `codex --help` blocks the seat. The readiness window defaults to 30 seconds and can time out under load (#182); since #643 it is configurable as `runtime.readiness_timeout_seconds` (env `OPENRIG_RUNTIME_READINESS_TIMEOUT_SECONDS`, 1–600). A git worktree's `.git` file broke the Codex sandbox (#121; see #126). #618 moved non-managed Claude, Codex and Pi launches behind the seat launch environment, and #628, #638 and #666 followed within days. Pi launch and resume carry `--thinking` from the seat's resolved effort (OMP does not). |
| **Queue claim, pickup, wakes** | `daemon/src/domain/queue-repository.ts`, `daemon/src/domain/queue-pickup.ts`, `daemon/src/domain/queue-wake-ladder.ts`, `daemon/src/routes/require-sender-identity.ts`, `cli/src/client.ts` | All durable work between seats | After a slow `/healthz`, the CLI host-qualified a local sender and claims failed (#131, fixed by #135). Done-and-closed items read as stalled forever (#164, fixed by #176). |
| **Rig identity: same names, archived and deleted rigs** | `daemon/src/domain/rig-repository.ts`, `daemon/src/domain/rig-lifecycle-service.ts`, `daemon/src/domain/rig-teardown.ts`, `daemon/src/domain/seat-handover-service.ts`, `daemon/src/domain/running-name-guard.ts` | Seat resolution, `rig remove`, restore, importing a rig from YAML | Archived rigs still matched seat references, and `rig remove` killed another rig's live seat with the same name (#174, fixed by #181). Replacing stopped same-name rig generations on YAML import followed in #196. |
| **Projection of skills and files** | `daemon/src/domain/rigspec-instantiator.ts`, `daemon/src/domain/projection-planner.ts`, and each runtime adapter's `project()` (Claude Code, Codex, Pi, OMP, stub) | What every agent is given at start | Codex seats skipped skills that a Claude sibling had already projected (#159, fixed by #162). File-shaped entries failed with ENOTDIR (fixed by #185). |
| **Native process observation** | `daemon/src/domain/native-process-lineage.ts` (parses `ps -Ao pid,ppid,pgid,tpgid,ucomm,lstart,command`) | Liveness, identity verdicts, delivery checks | Processes whose command name contains a space were dropped (#134, fixed by #82). Non-English locales broke the date parsing (fixed by #239, which runs `ps` with `LC_ALL=C`). #220 also changed this file to recognise managed Claude seats behind launch wrappers. Claude identity proof (wrappers, launcher shims, conversation rotation, effort, version-named binaries, launch `--settings`) changed ten more times after 0.6.3. |
| **Schema and migrations** | `daemon/src/db/migrations/`, `daemon/src/db/all-migrations.ts`, `daemon/src/db/migrate.ts` | Every install, and every upgrade of a long-lived install | Parallel pull requests pick the same next number: #112 adds `086_rig_kernel_variant` while `main` already has `086_classification_fields_and_attempts`, and #155 and #195 landed as 090 and 091. `migrate.ts` applies by migration name in name order, so a duplicate number is not skipped, but its order relative to the other migration changes; 093 is unused at `e8f0ab34`. A long-lived install upgrading across several releases applies many migrations in one start, against real data. |
| **Restore and recovery** | `daemon/src/domain/restore-orchestrator.ts`, `daemon/src/adapters/{claude,codex,pi,omp}-resume.ts`, `daemon/src/domain/reconciler.ts`, `daemon/src/domain/restore-check-service.ts`, `daemon/src/domain/startup-orchestrator.ts`, `daemon/src/adapters/tmux.ts` | Reboots, power loss, daemon restarts | Detached seats kept stale tmux pane ids after a reboot (#141, fixed by #151 in `tmux.ts`). `restore-check` read queue files and Claude hooks from a fixed shared-docs path (#130); #139 made it use the configured root, and #328 replaced the queue-file check with a probe of the daemon's queue store and checks the selected Claude hooks. After a fresh relaunch, a stale Codex restore attention flag never clears (#116). Full-restore recovery of OMP seats is open (#41). |
## How reviews use this page
- **Find where the effect lands.** A reviewer notes which artery a pull request touches, if any,
and what depends on it.
- **At an artery, review the effect, not only the diff.** Whatever the diff size, the reviewer
states the downstream effects and checks behaviour with a scratch reproduction or a test.
- **Away from the arteries,** small pull requests keep a normal review. Scrutiny goes where the
effect is.
## The scenario rule
**A pull request that touches an artery adds or extends a stub-agent scenario, or says in its
description why it cannot.** Reviewers check for one or the other. Scenarios live in
`packages/test-system/scenarios/`; [ARCHITECTURE.md](../../ARCHITECTURE.md#a-scenario) says how to
write and run one, and [test-layers.md](test-layers.md) says what each test layer can and cannot
catch.
The goal is that every artery has at least one scenario whose seeded regression fails, so a small
change to an artery meets a real end-to-end check before it merges, not only a reviewer's reading.
### Scenario coverage today
At commit `e8f0ab34`. For why the stub cannot reach some of these yet, see "What a stub can and
cannot prove" in [test-layers.md](test-layers.md).
- **Queue durability across a daemon restart: covered.** CI runs
`queue-baton-survives-restart.yaml` healthy, then with a seeded `baton-drop` fault that must
fail, then healthy again (#243). It runs `rig queue claim` and checks the destination after the
restart, but pickup, wakes and claim-identity edge cases (such as the #131 sender case) have no
scenario yet.
- **Delivery (the #197 class): not covered.** The stub runtime has no input behaviour, so it cannot
exercise delivery to a managed wrapper; `send-verify-means-rendered.yaml` is not admitted to CI
for that reason (`packages/test-system/ci/README.md`).
- **Addressing and rendered delivery: partial.** CI runs the transcript and capture stub scenarios
in passing form, and the capture scenario catches a seat resolved by member-name prefix.
`send-renders-in-addressed-pane.yaml` and `down-stops-every-seat.yaml` run with the local runner
only. `stub-cli-journeys.integration.test.ts` checks that a verified send lands in the addressed
pane and not its sibling. None of these proves a seat consumed a message.
- **Restore (the #141 class): not covered.** The scenario runner does not bind the `restore` verb
yet; it fails with `UnboundActionError`.
- **Rig identity (the #174 class): not covered.** No library scenario sets up a same-name archived
or removed rig.
- **Projection (the #159 class): not coverable with `runtime: stub`,** which projects skills into its
own `.openrig/stub/skills/` directory. Use adapter-level unit tests.
- **Native process observation: unit tests only** (for example
`packages/daemon/test/codex-process-observation.test.ts`, `native-ps-locale.test.ts` and
`send-runtime-not-running.test.ts`).
- **Migrations: unit guards only** (`migration-fixture-parity.test.ts`,
`startup-migrations-mirror.test.ts`). Every scenario starts from an empty database, so upgrading
an existing database is not covered.
- **Launch:** every scenario's `up` goes through the real `rig up`, instantiation and startup
orchestration with stub seats. The stub adapter types its runner directly; Claude Code, Codex
and Pi seats launch through the seat launch environment (`seat-launch-environment.ts`), which
no scenario reaches. Real Codex launch and handover run only in two opt-in daemon tests
(`OPENRIG_E2E_REAL_CODEX=1`, which needs tmux, `codex` and a Codex login). The CI containers
have no provider CLIs or credentials.
## Regression log
When a regression reaches a release, add one line: date, issue, artery, and which layer missed it
(the layers are named in [test-layers.md](test-layers.md)). Each line should end up as a scenario.
- 2026-09-30, #197 (0.6.2), delivery: review saw a small diff in isolation; CI had no managed
explicit-mode Claude seat; the project's own day-to-day seats use the default launch path.
- 2026-09-29/30, #141, #174, #188 (after 0.6.0), delivery and rig identity: reviews of #109 did not
see the downstream effect of the exactly-one-target rule.
- 2026-10-19, #1483, managed compaction: a helper-only command-composition check did not bind the submitted command to the precompact effect. `managed-compaction-effect.test.ts` now drives the real enforcer command into a version-bound stub input model and checks the shipped precompact marker; its 851-character pasted-command control lacks that effect despite a successful submit receipt. `rig compact` rejects stub runtimes, so this is an adapter/helper check, not an installed CLI or native compaction proof. The model uses the recorded Claude Code 2.1.282 distinction; other versions and actual context compaction remain unverified here.
- 2026-10-19, #484, refocus orientation: script tests supplied basis strings without composing parked typed queue state through `queue whoami` and the hook. `refocus-parked-baton.yaml` plus the active-baton contrast now assert the shipped hook's own emitted context; installed-scenario runs healthy/seeded/healthy; its scratch trace-child fault moves the parked row from held work into the work candidates as current work, and the hook's emitted context must then fail with that row's slice shown as `WORK FROM QUEUE EVIDENCE`. This proves the composed diagnostic effect, not native hook scheduling or an agent reading and acting on it. With the work packet's bounds and per-runtime default, the parked scenario runs with the packet on and asserts the row as held work. `refocus-parked-baton-packet-off.yaml` keeps the labelled fallback as the packet-off control.
File diff suppressed because it is too large. Load diff
+91 -178
View File
@@ -1,197 +1,110 @@
---
kind: as-built
title: OpenRig Codemap — Navigation Index / Map of Territory
title: OpenRig Codemap — Modules and Source Entry Points
status: active
topics: [knowledge-and-context, observability]
domains: [engineering-advisor, operating-advisor]
applies-when: |
You know what you need to learn about the shipped OpenRig system but not
which as-built module holds it. Use the module map, the use-case lookup,
or the source-root table to route to the right doc — or jump straight to
the source root the codemap points at.
siblings: [README.md, cli-reference.md]
You know the behavior you need to inspect but not its owning source files.
Follow the module and source entry points below, then read the implementation.
siblings: [README.md, arteries.md, test-layers.md, cli-reference.md]
prerequisite-reads: [README.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# OpenRig Codemap — Navigation Index
# OpenRig codemap
This is a **map of territory**, not a content dump. It tells you which
as-built module answers a question and which `packages/*/src` root that
module is grounded in. The deep content lives in the modules; the code lives
in the source roots; this file points at both.
The paths and named entry points below were checked at main
`e8f0ab340db773392ec8be75b072d1c0f3068a50`. This is a navigation map, not a replacement for
reading the implementation. Linked documents retain their individual verification stamps.
[README.md](README.md) lists the complete document tree and commands to derive its inventory.
> The old codemap was a 425-line file-by-file `Exports:`/`Related:` flat dump
> that drifted fastest (its own header carried a stale v0.2.0 footprint and an
> internally-contradictory command-group count) and never fit a context
> window. That anti-pattern is retired (slice-08 Q5, founder-ratified). The
> genuinely-useful part — the source-root index — is preserved below as the
> source-root pointer table; the per-file transcription is not.
## Package entry points
## (a) Product frame
Paths in backticks are relative to the repository root.
OpenRig is a local control plane for multi-agent coding topologies — a
multi-agent harness that manages your Claude Code and Codex sessions as a
single system. The daemon (`@openrig/daemon`) is the framework-free
SQLite-backed core; the CLI (`@openrig/cli`), UI (`@openrig/ui`), and MCP
server all sit on top of it.
> Source-verified at HEAD `7eaf524c` (`v0.3.1-6-g7eaf524c`); package version
> **0.3.1**, 6 unreleased 0.3.2 commits on HEAD, no `v0.3.2` tag. Frame
> sentence triangulated against `architecture/daemon-core.md` §1 +
> `openrig-internal/product/positioning.md` ("a multi-agent harness, a local
> control plane that manages your Claude Code and Codex sessions as a single
> system").
## (b) Module map
One row per module. "Reach for this when…" mirrors each module's actual
`applies-when` frontmatter.
### architecture/
| Module | One-sentence summary | Reach for this when… |
|---|---|---|
| `daemon-core.md` | The framework-free SQLite-backed core the CLI/UI/MCP all sit on. | You need to know how the daemon boots, how `createDaemon` wires the dependency graph, the SQLite schema/migration set, or the route-mount surface. |
| `adapters-and-runtimes.md` | The five-method runtime-adapter contract + the resume-honesty layer. | You need the runtime-adapter contract, how OpenRig launches/resumes a Claude Code, Codex, or terminal harness inside tmux, or how the daemon honestly assesses whether a harness actually resumed vs fresh-launched. |
| `coordination-primitive.md` | PL-004 Phase A: the SQLite-canonical durable-work layer (`/api/stream`, `/api/queue`). | You need the stream/queue/inbox/outbox tables, the hot-potato closure contract, the transactional handoff guarantee, or where queue closure is enforced. |
| `workflow-runtime.md` | PL-004 Phase D: turns an intended sequence of work into durable SQLite state. | You need workflow specs cache, instance state, step trails, the transactional-scribe projection contract, or the watchdog policy set including workflow-keepalive. |
| `mission-control.md` | PL-005: the daemon-backed queue-observability surface inside the existing shell. | You need the seven views, the seven write verbs, the action audit table, the bearer-token middleware, or how queue observability maps to PL-004 sources. |
| `agent-spec-and-startup.md` | How authored YAML specs become a resolved, launched, identity-addressable topology. | You need the AgentSpec/RigSpec/pod-aware reboot types, profile resolution + additive startup layering, the StartupOrchestrator delivery split, or how whoami/materialize/bind/adopt resolve identity. |
| `lifecycle-snapshot-restore.md` | The durable-state half of `down → up → handoff`. | You need how OpenRig captures a snapshot, restores a rig (resume vs rebuild vs fresh), enforces restore honesty, consults live continuity, or how restore-check / restore-packet readiness probes work. |
| `transport-and-transcripts.md` | The communication-and-history layer; tmux is transport, not truth. | You need how rig send/capture/broadcast works, pipe-pane transcript capture + search, durable SQLite chat, what `rig ask` gathers, or the MCP-tool-name vs tmux-metadata-key distinction. |
| `workspace-primitive.md` | PL-007: the typed declaration of where a rig's work lives. | You need how a rig declares a typed workspace (root/repos/defaultRepo/knowledgeRoot), how it persists/resolves into whoami / node-inventory, how per-item `target_repo` scope is validated, or how the file-backed missions/slices tree is indexed and projected into Project. |
| `content-surfaces.md` | The operator-allowlisted, filesystem-canonical read/write layer Project/Steering sits on. | You need how the file browser enforces path safety, how atomic conflict-checked writes + the JSONL edit audit work, how the PROGRESS.md tree is indexed, or how the one-screen Steering surface is composed. |
| `plugin-agent-image-context-pack.md` | Four filesystem-canonical content primitives the daemon discovers and serves. | You need how OpenRig discovers plugins, captures/forks agent images, assembles/sends context packs, or how the Claude auto-compaction enforcer decides to send `/compact`. |
| `packaging-bootstrap-bundles.md` | How a topology is packaged into a shareable bundle and reconstituted elsewhere. | You need how rig/pod bundles are assembled (schema-v2 vs legacy v1), how bundle create/inspect/install + `/api/up` route across source kinds, the staged BootstrapOrchestrator flow, or which legacy install-engine seams still ship. |
| `architecture-rules-and-event-system.md` | The cross-cutting invariants that belong to no single subsystem. | You need the 25 architecture rules + startup/import constraints, the shape of the RigEvent union and its SSE delivery, or the intentional compatibility limits that still describe the shipped system. |
| `living-notes-review.md` | **v0.4.4** — the one intent→plan→delivered review projection over on-disk SDLC markdown. | You need the `ComposedSliceReview` contract, the `/api/review/*` routes, staged-approval locks (`--scope spec|delivery`), the `## Proof contract` ↔ proof-artifact join and C1-bound `verified`, the freeze export, or ranged media serving for review evidence. |
### ui/
| Module | One-sentence summary | Reach for this when… |
|---|---|---|
| `shell-and-routing.md` | The shell-first, route-first, primitive-driven operator surface. | You need how the UI shell (rail / Explorer / center workspace / drawer / preview stack) is assembled, the actual route tree the shipped UI mounts, or how the shared detail drawer and event consumption work. |
| `topology.md` | The operator's live picture of host → rig → pod → seat. | You need how the topology surface is built — the host hybrid graph, the table/terminal views, the activity-ring / hot-potato visual language, terminal-preview popovers, and the navigation/overlay contracts. |
| `project-and-for-you.md` | The three operator-facing destination surfaces (For You / Project / Dashboard). | You need how the For-You attention feed (5-card classifier + verb actions), the Project workspace/mission/slice scope pages, and the Dashboard landing on the vellum brand system are built. |
| `library-specs-and-design-system.md` | The Library (`/specs`) destination + the design-system pointer. | You need how the Library UI is assembled — the spec/skills/plugins surfaces, the spec-review + spec-library + live-identity flows that feed it — or where the canonical visual/design-system spec lives. |
### root
| Doc | One-sentence summary | Reach for this when… |
|---|---|---|
| `cli-reference.md` | The full `rig` CLI surface, kept as one doc. | You need the exact rig CLI surface — command groups, subcommands, flags, JSON output, cross-host, coordination primitives. |
| `frontmatter-schema.md` | The frontmatter convention these docs follow + the as-built-unique field. | You are authoring or updating a doc under `docs/as-built/`. |
| `../DESIGN.md` | The canonical visual / brand / design-system spec (repo `docs/` root). | You need the visual system, brand identity, or design-system tokens. (Stays at root by design; pointer only.) |
## (c) Structural relationship diagram
Built from each module's `siblings` / `prerequisite-reads` frontmatter.
`daemon-core.md` is the spine (prerequisite for almost every architecture
module); `shell-and-routing.md` is the UI spine.
```
README.md (entry — prerequisite for all)
│
┌───────────────┴───────────────┐
▼ ▼
architecture/ ui/
│ │
daemon-core.md ◀── (prerequisite spine for the column below)
│ │ │ │
│ │ │ └──▶ adapters-and-runtimes.md
│ │ │ (five-method contract + resume honesty;
│ │ │ consumed by agent-spec startup orchestration)
│ │ └────────────────────────────┐
│ └──────────────┐ │
▼ ▼ ▼
coordination- agent-spec-and- transport-and-
primitive.md startup.md transcripts.md
│ │ │ │
▼ ▼ │ ▼
workflow- mission- │ lifecycle-snapshot-restore.md
runtime.md control.md │ ▲ (consumes persisted replay context)
│ │ │
└────┬─────┘ ├──▶ packaging-bootstrap-bundles.md
▼ │ ▲
architecture-rules- │ │ (0.3.x reusable starter-state cluster)
and-event-system.md │ ▼
(consumes all └──▶ plugin-agent-image-context-pack.md
PL-004/005 events)
workspace-primitive.md ──▶ content-surfaces.md
(PL-007 declaration) (filesystem read/write layer on top)
│ │
└──────────┬───────────────┘
▼ (UI counterpart)
ui/project-and-for-you.md
shell-and-routing.md ──▶ topology.md
│ └──▶ project-and-for-you.md ◀──▶ architecture/mission-control.md
└──────────────▶ library-specs-and-design-system.md ──▶ ../DESIGN.md (pointer)
```
Reading-order rule: open a module's `prerequisite-reads` first
(`README.md`, then `daemon-core.md` for most architecture modules;
`README.md` then `shell-and-routing.md` for most ui modules).
## (d) Fast lookup by use-case
| I need to know… | → see |
| Surface | Start here |
|---|---|
| How the daemon boots / `createDaemon` wiring / migration set / route mounts | `architecture/daemon-core.md` |
| The runtime-adapter contract / how a harness is launched or resumed in tmux | `architecture/adapters-and-runtimes.md` |
| Where Claude resume honesty lives / resumed-vs-fresh assessment | `architecture/adapters-and-runtimes.md` |
| Where queue closure is enforced / hot-potato contract / durable handoff | `architecture/coordination-primitive.md` |
| How workflow specs project on closure / transactional-scribe / watchdog policies | `architecture/workflow-runtime.md` |
| The Mission Control views/verbs / queue-observability / action audit | `architecture/mission-control.md` |
| AgentSpec/RigSpec types, profile resolution, startup layering, whoami/bind/adopt | `architecture/agent-spec-and-startup.md` |
| Snapshot/restore, restore honesty, restore-check / restore-packet probes | `architecture/lifecycle-snapshot-restore.md` |
| rig send/capture/broadcast, transcripts, durable chat, `rig ask`, MCP-name vs tmux-key | `architecture/transport-and-transcripts.md` |
| The workspace primitive (root/repos), `target_repo` scope gating, missions/slices indexing | `architecture/workspace-primitive.md` |
| The file browser path safety, atomic writes + edit audit, PROGRESS tree, Steering composer | `architecture/content-surfaces.md` |
| The composed slice/mission review (`/api/review/*`), staged-approval locks, proof artifacts + `verified`, freeze export, ranged media | `architecture/living-notes-review.md` |
| Plugin discovery / agent images / context packs / Claude auto-compaction enforcer | `architecture/plugin-agent-image-context-pack.md` |
| Bundle assembly, bundle install / `/api/up`, BootstrapOrchestrator, legacy install seams | `architecture/packaging-bootstrap-bundles.md` |
| The 25 architecture rules / RigEvent union / SSE delivery / compatibility limits | `architecture/architecture-rules-and-event-system.md` |
| The UI shell, the real route tree, the shared detail drawer | `ui/shell-and-routing.md` |
| The topology graph/table/terminal views, activity-ring / hot-potato visuals | `ui/topology.md` |
| The For-You attention feed, Project scope pages, the Dashboard landing | `ui/project-and-for-you.md` |
| The vellum brand system on the destination surfaces (0.3.1 brand identity) | `ui/project-and-for-you.md` (vellum brand = **0.3.1** per slice-00 0.3.0-GT seam (b); slice-00 §2 row 1 = vellum-primitives → brand-identity, row 2 = destination-model → polished-destinations) |
| The Library `/specs` UI + spec-review/spec-library/live-identity flows | `ui/library-specs-and-design-system.md` |
| The full `rig` CLI surface | `cli-reference.md` |
| The visual / brand / design-system spec | `../DESIGN.md` (repo `docs/` root) |
| Which frontmatter these docs use + the as-built-unique field | `frontmatter-schema.md` |
| Daemon process | `packages/daemon/src/index.ts`; `createDaemon()` in `packages/daemon/src/startup.ts`. |
| HTTP application | `createApp()` in `packages/daemon/src/server.ts`; route modules under `packages/daemon/src/routes/`. |
| State and migrations | `packages/daemon/src/db/connection.ts`, `packages/daemon/src/db/migrate.ts`, `packages/daemon/src/db/all-migrations.ts`. |
| CLI | `createProgram()` in `packages/cli/src/index.ts`; commands under `packages/cli/src/commands/`, HTTP in `packages/cli/src/client.ts`. |
| MCP | `createMcpServer()` in `packages/cli/src/mcp-server.ts`; stdio command in `packages/cli/src/commands/mcp.ts`. |
| Terminal UI | `packages/tui/src/main.ts`, `packages/tui/src/state.ts`, `packages/tui/src/render.ts`; HTTP in `packages/tui/src/daemon-client.ts`. |
| Web UI | `packages/ui/src/main.tsx`, `packages/ui/src/routes.tsx`. |
| npm assembly | `scripts/build-package.sh`, `scripts/rewrite-daemon-imports.mjs`, `packages/cli/package.json`. |
## (e) Source-root pointer table
The daemon's route handlers obtain domain services from request context. `startup.ts` constructs
those services, repositories and runtime adapters; `server.ts` wires them into the application.
CLI and TUI clients use the daemon's HTTP projections. Package boundaries and the development
versus bundled paths are described in [ARCHITECTURE.md](../../ARCHITECTURE.md).
Module → primary `packages/*/src/...` roots. This replaces the old per-file
`Exports:`/`Related:` dump: it points at the code, it does not transcribe it.
Source-grounding for each claim lives inside the module with file:line cites.
## Runtime and state modules
| Module | Primary source roots |
Each row names an existing module and a small set of source starting points. Directories group
related code; they are not an exhaustive dependency list.
| Question | Module | Source entry points |
|---|---|---|
| How are the daemon, database and routes assembled? | [Daemon core](architecture/daemon-core.md) | `packages/daemon/src/startup.ts`, `packages/daemon/src/server.ts`, `packages/daemon/src/db/`. |
| How do runtime launch, projection and resume work? | [Adapters and runtimes](architecture/adapters-and-runtimes.md) | `packages/daemon/src/domain/runtime-adapter.ts`, `packages/daemon/src/adapters/`, `packages/daemon/src/domain/native-resume-probe.ts`. |
| How do authored specs become launched agents with identity? | [Agent spec and startup](architecture/agent-spec-and-startup.md) | `packages/daemon/src/domain/rigspec-schema.ts`, `packages/daemon/src/domain/startup-orchestrator.ts`, `packages/daemon/src/domain/whoami-service.ts`. |
| Where are durable work, delivery and handoff handled? | [Coordination](architecture/coordination-primitive.md) | `packages/daemon/src/domain/queue-repository.ts`, `packages/daemon/src/domain/stream-store.ts`, `packages/daemon/src/domain/inbox-handler.ts`, `packages/daemon/src/domain/outbox-handler.ts`. |
| How does a workflow retain progress and resume? | [Workflow runtime](architecture/workflow-runtime.md) | `packages/daemon/src/domain/workflow-runtime.ts`, `packages/daemon/src/domain/workflow-projector.ts`, `packages/daemon/src/domain/policies/`, `packages/daemon/src/routes/workflow.ts`. |
| How are queue observations and actions exposed? | [Mission control](architecture/mission-control.md) | `packages/daemon/src/domain/mission-control/`, `packages/daemon/src/routes/mission-control.ts`. |
| What is captured and checked during restore? | [Lifecycle, snapshot and restore](architecture/lifecycle-snapshot-restore.md) | `packages/daemon/src/domain/snapshot-capture.ts`, `packages/daemon/src/domain/restore-orchestrator.ts`, `packages/daemon/src/routes/restore-check.ts`. |
| How do messages and transcript reads reach sessions? | [Transport and transcripts](architecture/transport-and-transcripts.md) | `packages/daemon/src/domain/session-transport.ts`, `packages/daemon/src/domain/transcript-store.ts`, `packages/daemon/src/routes/transport.ts`. |
| Where do workspaces, projects and repository scope resolve? | [Workspace](architecture/workspace-primitive.md) | `packages/daemon/src/domain/workspace/`, `packages/daemon/src/domain/current-work.ts`, `packages/daemon/src/routes/projects.ts`. |
| How are files, progress and steering read or written? | [Content surfaces](architecture/content-surfaces.md) | `packages/daemon/src/domain/files/`, `packages/daemon/src/domain/progress/`, `packages/daemon/src/domain/steering/`. |
| How are review inputs, proof and approvals composed? | [Living notes and review](architecture/living-notes-review.md) | `packages/daemon/src/domain/review/`, `packages/daemon/src/domain/scope/`, `packages/daemon/src/routes/review.ts`. |
| Where are plugins, agent images and context packs discovered? | [Plugins, images and context packs](architecture/plugin-agent-image-context-pack.md) | `packages/daemon/src/domain/plugin-discovery-service.ts`, `packages/daemon/src/domain/agent-images/`, `packages/daemon/src/domain/context-packs/`. |
| How are reusable bundles assembled and installed? | [Packaging, bootstrap and bundles](architecture/packaging-bootstrap-bundles.md) | `packages/daemon/src/domain/pod-bundle-assembler.ts`, `packages/daemon/src/domain/bootstrap-orchestrator.ts`, `packages/daemon/src/routes/bundles.ts`, `packages/daemon/src/routes/up.ts`. |
| Where are event types, publication and SSE handled? | [Architecture rules and events](architecture/architecture-rules-and-event-system.md) | `packages/daemon/src/domain/types.ts`, `packages/daemon/src/domain/event-bus.ts`, `packages/daemon/src/routes/events.ts`. |
For an execution projection, also read `packages/daemon/src/domain/execution-view.ts` and
`packages/daemon/src/domain/view-projector.ts`. The terminal-side consumer starts in
`packages/tui/src/execution/`. These sit alongside the queue and workflow sources above.
### Newer entry points
These features were added after the module pages above were last verified. Each module's own
stamp says whether it already covers them; until then, start from the source named here.
| Question | Source entry points | Nearest module |
|---|---|---|
| How does a GitHub folder link become a bundle source? | `isGitHubBundleLink()` and the bundle source in `packages/cli/src/lib/bundle-source.ts`, used by `packages/cli/src/commands/up.ts` and `packages/cli/src/commands/bundle.ts`. | [Packaging and bundles](architecture/packaging-bootstrap-bundles.md) |
| What does `rig bundle check` read? | `checkBundleFolder()` in `packages/cli/src/lib/bundle-check.ts`: advisory file reads against `openrig.bundle-standard/v1`, with no daemon, launch or provider call. | [Packaging and bundles](architecture/packaging-bootstrap-bundles.md) |
| How does a member's `permission_policy` become a launch posture, including `builtin:auto`? | `builtinLaunchPosture()` and `resolvePermissionPolicyAttachment()` in `packages/daemon/src/domain/permission-policy/policy-ref.ts` (`builtin:yolo` is full bypass, `builtin:auto` is auto, the other built-ins are the floor), bound per seat in `packages/daemon/src/domain/rigspec-instantiator.ts`. `packages/daemon/src/domain/bundle-behaviour.ts` is the read-only preview of the same mapping for an unopened bundle. | [Adapters and runtimes](architecture/adapters-and-runtimes.md) |
| What does a non-interruptive launch add? | `nonInterruptiveArgs()` in `packages/daemon/src/adapters/non-interruptive.ts` (per-launch arguments only; it never changes permissions or native settings files). The separate instance-wide YOLO setting, off by default, is in `packages/daemon/src/adapters/yolo-mode.ts`. | [Adapters and runtimes](architecture/adapters-and-runtimes.md) |
| What launch arguments does a kernel seat get? | `operationalLaunchArgs()` and `KERNEL_CLAUDE_ALLOW` in `packages/daemon/src/adapters/kernel-authority.ts`; `NativePermissionStore.launchOverride()` in `packages/daemon/src/domain/native-permission-store.ts` decides it per launch (only the rig named `kernel`, with no explicit seat choice, permission policy or Codex profile). | [Adapters and runtimes](architecture/adapters-and-runtimes.md) |
| What launch default does a seat in any other rig get? | Under the same conditions `launchOverride()` sets `teamPermissionDefault`: a Claude seat at the floor posture gets `TEAM_CLAUDE_ALLOW` and `TEAM_CLAUDE_ASK` from `operationalLaunchArgs()` in `packages/daemon/src/adapters/kernel-authority.ts`, whose `claudeCommandSettings()` hands the kernel or team lists to the session-only Bash hook `packages/daemon/assets/claude-team-permissions.cjs`, which returns the allow or ask decision; a workspace-write Codex seat gets `--add-dir` roots from `prepareCodexTeamWorkspace()` in `packages/daemon/src/domain/codex-team-workspace.ts`. | [Adapters and runtimes](architecture/adapters-and-runtimes.md) |
| How does `rig seat continue` finish a fresh or Codex-fork startup that stopped before its context was delivered? | `continueStartup()` in `packages/daemon/src/domain/seat-lifecycle-service.ts`, `canContinueStartup()` and `readPendingStartupContext()` in `packages/daemon/src/domain/startup-orchestrator.ts`, `captureForkIdentity()` in `packages/daemon/src/adapters/codex-runtime-adapter.ts`, the route in `packages/daemon/src/routes/seat.ts`, and the command in `packages/cli/src/commands/seat.ts`. | [Agent spec and startup](architecture/agent-spec-and-startup.md) |
| How does `rig context work-install` choose a project and position? | `resolveWorkPosition()` in `packages/cli/src/lib/work-install.ts`, `packages/cli/src/commands/context.ts`, and `packages/daemon/src/domain/workspace/project-catalog.ts`. | [Workspace](architecture/workspace-primitive.md) |
| Where do rosters come from? | `packages/cli/src/commands/roster.ts`: `rig roster list`, `show` and `find` read JSON roster files from `<workspace.root>/rosters` (or `--folder`) and are read-only. | [Agent spec and startup](architecture/agent-spec-and-startup.md), "Specialist rosters" |
| What telemetry can be read? | `packages/daemon/src/domain/finite-telemetry.ts` (the `events`, `queue-transitions` and `tenures` streams), `/api/telemetry` in `packages/daemon/src/routes/telemetry.ts`, and `packages/cli/src/commands/telemetry.ts`. | [Architecture rules and events](architecture/architecture-rules-and-event-system.md), "Telemetry read surface" |
## Change and verification guides
| Need | Read |
|---|---|
| `architecture/daemon-core.md` | `packages/daemon/src/{startup.ts,server.ts,index.ts}`, `packages/daemon/src/db/migrations/`, `packages/cli/src/index.ts` |
| `architecture/adapters-and-runtimes.md` | `packages/daemon/src/domain/runtime-adapter.ts`, `packages/daemon/src/adapters/{claude-code-adapter,codex-runtime-adapter,terminal-adapter}.ts`, `packages/daemon/src/domain/{native-resume-probe,resume-metadata-refresher,codex-thread-id}.ts` |
| `architecture/coordination-primitive.md` | `packages/daemon/src/domain/{stream-store,queue-repository,queue-transition-log,hot-potato-enforcer,inbox-handler,outbox-handler}.ts`, `packages/daemon/src/routes/{stream,queue}.ts` |
| `architecture/workflow-runtime.md` | `packages/daemon/src/domain/{workflow-projector,workflow-runtime,workflow-instance-store,workflow-spec-cache,workflow-step-trail-log,workflow-validator}.ts`, `packages/daemon/src/domain/policies/workflow-keepalive.ts`, `packages/daemon/src/routes/workflow.ts` |
| `architecture/mission-control.md` | `packages/daemon/src/domain/mission-control/`, `packages/daemon/src/middleware/auth-bearer-token.ts`, `packages/daemon/src/routes/mission-control.ts`, `packages/daemon/src/db/migrations/037_mission_control_actions.ts` |
| `architecture/agent-spec-and-startup.md` | `packages/daemon/src/domain/{agent-manifest,rigspec-schema,profile-resolver,startup-orchestrator,whoami-service,claim-service}.ts`, `packages/daemon/src/routes/{rigspec,whoami}.ts` |
| `architecture/lifecycle-snapshot-restore.md` | `packages/daemon/src/domain/{restore-orchestrator,snapshot-capture,snapshot-repository,checkpoint-store}.ts`, `packages/daemon/src/routes/restore-check.ts`, `packages/cli/src/commands/restore-packet.ts` |
| `architecture/transport-and-transcripts.md` | `packages/daemon/src/domain/{session-transport,transcript-store,history-query,ask-service,chat-repository}.ts`, `packages/daemon/src/routes/{transport,transcripts,ask,chat}.ts`, `packages/cli/src/mcp-server.ts` |
| `architecture/workspace-primitive.md` | `packages/daemon/src/domain/workspace/`, `packages/cli/src/commands/config-init-workspace.ts`, `packages/daemon/src/db/migrations/{038,039}*`, `packages/ui/src/routes.tsx` |
| `architecture/content-surfaces.md` | `packages/daemon/src/domain/{files,progress,steering}*`, `packages/daemon/src/routes/{files,progress,steering}.ts`, `packages/ui/src/routes.tsx` |
| `architecture/living-notes-review.md` | `packages/daemon/src/domain/review/{types,compose,gather,freeze,brief-spine}.ts`, `packages/daemon/src/routes/{review,files,slices}.ts`, `packages/cli/src/commands/{scope,proof}.ts`, `packages/ui/src/components/review/` |
| `architecture/plugin-agent-image-context-pack.md` | `packages/daemon/src/domain/plugin-discovery-service.ts`, `packages/daemon/src/domain/{agent-images,context-packs}/`, `packages/daemon/src/domain/claude-compaction-enforcer.ts` |
| `architecture/packaging-bootstrap-bundles.md` | `packages/daemon/src/domain/{pod-bundle-assembler,bootstrap-orchestrator,bundle-*,package-*,install-*}.ts`, `packages/daemon/src/routes/{bundles,up}.ts` |
| `architecture/architecture-rules-and-event-system.md` | `packages/daemon/src/domain/types.ts` (RigEvent union), `packages/daemon/src/routes/{stream,queue}.ts` (SSE watch), `packages/daemon/src/server.ts` (`/api/events`) |
| `ui/shell-and-routing.md` | `packages/ui/src/routes.tsx`, `packages/ui/src/components/AppShell.tsx` |
| `ui/topology.md` | `packages/ui/src/components/topology/`, `packages/ui/src/lib/{graph,hybrid,multi-rig}-layout.ts` |
| `ui/project-and-for-you.md` | `packages/ui/src/routes.tsx`, `packages/ui/src/components/dashboard/vellum/` |
| `ui/library-specs-and-design-system.md` | `packages/ui/src/components/specs/`, `packages/daemon/src/domain/{spec-review-service,spec-library-service}.ts`, `../DESIGN.md` (pointer) |
| `cli-reference.md` | `packages/cli/src/index.ts`, `packages/cli/src/commands/*` |
| Contributor setup and a small change recipe | [CONTRIBUTING.md](../../CONTRIBUTING.md), [ARCHITECTURE.md](../../ARCHITECTURE.md). |
| What depends on a sensitive source path | [arteries.md](arteries.md). |
| Unit, route, scenario, package and CI coverage | [test-layers.md](test-layers.md), `packages/test-system/README.md`, `.github/workflows/tests.yml`. |
| Exact CLI syntax | [cli-reference.md](cli-reference.md), then `packages/cli/src/index.ts`, its command module and current command help. |
| As-built metadata | [frontmatter-schema.md](frontmatter-schema.md). |
| An older architecture link | [architecture.md](architecture.md), which redirects into this module tree. |
| Visual specification | [DESIGN.md](../DESIGN.md). |
> No per-file flat dump. File-level detail belongs in the code; this codemap
> points at the source root and the module that explains it. The per-file
> index anti-pattern (old codemap) is retired, not relocated.
## Existing web UI references
These historical documents are still indexed; this pass checks their locations, not their
current implementation claims. Consult each page's stamp.
| Reference | Source area |
|---|---|
| [UI compatibility pointer](ui.md) | `packages/ui/src/`. |
| [Shell and routing](ui/shell-and-routing.md) | `packages/ui/src/routes.tsx`, `packages/ui/src/components/AppShell.tsx`. |
| [Topology](ui/topology.md) | `packages/ui/src/components/topology/`. |
| [Project and For You](ui/project-and-for-you.md) | `packages/ui/src/routes.tsx`. |
| [Library/specs and design system](ui/library-specs-and-design-system.md) | `packages/ui/src/components/specs/`. |
+52 -44
View File
@@ -1,65 +1,73 @@
---
kind: as-built
title: As-Built Frontmatter — Pointer + As-Built-Unique Field
title: As-Built Frontmatter
status: active
topics: [knowledge-and-context, frontmatter]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Authoring or updating a doc under docs/as-built/. Tells you which
frontmatter convention governs these docs and the one field that is
unique to as-built docs.
siblings: [README.md]
prerequisite-reads: [README.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
Writing or refreshing a source-grounded document under docs/as-built/.
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# As-Built Frontmatter — Pointer + As-Built-Unique Field
# As-Built Frontmatter
Every doc under `docs/as-built/` carries YAML frontmatter. The shape is
**not** defined here. It is the substrate-wide context-frontmatter
convention; this doc only points to it and documents the one field that
is unique to as-built docs.
Source snapshot: `e8f0ab340db773392ec8be75b072d1c0f3068a50`. This describes the source at that commit;
it does not establish the version or behavior of a running daemon.
## Canonical convention (do not duplicate — read it)
Frontmatter makes an as-built page discoverable and records the source it
was checked against. This page describes the convention visible in this
repository. It does not require an unpublished schema or an internal
workspace to interpret the fields.
`openrig-work/conventions/frontmatter-for-context/README.md` is the
authoritative schema: required floor (`kind` + `title` + `status` +
`applies-when`), recommended fields (`topics`, `domains`, `siblings`,
`prerequisite-reads`), and the controlled vocabularies for `kind:`,
`topics:`, and `domains:`. Author against that convention. This doc adds
nothing to it except the field below.
## Fields
## `kind: as-built`
The corpus uses these fields; see the [module index](README.md) and
[CLI reference](cli-reference.md) for examples.
These docs use `kind: as-built`. That value is in the convention's
controlled `kind:` vocabulary (first row of its "Controlled vocabulary —
`kind:`" table, source `openrig/docs/as-built/*`). Using it is conformant,
not an extension.
| Field | Meaning |
|---|---|
| `kind: as-built` | Identifies a description of implemented behavior. |
| `title` | Human-readable subject of the page. |
| `status` | Document status, such as `active`; not a daemon or feature status. |
| `applies-when` | Short retrieval cue explaining when to open the page. |
| `topics`, `domains` | Lists of indexing labels used in this corpus. They do not select permissions or runtime behavior. |
| `siblings`, `prerequisite-reads` | Related pages and reading order, when useful. Paths are relative to the containing page. |
| `last-verified-against-source` | A resolvable Git commit whose source was used to check the page. |
| `last-updated` | Date of the document update, in `YYYY-MM-DD` form. |
## `last-verified-against-source: <sha>` (as-built-unique)
## Verification stamp
As-built docs describe the running system. They drift when the source
drifts. The as-built-unique field records the exact commit the doc was
last verified against:
Use a commit ID, preferably full length, rather than a branch name or a
moving `HEAD` label. A source stamp identifies what was read; it is not proof
that an installed package or a running system uses that source. Keep runtime
observations separately qualified.
```yaml
last-verified-against-source: 7eaf524c
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
```
- **Value:** the short SHA of the source HEAD the doc was verified
against at its last edit. Pair with `last-updated: <iso-date>`.
- **Why it is here and not in the convention:** the convention is
substrate-wide; most context docs do not track a source SHA. This
field is meaningful only for docs that mirror code, i.e. as-built
docs. It is the per-module drift-detection anchor the
context-architecture-v1 mission dogfoods on its own production.
- **Discipline:** when re-verifying a module against a newer HEAD,
bump this field (and `last-updated`) and carry an inline
`re-confirmed <file:line> @HEAD` annotation on each load-bearing
claim that was re-checked.
Check that the commit resolves with `git cat-file -t <commit>` in a checkout
containing that history. Verify the paths, symbols, and numeric claims cited
by the page at that commit before changing its stamp. A newer date alone
does not refresh the content. Missing history in a shallow checkout and an
invalid commit ID are different conditions.
## See also
Use repository links and named symbols for source references. For numeric
inventories, state what is counted and how it was obtained; for example, the
CLI reference distinguishes registered command objects from aliases and
Commander-generated help.
- `openrig-work/conventions/frontmatter-for-context/README.md` — the canonical schema
- `README.md` — the as-built corpus map of territory
## What the repository guard checks
[`scripts/check-docs-guard.mjs`](../../scripts/check-docs-guard.mjs)
checks allowed tracked documentation paths. Its `findBlockedDocsPaths`
function does **not** validate this frontmatter or prove the prose matches
source. Passing that guard should not be reported as a schema or factual
accuracy check.
[As-built pages](README.md) and [operator reference pages](../reference/help.md)
serve different purposes. `docs/reference/` is staged by
[`scripts/build-package.sh`](../../scripts/build-package.sh); placing content
there changes what is distributed in the package.
+564
View File
@@ -0,0 +1,564 @@
---
kind: as-built
title: Test layers — what to run before you push, and what each layer proves
status: active
applies-when: |
You changed OpenRig and want to know which checks to run before opening a pull
request, what each check actually proves, and what CI will run for you. Also
read it before claiming a stub-agent scenario covers a behaviour.
siblings: [arteries.md, README.md, codemap.md]
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# Test layers: what to run before you push, and what each layer proves
> **This page is a map, not the territory.** It was checked against source at `e8f0ab34`
> and it will drift. It is also incomplete on purpose. Before you rely on a command or a
> claim here, read the script it names or run it. If a behaviour is missing from this page
> (or from [arteries.md](arteries.md)), that tells you nothing about whether a change to it
> is safe.
## Short version
For every change, run what the pull-request template asks for:
```sh
npm run build
npm run lint # typecheck only; there is no formatter or style linter
npm test # = npm run test:repo && npm run test:workspaces
```
Then add the layers your change calls for, using the ladder below. CI also runs a
network-denied macOS test pass and a containerised installed-package scenario on every PR
to `main`. In the PR description, say which layers you ran and which you could not run.
## The ladder
| Layer | Command | What it proves | What it cannot prove | When to run it |
|---|---|---|---|---|
| Typecheck | `npm run lint` | Builds the daemon, then `tsc --noEmit` passes for daemon, ui, cli and tui | Any runtime behaviour. Formatting. | Every change |
| Build | `npm run build` | All four workspaces compile (the UI also runs `vite build`) | That the *published* package is complete (see Packaging) | Every change |
| Repo checks | `npm run test:repo` | Builds the daemon, then runs `node --test --test-concurrency=1 scripts/*.test.mjs`, `scripts/check-first-run-references.mjs`, `scripts/check-docs-guard.mjs`, `mirror-skills --check` (skill homes, generated copies, layout and digests) and `generate-context-packs --check` | Package behaviour | Every change. It matters most when you touch `scripts/`, `docs/` or skills. |
| Package suites | `npm run test:workspaces`. One package: `npm run test -w packages/cli`. One file, from the repo root: `npx vitest run packages/cli/test/<file>.test.ts` | Vitest unit and integration tests for daemon, cli and tui. Some of them start real scenario daemons, tmux sessions and stub runners. | The installed package. Real Claude Code or Codex. CI's sandbox conditions (see CI). | Every change (`npm test` covers it) |
| Web UI suite | `npm run test:ui` | jsdom unit tests for `packages/ui` | Real browser rendering | When you touch `packages/ui`, or a daemon API the UI reads. The web UI is in maintenance mode, so this suite is advisory locally and is not part of `npm test`. |
| Generated files | `npm run mirror-skills:check`, `npm run generate-context-packs:check` (both part of `npm test`) | Shipped skill homes are publishable, generated copies match their homes, all edges match their recorded hashes, and every static context pack passes the daemon's own manifest parser and the leak scan | Whether the skill content is any good | Edit a shipped skill's one in-repo home, run `npm run mirror-skills` to regenerate its other copies and refresh digests, then run the checks and commit the result. The apply reads nothing outside the repository. See "A shipped skill" in [ARCHITECTURE.md](../../ARCHITECTURE.md#a-shipped-skill). |
| Local gate | `npm run gate` | Lint plus `npm test` on a clean tree, tied to `HEAD`, one run per machine at a time, with a JSON receipt | Anything that lint and `npm test` don't already prove | Optional. Useful when several agents share one machine, or when you want a receipt tied to a commit. |
| Packaging | `npm run build:package`, `npm run test:tui-package`, `bash scripts/smoke-fresh-install.sh` | The publishable `@openrig/cli` assembles, the packed TUI launches, and a fresh install starts a daemon | Behaviour beyond startup | When you touch dependencies, bin entries, build scripts, or files a package ships |
| Stub scenarios, host mode | `node --import tsx packages/daemon/scripts/run-scenarios.mjs [scenario.yaml …]` | A scenario's steps and assertions pass against a scratch daemon, real tmux and `runtime: stub` seats | The installed package. Seeded-regression pairing. Everything under [What a stub can and cannot prove](#what-a-stub-can-and-cannot-prove). | While you write or debug a scenario |
| Stub scenarios, installed package in a container | CI job `installed-scenario`. Before pushing: `DOCKER_HOST=ssh://<your-host> bash scripts/run-pr-scenarios.sh --remote …` | A clean Linux install starts. A claimed queue item survives a daemon restart. A planted fault is caught at the intended assertion. Two stub seats' scripted output reads back through `rig transcript` and `rig capture` (passing form only). | Native runtimes. Most command families (see [Help wanted](#help-wanted-command-families-without-a-behavioural-scenario)). | Changes that can affect daemon startup, packaging, queue durability or the scenario harness |
| Live-model evals | `npm run eval -w packages/daemon -- --provider rig …` | Whether a real Claude Code seat runs the expected `rig context get <entry>` for natural prompts | Determinism. Codex. Anything without a case. | Changes to shipped skills or context entries meant to steer agents. **Uses provider credits.** |
| Testbed runbooks | `docker/testbed/runbooks/` (manual) | The testbed image itself works as a test environment | Product behaviour | Only when you change the testbed image or the container plumbing |
Some package tests are gated. `OPENRIG_E2E_REAL_CODEX=1` runs two daemon e2e tests against a
real Codex (they also need tmux, `codex` and `~/.codex/auth.json`, and they use provider
credits). `OPENRIG_REAL_CLAUDE_INTEGRATION=1` enables only a placeholder: it requires
`OPENRIG_PARENT_NATIVE_ID` and checks its format, and no real-Claude fork test exists yet.
Without tmux, some tmux tests skip and others (such as `transcript-seat-env-native.test.ts`)
fail. The CLI's release-tag tests skip without local tags unless `CI=true`, so a green local
run without tags has skipped them. CI installs tmux and fetches full history.
The TUI has its own vitest suite (`npm run test -w packages/tui`, which builds the TUI first)
and runs in the `tui` leg of `package-tests`; `npm run test:tui-package` launches the packed
TUI in demo mode. The `tui_socket` scenario surface exists, but the only scenarios that use it
are not yet runnable checks.
### Gotchas that cost people time
- **Running inside a seat.** The root `vitest.config.ts` makes a root-level file run use its
package's config. The cli, daemon and TUI configs all run the shared root
`test/hermetic-env.setup.ts` before any test file. It clears the inherited `OPENRIG_*` and `RIGGED_*` instance selectors (connection,
database, workspace and topology roots, seat identity, bearer tokens), forces a fixture
`OPENRIG_HOME` and fails if the home is not fixture-scoped. It also wraps `fetch`, so a real
request to anything other than a loopback ephemeral-port fixture or a registered target fails.
It points `HOME` and the XDG directories at a fixture user home and clears `CODEX_HOME` and
`CLAUDE_CONFIG_DIR`. `OPENRIG_E2E_REAL_CODEX=1` keeps native homes and binaries only for
`seat-handover-model-fidelity-e2e.test.ts` and `seat-lifecycle-set-model-resume-e2e.test.ts`;
all other files remain isolated. The scenario scaffold always uses fixture homes and runtime stubs.
The two native files rely on Vitest's default per-file isolation; runs without it are unsupported.
Scenario scaffolds scrub inherited provider roots but preserve those passed in an explicit `baseEnv`.
A test can still set its own
overrides after setup. The UI suite (jsdom) uses its own `packages/ui/test/setup.ts`.
- **Stale vendored daemon.** `npm run build:package` leaves an assembled copy of the daemon at
`packages/cli/daemon/` (gitignored). If you change daemon source afterwards,
`scripts/check-cli-daemon-freshness.test.mjs` inside `test:repo` can fail on the stale copy.
Re-run `npm run build:package` or delete `packages/cli/daemon/`. `npm run gate` deletes it for you.
- **Local passes, CI fails.** CI runs the package suites with a scratch `HOME`, no
credentials, and outbound network blocked except to localhost (see below). A test that reads
your real home directory, a running daemon, the network or a credential can pass on your
machine and fail in CI.
- **Docs location.** `check-docs-guard` fails if a tracked file under `docs/` sits outside
`docs/as-built/`, `docs/reference/` or `docs/releases/`. `docs/DESIGN.md` is the one allowed
exception.
## What CI runs on your pull request
`.github/workflows/tests.yml` runs on pull requests to `main` and on manual dispatch, all on
Node 22. Each suite is its own job, so one failure doesn't hide the others. No provider
credentials are supplied.
| Job | Runner | What it does |
|---|---|---|
| `build-and-package` | ubuntu | `npm ci` and `npm run build`. Then `npm pack --dry-run` for cli, daemon and tui, with each file list uploaded as the `pack-lists` artifact. The job only records the lists; reviewers read them. |
| `typecheck` | ubuntu | `npm run lint` |
| `repo-checks` | ubuntu | `npm run test:repo` |
| `package-tests` | macOS, matrix `daemon`, `cli`, `tui`, `ui` (fail-fast off) | Installs tmux, runs `npm ci` and `npm run build`. Then runs `npm run test -w packages/<pkg>` under `env -i` with a scratch `HOME`/`TMPDIR`/`TMUX_TMPDIR` and a `sandbox-exec` profile that blocks outbound network except localhost and the job's own socket directory. `scripts/ci-macos-process-probe.mjs` runs first. |
| `installed-scenario` | ubuntu | `bash scripts/run-pr-scenarios.sh` (eight container runs, described below). Uploads `dist/pr-scenarios/` as `installed-scenario-evidence`, including on failure. |
A second workflow, `.github/workflows/portability-report.yml` (job `portability-report`),
lists lines your PR adds that contain machine-specific values: credentials, home or temp
paths, network addresses, email addresses. It never fails because of a finding. To see the
matched text locally (credentials show only their first characters), run
`node scripts/portability-report.mjs`. By default it compares the
merge-base with `origin/main` against `HEAD`; pass `--staged` to check staged changes instead.
The UI suite is a CI matrix leg even though it is advisory locally. Check your PR's status to
see whether a red UI leg is treated as blocking. Branch-protection settings are not in the
repository.
## The local gate: `npm run gate`
`scripts/gate-lane.mjs` runs two legs: `npm run lint` and `npm run test`. It does not run
`test:ui`, the scenarios or the packaging checks. On top of those legs it:
- holds a machine-wide lock on localhost port 40404 (override with `OPENRIG_GATE_LANE_PORT`).
A second gate exits 2 straight away instead of waiting.
- refuses a dirty worktree. Refuses a `node_modules` that is a symlink, or `@openrig/*`
workspace links that resolve outside this worktree. Both are common with shared git worktrees.
- deletes the stale vendored daemon bundle at `packages/cli/daemon/` before the legs run.
- writes `gate-lane-verdict.json` at the repo root, or at `OPENRIG_GATE_VERDICT`, which must
point inside the current worktree (a path outside it exits 3 before the legs run). The file holds the `HEAD` SHA, per-leg results and durations, and a note of other
`node`/`vitest`/`tsc` processes running at the time. It fails if `HEAD` changes during the
run. The file is not gitignored, so don't commit it.
Exit codes: 0 pass, 1 a leg failed, 2 lane busy, 3 the runner itself errored.
`OPENRIG_GATE_LANE_SMOKE=1` skips the legs to test the wiring only, and the verdict records
`smoke: true`.
## Stub-agent scenarios
### What's in the box
| Piece | Where |
|---|---|
| `runtime: stub` adapter | `packages/daemon/src/adapters/stub-runtime-adapter.ts`, with `stub-runner.ts` (the process that runs in the pane), `stub-script.ts` (the launch-script format) and `stub-compaction.ts` / `stub-restore.ts` |
| Scenario format and runner | `packages/daemon/test/helpers/scenario-*.ts`. Step verbs: `up`, `down`, `send`, `restart`, `daemon`, `seed_regression` are bound. `restore`, `emit`, `mutate`, `policy` parse but are unbound. Assertion surfaces: `ps`, `queue`, `stream`, `scope`, `pane`, `transcript`, `tui_socket`, `policy_provenance`. |
| Scenario library | `packages/test-system/scenarios/`: 17 scenarios, 7 stub topologies, `agents/`, `culture.md`, per-seat stub scripts in `scripts/` |
| Runner fixtures | `packages/daemon/test/fixtures/scenarios/` (`scenario-01-per-seat-scripts`, `scenario-02-baton`, `scenario-10-one-view-state`) |
| Host runner | `packages/daemon/scripts/run-scenarios.mjs` |
| In-container entry and result check | `packages/test-system/ci/run.mjs`, `packages/test-system/ci/result.mjs` |
| PR orchestrator | `scripts/run-pr-scenarios.sh` |
| Image | `docker/testbed/Dockerfile`, built by `scripts/build-testbed-image.sh`; `docker/testbed/Dockerfile.scenarios` is layered on top by `scripts/run-pr-scenarios.sh` |
### Host mode: while you're writing a scenario
```sh
npm run build # the runner drives packages/cli/dist/bin-wrapper.js
node --import tsx packages/daemon/scripts/run-scenarios.mjs # the fixture scenario-*.yaml files
node --import tsx packages/daemon/scripts/run-scenarios.mjs packages/daemon/test/fixtures/scenarios/scenario-02-baton.yaml
```
- The runner creates a scratch `HOME`/`OPENRIG_HOME`, its own tmux server and its own
daemon. It builds the scenario environment from `HOME`, `PATH` and `TERM` only, so your
shell's daemon-target variables (`OPENRIG_URL`, `OPENRIG_PORT` and similar), `TMUX` and
`OPENRIG_TEST_CLOCK_NOW` are dropped rather than inherited. It does not touch the daemon or
tmux server your own session uses.
- It accepts YAML paths only. Any flag, including `--container`, is refused before anything runs.
- It supplies no fault controller, so any scenario with a `seed_regression` step fails loudly
at that step. That includes the library's `queue-baton-survives-restart`. Use the container
path to run the seeded pair.
- `scenario-10-one-view-state` declares its own normaliser for its cross-surface `equals`
check. Whether it passes in host mode has not been verified.
### Container mode: the scenario pack CI runs
In CI the `installed-scenario` job runs `scripts/run-pr-scenarios.sh` with no arguments:
both baton cases (`fixture` = `scenario-02-baton.yaml`, `library` = `queue-baton-survives-restart.yaml`),
each run three times as healthy, then lost-baton, then healthy. Then the two stub-script
cases (`transcript` = `transcript-reads-addressed-seat.yaml`, `capture` =
`capture-returns-addressed-seat.yaml`) run once each, healthy only. That is eight fresh
containers.
To run a case before you push, point `DOCKER_HOST` at a Docker engine you control over SSH:
```sh
npm ci
DOCKER_HOST=ssh://<your-host> bash scripts/run-pr-scenarios.sh \
--remote --case library --mode healthy --out dist/scenario-check
```
- Options: `--case fixture|library|transcript|capture` (default: all four), `--mode
healthy|lost-baton` (default: healthy, lost-baton, healthy) and `--out <dir>` (default
`dist/pr-scenarios`). `--mode` applies to `fixture` and `library`; `transcript` and `capture`
always run once, healthy. `--mode lost-baton` leaves them out of a full run, and
`--case transcript|capture --mode lost-baton` is refused with exit 2. Use a fresh `--out`
directory for each run you want to keep.
- `--remote` accepts only `ssh://` values for `DOCKER_HOST`, and it refuses if
`DOCKER_CONTEXT` is set. The engine must be Linux on amd64 or arm64. The script reads the
*server's* platform, so a macOS/arm64 laptop driving a Linux/amd64 engine works.
- Without `--remote`, the script refuses to run anywhere except GitHub Actions on Linux.
- The source build and pack run on your machine. The image build and the containers run on
the engine. Building the image needs network access for the pinned base image, Node and
dependencies. The scenario containers have no network.
- The image is built from your working tree but tagged with `git rev-parse HEAD`. Commit
first, so the tag names what you actually tested.
- It never pushes images. It removes only the containers it named. If the SSH connection
drops, it prints the name of any container it could not remove.
What happens, in order:
1. `scripts/build-testbed-image.sh` packs `@openrig/cli` from your tree. It installs the
package into a digest-pinned Debian image with Node, checks `rig --version`, and checks
that the installed daemon loads. The result is tagged `openrig-testbed:<sha>`.
2. `docker/testbed/Dockerfile.scenarios` adds a bundled copy of
`packages/test-system/ci/run.mjs` plus the fixture and library scenarios.
3. Each run uses a fresh container: `--network none`, read-only root plus a 512 MB `/tmp`
tmpfs, `--cap-drop ALL`, `no-new-privileges`, non-root, 2 CPUs, 2 GiB, 256 PIDs and a
300-second deadline.
4. In lost-baton mode, the runner stops the daemon, changes exactly one queue row in the
scratch database from `in-progress` to `pending`, and restarts the daemon.
`packages/test-system/ci/result.mjs` then accepts only one outcome: a failure at the
post-restart queue assertion, with `baton-1` observed as `pending` at the expected
destination. A startup error, a timeout or any other failure does not count as a caught
regression. Healthy runs must pass with no fault armed.
5. The `transcript` and `capture` runs are passing form only: `result.mjs` accepts only a
clean PASS of the named scenario, with no seed or fault. Their planted failures are
product-code mutations, so they stay per-PR evidence and are not CI runs. Stub scripts
work here because the runner executes the pipeline in host mode inside the image.
A single healthy run proves that one leg only. The paired fault run is what shows the
assertion can catch the failure.
Adding a new case to this pack today means changing three files:
`scripts/run-pr-scenarios.sh` (the `--case` list), `CASES` in
`packages/test-system/ci/result.mjs`, and the fault controller in
`packages/test-system/ci/run.mjs`, which is currently specific to the baton row. A
passing-only case needs no fault controller: add it to `PASSING_CASES` and the `--case` list
in `scripts/run-pr-scenarios.sh`, and to `PASSING_CASES` in `result.mjs`.
### What a green stub scenario proves
- The packaged CLI installs into a clean Linux container and starts a daemon.
- `rig up` and `rig down` of a stub topology go through the real daemon, tmux, SQLite and CLI.
- Queue state, read through the shipped `rig queue list` path, survives a daemon restart.
- With the paired seeded run: the assertion fails when that state is broken.
### What a stub can and cannot prove
The stub does not fabricate product outputs. It runs the real daemon, tmux and CLI. But it is
not Claude Code or Codex, and it differs from them in ways that decide what a stub green
means:
| Area | What the stub does at `e8f0ab34` | What that means for your test |
|---|---|---|
| Consuming a message | `stub-runner.ts` runs its launch script once and then idles. It has no stdin reader, socket or other input channel. The default script prints `[stub] scripted reply: acknowledged` at boot, before anything has been sent. | A pane showing a reply, or your echoed text, does not prove the message was consumed. No stub scenario can currently prove "delivered and answered". Separately, `rig send --verify` means "appeared in the pane" (with transport.verify_input_box on, a Claude Code or Codex send means "the seat was idle before the paste and its input box took the exact text"), not acknowledgement (see `rig send --help`), and the scenario `send` step doesn't pass `--verify` at all. |
| Launch path | `StubRuntimeAdapter` types `node <stub-runner> …` into the pane (`tmux.sendText`, then Enter). Claude Code with an explicit permission mode launches through a managed launch (`ClaudeManagedLaunch.prepare`, `tmux.sendShellCommand`). Otherwise Claude Code, Codex and Pi launch through `SeatLaunchEnvironment.command` and `tmux.sendShellCommand`; the stub adapter does not get that environment. The shell-foreground check in `session-transport.ts` (`unverifiedShellForeground`) runs for every runtime except `terminal` and `claude-code`, and only `codex` has a native-process proof; Claude Code ordinary delivery applies its own uncertainty policy at the input boundary. | A stub seat doesn't exercise the seat launch environment, managed launch, wrappers or native-process identity (the class behind #197). Wrapping the stub in a shell wouldn't change that. |
| Permissions | `validateNativePermissionSelection` accepts only `codex` and `claude-code`. The stub carries the resolved `floor` / `full_bypass` posture, including one set by a declarative `permission_policy`, into its runner's `--posture` argument and READY line. It ignores non-interruptive launches, and it doesn't exercise Claude or Codex native permission behaviour. | Testing Claude permission modes or per-seat permission selection needs a real runtime. |
| Queue pickup and wake | No stub worker reacts to a nudge by claiming an item, working on it and handing it back. | The baton scenarios prove the claim *survives a restart*. They don't prove delivery, pickup or wake. |
| Reboot / tmux reset | `daemon: {op: restart}` restarts only the scenario daemon, and the tmux server keeps running. No step resets tmux. | Recycled pane IDs and stale bindings after a real reboot (the class behind #141) are not covered by a daemon restart. |
| Multi-rig and same-name identities | The `up` step always uses the scenario's top-level `topology` and ignores a per-step override. No step archives or removes a rig. | Cross-rig scope, same-name generations and archive/remove routing (the class behind #174) need runner work before they can be tested. |
| Step-time restore, compaction, mutation, policy | `restore`, `emit`, `mutate` and `policy` parse, but the runner throws `UnboundActionError` when it reaches them. Behaviours run only from a per-seat launch script (`env.stub_scripts`). A seat `restart` step maps to `rig launch`, which is not native resume or fork. | Step-time compaction and restore, and native resume and fork, are not covered. |
| Skill projection | The stub projects skills into `<cwd>/.openrig/stub/skills/`. Claude Code projects into `<cwd>/.claude/skills/`. | A stub green says nothing about provider-specific projection (the class behind #159). |
| Model and provider | No model, no tokens. Stub scripts refuse `usage_limit` because it only exists on real runtimes. | Model behaviour, provider usage limits and real context usage need live evals or a real runtime. |
| Platform | CI's scenario job runs in a Linux container. | macOS process behaviour is covered by the macOS `package-tests` jobs, not by scenarios. |
The most useful next pieces of harness work, roughly in dependency order:
1. A stub that consumes input and answers a fresh nonce.
2. A model-free test entry point shaped like a provider, that goes through the real native
adapter and managed launch. Package tests such as `claude-interactive-launch.test.ts` and
the `*-native.test.ts` files already drive the real adapters through tmux against an
offline recorder; they prove command resolution and arguments.
`claude-executable-foreground.test.ts` holds that recorder open in private Bash, zsh, dash and ksh panes
to check parent PID, process-group ownership, tmux's pane command and parent-shell
restoration for unmanaged fresh, fork and resume launches. These fixtures do not prove
native readiness, history or answers.
3. Lifecycle and identity steps (tmux reset, archive/remove).
4. Then pickup, wake and restore scenarios.
### Library status
Four scenarios run in CI: `queue-baton-survives-restart` (since #243) with its seeded pair,
and `transcript-reads-addressed-seat`, `capture-returns-addressed-seat` and
`daemon-restart-preserves-team-identity` in passing form only. Three more,
`down-stops-every-seat`, `send-renders-in-addressed-pane` and
`up-relaunch-restores-a-two-seat-team`, run with the local runner but not in CI. Those six later scenarios are not in this table; see "Status
today" under [Help wanted](#help-wanted-command-families-without-a-behavioural-scenario). The
other ten scenarios are authored but not yet runnable as meaningful checks:
| Scenario | Why it doesn't run as a check yet | Smallest useful next step |
|---|---|---|
| `queue-baton-survives-restart` | Runs in CI: healthy / seeded `baton-drop` / healthy | Extend it to handoff, block, resolve and unclaim |
| `clean-lifecycle-no-residue` | The post-`down` "nothing left over" assertion is commented out, because the format has no way to say "empty" | Add a real absence assertion |
| `ps-scope-honesty` | The second `up` reuses the first topology, and the expected match tolerates the other rig | Make `up` honour the per-step topology, then assert the exclusion |
| `send-verify-means-rendered` | The `send` step drops `verify`, and the stub has no input loop | Build the input-consuming stub and assert a response derived from the nonce |
| `home-divergence-preseed-visible` | The pipeline ignores `env.pre_existing_tmux`, and the default script never prints the expected `trust reached` | Recreate the real HOME split and whatever consumes it |
| `compaction-restore-resumes-role` | Step-time `emit` is unbound | Input-triggered hooks plus evidence specific to one seat |
| `stream-emit-durable-replay-live` | Step-time `emit` is unbound | Assert the actual stream contract |
| `policy-posture-survives-structural-edit` | `policy` and `mutate` are unbound | Rewrite around current per-seat permission selection and an observed launch |
| `locked-restore-never-permissive` | `policy` and `restore` are unbound | Keep the invariant (the selection survives a restore) and use current modes |
| `one-view-state-after-mutation-storm` | The validator rejects its bare-list `equals` (`EQUALS_NOT_DECLARATIVE`), and `mutate` is unbound | Declare the comparable fields and real mutations |
| `kill-daemon-mid-handoff` | A pane `send` doesn't create the queue item the next assertion expects, and later assertions use a shape the queue reader doesn't return | Rebuild the setup before treating a red result as meaningful |
In most of these files, `seed_regression` steps that come *after* the assertions are
historical markers, not executable fault injections.
### Ordinary CLI journeys with stub seats
`packages/daemon/test/stub-cli-journeys.integration.test.ts` reuses the scenario
helpers with one private daemon and two stub rigs. It checks three contracts
through the real CLI: verified send appears in the addressed pane but not its
sibling; current-rig and explicit rig listings contain exactly the expected seats;
and a filtered stream item survives daemon restart and an idempotent emit retry.
After building, run the focused file with:
```sh
npm test -w @openrig/daemon -- test/stub-cli-journeys.integration.test.ts
```
The file also runs in the daemon package-test job. It covers these command
contracts without extending the YAML grammar. The corresponding library scenarios
above remain pending: pane rendering does not prove input consumption, durable
stream replay does not prove live subscription, and this test does not exercise
native providers, restore or policy changes.
## If your change touches an artery, add or extend a scenario (or say why not)
[arteries.md](arteries.md) lists the behaviours that everything else depends on. If your
diff can affect one, your PR description should do one of these:
- link the scenario that covers it, and say which layer you ran it in;
- add or extend a scenario. For a regression scenario, show that the fixed code passes and
that the planted old defect fails *at the intended assertion*. A setup crash or a timeout
doesn't count;
- or say precisely why the stub can't exercise it. Use the table above, which covers
message consumption, native launch and permissions, tmux reset and so on. Then say what
you ran instead, for example a manual run with the real runtime.
This is part of normal review, not an extra approval step. It also isn't a claim that
changes outside the arteries map are safe.
## Live-model evals
`packages/test-system/evals/` is a separate check from scenarios. A real seat receives a
natural prompt and decides what to do. A case passes when the seat's transcript shows the
expected `rig context get <entry>` command, in the expected order. Cases live in
`cases/selection.yaml` (10) and `cases/loading.yaml` (4).
```sh
# Harness check: a fake provider fed a JSON map of prompt -> transcript.
# Any prompt without a transcript counts as an error, never as a pass.
npm run eval -w packages/daemon -- --transcripts <transcripts.json> --out <result.json>
# Live run: drives a real Claude Code seat
npm run eval -w packages/daemon -- --provider rig --seat <session> --out <result.json>
npm run eval -w packages/daemon -- --provider rig --seat-spec "$PWD/<one-seat-rig.yaml>" --out <result.json>
```
- **Live runs use provider credits, and the results vary from run to run.** CI never runs them.
- `--provider rig` needs `OPENRIG_HOME` set, and it supports Claude Code seats only. It
refuses a Codex seat.
- `--seat-spec` runs `rig up` of a scratch rig against **your current daemon**, then
`rig down` at the end. `--seat` attaches to an existing seat and leaves it running.
- `evals/rig-seat/example-scratch-rig.yaml` sets `permission_policy: builtin:yolo` and
`cwd: "."`. It also references `local:agents/blank`, and no such agent directory ships
beside it. Read the file and expect to adapt it before you use it.
- Before any run, the runner builds the production context package in a temp directory and
refuses if any case's entry doesn't resolve in it.
- `npm test` covers the harness without a model: the case schema, the grader, the fixtures
and production entry resolution (`packages/daemon/test/eval-*.test.ts`).
## Docker testbed runbooks
`docker/testbed/runbooks/` holds manual procedures, L0 to L6, that you run on a machine with
Docker. They check the testbed image itself:
- L0: resolve the pinned base image and the stub asset list
- L1: PTY allocation
- L2: tmux server lifecycle
- L3: the daemon inside a container, settling a stub rig
- L4: the scenario environment still refuses a foreign daemon target inside a container
- L5: several containers acting as named hosts on one Docker network
- L6: the scenario runner driving a scenario through a container
Use them when you change `docker/testbed/`, `scripts/build-testbed-image.sh` or the
container staging helpers. Ordinary PRs don't need them. They were written before the CI
scenario job and contain internal planning references, so treat them as procedures to adapt,
not as current status.
## Help wanted: command families without a behavioural scenario
> This list may be stale. It was taken from the `rig --help` tree of 0.6.3: 85 visible
> top-level families. At `e8f0ab34`, `packages/cli/src/index.ts` registers 87 top-level
> commands; `roster` and `telemetry` were added since and have no row yet. Before picking one up, check `packages/test-system/scenarios/`, the cases in
> `scripts/run-pr-scenarios.sh`, and the current `rig --help`.
> One scenario doesn't cover a family's every option, sequence or platform. A `--help`
> check only proves the command is discoverable. Existing unit tests are not counted here.
> They exist, but this list is about behavioural scenarios.
Status today: `queue` has partial coverage, namely create, claim and list, plus the claim
surviving a restart. `down` has partial coverage in
`packages/test-system/scenarios/down-stops-every-seat.yaml`: after `rig down`, `rig ps` reports
every seat stopped and the rig still listed. `send` has partial coverage in
`send-renders-in-addressed-pane.yaml` beside it: the envelope and the message body render in
the addressed seat's pane. `transcript` has partial coverage in
`transcript-reads-addressed-seat.yaml`: each of two seats' scripted output is readable through
that seat's `rig transcript --tail 200 --json`. `capture` has partial coverage in
`capture-returns-addressed-seat.yaml`: in a rig whose member names overlap by prefix (`impl`,
`impl2`; `dev-impl`, `dev-impl2` with the pod), `rig capture <seat>` returns each seat's own
pane. The scenario catches a capture that resolves the seat by a prefix match on its member
name (so `dev-impl` also matches `dev-impl2`) and takes the first hit, or any resolver that
returns the same pane for both seats; it does not exercise a prefix match on the full seat
name. All six run with the local runner (`run-scenarios.mjs`). The transcript, capture and daemon
scenarios also run in the CI job, in passing form only; the down, send and up scenarios don't.
They do not prove that panes are gone or that a seat consumed a message. The transcript
case does not establish ordering, uniqueness, sibling-token absence, tail limits or restart
persistence. `up` has partial coverage in `up-relaunch-restores-a-two-seat-team.yaml`: a
two-seat stub team comes up, goes down, and the same spec starts a new team in place of the
stopped one with the same name, exactly two seats, both running, not archived, so a
relaunch that re-records the old seats into the team's row fails on the final `ps` counts.
It does not prove that conversations survive the round trip (that is the `--existing`
restore path), that a seat consumed a message, or that the panes are gone after `down`.
`daemon` has partial coverage in `daemon-restart-preserves-team-identity.yaml`: a two-seat
stub team is up, the runner restarts the scratch daemon, and `rig ps --json` must report the
same name still running with exactly two seats, both running, not archived, so a restart
that loses the team's row, or changes its seat counts or status, fails on the post-restart `ps`;
`rig down` then records it stopped, so the restart left a governable team. It does not prove
that queue items survive the restart (that is `queue-baton-survives-restart.yaml`), that a
kill inside a handoff window is reconciled (that is `kill-daemon-mid-handoff.yaml`), the
port-and-process half of the row, or that the panes are gone after `down`. Everything else
has none.
Before you start, two honest constraints:
- Today's step verbs can't run arbitrary `rig` commands. Many rows below need a runner
binding first. One proposal (not implemented) is a single structured-argv step that runs
the installed CLI through the existing `rigBin`, instead of one new verb per command.
- Rows that need a seat to *answer* (anything with "nonce") depend on the input-consuming
stub described above.
- `expect` has no negative, absence or count form. `match` is a structural subset and
`contains` is a substring, so "the sibling received nothing", "the panes are gone" or "no
duplicates" can't be asserted yet. An exact field value, such as `runningCount: 0` on the
`ps` surface, is the closest available form.
- The `restart` step runs `rig launch <rig> <node> --json` and passes no other flag; the node
is the logical ID (for example `dev.qa`). A stub seat has no resume token. `rig launch` has
no `--fresh` option: a deliberate fresh start of a stub seat after `down` goes through
`rig up --existing <rig> --fresh <seat>` or `rig seat launch <seat> --fresh --reason "<why>"`, so the
`launch` row needs a runner binding to one of those first.
| Group | Family | Proposed first check (observable result) |
|---|---|---|
| lifecycle | `start` | Restore two stopped stub seats. Both answer distinct fresh nonces, and no second daemon starts. |
| lifecycle | `daemon` (partial) | Restart-preserving-the-persisted-team-row is covered by `daemon-restart-preserves-team-identity.yaml`. Next: port and process agreement through public commands, and `stop`, which needs a runner binding. |
| lifecycle | `bootstrap` | Bootstrap a minimal stub spec. Seats come up ready and the selected spec is the one used. |
| lifecycle | `up` (partial) | Relaunch-not-duplicating-identities is covered by `up-relaunch-restores-a-two-seat-team.yaml`. Next: each seat consumes its own send, which needs the input-consuming stub. |
| lifecycle | `down` | (partial) Next: its panes are gone, a sibling rig still answers, retained data follows the docs. |
| lifecycle | `create` | Create a one-seat rig through the public path. It appears and answers without a hand-written topology. |
| lifecycle | `launch` | Fresh, relaunch, resume and fork on provider-shaped fixtures. Correct restored token, one live process. |
| reads | `status` | Two rigs in different states. Status matches their exact identities and transitions. |
| reads | `ps` | Two rigs with overlapping seat names. Rig and node filters return exactly the intended members. |
| reads | `usage` | Deterministic stub telemetry. top and series respect seat and time bounds. Missing data isn't reported as zero. |
| reads | `health` | Known fresh, stale and cleared findings. Scope, explain and diagnosis values match the fixture. |
| continuity | `snapshot` | Snapshot two seats. Rig, membership and snapshot bytes survive a daemon restart. |
| continuity | `restore` | Restore after a daemon and tmux reset. Seat identity and nonce answers survive. |
| continuity | `agent-image` | create/show/pin/unpin/delete for a provider-shaped fixture. References and identity match. |
| continuity | `fork` | Fork at a known history token. The child keeps the prefix with its own identity, and the parent still answers. |
| continuity | `restore-check` | One restorable and one missing transcript. Readiness tells them apart without relaunching. |
| continuity | `restore-packet` | write/read/validate round trip. A malformed packet fails clearly. |
| continuity | `compact-plan` | Scripted history and usage fixtures. Candidates and exclusions match thresholds, and nothing is compacted. |
| continuity | `compact` | Input-driven compact and restore keep the role and token. Messages before and after reach the same seat. |
| continuity | `handover` | Scripted predecessor and successor. Context is delivered before the rebind, and the successor answers. |
| recovery | `crash-cart` | Stop only the scratch daemon. The output names paths and state, and the command changes nothing. |
| recovery | `preflight` | Ready and missing-dependency fixtures produce named checks without launching seats. |
| recovery | `doctor` | Healthy and damaged scratch installs. Exact diagnosis, no automatic repair. |
| recovery | `destroy` | In a disposable scenario HOME only. Removes the intended state and keeps explicitly retained markers. |
| registry | `gateway` | Add, show, update and remove a synthetic human. Reads match exact fields, and removal sticks. |
| registry | `host` | add/list/select/rename isolated entries that resolve to fixture endpoints. Pairing needs two container daemons. |
| coordination | `parked` | An owed item with a stopped worker is reported. A held worker with a live wake is distinguished. |
| coordination | `stream` | emit/list/show/archive an exact item. A restart and a bounded watch keep the order with no duplicates. |
| coordination | `queue` | (partial) Next: handoff, block, resolve and unclaim, each with exact items and destinations. |
| coordination | `project` | Acquire a lease, classify one item twice, read one projection. The wrong holder cannot act. |
| coordination | `view` | Register a view over known items. list/show return the exact filtered result after a mutation. |
| coordination | `watchdog` | Register one short wake, see one response, stop it, prove no further deliveries. |
| coordination | `workflow` | validate/compile/instantiate a tiny flow. It transitions and resumes after a restart with no duplicate queue work. |
| coordination | `chatroom` | send/history/topic/clear in a scratch room. A bounded watcher sees exactly the ordered messages. |
| coordination | `heartbeat` | Known execution-proof and missing-closure fixtures report the right status. Empty output isn't completion. |
| authoring | `export` | Export a stub rig, then validate and re-import it. Membership and configuration are equivalent. |
| authoring | `import` | Import a minimal spec, and the export matches it. Malformed input leaves state unchanged. |
| authoring | `package` | validate/plan/install/rollback in scratch. Installed files and prior state match. |
| authoring | `requirements` | Complete and missing capability fixtures produce the right named requirements. |
| authoring | `bundle` | create/inspect/install a local bundle and round-trip it. A missing asset gives a named failure. |
| authoring | `agent` | Validate a good and a malformed stub AgentSpec. The diagnostic names the bad field. |
| authoring | `spec` | validate/audit/preflight/show a minimal spec, with predictable diagnostics for a malformed field. |
| authoring | `specs` | add/show/preview/rename/remove a library fixture. A missing reference fails explicitly. |
| authoring | `workspace` | validate/doctor known roots plus one missing-frontmatter case. Reports the exact affected path. |
| authoring | `config` | set/get/reset a scratch key and init a workspace. Readback and files match the requested root. |
| presentation | `ui` | Open the URL through a fake browser executable and read a local UI route. Rendering is out of scope. |
| presentation | `tui` | Drive the TUI command bar and socket over two stub rigs. select, mutate and back show exact identities. |
| presentation | `terminal` | open/status/views against a fake terminal-app endpoint. Correct target and layout arguments. |
| adoption | `discover` | One unmanaged and one owned scratch tmux session. Only the intended candidate is discovered. |
| adoption | `attach` | Attach to the intended seat. `whoami` reports it without duplicating the process. |
| adoption | `bind` | Bind one discovered pane. A different, already-occupied identity is refused. |
| adoption | `adopt` | Adopt two scratch sessions. PIDs and history are preserved, and the identities become addressable. |
| adoption | `reconcile-session` | Rebind a hand-resumed provider-shaped fixture without starting or typing into another process. |
| adoption | `unclaim` | Release an adopted seat. The tmux process and its history stay alive. |
| adoption | `release` | Release one rig's claimed sessions. Processes survive, and a sibling rig is unchanged. |
| identity | `archive` | Archive an old same-name generation. The current one stays routable, and the old data is kept. |
| identity | `unarchive` | Unarchive a retained generation without taking over another live seat. |
| identity | `remove` | Remove an archived generation or one member. Only that identity goes, and a reused name still routes. |
| identity | `whoami` | Inside each stub seat, it returns that seat, not a sibling or the caller. |
| identity | `seat` | Status, held-message guard, stop/launch and resume token keep the right process and permissions. |
| integration | `mcp` | Serve against a scratch daemon. One listed tool's value matches CLI state. |
| integration | `slack` | Manifest and config round trip, plus deterministic inbound and outbound fixture requests. No real Slack account. |
| integration | `ask` | Search fixture transcripts via a fake model endpoint. Citations resolve to the stored lines. |
| integration | `file` | Copy a fixture payload through isolated transport endpoints. Verify bytes and paths. |
| integration | `env` | A fixture service-backed rig. status/logs/down reflect that service and stop only it. |
| delivery | `transcript` (partial) | Own scripted output from two addressed seats is covered by `transcript-reads-addressed-seat.yaml`. Remaining: ordering, uniqueness, no other seat's token, tail limits and restart persistence; absence/count assertions need a runner binding. |
| delivery | `send` | (partial) Next: send a fresh nonce and require an answer derived from it. Boot text or echo can't pass. |
| delivery | `capture` | (partial) Each seat's own token, under prefix-overlapping member names. Next: the not-found, tail (`--lines`), sibling-absence and `--rig`/`--pod` cases, which need an error form, a tail option, an absence form and a multi-target surface in the runner. |
| delivery | `broadcast` | Broadcast a nonce to a rig or pod. Each intended seat answers once, and an excluded seat gets nothing. |
| delivery | `walk` | Walk two pieces through an input-consuming stub. Order is kept, and a bad piece isn't reported as delivered. |
| context | `context` | add/get/compose/trace/profile over a fixture project. Output bytes, order and roots match. |
| context | `plugin` | list/show/used-by/validate a fixture plugin. A missing resource is not the same as a valid empty selection. |
| context | `skill` | Resolve and audit a fixture skill, then inspect the projection the consumer actually gets. |
| context | `mode` | set/effective/cite/unset at nested scopes. Precedence holds, and the inherited value returns after unset. |
| context | `startup-proof` | Submit a proof from a real stub identity. Check the stored attribution and the duplicate behaviour. |
| permissions | `policy` | Apply and read an explicit permission selection using a provider-shaped fixture. It survives a restore, and the default is unchanged. |
| accounts | `auth` | Synthetic auth files in scratch: save, list, validate, switch. No provider contact, no real credentials. |
| accounts | `provider` | Synthetic account, binding and signal state. The precheck refuses where it should, and a switch keeps seat history. |
| topology | `expand` | Add a pod to a live stub rig. Old seats survive, and new members answer nonces. |
| topology | `add` | Add one seat. Exact binding, siblings preserved, and the duplicate-name behaviour is explicit. |
| topology | `grow` | Grow two seats. Identities are unique, config is inherited, and existing history is kept. |
| topology | `shrink` | Remove a pod. Unrelated seats still answer, and the removed membership is gone. |
| onboarding | `setup` | Scripted newcomer answers against synthetic providers. No install or login for an unused provider. |
| work | `scope` | Create a mission and a slice. move/progress/notes/graph readback keep identity and paths. |
| work | `proof` | add/judge/show evidence in a fixture scope. Readiness updates without overwriting earlier proof. |
How to make a case useful:
- Assert actual state or content, not just exit code 0. Where ordinary use includes bad
input, add an invalid or missing input case too.
- Reuse the existing runner and the installed CLI. Don't add a second scenario engine.
- If a scenario exposes an existing product bug, keep the failing case and open an issue.
Include the exact source revision, the shortest failing sequence, and the intended versus
observed result. Don't weaken the assertion to make it pass. Keep "the harness setup
failed" separate from "the product misbehaved".
- A check that only covers the success path is still useful. Just don't call it a
regression detector until you have seen its negative case fail.
## Existing docs in this area that are out of date
Read these with care. This page notes them and proposes no changes.
- `packages/test-system/ci/README.md` describes the CI scenario job, except its
"Run one case" section, which still says both cases and six runs; the script runs four cases
and eight containers by default.
- The headers of `transcript-reads-addressed-seat.yaml` and `capture-returns-addressed-seat.yaml`
say "host mode only". Both run in the CI container job, which executes the host-mode pipeline
inside the image.
- `packages/test-system/scripts/README.md` and `packages/test-system/ROUTING.md` are
dependency-routing notes from when the scenarios were first written. Several of the items
they list have since landed. Treat them as history.
- `docker/testbed/runbooks/`: see above. They are manual procedures that predate the CI job.
+2 -2
View File
@@ -11,8 +11,8 @@ applies-when: |
named ui/ module.
siblings: [README.md, codemap.md, architecture.md]
prerequisite-reads: []
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# ui.md was reorganized into the modular as-built tree
@@ -6,12 +6,13 @@ topics: [specification-and-bundles, observability]
domains: [engineering-advisor, product-advisor]
applies-when: |
Need to know how the Library (`/specs`) UI is assembled — the spec/skills/
plugins surfaces, the spec-review + spec-library + live-identity flows that
feed it — or where the canonical visual/design-system spec lives.
plugins surfaces, the spec-review + spec-library flows that feed it, and
how seat details open — or where the canonical visual/design-system spec
lives.
siblings: [shell-and-routing.md]
prerequisite-reads: [../README.md, shell-and-routing.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# UI Library/Specs Surfaces + Design-System Pointer
@@ -20,101 +21,122 @@ The Library destination keeps `/specs` as the route and presents the product
label "Library": specs, applications, context packs, agent specs, agent
images, plugins, and skills.
> Verified against source at HEAD `7eaf524c`; package version **0.3.1**
> (slice-00 §1.1). Component/primitive names below are reconciled against
> `packages/ui/src/components/` at HEAD — NOT taken on trust from `ui.md`'s
> or `DESIGN.md`'s lists.
> Verified against source at `e8f0ab34`; package version 0.6.7. Component and
> primitive names below are reconciled against `packages/ui/src/components/`,
> not taken on trust from `DESIGN.md`'s lists. The web UI is in maintenance
> mode (`docs/reference/developing.md`).
## 1. Library / specs surfaces
Components in `packages/ui/src/components/specs/` (re-confirmed at HEAD):
Components in `packages/ui/src/components/specs/`:
- `SpecsLibraryPage.tsx` — the `/specs` Library page (unified list:
All / Apps / Rigs / Agents; service-backed entries render as `APP`).
- `SpecsTable.tsx`, `SpecsTreeView.tsx` — list + Explorer tree.
- `SkillsIndexPage.tsx`, `SkillDetailPage.tsx` — folder-based skills.
The skill tree treats each skill as a folder; clicking a skill opens a
detail route defaulting to `skill.md` case-insensitively, rendered via the
shared `FileViewer` in the center workspace (no second in-page file
browser — file navigation belongs in the Explorer tree).
- `SpecsLibraryPage.tsx` — the `/specs` Library page (also mounted at
`/specs/applications`): a sectioned grid of Rig Specs, Workspace Specs
(placeholder), Workflow Specs, Context Packs, Agent Specs, Agent Images
and Applications, then full-width Plugins and Skills sections.
Service-backed rigs (`hasServices`) appear under Applications, not Rig
Specs.
- `SpecsTreeView.tsx` — the Explorer tree. (`SpecsTable.tsx` is still in
the folder but nothing imports it.)
- `SkillsIndexPage.tsx`, `SkillDetailPage.tsx` — skills. The Explorer
groups skills into category folders; each skill is a single row, not
expandable into files. Opening a skill goes to a detail route that
defaults to `SKILL.md` (case-insensitive) and renders its own docs
browser: a file tree with breadcrumbs beside a viewer, `MarkdownViewer`
for `.md`/`.mdx`, `SyntaxHighlight` for other text, preformatted text
otherwise. Files come from `/api/skills/:id/files/list` and `/files/read`
(`hooks/useSkillFiles.ts`).
- `PluginsIndexPage.tsx`, `PluginDetailPage.tsx`, `AgentPluginsList.tsx` —
the plugin surfaces.
> Drift-note (slice-00 0.3.0-GT seam a): the plugin primitive is a **0.3.1**
> feature (git-ancestry proven; absent at `v0.3.0`, present at `v0.3.1`). Do
> NOT back-attribute the `/specs/plugins`, `/plugins/$pluginId` routes or
> these plugin components to 0.3.0. `ui.md` (which predates 0.3.x) has **no
> narrative for plugins at all** — these surfaces are authored from source +
> the slice-00 0.3.0-GT seam, not migrated.
Library routes: `/specs`, `/specs/applications`, `/specs/skills`,
`/specs/skills/$skillToken`, `/specs/skills/$skillToken/file/$fileToken`,
`/specs/plugins`, `/plugins/$pluginId`, `/specs/library/$entryId` (see
[`shell-and-routing.md`](shell-and-routing.md) §3).
## 2. Spec review / library / live-identity flows
> The plugin primitive is a **0.3.1** feature (absent at `v0.3.0`, present
> at `v0.3.1`). Do NOT back-attribute the `/specs/plugins`,
> `/plugins/$pluginId` routes or these plugin components to 0.3.0.
These daemon-backed flows feed the Library UI (`architecture.md` §6
"Spec review and spec library flow", "Live identity / specs UI flow",
re-confirmed accurate at HEAD):
## 2. Spec review / library flows and seat details
These daemon-backed flows feed the Library UI:
- **Raw YAML preview:** UI/CLI posts YAML to `/api/specs/review/rig` or
`/api/specs/review/agent`; `SpecReviewService` parses/validates/returns
structured review models; UI renders them through `RigSpecDisplay` /
`AgentSpecDisplay` (the same primitives reused for draft preview, library
review, and live full-details).
review, and live details).
- **Filesystem-backed library:** `SpecLibraryService` scans builtin + user
roots (`packages/daemon/specs`, `~/.openrig/specs`, legacy fallback
`~/.rigged/specs`); each YAML is classified via structured review;
service-backed rigs are marked `hasServices`; `/api/specs/library` serves
list/get/review/sync.
- **CLI mirror:** `rig specs ls/show/preview/add/sync`; `rig specs add`
installs a single YAML spec or a full spec directory; `rig up` /
`rig bootstrap` resolve library names before other source kinds.
- **Live identity:** Explorer/graph selection opens the shared right drawer
(runtime-first node detail: live identity, peers, directional edges,
transcript helpers, compact spec summary); `Open Full Details` navigates to
`/rigs/$rigId/nodes/$logicalId` in the center workspace.
service-backed rigs are marked `hasServices`. Each list request also
merges workflow entries from the workflow-spec cache.
`/api/specs/library` serves list, get, review and sync, plus
`DELETE /:id`, `POST /:id/rename` and GET/POST/DELETE `/active-lens`.
On a non-local host, list and review reads carry `?host=<id>`; the
active lens stays local.
- **CLI mirror:** `rig specs ls/show/preview/add/sync/remove/rename`;
`rig specs add` installs a single YAML spec or a full spec directory;
`rig up` / `rig bootstrap` resolve name-shaped sources through the
library.
- **Seat details:** graph, tree and table clicks navigate to
`/topology/seat/$rigId/$logicalId`, which renders `LiveNodeDetails`
(Overview and Details tabs). The shared drawer no longer has a
seat-detail kind; its kinds are system, log, status, discovery, qitem,
file and sub-spec. The legacy `/rigs/$rigId/nodes/$logicalId` route also
renders `LiveNodeDetails`, but nothing in the UI links to it.
> Source: `packages/daemon/src/routes/spec-library.ts`;
> `packages/ui/src/hooks/useSpecLibrary.ts`; `packages/cli/src/commands/specs.ts`
> (`remove`, `rename`); `packages/ui/src/components/SharedDetailDrawer.tsx`
> (viewer kinds; seat-detail retired).
## 3. UI primitive inventory (reconciled against source)
> Drift-fix — `ui.md` "Design Primitives" (L75–107) omits `ProjectPill`.
> `docs/DESIGN.md` L195 lists it; re-confirmed at HEAD it is a real export
> (`packages/ui/src/components/project/ProjectMetaPrimitives.tsx:196`
> `export function ProjectPill`). Reconciled inventory below is from source,
> not from either doc's list.
- **Vellum/base** (`components/ui/`): `VellumCard`, `VellumSheet`,
`RegistrationMarks`, `StatusPip`, `SectionHeader`, `EmptyState`,
`Button`, `Tabs`, `Table`, form controls, plus `rig-stamp.tsx`
(`RigStamp`) — present at HEAD; not in ui.md's list.
- **Graphics** (`components/graphics/RuntimeMark.tsx`, exports re-confirmed):
`RuntimeMark`, `RuntimeBadge`, `ToolMark`, `ToolBadge`, `ActorMark`,
(`RigStamp`).
- **Graphics** (`components/graphics/RuntimeMark.tsx`): `RuntimeMark`,
`RuntimeBadge`, `ToolMark`, `ToolBadge`, `ActorMark`,
`OperatorMoodMark`; normalization in `lib/runtime-brand.ts` +
`lib/tool-brand.ts`.
- **Project metadata** (`components/project/ProjectMetaPrimitives.tsx`,
exports re-confirmed): `ProjectPill` (`:196`), `EventBadge` (`:224`),
`QueueStateBadge` (`:228`), `TagPill` (`:274`), `ActorChip` (`:283`),
`DateChip` (`:303`), `FlowChips` (`:315`), `ProofThumbnailGrid` (`:334`),
`ProofPacketHeader` (`:380`) — plus `QueueCountIcon` / `StatusDot` (in
source, not in ui.md/DESIGN.md primitive lists).
`lib/tool-brand.ts`. Runtime brands are Claude Code, Codex, Pi ("Pi"),
OMP ("Oh My Pi", short "OMP"), terminal and unknown; `ActorMark` reuses
the runtime marks for recognized runtimes.
- **Project metadata** (`components/project/ProjectMetaPrimitives.tsx`):
`ProjectPill` (`:199`), `EventBadge` (`:227`), `QueueStateBadge` (`:231`),
`TagPill` (`:277`), `ActorChip` (`:286`), `DateChip` (`:306`),
`FlowChips` (`:318`), `ProofThumbnailGrid` (`:337`), `ProofPacketHeader`
(`:383`) — plus `QueueCountIcon` / `StatusDot`.
- **Viewers**: `FileViewer` (`components/drawer-viewers/FileViewer.tsx`),
`MarkdownViewer` (`components/markdown/MarkdownViewer.tsx`),
`ProofImageViewer`, `SessionPreviewPane` (`components/preview/`).
`ProofImageViewer` and `Lightbox` (`components/project/`),
`SessionPreviewPane` (`components/preview/`).
- **Themes** (`lib/theme.ts`): Vellum Light, Vellum Dark and System
(default `system`, following the OS colour scheme), stored under the
`openrig.theme` localStorage key. `applyTheme` toggles a `.dark` class
on `<html>`, which switches to the `.dark` token block in `globals.css`.
`ThemeProvider` is mounted in `main.tsx`, `ThemeSelector` in the
AppShell top bar, and a pre-paint script in `index.html` mirrors the
storage key.
## 4. Design-system pointer (NOT a copy — Q1)
The canonical OpenRig visual/design system is **`docs/DESIGN.md`** (at the
repo `docs/` root, NOT under `docs/as-built/`). Q1 is ratified: DESIGN.md
stays at root, byte-identical, and this module **points to it rather than
copying it**. DESIGN.md is the source for: Vellum-paper vs Black-glass
surface languages, colour tokens (`packages/ui/src/globals.css` +
`tailwind.config.ts`), typography (`font-body` Inter / `font-headline` Space
Grotesk / `font-mono` JetBrains Mono), layout (48px rail + Explorer + center
+ drawer + preview stack), the core-primitive list, the graphics system, and
the interaction/motion/accessibility/do-and-do-not rules.
stays at root (the as-built reorganization left it byte-identical), and this
module **points to it rather than copying it**. DESIGN.md is the source for: Vellum-paper vs
Black-glass surface languages, colour tokens (`packages/ui/src/globals.css`
+ `tailwind.config.ts`), typography (`font-body` Inter / `font-headline`
Space Grotesk / `font-mono` JetBrains Mono), layout (48px rail + Explorer +
center + drawer + preview stack), the core-primitive list, the graphics
system, and the interaction/motion/accessibility/do-and-do-not rules.
> Reconciliation note: DESIGN.md's primitive lists were independently
> verified against `packages/ui/src/components/` at HEAD — every primitive
> DESIGN.md names (Vellum, Graphics, Project-metadata, Topology, Preview)
> resolves to a real export at HEAD. DESIGN.md is accurate and carries no
> slice-00 numeric drift, so it is referenced as-is. Do not duplicate its
> content here; read `docs/DESIGN.md` directly for the visual spec.
> Reconciliation note: every primitive DESIGN.md names (Vellum, Graphics,
> Project-metadata, Topology, Preview) resolves to a real export at the
> stamped commit. Do not duplicate its content here; read `docs/DESIGN.md`
> directly for the visual spec.
## See also
+275 -336
View File
@@ -6,428 +6,367 @@ topics: [observability, coordination]
domains: [engineering-advisor, product-advisor, operating-advisor]
applies-when: |
Need to know how the operator-facing destination surfaces are built —
the For-You attention feed (5-card classifier + verb actions), the
Project workspace/mission/slice scope pages (tabbed rollups), and the
Dashboard landing surface on the vellum brand system. Author-mode
module — ui.md prose for these surfaces predates 0.3.x; every claim is
sourced to file:line at HEAD.
the For-You attention feed (5-card classifier, attention merge, verb
actions), the Project workspace/mission/slice scope pages (tabbed
rollups), and the Dashboard launcher. The web UI is in maintenance mode;
claims are sourced to file and symbol (and line where verified) at the
stamped commit.
siblings: [shell-and-routing.md, ../architecture/mission-control.md]
prerequisite-reads: [../README.md, shell-and-routing.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-07-06
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# UI Project Observability, For You, Dashboard
The three operator-facing destination surfaces: **For You** (`/for-you`,
the attention feed), **Project** (`/project*`, the workspace/mission/slice
scope pages), and the **Dashboard** (`/`, the landing surface on the
vellum brand system). All read live daemon state; none adds UI-local
persistence beyond per-event soft-dismiss.
scope pages), and the **Dashboard** (`/`, the launcher). All read live
daemon state. For You persists two dismissal sets in localStorage; shared
shell preferences include the theme choice (see
[`library-specs-and-design-system.md`](library-specs-and-design-system.md))
and the maintenance-notice dismissal (see
[`shell-and-routing.md`](shell-and-routing.md)).
> **AUTHOR-HEAVY module.** `ui.md`'s Project Observability / For You /
> Graphics-Layer sections are thin and predate the 0.3.1 dashboard/vellum
> brand refresh. Every load-bearing claim carries `> Source: <file:line>
> @HEAD`; ambiguity is declared as an OPEN item, never smoothed. Paths
> are relative to `packages/ui/src/` unless prefixed `docs/`.
>
> Verified at HEAD `7eaf524c` (`git describe` → `v0.3.1-6-g7eaf524c`).
> Package version **0.3.1**; HEAD carries 6 unreleased release-0.3.2
> commits; no `v0.3.2` tag (daemon-core.md; slice-00 §1.1).
> Paths are relative to `packages/ui/src/` unless prefixed `docs/` or
> `packages/`. Verified at `e8f0ab34` (package version 0.6.7). The web UI
> is in maintenance mode (`docs/reference/developing.md`); this page
> records what ships, not a roadmap.
## 0. Release attribution (forensic seam — read first)
## 0. Release attribution (forensic seam)
Re-verified at HEAD via `git cat-file -e <tag>:<path>`:
Checked via `git cat-file -e <tag>:<path>`:
| Layer | Release | Forensic proof @HEAD |
| Layer | Release | Forensic proof |
|---|---|---|
| Project-observability foundation (For-You feed, feed-classifier, project scope pages, the Mission Control 7-verb vocabulary) | **0.3.0** | `v0.3.0:components/for-you/Feed.tsx`, `v0.3.0:lib/feed-classifier.ts`, `v0.3.0:components/project/ScopePages.tsx`, `v0.3.0:components/mission-control/components/VerbActions.tsx` all resolve at `v0.3.0` (slice-00 0.3.0-GT §1.5/§1.6/§1.7) |
| Vellum **brand-identity system** the Dashboard/For-You now render on (`dashboard/vellum/*`: CornerBracket, VellumDestinationCard, marks, graphics, single-source-of-truth barrel) | **0.3.1, NOT 0.3.0** | `git cat-file -e v0.3.0:components/dashboard/vellum/index.ts` → **ABSENT** ("exists on disk, but not in 'v0.3.0'"); `v0.3.1:` → present (slice-00 0.3.0-GT seam (b); §2 rows 1/2) |
| Project-observability foundation (For-You feed, feed-classifier, project scope pages, the Mission Control 7-verb vocabulary) | **0.3.0** | `v0.3.0:components/for-you/Feed.tsx`, `v0.3.0:lib/feed-classifier.ts`, `v0.3.0:components/project/ScopePages.tsx`, `v0.3.0:components/mission-control/components/VerbActions.tsx` all resolve at `v0.3.0` |
| Vellum **brand-identity system** (`dashboard/vellum/*`: CornerBracket, VellumDestinationCard, marks, graphics, barrel) | **0.3.1, NOT 0.3.0** | `git cat-file -e v0.3.0:packages/ui/src/components/dashboard/vellum/index.ts` fails; `v0.3.1:` resolves |
> Source: re-run at HEAD `7eaf524c` —
> `git cat-file -e v0.3.0:packages/ui/src/components/dashboard/vellum/index.ts`
> fails; `v0.3.0:.../for-you/Feed.tsx`, `.../lib/feed-classifier.ts`,
> `.../project/ScopePages.tsx`, `.../mission-control/components/VerbActions.tsx`
> all resolve at `v0.3.0`. Vellum surface *primitives*
> (`components/ui/vellum-*.tsx`) shipped 0.3.0; the coherent vellum
> *brand system* under `dashboard/vellum/` is 0.3.1 — slice-00 0.3.0-GT
> seam (b) is the exact split. **Do not back-attribute the vellum brand
> system to 0.3.0.**
Vellum surface *primitives* (`components/ui/vellum-*.tsx`) shipped 0.3.0;
the brand system under `dashboard/vellum/` is 0.3.1. Do not back-attribute
the brand system to 0.3.0.
## 1. Route reality (source-verified at `routes.tsx`@HEAD — BINDING)
## 1. Route reality
Before narrating any surface, each route was verified at
`packages/ui/src/routes.tsx`@HEAD (542 lines). The Phase-8.1 survey's
"missing route" expectations are grep-derived and partially wrong; this
table is authored from `routes.tsx` reality, not the survey:
Verified at `routes.tsx` (605 lines):
| Path | Reality @HEAD | Component | Source |
| Path | Reality | Component | Source |
|---|---|---|---|
| `/for-you` | **REAL destination route** | `Feed` | `routes.tsx:122-126` |
| `/project` | **REAL destination route** | `WorkspaceScopePage` | `routes.tsx:128-132` |
| `/project/mission/$missionId` | **REAL destination route** | `MissionScopePage` | `routes.tsx:134-138` |
| `/project/slice/$sliceId` | **REAL destination route** | `SliceScopePage` | `routes.tsx:140-144` |
| `/` (index) | **REAL destination route** | `Dashboard` | `routes.tsx:88-92` |
| `/mission-control` | **DELETED `<Navigate to="/for-you">` redirect-stub** | `() => <Navigate to="/for-you">` | `routes.tsx:440-444` |
| `/progress` | **`<Navigate to="/project">` redirect-stub** (folds into Project tabs) | `() => <Navigate to="/project">` | `routes.tsx:463-467` |
| `/slices` | **DELETED `<Navigate to="/project">` redirect-stub** | `() => <Navigate to="/project">` | `routes.tsx:447-451` |
| `/slices/$name` | **`<Navigate to="/project/slice/$sliceId">` redirect-stub** | `useParams` → `<Navigate>` | `routes.tsx:453-460` |
| `/steering` | **`<Navigate to="/project">` redirect-stub** | `() => <Navigate to="/project">` | `routes.tsx:470-474` |
| `/markdown` | **NOT a route** — `MarkdownViewer` is a component used inside `MissionScopePage` | (no route) | grep `routes.tsx`@HEAD: zero `path: "/markdown"` |
| `/` (index) | destination route | `Dashboard` | `routes.tsx:96-100` |
| `/for-you` | destination route | `Feed` | `routes.tsx:130-134` |
| `/project` | destination route | `WorkspaceScopePage` | `routes.tsx:136-140` |
| `/project/mission/$missionId` | destination route | `MissionScopePage` | `routes.tsx:142-146` |
| `/project/slice/$sliceId` | destination route | `SliceScopePage` | `routes.tsx:148-152` |
| `/mission-control` | redirect stub to `/for-you` | `() => <Navigate to="/for-you">` | `routes.tsx:496-500` |
| `/slices` | redirect stub to `/project` | `() => <Navigate to="/project">` | `routes.tsx:503-507` |
| `/slices/$name` | redirect stub to `/project/slice/$sliceId` | `useParams` → `<Navigate>` | `routes.tsx:509-516` |
| `/progress` | redirect stub to `/project` | `() => <Navigate to="/project">` | `routes.tsx:519-523` |
| `/steering` | redirect stub to `/project` | `() => <Navigate to="/project">` | `routes.tsx:526-530` |
| `/markdown` | **not a route** — `MarkdownViewer` is a component | (no route) | no `path: "/markdown"` in `routes.tsx` |
> Source: `routes.tsx:88-92`,`:122-144`,`:440-474` @HEAD; component
> imports `routes.tsx:40-41` (`Dashboard`, `Feed`), `:60-63`
> (`WorkspaceScopePage`/`MissionScopePage`/`SliceScopePage` from
> `components/project/ScopePages.js`) @HEAD.
> Source: component imports `routes.tsx:42-43` (`Dashboard`, `Feed`),
> `:61-65` (`WorkspaceScopePage`/`MissionScopePage`/`SliceScopePage` from
> `components/project/ScopePages.js`).
> **Route-reality contract (slice-08 §10.7):** the **Mission Control
> *system*** lives at daemon/PL-005 (see `../architecture/mission-control.md`)
> — `/mission-control` is **NOT a UI destination**; it is a deleted
> redirect-stub (SC-18). The 7-verb *action vocabulary* surfaces in this
> module via `VerbActions` embedded in For-You cards, but the system
> itself is not this module's subject. `/progress`, `/slices`,
> `/steering` all fold into `/project` tabs — they are redirect-stubs,
> not surfaces to narrate.
The review altitudes `/agents` (`RigAgentsPage`) and `/fleet` (`FleetPage`)
are listed in [`shell-and-routing.md`](shell-and-routing.md).
> **Route-reality contract:** the **Mission Control *system*** lives in the
> daemon (see `../architecture/mission-control.md`); `/mission-control` is
> a redirect stub, not a UI destination. The 7-verb *action vocabulary*
> surfaces here via `VerbActions` in For-You cards. `/progress`, `/slices`
> and `/steering` fold into `/project` tabs.
## 2. For You — the attention feed (`/for-you` → `Feed`)
`Feed` is the operator's attention surface: a chronologically-sorted,
subscription-filtered, soft-dismissable card stream over the live
activity feed. Header reads `Attention` / `For You`; max width 720px.
`Feed` is the operator's attention surface: decision cards first, then the
rest newest-first, subscription- and lens-filtered and soft-dismissable.
Header reads `Attention` / `For You`; max width 720px. A plain-language
`LevelControl` (All activity / Highlights / Needs you) sits at the top of
the feed over the same subscription toggles.
> Source: `components/for-you/Feed.tsx:364-369` (`data-testid="for-you-feed"`,
> max-w-720 + `For You` header), feed-centerpiece design note `:3-12`
> (PRIMARY UX = the feed; subscriptions NOT dominating — LOAD-BEARING
> SC-16) @HEAD.
> Source: `components/for-you/Feed.tsx` (`data-testid="for-you-feed"`,
> max-w-720 header; `LevelControl` in `feed-level-control`; design note
> `:3-12`); `lib/feed-levels.ts` `FEED_LEVEL_LABELS`.
### 2.1 The 5-card classifier (0.3.0 spine)
`classifyFeed(events)` maps every `ActivityEvent` to exactly one of five
`classifyFeed(events)` maps every `ActivityEvent` to one of five
`FeedCardKind` values — `action-required`, `approval`, `shipped`,
`progress`, `observation` — then sorts by `receivedAt` descending.
**Nothing is silently dropped**: any unmatched event type falls through
to `observation`. Queue-visibility events are sub-classified by
`queueKind(type, state)` (e.g. `*.closed` → shipped; `human-gate` /
`pending-approval` → action-required; `closeout-pending-ratify` →
approval); a human-seat destination forces `action-required`.
`progress`, `observation` — sorted by `receivedAt` descending. **Nothing is
silently dropped**: an unmatched event type falls through to
`observation`. Queue events are sub-classified by
`queueKind(type, state, tier)`: `*.closed` → shipped;
`qitem.closure_overdue` / `inbox.denied` → action-required; tier
`human-gate` → **approval**; state `pending-approval` → action-required;
`closeout-pending-ratify` → approval; `done|closed|completed|shipped` →
shipped; otherwise progress. A human-seat destination forces
`action-required` unless the card is already an approval.
> Source: `lib/feed-classifier.ts:9-14` (`FeedCardKind` union),
> `classifyEvent` `:145-218` (default-observation fallthrough L216-217),
> `queueKind` `:93-110`, `classifyFeed` `:220-223` (receivedAt-desc sort),
> `isHumanSeat` `:141-144` @HEAD.
> Source: `lib/feed-classifier.ts` — `FeedCardKind` `:10-15`, `queueKind`
> `:105-129`, `isHumanSeat`, `classifyEvent` (approval-preserving
> human-seat override; default-observation fallthrough), `classifyFeed`,
> `sortFeedByDecisionBand`.
The feed pipeline (`Feed.tsx`): `classifyFeed` → cap at
`HISTORY_LIMIT = 50` → hydrate each card's kind from the live queue-item
map + action-audit (`hydratedCardKind`: a recorded outcome on an
action/approval card → `approval`; a `done|closed|completed` qitem →
`shipped`) → **subscription filter** (`isCardKindSubscribed` against the
5 `feed.subscriptions.*` config keys; `action-required` is always
visible, `observation` only when the audit subscription is on) → the
transient **lens-chip** filter (All / Action req / Approvals / Shipped /
Progress / Audit; not persisted) → per-event-seq soft-dismiss filter.
### 2.2 The feed pipeline
> Source: `components/for-you/Feed.tsx:63` (`HISTORY_LIMIT = 50`),
> `:238` (`classifyFeed(events).slice(0, HISTORY_LIMIT)`),
> `hydratedCardKind` `:156-180`, subscription+lens+dismiss pipeline
> `:269-285` (subscription FIRST L280-282; lens L283; dismiss L284),
> `LENS_CHIPS` `:54-61` @HEAD;
> subscription forced/default rules `Feed.tsx:3-12` (action_required
> forced ON L9; observation gated on audit_log L10) @HEAD.
1. **Event cards:** `classifyFeed(events)` capped at `HISTORY_LIMIT = 50`.
2. **Attention merge:** daemon attention rows (`useAttentionItems(50, …)`:
`GET /api/queue/list?attention=1…`, or `GET /api/queue/attention-aggregate`
when a remote host subscription is on) and needs-input seats
(`useNeedsInputSeats`) become cards, and `mergeAttentionIntoFeed` lets a
queue-derived card supersede a matching event-derived **action-required
or approval** card; shipped, progress and observation event cards for the
same qitem remain.
3. **Decision-band sort:** `sortFeedByDecisionBand` lifts every
action-required and approval card above the rest, newest-first within
each band.
4. **Hydration:** `hydratedCardKind` re-reads each card against the live
queue item and the action audit: a recorded outcome on an
action/approval card → `approval`; tier `human-gate` → `approval`; a
`done|closed|completed` item → `shipped`; a human-seat destination →
`action-required`.
5. **Filters, in order:** subscription (`isCardKindSubscribed`;
`action-required` always visible, `observation` only with the audit
subscription), the transient lens chips (All / Action req / Approvals /
Shipped / Progress / Audit), a per-host filter, then dismissal.
Event cards dismiss by event seq (`forYou.dismissedSeqs`); queue-derived
cards dismiss by card id (`forYou.dismissedCardIds`); both are
localStorage-backed.
### 2.2 Queue-item hydration + proof previews
> Source: `components/for-you/Feed.tsx` — `LENS_CHIPS` `:60-67`,
> `HISTORY_LIMIT` `:69`, `hydratedCardKind` `:167-186`, attention merge and
> sort `:244-276`, dismiss hooks `:285`/`:294`, filter pipeline `:334-356`;
> `hooks/useAttentionItems.ts`, `hooks/useNeedsInputSeats.ts`,
> `lib/attention-feed.ts` (`mergeAttentionIntoFeed`, `attentionKindFor`),
> `hooks/useDismissedSeqs.ts`, `hooks/useDismissedCardIds.ts`.
For cards carrying a `qitemId` payload, `useQueueItemMap` hydrates the
full queue-item body; for `shipped` cards `sliceForCard` matches a slice
by tag/text and `proofPreviewForSlice` pulls the first proof packet with
screenshots so the card renders an inline `ProofThumbnailGrid` →
`ProofImageViewer`. This is the slice-00 §1.5 "queue cards hydrate qitem
bodies + proof previews" foundation, live-wired.
With one or more remote host subscriptions enabled, the feed shows host
chips and status rows, cards carry a host chip, and verbs forward the
card's `hostId` (`Feed.tsx` host filter; `hooks/useFeedSubscriptions.ts`
key `feed.subscriptions.<hostId>.enabled`; `VerbActions.tsx`).
> Source: `components/for-you/Feed.tsx:263` (`useQueueItemMap`),
> `sliceForCard` `:182-201`, `proofPreviewForSlice` `:203-213`,
> per-card proof wiring `:421-427`; `FeedCard.tsx` proof block
> `:453-471` (`ProofPacketHeader`+`ProofThumbnailGrid`),
> `ProofImageViewer` `:521` @HEAD.
### 2.3 Queue-item hydration + proof previews
### 2.3 Verb actions on action/approval cards (the 7-verb system; OPEN-3)
For cards carrying a `qitemId`, `useQueueItemMap` hydrates the queue item;
for `shipped` cards `sliceForCard` matches a slice by tag/text and
`proofPreviewForSlice` pulls the first proof packet with screenshots, so
the card renders an inline `ProofThumbnailGrid` → `ProofImageViewer`.
An actionable card (`action-required` or `approval`, no recorded
outcome, non-terminal qitem) embeds `VerbActions`. The **canonical
Mission Control action vocabulary is the 7-verb system** —
> Source: `components/for-you/Feed.tsx` (`useQueueItemMap`,
> `sliceForCard`, `proofPreviewForSlice`); `FeedCard.tsx` proof block and
> `<ProofImageViewer>`.
### 2.4 Verb actions on action/approval cards
The **canonical Mission Control action vocabulary is the 7-verb system** —
`MISSION_CONTROL_VERBS = [approve, deny, route, annotate, hold, drop,
handoff]` — defined at the Mission Control system level (slice-00
0.3.0-GT §1.6/seam (c): the vocabulary *originates in 0.3.0 source*).
handoff]`. `VerbActions` defaults to all seven
(`enabledVerbs = [...MISSION_CONTROL_VERBS]`); route/handoff need a
destination, annotate an annotation, hold/drop a reason.
> Source: `components/mission-control/hooks/useMissionControlAction.ts:5-15`
> (`MISSION_CONTROL_VERBS` 7-element const `:5-13` + `MissionControlVerb`
> type `:15`), `components/mission-control/components/VerbActions.tsx:82`
> (defaults to all 7 via `enabledVerbs = [...MISSION_CONTROL_VERBS]`),
> per-verb input needs `:97-99` (route/handoff→destination L97;
> annotate→annotation L98; hold/drop→reason L99) @HEAD; slice-00
> 0.3.0-GT §1.6 + seam (c).
> Source: `components/mission-control/hooks/useMissionControlAction.ts:5-15`;
> `components/mission-control/components/VerbActions.tsx` (`enabledVerbs`
> default `:108`).
> **OPEN-3 RESOLVED (v0.4.4 living-notes corrective, founder ruling
> N-1, 2026-07-05).** The For-You actionable-card surface is **bare
> one-tap APPROVE + CHAT — nothing else**. `FeedCard` passes
> `enabledVerbs={["approve"]}` + `oneClickVerbs={["approve"]}` + the
> v0.4.4 `bare` prop (JSX-only: skips the "Choose response" header
> chrome; the mutation/receipt/error paths are byte-identical — pinned
> by a raw-body test), beside a CHAT button that opens the **shared
> `ProgressiveTerminal`** seeded via `buildChatPreamble` (terminal,
> never a chat panel — BR-12). Deny/route are RETIRED from this
> surface (including the action-required lens's empty-state copy:
> "one-tap approve and chat with the owning agent"); the card-level
> kind tag is the status label "Action required", never instruction
> chrome. The 7-verb vocabulary above remains the MISSION-CONTROL
> system-level vocabulary; For-You offers the two-action subset.
>
> Source @`bb5ad219`: `FeedCard.tsx:547-593` (bare `VerbActions`
> `enabledVerbs=["approve"]` :561-566 + chat button + inline
> `ProgressiveTerminal`), `:87-94` (`resolveCardTerminalSession` —
> human-action cards chat with the SENDER), `Feed.tsx:76-82`
> (`EMPTY_COPY["action-required"]`), `VerbActions.tsx` (`bare` prop),
> `review/chat.ts:21` (`buildChatPreamble`); tests
> `test/foryou-bare-approve-chat.test.tsx` (byte-identical mutation +
> chatBtns:1/denyRoute:0 + retired-copy source-scan).
**The For-You actionable-card surface is bare one-tap APPROVE + CHAT.**
`FeedCard` passes `bare`, `enabledVerbs={["approve"]}` and
`oneClickVerbs={["approve"]}`, beside a CHAT button that opens the shared
`ProgressiveTerminal` seeded via `buildChatPreamble` (human-action cards
chat with the sender). Deny/route are not offered here, and the
action-required empty state reads "one-tap approve and chat with the
owning agent". The 7-verb vocabulary remains the Mission Control
system-level vocabulary.
> Source: `components/for-you/FeedCard.tsx:558-570` (`bare` `:561`,
> `enabledVerbs` `:563`, `oneClickVerbs` `:564`),
> `resolveCardTerminalSession`; `Feed.tsx:76-82` (`EMPTY_COPY`);
> `review/chat.ts:21` (`buildChatPreamble`); test
> `test/foryou-bare-approve-chat.test.tsx`.
On mutation success `VerbActions` fires `onOptimisticOutcome`; `Feed`
keeps an optimistic-outcome map keyed by `qitemId` so the
`ActionOutcomePanel` receipt renders instantly without waiting for the
audit-log re-fetch (the audit re-fetch eventually surfaces the same
shape). A terminal qitem with no recorded outcome derives a fallback
receipt from its closure reason.
`ActionOutcomePanel` receipt renders before the audit re-fetch. A terminal
qitem with no recorded outcome derives a fallback receipt from its closure
reason. Card footers also carry a "show context" queue-item trigger, a
terminal drill, the evidence reference, and a "review →" link to the
slice's Review tab.
> Source: `components/for-you/Feed.tsx:224-236` (optimistic-outcome
> map + `setOptimisticOutcome`), `:426-428` (optimistic-first, audit
> fallback: `optimisticOutcomes.get ?? actionOutcomes.get ?? null`);
> `FeedCard.tsx:473-500` (`isActionableCard` gate L473 + `VerbActions`
> wiring L489-499), `isActionableCard` `:166-175`,
> `fallbackOutcomeFromQueueItem` `:177-198`, `ActionOutcomePanel`
> `:271-310`; `VerbActions.tsx:138-145` (`onOptimisticOutcome` on
> mutation `onSuccess`) @HEAD.
> Source: `Feed.tsx` (optimistic map; optimistic-first lookup);
> `FeedCard.tsx` (`isActionableCard`, `fallbackOutcomeFromQueueItem`,
> `ActionOutcomePanel`, `QueueItemTrigger`, `FeedCardTerminalDrill`).
### 2.4 Card surface — vellum-coherent (0.3.1 brand layer)
### 2.5 Card surface (0.3.1 brand layer)
`FeedCard` renders on the **0.3.1 vellum brand system**: a
`bg-stone-100/45 backdrop-blur` surface with a 3-stop ambient box-shadow
(no border), four `CornerBracket` marks registering the bounds through
the vellum, a mono-uppercase kind tag + colored dot, and runtime
graphics marks (`ActorMark` for sessions) — the slice-00 §1.7 "shared
graphics marks across drawers / proof rows / queue refs / story rows"
foundation, now expressed in the matured vellum vocabulary. Cards are
keyboard-dismissable (Backspace/Delete) and swipe-dismissable, with an
`UndoToast`.
`FeedCard` renders a `bg-surface-low/45 backdrop-blur-[10px]` surface with
a 3-stop ambient box-shadow (no border), four `CornerBracket` marks, a
mono-uppercase kind tag with a tone-coloured icon (a dot only when a kind
has no icon), and `ActorMark` runtime marks. Cards dismiss by keyboard
(Backspace/Delete) or swipe, with an `UndoToast`.
> Source: `components/for-you/FeedCard.tsx:72-73` (`CARD_SURFACE_CLASS`),
> `:74-80` (`CARD_SHADOW_STYLE` 3-stop box-shadow), corner brackets
> `:401-404` (4× `<CornerBracket position=…>`), `KIND_DOT` `:33-39`,
> kind tag span `:410-414`, `ActorMark` import `:25` + usage `:229`;
> `CornerBracket` from the 0.3.1 brand barrel
> `dashboard/vellum/index.ts:17`; slice-00 0.3.0-GT seam (b) + §1.7 @HEAD.
> Source: `components/for-you/FeedCard.tsx` — `CARD_SURFACE_CLASS`
> `:108-109`, `CARD_SHADOW_STYLE`, `KIND_TOKEN`, corner brackets
> `:452-455`, `ActorMark` `:265`; `CornerBracket` from
> `dashboard/vellum/index.ts`.
### 2.5 Storytelling preview band
Above the legacy card list `Feed` renders a `StorytellingFeed` preview
built by `buildStorytellingFeedItems` from discovered missions
(`useMissionDiscovery` → `ProgressCard`, first 2) + slices
(`useSlices` → `ShippedCard` for shipped/done, `IncidentCard`
otherwise, capped at 3). Mission rows carry a daemon-derived
`status` so the "Getting Started"-style complete-and-hide filters
durably (`status === "complete"`), with an optimistic local hide +
best-effort `POST /api/missions/:id/complete` audit write that swallows
network errors so a partial-air-gapped daemon does not block the hide.
> Source: `components/for-you/Feed.tsx:319-343` (mission/slice adapters:
> `useMissionDiscovery` L319, `missionsWithStatus` L329-335,
> `buildStorytellingFeedItems` L336-343; adapter comment L305-318),
> `handleMarkMissionComplete` `:351-361` (best-effort `void fetch` L354,
> error-swallowed L357), preview render `:399-409`;
> `components/feed/cards/storytelling-cards.tsx:36` (`CardKind`),
> `ShippedCard` `:184`, `IncidentCard` `:235`, `ProgressCard` `:289`
> @HEAD.
The 0.3.1 storytelling preview band is **gone**: `Feed.tsx:375-380` records
its removal. The `components/feed/cards/storytelling-cards.tsx` primitives
remain for the `/lab/card-previews` gallery. No UI code calls
`POST /api/missions/:id/complete` any more; the daemon route still exists
(`packages/daemon/src/routes/missions.ts`).
## 3. Project — workspace / mission / slice scope pages (0.3.0 spine)
`/project*` mounts three scope pages, all built on a shared
`ScopeShell` + tabbed-rollup pattern (slice-00 §1.5 project
observability foundation). A `SHARED_TABS` set —
`overview / story / progress / artifacts / tests / queue / topology` —
drives `WorkspaceScopePage` and `MissionScopePage`; `SLICE_TABS`
reorders `story` first for `SliceScopePage` but `SliceScopePage`'s
`useState` default is `overview` (README + readiness first, not a
metric grid).
`/project*` mounts three scope pages on a shared `ScopeShell` +
`TabNav` tabbed pattern. Tab sets:
> Source: `components/project/ScopePages.tsx:75-76` (`SharedTab` /
> `SliceTab` types), `SHARED_TABS` `:78-86`, `SLICE_TABS` `:88-96`,
> `ScopeShell` `:137-166`, `TabNav` `:98-135` @HEAD.
| Page | Tabs | Default |
|---|---|---|
| `WorkspaceScopePage` | `SHARED_TABS`: Overview, Story, Progress, Artifacts, Proof, Queue, Workflow (`topology`) | `overview` |
| `MissionScopePage` | `MISSION_TABS`: Overview, Steering, Review, Story, Progress, Artifacts, Proof, Queue, Workflow | `steering` |
| `SliceScopePage` | `SLICE_TABS`: Review, Story, Overview, Progress, Artifacts, Proof, Queue, Workflow | `review` |
> Source: `components/project/ScopePages.tsx` — `SharedTab`/`SliceTab`
> `:83-84`, `SHARED_TABS` `:86-94`, `MISSION_TABS` `:98-110`, `SLICE_TABS`
> `:112-123`, `TabNav`, `ScopeShell`; defaults `useState` at `:698`,
> `:798`, `:1226`.
Off the local host, the workspace and mission headers show an `ON <host>`
chip (the slice header does not), the Review tab is local-only, and
file-backed sections explain why local files are not shown.
### 3.1 WorkspaceScopePage (`/project`)
Reads the live workspace name (`useWorkspaceName`); honest empty-state
(`NO WORKSPACE CONNECTED` with an Open-settings action) when unset. The
`overview` tab renders `WorkspaceOverviewPanel`: slices grouped into
missions, then `partitionProjectMissions` splits them into a
two-column **Current Work / Archive** layout (slice-00 §1.5
"current/archive grouping"). Each mission card lists its slices as
`Link`s to `/project/slice/$sliceId` with a `QueueCountIcon` +
`StatusDot`. The other tabs are the scope rollups (§3.4).
Reads the live workspace name; honest empty state (`NO WORKSPACE
CONNECTED` with an Open-settings action) when unset. Tabs: Overview →
`WorkspacePortfolioPanel`; Story/Progress/Artifacts/Proof/Queue → the
scope rollups (§3.4); Workflow → `HostMultiRigGraph`.
(`WorkspaceOverviewPanel`, the older Current Work / Archive grid, is still
defined but not rendered.)
> Source: `components/project/ScopePages.tsx:676-749` (`WorkspaceScopePage`;
> no-workspace empty-state guard `:682-693`, `workspace-scope-no-workspace`
> `:689`), `WorkspaceOverviewPanel` `:534-674` (mission bucketing
> `:536-551`, `partitionProjectMissions` `:552`, two-column panel `:631`,
> Current section `:632-651`, Archive section `:652-671`) @HEAD.
> Source: `ScopePages.tsx` `WorkspaceScopePage` (no-workspace guard;
> `WorkspacePortfolioPanel` `:745`; `HostMultiRigGraph` `:788`).
### 3.2 MissionScopePage (`/project/mission/$missionId`)
Same `ScopeShell`/`SHARED_TABS`. `overview` renders the mission README
(`useScopeMarkdown(missionPath, "README.md")` via `MarkdownViewer`)
above a slice rail; `progress` renders a `MissionProgressHeatmap` + the
mission `PROGRESS.md` + the shared `ScopeProgressRollup`. The `topology`
tab renders the **projected workflow spec graph** via `TopologyTab`
when the mission's README frontmatter declares a `workflow_spec` that is
in the `WorkflowSpecCache` (daemon returns `topology.specGraph`),
falling back to session-name aggregation otherwise.
Lands on **Steering** (`SteeringTab`). Review → `MissionReviewTab` (§3.5).
Overview renders the mission README (`MarkdownViewer`) above a slice rail.
Progress renders `MissionProgressHeatmap` plus the mission `PROGRESS.md`
(the per-slice rollup cards were removed). Artifacts → `ArtifactsNavigator`;
Proof → `ScopeProofRollup`. Workflow renders the **projected workflow
spec graph** via `TopologyTab` when the mission README declares a
`workflow_spec` that is in the workflow-spec cache (the daemon returns
`topology.specGraph`), otherwise `ScopeTopologyRollup`.
> Source: `components/project/ScopePages.tsx:751-895` (`MissionScopePage`;
> `useMission` `:759`, `missionPath` `:760-761`, README/PROGRESS
> markdown `:762-763`, overview README section `:775`, progress
> heatmap `:832`, `mission-progress-readme` `:838`, spec-graph topology
> branch `:875-891` — `missionTopology` `:875`, `specGraph` check
> `:879`, session-name fallback `:890`) @HEAD.
> Source: `ScopePages.tsx` `MissionScopePage` (`SteeringTab` `:834`,
> `MissionReviewTab` `:843`, `MissionProgressHeatmap` `:906`,
> rollup-cards removal note `:979-983`, `ArtifactsNavigator` `:990`,
> spec-graph branch `:1010-1036`).
### 3.3 SliceScopePage (`/project/slice/$sliceId`)
Default tab `overview` (`SliceOverviewTab` — README + current step +
readiness). Loading/error states are honest empty-states (the error
state names `rig config get workspace.slices_root` as the likely
misconfiguration). `progress` folds in `AcceptanceTab` (acceptance is
the canonical slice-scope progress proof); `story` renders `TimelineTab`
with curated `timeline.md` (`useSliceTimelineMarkdown`) above the
auto-captured event feed; `topology` renders the slice's
workflow-instance-aware `TopologyTab`; **`review` (v0.4.4) renders the
Living Notes `SliceReviewTab`** (§3.5).
Lands on **Review** (`SliceReviewTab`, §3.5). Overview →
`SliceOverviewTab` (a 4-metric summary — status, progress, qitems, last
activity — then the README). Story → `ScopeStoryRollup` (the queue-lineage
story graph). Progress → `AcceptanceTab`. Artifacts → `ArtifactsNavigator`;
Proof → `SliceProofTab`; Queue → `SliceQueueTab`; Workflow → `TopologyTab`.
Loading and error states are honest (the error names
`rig config get workspace.slices_root` as the likely misconfiguration).
> Source: `components/project/ScopePages.tsx:1187-1297` (`SliceScopePage`;
> default `overview` `:1192`, timeline md `:1204`, loading-state
> guard `:1206`, error-state guard `:1225` (slices_root remediation
> hint `:1239`), story=`TimelineTab` `:1258-1265`,
> progress=`AcceptanceTab` `:1269-1273`, topology `:1294`) @HEAD.
> Source: `ScopePages.tsx` `SliceScopePage` (`SliceReviewTab` `:1307`,
> `ScopeStoryRollup` `:1317`, `SliceOverviewTab` `:1325`, `AcceptanceTab`
> `:1354`, `ArtifactsNavigator` `:1363`, `SliceProofTab` `:1366`,
> `TopologyTab` `:1379`, slices_root hint `:1276`), `SliceOverviewTab`
> summary grid `:1157-1162`.
### 3.4 Shared scope rollups
`ScopeStoryRollup`, `ScopeProgressRollup`, `ScopeArtifactsRollup`,
`ScopeTestsRollup`, `ScopeQueueRollup`, `ScopeTopologyRollup` (the
non-overview tabs) all read from one `useProjectScopeRollup(missionId,
loadDetails)` hook so workspace and mission scopes share identical
rollup behavior over their respective slice sets — the slice-00 §1.5
"workspace/mission rollups" foundation. Detail fetching is gated on the
active tab (`active !== "overview"`) so the overview path stays cheap.
`ScopeQueueRollup` and `ScopeTopologyRollup` read from one
`useProjectScopeRollup(missionId, loadDetails)` hook so workspace and
mission scopes share rollup behavior; `ScopeProofRollup`
(`project/ProofTab.tsx`) covers Proof. Detail fetching is gated on the
active tab (`active !== "overview"` for the workspace;
`active !== "overview" && active !== "steering"` for a mission).
> Source: `components/project/ScopePages.tsx:198-217`
> (`useProjectScopeRollup`; `rowsForScope` `:193-196`),
> rollup components `:219-532`; gate `:679`,`:754` (`active !== "overview"`)
> @HEAD.
> Source: `ScopePages.tsx` `useProjectScopeRollup`, rollup components,
> gates `:700`, `:803`.
### 3.5 Review tabs (v0.4.4 — the Living Notes surface)
### 3.5 Review tabs (the Living Notes surface)
Both the slice and mission scope pages mount a `Review` tab
(`SLICE_TABS`/mission tabs, `ScopePages.tsx:99-113`). The slice tab
(`review/SliceReviewTab.tsx`) renders the ONE reviewable structure per
slice — bands in order **NEEDS YOU → AGENTS → INTENT / PLAN / DELIVERED →
verify-lineage → SETTLED** — from `GET /api/review/slice/:name`
(`hooks/useReview.ts`):
The slice tab (`review/SliceReviewTab.tsx`) renders one reviewable
structure per slice — bands in order **NEEDS YOU → AGENTS → INTENT / PLAN
/ DELIVERED → verify-lineage → SETTLED** — from `GET /api/review/slice/:name`
(`hooks/useReview.ts`), with a proof-readiness status line and a defects
box above NEEDS YOU:
- **DELIVERED** pairs each planned deliverable with its curated proof down
the column (planned mockup above delivered artifact), media inline at text
height expanding on tap one-at-a-time (`?item=` deep link); `verified`
renders QA's recorded comparison in plain words (✓ QA-verified · ◇
unverified · ✗ missing + QA's note) — visible, never blocking. "See all
proof" drills into `proof/`.
- **Media actually plays**: video renders inline with native controls
(`?seek`/`?play` deep links for capture verification); images open the
shipped `Lightbox`; evidence and the "full PRD →" door open the shipped
`FileViewer` in the shared **right-edge** drawer (the v0.4.4 corrective
reverted the FR-11.1 left flip at its three tokens).
- **Two locks** (§4 of the architecture module) render as deliberate stamps:
plan-lock in PLAN, both stamps in SETTLED; an unaudited stamp renders
loudly as UNVERIFIED.
- Review cards ride ONE vellum recipe (`review/vellum.ts` —
background-matched translucency + backdrop blur, token-driven for both
themes); DELIVERED rows stack vertically below the `sm` breakpoint
(phone-first single-column scan).
- **DELIVERED** pairs each planned deliverable with its curated proof,
media inline and expanding one at a time (`?item=` deep link). Without a
configured readiness policy, `verified` renders as `✓ legacy QA-verified
(item revision unbound)` · `◇ unverified — no PASSING QA comparison` ·
`✗ missing — promised, nothing delivered`; with one, as `✓ accepted under
selected policy` / `◇ current acceptance absent`. A note renders as
"Judgment note:". Visible, never blocking. "See all proof" drills into
`proof/`.
- **Media plays**: video inline with native controls (`?seek`/`?play` deep
links); images open `Lightbox`; evidence and the "full PRD →" door open
`FileViewer` in the shared right-edge drawer.
- **Two locks** render as stamps: plan-lock in PLAN, both stamps in
SETTLED; an unaudited stamp renders as UNVERIFIED.
- Review cards share one vellum recipe (`review/vellum.ts`); DELIVERED rows
stack below the `sm` breakpoint.
- The mission tab (`review/MissionReviewTab.tsx`) is board-first: stage
cells from the collapsed contract, the completion ledger, cut-complete,
and a U5 row expansion reading the SAME contract (intent verbatim + a
bounded per-item verified summary; the full pairing lives on the slice
page). The rig altitude (`review/RigAgentsPage.tsx`) reads
`GET /api/review/rig`.
cells, the completion ledger, cut-complete, and a row expansion reading
the same contract. The rig altitude (`review/RigAgentsPage.tsx`, route
`/agents`) reads `GET /api/review/rig`.
Backend contract + composition: see
Backend contract: see
[`../architecture/living-notes-review.md`](../architecture/living-notes-review.md).
> Source @`bb5ad219`: `components/review/{SliceReviewTab,MissionReviewTab,
> Source: `components/review/{SliceReviewTab,MissionReviewTab,
> NeedsYouAccordion,AgentsBandView,VerifyLineageCard,EvidenceOpener,
> RigAgentsPage}.tsx`, `review/vellum.ts`, `hooks/useReview.ts`,
> `SharedDetailDrawer.tsx` (right-edge anchor + pre-flip z);
> tests `test/{fileviewer-resolvable-target,drawer-primitives}.test.tsx`.
> The rejected three-column compare and the separate item-join table are
> DELETED files (corrective delete-not-demote; zero references remain).
> `SharedDetailDrawer.tsx`; verified labels `SliceReviewTab.tsx:131-135`,
> `:164`, `:194`.
## 4. Dashboard — the landing surface (`/` → `Dashboard`)
## 4. Dashboard — the launcher (`/` → `Dashboard`)
`Dashboard` is a thin composition over the **0.3.1 vellum brand
system**: it imports `MidLayerContent`, `TopLayerContent`,
`DestinationsLayer` from `dashboard/vellum/index.js` — the SAME barrel
`/lab/vellum-lab` imports, so the production dashboard tracks the design
lab exactly (single source of truth). Real-data wiring: `useRigSummary`
→ totalRigs/totalAgents, `usePsEntries` → activeAgents, `useSpecLibrary`
→ librarySize, `window.location.hostname` → classification eyebrow. Per
a 2026-05-15 founder dispatch the heavy `BackLayerContent` /
`BackVellumSheet` back-layer was removed so the dashboard sits on the
page-level cream paper-grid; the barrel still exports them (used by the
lab).
`Dashboard` is the paper-draft launcher (OPR.0.4.1.14). It renders, in
order: a header with the station online state; `FieldEnvironment` (live
rows: RIGS from `useRigSummary`, AGENTS as the sum of `nodeCount` from
`usePsEntries`, STATION from `window.location.hostname`, OPERATOR ID from
the `agents.operator_session` setting with an `OPERATOR` fallback, and
VERSION from `useDaemonVersion` via `/api/health-summary/version`);
`KernelStatusCard` (from `/api/kernel/status`); `HostConfigCard`; a grid of
six destinations (Topology, Project, For You, Library, Search & Audit,
Settings); and `DashboardFooter`. Its glyphs come from
`dashboard/vellum/fidelity-glyphs.js`.
> Source: `components/dashboard/Dashboard.tsx:1-52` (vellum-barrel
> import `:12-16`, single-source-of-truth note `:2-5`, real-data hooks
> `:29-39`, back-layer-removal note `:21-27`, render `:40-50`);
> `components/dashboard/vellum/index.ts:1-26` (barrel; `BackLayerContent`
> `:5` / `BackVellumSheet` `:6` still exported); slice-00 0.3.0-GT
> seam (b) + §2 rows 1/2 @HEAD.
The vellum barrel `dashboard/vellum/index.ts` still exports
`BackLayerContent` and `BackVellumSheet`; `/lab/vellum-lab`
(`lab/VellumLab.tsx`) imports from it.
> Source: `components/dashboard/Dashboard.tsx` (header comment `:1-24`,
> glyph import, `DESTINATIONS`, data wiring, render order);
> `hooks/useDaemonVersion.ts`; `components/dashboard/vellum/index.ts:5-6`.
## 5. Cross-cutting properties
- **Live daemon state, no UI-local persistence beyond soft-dismiss** —
every surface reads daemon hooks; the only UI-local state is the
per-event-seq dismiss set + transient lens chips + optimistic-outcome
map (`Feed.tsx:217` lens, `:224` optimistic map, `:240-241` dismiss
set; `ScopePages.tsx` `useState` tab state `:677`,`:753`,`:1192`)
@HEAD.
- **Honest empty/error states** — `WorkspaceScopePage` no-workspace
(`ScopePages.tsx:682-693`), `WorkspaceOverviewPanel` index-unavailable
(`:565-573`, label `:568`), `SliceScopePage` not-available
(`:1225-1245`, label `:1235`) all surface the cause + a remediation
pointer, never a blank screen @HEAD.
- **Live daemon state** — every surface reads daemon hooks. UI-local state
on these surfaces is the two For You dismissal sets (localStorage), the
lens, host filter and optimistic-outcome map (transient), and each scope
page's tab state.
- **Honest empty/error states** — `WorkspaceScopePage` no-workspace and
`SliceScopePage` not-available surface the cause and a remediation
pointer, never a blank screen.
- **0.3.0 observability spine on the 0.3.1 vellum brand layer** — the
classifier / verb-action / scope-rollup *logic* is the 0.3.0
foundation (§0); the *visual surface* (vellum cards, corner brackets,
graphics marks, dashboard) is the 0.3.1 brand maturation. The split is
slice-00 0.3.0-GT seam (b); do not collapse either direction @HEAD.
classifier / verb-action / scope-rollup logic is the 0.3.0 foundation
(§0); the visual surface is the 0.3.1 brand layer and later refreshes.
## OPEN items (carried, not smoothed)
- **OPEN — For-You verb subset (slice-00 0.3.0-GT OPEN-3).** The exact
shipped For-You-surface verb subset is an unresolved velocity slice-01
ruling (CHANGELOG `[0.3.1]` "all 7" vs source-material §6 "subset"
discrepancy). This module describes the **7-verb system-level
vocabulary only** and reports the literal current `enabledVerbs`
prop value (§2.3) as source state, NOT as a resolution. Defer
For-You-subset enumeration to the pending velocity ruling.
- **OPEN — `/project` redirect-stub consolidation.** `/progress`,
`/slices`, `/steering` are `<Navigate to="/project">` stubs and
`/slices/$name` redirects into `/project/slice/$sliceId` (§1). The
former standalone surfaces fold into Project tabs; whether the stubs
are permanent or transitional is a product decision not resolvable
from source.
- No slice-00 numeric-drift OPEN (1–5) applies — this module carries no
migration / route-group / PL-004-event counts.
`/slices/$name` redirects into `/project/slice/$sliceId` (§1). Whether
the stubs are permanent or transitional is a product decision not
resolvable from source.
+112 -77
View File
@@ -10,8 +10,8 @@ applies-when: |
mounts, or how the shared detail drawer and event consumption work.
siblings: [topology.md, project-and-for-you.md, library-specs-and-design-system.md]
prerequisite-reads: [../README.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# UI Shell, Routing, Drawer System
@@ -21,15 +21,18 @@ operator surface. Brand/visual rules live in `docs/DESIGN.md` (pointer from
`library-specs-and-design-system.md`); this module is how the shell is
assembled and what routes it mounts.
> Verified against source at HEAD `7eaf524c`; package version **0.3.1**
> (slice-00 §1.1). UI footprint is **235** source files
> (`packages/ui/src`, `.ts`+`.tsx`, non-test; slice-00 §1.6 / D6).
> Verified against source at `e8f0ab34`; package version 0.6.7. UI
> footprint is **304** source files (`packages/ui/src`, `.ts`+`.tsx`,
> non-test; 235 at the previous stamp `7eaf524c`). The web UI is in
> maintenance mode (`docs/reference/developing.md`).
## 1. Package shape
UI package: `packages/ui`. Primary implementation areas:
- `src/routes.tsx` — TanStack Router route tree.
- `src/App.tsx`, `src/main.tsx` — app root (`ThemeProvider`, the
maintenance notice, the router).
- `src/components/AppShell.tsx` — global shell: rail, Explorer, drawer,
preview stack.
- `src/components/ui/` — reusable vellum + base UI primitives.
@@ -37,6 +40,8 @@ UI package: `packages/ui`. Primary implementation areas:
- `src/components/topology/` — graph/table/terminal topology surfaces.
- `src/components/project/`, `for-you/`, `dashboard/`, `feed/` —
observability surfaces.
- `src/components/review/`, `workflow/` — review altitudes (`/agents`,
`/fleet`) and workflow pages.
- `src/components/specs/` — Library / skills / plugins surfaces.
- `src/components/{preview,markdown,drawer-viewers}/` — viewers.
- `src/hooks/`, `src/lib/` — route data hooks, classifiers, formatters,
@@ -44,13 +49,23 @@ UI package: `packages/ui`. Primary implementation areas:
## 2. Shell model
`AppShell` wraps every route. `AppShell.tsx` lays a 48px icon rail + a
route-aware Explorer sidebar + center workspace + shared right drawer +
preview stack + topology overlay provider + shared drawer-selection /
discovery-placement contexts.
The root route wraps `AppShell` in `QueryClientProvider` and
`DaemonHealthProvider` (`routes.tsx:80-90`). Above the router, `App.tsx`
renders a dismissible `UiMaintenanceNotice` (localStorage key
`openrig.uiMaintenanceNoticeDismissed`); `main.tsx` mounts `ThemeProvider`.
The rail destinations (`AppShell.tsx` `RAIL_ICONS`, re-confirmed at HEAD)
are exactly six destination icons plus Advisor/Operator entries:
`AppShell.tsx` lays a 48px icon rail + a route-aware Explorer sidebar +
center workspace + shared right drawer + preview stack + topology overlay
provider + shared drawer-selection / discovery-placement / specs-workspace
contexts. The top bar's right slot holds `HostIndicator` and
`ThemeSelector`. When the shared event connection is down, a "Live updates
unavailable…" status line shows. Switching the selected host clears the
discovery placement (`useClearPlacementOnHostSwitch`). Below the `lg`
breakpoint a 3-slot `MobileBottomNav` (For You / Project / Topology) also
shows.
The rail destinations (`AppShell.tsx` `RAIL_ICONS`) are exactly six
destination icons plus Advisor/Operator entries:
- Dashboard `/` (`rail-dashboard`)
- Topology `/topology` (`rail-topology`)
@@ -64,95 +79,115 @@ rather than acting as a generic file browser.
## 3. Route model
> Drift-fix D16 — `ui.md` "Route Model" (the L52–73 list) and
> `architecture.md` §2 "UI architecture" predate 0.3.x. The route table
> below is **re-derived from `packages/ui/src/routes.tsx` at HEAD** (542
> lines). The route tree is assembled at `routes.tsx:480`
> (`rootRoute.addChildren([...])`).
> The route table below is derived from `packages/ui/src/routes.tsx` at
> `e8f0ab34` (605 lines). Each line number is the route's
> `createRoute(` line. The exported route tree is assembled at
> `routes.tsx:539` (`export const routeTree = rootRoute.addChildren([`);
> it holds 54 routes.
>
> Correction to the D16 expectation itself (source-verified at HEAD): the
> survey expected `/mission-control`, `/progress`, `/markdown` as net-new
> *real* routes. At HEAD `/mission-control` and `/progress` are **redirect
> stubs**, not destination routes, and there is **no `/markdown` route**.
> There IS a real `/files` route (markdown is rendered by the `MarkdownViewer`
> component inside file/drawer surfaces, not via a `/markdown` route). The
> route table is reported as source says, not as the survey predicted.
> `/mission-control` and `/progress` are **redirect stubs**, not
> destination routes, and there is **no `/markdown` route** (markdown is
> rendered by the `MarkdownViewer` component). There is a real `/files`
> route.
### Primary destination routes
| Path | Component | Notes |
|---|---|---|
| `/` | Dashboard (`indexRoute` `routes.tsx:88`) | rail destination |
| `/topology` | host topology (`:98`) | + rig/pod/seat scopes (see `topology.md`) |
| `/topology/rig/$rigId` | rig scope (`:104`) | |
| `/topology/pod/$rigId/$podName` | pod scope (`:110`) | |
| `/topology/seat/$rigId/$logicalId` | seat scope (`:116`) | live node details |
| `/for-you` | attention feed (`:122`) | rail destination |
| `/project` | workspace project scope (`:128`) | rail destination |
| `/project/mission/$missionId` | mission scope (`:134`) | |
| `/project/slice/$sliceId` | slice scope (`:140`) | |
| `/specs` | Library (`:146`) | rail destination |
| `/specs/applications` | applications section (`:152`) | |
| `/specs/skills` | skills index (`:160`) | |
| `/specs/skills/$skillToken` | skill viewer (`:166`) | defaults to `skill.md` |
| `/specs/skills/$skillToken/file/$fileToken` | skill file viewer (`:175`) | |
| `/specs/plugins` | plugins index (`:186`) | 0.3.1 (see `library-specs…`) |
| `/plugins/$pluginId` | plugin detail (`:201`) | 0.3.1 |
| `/specs/$specKind/$specName` | generic spec → library redirect (`:213`) | |
| `/files` | Files workspace (`:192`) | net-new vs ui.md/D16 |
| `/settings` | settings center (`:222`) | rail destination |
| `/settings/policies` | Policies (`:232`) | slice 27 Claude-compaction form |
| `/settings/log` | Log (`:237`) | slice 26 4-item Settings explorer |
| `/settings/status` | Status (`:242`) | |
| `/search` | audit/history view (`:248`) | |
| `/` | Dashboard (`indexRoute` `routes.tsx:96`) | rail destination |
| `/topology` | host topology (`:106`) | + rig/pod/seat scopes (see `topology.md`) |
| `/topology/rig/$rigId` | rig scope (`:112`) | |
| `/topology/pod/$rigId/$podName` | pod scope (`:118`) | |
| `/topology/seat/$rigId/$logicalId` | seat scope (`:124`) | live node details |
| `/for-you` | attention feed (`:130`) | rail destination |
| `/project` | workspace project scope (`:136`) | rail destination |
| `/project/mission/$missionId` | mission scope (`:142`) | |
| `/project/slice/$sliceId` | slice scope (`:148`) | |
| `/specs` | Library (`:202`) | rail destination |
| `/specs/applications` | applications section (`:208`) | |
| `/specs/skills` | skills index (`:216`) | |
| `/specs/skills/$skillToken` | skill viewer (`:222`) | defaults to `SKILL.md` |
| `/specs/skills/$skillToken/file/$fileToken` | skill file viewer (`:231`) | |
| `/specs/plugins` | plugins index (`:242`) | 0.3.1 (see `library-specs…`) |
| `/plugins/$pluginId` | plugin detail (`:257`) | 0.3.1 |
| `/specs/$specKind/$specName` | generic spec → library redirect (`:269`) | |
| `/files` | Files workspace (`:248`) | |
| `/settings` | settings center (`:278`) | rail destination |
| `/settings/policies` | Policies (`:288`) | Claude-compaction form |
| `/settings/log` | Log (`:293`) | 4-item Settings explorer |
| `/settings/status` | Status (`:298`) | |
| `/search` | audit/history view (`:304`) | |
### Zoom-addressed routes (no rail entry)
Reached from other views and deep links, deliberately not on the rail:
| Path | Component | Notes |
|---|---|---|
| `/agents` | `RigAgentsPage` (`:159`) | rig review altitude; separate from legacy `/agents/validate` |
| `/fleet` | `FleetPage` (`:171`) | fleet attention altitude above host |
| `/workflows` | `WorkflowsPage` (`:181`) | |
| `/workflow/instance/$instanceId` | `WorkflowInstancePage` (`:187`) | optional `?step=<id>` anchor |
### Lab routes (design experiments)
`/lab/project-graphics-preview` (`:254`), `/lab/card-previews` (`:262`),
`/lab/vellum-lab` (`:272`), `/lab/vellum-bg/{a-large,b-small,c-allover}`
(`:283`–`:293`). The vellum-lab + vellum-bg routes are the 0.3.1 vellum
brand-system experiment surface (slice-00 0.3.0-GT seam b: vellum brand
identity matured in 0.3.1; the `dashboard/vellum/*` system is 0.3.1).
`/lab/project-graphics-preview` (`:310`), `/lab/card-previews` (`:318`),
`/lab/vellum-lab` (`:328`), `/lab/vellum-bg/{a-large,b-small,c-allover}`
(`:339`–`:349`). The vellum-lab + vellum-bg routes are the 0.3.1 vellum
brand-system experiment surface (the `dashboard/vellum/*` system is 0.3.1).
### Legacy / compatibility routes
`/rigs/$rigId` (`:318`), `/rigs/$rigId/nodes/$logicalId` (`:324`),
`/import` (`:333`), `/packages`, `/packages/install`, `/packages/$packageId`
(`:339`–`:351`), `/bootstrap` (`:357`), `/agents/validate` (`:363`),
`/specs/rig` + `/specs/agent` review (`:372`/`:378`),
`/specs/library/$entryId` (`:384`), `/discovery` + `/discovery/inventory`
(`:395`/`:410`), `/bundles/inspect` + `/bundles/install` (`:416`/`:422`).
`/rigs/$rigId` (`:374`), `/rigs/$rigId/nodes/$logicalId` (`:380`),
`/import` (`:389`), `/packages`, `/packages/install`, `/packages/$packageId`
(`:395`–`:407`), `/bootstrap` (`:413`), `/agents/validate` (`:419`),
`/specs/rig` + `/specs/agent` review (`:428`/`:434`),
`/specs/library/$entryId` (`:440`), `/discovery` + `/discovery/inventory`
(`:451`/`:466`), `/bundles/inspect` + `/bundles/install` (`:472`/`:478`).
### Redirect stubs (deleted routes)
`routes.tsx:432`–`:474` mount `<Navigate>` redirects for removed routes —
`routes.tsx:488`–`:530` mount `<Navigate>` redirects for removed routes —
NOT destination pages: `/context` → `/topology`; `/mission-control` →
`/for-you` (SC-18: `/mission-control` deleted, For-You replaces it);
`/slices` + `/slices/$name` → `/project`; `/progress` → `/project`;
`/steering` → `/project`. The Mission Control *system* still exists at the
daemon/PL-005 layer (`../architecture/mission-control.md`); only the old UI
*route* was retired in favour of For-You.
`/for-you` (For-You replaces it); `/slices` → `/project`; `/slices/$name` →
`/project/slice/$sliceId` (with `sliceId` set to the name); `/progress` →
`/project`; `/steering` → `/project`. The Mission Control *system* still
exists in the daemon (`../architecture/mission-control.md`); only the old
UI *route* was retired in favour of For-You.
## 4. Drawer and viewer system
`SharedDetailDrawer` is the shared transient detail surface for queue-item
viewer, file viewer, subspec preview, and other detail selections. Drawer
triggers carry root/path provenance so the viewer fetches/render the correct
content; the drawer supports outside-click dismissal. Image proof viewing is
handled by `ProofImageViewer` with black-glass styling honouring the shell
layout. Skill detail uses Library Explorer navigation + `FileViewer`
(`components/drawer-viewers/FileViewer.tsx`) in the center workspace, not a
nested three-column browser.
viewer, file viewer (`FileViewer`), subspec preview, and other detail
selections. Drawer triggers carry root/path provenance so the viewer
fetches and renders the correct content; the drawer supports outside-click
dismissal.
Image proof viewing: For-You cards use `ProofImageViewer`
(`components/project/ProofImageViewer.tsx`), which stays inside the shell
layout. The Project Proof tab and the Review surfaces use the full-viewport
`Lightbox` (`components/project/Lightbox.tsx`; mounted in
`project/ProofTab.tsx`, `review/EvidenceOpener.tsx`,
`review/SliceReviewTab.tsx`).
Skill detail (`components/specs/SkillDetailPage.tsx`) renders its own
two-pane docs browser — a file tree beside a viewer — and draws content
with `MarkdownViewer` (`.md`/`.mdx`) or `SyntaxHighlight` (other text). It
does not use `FileViewer`, which only the shared drawer renders.
## 5. Event and activity consumption
UI event consumption is centralized through shared event hooks so the app
avoids duplicate SSE connections for related surfaces. Current consumers: For
You feed hydration, topology activity rings + hot-potato movement, the
activity feed/system surfaces, and rig event surfaces. Reduced-motion
preference is honoured for pulse/packet animation. (Daemon SSE surfaces:
`/api/events`, `/api/stream/watch`, `/api/queue/watch` —
`architecture-rules-and-event-system.md` §2.4.)
UI event consumption is centralized through one shared `/api/events`
connection (`lib/topology-events.ts`) so related surfaces avoid duplicate
SSE connections. Current consumers: For You feed hydration, topology
activity rings + hot-potato movement, the activity feed/system surfaces,
and rig event surfaces. `useGlobalEvents` reports whether that connection
is up and refetches review, slice and mission data on reconnect and on
`proof.*` events. Reduced-motion preference is honoured for pulse/packet
animation. (Daemon SSE surfaces: `/api/events`, `/api/stream/watch`,
`/api/queue/watch` —
[`../architecture/architecture-rules-and-event-system.md`](../architecture/architecture-rules-and-event-system.md)
§2, "Emission and delivery".)
## See also
+91 -56
View File
@@ -6,12 +6,13 @@ topics: [observability, coordination]
domains: [engineering-advisor, operating-advisor]
applies-when: |
Need to know how the topology surface is built — the host hybrid graph,
the table/terminal views, the activity-ring / hot-potato visual language,
terminal-preview popovers, and the topology navigation/overlay contracts.
the rig/pod graphs, the table/terminal views, the activity-ring /
hot-potato visual language, terminal-preview popovers and launchers, and
the topology navigation/overlay contracts.
siblings: [shell-and-routing.md, project-and-for-you.md]
prerequisite-reads: [../README.md, shell-and-routing.md]
last-verified-against-source: 7eaf524c
last-updated: 2026-05-16
last-verified-against-source: e8f0ab340db773392ec8be75b072d1c0f3068a50
last-updated: 2026-10-08
---
# UI Topology — Graph/Table/Terminal, HotPotato, ActivityRing
@@ -20,84 +21,117 @@ Topology is a scoped workspace with graph, table, and terminal views at the
`/topology` route family (`shell-and-routing.md` §3). It is the operator's
live picture of host → rig → pod → seat.
> Verified against source at HEAD `7eaf524c`; package version **0.3.1**
> (slice-00 §1.1). All component names below are re-confirmed against
> `packages/ui/src/components/topology/` at HEAD — `ui.md` and `DESIGN.md`
> name *exported symbols*; the source file that defines the hybrid nodes is
> `HybridTopologyNodes.tsx` (DESIGN.md L344 implementation reference).
> Verified against source at `e8f0ab34` (package version 0.6.7). The web UI
> is in maintenance mode (`docs/reference/developing.md`). The source file
> that defines the hybrid nodes is `HybridTopologyNodes.tsx` (DESIGN.md's
> implementation reference).
## 1. Topology pieces
> Drift-fix — `ui.md` "Topology" (L108–137) lists `HybridAgentNode` /
> `HybridPodGroupNode` as if top-level files. Re-confirmed at HEAD: both are
> exports inside `packages/ui/src/components/topology/HybridTopologyNodes.tsx`
> (`HybridPodGroupNode` is `memo(...)` at `HybridTopologyNodes.tsx:94`;
> `HybridAgentNode` is `memo(HybridAgentNodeInner, ...)` at `:272`). The
> component names are accurate; their file location is consolidated.
> `HybridAgentNode` and `HybridPodGroupNode` are exports inside
> `packages/ui/src/components/topology/HybridTopologyNodes.tsx`, not
> top-level files (`HybridPodGroupNode = memo(...)` at
> `HybridTopologyNodes.tsx:101`; `HybridAgentNode = memo(HybridAgentNodeInner,
> ...)` at `:321`).
Components in `packages/ui/src/components/topology/` (re-confirmed at HEAD):
Components in `packages/ui/src/components/topology/`:
- `HostMultiRigGraph.tsx` — host-level hybrid React Flow graph (multi-rig
single canvas).
single canvas). Also mounted on the `/project` workspace Workflow tab.
- `HybridTopologyNodes.tsx` — exports `HybridAgentNode` (compact agent cards:
runtime badges, context %, token totals, activity state, terminal preview,
CMUX actions) and `HybridPodGroupNode` (soft dashed pod frames).
per-card CMUX open via `useCmuxLaunch`) and `HybridPodGroupNode` (soft
dashed pod frames).
- `RigGroupNode.tsx` — soft rig frames with registration marks + aggregate
activity.
- `ActivityRing.tsx` — active / needs-input / blocked activity ring; card
activity classes in `activity-card-visuals.ts`.
- `HotPotatoEdge.tsx` — directional queue-movement edge animation.
- `TopologyTableView.tsx` — dense table mirror of topology data.
- `TopologyTerminalView.tsx` — terminal-oriented topology state.
- `TopologyTreeView.tsx` — tree navigation view.
- `TopologyViewModeTabs.tsx` — graph/table/terminal/tree mode switch.
- `TerminalPreviewPopover.tsx` — black-glass quick terminal preview, portaled
above the graph.
- `LaunchCmuxButton.tsx` — hover/focus CMUX launch action.
- `TopologyTableView.tsx` — dense table mirror of topology data (with
`topology-table-shimmer.css`).
- `TopologyTerminalView.tsx` — pinned-card terminal grid for host, rig or
pod scope; host scope shows 12 cards by default (`SAFE_N`) with a "show
all" toggle.
- `TopologyTreeView.tsx` — the topology tree, rendered in the Explorer
sidebar (`components/Explorer.tsx`), not as a center view mode.
- `TopologyViewModeTabs.tsx` — host tabs Graph / Table / Terminal; rig and
pod tabs add Overview. Tabs switch in place (React state), not separate
routes. (`SEAT_SCOPE_TABS` is defined but unused; the seat scope renders
`LiveNodeDetails`.)
- `TerminalPreviewPopover.tsx` — smoked-glass terminal preview, portaled
above the graph. On the graph and table it is `progressive`: a static
mirror first, click to go live, under a page-wide live-terminal cap.
- `TerminalLauncher.tsx` — the rig-scope tab-bar launcher: choose a
provider (herdr or cmux) and a view (this rig, a pod, a mission's or
slice's agents, a saved view), then open it via
`POST /api/terminal/open`. Shown only when the selected host is local.
- `LaunchCmuxButton.tsx` — the older rig-scope "Launch in CMUX" button.
`TerminalLauncher` replaced it in the tab bar, and no production
component imports it now (tests still do).
- `ScopePages.tsx` — host/rig/pod/seat scope page wrappers.
- `topology-overlay-context.tsx` — `TopologyOverlayProvider` (expanded-rig
state).
- `topology-overlay-context.tsx` — `TopologyOverlayProvider`: expanded-rig
state, the rig named in the URL auto-expanded, and the Explorer mode
(`overlay` on the graph tab, `opaque` on the others).
> Note (vs `DESIGN.md` "Topology" L205–216): DESIGN.md lists the same
> exported primitives (`HostMultiRigGraph`, `HybridAgentNode`,
> `HybridPodGroupNode`, `RigGroupNode`, `ActivityRing`, `HotPotatoEdge`,
> `TerminalPreviewPopover`, `TopologyTableView`, `TopologyTerminalView`) —
> reconciled against source: all present at HEAD. `TopologyTreeView` /
> `TopologyViewModeTabs` / `LaunchCmuxButton` exist in source but are not in
> DESIGN.md's primitive list (DESIGN.md is the brand primitive list, not an
> exhaustive component inventory; not a drift, a scope difference). DESIGN.md
> stays byte-identical (Q1).
The rig and pod graphs are not the hybrid graph: rig and pod scopes render
`components/RigGraph.tsx` (`RigNode` cards, `graph-layout.ts` layout),
sharing `HotPotatoEdge` and `useTopologyActivity`. Rig scope's Overview tab
renders `RigOverviewTab` (`RigSpecDisplay`); pod scope's is a placeholder.
On narrow viewports the graph tab falls back to the table.
> Source: `topology/TopologyViewModeTabs.tsx` (`HOST_SCOPE_TABS`,
> `RIG_POD_SCOPE_TABS`, `SEAT_SCOPE_TABS`); `topology/ScopePages.tsx`
> (`TerminalLauncher` `:270`, `RigGraph` `:322`/`:437`, `RigOverviewTab`
> `:342`, `useOverlayForActiveTab`); `topology/TerminalPreviewPopover.tsx`
> (`progressive`); `topology/TopologyTerminalView.tsx` (`SAFE_N` `:35`).
> Note (vs `DESIGN.md` "Topology"): DESIGN.md lists the exported brand
> primitives (`HostMultiRigGraph`, `HybridAgentNode`, `HybridPodGroupNode`,
> `RigGroupNode`, `ActivityRing`, `HotPotatoEdge`, `TerminalPreviewPopover`,
> `TopologyTableView`, `TopologyTerminalView`); all are present in source.
> `TopologyTreeView`, `TopologyViewModeTabs`, `TerminalLauncher` and
> `LaunchCmuxButton` exist in source but are not in DESIGN.md's primitive
> list (a scope difference, not drift).
## 2. Topology contracts
From `architecture.md` §2 "Current topology UI" + `ui.md` "Important
topology contracts", re-confirmed against source behaviour at HEAD:
Re-confirmed against source:
- Graph / table / tree navigation all resolve to seat detail URLs
(`/topology/seat/$rigId/$logicalId`).
- The host-level graph uses cross-rig node-ID prefixing for multi-rig single
canvas.
- Expanded-rig state is owned by `TopologyOverlayProvider`
(`topology-overlay-context.tsx`); graph data is lazy-fetched for expanded
rigs only.
- The host-level graph prefixes node IDs per rig for the multi-rig single
canvas (`lib/hybrid-layout.ts`: `PREFIX_DELIMITER = "::"`,
`prefixedHybridNodeId`).
- Expanded-rig state is owned by `TopologyOverlayProvider`. Rigs default to
**expanded** (`DEFAULT_RIG_EXPANDED = true` in `HostMultiRigGraph.tsx`),
with "Expand all" / "Collapse all" controls; graph data is fetched for
expanded rigs only.
- Compact agent cards show context percentage, token totals, and activity
card tint; `ActivityRing` + activity classes surface active / needs-input /
blocked.
- `HotPotatoEdge` animates directional queue movement at graph zoom levels;
reduced-motion preference removes pulse/travel animation and keeps static
state signals.
- `HotPotatoEdge` animates directional queue movement with non-scaling
strokes; reduced-motion preference removes pulse/travel animation and
keeps static state signals.
- Terminal-preview actions are hover/focus-visible; the
`TerminalPreviewPopover` must escape React Flow stacking contexts (portaled
above the canvas) and stay within the viewport.
`TerminalPreviewPopover` escapes React Flow stacking contexts (portaled
to `document.body`) and stays within the viewport.
- With a non-local host selected, the host graph fetch carries the host
parameter; terminal-preview and CMUX buttons are hidden on cards and in
the table; and the rig page shows a read-only marker instead of the
launcher.
## 3. Layout helpers
## 3. Layout and activity helpers
Topology layout is computed by `src/lib/` helpers (re-confirmed at HEAD):
`graph-layout.ts`, `hybrid-layout.ts`, `multi-rig-layout.ts`,
`topology-activity.ts`, `activity-visuals.ts`. Runtime/tool identity on the
cards comes from the central `runtime-brand.ts` / `tool-brand.ts` +
`RuntimeMark.tsx` (do not duplicate brand logic — DESIGN.md "Do not";
restated here as the topology-card brand-source contract).
In `src/lib/`: `hybrid-layout.ts` lays out the host graph
(`HostMultiRigGraph`); `graph-layout.ts` (`applyTreeLayout`) lays out the
rig/pod graph (`RigGraph`); `multi-rig-layout.ts` has no production
importer (tests only). `topology-activity.ts` computes ring states and
hot-potato edges, and `activity-visuals.ts` the rollups and activity dots.
Runtime/tool identity on the cards comes from the central
`lib/runtime-brand.ts` / `lib/tool-brand.ts` and
`components/graphics/RuntimeMark.tsx` (runtimes: Claude Code, Codex, Pi,
OMP, terminal, unknown). Do not duplicate brand logic (DESIGN.md "Do
not").
## See also
@@ -106,4 +140,5 @@ restated here as the topology-card brand-source contract).
- `../architecture/coordination-primitive.md` — the queue movement the
hot-potato edge visualizes.
- Source root: `packages/ui/src/components/topology/`,
`packages/ui/src/lib/{graph,hybrid,multi-rig}-layout.ts`.
`packages/ui/src/components/RigGraph.tsx`,
`packages/ui/src/lib/{hybrid,graph}-layout.ts`.
+149 -66
View File
@@ -1,8 +1,8 @@
# AgentSpec Reference
Version: 1.0
Last validated against code: 2026-04-11
Source of truth: `packages/daemon/src/domain/agent-manifest.ts`, `packages/daemon/src/domain/types.ts`
Last validated against code: 2026-10-07, at the 0.6.6 cut `2620dea8` (whole document at `fcaf1f8e`; changes to its sources and the shipped agent specs since then checked)
Source of truth: `packages/daemon/src/domain/agent-manifest.ts`, `packages/daemon/src/domain/types.ts`, `packages/daemon/src/domain/agent-resolver.ts`, `packages/daemon/src/domain/profile-resolver.ts`, `packages/daemon/src/domain/skill-catalog.ts`
This is the canonical reference for the AgentSpec YAML format (`agent.yaml`). Every field, validation rule, and default documented here was traced from the actual parser and validator code.
@@ -20,7 +20,7 @@ profiles:
skills: []
guidance: []
subagents: []
hooks: []
plugins: []
runtime_resources: []
resources: {}
@@ -35,7 +35,7 @@ startup:
```yaml
name: implementer
version: "1.0"
description: Implementation agent — writes code following TDD discipline
description: Implementation agent — implements and verifies coherent changes
defaults:
runtime: claude-code
@@ -46,11 +46,11 @@ imports:
profiles:
default:
uses:
skills: [openrig-user, development-team, test-driven-development, systematic-debugging]
skills: [development-team, systematic-debugging, verification-before-completion]
guidance: []
subagents: []
hooks: []
runtime_resources: []
plugins: [shared:openrig-core]
runtime_resources: [shared:claude-default-settings, shared:claude-default-mcp, shared:codex-default-config, shared:claude-activity-hooks]
resources:
guidance:
@@ -75,6 +75,7 @@ description: Vault specialist agent — manages HashiCorp Vault for this managed
defaults:
runtime: claude-code
model: claude-opus-4-6
effort: high
lifecycle:
execution_mode: interactive_resident
compaction_strategy: default-compaction
@@ -91,11 +92,11 @@ profiles:
preferences:
runtime: claude-code
uses:
skills: [openrig-user, systematic-debugging, vault-user]
skills: [systematic-debugging, vault-user]
guidance: []
subagents: []
hooks: []
runtime_resources: []
plugins: [shared:openrig-core, vault-tools]
runtime_resources: [claude-settings]
startup:
files:
- path: guidance/profile-specific.md
@@ -111,10 +112,11 @@ resources:
guidance:
- id: role
path: guidance/role.md
hooks:
- id: pre-commit
path: hooks/pre-commit.sh
runtimes: [claude-code]
plugins:
- id: vault-tools
source:
kind: local
path: plugins/vault-tools
runtime_resources:
- id: claude-settings
path: runtime/claude-settings.fragment.json
@@ -147,12 +149,12 @@ startup:
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `name` | string | yes | — | Agent name. Used in spec library identification and validation messages. |
| `version` | string | yes | — | Spec version. Informational — not used for compatibility gating. |
| `version` | string | yes | — | Spec version. Quote it (`"1.0"`): an unquoted number fails as a non-string. An importing spec that pins `imports[].version` must match it exactly. |
| `description` | string | no | — | Human-readable description. Shown in spec library and review surfaces. |
| `defaults` | Defaults | no | — | Default runtime, model, and lifecycle settings. Applied when not overridden by the rig spec or profile. |
| `imports` | Import[] | no | `[]` | Other AgentSpecs to import. Resources from imported specs become available for profile `uses` references. |
| `profiles` | map<string, Profile> | no | `{}` | Named profiles. Each profile selects resources and can override startup/lifecycle. The rig spec member's `profile` field selects which profile to use. |
| `resources` | Resources | no | all empty | Declared resources (skills, guidance, subagents, hooks, runtime resources). These are the available pool that profiles select from via `uses`. |
| `resources` | Resources | no | all empty | Declared resources (skills, guidance, subagents, plugins, runtime resources). These are the available pool that profiles select from via `uses`. |
| `startup` | StartupBlock | no | `{ files: [], actions: [] }` | Agent-level startup files and actions. Applied to all profiles via the startup layering model. |
---
@@ -163,6 +165,7 @@ startup:
defaults:
runtime: claude-code
model: claude-opus-4-6
effort: high
lifecycle:
execution_mode: interactive_resident
compaction_strategy: default-compaction
@@ -171,8 +174,9 @@ defaults:
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `runtime` | string | no | — | Default runtime for this agent. Can be overridden by the rig spec member's `runtime` field. |
| `model` | string | no | — | Default model. Can be overridden by the rig spec member's `model` field. |
| `runtime` | string | no | — | Default runtime for this agent. Precedence: the rig spec member's `runtime`, then the profile's `preferences.runtime`, then this, then `claude-code`. |
| `model` | string | no | — | Default model, with the same precedence. |
| `effort` | string | no | — | Default reasoning effort, with the same precedence. Claude gets `--effort`, Codex `-c model_reasoning_effort=…`, Pi `--thinking <level>` (Pi's levels: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`; passed as written). A blank or non-string value is ignored with an advisory. |
| `lifecycle` | Lifecycle | no | see below | Lifecycle behavior defaults. |
### Lifecycle Defaults
@@ -180,8 +184,9 @@ defaults:
| Field | Type | Default | Allowed Values |
|-------|------|---------|----------------|
| `execution_mode` | string | `interactive_resident` | `interactive_resident` (only value in v1; `wake_on_demand` is explicitly rejected) |
| `compaction_strategy` | string | `default-compaction` | `default-compaction`, `managed-compaction`, `handover`, `apprentice-handover`; deprecated aliases accepted with a validation advisory: `harness_native` → `default-compaction`, `pod_continuity` → `handover` (`custom_prompt` is explicitly rejected in v1) |
| `compaction_strategy` | string | `default-compaction` | `default-compaction`, `managed-compaction`, `handover`, `apprentice-handover`; deprecated aliases accepted with a validation advisory: `harness_native` → `default-compaction`, `pod_continuity` → `handover` (`custom_prompt` is explicitly rejected in v1). `managed-compaction` and `apprentice-handover` create their jobs only for `claude-code` seats; see [Codex compaction and sizing](agent-startup-guide.md#codex-compaction-and-sizing) |
| `restore_policy` | string | `resume_if_possible` | `resume_if_possible`, `relaunch_fresh`, `checkpoint_only` |
| `mechanic` | string | — | A canonical `seat@rig` session address; needed by `apprentice-handover` |
---
@@ -197,15 +202,18 @@ imports:
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `ref` | string | yes | Reference to another AgentSpec directory. Must start with `local:` (relative) or `path:` (absolute). The referenced directory must contain an `agent.yaml`. |
| `version` | string | no | Optional version constraint. Must be an exact version — no ranges (`~`, `^`, `>=`, etc.). |
| `version` | string | no | Optional version constraint. Must be an exact version — no ranges (`~`, `^`, `>=`, etc.). When set, the imported spec's `version` must equal it, or resolution fails with `version_mismatch`. |
### Import Resolution
- `local:` paths resolve relative to the importing spec's directory
- `path:` paths are absolute filesystem paths
- Imported resources become available for `uses` references in profiles
- When referencing imported resources in `uses`, use qualified `namespace:id` format (e.g., `shared:openrig-user`)
- Unqualified references (just `id`) resolve against the spec's own local resources first
- A qualified reference `namespace:id` (e.g., `shared:openrig-core`) names the imported spec by its `name` field
- An unqualified reference (just `id`) resolves against the spec's own resources first, then against the one import that
declares it. If two imports declare it, the reference is ambiguous and fails: qualify it
- An imported spec may not have imports of its own, and its `name` may not contain `:`. Two imports that resolve to the
same spec name are refused, and import cycles are detected
### The Shared Import Pattern
@@ -216,7 +224,13 @@ imports:
- ref: local:../../shared
```
This gives access to the full pool of shared skills (openrig-user, systematic-debugging, development-team, etc.) and agents select the ones they need via profile `uses`.
This gives access to the shared pool: skills such as `systematic-debugging`, `verification-before-completion`,
`development-team` and `test-driven-development`; the `openrig-core` plugin, which carries `openrig-user` and OpenRig's
other skills; and runtime resources such as `claude-default-settings`, `claude-default-mcp`, `codex-default-config` and
`claude-activity-hooks`. Agents select the ones they need via profile `uses`, for example
`plugins: [shared:openrig-core]`. That selection projects the plugin's skills into the seat. For a Claude seat it also loads
the plugin's hooks, through a `CLAUDE_CODE_PLUGIN_DIRS` the daemon sets for a seat that selected `openrig-core` (see
`refocus-channel.md`); a seat that didn't select it gets neither.
---
@@ -230,10 +244,10 @@ profiles:
runtime: claude-code
model: claude-opus-4-6
uses:
skills: [openrig-user, systematic-debugging, vault-user]
skills: [systematic-debugging, vault-user]
guidance: [role]
subagents: []
hooks: []
plugins: [shared:openrig-core]
runtime_resources: []
startup:
files: []
@@ -244,13 +258,14 @@ profiles:
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `summary` | string | no | — | Profile description. |
| `preferences` | object | no | — | Runtime/model preferences for this profile. |
| `summary` | string | no | — | Profile description. Spec review surfaces read a profile `description` instead. |
| `preferences` | object | no | — | Runtime/model/effort preferences for this profile. |
| `preferences.runtime` | string | no | — | Preferred runtime. |
| `preferences.model` | string | no | — | Preferred model. |
| `preferences.effort` | string | no | — | Preferred reasoning effort. |
| `uses` | Uses | no | all empty | Selects which declared resources are active for this profile. |
| `startup` | StartupBlock | no | — | Profile-level startup files and actions. Merged with agent-level startup via layering. |
| `lifecycle` | Lifecycle | no | — | Profile-level lifecycle overrides. |
| `lifecycle` | Lifecycle | no | — | Profile-level lifecycle overrides. `restore_policy` can only narrow (`resume_if_possible` → `relaunch_fresh` → `checkpoint_only`); `compaction_strategy` and `mechanic` take the most specific value (defaults, then profile, then member). |
### Uses
@@ -258,18 +273,28 @@ The `uses` block selects which resources from the `resources` pool (including im
```yaml
uses:
skills: [openrig-user, systematic-debugging, vault-user]
skills: [systematic-debugging, vault-user]
guidance: [role]
subagents: []
hooks: [pre-commit]
plugins: [shared:openrig-core]
runtime_resources: [claude-settings]
```
Each array contains resource IDs. These can be:
- **Unqualified** (`vault-user`) — resolves against the spec's own `resources` first, then imported specs
- **Qualified** (`shared:openrig-user`) — resolves against a specific imported spec's resources
- **Qualified** (`shared:systematic-debugging`) — resolves against a specific imported spec's resources
The `uses` categories are: `skills`, `guidance`, `subagents`, `hooks`, `runtime_resources`.
The `uses` categories are: `skills`, `guidance`, `subagents`, `plugins`, `runtime_resources`. A `uses.hooks` key, even an
empty list, is refused: hooks ship inside plugins.
**Skills resolve more widely than other resources.** For Claude Code and Codex seats, a skill ID that no declared
resource provides is looked up at launch in the seat's runtime skill folder (`<cwd>/.claude/skills` or
`<cwd>/.agents/skills`), then the `skills/` folder beside the RigSpec, then the home skill folder, then the managed
skills root. Pi looks only in the `skills/` folder beside the RigSpec. OMP does no filesystem discovery, so its
`uses.skills` references need declared resources. A discovered skill's ID is its `SKILL.md` frontmatter `name`, and a declared resource wins over a discovered skill with the
same ID. When a profile selects a skill from inside the spec's own folder and the managed catalog holds a different
copy, the spec's copy is used and launch warns `skill_bundle_precedence`. Any other differing copy fails launch with
`skill_identity_conflict`.
---
@@ -286,10 +311,12 @@ resources:
subagents:
- id: helper
path: subagents/helper
hooks:
- id: pre-commit
path: hooks/pre-commit.sh
runtimes: [claude-code]
plugins:
- id: vault-tools
source:
kind: local
path: plugins/vault-tools
plugin_type: auto
runtime_resources:
- id: claude-settings
path: runtime/claude-settings.fragment.json
@@ -297,26 +324,65 @@ resources:
type: claude_settings_fragment
```
Resources are the available pool. They are NOT automatically delivered to agents — profiles select them via `uses`. The only resources delivered are those that the active profile's `uses` block references.
Resources are the available pool. They are NOT automatically delivered to agents — profiles select them via `uses`.
The only declared resources delivered are those that the active profile's `uses` block references. Two sources add
skills outside `uses`: the managed skill catalog's system selection and a project's `install.skills`.
`resources.hooks` is refused at validation: hooks now ship inside plugins, declared under `resources.plugins`.
### Plugin paths
A local plugin's `source.path` supports these forms:
| Form | Resolution |
|------|------------|
| `/absolute/plugin` | The exact absolute path. |
| `~/plugins/example` or `~` | The operating-system user home. |
| `openrig-home:plugins/openrig-core` | Relative to the daemon's configured OpenRig home, including a non-default `OPENRIG_HOME`. |
| `plugins/example` or `./plugins/example` | Relative to the agent spec directory. |
For a plugin seeded by OpenRig, use the home-relative form so the spec selects
that daemon's copy:
```yaml
resources:
plugins:
- id: openrig-core
source:
kind: local
path: "openrig-home:plugins/openrig-core"
profiles:
default:
uses:
plugins: [openrig-core]
```
`openrig-home:` is resolved by the daemon from its configured state root. It is
not shell interpolation and does not consult a seat's shell startup files. Its
suffix must be relative. Existing absolute, tilde and spec-relative paths keep
their meaning; `~user` is still a literal relative segment, not a user lookup.
This form needs OpenRig 0.6.5 or later; keep bundles using it pinned to such a
version.
### Resource Categories
| Category | Fields | Description |
|----------|--------|-------------|
| `skills` | `id`, `path` | Skill directories containing a SKILL.md. Delivered via `skill_install`. |
| `guidance` | `id`, `path`, `target`*, `merge`* | Guidance files. Delivered via `guidance_merge` into CLAUDE.md/AGENTS.md. |
| `subagents` | `id`, `path` | Subagent definitions. |
| `hooks` | `id`, `path`, `runtimes`* | Hook scripts. Optional `runtimes` array restricts to specific runtimes. |
| `runtime_resources` | `id`, `path`, `runtime`, `type` | Runtime-specific resources. `runtime` and `type` are required. |
| `skills` | `id`, `path` | Skill directories containing a SKILL.md. Projected by the runtime adapter: Claude to `<cwd>/.claude/skills/<id>`, Codex to `<cwd>/.agents/skills/<id>`, Pi and OMP to the seat's own agent directory under OpenRig's state. |
| `guidance` | `id`, `path`, `target`*, `merge`* | Guidance files, merged as a managed block (see "Guidance Resources"). |
| `subagents` | `id`, `path` | Subagent definitions. Claude copies them to `<cwd>/.claude/agents/`, Codex to `<cwd>/.agents/`; Pi and OMP don't project them. |
| `plugins` | `id`, `source`, `plugin_type`* | Local plugin directories; selected with `uses.plugins`. `source.kind` must be `local`. `plugin_type` is `claude`, `codex` or `auto` (default): Claude projects a plugin to `<cwd>/.claude/plugins/<id>` when it is `claude`, or `auto` with a `.claude-plugin/plugin.json`; Codex projects to `<cwd>/.codex/plugins/<id>` when it is `codex`, or `auto` with a `.codex-plugin/plugin.json`. Pi and OMP don't project plugins. Neither Claude Code nor Codex reads skills from that plugin folder, so when a seat is instantiated a selected plugin's skills are also projected into the seat's skill folder (`.claude/skills/<name>` or `.agents/skills/<name>`) under their plain names. A folder already there with the same name, ignoring letter case, that OpenRig doesn't own is left alone; unless it already holds the same bytes, launch warns `plugin_skill_kept`. A skill the seat already selects by that name (from its profile, the System World or the project) keeps that source, an edited OpenRig-owned copy is kept with `plugin_skill_kept`, a retained plugin copy whose remembered source can no longer be projected is also kept with `plugin_skill_kept` (a seat selecting that plugin refreshes it at its next launch), and if the plugin skills can't be projected the seat launches without them and warns `plugin_skills_not_projected`. Hooks ship inside plugins. |
| `runtime_resources` | `id`, `path`, `runtime`, `type` | Runtime-specific resources. `runtime` and `type` are required. An entry whose `runtime` isn't the seat's runtime is skipped. Pi and OMP project none. |
*Fields marked with `*` are optional.
Recognized runtime resource types:
- `claude_settings_fragment` — merge a JSON object into `<cwd>/.claude/settings.local.json`.
- `claude_mcp_fragment` — merge a JSON object into `<cwd>/.mcp.json`.
- `codex_config_fragment` — upsert a TOML fragment into `~/.codex/config.toml` inside an OpenRig-managed block.
- `claude_activity_hooks` — reconcile OpenRig's activity hooks into `<cwd>/.claude/settings.local.json`.
- `codex_config_fragment` — upsert a TOML fragment into `$CODEX_HOME/config.toml` (default `~/.codex/config.toml`) inside an OpenRig-managed block.
Unknown runtime resource types are still copied to the runtime extension directory for agent-visible context.
Unknown runtime resource types are still copied to the Claude or Codex runtime extension directory for agent-visible context.
#### Writing a `codex_config_fragment`
@@ -353,7 +419,8 @@ overwritten, and the rest of the fragment still applies.
### Resource Path Rules
- All resource paths must be safe relative paths (no `..` traversal, no absolute paths)
- All resource paths must be safe relative paths (no `..` traversal, no absolute paths), except a plugin's
`source.path`, which takes the forms under "Plugin paths"
- Paths resolve relative to the agent spec's directory
- Resource IDs must be unique within their category
- Resource IDs are the identifiers used in `uses` references
@@ -364,16 +431,15 @@ overwritten, and the rest of the fragment still applies.
guidance:
- id: role
path: guidance/role.md
target: CLAUDE.md # optional — where to merge
merge: managed_block # optional — how to merge (default: managed_block)
merge: managed_block # optional — the only strategy applied
```
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `id` | string | yes | — | Resource identifier. |
| `id` | string | yes | — | Resource identifier. A `rig-role` guidance resource is never merged; deliver a role with a `send_text` startup file. |
| `path` | string | yes | — | Relative path to the guidance file. |
| `target` | string | no | — | Target file for merging (e.g., `CLAUDE.md`). |
| `merge` | string | no | `managed_block` | Merge strategy. One of: `managed_block`, `append`. |
| `target` | string | no | — | Parsed but not used: the runtime decides the file. Claude merges into the rig's `managed_blocks` file (`CLAUDE.md` by default, or `CLAUDE.local.md`); Codex, Pi and OMP merge into `<cwd>/AGENTS.md`. |
| `merge` | string | no | `managed_block` | Only `managed_block` is applied. Any other value, such as `append`, merges nothing. |
---
@@ -393,7 +459,7 @@ restore behavior, and the distinction between readiness and verified proof.
| Hint | When Delivered | Mechanism |
|------|---------------|-----------|
| `auto` | Before harness boot | System chooses based on file type |
| `auto` | Depends on the file | A path ending in `SKILL.md`, or content beginning with `# SKILL`, is `skill_install`; otherwise a `.md` file is `guidance_merge`, and any other file is `send_text` |
| `guidance_merge` | Before harness boot | Merged into CLAUDE.md/AGENTS.md as managed block |
| `skill_install` | Before harness boot | Installed to runtime skill directory |
| `send_text` | After harness is ready | Sent as text to agent terminal via tmux |
@@ -407,17 +473,26 @@ restore behavior, and the distinction between readiness and verified proof.
3. Import `ref` must start with `local:` (relative) or `path:` (absolute).
4. Import `version` must be an exact version (no ranges).
5. `profiles` must be a map (object), not an array.
6. Profile `uses` references must resolve to declared resources (local or imported).
6. Profile `uses` references other than skills must resolve to declared resources (local or imported). Skill
references are checked at launch, not at validation (see "Uses").
7. Unqualified `uses` references that don't resolve to local resources require imports to be present.
8. Qualified `uses` references must be in `namespace:id` format.
9. All resource paths must be safe relative paths.
10. Resource IDs must be unique within their category.
11. `runtime_resources` entries require `runtime` field.
9. All resource paths must be safe relative paths (a plugin's `source.path` excepted).
10. Resource IDs must be unique within their category, and each `resources.<category>` must be an array.
11. `runtime_resources` entries require `runtime` and `type` fields.
12a. `resources.hooks` and `profiles.<name>.uses.hooks` are refused: "removed in plugin-primitive (Phase 3a)". Declare
a plugin instead.
12b. A plugin needs a unique non-empty `id`, a `source` object with `kind: local` and a non-empty `path`, and a
`plugin_type` of `claude`, `codex` or `auto` when given.
12c. Lifecycle `mechanic` must be a canonical `seat@rig` session address.
12. Lifecycle `execution_mode` must be `interactive_resident`.
13. Lifecycle `compaction_strategy` must be one of `default-compaction`, `managed-compaction`, `handover`, `apprentice-handover` — or a deprecated alias (`harness_native`, `pod_continuity`), which validates with a deprecation advisory and normalizes to its canonical value (OPR.0.5.6.20).
14. Lifecycle `restore_policy` must be `resume_if_possible`, `relaunch_fresh`, or `checkpoint_only`.
15. Startup files and actions follow the same validation rules as in RigSpec.
Unknown keys are ignored, not refused. `rig agent validate <path> [--json]` runs these syntax checks through the running
daemon; it doesn't resolve imports, find skills or check that files exist, so a missing skill shows up only at launch.
---
## File System Layout
@@ -434,8 +509,8 @@ my-agent/
skills/
my-skill/
SKILL.md # skill content
hooks/
pre-commit.sh # hook script
plugins/
my-plugin/ # plugin (skills, hooks) with .claude-plugin/ and/or .codex-plugin/
runtime/
claude-settings.fragment.json # runtime-specific resource
```
@@ -446,12 +521,20 @@ The only required file is `agent.yaml`. Everything else is referenced by paths i
## Shipped Examples
| Agent | Location | Imports | Profile Skills | Purpose |
|-------|----------|---------|---------------|---------|
| `shared` | `specs/agents/shared/` | none | — (resource pool only) | Shared skill pool for all built-in agents |
| `implementer` | `specs/agents/development/implementer/` | `shared` | openrig-user, development-team, test-driven-development, systematic-debugging, etc. | TDD implementation agent |
| `qa` | `specs/agents/development/qa/` | `shared` | openrig-user, development-team, etc. | Quality assurance agent |
| `orchestrator` | `specs/agents/orchestration/orchestrator/` | `shared` | openrig-user, orchestration-team, etc. | Rig orchestration lead |
| `independent-reviewer` | `specs/agents/review/independent-reviewer/` | `shared` | review-team, systematic-debugging, verification-before-completion | Independent code reviewer |
| `vault-specialist` | `specs/agents/apps/vault-specialist/` | `shared` | openrig-user, systematic-debugging, vault-user | Vault domain specialist |
| `design` | `specs/agents/design/` | none | — | Product designer |
Every agent below except `shared` imports `shared` and selects `plugins: [shared:openrig-core]`, which carries
`openrig-user`. Paths are under `packages/daemon/specs/agents/`; the kernel's own agents are under
`packages/daemon/specs/rigs/launch/kernel/agents/`.
| Agent | Location | Default runtime | Profile skills | Purpose |
|-------|----------|-----------------|----------------|---------|
| `shared` | `shared/` | — | — (resource pool only) | Shared skills, the `openrig-core` plugin and runtime resources |
| `implementer` | `development/implementer/` | claude-code | development-team, systematic-debugging, verification-before-completion | Implementation agent |
| `qa` | `development/qa/` | codex | development-team, systematic-debugging, verification-before-completion, agent-browser, dogfood | Quality assurance agent |
| `orchestrator` | `orchestration/orchestrator/` | claude-code | orchestration-team, systematic-debugging, verification-before-completion | Rig orchestration lead |
| `independent-reviewer` | `review/independent-reviewer/` | claude-code | review-team, systematic-debugging, verification-before-completion | Independent code reviewer |
| `vault-specialist` | `apps/vault-specialist/` | claude-code | systematic-debugging, verification-before-completion, vault-user | Vault domain specialist |
| `product-designer` | `design/product-designer/` | claude-code | development-team, frontend-design, verification-before-completion | Product designer |
| `pm` | `product-management/pm/` | claude-code | office-hours, context-builder, requirements-writer, ui-mockup, plan-review, exec-summary, backlog-capture; `advisor` profile: orchestration-team | Product manager; its `advisor` profile is the factory's advisor |
| `analyst`, `synthesizer` | `research/analyst/`, `research/synthesizer/` | claude-code, codex | — | Research team |
| `conveyor-lead`, `-planner`, `-builder`, `-reviewer` | `conveyor/` | claude-code, codex, claude-code, codex | per role | Kept for the `factory-rsi` world bundle (its planner); no built-in team uses them |
| `factory-rsi-release-manager`, `factory-rsi-dogfood` | `factory-rsi/` | claude-code | per role | Used by the `factory-rsi` world bundle (not a built-in team) |
+384 -35
View File
@@ -1,13 +1,68 @@
# Agent Startup Guide
Version: 0.2.0
Last validated: 2026-04-11
Applies to: OpenRig 0.1.x
Last validated: 2026-10-05, against main `9b88b118`
Applies to: OpenRig 0.6.8
This guide teaches you how to think about what goes into an agent's startup experience — what files to write, where to put them, and how the layering model delivers them. It is an authoring guide, not a schema reference. For field-level details, see `rig-spec.md` and `agent-spec.md`.
---
## Continue after a native consent prompt
If a fresh Claude seat is waiting at its bypass-permissions warning, review and
answer that warning in the seat's native pane. Unless the rig was launched with
`--non-interruptive` (see [non-interruptive mode](non-interruptive-mode.md)),
OpenRig does not accept it for you, and it never sends configured startup context
into the active dialog. The seat reports `attention_required` and retains that
context for the same occupant.
After accepting, run `rig seat continue <seat>` (or press `c` on the seat in the
TUI, shown while its context is pending). This delivers the pending context
without relaunching Claude, and its first prompt reminds the seat that this is a
fresh conversation and how to find its work. It does not replay a delivery that
already started. A timeout, or a refusal because nothing is pending, reports an
unknown outcome; inspect `rig seat status <seat>` before taking another action.
It is also refused while the prompt is still showing (`attention_required`), or
when the seat's binding or runtime has changed since launch.
Runtime readiness, startup delivery, and orientation proof remain separate;
a missing proof does not block this continuation.
Other fresh-launch prerequisites, such as login or workspace trust, use the same
continuation: resolve the prerequisite in the native pane, then run the displayed
command. `rig ps --nodes` shows it under "Startup details (<seat>)", and
`rig up` and `rig bundle install` print it as "Startup attention (<seat>)":
"After resolving it in <session>, run: rig seat continue <session>".
The attention codes that stop startup this way are `trust_gate`,
`hook_trust_gate`, `update_gate`, `login_required`, `mcp_gate`,
`bypass_consent_gate`, `codex_auth_refusal` and `codex_client_incompatible`.
They are recognized from each harness's English prompt text.
## Continue a Codex fork whose child ID arrived late
For a member with `session_source.mode: fork`, OpenRig waits for Codex's new
child thread ID before sending its role and other startup prompts. It saves the
ID and sends the role only for a verified child: the bound pane's foreground
process forks the requested parent, and its own native record, matched to its
start time, supplies the ID. This capture uses `runtime.readiness_timeout_seconds`
(30 seconds by default, configurable from 1 to 600 seconds), as does the later
readiness check. The two waits have separate budgets. A seat handover with
`--source fork:<seat>` is different: its fork carries the conversation itself,
and a missed ID capture leaves the ID pending rather than stopping the handover.
If the ID is still unavailable, the seat reports `attention_required` and keeps
its startup context pending. Wait for the child to finish starting, resolve any
native prompt, then run `rig seat continue <seat>`. The continuation verifies
that the bound pane is running a fork of the requested parent and reads the
child's own native identity before delivering the saved context. It does not
launch another fork or resume the parent. The parent ID is never saved as the
child's resume token.
An unavailable or conflicting identity leaves the context pending. Once prompt
delivery has been attempted, it cannot be replayed by `continue`, including
after a daemon restart: inspect `rig seat status <seat>` and the native pane
before deciding how to recover an uncertain delivery.
## Two Categories of Startup
Everything an agent receives at boot time falls into one of two categories:
@@ -26,14 +81,14 @@ Context loading shapes what the agent knows, believes, and is capable of:
### Category 2: Deterministic Configuration
The rig spec declaratively installs things into the agent's runtime environment:
- Hooks (git hooks, pre-commit scripts)
- Hooks (shipped inside plugins)
- Permissions (`.claude/settings.json` allowlists, approval modes)
- MCPs (Model Context Protocol servers)
- System dependencies (tools, packages)
See the **Current Support Matrix** section at the end of this guide for what is reliable today vs experimental.
**The v0.2.0 recommendation:** Put as much of your setup logic as possible into Category 1 (context loading via markdown files). Describe the desired end state in startup files and let the agent handle the configuration. The deterministic path exists in the spec and will become more reliable over time, but for now the context-loading path is the one that works consistently across runtimes.
**The recommendation:** Put as much of your setup logic as possible into Category 1 (context loading via markdown files). Describe the desired end state in startup files and let the agent handle the configuration. The deterministic path exists in the spec and will become more reliable over time, but for now the context-loading path is the one that works consistently across runtimes.
---
@@ -118,30 +173,35 @@ Startup content is merged additively through layers. Each layer adds to what the
```
1. Agent layer — from the AgentSpec's top-level startup block
2. Profile layer — from the active profile's startup block
3. Rig layer — from the RigSpec's top-level startup block
4. Culture layer — from the RigSpec's culture_file
3. Culture layer — OpenRig's default culture, then the RigSpec's culture_file
4. Rig layer — from the RigSpec's top-level startup block
5. Pod layer — from the pod's startup block
6. Member layer — from the member's startup block in the RigSpec
7. Operator layer — injected at runtime (openrig-start overlay, context collector, etc.)
7. Operator layer — added by OpenRig: openrig-start.md and, on a fresh start, the onboarding pack
```
A member with a `starter_ref` gets that agent starter's files in front of the agent layer. Terminal seats
(`builtin:terminal`) skip the agent and profile layers.
### What Each Layer Is For
| Layer | Authored by | Purpose | Example content |
|-------|-------------|---------|-----------------|
| Agent | Agent spec author | Core identity and capabilities that travel with this agent type | Role guidance, default skills |
| Profile | Agent spec author | Profile-specific variations | Different skill sets for "default" vs "minimal" profiles |
| Rig | Rig spec author | Rig-wide context for all agents | Team norms, project documentation |
| Culture | Rig spec author | Rig constitution | `CULTURE.md` — communication, quality, operating philosophy |
| Culture | OpenRig, then the rig spec author | Team norms | OpenRig's `CULTURE-default.md` for every seat, then the rig's own `CULTURE.md` |
| Rig | Rig spec author | Rig-wide context for all agents | Project documentation |
| Pod | Rig spec author | Pod-specific coordination context | Pod SOP, intra-pod workflow |
| Member | Rig spec author | Individual member overrides | Member-specific instructions, cwd-specific context |
| Operator | OpenRig system | System-injected runtime content | `openrig-start.md`, context collector |
| Operator | OpenRig system | System-injected runtime content | `openrig-start.md` (optional delivery); on a fresh start, `openrig-onboarding-01.md` and `-02.md` unless `onboarding.default_pack.enabled` is false |
After the files, OpenRig sends a session-identity message (rig, pod, member, logical ID) once the seat is ready.
### Practical Guidance
**Most rigs only need three layers:** agent (role.md), rig (culture), and operator (openrig-start). Start simple. Add pod and member layers only when agents in the same pod need different startup content.
**Most rigs only need three layers:** agent (role.md), culture, and the built-in operator layer. Start simple. Add pod and member layers only when agents in the same pod need different startup content.
**The culture layer is high-value and often skipped.** A rig without a `CULTURE.md` relies on agents to guess how the team communicates and coordinates. Write one. Even a short culture file dramatically improves team coherence.
**The rig's own culture file is high-value and often skipped.** Every seat gets OpenRig's default culture, but that says nothing about how this team communicates and coordinates. Write a `CULTURE.md`. Even a short one dramatically improves team coherence.
**Member-level startup is for exceptions, not the rule.** If every member has its own startup block, the layering model is being used as a configuration dump. Refactor shared content up to the pod or rig level.
@@ -153,8 +213,8 @@ Startup content is merged additively through layers. Each layer adds to what the
| Delivery Hint | When | How | Use For |
|---------------|------|-----|---------|
| `auto` | Before harness boot | System chooses | Default — let OpenRig decide |
| `guidance_merge` | Before harness boot | Merged into `CLAUDE.md` / `AGENTS.md` as a managed block | Role guidance, culture, project context |
| `auto` | Depends on the file | Resolved per file: a `SKILL.md` (or content starting `# SKILL`) is `skill_install`, any other `.md` is `guidance_merge`, and any other file is `send_text` | Default — let OpenRig decide |
| `guidance_merge` | Before harness boot | Merged as a managed block into `AGENTS.md` (Codex, Pi) or `CLAUDE.md` (Claude; `CLAUDE.local.md` with the rig's `managed_blocks: { claude-code: CLAUDE.local.md }`) | Role guidance, culture, project context |
| `skill_install` | Before harness boot | Copied to runtime's skill directory | Skills |
| `send_text` | After harness is ready | Sent as text to agent's terminal via tmux | Boot-time grounding, identity hints, instructions to read skills |
@@ -167,11 +227,129 @@ Files delivered via `send_text` happen AFTER the harness is ready. The agent rec
- Instructions to load skills (the files are already projected, the message tells the agent to read them)
- Context that should feel like an operator briefing, not pre-loaded content
On a fresh launch the first message is one turn: the session identity, the first `send_text` file and, when a startup
proof is selected, its challenge (below).
A file's `required` field defaults to `true`: a required file that can't be delivered fails startup, and an optional
one is dropped without a message.
### Readiness, startup proof and failure
**Readiness.** After launch OpenRig polls the pane until the harness is interactive (backing off 1, 2, 4, 8 and 16
seconds), for up to 30 seconds by default. Change the window with
`rig config set runtime.readiness_timeout_seconds <1-600>` (or `OPENRIG_RUNTIME_READINESS_TIMEOUT_SECONDS`); it
applies to the next launch. A recognized prompt (the attention codes above) ends the wait at once as
`attention_required`. A timeout ends startup as `failed` ("Readiness timeout after Ns — harness did not become
interactive"), and the post-launch files aren't sent. A Codex fork that the rig launches (a member with
`session_source.mode: fork`, or an agent image's fork) is the exception: its timeout ends as `attention_required`,
with its startup context kept for `rig seat continue` (see below). A seat handover's fork has its own readiness check.
**Claude submission check.** For each startup message to a Claude seat, OpenRig makes a bounded check that the prompt
was submitted. When the capture can't tell, it records the submission as unverified and carries on. When it sees the
same prompt still sitting in the input, it presses Enter once more; if it's still there, it warns "Startup prompt still
staged in <session>; press Enter in that pane." The seat can still end `ready` with its submission `unverified` or
`staged`, so `ready` doesn't prove the prompt was submitted. After all files and actions are delivered, readiness is
checked once more, so a prompt that appears by then gives `attention_required`.
**Startup proof.** A `startup_proof` action selects `authenticated` or `none` (the default is none; the last applicable
one wins, and it needs `idempotent: true`). With `authenticated`, a fresh launch of an agent seat includes a challenge,
and the seat answers it with `rig startup-proof submit --challenge-id <id> --answer <answer>`. `rig ps --nodes --full`
shows the result in the ORIENTED column: `verified`, `missing`, `rejected` or `n-a`. A missing proof doesn't block startup.
**After a failure.** Delivery, launch and action failures, and readiness timeouts other than a Codex fork's, give
`failed`. Every 30 seconds the context monitor marks a `failed` or `attention_required` seat `ready` once its pane reads
ready, unless its fresh or Codex fork context is still pending for `rig seat continue`. A seat that timed out can therefore read `ready` without having received its
post-launch files. If it needs them, first look at what that occupant has done; then
`rig seat launch <seat> --fresh --reason <text>` starts a blank conversation for the seat. If the occupant is still
live, the command refuses with `session_live` unless you also pass `--stop`, which replaces that occupant deliberately.
**Preview before replacing a seat.** `rig seat launch <seat> --fresh --plan` inspects the selected
seat without starting tmux, stopping or launching a process, projecting startup files, or changing
lifecycle/queue records. Add `--json` for structured output. `--fresh` is still required;
`--reason` is optional for the preview and required when executing. Pass `--stop` to preview the
intended replacement of a live managed occupant. Adopted and unmanaged occupants remain blocked.
The plan identifies the target, current occupant, stop requirements, blockers, startup counts,
and each sibling seat's unchanged effect. Siblings stay attached and untouched. Launch composes
a new command through the runtime adapter using current settings; it does not replay a stored
wrapper command. The seat's launch environment and managed executable selection still apply.
The plan does not construct or display the launch command.
A preview is a snapshot, not a reservation or a native-readiness check. Unreadable tmux produces
`complete: false` and `launchable: null` (unknown), unless a known blocker already proves
`launchable: false`. A successful preview exits 0, including blocked or incomplete plans; scripts
must inspect `launchable === true` before deciding to execute. Request failures still exit nonzero.
Execution always resolves and checks the current state again. An older daemon without the preview
endpoint refuses the request; the CLI never falls back to executing a launch.
### Change an existing seat's working directory
Editing `cwd` in an already applied RigSpec doesn't update an existing seat's saved launch directory. Use `set-cwd` to
save a new one for the seat's next launch:
```sh
rig seat set-cwd planning-lead@project \
--cwd /work/project/seats/planning-lead --reason "isolate planning"
rig seat status planning-lead@project
```
**The path:** it must be absolute **on the daemon's host**. OpenRig creates a missing directory, resolves symlinks to
its real path, and refuses a filesystem root.
**What it saves:** the directory and a `node.cwd_changed` audit event (from, to, reason, operator), together, in one
transaction. The seat's node, canonical address, queue, session history and skill selection stay as they are.
`rig seat status` shows **Working directory for future launches** (`launch_cwd` in JSON). That's saved configuration,
not where the running process is.
**What it writes:** it creates the folder if it's missing, and writes nothing else there. The seat's next fresh launch or
rebuild handover writes its startup files there, as launch does today.
**`set-cwd`'s preflight policy:** before saving, it reads, without writing, the enumerated resource copies (including
nested plugin files) and startup skills that launch would place in the new directory, at their actual destinations,
as they are at that moment. It's a point-in-time check, not a global overwrite guarantee or protection against later
changes; at adoption, launch applies its own policy. (The commit's re-check covers the saved startup configuration,
not the destination's file contents.)
- **Refused, with the protected paths named (`cwd_destination_conflict`):** a file there that an operator edited, an
unrecorded file with different content, or two sources for one destination. That's stricter than launch, which
overwrites an unrecorded differing file with a warning; the refusal is deliberate, while the occupant still runs.
- **What to do:** use a clean destination, or move or merge those files, then retry.
- **Not checked:** managed guidance blocks and native configuration merges keep the adapter's policy at launch, and
launch-owned files such as `.openrig/context-collector.cjs` are written by launch as always.
- **A community harness** takes no startup files, so none are checked for it.
**The running occupant keeps its current directory.** Adopt the new one with:
- `rig seat launch <seat> --fresh --stop --reason <text>`, which starts a blank conversation; or
- `rig handover <seat> --source rebuild --reason <text>`, which carries durable context.
**Adopt it promptly.** The saved directory doesn't move the running process, but background work can use it before
adoption. Saved configuration isn't the live process's directory, and these examples aren't the only consumers. For a
running Claude seat:
- **Collector provisioning** writes `.openrig/context-collector.cjs` and merges `.claude/settings.local.json` in the
saved directory, under its existing preservation rules.
- **Managed compaction,** manual (`POST /api/compaction/trigger`) or automatic, asks the seat to write its restore map
under it. That may be outside the seat's current workspace, so a seat without bypass permissions may meet a write
prompt.
Adopting promptly is guidance. It doesn't protect against a poll or a compaction that runs before your next command.
**Before adopting,** don't `rig down`/`rig up` or hand over by fork. Those resume the existing conversation in the
saved directory, and Claude keeps conversations per project directory, so a resume there may not find it.
Cross-directory resume hasn't been run natively; this is the order to follow. `rig seat restart --keep-conversation`
(Codex) isn't adoption: it respawns in the directory it observes from the running process.
**Failures:** a refusal, missing or malformed saved startup context, or an audit-write failure leaves the prior
directory saved, and changes no seat, custody or startup file (a refusal may leave the new folder created). A concurrent configuration change is reported, not overwritten. A CLI timeout means the outcome is
unknown; check `rig seat status` before retrying. Choosing the same directory again records no second event.
**The old directory:** files there are left as they are, since other seats may still use them. The source RigSpec
declaration isn't changed either; update it separately if a future recreation should use the new directory.
### The `applies_on` Field
Each startup file and action specifies when it applies:
- `fresh_start` — delivered on first launch only
- `restore` — delivered on restore from snapshot
- `fresh_start` — delivered when a new conversation starts: the first launch, `rig seat launch --fresh`,
`rig seat continue`, and seats restored with `--fresh`
- `restore` — delivered when a seat is restored, including a restore whose resume falls back to a fresh conversation
- Default: `[fresh_start, restore]` (both)
Use this to avoid re-sending context that the agent already has from its resumed conversation. For example, a one-time project briefing might only apply on `fresh_start`, while identity grounding should apply on both.
@@ -184,15 +362,10 @@ The AgentSpec and RigSpec allow declaring deterministic environment configuratio
### What the Spec Supports
**Hooks** (in `resources.hooks`):
```yaml
resources:
hooks:
- id: pre-commit
path: hooks/pre-commit.sh
runtimes: [claude-code]
```
Hooks are scripts copied to the agent's workspace. They can be git hooks, automation scripts, or environment setup.
**Hooks** ship inside plugins: declare the plugin under `resources.plugins[]`. AgentSpec validation refuses
`resources.hooks`. OpenRig loads one plugin's hooks into a seat itself: the shipped `openrig-core` plugin, for a Claude seat
that selects it (see [the refocus channel](refocus-channel.md#the-mechanism)). The folder a declared plugin is projected into
is not one Claude Code or Codex loads, so a plugin of your own does not get its hooks run by that projection.
**Runtime resources** (in `resources.runtime_resources`):
```yaml
@@ -214,23 +387,26 @@ startup:
phase: after_ready
idempotent: true
```
Commands sent to the agent's terminal after it's ready. Can install MCPs, run setup commands, etc.
Each value is typed into the harness's input and submitted, so it is a prompt or a slash command, not a shell command.
Types are `send_text`, `slash_command` and `startup_proof` (see "Startup proof" above); `shell` is refused.
`idempotent` is required, and an action that isn't idempotent must not list `restore` in `applies_on`. Both phases
run after the harness is ready: `after_files` (the default) after the post-launch files, then `after_ready`.
### Current Support Matrix (OpenRig 0.1.x)
### Current Support Matrix
| Capability | Status | Notes |
|------------|--------|-------|
| Guidance file projection (`guidance_merge`) | **Supported** | Reliable. Primary delivery mechanism. |
| Skill projection (`skill_install`) | **Supported** | Reliable. Skills are copied to workspace. |
| `send_text` delivery after ready | **Supported** | Reliable. Requires harness to be ready. |
| Hook projection | **Experimental** | Files are copied but execution/integration varies by runtime. |
| Hooks | **Through plugins, limited** | `resources.hooks` is refused. OpenRig loads the shipped `openrig-core` plugin's hooks into a Claude seat that selects it (Claude Code v2.1.280 or later); a plugin you declare under `resources.plugins[]` is projected, but its hooks are not loaded. |
| Runtime resource projection | **Supported for recognized fragments** | `claude_settings_fragment`, `claude_mcp_fragment`, and `codex_config_fragment` are applied to provider config. Unknown types are copied to runtime extension directories. |
| Permission configuration | **Native settings plus managed launch flags** | OpenRig launches Claude with `acceptEdits` and Codex with `workspace-write` unless an explicit supported selection changes them. It does not add a global Claude `Bash(rig:*)` allowance. Use [the first-user permission guide](getting-started.md#opt-in-permissive-operation) for opt-in and custom choices. |
| MCP installation | **Experimental** | Claude Code: `/mcp` interactive command or `claude mcp add` from CLI. Can also be described in startup files for agent self-configuration. Reliability depends on runtime TUI state. |
| Permission configuration | **Native settings plus managed launch flags** | OpenRig launches Claude with `acceptEdits` and Codex with `workspace-write` unless an explicit supported selection changes them; a seat with no policy, selection or named Codex profile also gets the per-launch [team default](rig-spec.md#team-launch-defaults), and the `kernel` rig's seats get a wider operational default ([rig spec, "At launch"](rig-spec.md)). Neither is written to a settings file. Use [the first-user permission guide](getting-started.md#opt-in-permissive-operation) for opt-in and custom choices. |
| MCP installation | **Supported for Claude fragments** | A selected `claude_mcp_fragment` is merged into the project's `.mcp.json`. Claude asks to approve new servers found there; that prompt stops startup as `mcp_gate` until someone answers it and runs `rig seat continue`. Otherwise use `/mcp` or `claude mcp add`, or describe the servers in startup files for the agent to configure. |
| System dependency installation | **Not deterministic** | Describe in startup files; agent handles via shell commands. |
| Recurring tasks / wake timers | **Runtime-dependent** | Claude Code supports recurring tasks via the `/loop` command. Codex does not have a confirmed equivalent. Orchestrators should include `/loop` instructions in startup for Claude Code agents. |
### The v0.2.0 Approach: Describe, Then Let the Agent Handle It
### The Approach: Describe, Then Let the Agent Handle It
For anything beyond `guidance_merge`, `skill_install`, and `send_text`, the recommended approach is:
@@ -250,12 +426,18 @@ OpenRig performs best-effort deterministic runtime configuration for managed ses
installations may retain one; existing user settings are not removed.
- Claude global state: `~/.claude.json`
Purpose: pre-trust managed workspaces and mark onboarding complete for fresh managed sessions.
Explicit permission modes use the launch-selected `HOME/.claude.json`, or
`<CLAUDE_CONFIG_DIR>/.claude.json` when that variable is set. Classic startup
retains the daemon-home path.
- Claude project-local config: `.claude/settings.local.json`
Purpose: apply context collector/activity hooks and selected `claude_settings_fragment` resources inside the project without committing them to git.
- Claude project-local MCP config: `.mcp.json`
Purpose: apply selected `claude_mcp_fragment` resources for Claude in that project.
- Codex global config: `~/.codex/config.toml`
- Codex global config: `$CODEX_HOME/config.toml`, or `~/.codex/config.toml` when unset
Purpose: pre-trust managed workspaces and apply selected `codex_config_fragment` resources. Codex currently has no equivalent project-local MCP config path for global profile settings.
- Global skill folders: `~/.claude/skills` and `~/.agents/skills`
Purpose: daemon startup seeds the `openrig-skills` and `refocusing` skills and the person-facing `rigs` skill. Each
upgrade refreshes the `rigs` skill; a copy installed another way is left as it is.
Two important caveats:
- these writes are best-effort and should still be paired with startup guidance so the local agent can verify and repair them if needed
@@ -266,6 +448,39 @@ can affect native configuration, but OpenRig's launch flags can override those
values. Recording a config-surface `permission_policy` is not proof that its
rules were translated or applied. See [permission precedence and limits](getting-started.md#custom-settings-and-precedence).
### Separate Codex homes for separate installations
Set an **absolute `CODEX_HOME` in the environment that starts the daemon** when
you want a separate Codex configuration and state root. OpenRig uses that root
for its startup hook setup/removal and trust records, feature flag, workspace
trust and selected config fragments. Startup can write those files even when
the daemon has no seats.
The explicit selection also applies to future managed Codex fresh, resume and
fork launches, their capability/profile/configuration probes, native thread and
context reads, and plugin-cache discovery. Launch commands reassert it after
pane shell startup, so an rc file cannot silently switch that launch to another
Codex home. Executable and PATH selection stay the same. Existing running
sessions are not moved or restarted; a thread in another home is not searched
as a fallback for an explicitly selected home.
**With `CODEX_HOME` unset, a second install still shares `~/.codex`.** Setting only
`OPENRIG_HOME` separates OpenRig state, not provider configuration. The default
launch behavior is unchanged, including existing pane-shell overrides.
OpenRig does not copy or migrate authentication, history, rules, trust or
settings into the selected home. A separate file-backed home needs its intended
authentication provisioned if absent; OS credential stores and other config
layers can behave differently, so a new login is not universally required.
Explicit Codex auth commands resolve their **caller's** `CODEX_HOME`, otherwise
`$HOME/.codex`; contacting a daemon with `OPENRIG_URL` does not retarget auth
save/switch/registry writes to that daemon's selection. Set the intended root
on those commands as well.
This separates provider files, not OS users or accounts. Project-local resources
still use the selected project directory; shared project and system settings
remain shared.
### Runtime Differences
**Claude Code:**
@@ -283,8 +498,85 @@ rules were translated or applied. See [permission precedence and limits](getting
- Approval policy and sandbox access are separate controls. OpenRig's default
`-s workspace-write` selects the sandbox; it does not force `-a`. A member's
`codex_config_profile` selects native `-p`, distinct from the AgentSpec `profile`.
- On that plain `-s workspace-write` launch (fresh, resume, fork or restore), a
short-lived `codex app-server` first reads Codex's own configuration with the
seat's executable, home and working directory. OpenRig adds
`-c sandbox_workspace_write.network_access=true` only when no configuration
layer sets network access and no managed requirement could restrict it. A
timeout, error or unrecognized answer adds nothing. Named profiles and full
bypass are not read. The read may write Codex's own state files in
`CODEX_HOME`, read its login and fetch managed policy, as a Codex start does.
- Managed launches pass `-c check_for_update_on_startup=false`, so Codex skips its startup update check; your Codex
config is not changed.
- Can self-install dependencies from instructions but timer/recurring behavior is not reliably available
**Pi and OMP:**
- Read `AGENTS.md` in the working directory; guidance is merged there, added to Pi's own system prompt
- Selected skills are projected into the seat's own agent directory under OpenRig's state, not into a shared
workspace folder
**Terminal seats** (`builtin:terminal`) get no agent or profile layers and no startup proof.
### Codex compaction and sizing
OpenRig's managed compaction is for Claude Code seats only, by design. That covers `rig compact`, the
`policies.claude_compaction.*` automatic policy, and the watchdog jobs that the `managed-compaction` and
`apprentice-handover` strategies create. A Codex seat compacts with Codex's own automatic compaction, and OpenRig
leaves that to Codex.
- `rig compact <session>` refuses a Codex seat: "not a Claude (claude-code) seat".
- `rig compact-plan` lists a Codex seat as skipped (`codex_not_managed_by_claude_compact_in_place`).
- The automatic policy never acts on a Codex seat.
- A Codex member with `compaction_strategy: managed-compaction` or `apprentice-handover` gets no watchdog jobs.
**What Codex compacts at.** Codex describes `model_auto_compact_token_limit` as the "token threshold that triggers
automatic history compaction (unset uses model defaults)". Its configuration reference does not say what those
defaults are, and the model catalog's `auto_compact_token_limit` is null for the models we checked in Codex 0.162.1.
Measure a seat's own compactions before relying on an unset limit.
**What window the model has.** `codex debug models` prints the catalog. Each model carries `context_window`,
`max_context_window` and `effective_context_window_percent`. In Codex 0.162.1, `gpt-5.6-sol` has a `context_window`
of 272000 at 95%, which is 258400. That is the `model_context_window` its rollout `token_count` events report.
A limit only matters when it is below that effective window. Leave `model_context_window` alone: don't raise it toward
`max_context_window` to avoid compaction. Set the limit instead.
**Setting the limit for seats only.** Put `model_auto_compact_token_limit` in a Codex profile file,
`$CODEX_HOME/<name>.config.toml` (`~/.codex/<name>.config.toml` when `CODEX_HOME` is unset), and name it on each
Codex member that should use it:
```toml
# ~/.codex/seat-compaction.config.toml
model_auto_compact_token_limit = 150000 # choose your own value
```
```yaml
codex_config_profile: seat-compaction
```
OpenRig passes `-p seat-compaction` on that seat's fresh, fork and resume launches. Codex layers the profile file on
top of the base user config, so only seats that name the profile see the lower limit. A Codex session started without
that profile keeps the base `config.toml` in the same Codex home (`$CODEX_HOME/config.toml`, or `~/.codex/config.toml`
when `CODEX_HOME` is unset). The `150000` is an example, not a recommendation.
With the normal launch mode, `codex_config_profile` replaces OpenRig's explicit workspace-write sandbox flag, so the
profile must set the sandbox and approvals you want. See
[permission precedence and limits](getting-started.md#custom-settings-and-precedence), which also gives Codex's order
of precedence between a profile, project settings and CLI overrides.
**The trade-off.** Every model call carries the whole context so far, so a smaller context makes each call cheaper. The
cost is that Codex compacts sooner and more often, so more of the conversation is carried as a summary instead of
verbatim. A higher limit keeps more detail and makes each call larger.
**Related keys.** These also shape compaction. This guide doesn't recommend values for them. See Codex's
[configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference):
| Key | What Codex says it does |
|---|---|
| `model_auto_compact_token_limit_scope` | `total` (the default) counts the full active context; `body_after_prefix` counts only growth after the carried compaction-window prefix. |
| `compact_prompt` | Inline override for the history compaction prompt. |
| `experimental_compact_prompt_file` | Loads the compaction prompt override from a file (experimental). |
| `tool_output_token_limit` | Token budget for storing individual tool or function outputs in history. |
When authoring startup content, note which instructions are runtime-specific. For example, an orchestrator that needs a monitoring loop should include instructions like: "If running Claude Code, use `/loop 3m` to periodically check rig health. If running Codex, check rig health at the start of each task cycle instead."
---
@@ -301,6 +593,63 @@ profile → uses.skills: [openrig-user]
```
This is the minimum effective startup. The agent knows who it is, how the team works, and how to use the rig.
For seats sharing a working directory, keep each role in its own AgentSpec startup entry:
```yaml
startup:
files:
- path: guidance/role.md
orientation: role
delivery_hint: send_text
required: true
```
`rig queue whoami --json` reports only the calling seat's explicitly marked role
bindings, independently of its current work. The `role.state` is `no-record`,
`not-declared`, `missing`, `present`, or `unknown` when identity, storage or the
observation is unavailable. Files retain their original `path`, `absolutePath`
and `ownerRoot` plus the currently resolved `resolvedPath` and
`resolvedOwnerRoot`. Built-in packaged paths follow the running installation;
existing development-checkout paths stay where they were recorded.
`recordedAt` is the startup-context record write/attempt, which happens before
launch succeeds. Exact resume can retain an older record. `present` means the
resolved file currently exists, not that its bytes still match the spec or that
the agent read it. Unmarked startup files and startup actions are not exposed.
Refocus includes the role path and a re-read reminder with topology or both trees,
even if the trace fails. Work-only mode omits it; disabling refocus still disables
the entire hook. Custom refocus prose keeps its existing precedence. The hook
reuses its work lookup, or makes one bounded lookup when the work node is explicit;
a failed or skipped lookup reports `unknown`.
The shipped kernel seats no longer project their role into shared guidance.
Existing user files and legacy role blocks are left intact; this is not a cleanup
of already-installed shared blocks. General user-authored guidance projection is
unchanged.
The other shipped agent specs that start a seat with `guidance/role.md` mark that
file `orientation: role` too, so `rig queue whoami --json` reports their role and
refocus names it. They never projected a role into shared guidance; their startup
delivery is unchanged.
**Removing a leftover shared role block by hand.** A kernel installed before 0.6.5
may still hold one seat's old role in its working directory's `CLAUDE.md` (or the
rig's configured `managed_blocks` file) or `AGENTS.md`. Upgrading doesn't remove it.
`rig down` removes OpenRig's managed blocks from that file when no other running
rig uses it, so it stays until then. To remove it sooner, by hand:
1. Find the exact block: the lines from `<!-- BEGIN OpenRig MANAGED BLOCK: role -->`
through `<!-- END OpenRig MANAGED BLOCK: role -->` (in older files, `RIGGED`
instead of `OpenRig`). Only the block whose id is exactly `role`; leave
`rig-role`, other ids and everything outside the markers alone.
2. Confirm each seat that shares that directory has its per-seat replacement:
`rig queue whoami --json` run in the seat reports `role.state` as `present`.
A seat started before it was upgraded still has the old content in its
conversation; restart it fresh if you want it to start from the per-seat role.
3. Keep a copy of the file, remove only those lines, and compare the result with
the copy: nothing else in the file should differ.
**Separate project context from role**
Don't put project documentation inside the role guidance. The role is about the agent's function; project context is about what the agent is working on. Use rig-level or pod-level startup files for project context.
@@ -320,7 +669,7 @@ This prompts the agent to actually invoke the skills, not just have them as pass
After identity recovery, verify:
1. `rig ps --nodes` shows your rig running (scoped to your session's rig by default; outside a managed session name it explicitly: `rig ps --nodes --rig <name>`)
2. `rig env status` shows services healthy (if applicable)
2. `rig env status <rig>` shows services healthy (if applicable)
3. Your working directory is correct
4. Required tools are available (node, npm, git, etc.)
@@ -356,7 +705,7 @@ If your rig REQUIRES a hook to function and the hook installation fails silently
When creating a new agent's startup experience:
- [ ] Write a `guidance/role.md` — who is this agent?
- [ ] Reference it in the agent spec's `resources.guidance` AND `startup.files`
- [ ] Reference it in `startup.files` with `orientation: role` and `delivery_hint: send_text`. Avoid projecting distinct seat roles into one shared `AGENTS.md` or `CLAUDE.md`.
- [ ] Write a rig `CULTURE.md` if the rig doesn't have one
- [ ] Choose skills from the shared pool via profile `uses`
- [ ] Write a `startup/context.md` if the agent needs environment grounding
+60 -14
View File
@@ -1,8 +1,11 @@
# Agent state taxonomy
The formal state language every OpenRig surface renders from — TUI, `rig ps`, the node
inventory, and any future consumer. One oracle computes it; surfaces render it; no
surface keeps a private vocabulary.
The formal activity language OpenRig's surfaces render from — the TUI and the `rig ps`
ACTIVITY column. One oracle computes it; surfaces render it. Two exceptions remain: the web
UI's graph node still derives its own running/needs-input/idle/unknown from the legacy
`agentActivity`, and `rig ps --active` / `--filter agentActivity.state` filter on that legacy
field. Startup, orientation, restore and attention states are separate vocabularies, listed
under "Other state on the same surfaces" below.
**This document is the canonical text for the shipped taxonomy** and adds the
engineering reconciliation; it never forks a second vocabulary. Its typed source of
@@ -16,6 +19,12 @@ truth is `packages/daemon/src/domain/activity-taxonomy.ts`.
| activity | `working` · `idle-at-prompt` · `unknown` (+ needs-input as count+reason, below) | what a present agent is doing |
| resumability | `live` · `resumable` · `context-walled` | what a non-present agent can come back as |
Only the activity axis is served today. The session and resumability values are declared in
`activity-taxonomy.ts` but no surface reads them: `rig ps --nodes --full` shows the raw session
STATUS, both node views show a LIFECYCLE of `running`, `detached`, `recoverable` or `attention_required` (`run`, `det`, `rec`,
`att`), and node inventory serves `occupantLifecycle` (`active`, `retiring`, `retired`,
`context_walled`, `compacted`, `crashed`, `unknown`).
The axes never blend. Reachability is strict; revival optimism is a different field
(omnigent's strict-liveness split). `unknown` is a first-class honest value — the oracle
saying it cannot tell. Unknown beats a confident wrong answer.
@@ -35,15 +44,18 @@ collision in both codebases.
## Derived diagnoses — computed at read time, never stored
- **PARKED** — the disease: `(activity = idle-at-prompt OR needs-input pending) ×
(open obligations exist)`. A dropped baton or an unanswered block. Queryable at rig and
seat level; the join lives in the parked query surface, never inside the oracle
(the oracle's non-inference contract: it never reads queue state).
(open obligations OR unhealthy HELD rows)`. A dropped baton or an unanswered block. When
activity is `unknown` the verdict is `indeterminate`, never parked or not-parked. Queryable
at rig and seat level with `rig parked [seat] [--rig <name>] [--json]`; the join lives in the
parked query, never inside the oracle (the oracle's non-inference contract: it never reads
queue state).
- **HELD** — the deliberate counterpart: a queue-level hold with a named owner and an
armed wake (`rig view show held`). Stopping on purpose is HELD; stopping by accident is
PARKED. A HELD row is **not** parked.
PARKED. A HELD row is healthy only while its wake is live, and not fired-but-unconsumed
unless the stuck sweep owns its recovery; an unhealthy HELD row on a stopped seat makes
the seat parked.
- **DONE-UNSEEN** — finished work whose completion nobody consumed (herdr derives it as
idle ∧ unseen). Declared here and computed at read time from claims/transitions,
outside the activity oracle, preserving its non-inference boundary.
idle ∧ unseen). Declared as a concept only; no surface computes it yet.
## Reconciliation with prior art
@@ -65,8 +77,10 @@ time-bounded evidence. Rungs, top down, with each rung's retirement condition:
- **r3 — Claude `sessions/<pid>.json` self-report** (busy/shell/idle/waiting, since
v2.1.139): standing, above hooks for working/idle. Undocumented internal — unreadable
means fall down the ladder, never error.
- **r2 — lifecycle hooks** (Claude Stop/StopFailure; Codex UserPromptSubmit/Stop/
PermissionRequest): standing. Exactly-once turn boundaries; SubagentStop filtered (it
- **r2 — lifecycle hooks** (Claude SessionStart/UserPromptSubmit/Stop/Notification;
Codex SessionStart/UserPromptSubmit/Stop/PermissionRequest): standing for Claude; Codex's
hook rung starts at trial and is promoted after 50 agreeing observations over at least an
hour. Exactly-once turn boundaries; SubagentStop filtered (it
can fire post-turn and must never revive an idle seat). Hook-rung authority is
TIME-BOUNDED: the hook rung is the only rung that does not self-date its evidence, so
persistent cross-rung contradiction degrades it to identity-only, visibly, with a
@@ -76,11 +90,27 @@ time-bounded evidence. Rungs, top down, with each rung's retirement condition:
- **r1 — window-activity sampling** (today's oracle): the fallback tier. Retires
PER-HARNESS when that harness's hook rung earns trust through a measured agreement
window in production — never by fixture pass alone (symmetric admission: a fixture
pass admits a rung to TRIAL; production agreement promotes it; identity-only until
promoted).
pass admits a rung to TRIAL, where it is measured but not consulted; production agreement
promotes it). Undeclared and partial-coverage rungs are identity-only, which is also where
a degraded rung goes, with one declared exception: for a pi or omp seat or a community
harness, sampling is positive-only: a changing pane reads working, and a quiet one never reads idle on its
own, since the pane can be quiet mid-turn.
- **pi and omp runner hooks**: OpenRig's runner reads the child's RPC event stream and posts
each turn boundary (`agent_start`, `turn_start`, tool calls, `agent_end`; attention). These
decide working, idle and needs-input. Unlike Claude and Codex hooks, an idle or attention
boundary holds until the next one instead of expiring after 15 s; a working boundary still
expires, so a turn whose end was lost reads unknown, not working forever. Posts are taken
in the runner's own order (time, then its sequence), so an older boundary arriving late
doesn't win. The runner's report that its child
exited reads unknown, not idle. A boundary the runner didn't see (if a runtime ended a turn
without `agent_end`) leaves the seat working up to the 15 s window, then unknown, never idle. After a
daemon restart, a runner seat takes its last recorded boundary from the hook store, for its
current session and occupant generation only, so an idle seat still reads idle before it
posts again.
Partial-coverage honesty: a source with partial lifecycle coverage gets identity-only
trust. The ladder is also the migration path — new oracles slot in above existing
trust, unless its inventory declares it positive-only. A positive-only source can report
working and nothing else; its silence reads unknown, never idle. The ladder is also the migration path — new oracles slot in above existing
heuristics, lower rungs retire a release at a time, consumers never see a flag day.
Seat-keyed: state attaches to the durable seat nodeId, never the occupant. A handover or
@@ -88,6 +118,22 @@ generation swap is its own visible event — never an activity transition — an
rung-inventory re-declaration: a successor never inherits its predecessor's rung
authority (hooks live in occupant config while the pane is seat-persistent).
## Other state on the same surfaces
These are separate vocabularies, not activity values. `rig ps --nodes --full` shows them in
its STARTUP, ORIENTED, LIFECYCLE and RESTORE columns (the default compact view shows only
LIFECYCLE); see the
[startup guide](agent-startup-guide.md) for how each arises.
- **Startup status:** `pending`, `ready`, `attention_required`, `failed`. `ready` means
startup finished, never that the seat is oriented, and a seat isn't marked `ready` while
its startup context is still pending for `rig seat continue`.
- **Oriented:** `verified`, `missing`, `rejected`, `n-a`, from the startup proof.
- **Attention codes:** `trust_gate`, `hook_trust_gate`, `update_gate`, `login_required`,
`mcp_gate`, `bypass_consent_gate`, `codex_auth_refusal`, `codex_client_incompatible`.
- **Restore outcome:** `resumed`, `fresh-primed`, `awaiting-decision`, `attention_required`,
`failed` (plus `rebuilt`, `operator_recovered` and the legacy `fresh`).
## Rejected oracles — dated receipts (2026-08-26), so nobody re-derives them expensively
- **transcript-quiescence as an activity oracle: REJECTED.** omnigent's 1-second version
+49
View File
@@ -0,0 +1,49 @@
## Browser access and allowed addresses
The OpenRig daemon answers its API only when a request is addressed to this machine and, if it
comes from a web page, only when that page is the OpenRig UI or a page you allowed.
### What works with no setup
- The CLI, the TUI and agents on this machine, addressing the daemon by `localhost` or an IP
address.
- Other OpenRig hosts and clients that reach this daemon by its IP address, its own hostname, or
its own Tailscale name (for example `my-machine.your-tailnet.ts.net`, or the short `my-machine`).
The daemon learns its own Tailscale name automatically from Tailscale on this machine.
- The web UI, when it is turned on (`rig config set ui.enabled true`, then restart the daemon) and
opened over `http` on the daemon's own port at any address the daemon accepts, including its
Tailscale name. A UI page served any other way, such as over `https` through your own domain,
also needs its exact origin in `OPENRIG_ALLOWED_ORIGINS`, then a daemon restart.
### When you see a refusal
The daemon answers `403` with a sentence that says what to do. There are two kinds:
- **The address is not recognized** (`untrusted_host`). You reached the daemon by a name it does not
know as its own, such as a custom DNS name, an alias in `/etc/hosts`, or a reverse proxy domain.
Use `localhost`, an IP address or the machine's own name instead, or list the name you use:
`OPENRIG_ALLOWED_HOSTS=rig.example.com` in the daemon's environment, then restart the daemon.
A client that presents the daemon's configured bearer token is not refused for its address
(it still needs whatever access each route requires).
- **The web page is not allowed** (`browser_origin_refused`). A browser page that is not the
OpenRig UI at the daemon's own address called the API. This includes another local app or
development server on a different port. To allow a page, list its exact origin:
`OPENRIG_ALLOWED_ORIGINS=http://localhost:5173` in the daemon's environment, then restart the
daemon. A bearer token does not override this.
`OPENRIG_ALLOWED_HOSTS` lists names you use to reach the daemon. `OPENRIG_ALLOWED_ORIGINS` lists
web pages allowed to call it. They are separate: a UI served through your own domain usually needs
both. Separate several entries with commas. Pages on other origins cannot read the refusal; the
message is for you, the CLI and agents.
### Limits
- If you rename the machine in Tailscale, the daemon keeps accepting its previous name until it
restarts or until it next looks its name up after seeing an unrecognized one.
- If the daemon has not reached Tailscale's resolver since it started, its Tailscale name is
refused until a lookup succeeds. A later failed lookup keeps the name it already learned.
`localhost` and IP addresses keep working.
- This protects against unknown web pages and unknown names. It is not complete browser isolation:
a page on another site can still cause a simple read request to an address the daemon accepts,
although it cannot read the answer. Keep the daemon on loopback or your tailnet.
+209
View File
@@ -0,0 +1,209 @@
# Bundle formats (v1)
The shared data formats for sharing rig bundles: the configurations a bundle offers, the before-install view of what it
will do, run records and the public status file, and registry entries. The schemas are in [`schemas/`](schemas/), with
fixtures that pass and fail them in [`schemas/fixtures/`](schemas/fixtures/). Tools outside this repository read them
at a pinned commit.
**A v1 format only grows:** new optional properties may appear, and consumers ignore properties they don't know. Any
other change is a v2. The schemas are open to new properties, with three closed on purpose: the package digest (an exact
value), a run record's subject (a harness check can never carry a team's identity), and the public status file, where
nothing outside the schema may appear, so a private field can't leak in. A new property in a closed part is a v2. The
status schema also rejects labels that contradict their evidence: a tested label needs records and a package, tested
with help needs its count, tested can't carry a count above zero, and an unreadable listing carries only Status
unavailable.
## Three identities, kept apart
| What | Name | Defined by |
|---|---|---|
| What someone chose | configuration ID | the mapping of every seat to a runtime |
| What was packaged | package digest | the built archive's files |
| What actually ran | execution binding | a run record (resolved resources, settings, environment, unknowns) |
None stands in for another. A package digest doesn't describe what ran, and a configuration ID doesn't describe what was
packaged.
### Source identity
A bundle on GitHub is named by `repository` (`https://github.com/<owner>/<repo>`, no credentials), `folder` (the
repo-relative path of the folder holding `rig.yaml`, or `.` for the repository root) and `resolvedCommit` (40 lowercase
hex).
- `requestedRef` (the branch, tag or commit someone gave, or `HEAD` for a link without `/tree/…`) and `canonicalUrl`
(`…/tree/<resolvedCommit>/<folder>`, with each folder segment percent-encoded and no folder part for the root)
explain it, and aren't part of it.
- A built bundle records its source in its manifest's provenance, which is outside the package digest.
### Configuration ID
Every member's `pod.member=runtime`, sorted by `pod.member` in UTF-16 code-unit order, joined with `,`. There's no
whitespace, and runtimes are spelled as in `rig.yaml`. For example:
```text
dev.build=claude-code,dev.qa=claude-code,dev.review=codex,orch.lead=codex
```
Preset names such as `recommended` or `all-claude` are aliases shown beside the ID, never part of it.
### Package digest
`{ algorithm: "sha256", value, coverage: "openrig.package-digest/v1" }`:
- `value` is SHA-256 over UTF-8 lines `<quoted path>\t<sha256>\n`, one for each entry of the built archive's
`integrity.files`, sorted by path in UTF-16 code-unit order;
- `<quoted path>` is the path as a JSON string, exactly as JavaScript's `JSON.stringify(path)` writes it, so a tab or
newline in a file name can't make two different file lists hash the same. In words: wrapped in `"`; `"` and `\`
escaped with a backslash; U+0008, U+0009, U+000A, U+000C and U+000D written `\b`, `\t`, `\n`, `\f` and `\r`; any
other character below U+0020, and any lone surrogate, written `\uXXXX` in lowercase hex; everything else as itself;
- it's the same when the same folder is rebuilt by the same OpenRig, while the archive's own hash changes with every
build (`createdAt`).
**Coverage, shown wherever the digest is:** the bytes of every packaged file. It doesn't cover:
- `bundle.yaml`, so no manifest field, provenance or `createdAt`;
- the names the integrity walk skips (`.DS_Store`, `Thumbs.db`, `.gitkeep`);
- file modes;
- anything resolved on the installing machine at launch, for example an `openrig-home:` plugin, catalog skills, or a
model or effort nothing declares.
**A build result** carries `source` (`null` unless the bundle was built from a GitHub link), `configurationId`,
`packageDigest`, `archiveHash` and `assembler`. `rig bundle inspect` reports the same fields for an archive, and any the
archive doesn't state are `null`. `assembler` is `{ openrigVersion }`: the format also allows a `commit`, which this
OpenRig doesn't write. `configurationId()` and `packageDigest()` are exported from `@openrig/daemon/bundle-identity`.
Shared test vectors are in `schemas/fixtures/identity-vectors.json`.
## The formats
| Format | Schema | Lives | Written by |
|---|---|---|---|
| Declared configurations | `bundle-configurations.v1` | `configurations.yaml` beside `rig.yaml` | the bundle's author |
| Before-install view | `bundle-behaviour.v1` (`openrig.bundle-behaviour/v1`) | the registry, one file per configuration and assembler version; never inside the archive | the daemon's inspect: `rig bundle inspect`, under `behaviour` with `--json` |
| Run record | `run-record.v1` | beside its receipt, private | Fleet, Dev QA, and maintainers for community reports |
| Public status | `bundle-status.v1` | `openrig-registry` status, generated | the status generator only |
| Registry entry | `registry-entry.v1` | `openrig-registry/registry/<slug>.yaml` | maintainers, through review |
### Declared configurations
`seats` gives a `pod.member` the runtimes it may use, and the profile each runtime uses. A member it doesn't list keeps
the runtime `rig.yaml` gives it. `presets` names full mappings, and `recommended` names one of them, which must be
`rig.yaml` as written. `rig bundle create`, `rig bundle configurations` and `rig bundle check` refuse a file that breaks
these rules.
`--preset` and `--seat` choose a configuration (see the [rig bundle reference](rig-bundle.md)). Any mix of each seat's
declared runtimes can be built, not only the presets; a runtime a seat doesn't declare is refused, and nothing is built.
Without either flag, create builds `rig.yaml` as written. The built archive's manifest records
`configuration: { id, preset }` outside the package digest; `preset` is there only when `--preset` or `--seat` chose a
mapping that matches a declared preset.
### Before-install view
It's derived from the archive's files alone. Nothing is launched, probed or fetched. It's a view, never a gate, and
carries no tested status.
- **`identity`:** source, configuration ID, package digest, the archive's assembler, the generator that made the view,
stated compatibility, stated provenance (not verified), and integrity (self-consistency, not authorship). A source,
configuration ID, package digest or assembler the archive doesn't state is `null`; unstated compatibility and
provenance are empty objects. None of it is filled from the inspecting OpenRig.
- **`team`, `posture`, `toldFiles`, `alsoRuns`, `writes`, `outsideAddresses`, `needs` and `unknownBeforeLaunch`**, in
that order. Facts cite the archive file they come from (`sourceRefs`), except `team` entries and the bundle-wide
unknowns. `toldFiles` and `alsoRuns` also say how each resolves: `archive`, `host_at_launch` or `unresolved`.
- Posture separates what the archive declares from the product's default. Its effect on the host is `unknown`,
because host settings decide it.
Optional `posture[].permissionPrompts` is `off` for declared `full_bypass` (including rig- or member-level
`builtin:yolo`) on any runtime; for Claude/Codex, `on` for a declared flag-surface floor policy or `default` when
no policy is declared (prompts on unless the installing machine's settings turn them off); for Codex, `on` for
declared `auto`. Omit it for Claude under auto (naming auto mode in `selection`), config-surface policies
(`builtin:locked`, `builtin:standard`, `builtin:open` or an archived `surface: config` policy), host-resolved
Codex profiles, `permission_policy: none`, a policy the archive can't resolve, and every runtime other than Claude
and Codex (Pi, terminal) except declared full bypass. `selection` names the declared policy.
An absent field means not stated, never `on`. For `off`, Claude
bypasses permissions, Codex runs with full access and never asks, and Pi gets full resource trust (`--approve`,
not a permission mode). These are archive facts; `nativeEffect` remains `unknown`.
Optional `posture[].firstRunWarnings.claudeBypass: "harness_asks_once"` names the first-run bypass warning for a
declared full-bypass Claude seat, conditional on whether the harness has remembered acceptance.
`posture[].nonInterruptive: "available"` says a full-bypass Claude/Codex seat can use
[non-interruptive launch flags](non-interruptive-mode.md). It does not select the option, read host acceptance
state or prove a prompt-free launch. Both fields are omitted where inapplicable or unresolved; older v1 views
remain valid without them. Optional `posture[].nonInterruptiveDefault` (boolean) carries the rig's authored
`non_interruptive` for those seats; an explicit launch choice overrides it. When it is `true`, `firstRunWarnings`
is omitted. Pi has no additional warning-suppression flag. `nativeEffect` stays `unknown`.
- An empty list means none are known. Something unknown goes in `unknownBeforeLaunch`.
- Per-seat facts carry `seat` (`pod.member`) and human output labels them with that identity. It's required on
`team` and `posture`. Elsewhere it's optional: bundle-wide facts (services, library and project writes, setup and
version needs) omit it, and older generators may not have stated it.
- **`not_generated`:** a combination without a generated view, or an archive the generator can't describe: schema 1, no
readable pod-aware rig spec, a member missing its pod, id or agent reference, a runtime that depends on an AgentSpec
the archive can't read, or an error while reading. It carries a reason and the local command that shows it, and no
sections.
### Declared setup preconditions
The author's `bundle.yaml`, beside `rig.yaml`, may declare setup that the user must do before installing:
```yaml
preconditions:
- name: Run inside an OpenRig source clone with dependencies installed and packages built.
commands:
- git clone https://github.com/mvschwarz/openrig.git
- cd openrig
- npm ci
- npm run build
- name: Sign in to the selected coding runtimes before starting the team.
```
Local-folder creation and GitHub-link imports carry these declarations into the archive manifest. A generated
before-install view lists each as `needs[]` with `kind: precondition`, the author's `name`, optional ordered `commands`,
`status: not_checked`, and a `sourceRefs` entry naming `bundle.yaml` and `preconditions[index]`. Inspect, plan and apply
previews show the same declaration. A legacy schema-1 archive retains it in the manifest, but its view remains
`not_generated`. Missing preconditions mean none were declared, not that no setup is needed.
Each command is one plain command line, without shell operators (`;`, `&&`, pipes, command substitution, backticks or
redirection). Run them in order in **one shell**, then run the install command in that same shell: it inherits the
working directory left by the setup commands. There is no separate `workdir` field. Commands are untrusted author data;
a site building a copyable block must validate every line and bound the number of entries, omitting all setup lines
if any fails its plain-command rule. OpenRig displays these declarations; it does not execute them, verify that setup
was done, or add a prerequisite gate. The archive hash covers the manifest; `packageDigest` excludes `bundle.yaml`
and therefore does not cover these declarations.
At creation, malformed preconditions produce a warning and the whole block is omitted; other author-field validation
is unchanged. Shell operators in otherwise valid command lines produce a warning, but the declarations are retained
as data. An already-built archive with malformed preconditions reports them as unknown before launch.
### Run records and status
**A run record's subject** is either a team (source, configuration ID, package digest, assembler) or a harness check (a
runtime). A harness check never upgrades a team label.
**A run record's `environment.platform` and `arch`** are Node's `process.platform` (`linux`, `darwin` or `win32`) and
`process.arch` (`x64` or `arm64`): the values a status platform key can carry, so every valid record can be labelled.
**Records are private.** Only `outcome.publicNote` (a short public cause) reaches the status file.
**Relations:** `supersedes`, `withdraws` and `resolves`. Reusing earlier evidence for a changed package is a reviewer's
decision, recorded in the registry entry's `evidenceReuse`.
**The status file** is generated from records by rule `openrig.status-rule/v1`:
- **Labels:** `known_problem`, `tested`, `tested_with_help`, `partly_tested`, `not_tested` and `status_unavailable`.
They're shown as Known problem, Tested by OpenRig, Tested with help (N), Partly tested, Not tested by OpenRig
and Status unavailable.
- **A label belongs to one configuration ID.** No configuration is ever shown another configuration's label.
- **Empty `platforms`** means Not tested by OpenRig. So does a custom configuration, one the listing doesn't offer.
- **Status unavailable is only for a listed configuration** whose records can't be read, or that's missing from the
status file; never Not tested by OpenRig. A listing whose records can't be read is `status_unavailable` as a whole.
- **Platform keys** are `<os>-<arch>` (`linux`, `darwin` or `win32`; `x64` or `arm64`).
- **`tested` means no help was needed:** it can't carry an assistance count above zero.
- **An assist** is one action a person or the test runner took to get past a problem during the run, such as restarting a seat or re-running a command; following the bundle's own documented steps doesn't count.
- **The file holds no private paths, host names, row IDs, account names or receipt text,** and regenerating it gives
identical bytes.
- **`bodyDigest`** is SHA-256, lowercase hex, over the RFC 8785 (JCS) canonical JSON, as UTF-8, of an object holding
every other top-level field. The site import recomputes it and rejects a hand-edited file. `harnessChecks` has its own
`state`, so an unreadable harness-check record reads Status unavailable too.
### Registry entries
Each entry records:
- the source at its reviewed commit;
- each offered configuration with its package digest, assembler and behaviour-view file;
- optional `evidenceReuse`;
- the review date, and `listed` or `withdrawn` (with `withdrawnOn`).
v1 has no author field: a listing shows the owner of `source.repository`.
A listing shows "Reviewed for listing on `<date>` at commit `<short>`. Review is not a security audit."
+18 -9
View File
@@ -50,19 +50,25 @@ Established chain names on the topology tree:
- `LEARNED.md` — what a POSITION has learned; never shared or shipped as-is.
A seat's LEARNED is identified by its PATH: the same seat name in two rigs
is two different files.
- `CULTURE.md` — norms layered into members at startup.
- `CRAFT.md` — how work is done at that altitude (shipped at instance, rig and
seat), with `ORCHESTRATION-CRAFT.md` at rig level for orchestration practice.
- `CULTURE.md` — team norms. Note that startup delivers the rig spec's own
`culture_file` (a path beside `rig.yaml`), not a `CULTURE.md` under
`topology.root`.
### The project tree
Rooted at the workspace keys (`workspace.root`, `workspace.slices_root`).
Chain names there: `SPEC.md` (intent in frontmatter composes up the chain;
specification is a leaf property), `PROOF.md`, `PROGRESS.md`.
specification is a leaf property), `PROOF.md`, `PROGRESS.md`. The walkers also
read `NOTES.md` (or `MISSION_NOTES.md`), and fall back to `README.md` for a node
without a `SPEC.md`.
**Project-tree context cannot ship.** It describes what *you* are building —
mission intent, slice specifications, proof contracts. No vendor can author it
in advance, and shipping a default would install someone else's project as
your context. The demo project carries a worked example to copy from; real
projects author their own. (Topology-tree context is the opposite: how a team
your context. Real projects author their own; `rig scope mission create` and
`rig scope slice create` start the tree. (Topology-tree context is the opposite: how a team
of agents runs well is largely general, which is why included rigs ship
defaults.)
@@ -70,8 +76,11 @@ defaults.)
Before this convention the topology tree lived at `~/.openrig/shared-docs/rigs/`
(design decision 2026-08-14: an arbitrary folder on one machine, not a product
path). That location **stays readable** as a per-level fallback so existing
rigs migrate instead of breaking — but every read that resolves there emits a
path). That location **stays readable** as a per-level fallback for
`rig context trace`, at the rig and seat levels, so existing rigs migrate instead
of breaking. The refocus trace, `seat:` profile atoms and handover priming read
only `topology.root`, so until migration they report those files as missing. Every
read that resolves to the legacy location emits a
named advisory (`legacy-topology-read: …`) stating the legacy source, the
canonical destination under `topology.root`, and the config key. A silent
legacy read is a defect. The legacy literal lives in exactly one helper per
@@ -93,9 +102,9 @@ reproduces the drift it was meant to catch. Run it; do not recall it.
## Shipped defaults and the curation path
Included rigs (product-team first) ship sensible-default chain files at the
applicable instance, rig, pod, and seat altitudes, installed under
`topology.root` at rig-up.
Included rigs ship sensible-default chain files under a `topology/` folder,
installed under `topology.root` at rig-up. Today only `factory` ships one,
with instance, rig and seat defaults; the installer also supports pod defaults.
A shipped default is a **starting point** the occupying team appends to — it
is never overwritten by a later rig-up (existing files win).
+69
View File
@@ -0,0 +1,69 @@
# Custom Claude status line
OpenRig installs a silent context collector as `statusLine.command` in the seat
working directory's `.claude/settings.local.json`. Claude's project-local setting
overrides your user-level status line, so a renderer configured only in
`~/.claude/settings.json` can disappear in that directory. Other Claude sessions
using the same directory also read that setting.
Since 0.6.5, OpenRig preserves a custom, nonempty project-local status line command,
including a wrapper or a command composed with shell operators. It still refreshes
its own collector script. If your command does not run the collector, context and
provider usage stop updating, and Claude resume-token capture at adoption or
handover loses its current session evidence. An earlier sidecar can remain and
contain an older session ID; without one, context and capture report
`missing_sidecar`, and provider usage reports `no_statusline_cache_yet` unless an
earlier cache remains.
## Feed both commands the same input
On macOS, Linux or WSL2, save a wrapper such as this, replacing the three
placeholder paths and `my-statusline` with your actual commands:
```sh
#!/bin/sh
input=$(cat)
printf '%s' "$input" |
node '/seat/cwd/.openrig/context-collector.cjs' \
'/instance/home/state/context-usage' \
'/instance/home/state/provider-usage' >/dev/null 2>&1
printf '%s' "$input" | my-statusline
```
Take the collector path and both directory arguments from the existing generated
`statusLine.command` in that seat's `.claude/settings.local.json`; the instance
home is the selected `OPENRIG_HOME`. Keep paths quoted, including paths with
spaces. Each command needs the same status line JSON on stdin: simply running
the collector and renderer in sequence against a single stdin lets the first
consume the input.
In that same settings file, merge this field while preserving your other settings:
```json
{
"statusLine": {
"type": "command",
"command": "sh '/absolute/path/to/openrig-status-line.sh'"
}
}
```
Use the renderer command from your user-level configuration in the wrapper. The
collector stays silent and the renderer supplies the visible status line. This
POSIX-shell example applies to WSL2's Linux installation; it does not establish
native Windows support.
## Check after an upgrade or instance change
The collector command's paths and arguments are implementation details. OpenRig
preserves your wrapper, so it cannot refresh those arguments for you. Recheck
them after an upgrade, a seat-directory move or an `OPENRIG_HOME` change.
After Claude next updates its status line, inspect context usage in `rig ps` or
`rig whoami --full` from the seat. Unknown or stale context is a reason to check
the wrapper; it does not prove the collector is running. For a direct check,
inspect the current session's JSON under the configured `state/context-usage`
directory: its timestamp should advance and its `session_id` should match the
current Claude session. A visible custom status line alone does not verify
collection or end-to-end adoption/handover recovery. The wrapper above suppresses
collector errors; remove its stderr redirection temporarily when diagnosing it.
+24 -9
View File
@@ -1,8 +1,18 @@
# Developing OpenRig — gates and lanes
This is the contributor-facing statement of which checks BLOCK a change and which are
advisory. There is no external CI at this tip: the root `package.json` script chain IS
the gate, and the release checklists invoke it.
advisory. Every pull request to `main` runs `.github/workflows/tests.yml` on a clean GitHub
runner: build and packaging, typecheck, the repository scripts (`npm run test:repo`), each
workspace's test suite (daemon, cli, tui and ui) on macOS without ambient credentials or
external network, and an installed-package scenario (`scripts/run-pr-scenarios.sh`). The root
`package.json` scripts below run the same build, typecheck, repository and test checks locally,
with one difference: `npm test` does not include the UI suite, which CI runs as
`package-tests (ui)`. Run `npm run test:ui` for it.
**In a fresh clone or worktree, run `npm ci`, then `npm run build`,** as CI's build-and-package and
package-test jobs do (typecheck and repo-checks build only the daemon, through their scripts; see
`CONTRIBUTING.md` and [worktree builds](worktree-builds.md)).
Locally, `npm test` builds only the daemon, and `test:workspaces` and `test:ui` build nothing.
## Blocking gates (must pass before a candidate moves)
@@ -10,23 +20,28 @@ the gate, and the release checklists invoke it.
|---|---|---|
| Typecheck | `npm run lint` | daemon + **ui** + cli + tui tsconfigs — UI typecheck STAYS blocking |
| Build | `npm run build` | all workspaces — the UI dist ships in the package, so its build STAYS blocking |
| Repo scripts | `npm run test:repo` | script self-tests, docs guard, skill mirror check |
| Repo scripts | `npm run test:repo` | daemon build, script self-tests, first-run reference check, docs guard, skill mirror check, context-pack generation check |
| Unit tests | `npm run test:workspaces` | `packages/daemon` + `packages/cli` + `packages/tui` |
| UI unit tests | `npm run test:ui` | `packages/ui` vitest. NOT part of `npm test`, but every pull request runs it as `package-tests (ui)` (the `package-tests` matrix in `.github/workflows/tests.yml`) |
| Installed-package scenario | CI only: `scripts/run-pr-scenarios.sh` | the installed package, a daemon restart and a seeded durability failure. The script refuses to run outside GitHub Actions unless given `--remote` with `DOCKER_HOST=ssh://…` |
| Package file lists | CI only | records each package's published file list (`npm pack --dry-run`) |
`npm test` runs `test:repo` and `test:workspaces` — the blocking set is readable in the
script itself.
`npm test` runs `test:repo` and `test:workspaces`; `npm run test:ui` is the separate UI
suite. Both sets are readable in the root `package.json` scripts.
## Advisory lane
| Lane | Command | Meaning |
|---|---|---|
| UI unit tests | `npm run test:ui` | runs `packages/ui` vitest at will; NOT part of `npm test` |
| Portability report | `node scripts/portability-report.mjs` | lists added lines with machine-specific values; findings never fail it (`.github/workflows/portability-report.yml`) |
## The norm (web-UI freeze at 0.5.0)
Daemon API changes no longer require UI sync or UI verification; the contract mirrors
under `packages/ui/src/hooks/` are no longer proactively maintained; a new `test:ui`
failure signals a moved API contract, not a broken gate.
Daemon API changes no longer require browser or interaction verification of the UI, and
the contract mirrors under `packages/ui/src/hooks/` are no longer proactively maintained. A
new `test:ui` failure usually signals a moved API contract. Because pull-request CI runs the
UI suite as `package-tests (ui)`, the change that moves the contract has to update the affected
UI test or mirror to pass that check.
Browser/interaction testing of the web UI is not a contributor gate. (The packaged
starter-rig agent skills that exercise the UI are product content for user rigs, not
+18 -10
View File
@@ -1,8 +1,7 @@
# Edge Types Reference
Version: 0.2.0
Last validated against code: 2026-04-11
Source of truth: `packages/daemon/src/domain/rigspec-schema.ts`, `packages/daemon/src/domain/rigspec-instantiator.ts`
Last validated against code: 2026-10-07, at the 0.6.6 cut `2620dea8` (whole document at `fcaf1f8e`; its sources unchanged in edge behaviour since then)
Source of truth: `packages/daemon/src/domain/rigspec-schema.ts`, `packages/daemon/src/domain/rigspec-instantiator.ts`, `packages/daemon/src/domain/queue-owner.ts`
---
@@ -17,17 +16,18 @@ See `docs/reference/rig-spec.md` for the YAML syntax.
## Edge Kinds
Five edge kinds are accepted by the validator:
Five edge kinds are accepted by the pod-aware validator (the legacy flat-node format accepts only `delegates_to`,
`spawned_by` and `can_observe`):
| Kind | Accepted | Has Runtime Behavior | Description |
|------|----------|---------------------|-------------|
| `delegates_to` | yes | **yes — affects launch order** | Source delegates work to target |
| `spawned_by` | yes | **yes — affects launch order** | Target was spawned by source |
| `delegates_to` | yes | **yes — launch order and queue escalation** | Source delegates work to target |
| `spawned_by` | yes | **yes — affects launch order** | Source was spawned by target |
| `can_observe` | yes | no | Source can observe target's output |
| `collaborates_with` | yes | no | Peer collaboration |
| `escalates_to` | yes | no | Source escalates to target |
## What Edges Actually Do Today (OpenRig 0.1.x)
## What Edges Actually Do Today
### Launch ordering
@@ -36,10 +36,16 @@ Only `delegates_to` and `spawned_by` affect runtime behavior. They constrain the
- **`delegates_to`**: source launches BEFORE target. The delegator must be up before the delegate.
- **`spawned_by`**: target (parent) launches BEFORE source (child). The parent must be up before the child it spawned.
This ordering is enforced in both `PodRigInstantiator` (initial launch) and `RestoreOrchestrator` (restore from snapshot). The code uses topological sort over the dependency graph — if there's a cycle, instantiation fails.
This ordering is enforced in both `PodRigInstantiator` (initial launch) and `RestoreOrchestrator` (restore from snapshot). The code uses topological sort over the dependency graph — if there's a cycle, instantiation fails with `cycle_error` before the rig is created. A `delegates_to` or `spawned_by` edge from a member to itself counts as a cycle. Restore uses the same sort but has no cycle check of its own.
All other edge kinds (`can_observe`, `collaborates_with`, `escalates_to`) do NOT constrain launch order.
### Queue escalation
`delegates_to` also names a seat's orchestrator for the queue: the source of the `delegates_to` edge into a seat. The
wake ladder escalates an unacknowledged row to that orchestrator, and stuck-row findings and recovery go to it. A seat
with no incoming `delegates_to` edge has no default orchestrator. `spawned_by` plays no part here.
### Graph visualization
All edges are rendered in the UI topology graph. They create visual connections between nodes, helping the operator understand the team structure. Pod-local edges appear within the pod group; cross-pod edges connect across groups.
@@ -50,13 +56,15 @@ All edges appear in `rig whoami --json` output under `edges.outgoing` and `edges
### Attach hint heuristic
The post-command handoff (the "Attach:" line after `rig up` and `rig restore`) uses edges to prefer the orchestrator as the default attach target. The heuristic looks for the first node with `delegates_to` outgoing edges.
The post-command handoff (the "Attach:" line after `rig up` and `rig restore`) doesn't use edges. It names the first
node, in creation order, whose session is running, or else the first node with a session name.
## What Edges Do NOT Do Today
Edges do NOT currently:
- **Route messages** — `rig send` can target any session, regardless of edges
- **Route messages** — `rig send` can target any session, regardless of edges (queue escalation, above, is the one
daemon path that follows `delegates_to`)
- **Enforce delegation** — an agent can communicate with any peer, not just its edge targets
- **Control permissions** — there's no edge-based access control
- **Affect transport** — `rig capture`, `rig broadcast`, etc. work based on session identity, not edge topology
File diff suppressed because it is too large. Load diff
+23 -8
View File
@@ -115,9 +115,12 @@ outcome list affirms zero outcomes, not failed discovery. `false-positive`
clears the suspicion without inventing a denominator when no missing facts remain.
A false-positive assessment that still names missing facts stays indeterminate
and does not close the episode interval. `indeterminate` supplies
no outcomes and names the missing fact in `missingFacts`. Required references
must resolve inside the workspace; extra evidence beyond the initial packet is
allowed. The receipt retains the actual actor, timestamp, identity provenance,
no outcomes and names the missing fact in `missingFacts`. `established` needs
`boundedAuthority` set to true or false (not null) and no missing facts; while an
established census still confirms the signal, a `false positive`, `insufficient
evidence` or `resolved` verdict is refused. Required references must resolve
inside the finding's resolved project folder (the configured workspace when no
project resolves); extra evidence beyond the initial packet is allowed. The receipt retains the actual actor, timestamp, identity provenance,
source basis, and evidence hashes. A changed basis refuses a stale submission.
Later evidence changes make confirmation indeterminate rather than preserving
a false ratio. Outcome meaning remains attributed agent judgment.
@@ -131,10 +134,15 @@ traffic in the same family starts a new episode. Repeated reads never advance
these boundaries. One occurrence and the existing owner cooldown apply to each
episode; a disposition stops repeated requests.
This bounded source covers explicitly linked project or mission work: at most 2,000 touched
qitems, 200 roots, 1,000 members / 10,000 transitions per family, 200 workflow
This bounded source reads every handoff family touched in the window; only
explicitly linked project or mission work resolves a scope. Its bounds: at most 2,000 touched
qitems, 1,000 members / 10,000 transitions per family, 200 workflow
receipts, 200 declared slices, and 100 proof files per selected slice. Overflow
refuses visibly. Context files are bounded to 64 KiB. A lineage beginning before
refuses visibly. When more than 200 families (roots) were touched, it evaluates the
200 with the most transitions in the window, then by lineage ID, and reports the
result as partial coverage with the total and omitted counts. Omitted families
were not evaluated, so having no finding for them is not a healthy verdict.
Context files are bounded to 64 KiB. A lineage beginning before
the retained window remains indeterminate, with the missing interval named.
Project planning does not require a successor mission: an explicit project identity
resolves its current context, with mission and phase absent unless evidenced.
@@ -370,7 +378,12 @@ A consumer such as a later Herder plugin reads `GET /api/health` and
`GET /api/health/:findingId`, or the identical `rig health --json` and
`rig health explain <finding-id> --json` records. The record schema is
`openrig.health/v0alpha1`; list metadata is `openrig.health-list/v0alpha1`.
Preserve ID, status, policy version, time window, freshness, evidence and
For a source that bounds its input, list metadata also carries `coverage`
(`source`, `evaluatedAt`, `unit`, `total`, `evaluated`, `omitted`, `limit`,
`order`, `partial`). A source that failed or hit a limit appears instead as
`status: "unavailable"` with its `reason`, and its findings are left out.
`rig health policy` reports the scheduled evaluation's coverage under
`engine.lastEvaluation.coverage`. Preserve ID, status, policy version, time window, freshness, evidence and
threshold together. There is no health score or implicit remediation authority.
The default list excludes cleared records; explicit cleared queries and exact
ID reads retain them while the source can still project them. A recurrence after
@@ -392,7 +405,9 @@ Behavioral and epistemic categories intentionally have no detector. Review
carousel, redundant wakes, stale directives and scope admission have typed
evaluators and replay controls, but the live source does not infer their missing
candidate-change, rescue, directive-conflict or admission-authority facts.
Untagged work and undeclared relationships remain outside passive ceremony
Untagged work is still read: a family whose scope can't be resolved shows as an
indeterminate instance-scope finding that names the unresolved scope and can't
start a diagnosis. Undeclared relationships remain outside passive ceremony
coverage; normal tagged work no longer requires a special outcome census. A small lineage below the configured threshold may still deserve an
agent's inspection; the threshold is a conservative admission rule, not a
definition of good process.
+74 -14
View File
@@ -1,13 +1,14 @@
# Help your user get unstuck
This page is for an agent whose user says OpenRig isn't working. It is the one place OpenRig keeps this guidance. The
copy installed with OpenRig matches that installed version. Read it with `rig context get help`. If `rig` won't run,
open `daemon/docs/reference/help.md` inside the installed `@openrig/cli` package (under `npm root -g`); in the source
copy installed with OpenRig matches that installed version. Read it with `rig context get help`, which needs a running
daemon. If `rig` won't run or the daemon is down, open `daemon/docs/reference/help.md` inside the installed
`@openrig/cli` package (under `npm root -g`); in the source
repository the same file is `docs/reference/help.md`. The same text is online at
[openrig.dev/help/agents](https://www.openrig.dev/help/agents), next to the ways people can contact OpenRig support.
Each guide this page links to is installed too. Load one only when you need it, with the `rig context get` address
shown beside its link; the same files sit beside this one in `daemon/docs/reference/`.
shown beside its link where there is one; every linked file also sits beside this one in `daemon/docs/reference/`.
Start with what your user was trying to do. Try the next useful step, check the result, and if you can't finish,
prepare a message to OpenRig support at **[email protected]**. Your user doesn't need a GitHub account.
@@ -23,7 +24,10 @@ rig doctor --json
```
Use the installed command's `--help` if an option is unavailable. Read the diagnostic findings; don't treat them as
instructions to reset the machine.
instructions to reset the machine. `rig doctor` checks Claude and Codex authentication using the same local checks
as setup, including a configured Codex provider credential variable. A set variable does not prove that the provider accepts it or that managed
seats receive it. Doctor does not run an agent task: also inspect `rig ps --nodes --rig <rig>`. If the daemon is involved, `rig daemon status` and `rig daemon logs` show its state
and recent output.
**If OpenRig won't install or `rig` won't run, start here anyway.** Record the attempted package version, install
command and error. Leave unknown values unknown. A working daemon or a passing diagnostic is not required to ask for
@@ -32,17 +36,58 @@ help.
## Match the guidance to the installed version
The reference documents beside this file describe the version they were installed with. GitHub's default branch can
contain changes that haven't reached your user's version. For release notes and known limitations, open
`https://github.com/mvschwarz/openrig/blob/v<version>/docs/releases/v<version>.md`, using the version from
`rig --version`. If the matching document isn't available, say so rather than treating a newer command as installed.
contain changes that haven't reached your user's version. After an upgrade, start with the short note on what changed
in the installed version: `rig context get reference/whats-new.md`. For full release notes and known limitations, open
`https://github.com/mvschwarz/openrig/blob/v<version>/docs/releases/v<version>.md`, using the version number from
`rig --version` (without the commit it may show in parentheses). When that file doesn't exist, use the version's
section of `https://github.com/mvschwarz/openrig/blob/v<version>/CHANGELOG.md`. If neither is available, say so
rather than treating a newer command as installed.
## Find your next step
### Installation or platform problems
Supported platforms are macOS and Linux. Native Windows is not supported yet, and WSL2 has not been tested. OpenRig needs
Node.js 22 or 24 and tmux. A WSL error needs its actual versions, commands and error text; don't assume a
Windows-related pull request fixes it.
Supported platforms are macOS and Linux, and WSL2 on Windows; native Windows isn't supported. OpenRig's automated tests
don't run on WSL2 yet; one user's [reported working setup](getting-started.md#wsl2-a-reported-working-setup) lists what
mattered. OpenRig needs
Node.js 22 or 24 and tmux. A Linux distribution's own Node.js can be older; check `node --version`. With npm 11 or
later, an `npm warn install-scripts` line for `@openrig/cli` means only the postinstall Node.js and SQLite check was
skipped; `node "$(npm root -g)/@openrig/cli/scripts/check-abi.mjs"` runs it. A WSL error needs its actual versions,
commands and error text; don't assume a Windows-related pull request fixes it.
The one-command install ([getting-started](getting-started.md#install-and-sign-in)) prints its plan with
`--dry-run` and changes nothing. When a step fails it prints `FAILED [n/4] <command or check> (exit <code>)` and
stops. Read its diagnostic: if it names a runnable command, run that command by hand for the full error and record it
in a report; otherwise follow the accompanying diagnostic. If the only remaining failures are provider sign-ins under
"Some steps need attention", the install steps finished: sign in to each selected provider and continue.
### Installation finished, but there is nobody to talk to
Load the `rigs` skill and follow its step 2: it opens the OpenRig view (`rig terminal open saved:kernel --window`),
gives the attach commands when the window can't open or over SSH, and hands the person's goal to the operator.
[Install and sign in](getting-started.md#install-and-sign-in) says how to load it. The reference for the view, manual
attachment and the table of what can interrupt it is
[Open the kernel conversations](getting-started.md#open-the-kernel-conversations)
(`rig context get reference/getting-started.md#open-the-kernel-conversations`). Started is not ready: the view can
open while the kernel's agents finish starting, and opening it creates no other kernel or account.
### A step interrupted setup or the OpenRig view
Name the exact command and result, the reason it stopped and the next useful step. A harness's permission rules,
sandbox or automatic permission decision can refuse an installing agent's tool call before OpenRig runs.
Claude Code's [auto mode can deny calls](https://code.claude.com/docs/en/auto-mode-config); explain the reported
refusal and let the person review that step in their harness controls or run it themselves, within their chosen
permissions. Do not silently claim installation failed or completed from a refused call.
For missing tools, downloads or selected logins, use the specific setup hint. A Herdr install warning leaves plain
tmux available. A requested Ghostty install can fail setup; resolve it or decline with `--no-ghostty` and keep the
earlier choices. Terminal.app remains available; required tools and logins still matter. macOS may ask for
Automation permission; a missing display or remote daemon needs the documented headless/manual route.
Herdr may show an intro (Return to continue) and an agent-integration panel (Esc to close); the view does not
require installing those integrations. Enlarge a cramped 80×24 window. Use authorized desktop tools to inspect the
window contents, or state that visibility is unconfirmed and ask the person to check. A successful command or
window listing alone is not visual proof. The [OpenRig view guide and friction table](getting-started.md#open-the-kernel-conversations)
connects each observation to its next step. Preserve existing conversations while resolving it.
### The team did not start, or a terminal is missing
@@ -58,6 +103,7 @@ Read [Have your agent configure permissions](getting-started.md#have-your-agent-
(`rig context get reference/getting-started.md#have-your-agent-configure-permissions`). Identify the
specific prompt or sandbox restriction. Work within the user's chosen permissions; don't switch the whole environment
to unrestricted access to clear one prompt.
For a `403` naming `untrusted_host` or `browser_origin_refused`, see [Browser access and allowed addresses](browser-access.md).
### A seat shows attention, waiting or a failed restore
@@ -66,6 +112,14 @@ and `rig ps --nodes --rig <rig-name>`, then compare the reported state with what
A waiting prompt, a failed launch and an agent working behind a stale status need different next steps. Repeatedly
clearing attention doesn't fix an underlying readiness problem.
A fresh seat stopped at a native prompt (Claude's bypass-permissions warning, a login or a folder-trust question)
keeps its startup context. `rig up`, `rig bundle install` and `rig ps --nodes` print "Startup attention" or "Startup
details" for it, ending with the command to run. Once your user has answered the prompt in that seat's terminal,
`rig seat continue <seat>` delivers the context in the same conversation, without relaunching. If it reports an
unknown outcome, check `rig seat status <seat>` before trying again. For a rig whose seats bypass permissions,
`--non-interruptive` on `rig up` or `rig bundle install` avoids Claude's warning and Codex's notices in the first
place; see `non-interruptive-mode.md` beside this file.
### You can't tell which instance or configuration is involved
Read [instance layout](instance-layout.md) (`rig context get reference/instance-layout.md`) and
@@ -77,12 +131,18 @@ involved before proposing changes.
Compare the harness version and what you actually observe before attributing a failure to one of these. Check the
issue's current status; a similar symptom alone is not a diagnosis.
- Claude seats reported as needing attention after a restore: [#86](https://github.com/mvschwarz/openrig/issues/86).
- Claude usage limits are not detected: [#98](https://github.com/mvschwarz/openrig/issues/98),
[#99](https://github.com/mvschwarz/openrig/issues/99).
- Codex prompt variants not recognised as ready: [#79](https://github.com/mvschwarz/openrig/issues/79).
- Claude seats reported as needing attention after a restore: [#86](https://github.com/mvschwarz/openrig/issues/86),
[#273](https://github.com/mvschwarz/openrig/issues/273).
- Claude usage limits may not be detected: [#99](https://github.com/mvschwarz/openrig/issues/99).
- Codex prompt variants not recognised as idle: [#79](https://github.com/mvschwarz/openrig/issues/79).
- Codex asks about hook trust at first launch: [#17](https://github.com/mvschwarz/openrig/issues/17), not reproduced
by the team.
- A Codex seat on the default `workspace-write` sandbox starts without network access, so it can't reach the local
daemon, when its Codex configuration sets network access off, a managed requirement could restrict it, or Codex
doesn't answer OpenRig's configuration read in time: [#275](https://github.com/mvschwarz/openrig/issues/275).
- Kernel seats fail within a second of the first start on a distribution tmux whose server exits on `capture-pane`
(`tmux -V` prints `next-3.4`): [#980](https://github.com/mvschwarz/openrig/issues/980). The check and recovery
are in [Incomplete setup and restart](getting-started.md#incomplete-setup-and-restart).
For everything else, search [open issues](https://github.com/mvschwarz/openrig/issues).
+61
View File
@@ -0,0 +1,61 @@
# Host load and transcript capture
Use `rig ps --resources` to inspect the serving host, or add `--host <id>`
for one registered HTTP/SSH host. `--json` returns the same measurements for
operators and monitoring tools. This view is host-scoped; rig/node filters and
multi-host fan-out do not apply. Ordinary `rig ps` output is unchanged.
The view reports available CPU count, host load averages (1/5/15 minutes),
load divided by CPU count, running seats, the number of rotating seats and how
many of them are backed off, and transcript capture attempts, failures, UTF8
bytes and elapsed capture time for currently rotating seats.
Load is not CPU utilization; capture elapsed time includes waiting for tmux,
and is not daemon CPU time. Load averages are unavailable on Windows, rather
than reported as zero. Counters reset when a rotation is restarted/stopped or
the daemon restarts, so they are observations rather than a durable billing log.
When no seat is capturing, the active interval, idle ceiling and line count are
unavailable (`null` in JSON), not zero.
## Reduce idle capture cost
Transcript rotation still captures the bounded trailing buffer. When successive
captures are unchanged and tmux exposes an unchanged current-window activity
hint, capture backs off exponentially to a derived ceiling. With the default
2-second active interval and 1-second settings timer, the effective ceiling is
3 seconds: the 10-second freshness window minus the 1-second activity-hint
deadline, 5-second capture-result deadline and 1-second timer spacing. The
ceiling is capped at 6 seconds but never below the configured active interval.
This scheduling budget is not a CPU or child-process lifetime bound; the result
deadline does not cancel an unfinished capture. One shared tmux
activity read wakes idle rotations; a changed hint restores the active cadence.
Missing/failed hints retain the configured full-capture cadence. A hint read
that takes longer than one second becomes unknown without starting additional
metadata probes while its underlying call is still pending. Periodic full
capture reconciles output even when a hint fails to change (tmux timestamps have
one-second resolution). Longer configured active intervals retain that interval
instead of silently increasing capture frequency.
This does not change provider readiness, delivery guards, seat activity or queue
state. Capture activity is not proof an agent is healthy or finished. As before,
transcripts are bounded trailing snapshots, not lossless terminal archives: an
output burst larger than retained tmux scrollback or the configured line limit
can exceed the saved trail. Interactive terminal streaming is unchanged.
## Change capture settings without restarting
```bash
rig config set transcripts.poll_interval_seconds 3
rig config set transcripts.lines 2000
rig ps --resources
rig config reset transcripts.poll_interval_seconds
```
Running rotations reread shared settings at most once per second and adopt the
next valid policy without starting overlapping captures. Intervals accept whole
seconds from 1 to 3600; trailing lines accept integers from 1 to 1000000. The
existing environment variables take precedence over file settings. Malformed
intermediate JSON retains the last usable policy, is shown in the resource view,
and is retried; normal config
writes reject invalid values. Changing `transcripts.enabled` or
`transcripts.path` still requires a daemon restart. This feature does not impose
CPU quotas or allocate build slots.
+16
View File
@@ -79,6 +79,11 @@ Missing or malformed selections fail; absence is never inferred as disablement.
`rig context work-install --json` reports the effective state, source, manifest,
context selectors, and skills. With `--runtime`, its managed skill loadout then
combines System World, topology, and Project World selectors with provenance.
The catalog is a Git checkout. A skill folder with uncommitted or untracked content is
skipped by itself and named. With `--runtime`, work-install reports selected skips with
exit 1. It inspects by default; `--apply-skills` projects the remaining clean skills while
keeping any previously projected copy of the skipped skill. An uncommitted change directly
in the catalog root, such as `catalog.yaml`, still makes the whole catalog unavailable.
For a pre-0.5.9 home, use the `openrig-upgrade` skill's
`migrate-telemetry-state-0.5.9.mjs` helper as an Agent-Operated Migration. Its
@@ -104,3 +109,14 @@ runtime reads for compatibility. Treat the two-home state as an explicit
limitation: use the live spec-library commands to determine where a spec is
served from, and do not infer convergence merely because the canonical
directory exists.
Config updates publish a complete replacement file atomically where directory
permissions and the filesystem allow it. On POSIX systems, replacement preserves
the existing owner, group, and read/write/execute permission bits. If creating or
preparing the replacement, or renaming it, fails with `EACCES`, `EPERM`, or `EBUSY`,
the stores write the writable target in place, preserving compatibility with
unwritable directories and single-file bind mounts. This fallback is not atomic
and retains the previous partial-write risk. Read-only config files are refused.
Other errors, including `ENOSPC`, leave the original file intact on the atomic
path. Atomic replacement does not carry extended ACLs or other inode metadata;
a hard-linked second name continues to refer to the previous file.
@@ -0,0 +1,75 @@
# Inventory request diagnostics
The private slow-operation log can correlate explicitly marked inventory reads.
This diagnoses future observations; it does not repair a timeout or establish the
cause of an earlier uncorrelated request.
Send exactly one `X-OpenRig-Diagnostic-Attempt` header containing a fresh lowercase
UUIDv4 on a `GET /api/rigs` or `GET /api/rigs/:id/nodes` request. The token is only a
correlation hint. It grants no authority, triggers no retry, and changes neither
the response nor its timeout. Invalid or duplicate tokens are ignored by the
observer. Do not copy the token to incidental identity or health checks.
Records use `schema: openrig.request-phase/v1` in the existing
`logs/slow-operations.jsonl`. Each process has an observation `epoch` and sequence
`seq`. An activation record carries the installed build stamp (`semver`,
`commit`, `dirty`, `builtAt`; each is null in an unstamped development build).
Each admitted request gets a distinct
`serverRequestId`, even if a caller reuses an `attemptId`. Routes are recorded as
`rigs_list` or `rig_nodes`, never a rig name or full URL.
The phases are:
- `node_arrival`: the existing Node HTTP request listener ran. This is after HTTP
parsing and JavaScript scheduling, not a socket-arrival timestamp.
- `hono_enter` / `hono_exit`: application middleware started/finished.
- `handler_enter` / `handler_exit`: the actual inventory handler started/finished.
Gate rejection or read-through may have no local handler entry.
- `sql_begin` / `sql_end`: the root list's SQLite prepare/read, excluding row mapping.
Other node-inventory queries are not individually traced.
- `response_finish`: Node completed its server-side response writes; this does not
prove that the client consumed the body.
- `response_close`: records `headersSent`, `writableFinished` and status. A normal
close after finish is not failure. A premature close does not identify its cause.
- `request_aborted`: only when Node emits that incoming-request event. A GET client
timeout often appears as response close instead. Handler work can finish later.
- `trace_expired`: diagnostic state expired; the request was not canceled.
`elapsedMs` is process-local monotonic time since observation activation;
`requestElapsedMs` is since the request event. `utc` is a dated anchor. Never
subtract monotonic times across processes. A client's useful counterparts are its
logical start, actual fetch invocation, headers received, body completion, signal
abort and final outcome. Fetch invocation does not prove a socket write.
The existing 250 ms event-loop tick provides bounded recent timing context and
`event_loop_gap` records for tick intervals of at least 500 ms. The gap is reported
when the loop resumes. An indefinite stall or killed process cannot report its
end. This does not change the existing lifetime histogram or health verdict.
Diagnostic limits: 128 admitted requests per monotonic minute, 128 active traces,
16 distinct phases per trace, 60-second observation lifetime, 40 recent ticks,
1 KiB per record and 1024 outstanding diagnostic writes. Overflow drops diagnostic
observations, never requests. The existing 1 MiB log plus three rotated files and
0600 file modes apply. The worker writes asynchronously; HTTP observation never
waits for fsync or the synchronous slow-operation BEGIN barrier.
Records carry cumulative `rejected` (admission refused), `expired` and
`observerErrors` counters and writer
`coverage` counters (`offered`, `enqueued`, `dropped`, `acknowledged`, `failed`,
`pending`, `recorderHealthy`). Writer counters describe the state sampled for that
record, not an acknowledgment of that record itself. Retained epoch/sequence
ranges can be read from the current and rotated logs; the log is not an archive.
A missing activation/tail, sequence loss, recorder failure, overflow, expiry or
rotated-away interval makes the corresponding coverage incomplete. Source tests
without the Node raw-request binding cannot establish Node arrival.
Missing arrival is unknown by default. Even a complete covered interval only
establishes that no matching JavaScript request event was observed there; it does
not distinguish a client that never sent from network, parser or event-loop delay.
HTTP status at handler exit is a prepared response, and status at finish/close is
server-side state. Neither replaces the client's header/body receipt.
The new format contains no payloads, auth or raw identity headers, URL parameters,
SQL text, bind values, native identifiers or raw exception messages. Legacy
slow-operation records keep their existing format: their `outcome: ok` indicates
completion of the observed operation and is not an HTTP-success assertion.
+253
View File
@@ -0,0 +1,253 @@
# Keeping a Watch for a Person
**How an operator turns "remind me in 20 minutes" or "tell me when X happens, check every hour" into a watch it
keeps, using today's queue commands.** The person speaks in sentences. They never see YAML, a job ID or a policy name
unless they ask.
> **Status (0.7.0).** The kernel operator's role guidance points here: when a person asks it to watch something or
> remind them, it reads this page (installed at `$OPENRIG_HOME/reference/keeping-a-watch.md`) first. Every step below
> was exercised with the CLI on an isolated private daemon: create, set aside, fire, re-arm, list, change, stop, a
> daemon restart and a handover. A native run with a real operator, install and channel has **not** been run yet.
> The usage warning's command and field names are checked against the served command on a test fixture; it hasn't
> been run as a watch.
## The shape
A watch is a **queue task the operator owns**, set aside with a **one-shot timer**:
1. The person asks. The operator creates one task for itself and sets it aside with `--wake-after`.
2. The timer fires once and wakes the operator. The operator reads the task and checks the condition.
3. Then it tells the person, re-arms the timer, or both. **A timer fires once: a watch that isn't re-armed goes
quiet.**
OpenRig keeps the record and the timer. The operator does the judgment: what to check, and whether it's worth telling
the person.
## Before you set one: can you reach the person?
Run `rig gateway human list --json`. A watch tells the person through the registered human channel (Slack today,
also shown in the TUI Feed), at `<entityId>@external`. **A terminal is never a person's address.** If no human is
registered, say so now, before setting anything up: a watch that can't reach them is a watch they'll never hear from.
## Setting a watch
**1. Write the task body for a successor.** You may be restarted, compacted or replaced before the watch ends. A new
operator must be able to act from the task alone. Put these in the body:
```markdown
Person's words: "Tell me when the release PR merges; check every hour."
Check: `gh pr view <n> --json state` — met when state is MERGED.
Interval: 1h.
Tell them: <entityId>@external (human channel), once, when met.
Stop: after telling them once, or when they say stop.
Unknown: not said yet.
```
**2. Create it for yourself,** with a `watch` tag so it can be listed later (tags can't be changed after creation).
`<your session>` is your session name from `rig whoami --json`:
```bash
rig queue create --destination <your session> --tags watch \
--summary "Watch: tell <person> when the release PR merges (hourly)" --body-file <file>
```
**3. Set it aside with the timer.** A new pending task can be set aside directly; no claim is needed:
```bash
rig queue block <task> --on external:<what you check> --wake-after 1h \
--continuation "check <what>; tell <person> if met, else re-arm 1h"
```
`--on` is always required; `external:<what>` names the outside thing you're waiting on. The timer first fires after
the interval, not now.
**4. Say back what you set, in one or two plain lines:** what you'll check, how often, how they'll be told, and when
it stops. For example: "I'll check the release PR every hour and message you here once it merges. Then I'll stop."
A plain reminder ("remind me in 20 minutes to look at the release notes") is the same with no condition. Set it aside
with `--wake-after 20m`, and when it fires, tell them and close it.
## Every time the timer fires: read the record first
When the timer's message arrives, **run `rig queue show <task> --full --json` before doing anything.** A message already
on its way can still arrive after the watch was stopped or changed. If the task is no longer set aside (done, canceled, or replaced),
do nothing.
Otherwise, check the condition, then do exactly one of these:
| What you found | Do |
|---|---|
| **Met, and the watch was "once"** | Tell the person (below), then close: `rig queue update <task> --state done --closure-reason no-follow-on --note "<what you saw>"` |
| **Met, and it's "every time"** | Tell the person, then re-arm |
| **Not met** | Re-arm. Say nothing to the person: never send "nothing yet" |
| **Can't tell** (no fresh reading) | The first time, tell them once that you can't tell, and why. Record that in a note (`Unknown: said <time>`), then re-arm. **Never say "all fine" for an unknown.** Stay quiet on later unknowns until the reading returns or changes |
**Re-arm** by setting it aside again with a fresh timer:
```bash
rig queue block <task> --on external:<what> --wake-after 1h --note "checked <time>: not met"
```
A new set-aside replaces the old one and retires any earlier timer, so a task never carries two live timers.
**Put what changed in `--note` or `--continuation`, not both.** When `rig queue block` gets `--continuation`, that is
the note it records, and `--note` is dropped.
Each check costs one of your turns on the person's subscription. **Use the longest interval that serves the ask.**
## Telling the person
```bash
rig queue create --destination <entityId>@external --human-intent update \
--summary "<subject>" --body-file <brief> --evidence-ref <watch task id> --verify --json
```
- Always pass `--evidence-ref`; the watch task's ID is a durable pointer the person can open.
- Later messages about the same watch can thread with `--reply-to <earlier message's id>`.
- **`posted` means the connector posted it, not that they read it.** Don't say they saw it.
- **If delivery fails or is indeterminate,** inspect that task before anything else. Never resend blindly.
## "What are you watching for me?"
List **every active state**, not just set-aside ones. A watch being checked can be in progress, and a new one can be
pending:
```bash
rig queue list --owned --state pending,in-progress,blocked --full --limit 200 -o json
```
Then keep the tasks tagged `watch`. Two rules:
- **Check that the number of tasks returned is below the limit.** The limit applies before you filter by tag. If you got
exactly the limit, raise it and list again. **Never report "no watch" from a page that was cut off.**
- **Use `--full`.** Compact output leaves out the body and the waiting view.
For each watch, say what it checks, how often, how they'll be told, and the next check. The next check is
`waiting.nextBackstop.dueAt` when `waiting.nextBackstop.mechanism` starts with `watchdog:`. If a set-aside watch shows
no timed backstop instead, its timer has fired and wasn't re-armed. Check it now and re-arm it.
Answer from the records, so a second reader would give the same list.
## Changing or stopping a watch
| The person says | Do |
|---|---|
| **"Check every 2 hours instead"** | Re-arm with the new interval and a note saying what changed: `rig queue block <task> --on external:<what> --wake-after 2h --note "<person's words>"` |
| **"Watch Y instead"** (what's checked changes) | A task's body can't be edited. Create the new watch, then retire the old one: `rig queue update <old> --state canceled --closure-reason superseded --closure-target <new> --note "<person's words>"` |
| **"Stop watching that"** | `rig queue update <task> --state canceled --note "<person's words>"`. Leaving the set-aside state retires its timer. A plain cancel takes no other closure fields |
Tell the person in one line what changed. After a stop, take no further action for that watch.
## Across a restart or handover
A set-aside watch's current timer is **kept** when the operator is restarted or replaced, and it fires at whoever is
the operator next. That's why the body must stand alone.
**One gap:** a timer fires once. If the operator is replaced **after a fire and before the re-arm**, the successor
inherits a set-aside watch with no live timer. OpenRig's idle-owner check may remind the new operator once, but only
under some conditions, with no delay guarantee. So:
- **Re-arm promptly** after every fire.
- **After a restart or handover, list your watches** (above) and re-arm any that show no timed backstop.
- **Handing a watch to another session** (`rig queue handoff <task> --to <session>`) closes the old task and retires its
timer (unless another task shares that timer through `--wake-watchdog`; a watch set up as above never does). The new
task arrives pending, with its body and `watch` tag but no timer: the new owner sets it aside again with a fresh
timer, as in step 3.
## A usage warning: "warn me when my allowance runs low"
This is a conditional watch like any other: the same task, timer, re-arm, stop and human channel. Only the check is
specific.
**The check is `rig provider status --all-hosts --json`.** It returns what every registered machine already holds,
this one included, and never starts a read on any account. With no host registry it covers this machine only, and
says so. Use it rather than the single-machine `rig provider status --json`: one allowance used from several
machines appears once, with each machine's own observation beside it, so you can't count it twice. If it answers that
usage windows are off, tell the person that before setting the watch, as you would an unreachable channel.
**Never put `--refresh` in the timer's check.** `rig provider status --all-hosts --refresh` starts a native read of the
accounts on every machine. Run it only when the person asks for a fresh reading now.
**Choose the allowance with the person once, and write its identity into the body.**
- **The allowance:** its `items[].key` and `items[].provider`, read from one run of the check. Show them the allowance
by its label in the plain `rig provider status --all-hosts` view, never a key they have to type. An item whose key
is null (a login that hasn't been identified) can't be watched: say so, and offer to watch it once it's identified.
- **For Codex, the login email too:** `items[].observations[].row.identity.email`, shown on each machine's line in the
plain view. The same Codex account can appear as more than one item with the same key, one per login email (or none)
it was seen under. So on each fire, use the one item whose key matches and whose observations carry the recorded
email. If none or several do, you can't tell. A Codex allowance whose login email is missing can't be pinned this
way, so it stays can't tell. A changed email isn't followed: if the person's login email changes, set the watch
again with them.
- **The window:** `items[].observations[].row.windows[].window`. Claude's are `five_hour` and `weekly`; Codex's are
`primary` and `secondary`, with `items[].observations[].row.windows[].durationMins` saying which is which.
- **The threshold:** on `items[].observations[].row.windows[].remainingPercent`. It's a percentage, and no absolute
amount is served. Remaining is 100 minus `items[].observations[].row.windows[].usedPercent`, never below 0. Both are
null when the machine reported no usage for the window.
**What each part of the answer means:**
| Field | What it tells you |
|---|---|
| `items[].linkage` | `single`: one machine saw it. `same`: several machines saw one allowance. Compare their observations; **never add or average them**. `conflict`: the machines' fresh observations disagree (their reset times are more than 60 s apart); every observation is kept and none is chosen. `unknown`: the same id seen under another login, or with no login email, and not merged with it. `items[].notes` says why. For Codex, the one item carrying the person's recorded key and email is still theirs: its `unknown` is about the other login's item (see the decision). Any other `unknown` item is not theirs to watch |
| `items[].observations[].hostId`, `items[].observations[].readAt` | Which machine the observation is from, and when this daemon read it |
| `items[].observations[].row.windows[].observedAt` | When that machine's reading was taken: the time to tell the person |
| `items[].observations[].row.windows[].resetsAt` | When that window resets: tell the person this too |
| `items[].observations[].row.windows[].freshness` | `fresh`, `stale` or `unavailable`, with `items[].observations[].row.windows[].freshnessReason` saying why. A reading is fresh for 15 minutes |
| `items[].observations[].row.windows[].level` | The served level, with `items[].observations[].row.windows[].levelReason`. Compare the person's threshold, not this level. But **`unknown` means the number can't be used**: no usage was reported, the window's reset time has passed (the number is from before it), or Claude seats report different windows (possibly different logins) |
| `items[].observations[].row.lastRefresh` | **Codex:** that machine's last native read. When `items[].observations[].row.lastRefresh.outcome` is `failed`, the reading it kept is older and reads `stale`. **Claude:** the last read of the daemon's own Claude login (its identity) only. Claude's windows come from the seats' status-line readings at their own times, so they can stay `fresh` beside a failed identity read |
| `items[].observations[].row.identityNote` | **Claude:** which login the identity is (as of the last identity read) and which seats the windows came from. The windows aren't proven to be that login. Say so when you tell the person |
| `hosts[].usage`, `hosts[].usageReason` | Whether each machine's usage was read: `served`, `off`, `older` or `unavailable`, and why. A machine that wasn't read contributes nothing, never a zero |
| `hosts[].lastRefresh` | The last refresh started from here for that machine, per provider. A `failed` one sits beside the older observation the machine kept |
| `seatAccounts[].seats[].configured`, `seatAccounts[].seats[].allowance` | The account each seat is **configured** to use. `seatAccounts[].seats[].allowance.linked` is always false: configuration isn't proof of which allowance a running seat draws on, or that a Claude seat's windows are the identity's login. Never tell the person a seat uses this allowance because of it |
| `seatAccounts[].seats[].observed` | What the seat itself was seen reporting: whether its status line has sent windows and when (`seatAccounts[].seats[].observed.lastSampledAt`), and `seatAccounts[].seats[].observed.differsFrom`, the seats whose readings disagree with it. Observed facts, still not a link to an allowance |
**The decision on each fire,** using the table in "Every time the timer fires". A usable reading is a `fresh`
observation of the chosen window whose `level` isn't `unknown`.
- **Met:** a usable reading is below the threshold. Tell them the lowest one, with its machine, `observedAt` and
`resetsAt`. If the linkage is `conflict`, also tell them the machines disagree, from `items[].notes`, rather than
presenting the lowest as the reading.
- **Not met:** every usable reading is at or above the threshold, and there is at least one.
- **Another login on the same Codex account:** when the item matched by key and recorded email has `items[].notes`
saying the account is also observed under another login email (or with none), its linkage reads `unknown` on one
machine, or `same` on several. Use its own usable readings as above. When you tell the person, say that login's
observations are unlinked: not added, and not merged.
- **Can't tell:** no usable reading: none `fresh`, or the fresh ones' `level` is `unknown`, which includes a null
`remainingPercent`. Also when the allowance is missing from the answer or its key is null, or (Codex) no login email
was recorded, or no item, or more than one, carries both the key and the recorded email. Use the once-then-quiet
unknown rule, and give the reason (`freshnessReason`, `levelReason`, or the machine's `usageReason`).
The task body, for the person's own allowance, window and threshold:
```markdown
Person's words: "Warn me when my Claude allowance drops below 20% of its 5-hour window; check every 30 minutes."
Check: `rig provider status --all-hosts --json` (served readings only; never --refresh).
Allowance: key <allowance key>, provider claude, window five_hour. Chosen with the person.
(For Codex, also: login email <email shown in the label>.)
Usable: a fresh observation of that window whose level isn't unknown.
Met: a usable reading with remainingPercent below 20. Report the lowest, with its machine, observedAt and resetsAt.
Never add machines' numbers. If the linkage is conflict, say the machines disagree (items[].notes).
Claude: say the windows come from seats' status lines and aren't proven to be the identity's login (identityNote).
Codex: the one item with the recorded key and email is theirs even if its linkage is unknown; say the other login's
observations are unlinked (items[].notes).
Can't tell: no usable reading (none fresh, or level unknown: give its levelReason), the allowance missing or its key
null, or (Codex) no email recorded, or no item, or more than one, carries both the key and the recorded email. Give the
reason.
Interval: 30m.
Tell them: <entityId>@external (human channel), once, when met.
Stop: after telling them once, or when they say stop.
Unknown: not said yet.
```
## What not to use
- **`rig watchdog register --policy periodic-reminder` for a person's watch.** It repeats every interval until it's
stopped (the first fire comes one interval after you register it), and it stops when the agent that registered it
is replaced. It's fine for agent-to-agent reminders. Your own watch timers also show as `periodic-reminder` in
`rig watchdog list`: that's the one-shot timer `--wake-after` arms, not a registered repeating reminder. It's retired
when it fires or when the task stops being set aside. A wake held back because you were typing (a retained
delivery) wasn't delivered, so it doesn't use the timer up: it's tried again at each interval until an attempt goes
through (delivered or failed), which retires it. A timer another task shares through `--wake-watchdog` stays live
for that task when this task is handed off or stopped, and the same rule applies to its wake. None of this is a
delivery guarantee.
- **Transcript bytes as "usage".** `context-usage-threshold` measures an agent's transcript, not an account's
allowance. For an allowance, see "A usage warning" above.
+3 -1
View File
@@ -91,7 +91,9 @@ shipped vocabulary (four rungs plus two exits):
`wip | provisional | established | canonical | superseded | retired`
`superseded` must name its successor; `retired` means do-not-use. These are the ONLY
valid values — invented stages (shape, shaped, draft) are rejected. Items minted under
valid values — `rig scope slice stage` and `rig scope mission stage` reject invented stages
(shape, shaped, draft) and a `superseded` without a successor; context-pack manifests and
lore frontmatter aren't checked. Items minted under
new conventions carry a stage from birth: labeling from day one is free, retrofitting
is archaeology.
+4 -2
View File
@@ -3,8 +3,10 @@
For rigs whose hand-authored context predates the chain-file convention and
lives at the legacy location (`~/.openrig/shared-docs/rigs/<rig>/`, or
`$OPENRIG_SHARED_DOCS_ROOT/rigs/<rig>/`). Nothing here is destructive: the
legacy tree is left in place, reads keep working throughout (the walker's
advisory-emitting fallback), and every copy is no-clobber.
legacy tree is left in place, `rig context trace` keeps reading it at the rig and
seat levels throughout (with an advisory), and every copy is no-clobber. The refocus
trace, `seat:` profile atoms and handover priming read only `topology.root`, so
they see these files only after migration.
## The path, with exact commands
+3 -1
View File
@@ -84,7 +84,9 @@ line so attribution remains visible when the resolver returns only that section.
## Addressing and composition
Lore uses the existing `seat:` grammar and an explicit rig-and-seat read grant.
Lore uses the existing `seat:` grammar and an explicit rig-and-seat read grant
(`rig context profile <pack> --situation <fresh|handover|post-compaction> --rig <rig> --seat <seat>`,
where the grant needs both `--rig` and `--seat`).
The address says which file or section to read; the grant says whose seat tree
the address is relative to. No grant means no read.
+3 -1
View File
@@ -196,7 +196,9 @@ The layers compose from surfaces that already exist; no new mechanism is require
retains `claude-code`. Profile defaults from `OPENRIG_RUNTIME`, otherwise
Claude; work-install requires the flag to inspect or apply skills.
- Delivery: `rig walk <seat> --through-profile world-public --profile <profile>
--situation <situation> ...` applies the already-inspected profile;
--situation <situation> ...` applies the already-inspected profile (walk's
seat grant is `--seat-grant`, and its `--runtime` takes `claude` or `codex`,
defaulting to `claude`, so a Codex profile needs `--runtime codex`);
`--through <files> --pace <interval>` remains the raw byte-walk path. Paced
sends naming addressed reads serve pointer-walks.
- The delta: a dated markdown file beside the seat's recap; verified by reading it.
+63
View File
@@ -0,0 +1,63 @@
# Non-interruptive mode
Use `rig up <source> --non-interruptive` or `rig bundle install <archive-or-link> --non-interruptive`
to accept supported harness first-launch warnings for this rig. Sessions remain interactive.
This does not sign in to a provider or change any seat's permission policy.
The option applies only to seats whose resolved launch posture is `full_bypass`.
This must be declared through `builtin:yolo`, a `full_bypass` flag policy, or an explicit `full_bypass` selection;
ambient `OPENRIG_YOLO` alone without an attached policy is not covered. One exception: kernel Codex seats on the
kernel's operational default always get the Codex notice overrides below, without this option.
- Claude Code receives `--settings '{"skipDangerousModePermissionPrompt":true}'`, accepting its bypass-permissions warning.
A seat with an explicitly selected native permission mode other than `bypassPermissions` doesn't get it.
- Codex receives per-launch `-c notice.…=true` overrides for the full-access and GPT-5.1 migration notices.
The separate GPT-5.1-Codex-Max migration notice is not suppressed.
- Pi's existing launch flags are unchanged.
OpenRig saves the choice on the rig. Later launches, restores, forks and handovers keep it, including
when the option is omitted. To turn it off, first stop the rig with `rig down <rig-name>`, then run
`rig up <rig-name> --existing --no-non-interruptive`. The choice is cleared for this and subsequent
launches. If the rig is still running, the command is refused before the choice changes. `--plan`
changes nothing. Disabling the mode does not erase acceptance that a person previously saved in the harness.
Turning it on for an existing rig works the same way: `rig down <rig-name>`, then
`rig up <rig-name> --existing --non-interruptive`. Rigs created before this option existed start with it off.
For an operator default on **new rigs**, use `rig config set launch.non_interruptive true`, or set
`OPENRIG_LAUNCH_NON_INTERRUPTIVE` in the daemon's environment (it overrides the config file).
The default is false; a rig spec's `non_interruptive` overrides it (see below), and an explicit positive or
negative command-line flag overrides both. Existing rigs
keep their saved choice when the operator default changes. On a remote install the receiving daemon's
default applies.
`rig up` and `rig bundle install` print what happened as warnings: "Non-interruptive mode is saved for this rig…"
when it is on (also on each restore), "Non-interruptive mode is off for this rig's launches…" when you turn it off,
and, for each affected seat, "Non-interruptive: OpenRig accepted Claude's bypass-permissions warning" or "…hid
Codex's full-access and GPT-5.1 migration notices… no warning-acceptance settings were written."
A bundle's before-install view (`rig bundle inspect`) says when this option is available for its full-bypass
Claude and Codex seats, and that Claude Code asks once to accept its warning otherwise. When the bundle's `rig.yaml`
declares `non_interruptive: true`, it says instead that the bundle's launches are non-interruptive by default, and
leaves out the asks-once note. See [bundle formats](bundle-formats.md).
This feature writes no warning-acceptance settings to Claude or Codex files. It uses the launch-flag
surfaces checked in Claude Code 2.1.282 and Codex 0.153.4. Other notices introduced by later harness
versions, sign-in, and harness preconditions can still require attention. Ordinary launches without
an opt-in keep their existing behaviour.
## Bundle or rig default
A pod-aware `rig.yaml` may declare `non_interruptive: true` alongside its
permission policy. This saves the choice on the installed rig without requiring
a CLI flag. Explicit `--non-interruptive` or `--no-non-interruptive` wins over
the spec; a declared boolean wins over the machine's `launch.non_interruptive`
default. A declaration of `false` is distinct from omission. Exports include
`non_interruptive: true` when enabled; disabled or unset choices omit the key
because saved state does not distinguish their origin. Restores of the existing
rig retain its saved choice.
The before-install view reports this declaration as
`posture[].nonInterruptiveDefault` for full-bypass Claude/Codex seats, separately
from `nonInterruptive: available`. It leaves `nativeEffect: unknown`: explicit
launch choices, sign-in and unsupported harness notices still apply. This field
does not broaden the rig's permission policy or add warning flags to Pi.
+2 -1
View File
@@ -50,4 +50,5 @@ Scope research to the unknown that could change the plan; scope an adversarial
pass to the failure modes the author may miss. Record the questions resolved and
the resulting design changes so the owner can judge the value of the selected
rung. Run planned research before build dispatch, while its answers can still
shape the spec.
shape the spec. Record the chosen rung in the slice's frontmatter as
`approved-spec-dial:`; `rig view show execution` shows it as `planning_dial`.
+11 -6
View File
@@ -1,8 +1,8 @@
# Product-journey SDLC components
This is a reusable menu for building the smallest complete user outcome. A
mission or slice selects only the components its work needs and records their
order in mission/slice YAML. This is **not a mode, pipeline, topology, rig
mission or slice selects only the components its work needs and records them,
with any explicit edges between them, in mission/slice YAML. This is **not a mode, pipeline, topology, rig
shape, or mandatory gate set**. If no composition is present, use the light
Part A flow in `sdlc-conventions.md`.
@@ -215,7 +215,8 @@ possible explanation.
## Composition rules
1. `project.yaml` may declare project defaults; `mission.yaml` may select the
catalog and override those defaults for the mission.
catalog and override those defaults for the mission. Some file in that chain
must name the catalog: there is no default catalog.
2. `slice.yaml` selects or overrides the components for that slice.
3. Edges are explicit data. Array order is presentation, not dependency.
4. Select the fewest components that honestly fit the work.
@@ -305,15 +306,19 @@ On a fresh start, restore, or new assignment:
Do not choose a mission from an old onboarding packet or a folder's recency.
3. Resolve SDLC selection in order: project defaults, mission defaults, then the
active slice's explicit selection/override. A narrower explicit selection
replaces the broader component list; it does not append every ancestor's
gates. Follow an addressed wave map for its membership, review model and
replaces the broader component list and its edges; it does not append every
ancestor's gates. Follow an addressed wave map for its membership, review model and
boundary; an explicit named-slice exception applies only to that slice.
4. Read only the selected components and additional addressed context. Repository
references resolve from the code repository root; installed references from
references resolve from the Git root of the repository that holds the YAML
declaring the catalog, which may not be the code checkout; installed references from
`$OPENRIG_HOME/reference`; context-pack refs use `rig context get`. For a
Markdown `#section` address, use `loading-addressable-markdown` rather than
loading an entire unrelated manual. Expand the investigation when the task's
evidence requires it: the address map is a starting point, not a search limit.
For work running as a workflow instance, `rig workflow guidance <instance>`
reads the effective selection, the selected catalog sections and the original
intent; add `--component <id>` or `--full` to expand.
5. State briefly the user outcome, current role, candidate, selected path and
next completion boundary. No composition means the light Part A flow in
`sdlc-conventions.md#a1-the-flow-in-one-pass`. Do not author a
+3 -1
View File
@@ -31,7 +31,9 @@ measuring stick:
3. **PRESENT DECISIONS DECISION-READY.** One at a time, lettered, recommendation
first, records cited. The owner's ruling gates everything downstream —
mechanically where possible (a blocked-on anchor), never by memory.
4. **MINT SLICES AT PLAN TIME** with real one-paragraph intents.
4. **MINT SLICES AT PLAN TIME** with real one-paragraph intents
(`rig scope slice create <mission> <slug> --intent "..."`; without `--intent`
the SPEC.md intent defaults to the title).
5. **DEPOSIT THE DESIGN — the fidelity law.** Every design-bearing slice's SPEC.md
carries the full design contract INLINE: the owner's words verbatim, the settled
do-not-reopen decisions, the live evidence, the shape of done, the anti-goals. A
+150 -4
View File
@@ -31,6 +31,23 @@ is the project-location catalog. The project manifest exposes empty
addresses and stable managed-catalog skill IDs, but neither skill source nor a
System World belongs in this tree.
Installing a bundle that carries a project (`rig bundle create --project-dir`)
copies the project folder to `<workspace.projects_root>/<id>/`, adds its catalog
entry, and lists the bundle's rig under that entry's `rigs` (see "Work-install
project selection"), before any seat launches. Every byte already in the
catalog stays: the entry is appended in the file's own indentation and line
endings, and a later rig joins it by a one-line edit of its `rigs: [...]`.
Reinstalling changes nothing. If the file's shape doesn't allow that (for
example a flow-style list), if the id is already taken by another root, if the
folder is registered under a different id, or if the rig is already listed
under another project, install writes nothing to the catalog and prints what to
change, and the folder isn't copied either. An existing folder at
`<workspace.projects_root>/<id>/` is never overwritten: if its files differ from
the bundle's, install keeps it and says so. Without a catalog, the one it writes
keeps an entry for the workspace root beside the bundle's, under the id from the
workspace's own `project.yaml` (`default` when it declares none); if that id is the
bundle's project id, install reports a conflict and writes no catalog.
## Project-world install
`project.yaml` may select project context and managed skills together:
@@ -46,6 +63,24 @@ install:
- repository-maintenance
```
A project can also name world packs to read after the System World, in order:
```yaml
install:
worlds:
- ref: openrig-world
- ref: project-world
profiles: { claude: guided }
```
Each `install.worlds` entry has the same `{ ref, profiles }` shape as a System
World `context` entry. `work-install` lists them as `context world <ref>` lines
and `worlds` in `--json`; it never delivers their content, so read each with
`rig context get <ref>`. An invalid entry, or a ref the System World or an
earlier entry already lists, is ignored with a warning. Without the key, the
output is unchanged. The list holds pack names only, resolved from the local
library when read, so naming a world copies none of its content.
`install.context` contains project-relative Markdown addresses. `install.skills`
contains stable skill identities only. Skill source bytes live in the single
configured managed catalog (`skills.root`, default `$OPENRIG_HOME/skills`),
@@ -73,6 +108,43 @@ ownership receipt. A later seat start with no project-world input preserves it;
an explicit install whose `install.skills` is empty clears it. This keeps
"project not supplied" distinct from "project deliberately selects no skills."
## Work-install project selection
`rig context work-install` picks one project from the catalog at
`workspace.catalog_path` (default `workspace.yaml`), in the order below. Without a
catalog, the workspace root itself is the project (`selectedBy: workspace`, or
`explicit` with a matching `--project`), and `--project` must match its
`project.yaml` id. Operating posture uses steps 3-5
the same way when a task names no project (see
[scoped operating posture](scoped-operating-posture.md)).
1. `--project <id>`;
2. the only declared project;
3. the project whose entry lists the calling seat's rig under `rigs`;
4. the deepest declared project root that contains the working directory
(`--cwd`, else the current directory);
5. the only project whose entry lists no `rigs`, so a rig that isn't listed
anywhere keeps its project after a claimed project is added beside it;
6. otherwise it stops with `project_required` and prints each candidate's exact
command.
```yaml
schema: openrig.workspace/v0alpha1
projects:
- id: default
root: .
- id: contributor
root: projects/contributor
rigs: [openrig-dev]
```
`rigs` is optional. A `rigs` value that isn't a list of rig names is ignored
with a warning; the entry can still be chosen by `--project`, as the only entry
or by working directory, but never counts as unclaimed in step 5. A rig listed under two projects, or two projects sharing the
deepest root, leave the choice to `--project`. Step 3 reads the seat's
`OPENRIG_SESSION_NAME`, so a plain shell skips it. `--json` reports the step
that chose the project as `position.selectedBy`.
## TUI project selection
Open **PROJECTS** (or enter `projects`) to choose an ID and root from the
@@ -88,7 +160,7 @@ existing file-reader allowlist. Catalog membership does not grant file-read or
execution permission. These views only read; they do not select a lifecycle
operation or activate a mission. Execution and slice queue membership require
an exact `project:<id>` tag; lifecycle instances use their authored project
identity. Unscoped historical queue rows and global review artifacts without
identity. Unscoped historical tasks and global review artifacts without
project binding are excluded from project-specific claims.
The read API adds `GET /api/scopes/projects` and optional `project` and
@@ -116,14 +188,23 @@ ambiguity.
## Queue Mapping
Queue items attach to a slice when their body or tags mention one of:
A `slice:<id>` tag is the authoritative way to attach a queue item to a slice;
with a project selected, typed rows also need the `project:<id>` tag. The tag
value is either the slice's frontmatter `id` (a dot-ID such as `CUS.9775.1.1`)
or its directory name (`01-custody-funds`); both resolve to the same slice on
the Queue tab, the ownership lanes and the agents band. A row that carries both
forms counts once. As a
fallback, for slices with no typed rows, items attach when their body or tags
mention one of:
- the slice id;
- the mission id;
- the legacy `rail-item` value in slice frontmatter.
For new work, include both mission and slice ids in the queue item body or
tags. Example:
Once any slice in a mission has typed rows, the fallback stops matching on the
mission id (and on a `rail-item` defaulted from it) for that mission's other
slices too. For new work, tag rows with `slice:<id>` (and `project:<id>`), and
include the mission and slice ids in the body as well. Example:
```text
Mission: idea-ledger
@@ -133,6 +214,71 @@ Slice: capture-product-ideas
This makes Story, Queue, Tests, and Topology tabs line up with the filesystem
slice without adding a separate project database schema.
### Workflow packets
Packets that `rig workflow` projects carry the scope of their instance. Pass the
scope when the instance is created and every packet it creates (the entry, each
hand-off and gate, exception items, and resume packets) is tagged, so they show
on the slice's Queue tab:
```bash
rig workflow instantiate ./spec.workflow.md \
--root-objective "Build the capture flow" --created-by orch@my-rig \
--project my-project --mission idea-ledger --slice capture-product-ideas \
--tags ticket-7
```
- `--project` should name a project in the workspace catalog. `--mission` and
`--slice` take the same ids as the slice routes. `rig workflow run` takes the
same flags. The CLI refuses what it can check itself (an id of the wrong shape,
a reserved tag, a tag that contradicts a flag) as a usage error, before
anything is sent. Only the daemon knows the catalog, so a mistyped `--project`
is **not refused**: the daemon creates the instance unscoped, its packets carry
no scope tags, and the CLI prints a warning on stderr (also with `--json`)
that names the instance and says the scope was not applied. The CLI does not
retry; instantiating again creates a second instance.
- Packets carry `project:<id>`, `mission:<id>` and `slice:<id>` for the parts
you set, then your `--tags`, after the tags the workflow system writes. Tags
compose as in `rig queue create`: duplicates collapse, so `--slice S --tags
slice:S` is one tag.
- `--tags` is refused locally when it carries what the workflow runtime reads
back to route packets: `workflow`, `handoff`, `gate`, `entry`, `resume`,
`re-route`, `workflow-exception`, and the `workflow:`, `instance:`, `step:`,
`exception:`, `occurrence:` and `recovery-for:` prefixes, a `project:`,
`mission:` or `slice:` tag that contradicts its flag, or a second value of
the same key.
- `rig workflow instantiate-lifecycle` needs no flags: it takes the project and
mission from the lifecycle identity it compiles. A compiled step's packets
carry the `slice:<directory>` of the slice that step was compiled from, even
when another slice's directory has the same name as its `metadata.id`. A step
an authored graph names carries `slice:<directory>` when it names an active
slice: by its exact directory name, else by a `metadata.id` that exactly one
active slice claims (an id two slices claim maps to nothing, with a compile
advisory). A step that names no slice, such as an authored closing step,
carries only `project:` and `mission:`, so it appears on no slice's Queue tab.
A project id or mission name the compiler reads from the manifests that cannot
be a tag (a space, a `:`, a leading `.`, `_` or `-`, or too long) is left off
the packets with a compile advisory; the lifecycle still instantiates. Slice
metadata the lifecycle does not run is read only leniently, for step names, and
never fails compile or instantiate.
- Over HTTP, `POST /api/workflow/instantiate` reads the scope from a `scope`
object (`{ project, mission, slice, tags }`). A scope that is valid and names
a catalogued project is applied as above. A scope the route cannot apply (a
project the catalog does not declare, a conflicting, reserved or malformed tag
or id, or a `scope` that is not an object) is ignored: the route does what it
did before the field existed and creates one unscoped instance, records
nothing the scope named, and never lets a rejected tag reach a packet. The
response `advisories` then carry a `Scope not applied (...)` note that names
the instance (`scopeIgnored` repeats it); `rig workflow run` prints
`advisories`. Bare `project`, `mission`, `slice` or `tags` fields in the body
are ignored the same way, with a note. A failure unrelated to the scope still
fails the request.
- A Projects view scoped to a project lists a slice's packets only when they
carry `project:<id>` as well as `slice:<id>`, so pass `--project` with
`--slice`.
- The scope is stored on the instance when it is created and does not change.
Instances created without it behave as before.
## Compatibility
The default discovery root is `workspace.slices_root=<workspace.root>/missions`.
+157
View File
@@ -0,0 +1,157 @@
# Publishing a rig bundle
A rig bundle is a whole OpenRig team that someone else can install and run: the rig spec, its agents, their
instructions and skills, and its documentation. This guide walks through building one, checking it, sharing it as a
link, installing from a link, and submitting it to openrig.dev/rigs. The last section is a block of instructions you can
give your agent to build one for you.
For every flag, see the [rig bundle reference](rig-bundle.md); for the file formats, see
[bundle formats](bundle-formats.md). This guide doesn't repeat them.
## 1. Lay out the folder
A shareable bundle is one folder, kept on GitHub: in its own repository, or as a subfolder of one you already have.
The folder holds the rig spec (`rig.yaml`), the agents it uses, and a README. Choose
[names that describe the team, domains and roles](topology-naming.md) before wiring its references.
The rules are the bundle standard
(`openrig.bundle-standard/v1`), summarized under "Advisory author check" in the
[rig bundle reference](rig-bundle.md#advisory-author-check).
Two rules matter most for strangers:
- **Keep everything inside the folder.** Every `agent_ref` should be `local:` and point inside it. A path that exists on
your machine won't exist on anyone else's.
- **Never put credentials in it.** No tokens, keys or `.env` files. `rig bundle create` refuses well-known sensitive
file names (such as `.env`, `.pem` and `.key`) anyway. It also refuses contained `.claude/.credentials.json`,
`.codex/auth.json` and `.pi/agent/auth.json`, including nested copies in agents or a carried project. Remove them
and rebuild. Only if recipients should have these logins (for example, your own internal test bundle) and their
owner agrees, `rig bundle create --include-login-files` records the exact included login-file paths in the
manifest and consumers show a notice; anyone with the bundle could read those files.
Unrecorded login files and other sensitive paths still fail. See [harness login files](rig-bundle.md#harness-login-files).
Two optional files sit beside `rig.yaml`:
- **`bundle.yaml`** declares what people need before installing: setup steps (`preconditions`, shown before install
and never run), the oldest OpenRig that works (`compatibility.min_cli_version`), and skills shared by several
agents.
- **`configurations.yaml`** offers other harness mixes (for example all-Claude), as presets. The recommended preset
must be `rig.yaml` as written. `rig bundle configurations ./my-team/rig.yaml` lists them with their configuration
IDs.
## 2. Check it
```sh
rig bundle check ./my-team # checks the folder against the standard; launches nothing
```
Fix what it reports, or say in your README why a finding doesn't apply. Any finding exits 1, and the output names the
file a finding is about when there is one. It checks the folder on disk, including files you haven't committed, so
check again at the commit you share. README completeness and embedded secrets always read `not_checked`: those are yours to review.
You can also build and look inside the archive:
```sh
rig bundle create ./my-team/rig.yaml -o my-team.rigbundle --name my-team
rig bundle inspect my-team.rigbundle
```
`create` and `inspect` don't launch anything. A local build like this packages a minimum OpenRig version only from
`--min-cli-version`; a build from your link reads it from your `bundle.yaml`. To preview what installing would do,
`rig bundle install my-team.rigbundle --plan` writes nothing to a target, but it isn't free of side effects: it records
a planned run, and it can run harness checks such as `pi --version` for Pi seats.
## 3. Share it as a link
Share a link to the folder **at a full commit**, so everyone gets exactly the version you checked:
```text
https://github.com/<you>/<repo>/tree/<commit>/<path-to-folder>
```
A branch name moves when you push again; a commit doesn't. `rig bundle inspect` on a branch link prints the
commit-pinned link to share (`Source:`). Use the full 40-character commit ID: a shorter one is looked up as a branch or
tag name and isn't found.
## 4. Install from a link
```sh
rig bundle inspect https://github.com/<you>/<repo>/tree/<commit>/<path> # see what it will do first
rig up https://github.com/<you>/<repo>/tree/<commit>/<path> --target <an empty folder> --cwd <your project>
```
Look before you run. `inspect` shows which agents start and with what access, what they're told, what gets written
where, and what the bundle needs, including the author's setup steps. Its integrity check tells you the archive is
self-consistent; it doesn't tell you who made it. `rig up` prints the same view before it installs, but doesn't stop to
ask.
Links need `git`, a running local OpenRig daemon, and a public GitHub link without credentials; they don't work with
`--host`. If the team uses `permission_policy: builtin:yolo` (no permission prompts), `--non-interruptive` lets OpenRig accept the harnesses'
first-launch warnings for you (see [non-interruptive mode](non-interruptive-mode.md)). As the author, you can make that
the install default by declaring `non_interruptive: true` in `rig.yaml`; `--no-non-interruptive` overrides it.
Installing writes the bundle's files into the install target (`--target`, the current directory if you leave it
out) and launches the team from there, with the seats working in `--cwd`. If the target already
has a different file at the same path, install refuses and writes nothing, so use an empty or dedicated directory.
Installing again over a stopped team of the same name replaces it, and in its own install folder the changed files are
backed up first under `~/.openrig/bundle-backups/`. A running team of the same name is refused, so stop it with
`rig down` first. The reference's "Install a bundle" section has the details.
## 5. Choose your harnesses (when a bundle offers configurations)
```sh
rig up <link> --preset all-claude
rig up <link> --seat orch.lead=pi --seat dev.qa=codex
```
On openrig.dev/rigs, pick a configuration and the page gives you one command to paste, which fetches exactly that
configuration from GitHub. Every run prints the configuration it used, as its configuration ID.
The page also shows how much each configuration has been tested, with a label such as Tested by OpenRig, Partly tested
or **"Not tested by OpenRig"**, which means exactly that. You're welcome to run it and tell us how it went.
## 6. Submit it to openrig.dev/rigs
Open a pull request to [mvschwarz/openrig-registry](https://github.com/mvschwarz/openrig-registry) that adds one file,
`registry/submissions/<your-team>.yaml`, with three fields: `repository` (your GitHub repository URL), `folder` (the
folder holding `rig.yaml`, or `.` for the repository root) and `ref` (a branch, tag or commit). No pull requests? Open
an issue there with the same three things. A maintainer then writes the full entry, in the `registry-entry.v1` format
defined in the [bundle formats reference](bundle-formats.md), with the parts only a review can produce, such as the
pinned commit and each configuration's package digest.
Rig names are unique on the site. If `registry/<your-team>.yaml` already exists, openrig-registry's registry check
still replies that your submission was received, and says the name is taken; choose a distinct one, for example
`<taken-name>-<your-name>`. A team whose `rig.yaml` name matches a listed team's, such as an unchanged copy of one,
passes the checks with a notice for the maintainer about the shared name. Whether it's listed is the maintainer's
review decision, not the checks'.
What happens next:
- a maintainer pins your link to an exact commit, runs the same check, and reads everything your bundle gives to an
agent;
- if it's useful to people running OpenRig and meets the standard, it's listed, and appears on the site
automatically. The listing shows the commit we reviewed, the date, and "Review is not a security audit". Listing
doesn't mean OpenRig tested it;
- if it isn't listed, you get a short reply saying why.
**Updating:** push your change, then open a pull request that updates your entry. The site keeps showing the reviewed
commit until the update is merged.
**Removing:** ask in an issue or a pull request, and we'll take it down.
---
## Give this to your agent
> Build an OpenRig rig bundle for: <one sentence on what the team should do>.
>
> Read the bundle guide and reference for the OpenRig version installed here (`rig --version`): the installed copies
> are `publishing-a-rig-bundle.md` and `rig-bundle.md` in `$OPENRIG_HOME/reference/` (default `~/.openrig/reference/`).
> Follow the bundle standard in the reference:
> - one folder with `rig.yaml`, a README listed in its `docs`, and every agent inside the folder, with each
> `agent_ref` as `local:`;
> - no credentials, tokens or absolute paths anywhere in the folder.
>
> Run `rig bundle check <folder>` and fix every finding, or explain in the README why it doesn't apply.
>
> Preview with `rig bundle create <folder>/rig.yaml -o <scratch>/team.rigbundle`, then `rig bundle install
> <scratch>/team.rigbundle --plan`. Don't launch the team for real unless I say so.
>
> When it's clean, show me the check output, the folder tree, and the README's sections on what to do before
> installing and on permissions. I decide whether to push it and submit it.
+200
View File
@@ -0,0 +1,200 @@
# Getting started
OpenRig runs a team of coding agents (Claude Code, Codex and others) on your project, each in its own terminal. You
talk to one agent, and it hands work to the others. The team keeps its tasks and messages between sessions.
Most people let their coding agent set it up. This page explains what happens either way, so nothing is a black
box, and shows how to do each step by hand if you'd rather.
## The quick way: let your coding agent do it
In your project folder, add OpenRig's `rigs` skill to the agent you use:
```sh
# Claude Code
npx skills add https://github.com/mvschwarz/openrig/tree/<release-tag>/skills/rigs --skill rigs --agent claude-code
# Codex
npx skills add https://github.com/mvschwarz/openrig/tree/<release-tag>/skills/rigs --skill rigs --agent codex
```
For a new install, use the latest release's tag, for example `v0.7.0`. If OpenRig is already installed, use the tag
that matches `rig --version`, or upgrade first. If the command fails with `npx: command not found`, Node.js isn't
installed or isn't on your PATH yet (see [What you need](#what-you-need)). Then type `/rigs` in Claude Code, or `$rigs` in Codex, and say what
you want built.
The skill has your agent work through the steps below in order. It says what it will run and change before it runs
it, and it asks before installing anything on your system. It finishes when you're talking to the operator.
## How the pieces fit
- **`rig`** is the command you and your agents use. It comes from the npm package `@openrig/cli`.
- **The daemon** is a small background service on your machine. It keeps tasks, messages and state in a local
database. `rig daemon start` starts it.
- **tmux** runs each agent in its own terminal session. Agents keep running when you close a window, and one agent
can type into another's terminal.
- **The kernel** is OpenRig's own small team, which starts with the daemon. You talk to its **operator**, which
starts and runs teams for you. Its **advisor** helps you think through what you want.
- **Your team** (a *rig*) is the set of agents that work on your project, such as `starter`.
- **The OpenRig view** is a terminal window with the operator and, beside it or on another page, a dashboard of your
agents.
## What you need
- macOS or Linux. On Windows, use WSL2 ([one person's working setup](getting-started.md#wsl2-a-reported-working-setup)).
- Node.js 22 or 24 (on Apple silicon, Node.js 22) and tmux.
- Claude Code or Codex, signed in. One is enough to start.
If `node --version` does not show a supported version, first check your existing Node installation and PATH.
Ask your coding agent to help use the toolchain already on your machine. On a Mac, a shared Homebrew installation
may belong to another user; do not change its ownership to complete this setup. After correcting PATH or installing
Node, open a new terminal and check `node --version` and `npx --version` before continuing.
On a Mac where you aren't an administrator, or where another account owns Homebrew, install Node.js in your own home
folder with [nvm](https://github.com/nvm-sh/nvm); nvm itself needs no administrator password. A new Mac account has no
`~/.zshrc`, and nvm's installer only adds itself to a profile file that already exists, so create one first:
```sh
touch ~/.zshrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash
```
Then open a new terminal and run `nvm install 22`. If nvm's installer says you need Apple's command line tools, run
`xcode-select --install`, then its install command again. That's nvm v0.40.8's install command; [nvm's
page](https://github.com/nvm-sh/nvm#install--update-script) has the newest.
## What happens, step by step
Each step shows the command, so you can run it yourself.
### 1. Install the `rig` command
```sh
npm install -g @openrig/cli
rig --version
```
This installs the CLI globally under your npm prefix. `rig --version` prints the version and a commit, such as
`0.6.12 (9e5382dd)`. With npm 11 or later, an `npm warn install-scripts` line is expected: it means only the
Node.js and SQLite check was skipped.
### 2. Set up the tools around it
```sh
rig setup --providers claude
```
Use `codex` or `both` in place of `claude` to match the coding agents you use. Add `--dry-run` first to see the plan without changing anything. Setup does four things:
- it checks Node.js, tmux and your sign-in;
- it installs a missing tmux (with Homebrew on macOS, if you have it) or the coding agent you chose;
- it installs Herdr, a terminal workspace app the OpenRig view can use, unless you add `--no-herdr`;
- it adds an OpenRig block to `~/.tmux.conf` (mouse support and longer scrollback).
It doesn't start anything. It ends with a summary of what's done and what still needs you. A missing sign-in shows
there: run `claude auth login` or `codex login`, then carry on.
### 3. Start OpenRig
```sh
rig daemon start
rig status
rig ps --nodes --rig kernel
```
The daemon starts and boots the kernel with the coding agents you're signed in to, or both if you're signed in to both.
**What starting OpenRig changes, for the coding agents you use** (paths are the usual defaults):
- **For Codex:** hooks and trust in `~/.codex/config.toml`, when OpenRig or a Codex agent starts.
- **For Claude Code:** workspace trust in `~/.claude.json`, and activity hooks in the project's
`.claude/settings.local.json`, plus a status line unless you already have your own.
- **For both:** small discovery skills in `~/.claude/skills` and `~/.agents/skills`.
- **Kernel access:** by default the kernel gets broader permissions than a project team gets by default. On Codex
that's full access with no approval prompts. On Claude Code, its file tools, web fetches and operational commands,
including reads under your home folder, run without asking. A permission policy, per-agent choice or Codex profile
changes that.
OpenRig doesn't guarantee it can preserve or roll back these files, so back them up first. [Everything OpenRig writes, and why](../../README.md#what-openrig-changes-on-your-machine).
Started isn't the same as ready. `rig status` shows a `Kernel:` line, and `rig ps --nodes --rig kernel` shows each
kernel agent's state. They can take a moment after the daemon is up.
### 4. Open the OpenRig view
```sh
rig terminal open saved:kernel --window
```
**What you'll see:**
- **Where it opens:** a new terminal window or tab. If your agent is already running inside Herdr, it opens a new
Herdr space instead. It uses Herdr when installed, plain tmux otherwise.
- **Layout:** in a narrow window, or when the width can't be measured, the operator fills the first page. From 120
columns, the dashboard and the operator share it. The advisor has its own tab.
- **On a Mac:** you may be asked to let your terminal app be controlled. Allowing it is fine.
- **Over SSH or with no display:** the window can't open. The command says why and, where it can, prints a command
to run in a new terminal. Otherwise your agent works out the exact command to join the operator.
You're installed when you're talking to the operator.
### 5. Start your first team
Tell the operator what you want built, and in which folder. It recommends one of three teams:
- `starter`: a builder and a reviewer, for one bounded change;
- `workshop`: a lead, a builder, QA and a reviewer, for ongoing work in one repository;
- `factory`: seven agents, for sustained product work.
Before it starts one, it tells you what starting a team in your folder changes: managed guidance in `AGENTS.md` or
`CLAUDE.md`, plus the team's skills. Then it waits for your yes. As shipped, `starter` uses both Claude Code and
Codex. With only one of them, ask the operator to adapt it.
By hand, from your repository (the first command shows what it would start, and starts nothing):
```sh
rig up starter --cwd . --plan
rig up starter --cwd .
rig ps --nodes --rig starter
```
If an agent stops at a sign-in, trust or permission prompt, `rig up` reports `Status: partial` and names the prompt.
Answer it in that agent's terminal, then run the `rig seat continue <seat>` command it prints. The team is ready
for work once its agents show as ready in `rig ps --nodes --rig starter`.
### 6. Give the team work, and stop it
```sh
rig send dev-build@starter 'Fix <one useful thing>. Ask dev-review to check it, and record the result and how I can try it.'
rig queue list --destination dev-build@starter
```
The builder records the work as a task, so you can follow it with `rig queue`. When you're done, `rig down starter`
stops that team. `rig daemon stop` stops the background service and leaves agent sessions running.
## The one-command install
Instead of steps 1 and 2 (the first line shows the plan and changes nothing):
```sh
curl -fsSL https://openrig.dev/install.sh | sh -s -- --dry-run
curl -fsSL https://openrig.dev/install.sh | sh
```
It checks Node.js and npm, installs the latest `@openrig/cli`, then runs `rig setup`. It doesn't know which coding agent
you use, so it checks and may install both. For just one, use steps 1 and 2. If a sign-in is missing, setup reports
it as the step to finish: sign in, then continue at step 3.
## What these words mean
- **Rig:** a team of agents, started with one command. Your first one is usually `starter`.
- **Seat:** one agent's role and address in a team, such as `dev-build@starter`.
- **Harness:** the software around the model that an agent runs in: Claude Code, Codex or Pi.
- **Kernel:** OpenRig's own small team, which starts with OpenRig. It isn't your project's team.
- **Operator:** the kernel's agent you talk to first. It recommends a team for your goal and starts it when you say
yes.
- **Advisor:** the kernel's agent for thinking through what you want before a team starts. It has its own tab.
- **OpenRig view:** the terminal view that opens on the operator. In a wide window the dashboard sits beside it;
otherwise, or when the width can't be measured, the dashboard is on its own page. `saved:kernel` in
`rig terminal open saved:kernel` is the name of this saved view.
## More
- **Every detail of setup:** troubleshooting, permissions, headless and SSH use, and what can stop the view from
opening. See the [setup reference](getting-started.md).
- **Stuck?** Run `rig context get help`, or read [Help](help.md).
+116 -10
View File
@@ -14,7 +14,37 @@ it is the mechanism that makes shipped chain files (see
|---|---|---|---|
| UserPromptSubmit | ✓ | ✓ | deliver due or on-demand context at a model-visible boundary |
| Stop | ✓ | — | catch a long Claude turn crossing the growth threshold |
| PostCompact | ✓ | ✓ | retain exact compaction due-state; deliver on the next prompt |
| PostCompact | ✓ | ✓ | retain exact compaction due-state; deliver on the next actionable prompt |
**How the hooks reach a seat.** A Claude seat whose resolved plugin selection includes the shipped `openrig-core` plugin
(for example `plugins: [shared:openrig-core]`, or the same plugin under another name) starts with `CLAUDE_CODE_PLUGIN_DIRS`
set to the vendored plugin (`$OPENRIG_HOME/plugins/openrig-core`), so Claude loads `hooks/claude.json` with no setup step, on a
fresh launch, a restore, a handover successor and a launch with a permission mode. A seat that didn't select the plugin is
launched as before and doesn't load these hooks. The folder a spec's plugin selection projects into the seat's workspace is
not what Claude loads. A list the seat declares itself in `CLAUDE_CODE_PLUGIN_DIRS` keeps working, with the vendored plugin
added after it.
Claude Code reads this variable from v2.1.280. OpenRig doesn't check the Claude version at launch: an older Claude ignores the
variable, starts normally, and doesn't load these hooks. The behaviour was checked on Claude Code 2.1.296 and not on
earlier versions.
A Claude started from inside a seat (its shell or Bash tool) inherits the seat's environment and so loads the plugin as well.
A seat that loads the plugin is also given `OPENRIG_SEAT_PROJECT_DIR`, its launch project, and the plugin's seat effects (the
activity and session-identity posts, the compaction hooks, refocus, and the first-launch marker) run only when that Claude's
`CLAUDE_PROJECT_DIR` names the same folder (compared by real path, so a trailing slash or symlink doesn't matter). A nested
Claude in another project, or in a subfolder of the seat's project, therefore changes nothing for the seat, and a `cd` inside
the seat's own session keeps working because `CLAUDE_PROJECT_DIR` is fixed when Claude starts. A nested Claude in the seat's
own project folder is the same project and still acts as the seat, as before this change. Without either variable (a seat
launched before this change, a manual run) the hooks do what they always did. The plugin's activity relay stays quiet next to
the seat's own `settings.local.json` copy only when that entry is exactly OpenRig's and the script it names is the same
script; an entry from an older install doesn't match, so both report until the seat's next launch refreshes it.
OpenRig automatically installs its Codex plugin for seats that select it. On its first installation, the six exact shipped
hook definitions are trusted before launch, after checking the installed hook files against this daemon's shipped copy.
Existing plugin disables and hook choices are retained. An existing untrusted installation stays under native review:
Codex's "continue without trusting" leaves no record, so OpenRig does not assume an absent trust record is permission.
The file check happens only when trust is granted: a later edit to the cached hook scripts keeps that trust, as with any hook trusted in Codex.
The Codex
column above then applies only to a Codex seat whose plugin selection includes openrig-core: every Codex hook command
exits 0 before running anything unless OpenRig gave that seat `OPENRIG_SEAT_PROJECT_DIR` and an explicit
`OPENRIG_NODE`.
Claude's additional firing signal is **transcript growth** — not turns (one turn
can burn 200k tokens across fifty tool calls) and not wall-clock (the failure is
@@ -25,11 +55,38 @@ redundant double-fire around Codex's own compaction cadence. Set
`OPENRIG_REFOCUS_NOW=1` for an on-demand refocus and
`OPENRIG_REFOCUS_ENABLED=0` to disable the feature. Fresh `SessionStart` is
always a no-op: the default onboarding pack owns fresh orientation. Both
runtimes retain `PostCompact` due-state for the next prompt. Otherwise the hook
is a silent no-op, and it degrades to silence on unrelated hook errors. A
configured REF resolution failure instead degrades
loudly in the delivered payload while still completing the hook — a refocus
must never break a seat's turn.
runtimes retain `PostCompact` due-state for the next prompt. After a managed Claude
compaction, the acknowledgement-only boundary and other prompts (for up to 10 minutes)
are skipped without consuming that state, so the hook delivers on the restore request
(after 10 minutes, on the next prompt);
that request asks the seat to read the refocusing skill and consume the delivered
traces rather than rerun them, and the read-depth audit accounts for them. Otherwise the hook
is a no-op (it writes a stderr advisory when the transcript shrinks or the
session has no identity), and it degrades to silence on unrelated hook errors.
**Time budget.** By default each lookup (the trace, the content REF, `rig queue whoami`, `rig config`) gets 2 seconds,
as before, and a slow one ends as a reported gap (`TRACE GAP`, `REFOCUS CONTENT REF FAILED`, or a role marked
unknown). Set `OPENRIG_REFOCUS_BUDGET_MS` in a seat's environment to give a slow trace more time, up to 52000 (52 s).
Each lookup's cap then grows in proportion (at 45000 the trace may take 20 seconds; at 52000, about 23), and every lookup
is also cut to what is left of that budget, so the attempt delivers what it has and counts as failed. After a failed
attempt, the issue report gets its own 1.5 seconds once the lookups are done. Both registrations allow `refocus.cjs` 60
seconds, where they used to stop it at 5; the other OpenRig hooks keep theirs. So a default fire whose lookups together
pass 5 seconds now completes instead of being stopped with nothing delivered, and a hook that hangs outside its lookups
can hold a prompt for up to those 60 seconds.
A configured REF resolution failure degrades loudly in the delivered payload while still completing the hook — a
refocus must never break a seat's turn.
**Overlapping events (unresolved).** Two hook runs for the same seat and occupant are not serialized. If they overlap,
a `PostCompact` recorded while a prompt is delivering can be lost, and one refocus can be delivered twice. This is
reproduced between hook processes; whether a harness overlaps these events for one session is not established, so it is
an open gap, not one shown to be safe.
Failed trace or configured-content resolution keeps refocus due. After three
consecutive failed attempts for the same seat and occupant, the hook emits one
idempotent issue-stream item tagged `issue,refocus`, visible through `rig stream
list --tag refocus`. A successful delivery resets that failure episode. An
unconfirmed stream write keeps the same item ID for the next failed attempt; it
does not send a wake, change seat status, or prove the agent read the content.
Because the hook runs at the seat's own turn boundaries, delivery to a
RUNNING seat needs no relaunch, no operator action, and no message traffic:
@@ -44,8 +101,9 @@ Resolution order:
1. `OPENRIG_REFOCUS_CONTENT_REF` — a path-like context-library ref resolved
through `rig context get`, so refocus receives the same assembled bytes as
on-demand pull. This wins when REF and FILE are both set.
2. `OPENRIG_REFOCUS_CONTENT_FILE` — an operator-authored file (per-seat or
per-rig via spec env).
2. `OPENRIG_REFOCUS_CONTENT_FILE` — an operator-authored file, set in the
environment the seat's harness runs in (rig and agent specs have no `env`
key).
3. `$OPENRIG_HOME/refocus/REFOCUS.md` — the instance's standing content.
4. The generic default at
`skills/refocusing/references/refocus.md`: three project-neutral orientation
@@ -73,12 +131,60 @@ reports broken links as gaps rather than following pointers.
This automatic hook path is additive to one-shot manual injection through
`rig send --context`; neither mode substitutes for the other.
## The work packet (off by default on every runtime, for now)
Set `OPENRIG_REFOCUS_WORK_PACKET=1` in a seat's harness environment so its
refocus carries the work it is actually doing as text rather than as pointers.
`=0` (or `off`, `false`, `no`) turns it off. Unset, each runtime's default
applies. A runtime's default becomes on only after a native run shows the
packet reaching the agent and leading to the right next action. No runtime has
been shown that yet, so today both Claude Code and Codex default to off.
With the switch on:
- The hook asks `rig queue whoami --work-candidates` for labelled evidence.
That is each in-progress row's own `mission:` tag (a slice tag is optional),
or for an untagged row the nearest local handoff ancestor's mission, plus
blocked rows as held work and pending rows as possible next work. The
strict `currentWork` derivation is unchanged.
- One direct, resolved tag is shown as the work, labelled with its source so
the agent can correct a stale tag. Anything less certain lists every
candidate's one-line intent and asks the agent to name its mission (or to say
it has no current work), giving the `--work-start` route that then shows
that mission's intent as text. The project-level chain appears only as
labelled orientation.
- A tag that does not resolve on this host is named, never replaced. A
retargeted handoff or a remote ancestor gives no assumed mission. A mission
named only in body text is not evidence.
- The seat's `LEARNED.md` contributes its `MY JOB HERE` and `STANDING DUTIES`
sections, and notes and each node's `PROGRESS.md` contribute their
`Current state` section. When a file has
no such heading, the packet says so and shows a bounded excerpt. No heading
is required.
- A notes or `LEARNED.md` file older than
`OPENRIG_REFOCUS_NOTES_MAX_AGE_DAYS` (default 14) is named with its age, the
age's source (`updated:` frontmatter, else mtime) and the threshold: a cue
for judgment, not a staleness verdict.
- Each field is bounded on its own, with no total cap. A held or next row's
summary and continuation are one line each (about 160 characters), with
`rig queue show <id>` named when one was shortened. At most 20 held and 10
next rows are shown, with how many there are and the `rig queue list` command
for the rest. A matched section's body is cut at about 1,500 characters,
pointing to `--depth full`.
`trace-to-root.py --packet --work-candidates <path|->` renders the same packet
by hand.
## Relation to chain files
The chain files are the durable, altitude-addressed home of orientation
content; the refocus channel is its delivery schedule. A practice added to a
rig's `CRAFT.md` today reaches running seats through their next refocus
pointer, and future installs through the shipped defaults
rig's `LEARNED.md` today reaches running seats through their next refocus
trace, which reads `LEARNED.md` at each topology level. The default light trace
shows only about the first 800 characters of each `LEARNED.md` body, so a
practice appended to a longer file reaches seats only with
`OPENRIG_REFOCUS_DEPTH=full` or through the configured refocus content. A `CRAFT.md` practice
reaches them only through the configured refocus content (REF or FILE), and future
installs through the shipped defaults
(discovery → curation → ship, per the convention doc).
## What a refocus is NOT
+7 -3
View File
@@ -88,7 +88,11 @@ naming that exact delta AND a distinct successor delta file existing. A header a
does not expire it; missing or unreadable inputs remain unknown/live. At the actual
boundary, verify the event before recording expiry, then stop citing the expired
delta. Do not create a successor merely to make the condition true. Candidate
absorption is not proof of publication or served production adoption.
absorption is not proof of publication or served production adoption. The delta is
`CAPABILITY-DELTA-v<version>.md` in the release mission folder (scaffolded by
`rig scope mission create release-X.Y.Z`); its `expiry.canon_path` and
`expiry.successor_path` name the two inputs, and `rig scope audit --mission <name>`
reports `expired_capability_delta` once both hold.
Private project topology, host practice, and release ownership go to the versioned
project world instead of leaking into the public package. The new release's delta
@@ -107,8 +111,8 @@ obligations start at ITS cut.
packaged result, repairs any missed absorption as explicit debt, absorbs private
project truth, re-primes, and observes whether a clean world-installed agent
reaches the capability from its situation without being told its name.
- A missing route is a release finding. Repair the smallest existing seam or deposit
the evidenced gap into the derivable-context mission; do not create a second
- A missing route is a release finding. Repair the smallest existing seam or record
the evidenced gap as scoped follow-up work in the project; do not create a second
capability registry, search service, or world store at the boundary.
## 8. What deliberately does NOT happen at the boundary
+316 -43
View File
@@ -1,11 +1,71 @@
# RigBundle Reference
Version: 2 (pod-aware)
Last validated against code: 2026-09-29 (install paths and `--target` only; other sections last checked 2026-04-11)
Source of truth: `packages/daemon/src/domain/bundle-types.ts`, `packages/daemon/src/domain/bundle-archive.ts`, `packages/daemon/src/domain/pod-bundle-assembler.ts`
Last validated against code: 2026-10-07, at the 0.6.6 cut `2620dea8` (whole document at `a350c59b`; changes to its sources since then checked)
Source of truth: `packages/daemon/src/domain/bundle-types.ts`, `packages/daemon/src/domain/bundle-archive.ts`, `packages/daemon/src/domain/pod-bundle-assembler.ts`, `packages/daemon/src/routes/bundles.ts`, `packages/cli/src/commands/bundle.ts`, `packages/daemon/src/domain/bundle-install-context.ts`, `packages/daemon/src/domain/bundle-source-resolver.ts`, `packages/daemon/src/domain/bootstrap-orchestrator.ts`
A `.rigbundle` is a self-contained distributable archive that packages a rig spec, all referenced agent specs, their resources (skills, guidance, startup files), culture file, documentation, and an integrity manifest into a single file. The recipient can install and launch the rig without needing the original source tree.
## GitHub folder links
`rig bundle create`, `inspect`, `install`, and `rig up` accept a public HTTPS GitHub folder link:
```sh
rig bundle create https://github.com/example/teams/tree/main/rigs/team -o team.rigbundle
rig bundle inspect https://github.com/example/teams/tree/v1/rigs/team --json
rig up https://github.com/example/teams/tree/COMMIT/rigs/team --target ./project
```
Replace `COMMIT` with a full commit ID. Branches and tags are also accepted, including names containing `/`: they
resolve once to a full commit before fetching. Each result names the resolved source, configuration ID, package digest
and assembler. Save the printed commit-pinned URL to repeat the same source selection. Only a full 40-character commit
ID counts as a commit; a shorter one is looked up as a branch or tag name. `--preset` and repeatable
`--seat pod.member=runtime` select only configurations the folder declares. A link build takes the rig's `name` from
its `rig.yaml` unless `--name` says otherwise, and is named `github-bundle` when `rig.yaml` has no readable name.
Link import needs a running, verified local daemon and a credential-free, publicly readable GitHub URL. It does not
upload files to remote daemons. For a remote target, run the link command on that host, or create an archive, transfer
it with its sibling digest, and use the existing path command there. Existing local path/name commands keep their
dispatch. Importing does not install dependencies or execute repository scripts. Before packaging a link, it checks
the checkout's symlinks (excluding Git metadata), member agent refs, agent imports and legacy package refs (including
additional `--include-packages` entries): every target must resolve inside the fetched checkout. Shared agents and
legacy packages outside the selected folder are allowed within that repository. Preset staging
preserves that directory layout. Unresolved or escaping references stop the import and remove its temporary source.
The selected source is packaged through the existing bundler once. Link `up`/`install` then use the existing bundle
install path, including compatibility and target-conflict checks. For a link, the default install target is the current
directory; `--cwd` separately overrides seat working directories. Imported archives and source/build receipts remain
under the selected OpenRig home's `bundle-imports/` directory for install history. If a response is lost, inputs stay
available and the outcome is reported as unknown; inspect `rig ps` and `rig bundle history` before retrying.
An author's root `bundle.yaml` can declare `compatibility.min_cli_version` and `compatibility.min_daemon_version`.
Link import passes these into create; explicit create minimum-version flags override them. A local-path create doesn't
read them: it packages a minimum only from `--min-cli-version` or `--min-daemon-version`.
The package digest covers the packaged `integrity.files` entries, excluding `bundle.yaml`, ignored junk basenames,
and file modes. It does not cover resources resolved on the installing host or prove what ran. The archive hash is
separate. See [bundle formats](bundle-formats.md) for the exact coverage and identity definitions. Older archives can
have unknown source, configuration or assembler; inspection does not fill those gaps with the inspecting daemon's
identity.
## Advisory author check
```sh
rig bundle check ./my-team --json
```
This local, read-only check reports `openrig.bundle-standard/v1` with `pass`, `finding` or `not_checked` per rule. It
checks pod-aware rig validity, README inclusion in `docs`, readable declared files, in-folder agent refs/imports,
minimum-version shape, declared preset consistency and known sensitive filenames. It does not contact a daemon,
build an archive, run preflight or launch anything. Findings give exit status 1; they are never an install gate. It
reads the folder on disk, not a link or a commit, so files that aren't committed are checked too. Human output gives
each rule's status, ID and reason, then the file it's about in parentheses when there is one; `--json` carries the
same as a `path` field.
README completeness and arbitrary embedded secrets need human review and are reported as `not_checked`. A bounded
or unreadable scan is also `not_checked`, never a clean scan. The check is advice for authors, not a security audit or
listing approval.
---
## Archive Format
@@ -34,7 +94,7 @@ The packer produces deterministic output:
- Portable mode normalizes uid/gid/mode
- Maximum gzip compression (level 9)
This means the same inputs always produce the same archive hash.
Identical staged bytes (including manifest timestamps and provenance) produce the same archive hash. Use the package digest to compare packaged file content independently of manifest metadata.
---
@@ -55,6 +115,10 @@ agents/
SKILL.md — skill files
startup/
context.md — startup files
context-packs/<name>/ — a pack carried with --context-pack (its manifest.yaml and declared files)
project/ — the project carried with --project-dir (project.yaml and files beside it)
skills/<name>/ — a shared skill the author's bundle.yaml declares; other declared
plugins, workflow specs, context packs and agent images keep their paths
```
### Key rules
@@ -98,6 +162,15 @@ agents:
original_ref: "local:../../shared"
hash: "abc123..."
culture_file: CULTURE.md
provenance:
created_at: "2026-04-11T22:32:48.570Z"
daemon_version: "0.6.6"
cli_version: "0.6.6"
# ... and, for a GitHub link, the source it was built from
assembler:
openrigVersion: "0.6.6"
configuration:
id: "dev.lead=claude-code,dev.researcher=codex"
integrity:
algorithm: sha256
files:
@@ -118,7 +191,15 @@ integrity:
| `rig_spec` | string | yes | Relative path to the rig spec within the archive. Safe relative path. |
| `agents` | AgentEntry[] | yes | Array of vendored agent entries. |
| `culture_file` | string | no | Relative path to the culture file if present. |
| `integrity` | Integrity | no | Per-file SHA-256 checksums for content verification. |
| `included_login_files` | string[] | no | Exact archive-relative harness login files deliberately included by the producer. Only these paths are exempt from the login-file refusal; this unsigned declaration is not authentication or receiver approval. |
| `integrity` | Integrity | no | Per-file SHA-256 checksums for content verification. Validation doesn't require it, but install refuses an archive without it and inspect reports integrity FAIL. |
| `provenance` | object | no | Stated, not verified: `created_at`, `daemon_version`, `cli_version`, `source_host`, `author_session`, `source_rig_id`, `source_rig_name`, `notes`, and `source` for a GitHub link build. |
| `assembler` | object | no | `openrigVersion` of the OpenRig that built the archive. |
| `configuration` | object | no | The configuration ID the archive was built in, and `preset` when it matches a declared preset. Outside the package digest. |
| `compatibility` | object | no | `min_cli_version` and `min_daemon_version`, checked on install. |
| `preconditions` | list | no | The author's setup declarations, shown before install and never run (see [bundle formats](bundle-formats.md#declared-setup-preconditions)). |
| `skills`, `plugins`, `workflow_specs`, `context_packs`, `agent_images` | lists | no | Contents from the author's `bundle.yaml` and `--context-pack`, routed into your libraries on install. |
| `project` | object | no | `id` and `path` of the project carried with `--project-dir`. |
### Agent Entry Fields
@@ -127,9 +208,9 @@ integrity:
| `name` | string | yes | Agent name (from agent.yaml). |
| `version` | string | no | Agent version. |
| `path` | string | yes | Relative path to the vendored agent directory. Safe relative path. |
| `original_ref` | string | yes | The original `agent_ref` before rewriting. |
| `original_ref` | string | written by create | The original `agent_ref` before rewriting. Validation doesn't require it. |
| `hash` | string | yes | SHA-256 hash of the agent.yaml content. |
| `import_entries` | ImportEntry[] | yes | Vendored imports for this agent (may be empty). |
| `import_entries` | ImportEntry[] | written by create | Vendored imports for this agent (may be empty). Validation doesn't require it. |
### Import Entry Fields
@@ -141,12 +222,34 @@ integrity:
| `original_ref` | string | yes | The original import ref before rewriting. |
| `hash` | string | yes | SHA-256 hash of the imported agent.yaml. |
### Harness login files
By default, create refuses `.claude/.credentials.json`, `.codex/auth.json` and `.pi/agent/auth.json`
at the root or nested anywhere in selected bundle content, including agents and an explicitly carried project.
The author check reports them too. Messages name paths, never contents, and explain both remedies:
remove the file from the agent folder or carried project and build again; or, only if recipients should have this
login (for example, your own internal test bundle) and its owner agrees, recreate with
`rig bundle create <spec> -o <archive.rigbundle> --include-login-files`.
Anyone with that archive could read the included login files.
The flag applies to this create only. The generated `included_login_files` manifest list names only the actual,
exact archive-relative login files included. Inspect, unpack, install and bootstrap honour those paths without
another flag and show a credential-bearing notice. An additional unrecorded login file still fails, as do malformed
records, directory or wildcard exemptions, and unrelated sensitive files. There is no machine setting or `--force`
bypass. The unsigned record states the producer's choice; it does not authenticate the producer, establish trust,
or constitute a fresh recipient approval. Review the source and files before using a bundle.
Compatibility change: previously accepted bundles containing these files now fail default creation and downstream
verification/install unless deliberately rebuilt with the record. Inspection remains diagnostic: it reports failed
integrity. Ordinary `auth.json` elsewhere and non-login harness files are unchanged. Filename checks do not scan
arbitrary contents for secrets.
### Integrity Section
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `algorithm` | string | yes | Must be `sha256`. |
| `files` | map<string, string> | yes | Map of archive-relative file path → SHA-256 hex hash. Every file in the archive (except `bundle.yaml` itself) should be listed. |
| `files` | map<string, string> | yes | Map of archive-relative file path → SHA-256 hex hash. Every file in the archive except `bundle.yaml`, `.DS_Store`, `Thumbs.db` and `.gitkeep` is listed; an extra file that isn't listed fails verification. |
---
@@ -169,13 +272,15 @@ Future enhancement: cryptographic signing (Ed25519) for author authentication.
The unpacker enforces these safety rules before extraction:
1. **No symlinks or hardlinks** — `SymbolicLink` and `Link` entries are rejected
2. **No absolute paths** — entries starting with `/` are rejected
3. **No path traversal** — entries containing `..` segments are rejected
2. **No absolute paths** — entries starting with `/`, or carrying a Windows drive letter such as `C:\`, are rejected
3. **No path traversal** — entries containing `..` segments are rejected, on either slash direction (`..` or `..\`)
4. **Digest verification** — archive SHA-256 must match the sibling `.sha256` file
5. **Content integrity** — after extraction, per-file hashes are verified against the manifest
If any check fails, extraction is aborted and an error is thrown.
`rig bundle inspect` applies the same unsafe-entry scan (rules 1-3) before it extracts into its temporary directory, so an archive the installer refuses for an unsafe entry is never reported as inspectable. Digest and content-integrity failures are a different case: inspect reports those in its result (`digestValid`, `integrityResult`) instead of refusing, which is what lets it describe a broken bundle rather than throw.
---
## CLI Surface
@@ -190,78 +295,227 @@ where the daemon runs.
### Create a bundle
```bash
rig bundle create <spec-path> -o <output.rigbundle> [--rig-root <dir>] [--name <name>] [--bundle-version <ver>]
rig bundle create <spec-path-or-github-link> -o <output.rigbundle> [--rig-root <dir>] [--preset <name>] [--seat <pod.member=runtime>]... [--context-pack <dir>]... [--project-dir <dir>] [--name <name>] [--bundle-version <ver>] [--min-cli-version <ver>] [--min-daemon-version <ver>] [--notes <text>] [--include-packages <refs...>] [--allow-drift] [--include-login-files] [--json]
```
| Flag | Required | Default | Description |
|------|----------|---------|-------------|
| `<spec-path>` | yes | — | Path to the rig spec YAML file. |
| `<spec-path-or-github-link>` | yes | — | Path to the rig spec YAML file, or a GitHub folder link (see "GitHub folder links" above). |
| `-o, --output` | yes | — | Output path. Must end with `.rigbundle`. |
| `--rig-root` | no | spec directory | Root directory for resolving `agent_ref` and other relative paths. |
| `--name` | no | `my-bundle` | Bundle name in the manifest. |
| `--preset <name>` | no | — | Build one of the configurations the bundle declares in `configurations.yaml` beside `rig.yaml` (see [bundle-formats.md](bundle-formats.md)). The chosen runtimes and profiles are applied to an owned copy of the rig folder, never to yours. |
| `--seat <pod.member=runtime>` | no | — | Use this runtime for one seat, within what `configurations.yaml` allows. Repeatable; applied after `--preset`. An undeclared choice is refused with the allowed set, and nothing is built. |
| `--context-pack <dir>` | no | — | Carry the context pack in `<dir>`. Repeatable. The directory may be outside the rig folder, for example a world pack whose `manifest.yaml` is at its repository root. Only `manifest.yaml` and the files it declares are carried, the same set `rig context add --git` installs, and the pack lands in the bundle at `context-packs/<manifest name>/`. Needs a pod-aware spec. |
| `--project-dir <dir>` | no | — | Carry the project the rig works in: the folder holding its `project.yaml` (which must declare an `id`) and files beside it, such as `SPEC.md`. On install the project is registered in the workspace catalog and the rig is associated with it, before any seat launches (see [project-workspace.md](project-workspace.md)). Needs a pod-aware spec. |
| `--name` | no | the rig's `name` in `rig.yaml`; `my-bundle` (`github-bundle` for a link) when it has no readable name | Bundle name in the manifest. |
| `--bundle-version` | no | `0.1.0` | Bundle version in the manifest. |
| `--min-cli-version`, `--min-daemon-version` | no | — | The oldest OpenRig CLI or daemon that may install the bundle, checked on install. For a link they override the author's `bundle.yaml` minimums. |
| `--notes <text>` | no | — | Notes stored in the manifest's provenance. |
| `--include-packages <refs...>` | no | all from the spec | Legacy (schema 1) specs only: the package refs to include. |
| `--include-login-files` | no | off | Only if recipients should have these logins and their owner agrees (for example, an internal test bundle), include them and record their exact archive-relative paths. Create and consumers show a credential-bearing notice. Does not exempt other sensitive files. |
| `--allow-drift` | no | off | Build a spec that differs from the running rig of the same name. Without it, create refuses; with it, the difference is written into the manifest's provenance notes. |
| `--json` | no | off | Machine-readable output. |
`--context-pack` and `--project-dir` exist only on create. `rig up` and `rig bundle install` have neither, so a bundle
installed straight from a GitHub link carries no project, and carries a context pack only when the folder's own
`bundle.yaml` declares one inside the folder.
The create command:
1. Validates the rig spec
2. Resolves all `agent_ref` paths and their imports
3. Vendors all agent specs, resources, and startup files into a staging directory
4. Rewrites `agent_ref` paths to bundle-relative `local:` refs
5. Collects culture file, docs files, and rig-level startup files
6. Computes per-file integrity hashes
7. Writes the manifest (`bundle.yaml`)
8. Packs into a deterministic `.tar.gz`
9. Writes the sibling `.sha256` digest
1. Validates the rig spec, and refuses a spec that differs from the running rig of the same name (see `--allow-drift`)
2. Collects the culture file, docs files, and rig-, pod- and member-level startup files
3. Resolves all `agent_ref` paths and their imports, vendors the agent specs and their resources, and rewrites the refs to bundle-relative `local:` paths
4. Adds the author's `bundle.yaml` contents (preconditions, skills, plugins, workflow specs, context packs, agent images), the carried packs and project, and the configuration and assembler stamps
5. Computes per-file integrity hashes, refusing sensitive paths (such as `.env`, `*.pem`, `*.key`, `*.p12`, `credentials.*` and `tokens.*`), and writes the manifest (`bundle.yaml`)
6. Refuses staged content that can't be shipped publicly
7. Packs into a deterministic `.tar.gz` and writes the sibling `.sha256` digest
### List a bundle's configurations
```bash
rig bundle configurations <spec-path> [--json]
```
Lists the presets that `configurations.yaml` declares, each with its configuration ID, which one is recommended, and which one matches `rig.yaml` as written.
### Inspect a bundle
```bash
rig bundle inspect <bundle-path> [--json]
rig bundle inspect <bundle-path-or-github-link> [--preset <name>] [--seat <pod.member=runtime>]... [--json]
```
Shows the manifest, digest validity, and integrity verification result. Inspect extracts the archive into a temporary directory for safe validation, then cleans that directory up. It does not install or launch anything.
Shows the manifest, the archive's identity (source and commit for a link, configuration, package SHA-256 and its
coverage, assembler, archive SHA-256), digest validity, the integrity result, any carried context packs and project,
and then the behaviour view. Inspect extracts the archive into a temporary directory for safe validation, then cleans
that directory up. It does not install or launch anything. It exits 2 when the digest or integrity check fails.
`--preset` and `--seat` choose a declared configuration of a GitHub link.
The behaviour view describes the selected archive: its team and configured models, declared permission posture,
files agents receive, startup actions and hooks, managed writes, literal outside domains, prerequisites and what
remains unknown until launch. It reads packaged declarations; it does not run scripts, contact providers, probe
runtimes or create a bootstrap run. Source and assembler identity come from the archive, separately from the view
generator. Configured models are not observations of a running model, and literal domains are not predicted traffic.
Under "Needs (not checked)" the view lists the author's setup preconditions, with their commands marked "not run; one
shell, in order". For a declared full-bypass Claude seat it notes that Claude Code asks once to accept its bypass
warning, and when any Claude or Codex seat is full bypass it says that `--non-interruptive` is available (see
[non-interruptive mode](non-interruptive-mode.md)). It doesn't select the mode or check whether you've already
accepted the warning. When the bundle's `rig.yaml` declares `non_interruptive: true`, the view instead says that the
bundle declares non-interruptive launches for those seats, with broad file, command and network access, and that
`--no-non-interruptive` overrides it; the asks-once note is left out.
`rig bundle install` and bundle-form `rig up` print this same view to stderr before the existing action, including
`--plan`. With `--json`, stdout remains one result; its optional `behaviour` field carries the structured view.
GitHub links reuse the single prepared archive. The header is informational: missing views and inspection errors
print a diagnostic, then the original installation checks and result determine success. Legacy schema-1 archives
report `not_generated`, rather than an empty team. A local archive can change between inspection and installation;
the header does not bind a later action atomically to those bytes.
Agents can run shell commands as the launching user, subject to runtime and host policy. Explicit permission bypass
is distinguished from conditional launch floors; Pi resource trust is separate from native permission policy.
Host settings, accounts, plugins, runtime support and effective permissions remain unknown. Text scanning is bounded
and reports unread members; dynamically computed commands and addresses cannot be predicted. Installation targets,
`--cwd` and configured library roots resolve separately from the archive's declarations. See
[bundle formats](bundle-formats.md) for the structured view and digest coverage.
**Integrity means the archive is self-consistent, not who made it. Provenance is stated by the bundle and not verified.**
### Install a bundle
```bash
rig bundle install <bundle-path> [--plan] [--yes] [--target <root>] [--json]
rig bundle install <bundle-path-or-github-link> [--plan] [--yes] [--target <root>] [--cwd <dir>] [--preset <name>] [--seat <pod.member=runtime>]... [--non-interruptive | --no-non-interruptive] [--skip-version-check] [--force] [--json]
```
| Flag | Required | Default | Description |
|------|----------|---------|-------------|
| `<bundle-path>` | yes | — | Path to the `.rigbundle` file. |
| `--plan` | no | `false` | Preview without installing or launching. Not side-effect free: it runs the preflight, which executes the members' runtime `--version` probes, and it records a bootstrap run. It writes nothing to the target. |
| `<bundle-path-or-github-link>` | yes | — | Path to the `.rigbundle` file, or a GitHub folder link. |
| `--plan` | no | `false` | Preview without installing or launching. Not side-effect free: it records a bootstrap run and runs the preflight, which for a pod-aware bundle runs `pi --version` or `omp --version` for Pi or OMP seats and `codex -p <profile> mcp list` for a Codex seat that names a `codex_config_profile`. It writes nothing to the target. |
| `--yes` | no | `false` | Auto-approve trusted actions during apply mode. |
| `--target <root>` | yes in apply mode | — | Directory the bundle is installed into and launched from. Required unless `--plan` is used. |
| `--target <root>` | yes in apply mode, for an archive path | the current directory for a link | Directory the bundle is installed into and launched from. Required for an archive path unless `--plan` is used. |
| `--cwd <dir>` | no | — | Working directory for every launched member, for this install only (for example, the repository the rig works on). Does not change the install target. |
| `--preset <name>`, `--seat <pod.member=runtime>` | no | — | For a GitHub link, the declared configuration to build and install. |
| `--non-interruptive` | no | the bundle `rig.yaml`'s `non_interruptive`, else the operator setting `launch.non_interruptive`, else off | Accept the harnesses' first-launch warnings for this rig's full-bypass Claude and Codex seats with launch flags, writing nothing to your settings. The choice is saved on the rig. `--no-non-interruptive` turns a saved choice off; stop a running rig with `rig down` first. See [non-interruptive mode](non-interruptive-mode.md). |
| `--skip-version-check` | no | off | Skip the compatibility check below. Not for routine use. |
| `--force` | no | off | Skip the running-team check below. Not for routine use. A pod-aware bundle is still refused before target files are written when a team with the same name is running; a legacy (schema 1) bundle can be left partly installed. |
| `--json` | no | `false` | Emit machine-readable JSON. |
Install **launches the rig**; it does not just unpack it. It extracts the bundle to a temporary directory, validates integrity, and bootstraps the rig. In apply mode, the daemon requires `targetRoot`, so `rig bundle install` must be given `--target <root>` unless you are running with `--plan`.
Install **launches the rig**; it does not just unpack it. It extracts the bundle to a temporary directory, validates integrity, and bootstraps the rig. In apply mode, the daemon requires `targetRoot`, so `rig bundle install` must be given `--target <root>` for an archive path unless you are running with `--plan`.
For a pod-aware (schema version 2) bundle, apply copies the extracted contents (`bundle.yaml`, `rig.yaml`, `agents/`, culture and docs files) into the target and launches from there, then removes the temporary extraction. So:
Before it plans or applies, install runs two checks on the archive, both also under `--plan`:
- **compatibility:** the manifest's `min_daemon_version` and `min_cli_version` against this daemon and CLI. A failure
reports "Bundle compatibility check failed" with the versions involved.
- **running team:** a running team with the bundle's rig name refuses the install with "Bundle install conflict check
failed". The error names the installed and the offered team and lists three choices: use the existing team, stop it
with `rig down` and retry to replace it, or cancel. This check does not refuse a stopped team with that name.
- the target becomes the rig root: `agent_ref` paths resolve inside it, and a member with `cwd: "."` (or no `cwd`) starts in the target;
- an absolute member `cwd` stays as authored, and `rig up --cwd <dir>` still overrides every member's cwd;
- if the target already has a file with **different** content at any bundle path (for example its own `rig.yaml`), install refuses with `target_conflict` and writes nothing. Identical files are accepted, so reinstalling the same bundle into the same target works. Use an empty or dedicated directory as the target.
Each error lists its fixes; the compatibility error also names `--skip-version-check`. `--skip-version-check` and
`--force` skip only these two checks: the manifest safety check of its `rig_spec` and `project` entries always runs.
Legacy (schema version 1) bundles keep their old behavior: `--target` is only where packages are installed.
For a pod-aware (schema version 2) bundle, installing a team whose rig name matches a stopped team replaces it: the
earlier team is archived when the new one is created, and the result gives the `rig unarchive <id>` command that
restores it. If OpenRig cannot confirm the earlier team is stopped, install refuses with `generation_unconfirmed` and
creates no replacement team. For an install into that team's own install folder, OpenRig makes this check before
writing any files; for any other target, bundle files already copied there stay.
A legacy (schema version 1) bundle does not replace a stopped team. Its approved external and package install steps run
first, and then its rig-name check fails preflight with "Rig name '<name>' already exists".
For a pod-aware (schema version 2) bundle, apply copies every extracted file (`bundle.yaml`, `rig.yaml`, `agents/`, culture and docs files, and any carried `project/`, `context-packs/` and author-declared contents) into the target and launches from there, then removes the temporary extraction. So:
- the target becomes the rig root: `agent_ref` paths resolve inside it, and a member with `cwd: "."` starts in the target (every pod-aware member must declare a `cwd`);
- an absolute member `cwd` stays as authored, and `--cwd <dir>` (on `rig bundle install` or `rig up`) still overrides every member's cwd;
- if the target already has a file with **different** content at any bundle path (for example its own `rig.yaml`), install refuses with `target_conflict` and writes nothing. Identical target files don't cause a target-content conflict; the other installation checks above, including the running-team check, still apply. Use an empty or dedicated directory as the target.
- exception: reinstalling over a stopped team into that team's own install folder (the target's `bundle.yaml` is schema version 2 with the same bundle name, or with `my-bundle` or `github-bundle`, the default names before 0.6.7) replaces its files there. Each differing path is first copied under `<OpenRig home>/bundle-backups/reinstall-*/files/`, with a `RESTORE.json` beside it; other files in the folder are kept. The files stay installed even if a later launch fails.
The bundle's declared skills, plugins, workflow specs, context packs and agent images are routed into your libraries **before any member launches**, and the context-pack library is rescanned, so a member's first turn can already read a pack the bundle carried. A routing failure does not stop the install: it is printed as a warning, returned in `routingFailures`, and recorded in the install audit. The human output lists what each declared kind routed and any entry that was not routed.
A carried pack is routed into `context.root` under its folder name in the archive: for a pack carried with `--context-pack`, that is its manifest name (`context-packs/<name>/`); for a pack the author's `bundle.yaml` declares, it is the basename of the declared folder, whatever the manifest says. If a pack of that name is already installed, install never merges into it: an identical pack is reported as `already_installed`, and a different one (for example a `rig context add --git` install at another revision) is kept unchanged and reported as `kept_existing`, with the `rig context rm <name>` command to use the bundle's copy instead.
A carried project is registered as `registered` (a new catalog entry), `associated` (the rig added to an existing entry), `already_registered` or `conflict`. A conflict writes nothing to the catalog and is reported as a routing failure; the install continues. A project folder that already exists with different files is kept unchanged.
### Skills shared by bundle profiles
For skills shared by several agents, place each complete skill directory at
`skills/<name>/` beside the rig spec and declare its entry point in the source
`bundle.yaml`:
```yaml
skills:
- skills/review-work/SKILL.md
```
`rig bundle create` includes that directory's helper scripts and references as
well as `SKILL.md`. The skill needs valid `name` and `description` frontmatter;
the name is the ID a profile selects with `uses.skills: [review-work]`.
Undeclared sibling directories are not bundled. Other declared skill file paths
retain their single-file behavior.
Claude, Codex and Pi profiles can select this installed bundle pool even when
their working directory is elsewhere. Explicit AgentSpec resources keep priority
over a discovered skill with the same ID. Pi projects selected skills into its
seat's agent directory; it does not scan Claude or Codex home/workspace pools.
Installing the bundle does not add these skills to the operator's managed
`skills.root` catalog. Profiles that already get a skill from a plugin should not
also select its bundle copy.
When a profile selects a skill from inside its agent spec's folder (for example the
installed bundle) and the managed catalog holds a different copy with the same ID,
the bundle's copy is used. Launch warns `skill_bundle_precedence` and leaves the
catalog unchanged. The skill's `SKILL.md` `name` must equal the selected ID. A
differing copy from anywhere else fails launch with `skill_identity_conflict`.
Legacy (schema version 1) bundles keep their old behavior: `--target` is only where packages are installed, and their declared contents are routed after a completed install.
### Launch directly
```bash
rig up <bundle-path> [--target <root>] [--cwd <dir>]
rig up <bundle-path-or-github-link> [--target <root>] [--cwd <dir>] [--plan] [--yes] [--preset <name>] [--seat <pod.member=runtime>]... [--non-interruptive | --no-non-interruptive] [--host <id>] [--json]
```
`rig up` auto-detects `.rigbundle` files and routes them through the bundle bootstrap path.
`rig up` auto-detects `.rigbundle` files and GitHub folder links and prints the behaviour view before it acts. The two
take different routes:
- **A GitHub link** builds the archive and installs it through the `rig bundle install` path, with its compatibility
and rig-name checks and the install audit.
- **A local `.rigbundle` path** goes through the bundle bootstrap path directly. It skips the compatibility check,
isn't recorded in the install audit (so `rig bundle history` doesn't list it), and doesn't print the routing summary.
For a pod-aware archive, a running team with the same name is still refused before target files are written, and a
stopped one is replaced as described under "Install a bundle". A legacy (schema 1) archive runs its approved install
steps before its rig-name check, which then refuses a running team and fails preflight for a stopped one; it also
gets no post-install routing this way. To get the checks and the audit for a local archive, use `rig bundle install`
or `rig bootstrap`.
`rig bootstrap <bundle-path>` also accepts archives and uses the ordinary bundle
install path, including compatibility checks and the install audit. Use `--plan`
to preview, or `--target <root>` to choose the persistent install directory. Its
default target is the caller's current directory; `--cwd` only changes the agents'
working directory. YAML files and library spec names keep the spec bootstrap path.
It prints no behaviour view and has no `--non-interruptive` option; a bundle's declared `non_interruptive` still applies.
- `--target <root>` is the install target described above (for a schema-version-2 bundle, the directory the bundle is copied into and launched from)
- if `--target` is omitted for a `.rigbundle`, the CLI defaults the install target to the current working directory, so the bundle's files are written there
- `rig up` resolves a relative `--target` against your current directory before sending it, like `rig bundle install`; with `--host`, `--target` is sent as given and must be a path that exists on that host
- if `--target` is omitted for a `.rigbundle` or a link, the CLI defaults the install target to the current working directory, so the bundle's files are written there
- `rig up` resolves a relative `--target` against your current directory before sending it, like `rig bundle install`; with `--host`, `--target` is sent as given and must be a path that exists on that host, and an omitted `--target` is refused there ("targetRoot is required for bundle apply mode"). GitHub links don't work with `--host`.
- `--cwd <dir>` does **not** change the install target; it only overrides the launched members' working directory for that run
- `--non-interruptive` works as on `rig bundle install`
- a schema-version-2 bundle's declared contents are routed before any member launches, as with `rig bundle install`
### Install history
```bash
rig bundle history [--rig <name>] [--since <iso>] [--json]
```
Lists the install audit records in `bundle-audit.jsonl` in the OpenRig home (default `~/.openrig`): when, the outcome,
the rig and the bundle path.
`--rig` filters by target rig name and `--since` by install time. Installs through `rig bundle install`,
`rig bootstrap <archive>` and `rig up <link>` are recorded; `rig up <local archive>` isn't.
---
## Assembly Process
When `rig bundle create` runs, the `PodBundleAssembler` performs these steps:
When `rig bundle create` runs, the `PodBundleAssembler` stages the files (steps 1-4). The create route then adds the
author's `bundle.yaml` contents, the carried packs and project, and the configuration and assembler stamps, and does
steps 5-7:
1. **Parse and validate** the rig spec
2. **Collect rig-level files:**
@@ -305,8 +559,11 @@ When an agent spec has `imports`, each import is resolved, vendored into the bun
5. `rig_spec` is required and must be a safe relative path
6. `agents` must be an array
7. Each agent must have `name`, `path` (safe relative), and `hash`
8. Integrity `algorithm` must be `sha256`
9. Integrity `files` must be a non-empty map of safe-relative-path → 64-char hex hash
8. Optional blocks, when present, must be well formed: `provenance`, `compatibility`, `skills`, `plugins`,
`workflow_specs`, `context_packs`, `agent_images`, and `project` (an `id` made of letters, digits, `.`, `_` and `-`,
and a safe relative `path`), plus `included_login_files` (unique safe relative paths)
The manifest validator doesn't check `integrity`; unpack does (below).
### Archive safety (enforced on unpack)
@@ -314,7 +571,7 @@ When an agent spec has `imports`, each import is resolved, vendored into the bun
2. No absolute paths
3. No `..` path traversal
4. Archive digest must match sibling `.sha256`
5. Per-file content hashes must match integrity section
5. The manifest must have an integrity section, and per-file content hashes must match it
### Assembly validation
@@ -322,6 +579,10 @@ When an agent spec has `imports`, each import is resolved, vendored into the bun
2. All `agent_ref` paths must resolve to valid agent specs
3. All declared `docs` files must exist on disk (missing docs fail assembly)
4. Culture file and startup files are collected best-effort (missing = skipped)
5. A declared skill that's missing or unreadable is a warning, written into the manifest's provenance notes; it
doesn't stop the build
6. Sensitive paths ("Sensitive paths detected in bundle") and content that can't be shipped publicly ("Public artifact
substance refusal") stop the build
---
@@ -336,6 +597,9 @@ Key differences from v2:
- No `import_entries` in package entries
- Legacy rig spec format (flat nodes, not pods)
The v1 validator checks a `project` block the same way as v2, so a v1 bundle can't write outside the projects root or
read outside the bundle.
---
## Example: Creating and Using a Bundle
@@ -360,11 +624,18 @@ Bundle created: my-team.rigbundle
rig bundle inspect my-team.rigbundle
```
Output:
The manifest summary and identity lines are followed by the behaviour view:
```
Bundle: my-team v1.0.0
Configuration: dev.lead=claude-code,dev.researcher=codex
Package SHA-256: 3f9a...
Coverage: openrig.package-digest/v1; packaged files only; excludes bundle.yaml, ignored junk and file modes; not host-resolved resources or execution.
Assembler: OpenRig 0.6.6
Archive SHA-256: a1b2c3d4...
Digest valid: true
Integrity: PASS
What this bundle declares before installation:
...
```
### Install and launch
@@ -380,4 +651,6 @@ Equivalent explicit form:
rig up /path/to/my-team.rigbundle --target ~/projects/my-project
```
The bundle is extracted to a temporary directory and its integrity is verified. A schema-version-2 bundle is then copied into the target root (refused if the target holds different files at the same paths) and the rig is launched from there, with all agents and resources from the bundle. If you also want agents to launch with a different working directory for that run, pass `--cwd <dir>` separately.
The bundle is extracted to a temporary directory and its integrity is verified. A schema-version-2 bundle is then copied into the target root and the rig is launched from there, with all agents and resources from the bundle. If you also want agents to launch with a different working directory for that run, pass `--cwd <dir>` separately.
A running team must be stopped before reinstalling. Reinstalling into a stopped team's recorded install folder preserves conflicting files in the instance's `bundle-backups` directory; the result names the backup. The folder must still contain that bundle's installed manifest. A copied same-name manifest in another folder does not authorize replacing its conflicting files. Other targets retain first-install behavior: different files at the same paths are refused before writing. New installations record the canonical target folder for each generation, independently of `--cwd`. Older generations and new generations created directly from `rig.yaml` have no recorded folder and retain the manifest-only check until their next successful bundle installation, so a copied same-name manifest can still qualify for those generations.
+278 -38
View File
@@ -1,13 +1,16 @@
# RigSpec Reference
Version: 0.2 (pod-aware)
Last validated against code: 2026-04-11
Source of truth: `packages/daemon/src/domain/rigspec-schema.ts`, `packages/daemon/src/domain/types.ts`
Last validated against code: 2026-10-07, at the 0.6.6 cut `2620dea8` (whole document at `fcaf1f8e`; changes to its sources since then checked)
Source of truth: `packages/daemon/src/domain/rigspec-schema.ts`, `packages/daemon/src/domain/types.ts`, `packages/daemon/src/domain/startup-validation.ts`, `packages/daemon/src/domain/permission-policy/policy-ref.ts`, `packages/daemon/src/domain/profile-resolver.ts`, `packages/daemon/src/domain/rigspec-preflight.ts`, `packages/daemon/src/adapters/kernel-authority.ts`, `packages/daemon/src/domain/native-permission-store.ts`, `packages/daemon/src/domain/codex-team-workspace.ts`
This is the canonical reference for the pod-aware RigSpec YAML format. Every field, validation rule, and default documented here was traced from the actual parser and validator code, not from prior documentation.
---
For choosing IDs, see [naming rigs, pods and seats](topology-naming.md). Keep the same
logical names in edges, startup instructions, workflow targets and runtime presets.
## Minimal Valid Example
```yaml
@@ -18,7 +21,7 @@ pods:
- id: dev
label: Development
members:
- id: impl
- id: build
agent_ref: "local:agents/impl"
profile: default
runtime: claude-code
@@ -105,7 +108,7 @@ pods:
required: true
actions: []
members:
- id: impl
- id: build
agent_ref: "local:agents/impl"
profile: default
runtime: claude-code
@@ -121,7 +124,7 @@ pods:
applies_on: [fresh_start]
actions:
- type: send_text
value: "Load the implementation-pair skill and begin."
value: "Read your guidance and begin."
phase: after_ready
idempotent: true
- id: qa
@@ -131,7 +134,7 @@ pods:
cwd: "."
edges:
- kind: delegates_to
from: impl
from: build
to: qa
- id: rev
@@ -152,13 +155,13 @@ pods:
edges:
- kind: delegates_to
from: orch.lead
to: dev.impl
to: dev.build
- kind: delegates_to
from: orch.peer
to: dev.qa
- kind: can_observe
from: rev.r1
to: dev.impl
to: dev.build
- kind: can_observe
from: rev.r2
to: dev.qa
@@ -170,15 +173,18 @@ edges:
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `version` | string | yes | — | Must be `"0.2"` for pod-aware specs. |
| `version` | string | yes | — | Use `"0.2"`. Any non-empty string validates; a spec is treated as pod-aware because `pods` is an array. |
| `name` | string | yes | — | Rig name. Used in session naming (`{pod}-{member}@{name}`), snapshot identification, and spec library lookup. |
| `summary` | string | no | — | Human-readable description. Shown in spec library, review surfaces, and `rig specs show`. |
| `summary` | string | no | — | Human-readable description. Shown in the spec library, review surfaces and `rig specs preview` (in `rig specs show` only with `--json`). |
| `culture_file` | string | no | — | Relative path to a rig-wide culture/constitution file. Must be a safe relative path (no `..`, no absolute). |
| `permission_policy` | string | no | — | Permission policy attached to the rig. Either a built-in (`builtin:locked`, `builtin:standard`, `builtin:open`, `builtin:yolo`) or a safe relative path to a custom policy file (resolved from this spec's directory; no `..`, no absolute). Absent leaves the default floor. A member may set its own `permission_policy`, which takes precedence over the rig-level one. See "Attaching a permission policy" below. |
| `managed_blocks` | map | no | `CLAUDE.md` | File that receives OpenRig's managed instruction blocks for Claude Code members. Only the `claude-code` key is accepted, with `CLAUDE.md` or `CLAUDE.local.md`. Codex members always use `AGENTS.md`. See "Choosing the Claude instruction file" below. |
| `non_interruptive` | boolean | no | — | Pod-aware rig launch-warning default. With full-bypass Claude/Codex seats, true accepts or hides supported harness warnings using launch flags. Explicit CLI choices override this field; this field overrides the machine default. It does not grant permissions, change native settings files, or bypass login. |
| `permission_policy` | string | no | — | Permission policy attached to the rig. Either a built-in (`builtin:locked`, `builtin:standard`, `builtin:open`, `builtin:yolo`, `builtin:auto`) or a safe relative path to a custom policy file (resolved from this spec's directory; no `..`, no absolute, no empty segments, each segment `[A-Za-z0-9][A-Za-z0-9._-]*`), or `none`, a recorded choice of the floor. Absent uses the default floor with the scoped team launch allowances described below. A bare built-in name such as `yolo` is refused ("use 'builtin:yolo'"), and so is an explicit `null`. A custom file that is missing, unreadable or invalid isn't a validation error: it resolves to the floor, and preflight warns. A member may set its own `permission_policy` (not on a terminal member), which takes precedence over the rig-level one; there is no pod level. See "Attaching a permission policy" below. |
| `env` | map | no | — | Launch environment for every seat in the rig: `NAME: value` pairs. A member's own `env` overrides it name by name. Names match `^[A-Z_][A-Z0-9_]*$`, names starting `OPENRIG_` are reserved, and values must be non-empty strings (quote numbers and booleans). Values are not secret. See "Launch environment" below. |
| `managed_blocks` | map | no | `CLAUDE.md` | File that receives OpenRig's managed instruction blocks for Claude Code members. Only the `claude-code` key is accepted, with `CLAUDE.md` or `CLAUDE.local.md`. Codex, Pi and OMP members use `AGENTS.md`. See "Choosing the Claude instruction file" below. |
| `workspace` | object | no | — | The rig's workspace: `workspace_root` (required), `repos[]` of `{name, path, kind}` with `kind` one of `user`, `project`, `knowledge`, `lab` or `delivery` and unique names, an optional `default_repo` naming one of them, and an optional `knowledge_root`. Relative repo paths resolve against `workspace_root`. |
| `docs` | Doc[] | no | — | Documentation files that should travel with the rig. Included in rig bundles. Each entry has a `path` field (safe relative path). The engine does not consume these — they are for humans and agents setting up the environment before launch. |
| `startup` | StartupBlock | no | — | Rig-level startup files and actions. Applied to all members via the startup layering model. |
| `services` | ServicesBlock | no | — | Optional managed services (Docker Compose). When present, services boot before any agent launches. |
| `services` | ServicesBlock | no | — | Optional managed services (Docker Compose). When present, `rig up` boots them before any agent launches; `rig import` doesn't boot them. |
| `pods` | Pod[] | yes | — | At least one pod required. Each pod is a bounded context containing members and pod-local edges. |
| `edges` | CrossPodEdge[] | no | `[]` | Cross-pod edges connecting members in different pods. Must use fully-qualified `pod.member` IDs. |
@@ -194,7 +200,7 @@ permission_policy: builtin:standard
permission_policy: policies/my-cautious-dev.policy.md
```
Built-in policies (`locked` / `standard` / `open` / `yolo`) are read-only and are
Built-in policies (`locked` / `standard` / `open` / `yolo` / `auto`) are read-only and are
referenced as `builtin:<name>`. A custom policy lives in your own project and is
referenced by a safe relative path (no `..`, no absolute). A shipped example of the
custom shape is `packages/daemon/policies/examples/my-cautious-dev.policy.md` — copy it
@@ -211,6 +217,162 @@ future managed launches of that stable seat; it does not rewrite this spec or
its inherited policy provenance. `inherit` removes that override. See
[per-seat permission mode](getting-started.md#per-seat-permission-mode).
### Team launch defaults
A non-kernel Claude or Codex seat with no authored permission policy, explicit
seat permission selection, or named Codex profile receives the team launch
default. An explicit policy, including `none` or `builtin:locked`, keeps its
existing meaning. The default is derived again for fresh launch, resume, fork
and handover; it is not saved as a user choice. Kernel, Pi and terminal behavior
is unchanged.
Claude keeps `acceptEdits` and receives inline session settings allowing ordinary
`rig` commands, project reads and common project test commands (for example,
`npm test`, `pnpm test`, `pytest`, `go test` and `cargo test`). Lifecycle commands
such as `rig up`, `rig down`, `rig restore`, `rig bundle install` and seat stop or
handover ask through a session `PreToolUse` hook. Their literal help forms, such
as `rig down --help`, `rig bundle install -h` and `rig help down`, run without
that lifecycle prompt. Native personal, project and managed deny/ask rules still
apply; OpenRig does not remove or override them.
For allowances, the hook recognizes literal command words (including quoted or absolute paths),
leading environment assignments that do not change executable lookup or startup,
and `env`, `command` and `exec` wrappers without options other than `--`.
Relative executable paths and assignments such as `PATH` or `NODE_OPTIONS` stay
with native checks. The same existing team allowances apply after spelling
normalization; project `node_modules/.bin/vitest` and `jest` paths match their
existing `npx` allowances. It does not automatically allow pipelines, command
substitutions, redirects, heredocs, shell functions or other unrecognized syntax.
Lifecycle prefixes are checked at every word position, including after wrappers,
control-flow words and CLI argument separators. A `--` separator before or after
the subcommand ends option parsing, so a later `--help` is an operand and still
asks. Ask detection also scans with comment text retained, so a `#` inside a
substitution does not hide a later lifecycle command. Unquoted prose or comments
containing a lifecycle command may also ask; ordinary trailing comments do not
change allowance matching. Quoted messages and quoted heredoc bodies remain data.
Arithmetic shifts are not treated as heredoc operators. These are command
allowances, not containment: a project's test command can execute code. The
hook and allowances are passed with `--settings` at launch, including resume
and fork; nothing is written to personal or project permission files.
If the helper asset is missing at launch, OpenRig falls back to the native lifecycle
ask rules; help can prompt in that fallback. A helper that disappears or times out
after launch cannot supply a decision, leaving Claude's remaining native rules
in effect. The hook is a convenience policy, not a containment boundary.
Codex keeps `workspace-write` with its existing approval policy and receives the
configured OpenRig workspace root plus its pod's shared state directory as
additional writable directories. The team workspace preparer creates missing
directory ancestors and excludes the home directory and its ancestors from its
prepared scopes. Unavailable optional directories are warned about and omitted
from that list without blocking launch. When no prepared scopes remain, the
runtime adapter retains its existing pod-state `--add-dir` fallback, which this
step does not prepare. This does not modify Codex permission files or enable
non-interruptive mode.
**Codex lifecycle commands do not gain a new approval rule.** With Codex's
existing `on-request` policy, non-escalated sandboxed commands, including
`rig up` and `rig down`, can run without asking. This default addresses writable
workspace access; it does not promise a lifecycle confirmation prompt.
### Built-in permission policies
The five built-ins live in `packages/daemon/policies/builtin/`. Action names are the
policies' own semantic classes.
| Policy | Surface | Runs without asking | Asks a person | Denied |
|--------|---------|---------------------|---------------|--------|
| `builtin:locked` | config | `run_toolchain` (npm, node, tsc, tests, lint), `rig_up`, `rig_down` | nothing | everything else (`default_posture: deny`) |
| `builtin:standard` | config | everything not listed, including `push_to_remote` (`default_posture: allow`) | `create_pr`, `publish_package`, `merge_or_release`, `force_push`, and the destructive class | nothing |
| `builtin:open` | config | everything, including PRs, publishing, merges and force pushes (`default_posture: allow`) | the destructive class only | nothing |
| `builtin:yolo` | flag (`launch_posture: full_bypass`) | everything; the runtime's permission prompts are bypassed at launch | nothing | nothing |
| `builtin:auto` | flag (`launch_posture: auto`) | Claude runs with `--permission-mode auto`; Codex, Pi and OMP launch at the floor | Claude: decided by auto mode; others: as at the floor | Claude: decided by auto mode; others: as at the floor |
The destructive class is `delete_everything`, `drop_persistent_store` and
`reset_or_discard_vcs`; `builtin:locked`'s list also names `delete_files` and `force_push`.
**At launch.** `builtin:yolo` selects Claude `--dangerously-skip-permissions`, Codex
`-s danger-full-access -a never`, and Pi `--approve`. `builtin:auto` selects Claude
`--permission-mode auto`, while Codex and Pi do not have an auto mode and launch at the floor.
Every other seat launches at the floor (a non-kernel seat with no policy also gets the
[team launch default](#team-launch-defaults) above):
- Claude `--permission-mode acceptEdits`;
- Codex `-s workspace-write`, or `-p <profile>` when the member sets
`codex_config_profile`, in which case the profile governs its own sandbox;
- Pi `--no-approve` by default.
Seats of the rig named `kernel` are the exception. With no member or rig policy, no
per-seat choice and (for Codex) no named profile, Claude launches in `acceptEdits` with a
per-launch `--settings` allow list for its file tools and operational commands, and Codex
launches with `-s danger-full-access -a never`, plus per-launch `-c` overrides that hide its
full-access and GPT-5.1 migration notices, whatever the rig's non-interruptive choice.
**Config-surface policies are recorded, not applied at launch.** The seat still starts at
the floor. The `allow`, `ask` and `deny` rules take effect once they are translated into the
runtime's native settings. The `applying-a-permission-policy` skill in `openrig-core` does
that translation, with per-runtime limits. For example, Claude's prefix rules can't
reliably tell `git push --force` from `git push`. An `ask` waits for a person, so it pauses
an autonomous seat. Standard suits interactive work, and the policy files point
autonomous teams to Open or YOLO.
**Pi has no permission policy.** `--approve` and `--no-approve` set Pi's resource trust. The
OMP variant maps that trust to its approval mode: `yolo` under `--approve`, otherwise
`always-ask`.
**A custom policy file** is Markdown with frontmatter: `policy_schema_version: 1`, `name`,
`source: custom`, `description`, and `surface`.
- `surface: flag` adds `launch_posture` (`floor`, `full_bypass` or `auto`).
- `surface: config` adds `default_posture` (`allow`, `ask` or `deny`) and the `allow`, `ask`,
`deny` and `destructive_class` lists (`[]` for none).
**Claude Code's own checks.** The first time Claude Code starts an interactive session
with permissions bypassed, it shows a warning dialog asking you to accept responsibility;
declining exits. OpenRig reports such a seat as `attention_required` and holds its startup
context for `rig seat continue`; `rig up --non-interruptive` or `rig bundle install
--non-interruptive` accepts the warning with a launch flag instead (see
[non-interruptive mode](non-interruptive-mode.md)). That choice is saved on the rig, not in
`rig.yaml`. On Linux and macOS Claude Code refuses that mode when run as root or under `sudo`,
except inside a recognized sandbox. See Claude Code's
[Choose a permission mode](https://code.claude.com/docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode).
### Launch environment
`env:` sets environment variables for the seats of a rig, so a team can share a setting such as a feature flag, a region or a log level without every member hand-editing a shell profile. Declare it on the rig, on a member, or both:
```yaml
env:
LOG_LEVEL: info
REGION: eu
pods:
- id: dev
members:
- id: impl
runtime: claude-code
env:
LOG_LEVEL: debug # overrides the rig's value for this seat only
```
- A seat gets the rig's `env` with its own `env` laid over it, name by name.
- The same environment is applied on first launch, on `rig up <rig-name>` restore, and to the successor of a seat handover.
- `rig up <spec> --env KEY=VALUE` (repeatable) adds or overrides a value for one launch. A one-off value belongs to the terminal that launch creates: it stays in that terminal's environment for as long as the terminal lives, and OpenRig removes it from the tmux session's environment as soon as the terminal has started, so a terminal started later in that session does not get it. If OpenRig can't take it out, the seat keeps running and the launch warns, naming the variable and the tmux command to put it back or remove it. Until then, a terminal started later in that session would get it. A restore, a handover successor or any later launch starts from the spec's `env:` alone, so the value is not saved and does not carry forward. To keep a value, put it in `env:`. One exception to "does not carry forward", for a managed Claude seat (see below): a one-off name that the seat's spec does not declare stays on the session's list of names, `OPENRIG_SEAT_ENV_KEYS` (names only, no values), because the first launch and an in-place restart of the same terminal read that list. So if a later pane in that session gets a value for that name from the tmux server's own environment, its managed Claude launch can forward that value, where a launch without `--env` would leave it out. The first launch's one-off value itself is not passed on to that pane. This comes from reading the code and has not been measured. `--env` does not apply to `rig up <rig-name>` (a restore) or to a topology (several rigs from their own specs); the CLI refuses both. For a topology, put `env:` in each rig's spec.
- Names starting `OPENRIG_` are reserved for OpenRig and refused. Empty values are refused, because the launch omits empty variables.
- `rig export` writes the rig and member `env:` back out.
**Where the declared names reach, by runtime.** Declared values are handed to the seat's terminal as tmux environment, so most seats take them as given:
- Plain Claude Code (no permission mode selected), Codex and terminal seats take a spec `HOME`, `PATH` or `CLAUDE_CONFIG_DIR` as given.
- The cleared environment (`env -i`) belongs only to a managed Claude launch, which is the one used when a permission mode is selected for the seat (for example `permission_policy: builtin:auto`). It forwards the declared names through the cleared environment, except `PATH`, `HOME` and `CLAUDE_CONFIG_DIR`, which OpenRig sets for that launch itself, and `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`, for which it sets its own renderer setting. A spec value for any of those four is not forwarded. A seat that selected the shipped `openrig-core` plugin also has `CLAUDE_CODE_PLUGIN_DIRS` (the vendored plugin, added after a list the seat declares itself) among its declared names, so it is forwarded like the others and the plugin's hooks load in a seat with a permission mode as in one without; a seat that didn't select the plugin has no such name added. Beyond the declared names, the launch also forwards, by name and only when the seat's terminal has them set, the terminal and locale variables (`TERM`, `COLORTERM`, `TERM_PROGRAM`, `TERM_PROGRAM_VERSION`, `LANG` and the `LC_*` names) and the person's editor and display session: `EDITOR`, `VISUAL`, `DISPLAY`, `XAUTHORITY` and `WAYLAND_DISPLAY`. They let Claude's external-editor action open the person's editor and let image paste reach the clipboard, without a value in a spec. `WAYLAND_DISPLAY` is passed as an absolute path: an absolute value is kept, and a relative one is joined to the terminal's `XDG_RUNTIME_DIR`; if the terminal has no `XDG_RUNTIME_DIR` for it, the name is left out. `XDG_RUNTIME_DIR` itself is not forwarded, because D-Bus clients look for the session bus at `$XDG_RUNTIME_DIR/bus` and would reach the keyring and `systemctl --user`. `DBUS_SESSION_BUS_ADDRESS`, `XDG_SESSION_TYPE`, `XDG_CURRENT_DESKTOP` and `SSH_AUTH_SOCK` are not forwarded either. A running seat picks the names up at its next managed Claude launch, not before: `rig seat launch <seat> --fresh --stop --reason "<why>"` for that seat alone (a new conversation), or a restore of the whole rig (`rig down <rig>`, then `rig up <rig> --existing`, which resumes each conversation but restarts every seat in the rig), or a handover. A seat that is up keeps the environment it started with.
- Codex seats run OpenRig's own Codex executable whatever a spec `PATH` says, and use the daemon's `CODEX_HOME` when the daemon has one.
- On Pi and OMP seats the values reach the terminal. The agent process gets only what the runner passes on, so a spec or one-off value reaches it only for the names the runner always passes: `PATH`, `HOME`, `USER`, `LOGNAME`, `TERM`, `LANG`, `LC_ALL`, `SHELL` and `TMPDIR`. Pi's agent process receives the runner's `HOME`, so a spec or one-off `HOME` value that reaches the runner is passed to Pi; OMP's agent process gets its seat state directory (`$OPENRIG_HOME/state/omp/<seat>`, see Oh My Pi below) as `HOME`, so a `HOME` value does not reach it. The selected provider's variables are passed separately, as described under each runtime.
**Do not put secrets in `env:` or `--env`.** The values are not secret, and nothing here encrypts or hides them (see #306):
- Spec values are stored in OpenRig's database and in rig snapshots, and `rig export` and bundles copy them, so a secret put there by mistake travels with the rig.
- While a seat launches, the values are passed to tmux as command arguments, so other users and processes on the same machine can see them for that time. They then sit in the seat's process environment. Only the managed Claude launch command is value-free: it forwards names, and the terminal supplies the values.
- A one-off `--env` value is not stored in the database or in snapshots, but it reaches tmux the same way, so it is visible in the same ways while that launch runs.
Use `env:` for settings only. Credentials belong in the provider's own login or a secret store the seat reads at run time.
### Choosing the Claude instruction file
OpenRig writes its instructions for Claude Code members into managed blocks in
@@ -247,17 +409,18 @@ directory's `CLAUDE.md`, including blocks written by other rigs.
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `id` | string | yes | — | Pod identifier. Must not contain dots. Must be unique within the rig. Used as the first segment of session names and logical IDs. |
| `id` | string | yes | — | Pod identifier. Must not contain dots or `@`. Must be unique within the rig. Used as the first segment of session names and logical IDs. |
| `label` | string | yes | — | Human-readable pod name. Shown in UI explorer, graph groupings, and detail surfaces. |
| `summary` | string | no | — | Pod description. |
| `continuity_policy` | ContinuityPolicy | no | — | Pod-level continuity/restore policy. Controls compaction recovery, artifact management, and peer-driven restoration. |
| `continuity_policy` | ContinuityPolicy | no | — | Pod-level continuity/restore policy, validated and stored with the pod (see "Continuity Policy"). |
| `startup` | StartupBlock | no | — | Pod-level startup files and actions. Applied to all members in this pod via the startup layering model. |
| `members` | Member[] | yes | — | At least one member required (enforced by pods needing content). |
| `members` | Member[] | yes | — | The pod's members. It must be an array; validation doesn't refuse an empty one. |
| `edges` | PodLocalEdge[] | no | `[]` | Edges between members within this pod. Must use unqualified member IDs (not `pod.member`). |
### Pod ID Rules
- Must not contain dots (`.`)
- Must not contain `@`, which separates the pod/member portion from the rig name in session addresses
- Must be unique across all pods in the rig
- Becomes the first segment of the qualified logical ID: `{podId}.{memberId}`
- Becomes the first segment of the canonical session name: `{podId}-{memberId}@{rigName}`
@@ -268,17 +431,44 @@ directory's `CLAUDE.md`, including blocks written by other rigs.
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `id` | string | yes | — | Member identifier. Must not contain dots. Must be unique within the pod. |
| `id` | string | yes | — | Member identifier. Must not contain dots or `@`. Must be unique within the pod. |
| `agent_ref` | string | yes | — | Reference to an AgentSpec. Must start with `local:` (relative) or `path:` (absolute). Exception: `builtin:terminal` for infrastructure nodes. |
| `profile` | string | yes | — | Profile name from the referenced AgentSpec. Use `default` for the default profile. Exception: `none` for terminal nodes. |
| `codex_config_profile` | string | no | — | Codex-only native profile passed as `-p <name>`; letters, numbers, `_`, `.`, `-`. Separate from the AgentSpec `profile`. With the normal launch mode, this replaces OpenRig's explicit workspace-write sandbox flag. A full-bypass policy instead emits danger-full-access and omits this profile argument. |
| `runtime` | string | yes | — | Agent runtime. Current supported values: `claude-code`, `codex`, `terminal`. |
| `cwd` | string | yes | — | Working directory for the agent. Resolved relative to the rig root (the directory containing the rig spec). Use `"."` for the rig root itself. Can be overridden at launch time with `rig up --cwd`. |
| `runtime` | string | yes | — | Agent runtime. Current supported values: `claude-code`, `codex`, `pi`, `omp`, `terminal`, `stub`. `stub` is a deterministic test harness, not an agent: a Node runner in the seat's tmux pane goes through the normal launch, skill projection, startup-file and readiness path, follows `<cwd>/.openrig/stub/script.json` when present, and calls no model. See "What a stub can and cannot prove" in `docs/as-built/test-layers.md`. |
| `cwd` | string | yes | — | Working directory for the agent. A relative path resolves against the rig root (the directory containing the rig spec). If that path exists as written, it is used. Otherwise a leading `~` or `~/` expands to the home directory (`~user` does not) and `$VAR` / `${VAR}` expand from the daemon host's environment; a relative result still resolves against the rig root. A reference to an unset variable stays as written, so the cwd is that literal path and works only if it exists. Use `"."` for the rig root itself. Can be overridden at launch time with `rig up --cwd`. A cwd inside the OpenRig installation fails preflight unless `--cwd` is given. Editing this declaration does not update an existing seat; use [`rig seat set-cwd`](agent-startup-guide.md#change-an-existing-seats-working-directory) to save its future launch directory. |
| `label` | string | no | — | Human-readable member name. Shown in UI when present. |
| `model` | string | no | — | Model override. Runtime-specific (e.g., `claude-opus-4-6` for Claude Code). |
| `restore_policy` | string | no | `resume_if_possible` | Restore behavior. One of: `resume_if_possible`, `relaunch_fresh`, `checkpoint_only`. |
| `effort` | string | no | — | Reasoning effort override, trimmed. Claude gets `--effort`, Codex `-c model_reasoning_effort=…`, Pi `--thinking` (see "Pi" below). A non-string value is ignored with an advisory. |
| `permission_policy` | string | no | — | Member-level permission policy; overrides the rig's. Not valid on terminal members. |
| `env` | map | no | — | Launch environment for this seat, laid over the rig's `env`. Same rules as the rig-level field. Valid on terminal members too. See "Launch environment" below. |
| `role` | string | no | — | The seat's role, letters, digits, `_`, `.` and `-`. Not valid on terminal members. |
| `restore_policy` | string | no | the AgentSpec's | Restore behavior. One of: `resume_if_possible`, `relaunch_fresh`, `checkpoint_only`. The default comes from the AgentSpec's `defaults.lifecycle` (else `resume_if_possible`) as narrowed by its profile; a member value may only narrow it further, in that order. |
| `compaction_strategy` | string | no | — | `default-compaction`, `managed-compaction`, `handover` or `apprentice-handover`; `harness_native` and `pod_continuity` are accepted as deprecated aliases, and `custom_prompt` is refused. `managed-compaction` and `apprentice-handover` create their jobs only for `claude-code` seats; see [Codex compaction and sizing](agent-startup-guide.md#codex-compaction-and-sizing). |
| `mechanic` | string | no | — | A canonical `seat@rig` session address, for `apprentice-handover`. |
| `session_source` | object | no | — | Start the seat from an existing session: `fork` with `native_id`, `rebuild` with `artifact_set`, or `agent_image` with `image_name`. A Claude Code `fork` needs Claude Code 2.0.73 or later. Not valid on terminal members. |
| `starter_ref` | object | no | — | `{ name }` of an agent starter (`^[a-zA-Z0-9][a-zA-Z0-9_-]*$`) whose files lead the seat's startup. Not valid on terminal members or with a fork. |
| `startup` | StartupBlock | no | — | Member-level startup files and actions. Applied only to this member. |
### Pi (`runtime: pi`)
`runtime: pi` launches the Pi coding agent (`pi --mode rpc`) through OpenRig's RPC runner.
- **State:** Each seat uses `$OPENRIG_HOME/state/pi/<session>/agent` as its Pi agent directory, with `sessions/` beside it, instead of your default `~/.pi/agent`. The runner sets `PI_CODING_AGENT_DIR` to that directory. `<session>` is the seat's session name, unchanged; for a pod member it is `{podId}-{memberId}@{rigName}`. `$OPENRIG_HOME` defaults to `~/.openrig`. OpenRig creates these directories at launch and does not copy anything from `~/.pi/agent`.
- **Thinking level:** A Pi seat's effort (the choice saved with `rig seat set-effort`, else the spec's `effort`) is sent to Pi as `--thinking <level>` on every managed launch and resume: fresh launch, successor and restore. Pi accepts `off`, `minimal`, `low`, `medium`, `high`, `xhigh` and `max`; OpenRig passes the value as written and does not translate it, so Codex's `none` is not mapped to `off`. Only a value of the shape `set-effort` accepts (a letter, then up to 31 letters, digits, `-` or `_`) is sent; any other spec value, such as one with a space or one that starts with `--`, is left out, and `rig seat effort` says so. An unfamiliar level gets an advisory (a warning from `set-effort`), never a refusal, and Pi itself ignores an unknown level with a warning and keeps the level it would use without the flag: a model suffix, the resumed session's level, or its default. With no effort resolved, no flag is sent. The effort wins over a model suffix, and the model string is never changed. `rig seat effort` reports the level sent at launch and, on Pi 0.99.0 or later, the `thinkingLevel` Pi records on this launch's latest successful assistant turn (error and aborted turns are skipped); that is the session's level after Pi's own cap, not proof the provider applied it, and it is shown apart from the level sent when they differ. On older Pi it is NOT VERIFIED. Without an effort, you can still set the level as a model suffix, for example `model: openrouter/x-ai/grok-4:high`. Pi first looks for a model whose id is the whole pin, and uses it when there is one, suffix included. Only when there is none does Pi read the suffix as the level and record the model without it. Any other suffix, such as OpenRouter's `:free`, stays part of the model id. The model-divergence check reads the pin literally when the seat's `models.json` defines a model with that exact id; otherwise it accepts the model with or without the suffix. If the seat's `models.json` can't be read, a pin with a suffix stays unchecked, with the usual warning, when the recorded model matches the whole pin or the pin without its suffix. A record that matches neither is reported.
- **Custom models:** Pi reads `models.json` from its agent directory, so a seat reads `$OPENRIG_HOME/state/pi/<session>/agent/models.json`, not `~/.pi/agent/models.json`. Custom provider and model definitions for a seat go in that file. A seat that uses only providers Pi already includes does not need one. OpenRig does not create or write `models.json`.
- **Credentials:** The Pi process receives only `PATH`, `HOME`, `USER`, `LOGNAME`, `TERM`, `LANG`, `LC_ALL`, `SHELL`, `TMPDIR`, a fixed set of OpenRig seat and instance variables, `PI_CODING_AGENT_DIR`, `PI_CODING_AGENT_SESSION_DIR`, and at most one provider key. That key is `OPENROUTER_API_KEY`, `ZAI_API_KEY`, `KIMI_API_KEY` or `MINIMAX_API_KEY`, passed only when it is set in the seat's environment and the seat's `model` is written as `openrouter/<id>`, `zai/<id>`, `kimi-coding/<id>` or `minimax/<id>`. Naming that variable in `recovery.provider_auth_env_allowlist` (empty by default) makes the daemon add it, when set in the daemon's environment, to the seat's launch environment. No other variable reaches Pi, including other providers' keys and a custom provider's own key variable.
### Oh My Pi (`runtime: omp`)
`runtime: omp` launches Oh My Pi through OpenRig's RPC runner. It is separate from `runtime: pi`; OMP does not use Pi's `--name` or `--approve` flags.
- **State:** Each seat uses `$OPENRIG_HOME/state/omp/<seat>/agent` and `sessions/` instead of your default `~/.omp` profile, and runs with that seat directory as `HOME`. OpenRig does not copy OMP credentials. The runner finds the real `omp` binary before switching `HOME`, so a version-manager shim such as mise on the daemon's `PATH` still works.
- **Credentials:** Provision each seat separately, or put the provider's key variable in `recovery.provider_auth_env_allowlist` (for example `ANTHROPIC_API_KEY` or `MISTRAL_API_KEY`). The allowlist accepts the key variable of every provider in OpenRig's OMP provider map, from `anthropic` through `litellm`. A seat receives a key only when its `model` is written as `provider/id`, such as `anthropic/claude-sonnet-4-5`. Short names such as `opus` pass no key. A provider whose key is scoped to one endpoint also accepts that endpoint's variable: `anthropic`, `openai` and `litellm` each take their `<PROVIDER>_BASE_URL` — `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL`, `LITELLM_BASE_URL`. The allowlist admits each variable on its own, so an endpoint named without its key is admitted too, which suits a keyless local proxy. The launch gate admits these endpoint names for OMP seats; the match against the seat's declared `provider/id` happens at the OMP child, which forwards a matching endpoint already in the runner's environment just as it forwards a key. OMP also reads the launch directory's `.env`, so use a trusted working directory.
- **Approval posture:** The default floor is `--approval-mode always-ask`. Because the runner is headless, OMP approval requests are cancelled and the seat stays in needing-attention after the turn ends, until the next agent run starts. A `full_bypass` permission policy selects `--approval-mode yolo`.
- **Model errors:** Errors are printed in the pane. A completed assistant failure with a numeric `errorStatus` of 408, 429, 500, 502, 503, 504, or 529 returns to idle at terminal `agent_end`, allowing an ordinary retry. Until that terminal boundary it stays in needing-attention. Intermediate `agent_end(isTerminal:false)` events do not release attention. A statusless failed retry summary retains that classification only when its attempt matches an announced retry and its final error exactly matches the latest typed transient assistant failure in that attempt. New assistant/turn boundaries invalidate the previous failure; unmatched summaries remain runtime errors. Rejected prompts, auth/configuration failures, exhausted retries without a typed transient status, and untyped errors (including text such as `529 overloaded`) retain attention until the next agent run starts. The runner does not classify diagnostic text. A transient failure does not clear a denied approval or another unresolved runtime failure in the same turn.
- **Restore:** OMP creates its session file after the first persisted turn. A new seat with no persisted turn has no resume token; restoring it requires `rig up --existing <rig> --fresh <seat>`. After that file exists, OpenRig restores that exact session file. If a full rig restore leaves an OMP seat in `attention_required` or `failed`, `rig seat clear-attention` cannot yet reconcile it to `operator_recovered`, even with `--reason`, because restore reconciliation only verifies Claude Code and Codex processes ([#41](https://github.com/mvschwarz/openrig/issues/41)). Relaunch that seat with `rig up --existing <rig> --fresh <seat>`, or restore it manually.
### Terminal Nodes
Terminal nodes are infrastructure processes (servers, log tails, build watchers) that are not agent runtimes. They require an exact triple:
@@ -291,6 +481,8 @@ profile: none
All three must be present together. Any partial combination is a validation error.
A terminal seat no longer waits for a `--fresh` decision just because it has no resume token: on restore it relaunches fresh and re-runs its startup actions. The runtime, identity and replay prerequisites still apply. A runtime mismatch still waits for a decision, an ambiguous occupant still fails, and a missing required replay file still blocks.
### agent_ref Rules
- Must start with `local:` or `path:`
@@ -307,7 +499,10 @@ The canonical session name is derived from the pod ID, member ID, and rig name:
{podId}-{memberId}@{rigName}
```
Example: pod `dev`, member `impl`, rig `my-team` → session `dev-impl@my-team`
Example: pod `dev`, member `build`, rig `my-team` → session `dev-build@my-team`
Pod and member IDs cannot contain `@` because the first `@` separates their portion
of the session address from the rig name. Rig names may still contain `@`.
This is human-authored (you choose the pod/member IDs) and system-validated (the system enforces the format).
@@ -320,7 +515,7 @@ This is human-authored (you choose the pod/member IDs) and system-validated (the
| Kind | Meaning | Use When |
|------|---------|----------|
| `delegates_to` | Source delegates work to target. Constrains launch order. | Orchestrator → implementer, lead → worker |
| `spawned_by` | Target was spawned by source. Constrains launch order. | Parent → child in hierarchical topologies |
| `spawned_by` | Source was spawned by target; the target launches first. Constrains launch order. | Child → parent in hierarchical topologies |
| `can_observe` | Source can observe target's output. Does NOT constrain launch order. | Reviewer → implementer, monitor → worker |
| `collaborates_with` | Peer collaboration relationship. Does NOT constrain launch order. | Co-equal peers working together |
| `escalates_to` | Source escalates to target for decisions. Does NOT constrain launch order. | Worker → lead for escalation |
@@ -333,13 +528,13 @@ Edges within a pod use **unqualified member IDs** (just the member `id`, not `po
pods:
- id: dev
members:
- id: impl
- id: build
# ...
- id: qa
# ...
edges:
- kind: delegates_to
from: impl # NOT dev.impl
from: build # NOT dev.build
to: qa # NOT dev.qa
```
@@ -353,7 +548,7 @@ Edges between pods use **fully-qualified `pod.member` IDs**:
edges:
- kind: delegates_to
from: orch.lead # pod.member format
to: dev.impl # pod.member format
to: dev.build # pod.member format
```
Cross-pod edges must reference different pods. An edge where both `from` and `to` are in the same pod is a validation error — use pod-local edges instead.
@@ -362,13 +557,14 @@ Cross-pod edges must reference different pods. An edge where both `from` and `to
## Startup Block
Startup blocks can appear at three levels: rig, pod, and member. They are merged additively via the startup layering model (see `docs/reference/startup-layering.md`).
Startup blocks can appear at three levels: rig, pod, and member. They are merged additively via the startup layering model (see [the layering model](agent-startup-guide.md#the-layering-model)). The rig's `culture_file` joins as a required file with the `auto` hint in the culture layer, on both fresh start and restore.
### Files
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `path` | string | yes | — | Relative path to the file. Must be a safe relative path. |
| `orientation` | string | no | — | Set to `role` to identify a per-seat role file for `rig queue whoami --json` and refocus. Does not change delivery or replay startup. |
| `delivery_hint` | string | no | `auto` | How the file is delivered. One of: `auto`, `guidance_merge`, `skill_install`, `send_text`. |
| `required` | boolean | no | `true` | Whether startup fails if this file cannot be delivered. |
| `applies_on` | string[] | no | `[fresh_start, restore]` | When this file is delivered. Subset of: `fresh_start`, `restore`. |
@@ -378,7 +574,7 @@ Startup blocks can appear at three levels: rig, pod, and member. They are merged
| Hint | Behavior |
|------|----------|
| `auto` | System chooses based on file type and context. |
| `guidance_merge` | Merged into the runtime's guidance file (`CLAUDE.md` or `AGENTS.md`) as a managed block. Delivered before harness boot. |
| `guidance_merge` | Merged as a managed block into the runtime's guidance file: for Claude, the `managed_blocks` file (`CLAUDE.md` or `CLAUDE.local.md`); for Codex, Pi and OMP, `AGENTS.md`. Delivered before harness boot. |
| `skill_install` | Installed as a skill in the runtime's skill directory. Delivered before harness boot. |
| `send_text` | Sent as text to the agent's terminal after the harness is ready. Requires the agent TUI to be active. |
@@ -431,6 +627,31 @@ the current proof; resume/adoption also preserves existing proof history.
The effective selection is recorded on `node.startup_pending`; actions are
persisted in startup context for restore and fresh relaunch.
The harness readiness window defaults to 30 seconds. On a loaded machine, set
`rig config set runtime.readiness_timeout_seconds 60` to give new seats and
handover successors longer to become interactive. The setting accepts 1–600
seconds, applies to the next launch without a daemon restart, and can also be
set with `OPENRIG_RUNTIME_READINESS_TIMEOUT_SECONDS`. It also bounds how long a
restore keeps watching a Claude seat whose resume is still starting, so raising
it for slow fresh launches lengthens that wait too. The wait is about the
setting in total per seat, counting the usual 3.2-second check: the adapter polls
for the rest of it (nominally: it counts polls, and each poll's tmux and process
reads add a little). A restore
starts seats one after another, so each seat that never starts Claude adds up to
about this much, minus the 3.2 seconds, to the restore; the time adds up seat by
seat, and a longer setting means a longer wait before a stuck seat is reported.
A seat that is still not interactive then ends `attention_required` with its
launch and resume token kept, and the later readiness wait is skipped for it.
That holds at every setting: at 1–3 seconds there are no extra polls, but an
unresolved boot is still kept rather than failed. A pane that shows a Codex or
another conversation's Claude is not waited for. `rig up` and
`rig launch` wait 120 seconds for the daemon, so a restore of several stuck
seats can pass that (in one measurement, about 31 seconds a seat at the
default, 95 for three). A client timeout and exit code 1 do not mean the
restore was rolled back or that it should be run again; check the real state
first with `rig ps`. Apart from this, the setting does not change the time
spent by the runtime adapter before readiness polling starts.
---
## Services Block
@@ -441,7 +662,7 @@ The services block is optional. When present, services boot before any agent nod
|-------|------|----------|---------|-------------|
| `kind` | string | yes | — | Service backend. Only `compose` is supported in v1. |
| `compose_file` | string | yes | — | Relative path to the Docker Compose file. Must be a safe relative path. Resolved relative to rig root. |
| `project_name` | string | no | derived from rig name | Docker Compose project name. Must match `[a-z0-9][a-z0-9_-]*`. If omitted, derived by sanitizing the rig name. |
| `project_name` | string | no | stored predecessor project or unique rig-ID default | Docker Compose project name. Must match `[a-z0-9][a-z0-9_-]*`. An explicit value takes precedence. A new rig uses a stable, unique rig-ID-derived name. A same-name replacement inherits the stored project of the exact generations it replaces; conflicting predecessor projects require an explicit value. Existing stored names remain unchanged. |
| `profiles` | string[] | no | — | Compose profiles to activate. |
| `down_policy` | string | no | `down` | What happens on `rig down`. One of: `leave_running`, `down`, `down_and_volumes`. |
| `wait_for` | WaitTarget[] | no | — | Health targets that must pass before agent launch. |
@@ -454,7 +675,8 @@ Each target must define exactly one of `service`, `url`, or `tcp`:
```yaml
wait_for:
# HTTP probe — hits the URL, expects 2xx
# HTTP probe — any 2xx or 3xx response passes the HTTP wait target; redirects are not followed.
# This proves the server answered, not application readiness.
- url: http://127.0.0.1:8200/v1/sys/health
# TCP probe — connects to host:port
@@ -484,7 +706,7 @@ surfaces:
command: "vault status -address=http://127.0.0.1:8200"
```
Surfaces are metadata only. They are displayed in the UI and in `rig env status` output but are NOT executed by OpenRig.
Surfaces are metadata only. They are displayed in the UI and in `rig env status --json` output (the text output lists only services) but are NOT executed by OpenRig.
### Checkpoint Hooks
@@ -498,10 +720,10 @@ checkpoints:
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `id` | string | yes | Unique identifier for this checkpoint. |
| `export` | string | yes | Shell command to export state. `{{artifacts_dir}}` is replaced with a daemon-managed path. |
| `export` | string | yes | Shell command to export state. |
| `import` | string | no | Shell command to import state on restore. |
Checkpoint hooks are shell commands run by the daemon. They are best-effort — a failed export does not block snapshot, but continuity is classified as `receipt_only` instead of `checkpointed`.
Checkpoint hooks are validated and stored with the spec. In this version the daemon doesn't run them during snapshot or restore, and doesn't substitute `{{artifacts_dir}}`.
---
@@ -532,11 +754,24 @@ continuity_policy:
| `restore_protocol.peer_driven` | boolean | no | — | Whether peers drive the restore process. |
| `restore_protocol.verify_via_quiz` | boolean | no | — | Whether to verify restoration via quiz. |
These fields are validated, stored on the pod and written back on export. In this version nothing acts on
`sync_triggers`, `artifacts` or `restore_protocol`.
---
## Validation Rules Summary
These rules are enforced by the validator. A spec that violates any of these will be rejected by `rig spec validate` and `rig up`.
Unknown keys at the rig, pod, member and edge levels are refused ("unknown key … refusing the spec because
normalization would otherwise discard it"). Keys inside `startup`, `services`, `continuity_policy` and `workspace` are
not checked this way. Some rules are enforced at preflight rather than validation: the runtime must be one of the
supported values, rig, pod and member names may use only letters, digits, `-`, `_`, `.` and `@` where allowed above,
each `agent_ref` must have an `agent.yaml`, Codex profiles must load, and a cwd may not be inside the OpenRig
installation.
Schema validation checks the structural rules below. Pod and member IDs containing
`@` are additionally rejected during preflight and member creation or launch; a
spec can pass `rig spec validate` and then fail at preflight or import. Run
`rig spec preflight` before creation or import.
1. `version` and `name` are required non-empty strings.
2. `pods` must be a non-empty array.
@@ -573,8 +808,13 @@ These are the built-in specs shipped with OpenRig. Read them as worked examples.
| Spec | Location | Pods | Members | Services |
|------|----------|------|---------|----------|
| `product-team` | `packages/daemon/specs/rigs/preview/product-team/rig.yaml` | orch1, dev1, rev1 | 7 (lead, peer, impl, qa, design, r1, r2) | no |
| `implementation-pair` | `packages/daemon/specs/rigs/launch/implementation-pair/rig.yaml` | dev | 2 (impl, qa) | no |
| `adversarial-review` | `packages/daemon/specs/rigs/focused/adversarial-review/rig.yaml` | orch, review | 3 (lead, r1, r2) | no |
| `research-team` | `packages/daemon/specs/rigs/focused/research-team/rig.yaml` | orch, research | 3 (lead, analyst, synthesizer) | no |
| `starter` | `packages/daemon/specs/rigs/launch/starter/rig.yaml` | dev | 2 (build, review) | no |
| `factory` | `packages/daemon/specs/rigs/launch/factory/rig.yaml` | orch, dev, review | 7 (lead, advisor, build, qa, design, r1, r2) | no |
| `code-review` | `packages/daemon/specs/rigs/focused/code-review/rig.yaml` | orch, review | 3 (lead, r1, r2) | no |
| `research` | `packages/daemon/specs/rigs/focused/research/rig.yaml` | orch, research | 3 (lead, analyst, synthesizer) | no |
| `pm` | `packages/daemon/specs/rigs/focused/pm/rig.yaml` | pm, dev | 3 (lead, researcher, build) | no |
| `secrets-manager` | `packages/daemon/specs/rigs/launch/secrets-manager/rig.yaml` | vault | 1 (specialist) | yes (Vault) |
Also shipped, in the same tree: `launch/kernel`, OpenRig's own team, which starts automatically. `first-project` is
starter's old name and still resolves to it. `workshop`, the four-agent middle team, is a rig bundle rather than a
built-in. List the built-ins with `rig specs ls --kind rig`.
+88
View File
@@ -0,0 +1,88 @@
# Find specialists with rosters
A roster records who to involve for a purpose and why. The same seat can appear in several
rosters with different capabilities and engagement. Membership is a recommendation, not an
assignment or a grant of authority. Contact someone with the existing `rig send` or `rig queue` commands.
Put JSON files in `<workspace.root>/rosters/`; the included starter and factory leads write
their team's `<rig>.json` there at first start and never replace an existing one. Read `workspace.root` with
`rig config get workspace.root`, or use `--folder` to read another folder in place.
```sh
rig roster list
rig roster show production --json
rig roster find 'colour grading'
rig roster find 'editor@studio' --folder ./rosters --json
```
`list` reads authored purposes and curators without contacting daemons. `show` and `find` read the
configured daemon and registered HTTP hosts through `rig ps`. Each command reads current node
listings once per route, not once per member. `find` matches part of a capability tag or seat
address, ignoring case. A seat in two rosters produces two recommendations with their own reasons.
```json
{
"version": 1,
"id": "production",
"name": "Production",
"purpose": "Make a film",
"curator": { "seat": "lead@studio", "host": "host-a" },
"updated_at": "2026-10-01",
"members": [{
"seat": "editor@studio",
"host": "host-a",
"capabilities": ["colour grading"],
"engagement": ["consult", "review"],
"use_when": "Choose a look or review a grade",
"why": "Knows the footage and the delivery requirements",
"caveat": "Ask about availability first"
}]
}
```
Use the serving daemon's `hostSelfId` and the exact seat address from `rig ps --nodes -A --json`.
A caller's local host alias is not necessarily that identity. Other hosts must already be
registered; the roster command does not register them or dispatch work. Existing HTTP fan-out
reports SSH-only hosts as unsupported. JSON retains per-host failures and partial-read warnings.
Authored files contain recommendations, not runtime facts. Extra fields are ignored, including
any authored runtime, model or activity. At read time the command joins by exact host self-id
and seat. Unmatched or conflicting observations are `unknown`; a seat not reported running is
`stale`, with current runtime/model unknown. The configured model is the registry declaration.
Daemon node listings, `rig ps --nodes --full` and roster members also carry the full
`modelObservation`: `status`, `model`, `source`, `observedAt`, `generation` and `reason`.
Compact JSON uses the smaller shape described below. The configured `model` stays separate; roster's
`live.observedModel` is the observation's model or null. Human output says **last observed**.
Claude (`claude-assistant-response`) and Pi (`pi-assistant-response`) name response evidence;
Codex (`codex-turn-context` or `codex-world-state`) names recorded turn configuration, not a
verified backend response. The timestamp is the native record's time, never file mtime or inventory
read time. None promises the model that will answer the next turn.
The daemon reuses the current-occupant record selectors and bounded readers used by divergence
monitoring, sharing a process census. Reporting does not need a configured model or comparator.
A changed or unverified occupant, a record predating its tenure, missing or invalid record time,
unreadable or ambiguous records, unsupported runtimes and older daemons report **UNKNOWN** with
a reason, never the configured value as a fallback. An older record from the same verified occupant
remains labelled last observed at its original time; this is not a freshness guarantee. No record
contents, transcript paths or credentials are returned. Activity includes its own sample time;
activity and running status do not promise that someone is available for new work.
The JSON `observations.readAt` is when the inventory read completed, not a native observation
timestamp. Rosters are never rewritten by these commands. Malformed files produce warnings while
valid rosters remain usable; duplicate IDs make `show` report ambiguity instead of selecting one.
Non-regular file targets, such as FIFOs and directories, are skipped with a warning; links to
regular files remain readable. Inventory uses `ps --no-cleanup` to preserve even stale local
daemon state files. Ordinary `rig ps` keeps its existing cleanup behavior unless given that flag.
The daemon reuses model facts only while the selected record's identity, size and
modification time and the occupant generation remain unchanged. Inventory reads
share two bulk pane snapshots and one process census; identity is checked after
the final snapshot. A different observation from duplicate host routes makes
only that observation UNKNOWN, preserving agreed registry fields.
`rig ps --nodes --json` keeps an observed model compact as
`modelObservation: ["literal-model-id", "evidence-source", "native-record-time"]`.
UNKNOWN is `{ "status": "unknown", "reason": "..." }`; older daemons may yield
`null`. `--full` and `--fields modelObservation` retain the full object, including
its status and occupant generation. Human output and roster reports use the full
labelled observation.
@@ -0,0 +1,649 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://openrig.dev/schemas/bundle-behaviour.v1.json",
"title": "Before-install behaviour view (openrig.bundle-behaviour/v1)",
"description": "Derived from the archive's files alone, for one configuration and one assembler version; kept outside the archive, so it never feeds the package digest. A view, never a gate; carries no tested status. Consumers ignore unknown properties; producers add only optional properties within v1. An empty list means none are known; something unknown goes in unknownBeforeLaunch.",
"$defs": {
"sourceRef": {
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"type": "string",
"minLength": 1
},
"field": {
"type": "string"
}
},
"description": "Archive-relative file, and optionally the field within it."
}
},
"type": "object",
"required": [
"schema",
"state",
"identity"
],
"properties": {
"schema": {
"const": "openrig.bundle-behaviour/v1"
},
"state": {
"enum": [
"generated",
"not_generated"
]
},
"reason": {
"type": "string"
},
"localInspectCommand": {
"type": "string",
"description": "For not_generated: the existing command that shows this view locally, for example rig bundle inspect <archive> --json."
},
"identity": {
"type": "object",
"required": [
"configurationId",
"packageDigest",
"assembler",
"generator"
],
"properties": {
"source": {
"oneOf": [
{
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/source"
},
{
"type": "null"
}
]
},
"configurationId": {
"oneOf": [
{
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/configurationId"
},
{
"type": "null"
}
],
"description": "null when the archive doesn't state it (a local or legacy archive)."
},
"packageDigest": {
"oneOf": [
{
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/packageDigest"
},
{
"type": "null"
}
]
},
"assembler": {
"oneOf": [
{
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/assembler"
},
{
"type": "null"
}
],
"description": "The OpenRig that built the archive, as the archive states it; null when unstated. Never the inspecting OpenRig."
},
"generator": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/assembler",
"description": "The OpenRig that produced this view."
},
"compatibility": {
"type": "object",
"properties": {
"minDaemonVersion": {
"type": "string"
},
"minCliVersion": {
"type": "string"
}
}
},
"statedProvenance": {
"type": "object",
"description": "As the bundle states it; not verified."
},
"integrity": {
"type": "object",
"required": [
"digestValid",
"filesVerified"
],
"properties": {
"digestValid": {
"type": "boolean"
},
"filesVerified": {
"type": "boolean"
}
},
"description": "Self-consistency of the archive; not authorship."
}
}
},
"team": {
"type": "array",
"items": {
"type": "object",
"required": [
"seat",
"pod",
"member",
"agentRef",
"runtime",
"cwd"
],
"properties": {
"seat": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/member"
},
"pod": {
"type": "string",
"minLength": 1
},
"member": {
"type": "string",
"minLength": 1
},
"agentRef": {
"type": "string",
"minLength": 1
},
"profile": {
"type": "string"
},
"runtime": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/runtime"
},
"model": {
"type": "string"
},
"cwd": {
"type": "string",
"minLength": 1
}
}
}
},
"posture": {
"type": "array",
"items": {
"type": "object",
"required": [
"seat",
"shellAccess",
"selection",
"basis",
"nativeEffect"
],
"properties": {
"seat": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/member"
},
"shellAccess": {
"type": "string",
"minLength": 1
},
"selection": {
"type": "string",
"minLength": 1
},
"basis": {
"enum": [
"explicit",
"product_default",
"unresolved"
],
"description": "Declared in the archive, the product's conditional default, or not resolvable before launch."
},
"nativeEffect": {
"const": "unknown",
"description": "Host settings (for example OPENRIG_YOLO, persisted or native settings) decide the effective permission at launch."
},
"permissionPrompts": {
"enum": [
"off",
"on",
"default"
],
"description": "Archive declaration per seat: off for full_bypass (including builtin:yolo) on any runtime; on for a Claude/Codex flag-surface floor policy, or Codex under auto; default for Claude/Codex with no declared policy. Omitted for Claude under auto, config-surface policies, host-resolved Codex profiles, and Pi except declared full bypass. Absent means not stated, never on. Host settings may differ; nativeEffect remains unknown."
},
"sourceRefs": {
"type": "array",
"items": {
"$ref": "#/$defs/sourceRef"
}
},
"firstRunWarnings": {
"type": "object",
"properties": {
"claudeBypass": {
"const": "harness_asks_once"
}
},
"description": "Declared full-bypass Claude seat: the harness asks for bypass-warning acceptance if it has not been remembered. No host acceptance state is read; nativeEffect stays unknown."
},
"nonInterruptive": {
"const": "available",
"description": "This declared full-bypass Claude/Codex seat can use --non-interruptive launch flags. Availability is not the operator choice or proof that no prompt will appear. Omitted for other postures, unresolved policies and runtimes with no such flags."
},
"nonInterruptiveDefault": {
"type": "boolean",
"description": "Optional authored rig-level default for supported full-bypass Claude/Codex launches. An explicit launch option overrides it; absent is not an off or on claim. Native effect remains unknown."
}
}
}
},
"toldFiles": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind",
"pathOrRef",
"resolution"
],
"properties": {
"seat": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/member"
},
"kind": {
"type": "string",
"minLength": 1
},
"pathOrRef": {
"type": "string",
"minLength": 1
},
"delivery": {
"type": "string"
},
"resolution": {
"enum": [
"archive",
"host_at_launch",
"unresolved"
]
},
"sourceRefs": {
"type": "array",
"items": {
"$ref": "#/$defs/sourceRef"
}
}
}
}
},
"alsoRuns": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind",
"pathOrRef",
"resolution"
],
"properties": {
"seat": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/member"
},
"kind": {
"type": "string",
"minLength": 1
},
"pathOrRef": {
"type": "string",
"minLength": 1
},
"trigger": {
"type": "string"
},
"resolution": {
"enum": [
"archive",
"host_at_launch",
"unresolved"
]
},
"sourceRefs": {
"type": "array",
"items": {
"$ref": "#/$defs/sourceRef"
}
}
}
}
},
"writes": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind",
"destinationBase",
"path",
"operation",
"phase"
],
"properties": {
"seat": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/member"
},
"kind": {
"type": "string",
"minLength": 1
},
"destinationBase": {
"type": "string",
"minLength": 1
},
"path": {
"type": "string",
"minLength": 1
},
"operation": {
"type": "string",
"minLength": 1
},
"phase": {
"type": "string",
"minLength": 1
},
"condition": {
"type": "string"
},
"sourceRefs": {
"type": "array",
"items": {
"$ref": "#/$defs/sourceRef"
}
}
}
}
},
"outsideAddresses": {
"type": "array",
"items": {
"type": "object",
"required": [
"domain",
"sourceRefs"
],
"properties": {
"domain": {
"type": "string",
"minLength": 1
},
"sourceRefs": {
"type": "array",
"items": {
"$ref": "#/$defs/sourceRef"
}
}
}
}
},
"needs": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind",
"name",
"status"
],
"properties": {
"seat": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/member"
},
"kind": {
"type": "string",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"versionConstraint": {
"type": "string"
},
"commands": {
"type": "array",
"description": "Unexecuted author setup lines, in order in one shell; the install command follows in the resulting working directory.",
"items": {
"type": "string",
"minLength": 1
}
},
"status": {
"const": "not_checked"
},
"sourceRefs": {
"type": "array",
"items": {
"$ref": "#/$defs/sourceRef"
}
}
}
}
},
"unknownBeforeLaunch": {
"type": "array",
"items": {
"type": "object",
"required": [
"subject",
"reason"
],
"properties": {
"seat": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/member"
},
"subject": {
"type": "string",
"minLength": 1
},
"reason": {
"type": "string",
"minLength": 1
},
"sourceRefs": {
"type": "array",
"items": {
"$ref": "#/$defs/sourceRef"
}
}
}
}
},
"services": {
"type": "array",
"description": "Optional opt-in service declarations from archived Compose YAML. Host-resolved values remain unresolved; no Compose or health probe ran.",
"items": {
"type": "object",
"required": [
"name",
"composeFile",
"image",
"ports",
"privileged",
"capAdd",
"securityOpt",
"devices",
"environment",
"mounts",
"healthcheck",
"waitFor",
"downPolicy",
"unresolved",
"notes"
],
"properties": {
"name": {
"type": "string"
},
"composeFile": {
"type": "string"
},
"image": {
"type": "string"
},
"ports": {
"type": "array",
"items": {
"type": "string"
}
},
"privileged": {
"type": [
"boolean",
"string"
]
},
"capAdd": {
"type": "array",
"items": {
"type": "string"
}
},
"securityOpt": {
"type": "array",
"items": {
"type": "string"
}
},
"devices": {
"type": "array",
"items": {
"type": "string"
}
},
"environment": {
"type": "array",
"items": {
"type": "string"
}
},
"mounts": {
"type": "array",
"items": {
"type": "string"
}
},
"healthcheck": {},
"waitFor": {
"type": "array"
},
"downPolicy": {
"type": "string"
},
"unresolved": {
"type": "array",
"items": {
"type": "string"
}
},
"notes": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
"allOf": [
{
"if": {
"properties": {
"state": {
"const": "not_generated"
}
}
},
"then": {
"required": [
"reason",
"localInspectCommand"
],
"not": {
"anyOf": [
{
"required": [
"team"
]
},
{
"required": [
"posture"
]
},
{
"required": [
"toldFiles"
]
},
{
"required": [
"alsoRuns"
]
},
{
"required": [
"writes"
]
},
{
"required": [
"outsideAddresses"
]
},
{
"required": [
"needs"
]
},
{
"required": [
"unknownBeforeLaunch"
]
}
]
}
}
},
{
"if": {
"properties": {
"state": {
"const": "generated"
}
}
},
"then": {
"required": [
"team",
"posture",
"toldFiles",
"alsoRuns",
"writes",
"outsideAddresses",
"needs",
"unknownBeforeLaunch"
]
}
}
]
}
@@ -0,0 +1,110 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://openrig.dev/schemas/bundle-common.v1.json",
"title": "Shared bundle identity definitions (v1)",
"description": "Source identity, configuration ID, package digest and assembler, shared by every bundle format. See docs/reference/bundle-formats.md.",
"$defs": {
"source": {
"type": "object",
"description": "Source identity: repository + resolvedCommit + folder. requestedRef and canonicalUrl explain it and are not part of it.",
"required": [
"repository",
"folder",
"resolvedCommit"
],
"properties": {
"repository": {
"type": "string",
"pattern": "^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
},
"folder": {
"type": "string",
"pattern": "^(\\.|(?!/)(?!.*(^|/)\\.\\.(/|$))[^\\\\]+)$",
"description": "Repo-relative POSIX path of the folder holding rig.yaml; '.' is the repository root."
},
"resolvedCommit": {
"type": "string",
"pattern": "^[0-9a-f]{40}$"
},
"requestedRef": {
"type": "string",
"minLength": 1
},
"canonicalUrl": {
"type": "string",
"pattern": "^https://github\\.com/.+/tree/[0-9a-f]{40}(/.*)?$"
}
}
},
"member": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$",
"description": "pod.member"
},
"runtime": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9-]*$",
"description": "A runtime as rig.yaml spells it, for example claude-code, codex, pi."
},
"configurationId": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+=[a-z0-9][a-z0-9-]*(,[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+=[a-z0-9][a-z0-9-]*)*$",
"description": "Every member's pod.member=runtime, sorted by pod.member in code-unit order, joined with ','."
},
"packageDigest": {
"type": "object",
"description": "SHA-256 over UTF-8 lines JSON.stringify(path) + '\\t' + sha256 + '\\n', one per integrity.files entry, sorted by path in code-unit order. See docs/reference/bundle-formats.md.",
"required": [
"algorithm",
"value",
"coverage"
],
"properties": {
"algorithm": {
"const": "sha256"
},
"value": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"coverage": {
"const": "openrig.package-digest/v1"
}
},
"additionalProperties": false
},
"assembler": {
"type": "object",
"required": [
"openrigVersion"
],
"properties": {
"openrigVersion": {
"type": "string",
"minLength": 1
},
"commit": {
"type": "string",
"pattern": "^[0-9a-f]{7,40}$"
}
}
},
"sha256": {
"type": "object",
"required": [
"algorithm",
"value"
],
"properties": {
"algorithm": {
"const": "sha256"
},
"value": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
}
},
"additionalProperties": false
}
}
}
@@ -0,0 +1,67 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://openrig.dev/schemas/bundle-configurations.v1.json",
"title": "Declared configurations (configurations.yaml beside rig.yaml)",
"type": "object",
"required": [
"schema",
"recommended",
"seats",
"presets"
],
"properties": {
"schema": {
"const": "openrig.bundle-configurations/v1"
},
"recommended": {
"type": "string",
"description": "The preset name of the recommended configuration."
},
"seats": {
"type": "object",
"minProperties": 1,
"description": "pod.member -> the runtimes that seat may use, each with the profile it uses.",
"propertyNames": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/member"
},
"additionalProperties": {
"type": "object",
"required": [
"runtimes"
],
"properties": {
"runtimes": {
"type": "object",
"minProperties": 1,
"propertyNames": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/runtime"
},
"additionalProperties": {
"type": "string",
"minLength": 1
}
}
}
}
},
"presets": {
"type": "object",
"minProperties": 1,
"description": "Preset name -> a runtime for every member. Names are aliases; the configuration ID is computed from the mapping.",
"propertyNames": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9-]*$"
},
"additionalProperties": {
"type": "object",
"minProperties": 1,
"propertyNames": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/member"
},
"additionalProperties": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/runtime"
}
}
}
}
}
@@ -0,0 +1,323 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://openrig.dev/schemas/bundle-status.v1.json",
"title": "Public status file (generated; do not edit)",
"description": "Built from run records by rule openrig.status-rule/v1, from an allowlist of output fields: no private paths, host names, row IDs, account names or receipt text. Regenerating gives identical bytes. An empty platforms object means Not tested. Closed on purpose: no property outside this schema may appear, so a private field can't leak in.",
"type": "object",
"required": [
"generated",
"listings",
"harnessChecks",
"bodyDigest"
],
"additionalProperties": false,
"properties": {
"generated": {
"type": "object",
"required": [
"by",
"notice",
"rule",
"generatorVersion"
],
"properties": {
"by": {
"type": "string"
},
"notice": {
"const": "Generated file. Do not edit by hand; regenerate it."
},
"rule": {
"const": "openrig.status-rule/v1"
},
"generatorVersion": {
"type": "integer",
"minimum": 1
}
},
"additionalProperties": false
},
"listings": {
"type": "object",
"propertyNames": {
"pattern": "^[a-z0-9][a-z0-9-]*$"
},
"additionalProperties": {
"type": "object",
"required": [
"state",
"configurations"
],
"properties": {
"state": {
"enum": [
"ok",
"status_unavailable"
]
},
"configurations": {
"type": "object",
"propertyNames": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/configurationId"
},
"additionalProperties": {
"type": "object",
"required": [
"platforms",
"communityReports"
],
"properties": {
"platforms": {
"type": "object",
"additionalProperties": {
"type": "object",
"required": [
"label",
"date",
"openrigVersion",
"recordIds",
"packageDigests"
],
"properties": {
"label": {
"enum": [
"known_problem",
"tested",
"tested_with_help",
"partly_tested",
"not_tested",
"status_unavailable"
]
},
"assistanceCount": {
"type": "integer",
"minimum": 0
},
"date": {
"type": "string",
"format": "date"
},
"openrigVersion": {
"type": "string"
},
"recordIds": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
}
},
"packageDigests": {
"type": "array",
"items": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/packageDigest"
}
},
"note": {
"type": "string"
}
},
"additionalProperties": false,
"allOf": [
{
"if": {
"properties": {
"label": {
"enum": [
"tested",
"tested_with_help",
"partly_tested",
"known_problem"
]
}
}
},
"then": {
"properties": {
"recordIds": {
"minItems": 1
},
"packageDigests": {
"minItems": 1
}
}
}
},
{
"if": {
"properties": {
"label": {
"const": "tested_with_help"
}
}
},
"then": {
"required": [
"assistanceCount"
],
"properties": {
"assistanceCount": {
"minimum": 1
}
}
}
},
{
"if": {
"properties": {
"label": {
"const": "tested"
}
}
},
"then": {
"properties": {
"assistanceCount": {
"const": 0
}
}
}
}
]
},
"propertyNames": {
"pattern": "^(linux|darwin|win32)-(x64|arm64)$"
}
},
"communityReports": {
"type": "integer",
"minimum": 0
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false,
"allOf": [
{
"if": {
"properties": {
"state": {
"const": "status_unavailable"
}
}
},
"then": {
"properties": {
"configurations": {
"additionalProperties": {
"properties": {
"platforms": {
"additionalProperties": {
"properties": {
"label": {
"const": "status_unavailable"
}
}
}
}
}
}
}
}
}
}
]
}
},
"harnessChecks": {
"type": "object",
"required": [
"state",
"harnesses"
],
"additionalProperties": false,
"properties": {
"state": {
"enum": [
"ok",
"status_unavailable"
],
"description": "status_unavailable: some harness-check record could not be read."
},
"harnesses": {
"type": "object",
"propertyNames": {
"$ref": "https://openrig.dev/schemas/bundle-common.v1.json#/$defs/runtime"
},
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "object",
"required": [
"result",
"date",
"openrigVersion",
"harnessVersion",
"recordIds"
],
"properties": {
"result": {
"enum": [
"PASS",
"FAIL",
"BLOCKED",
"NOT_RUN"
]
},
"date": {
"type": "string",
"format": "date"
},
"openrigVersion": {
"type": "string"
},
"harnessVersion": {
"type": "string"
},
"recordIds": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
}
},
"note": {
"type": "string"
}
},
"additionalProperties": false
},
"propertyNames": {
"pattern": "^(linux|darwin|win32)-(x64|arm64)$"
}
}
}
},
"allOf": [
{
"if": {
"properties": {
"state": {
"const": "status_unavailable"
}
}
},
"then": {
"properties": {
"harnesses": {
"maxProperties": 0
}
}
}
}
]
},
"bodyDigest": {
"type": "string",
"pattern": "^[0-9a-f]{64}$",
"description": "SHA-256, lowercase hex, over the RFC 8785 (JCS) canonical JSON, as UTF-8, of an object holding every other top-level field."
}
}
}
@@ -0,0 +1,80 @@
{
"configurationId": [
{
"mapping": {
"check.review": "codex",
"build.lead": "claude-code",
"check.qa": "codex",
"build.impl": "claude-code"
},
"expected": "build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex"
},
{
"mapping": {
"b.x": "pi",
"B.y": "codex",
"a.z": "claude-code"
},
"expected": "B.y=codex,a.z=claude-code,b.x=pi"
},
{
"mapping": {
"a.b-c": "pi",
"a.b": "codex"
},
"expected": "a.b=codex,a.b-c=pi"
}
],
"packageDigest": [
{
"integrityFiles": {
"rig.yaml": "1111111111111111111111111111111111111111111111111111111111111111",
"agents/openrig-dev/agent.yaml": "2222222222222222222222222222222222222222222222222222222222222222",
"README.md": "3333333333333333333333333333333333333333333333333333333333333333",
"agents/openrig-dev/guidance/lead.md": "4444444444444444444444444444444444444444444444444444444444444444"
},
"expected": {
"algorithm": "sha256",
"value": "cda24a7d4904e89e29c9513fc1e4916bee782a57b2b6ee43b859a84f4b94fb6a",
"coverage": "openrig.package-digest/v1"
}
},
{
"note": "Two files, x and y. Unquoted, their lines were the same bytes as the next vector's one file, whose name holds a tab and a newline.",
"integrityFiles": {
"x": "1111111111111111111111111111111111111111111111111111111111111111",
"y": "2222222222222222222222222222222222222222222222222222222222222222"
},
"expected": {
"algorithm": "sha256",
"value": "7ba71a4097dae6dbfb358af6b0b601a438f748eec578756f97144fe9f7fadaea",
"coverage": "openrig.package-digest/v1"
}
},
{
"note": "One file whose name holds a tab and a newline; quoting keeps it apart from the two-file vector above.",
"integrityFiles": {
"x\t1111111111111111111111111111111111111111111111111111111111111111\ny": "2222222222222222222222222222222222222222222222222222222222222222"
},
"expected": {
"algorithm": "sha256",
"value": "413a88836f2b10561d9272a6d272e5c610a122d76d327d16bc2a6f1af44a0826",
"coverage": "openrig.package-digest/v1"
}
},
{
"note": "Escaping: a double quote, a backslash, a control character (\\u0001) and a non-ASCII letter written as itself.",
"integrityFiles": {
"docs/a \"quoted\" name.md": "1111111111111111111111111111111111111111111111111111111111111111",
"docs/back\\slash.md": "2222222222222222222222222222222222222222222222222222222222222222",
"docs/control\u0001char.md": "3333333333333333333333333333333333333333333333333333333333333333",
"docs/café.md": "4444444444444444444444444444444444444444444444444444444444444444"
},
"expected": {
"algorithm": "sha256",
"value": "9055bef9907afbafec3401bbba55625ed0ddf1924390259c6dd95a128b3d50e8",
"coverage": "openrig.package-digest/v1"
}
}
]
}
@@ -0,0 +1,60 @@
{
"schema": "openrig.bundle-behaviour/v1",
"state": "not_generated",
"identity": {
"source": {
"repository": "https://github.com/mvschwarz/openrig-world",
"folder": "rigs/openrig-dev",
"resolvedCommit": "894ad0e301ab46ac6ddd74dea784b7f6311d69a2",
"requestedRef": "main",
"canonicalUrl": "https://github.com/mvschwarz/openrig-world/tree/894ad0e301ab46ac6ddd74dea784b7f6311d69a2/rigs/openrig-dev"
},
"configurationId": "build.impl=pi,build.lead=claude-code,check.qa=codex,check.review=codex",
"packageDigest": null,
"assembler": null,
"generator": {
"openrigVersion": "0.6.6",
"commit": "910bf9f1"
}
},
"reason": "No view has been generated for this combination.",
"localInspectCommand": "rig bundle inspect <the archive built for this combination> --json",
"team": [
{
"seat": "build.lead",
"pod": "build",
"member": "lead",
"agentRef": "local:agents/openrig-dev",
"profile": "lead",
"runtime": "claude-code",
"cwd": "--cwd (the user's openrig clone)"
},
{
"seat": "build.impl",
"pod": "build",
"member": "impl",
"agentRef": "local:agents/openrig-dev",
"profile": "implementer",
"runtime": "claude-code",
"cwd": "--cwd (the user's openrig clone)"
},
{
"seat": "check.review",
"pod": "check",
"member": "review",
"agentRef": "local:agents/openrig-dev",
"profile": "reviewer",
"runtime": "codex",
"cwd": "--cwd (the user's openrig clone)"
},
{
"seat": "check.qa",
"pod": "check",
"member": "qa",
"agentRef": "local:agents/openrig-dev",
"profile": "qa",
"runtime": "codex",
"cwd": "--cwd (the user's openrig clone)"
}
]
}
@@ -0,0 +1,6 @@
schema: openrig.bundle-configurations/v1
recommended: r
seats:
'build lead': { runtimes: { codex: lead } }
presets:
r: { 'build lead': codex }
@@ -0,0 +1,21 @@
schema: openrig.registry-entry/v1
slug: openrig-dev
name: OpenRig contributor team
summary: A four-seat team that turns one OpenRig issue into one pull request.
source:
repository: https://github.com/mvschwarz/openrig-world
folder: rigs/openrig-dev
resolvedCommit: 894ad0e301ab46ac6ddd74dea784b7f6311d69a2
requestedRef: main
configurations:
- id: build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex
alias: recommended
recommended: true
packageDigest: { algorithm: sha256, value: 5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29, coverage: openrig.package-digest/v1 }
assembler: { openrigVersion: 0.6.6, commit: 910bf9f1 }
behaviour: views/openrig-dev/build.impl-claude-code_build.lead-claude-code_check.qa-codex_check.review-codex.0.6.6.json
review:
date: 2026-10-04
note: Reviewed for listing. Review is not a security audit.
status: listed
withdrawnOn: 2026-10-05
@@ -0,0 +1,16 @@
schema: openrig.registry-entry/v1
slug: openrig-dev
name: OpenRig contributor team
summary: A four-seat team that turns one OpenRig issue into one pull request.
configurations:
- id: build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex
alias: recommended
recommended: true
packageDigest: { algorithm: sha256, value: 5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29, coverage: openrig.package-digest/v1 }
assembler: { openrigVersion: 0.6.6, commit: 910bf9f1 }
behaviour: views/openrig-dev/build.impl-claude-code_build.lead-claude-code_check.qa-codex_check.review-codex.0.6.6.json
review:
date: 2026-10-04
note: Reviewed for listing. Review is not a security audit.
status: listed
@@ -0,0 +1,20 @@
schema: openrig.registry-entry/v1
slug: openrig-dev
name: OpenRig contributor team
summary: A four-seat team that turns one OpenRig issue into one pull request.
source:
repository: https://github.com/mvschwarz/openrig-world
folder: ../rigs/openrig-dev
resolvedCommit: 894ad0e301ab46ac6ddd74dea784b7f6311d69a2
requestedRef: main
configurations:
- id: build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex
alias: recommended
recommended: true
packageDigest: { algorithm: sha256, value: 5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29, coverage: openrig.package-digest/v1 }
assembler: { openrigVersion: 0.6.6, commit: 910bf9f1 }
behaviour: views/openrig-dev/build.impl-claude-code_build.lead-claude-code_check.qa-codex_check.review-codex.0.6.6.json
review:
date: 2026-10-04
note: Reviewed for listing. Review is not a security audit.
status: listed
@@ -0,0 +1,20 @@
schema: openrig.registry-entry/v1
slug: openrig-dev
name: OpenRig contributor team
summary: A four-seat team that turns one OpenRig issue into one pull request.
source:
repository: https://github.com/mvschwarz/openrig-world
folder: rigs/openrig-dev
resolvedCommit: 894ad0e
requestedRef: main
configurations:
- id: build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex
alias: recommended
recommended: true
packageDigest: { algorithm: sha256, value: 5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29, coverage: openrig.package-digest/v1 }
assembler: { openrigVersion: 0.6.6, commit: 910bf9f1 }
behaviour: views/openrig-dev/build.impl-claude-code_build.lead-claude-code_check.qa-codex_check.review-codex.0.6.6.json
review:
date: 2026-10-04
note: Reviewed for listing. Review is not a security audit.
status: listed
@@ -0,0 +1,20 @@
schema: openrig.registry-entry/v1
slug: withdrawn
name: OpenRig contributor team
summary: A four-seat team that turns one OpenRig issue into one pull request.
source:
repository: https://github.com/mvschwarz/openrig-world
folder: rigs/openrig-dev
resolvedCommit: 894ad0e301ab46ac6ddd74dea784b7f6311d69a2
requestedRef: main
configurations:
- id: build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex
alias: recommended
recommended: true
packageDigest: { algorithm: sha256, value: 5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29, coverage: openrig.package-digest/v1 }
assembler: { openrigVersion: 0.6.6, commit: 910bf9f1 }
behaviour: views/openrig-dev/build.impl-claude-code_build.lead-claude-code_check.qa-codex_check.review-codex.0.6.6.json
review:
date: 2026-10-04
note: Reviewed for listing. Review is not a security audit.
status: withdrawn
@@ -0,0 +1,75 @@
{
"schema": "openrig.run-record/v1",
"id": "rr-20261004-004",
"subject": {
"kind": "harness_check",
"harness": "pi",
"configurationId": "build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex"
},
"execution": {
"resources": [
{
"kind": "plugin",
"ref": "openrig-core",
"version": "0.1.3"
}
],
"settings": {
"permissionPolicy": "none declared"
},
"unknowns": [
"model chosen by the runtime default"
]
},
"environment": {
"openrig": {
"version": "0.6.6",
"commit": "910bf9f1"
},
"platform": "linux",
"arch": "x64",
"harnesses": [
{
"name": "claude-code",
"version": "2.1.0",
"knownBy": "claude --version"
},
{
"name": "codex",
"version": "0.50.0",
"knownBy": "codex --version"
}
]
},
"evidence": {
"kind": "native-workflow",
"receipt": {
"ref": "receipt.md",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
},
"journey": {
"id": "harness-check",
"version": 1
},
"outcome": {
"steps": [
{
"id": "harness-check",
"result": "BLOCKED"
}
],
"assistance": {
"count": 0,
"description": ""
},
"recordedBy": "fleet",
"at": "2026-10-04T12:00:00Z",
"publicNote": "Pi was not signed in on the test machine."
},
"relations": {
"supersedes": [],
"withdraws": [],
"resolves": []
}
}
@@ -0,0 +1,97 @@
{
"schema": "openrig.run-record/v1",
"id": "rr-20261004-001",
"subject": {
"kind": "team",
"source": {
"repository": "https://github.com/mvschwarz/openrig-world",
"folder": "rigs/openrig-dev",
"resolvedCommit": "894ad0e301ab46ac6ddd74dea784b7f6311d69a2",
"requestedRef": "main",
"canonicalUrl": "https://github.com/mvschwarz/openrig-world/tree/894ad0e301ab46ac6ddd74dea784b7f6311d69a2/rigs/openrig-dev"
},
"configurationId": "build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex",
"packageDigest": {
"algorithm": "sha256",
"value": "5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29",
"coverage": "openrig.package-digest/v1"
},
"assembler": {
"openrigVersion": "0.6.6",
"commit": "910bf9f1"
}
},
"execution": {
"resources": [
{
"kind": "plugin",
"ref": "openrig-core",
"version": "0.1.3"
}
],
"settings": {
"permissionPolicy": "none declared"
},
"unknowns": [
"model chosen by the runtime default"
]
},
"environment": {
"openrig": {
"version": "0.6.6",
"commit": "910bf9f1"
},
"platform": "macos",
"arch": "x64",
"harnesses": [
{
"name": "claude-code",
"version": "2.1.0",
"knownBy": "claude --version"
},
{
"name": "codex",
"version": "0.50.0",
"knownBy": "codex --version"
}
]
},
"evidence": {
"kind": "native-workflow",
"receipt": {
"ref": "receipt.md",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
},
"journey": {
"id": "contributor-team",
"version": 1
},
"outcome": {
"steps": [
{
"id": "install",
"result": "PASS"
},
{
"id": "orient",
"result": "PASS"
},
{
"id": "pull-request",
"result": "PASS"
}
],
"assistance": {
"count": 0,
"description": ""
},
"recordedBy": "fleet",
"at": "2026-10-04T12:00:00Z"
},
"relations": {
"supersedes": [],
"withdraws": [],
"resolves": []
}
}
@@ -0,0 +1,61 @@
{
"generated": {
"by": "openrig-world tools/status.mjs",
"notice": "edited by hand",
"rule": "openrig.status-rule/v1",
"generatorVersion": 1
},
"listings": {
"openrig-dev": {
"state": "ok",
"configurations": {
"build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex": {
"platforms": {
"linux-x64": {
"label": "tested",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"recordIds": [
"rr-20261004-002"
],
"packageDigests": [
{
"algorithm": "sha256",
"value": "5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29",
"coverage": "openrig.package-digest/v1"
}
]
}
},
"communityReports": 0
},
"build.impl=pi,build.lead=pi,check.qa=pi,check.review=pi": {
"platforms": {},
"communityReports": 0
}
}
},
"unreadable-example": {
"state": "status_unavailable",
"configurations": {}
}
},
"harnessChecks": {
"state": "ok",
"harnesses": {
"pi": {
"linux-x64": {
"result": "BLOCKED",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"harnessVersion": "unknown",
"recordIds": [
"rr-20261004-004"
],
"note": "Pi was not signed in on the test machine."
}
}
}
},
"bodyDigest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
}
@@ -0,0 +1,62 @@
{
"generated": {
"by": "openrig-world tools/status.mjs",
"notice": "Generated file. Do not edit by hand; regenerate it.",
"rule": "openrig.status-rule/v1",
"generatorVersion": 1
},
"listings": {
"openrig-dev": {
"state": "ok",
"configurations": {
"build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex": {
"platforms": {
"linux-x64": {
"label": "tested",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"recordIds": [
"rr-20261004-002"
],
"packageDigests": [
{
"algorithm": "sha256",
"value": "5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29",
"coverage": "openrig.package-digest/v1"
}
],
"assistanceCount": 1
}
},
"communityReports": 0
},
"build.impl=pi,build.lead=pi,check.qa=pi,check.review=pi": {
"platforms": {},
"communityReports": 0
}
}
},
"unreadable-example": {
"state": "status_unavailable",
"configurations": {}
}
},
"harnessChecks": {
"state": "ok",
"harnesses": {
"pi": {
"linux-x64": {
"result": "BLOCKED",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"harnessVersion": "unknown",
"recordIds": [
"rr-20261004-004"
],
"note": "Pi was not signed in on the test machine."
}
}
}
},
"bodyDigest": "548f7ce51c9cf66f34fd0b613dd3754240350cd856ac51f7f98140300766dd57"
}
@@ -0,0 +1,59 @@
{
"generated": {
"by": "openrig-world tools/status.mjs",
"notice": "Generated file. Do not edit by hand; regenerate it.",
"rule": "openrig.status-rule/v1",
"generatorVersion": 1
},
"listings": {
"openrig-dev": {
"state": "ok",
"configurations": {
"build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex": {
"platforms": {
"linux-x64": {
"label": "tested",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"recordIds": [],
"packageDigests": [
{
"algorithm": "sha256",
"value": "5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29",
"coverage": "openrig.package-digest/v1"
}
]
}
},
"communityReports": 0
},
"build.impl=pi,build.lead=pi,check.qa=pi,check.review=pi": {
"platforms": {},
"communityReports": 0
}
}
},
"unreadable-example": {
"state": "status_unavailable",
"configurations": {}
}
},
"harnessChecks": {
"state": "ok",
"harnesses": {
"pi": {
"linux-x64": {
"result": "BLOCKED",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"harnessVersion": "unknown",
"recordIds": [
"rr-20261004-004"
],
"note": "Pi was not signed in on the test machine."
}
}
}
},
"bodyDigest": "c6ceabe8326538cc3c662c923085f403888a7a06c8c4cf4823fda5e159bc99c1"
}
@@ -0,0 +1,61 @@
{
"generated": {
"by": "openrig-world tools/status.mjs",
"notice": "Generated file. Do not edit by hand; regenerate it.",
"rule": "openrig.status-rule/v1",
"generatorVersion": 1
},
"listings": {
"openrig-dev": {
"state": "ok",
"configurations": {
"build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex": {
"platforms": {
"linux-x64": {
"label": "tested",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"recordIds": [
"rr-20261004-002"
],
"packageDigests": [
{
"algorithm": "sha256",
"value": "5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29",
"coverage": "openrig.package-digest/v1"
}
]
}
},
"communityReports": 0
},
"build.impl=pi,build.lead=pi,check.qa=pi,check.review=pi": {
"platforms": {},
"communityReports": 0
}
}
},
"unreadable-example": {
"state": "status_unavailable",
"configurations": {}
}
},
"harnessChecks": {
"state": "status_unavailable",
"harnesses": {
"pi": {
"linux-x64": {
"result": "BLOCKED",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"harnessVersion": "unknown",
"recordIds": [
"rr-20261004-004"
],
"note": "Pi was not signed in on the test machine."
}
}
}
},
"bodyDigest": "c23b3fae312e39667da2ec9fbb0a44c9d68048e0ca4c392301bf884ca30a44e8"
}
@@ -0,0 +1,61 @@
{
"generated": {
"by": "openrig-world tools/status.mjs",
"notice": "Generated file. Do not edit by hand; regenerate it.",
"rule": "openrig.status-rule/v1",
"generatorVersion": 1
},
"listings": {
"openrig-dev": {
"state": "status_unavailable",
"configurations": {
"build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex": {
"platforms": {
"linux-x64": {
"label": "tested",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"recordIds": [
"rr-20261004-002"
],
"packageDigests": [
{
"algorithm": "sha256",
"value": "5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29",
"coverage": "openrig.package-digest/v1"
}
]
}
},
"communityReports": 0
},
"build.impl=pi,build.lead=pi,check.qa=pi,check.review=pi": {
"platforms": {},
"communityReports": 0
}
}
},
"unreadable-example": {
"state": "status_unavailable",
"configurations": {}
}
},
"harnessChecks": {
"state": "ok",
"harnesses": {
"pi": {
"linux-x64": {
"result": "BLOCKED",
"date": "2026-10-04",
"openrigVersion": "0.6.6",
"harnessVersion": "unknown",
"recordIds": [
"rr-20261004-004"
],
"note": "Pi was not signed in on the test machine."
}
}
}
},
"bodyDigest": "c6ceabe8326538cc3c662c923085f403888a7a06c8c4cf4823fda5e159bc99c1"
}
@@ -0,0 +1,22 @@
{
"schema": "openrig.bundle-behaviour/v1",
"state": "not_generated",
"identity": {
"source": {
"repository": "https://github.com/mvschwarz/openrig-world",
"folder": "rigs/openrig-dev",
"resolvedCommit": "894ad0e301ab46ac6ddd74dea784b7f6311d69a2",
"requestedRef": "main",
"canonicalUrl": "https://github.com/mvschwarz/openrig-world/tree/894ad0e301ab46ac6ddd74dea784b7f6311d69a2/rigs/openrig-dev"
},
"configurationId": "build.impl=pi,build.lead=claude-code,check.qa=codex,check.review=codex",
"packageDigest": null,
"assembler": null,
"generator": {
"openrigVersion": "0.6.6",
"commit": "910bf9f1"
}
},
"reason": "No view has been generated for this combination.",
"localInspectCommand": "rig bundle inspect <the archive built for this combination> --json"
}
@@ -0,0 +1,53 @@
{
"schema": "openrig.bundle-behaviour/v1",
"state": "generated",
"identity": {
"source": null,
"configurationId": null,
"packageDigest": {
"algorithm": "sha256",
"value": "5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29",
"coverage": "openrig.package-digest/v1"
},
"assembler": null,
"generator": {
"openrigVersion": "0.6.6",
"commit": "910bf9f1"
},
"integrity": {
"digestValid": true,
"filesVerified": true
}
},
"team": [
{
"seat": "build.lead",
"pod": "build",
"member": "lead",
"agentRef": "local:agents/openrig-dev",
"profile": "lead",
"runtime": "claude-code",
"cwd": "--cwd (the user's openrig clone)"
}
],
"posture": [
{
"seat": "build.lead",
"shellAccess": "runs shell commands in its working folder under your logged-in account",
"selection": "set by a host setting",
"basis": "unresolved",
"nativeEffect": "unknown"
}
],
"toldFiles": [],
"alsoRuns": [],
"writes": [],
"outsideAddresses": [],
"needs": [],
"unknownBeforeLaunch": [
{
"subject": "source and configuration",
"reason": "the archive does not state them"
}
]
}
@@ -0,0 +1,101 @@
{
"schema": "openrig.bundle-behaviour/v1",
"state": "generated",
"identity": {
"source": null,
"configurationId": null,
"packageDigest": null,
"assembler": null,
"generator": {
"openrigVersion": "0.6.6"
},
"integrity": {
"digestValid": false,
"filesVerified": false
}
},
"team": [
{
"seat": "team.claude-code",
"pod": "team",
"member": "claude-code",
"agentRef": "local:agent",
"profile": "default",
"runtime": "claude-code",
"cwd": "."
},
{
"seat": "team.codex",
"pod": "team",
"member": "codex",
"agentRef": "local:agent",
"profile": "default",
"runtime": "codex",
"cwd": "."
},
{
"seat": "team.pi",
"pod": "team",
"member": "pi",
"agentRef": "local:agent",
"profile": "default",
"runtime": "pi",
"cwd": "."
}
],
"posture": [
{
"seat": "team.claude-code",
"shellAccess": "Can run shell commands as the launching user, subject to runtime and host policy.",
"selection": "acceptEdits (conditional launch floor)",
"basis": "product_default",
"permissionPrompts": "default",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml",
"field": "pods.team.members.claude-code"
}
]
},
{
"seat": "team.codex",
"shellAccess": "Can run shell commands as the launching user, subject to runtime and host policy.",
"selection": "workspace-write (conditional launch floor); approval policy resolved at launch",
"basis": "product_default",
"permissionPrompts": "default",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml",
"field": "pods.team.members.codex"
}
]
},
{
"seat": "team.pi",
"shellAccess": "Can run shell commands as the launching user, subject to runtime and host policy.",
"selection": "resource trust resolved at launch; not a native permission policy",
"basis": "product_default",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml",
"field": "pods.team.members.pi"
}
]
}
],
"toldFiles": [],
"alsoRuns": [],
"writes": [],
"outsideAddresses": [],
"needs": [],
"unknownBeforeLaunch": [
{
"subject": "host and native settings",
"reason": "Effective native permissions are not observed before launch.",
"sourceRefs": []
}
]
}
@@ -0,0 +1,102 @@
{
"schema": "openrig.bundle-behaviour/v1",
"state": "generated",
"identity": {
"source": null,
"configurationId": null,
"packageDigest": null,
"assembler": null,
"generator": {
"openrigVersion": "0.6.6"
},
"integrity": {
"digestValid": false,
"filesVerified": false
}
},
"team": [
{
"seat": "team.claude-code",
"pod": "team",
"member": "claude-code",
"agentRef": "local:agent",
"profile": "default",
"runtime": "claude-code",
"cwd": "."
},
{
"seat": "team.codex",
"pod": "team",
"member": "codex",
"agentRef": "local:agent",
"profile": "default",
"runtime": "codex",
"cwd": "."
},
{
"seat": "team.pi",
"pod": "team",
"member": "pi",
"agentRef": "local:agent",
"profile": "default",
"runtime": "pi",
"cwd": "."
}
],
"posture": [
{
"seat": "team.claude-code",
"shellAccess": "Can run shell commands as the launching user, subject to runtime and host policy.",
"selection": "Permission prompts: off; Claude bypasses permissions (full_bypass)",
"basis": "explicit",
"permissionPrompts": "off",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml",
"field": "permission_policy"
}
]
},
{
"seat": "team.codex",
"shellAccess": "Can run shell commands as the launching user, subject to runtime and host policy.",
"selection": "Permission prompts: off; Codex runs with full access and never asks (full_bypass)",
"basis": "explicit",
"permissionPrompts": "off",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml",
"field": "permission_policy"
}
]
},
{
"seat": "team.pi",
"shellAccess": "Can run shell commands as the launching user, subject to runtime and host policy.",
"selection": "Permission prompts: off; Pi gets full resource trust (full_bypass / approve); not a native permission policy",
"basis": "explicit",
"permissionPrompts": "off",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml",
"field": "permission_policy"
}
]
}
],
"toldFiles": [],
"alsoRuns": [],
"writes": [],
"outsideAddresses": [],
"needs": [],
"unknownBeforeLaunch": [
{
"subject": "host and native settings",
"reason": "Effective native permissions are not observed before launch.",
"sourceRefs": []
}
]
}
@@ -0,0 +1,258 @@
{
"schema": "openrig.bundle-behaviour/v1",
"state": "generated",
"identity": {
"source": {
"repository": "https://github.com/mvschwarz/openrig-world",
"folder": "rigs/openrig-dev",
"resolvedCommit": "894ad0e301ab46ac6ddd74dea784b7f6311d69a2",
"requestedRef": "main",
"canonicalUrl": "https://github.com/mvschwarz/openrig-world/tree/894ad0e301ab46ac6ddd74dea784b7f6311d69a2/rigs/openrig-dev"
},
"configurationId": "build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex",
"packageDigest": {
"algorithm": "sha256",
"value": "5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29",
"coverage": "openrig.package-digest/v1"
},
"assembler": {
"openrigVersion": "0.6.6",
"commit": "910bf9f1"
},
"generator": {
"openrigVersion": "0.6.6",
"commit": "910bf9f1"
},
"integrity": {
"digestValid": true,
"filesVerified": true
},
"statedProvenance": {}
},
"team": [
{
"seat": "build.lead",
"pod": "build",
"member": "lead",
"agentRef": "local:agents/openrig-dev",
"profile": "lead",
"runtime": "claude-code",
"cwd": "--cwd (the user's openrig clone)"
},
{
"seat": "build.impl",
"pod": "build",
"member": "impl",
"agentRef": "local:agents/openrig-dev",
"profile": "implementer",
"runtime": "claude-code",
"cwd": "--cwd (the user's openrig clone)"
},
{
"seat": "check.review",
"pod": "check",
"member": "review",
"agentRef": "local:agents/openrig-dev",
"profile": "reviewer",
"runtime": "codex",
"cwd": "--cwd (the user's openrig clone)"
},
{
"seat": "check.qa",
"pod": "check",
"member": "qa",
"agentRef": "local:agents/openrig-dev",
"profile": "qa",
"runtime": "codex",
"cwd": "--cwd (the user's openrig clone)"
}
],
"posture": [
{
"seat": "build.lead",
"shellAccess": "runs shell commands in its working folder under your logged-in account",
"selection": "none declared",
"basis": "product_default",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml"
}
]
},
{
"seat": "build.impl",
"shellAccess": "runs shell commands in its working folder under your logged-in account",
"selection": "none declared",
"basis": "product_default",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml"
}
]
},
{
"seat": "check.review",
"shellAccess": "runs shell commands in its working folder under your logged-in account",
"selection": "none declared",
"basis": "product_default",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml"
}
]
},
{
"seat": "check.qa",
"shellAccess": "runs shell commands in its working folder under your logged-in account",
"selection": "none declared",
"basis": "product_default",
"nativeEffect": "unknown",
"sourceRefs": [
{
"path": "rig.yaml"
}
]
}
],
"toldFiles": [
{
"kind": "culture",
"pathOrRef": "CULTURE.md",
"delivery": "guidance_merge",
"resolution": "archive",
"sourceRefs": [
{
"path": "rig.yaml",
"field": "culture_file"
}
]
},
{
"kind": "startup",
"pathOrRef": "startup/context.md",
"delivery": "send_text",
"resolution": "archive",
"sourceRefs": [
{
"path": "rig.yaml",
"field": "startup.files"
}
]
},
{
"seat": "build.lead",
"kind": "role",
"pathOrRef": "agents/openrig-dev/guidance/lead.md",
"resolution": "archive",
"sourceRefs": [
{
"path": "agents/openrig-dev/agent.yaml",
"field": "profiles.lead"
}
]
}
],
"alsoRuns": [
{
"kind": "plugin",
"pathOrRef": "openrig-home:plugins/openrig-core",
"resolution": "host_at_launch",
"sourceRefs": [
{
"path": "agents/openrig-dev/agent.yaml",
"field": "resources.plugins"
}
]
},
{
"kind": "hook",
"pathOrRef": "agents/openrig-dev/runtime/claude-activity-hooks.json",
"trigger": "Claude Code activity events",
"resolution": "archive",
"sourceRefs": [
{
"path": "agents/openrig-dev/agent.yaml"
}
]
}
],
"writes": [
{
"kind": "managed_block",
"destinationBase": "each seat's working folder",
"path": "CLAUDE.local.md",
"operation": "add OpenRig block",
"phase": "launch",
"condition": "Claude Code seats",
"sourceRefs": [
{
"path": "rig.yaml",
"field": "managed_blocks"
}
]
},
{
"kind": "managed_block",
"destinationBase": "each seat's working folder",
"path": "AGENTS.md",
"operation": "add OpenRig block",
"phase": "launch",
"condition": "Codex seats"
}
],
"outsideAddresses": [
{
"domain": "github.com",
"sourceRefs": [
{
"path": "README.md"
}
]
}
],
"needs": [
{
"kind": "runtime",
"name": "claude-code",
"status": "not_checked",
"sourceRefs": [
{
"path": "rig.yaml"
}
]
},
{
"kind": "runtime",
"name": "codex",
"status": "not_checked",
"sourceRefs": [
{
"path": "rig.yaml"
}
]
},
{
"kind": "account",
"name": "GitHub account with push credentials",
"status": "not_checked",
"sourceRefs": [
{
"path": "README.md"
}
]
}
],
"unknownBeforeLaunch": [
{
"subject": "effective permissions",
"reason": "host settings decide them at launch"
},
{
"subject": "model and effort",
"reason": "not declared; the runtime's defaults apply"
}
]
}
@@ -0,0 +1,12 @@
schema: openrig.bundle-configurations/v1
recommended: recommended
seats:
build.lead: { runtimes: { claude-code: lead, codex: lead, pi: lead } }
build.impl: { runtimes: { claude-code: implementer, codex: implementer, pi: implementer } }
check.review: { runtimes: { codex: reviewer, claude-code: reviewer, pi: reviewer } }
check.qa: { runtimes: { codex: qa, claude-code: qa, pi: qa } }
presets:
recommended: { build.lead: claude-code, build.impl: claude-code, check.review: codex, check.qa: codex }
all-claude: { build.lead: claude-code, build.impl: claude-code, check.review: claude-code, check.qa: claude-code }
all-codex: { build.lead: codex, build.impl: codex, check.review: codex, check.qa: codex }
all-pi: { build.lead: pi, build.impl: pi, check.review: pi, check.qa: pi }
@@ -0,0 +1,20 @@
schema: openrig.registry-entry/v1
slug: openrig-dev
name: OpenRig contributor team
summary: A four-seat team that turns one OpenRig issue into one pull request.
source:
repository: https://github.com/mvschwarz/openrig-world
folder: rigs/openrig-dev
resolvedCommit: 894ad0e301ab46ac6ddd74dea784b7f6311d69a2
requestedRef: main
configurations:
- id: build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex
alias: recommended
recommended: true
packageDigest: { algorithm: sha256, value: 5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29, coverage: openrig.package-digest/v1 }
assembler: { openrigVersion: 0.6.6, commit: 910bf9f1 }
behaviour: views/openrig-dev/build.impl-claude-code_build.lead-claude-code_check.qa-codex_check.review-codex.0.6.6.json
review:
date: 2026-10-04
note: Reviewed for listing. Review is not a security audit.
status: listed
@@ -0,0 +1,21 @@
schema: openrig.registry-entry/v1
slug: withdrawn
name: OpenRig contributor team
summary: A four-seat team that turns one OpenRig issue into one pull request.
source:
repository: https://github.com/mvschwarz/openrig-world
folder: rigs/openrig-dev
resolvedCommit: 894ad0e301ab46ac6ddd74dea784b7f6311d69a2
requestedRef: main
configurations:
- id: build.impl=claude-code,build.lead=claude-code,check.qa=codex,check.review=codex
alias: recommended
recommended: true
packageDigest: { algorithm: sha256, value: 5f2c0a1e9b8d7c6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a29, coverage: openrig.package-digest/v1 }
assembler: { openrigVersion: 0.6.6, commit: 910bf9f1 }
behaviour: views/openrig-dev/build.impl-claude-code_build.lead-claude-code_check.qa-codex_check.review-codex.0.6.6.json
review:
date: 2026-10-04
note: Reviewed for listing. Review is not a security audit.
status: withdrawn
withdrawnOn: 2026-10-05
@@ -0,0 +1,74 @@
{
"schema": "openrig.run-record/v1",
"id": "rr-20261004-004",
"subject": {
"kind": "harness_check",
"harness": "pi"
},
"execution": {
"resources": [
{
"kind": "plugin",
"ref": "openrig-core",
"version": "0.1.3"
}
],
"settings": {
"permissionPolicy": "none declared"
},
"unknowns": [
"model chosen by the runtime default"
]
},
"environment": {
"openrig": {
"version": "0.6.6",
"commit": "910bf9f1"
},
"platform": "linux",
"arch": "x64",
"harnesses": [
{
"name": "claude-code",
"version": "2.1.0",
"knownBy": "claude --version"
},
{
"name": "codex",
"version": "0.50.0",
"knownBy": "codex --version"
}
]
},
"evidence": {
"kind": "native-workflow",
"receipt": {
"ref": "receipt.md",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
},
"journey": {
"id": "harness-check",
"version": 1
},
"outcome": {
"steps": [
{
"id": "harness-check",
"result": "BLOCKED"
}
],
"assistance": {
"count": 0,
"description": ""
},
"recordedBy": "fleet",
"at": "2026-10-04T12:00:00Z",
"publicNote": "Pi was not signed in on the test machine."
},
"relations": {
"supersedes": [],
"withdraws": [],
"resolves": []
}
}
Loaded 100 of 2060 files, more files were not shown because too many files have changed in this diff. Show more