@staix/agent-hub 0.44.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +3 -8
  3. package/docs/agent-notes/adapters.md +2 -2
  4. package/docs/agent-notes/daemon.md +1 -1
  5. package/docs/agent-notes/local-worker.md +1 -1
  6. package/docs/agent-notes/security-review.md +1 -1
  7. package/docs/agent-notes/tasks.md +3 -1
  8. package/docs/agent-notes/tests.md +3 -2
  9. package/docs/design/adapters.md +4 -2
  10. package/docs/design/agent-hub.md +1 -1
  11. package/docs/design/roadmap.md +75 -2
  12. package/docs/design/supervision.md +21 -1
  13. package/docs/design/task-board.md +30 -2
  14. package/docs/dogfood.md +13 -4
  15. package/docs/events.md +5 -1
  16. package/docs/influences.md +7 -0
  17. package/docs/memory.md +4 -4
  18. package/docs/operations.md +51 -18
  19. package/docs/quickstart.md +8 -2
  20. package/docs/research.md +16 -0
  21. package/docs/roadmap.json +4 -0
  22. package/docs/roadmap.md +9 -0
  23. package/docs/sdlc.md +15 -3
  24. package/docs/security.md +3 -3
  25. package/docs/verification/2026-11-19-claude-implementer-2.1.328.md +49 -0
  26. package/docs/verification/2026-11-20-claude-implementer-2.1.329.md +49 -0
  27. package/docs/verification/2026-11-20-sdlc-metrics-diagnosis.md +7 -0
  28. package/docs/verification/2026-11-21-0.45.0.md +69 -0
  29. package/docs/verification/2026-11-22-codex-0171-reviewer-isolation.md +47 -0
  30. package/docs/verified.json +32 -26
  31. package/package.json +2 -2
  32. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  33. package/plugins/agent-hub/kimi-hook.js +472 -229
  34. package/plugins/agent-hub/kimi-review-policy-worker.js +5 -5
  35. package/plugins/agent-hub/server.js +513 -258
  36. package/scripts/check-docs.mjs +9 -1
  37. package/src/adapters/acp.ts +11 -1
  38. package/src/adapters/compat.ts +3 -3
  39. package/src/adapters/definitions/builtin-metadata.ts +2 -2
  40. package/src/adapters/definitions/native-context.ts +10 -0
  41. package/src/adapters/jcode.ts +10 -0
  42. package/src/adapters/local-worker.ts +3 -2
  43. package/src/adapters/pi.ts +15 -4
  44. package/src/cli/console-state.ts +3 -1
  45. package/src/cli/help.ts +3 -1
  46. package/src/cli/identity.ts +2 -1
  47. package/src/cli/main.ts +11 -5
  48. package/src/cli/recovery-package.ts +16 -3
  49. package/src/cli/roadmap-write.ts +59 -0
  50. package/src/cli/roadmap.ts +81 -4
  51. package/src/cli/sdlc-output.ts +4 -0
  52. package/src/cli/upgrade-runtime.ts +10 -6
  53. package/src/hub/agent-mem-range.ts +43 -0
  54. package/src/hub/board.ts +102 -1
  55. package/src/hub/check-runner.ts +25 -1
  56. package/src/hub/config-apply.ts +4 -2
  57. package/src/hub/config-trust.ts +1 -1
  58. package/src/hub/context-window.ts +1 -1
  59. package/src/hub/cost-governance.ts +11 -7
  60. package/src/hub/daemon.ts +253 -30
  61. package/src/hub/dogfood-read.ts +4 -2
  62. package/src/hub/edit-guard.ts +100 -0
  63. package/src/hub/events.ts +79 -8
  64. package/src/hub/facts.ts +57 -4
  65. package/src/hub/hub-tools.ts +2 -0
  66. package/src/hub/lifecycle.ts +6 -1
  67. package/src/hub/log-rotation.ts +130 -0
  68. package/src/hub/memory-profile.ts +137 -21
  69. package/src/hub/no-writes.ts +1 -0
  70. package/src/hub/operational-authority.ts +3 -2
  71. package/src/hub/operational-settings.ts +2 -2
  72. package/src/hub/recovery-store.ts +49 -21
  73. package/src/hub/research-experiments.ts +132 -0
  74. package/src/hub/research-quality.ts +8 -2
  75. package/src/hub/research-record.ts +35 -0
  76. package/src/hub/research.ts +128 -28
  77. package/src/hub/roadmap-check.ts +65 -0
  78. package/src/hub/roadmap-decompose.ts +80 -0
  79. package/src/hub/roadmap-export.ts +27 -0
  80. package/src/hub/roadmap-sync.ts +97 -0
  81. package/src/hub/roadmap.ts +40 -0
  82. package/src/hub/sdlc-branch-ci.ts +128 -0
  83. package/src/hub/sdlc-merge.ts +6 -3
  84. package/src/hub/sdlc-metrics.ts +19 -5
  85. package/src/hub/sdlc.ts +73 -5
  86. package/src/hub/settings.ts +1 -0
  87. package/src/hub/snapshots.ts +13 -1
  88. package/src/hub/startup-event-seeds.ts +21 -15
  89. package/src/hub/startup-timing.ts +3 -1
  90. package/src/hub/supervision-proposals.ts +10 -2
  91. package/src/hub/supervision-rules.ts +26 -3
  92. package/src/hub/supervision.ts +7 -0
  93. package/src/hub/task-pr.ts +47 -0
  94. package/src/hub/task-worktree.ts +18 -11
  95. package/src/hub/tasks.ts +502 -34
  96. package/src/hub/usage-rollup.ts +35 -20
  97. package/src/local/tools.ts +13 -1
  98. package/src/memory/client.ts +3 -2
  99. package/src/pi/extension.ts +15 -3
  100. package/src/pi/tool-receipts.ts +26 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,46 @@ Issue and pull request numbers in the entries for 0.7.7 and earlier refer to the
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.45.0
8
+
9
+ - Release N-1 for 0.45.x is published 0.44.0, with exact agent-mem 0.30.0 and control protocol 17 (descriptor floor 16). The N-1 fixture and matrix pin that package; the separate protocol-16 fixture stays at 0.25.0. The isolated compatibility fixture covers old clients and plugins against the new daemon and new clients and plugins against the old daemon; it does not prove live-agent, rollback, or shared-home compatibility. The protocol window and CLI forms are unchanged. This release declares agent-mem `>=0.33.0 <1.0.0`, resolved to 0.33.0 by the lockfile, and does not automatically raise the memory home or sync format floor; compatibility after a person raises a floor requires separate verification.
10
+
11
+ - Add descriptive edit-governance factorial, sensitivity and evidenced cost-per-success helpers (Refs #1556, hub task 1008).
12
+ - Admit a verified draft head to review before macOS runs, while preserving the full exact-head merge gate (Refs #1576, hub task 1031).
13
+ - Accept new agent-mem minors automatically through the declared range `>=0.33.0 <1.0.0`, checked at load against the package's host API range `[1, 1]` (Refs #1611, hub task 1054). A package without valid `HOST_API_MIN` and `HOST_API_VERSION` is refused with the cause, never a module-link error. A minor may raise the store format floor, so roll back the hub together with the store. A new major stays a reviewed raise. Memory opens only for such a release (`Bun.semver.satisfies`), and the recovery package and `scripts/check-package.mjs` apply the same rule; `ahub doctor` and the memory client report the loaded release and, on refusal, its cause. A daily scheduled and dispatch workflow installs the newest in-range release beside the unchanged manifest and lockfile and runs the memory-surface gate against it. An in-place upgrade turns the sync-placement writer proof to `changed` until a person re-runs `amem migrate --sync-placement --dry-run`. This replaces the exact agent-mem pin (the interim `~0.32.1` range of #1605, hub task 1047, never shipped).
14
+ - Add opt-in edit route and read-receipt guards for hub-owned tools, plus edit supervision observations (Refs #1556, hub task 1007).
15
+ - Open or attach a verified GitHub PR for a managed worktree at task completion (Refs #1549, hub task 1019).
16
+ - The console keeps the selected row on screen in the Settings panel: the row window now leaves room for the notes above the table (#1607, hub task 1049).
17
+ - Propose the parts of a roadmap milestone: `ahub roadmap decompose <id>` and `hub_roadmap_decompose {id}` ask the hub's model how one milestone decomposes, reading only its public title and outcome, the goal or architecture specs it links and the issues it links. A part is kept only when it cites an id the model was shown and says whether it needs its own spec issue or goes straight to a task, and the answer is saved as a pending model answer; nothing is intaken, linked or published (Refs #1480, hub task 1050).
18
+ - Accept one proposed part of a milestone decomposition as a held intake draft: `ahub roadmap decompose <id> --accept <part>` and `hub_roadmap_decompose {id, accept}` create a backlog draft linked to the milestone that carries the part's `spec`/`task` kind, so nothing offers, pulls or routes it until the person releases it with `ahub intake approve`. Each part is accepted on its own, accepting the same part twice returns the draft the first accept made, and the reply is a public view, so a part the screen refuses is held privately and reads `[pii]` (Refs #1480, hub task 1051).
19
+ - Record codex-cli 0.171.0 reviewer evidence from model-free preparation only; 0.171.0 stays unverified because the one model-backed review persisted no verdict, and the compatibility list is unchanged (Refs #888, hub task 1024).
20
+ - Move the external project mentions from the README to `docs/influences.md` (#1589).
21
+ - Shorten two slow test files without loosening what they assert: the hang-watch gate fixtures are trimmed, with the measured reason `memory-store` cannot be halved (#1594), and a checkpoint test waits out the expiry its fixture already shortens (Refs #1578, #1595).
22
+
23
+
24
+ - Add `turn_end.edits` (closed counts of edit-tool and shell-route writes graded by read receipts, only on mutating turns with `research.enabled`) and a text-free `edits` block on research records v2, reported per leaf by `quality.json` with null (never 0) on tree-only surfaces (Refs #1556, hub task 1006).
25
+
26
+ - Exact-pin the first-party agent-mem dependency to 0.32.0, from 0.30.0 (hub task 1042). The 0.31.0 additions stay outside the paths this hub reads (the `held` placement realm outcome and the classified agent-marked CLI read causes), and its sync result shape and `SYNC_FAILURE_CAUSES` are unchanged. The 0.32.0 CLI changes also reach nothing here: the hub's one `amem` call previews `amem setup <tool> --json` and parses the answer with `JSON.parse`, so 2-space `--json` indentation and usage errors exiting 2 read the same, and it writes no capture hook or `amem ingest` call of its own, so piped ingest printing human text and the `amem_work_state_read` per-call policy snapshot change nothing it runs. `amem list`, `show` and `graph` keep byte parity and storage is unchanged.
27
+ - Check roadmap drift, preview an opt-in GitHub milestone mirror, and export validated public roadmap files (Refs #1482, hub task 951).
28
+ - Take the recovery driver's attachment-wait poll slice from the clock object it already accepts for `now` and `sleep`, defaulting to the same 1 s so no production timer or deadline moves, and let the `#489` deadline tests poll at 10 s: `test/upgrade-runtime.test.ts` drops from 126 s to 57 s on macOS with every 600, 650, 700 and 900 s assertion unchanged. The other four files of the ten-file table are left with measured per-file reasons (Refs #1578, hub task 1044).
29
+ - Report Pi prompt context occupancy and session model in headless and TUI modes, and bind verified TUI sessions to Record capture (Refs #1549).
30
+
31
+ - Read merged PR CI costs from complete branch-scoped evidence when GitHub omits run-to-PR links, including first-pass status and full-gate and macOS shard counts (Refs #1579, Refs #1555, hub task 1032).
32
+ - Make a failing gate name its step: `scripts/check.sh` prints one `check: FAILED step '<name>' (exit N)` line (and a GitHub annotation under Actions) for each once-only step, and for the test runner it adds the failing-test count (each test once, although Bun repeats every `(fail)` line in its end-of-run recap), the first failing test and the last test file started, or says the runner exited or was signalled with no `(fail)` line, plus the leaked-process scan. Exit statuses and pass/fail are unchanged (Refs #1577, Refs #1260).
33
+ - Retire a finished recovery receipt's runner db only while this process's own live claim still refuses a new owner, so two maintenance passes can no longer race a release against an unlink and crash a pass on the moved database (Refs #1260, Refs #1541, hub task 1040).
34
+ - Keep the staged-project-isolation test's two real daemons but run every await under a 45 s body deadline with 6 s cleanup waits under its own 90 s timeout, so a slow macOS shard fails the step it waited on instead of being cut by Bun's 20 s while a synchronous `ps` read is on the stack (Refs #1577, Refs #1260, hub task 1038).
35
+ - Split `post_ready` on the startup timings line into one boundary per step (`post_ready_handoff`, `_queue`, `_watch`, `_reconcile`, `_goals`, `_leases`, `_crash`, `_pi`, `_drift`), so the next live start names which step holds the 17 s that blocks control replies. Measurement only; no behavior changes (Refs #1445).
36
+ - Rotate `events.jsonl` (64 MiB segments, three kept) and `hub.log` (16 MiB, two kept) by size. A rotated segment is named by its starting byte, so every reader and every persisted offset (the usage roll-up, the live research tail) keeps its meaning across a rotation, and `ahub research backfill` gives the same records for a task whose events sit in a rotated segment. The oldest event segment is kept while it holds an open task's events (Refs #1546, hub task 1021).
37
+ - Drop a closed task's ephemeral state: its `touches` rows, the output tail and staged output of its finished isolated checks, and the settled results of a closed Pi session shrink to 2,000 characters with a shell exit code kept. Tasks, history, receipts and roll-ups are untouched (Refs #1555, hub task 1004).
38
+ - Remove the rooms-delivery replaced-presence flake: the test counted beta's own session-start presence request as an echo of the replacement reply, and now waits on beta's answer (Refs #1577, Refs #1260, hub task 1035).
39
+ - Remove the runtime-prune recovery flake: the test waits for the pass it admitted to record its terminal phase in the admission ledger instead of a fixed 50 ms delay that raced the worker's write, and an unreadable ledger is no longer read as zero rows (Refs #1260, Refs #1546, hub task 1037).
40
+ - Remove the conductor detached-restart flake: the test waits for the restart terminal receipt or the runner exit instead of fixed 10 s and 15 s budgets (Refs #1577, Refs #1260, hub task 1033).
41
+ - Verify Claude Code 2.1.328 and 2.1.329 as headless implementers with isolated model-free transport and wrapper receipts (Refs #888, hub task 1023).
42
+ - Read only the slice of `events.jsonl` a closing task needs when the live research writer builds its record, with the same row as `ahub research backfill` (Refs #1555, hub task 1003).
43
+ - Cache the memory sync policy version on the profile fence's stat tuple and stop asking the store for `bridgeStatus` there, so an unchanged home costs a stat per fence check instead of a full shard re-read (Refs #1545, hub task 1028).
44
+ - Allow a hub-managed worktree to be committed and checked before task handoff (Refs #1549, hub task 1018).
45
+ - Raise the ACP open-tool ceiling's default from the legacy 30 minutes to 60, and its cap to 120, because this repository's own instructions expect a gate run to wait up to 50 minutes (`dot remote verify --wait 50m`); a tool call that reports no progress for that long still ends the turn, and per-poll rearming and the watchdog floor are unchanged. A turn the ceiling cancels now names its cause: hub.log gets the ceiling and its minutes for a configured kind whose native diagnostics stay withheld, plus that peer's own launch (`ahub jcode`, or `ahub jcode --as <peer>` for an extra instance) and the held queue row the person settles, and a private turn's tool titles stay withheld with them (Refs #1601, hub task 1046).
46
+
7
47
  ## 0.44.0
8
48
 
9
49
  - Release N-1 for 0.44.x is published 0.43.0, with exact agent-mem 0.29.0 and control protocol 17 (descriptor floor 16). The N-1 fixture and matrix pin that package; the separate protocol-16 fixture stays at 0.25.0. The isolated compatibility fixture covers old clients and plugins against the new daemon and new clients and plugins against the old daemon; it does not prove live-agent, rollback, or shared-home compatibility. The protocol window and CLI forms are unchanged; the backlog pull MCP description now explicitly names planner-only authority. This release pins agent-mem 0.30.0 and does not automatically raise the memory home or sync format floor; compatibility after a person raises a floor requires separate verification.
package/README.md CHANGED
@@ -5,7 +5,7 @@ Code, Codex, Kimi Code, Pi and a hub-owned local worker (plus Qwen Code, Jcode a
5
5
  Antigravity if you want them) share a message bus, a task board and a memory, each
6
6
  connected through its own native interface.
7
7
 
8
- Status: 0.44.0, control protocol 17 (accepts 16). Bun + TypeScript, one loopback daemon per
8
+ Status: 0.45.0, control protocol 17 (accepts 16). Bun + TypeScript, one loopback daemon per
9
9
  project. Site: [agent-hub.staix.net](https://agent-hub.staix.net).
10
10
 
11
11
  Inspect bounded task and attempt metadata with `ahub lineage show`; admit external
@@ -132,7 +132,7 @@ including [a new project with SDLC advise or enforce](docs/quickstart.md#a-new-p
132
132
  ([guidance probes](docs/design/guidance-probes.md)).
133
133
  - **Shared memory.** Decisions, contracts, fails and findings are kept through the
134
134
  first-party [`@staix/agent-mem`](https://github.com/STAIxBWLB/agent-mem) library,
135
- in process with no claude-mem worker (short- and long-term tiers, a typed graph,
135
+ in process (short- and long-term tiers, a typed graph,
136
136
  git sync between machines). Agents get
137
137
  it as a recall preface, as briefs on a task, and through bounded search tools.
138
138
  Managed headless peers can save compact `amem:` records from final answers; the
@@ -222,18 +222,13 @@ Live checks that still need a real account or a person are listed in the
222
222
  | [Security notes](docs/security.md) | what the hub defends and what it does not |
223
223
  | [Design spec](docs/specs/2026-09-19-agent-hub-design.md) | how it is built and why |
224
224
  | [Smoke checklist](docs/smoke.md) | what has been verified against real agents |
225
+ | [Influences](docs/influences.md) | projects whose features informed agent-hub |
225
226
  | [Changelog](CHANGELOG.md), [Contributing](CONTRIBUTING.md) | releases and how to contribute |
226
227
 
227
228
  Coding agents that work on this repository follow [`AGENTS.md`](AGENTS.md) and
228
229
  [`docs/agent-notes/`](docs/agent-notes/).
229
230
  The managed agent guidance explains the marker-only no-reply path for a delivery that needs no answer (#1550).
230
231
 
231
- ## Origin
232
-
233
- The first idea came from [agent-bridge](https://github.com/raysonmeng/agent-bridge),
234
- which lets Claude Code and Codex talk to each other. agent-hub has since grown into a
235
- different system with its own goals and shares no code with it.
236
-
237
232
  ## License
238
233
 
239
234
  MIT
@@ -47,7 +47,7 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
47
47
  - A peer must set `busy` synchronously inside `deliver()`, otherwise the bus drains the next envelope into a running turn (Kimi answers `turn.agent_busy`). Outside a turn the adapter accepts an occupancy diagnostic (a `context-used` `usage_update` naming its current session) and nothing else: no token total, no chunk, nothing unnamed or for an offline peer (#285).
48
48
  - A watchdog-cancelled turn still reports later. Anything a turn does on completion must check it is still the current turn (`turn` generation in `acp.ts`, `activeTurns` in `codex-appserver.ts`). A rejected prompt other than a recognised quota refusal, or an abnormal prompt end, reports through the adapter's `onTurnFailure` (same shape in `acp.ts` and `pi.ts`), even when ACP streamed partial text; a stale cancelled turn never reports it; a rejected watchdog-cancelled ACP prompt during its journal-less wait is discarded with one log line, not requeued as on the earlier adapter.
49
49
  - After an ACP watchdog cancels a prompt on a bus without a journal, keep the peer busy with its inactivity watchdog cleared until that prompt settles; suppress its turn-scoped updates and permissions while still accepting session-bound occupancy diagnostics. Bound the wait by the existing 30 s ACP handshake deadline, go offline, never idle, with queued work retained if it expires, and revoke the wait on stop or transport loss; a durable delivery keeps its existing offline/needs_review path.
50
- - ACP tool ceiling (#542): a tool call announced (`tool_call`) and not yet `completed` or `failed` in the current turn keeps a silent busy turn alive past the watchdog, up to `AcpOptions.toolCeilingMs` (never below the watchdog) counted from the last protocol message. Re-arm with `touch(<remaining ceiling, at most the watchdog>)`, never a full extra watchdog, and clear the open calls at each `deliver()`. Past the ceiling, cancel as an ordinary watchdog; its log line names the open tools only on a turn that is not private (latch `isPrivateTurn`, fail closed when it throws), each title as one sanitized, quoted, cut line. The daemon passes `toolCeilingMs`, `activityBatchMs` and Jcode's `steerTimeoutMs` from `adapterOperationalReaders` (`adapter_timing.*`, #982) only when it constructs an adapter; an adapter never reads config itself, and an accepted edit never retimes a running launch.
50
+ - ACP tool ceiling (#542): a tool call announced (`tool_call`) and not yet `completed` or `failed` in the current turn keeps a silent busy turn alive past the watchdog, up to `AcpOptions.toolCeilingMs` (never below the watchdog) counted from the last protocol message. Re-arm with `touch(<remaining ceiling, at most the watchdog>)`, never a full extra watchdog, and clear the open calls at each `deliver()`. Past the ceiling, cancel as an ordinary watchdog; its log line names the open tools only on a turn that is not private (latch `isPrivateTurn`, fail closed when it throws), each title as one sanitized, quoted, cut line. Fire `onToolCeiling({ ceilingMs })` before that line and the cancel; it carries the number only, and the daemon turns it into the host sentence for a kind whose adapter log is withheld (Jcode, `jcodeToolCeilingCause(ceilingMs, peer)`, #1601), so never add a title or native text to it. The daemon passes `toolCeilingMs`, `activityBatchMs` and Jcode's `steerTimeoutMs` from `adapterOperationalReaders` (`adapter_timing.*`, #982) only when it constructs an adapter; an adapter never reads config itself, and an accepted edit never retimes a running launch.
51
51
  - Native capability listings (#445 C1, #985): keep vendor identities and listing shapes in `src/adapters/native-capabilities.ts`, never in `src/hub/capabilities.ts`. `capabilityManifest` lists only on a `NATIVE_PINS` version; any other version returns an empty manifest, never a guess, and a transport failure rejects rather than showing a stale list. Codex `skills/list` uses a negative hub id, and only `enabled: true` skills are listed. ACP keeps `available_commands_update` lists that arrive during `binding` keyed by session (`earlyCommands`, at most `EARLY_COMMANDS_MAX`), and the bind adopts only the bound session's list (#567).
52
52
  - Retire a cancelled Codex native turn until its exact completion or session teardown. Late start acceptance, answer frames and completion must not revive its audience or relabel uncertainty as `failed_safe`. If cancellation has no provable native id, keep the peer offline until verified reattachment.
53
53
  - Codex: the adapter never sends its own `initialize`. It is a proxy; hub requests use negative ids and their responses must not reach the TUI.
@@ -80,7 +80,7 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
80
80
  - Tag a Pi hub-tool refusal only at a proven pre-effect guard with `PreEffectToolRefusal`; return its exact error and settle its receipt. Never classify a generic/post-effect/storage failure or a legacy pending receipt from error text or current board state. After durable `markStale`, cancellation or output consumption, retain ordinary failure classification; a later binding/privacy rejection cannot prove that no effect occurred. Recheck task revision, owner/session generation and privacy across awaited bounded spec/check operations; never turn those tools into arbitrary host execution.
81
81
  - Version gate (#843): `PiPeer.startImpl` first awaits the preflight the production factory `createPi` passes as a separate constructor argument (keep it out of `PiOptions`: transport option identity), which runs `piVersionAsync` on the exact configured `pi.cmd` plus `--version` (owned group, 64 KiB, 10 s) against compat `pi`. Only a `PiVersionRefusal` reaches the caller as is (sanitized, 1000 characters); never wrap another start error in it. A fake Pi in a daemon fixture answers `--version` with a verified version.
82
82
  - Report each Pi owner exit once, with code/signal (unknown for an unobserved TUI exit), turn/tool activity and only the last tool name. Auto-restart only a current, started, unexpectedly idle headless owner on its verified persisted session, once per 60 s; preserve shutdown/requested-stop/recovery/startup/active-tool fences and never fall back fresh.
83
- - Keep Pi owner identity on the shared `processSignature`/`processLiveness` contract exported by the exact-pinned package's Node-safe `@staix/agent-mem/platform` entry, re-exported unchanged by `src/pi/process-signature.ts` for the startup claim, extension claim, TUI owner monitor, `recoveryReady` and verified teardown. Memory's `sync.lock` uses the same implementation. Preserve the Node-safe process-entry regression in `test/memory-parity.test.ts`, the existing Pi process behavior tests, the LC_ALL=C/TZ=UTC `ps` read and strict pid + start + command identity; never accept PID-only or a fuzzy command match.
83
+ - Keep Pi owner identity on the shared `processSignature`/`processLiveness` contract exported by the first-party package's Node-safe `@staix/agent-mem/platform` entry, re-exported unchanged by `src/pi/process-signature.ts` for the startup claim, extension claim, TUI owner monitor, `recoveryReady` and verified teardown. Memory's `sync.lock` uses the same implementation. Preserve the Node-safe process-entry regression in `test/memory-parity.test.ts`, the existing Pi process behavior tests, the LC_ALL=C/TZ=UTC `ps` read and strict pid + start + command identity; never accept PID-only or a fuzzy command match.
84
84
  - Return the shared `toolResultFailed` verdict as `/tool`'s `failed`; map only `failed === true` to Pi's `isError`. Preserve text and the older bridge's absent-flag behavior. The one exception is a person's `!command` whose process exit was observed: its `failed` is `exitCode !== 0` and the reply carries `exitCode`, from `onProcessExit` through `packPiShellResult`, never parsed from the output (#253).
85
85
  - Pi's bridge executes `/tool` only for the verified owner (`verifiedOwner()`: the claimed pid with its `processSignature`; a headless owner is pinned from the spawned process once `get_state` proved its session) with the current `sessionId` and turn `generation`, and admits `/budget` only for that owner and generation, checked again after the awaited admission. Refuse anything else before execution. `tool_abort` aborts that pending call, or fences its id when it arrives before the call (64 ids a turn, then every further call of that turn). A person's `!command` (`purpose: "idle_user_bash"`) is taken only in TUI mode from an idle owner on its one-use reservation, and it alone skips `piPermit`: never widen that to a model's bash call (#253).
86
86
  - Emit Pi's ceiling event at the pre-effect rejection boundary (`src/pi/ceiling.ts`), before `agent_end`. Accept only a valid current-session/current-generation signal during a running turn; retain the first signal and attach it to that turn's failure. Never classify a ceiling from free text. At `agent_settled`, mark a ceiling delivery completed with `ceiling steps <count>/<limit>` and pass `settledCeiling: true` only when that turn failed without cancellation, withdrawal or an execution/approval budget stop, and no managed tool was pending when the ceiling arrived or remains pending. Latch tool uncertainty at the ceiling even if tools settle later. Keep every other failed delivery held; never replay it. Observe explicit stop/recovery, roster or personal withdrawal and cancelled settlement once per logical turn through `onTurnAborted`, without failure handoff; internal model-failure teardown suppresses that observation. Call `onTurnSuccess` only for an actual nonerror, noncancelled settlement, never a ceiling.
@@ -118,7 +118,7 @@ Scope: the operator console, control WS and its protocol, state files, the dashb
118
118
  - `native_hook_launch` (#543) is console-only and needs a definition with `hooks.factsHook`; one launch per peer. Refuse `begin` during recovery or shutdown, off roster or while the peer is attached. `end` needs the matching `launchId` and is the only request besides `status` and `kill` a stopping hub admits; closing the launcher's socket ends its launch. Both settle an open run `interrupted` once. Accept `native_facts` only from the tools role for the current `instanceId` and `launchId`, the latched native session and socket generation, and workspace paths whose `realPath` is the project. When a launch records `nativeHome`, its transcript index must be exactly `<nativeHome>/session_index.jsonl`. Close a `ws-pull` peer's hello without `channel: false` with 4403.
119
119
  - `native_tui_launch` (#464) is console-only and resolves only a running owned `JcodePeer` under its own kind id (`tuiLaunch`). Refuse it while stopping, during recovery, off roster, during that peer's roster change or requested stop, or when `jcodeMcpReady` fails against the daemon's `SERVER_JS`; a `binding` must name the current `launchId` and `sessionId`. Failures answer fixed errors with details withheld (a `JcodeOptionMismatch` names only the flag in `option`, #559) plus one closed cause `code` (a `JcodeTuiRefusalCode`, or `hub_busy`, `not_running`, `mcp_stale`, `bad_request`), logged as one `hub.log` line (#1093), and the launch tuple (socket, env) goes only into that console reply, never into `status`, `status.json` or a log. A launcher sends it only when the hub's `features` list `native_tui_launch`.
120
120
 
121
- - When preserving a recovery source, copy only the exact-pinned `@staix/agent-mem` package through `preserveRuntimeDependencies` in `src/cli/recovery-package.ts`; include its identity and bytes in `packageDigest`. Never copy the whole node_modules tree or link a preserved source to a mutable installation. Verify preserved sources with `ownDependencies: true` so a missing or symlinked memory copy cannot resolve an ancestor installation. Verify staged releases with `dependencyRoot` bound to their retained install directory; never resolve beyond it. Keep no-dependency release digests compatible.
121
+ - When preserving a recovery source, copy only the hub's declared `@staix/agent-mem` package through `preserveRuntimeDependencies` in `src/cli/recovery-package.ts`; include its identity and bytes in `packageDigest`. Never copy the whole node_modules tree or link a preserved source to a mutable installation. Verify preserved sources with `ownDependencies: true` so a missing or symlinked memory copy cannot resolve an ancestor installation. Verify staged releases with `dependencyRoot` bound to their retained install directory; never resolve beyond it. Keep no-dependency release digests compatible.
122
122
  - Release checker and committed release policy (#1120, #1381): `scripts/check-docs.mjs` is the one file outside `RUNTIME_ASSETS` that a capture carries (`RELEASE_CHECKER` in `src/cli/recovery-package.ts`, copied only when the source has it and refused when it is not a regular file), and `captureLayout` in `src/hub/runtime-capture-prune.ts` accepts an optional `scripts/` holding exactly that file, so captures made before #1120 still prune. It is deliberately not in `packageDigest`: widening the digest makes every already-staged release refuse as "cached release changed". `readDocEvidenceDetailed` returns `{ unavailable }` for a missing or failing checker and `ReleaseAuthorizations` turns that into its own refusal; only evidence that was read and is not fresh may say "stale documentation". Keep its spawn arguments unchanged (seed `release-committed-doc-metadata`). For the complete policy, receipt and `releasePolicyNotices` contract, read `tasks.md`'s Release authorization rule when changing that boundary. The production `ReleaseAuthorizations` host port in `daemon.ts` reads policy from the candidate commit; keep that injected port fail-closed.
123
123
 
124
124
  - Render staleness only through the call-scoped privacy preflight and bounded metadata probe (`memory-staleness.ts`); on a tree not modified during the call, private/denied/observed-symlink/unknown paths never produce a marker. Retain the explicit same-user concurrent-swap ceiling in docs/memory.md and the probe-loop ponytail. Keep hints out of stored rows and route native brief decoration after selection so one batch shares its probe budget.
@@ -10,7 +10,7 @@ Scope: the hub-native local worker, its tools, path guard, denylist and seatbelt
10
10
  - The sandbox denies home reads by default (toolchain dirs, the project and its real git dir excepted) and all network, loopback included: claude-mem and the Codex app-server listen on loopback without auth. Tests that bind a local port therefore fail when the worker runs them, also with `local.bash_network: true` (the egress proxy keeps loopback closed, and the proxy variables send a test's plain-HTTP `fetch` to the proxy, which refuses it); that is the intended trade-off, and `"direct"` is the switch until a later release removes it.
11
11
  - The seatbelt profile refuses the `.git` name itself at any depth (creation, rename, symlink, gitfile), `config`, `config.worktree` and `hooks` directly under it, `commondir` at any depth below it or below an external git dir, and `.agenthub` anywhere in the project, every name folded against the 16 code points HFS+ ignores (#270). Every `modules/` tree the project can reach (the common dir's, the worktree's own, every linked worktree's under `<common>/worktrees/<wt>/modules/` as a pattern so a tree or worktree that does not exist yet is covered, #518, and each discovered submodule's own `modules/`) refuses EVERY write that is not inside a discovered submodule git dir (#520): nothing is exempt by name, so a fake git dir called `refs`, `logs` or anything else cannot be planted for a later unsandboxed `git submodule update --init` to reuse. Inside each discovered git dir `D` the refusals are anchored to `D`: `D/config`, `D/config.worktree` (folded in both halves), `D/hooks` and what is below it, and `D/worktrees/*/config.worktree`, with `D/worktrees`, each `D/worktrees/<name>` and `D/hooks` refused as directory entries too, so none can be moved out, edited and put back; a submodule's own linked worktrees keep a `modules/` of their own at `D/worktrees/<name>/modules`, which gets the same everything-not-discovered refusal by pattern (so one that does not exist yet is covered) and has its `modules` entry refused as a target; `D/logs`, `D/objects` and `D/index` stay writable, and since #1123 `D/refs`, `D/packed-refs`, `D/HEAD` and `D/worktrees` are refused like the project's own (`gitRefRules` gets the discovered dirs), so commit, branch, tag and rebase fail in a submodule too, and a submodule really named `refs` or `logs` is protected like any other. `hooks` is anchored by path depth (`hooksUnder`), never by an unanchored any-prefix name, which also matched a project under a directory named `hooks`. The worktrees container and each worktree git dir are refused as directory entries too (otherwise an ancestor can be moved out of the protected path, edited and moved back), and so are the discovered git dirs, the modules root and the components in between (rename, replace, symlink, recreate). Keep every regex literal under 1024 bytes (UTF-8 bytes, not characters), and never put the git path and a folded name in one literal: the root is its own `require-all` filter, so the folded literals are the same size at any path length (`test/sandbox.test.ts` asserts it). Known residuals: a nested repository in bare layout (the hub never runs git there; docs/security.md), folded spellings of the components between `.git` and a submodule's git dir on a volume that folds names (the 1024-byte SBPL literal cannot hold a folded path; external git dirs carry the same residual since #270), and the submodules of a repository nested inside the project (only the project's own common dir is discovered). An external git dir's `config`/`config.worktree`/`hooks` rules, and the pattern rules for every linked worktree git dir under `<common>/worktrees/`, cover only its own children plus the hooks directory's contents: at any depth they would deny refs named `config` or `hooks` in a worktree or submodule project. The fold is a group alternation, never a character class (the seatbelt regex engine is byte-oriented and a quantifier after a multi-byte class member binds to its last byte), and every pattern keeps its `^` anchor (an unanchored starred alternation does not match). Folded literals never contain the project root: an SBPL string literal dies at 1024 bytes. The cost: `git init`, `git clone` and `git worktree add` do not run inside the sandbox, and neither do `git worktree remove`, `git worktree prune` of a stale record, `git clean -ffd` with a nested repository, `git submodule update --init` (its git dir's `config` write is refused), or `rm -rf` of a directory holding a `.git`.
12
12
  - The shared object store `<common>/objects` takes only NEW loose objects from a sandboxed command (`objectStoreRules` in `src/local/deny.ts`, #864): every write under `objects/info` (alternates, http-alternates, commit-graph) and `objects/pack` is refused, so are the `objects`, `objects/info` and `objects/pack` entries, the unlink or rename of a fan-out directory, and data, unlink, mode and flags writes to an existing loose object. Keep loose-object creation allowed (sandboxed `git add`, `commit`, `stash` need it) and never reopen packs or `objects/info` for a sandboxed command: git reads packs before loose objects and never rehashes on read, so either one replaces content that every checkout and the #845 host add/commit/push trust. `test/sandbox.test.ts` "(#864)" proves it with the real sandbox-exec. The cost: `git gc`, `repack`, `fetch`, `maintenance` and `commit-graph write` run outside the sandbox. A hardlink to an existing loose object is refused too (into the project and into the command's own temp dir); keep that case in the test. Residual: an object id that does not exist yet can be planted before git writes it; a local checkout then shows the planted bytes, and a push of that commit is rejected by the receiving side, which rehashes what it receives ("missing necessary objects"). The upgrade path is host-side git writes as in #845.
13
- - Build every git invocation outside the sandbox through the single implementation exported by exact-pinned `@staix/agent-mem/platform` (`memoryGitArgv`/`memoryGitEnv`/`memoryGitSync`), re-exported as `hubGitArgv`/`hubGitEnv`/`hubGitSync` by `src/hub/git.ts`. Keep the git export identity, behavior and direct-spawn tripwire checks in `test/hub-git.test.ts` passing; retain home compatibility and Node-safe process-entry checks in `test/memory-parity.test.ts`. The sandboxed git tool in `src/local/tools.ts` retains its own behavior. Use `{ credentials: true }` only for the memory repository the hub creates itself, never a project's repository. Use the core deny policy re-exported by `src/local/deny.ts` for guards, sandbox rules and capture; do not add another denylist.
13
+ - Build every git invocation outside the sandbox through the single implementation exported by the first-party `@staix/agent-mem/platform` entry (`memoryGitArgv`/`memoryGitEnv`/`memoryGitSync`), re-exported as `hubGitArgv`/`hubGitEnv`/`hubGitSync` by `src/hub/git.ts`. Keep the git export identity, behavior and direct-spawn tripwire checks in `test/hub-git.test.ts` passing; retain home compatibility and Node-safe process-entry checks in `test/memory-parity.test.ts`. The sandboxed git tool in `src/local/tools.ts` retains its own behavior. Use `{ credentials: true }` only for the memory repository the hub creates itself, never a project's repository. Use the core deny policy re-exported by `src/local/deny.ts` for guards, sandbox rules and capture; do not add another denylist.
14
14
  - SBPL strings go through `sbplString` (the plain `"..."` form). In the raw `#"..."` form a backslash escapes nothing, so a `"` in a path ends the literal and the whole profile fails to parse.
15
15
  - Seatbelt sees absolute paths, so `local.deny` entries are anchored under the project root.
16
16
  - `guardPath` walks with `lstat`, never `existsSync`, which follows symlinks.
@@ -40,7 +40,7 @@ Scope: the security pass of a review (`REVIEW.md`), and any change under `src/lo
40
40
  - When reviewing Pi dependency preparation, also check the Pi dependencies rule in `docs/agent-notes/adapters.md` and the Pi prepared dependencies section in `docs/security.md`.
41
41
  - Workflow actions are pinned by commit SHA with the version in a comment; `test/workflow-pins.test.ts` refuses a tag. Workflow `permissions` stay at the minimum each job needs (`.github/workflows/`).
42
42
  - The dependency volume key covers everything that decides `node_modules` (`dependencyKey` in `src/hub/check-runner.ts`); a manifest with an install lifecycle script is refused, never keyed. Never add `--ignore-scripts` or a writable shared cache to make a run pass.
43
- - Runtime dependencies stay at zero third-party packages; `@staix/agent-mem` stays exact-pinned.
43
+ - Runtime dependencies stay at zero third-party packages; `@staix/agent-mem` stays on a declared range (`>=X.Y.Z <M.0.0`, floor 0.33.0 or later), so a plain in-range release with a supported host API ships without a hub change and a new major needs a reviewed raise.
44
44
  - Publishing happens only in the tag workflow through trusted publishing; the guarded tag (`scripts/release-tag.ts`) needs the person's consent. A change that adds a token, a second publish path or a way around the consent check is Important.
45
45
 
46
46
  ## A security audit turn
@@ -28,6 +28,7 @@ Scope: the task flow, assignment, the state machine and the hub's MCP tools. Rea
28
28
  - Planned start (#1092): `plannedStartPending` (`src/hub/task-sweep.ts`) is the only test that a card's `plannedStart` is still ahead. Every automatic path skips such a card: dependent readiness, `backlog_ready` notices, the reserved-ready pick, auto pull and its `guard`, a hub-actor (`by === HUB`) offer, pull or assign of an ownerless backlog or proposed card, and the idle sweep. The planner digest shows it as `scheduled`. A new automatic path asks it too.
29
29
  - Per-head CI watcher (#785 P1b, `src/hub/ci-watch.ts`, `Tasks.watchCi`, `ciCompleted`, `reofferHeldReview`): when a `done` leaves a review whose admission was not ready at the task's exact full-commit head (or a review is held as premature in `sendReview`), `CiWatchers` starts at most one watcher per task and head, with chained unref'd `setTimeout`s and no interval. Each poll is one `gh pr view` through the `sdlc.gh` port (`pollCi`); `latestCheckRuns` drops older rows only when a same-name check has the same workflow identity and a unique latest start time, otherwise duplicate evidence remains. A cancelled check and a draft PR's deliberately deferred `check (macos-latest)` failure are pending, not failed, and so is an older macOS aggregate failure while a newer same-workflow `check (macos-latest) shard N/M` is queued or in progress with a later start (`awaitingDeferredReplacement`, #1490); missing ordering or workflow evidence stays a failure; other required failures remain failures. It ends on a passed result for the required checks, on `CI_WATCH_DEADLINE_MS`, on `stopCiWatchers` (daemon `stopOnce`), or silently when `ciWatchCurrent` fails (the task left `in_review`, its head or PR changed, the lifecycle is off, it turned private). `complete`, `review` (both verdict writes) and `cancel` cancel it. Each (head, outcome) is told once (`settled`), and only `passed` settles a head for good (#540): after `failed` or `incomplete` the watcher keeps reading for a rerun of that head (the first pending read after each newly told result is a new run attempt and renews the deadline once; later pending or unreadable reads and an unchanged failed result never renew it, so the watcher always ends; a deadline after a told result ends silently), and a later `hub_task_done` at that head starts one again. A newer head replaces the watcher. The result is one ids-only `ci_completed:` task envelope at `status` weight to the owner and the reviewer (`fyi` is never delivered to a peer, so it would not reach them), a console notice for `user`, and for a deadline a console notice only. A passed or incomplete result re-offers a review held as premature once (`heldReviews`, keyed by task, head, reviewer and review revision) after a fresh `reviewRequestAdmission` says ready; a failed one re-offers nothing. No task text goes in the notice, no PII task is watched, and nothing is restored after a hub restart (the next `hub_task_done` starts one). Never add a second periodic gh read outside this watcher.
30
30
  - Required checks (#1344): resolve the names only through `requiredChecksFor` / `requiredCheckNames` (`src/hub/sdlc-merge.ts`, `src/hub/sdlc.ts`); the built-in `check (...)` and `seeded guards` set applies only to this repository, and an empty set elsewhere is a `required checks unknown` blocker, never a pass.
31
+ - Draft review (#1576): admit the failed macOS aggregate only with exact-head job-step proof of its draft deferral, a matching fresh PR snapshot and every other required check green. Only on that proven draft may approval defer missing GitHub approval and known outstanding review requests; preserve change-request and unresolved-thread blockers. Never treat that admission as a successful full gate or weaken merge and identical-tree proof.
31
32
  - Build-entry guidance (#1354, `buildEntryDiagnostic` in `src/hub/build-entry.ts`) is pure display data: routing and `route explain` may show it but never read GitHub or change eligibility because of it.
32
33
  - Merge adoption (#1348, `ahub sdlc adopt-merge`, `Tasks.adoptMerge`): only the person or the one configured conductor adopts an already merged PR; it writes `approved` with the `merged outside the hub` event and creates no reviewer verdict, review metric, reviewed-head receipt, guarded-merge result or GitHub mutation, and a private task or turn refuses before any GitHub read. Its bounded GraphQL check read uses `latestCheckRuns`: discard an older same-name row only when workflow identity and a unique latest start time prove which run is newest; preserve duplicate evidence when ordering is uncertain. Contract: `docs/design/task-board.md` "Merged PR adoption".
33
34
  - External merge readback (#1555, `Tasks.captureExternalMerge`, `settleMergeReadbacks`): host-only and read-only on GitHub, for an approved non-PII task whose repository merge mode is `off`. It writes `sdlc.mergeReadback` with the `merge observed` event and never `sdlc.merge`, a verdict or a GitHub mutation. Save `cost` only from a complete history read, and recheck the task, receipt and policy identity after every await before the write.
@@ -42,6 +43,7 @@ Scope: the task flow, assignment, the state machine and the hub's MCP tools. Rea
42
43
  - Conductor authority requires the explicit unique role before capability checks. The only exceptions run before that check in `Conductor.execute` and stay task-scoped: a task's current owner and reviewer read it with `hub_task_show` (#208; a reviewer-backend peer only during its bound review, rule below), and its proposer redirects it with `hub_task_assign` while nobody ever accepted it and no person moved it (#207). Removing them strands reviewers that missed a review request. Assignments preserve the acting peer. A peer releases only its own conductor hold; operator release and manual, quota and recovery holds remain separate paths.
43
44
  - The PII screen (#198) runs in `propose` before anything else reads the task (no board row, envelope, triage or brief before its verdict), and `unknown` is PII. A call that screens free text (`done`, `review`, `remember`) screens only after its own checks pass, and `done` and `review` run them again after the awaited screen, because the task can change meanwhile. A history entry marked `withheld` stays withheld in public views, completed notices and review requests, whatever `nameable()` says; `ahub ask` shows it only on campus, like a note that matches a PII pattern.
44
45
  - `taskOp` (`src/hub/daemon.ts`) lists full PII rows only when `onPrem` holds: an in-process peer whose definition sets `trust.onPrem` (only the local worker) inside a PII turn (#230). Every other caller, the local worker's ordinary turns included, gets stubs. `assign()` (`src/hub/routing.ts`) is the PII gate: it admits PII work only for `trust.onPrem`, and an unknown id is never on-prem. `relayCandidates` only orders the preferred handoff peers by the same field; never treat its order as the gate.
46
+ - A roadmap part accepted with `ahub roadmap decompose <id> --accept <part>` is the person's own intake hold, not a second state: `Tasks.roadmapDecomposePart` stages a `draft` backlog task through `propose` with the host Symbol `HOST_ROADMAP_DRAFT`, links it as a milestone `task`, and keys it by (answer, part) in `milestone_decomposition_accepts`, so a repeat returns the same draft. That Symbol is the only way a non-person stages a draft, and it still needs `backlog` and the configured planner or conductor; releasing it stays `ahub intake approve`, and the reply is `publicView`, so a private part reads `[pii]`. The accept is single-flight per (answer, part) through `decompositionAccepts`, so a concurrent accept reads the first one's row instead of making a second draft, and everything after `propose` runs through `releaseNotice`: never add a bare call to that tail, or a settled milestone would refuse a caller whose draft is already saved.
45
47
  - `review()` reads `escalateAfter()` (`tasks.escalate_after`, 1-10, default `ESCALATE_AFTER` = 3) at each `changes_requested` verdict, so a reload applies from the next verdict; never capture it at construction or compare against a literal (#488).
46
48
  - A guard in `tasks.ts` or `conductor.ts` passes `preEffect` (throws `PreEffectToolRefusal`, `src/hub/tool-refusal.ts`) only before the operation's first board or hold write; a throw after a write, a readback failure or a wrapped error stays a plain `Error` (#254). The Pi side of the rule is in `adapters.md`.
47
49
  - Supervision reasons use structured enums, never history notes, check output or approval titles. Round signatures survive restart; later summaries count only newly joined tasks.
@@ -131,7 +133,7 @@ Scope: the task flow, assignment, the state machine and the hub's MCP tools. Rea
131
133
  - Declared needs (#1081, 2026-11-02): `needs_network` and `needs_worktree` are task signals set only by an explicit `true` in `Tasks.propose` (never inferred from text). `assign()` in `routing.ts` reads each as a refusal code (`network`, `worktree`) against `PeerCapabilities.network` / `.worktree === false`, and `Tasks.declaredNeedCheck` repeats both at accept, before any write: that check is what stops a sandboxed peer from accepting work, failing at `git worktree add` (#270) and leaving an empty branch ref (#621, #565). `peerCapabilities` in `daemon.ts` is the only producer: unsandboxed peers are `true` for both, hub-sandboxed peers have `worktree` from `TaskWorktrees.available()` (#1115: true only where the hub can make the worktree, else false with its cause and next step) and `network` from `sandboxNetwork !== false` (the one `local.bash_network` setting). Unknown (no entry) is never a refusal. Keep the four lists together when you add a need: `RoutingRefusalCode`, `TASK_STALL_CODES`, the `requireCapabilities` filter and `declaredNeedCheck`.
132
134
  - Hub-made task worktree (#1115, 2026-11-02, `src/hub/task-worktree.ts`): `Tasks.accept` calls `hubWorktreeFor` right before `acceptanceCapacity` and the accept write, only for a hub-sandboxed owner (`TaskWorktrees.applies`), a non-PII task, and write-class work (`writesRepository(task.class)` in `routing.ts`: `implement` and `bulk_edit`, #1129) or a declared `needs_worktree`, and clears it again (`undoWorktree`) when anything throws before the write. `Tasks.decline` and `Tasks.cancel` call `releaseHubWorktree` after their board write. The daemon's `hub_task_done` case calls `tasks.worktreeHandoff` BEFORE `tasks.done` and passes its `{ commit, branch }` refs on, so `Tasks.done` itself is untouched and its head gates see an ordinary full-SHA refile; keep the hook out of `done`. The sandbox profile is not changed by this hook. Since #1123 it refuses ref, HEAD, packed-refs and worktree-admin writes, so a sandboxed peer cannot commit at all and the hub's commit is the only one; still never trust what is under `.git`, and commit only when the branch tip equals the recorded base or the hub's own last commit (the record lives in `<state>/task-worktrees.json`, which no sandbox root contains), because a rule can be loosened later and a same-user process is outside the sandbox. Since #1129 the hook covers every write-class task, so a hub-sandboxed owner of `implement` or `bulk_edit` work always has a hub worktree and a hub commit; keep `writesRepository` the one definition that routing and `Tasks` both read.
133
135
  - Focused-check dependency preparation (#1447): after a task is accepted, the hub may prepare the task worktree's dependencies and report a fixed prepared/not-prepared result in that owner's task context. Preparation is advisory; do not treat it as a check result or replace the remote/full verification gates.
134
- - Roadmap milestones and placement (#1479/#1481): `docs/design/roadmap.md` is the contract. `Board` stores rows and links; every external write goes through `Tasks` with revision and privacy checks. Triage suggestions are inert until accepted; GitHub import is person-only and dry-run by default. Keep private membership count-only and preserve the recovery compatibility check.
136
+ - Roadmap milestones and placement (#1479/#1481): `docs/design/roadmap.md` is the contract. `Board` stores rows and links; every external write goes through `Tasks` with revision and privacy checks. Triage suggestions are inert until accepted; GitHub import is person-only and dry-run by default. A decomposition (#1480 R2 part 1) is inert too: a part is kept only when it cites an id the prompt offered, and nothing reads `milestone_decompositions` until a later R2 part intakes one. Keep private membership count-only and preserve the recovery compatibility check.
135
137
  - Pi step-ceiling escalation (#1447): `step_limit` is a distinct task-move reason from `inference_failed`; only a settled ceiling can receive the bounded, acceptance/session-bound continuation. See the dogfood row for coverage and live-proof limits.
136
138
  - Paged `hub_task_list` (#1083, 2026-11-02, `src/hub/task-list-page.ts`, the `hub_task_list` case in `daemon.ts`): an agent (`by !== USER`) always gets `{tasks, total, next?}` and the console gets the bare array unless it names `limit`, `cursor`, `ids` or `detail`; keep that split, because `ahub board`/`ahub tasks` and `test/cli-json-guard.test.ts` read the array. Build every row with the existing `listRow` (it starts from `tasks.publicView`, so PII stays a stub and the `board-column-started-projection` seed text is unchanged) and only then reduce it with `compactRow`; never build a compact row from the raw `Task`. The cursor is a keyset (`updated.id`), not an offset. A new caller of `hub_task_list` as a peer reads `.tasks`, or passes `ids` for one task. Do not raise the 200 cap or the default 50 without re-running the 600-task size test.
137
139
  - Urgent accept and the WIP refusal (#1080, 2026-11-02): `acceptanceCapacity` takes an `urgent` mode, and only `accept` passes `"displace"`; `acceptReviewed` and the early check in `accept` pass `"check"`, which never writes. `displaceOffers` runs immediately before the accept write, after every gate (spec, plan, study), so a refused accept can never have taken back an offer. It takes back only offers the owner never accepted (`displaceable`: state proposed, owned, not pinned, not urgent, no `taskHasStarted`), newest handed first, and only as many as the limit needs; if they are not enough it takes none and refuses. The refusal comes from `wipSplit` and names accepted, offered and reserved separately, with a next step. Do not widen `displaceable` to accepted or urgent work, and do not call the displace mode from any other path.
@@ -9,7 +9,7 @@ Scope: tests, fakes and the test gate. Read before adding or changing a test or
9
9
  - A fixture that walks a policy table (a `COMPAT` entry list, a registry) derives its per-entry values from the table, never a fixed list of keys or versions a planned entry is not in: the compat watch test builds every served version and the ahead/unknown row from `COMPAT[id]`, so an added entry (`pi`, #843 AC2) is covered without editing the test.
10
10
  - Tests that are not about batching build the bus with `batchMs: 0`; with the default 15 s window a lone status envelope looks like a lost message.
11
11
  - A test that writes an executable shim and then times a product call through it (a `git` wrapper on `PATH`, as `test/memory-code-head-684.test.ts` does) runs the shim once by absolute path first, outside the measured region: the first exec of a newly written executable costs about 250 ms on macOS (#519). Never widen the product's bound or weaken the assertion for it.
12
- - A test timeout that fires while `Bun.spawnSync` runs can start the next test inside spawnSync's own event loop (Bun 1.3.14 and 1.4.2; not rechecked on 1.4.4; background: README). `scripts/check.sh` runs tests with a 20 s timeout and under `scripts/hang-watch.sh`; a test that spawns and reads the process table gets a timeout of its own, never above 20 s: an explicit larger timeout overrides the gate's `--timeout 20000`, so shorten the scenario instead.
12
+ - A test timeout that fires while `Bun.spawnSync` runs can start the next test inside spawnSync's own event loop (Bun 1.3.14 and 1.4.2; not rechecked on 1.4.4; background: README). `scripts/check.sh` runs tests with a 20 s timeout and under `scripts/hang-watch.sh`; a test that spawns and reads the process table gets a timeout of its own, never above 20 s: an explicit larger timeout overrides the gate's `--timeout 20000`, so shorten the scenario instead. Narrow exception (person's ruling 2026-11-20, #1577): a test that must keep a real multi-second process may set its own timeout above 20 s only when its body has a deadline, every cleanup wait is bounded, and the body deadline plus the cleanup bounds stay below the test timeout, so the timeout can never fire inside a `spawnSync`. The instances are `test/conductor-recovery-process.test.ts` (60 s: 30 s body deadline, post-receipt waits of 6 s each, cleanup waits of 3 s each) and `test/staged-project-isolation.test.ts` (90 s: 45 s body deadline, cleanup waits of 6 s each; its body keeps two real daemons and a real upgrade CLI child and took 14.7 s in a green macOS shard run, so the gate's 20 s left no room for a slower one).
13
13
  - Sandboxed commands and the MLX server get a fixed environment (`PATH`, `HOME` and their own keys), so test knobs for their fakes travel in a wrapper script or argv, not in `process.env`. Daemon-owned peer children use `peerChildEnv`, which drops `ORCA_*` and replaces agent identity markers; a person-owned native launch preserves only its own pane's `ORCA_*` context while dropping inherited agent identity.
14
14
  - Bind agent identity markers explicitly in native/CLI fixture children. The full gate starts the test runner without inherited agent markers (including `AGENTHUB_DELIVERY_ONLY`) and without an `ahub claude` session's hub variables (`AGENTHUB_PROJECT_DIR`, `AGENTHUB_STATE_DIR`, `AGENTHUB_INSTANCE_ID`, `AGENTHUB_LAUNCH_ID`); a new variable a native session exports and a fixture child reads joins that `env -u` list in `scripts/check.sh`. Never weaken production marker detection to make them pass.
15
15
  - A fixture that spawns the real channel plugin (`src/adapters/claude-channel.ts` or `plugins/agent-hub/server.js`) to act as a peer runs it with `cwd` at the hub's project root, made with `realPath` (the macOS temp dir is a symlink). The plugin chooses its hub through `channelProject` (rule: `daemon.md`), so from another cwd it joins the wrong hub, joins as a distinct session or connects nowhere. Only tools mode with both `AGENTHUB_STATE_DIR` and `AGENTHUB_PROJECT_DIR` set skips that check. A fixture whose plugin must push as a channel (not fall back to tools mode) injects the parent row with `syntheticClaudeParentEvidenceSetup()` (`test/fakes/claude-channel-parent.ts`, #1171), which replaces only `claudeParentCommandPort.read`; the production marker and classifier still run, so never stub `classifyClaudeParentCommand` or skip the evidence check. For an unchanged published bundle with an inlined observer port, use the published-leg raw port-fact injection in `test/published-protocol-compat.test.ts`: bootstrap its import with Bun's built-in `mock.module` only for `child_process` and `node:child_process`, export the real functions and replace only `spawnSync` for `/bin/ps -ww -p <direct-parent-pid> -o command=`. Return `SYNTHETIC_CLAUDE_PARENT_COMMAND` from the same fixture helper and delegate every other call. Preserve the bundle bytes, classifier, inherited marker, parent-identity check, assertions and timeouts. This synthetic host observation is not native-launch acceptance. A second opted-in session attached while a fixture owner holds the peer stays a standby (#1174): close the owner and wait for offline before attaching the session under test (`test/channel-inbox-daemon.test.ts`).
@@ -39,6 +39,7 @@ Scope: tests, fakes and the test gate. Read before adding or changing a test or
39
39
 
40
40
  - `scripts/check.sh` pins the test environment (#610): `GIT_CONFIG_GLOBAL=/dev/null`, `NO_COLOR` unset, `TERM=xterm-256color`, temp root under the OS per-user temp dir, agent markers cleared. A test that needs a person's git config or color settings sets them itself. `--changed` selects tests with `scripts/changed-tests.mjs`: changed tests (nested suites included) plus every test that names a changed file directly; docs need none; any other changed file no test names, and any gate, package or shared-fixture change, runs everything.
41
41
  - `scripts/check.sh` holds the repo's heavy-job slot (`<git common dir>/ahub-heavy.lock`, #398) for the whole run, so a test never runs the real gate; `test/check-lock.test.ts` runs a copy in a scratch repo.
42
+ - A red gate names its step (#1577 entry 3): `scripts/check.sh` wraps each once-only step in `step NAME CMD...` and prints `check: FAILED step '<name>' (exit N)` through `failed_line` (plus a `::error` annotation under GitHub Actions); after `bun test` it adds the failing-test count, the first `(fail)` line and the last test file header, read from the summary file `scripts/progress-tee.sh FILE SUMMARY` writes, or says the runner exited or was signalled with no `(fail)` line, and names the leak scan. That count is distinct `(fail)` rows: bun prints every failing test again in its `N tests failed:` recap after the last file, byte for byte, and the recap carries no file header, so the last header is still the file that was running. A new step in the gate goes through `step`, and `test/check-failure-names.test.ts` runs the real script against a fake `bun` to prove each path. It changes no exit status and adds no retry.
42
43
  - The whole-suite watchdog is `scripts/hang-watch.sh PID SECONDS [PROGRESS_FILE QUIET_SECONDS]` (#115, #516). `scripts/check.sh` sends bun's stderr (where it prints results) through a fifo to `scripts/progress-tee.sh FILE`, which forwards every line unchanged and appends one byte to FILE per `(pass)`, `(fail)`, `(skip)` or `(todo)` line and per test file header (under mawk only with `-W interactive`: mawk reads a pipe in blocks, so without it nothing counts until the input ends, #883); the watchdog stops the suite when FILE has not grown for `AHUB_CHECK_QUIET_S` (default 300, set in `.github/workflows/check.yml`, above the 120 s of the longest explicit test timeout). That is the hang detector, so a slow suite that keeps passing tests is never cut, and a test that logs without finishing is not progress. `AHUB_CHECK_HANG_S` (default in `scripts/check.sh`, 2700 s since #1564: healthy full runs exceeded the earlier 2250 s backstop while still reporting passing tests; hosted values for both OSes in `.github/workflows/check.yml`; #378, #593) is only the backstop for a run that keeps printing results while hung: raise it, with the job's `timeout-minutes` (room above it for setup), only when a healthy run nears it, never for a hung test, and keep the per-test 20 s timeout. The two-argument form (no file) is the old total-time bound, still used by the CI timing job and `scripts/seeded-check.ts`. A fifo and a filter of its own, never a pipe (`$!` must stay bun's pid) and never a process substitution (it cannot be waited on with a bound); `scripts/progress-tee.sh` is in the `--changed` FULL list. `test/hang-watch.test.ts` covers the watchdog, the filter and the fifo wiring.
43
44
  - A seed's named test must run on Linux, where the seeded job runs: a darwin-only test reports no result there and fails the job (#382). Cover a macOS-only protection with its regression test instead.
44
45
 
@@ -49,7 +50,7 @@ Scope: tests, fakes and the test gate. Read before adding or changing a test or
49
50
  - A daemon test that writes a config file and then calls `settings_reload` passes `configWatch: false` (`DaemonOptions`, #546), unless the watcher is what it tests. The daemon's file watcher (100 ms poll, 100 ms debounce) publishes the same bytes, so whichever of the two runs second reports `applied: []`, and a watcher pass between a preview and its confirm replaces the confirmation token. Never lengthen a sleep or loosen `applied` for it; the watcher has its own tests in `test/settings-reload-daemon.test.ts`.
50
51
  - A daemon test of a tool that reaches a public host passes the host-only transport seam (`DaemonOptions.webFetchTransport`, #553) and asserts what the daemon handed the tool, never a real round trip or a longer wait. The tool, the proxy URL and the allowlist stay the daemon's own; only the request is replaced. The proxy's own behaviour has its tests in `test/proxy.test.ts` and the web-proxy block of `test/web-fetch.test.ts`.
51
52
  - The preload leaves `HOME` unchanged and clears inherited `CLAUDE_CONFIG_DIR` and `CODEX_HOME`; tests that need fixture selectors set them after preload. A test that spawns `ahub setup`, `ahub autonomy` or `ahub init` under machine defaults, or reaches `discoverClaudeHomes` or the profile hook, sets `HOME`, `CLAUDE_CONFIG_DIR`, `AGENTHUB_HOME` and `AMEM_HOME` to temp directories, as `test/autonomy-machine-cli.test.ts` does; unit tests pass `{ home, env }` instead of `process.env`. A test that runs `ahub doctor` through the CLI also sets `CODEX_HOME` to a temp directory and puts a fake `amem` first on PATH, because doctor runs `amem setup <tool> --json` (#1025, `test/doctor-memory-capture.test.ts`).
52
- - Raising the `@staix/agent-mem` exact pin moves its version literal in `test/memory.test.ts`, `test/memory-profile.test.ts`, `test/memory-profile-daemon.test.ts` and `test/doctor-model-aliases.test.ts` in the same PR. Any other test edit in a pin raise adapts a fixture to a changed package contract (an index file name, a transport read before screening) with a comment naming the package version; never weaken an assertion to pass a raise. A test that names a package file reads the name from what the store creates (`indexFileOf` in `test/memory-store.test.ts`), never a fixed `index.db`.
53
+ - The `@staix/agent-mem` dependency is a declared range (`>=X.Y.Z <M.0.0`), so tests read the installed release (`import.meta.resolve` plus its `package.json`) instead of a literal: `test/memory.test.ts`, `test/memory-profile.test.ts`, `test/memory-profile-daemon.test.ts`, `test/doctor-model-aliases.test.ts` and the recovery-package fixtures derive their expected version that way, and a range raise moves only `package.json` and `bun.lock`. Any other test edit in a range raise adapts a fixture to a changed package contract (an index file name, a transport read before screening) with a comment naming the package version; never weaken an assertion to pass a raise. A test that names a package file reads the name from what the store creates (`indexFileOf` in `test/memory-store.test.ts`), never a fixed `index.db`.
53
54
  - `test/fixtures/release-n-1` and `test/fixtures/protocol-v16` are separately exact-locked published packages (own `bun.lock`, installed by `scripts/check.sh`), never root dependencies, and `PUBLISHED_FIXTURES` in `test/published-protocol-compat.test.ts` pins their versions and compatibility metadata. In a minor release PR, retarget release N-1 to the latest stable patch of the preceding minor together with the version bump; update its package manifest, lockfile and `PUBLISHED_FIXTURES` row, including the exact amem dependency and protocol read from the published package (AGENTS.md Releasing step 1, procedure in `docs/operations.md` #1164). The guard requires the fixture minor to be the package minor minus one. protocol-v16 stays at its version while protocol 16 is promised (#1168).
54
55
  - Keep CI's Bun version sourced from `.bun-version` through the pinned setup-bun action; update the version file rather than adding per-job version literals.
55
56
  - Release verification requires both OS checks and the aggregate `seeded guards` success for an identical tree, a tag matching `package.json` on `origin/main`, and fresh ancestor-bound documentation stamps. Preserve the separate npm OIDC publish job and GitHub Release write job; neither job gets the other's credential authority.
@@ -528,12 +528,14 @@ When a quote-bearing review reaches a peer without a stable native session ID, t
528
528
 
529
529
  The local worker binds review observer exclusion to its actual input envelopes before awaiting model or tool work. An anchored `hub_review` submission latches that exclusion for the rest of the batch/turn, including sibling and later tool calls. While latched, `hub_remember` and `hub_task_propose` are refused before reaching the host task tools; the caller can retry them in a later ordinary turn. Such turns do not call capture, commit review messages into later model history, or put provider error text and partial model text in failure logs. A later ordinary local turn resumes ordinary history and capture without inheriting the review payload. This is distinct from the PII policy: a public review package retains ordinary task authority and does not acquire an on-campus-only model route. Vendor-native histories remain owned by their adapters; the hub's current-turn and named-parent observer provenance is described in [the bus contract](bus.md#review-observer-provenance-1056).
530
530
 
531
- ## Headless Record boundaries (#1320)
531
+ ## Owned Record boundaries (#1320, #1549)
532
532
 
533
- Only a host-owned getter supplies the imported agent-mem instruction at an admitted headless turn boundary, after owned input and busy state exist and before the native prompt/model request. Multi-call local turns keep one fixed prompt. Native-client prompts, steer, Claude hooks and isolated reviewers keep their separate surfaces. A getter failure omits optional Record guidance and does not change ordinary routing. The production getter reads the public `recordsEnabled(activeHome, executionCwd)` accessor from the exact-pinned amem package; either machine or repository false disables the optional Record path. Its boolean revision is not a privacy-policy fingerprint: current package and hub screens are rechecked separately before effects.
533
+ Only a host-owned getter supplies the imported agent-mem instruction at an admitted headless turn boundary or a verified Pi TUI hub-delivered turn boundary, after owned input and busy state exist and before the native prompt/model request. Pi TUI binding requires a current verified process and session, and keeps the same turn, owner, privacy and policy fences as headless. Multi-call local turns keep one fixed prompt. Native-client prompts, steer, Claude hooks and isolated reviewers keep their separate surfaces. A getter failure omits optional Record guidance and does not change ordinary routing. The production getter reads the public `recordsEnabled(activeHome, executionCwd)` accessor from the exact-pinned amem package; either machine or repository false disables the optional Record path. Its boolean revision is not a privacy-policy fingerprint: current package and hub screens are rechecked separately before effects.
534
534
 
535
535
  Model final output uses a host-only final-answer callback distinct from explicit send tools and diagnostic messages. Only normal completion can append Record rows; partial output is stripped for sharing without certifying a settled record. Capture binds immutable owner, turn, session/generation, execution cwd, profile and policy identity. Replacement, exclusion or unsafe steering revokes the frame before any later append. This grants no task, permission, native consumption or model acceptance authority.
536
536
 
537
+ Pi context occupancy is the last assistant prompt's input plus cache read and cache write counters against the current native model's context window, never cumulative consumption. The extension reports model and occupancy through the authenticated owner bridge; the adapter admits readings only for the current verified session and turn. Missing or invalid components remain unknown. The verified TUI session's native model is session evidence, while a configured choice without native observation remains configured evidence.
538
+
537
539
 
538
540
  ## Restoration launch diagnostics (#1426)
539
541
 
@@ -50,7 +50,7 @@ and the CLI, preserving unknown evidence and count-only private membership
50
50
  | Messages have durable delivery evidence, and uncertain attempts are distinct from task completion. | A restart, failed notification or retry must not silently repeat work or approve a task ([#37](https://github.com/STAIxBWLB/agent-hub/issues/37), [#1079](https://github.com/STAIxBWLB/agent-hub/issues/1079)). |
51
51
  | Hub-owned traffic uses in-process model routes and OmniRoute; native subscription traffic keeps its native authentication. | This separates peer policy, per-call model selection and provider credentials without a second routing sidecar ([#553](https://github.com/STAIxBWLB/agent-hub/issues/553)). |
52
52
  | Host policy screens private task and turn text before shared projection, memory or model use, with positive campus admission where PII-sensitive inference requires it. | A missing network fact or a model-selected destination is not privacy authorization ([#198](https://github.com/STAIxBWLB/agent-hub/issues/198), [#230](https://github.com/STAIxBWLB/agent-hub/issues/230)). |
53
- | Portable memory comes from exact-pinned first-party amem; the hub keeps caller and privacy policy. Legacy claude-mem is import-only. | One storage core avoids competing memory implementations and dependence on an external worker for runtime recall and capture ([#752](https://github.com/STAIxBWLB/agent-hub/issues/752)). |
53
+ | Portable memory comes from first-party amem on a declared range below the next major, gated by its host API range; the hub keeps caller and privacy policy. Legacy claude-mem is import-only. | One storage core avoids competing memory implementations and dependence on an external worker for runtime recall and capture ([#752](https://github.com/STAIxBWLB/agent-hub/issues/752)). |
54
54
  | Code review, automated checks, hosted CI and native/live verification remain distinct evidence. | A code-only reviewer or a passing fixture cannot certify a real account, sandbox or provider interaction ([#852](https://github.com/STAIxBWLB/agent-hub/issues/852)). |
55
55
  | Ordinary peer, configured conductor and person authority are different; release consent originates in the person's explicit decision. | Model output and relayed peer messages cannot grant privileged operational or release authority ([#812](https://github.com/STAIxBWLB/agent-hub/issues/812), [#1063](https://github.com/STAIxBWLB/agent-hub/issues/1063)). |
56
56
 
@@ -10,6 +10,10 @@ paths:
10
10
  - src/hub/roadmap-view.ts
11
11
  - src/hub/roadmap-unplaced.ts
12
12
  - src/hub/roadmap-triage.ts
13
+ - src/hub/roadmap-decompose.ts
14
+ - src/hub/roadmap-check.ts
15
+ - src/hub/roadmap-sync.ts
16
+ - src/hub/roadmap-export.ts
13
17
  - src/hub/github-import.ts
14
18
  - src/hub/specs-task.ts
15
19
  - src/hub/board.ts
@@ -18,6 +22,7 @@ paths:
18
22
  - src/hub/daemon.ts
19
23
  - src/hub/restart.ts
20
24
  - src/cli/roadmap.ts
25
+ - src/cli/roadmap-write.ts
21
26
  - src/cli/main.ts
22
27
  - src/cli/help.ts
23
28
  - src/cli/identity.ts
@@ -28,8 +33,16 @@ paths:
28
33
  - test/roadmap-recovery.test.ts
29
34
  - test/roadmap-unplaced.test.ts
30
35
  - test/roadmap-triage-tasks.test.ts
36
+ - test/roadmap-decompose.test.ts
31
37
  - test/roadmap-r3-cli.test.ts
32
38
  - test/roadmap-r3-daemon.test.ts
39
+ - test/roadmap-check.test.ts
40
+ - test/roadmap-sync.test.ts
41
+ - test/roadmap-export.test.ts
42
+ - test/roadmap-write.test.ts
43
+ - test/roadmap-r4-daemon.test.ts
44
+ - test/check-roadmap.test.ts
45
+ - scripts/check-roadmap.mjs
33
46
  ---
34
47
 
35
48
  # Roadmap milestones
@@ -39,9 +52,12 @@ R1 implements [#1479](https://github.com/STAIxBWLB/agent-hub/issues/1479) of the
39
52
  the source of truth. R1 adds no GitHub writes, roadmap model calls, export,
40
53
  automatic task assignment, dashboard or console UI. R3 ([#1481](https://github.com/STAIxBWLB/agent-hub/issues/1481),
41
54
  "Bottom-up placement" below) adds the first roadmap model call and read-only GitHub
42
- reads, and still adds no GitHub write.
55
+ reads; R2 part 1 ([#1480](https://github.com/STAIxBWLB/agent-hub/issues/1480), "Decomposition" below)
56
+ adds a second model call over the same read-only path. Neither adds a GitHub write.
43
57
 
44
- R1 adds no generation, triage or decomposition call; those belong to R2 and R3.
58
+ R1 adds no generation, triage or decomposition call; those belong to R2 and R3. R2
59
+ part 1 is the read-only proposal only: nothing is intaken, linked or published, and
60
+ accepting a part or writing to GitHub is a later part.
45
61
  The existing mandatory privacy screen on planner-written text stays exactly as
46
62
  `Tasks.newRelease` applies it, including on milestone title and outcome. It fails
47
63
  closed where newRelease does and is never bypassed.
@@ -138,6 +154,49 @@ its ordered row/link digest to integrity. Empty databases retain the existing
138
154
  format floor and integrity shape; the additive tables do not advance the database
139
155
  format marker.
140
156
 
157
+ ## Decomposition (R2)
158
+
159
+ R2 turns a milestone into the parts of work that deliver it. Part 1 is the read-only proposal: nothing is intaken, linked,
160
+ proposed as a task or published, and it changes no board row except the saved model answer.
161
+
162
+ **Proposal.** `ahub roadmap decompose <id> [--json]` and `hub_roadmap_decompose {id}` (configured planner or unique conductor,
163
+ never during a PII or private turn) ask the hub's model how one milestone decomposes. The model sees that milestone's own title
164
+ and outcome and what the milestone already links: the summaries of its `goal` and `architecture` specs (or, when it links neither
165
+ type, of whatever spec types it links) and its linked issue refs with the titles from one bounded `readGitHubIssuePages` read.
166
+ Every spec id, title, path and issue title must pass `publicMetadataText` first: a spec that fails is not offered at all, an issue
167
+ title that fails or cannot be read is offered by its ref alone, and a milestone whose own title or outcome is withheld refuses
168
+ before any model call. The prompt asks for one JSON array of at most eight and at least one part in the `hub_backlog_split` parts
169
+ schema (`title`, `detail`, `class`) plus `needs_spec` (true: a feature or behaviour change that needs its own spec issue; false: a
170
+ mechanical chore that goes straight to a task) and `cites`.
171
+
172
+ **Reader and storage.** `parseDecomposition` (`src/hub/roadmap-decompose.ts`) keeps a part only when its title and detail are
173
+ bounded, its `class` is a `hub_task_propose` class, `needs_spec` is a boolean and at least one cite names an id the model was
174
+ shown; the answer is capped at eight parts and a repeated title is dropped. `intake` records the `needs_spec` decision as `spec`
175
+ or `task`. Each kept part is screened again at the write and stored as a pending row of `milestone_decompositions`, attributed to
176
+ `hub` as a model's answer. One pending row per milestone, so a newer run supersedes the older one in the same transaction, and
177
+ settled rows keep the newest 200. An answer that cites nothing it was shown saves nothing and is reported in `dropped`. No model,
178
+ a dead one, or a milestone that links nothing to decompose from reports `unavailable`, never a silent empty result.
179
+
180
+ **Held intake draft.** `ahub roadmap decompose <id> --accept <part>` and `hub_roadmap_decompose {id, accept}` (the same configured
181
+ planner or unique conductor, refused during a PII or private turn) accept one part of the pending answer, named by the 1-based
182
+ position the proposal printed. Accepting creates the existing intake hold rather than a new board state: a backlog task with
183
+ `draft`, so nothing offers, pulls or routes it, and the draft's text carries the part's `spec`/`task` kind and the milestone id a
184
+ person reads before releasing it. The draft is linked to the milestone as a `task` link, and every board write goes through
185
+ `Tasks`. `milestone_decomposition_accepts` keys each accepted part by its answer row and position, so accepting the same part
186
+ twice returns the draft the first accept made and the board gains no row; a superseded answer is not pending, so an accept cannot
187
+ land on it. An accept needs a pending answer and a part inside it, both refused before any write, and a milestone settled to
188
+ `done` or `dropped` while the answer waits refuses there too. One accept of a part runs at a time, so two concurrent accepts of
189
+ the same part make one draft and read the same task, and once the draft is saved the accept record, the link and the notice are
190
+ best-effort: the caller is never refused after a board write, and a retry records a link an interrupted tail lost. Release stays
191
+ the existing `ahub intake approve` by the person or the conductor acting for them, so no part reaches a peer before that approval
192
+ and this command grants no release authority of its own. The reply and its notice carry the draft's id and the part's kind only:
193
+ the result is a public view, so a part whose draft carries a PII signal reads `[withheld]` and no stored text is repeated. The
194
+ GitHub write is part 3.
195
+
196
+ `milestone_decompositions` is additive and outside the roadmap integrity digest like a suggestion: a lost answer is asked for
197
+ again, and no recovery format changes. `milestone_decomposition_accepts` is additive the same way: a lost accept row files the
198
+ part again as a second draft rather than breaking a read.
199
+
141
200
  ## Bottom-up placement (R3)
142
201
 
143
202
  R3 starts from the work that exists (open GitHub issues, open board tasks, `active` and `draft` specs) and places it on the
@@ -189,3 +248,17 @@ in `withheld`. Nothing is written to GitHub.
189
248
 
190
249
  `milestone_suggestions` and `milestone_imports` are additive tables outside the roadmap integrity digest: a lost suggestion is
191
250
  triaged again and an import mark only prevents a duplicate, so neither changes the recovery format.
251
+
252
+ ## Drift, mirror and export (R4)
253
+
254
+ `hub_roadmap_check` and `ahub roadmap check` report the eight rules in #1482. Issue state is fresh bounded GitHub metadata, never inferred from a task verdict. At most 100 issue reads share a 20-second deadline; unreadable or unvisited evidence remains unknown. A merged issue is reported open only after 24 hours, so GitHub's closing lag does not become a false finding. A public `feat:` or `feat(...)` task with no recorded spec issue is a feature finding. Missing issue identity is a separate finding. The result has at most 100 findings and says `truncated` when more exist.
255
+
256
+ `roadmap.github_mirror` defaults to false and `roadmap.github_write` to `off`; both are machine-local. The only other write value is `conductor`. `ahub roadmap sync` reads complete bounded all-state GitHub milestone and issue metadata, without issue bodies, and previews fixed `gh api` argument arrays. `--apply --confirm <fingerprint>` re-reads and rechecks the exact plan. The person may apply; the current rostered unique conductor may apply only with `github_write: "conductor"`. The operational audit and current caller, task, configuration, privacy and recovery fences remain in force. Incomplete pages, conflicting identity or withheld milestone membership refuse a plan. GitHub writes never delete a milestone, and a write whose effect cannot be confirmed is reported as uncertain rather than a safe retry.
257
+
258
+ The current full issue inventory has a ceiling of 1000 rows including pull requests. At or above that ceiling it fails closed, so mirror sync is unavailable and drift rule 7 stays unknown. A future scoped read of each bound milestone's members and desired issues removes this ceiling.
259
+
260
+ A local milestone has at most one remote number per repository. R3's `milestone_imports` marks are the durable binding, including for an imported milestone. A creation includes `<!-- ahub-roadmap:<project>:<local milestone id> -->` in its description; the response must confirm the number, repository URL, title, state and marker before binding. After a lost response, exactly one marked milestone is offered as a local binding in a new confirmed preview. Duplicate markers or a title match without the marker are refused for inspection. A new milestone's first preview creates only the milestone; a later preview binds its server-assigned number and plans issue membership. Moving an issue directly to another known milestone never follows the move with a stale unassignment.
261
+
262
+ `ahub roadmap export` renders deterministic JSON and Markdown from screened milestone views. `--write` writes only `docs/roadmap.md` and `docs/roadmap.json` in the caller's Git worktree after proving it shares the selected repository, enforcing its current deny, read-only and PII path policy and refusing symlinks or hardlinks. A partially completed two-file write is reported. `--issue <n> --apply --confirm <fingerprint>` updates that issue body only after a matching preview, under the same person/conductor policy. The fingerprint binds repository, issue and rendered body.
263
+
264
+ Task state and merge changes schedule affected public milestones for an ids-only supervision notice. The existing five-minute merge-readback sweep rechecks unresolved findings, including the close-lag boundary. A durable marker suppresses a finding already delivered; an unavailable feed or evidence is retried on a later change or sweep. Private tasks are never named. `scripts/check-roadmap.mjs` is a standalone Node validator: it checks the generated JSON's schema, linked spec IDs and tracked spec paths, and checks known issue states when a GitHub token is available. `scripts/check.sh` and the hosted docs step run it. Only `docs/roadmap.md` is exempt from the documentation stamp because this validation covers the generated page; the standalone release docs checker retains its Node-only contract.
@@ -27,11 +27,12 @@ The module is `src/hub/supervision-rules.ts` for the reading and `src/hub/superv
27
27
 
28
28
  ## Facts the rules may read
29
29
 
30
- One evaluation takes three fact sets, all authored by the hub, never by a peer or a model:
30
+ One evaluation takes four fact sets, all authored by the hub, never by a peer or a model:
31
31
 
32
32
  - **task revisions**: an id, a state and the task's structured history (event name, time, check key, plan revision, `evidenceOnly`, `noWrites` and delivered record ids). A note, a withheld body, a review finding or a transcript is not in the fact type and cannot be reached from it.
33
33
  - **deliverable measurement**: the hub's own `deliverableStatus` reading per task: whether it measured the files, and which delivered ids it now reads as changed or missing. Ids and states, never a file body.
34
34
  - **declared overlap**: the hub's own `overlapHits` rows, one row per unordered pair.
35
+ - **edit evidence**: bounded in-memory counts for the current owner revision, without paths or content. Missing coverage stays unknown.
35
36
 
36
37
  Nothing is read from a private task, a cloud observer or a native transcript, and the module imports no board write, bus, daemon, peer or memory module. A source-string test in `test/supervision-rules.test.ts` fails if a clock, a timer, an emit path, `process.env` or one of those imports appears, so the purity is proven mechanically and not only asserted.
37
38
 
@@ -51,6 +52,10 @@ Each rule has an id, a version, one reason code and one suggested existing actio
51
52
 
52
53
  **`declared_overlap_without_integration` (version 1, reason `unintegrated_overlap`, action `request_integration`).** A declared pair whose both sides have accepted their current revision, with no integration request, landed integration or recorded integration failure after either acceptance, and with neither side closed. Persistence is record-based, never elapsed time. Trigger: `overlap:<low>:<high>`, bound to the pair's lower task id so naming the pair in either direction is the same observation; refs: the other task and both acceptance records.
53
54
 
55
+ **`unverified_shell_write` (version 1, action `recheck`).** At least two observed shell-route or blind/stale edits in the current owner revision. A shell command whose target or effect cannot be observed is counted separately as unknown and does not assert a write.
56
+
57
+ **`cascading_edit_after_failed_check` (version 1, action `recheck`).** At least two distinct observed files changed after a check failed, without an intervening observed full read or passing check. A full read is a conservative observable proxy for a diagnostic read; an unobservable read cannot clear the evidence.
58
+
54
59
  Ordinary progress triggers nothing: a passing check, an unequal pair of failures, a cleared streak, an evidence-only rejection, a closed task, a pair that recorded one integration attempt. Elapsed silence is never a trigger by itself: no rule reads a clock, and a record set read two days later reads identically.
55
60
 
56
61
  ## Unknown coverage is an output, never a zero
@@ -116,6 +121,21 @@ A role on the task is not the authority to run what the proposal names. Acceptin
116
121
  | `MAX_PROPOSAL_ROWS` | 400 | terminal rows kept for dedupe and history; past it the oldest terminal row goes and a pending row is never pruned |
117
122
  | `MAX_PROPOSAL_READ` | 50 | proposals one read returns, pending first |
118
123
 
124
+ ## Edit governance arms
125
+
126
+ `edit_governance.arm` is machine-local and defaults to `baseline`. The opt-in `route_guard`, `occ_guard` and `combined_guard` arms act only where the hub proves a pre-effect tool boundary. The hub-owned local and Pi tools are admitted while their current task, owner and native turn remain valid. Native Claude, Codex and ACP report `unavailable`: their paths do not provide a hub-owned pre-effect deny under the current security contract. These surfaces use existing exact-head PR, plan conformance and check evidence at done and review time. This is detection, not prevention; missing PR or matching-check evidence remains `unknown`. Uncommitted worktree state is outside this fallback.
127
+
128
+ | Surface | Enforcement | Reason |
129
+ | --- | --- | --- |
130
+ | Hub-owned local and Pi tools | `admitted` while current task and turn are verified | The hub owns the tool transaction |
131
+ | Native Claude | `unavailable` | The managed hook never denies |
132
+ | Codex and ACP native tools | `unavailable` | A pre-effect hub deny is not guaranteed |
133
+ | External tree-only peers | `unavailable` | No pre-effect tool stream |
134
+
135
+ Route enforcement refuses a shell command only when `classifyShellWrite` proves a write. `unknown` is observed but does not become a refusal. OCC checks the current hash immediately before an admitted write and refuses a blind or stale receipt at check time with the current SHA-256 and a re-read instruction. An absent target may be created; other read errors refuse with a bounded cause. The local tool and native hook are best-effort: another process can change the file after the check, so the check is not atomic against concurrent writers. The Design 1.2 0444 worktree and `ahub-edit` isolation is the upgrade path and is outside this change.
136
+
137
+ The edit observations bind to the task's current owner revision, retain only bounded counts and in-memory file identifiers, and never persist a per-read or per-edit event. Shadow mode does not send a worker turn; advisory mode uses the existing proposal path.
138
+
119
139
  ## Deliberately outside this contract
120
140
 
121
141
  Automatic pause, retry, cancel, reroute, approval or rollback, any automatic acceptance, any import of an external supervision runtime, and any resident worker or recurring timer. The queue proposes an existing action and runs it only when a present role says so. agent-research#63 builds on the reading and bounds above, not on an acceptance path here.
@@ -31,6 +31,7 @@ paths:
31
31
  - src/hub/main-checkout.ts
32
32
  - src/hub/checks.ts
33
33
  - src/hub/task-repository.ts
34
+ - src/hub/task-pr.ts
34
35
  - src/hub/no-writes.ts
35
36
  - src/hub/review-findings.ts
36
37
  - src/hub/review-anchor.ts
@@ -82,6 +83,26 @@ Inputs are the recorded reviewed Git base, never mutable task files; changed
82
83
  inputs or unsupported install settings/layouts remain unprepared. No new public
83
84
  task schema or local-worker preparation is added.
84
85
 
86
+ A current public owner with a hub-managed worktree may start an isolated check
87
+ before task completion (#1549 T1). After runner and request admission, the hub
88
+ commits and pushes using the same private index, path policy and recorded-tip
89
+ fence as the completion handoff. The task board records the resulting branch and
90
+ exact commit before the runner starts on that commit; an unchanged hub-committed
91
+ head is reused. Owner, session, capability, privacy and recovery authority are
92
+ rechecked across the awaited work, and a lost authority never starts a check.
93
+ Peers without a hub-managed worktree retain their existing check path.
94
+
95
+ On a public managed-worktree completion pushed to the trusted GitHub origin
96
+ (#1549 T2), the hub finds one open same-repository PR at the exact pushed head,
97
+ or creates it as a draft and makes it ready. It rechecks owner, session, task
98
+ revision, privacy, recovery and origin around the bounded GitHub calls. The
99
+ admitted done records the host-verified PR as `task.sdlc.pr`; `TaskRefs` has no PR
100
+ field. A lost create response is resolved by lookup on retry. A failure after a
101
+ commit or push reports the prior effect and directs the owner to inspect it.
102
+ The generated PR body contains only the task number and a `Refs` link to the
103
+ same-repository spec issue when known. Untrusted or absent origins do not grant
104
+ GitHub write authority.
105
+
85
106
  Pressure checkpoints remain peer/session operations, including for taskless peers.
86
107
  A host waiter additionally captures its owned-work task ids, creation identities
87
108
  and actual owner-history epochs (#1447 T4). Move, unassign, cancellation or a
@@ -135,7 +156,7 @@ Untouched returns may atomically update `reserved` while moving eligible propose
135
156
 
136
157
  For a profile that supports `plan.sources`, `Tasks` validates every retained source ID against the source registry at proposal and acceptance, before board writes, admission effects or peer notices. Unknown IDs are refused with the ID and `ahub source list` guidance. Overlap notices compare the registry IDs; private task plans remain withheld by the shared public view.
137
158
 
138
- Natural-language intake from the CLI or dashboard enters the same `Tasks.intake` path and creates held draft Backlog cards, not offers. Dashboard task replies use the public view, and a ticket-bound live-test session cannot create these person-attributed drafts. Approval and discard retain their existing authority. Read-only source snapshots carry only ID, kind, byte size, hash prefix and registration time, with no content or origin paths ([#1144](https://github.com/STAIxBWLB/agent-hub/issues/1144)).
159
+ Natural-language intake from the CLI or dashboard enters the same `Tasks.intake` path and creates held draft Backlog cards, not offers. Dashboard task replies use the public view, and a ticket-bound live-test session cannot create these person-attributed drafts. A roadmap decomposition part accepted through `Tasks.roadmapDecomposePart` enters that same hold: a backlog draft attributed to the configured planner or the unique conductor that accepted it and linked to its milestone, offered to nobody until the person's `ahub intake approve` releases it ([#1480](https://github.com/STAIxBWLB/agent-hub/issues/1480)). Approval and discard retain their existing authority. Read-only source snapshots carry only ID, kind, byte size, hash prefix and registration time, with no content or origin paths ([#1144](https://github.com/STAIxBWLB/agent-hub/issues/1144)).
139
160
 
140
161
  ## Completion, review and evidence
141
162
 
@@ -178,7 +199,9 @@ state transition table is unchanged.
178
199
 
179
200
  The state becomes `approved` through Tasks, with the actual actor and the
180
201
  `merged outside the hub` history event. Ordinary dependent release runs after
181
- the saved approval. The host stores external merged-PR evidence as `mergeReadback`, separate from `merge` records produced by a guarded merge. A readback has no command exit, cleanup or owner-notice fields; unreadable cost stays absent. Artifact relinks discard both kinds of host evidence. A host-owned five-minute settlement pass reads at most three eligible public approved tasks sequentially, at most once per task every ten minutes and only for 24 hours after approval. Closed PRs stop the schedule; open or unreadable PRs retry within that window. The in-memory schedule is lost on restart.
202
+ the saved approval. The host stores external merged-PR evidence as `mergeReadback`, separate from `merge` records produced by a guarded merge. A readback has no command exit, cleanup or owner-notice fields; unreadable cost stays absent. Inline merge and adoption cost reads have an eight-second bound. Artifact relinks discard both kinds of host evidence. A host-owned five-minute settlement pass reads at most three eligible public approved tasks sequentially, at most once per task every ten minutes and only for 24 hours after approval or adoption. It also retries merged records with missing CI cost, using a 60-second bound and the same artifact and privacy fences. Closed PRs stop the schedule; open or unreadable PRs retry within that window. The in-memory schedule is lost on restart.
203
+
204
+ CI cost readback associates an explicitly linked PR run directly. If GitHub omits the association, it reads the PR branch's complete pull-request run inventory within the PR creation-to-merge interval, only for a same-repository head and a branch without another overlapping PR. Incomplete pagination, ambiguous branch ownership or failed reads keep costs unknown. Full-gate runs are split by their latest conclusion at merge, and macOS shard jobs count only non-skipped jobs with a positive GitHub `runner_id` from attempts completed before merge; zero and null are unassigned for cancelled or skipped jobs. Attempt `run_started_at` determines whether an attempt began after merge; an attempt straddling merge or sharing its timestamp leaves the evidence unknown. For first-pass CI without a hub check, use attempt 1 of the first eligible check run at the task's first submitted head. Cancelled and draft-deferred runs do not qualify. Draft state comes from complete `converted_to_draft` and `ready_for_review` timeline events compared with run `created_at`; equal timestamps or incomplete evidence stay unknown. Hub completion and isolated-check history retain precedence.
182
205
 
183
206
  Adoption creates no reviewer verdict, review metric,
184
207
  reviewed-head receipt, guarded-merge result, GitHub mutation or branch cleanup.
@@ -458,6 +481,11 @@ COMPLETED with conclusion SUCCESS; a StatusContext must have state SUCCESS.
458
481
  Common normalization cannot turn malformed fresh proof into admission. The shared
459
482
  parser and cached evidence schema retain their existing contracts.
460
483
 
484
+ The sole review and approval exception is this repository's proven draft macOS
485
+ deferral: [SDLC readbacks](../sdlc.md#readbacks-and-presentation) specifies the
486
+ exact-head job-step proof and the review blockers deferred until merge. It never
487
+ counts as a full-gate success or relaxes guarded merge or identical-tree reuse.
488
+
461
489
  ## Reviewer quota waits (#1446)
462
490
 
463
491
  Automatic reviewer selection shares `review.gate` (default 0.8) across routing and explain using canonical-account projected headroom. Unknown/no-source readings skip by default (`review.unknown_quota = "skip"`). Explicit `pass` admits unknown readings but preserves the known numeric floor; an admitted unknown never participates in a quota wait. `review.gate = "off"` disables floor checks, unknown checks and every quota wait. Actual Budget/manual pauses and all other routing constraints remain binding. With a numeric gate, a quota-only exhausted pool may wait only when every declared candidate is actually paused or at the known floor and each has a known reset; other blockers prevent waiting. Persist task incarnation, opaque head/repo binding, first start and deadline in ordinary role history. The first `task_sweep.review_min` deadline is the sole hard cap; reset timestamps only wake a recheck (including Budget's existing reset plus 60-second grace), and later signals/restarts cannot extend the cap. Expiry or unknown under the skip policy returns to existing fallback. Head/private/close/stop changes cancel timers. Quota does not join the permanent per-head failure set. `review.max_minutes` defaults to 20; a child-specific generation fence and existing owned teardown produce a typed timeout without closing the task.