@staix/agent-hub 0.34.1 → 0.36.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 (213) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +53 -7
  3. package/docs/adding-an-ai-tool.md +2 -2
  4. package/docs/addons/claude-mem.md +4 -4
  5. package/docs/addons/open-code-review.md +1 -1
  6. package/docs/agent-notes/README.md +66 -0
  7. package/docs/agent-notes/adapters.md +14 -7
  8. package/docs/agent-notes/budget.md +1 -1
  9. package/docs/agent-notes/bus.md +2 -1
  10. package/docs/agent-notes/daemon.md +9 -7
  11. package/docs/agent-notes/local-worker.md +1 -1
  12. package/docs/agent-notes/models.md +5 -2
  13. package/docs/agent-notes/tasks.md +9 -2
  14. package/docs/agent-notes/tests.md +6 -0
  15. package/docs/design/adapters.md +182 -2
  16. package/docs/design/agent-hub-architecture.md +64 -2
  17. package/docs/design/agent-hub.md +6 -0
  18. package/docs/design/bus.md +26 -0
  19. package/docs/design/execution-reference.md +306 -0
  20. package/docs/design/guidance-experiments.md +438 -0
  21. package/docs/design/model-routes.md +628 -0
  22. package/docs/design/supervision.md +121 -0
  23. package/docs/design/task-board.md +121 -0
  24. package/docs/dogfood.md +45 -13
  25. package/docs/events.md +38 -20
  26. package/docs/memory.md +21 -7
  27. package/docs/operations.md +824 -40
  28. package/docs/profiles.md +2 -2
  29. package/docs/quickstart.md +117 -4
  30. package/docs/research.md +73 -13
  31. package/docs/roles.md +1 -1
  32. package/docs/sdlc.md +117 -11
  33. package/docs/security.md +153 -15
  34. package/docs/smoke.md +14 -0
  35. package/docs/specs/2026-09-19-agent-hub-design.md +13 -7
  36. package/docs/verification/2026-10-25-qwen-dual-output-t0.md +22 -0
  37. package/docs/verification/2026-11-07-compat-python-startup-1248.md +51 -0
  38. package/docs/verification/2026-11-07-compat-receipt-harness-1248.md +105 -0
  39. package/docs/verification/2026-11-07-compat-receipt-producers-1248.md +96 -0
  40. package/docs/verification/2026-11-07-compat-workflow-1248.md +94 -0
  41. package/docs/verification/2026-11-07-daemon-startup-1232.md +169 -0
  42. package/docs/verification/2026-11-07-jcode-receipt-reconstruction-1248.md +118 -0
  43. package/docs/verification/2026-11-07-kimi-delayed-usage.md +34 -0
  44. package/docs/verification/2026-11-07-kimi-review-watch-1284.md +115 -0
  45. package/docs/verification/2026-11-08-agy-1.5.3.md +96 -0
  46. package/docs/verification/2026-11-08-agy-acp-t0.md +56 -0
  47. package/docs/verification/2026-11-08-hub-visual-1058.md +161 -0
  48. package/docs/verification/2026-11-08-jcode-0991-model-setter-1317.md +143 -0
  49. package/docs/verification/2026-11-08-kimi-252-model-setter-1317.md +137 -0
  50. package/docs/verification/2026-11-08-kimi-tui-completion-1282.md +45 -0
  51. package/docs/verification/2026-11-08-kimi-wire-yield-1283.md +31 -0
  52. package/docs/verification/2026-11-08-live-model-override-1317.md +250 -0
  53. package/docs/verification/2026-11-08-qwen-0269-acp.md +138 -0
  54. package/docs/verification/2026-11-08-qwen-0269-model-setter-1317.md +91 -0
  55. package/docs/verification/2026-11-09-0.35.0.md +129 -0
  56. package/docs/verification/2026-11-09-headless-records-1320.md +157 -0
  57. package/docs/verification/2026-11-09-qwen-0270-acp.md +181 -0
  58. package/docs/verification/2026-11-09-qwen-0270-model-setter-1317.md +46 -0
  59. package/docs/verification/2026-11-10-0.36.0.md +59 -0
  60. package/docs/verification/2026-11-10-claude-implementer-2.1.322.md +59 -0
  61. package/docs/verification/2026-11-10-qwen-0270-dual-output.md +367 -0
  62. package/docs/verification/2026-11-10-qwen-0271-dual-output.md +101 -0
  63. package/docs/verification/claude-permission-transport-native.py +10 -3
  64. package/docs/verification/claude-shell-wrapper-native.py +8 -8
  65. package/docs/verified.json +245 -15
  66. package/package.json +3 -3
  67. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  68. package/plugins/agent-hub/kimi-hook.js +21230 -0
  69. package/plugins/agent-hub/kimi-review-policy-worker.js +217 -0
  70. package/plugins/agent-hub/server.js +4359 -1071
  71. package/scripts/check-docs.mjs +12 -1
  72. package/src/adapters/acp-model-policy.ts +56 -0
  73. package/src/adapters/acp.ts +175 -5
  74. package/src/adapters/agy/entry.ts +8 -5
  75. package/src/adapters/agy/hooks.ts +65 -15
  76. package/src/adapters/channel-peer.ts +33 -1
  77. package/src/adapters/claude-channel.ts +7 -4
  78. package/src/adapters/claude-implementer.ts +16 -3
  79. package/src/adapters/codex-appserver.ts +118 -8
  80. package/src/adapters/codex-review-isolation.ts +3 -1
  81. package/src/adapters/compat.ts +18 -13
  82. package/src/adapters/definitions/builtin-metadata.ts +8 -1
  83. package/src/adapters/definitions/native-cli-entry-kimi.ts +76 -7
  84. package/src/adapters/definitions/native-cli-preview-common.ts +2 -2
  85. package/src/adapters/definitions/native-cli-preview-kimi.ts +9 -2
  86. package/src/adapters/definitions/reviewer-variants.ts +3 -1
  87. package/src/adapters/kimi-review-policy-worker.js +2 -0
  88. package/src/adapters/kimi-review-policy-worker.ts +85 -0
  89. package/src/adapters/kimi-review-policy.ts +68 -0
  90. package/src/adapters/kimi-review.ts +41 -41
  91. package/src/adapters/kimi-tui-facts.ts +153 -0
  92. package/src/adapters/kimi-wire-usage.ts +33 -8
  93. package/src/adapters/local-worker.ts +60 -21
  94. package/src/adapters/model-token.ts +3 -0
  95. package/src/adapters/pi.ts +27 -5
  96. package/src/adapters/qwen-dual.ts +324 -44
  97. package/src/adapters/registry-types.ts +34 -3
  98. package/src/adapters/registry.ts +1 -0
  99. package/src/adapters/reviewer-policy-watch.ts +86 -0
  100. package/src/adapters/reviewer-print.ts +80 -18
  101. package/src/cli/agents.ts +1 -1
  102. package/src/cli/facts-hook.ts +4 -2
  103. package/src/cli/guidance.ts +67 -0
  104. package/src/cli/help.ts +13 -5
  105. package/src/cli/identity.ts +13 -3
  106. package/src/cli/init-prompt.ts +15 -2
  107. package/src/cli/init-required-checks.ts +122 -0
  108. package/src/cli/init-settings.ts +10 -4
  109. package/src/cli/init.ts +39 -3
  110. package/src/cli/kimi-facts-hook.ts +11 -0
  111. package/src/cli/kimi-plugin.ts +157 -0
  112. package/src/cli/lineage.ts +78 -0
  113. package/src/cli/main.ts +159 -19
  114. package/src/cli/model.ts +52 -0
  115. package/src/cli/output.ts +23 -1
  116. package/src/cli/reset.ts +1 -1
  117. package/src/cli/setup-research.ts +10 -0
  118. package/src/cli/status-lines.ts +8 -4
  119. package/src/hub/autonomy-defaults.ts +20 -9
  120. package/src/hub/board.ts +346 -4
  121. package/src/hub/budget.ts +1 -1
  122. package/src/hub/build-entry.ts +11 -0
  123. package/src/hub/bus.ts +52 -2
  124. package/src/hub/ci-watch.ts +4 -4
  125. package/src/hub/code-facts.ts +10 -3
  126. package/src/hub/completions.ts +3 -1
  127. package/src/hub/config-apply.ts +3 -1
  128. package/src/hub/config-trust.ts +1 -0
  129. package/src/hub/control-client.ts +1 -1
  130. package/src/hub/daemon.ts +1387 -121
  131. package/src/hub/deliverable-files.ts +38 -5
  132. package/src/hub/delivery-hints.ts +4 -2
  133. package/src/hub/delivery-journal.ts +50 -2
  134. package/src/hub/delivery-public.ts +51 -0
  135. package/src/hub/dogfood-profile.ts +9 -5
  136. package/src/hub/envelope.ts +1 -1
  137. package/src/hub/events.ts +28 -18
  138. package/src/hub/execution-lineage-owner.ts +272 -0
  139. package/src/hub/execution-lineage.ts +164 -0
  140. package/src/hub/execution-links.ts +85 -0
  141. package/src/hub/execution-reference.ts +36 -0
  142. package/src/hub/guidance-variants.ts +398 -0
  143. package/src/hub/handoff.ts +1 -0
  144. package/src/hub/hub-tools.ts +62 -2
  145. package/src/hub/instances.ts +4 -3
  146. package/src/hub/kimi-events.ts +46 -0
  147. package/src/hub/kimi-usage.ts +132 -29
  148. package/src/hub/lifecycle.ts +31 -15
  149. package/src/hub/limits.ts +13 -4
  150. package/src/hub/manager.ts +58 -3
  151. package/src/hub/memory-policy.ts +4 -3
  152. package/src/hub/memory-sync-attestation.ts +54 -0
  153. package/src/hub/memory-sync-state.ts +20 -5
  154. package/src/hub/model-overrides.ts +115 -0
  155. package/src/hub/native-hook-launch.ts +12 -3
  156. package/src/hub/operational-view.ts +2 -2
  157. package/src/hub/peers.ts +28 -1
  158. package/src/hub/permission-mode.ts +1 -1
  159. package/src/hub/person-figures.ts +88 -0
  160. package/src/hub/planning.ts +1 -1
  161. package/src/hub/progress.ts +24 -7
  162. package/src/hub/report.ts +38 -4
  163. package/src/hub/research-dataset.ts +158 -0
  164. package/src/hub/research-memory.ts +68 -0
  165. package/src/hub/research-quality.ts +118 -0
  166. package/src/hub/research-record.ts +279 -0
  167. package/src/hub/research.ts +126 -27
  168. package/src/hub/restart.ts +27 -0
  169. package/src/hub/roles.ts +26 -0
  170. package/src/hub/routing.ts +4 -1
  171. package/src/hub/sdlc-merge.ts +39 -1
  172. package/src/hub/sdlc-release.ts +1 -1
  173. package/src/hub/sdlc.ts +62 -11
  174. package/src/hub/settings.ts +5 -0
  175. package/src/hub/startup-event-seeds.ts +51 -0
  176. package/src/hub/startup-readiness.ts +65 -0
  177. package/src/hub/startup-timing.ts +38 -0
  178. package/src/hub/supervision-proposals.ts +405 -0
  179. package/src/hub/supervision-rules.ts +388 -0
  180. package/src/hub/supervision.ts +2 -0
  181. package/src/hub/task-approval.ts +2 -2
  182. package/src/hub/task-repository.ts +5 -0
  183. package/src/hub/tasks.ts +632 -59
  184. package/src/hub/ui.ts +9 -5
  185. package/src/hub/visual-assets.ts +50 -0
  186. package/src/hub/visual.ts +257 -0
  187. package/src/memory/brief.ts +169 -14
  188. package/src/memory/capture.ts +4 -3
  189. package/src/memory/recall.ts +46 -5
  190. package/src/memory/record-provenance.ts +82 -0
  191. package/src/memory/records.ts +116 -0
  192. package/src/models/relay.ts +9 -2
  193. package/src/models/route/adec.ts +190 -0
  194. package/src/models/route/config.ts +64 -3
  195. package/src/models/route/decision-evidence.ts +83 -0
  196. package/src/models/route/decision.ts +215 -0
  197. package/src/models/route/relay-selector.ts +8 -7
  198. package/src/models/route/runtime.ts +35 -22
  199. package/src/models/route/stage-diagnostics.ts +22 -0
  200. package/src/models/route/stage-evidence.ts +55 -0
  201. package/src/models/route/stage-fallback.ts +58 -0
  202. package/src/models/route/stage-input.ts +155 -0
  203. package/src/models/route/stage.ts +5 -147
  204. package/src/ui/guidance-panel.ts +156 -0
  205. package/src/ui/guidance-view.ts +43 -0
  206. package/src/ui/index.html +134 -6
  207. package/src/ui/lineage-view.ts +34 -0
  208. package/src/ui/plugin.ts +136 -11
  209. package/templates/AGENTS.block.md +1 -1
  210. package/templates/config.json +1 -1
  211. package/templates/profiles/general.json +1 -1
  212. package/templates/profiles/research.json +1 -1
  213. package/templates/profiles/writing.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,79 @@ 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.36.0
8
+
9
+ - Claude Code 2.1.322 is a receipt-verified headless implementer version (#888, task 868): the model-free permission-transport and host shell-wrapper producers pass on it with 2.1.319 as the control (`docs/verification/2026-11-10-claude-implementer-2.1.322.md`).
10
+ - Qwen Code 0.27.1 is a receipt-verified dual-output TUI version (#888, task 869): required normal-Bus Q2 and Q3/Q5/Q6/Q7 pass on it with 0.27.0 as the control (`docs/verification/2026-11-10-qwen-0271-dual-output.md`). The headless `qwen` ACP entry is unchanged and still refuses 0.27.1.
11
+
12
+ - The new-project SDLC guide connects init choices, shared-file commits, managed sessions, actor-owned lifecycle steps and recovery (#1328). Compatibility: repositories other than `STAIxBWLB/agent-hub` in `advise` or `enforce` with no configured required checks report `required checks unknown` for review readiness and CI watches instead of assuming the native `seeded guards` floor; configure that repository's own checks and restart after editing `sdlc.toml`.
13
+ - Keep Qwen dual-output queued input fenced after a deny until a new personal turn completes or a verified fresh native generation starts. A 30 s wait expires offline without changing the known denied delivery disposition (#888).
14
+
15
+ - Stage routing uses newly authored bounded numeric evidence, deterministic fallback and session switching (#1352 R1). Whole-wire input sizing rounds compact JSON UTF-8 bytes upward, intentionally increasing the Unicode estimate conservatively; unavailable or overflowing sizes refuse context admission. Optional adec routing remains off/shadow only, and generic decision evidence v1 is unchanged.
16
+
17
+ - Bounded execution lineage reads and deduplicated declared external references are available through Tasks, CLI and MCP (#1220 T2). Admission rechecks current task role, revision, project and privacy; reads retain historical review bindings and explicit observation gaps without scanning the board or contacting producers.
18
+
19
+ - Supervision rules and proposals (#1221 T1 and T2, PRs #1362, #1368, #1374). Three versioned deterministic rules (`repeated_failure`, `deliverable_invalidated_check`, `declared_overlap_without_integration`) read only facts already in the public project view and record observations with zero effects in shadow mode. A reading can become a bounded proposal (100 pending, 3 per task revision) that a present role decides with `hub_supervision_list`, `hub_supervision_accept` or `hub_supervision_dismiss`; accepting runs one existing action under that action's own authority and writes nothing to the board itself. `supervision.mode` stays `off` by default and is person-only. A pair whose side is closed has no coverage entry, gap or observation.
20
+ - Task-local guidance variants (#1225, PRs #1363, #1367, #1376): an immutable `GuidanceVariantV1` contract whose candidate changes are limited to the Scope, Deliverables and Evidence prose, Tasks-owned persistence with idempotent create and one-way withdrawal, and `ahub guidance` create/list/show/withdraw, the matching `hub_guidance_*` MCP tools and a read-only console panel. Every reader and receipt screens original field text; no variant is activated or handed to task execution.
21
+ - The acon console reads the same bounded execution lineage page as `ahub lineage show` (#1220 T3, PR #1358), with a dogfood recipe and a bounded-read measurement on a large synthetic board.
22
+ - adec stage routing asks the decider only inside an ambiguity band around the confidence threshold (`|score - threshold| <= band`, default 0.05) and stays shadow only (#554 S2, PR #1373). `scripts/decision-eval.ts` replays planner-classified non-PII board tasks against a decider and the current triage, by hand and from a copy of `hub.db` (#554 S3, PR #1346).
23
+ - `ahub sdlc adopt-merge <task> --pr <n>` records a PR merged outside the guarded merge, for the person or the configured conductor, after one bounded GitHub snapshot proves the merged head, green configured checks and clean review coverage (#1328 T3, PR #1348).
24
+ - Init discovers repository required checks (at most three capped reads, `--required-checks` overrides) and refuses `enforce` with no known checks before any write (#1328 T1, PR #1344). `ahub init --research|--no-research` writes `research.enabled` and prints the person's next steps; `ahub setup --research` saves a machine default (#1328 T6, PRs #1347, #1357). Upgrade every hub and CLI on the machine before saving that default: an older reader refuses the unknown `research` key in `defaults.json` and distrusts the whole file.
25
+ - Exact-head review blockers name each missing, pending, failed, duplicate or unknown required check (#1328 T2, PR #1354). A task that supersedes cancelled work on the same issue keeps the person's spec consent when the issue body is unchanged (#1328 T4, PR #1361). `hub_inbox` shows the caller's own held deliveries without settling them (#1328 T5, PR #1359).
26
+ - Optional Claude Code companion (#1338, PRs #1343, #1349, #1365, #1369): a frozen mod host contract, a fixture-only read-only status pane with `/hub`, `/hub refresh` and `/hub console`, an attention band and compact rows for four agent-hub tools, and manual session-only packaging. Native receipts on each surface are person-run and not claimed here.
27
+ - Qwen Code 0.27.0 is receipt-verified for basic headless ACP (#888, PR #1355) and for the dual-output TUI (#888, PR #1364).
28
+ - Fixes: a daemon start with a persisted deferred hub notice no longer fails readiness before Tasks exists (#1350, PR #1353); Jcode receipt observers publish their environment record atomically (PR #1372).
29
+ - Tests and docs without a behavior change: Orca 1.4.254 terminal focus recheck (#1198, PR #1342), synchronized ACP model observations (PR #1345), the handoff catch-up flake (#1260, PR #1356) and the Orca status port canaries (PR #1360).
30
+
31
+ Release N-1 for 0.36.x is 0.35.0 (exact `@staix/agent-mem` 0.23.1, control protocol 17 with descriptor floor 16); `test/fixtures/release-n-1` and `test/published-protocol-compat.test.ts` now pin it. Compatibility: the wire protocol window is unchanged at 16 through 17. Files: `hub.db` gains additive tables (`supervision_proposals`, `guidance_experiments`, `guidance_variants`, `execution_reference_links`) created with `CREATE TABLE IF NOT EXISTS` and no `hub_schema` bump, so 0.35.0 opens a 0.36.0 database and ignores them; the machine `defaults.json` `research` key is the one format ceiling, refused by 0.35.0 readers. CLI: new `ahub guidance`, `ahub lineage`, `ahub sdlc adopt-merge` and init flags; existing commands are unchanged. MCP: new `hub_guidance_*`, `hub_lineage_*` and `hub_supervision_*` tools; existing tool schemas keep their fields.
32
+
33
+ ## 0.35.0
34
+
35
+ - Managed headless peers can author compact amem Record capture rows from final answers (#1320), following the package records policy and existing privacy fences. Record lines are removed from shared replies; bounded memory preference uses proven generated-note IDs and anchors without deleting unrelated notes or promoting capture into curated evidence.
36
+ - Hub memory sync supplies amem's public placement attestation per pass (#1173). Typed writer refusals retain their closed category/cause and next step in status and the dashboard, including when the transport returns a generic or quiet result. Placement activation remains a person-run action.
37
+ - Exact-pin the first-party agent-mem core to 0.23.1 (refs #1320; PR #1335 raised it to 0.23.0, PR #1339 to 0.23.1). An agent-mem 0.22.1 drain silently discards Record format-3 spool entries and refuses the `records` config key, so upgrade every hub and amem that shares a memory home together.
38
+
39
+ - adec shadow route metadata accepts an optional pinned `decider.version` (#554, agent-decide#6), while preserving unknown when absent and refusing moving `latest` aliases.
40
+ - Optional hub `decision` routes consult a loopback agent-decide policy service (#554), default off and shadow-first. Shadow preserves the existing stage model/effort; proposed alias/effort appears only in route events. Enforcement is explicitly unavailable until the #554 follow-up. Evidence and events are bounded and privacy-screened, sensitive turns are campus-gated, and ordinary routes and explicit model selections are unchanged.
41
+ - Person-only next-turn model overrides (#1317, PRs #1321, #1323): `ahub model set <peer> <model>`, `ahub model clear <peer>` and `ahub model list [--json]`, or a preview and confirm in dashboard settings, store a runtime override in hub.db that the Claude implementer, Codex app-server and reviewer, local, Pi and headless Kimi Code 2.5.2 ACP peers apply at their next turn, with `model_change` audit events and effective/source/pending status. An explicit Codex client model still wins; raw and pull-only TUIs and other unsupported peers (Qwen and Jcode ACP included) refuse a live set with restart guidance. Native provider-backed model acceptance and real dashboard interaction are unverified.
42
+
43
+ - Peers can post bounded visuals (Mermaid diagrams, comparisons, tables, before/after views) with `hub_visual` and read one back with `hub_visual_show` (refs #1058, PR #1315). Delivery is console-only by default and other peers get only an id stub; private and PII contexts and remote recipients refuse. acon renders them (WebP needs acon 0.1.7 or later) and the standalone UI shows a text or source fallback; standalone browser and native all-peer journeys are unverified.
44
+ - Kimi TUI turns complete on the native final transcript row instead of the Stop hook (#1282, PR #1309): completion waits until native background work is quiet, a lost launcher closes the run once as interrupted, and the launch-scoped plugin is installed and cleaned under fail-closed ownership checks. Any bridge setup failure falls back to the plain TUI. Live receipts passed on Kimi 2.5.2.
45
+ - Kimi wire usage that arrives after `turn_end` is drained (#1281, PR #1291): one bounded delayed drain per peer (250 ms, 1 s, 2 s) attributes late rows to their captured turn, or `unattributed` when ambiguous, and updates usage, tokens and the soft window exactly once without changing earlier `turn_end` totals. Eight ordinary Kimi 2.5.2 turns produced no delayed row, so the delayed path is covered by fixtures only.
46
+ - Scheduled Kimi wire-log drains read one bounded slice per callback and yield between slices (#1283, PR #1313), so a large backlog no longer holds the daemon loop. In the benchmark the longest synchronous slice fell from 34 ms to 3.3 ms for the same 2 MB.
47
+ - Fresh Kimi reviews run their periodic isolation check in one owned worker off the daemon loop (#1284, PR #1296). The full synchronous fence still runs before spawn and at every review token, task-MCP and verdict boundary, and a worker result never grants authority. No production latency claim is made.
48
+ - Antigravity (agy) fixes (#1280, PRs #1286, #1294, #1295): hook transcript reads are skipped when no fact offer is pending, a terminal non-normal Stop no longer leaves agy busy, and auto-update is suppressed at launch. Write and Edit calls are credited to agy's facts, 1.5.x `SYSTEM_MESSAGE` readback works, `GEMINI.md` is protected as an instruction file, transcript token counts are recorded as usage, and SessionStart and PreInvocation tell agy how many messages wait (counts only). `agy acp` has only a model-free 1.5.3 probe; ACP peer wiring and a Stop continuation on important mail are not implemented.
49
+ - Detailed status names the current owner of an attached channel peer (#1310, PR #1311): `ahub status` prints `<peer> owner: pid N; attached <age>; native session <id|unverified>`, and `ahub status --json` carries it as the optional `ownerAttachment`. It is withheld from `status.json` and every non-console reader. No real Kimi or Claude plugin attach was observed.
50
+ - Startup reads `events.jsonl` once for its three seed consumers and logs one numeric `startup timings ms:` line (refs #1232, PR #1285). After 12 seconds `ahub up` reports that the hub is still starting, with its pid, and keeps waiting; at the 120-second bound it exits unsuccessfully and leaves the process running. The historical 11 to 16 s startup was not reproduced, so no general speedup is claimed.
51
+ - The managed AGENTS block and the three profile blocks tell peers to keep their turn open until every check they started has exited and its result is handled (#1333, PR #1334); filing `hub_task_done` without waiting for hosted CI is unchanged. Other projects get it after upgrading and running `ahub init` again.
52
+ - Bounded execution reference and lineage contracts (#1220 T1, PR #1336): `ExecutionReferenceV1`, neutral JSON conformance vectors and a pure lineage reader whose pages hold at most 100 nodes, 200 edges and 256 KiB, with HMAC-bound continuations; an unauthorized absent or denied reference reads `unavailable`. Contracts only: admission, runtime and console surfaces (T2, T3) are not in this release.
53
+
54
+ - Research record v2 and dataset export (#1277, PRs #1290, #1312): every task in a terminal board state, cancelled included, gets a record with review, delivery, merge, specs, memory, person, stall and handoff blocks, `null` where a value cannot be derived; v1 rows still load. `ahub research export --dataset <dir>` writes per-project `tasks.jsonl`, `manifest.json` and `quality.json` (per-field unknown counts, quota gaps, budget hand-offs, token attribution share), family names only, to a directory in the home outside every project. No live hub ran with research enabled.
55
+ - Research memory and person figures (#1279, #1278, PRs #1297, #1298): per-task rendered, delivered, cited and fail-note counts and a retry signal come from agent-mem's own sidecar counters, with new `mem:<id>` citation sites in review notes, `hub_remember` and spec acknowledgements. `permission`, `question`, `completion` and `agent_cli` events carry task attribution, and the research `person` block and `ahub report --by task` share one count. Permission and question flows were checked against fakes only.
56
+
57
+ - Optional Orca companion plugin in `integrations/orca/`, not part of the npm package (#1198, PRs #1299, #1300, #1301, #1302): it binds an exact workspace on this Mac, opens the dashboard, `ahub console` or `acon ui`, and shows a read-only status projection on click. It never focuses or reads an existing terminal and refuses remote and Windows workspaces. Its support matrix lists no combination as supported: every native receipt is a person-run leg not yet run.
58
+ - Optional Herdr mod in `integrations/herdr/`, not part of the npm package (#1199, PRs #1303, #1304, #1305, #1306): it lists the focused machine's registered projects, opens `ahub console` in a new tab or the local dashboard, shows a click-only status card, and focuses or peeks an existing local console only when exactly one live terminal matches on two reads. It is one action more than the manual baseline when the pane is already in the right project. No combination is supported yet, remote is fixture-only, and all native receipts are person-run legs not yet run.
59
+
60
+ - Compat receipt automation (#1248, PRs #1256, #1264, #1272, #1275, #1288): `scripts/compat-receipt.ts` runs model-free receipts only on a disposable runner (a personal Mac is refused) with exact acquisition, integrity binding and bounded execution. The Kimi and Qwen producers are promoted, a Jcode producer is reconstructed (its 0.99.1 Linux control is partial, two legs fail), and the drift watcher can run receipts on hosted runners and propose verification PRs that are never auto-merged. A receipt is a compatibility signal, not a security attestation; PR publication was exercised against fake REST only, and these PRs change no COMPAT, trust or verified version.
61
+ - Exact agy 1.5.3 (PR #1314) and Qwen ACP 0.26.9 (PR #1322) join the verified versions (refs #843), from isolated model-free native macOS arm64 receipts. agy 1.5.2 and 1.5.4 stay refused and qwen-dual stays 0.26.1. Account, model, TUI and native permission behavior remain unqualified, as do agy ACP and Qwen on Linux and Intel Macs.
62
+
63
+ - CI defers the four macOS shards of a stacked pull request, one whose base is another PR's branch rather than `main` (#1307). GitHub runs at most 5 macOS jobs at once on this account, and a stacked PR is rebased and rerun once it targets `main`, so its earlier macOS run never served as the merge gate. The required `check (macos-latest)` check fails for such a PR with the reason and the fix, so a skipped required check can never pass. A PR retargeted to `main` without a new commit gets its macOS run by a push or by closing and reopening it. Ubuntu, seeded guards, `main` pushes and identical-tree reuse are unchanged.
64
+ - CI installs npm 11.20.0 before each gate shard, the version the release workflow publishes with, and `scripts/check-package.mjs` refuses any other `npm pack --json` shape with the cause and `npm --version` instead of a TypeError, so a local check under npm 12 stops there (#1257, PR #1258). A weekly workflow keeps the "CI flake ledger (check.yml)" issue of shard jobs that failed and then passed on the same head, and `scripts/refresh-test-timings.ts --check` reports shard weights (PR #1259). The macOS typecheck step gets a 5120 MiB heap ceiling (#1318, PR #1319).
65
+ - The budget gate defaults to 0.99 instead of 0.9 (#1292). A peer now checkpoints and pauses only when a fresh quota window reaches 99%; it resumes below 89%, and a release cut is held only below 1% headroom. A provider's hard refusal still pauses at once. `ahub init` no longer writes `"gate": 0.9` into a new project's tracked config, so new projects follow the default. Existing projects keep the 0.9 their tracked `config.json` pins until the key is removed or a machine-local value is set. `budget.gate` is now a registered setting: `ahub settings set budget.gate <0..1>` from a terminal or an `ahub ui --settings` session writes `config.local.json` and applies from the next quota reading without a restart; an ordinary dashboard session and the conductor cannot set it.
66
+ - Documentation is kept current (#1268): the quickstart's GitHub install tag, the Bun floor and the agent-mem pin are generated from `package.json` and `.bun-version` (`bun scripts/readme-facts.ts`, part of `scripts/check.sh`); `docs/verified.json` now covers every page under `docs/` and `docs/addons/` except the smoke ledger and the retired GSD analysis, and CI warns about stale stamps on every pull request; stale statements about claude-mem, research campaigns, design specs, events, roles and the SDLC readbacks are corrected; a release notifies the family site when `SITE_DISPATCH_TOKEN` is set.
67
+ - `release-prepare` renders the generated doc facts blocks (the quickstart install tag and the version pins) after the version bump, and `--dry-run` lists the blocks it would change, so a release PR passes `scripts/readme-facts.ts` with no manual `--write` (#1273). CONTRIBUTING explains that the stale-documentation warning on an ordinary pull request is expected and cleared by the release PR's restamp (#1274).
68
+ - `scripts/spec-dogfood-report.ts` reports how often PRs that touch a dogfood spec's paths also change the owning spec (#1064 T6, PR #1270). The first five dogfood days read 41% (21 of 51), below the 54% monolith baseline and the 70% target.
69
+ - Test-only flake fixes, no product change: the replaced process environment is restored when a staged test times out (#1262, PR #1267), two fake-ripwire fixtures record CodeFacts step times on failure (#1261, PR #1265), trace reads wait for a complete record (#1263, PR #1269), the empty rooms rotation fixture awaits live roster adoption (#1287, PR #1289), UI inbox refresh races are gated without sleeps (#1324, PR #1325), and the Herdr AC9 test no longer depends on the host (PR #1316).
70
+
71
+ - 0.35.0 N-1: published 0.34.1, the latest 0.34.x patch, pins agent-mem 0.22.1; this hub exact-pins agent-mem 0.23.1. Control remains protocol 17 (descriptor floor 16). The release N-1 fixture and matrix now pin published 0.34.1/core 0.22.1; the separate protocol-16 fixture stays 0.25.0.
72
+ - Wire and protocol: the control protocol window, room headers, codecs and RoomStore are unchanged; nothing under `src/rooms` or `src/broker` changed. The daemon adds two feature labels, `model_overrides` and `visuals`, and a console-only `model` control message; the dashboard's `model_preview`/`model_confirm` actions are served by the same daemon. A 0.35.0 `ahub model` checks the label and refuses against a 0.34.1 hub with an upgrade-and-restart step; a 0.34.1 CLI never sends it. Envelopes gain an optional local `refs.visual`; visuals refuse remote recipients, so nothing new crosses a room.
73
+ - MCP tools: two tools are added, `hub_visual` and the read-only `hub_visual_show`; no existing tool schema changed. A 0.34.1 plugin on a 0.35.0 hub simply lacks them. The current plugin lists them without a feature check, so against a 0.34.1 hub a call is refused as an unknown task operation (source reading, not a run). The execution reference and lineage contracts (#1336) add no tool, control message, table or command. Model overrides (#1321) are a person-only CLI and dashboard surface, not an MCP tool.
74
+ - Files and format floors: hub.db remains schema 2 and RoomStore remains schema 5. Two additive hub.db tables, `model_overrides` and `visuals` (with two indexes), are created on first use without raising the format; a 0.34.1 daemon opens the database and does not read them. Restart snapshots gain optional `modelOverrides` and `visuals` integrity digests. The machine's research store now writes `agent-hub.research/v2` records and still reads v1; a 0.34.1 reader skips v2 rows, so its `ahub research` and export omit records 0.35.0 wrote.
75
+ - Rollback: controlled recovery to a target without these labels, which is the `ahub upgrade --to 0.34.1` path, refuses before effects while model override rows exist (clear them with `ahub model clear <peer>`), while stored visual records exist (there is no clear command), or while any config file has an explicit `visuals` block, including one written by `ahub settings set visuals.retention_days` (remove it). A Kimi 2.5.2 TUI launched by 0.35.0 installs a launch-scoped plugin under `<kimi home>/plugins/managed/agent-hub` and removes it on exit; a 0.34.1 launcher neither installs nor removes it, so a copy left by a crash stays until a later 0.35.0 launch replaces or cleans it (source reading, not a run).
76
+ - Shared memory home: Records are on by default in agent-mem 0.23.x. Upgrade every amem CLI, native hook and ahub that shares a memory home together. 0.23.1 keeps `INDEX_VERSION` 3, the capture-row schema and the hook spool prefixes of 0.22.1, but adds the `Record` capture event, and this hub's managed headless peers capture Records unless amem `records: false` applies. agent-mem's own rollout note says a 0.22.1 hook drain silently discards a Record format-3 spool entry without a counted loss, and the 0.22.1 config parser refuses the `records` key even when it is `false`. A 0.34.1 hub embeds 0.22.1, so it is one of those consumers: setting `records: false` while a 0.34.1 hub or a 0.22.1 amem still uses the home breaks that consumer's configuration. agent-mem's alternative, a person-appended `home` reader floor at 0.23.0, makes 0.22.1 consumers, the 0.34.1 hub included, refuse the home instead. This hub supplies placement attestation on each sync pass (#1173); a 0.34.1 hub on an active-placement home still declines sync as before. Activation, floors and writer renewal stay person-run; this preparation performs none of them.
77
+ - CLI: adds `ahub model set <peer> <model> | clear <peer> | list [--json]` and `ahub research export --dataset <dir>`, and `ahub up` prints a still-starting notice while it waits for readiness. A 0.34.1 CLI keeps its own behavior against a 0.35.0 hub: no new flag, command or JSON field is required, and the two new feature labels are additive.
78
+ - Evidence ceiling: the N-1 fixture uses the unmodified published 0.34.1 package (core 0.22.1) for the control/plugin round trip in both directions and the isolated broker/member tests. It does not call `hub_visual`, `ahub model` or Record capture, does not open a hub.db or memory home written by 0.35.0 with 0.34.1, and does not run a rollback; those statements come from source reading. These claims do not establish real-account inference, a live Kimi TUI launch, a real memory home or two-machine operation; the release verification report records execution results separately.
79
+
7
80
  ## 0.34.1
8
81
 
9
82
  - `ahub upgrade` works with npm 12 again (#1253, PR #1254, task 766). npm 12 wraps `npm view --json` output for one package in a one-element array. The default target ("unexpected latest release") and `--to` ("unexpected release identity") both refused it. Both now share one parser that accepts the npm 11 value and a one-element array of it, and still refuses any other shape, with a message naming the `npm view` command to check. Until this release, an npm 12 machine can upgrade by putting npm 11 first on PATH for the run.
package/README.md CHANGED
@@ -5,12 +5,16 @@ 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.34.1, control protocol 17 (accepts 16). Bun + TypeScript, one loopback daemon per
8
+ Status: 0.36.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
+ Inspect bounded task and attempt metadata with `ahub lineage show`; admit external
12
+ references through the current task role with `ahub lineage link`. References remain
13
+ declared and never cause an external fetch. See [execution lineage](docs/operations.md#execution-lineage-1220-t2).
14
+
11
15
  ## Quick start
12
16
 
13
- You need [Bun](https://bun.sh) 1.4.2 or later on PATH.
17
+ You need [Bun](https://bun.sh) <!-- facts:bun-floor -->1.4.2<!-- /facts:bun-floor --> or later on PATH.
14
18
 
15
19
  ```bash
16
20
  bun add -g @staix/agent-hub && ahub setup
@@ -28,6 +32,11 @@ ahub say "Each of you: reply with your name."
28
32
  ahub ui # the web dashboard
29
33
  ```
30
34
 
35
+ If a verified daemon child is still starting after 12 seconds, `ahub up` reports
36
+ its PID and keeps waiting for readiness. Completed starts write phase timings to
37
+ `hub.log`; [startup diagnostics](docs/operations.md#install-and-start) explains
38
+ the 120-second outer bound and the next step for unconfirmed readiness.
39
+
31
40
  `ahub setup` also registers agent-hub as a plugin of the family console
32
41
  ([agent-console](https://github.com/STAIxBWLB/agent-console), `acon ui`): the same dashboard
33
42
  appears as a panel for every registered project, and pending approvals, reviews assigned
@@ -43,13 +52,29 @@ become links. The scene carries labels and states only, never message bodies or
43
52
  terminal, `ahub init` asks each main setting with its default before writing; flags
44
53
  such as `--agents`, `--sdlc` or `--no-specs` set them directly, and `--yes` takes the
45
54
  defaults. The
46
- [Quickstart](docs/quickstart.md) walks through a first session and a working day.
55
+ [Quickstart](docs/quickstart.md) walks through a first session and a working day,
56
+ including [a new project with SDLC advise or enforce](docs/quickstart.md#a-new-project-with-sdlc-advise-or-enforce).
47
57
 
48
58
  ## What you get
49
59
 
60
+ - **Bounded visual explanations.** Ordinary local peers can post a diagram,
61
+ comparison, table or before/after view with `hub_visual`. acon renders the
62
+ screened record; the standalone dashboard shows text/source, and peers receive
63
+ only a stub. [Limits and privacy](docs/operations.md#bounded-visual-attachments-1058).
50
64
  - **Peers, not a pipeline.** Any agent can message the others. Messages are batched
51
65
  into digests, priorities decide what interrupts a turn, and delivery survives
52
66
  restarts.
67
+ - **Optional decision routing.** Hub-owned routes can consult a loopback adec
68
+ policy in shadow mode while keeping the existing model choice unchanged.
69
+ Stage routes use bounded numeric evidence and a deterministic fallback;
70
+ whole-wire sizing conservatively counts UTF-8 JSON bytes, including Unicode.
71
+ See the [stage contract](docs/design/model-routes.md) and
72
+ [configuration and privacy limits](docs/operations.md#optional-adec-decision-route-554).
73
+ - **Live model selection.** A person can set a supported peer's next-turn model
74
+ with `ahub model set`, without restart or reload. Headless Kimi 2.5.2 has an
75
+ exact-version ACP setter receipt; other ACP kinds remain unsupported.
76
+ Active turns stay unchanged;
77
+ [status distinguishes pending and unsupported selection](docs/operations.md#live-peer-model-overrides-1317).
53
78
  - **A shared task board.** Work is proposed, accepted, done and reviewed through hub
54
79
  tools. Roles split planning, implementation and review (up to eight planners,
55
80
  each task bound to one), `routing.toml` picks
@@ -65,22 +90,38 @@ defaults. The
65
90
  another project running agent-hub on this machine goes onto that project's board
66
91
  with `ahub task handoff` (agents: `hub_task_handoff`), and its state changes come
67
92
  back as task messages.
93
+ For a PR already merged outside the hub, [merged PR adoption](docs/sdlc.md#adopting-a-pr-merged-outside-the-hub-1328-t3) verifies its recorded head and releases dependents: `ahub sdlc adopt-merge <task> --pr <n>`.
94
+ An explicitly superseding task may [carry existing spec consent](docs/sdlc.md#spec-acceptance-481-s1) for the same repository and issue when the host verifies an unchanged body.
95
+ Fresh Kimi reviews run periodic isolation checks off the hub event loop;
96
+ verdict and task-tool authority still require the complete synchronous fence
97
+ ([measurements and limits](docs/verification/2026-11-07-kimi-review-watch-1284.md)).
68
98
  - **Research campaigns.** `ahub study` keeps a multi-unit study contract as a draft
69
99
  (a planner drafts it with `hub_study_draft`); only the person approves it, which
70
100
  creates one task per unit, and `ahub study show` reads coverage per unit and
71
101
  source. A unit is covered by its owner's `hub_study_handoff` with evidence, not by
72
102
  a done task. Experiment attempts are recorded with `hub_experiment_record` and read
73
- with `ahub study experiments`, each value naming where it came from.
103
+ with `ahub study experiments`, each value naming where it came from. Covered by
104
+ source and fixture tests only so far: no real campaign has run on this repository
105
+ ([dogfood](docs/dogfood.md#operations)).
74
106
  - **Design specs.** Markdown specs with `id` and `type` frontmatter name the paths
75
107
  they govern. `ahub specs check` validates their links and reports specs that are
76
108
  stale against their covered sources, the hub names the specs covering a task, and
77
109
  agents read them with `hub_specs`. Only a person stamps a spec as reviewed
78
- (`ahub specs stamp`).
110
+ (`ahub specs stamp`). Fixture-tested only so far: this repository's own specs in
111
+ `docs/design/` are unstamped drafts ([dogfood](docs/dogfood.md#operations)).
112
+ The [guidance variant contract](docs/design/guidance-experiments.md) defines
113
+ immutable advisory role proposals and private task-local lifecycle storage.
114
+ `ahub guidance create|list|show|withdraw` and the MCP tools share task authority
115
+ and public projections; the producer console's Guidance panel is read-only.
116
+ Section diffs remain advisory, without activation, permissions or probes.
79
117
  - **Shared memory.** Decisions, contracts, fails and findings are kept through the
80
118
  first-party [`@staix/agent-mem`](https://github.com/STAIxBWLB/agent-mem) library,
81
119
  in process with no claude-mem worker (short- and long-term tiers, a typed graph,
82
120
  git sync between machines). Agents get
83
121
  it as a recall preface, as briefs on a task, and through bounded search tools.
122
+ Managed headless peers can save compact `amem:` records from final answers; the
123
+ hub follows amem's `records` policy and removes record lines from shared replies
124
+ ([details](docs/memory.md#agent-authored-records-1320)).
84
125
  - **Local and on-prem models.** Pi and the local worker can run on DGX or local MLX
85
126
  through an authenticated relay. Tasks marked as PII stay on the on-prem worker.
86
127
  - **Guard rails.** The local worker and Pi run in a sandbox, and their writes and
@@ -96,7 +137,8 @@ defaults. The
96
137
  the project's own peer appears as `<peer>~<origin>` with none of that peer's
97
138
  roles: sessions are distinguishable, which is provenance, not authentication.
98
139
  Budgets pause an
99
- agent before it runs out of quota, and recovery never replays an
140
+ agent before it runs out of quota (at 99% of a window by default, the
141
+ `budget.gate` setting), and recovery never replays an
100
142
  effect whose outcome is unknown.
101
143
  - **Operations.** A terminal console and a local dashboard, one hub per repository or
102
144
  worktree with a machine-wide view, live settings reload, machine-local schedules
@@ -128,9 +170,13 @@ Agent CLIs update themselves. `ahub agents` shows which installed versions the h
128
170
  accepts, `ahub agents trust <id> <version>` accepts an untested one on this
129
171
  machine, and the hub tells the planner when an installed version is not verified.
130
172
 
173
+ Qwen Code dual-output 0.27.0 and 0.27.1 are qualified by source and account-free macOS arm64 checks ([0.27.0](docs/verification/2026-11-10-qwen-0270-dual-output.md), [0.27.1](docs/verification/2026-11-10-qwen-0271-dual-output.md)) (supported from 0.36.0 once a hub is upgraded); real-model turns and live TUI use here remain unverified. A hub deny keeps later input fenced until a new personal turn completes or a verified fresh generation starts; see [Qwen TUI operations](docs/operations.md#qwens-own-tui-driven-through-dual-output-286-part-3).
174
+
131
175
  Before you migrate a memory home with `amem`, read
132
176
  [memory profiles and rollout](docs/memory.md#selected-memory-profile). Every hub that
133
177
  uses the home must run a version that understands the new layout.
178
+ Machine sync uses amem's public writer attestation; status and the dashboard
179
+ show an unverified writer's cause and the person-run next step.
134
180
 
135
181
  ## Where it is going
136
182
 
@@ -143,7 +189,7 @@ uses the home must run a version that understands the new layout.
143
189
  [#258](https://github.com/STAIxBWLB/agent-hub/issues/258)).
144
190
 
145
191
  Live checks that still need a real account or a person are listed in the
146
- [release verification report](docs/verification/2026-11-07-0.34.0.md) and the
192
+ [release verification report](docs/verification/2026-11-10-0.36.0.md) and the
147
193
  [smoke checklist](docs/smoke.md).
148
194
 
149
195
  ## Documentation
@@ -42,7 +42,7 @@ agent-hub supports five transport architectures (`transport` in `AdapterDefiniti
42
42
  An adapter exports an object conforming to `AdapterDefinition` in `src/adapters/registry-types.ts`. Read that type as the source of truth: most blocks are declared inline there, so there are no separate `Adapter*Definition` types to import, and some members are required. Its top-level fields are:
43
43
 
44
44
  - Required: `api` (always `1`), `kind`, `displayName`, `family`, `transport`, `roles`, `trust` (`onPrem`, `hubSandboxed`), `start`, `identity` (`mcp`), `permission`, `session`, `turnEnd`, `cli`, `display`.
45
- - Optional: `optional`, `defaultOnRoster`, `enabledSwitchStartOnly`, `instances`, `attach`, `reporting`, `routing`, `budget`, `configuration`, `capabilities`, `hooks`, `reviewerVariant`, `reviewer`.
45
+ - Optional: `optional`, `defaultOnRoster`, `enabledSwitchStartOnly`, `instances`, `attach`, `reporting`, `routing`, `budget`, `configuration`, `capabilities`, `hooks`, `reviewerVariant`, `reviewer`, `title`, `titlePersistence`, `questionWaitMs`, `settle`, `modelOverride` (the person's next-turn model override boundary, fixed builtins only), `headlessInstances`, `headlessVariant`, `projection`.
46
46
  - Registry load runs `assertDefinitionCoherence` (`src/adapters/registry.ts`) on every definition and reviewer variant, so an incoherent combination fails at load, not at run time.
47
47
 
48
48
  ### Key Sub-Objects
@@ -88,7 +88,7 @@ The `ahub <kind>` surface: `command`, `startWords(form)`, and for a fixed builti
88
88
  `instances.mode` is `headless` (needs a headless `start.create` factory) or `external` (a channel instance started from the person's terminal). A kind with no `instances` policy (Jcode) takes no extra instance, and `validateInstances` refuses a declaration of one. `attach` holds the pull-only forms, external-hello admission and the refusal texts for a TUI that attaches without a driven peer.
89
89
 
90
90
  #### Peer capability members
91
- The runtime peer (`PeerAdapter`, `src/hub/peers.ts`) exposes optional members that the daemon reads instead of checking its class (#625 phase 6): `sessionGeneration` (native session identity: absent keeps the owner-token fallback, present but undefined is unknown and refuses bounded checks), `checkpointUsesSessionGeneration` (opt out of generation-fenced checkpoints, as Pi does), `permissionModeState` (the effective native approval state, or `unknown` / `unmanaged`) and `setPermissionMode(mode)` (resolves only after the native side acknowledges). Native safety proofs (Codex proxy and restoration, Claude launch generation) stay in the daemon.
91
+ The runtime peer (`PeerAdapter`, `src/hub/peers.ts`) exposes optional members that the daemon reads instead of checking its class (#625 phase 6): `sessionGeneration` (native session identity: absent keeps the owner-token fallback, present but undefined is unknown and refuses bounded checks), `checkpointUsesSessionGeneration` (opt out of generation-fenced checkpoints, as Pi does), `permissionModeState` (the effective native approval state, or `unknown` / `unmanaged`) and `setPermissionMode(mode)` (resolves only after the native side acknowledges). A driven peer publishes its turn's final answer through `BasePeer.finalAnswer` rather than `onMessage`, so the bus strips `amem:` Record lines before sharing it (#1320); the Record instruction reaches only the owners the daemon binds (see [memory](memory.md#agent-authored-records-1320)). Native safety proofs (Codex proxy and restoration, Claude launch generation) stay in the daemon.
92
92
 
93
93
  #### `budget`
94
94
  Defines quota and context window consumption readers:
@@ -4,9 +4,9 @@ Status 2026-10-12: keep optional. No measured effect yet.
4
4
 
5
5
  ## What it does to collaboration
6
6
 
7
- - Recall: `context/inject` at session start (native hooks for Claude and Codex, the hub's `recallFor` for the other peers) and the task brief on handoff (`search` plus `timeline`).
8
- - Capture: native hooks record tool use; the hub captures the local worker's (`src/memory/capture.ts`).
9
- - Shared notes: `hub_remember` and the hub's own notes on done, review, escalation and checkpoint.
7
+ - Through the hub: nothing at runtime. Session-start recall, task briefs, the local worker's capture and `hub_remember` all use the in-process amem store (`@staix/agent-mem`); the hub makes no claude-mem worker request and ignores `memory.worker_url` (`ahub doctor`: "in-process, no claude-mem worker").
8
+ - Native plugin: claude-mem installed as a Claude Code or Codex plugin runs its own hooks inside those sessions; the hub neither reads nor writes them. The add-on fingerprint records it when it is enabled there, so `ahub research addons` and `ahub bench run --addon claude-mem=on|off` can compare on against off.
9
+ - Import: `ahub memory import claude-mem` is a person's one-way, read-only copy of past hub observations into hub memory (`docs/memory.md`). The bench memory arms `claude-mem` and `both` are historical labels for `memory.enabled`, not a live claude-mem path.
10
10
 
11
11
  ## Evidence
12
12
 
@@ -18,7 +18,7 @@ Status 2026-10-12: keep optional. No measured effect yet.
18
18
  | Part | Decision | Basis |
19
19
  | --- | --- | --- |
20
20
  | Recall at session start | keep optional | no measurement; the hub already reaches every peer through `recallFor` |
21
- | Capture of tool use | keep optional | no measurement; capture runs through a cloud observer, so PII rules keep it out of PII work regardless |
21
+ | Capture of tool use | keep optional | no measurement; this is claude-mem's own native capture, not the hub's (the hub's capture is local and deterministic), and PII rules keep the hub's PII work out of every observer |
22
22
  | Long-term store, tiers, graph of notes | adopted natively in #258 | the user's request for cross-project and cross-machine memory, not a measured effect; #258 AC11 measures it (memory off, claude-mem only, native graph) |
23
23
 
24
24
  Revisit when an arm comparison has at least 5 attempts per arm and measure, or field data has 5 tasks on each side.
@@ -4,5 +4,5 @@ Status 2026-10-12: keep optional. No measured effect yet.
4
4
 
5
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
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 for Claude (plugin) only. Arms owed: `all-on`, `open-code-review-off`, `all-off`.
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
8
  - Decision: keep optional. The hub's reviewer role and review checklists (#35) are the native counterpart; no part is adopted without data.
@@ -2,6 +2,12 @@
2
2
 
3
3
  Human explanation. Agent instructions: the area notes in this directory.
4
4
 
5
+ On 2026-11-10, #1352 R1 separated newly authored stage evidence, fallback and
6
+ whole-wire sizing from the remaining legacy route modules. The models note
7
+ points at the stage contract and its single switch planner; generic decision
8
+ evidence v1, the remaining route decisions and notice cleanup have separate
9
+ ownership boundaries.
10
+
5
11
  In the #1055 review, the new title-binding lookup preceded invocation,
6
12
  pending-delivery and supervision bookkeeping in `Bus.onDelivered`. The bus's
7
13
  outer observer catch protected settlement but could not finish bookkeeping
@@ -90,3 +96,63 @@ Review of PR #1050 found that including accepted runner configuration and raw-ke
90
96
  Review of PR #1052 found that full-index trust sweeps and hashing every retained capture under the registry writer lock made ordinary startup refuse large repositories or starve other project writers. Per-start scoped trust and bounded quarantine transactions separate execution authority and deletion safety from maintenance cost.
91
97
 
92
98
  The ledger review of PR #1052 found that applying the startup admission wait to worker completion could strand the ledger in running state after contention or a crash. Signed process ownership, an atomic dead-owner replacement, a normal worker wait and read-only doctor paths keep deferred maintenance recoverable and visible.
99
+
100
+ On 2026-11-09, #1220 T1 classified malformed root/limit input as source corruption.
101
+ T2 initially repeated that cause error for an explicit attempt address whose id
102
+ was not an owner-supported attempt id. The query-validation rule in tasks.md
103
+ separates caller mistakes from source failures; the execution-lineage and owner
104
+ fixtures cover both cases, including source-lookup traps and neutral agent replies.
105
+
106
+ On 2026-11-09, the #1320 Record read projection used the global configuration
107
+ revision. A roster-only reload then discarded a held public recall response, so
108
+ the existing #315 preface test lost its preface even though the independent
109
+ off-roster attach guard remained correct. The memory/privacy-specific read
110
+ revision preserves both behaviors; capture still uses its stricter turn fence.
111
+
112
+
113
+ ## Changes
114
+
115
+ - 2026-11-10: #850 distinguishes normal-Bus Q2 proof from direct busy-submit characterization and preserves adoption/reattach/deny quiescence ceilings.
116
+ - 2026-11-10: Spec acceptance carry-over (#1328 T4) distinguishes a new person decision from host-verified reuse of the same decision on explicitly superseding work. The narrow exception preserves original consent and records its cancelled source; it does not expose acceptance as a tool or receipt field. Review caught an early carry write before a later plan refusal: staging the host proof and committing only with the admitted outer event preserves the existing pre-effect refusal contract.
117
+ - 2026-11-09: #1328 T6 extended the closed machine-default schema for an explicit setup research choice, reusing guarded publication and preserving the existing autonomy and start choices.
118
+
119
+ ## 2026-11-10: Qwen dual-output Q2
120
+
121
+ The v2 native workload appended a second submit directly while the first provider
122
+ response was held. Its private 0.26.1 matched control and later candidates emitted
123
+ one user event and one final assistant/stop containing both markers. The extra
124
+ provider POSTs were not classified by response format or role counts, so their
125
+ underlying cause is unknown. That workload did not reproduce the original
126
+ 0.26.1 receipt's native-queued-turn claim; the original used a real gateway and a
127
+ global installation that changed during the day.
128
+
129
+ Ruling fa75c5f2-fc78-42a1-85dc-cf206e6a7825 makes required Q2 follow the actual normal
130
+ Bus and QwenDualPeer path. The second envelope waits in the Bus during the held
131
+ first response. Distinct native user/provider/final assistant/stop boundaries
132
+ remain necessary. Direct native busy-submit behavior is separate characterization.
133
+ The manual producer does not make the receipt harness eligible for automation.
134
+
135
+ Adoption can report idle with an unknown pre-existing turn; reattachment can
136
+ report idle before proving native quiescence; deny marks the hub turn ended before
137
+ native consumption is acknowledged. Those existing ceilings prevent an absolute
138
+ claim that no input can ever reach a native active turn. The premature deny/idle
139
+ follow-up is outside this compatibility change; the production adapter is unchanged.
140
+
141
+ The final account-free normal-Bus Q2 runs passed on the private 0.26.1 control
142
+ and 0.27.0 candidate, with two user/final-stop/provider turns after evidence was
143
+ frozen at owned stop. Two earlier normal-path controls failed the strict provider
144
+ check despite observing two real turns. Shipped-source analysis showed `--bare`
145
+ bypassed the private UI follow-up setting; the corrected fixture loads owned full
146
+ settings. The earlier extra requests remain unattributed because their latest
147
+ user bodies were not retained. The [dated receipt](../verification/2026-11-10-qwen-0270-dual-output.md)
148
+ separates these attempts and the 0.26.1 config-only observation from the later
149
+ passing required Q3/Q5/Q6/Q7 pair. The remaining producer preserved a PTY/catalog
150
+ control failure and a host FIFO-helper setup failure before the final matched
151
+ pair passed with owned cleanup/final closure. The independent direct-busy pair
152
+ on both versions observed one user/assistant/Stop with both markers in one
153
+ assistant, while required normal-Bus Q2 retained two distinct turns. No production
154
+ adapter, Bus or automatic receipt-admission behavior changed.
155
+
156
+ The task 859 deny-readiness correction separates known delivery disposition from native quiescence. Task 850 measured no post-deny completion ACK; normal-Bus assistant/Stop evidence cannot be reused for the denied turn. The durable fence keeps a synchronous Bus drain from submitting queued work and allows recovery through a new personal turn or a verified fresh generation. The 30 s deadline is an operational waiting bound, not evidence that native work stopped.
157
+
158
+ The same review found that a single append can write a prefix without throwing. The byte-count check and actual tail guard prevent a second append from completing that prefix. This intentionally adds no per-write persisted intent: a crash leaving a torn prefix that already ends with newline remains the explicit ceiling.
@@ -6,6 +6,8 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
6
6
 
7
7
  ## Adapter definitions, the registry and external modules (#451)
8
8
 
9
+ - Optional live model selection must preserve ordinary no-override delivery when its native surface is unsupported or unverified. A retained desired override must instead refuse before any prompt. Test both paths through the actual daemon factory; capability metadata alone cannot prove runtime readiness.
10
+
9
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.
10
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`).
11
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`).
@@ -53,6 +55,7 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
53
55
  - Codex reports each thread it adopts, started or resumed (`onThread`, the `native_thread` event), before any turn on it starts: the upgrade planner (Codex's `session.zeroTurn` in `src/adapters/definitions/native-recovery.ts`, read through `nativeZeroTurn` in `src/cli/upgrade-runtime.ts`, #215) gives each codex `turn_start` to the thread adopted last before it and plans a thread it saw start with no turn (and no rollout) as a fresh start.
54
56
  - Peer DOING (#878): an adapter reports a native session title or its plan's in-progress item only through `onDoing` (set by `Bus.add`), with `reset` when it binds a new session or thread; never put that text in a log line, event, message, status notice or memory capture. Codex reads only `thread/name/updated` and `turn/plan/updated` of the bound thread, ACP only a `plan` update inside the current turn; never guess a value for a peer without such a source.
55
57
  - Session titles (#1055, spec `docs/design/adapters.md` "Session title slots"): only a fixed builtin may declare `title` or `titlePersistence` (`assertNativeCapabilityScope`), and only a `title: "hub"` definition (Pi, local) is offered `hub_set_title` (`sessionTitleTools`); keep it off Claude, Codex, Kimi and ACP tool lists and native auto-approval names. Write a title only through `setSessionTitle` (unnamed-only for an agent, `current()` rechecked right before the effect) and report it only through `onDoing("title", ...)`; never pass a title call to `observeTool` or capture, and never store a derived unnamed label.
58
+ - Final answers (#1320): a driven adapter publishes a model's final turn answer through `BasePeer.finalAnswer` (the bus's `onFinalAnswer`), never `onMessage`, and passes `complete` only for a normal completion. `onMessage` skips Record capture and lets `amem:` Record lines reach peers unstripped. Decorate a turn's fixed prompt with `turnRecordPrompt`, never native client configuration.
56
59
  - Codex 0.154.0 `agentMessage` items carry `text` and `phase` (not `content[]`); only the last non-`commentary` message of a turn is shared.
57
60
  - Hide `hub_delivery_retry` from delivery-only ACP/local tool lists and omit its retry hint. Treat `AGENTHUB_DELIVERY_ONLY` only as an exposure hint; the daemon must refuse by the actual attached adapter, and native children must not inherit the marker. A Claude push that cannot reach its model reports `failed_safe`; if the daemon refuses that optional receipt state, try `needs_review` and retain uncertainty when neither receipt is confirmed. Keep `hub_delivery_resolve` on every list, delivery-only included: settling one's own `needs_review` row is not a retry (#1112).
58
61
  - ACP `onActivity` is a closed, transient person-only projection. Never publish it through the bus, log/event writers, UI, tools or memory. Emit only for an active turn; latch private envelopes and associated PII work, including unreadable privacy state, and discard pending chunks on turn teardown. Native terminal references do not authorize filesystem/terminal RPC reads.
@@ -86,19 +89,23 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
86
89
 
87
90
  ## Qwen's dual-output TUI (#286 Part 3)
88
91
 
92
+ - Before qualifying another dual-output version, read the required Q2 normal-path contract in `docs/specs/2026-09-19-agent-hub-design.md` (Qwen dual-output TUI amendment) and use `scripts/compat-receipts/proofs/qwen-dual-bus-q2.ts`. Keep direct-native-busy-submit characterization separate; do not change automation admission from this manual proof. Do not infer native quiescence from adoption, event-file reattachment or hub deny settlement; preserve their separate ceilings when reporting qualification. Background for changing this rule: `README.md` in this directory.
93
+
89
94
  - `src/adapters/qwen-dual.ts` drives Qwen's own TUI through `--input-file` and `--json-file`; it is started only by `ahub qwen --mode tui`, through the definition's `start.createTui` and the `qwen-dual` daemon port, both fixed-builtin capabilities (`assertNativeCapabilityScope`). Qwen's `start.forms` stays `["headless"]`: never add `tui` to it (that would make Qwen a start-mode peer the hub opens by itself, and would change `START_MODE_PEERS`, a cross-release probe). The launcher needs a terminal and the base `qwen` id; the daemon refuses a TUI start for a declared instance, off roster or while a headless Qwen runs.
90
95
  - Judge a Qwen TUI by `holdsTerminal()` (its bound owner verified alive, or a session seen with no owner bound), never by peer state: a detached TUI reads offline while Qwen keeps running. A headless start over a held terminal is refused and a TUI start answers `already`.
91
- - Gate the TUI on `COMPAT["qwen-dual"]` (verified 0.26.1, no `line`), both before the start (`qwenDualVersionAsync`) and from the TUI's own `session_start` (version, `protocol_version` 2, the events read). Never widen the headless `qwen` entry for it, or the other way round: their receipts are separate.
96
+ - Gate the TUI on `COMPAT["qwen-dual"]` (verified 0.26.1, 0.27.0 and 0.27.1, no `line`), both before the start (`qwenDualVersionAsync`) and from the TUI's own `session_start` (version, `protocol_version` 2, the events read). Never widen the headless `qwen` entry for it, or the other way round: their receipts are separate.
92
97
  - `deliver()` sets `busy` synchronously and appends one `submit`; a prompt that is not the hub's own (matched by its text) is the person typing: the peer stays busy, nothing is shared, no approval is asked of the console. A submit that starts with `/`, `!`, `@` or `?` gets an `[agent-hub]` first line: Qwen reads a submit as typed input (slash command, shell line, file include). A turn ends at an `assistant` whose `stop_reason` is not `tool_use` followed by `message_stop` (or a `result`); a `tool_use` message never ends it.
93
98
  - A Qwen background-task notice is not the person typing (#517): when a background shell finishes Qwen writes a `user` event of its own, which can land in the middle of a running hub turn, and several finished shells fold into one event. `isQwenTaskNotification` accepts exactly one or more whole `<task-notification>` envelopes (task id, kind, status header, blank line between envelopes) and nothing else; `onUser` judges the raw event, not `promptText` (which joins every text block and drops the rest): the content must be exactly one text block that is wholly the envelope, so a split or mixed-block event is a person's prompt. Such an event changes nothing: a running hub turn keeps its owner and is not failed, and an idle peer stays idle (never mark it busy for a notice nobody may answer). Read nothing inside an envelope beyond its header, and never loosen the shape: a prompt that only contains or resembles one is still a person's prompt and still settles a hub turn as uncertain. The old reading held 7 of 7 recorded `needs_review` queues; when a new Qwen event type shows up inside a turn, check the live `events.jsonl` against `onUser` before widening anything.
94
- - Limit 1: Qwen emits nothing for a deny, so after `allowed: false` the adapter ends the turn itself (the delivery `completed`, since a deny is a known outcome and `needs_review` holds the peer's whole queue: measured against the real Qwen; no answer; a notice). Only an unknown outcome (Qwen exited, Esc then a new prompt, an unreadable event file) settles `needs_review`. Limit 2: the watchdog never cancels. `onWatchdog` marks the turn stalled and keeps the peer busy; the next event clears it. Never type into the terminal, send a signal to stop a turn, or add an input type: the protocol has only `submit` and `confirmation_response`. A pending approval is a person deciding, not silence.
99
+ - After appending a Qwen deny, retain a durable input fence and settle only the delivery as known `completed`; never report idle from the deny, a denied-turn assistant/Stop, a control response, file readability or elapsed time. Check the fence write before appending the deny. Release it only after a newly observed same-session personal USER and that personal turn's normal final assistant/message_stop under the same verified owner, or a verified fresh native generation. Expire the named 30 s wait to offline with an actionable notice, retain queued input and the fence, and keep observing those recovery proofs after expiry. Persist the fence across detach, stop and adoption; an adopted fence needs a new personal USER, never buffered history. The watchdog never cancels: keep stalled turns busy; never type into the terminal, signal a turn or invent an input/ACK schema.
95
100
  - Only an exact hub tool name is auto-approved (`autoApprove`, the daemon's `HUB_TOOL_TITLES`), and an always-ask class call never is. A `control_response` for a request the hub has not answered means the person answered in the TUI: abort the hub's pending request so a late console answer finds nothing. A request other than a hub tool that names the hub state dir (`qwenDualNamesStateDir` against `guardDir`) is refused before anyone is asked: the input file is a prompt channel (`docs/security.md`).
101
+ - Write each Qwen input record as one full UTF8 Buffer and require its full byte count, never retry a remainder. A short/throwing write settles uncertainty as `needs_review` and offline; a non-newline tail before append or attachment also blocks input. Only a verified fresh generation may reopen that file, never personal completion. Preserve the documented torn-prefix-ending-newline ceiling; add durable write intents only if that failure is observed.
96
102
  - The event file is read from the saved offset in `state.json`. Qwen opens an existing event file at byte 0 without truncating it (measured on 0.26.1), so a fresh or resumed launch starts from empty files (the old event file is kept as `events.prev.jsonl`) and a hub restart adopts a still-running Qwen from the saved offset instead. The owner is bound from the host's process table (the root of the tree of processes whose argv names this adapter's input file; two separate roots is no owner), never from anything the launcher sends. An unreadable event file is `detached` (offline, the `qwen-detached` status notice), never idle, and reattaches when it reads again; a stall shows `qwen-stalled`. An event line over 1 MiB is dropped through its newline and the saved offset moves past it.
97
103
  - Recovery never restores this terminal as a headless worker (`QWEN_RECOVERY_SESSION.recoveryRefusal`), and `stopPeer` refuses a Qwen TUI: the hub never signals a person's Qwen.
98
104
 
99
105
  ## TUI launchers, native facts and Antigravity
100
106
 
101
- - Kimi TUI is a pull-only WsPeer under the one kimi id, with no hub busy/watchdog/permission/quota machinery. Only the person's launcher merges or removes its project MCP entry; a daemon headless start refuses a stale entry and never edits the file. Scrub mode/channel markers from the native child; managed AGENTS instructions and tool descriptions carry the pull rules, not MCP initialize instructions.
107
+ - Kimi TUI is a pull-only WsPeer under the one kimi id, with no hub busy/watchdog/permission/quota machinery. Only the person's launcher merges or removes its project MCP entry; a daemon headless start refuses a stale entry and never edits the file. Scrub mode/channel markers from the native child; managed AGENTS instructions and tool descriptions carry the pull rules, not MCP initialize instructions. Completion facts (#1282) do not change that pull-only transport: no push, steer, watchdog, permission or automatic quota handoff.
108
+ - 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.
102
109
  - 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).
103
110
  - 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.
104
111
  - 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.
@@ -108,9 +115,9 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
108
115
  - Jcode MCP set (#572): `jcode acp` and `jcode serve` start every server named in `<JCODE_HOME>/mcp.json` and the project's `.jcode/mcp.json`, `.mcp.json` and `.claude/mcp.json`, and no flag or variable selects them (`--mcp-tools`, `JCODE_MCP_TOOLS`, `JCODE_DISABLED_TOOLS` and `JCODE_DISABLE_CLAUDE_MCP` do not). Do not paper over it: `ahub doctor` lists the extra names through `jcodeExtraMcpServers` (`src/adapters/definitions/native-cli-jcode-mcp.ts`), names only, those four paths only, no home search, no link followed. Below the project root or home, `.jcode` and `.claude` must be real directories and the file a regular file (per-component `lstat`, an `O_NOFOLLOW` open and an `fstat` identity recheck); a system alias at or above the configured root stays allowed. Revisit if upstream adds a server selector.
109
116
  - Extra Jcode instances (#685, #368): one `JcodePeer` per declared id (at most 8), each with its own `jcode_home`, socket and state. The person authenticates inside Jcode; the hub passes `-p`, `--model` and `--provider-profile` exactly as declared, handles no model credential or URL, and only checks that the home is a directory the person owns (`jcodeHomeRefusal`: no read or write under it). Never put `AGENTHUB_PEER_ID` in the shared `.jcode/mcp.json` entry (`jcodeMcpEntry`): every owned launch supplies it through `peerChildEnv(<id>)` or the TUI launch env, together with its `AGENTHUB_LAUNCH_ID`. The MCP server with no `AGENTHUB_PEER_ID` in tools mode refuses every tool and never defaults to a peer id. The daemon admits a `tools` hello for a peer whose definition is `owned-acp` only when it carries the launch id of that peer's current owned launch (`JcodePeer.ownsLaunch`, from `jcodeLaunches`); never trust the env alone. `jcode --as <id>` never opens a TUI. Declare the semantic `instances.nativeHome` on a definition, never compare the kind name (`registry-guard`); it is a fixed-builtin capability that `assertNativeCapabilityScope` refuses elsewhere. `checkJcodeInstanceHomes` (`src/hub/instances.ts`, run once at daemon startup) refuses a home equal to or nested in the base Jcode's or another instance's; compare homes only through its `canonicalHome` (`realPath`, case-folded on a volume that folds case, inode), never `resolve()` text. The preview of `--as <id>` passes the instance to `previewJcode` so it shows the daemon's real flags.
110
117
  - Jcode defers MCP tools (#912, `JCODE_DEFERRED_TOOLS_INSTRUCTION` in `src/hub/envelope.ts`): a Jcode peer lists only its built-in tools until the model searches for an MCP tool, so without a hint it reports the hub tools missing and answers in its final message. The guidance is written in exactly one place, that constant, and `JcodePeer` sends it through `jcodePreamble` (`src/adapters/jcode.ts`) ahead of the role contract, once with a session's first prompt, for the base peer and every extra instance. Never copy it into `STANDING_INSTRUCTION`, `templates/AGENTS.block.md` or a profile template (the Jcode bullet there is the same text in every template, and `test/jcode-deferred-tools.test.ts` pins both), and never change Jcode's own deferral or cache settings from the hub. The tools it names must exist, and the server name must be `JCODE_MCP_NAME`.
111
- - Antigravity P1 (`src/adapters/agy/`): keep it optional, cloud, off roster by default, implementer/verifier only and pull-only. Until per-mode native prompt behavior is verified, reject hub permission/unattended mappings, headless starts and resume selectors; do not infer a quota source. The launcher refuses extra instances, any `agy --version` that compat `agy` refuses (1.4.2, 1.4.7 and 1.4.12 are T0-verified; other 1.4.x patches launch with a stderr warning, #589; another version needs the person's trust, #691), and a hub without the `native_hook_launch` feature.
118
+ - Antigravity P1 (`src/adapters/agy/`): keep it optional, cloud, off roster by default, implementer/verifier only and pull-only. Until per-mode native prompt behavior is verified, reject hub permission/unattended mappings, headless starts and resume selectors; do not infer a quota source. The launcher refuses extra instances, any `agy --version` not admitted by `assessVersion("agy", ...)` (`COMPAT.agy` in `src/adapters/compat.ts` is the verified-set/warning-line source of truth; exact person trust is separate, #691), and a hub without the `native_hook_launch` feature.
112
119
  - Only the person's `ahub agy` launcher manages `.agents/plugins/agent-hub/{plugin.json,mcp_config.json,hooks.json}`. Refuse linked/foreign entries before any write; cleanup only the matching launch. Never write project-level `.agents/hooks.json` or personal Gemini settings. The plugin MCP server is named `agent-hub_agent-hub` by the pinned native client.
113
- - Managed native facts use the definition's typed `NativeFactsPort` and the daemon's ephemeral `native_hook_launch` authority. Bind every observation to the daemon, launch, native session, project and current socket generation. Stop requires `fullyIdle`, normal termination and a fresh validated completion row; a missing readback keeps the peer busy. Native fact acknowledgement accepts only SDK ephemeral-message rows in the exact session transcript path. `decodeAgyHook` classifies as `Read` only the observed native read (`view_file` `AbsolutePath`, or 1.4.3 `read_file` `Path`); a `StartLine`/`EndLine` range becomes `offset`/`limit`, so a partial read never counts as a whole-file view. Unobserved edits get no scoped grant or effect attribution. The daemon records Pre/PostToolUse through `Facts.preTool`/`postTool` and offers nothing on them (#555).
120
+ - Managed native facts use the definition's typed `NativeFactsPort` and the daemon's ephemeral `native_hook_launch` authority. Bind every observation to the daemon, launch, native session, project and current socket generation, and bind `WsPeer`'s live `nativeSession` (`bindNativeSession`) from `case "native_facts"` while keeping new `WsPeer` instances free of `nativeSession` until observed. Normal `Stop` (`NO_TOOL_CALL`) requires `fullyIdle` and a fresh validated completion row (a missing readback keeps the peer busy); terminal non-normal `Stop` reasons (`USER_CANCELED`, `ERROR`, `MAX_INVOCATIONS`, `MAX_FORCED_INVOCATIONS`, `MAX_TOKEN_BUDGET_EXCEEDED`, `TERMINAL_STEP_TYPE`, `TERMINAL_CUSTOM_HOOK`) with `fullyIdle` acknowledge any pending transcript facts/usage, clear the active turn, end any waiting cohort turn, record a closed-reason `native_turn_end` event (`reason` without `id`), settle any open #1054 run by its closed reason (pull-only `agy` opens none), and return the peer to `idle` (#1280). Native fact acknowledgement accepts only `SYSTEM_SDK` rows (`EPHEMERAL_MESSAGE` in 1.4.x, `SYSTEM_MESSAGE` in 1.5.x) in the exact session transcript path, extracts completed `PLANNER_RESPONSE` token counters (`input_tokens` excludes `cache_read_tokens`: cache reads exceeded input on 2947 of 3021 real 1.5.x rows, so `totalTokens` is their sum, not a double count) into `source: "agy_transcript"` usage events (deduped by hashed `(session, step_index)` across restarts), and advances the per-launch transcript cursor only after a scan that reached the previous cursor (or the 4 MiB lookback ceiling). `decodeAgyHook` normalizes `Read` (`view_file` `AbsolutePath`, `read_file` `Path`, with `StartLine`/`EndLine`/`ByteOffset` carried as `offset`/`limit` so partial reads never count as a whole-file view), `Write` (`write_to_file` `TargetFile`/`CodeContent`, `write_file` `Path`/`Content` when not `Append`), and `Edit` (`replace_all` only when `AllowMultiple` is true: a missing flag reads as a single replacement because no native receipt shows the default) (`replace_file_content` `TargetFile`/`TargetContent`/`ReplacementContent`, `edit_file` `Path`/`Target`/`Replacement`). The daemon records Pre/PostToolUse through `Facts.preTool`/`postTool` and offers nothing on them (#555, #1280). `INSTRUCTION_FILES` (`src/hub/permission-mode.ts`) includes `gemini.md` alongside `agents.md`, `claude.md` and `qwen.md`. Pull-only `agy` has no push, so on `SessionStart`/`PreInvocation` the daemon appends a count-only line (`[agent-hub: N message(s) waiting (M important); call hub_inbox]`, never a body or sender) to the injected message when `bus.queued(peer) > 0`, with or without a fact offer (#1280 P2). `agy acp` was probed model-free (`docs/verification/2026-11-08-agy-acp-t0.md`); its `AcpPeer` wiring waits for one authorized model-backed receipt.
114
121
  - `terminalOwner(launchId)` (`src/hub/peers.ts`, #482) answers only for the adapter's current native TUI owner bound to that launch (Codex: the claimed link with that `launchId`, both sockets open; the launcher sends the id as the upgrade's bearer token through `--remote-auth-token-env`, because `codex --remote` refuses any path or query (#586); Pi: a started, verified TUI owner on its requested session); a start acknowledgement is never ownership. A Codex link that is not the claimed one or has a closed socket never adopts a thread.
115
122
 
116
123
  ## Reviewers
@@ -124,13 +131,13 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
124
131
  - Every print child (reviewer and Claude implementer) is spawned, bounded and stopped only through `OwnedPrintChild` (`src/adapters/claude-print-child.ts`): its `done` settles only after the whole group is confirmed gone, and a failed stop rejects with `PrintChildCleanupError` while the owning peer keeps the handle. Never add a second spawn path to an adapter.
125
132
  - Owned input observers (#1056): `beforeInput`/`inputReleased` (`OwnedInputObserver` in `src/adapters/claude-print-child.ts`) carry review-observer provenance only. `observerSessionId` (Claude implementer, reviewer print, local) is never `nativeSession` and never grants budget, resume, permission or task authority. `beforeInput` runs with the final target session before any prompt reaches the child or model, and a throw releases no prompt; `onInputReleased` fires only after stdin flushed for the current generation, and an observer throw never changes settlement. A fresh reviewer calls `inputFinished` only after its group is confirmed gone, its task MCP is closed and launch cleanup succeeded.
126
133
  - Retained standby (#1174, `WsPeer` in `src/adapters/channel-peer.ts`): an opt-in (`retainStandby`) hello while another session holds the peer is kept as one of at most `MAX_STANDBY_SESSIONS` (8) standbys; `standbySessions` ids and PIDs are display only, never native-session provenance or authority. Ownership changes only through `takeover` (the person's `peer_takeover`, or the oldest standby when the owner leaves), guarded by the host's `channelTakeoverAdmission` and `claim.isCurrent()` across the async preface; the old socket closes 4405 (opt-in) or 4403 "detached by the person" and its native process is not stopped. A standby socket runs no peer operation until `ownsSocket` confirms it. A hello without the opt-in keeps newest-hello replacement.
127
- - A reviewer backend is a fixed builtin `ReviewerBackend` in a definition's `reviewer`, never config. Its `prepare` must return a complete isolation receipt (matching backend id, binary, version, profile, evidence and `readOnly` true, plus `strictMcp` and `ephemeral` true, or for a `nativePolicy` backend `enforcement: "native-policy"`, `freshSession` and `hubToolsOnly` true) before every child. A `taskMcp` backend refuses without the host's `taskMcp` port and gets only that task's MCP config, never the hub-wide one. `admit(env)` and `launch.current()` are rechecked right before spawn, and a `watchCurrent` launch is polled while the review runs: a change aborts it as `review policy changed`; a missing or failed proof refuses, never a weaker launch or a continuing native session. The daemon puts the reviewer on the bus only after `start()` proved isolation; a failed start or a `start_failed` report marks it in `reviewerUnavailable`, which routing reads as `failing`. An unavailable reviewer variant has no reviewer backend or launch code; `startPeerBody` refuses it before preflight, independently of any native TUI launcher.
134
+ - A reviewer backend is a fixed builtin `ReviewerBackend` in a definition's `reviewer`, never config. Its `prepare` must return a complete isolation receipt (matching backend id, binary, version, profile, evidence and `readOnly` true, plus `strictMcp` and `ephemeral` true, or for a `nativePolicy` backend `enforcement: "native-policy"`, `freshSession` and `hubToolsOnly` true) before every child. A `taskMcp` backend refuses without the host's `taskMcp` port and gets only that task's MCP config, never the hub-wide one. `admit(env)` and the complete synchronous `launch.current()` are rechecked right before spawn; keep that complete fence in `reviewToken()` at every verdict/task-MCP authority boundary. A `watchCurrent` launch supplies `startPolicyWatch()` with a review-owned full-policy probe; run its serialized asynchronous checks on absolute 100 ms due times, coalescing missed ticks without overlap or an extra post-check delay. Pass only expected paths/fingerprints to its worker, never task text or inherited environment. Fence the exact child/review sequence on failure as `review policy changed`, and terminate/join the worker before private cleanup even when native stop fails; retain an unconfirmed owner for explicit stop retry; a missing or failed proof refuses, never a weaker launch or a continuing native session. The daemon puts the reviewer on the bus only after `start()` proved isolation; a failed start or a `start_failed` report marks it in `reviewerUnavailable`, which routing reads as `failing`. An unavailable reviewer variant has no reviewer backend or launch code; `startPeerBody` refuses it before preflight, independently of any native TUI launcher.
128
135
  - Report reviewer failures (`onUnavailable`: `start_failed`, `quota`, `no_verdict`) only after the child's group is confirmed gone and only while its generation is current: a person's stop owns its hold and never reroutes. Complete a normal no-verdict delivery only after the host confirms a current re-offer; an uncertain or failed fallback stays `needs_review`, with its `REVIEWER_FALLBACK_UNCONFIRMED` reason excluded from automatic moved-review settlement; ordinary superseded holds keep their existing rule. Log one bounded no-verdict line from exit code and allowlisted hub-tool metadata only, with full refusal privacy/secret screening before sanitization and truncation; retain the first full host refusal across native echoes, and withhold differing later host refusals rather than replacing or accumulating them; stale/private context is withheld. Record only allowlisted tool names and refusal text; never retain argument objects, task/diff fields or model-message events as trace data. `quota` comes only from the backend's structured `failure(event)`, never from vendor text. An NDJSON frame over 256 KiB or more than 4 MiB of output aborts the review as `needs_review`.
129
136
  - Codex reviewer isolation (`src/adapters/codex-review-isolation.ts`): accept only a `codex-cli` version that compat `codex-review` admits (verified or the person's trust, #691), and still run every proof below after trust; pass `-c notify=[]` (legacy notify off) on every launch; prove model-free that Apps, plugins and hooks are disabled (`features list`), ambient MCP servers are replaced by disabled stubs, and the hub server alone is enabled with exactly `hub_review` and `hub_task_show`; approve exactly those two MCP tools per tool, never with a server-wide approval default; before marking a reviewer backend/version verified, record a successful model-backed hub tool call as well as the model-free inventory (inventory alone is not verdict-delivery proof); run the native sandbox fixture probe before every launch; hash the binary once and fence binary and config files by metadata. Credential denies come only from the bounded `HOST_CREDENTIAL_PATHS` and `HOST_CREDENTIAL_ENV` lists, denied at the lexical and canonical path; refuse glob syntax or a root inside the checkout. A root that is dangling or unreadable refuses too; the reason names only its path class (`~/.docker`, `$DOCKER_CONFIG`), never a path or contents. Never pass the control token in a reviewer child's argv, env or MCP config: keep the hub state dir in its `privatePaths`. A refused `prepare` carries a `causeClass` from the closed `REVIEWER_CAUSE_CLASSES` (`version`, `binary`, `mcp_inventory`, `plugins_hooks_apps`, `sandbox_proof`, `credential_root`, `timeout`, `unknown`; `reviewer-print.ts`, #722): `prepare` tracks the proof leg it is on, and `timeout` means a metadata command ran out of its 2 s or the 12 s budget, never an abort. The host builds the reason only through `reviewerUnavailableReason(cause, detail)`: a fixed sentence per class, plus a credential-root path class (`~/.docker: a dangling link`) as the only detail. The one exception is a failed `start()` whose error is a version refusal (`VERSION_REFUSAL`) or comes from a `nativePolicy` backend: the daemon shows that sanitized message, capped at 1000 characters (#691). `ReviewerPrintPeer` classes a missing or invalid receipt as `unknown`, a `launch.current()` change before spawn as `binary`, and any other start error as `unknown`. Keep admission refusals separate from start failures: skip only a stale-bound request with one task-id log and no reroute; reroute a still-current request whose policy changed as `no_verdict`, without marking the reviewer unavailable. The daemon writes that reason to the `reviewerUnavailable` map (read by routing and shown as the `reviewer` line of `ahub status`), and a `hub.log` line names the class. Never add native CLI text, a path, a version output or a token to the class, the reason or the log.
130
137
 
131
138
  ## Headless Claude implementer (#525-4)
132
139
 
133
- - `ClaudeImplementerPeer` (`src/adapters/claude-implementer.ts`) runs one owned print child per turn in its verified worktree and none while idle. Keep the native argv of `claudeImplementerArgs`: `--permission-mode default`, `--strict-mcp-config` and `--permission-prompt-tool mcp__agent-hub__hub_permission_request`; never `acceptEdits`, `dontAsk`, `bypassPermissions` or `--bare`. `--model` is added only from the instance's validated declared `model` (#844, `instances.modelSelect` on the headless variant; one `NATIVE_WORD`, headless implementer only, untracked config only), on every turn, resumed ones included; never from task, chat or tool text. `never-ask` and `--unattended` are refused at every layer (factory, `setPermissionMode`, daemon start, `validateInstances`); a mode change only changes what the host facts gate allows. A start needs a version compat `claude-implementer` admits, and each turn rechecks the binary fingerprint from `proveClaudeImplementer`.
140
+ - `ClaudeImplementerPeer` (`src/adapters/claude-implementer.ts`) runs one owned print child per turn in its verified worktree and none while idle. Keep the native argv of `claudeImplementerArgs`: `--permission-mode default`, `--strict-mcp-config` and `--permission-prompt-tool mcp__agent-hub__hub_permission_request`; never `acceptEdits`, `dontAsk`, `bypassPermissions` or `--bare`. `--model` is added only from the instance's validated declared `model` (#844, `instances.modelSelect` on the headless variant; one `NATIVE_WORD`, headless implementer only, untracked config only) or, ahead of it, the person's runtime override sampled at each turn boundary (`getModelOverride`, `ahub model`, #1317, rechecked with `isNativeModelToken`), on every turn, resumed ones included; never from task, chat or tool text. `never-ask` and `--unattended` are refused at every layer (factory, `setPermissionMode`, daemon start, `validateInstances`); a mode change only changes what the host facts gate allows. A start needs a version compat `claude-implementer` admits, and each turn rechecks the binary fingerprint from `proveClaudeImplementer`.
134
141
  - Per-task native sessions live only in `ClaudeTaskSessions` (`src/adapters/claude-task-sessions.ts`, file `claudeStateFile("claude-task-sessions", id)`, ids only). A reserved UUID becomes `--resume` only after `markStarted` saw a stream-json frame naming that session; forget it only when `transcriptPersisted` answers false (unknown keeps it); an unreadable or invalid state file throws, never resets. Chat without a task ref goes to the instance's single `in_progress` task (`chatTask`), else to a `--no-session-persistence` one-off child.
135
142
  - A private envelope refuses the delivery before spawn; an item `admit` refuses is dropped without vetoing the others. Settle `failed_safe` until the child's stdin was released (`inputReleased`), `needs_review` after; a failed group cleanup keeps the handle and stays `busy`.
136
143
  - The child's tools-mode server (`AGENTHUB_PERMISSION_TOOL=1`) lists only `IMPLEMENTER_HUB_TOOL_NAMES`. `hub_permission_request` returns the original input only for the person's allow-once. Automatic Bash grants require the #845 host wrapper, a current owned public task/root/branch, existing read-only or closed task-command proof, and wrapper protocol 1 on request and reply; never return an automatic allow for the original native command. Consume the expiring single-use ticket before rechecking and executing with the fixed host environment, absolute executable and proven cwd; changed proof/task/child/root/branch runs nothing. Require the local-worker mutating Seatbelt profile for check/test/build with an additive deny for all project Git metadata and the canonical hub state. Only closed host Git add/commit/push and gh stay outside it; refuse configured filter/external drivers/textconv for add/commit only (global Git LFS must not disable push/gh), retain the config-include/partial-clone refusal for privileged Git/gh, and disable signing/automatic maintenance. Pin default-branch authority from the remote, never mutable local origin/HEAD. Unknown or unavailable confinement asks. Enabled action classes and `ask` still ask; malformed requests, no hub, expiry or a changed child deny. The original arguments stay in the child's request; the person sees only `permissionPayload` (`src/hub/permission-payload.ts`): the whole value withheld on any screen match, cut with `[cut, N chars]` inside 600 characters. Daemon admission of that child: `daemon.md`.
@@ -32,4 +32,4 @@ Scope: quota and native context readings, checkpoints, pause, handoff and resume
32
32
 
33
33
  - Usage roll-up (#683 U2): `src/hub/usage-rollup.ts` is the only reader of `events.jsonl` for `ahub usage`, the console Usage panel and the dashboard Usage view (rules: `daemon.md`). A pass reads from the stored offset, keeps whole lines only and commits its rows with the new offset in one transaction; its 20 ms slice (`poll(maxMs)`, #719) stops only between whole records and commits the offset of the last one folded; a line longer than the cap is read whole and one past `MAX_LINE_BYTES` is skipped, so the fold always advances. Never store a title, reason or summary there; `limit_events` drops `reason`. issue/pr/release are joined from the board at query time through `TaskLinks`, never stored. A counter with no record behind it is `unknown`, not 0. Claude's total is derived as the sum of its four counters (`claudeReportedTokens`); a source whose input contains the cached part gets none. Every `usage` reply, errors included, answers the rid, and the op is for the console and a configured planner only, never during that planner's private turn. A rebuild from byte 0 must equal the incremental result (`test/usage-rollup.test.ts`). Never present unknown as 0 in a sum: an overall figure with an unknown peer is `partial` and names the peers (`total().unknownPeers`). Never drop rows silently: `limits()` reports `truncated`, `omitted` and the bound. An event-open pause the hub no longer holds is `endedUnknown` (`ahub reset` keeps the log), so `limits(peer, { live })` needs the daemon's held pauses. A poll's fold transaction is IMMEDIATE and rechecks the stored offset, so two roll-ups on one `hub.db` never fold a range twice.
34
34
  - Daily usage (#683 U4): `UsageRollup.daily(days, now)` returns the last `days` UTC calendar days (at most 366) ending today, clipped to the first day with a record. A day inside the window with no record is a row with `empty: true`, never zeros. Per peer and day, take the native total when reported, else the counted tokens (`count`), else `unknown`; a day's total is `partial` when some peers are unknown and `unknown` when all are, never a sum that treats them as 0.
35
- - Kimi's consumption (#285 phase 2): `src/adapters/kimi-wire-usage.ts` is the only reader of Kimi's wire log and `src/hub/kimi-usage.ts` the only owner of the Kimi count; `daemon.ts` supplies ports (events, budget, clock, session id) and binds the session at a turn start (no read) and calls `collectKimiUsage` at a turn end, a `usage_update` and an offline transition. Rows of an earlier read pass are recorded before a later pass can fail; restart seeding counts only rows recorded after the last `budget_resume` of a soft-token peer (`kimiSeedRows`). Tests never reach the person's `~/.kimi-code`: `test/hub-home.ts` sets `KIMI_CODE_HOME` to a temp dir. Never feed `budget.report(kimi, tokens)` from an ACP total or an estimate, and never change `kimiCountedTokens` without the AC5 test: cache reads are recorded, not counted. An unreadable log, an unknown row shape or an untested `protocol_version` is unknown (reading dropped via `Budget.forget(peer, "tokens", "count")`, so only the count's own reading goes; one notice), never a partial count. A usage row's text never leaves the reader: four integers, a model label and the row time. A resume clears the window (`kimiUsage.reset()`).
35
+ - Kimi's consumption (#285 phase 2, delayed drain #1281, sliced drain #1283): `src/adapters/kimi-wire-usage.ts` is the only reader of Kimi's wire log and `src/hub/kimi-usage.ts` the only owner of the Kimi count; `daemon.ts` supplies ports (events, budget, clock, session id, unreferenced scheduler) and binds the session at a turn start (no read), calls `collectKimiUsage` at a turn end, a `usage_update` and an offline transition, and schedules at most three coalesced follow-ups (250 ms, 1,000 ms, 2,000 ms). With a scheduler, one invocation reads and commits one slice, then yields with a 0 ms continuation while the same cue's backlog remains (at most 16 slices per burst). Discovery is fresh on every slice; do not cache the agent set. Without a scheduler, the original synchronous 16-pass behavior remains for compatibility. Stop, offline and session replacement cancel delayed work; offline preserves the final synchronous `collect -> drop`, with rows durable only later as the documented ceiling. A native row time selects a unique interval among the most recent 32 captured turns; no unique match gives `unattributed`. Late rows never rewrite an earlier `turn_end` or increment a later turn. A successful reader slice commits offsets only after its rows are recorded; restart seeding counts only rows recorded after the last `budget_resume` of a soft-token peer (`kimiSeedRows`). Tests never reach the person's `~/.kimi-code`: `test/hub-home.ts` sets `KIMI_CODE_HOME` to a temp dir. Never feed `budget.report(kimi, tokens)` from an ACP total or an estimate, and never change `kimiCountedTokens` without the AC5 test: cache reads are recorded, not counted. An unreadable log, an unknown row shape or an untested `protocol_version` is unknown (reading dropped via `Budget.forget(peer, "tokens", "count")`, so only the count's own reading goes; one notice), never a partial count. A usage row's text never leaves the reader: four integers, a model label and the row time. A resume clears the window (`kimiUsage.reset()`).
@@ -12,7 +12,7 @@ Scope: delivery, digests and condensation, reply addressing, priority and limits
12
12
  - `replyParent()` decides what a reply answers (highest hop, never the `hub` preface). Use it for deliveries and steers alike, or the hop cap can be reset.
13
13
  - Report a send's outcome from `Bus.publishResult`, never from `publish()`'s bare target list: a hop-capped send answers `ok: true, dropped: "hop"` with the hop-cap notice, and the channel tool and `ahub say` print that notice, never "no peers attached" (#546). A native peer's `onMessage` returns that `PublishResult` on a hop drop, its send tool (Pi, the local worker) reports it as not delivered, and no off-roster retention note follows a hop drop (#550).
14
14
  - What a peer is handed (`out`) and what it stands for (`originals`) differ once a delivery is condensed: the bus keeps both, registers `out` so `reply_to` resolves, puts the originals back on a `failed_safe` receipt and holds any other failure (a thrown `deliver`, a later `onFailed`, a `needs_review` receipt) as `needs_review` with its originals, for `ahub queue resolve`, and counts no attempt when the peer merely got busy while the delivery was prepared. A delivery with an `important` envelope, an invocation kind or a remote sender is never condensed; a remote recipient (`remoteId`, rooms #941) gets one envelope per delivery with its queue deadline, never a preface, batching delay, condensation or steer.
15
- - Invocations (#445 C2, #986): an `invocation` or `invocation_result` (`isInvocationKind`) goes alone in `take` and `takeBudget`, is never condensed, and is never steered into: both steer sites and `steerQueued` ask `invocationTurnOpen` first. In `onMessage`, a peer's answer goes to `onAnswer` before `parseMarker` and before any publish, when it names the request (`inReplyTo` in the pushed `lastDelivery` or the pulled `lastPulled`) or names nothing while the invocation turn is open. A pull is kept in `lastPulled`, never in `lastDelivery`, so it cannot replace a pushed invocation's answer parent (#1192). A taken answer, or a throwing hook, publishes, stores and emits nothing.
15
+ - Invocations (#445 C2, #986): an `invocation` or `invocation_result` (`isInvocationKind`) goes alone in `take` and `takeBudget`, is never condensed, and is never steered into: both steer sites and `steerQueued` ask `invocationTurnOpen` first. In `onMessage`, a peer's answer goes to `onAnswer` with its marker still unparsed (a final answer has only its `amem:` Record lines stripped, #1320) and before any publish, when it names the request (`inReplyTo` in the pushed `lastDelivery` or the pulled `lastPulled`) or names nothing while the invocation turn is open. A pull is kept in `lastPulled`, never in `lastDelivery`, so it cannot replace a pushed invocation's answer parent (#1192). A taken answer, or a throwing hook, publishes, stores and emits nothing.
16
16
  - An invocation is never replayed through ordinary retry (#991). `retryDelivery` refuses a row that holds one. An uncertain or thrown delivery holds the peer (`recoveryHeldPeers`) and calls `onInvocationUncertain` instead of `failed()`. `failed()` allows at most one automatic retry, and only when `canRetryInvocation` returns true; unknown or a throw refuses.
17
17
  - Add an envelope kind only to `KINDS` (`envelope.ts`); the journal, restart reader, deferred-hub check and held hints read that one list. Test room provenance with `remoteEnvelope(env)`, never `from.includes("@")`: a relayed room invocation arrives `from: hub` with `refs.invocationRemote` (#992).
18
18
  - `Envelope.session` (agent-hub#1036) marks a sender that is a distinct session, `from` being its minted `<peer>~<origin>` id (rules: `daemon.md`). It grants nothing; keep it on queued and journaled originals, because the `session_identity` recovery guard reads it from unsettled deliveries.
@@ -21,6 +21,7 @@ Scope: delivery, digests and condensation, reply addressing, priority and limits
21
21
  - A reply is addressed, never broadcast. An adapter that answers a delivery passes `to: replyAudience(envs)`; anything else with an `inReplyTo` inherits that envelope's sender. Leaving `to` out or empty fans the message out to every peer. The control `send` takes a nonempty string `to` as that one peer and refuses any other non-array shape or bad item before publishing (#963); never turn a malformed `to` into a broadcast.
22
22
  - `digest` is not a peer: addressing a reply at the envelopes the peer was handed sends it nowhere once a delivery was condensed. The bus resolves `digest` back through `lastDelivery.originals`; anything else that reads a reply's `to` has to do the same.
23
23
  - A pull-only peer (a Claude session without channel pushes, Kimi in its own TUI, or agy) is never drained by a push; `Bus.pull` hands it its queue oldest first up to `bus.pull_budget_bytes` (#489 H3; unset is `PULL_BUDGET_BYTES`, 64 KiB of `frame` text, #713; `takeBudget`), the first item always going so one huge envelope cannot stall it, and a poison one still alone. A push peer, and an attached channel session that is not pull-only, keep `take`'s `bus.digest_max` (at most `DIGEST_MAX`): never raise that for a pull. The daemon's `inbox` reply carries `waiting` and the plugin says `N more waiting: call hub_inbox again before you start work`. An attached channel session may also pull its own queue through `hub_inbox` while busy (#493); journal completion rules still apply. Drain and pull retain recovery, pause and lifecycle `deliveryHeld` fences; an explicit `hub_inbox` pull may pass only a `needs_review` uncertainty hold (#1079), returning newly queued work and bounded held-row metadata while leaving held originals and automatic delivery held. Orphaned dispatching/accepted deliveries, storage failure and unknown hold evidence still refuse. Both paths use `remember()` (so `reply_to` resolves), and a drain rechecks `deliverable()` after condensing because such a session can take the peer meanwhile. A pull is journaled `completed` in the same transaction as the bus snapshot, never `accepted`; a failed one puts back only that peer's queue and preface and never reloads the snapshot.
24
+ - The held-body view in `hub_inbox` (`Bus.heldInbox`, `inboxHeldRead` in `daemon.ts`, #1359) is inspection only: it never settles, retries, resolves, changes an attempt or records a task-offer read, and it reads only the authenticated caller's own `needs_review` rows (plus `accepted` for an explicit-settlement channel). Bound rows (`HELD_DELIVERY_PAGE`) and raw bytes (`bus.pull_budget_bytes`) in SQL before hydrating originals, render bodies only through `publicDeliveryBodies` (`src/hub/delivery-public.ts`), and treat an overflowing, unreadable or unknown window as observer-excluded (`hasHeldReviewScope`). A failure in it never discards the committed normal pull. Read `docs/design/bus.md` before changing it.
24
25
  - Record exact task-offer reads only through `DeliveryJournal.completeDelivered` on an active-fenced adapter completion, correlated reply or actual pull, atomically with completion. Capture original offers before terminal pruning and record their ids, never condensed ids; accepted receipts, generic transitions, operator/hub dispositions and restored completed rows are not read evidence.
25
26
  - The `onImportantQueued` nudge for a pull-only peer (#398) is advisory: it never dequeues, steers, journals or settles, and a throw from it never stops an enqueue.
26
27
  - Merge recall and restored prefaces through `mergePrefaces`/`uniqueMemoryLines`; preserve distinct context and new notes, deduplicate memory identities, and keep colliding short prefixes distinct. Use `recallDisplayText`/`recallMemoryLines` before display caps: suppress only matching automatic approval outcomes, retain nonempty rejection details, preserve id headers and complete-word excerpts, and keep token trimming at line boundaries. Keep these changes display-only.