@staix/agent-hub 0.52.0 → 0.54.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 (196) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +4 -3
  3. package/docs/addons/open-code-review.md +3 -6
  4. package/docs/agent-notes/README.md +1 -1
  5. package/docs/agent-notes/adapters.md +5 -4
  6. package/docs/agent-notes/budget.md +2 -2
  7. package/docs/agent-notes/bus.md +1 -0
  8. package/docs/agent-notes/daemon.md +6 -5
  9. package/docs/agent-notes/models.md +1 -1
  10. package/docs/agent-notes/tasks.md +3 -3
  11. package/docs/agent-notes/tests.md +4 -4
  12. package/docs/contracts/companion-cli-v2.json +90 -0
  13. package/docs/contracts/companion-cli-v3.json +348 -0
  14. package/docs/design/adapters.md +1 -1
  15. package/docs/design/agent-hub-architecture.md +8 -5
  16. package/docs/design/bus.md +1 -1
  17. package/docs/design/cli-output-inventory.md +4 -2
  18. package/docs/design/execution-reference.md +1 -1
  19. package/docs/design/guidance-experiments.md +1 -0
  20. package/docs/design/guidance-probes.md +1 -0
  21. package/docs/design/model-routes.md +20 -5
  22. package/docs/design/roadmap.md +6 -4
  23. package/docs/design/task-board.md +21 -2
  24. package/docs/dogfood.md +13 -6
  25. package/docs/events.md +1 -1
  26. package/docs/memory.md +2 -2
  27. package/docs/operations.md +158 -50
  28. package/docs/quickstart.md +14 -2
  29. package/docs/security.md +17 -9
  30. package/docs/specs/2026-09-19-agent-hub-design.md +5 -3
  31. package/docs/specs/2026-09-19-multi-project-design.md +1 -1
  32. package/docs/specs/2026-09-20-upgrade-recovery-design.md +24 -0
  33. package/docs/specs/2026-12-04-arev-adoption-design.md +84 -0
  34. package/docs/specs/mcp-endpoint.md +15 -4
  35. package/docs/specs/relay-contract.md +38 -0
  36. package/docs/verification/2026-12-04-host-shared-receipts.md +43 -0
  37. package/docs/verification/2026-12-05-0.53.0.md +101 -0
  38. package/docs/verification/2026-12-05-agy-1.5.24.md +55 -0
  39. package/docs/verification/2026-12-05-claude-implementer-2.1.337.md +43 -0
  40. package/docs/verification/2026-12-06-0.54.0.md +76 -0
  41. package/docs/verification/2026-12-06-codex-0174-reviewer-isolation.md +43 -0
  42. package/docs/verification/2026-12-06-codex-0174-reviewer-tool-call.md +34 -0
  43. package/docs/verification/2026-12-06-compat-codex-capabilities-0.174.0.md +25 -0
  44. package/docs/verification/2026-12-06-compat-pi-1.8.0.md +23 -0
  45. package/docs/verified.json +38 -29
  46. package/package.json +9 -3
  47. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  48. package/plugins/agent-hub/.mcp.json +1 -1
  49. package/plugins/agent-hub/compat.json +9 -5
  50. package/plugins/agent-hub/kimi-hook.js +892 -874
  51. package/plugins/agent-hub/relay-launcher.js +24 -0
  52. package/plugins/agent-hub/server.js +27271 -25146
  53. package/src/adapters/acp-session-model.ts +1 -1
  54. package/src/adapters/acp.ts +5 -4
  55. package/src/adapters/agy/definition.ts +1 -1
  56. package/src/adapters/agy/hooks.ts +1 -1
  57. package/src/adapters/channel-peer.ts +3 -1
  58. package/src/adapters/claude-channel-evidence.ts +26 -1
  59. package/src/adapters/claude-channel.ts +27 -30
  60. package/src/adapters/claude-connection-policy.ts +62 -0
  61. package/src/adapters/claude-relay.ts +255 -0
  62. package/src/adapters/codex-review-isolation.ts +1 -2
  63. package/src/adapters/compat.ts +28 -18
  64. package/src/adapters/definitions/native-cli-preview-pi.ts +2 -1
  65. package/src/adapters/definitions/native-config-defaults.ts +1 -1
  66. package/src/adapters/definitions/native-context.ts +1 -2
  67. package/src/adapters/definitions/native-factories.ts +4 -1
  68. package/src/adapters/definitions/native-quota.ts +1 -1
  69. package/src/adapters/definitions/native-recovery.ts +3 -1
  70. package/src/adapters/external-modules.ts +2 -2
  71. package/src/adapters/kimi-review.ts +1 -1
  72. package/src/adapters/kimi-tui-facts.ts +1 -1
  73. package/src/adapters/local-worker.ts +3 -3
  74. package/src/adapters/native-capabilities.ts +1 -1
  75. package/src/adapters/pi.ts +26 -7
  76. package/src/adapters/registry-types.ts +2 -0
  77. package/src/adapters/relay-launcher.ts +27 -0
  78. package/src/adapters/reviewer-mcp.ts +1 -1
  79. package/src/cli/agents.ts +20 -8
  80. package/src/cli/agy-mcp.ts +1 -1
  81. package/src/cli/claude-profile-hook.ts +1 -1
  82. package/src/cli/command-table.ts +1 -0
  83. package/src/cli/commands/agents.ts +18 -1
  84. package/src/cli/commands/doctor.ts +18 -4
  85. package/src/cli/commands/launch-line.ts +32 -0
  86. package/src/cli/commands/status.ts +14 -3
  87. package/src/cli/help.ts +7 -4
  88. package/src/cli/identity.ts +1 -1
  89. package/src/cli/init-roles.ts +1 -1
  90. package/src/cli/init-settings.ts +1 -1
  91. package/src/cli/launch-line-plan.ts +82 -0
  92. package/src/cli/launch-line-project.ts +13 -0
  93. package/src/cli/main.ts +10 -9
  94. package/src/cli/pi-steps-warning.ts +14 -0
  95. package/src/cli/recovery-package.ts +60 -6
  96. package/src/cli/reset.ts +1 -1
  97. package/src/cli/shell-quote.ts +1 -3
  98. package/src/cli/upgrade-interactive.ts +7 -2
  99. package/src/cli/upgrade-keep-plan.ts +47 -0
  100. package/src/cli/upgrade-restore-state.ts +1 -1
  101. package/src/cli/upgrade-runtime.ts +119 -18
  102. package/src/cli/upgrade.ts +17 -2
  103. package/src/hub/accounts.ts +8 -4
  104. package/src/hub/action-class.ts +1 -3
  105. package/src/hub/adec-triage.ts +105 -0
  106. package/src/hub/autonomy.ts +1 -1
  107. package/src/hub/board.ts +3 -27
  108. package/src/hub/bus.ts +39 -6
  109. package/src/hub/capabilities.ts +1 -1
  110. package/src/hub/channel-project-base.ts +46 -0
  111. package/src/hub/channel-project.ts +21 -46
  112. package/src/hub/config-apply.ts +1 -1
  113. package/src/hub/config-edit.ts +1 -1
  114. package/src/hub/config-tier.ts +1 -1
  115. package/src/hub/config.ts +2 -2
  116. package/src/hub/confirmation-matrix.ts +1 -1
  117. package/src/hub/control/board-messages.ts +415 -0
  118. package/src/hub/control/dashboard-messages.ts +221 -0
  119. package/src/hub/control/delivery-messages.ts +356 -0
  120. package/src/hub/control/dispatch.ts +114 -0
  121. package/src/hub/control/hub-tool-helpers.ts +243 -0
  122. package/src/hub/control/hub-tools.ts +147 -0
  123. package/src/hub/control/native-messages.ts +665 -0
  124. package/src/hub/control/operations-messages.ts +269 -0
  125. package/src/hub/control/peer-messages.ts +126 -0
  126. package/src/hub/control/recovery-messages.ts +391 -0
  127. package/src/hub/control/recovery-operation.ts +480 -0
  128. package/src/hub/control/scope.ts +460 -0
  129. package/src/hub/control/sdlc-messages.ts +373 -0
  130. package/src/hub/control/task-ops-more.ts +245 -0
  131. package/src/hub/control/task-ops.ts +553 -0
  132. package/src/hub/control/ui-actions.ts +241 -0
  133. package/src/hub/control-write-trace.ts +1 -4
  134. package/src/hub/daemon.ts +485 -4324
  135. package/src/hub/delivery-hints.ts +2 -0
  136. package/src/hub/delivery-journal.ts +17 -6
  137. package/src/hub/events.ts +2 -1
  138. package/src/hub/execution-reference.ts +1 -1
  139. package/src/hub/host.ts +41 -9
  140. package/src/hub/hub-tools.ts +3 -4
  141. package/src/hub/invocations.ts +1 -1
  142. package/src/hub/lifecycle.ts +4 -3
  143. package/src/hub/mcp-endpoint-serve.ts +4 -3
  144. package/src/hub/mcp-endpoint.ts +15 -6
  145. package/src/hub/memory-profile-check.ts +1 -1
  146. package/src/hub/no-writes.ts +1 -1
  147. package/src/hub/peers.ts +2 -0
  148. package/src/hub/pi-exit-policy.ts +27 -0
  149. package/src/hub/progress.ts +1 -1
  150. package/src/hub/project-runtime-state.ts +17 -4
  151. package/src/hub/project-runtime.ts +3 -1
  152. package/src/hub/protocol-window.ts +1 -1
  153. package/src/hub/recovery-continuity.ts +3 -3
  154. package/src/hub/recovery-kept-roster.ts +50 -0
  155. package/src/hub/review-anchor.ts +13 -181
  156. package/src/hub/review-brief.ts +78 -28
  157. package/src/hub/review-findings.ts +15 -193
  158. package/src/hub/review-ledger.ts +162 -0
  159. package/src/hub/review-material.ts +3 -3
  160. package/src/hub/reviewer-pool.ts +4 -2
  161. package/src/hub/roadmap-issue-states.ts +65 -14
  162. package/src/hub/roadmap-sync.ts +39 -14
  163. package/src/hub/routing.ts +9 -0
  164. package/src/hub/runtime-capture-prune.ts +8 -2
  165. package/src/hub/runtime-package-assets.ts +3 -0
  166. package/src/hub/sdlc-release-policy.ts +1 -2
  167. package/src/hub/settings.ts +1 -1
  168. package/src/hub/spec-ack-tool.ts +4 -0
  169. package/src/hub/spec-report-history.ts +36 -0
  170. package/src/hub/specs.ts +1 -4
  171. package/src/hub/supervision.ts +33 -6
  172. package/src/hub/tasks-audit.ts +390 -0
  173. package/src/hub/tasks-backlog.ts +522 -0
  174. package/src/hub/tasks-handoff.ts +208 -0
  175. package/src/hub/tasks-release.ts +257 -0
  176. package/src/hub/tasks-roadmap.ts +17 -3
  177. package/src/hub/tasks-specs.ts +672 -0
  178. package/src/hub/tasks-types.ts +334 -0
  179. package/src/hub/tasks.ts +286 -1961
  180. package/src/hub/upgrade-session-contract.ts +11 -0
  181. package/src/local/probe-sandbox.ts +1 -2
  182. package/src/local/probe-workspace.ts +1 -1
  183. package/src/models/route/config.ts +4 -4
  184. package/src/models/route/decision.ts +18 -10
  185. package/src/models/route/observation-signals.ts +1 -2
  186. package/src/models/route/runtime.ts +8 -5
  187. package/src/npm-artifact.ts +76 -0
  188. package/src/omniroute/client.ts +6 -0
  189. package/src/pi/extension.ts +5 -2
  190. package/src/pi/install.ts +77 -0
  191. package/src/pi/pin.ts +49 -0
  192. package/src/primitives.ts +14 -0
  193. package/src/version.ts +2 -0
  194. package/templates/adec/README.md +10 -6
  195. package/templates/config.json +1 -1
  196. package/templates/specs.block.md +1 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,43 @@ 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.54.0
8
+
9
+ - Release N-1 for 0.54.x is published 0.53.0, which declares agent-mem `>=0.47.0 <1.0.0`; its fixture lock pins the 0.47.0 that the 0.53.0 release resolved (with agent-review 0.17.1, cli-output 0.1.5 and mcp-stdio 1.2.1), with control protocol 17 (descriptor floor 16). Wire and protocol, `hub.db` format, memory store formats (agent-mem 0.48.0 to 0.50.0 raise no format floor) and MCP tools are unchanged and compatible both ways. Settings have a ceiling: a project that sets `bus.hold_notice_ms` in `.agenthub/` or `decision_mode = "enforce"` on a hub route is refused by a 0.53.0 hub, and a 0.53.0 hub ignores `[inference] triage_adec` in `routing.toml`. The `ahub launch-line` options and `ahub agents install pi` are not in the 0.53.0 CLI. The N-1 fixture and matrix pin that package; the separate protocol-16 fixture stays at 0.25.0.
10
+ - `ahub launch-line <kind> --json` takes `[--exec <absolute-path|self>] [-- <launch arguments>]`: it keeps the launch's options or refuses with a fixed reason, prints a runnable executable on request, refuses a daemon older than 0.53.0 with nothing on stdout, and never prints a blank command. Companion CLI contract v3 records it (Refs #1963).
11
+ - A Pi owner that is killed by a signal or ends itself with `ctx.shutdown()` now logs a distinct exit cause (signal, stderr tail, last native event, the provider a `model_select` named) and, when it is a managed headless owner under `pi.auto_start`, restarts once from its verified recorded session even if a turn or tool was active; the same cause within ten minutes does not restart again, and the 60-second restart limit still applies. The Pi step ceiling counts from a logical turn's start to `agent_settled`, so a native retry no longer resets it, and `ahub doctor` warns when a project file sets `pi.max_steps` below the default, naming the file and key. The pre-offer route probe moved to spec #1973 (Refs #1967).
12
+ - Codex 0.174.0 skill listing is verified through `codex-capabilities` on macOS arm64 (Refs #888).
13
+ - The compat publisher no longer stops on a merged or closed bot PR whose head was changed by hand: it reports it once and skips it, and an open bot PR with a foreign head is reported (number, id, version) and skipped for its own id and version while every other action still runs. The daily watch report adds a publisher health line with the last bot compat PR and any blocking PR (Refs #1966).
14
+ - Pi 1.8.0 is verified for model-free extension loading, RPC session identity and managed tool receipts on macOS arm64 (Refs #888).
15
+ - A person can pin a verified Pi release with `ahub agents install pi`. Projects without an explicit `pi.cmd` use the hub-owned install (Refs #1965).
16
+ - A local `needs_review` row left by the ACP adapter's own unrequested session stop (a host-set, journaled mark; reason text never decides it) now holds only itself: later queued work is delivered, the next delivery carries one bounded body-free held hint, and the conductor notice names the `ahub queue resolve` command the conductor may run and repeats once after the new `bus.hold_notice_ms` (default 30 minutes). Every other local `needs_review` row, including invocation rows, an accepted-settle timeout, an aborted turn and an unconfirmed reviewer fallback, still holds the peer (Refs #1946).
17
+ - A person can enable `decision_mode = "enforce"` on an adec decision route to apply its model and reasoning effort. Unusable decisions keep the current pair (Refs #554, #1936).
18
+ - Declared accounts: once a kind has a declared account, an unaccounted peer of that kind budgets as `<kind>:default` instead of the bare kind, so a declared base session and an unaccounted peer (for example `instances.claude-2`) no longer collide and `ahub status --json` works again; pauses stored under the bare id move there at start (Refs #1941).
19
+ - The Claude plugin uses the native agent-suite MCP relay when it advertises relay contract v1, and falls back to its bundled Bun relay otherwise (Refs #1942).
20
+ - In shared-host mode, an uncaught control callback error on WebSocket or MCP stops only its project. Other projects keep serving (Refs #1779).
21
+ - Dependencies: `@staix/cli-output` is pinned exactly to 0.1.6, the `@staix/agent-mem` floor is raised to 0.50.0 and `@staix/agent-review` to exactly 0.17.3, which pin the same cli-output, so recovery accepts them (STAIxBWLB/cli-output#48). No TypeScript behavior change (cli-output 0.1.6 fixes Rust-crate Indic and Lam-Alef widths).
22
+ - A `type = "decision"` route, plan_execute and advisor/escalation choice now send the pair the heuristic picked as `constraints.current` on every adec request, so shadow rows carry what adec is compared with (Refs #1936).
23
+ - `[inference] triage_adec` in `routing.toml` (default `off`) asks a loopback adec the `ahub.triage.v1` question beside the hub's own triage, with `current`, a `ko` tag and `pii`, and posts the settled class as the outcome label on approval; `enforce`, set only by a person, lets a non-abstaining answer name the class and falls open otherwise (#1936, refs #554).
24
+
25
+ ## 0.53.0
26
+
27
+ - Release N-1 for 0.53.x is published 0.52.0, which declares agent-mem `>=0.47.0 <1.0.0`; its fixture lock pins the 0.47.0 that the 0.52.0 release resolved (with cli-output 0.1.5 and mcp-stdio 1.2.1), with control protocol 17 (descriptor floor 16). Wire and protocol, `hub.db` format, settings and MCP tools are unchanged and compatible both ways: this release adds no setting a 0.52.0 hub refuses. The 0.53.0 plugin relays MCP over the project socket only when the daemon advertises it is serving one, so with a 0.52.0 daemon it keeps the stdio bridge; `ahub upgrade --recreate` is not in the 0.52.0 CLI. No capability or format ceiling is raised. The N-1 fixture and matrix pin that package; the separate protocol-16 fixture stays at 0.25.0.
28
+ - Dependencies: adds the first-party AREV core `@staix/agent-review` 0.17.1, pinned exactly; upgrade, restart and recovery retain it beside agent-mem and cli-output (Refs #1874).
29
+ - A head-bound `hub_review` verdict and its later finding dispositions are now recorded in the AREV ledger, so `arev gate` answers for a hub-reviewed head without a manual `arev record`. Unmet items become `compliance:unmet-<item>` blocking findings, and a private task writes nothing (Refs #1874).
30
+ - The review brief now takes its file list, exclusions and rule groups from the AREV packet of the same head and merge base, so it matches `arev packet`. Exclusion reasons are AREV's own names (generated, binary, too large), and a private task still builds no packet (Refs #1874).
31
+ - Task owners and configured conductors can add a missed design-spec acknowledgement at the filed head without restarting review (Refs #1928).
32
+ - Antigravity `agy` 1.5.24 is verified: the CLI, hooks, permission, tmux helper and actual-launcher legs pass on a scratch copy with the repository producers (Refs #843).
33
+ - Claude Code 2.1.337 is verified for the headless implementer: the 44 model-free native transport and host-wrapper cases pass and match the 2.1.334 control (Refs #888).
34
+ - The design spec instructions written by `ahub init` now tell agents to acknowledge unchanged covering specs with `spec_ack` (Refs #1830).
35
+ - Review anchors use the shared AREV validator and refuse paths such as `" .env"` when the trimmed path is denied (Refs #1874).
36
+ - Controlled upgrades can keep compatible attached Claude sessions open while the hub changes versions. Use `--recreate` to restart them with the previous plan (Refs #1807).
37
+ - A Claude bridge tool call made while the hub is being replaced is held up to 30 seconds and runs on the new hub in arrival order. If no hub returns, it fails with a named upgrade message and its next step. A call already sent is never resent (Refs #1807).
38
+
39
+ - The bundled plugin relays MCP over the project socket on a serving daemon and falls back to the existing bridge on older daemons (Refs #1780).
40
+ - Roadmap mirror sync reads only bound or recovered milestone members plus batched GraphQL desired issues, and live issue states resolve up to 1,000 linked issues in batched GraphQL reads (Refs #1850).
41
+ - The MCP endpoint checks a Claude relay's parent launch before enabling channel pushes and falls back to inbox polling when evidence is missing. Production relay wiring follows in T4 (Refs #1780).
42
+ - Companion CLI v2 adds peer account labels and Orca pane keys to person-console status JSON and a read-only Claude/Codex launch line (Refs #1811).
43
+
7
44
  ## 0.52.0
8
45
 
9
46
  - Release N-1 for 0.52.x is published 0.51.0, which declares agent-mem `>=0.42.0 <1.0.0`; its fixture lock pins the 0.43.0 that the 0.51.0 release resolved (with cli-output 0.1.4 and mcp-stdio 0.5.0), with control protocol 17 (descriptor floor 16). Wire and protocol, daemon features, `hub.db` format and MCP tools are unchanged and compatible both ways. Exceptions: a 0.51.0 hub refuses at startup the settings this release adds (`[structure]` in `.agenthub/sdlc.toml`, `accounts` and `instances.<id>.account`, `host.shared`, `upgrade.bridge_window_days` and `bridge_window_min`, and a configured kind with `transport: "pull"` in `.agenthub/config.local.json`), so leave them unset until every hub that reads the file runs 0.52.0; the new commands (`ahub host`, `ahub accounts import`, `ahub agents presets` and `add`, `ahub structure`, `ahub sdlc check` and `sync`) are not in the 0.51.0 CLI. The declared agent-mem range rises (to 0.47.0 or later): hub notes may carry a writer `session` key, which a 0.51.0 hub on agent-mem 0.43.0 still reads from the same home, though an older strict `amem project import` skips JSONL notes that carry it. No capability or format ceiling is raised. The N-1 fixture and matrix pin that package; the separate protocol-16 fixture stays at 0.25.0.
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.52.0, control protocol 17 (accepts 16). Bun + TypeScript, one loopback daemon per
8
+ Status: 0.54.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
@@ -66,8 +66,9 @@ including [a new project with SDLC advise or enforce](docs/quickstart.md#a-new-p
66
66
  - **Peers, not a pipeline.** Any agent can message the others. Messages are batched
67
67
  into digests, priorities decide what interrupts a turn, and delivery survives
68
68
  restarts.
69
- - **Optional decision routing.** Hub-owned routes can consult a loopback adec
70
- policy in shadow mode while keeping the existing model choice unchanged.
69
+ - **Optional decision routing.** Hub-owned decision routes can consult a loopback
70
+ adec policy. Shadow records the proposal while keeping the current model and
71
+ effort. A person can enable enforce to apply a validated model and effort.
71
72
  Stage routes use bounded numeric evidence and a deterministic fallback;
72
73
  whole-wire sizing conservatively counts UTF-8 JSON bytes, including Unicode.
73
74
  See the [stage contract](docs/design/model-routes.md) and
@@ -1,8 +1,5 @@
1
- # open-code-review: decision note (#248)
1
+ # Open Code Review (retired)
2
2
 
3
- Status 2026-10-12: keep optional. No measured effect yet.
3
+ AREV has been the review gate since 2026-12-03. Use the [AREV adoption design](../specs/2026-12-04-arev-adoption-design.md) for the current workflow.
4
4
 
5
- - What it does: the OCR delegation gate selects files and rules for a review that the host agent then performs; in this workspace it gates merges.
6
- - Expected effects to measure: review rounds and reviewer unmet items per approved task, `regressed` and `reverted` labels after approval.
7
- - Evidence: none collected; the fingerprint records it when the plugin is enabled in Claude Code or in Codex `config.toml`. Arms owed: `all-on`, `open-code-review-off`, `all-off`.
8
- - Decision: keep optional. The hub's reviewer role and review checklists (#35) are the native counterpart; no part is adopted without data.
5
+ Historical `tooling` events with the `open-code-review` add-on still parse. The earlier decision to keep OCR optional for measurement is retained in this file's history.
@@ -70,7 +70,7 @@ Background moved out of the area notes for 0.15.0:
70
70
 
71
71
  Background moved out of the area notes for 0.16.0:
72
72
 
73
- - Closing-refs negation list (#760, tests.md): agent-mem PR #36 said "Does not close #15", GitHub read `close #15` as a closing keyword, and the design issue closed with T3 open. The list errs toward flagging: a false positive costs a rewrite of the PR text, a false negative closes a design issue, and a body that really means a qualified close is the author's to reword. A keyword typed into a comment or the merge dialog is out of the check's reach. At 0.16.0 `closing-refs` is not a required status check (branch rules require `check (ubuntu-latest)`, `check (macos-latest)` and `seeded guards`).
73
+ - Closing-refs negation list (#760, tests.md; the check runs from `@staix/repo-tools` since #1938 and the list lives there): agent-mem PR #36 said "Does not close #15", GitHub read `close #15` as a closing keyword, and the design issue closed with T3 open. The list errs toward flagging: a false positive costs a rewrite of the PR text, a false negative closes a design issue, and a body that really means a qualified close is the author's to reword. A keyword typed into a comment or the merge dialog is out of the check's reach. At 0.16.0 `closing-refs` is not a required status check (branch rules require `check (ubuntu-latest)`, `check (macos-latest)` and `seeded guards`).
74
74
 
75
75
  Background behind the 0.18.0 rules:
76
76
 
@@ -11,7 +11,7 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
11
11
  - Keep per-kind native policy in `src/adapters/definitions/` and consume it through the registry. Private CLI implementations accept only fixed host-bound ports; keep identity, audit, lifecycle admission and effect ordering in the host. Except for the verified person-owned A4 startup-module contract, do not add config-selected callbacks or runtime imports from registry leaves into eagerly initialized hub/CLI modules; use type-only ports for existing host planners.
12
12
  - Adapter registry (#451): kind-specific policy lives in that peer's `AdapterDefinition` under `src/adapters/definitions/` (runtime definitions `NATIVE_BUILTIN_DEFINITIONS_WITHOUT_QWEN` in `builtin-metadata.ts` plus `qwen.ts`; the daemon constructs every native driver through `start.create` and `DAEMON_PORTS`). Outside `src/adapters/`, read a semantic field of `definitionOf(id)`: never a raw peer-id comparison, a resolved kind (`kindOf`, `definitionOf(...).kind`) or a constant alias compared with a native name, a vendor-keyed object, a peer-name array, or a closed-list import from `peer-catalog.ts`, `start-mode.ts` or `permission-mode.ts`; the guard resolves aliases and import/re-export bindings. `test/registry-guard.baseline.json` is `[]` and stays empty: a new site moves into a definition, never into the baseline. The only exceptions are the cross-release literals `KNOWN_PEERS`, `OPTIONAL_PEERS` and `START_MODE_PEERS`, which `test/registry-guard.test.ts` holds equal to the derived lists. `LaunchContext.nativeCommand` carries only validated config argv (or its redacted preview), never model input; a definition's `permission.grants` text is what `permissionGrant` shows, ahead of the built-in wording. Keep native mode-id maps in `definitions/*-native.ts`, free of registry factories (`test/adapter-import-order.test.ts`).
13
13
  - Registry load runs `assertDaemonEngine` and `assertNativeCapabilityScope` before publication. A definition that is not a fixed builtin (object identity in `fixedBuiltinDefinitions`, never a kind name) may not declare `start.acpCommand`, `start.upStart`, `attach.admission`, `budget.resetSoftTokensOnResume`, `session.crashIdentity`, `session.nativeRevert`, a `pi-rpc` or `claude-implementer` daemon port, `identity.currentChild`, `routing`, `projection`, `reviewerVariant`, `headlessVariant`, `reviewer`, `hooks.factsHook`, `cli.entry`, `cli.preview`, `cli.usage` or `instances.modelSelect`. Only `definitionOf(id, instances)` picks a kind's `reviewerVariant`, for a declared extra with `start_mode: "headless"`, roles exactly `["reviewer"]`, and either a variant whose `reviewer.declaration` is `"automatic"` (Claude, agy) or `review_mode: "fresh"` (Codex, Kimi); without that opt-in a reviewer-only Codex or Kimi instance keeps its native adapter. It picks a kind's `headlessVariant` (Claude, #525-4) for a declared headless extra whose roles include `implementer` and hold only `implementer` and `verifier`. Metadata-only reviewer variants never establish native peer support; `isSupportedPeer` shares the registry runtime/validated-instance predicate with the catalog and daemon. A new field that depends on fixed-builtin assumptions or host-global native state joins that list (`test/adapter-capability-scope.test.ts`). `trust.onPrem` admits PII work (rule: `tasks.md`).
14
- - Native branch ratchet (#625): `test/daemon-native-branches.test.ts` counts every call of a native class predicate (an `is*Peer` imported from an adapter module other than `registry.ts`) per enclosing function in `src/hub/daemon.ts` and `src/hub/claude-launch-proof.ts`, and the counts must equal `test/daemon-native-branches.json` (`predicate`, `function`, `count`, `reason`). A PR that adds, moves or removes such a call edits its row by hand with a concrete reason; never regenerate the table from a test. Bind a predicate alias with `const` only and never call one through a computed namespace key: the scan refuses both.
14
+ - Native branch ratchet (#625): `test/daemon-native-branches.test.ts` counts every call of a native class predicate (an `is*Peer` imported from an adapter module other than `registry.ts`) per enclosing function in `src/hub/daemon.ts`, `src/hub/claude-launch-proof.ts` and the native/recovery control modules in its source list, and the counts must equal `test/daemon-native-branches.json` (`predicate`, `function`, `count`, `reason`). A PR that adds, moves or removes such a call edits its row by hand with a concrete reason; never regenerate the table from a test. Bind a predicate alias with `const` only and never call one through a computed namespace key: the scan refuses both.
15
15
  - Native proof state (`frontendProxy`, builtin `statusNotice`, `revertTurn` with `session.nativeRevert`, the Claude launch proof and terminal execution root) is read in the daemon only after `isFixedBuiltinDefinition(definitionOf(peer))`: a same-name foreign definition gets none of it. A product of a definition that is not a fixed builtin may not have a `frontendProxy`, `statusNotice` or `revertTurn` member at all, even undefined (`assertNativeProofPorts`, run by `createFromDefinition` and the conformance kit). Use `frontendProxyState` for the daemon proxy reads: absence keeps the generic path, present undefined refuses with `frontend proxy state unknown`. Keep approval policies and restoration debt inside CodexPeer. The remaining Codex `actionEnforcement`/`actionGated` predicate is intentional until a separately specified action-policy port; never add it to `FrontendProxyPort`.
16
16
  - Quota renewal calls the optional `PeerAdapter.compareQuotaHome` and `readQuotaNow` ports. Verify fixed builtin definition identity before reading either member. Refuse foreign products with either member present, even undefined. Compare synchronously before renewal and at the save boundary. Fall back to the next launch only when comparison returns undefined or the port is absent. A throw means unknown. Keep home paths in memory. Read quota only after saving, and preserve the success reply if the read throws.
17
17
  - Adding a native peer: declare its `AdapterDefinition` under `src/adapters/definitions/` (or its own directory, as agy) and list it in `ADAPTERS` (`src/adapters/registry.ts`). `KNOWN_PEERS`, `OPTIONAL_PEERS`, `SUPPORTED_PEERS`, `START_MODE_PEERS` (a kind with both a TUI and a headless form), `ROLE_ORDER`, `HELP_ORDER` and `PLANNER_PEERS` are derived from it by `deriveAdapterLists`: set `optional`, `projection` (`roleRank`, `startRank`, `helpRank`, `plannerEligible`, `conductorEligible`, `reviewerEligible`; absent eligibility is false; a configured or external definition cannot) and, for an `ahub <kind>` launcher, `cli.entry`, `cli.usage`, `cli.preview` and `cli.startWords`, never a list edit (`builtinCliEntries(definitions)` projects the entries). The literal cross-release copies `KNOWN_PEERS` and `OPTIONAL_PEERS` in `src/hub/peer-catalog.ts` and `START_MODE_PEERS` in `src/hub/start-mode.ts` stay hand-kept for older coordinators: `test/registry-guard.test.ts` fails when one differs from the derived list. Adding a peer is the one change that updates their probe counts and `VENDORS` in `test/helpers/registry-inventory.ts` (`REGISTRY_COMPATIBILITY_PROBES`), the probe literal in `test/adapter-registry-a2.test.ts`, the `ADAPTERS` order in `test/adapter-registry.test.ts` and the literal in `test/adapter-catalog-a2.test.ts`; say so in the PR as an expected test change. `isSupportedPeer` answers from `ADAPTERS`, and for a declared instance from its kind's runtime definition unless the instance resolves to an unavailable reviewer variant; `isKnownPeer` and `defaultPeerRoles` answer from `definitionOf`; `STARTABLE_PEERS` reuses `SUPPORTED_PEERS`. Role eligibility (#1408) is read only through `roleEligibility` / `applyRoleCeiling` (`src/adapters/role-eligibility.ts`): a new kind changes the generated table in `docs/roles.md` (`renderEligibilityTable`; `test/roles-doc.test.ts` fails until the doc matches) and, when `conductorEligible`, the pinned conductor set in `test/conformance/conductor.test.ts`, and the conductor-start wording comes from `conductorStartText()` (`src/adapters/registry.ts`), never a text edit. It also adds the kind's `kinds` entry and its rows to `templates/presets/confirmation-matrix.json` (#999 T0): `test/confirmation-matrix.test.ts` fails without a tool-approval and a classed-action row per environment, and when the entry's forms, pull-only forms, conductor start or hub-mode fact differ from the definition. Add the same kind to `kinds` in `templates/presets/autonomous.json`, with a permission per form (`null` where the hub mode is `unmanaged`, or for `tui` under `unmanaged-in-tui`) and a start per environment: `test/autonomy.test.ts` fails when the preset and matrix kinds differ or a mode is unsupported. A builtin kind that reads a user skill directory joins `SKILL_HOSTS` and `hostSkillDir` (`src/adapters/definitions/native-cli-skills.ts`); one that reads none joins the exclusions in `test/skills-install.test.ts`.
@@ -79,8 +79,8 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
79
79
  ## Pi
80
80
 
81
81
  - 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.
82
- - 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.
83
- - 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.
82
+ - 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 command `piCommand(options.cmd)` resolves (an explicit `pi.cmd`, else the verified hub-owned pin from `src/pi/pin.ts`, else `pi` on PATH) plus `--version` (owned group, 64 KiB, 10 s) against compat `pi`, and returns that command so the launch uses the very command it checked. 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.
83
+ - Report each Pi owner exit once, with code/signal (unknown for an unobserved TUI exit), turn/tool activity, only the last tool name, and the bounded reason, last native event, `model_select` provider and stderr tail (`piExitReason`, `src/hub/pi-exit-policy.ts`). The hub writes no task text into the record, but the stderr tail is Pi's own output, whitespace-folded and cut to 300 characters, never filtered. Auto-restart only a current, started headless owner on its verified persisted session, once per 60 s; a restartable cause (`signal:*`, `session_shutdown`, `model_select:*`) may restart through a turn/tool-active exit, at most once per peer and cause per 10 minutes (`PiRestartLedger`), while a plain exit code keeps the inspect-first fence. Preserve shutdown/requested-stop/recovery/startup fences and never fall back fresh.
84
84
  - 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.
85
85
  - 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).
86
86
  - 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).
@@ -112,7 +112,8 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
112
112
  - Kimi TUI completion facts are admitted only on compat `kimi-tui` (2.5.2) through `native_hook_launch`, a launch-scoped plugin under the native home, and `KIMI_TUI_FACTS_HOOK`. The launcher uses async spawn so its control socket stays live, previews plugin writes, and cleans only that launch's files. A different launch's plugin is replaced only after a new begin succeeds and its recorded owner pid+signature is proven gone; an active or unknown owner is never replaced, including another project's launch sharing the native home. Replacement and cleanup share one fail-closed lock per native home; a stale lock is never removed automatically. Begin or setup failure prints the cause and next step and launches the plain TUI without completion receipts. Quiet background/final-turn re-reads back off from 250 ms to 1 s and the Stop deadline also arms them. `turn.prompt` proves origin, `turn.ended` proves the outcome; `prompt.completed`/`aborted` are optional consistency rows, and notification turns may omit prompt ids. Never treat Stop, a final message chunk, a heartbeat or an empty observed task list as proof. Background inventory is read from every agent's task files and stays unknown on any malformed or unreadable row. Final-turn and inventory re-reads must not emit prompt, response, error, task command or title text. Native-person results are private. StopFailure is failed only after final-state readback, Interrupt is quiet, and launcher end/socket loss creates at most one interrupted result.
113
113
  - Empty-inbox polling advice (#681, `InboxPolling` in `src/hub/inbox-polling.ts`) is advisory: never refuse or delay an inbox read for it. The daemon computes it only for a pull-only peer after the pull completed, so a throw drops the advice, never the pulled envelopes; it counts only empty reads with no open, non-backlog task as owner or reviewer, and an assignment resets it. The plugin shows `[polling detected]` only for a well-formed `pollingAdvice` (count >= 3, minutes 0 to 10).
114
114
  - TUI launchers (Kimi, Jcode, agy) write the plugin bundle the hub reports in `status` into their MCP entry, and the CLI's own copy only when the hub reports none (#502). Only the Jcode start path checks the entry against the daemon's own `SERVER_JS` (`jcodeMcpReady`); Kimi TUI admission does not compare it.
115
- - Native CLI versions (#691): every version gate asks `assessVersion` in `src/adapters/compat.ts`; no other file holds a version constant. Add a version to `verified` only with a receipt in `docs/verification/`, and point the entry's `receipt` at the receipt a later version should repeat (the daily `scripts/agent-compat-watch.ts` names it, #849); a `line` is for contract gates only (an isolation gate never assumes a newer version compatible); the person's `ahub agents trust` admits one exact version on this machine and never skips a runtime proof; `ahub agents` with anything but `--json` stays `console` in `classifyPeerCommand` and refused in `liveTestRefusal` (`src/cli/identity.ts`). A version refusal starts with `VERSION_REFUSAL` and names only versions and the trust command; keep it that way so the daemon may show it.
115
+ - Native CLI versions (#691): every version gate asks `assessVersion` in `src/adapters/compat.ts`; no other file holds a version constant. Add a version to `verified` only with a receipt in `docs/verification/`, and point the entry's `receipt` at the receipt a later version should repeat (the daily `scripts/agent-compat-watch.ts` names it, #849); a `line` is for contract gates only (an isolation gate never assumes a newer version compatible); the person's `ahub agents trust` admits one exact version on this machine and never skips a runtime proof; `ahub agents` with anything but `--json` stays `console` in `classifyPeerCommand` and refused in `liveTestRefusal` (`src/cli/identity.ts`). A version refusal starts with `VERSION_REFUSAL` and names only versions and the trust command; keep it that way so the daemon may show it. The hub-owned Pi pin reads `COMPAT.pi.verified` and holds no constant of its own: `readPiPin` (`src/pi/pin.ts`) accepts `<hub home>/agents/pi/current.json` only for a verified version with a valid integrity string in user-owned, non-writable directories, and `ahub agents install pi` (person only, `src/pi/install.ts`) defaults to the newest verified version, so a Pi version added to `verified` needs a receipt that covers the packaged install.
116
+ - On a `COMPAT.verified` change, update the version lists in `docs/operations.md` and any spec sentence that names those versions in the same PR.
116
117
  - Jcode (#529): accept the native version only through `jcodeVersionSupported` (compat `jcode` line, 0.98.0 up to 1.1.0), in the daemon preflight (`jcodeVersionAsync`: off the event loop, owning its process group, output capped at 64 KiB), the doctor probe (`jcodeVersion`) and ACP `expectedAgent`; never pin the minor, and lower `line.below` when a release breaks the contract. Every owned jcode process (probe, serve, ACP and TUI) gets `JCODE_OWNED_ENV`, and the private socket name ends in `.sock`.
117
118
  - Jcode TUI (#464): use only the current owned launch's top-level `--socket`/`--resume` tuple after native saved-session proof. Prove the save only through `savedSession` (no-follow, single-link regular file, size-bounded, unchanged across the read, its `id` and `messages` matching) and refuse a requested model, provider profile or session that differs from the running launch with `JcodeOptionMismatch`, which names the flag, never its value (#559); both the launcher and `--print-command` report it through `refuseNamedOption` (#574). Hand the tuple only to a person's launcher through `native_tui_launch` (admission: `daemon.md`); a refused tuple throws `JcodeTuiRefusal` with one closed `JcodeTuiRefusalCode` per check, never a path, socket, session or launch id. The launcher turns a returned code into words only through `jcodeTuiCauseMessage` (#1093). The headless-after-recovery hint is `JcodePeer.statusNotice` (fixed `JCODE_HEADLESS_AFTER_RECOVERY`), shown only after a crash report or a resumed session and gone once a ready TUI launch was served (`tuiServed`); previews (`--dry-run`, or `--print-command` from anyone but a person) start nothing and never resolve it. Never synthesize a save or prompt to induce one. Ctrl-C during the save wait and frontend close retain ACP; preserve session/load identity refusal and headless owned recovery metadata, and never record the TUI as a managed terminal (`recordTerminalLaunch`): Jcode has no terminal recovery adapter (#564).
118
119
  - Jcode steer (#572): reach a busy owned jcode only through `nativeSteer` on its private server socket, never by cancelling its turn: `ping` must list `soft_interrupt_ids`, `subscribe` uses `target_session_id` (the ACP session id) and `continue_on_disconnect`, `state` must report `is_processing` (a soft interrupt sent while idle starts a turn by itself), then `soft_interrupt {content, urgent: false, client_id}`. `canSend` rechecks the captured turn, busy state, owned server process, socket identity and session immediately before the write. Every refusal before the send is `failed_safe` with nothing sent; a sent message that is not acknowledged, or whose turn cannot be confirmed, is `needs_review`, never `failed_safe` or `completed`. Read `currentTurn()` before sending and adopt only through `AcpPeer.adoptIntoTurn(turn, ...)`, which refuses a different or ended turn; adopted senders join the turn answer's audience (`replyParent` and `replyAudience` over the turn envelopes, so the hop cap holds), and each steer receipt is `accepted` at once and settles with the turn (`completed` on a normal end, `needs_review` on a cancel, failure, stop or watchdog). Headless Kimi and Qwen have no steer: status reports their waiting important messages only through `importantWaitingStatus` (`src/hub/daemon.ts`) past `budget.stale_min`. A turn that ends and restarts between jcode's `state` reply and the write still receives the message, held `needs_review` and adopted into nobody: keep that ceiling until upstream offers an atomic per-turn steer, and never add a cancel-to-deliver path.
@@ -29,8 +29,8 @@ Scope: quota and native context readings, checkpoints, pause, handoff and resume
29
29
  - `Budget.report` resolves the reporter and its account through `hooks.definitionOf` (the daemon's startup-bound project catalog; builtin-only when absent) and skips `user`, `hub` and a registered kind, configured and external module kinds included, with no `budget` block or with `budget.quotaExempt` (only local); an unregistered id keeps quota accounting. `budget.instrumented` (execution budget) never exempts quota.
30
30
 
31
31
  - Key quota readings, pause records, overrides, checkpoints and handoffs by the canonical account (`hooks.account`, idempotent); telemetry keeps the reporter id and native context occupancy stays per instance. `instanceBudgetHooks` fans pause, resume, checkpoint and handoff out to every member, and `canHandOff` excludes the paused account's siblings. Startup normalization merges old alias pause rows without dropping a row or marking an unfinished handoff done. A manual pause stays per member. Reviewer and headless implementer variants keep their base kind's `budget.account`.
32
- - Declared accounts (#1810, `src/hub/accounts.ts`): resolve a peer's budget key only through the daemon's `accountOf` (`accountKeyFor`): the bare kind for the default label and `<kind>:<label>` for a declared one, so a project without `accounts` keeps its keys. A home path stays in `config.local.json` and the `accounts.ts` return values; events, logs, status and CLI output carry labels only (`labelForHome`). With `budget.cross_account_handoff = false`, same-kind peers on other labels are siblings (`handoffSiblings`, and `canHandOff` compares the base kind), and a move across accounts writes one `budget_handoff` event with peer ids and labels only (`handoffEvents`).
33
- - Release-cut quota admission (`releaseQuotaSnapshot` in `src/hub/daemon.ts`, #481 S11): an account has a quota source only when one of its members' definitions has `budget.reader`, or `budget.resetSoftTokensOnResume` with `kimi_tokens_5h > 0`. Without a source a registered account is reported `no quota source` and never defers; with one, an unknown, stale or below-gate reading defers. Manual and budget-record pauses defer for every attached peer.
32
+ - Declared accounts (#1810, `src/hub/accounts.ts`): resolve a peer's budget key only through the daemon's `accountOf` (`accountKeyFor`): `<kind>:<label>` for a named account, `<kind>:default` for the default account of a kind with declared accounts (#1941), and the bare kind otherwise. A home path stays in `config.local.json` and the `accounts.ts` return values; events, logs, status and CLI output carry labels only (`labelForHome`). With `budget.cross_account_handoff = false`, same-kind peers on other labels are siblings (`handoffSiblings`, and `canHandOff` compares the base kind), and a move across accounts writes one `budget_handoff` event with peer ids and labels only (`handoffEvents`).
33
+ - Release-cut quota admission (`releaseQuotaSnapshot` in `src/hub/daemon.ts`, #481 S11): resolve pauses and headroom with the exact `accountOf(id)` key. Find source capability by base kind, including offline base definitions. A kind has a source when one of its definitions has `budget.reader`, or `budget.resetSoftTokensOnResume` with `kimi_tokens_5h > 0`. Without a source a registered account is reported `no quota source` and never defers; with one, an unknown, stale or below-gate reading defers. Manual and budget-record pauses defer for every attached peer.
34
34
 
35
35
  - Window kinds (#285 AC6, AC8): classify a window only through `windowKind` (`src/hub/window-kind.ts`: `native`, `count`, `manual`); a reporter that knows its kind passes it (`ahub budget set` is `manual`, the Kimi count `count`). Readings are kept per window id and kind, never overwriting each other. The gate and `headroom` act only on `gating()`: a fresh `manual` reading replaces the others for its window, and the hub `count` never gates while a fresh `native` or `manual` reading exists. A hard refusal drops the `manual` reading of each window it reports. `status()` lists the gating reading first and marks the information-only fresh ones `superseded`; never gate or route from `status()` windows.
36
36
  - No-quota notes (#285 AC6, AC7): a peer whose definition sets `budget.noQuotaReason` (Pi, local) gets a hub 5 h token count (`hubTokenWindows`, replayed at start through `TokenWindow.seed`) as information only, never a window, a meter or a gate. Build the notes in `ahub budget`, the console and the dashboard only through `budgetNotes` (`src/hub/budget-notes.ts`) from the definition and the counters, and Kimi's source state only from `KimiUsage.status()`: a rule and a count, never a path, a session id or log text.
@@ -50,6 +50,7 @@ Scope: delivery, digests and condensation, reply addressing, priority and limits
50
50
  - `resolveDelivery` (#713): a `queued` delivery was never handed to the peer, and a `failed` one was refused before it ran (#1103), so a busy peer blocks discarding neither; `dispatching` stays refused as `active delivery`, and so does `accepted` except for its own explicit channel's completed/discard (#1172, below); unrelated resolutions keep the busy fence. Only the recipient may explicitly complete/discard its own `needs_review` row, or for a peer with `acceptedSettlement: "explicit"` its own `accepted` row, through `resolveOwnDelivery` with an observed revision and reason (#1079), recording the peer actor through the existing journal audit. Another peer, remote-room disposition and active dispatching/accepted row refuse; this never replays the originals. Every other operator resolution stays fenced while busy. `resolveOwnDelivery` refuses with its own `PreEffectToolRefusal`, which names the cause and the next step, never through `resolutionRefusal`. A row that carries an invocation stays person-only (#1112). The daemon names the refusal from a closed list (`resolutionRefusal`), never from free error text. `queue discard --peer` goes through `resolveDelivery` row by row, reading each row's current revision just before its discard, never the revision listed at the start. Without `--state` it takes the peer's `queued` rows and its unsettled `failed` rows (wire `states`, sent only to a hub whose `features` list `queue_discard_states`; `needs_review` still needs an explicit `--state`). A row a resolution already settled (`settledIds()`) is history: `queue list` hides it unless `all`, and resolving it again is refused as `already resolved by <action>`, never `stale revision` (#1098, #1103).
51
51
  - Accepted channel deliveries (#1172): an `accepted` receipt means the channel transport took the notification, never that the session handled it. `expireAcceptedDeliveries`, run from the daemon's 5 s invocation sweep with the host-only `DaemonOptions.acceptedSettlementNow` clock, moves an explicit channel's `accepted` row older than `bus.accepted_settle_ms` (`acceptedSettleMs`, default 10 min) to `needs_review` with `ACCEPTED_SETTLE_TIMEOUT_REASON` under a revision fence. It holds the peer, routes an invocation through `onInvocationUncertain` and never replays. A repeated `accepted` receipt never renews the deadline. `settleSupersededDeliveries` and supervision skip timeout rows; an important, task or review timeout gets one ids-only conductor status notice unless `conductor.feed` is `off`. The explicit channel's `inbox` reply, a refused one included, carries `held` metadata for its own accepted and `needs_review` rows (`heldDeliveryHints(peer, true)`), or `{ unavailable: true }`, never an empty claim.
52
52
  - Review provenance (#1056): `reviewResponse` runs on every publish (`publishResult` and the daemon's channel `send`). It strips a caller's `refs.reviewPackage`/`refs.reviewResponse` and stamps a host-derived `reviewResponse` only on a chat or status that answers a review-scoped parent (`lastDelivery`, `lastPulled`, the bounded `reviewParents`, or `reviewObserverScope`, whose failure counts as scoped); never trust a peer's marker or match content. `beforeReviewInputHandoff` runs before every native handoff (steer, drain, pull); a throw leaves the work queued as `ReviewInputHandoffError` and is never a storage error. `publishReviewEnvelope` republishes a saved package only when `reviewEnvelopeStatus` is `absent`, refuses `failed`, `discarded` and `unknown`, and never replays a published one. Terminal pruning keeps hub review-package rows (`refs.reviewPackage` `review-*`). The bus constructor restores from `transportSnapshot()`; only recovery uses the strict `snapshot()`, which refuses malformed review provenance.
53
+ - Local `needs_review` rows (#1946): only a row carrying the journaled `holdsSelf` mark holds only itself. `AcpPeer.stop()` with no requested reason is the one writer (`DeliveryReceipt.holdsSelf`, column `deliveries.holds_self`); the control receipt path builds its own receipt and never copies the mark, and no reason text decides anything (a channel receipt, an ACP prompt error or a failed turn can write any text). Every other local `needs_review` row (requested stop, accepted-settle timeout, turn aborted, adapter failure, `REVIEWER_FALLBACK_UNCONFIRMED` #804, any invocation) holds the peer wide exactly as before, and a room row never did. The constructor scan, `restore()`, `queueSummary`, `refreshRecoveryHold` and the receipt path all decide it in the one `holdsPeerWide` in `bus.ts`. Add a new exception there, never at a call site. The next delivery carries the body-free held hint through `prefaceHeld`, replacing a pending one; `SupervisionFeed.needsReview` with options says the conductor may run `ahub queue resolve` and repeats once after `bus.hold_notice_ms`, while a call without options keeps the old person notice. Never replay or settle the row for this.
53
54
  - Room delivery rows (#1204): a remote (`remoteId`) `needs_review` row holds its peer only when it carries an invocation; an ordinary room chat uncertainty never blocks later queued work. Settle, requeue, hold or resume a remote row only through the room adapter's host ports (`settleRemoteReceipt`, `requeueRemoteNotSent`, `holdRemoteMissingIntent`, `holdInvalidatedRemoteOutcome`, `holdRemoteEpochRotated`, `resumeRemotePending`). Each is bound to the current adapter, room and member, revision-fenced and refused after a person disposition. `deliveryReceipt` never calls `completeDelivered` or `deliveryFailed` for a remote peer, and an uncertain invocation stays person-only. At journal open, `recoverInterrupted` keeps an active single-envelope, non-invocation remote row active only while the bus snapshot still holds its room, member and an unexpired queue deadline; every other `dispatching`/`accepted` row becomes `needs_review`.
54
55
  - Closed publication (#1222): once the `Bus` is closed, `publish` returns `{ targets: [] }` before touching the journal or observers, so a late room or presence publication after shutdown writes nothing; a live storage error still propagates. Keep the closed check first when you touch the publish path.
55
56
 
@@ -30,7 +30,8 @@
30
30
 
31
31
  - Console attention navigation selects a delivery only by an exact visible row id. A missing id or row prints read-only guidance; never select by peer or fall back to the first Queue row.
32
32
 
33
- Scope: the operator console, control WS and its protocol, state files, the dashboard listener and settings, the Claude channel's reconnect, `ahub setup`, git snapshots, upgrade and recovery. Read before editing `src/adapters/definitions/native-recovery*.ts`, `src/adapters/definitions/native-policy-aux.ts`, `src/adapters/definitions/native-config-*.ts`, `src/adapters/definitions/native-cli-*.ts`, `src/cli/console.ts`, `src/cli/console-state.ts`, `src/cli/report-layout.ts`, `src/cli/console-versions.ts`, `src/cli/attention.ts`, `src/ui/needs.ts`, `src/hub/daemon.ts`, `src/hub/config.ts`, `src/hub/ui.ts`, `src/hub/settings.ts`, `src/hub/control-client.ts`, `src/adapters/claude-channel.ts`, `src/hub/restart.ts`, `src/hub/recovery-store.ts`, `src/hub/snapshots.ts`, `src/hub/manager.ts`, `src/hub/lifecycle.ts`, the runtime selection and retention modules (`src/hub/project-runtime-state.ts`, `src/hub/project-runtime.ts`, `src/hub/runtime-capture-prune.ts`, `src/hub/runtime-prune-health.ts`, `src/hub/registry.ts`), `src/hub/crash.ts`, `src/hub/start-mode.ts`, `src/hub/terminal-open.ts`, `src/hub/recovery-error.ts`, `src/hub/db-timeout.ts`, `src/hub/db-schema.ts`, `src/hub/protocol-window.ts`, `src/hub/config-reload.ts`, `src/hub/config-apply.ts`, `src/hub/config-tier.ts`, `src/hub/config-edit.ts`, `src/hub/config-edit-host.ts`, `src/hub/claude-launch-proof.ts`, the session and provenance modules (`src/hub/session-identity.ts`, `src/hub/provenance.ts`, `src/hub/channel-project.ts`), `src/hub/recovery-continuity.ts`, `src/cli/recovery-presentation-options.ts`, `src/cli/setup.ts`, the default agent set (`src/hub/start-agents.ts`, `src/cli/start-agents-run.ts`), `src/cli/upgrade*.ts`, `src/cli/runtime-version-warning.ts`, `src/cli/terminal-recovery.ts`, `src/cli/recovery-package.ts`, `src/cli/facts-hook.ts`, `src/hub/usage.ts`, `src/hub/memory-profile.ts`, the memory code modules (`src/hub/memory-symbols.ts`, `src/hub/memory-code-overlay.ts`, `src/hub/memory-code-head.ts`, `src/hub/memory-stale-anchors.ts`, `src/cli/memory.ts`), the task brief host (`src/memory/brief.ts`, `src/hub/memory-plan-guard.ts`), `src/hub/native-hook-launch.ts`, `src/cli/output.ts`, `src/cli/warn-line.ts`, `src/ui/index.html`, the dashboard view models (`src/ui/roadmap-model.ts`, `src/ui/overview-model.ts`), the acon plugin (`src/ui/plugin.ts`, `src/ui/office-space.ts`, `src/cli/acon-register.ts`), `ahub study` (`src/cli/study.ts`, `src/cli/study-output.ts`), `src/hub/task-code-group.ts` (dashboard Code group), the agent drift sweep (`src/hub/agent-drift.ts`, `src/cli/agents.ts`) or the instance modules (`src/hub/instances.ts`, `src/hub/instance-config.ts`, `src/hub/instance-execution.ts`), the shared host (`src/hub/host.ts`), the MCP endpoint and its bridge core (`src/hub/mcp-endpoint.ts`, `src/hub/mcp-bridge-core.ts`), the Orca pane watch (`src/hub/orca-state.ts`), the light CLI path (`src/cli/light-dispatch.ts`), or before adding a native peer.
33
+ Scope: the operator console, control WS and its protocol, state files, the dashboard listener and settings, the Claude channel's reconnect, `ahub setup`, git snapshots, upgrade and recovery. Read before editing `src/adapters/definitions/native-recovery*.ts`, `src/adapters/definitions/native-policy-aux.ts`, `src/adapters/definitions/native-config-*.ts`, `src/adapters/definitions/native-cli-*.ts`, `src/cli/console.ts`, `src/cli/console-state.ts`, `src/cli/report-layout.ts`, `src/cli/console-versions.ts`, `src/cli/attention.ts`, `src/ui/needs.ts`, `src/hub/daemon.ts`, `src/hub/control/scope.ts`, `src/hub/control/sdlc-messages.ts`, `src/hub/control/native-messages.ts`, `src/hub/control/recovery-messages.ts`, `src/hub/control/recovery-operation.ts`, `src/hub/control/dispatch.ts`, `src/hub/control/dashboard-messages.ts`, `src/hub/control/delivery-messages.ts`, `src/hub/control/operations-messages.ts`, `src/hub/control/peer-messages.ts`, `src/hub/control/ui-actions.ts`, `src/hub/control/hub-tools.ts`, `src/hub/control/board-messages.ts`, `src/hub/control/hub-tool-helpers.ts`, `src/hub/control/task-ops.ts`, `src/hub/control/task-ops-more.ts`, `src/hub/config.ts`, `src/hub/ui.ts`, `src/hub/settings.ts`, `src/hub/control-client.ts`, `src/adapters/claude-channel.ts`, `src/hub/restart.ts`, `src/hub/recovery-store.ts`, `src/hub/snapshots.ts`, `src/hub/manager.ts`, `src/hub/lifecycle.ts`, the runtime selection and retention modules (`src/hub/project-runtime-state.ts`, `src/hub/project-runtime.ts`, `src/hub/runtime-capture-prune.ts`, `src/hub/runtime-prune-health.ts`, `src/hub/registry.ts`), `src/hub/crash.ts`, `src/hub/start-mode.ts`, `src/hub/terminal-open.ts`, `src/hub/recovery-error.ts`, `src/hub/db-timeout.ts`, `src/hub/db-schema.ts`, `src/hub/protocol-window.ts`, `src/hub/config-reload.ts`, `src/hub/config-apply.ts`, `src/hub/config-tier.ts`, `src/hub/config-edit.ts`, `src/hub/config-edit-host.ts`, `src/hub/claude-launch-proof.ts`, the session and provenance modules (`src/hub/session-identity.ts`, `src/hub/provenance.ts`, `src/hub/channel-project.ts`), `src/hub/recovery-continuity.ts`, `src/hub/recovery-kept-roster.ts`, `src/hub/upgrade-session-contract.ts`, `src/hub/channel-project-base.ts`, `src/cli/recovery-presentation-options.ts`, `src/cli/setup.ts`, the default agent set (`src/hub/start-agents.ts`, `src/cli/start-agents-run.ts`), `src/cli/upgrade*.ts`, `src/cli/runtime-version-warning.ts`, `src/cli/terminal-recovery.ts`, `src/cli/recovery-package.ts`, `src/cli/facts-hook.ts`, `src/hub/usage.ts`, `src/hub/memory-profile.ts`, the memory code modules (`src/hub/memory-symbols.ts`, `src/hub/memory-code-overlay.ts`, `src/hub/memory-code-head.ts`, `src/hub/memory-stale-anchors.ts`, `src/cli/memory.ts`), the task brief host (`src/memory/brief.ts`, `src/hub/memory-plan-guard.ts`), `src/hub/native-hook-launch.ts`, `src/cli/output.ts`, `src/cli/warn-line.ts`, `src/ui/index.html`, the dashboard view models (`src/ui/roadmap-model.ts`, `src/ui/overview-model.ts`), the acon plugin (`src/ui/plugin.ts`, `src/ui/office-space.ts`, `src/cli/acon-register.ts`), `ahub study` (`src/cli/study.ts`, `src/cli/study-output.ts`), `src/hub/task-code-group.ts` (dashboard Code group), the agent drift sweep (`src/hub/agent-drift.ts`, `src/cli/agents.ts`) or the instance modules (`src/hub/instances.ts`, `src/hub/instance-config.ts`, `src/hub/instance-execution.ts`), the shared host (`src/hub/host.ts`), the MCP endpoint and its bridge core (`src/hub/mcp-endpoint.ts`, `src/hub/mcp-bridge-core.ts`), the Orca pane watch (`src/hub/orca-state.ts`), the light CLI path (`src/cli/light-dispatch.ts`), or before adding a native peer.
34
+ - Control scope (#1830 S2a): the `hub_*` tool dispatch (`taskOpBody`) lives in `src/hub/control/` and reads the daemon only through `DaemonScope` (`scope.ts`), the one getter-backed object `daemonScope` in `startDaemon`; never copy a field or add module-level state there. A name the moved code must assign gets a setter on that object in the same change, and the `readonly` on its field is dropped. `taskOpBody` in `daemon.ts` stays a same-signature wrapper, so callers and tests are unchanged.
34
35
 
35
36
  - The plugin bundle is installed apart from the daemon. Breaking a control WS message contract bumps `PROTOCOL` in `control-client.ts`; a new request answered as unknown or an optional field preserves it, as does additive optional public task metadata in `ui_snapshot` that older clients ignore (such as `deps` in #246). When `PROTOCOL` advances, the release PR adds a row to `BRIDGE_PROTOCOL_RELEASES` (`src/hub/protocol-window.ts`), leaves the prior row frozen and runs `bun scripts/bridge-protocol-table.ts --write`.
36
37
  - Bundle closure and the light path (#1778): the plugin bundle carries what `src/adapters/claude-channel.ts` imports, so it must not reach `src/hub/conductor.ts`, `src/hub/tasks.ts` or `src/hub/tooling.ts` (`test/channel-import-closure.test.ts`; instance configuration comes from `src/adapters/declaration-data.ts`), and `bun scripts/build.mjs --check` fails a stale bundle. `src/cli/light-dispatch.ts` (#1778 T7) runs `version` and `instruction-hook` from their `src/cli/commands/` modules without `main.ts` or `src/hub/config.ts`, and only when no agent, recovery or project marker is in the environment; `bun scripts/check-import-graph.ts --check` fails an import that reaches the shared setup from those entries.
@@ -70,14 +71,14 @@ Scope: the operator console, control WS and its protocol, state files, the dashb
70
71
  - State files that clients read (`status.json`, `control-token`) are written after the port is bound, and `status.json` via temp file + rename.
71
72
  - Project context (#1779 T2): daemon code takes its root, state directory and child environment only from `ctx` (`daemonProjectContext` or `hostedProjectContext`, `src/hub/project.ts`), and a child bound to the project gets its variables only from `projectChildEnv(ctx)`. Never read `process.cwd()`, `AGENTHUB_STATE_DIR` or `AGENTHUB_PROJECT_DIR` under `src/hub`: `scripts/check-process-identity.ts` (run by `test/process-identity-check.test.ts`) fails such a read unless its exact line is on `ALLOWED` with its side and reason, and fails a stale entry.
72
73
  - Shared host (#1779 T3a, `src/hub/host.ts`, `ahub host`): `host.shared` (off by default) runs a project's daemon in the one `Host` of its runtime. Only the winner of `Registry.claimHost` serves `hosts/<hash>.sock` or removes a stale one; a loser joins the answering host through `askHost` or fails closed, and a recovery operation or live test never runs shared. Launch a hosted project only through `launchHostedProject` inside `Host.within(id, ...)`, so an uncaught error stops that project alone; an unattributed one stops the whole host.
73
- - MCP endpoint (#1780, `startMcpEndpoint` in `src/hub/mcp-endpoint.ts`): it starts only when the lifecycle passes `mcpHome`, so a test daemon never writes into the person's hub home; `run/` and `run/<projectId>/` stay `0700` and this user's, `mcp.sock` `0600`, and a refusal is logged while the hub runs without the endpoint. A session opens only on a valid hello (the control token compared in constant time, within 5 s and 8 KiB, from a pid `ps` reports as this user) and keeps an account label, never the home path. Only an `exclusiveOwner` daemon (it holds its fixed control port) replaces a stale socket, after a refused connect and the same inode on two `lstat`s; never add another unlink path.
74
+ - MCP endpoint (#1780, `startMcpEndpoint` in `src/hub/mcp-endpoint.ts`): it starts only when the lifecycle passes `mcpHome`, so a test daemon never writes into the person's hub home. Production sets `mcpServe` and advertises `mcpServing` only alongside a live served socket; `run/` and `run/<projectId>/` stay `0700` and this user's, `mcp.sock` `0600`, and a refusal is logged while the hub runs without the endpoint. A session opens only on a valid hello (the control token compared in constant time, within 5 s and 8 KiB, from a pid `ps` reports as this user) and keeps an account label, never the home path. Only an `exclusiveOwner` daemon (it holds its fixed control port) replaces a stale socket, after a refused connect and the same inode on two `lstat`s; never add another unlink path.
74
75
  - Open native memory through the shared profile-aware helper with an explicit current selector binding; never fall back to shared v1 after invalid/missing generation metadata. Check that binding at hub call-site entry and before candidate/counter writes, including callbacks retained across awaits; do not intercept store methods with proxies/private hooks or claim atomic in-flight cutover. Quiesce and close consumers before migration/selection changes, then reopen through the supported lifecycle. Keep the sidecar at the independent memory root, not inside the selected generation. Report memory availability separately from bus health; never hot-rebind or migrate as a startup repair (`docs/memory.md` §Selected memory profile).
75
76
  - Take the memory project only from `memoryProjectFor` (the alias-resolved `memoryProjectKey` in the ambient memory home) in the daemon, `ahub memory` and `ahub goal`, or from `memoryProjectForStore` for a caller-injected store, which resolves the alias in that store's own `profile.home`; bind an injected sharded store with `bindProfileMemory(store, _, memoryProjectKey(cwd))` so a remap latches it unavailable; never use a raw `memoryProjectKey` as the project of a store, screen or raw command. The daemon resolves it once at start (falling back to the raw key, so the memory home never blocks startup) and passes both `project` and the raw `projectKey`, so the binding latches unavailable once the alias log maps the key elsewhere; a restart binds the new key.
76
77
  - Ask whether a curated store holds a derived index only through `memoryIndexExists` (`src/hub/memory-profile.ts`, read-only directory listing): agent-mem names the file per index version (`index.db`, `index-v4.db` since 0.25.0), so never test or open a fixed `index.db`.
77
78
  - Detect a curated split by `lstat` of `shards.json` (`splitMarked`), never `existsSync`. An inactive, malformed, dangling or unreadable marker throws `MEMORY_SPLIT_INCOMPLETE` before any shard read, and callers show that message instead of the generic profile refusal. On a split home open only through `openShardStore` with the canonical memory dir and a project key; never a plain `MemoryStore`, and refuse without a key. Profile inspection and `profile-check` on a split home read the shard seals (`shardProfileForProject` for each hub's own project), never the legacy selector (#536).
78
- - The channel's reconnect loop stops on closes a retry cannot fix (`TERMINAL_CLOSES` in `claude-channel.ts`); a new daemon close code that means "do not come back" belongs there, or two clients fight over it forever. Close 4426 (wire version mismatch) is not terminal: the session logs the cause and retries every `WIRE_MISMATCH_RETRY_MS` (5 min), so an upgraded hub takes it back without a restart.
79
+ - The channel's reconnect loop stops on closes a retry cannot fix (`claudeTerminalClose` in `claude-connection-policy.ts`); a new daemon close code that means "do not come back" belongs there, or two clients fight over it forever. Close 4426 (wire version mismatch) is not terminal: the session logs the cause and retries every `WIRE_MISMATCH_RETRY_MS` (5 min), so an upgraded hub takes it back without a restart.
79
80
  - The channel advertises `tools.listChanged`; build its tool list only through `toolListFor`, a wrapper of `mcpToolList` in `src/hub/mcp-bridge-core.ts`, which also holds the instructions (`mcpServerOptions`); both take explicit `McpSurface` values and read no environment or file, so the MCP endpoint (#1780 T2a) can share them. Change the channel's tools or text there. Record `listedTools` from each `ListTools` reply, so a reconnect sends `sendToolListChanged` when the whole definitions differ or the lifecycle stays unreadable (#490).
80
- - Close 4000 ends on its own (4426 retries on its own timer, above), so it is not in `TERMINAL_CLOSES`: the session stands by and reconnects only once `status.json` reports the peer offline and not `claiming`. One exception (#205, `peerHeld` in `claude-channel.ts`): a session with channel pushes also reconnects when the holder is reported `toolsOnly` and not `claiming`, and takes the peer; the daemon refuses the reverse with 4000. Reconnecting blind would evict whoever holds the id now, and the two would trade it forever. `status.json` is advisory: a reconnecting standby sends `standby: true`, and the daemon refuses it with 4000 while `standbyHeld` holds (a claim, or an open socket; only a channel-capable standby may replace a pull-only holder). A hello whose `launchId` differs from this instance's current `claude-launch` record closes with 4430, which is in `TERMINAL_CLOSES`; no launch id or no record keeps the old admission (#551). `claim()` happens at hello and `attach()` only after the preface, so the peer reads as offline in between: the daemon writes the status file at the claim and the flag covers that window.
81
+ - Close 4000 ends on its own (4426 retries on its own timer, above), so it is not a terminal close: the session stands by and reconnects only once `status.json` reports the peer offline and not `claiming`. One exception (#205, `peerHeld` in `claude-channel.ts`): a session with channel pushes also reconnects when the holder is reported `toolsOnly` and not `claiming`, and takes the peer; the daemon refuses the reverse with 4000. Reconnecting blind would evict whoever holds the id now, and the two would trade it forever. `status.json` is advisory: a reconnecting standby sends `standby: true`, and the daemon refuses it with 4000 while `standbyHeld` holds (a claim, or an open socket; only a channel-capable standby may replace a pull-only holder). A hello whose `launchId` differs from this instance's current `claude-launch` record closes with 4430, which is in `TERMINAL_CLOSES`; no launch id or no record keeps the old admission (#551). `claim()` happens at hello and `attach()` only after the preface, so the peer reads as offline in between: the daemon writes the status file at the claim and the flag covers that window.
81
82
  - Peer takeover (#1174): `peer_takeover` is console-role only, with closed fields (`peer`, optional `standbyId` of at most 64 characters, no control or format characters), and `ahub peer takeover` is in `liveTestRefusal`. It refuses without detaching the owner when no eligible standby remains, and answers `outcome: "requested"`; attachment is confirmed only by status. A connection detached by the person (`detachedByPerson`) refuses every peer request with the fixed detached text, and the plugin stops reconnecting on 4405. Never treat a standby id or reported PID as session, launch or permission evidence.
82
83
  - Channel push evidence (#1171): the plugin pushes only when `currentClaudeChannelEvidence()` (`src/adapters/claude-channel-evidence.ts`) reads `development-channel-launch` from the direct parent's bounded process row. The inherited `AGENTHUB_CHANNEL` marker alone, or unknown, malformed or changed-parent evidence, keeps it tools-only. The hello's `channelEvidence` is a closed, display-only label: an unlisted value becomes `unknown`, a missing one `unreported`. Never admit, deliver or authorize from it, and never walk ancestors.
83
84
  - Adding a native peer requires testing the command emitted by the actual recovery driver, not only its inspection or launch helpers. Never let a generic non-Codex branch treat a new peer as Claude.
@@ -127,7 +128,7 @@ Scope: the operator console, control WS and its protocol, state files, the dashb
127
128
  - `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.
128
129
  - `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`.
129
130
 
130
- - When preserving a recovery source, copy only the hub's declared first-party `@staix/agent-mem` and exact `@staix/cli-output` packages and the reviewed dependencies declared by agent-mem through `preserveRuntimeDependencies` in `src/cli/recovery-package.ts`; include their identities and runtime bytes in `packageDigest` without changing digests of older packages that lack the output dependency. 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 dependency 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. agent-mem may declare `@staix/cli-output` at the hub's exact pin and exact pins for `@staix/mcp-stdio` and `@staix/agent-hosts`. Bind each to a real sibling package with the matching name and version, no dependencies or nested `node_modules`, and the reviewed asset list (#1664, #1737).
131
+ - When preserving a recovery source, copy only the hub's declared first-party `@staix/agent-mem` and exact `@staix/cli-output` and `@staix/agent-review` packages and the reviewed dependencies declared by agent-mem through `preserveRuntimeDependencies` in `src/cli/recovery-package.ts`; include their identities and runtime bytes in `packageDigest` without changing digests of older packages that lack the output dependency. 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 dependency 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. agent-mem may declare `@staix/cli-output` at the hub's exact pin and exact pins for `@staix/mcp-stdio` and `@staix/agent-hosts`. Bind each to a real sibling package with the matching name and version, no dependencies or nested `node_modules`, and the reviewed asset list (#1664, #1737). Capture AREV's `src/` and manifest only, with its memory range and output pin satisfied by the same reviewed siblings. The AREV core does not import the CLI's nested `mcp-stdio`.
131
132
  - 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 also accepts the reviewed agent-mem siblings from `MEMORY_RUNTIME_LAYOUTS` (`src/hub/runtime-package-assets.ts`), the one asset table recovery and prune share; add a sibling there, never in either consumer (#1737). 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.
132
133
 
133
134
  - 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.
@@ -15,6 +15,6 @@ Scope: the model relay and its journal, the hub's own inference and its slots, O
15
15
  - Relay cooldown policy and journal size (`model_relay.*`, read through `modelOperationalReaders`, #984) are passed only when a relay is constructed, and `inference.backoff_min` only when `Inference` is constructed. Both are restart-bound: a reload never rewrites a running relay's cooldowns or journal, or an existing backoff deadline.
16
16
  - MLX owner and generation identity read `ps lstart` with LC_ALL=C/TZ=UTC pinned (#177): unpinned, a record written under one environment reads as a foreign process under another, and the fail-closed paths would refuse the hub's own server.
17
17
 
18
- - Optional adec `decision` routes (#554) default off and support shadow only; reject enforce at load with the #554 follow-up and do not keep an application or gateway effort path. Shadow must preserve the recorded stage model, effort and conversation. Send only bounded host-screened evidence after positive campus admission for sensitive turns; sensitive evidence is dimensions only, and remote/review-observer-excluded turns skip the service. Re-read current board/turn privacy and observer facts across awaits and before service HTTP effects and route metadata emission; changed or unavailable authority refuses the stale turn, never a model fallback around that refusal. Keep one opaque user-turn id through the tool loop; let adec recheck its pins and hard rules, rather than caching valid picks in the hub. Validate returned pairs against the route list, retain the heuristic on client failures/no_candidate, and keep evidence, arguments, secrets and service error prose out of route events. Never route PII screening, pure peer assignment or escalation authority through this service. A stage route asks it only through `ambiguousStage` (`classifier = "decision"`, `ambiguous_band` default `0.05`, `abs(score - confidence_threshold) <= band`): membership decides only whether the question is asked, the answer is recorded and changes no tier, the two tiers with effort `none` are the only options, and `ambiguous_band = 0` asks nothing.
18
+ - Optional adec `decision` routes (#554) default off. Allow enforce only on a person-configured decision route in routing.toml. Apply only a validated non-abstaining alias/effort pair and use the offered current pair on failure. Recheck the turn and authority before gateway execution. Shadow must preserve the recorded stage model, effort and conversation. Send only bounded host-screened evidence after positive campus admission for sensitive turns; sensitive evidence is dimensions only, and remote/review-observer-excluded turns skip the service. Re-read current board/turn privacy and observer facts across awaits and before service HTTP effects and route metadata emission; changed or unavailable authority refuses the stale turn, never a model fallback around that refusal. Keep one opaque user-turn id through the tool loop; let adec recheck its pins and hard rules, rather than caching valid picks in the hub. Validate returned pairs against the route list, retain the heuristic on client failures/no_candidate, and keep evidence, arguments, secrets and service error prose out of route events. Never route PII screening, pure peer assignment or escalation authority through this service. A stage route asks it only through `ambiguousStage` (`classifier = "decision"`, `ambiguous_band` default `0.05`, `abs(score - confidence_threshold) <= band`): membership decides only whether the question is asked, the answer is recorded and changes no tier, the two tiers with effort `none` are the only options, and `ambiguous_band = 0` asks nothing.
19
19
  - R2 host model/effort choices for `plan_execute`, `advisor` and `escalation` remain default-off and shadow-only. They are suggestions only: keep the plan phase, advisor/escalation trigger and verdict, privacy/currentness fences, and actual fallback execution in the hub; do not add effort application, authority transfer, or phase/purpose event fields. Judge-choice route metadata uses only the checked `decisionTarget: "judge"` marker and remains outside executor label/progress/usage accounting. The ADEc templates are placeholders with `onPrem: false` until a person verifies the serving location; no live or gain claim follows from fixtures.
20
20
  - The offline triage evaluation (`scripts/decision-eval.ts`, #554 AC5) is a person-run leg, never CI. It serializes `hub.db` from a read-only connection into one consistent image and reads that copy (never separate `hub.db`/`-wal`/`-shm` copies, which a checkpointing writer can leave on different WAL generations), keeps only planner-classified non-PII rows (no `triaged` or `class defaulted` history, no `pii`/`pii_path` signal, public text), and compares `Inference.triage` against a loopback adec `/v1/route` or `/v1/systemone`, each adec turn id carrying a fresh per-run id so no earlier pin is reused. It is evidence for D5 only: wiring a decider into `Tasks.triage`, `assign()` or the PII screen is a separate decision, and a change here never touches them.
@@ -1,8 +1,8 @@
1
1
  # Task board and hub tools
2
2
 
3
- Scope: the task flow, assignment, the state machine and the hub's MCP tools. Read before editing `src/hub/tasks.ts`, `src/hub/tasks-study.ts`, `src/hub/tasks-survey.ts`, `src/hub/tasks-roadmap.ts`, `src/hub/tasks-roadmap-plan.ts`, `src/hub/tasks-guidance.ts`, `src/hub/tasks-experiment.ts`, `src/hub/board.ts`, `src/hub/routing.ts`, `src/hub/task-sweep.ts`, `src/hub/settled-roles.ts`, `src/hub/conductor.ts`, `src/hub/conductor-peer.ts`, `src/hub/supervision.ts`, `src/hub/tool-refusal.ts`, `src/hub/hub-tools.ts`, `src/hub/review-brief.ts`, `src/hub/reviewer-pool.ts`, `src/hub/reviewer-pool-config.ts`, `src/hub/release-admission.ts`, `src/hub/main-checkout.ts`, `src/hub/checks.ts`, `src/hub/task-repository.ts`, `src/hub/review-findings.ts`, `src/hub/review-scope.ts`, `src/hub/plan-conformance.ts`, `src/hub/risk-tier.ts`, `src/hub/review-checkout.ts`, `src/hub/sdlc-metrics.ts`, `src/hub/sdlc-merge.ts`, `src/hub/sdlc-mirror.ts`, `src/hub/no-writes.ts`, `src/hub/workflow.ts`, `src/hub/deliverables.ts`, `src/hub/deliverable-files.ts`, `src/hub/research-campaign.ts`, `src/hub/research-experiments.ts`, `src/hub/research-runner.ts`, `src/hub/task-approval.ts`, `src/hub/ci-watch.ts`, the SDLC sync and check (`src/hub/sdlc-sync.ts`, `src/hub/sdlc-check.ts`), the structure budget (`src/hub/structure-budget.ts`, `src/hub/structure-scan.ts`) or the cross-project handoff (`src/hub/handoff.ts`, `src/cli/handoff-args.ts`, `src/cli/handoff-output.ts`).
3
+ Scope: the task flow, assignment, the state machine and the hub's MCP tools. Read before editing `src/hub/tasks.ts`, `src/hub/tasks-study.ts`, `src/hub/tasks-survey.ts`, `src/hub/tasks-roadmap.ts`, `src/hub/tasks-roadmap-plan.ts`, `src/hub/tasks-guidance.ts`, `src/hub/tasks-experiment.ts`, `src/hub/tasks-audit.ts`, `src/hub/tasks-handoff.ts`, `src/hub/tasks-release.ts`, `src/hub/tasks-types.ts`, `src/hub/tasks-backlog.ts`, `src/hub/tasks-specs.ts`, `src/hub/board.ts`, `src/hub/routing.ts`, `src/hub/task-sweep.ts`, `src/hub/settled-roles.ts`, `src/hub/conductor.ts`, `src/hub/conductor-peer.ts`, `src/hub/supervision.ts`, `src/hub/tool-refusal.ts`, `src/hub/hub-tools.ts`, `src/hub/review-brief.ts`, `src/hub/reviewer-pool.ts`, `src/hub/reviewer-pool-config.ts`, `src/hub/release-admission.ts`, `src/hub/main-checkout.ts`, `src/hub/checks.ts`, `src/hub/task-repository.ts`, `src/hub/review-findings.ts`, `src/hub/review-ledger.ts`, `src/hub/spec-ack-tool.ts`, `src/hub/spec-report-history.ts`, `src/hub/review-scope.ts`, `src/hub/plan-conformance.ts`, `src/hub/risk-tier.ts`, `src/hub/review-checkout.ts`, `src/hub/sdlc-metrics.ts`, `src/hub/sdlc-merge.ts`, `src/hub/sdlc-mirror.ts`, `src/hub/no-writes.ts`, `src/hub/workflow.ts`, `src/hub/deliverables.ts`, `src/hub/deliverable-files.ts`, `src/hub/research-campaign.ts`, `src/hub/research-experiments.ts`, `src/hub/research-runner.ts`, `src/hub/task-approval.ts`, `src/hub/ci-watch.ts`, the SDLC sync and check (`src/hub/sdlc-sync.ts`, `src/hub/sdlc-check.ts`), the structure budget (`src/hub/structure-budget.ts`, `src/hub/structure-scan.ts`) or the cross-project handoff (`src/hub/handoff.ts`, `src/cli/handoff-args.ts`, `src/cli/handoff-output.ts`).
4
4
 
5
- - Domain modules (#1830 S4a, S4b, S4c): the study, synthesis and survey methods live in `src/hub/tasks-study.ts` (`StudyDomain`) and `src/hub/tasks-survey.ts` (`SurveyDomain`); the roadmap and milestone methods in `src/hub/tasks-roadmap.ts` (`RoadmapDomain`: authority, milestone edits, snapshot, export, check, sync) and `src/hub/tasks-roadmap-plan.ts` (`RoadmapPlanDomain`: placement, triage, decomposition, import); the guidance variant and guidance probe methods in `src/hub/tasks-guidance.ts` (`GuidanceDomain`: the probe timers, the active map and the stop drain are instance fields of the domain, and `Tasks.stopGuidanceProbes` and `guidanceProbesPending` delegate to it) and the experiment, execution lineage and execution link methods in `src/hub/tasks-experiment.ts` (`ExperimentDomain`). `Tasks` builds each with `d` and an explicit host (`StudyHost`, `SurveyHost`, `RoadmapHost`, `RoadmapPlanHost`, `GuidanceHost`, `ExperimentHost`: bound `Tasks` callbacks, a getter per shared object) and keeps a one-line delegating method for every member it or the other domain reaches, so callers and signatures are unchanged. A module holds no module-level state and is never imported by adapters, tools or the CLI; `Tasks` stays the only board writer. A new call from a moved body into `Tasks` is a new host member, never an import of `tasks.ts` values.
5
+ - Domain modules (#1830 S4a, S4b, S4c, S4d-1, S4d-2): the study, synthesis and survey methods live in `src/hub/tasks-study.ts` (`StudyDomain`) and `src/hub/tasks-survey.ts` (`SurveyDomain`); the roadmap and milestone methods in `src/hub/tasks-roadmap.ts` (`RoadmapDomain`: authority, milestone edits, snapshot, export, check, sync) and `src/hub/tasks-roadmap-plan.ts` (`RoadmapPlanDomain`: placement, triage, decomposition, import); the guidance variant and guidance probe methods in `src/hub/tasks-guidance.ts` (`GuidanceDomain`: the probe timers, the active map and the stop drain are instance fields of the domain, and `Tasks.stopGuidanceProbes` and `guidanceProbesPending` delegate to it) and the experiment, execution lineage and execution link methods in `src/hub/tasks-experiment.ts` (`ExperimentDomain`). Release planning and readback live in `src/hub/tasks-release.ts` (`ReleaseDomain`); flow methods that release work or holds stay in `Tasks`. Spec reports, readback and acceptance gates live in `src/hub/tasks-specs.ts` (`SpecDomain`). The security audit and research evidence methods (audit start, report, carry, show, view and line; evidence record, read and origins; the review checkout evidence read) live in `src/hub/tasks-audit.ts` (`AuditDomain`, #1830 S4e-4): its board writes (`auditCreate`, `auditApply`, `recordEvidenceLink`) go through `AuditHost` callbacks, and `heldEvidence`, `tellConductorEvidenceOnly`, `learnEvidence` and `synthesisEvidence` stay in `Tasks` with the review and study flows. The cross-project handoff methods (authority, handoffIn, event, catch-up, state lookup and the conductor cancel rule) live in `src/hub/tasks-handoff.ts` (`HandoffDomain`, #1830 S4e-3); `doneWithHandoff` and `worktreeHandoff` stay in `Tasks` with the done and worktree flow, and the `[pii]` and private-turn refusals keep their wording in `handoffOutAuthority`. The top-level types and `TasksDeps` live in `src/hub/tasks-types.ts` (types only, #1830 S4e-1); `tasks.ts` re-exports every name it exported before, and `tasks.ts` supplies the private handoff symbol as the key type. Backlog planning, pulls and planner notices live in `src/hub/tasks-backlog.ts` (`BacklogDomain`). Keep board writes behind the explicit Tasks host callbacks. The carry proofs remain in one WeakMap per `Tasks` instance, and the accept, done and review flow stays in `Tasks`. `Tasks` builds each with `d` and an explicit host (`StudyHost`, `SurveyHost`, `RoadmapHost`, `RoadmapPlanHost`, `GuidanceHost`, `ExperimentHost`, `ReleaseHost`, `SpecHost`: bound `Tasks` callbacks, a getter per shared object) and keeps a one-line delegating method for every member it or the other domain reaches, so callers and signatures are unchanged. A module holds no module-level state and is never imported by adapters, tools or the CLI; `Tasks` stays the only board writer. A new call from a moved body into `Tasks` is a new host member, never an import of `tasks.ts` values.
6
6
  - Scope every task-place comparison through `TaskRepositories` (`src/hub/task-repository.ts`, #476): explicit `refs.repo`, else a common outside-absolute-ref repository or parent, else this project. Preserve relative display spelling within that key and gate overlap, contradiction, replay and held evidence by equal keys. Warm/cache repository identity at task mutation and startup; never repeat Git reads for unchanged overlap inputs. Set `refs.repo` for work in another repository; repo-only accept metadata never grants execution or file access.
7
7
  - Tool callers are models: MCP `inputSchema` is not enforced on the way in. Normalize at the boundary (`cleanRefs`) before anything reaches the board, and never throw after a board write: a publish or notify that follows a `review()` or `done()` board write goes through the one `releaseNotice` guard, which turns a failed publish into a console notice, drops a failed notify and never retries (#231, #243). An assignment's delivery once its board write is saved (#276, #297): the move is fact, the failed publish is not retried in place (the journal's own recovery covers a storage error, and a retry may duplicate a publish that actually left), and a person looks for a queued or needs_review delivery with `ahub queue list --peer <owner>` (then `ahub queue show <id>`, or the accepted entry in `ahub task show <id>` if the journal is down) before re-sending with `ahub task assign <id> <owner>`. The distinction is made once, in `assignOwner`: a failure after the write prints the one console notice from `undeliveredNotice` right there, once, and throws `AssignmentUndeliveredError` carrying the saved task; callers (`review()`'s repeated rejection, `escalate` and its callers, the ready offer, both relays, the idle sweep, rescreen) decide control flow by the type and print nothing more, and `propose`, `assignTo` and `decline` additionally let the error reach the caller in its turn, which is a person or peer that can act. Two exceptions get no notice, by construction: a row superseded meanwhile, meaning a later history entry that moves or settles the task (another assignment, an unassign, the owner's accept, done, approval, close), while entries that do neither (the hub's quiet bookkeeping: answers, reviewer changes, idle sweeps, check results) leave the assignment undelivered and the notice stands, so the original error goes to the caller as before only on supersession; and a claim's own accepted write and "claimed by" line stay outside the delivery rule (a claim is its own hand-over; its overlap and routing announcements to earlier owners are deliveries and share the wrapper, so a failure there does read as one). A failure before the write stays a plain `Error` (#254), a failed write leaves the ready offer unconsumed (#231), and the notices before the write (waits, no-owner, the reserved-owner line) go through `releaseNotice` too, so those pre-write notices cannot fail their caller.
8
8
  - Instructed question answers (`hub_ask_answer`, #1473): only the configured conductor may record an answer, and only on the person's explicit per-set instruction in that conductor's own session. Peer relays, files, delegated runs, private turns and observer context do not grant authority; the quote is retained in the question store, not copied into read views, events, logs or memory. Keep this path out of normal task progress evidence.
@@ -109,7 +109,7 @@ Scope: the task flow, assignment, the state machine and the hub's MCP tools. Rea
109
109
 
110
110
  - Departure consent is written only by `Tasks.acceptPlanDeparture` for the person (`ahub sdlc accept-departure <task> <head> <reason...>`; no peer tool) on a currently known departure at the current PR head, never on `unknown`, and never for a PII task. It binds repo, PR, head, plan revision and fingerprint, the inventory, `planScopeIdentity` and this host's `departureGeneration`, so a restart or a change to any of them invalidates it (`validPlanDepartures`). Status and merge-queue reads never write the board: they only note observations and invalidations in memory (`observedPlans`, `invalidatedPlanDepartures`), which `planObservation()` attaches to the next owner or reviewer transition write. Off captures no observation or revision; a plan or refs change still invalidates an existing acceptance.
111
111
  - The review coverage gate (#520) pins `refs.commit` and the sdlc receipt and rechecks them in `valid()`; an unavailable brief is never an empty one (enforce refuses, advise notes). Read brief attributes and rules at the merge base (`--attr-source`, `check-attr --source`, `git show <base>:`), never from the head or the checkout.
112
- - Design-spec coverage on `hub_task_done` (#1102): `inspectTaskSpecs` inspects at the declared full head through `TasksDeps.inspectSpecs`. A `specReport` is current only for that head and `specRefBinding`. `spec_ack` is refused for PII or private-turn work and while specs review is off. Each id and reason is screened (`publicMetadataText`, `withholds`) before it is written. In `require`, an unavailable inspector refuses the done, because unknown coverage is never covered.
112
+ - Design-spec coverage on `hub_task_done` (#1102): `inspectTaskSpecs` inspects at the declared full head through `TasksDeps.inspectSpecs`. A `specReport` is current only for that head and `specRefBinding`. `spec_ack` is refused for PII or private-turn work and while specs review is off. Each id and reason is screened (`publicMetadataText`, `withholds`) before it is written. In `require`, an unavailable inspector refuses the done, because unknown coverage is never covered. After filing, use `hub_spec_ack` as the owner or configured conductor to add missing public reasons to the current in-review or approved report at its exact head. Preserve the review and approval bindings.
113
113
  - A `routing.reviewOnly` definition is refused as owner inside `assign()`'s eligibility check, for every class, nomination and reservation; keep it there, not at call sites. A definition with `reviewer.unavailable` is refused as reviewer there too (code `policy`); unavailable never means pass.
114
114
  - A definition's `routing.allowedRoles` is a fixed role ceiling (#543): `assign()` refuses a peer whose required role (reviewer for the reviewer role or the `review` class, planner for `plan`, otherwise implementer) is outside it, with code `policy`, and `loadConductorPolicy` drops project `roles` entries outside it with a config notice. `planner` also needs `projection.plannerEligible` (#525-1): `loadConductorPolicy` drops it from a kind's entry and `effectiveInstanceRoles` from an instance-id entry. `conductor` needs `projection.conductorEligible` and an interactive effective start mode (#1408): `applyRoleCeiling` (`src/adapters/role-eligibility.ts`) drops it with a notice naming the reason and the fix, and the at-most-one-conductor count runs on the `adapterCeiling` result, before that drop; recovery's `freshRoles` (`src/hub/recovery-policy.ts`) applies the same ceiling and count with each peer's effective start mode, so a recovery never re-grants a conductor the running hub ignores. `roleEligibility` is the one answer that init, the loader, doctor and the `docs/roles.md` table read, and a settings write of `peers.<conductor>.start_mode` to `headless` is refused while that peer holds the role. Never widen either from project config.
115
115
  - Reviewer pool (#519): `selectReviewerPool` is pure and called only inside `assign()`, which builds the candidates (declared reviewer-only `routing.reviewOnly` instances) and their blocked reasons; Tasks passes only `reviewPool` (`pool`, `rerotate`, `failed`, `required`). With no fresh reviewer declared and no configured `review.pool`, routing stays the legacy path. The seed is the linked PR number, else the task id; compute its modulo over configured kinds with declared candidates, including blocked/offline/paused/quota/failing candidates, and do not renumber by availability; append undeclared-kind trace entries (`no declared reviewer`) after the declared walk without assigning them modulo shares or changing a selected reason; the implementer's family is skipped while another can run, and a delta review keeps the last `changes_requested` family unless `rerotate`. `required` (an explicit `review.pool`) exhaustion goes to the person with `reviewBlocked`; only the optional default pool may fall back to an eligible planner, other family first. Record the choice through `reviewMetadata` (`reviewerFamily`, `reviewerReason`, including `same-family fallback`), never in note text alone. PII tasks, `review`-class tasks and a reviewer a person named (`reviewer changed`, reason `manual`) stay outside the pool.
@@ -1,6 +1,6 @@
1
1
  # Tests
2
2
 
3
- Scope: tests, fakes and the test gate. Read before adding or changing a test or fake under `test/` or `src/adapters/conformance/`, or editing `scripts/check.sh`, `scripts/hang-watch.sh`, `scripts/progress-tee.sh`, `scripts/seeded-check.ts`, `scripts/seeds.json`, `scripts/lib/ts-ast.ts`, `scripts/changed-tests.mjs`, `scripts/check-closing-refs.mjs`, `.github/workflows/closing-refs.yml`, `scripts/release-prepare.ts`, `scripts/release-tag.ts` or `scripts/lib/release-plan.ts`.
3
+ Scope: tests, fakes and the test gate. Read before adding or changing a test or fake under `test/` or `src/adapters/conformance/`, or editing `scripts/check.sh`, `scripts/hang-watch.sh`, `scripts/progress-tee.sh`, `scripts/seeded-check.ts`, `scripts/seeds.json`, `scripts/lib/ts-ast.ts`, `scripts/changed-tests.mjs`, `.github/workflows/closing-refs.yml`, `scripts/release-prepare.ts`, `scripts/release-tag.ts` or `scripts/lib/release-plan.ts`.
4
4
 
5
5
  - A fake's gated action that never sees its gate skips the action; never fall through to a late, unsynchronized action. Owned-group tests inject `AcpOwnedGroupPorts`; a test never signals a process group it did not spawn.
6
6
  - When a production closure gains a dependency, find its VM fixtures by the closure and its callers as well as the new dependency name. Bind every transitive host port and actual imported policy helper, including asynchronous read paths, and run each affected extracted closure. When changing question-tool observer exclusions in `src/hub/daemon.ts`, bind the actual `QUESTION_TOOLS` import in `test/review-privacy-wiring.test.ts` and run that test alongside the question tests. Keep native identity checks on real unstarted instances; never replace a policy predicate with an always-true stub or weaken existing assertions to accommodate a moved dependency.
@@ -34,8 +34,8 @@ Scope: tests, fakes and the test gate. Read before adding or changing a test or
34
34
  - A request that a test expects a stop or shutdown to cut gets its rejection handler where the request is created, never after the awaited teardown: a late `catch` races the reset and the run fails on an unhandled rejection.
35
35
  - Run `bun scripts/seeded-check.ts` before reporting the seeded-guard gate complete. After changing seeded guard logic, run its affected seeds even when search-anchor counts are unchanged. Put asynchronous calls inside `resolves`/`rejects` expectations so a mutated refusal fails a named assertion. Keep the `scripts/seeds.json` cases sequential; require the same named test green before its seeded assertion fails. Seed rot, survivors, setup/compiler failures, timeout/watchdog termination and process leaks fail the gate. A change that moves or rewrites a line a `scripts/seeds.json` case searches for updates that case's search and replacement in the same PR (seed rot fails the gate), keeping its mutant effect and named test. `scripts/check.sh`, `--changed` included, never runs the seeds, so rot shows only in CI's `seeded guards` job (the `profile-cli-dry-flags` anchor needed a search-text update in both #1100 and #1110, 2026-11-02). Before pushing a change to a file `scripts/seeds.json` names, confirm every anchor still matches once: `bun -e 'const f=require("fs");for(const x of JSON.parse(f.readFileSync("scripts/seeds.json","utf8")).seeds){const n=f.readFileSync(x.file,"utf8").split(x.search).length-1;if(n!==1)console.log("seed rot:",x.id,n)}'` prints nothing when every anchor is intact. Never run the full seed runner from a unit test or mutate the source checkout; inspect preserved failed fixtures before removing them. CI runs it as four sequential Linux shards (`--shard i/4`) beside the ordinary check, separately from `scripts/check.sh`; the required `seeded guards` job passes only when every shard passed, or when the decision job reused a verified identical-tree full gate (`admission == 'reuse'`). Keep that job name: branch protection and `scripts/ci-gates.mjs` read it (#457). On seed rot the checker names the anchor's symbol at a base commit and where it is now (`seedRotContext`): `--base <commit>` sets that base (CI passes the PR base from a `fetch-depth: 0` checkout; keep both), and without it the base is `merge-base origin/main HEAD`. The context is evidence only: it never relaxes the one exact match, and an unavailable base says so instead of guessing.
36
36
  - `scripts/lib/ts-ast.ts` is the one TypeScript AST helper for scripts and source-scanning tests (`parseSource`, `callSites`, `symbolSpans`, `enclosingSymbol`, `findSymbol`; inline HTML scripts keep their offsets). It gives lexical locations only, never resolved call edges, and stays dev tooling: never import it from `src/`.
37
- - The native branch ratchet (`test/daemon-native-branches.json`) is reviewed data, never regenerated by a test (rule: `adapters.md`). `test/daemon-native-proof-gates.test.ts` runs daemon code cut out of `src/hub/daemon.ts` by its text, from ` function frontendProxyState(` to ` const manualPaused =` and from ` async function changePermission(` to ` async function confirmPermissionDefault(`, and the ` const isSupportedPeer =` and ` const readOnlyPeer =` bindings: renaming, reordering or reindenting them updates the test in the same PR. Test Claude launch permission proof through `createClaudeLaunchProof` in `src/hub/claude-launch-proof.ts`; never restore the removed daemon wrapper just to slice it in a fixture.
38
- - The #1057 worktree tests cut source by its text: `test/worktree-shelf.test.ts` reads `src/hub/daemon.ts` from `case "worktrees":` to `// #604 (agent-hub#1030)`; `test/worktree-panel.test.ts` reads it from `async function worktreeShelf(` and `function worktreesView(` to `async function uiMemorySnapshot(`, `src/ui/index.html` from `function renderWorktrees(shelf)` to `function renderBench(bench)` (plus the helper lines it names) and `src/hub/sdlc.ts` from `export async function readSdlcPr(` to `export async function readSdlcPrHead(`. Moving, renaming or reordering those lines updates the test in the same PR. The removal-module lists pinned there and in `test/worktree-tidy.test.ts` (`src/hub/code-facts.ts`, `src/hub/task-worktree.ts`, `src/cli/worktree-tidy.ts`) are never extended to let a new removal pass (rule: `daemon.md`).
37
+ - The native branch ratchet (`test/daemon-native-branches.json`) is reviewed data, never regenerated by a test (rule: `adapters.md`). `test/daemon-native-proof-gates.test.ts` runs daemon code cut out of `src/hub/daemon.ts` by its text, from ` function frontendProxyState(` to ` const manualPaused =` and from ` async function changePermission(` to ` async function permissionChange(`, and the ` const isSupportedPeer =` and ` const readOnlyPeer =` bindings: renaming, reordering or reindenting them updates the test in the same PR. `test/peer-frontend-proxy.test.ts` reads `confirmPermissionDefault` from `src/hub/control/recovery-messages.ts` and binds its daemon ports through scope. Bind the extracted `budgetRenewMessage` scope in `test/daemon-native-proof-gates.test.ts`. Test Claude launch permission proof through `createClaudeLaunchProof` in `src/hub/claude-launch-proof.ts`; never restore the removed daemon wrapper just to slice it in a fixture.
38
+ - The #1057 worktree tests cut source by its text: `test/worktree-shelf.test.ts` reads `worktreesRefreshPrsMessage` in `src/hub/control/operations-messages.ts`; `test/worktree-panel.test.ts` reads it from `async function worktreeShelf(` and `function worktreesView(` to `async function uiMemorySnapshot(`, `src/ui/index.html` from `function renderWorktrees(shelf)` to `function renderBench(bench)` (plus the helper lines it names) and `src/hub/sdlc.ts` from `export async function readSdlcPr(` to `export async function readSdlcPrHead(`. Moving, renaming or reordering those lines updates the test in the same PR. The removal-module lists pinned there and in `test/worktree-tidy.test.ts` (`src/hub/code-facts.ts`, `src/hub/task-worktree.ts`, `src/cli/worktree-tidy.ts`) are never extended to let a new removal pass (rule: `daemon.md`).
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.
@@ -43,7 +43,7 @@ Scope: tests, fakes and the test gate. Read before adding or changing a test or
43
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.
44
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.
45
45
 
46
- - The `closing-refs` workflow (`.github/workflows/closing-refs.yml`, #760) runs `scripts/check-closing-refs.mjs` (PR number from argv or `PR_NUMBER`) on `opened`, `edited`, `reopened` and `synchronize`: it reads `gh pr view --json closingIssuesReferences,body,title,commits` and fails when GitHub would close an issue the title and body only mention with `Refs`, a negation or a qualifier (`Refs #15. Does not close #15.` and `Refs #15. Partially fixes #15.` fail, `Refs #15.` and `Fixes #15` pass), or when a commit message has a closing keyword, negated or not, for an issue the title and body do not mean (a squash merge carries it). An issue linked only in the sidebar passes. A keyword is meant only when nothing earlier in its sentence (ending at `.`, `!`, `?`, `;` or a line break, never a comma) matches `NEGATION`; widen that list, never narrow it to let a qualified close pass (background: README). `mentioned`, `keywordReferences`, `intentionalCloses`, `closingMisuse` and `commitMisuse` are pure and covered by `test/closing-refs.test.ts` with the real `gh` shape (`repository.name`, `repository.owner.login`); its command test puts a fake `gh` first on `PATH`, never the real one. Run it by hand with `GITHUB_REPOSITORY=<owner/repo> node scripts/check-closing-refs.mjs <number>`.
46
+ - The `closing-refs` workflow (`.github/workflows/closing-refs.yml`, #760, #1938) calls the shared `STAIxBWLB/repo-tools` workflow pinned by full commit SHA (tag `v0.1.3`) with `contents: read` and `pull-requests: read`. The rule, its negation list and its tests live in `@staix/repo-tools` (`src/check-closing-refs/`, `bin/check-closing-refs` in the package): it fails a PR when GitHub would close an issue the title and body only mention with `Refs`, a negation or a qualifier, or when a commit message has a closing keyword for an issue the title and body do not mean. Widen the negation list there, never narrow it to let a qualified close pass. A gap goes to `STAIxBWLB/repo-tools`, not to a local copy; the pin moves only to a published, reviewed tag. `scripts/check-docs.mjs` stays shipped (the release reader runs it); `test/check-docs-fixtures.test.ts` runs the package's `check-docs` cases (`@staix/repo-tools/fixtures/check-docs/`, read from `node_modules`, no vendored copy) against it so the two cannot drift.
47
47
 
48
48
  - A test of `runCheck` (`src/hub/checks.ts`, #558) injects a `CheckSpawn` (argv and options in, `{ pid, exited, signalCode, stdout, stderr }` out) and never patches `node:child_process`: the runner reads a child's exit and pipes as values through `Bun.spawn`, because node's event layer can report a quick child's exit inside `spawn()` before a listener exists under load on macOS (oven-sh/bun#45483). Keep the `ended` fixtures for the already-ended case, and do not raise the 5 s limit or the 1 s kill grace to fix a flake.
49
49
 
@@ -0,0 +1,90 @@
1
+ {
2
+ "contract": "companion-cli",
3
+ "version": 2,
4
+ "since": "0.53.0",
5
+ "about": "Extends companion CLI v1 with person-console peer account labels and Orca pane keys, and a no-launch command for companion launch hooks.",
6
+ "types": {
7
+ "semver": "string matching MAJOR.MINOR.PATCH with an optional -pre or +build suffix",
8
+ "string": "non-empty string",
9
+ "absolute-path": "string starting with /",
10
+ "count": "non-negative safe integer",
11
+ "nullable-fraction": "null or a finite number from 0 to 1 inclusive",
12
+ "count-map": "object whose keys are in values and whose values are counts",
13
+ "enum": "string in values",
14
+ "true": "the boolean true",
15
+ "false": "the boolean false",
16
+ "prefixed": "string equal to one of values or starting with one of prefixes",
17
+ "object": "plain object"
18
+ },
19
+ "commands": [
20
+ { "argv": ["status", "--json"], "reads": "status" },
21
+ { "argv": ["--project", "<id|root>", "status", "--json"], "reads": "status" },
22
+ { "argv": ["projects", "--json"], "reads": "projects" },
23
+ { "argv": ["ui"] },
24
+ { "argv": ["--project", "<id|root>", "ui"] },
25
+ { "argv": ["console"] },
26
+ { "argv": ["--project", "<id|root>", "console"] },
27
+ { "bin": "acon", "argv": ["ui"] },
28
+ { "argv": ["launch-line", "<kind>", "--json"], "reads": "launchLine" }
29
+ ],
30
+ "noHub": { "exitCode": 1, "stderrPrefix": "ahub: no hub running for " },
31
+ "status": {
32
+ "version": { "type": "semver", "presence": "always" },
33
+ "projectId": { "type": "string", "presence": "always" },
34
+ "cwd": { "type": "absolute-path", "presence": "always" },
35
+ "tasks": { "type": "count-map", "presence": "always", "values": ["backlog", "proposed", "in_progress", "in_review", "approved", "changes_requested", "cancelled"] },
36
+ "peers": { "type": "object", "presence": "always" },
37
+ "peers.<id>.state": { "type": "enum", "presence": "always", "values": ["idle", "busy", "paused", "offline"] },
38
+ "peers.<id>.queued": { "type": "count", "presence": "always" },
39
+ "peers.<id>.accountLabel": { "type": "string", "presence": "person-console status when a named account is bound to the peer; absent otherwise" },
40
+ "peers.<id>.orcaPaneKey": { "type": "string", "presence": "person-console status for an online peer with a live, project- and instance-bound Orca launch record; absent otherwise" },
41
+ "peers.<id>.context": { "type": "object", "presence": "when a context reading is available; absent otherwise" },
42
+ "peers.<id>.context.used": { "type": "nullable-fraction", "presence": "with peers.<id>.context" },
43
+ "peers.<id>.context.freshness": { "type": "enum", "presence": "with peers.<id>.context", "values": ["fresh", "stale", "unknown"] },
44
+ "peers.<id>.attached": { "type": "false", "presence": "when the peer has no adapter attached; absent otherwise" },
45
+ "peers.<id>.needsReview": { "type": "count", "presence": "when nonzero; absent when zero" },
46
+ "peers.<id>.pullOnly": { "type": "true", "presence": "when the peer reads messages only through hub_inbox; absent otherwise" },
47
+ "peers.<id>.paused": { "type": "prefixed", "presence": "when paused; absent otherwise", "values": ["manual"], "prefixes": ["budget: "] },
48
+ "peers.<id>.detached": { "type": "object", "presence": "when a server the hub did not start serves that peer's socket; absent otherwise" },
49
+ "peers.<id>.detached.cause": { "type": "string", "presence": "with peers.<id>.detached" },
50
+ "peers.<id>.detached.command": { "type": "string", "presence": "with peers.<id>.detached; the exact command that puts the peer back under the hub" },
51
+ "needs": { "type": "object", "presence": "always" },
52
+ "needs.act": { "type": "count", "presence": "always" },
53
+ "needs.watch": { "type": "count", "presence": "always" },
54
+ "needs.state": { "type": "string", "presence": "always" },
55
+ "needs.first": { "type": "object", "presence": "when any item needs the person; absent otherwise" },
56
+ "needs.first.kind": { "type": "string", "presence": "with needs.first; \"approval\" is a pending permission request" },
57
+ "needs.first.level": { "type": "enum", "presence": "with needs.first", "values": ["act", "watch"] },
58
+ "needs.first.until": { "type": "count", "presence": "when the item expires (milliseconds since the epoch)" },
59
+ "needs.first.peer": { "type": "string", "presence": "when the item belongs to a peer" }
60
+ },
61
+ "launchLine": {
62
+ "kinds": ["claude", "codex"],
63
+ "startsProcess": false,
64
+ "response": {
65
+ "command": { "type": "string", "presence": "always; the shell command to run in the terminal" },
66
+ "env": { "type": "object", "presence": "always; overlay these bindings on the terminal environment" },
67
+ "env.AGENTHUB_PROJECT_DIR": { "type": "absolute-path", "presence": "always" },
68
+ "env.AGENTHUB_STATE_DIR": { "type": "absolute-path", "presence": "always" }
69
+ }
70
+ },
71
+ "projects": {
72
+ "[]": { "type": "object", "presence": "one per registered project" },
73
+ "[].id": { "type": "string", "presence": "always" },
74
+ "[].root": { "type": "absolute-path", "presence": "always" },
75
+ "[].state": { "type": "string", "presence": "always; readers recognise running and stopped, any other value reads as unknown" }
76
+ },
77
+ "shellQuote": [
78
+ { "in": "it's $(x)", "out": "'it'\\''s $(x)'" },
79
+ { "in": "", "out": "''" },
80
+ { "in": "a b", "out": "'a b'" },
81
+ { "in": "'", "out": "''\\'''" },
82
+ { "in": "''", "out": "''\\'''\\'''" },
83
+ { "in": "$(x)", "out": "'$(x)'" },
84
+ { "in": "`x`", "out": "'`x`'" },
85
+ { "in": "a\nb", "out": "'a\nb'" },
86
+ { "in": "é", "out": "'é'" },
87
+ { "in": "\\", "out": "'\\'" },
88
+ { "in": "a;b&c|d", "out": "'a;b&c|d'" }
89
+ ]
90
+ }