@staix/agent-hub 0.50.0 → 0.52.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 (350) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +1 -1
  3. package/docs/adding-an-ai-tool.md +26 -4
  4. package/docs/agent-notes/README.md +1 -0
  5. package/docs/agent-notes/adapters.md +4 -3
  6. package/docs/agent-notes/budget.md +8 -2
  7. package/docs/agent-notes/daemon.md +13 -8
  8. package/docs/agent-notes/local-worker.md +3 -3
  9. package/docs/agent-notes/security-review.md +6 -5
  10. package/docs/agent-notes/tasks.md +10 -3
  11. package/docs/agent-notes/tests.md +4 -3
  12. package/docs/cooperbench.md +1 -1
  13. package/docs/design/adapters.md +21 -0
  14. package/docs/design/cli-output-inventory.md +165 -150
  15. package/docs/design/cli-output.md +4 -3
  16. package/docs/design/guidance-probes.md +1 -0
  17. package/docs/design/roadmap.md +3 -1
  18. package/docs/design/task-board.md +35 -0
  19. package/docs/dogfood.md +21 -3
  20. package/docs/events.md +4 -2
  21. package/docs/memory.md +5 -3
  22. package/docs/operations.md +259 -19
  23. package/docs/quickstart.md +29 -2
  24. package/docs/roadmap.json +20 -20
  25. package/docs/roadmap.md +2 -2
  26. package/docs/roles.md +1 -1
  27. package/docs/sdlc.md +29 -5
  28. package/docs/security.md +11 -5
  29. package/docs/specs/2026-09-19-agent-hub-design.md +44 -0
  30. package/docs/specs/2026-09-19-multi-project-design.md +4 -0
  31. package/docs/specs/2026-09-20-upgrade-recovery-design.md +17 -0
  32. package/docs/specs/mcp-endpoint.md +63 -0
  33. package/docs/verification/2026-11-29-agy-1.5.20.md +33 -0
  34. package/docs/verification/2026-11-29-claude-profile-hook.md +12 -0
  35. package/docs/verification/2026-11-29-idle-daemon-footprint.md +75 -0
  36. package/docs/verification/2026-11-29-kimi-281-reviewer-compat.md +38 -0
  37. package/docs/verification/2026-11-29-kimi-tui-281.md +12 -0
  38. package/docs/verification/2026-11-30-0.51.0.md +91 -0
  39. package/docs/verification/2026-11-30-account-switch-1806.md +445 -0
  40. package/docs/verification/2026-11-30-capability-listing-shape-1808.md +45 -0
  41. package/docs/verification/2026-11-30-upgrade-keep-1807.md +174 -0
  42. package/docs/verification/2026-12-01-1811-confirmation-receipt.md +19 -0
  43. package/docs/verification/2026-12-01-1811-orca-agent-list.md +20 -0
  44. package/docs/verification/2026-12-01-1811-orca-pane-key.md +21 -0
  45. package/docs/verification/2026-12-02-1819-claude-process-after-renewal.md +54 -0
  46. package/docs/verification/2026-12-02-agy-1.5.21.md +74 -0
  47. package/docs/verification/2026-12-02-claude-implementer-2.1.334.md +44 -0
  48. package/docs/verification/2026-12-02-cli-import-graph.md +33 -0
  49. package/docs/verification/2026-12-03-0.52.0.md +150 -0
  50. package/docs/verification/2026-12-03-codex-0173-reviewer-isolation.md +53 -0
  51. package/docs/verification/2026-12-03-codex-0173-reviewer-tool-call.md +34 -0
  52. package/docs/verification/2026-12-03-jcode-1.3.0.md +25 -0
  53. package/docs/verification/agy/README.md +17 -0
  54. package/docs/verification/agy/cli-surface.ts +68 -0
  55. package/docs/verification/agy/interactive-bridge.ts +92 -0
  56. package/docs/verification/agy/interactive-session.ts +131 -0
  57. package/docs/verification/agy/launcher-nonce.ts +215 -0
  58. package/docs/verification/agy/native-hooks.ts +210 -0
  59. package/docs/verification/agy/originals/agent-hub-681/cli-surface.ts +87 -0
  60. package/docs/verification/agy/originals/agent-hub-681/native-hooks-adapted.ts +91 -0
  61. package/docs/verification/agy/originals/agent-hub-681/tui-actual.ts +200 -0
  62. package/docs/verification/agy/originals/agent-hub-684/probe.ts +107 -0
  63. package/docs/verification/agy/originals.json +25 -0
  64. package/docs/verification/agy/permission-new-functions.ts +128 -0
  65. package/docs/verification/agy/run-probe.py +108 -0
  66. package/docs/verification/agy/runtime.ts +171 -0
  67. package/docs/verification/agy/tmux-helper-control.ts +6 -0
  68. package/docs/verification/agy/tmux-session.ts +235 -0
  69. package/docs/verified.json +87 -42
  70. package/package.json +3 -3
  71. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  72. package/plugins/agent-hub/compat.json +157 -0
  73. package/plugins/agent-hub/kimi-hook.js +1416 -24985
  74. package/plugins/agent-hub/server.js +17415 -32755
  75. package/scripts/check-docs.mjs +1 -1
  76. package/src/adapters/acp.ts +13 -13
  77. package/src/adapters/agy/definition.ts +9 -26
  78. package/src/adapters/agy/entry.ts +2 -0
  79. package/src/adapters/channel-peer.ts +3 -1
  80. package/src/adapters/claude-channel-evidence.ts +7 -3
  81. package/src/adapters/claude-channel.ts +38 -257
  82. package/src/adapters/claude-implementer.ts +3 -1
  83. package/src/adapters/codex-appserver.ts +77 -15
  84. package/src/adapters/compat.ts +78 -14
  85. package/src/adapters/configured-acp.ts +23 -163
  86. package/src/adapters/configured-adapter-policy.ts +160 -0
  87. package/src/adapters/configured-pull-entry.ts +53 -0
  88. package/src/adapters/configured-pull.ts +38 -0
  89. package/src/adapters/conformance/fakes/app-server.ts +9 -2
  90. package/src/adapters/declaration-catalog.ts +25 -0
  91. package/src/adapters/declaration-data.ts +342 -0
  92. package/src/adapters/declaration-resolution.ts +53 -0
  93. package/src/adapters/definitions/builtin-metadata.ts +62 -84
  94. package/src/adapters/definitions/jcode-launch.ts +13 -0
  95. package/src/adapters/definitions/native-adapter-policy.ts +390 -0
  96. package/src/adapters/definitions/native-cli-claude-launch.ts +6 -3
  97. package/src/adapters/definitions/native-cli-codex-launch.ts +2 -1
  98. package/src/adapters/definitions/native-cli-entry-claude.ts +17 -2
  99. package/src/adapters/definitions/native-cli-entry-codex.ts +2 -0
  100. package/src/adapters/definitions/native-cli-entry-jcode.ts +6 -2
  101. package/src/adapters/definitions/native-cli-entry-kimi.ts +2 -0
  102. package/src/adapters/definitions/native-cli-entry-pi.ts +2 -0
  103. package/src/adapters/definitions/native-cli-entry-qwen.ts +2 -0
  104. package/src/adapters/definitions/native-cli-entry-types.ts +12 -3
  105. package/src/adapters/definitions/native-cli-jcode-home-init.ts +1 -1
  106. package/src/adapters/definitions/native-cli-launch-common.ts +2 -2
  107. package/src/adapters/definitions/native-cli-preview-common.ts +1 -1
  108. package/src/adapters/definitions/native-cli-retained.ts +1 -1
  109. package/src/adapters/definitions/native-config-defaults.ts +1 -1
  110. package/src/adapters/definitions/native-configuration.ts +18 -0
  111. package/src/adapters/definitions/native-help.ts +24 -0
  112. package/src/adapters/definitions/native-launch-declarations.ts +34 -0
  113. package/src/adapters/definitions/native-launch-policy.ts +4 -0
  114. package/src/adapters/definitions/native-launch-settings.ts +72 -0
  115. package/src/adapters/definitions/native-light-cli.ts +18 -0
  116. package/src/adapters/definitions/native-light-preview.ts +10 -0
  117. package/src/adapters/definitions/native-wrapper-launch.ts +10 -0
  118. package/src/adapters/definitions/qwen.ts +6 -29
  119. package/src/adapters/definitions/reviewer-variants.ts +7 -8
  120. package/src/adapters/external-declarations.ts +31 -0
  121. package/src/adapters/external-modules.ts +4 -29
  122. package/src/adapters/jcode.ts +19 -12
  123. package/src/adapters/native-capabilities.ts +18 -8
  124. package/src/adapters/native-facts-hooks.ts +12 -0
  125. package/src/adapters/native-proof-ports.ts +1 -1
  126. package/src/adapters/presets.ts +136 -0
  127. package/src/adapters/qwen-dual.ts +2 -2
  128. package/src/adapters/registry-types.ts +3 -0
  129. package/src/adapters/registry.ts +20 -81
  130. package/src/adapters/reviewer-print.ts +26 -9
  131. package/src/adapters/role-eligibility.ts +2 -1
  132. package/src/cli/accounts-import.ts +72 -0
  133. package/src/cli/agents-latest-table.ts +88 -0
  134. package/src/cli/agents-latest.ts +22 -0
  135. package/src/cli/agents-output.ts +10 -0
  136. package/src/cli/agents-presets.ts +100 -0
  137. package/src/cli/agents.ts +1 -1
  138. package/src/cli/attention.ts +3 -2
  139. package/src/cli/autonomy-homes.ts +7 -2
  140. package/src/cli/autonomy-offline.ts +1 -1
  141. package/src/cli/bench.ts +1 -1
  142. package/src/cli/budget-renew-guidance.ts +129 -0
  143. package/src/cli/claude-homes.ts +9 -5
  144. package/src/cli/claude-profile-hook.ts +31 -11
  145. package/src/cli/command-context.ts +3 -0
  146. package/src/cli/command-table.ts +123 -0
  147. package/src/cli/commands/accounts.ts +8 -0
  148. package/src/cli/commands/agents.ts +18 -0
  149. package/src/cli/commands/answer.ts +28 -0
  150. package/src/cli/commands/ask.ts +17 -0
  151. package/src/cli/commands/autonomy.ts +83 -0
  152. package/src/cli/commands/backlog.ts +46 -0
  153. package/src/cli/commands/bench.ts +60 -0
  154. package/src/cli/commands/board.ts +48 -0
  155. package/src/cli/commands/broker.ts +9 -0
  156. package/src/cli/commands/budget.ts +96 -0
  157. package/src/cli/commands/capabilities.ts +12 -0
  158. package/src/cli/commands/check-path.ts +55 -0
  159. package/src/cli/commands/completion.ts +8 -0
  160. package/src/cli/commands/console.ts +12 -0
  161. package/src/cli/commands/daemon.ts +8 -0
  162. package/src/cli/commands/deliverables.ts +25 -0
  163. package/src/cli/commands/doctor.ts +249 -0
  164. package/src/cli/commands/down.ts +3 -0
  165. package/src/cli/commands/export.ts +15 -0
  166. package/src/cli/commands/facts.ts +15 -0
  167. package/src/cli/commands/goal.ts +22 -0
  168. package/src/cli/commands/guidance.ts +102 -0
  169. package/src/cli/commands/help.ts +17 -0
  170. package/src/cli/commands/host.ts +45 -0
  171. package/src/cli/commands/init.ts +121 -0
  172. package/src/cli/commands/instructed.ts +19 -0
  173. package/src/cli/commands/instruction-hook.ts +15 -0
  174. package/src/cli/commands/intake.ts +24 -0
  175. package/src/cli/commands/kill.ts +15 -0
  176. package/src/cli/commands/learn.ts +23 -0
  177. package/src/cli/commands/lineage.ts +30 -0
  178. package/src/cli/commands/logs.ts +21 -0
  179. package/src/cli/commands/manager.ts +15 -0
  180. package/src/cli/commands/memory.ts +21 -0
  181. package/src/cli/commands/model.ts +25 -0
  182. package/src/cli/commands/models.ts +40 -0
  183. package/src/cli/commands/native.ts +39 -0
  184. package/src/cli/commands/pause.ts +5 -0
  185. package/src/cli/commands/peer.ts +32 -0
  186. package/src/cli/commands/permission.ts +26 -0
  187. package/src/cli/commands/permit.ts +12 -0
  188. package/src/cli/commands/pet.ts +24 -0
  189. package/src/cli/commands/projects.ts +49 -0
  190. package/src/cli/commands/queue.ts +70 -0
  191. package/src/cli/commands/recovery-run.ts +13 -0
  192. package/src/cli/commands/recovery.ts +130 -0
  193. package/src/cli/commands/release.ts +23 -0
  194. package/src/cli/commands/releases.ts +91 -0
  195. package/src/cli/commands/remember.ts +6 -0
  196. package/src/cli/commands/report.ts +27 -0
  197. package/src/cli/commands/research.ts +53 -0
  198. package/src/cli/commands/reset.ts +89 -0
  199. package/src/cli/commands/restart.ts +5 -0
  200. package/src/cli/commands/results.ts +31 -0
  201. package/src/cli/commands/resume.ts +5 -0
  202. package/src/cli/commands/review.ts +24 -0
  203. package/src/cli/commands/roadmap.ts +21 -0
  204. package/src/cli/commands/role.ts +34 -0
  205. package/src/cli/commands/roles.ts +30 -0
  206. package/src/cli/commands/room.ts +14 -0
  207. package/src/cli/commands/roster.ts +48 -0
  208. package/src/cli/commands/route.ts +9 -0
  209. package/src/cli/commands/say.ts +21 -0
  210. package/src/cli/commands/schedule.ts +17 -0
  211. package/src/cli/commands/sdlc.ts +321 -0
  212. package/src/cli/commands/settings.ts +148 -0
  213. package/src/cli/commands/setup.ts +89 -0
  214. package/src/cli/commands/shared-refusals.ts +25 -0
  215. package/src/cli/commands/smoke.ts +44 -0
  216. package/src/cli/commands/source.ts +64 -0
  217. package/src/cli/commands/specs.ts +13 -0
  218. package/src/cli/commands/status.ts +28 -0
  219. package/src/cli/commands/stop.ts +17 -0
  220. package/src/cli/commands/structure.ts +60 -0
  221. package/src/cli/commands/study.ts +39 -0
  222. package/src/cli/commands/tail.ts +19 -0
  223. package/src/cli/commands/task.ts +114 -0
  224. package/src/cli/commands/title.ts +17 -0
  225. package/src/cli/commands/turns.ts +10 -0
  226. package/src/cli/commands/ui.ts +47 -0
  227. package/src/cli/commands/undo.ts +77 -0
  228. package/src/cli/commands/up.ts +39 -0
  229. package/src/cli/commands/upgrade.ts +5 -0
  230. package/src/cli/commands/usage.ts +33 -0
  231. package/src/cli/commands/version.ts +5 -0
  232. package/src/cli/commands/watch.ts +30 -0
  233. package/src/cli/commands/worktrees.ts +31 -0
  234. package/src/cli/conductor-recovery.ts +1 -1
  235. package/src/cli/console-state.ts +5 -138
  236. package/src/cli/console-versions.ts +1 -1
  237. package/src/cli/facts-hook.ts +11 -4
  238. package/src/cli/help.ts +44 -20
  239. package/src/cli/identity.ts +27 -4
  240. package/src/cli/init-prompt.ts +1 -1
  241. package/src/cli/init-settings.ts +4 -35
  242. package/src/cli/init.ts +1 -1
  243. package/src/cli/json-text-spans.ts +57 -0
  244. package/src/cli/launch-check.ts +156 -0
  245. package/src/cli/launch.ts +19 -70
  246. package/src/cli/light-dispatch.ts +29 -0
  247. package/src/cli/main.js +8 -1
  248. package/src/cli/main.ts +257 -2799
  249. package/src/cli/memory.ts +1 -1
  250. package/src/cli/orca-probe.ts +119 -0
  251. package/src/cli/output.ts +45 -3
  252. package/src/cli/preview.ts +11 -6
  253. package/src/cli/recovery-launch.ts +1 -1
  254. package/src/cli/recovery-version-preflight.ts +28 -9
  255. package/src/cli/replace-process.ts +22 -0
  256. package/src/cli/report-layout.ts +142 -0
  257. package/src/cli/roadmap-usage.ts +16 -0
  258. package/src/cli/roadmap.ts +3 -16
  259. package/src/cli/sdlc-doctor.ts +27 -0
  260. package/src/cli/sdlc-output.ts +55 -1
  261. package/src/cli/setup-homes.ts +2 -2
  262. package/src/cli/start-agents-run.ts +85 -7
  263. package/src/cli/start-check.ts +28 -0
  264. package/src/cli/statusline-tee.ts +25 -4
  265. package/src/cli/terminal-recovery.ts +53 -10
  266. package/src/cli/upgrade-interactive.ts +1 -0
  267. package/src/cli/upgrade-runtime.ts +12 -1
  268. package/src/cli/upgrade.ts +4 -15
  269. package/src/cli/warn-line.ts +1 -1
  270. package/src/hub/accounts.ts +148 -0
  271. package/src/hub/addons.ts +20 -0
  272. package/src/hub/agent-drift.ts +2 -1
  273. package/src/hub/budget-projection.ts +39 -7
  274. package/src/hub/budget.ts +231 -16
  275. package/src/hub/channel-project.ts +3 -3
  276. package/src/hub/ci-watch.ts +311 -79
  277. package/src/hub/conductor-peer.ts +24 -0
  278. package/src/hub/conductor.ts +2 -21
  279. package/src/hub/config-apply.ts +25 -14
  280. package/src/hub/config-edit.ts +1 -1
  281. package/src/hub/config-tier.ts +2 -0
  282. package/src/hub/config.ts +535 -0
  283. package/src/hub/control-client.ts +49 -1
  284. package/src/hub/daemon.ts +492 -569
  285. package/src/hub/delivery-public.ts +11 -0
  286. package/src/hub/events.ts +3 -0
  287. package/src/hub/home-tag.ts +12 -0
  288. package/src/hub/host.ts +217 -0
  289. package/src/hub/hub-check.ts +125 -0
  290. package/src/hub/hub-tools.ts +2 -1
  291. package/src/hub/instance-budget.ts +2 -2
  292. package/src/hub/instance-config.ts +15 -126
  293. package/src/hub/instances.ts +22 -6
  294. package/src/hub/instruction-receipt.ts +2 -2
  295. package/src/hub/kimi-usage.ts +38 -11
  296. package/src/hub/lifecycle.ts +86 -4
  297. package/src/hub/mcp-bridge-core.ts +98 -0
  298. package/src/hub/mcp-channel-push.ts +20 -0
  299. package/src/hub/mcp-endpoint-serve.ts +178 -0
  300. package/src/hub/mcp-endpoint.ts +226 -0
  301. package/src/hub/mcp-tool-call.ts +181 -0
  302. package/src/hub/operational-settings.ts +2 -0
  303. package/src/hub/orca-env.ts +6 -0
  304. package/src/hub/orca-state.ts +84 -0
  305. package/src/hub/path-policy.ts +1 -1
  306. package/src/hub/peers.ts +5 -1
  307. package/src/hub/permission-mode.ts +5 -41
  308. package/src/hub/permission-paths.ts +41 -0
  309. package/src/hub/project.ts +20 -0
  310. package/src/hub/protocol-window.ts +58 -0
  311. package/src/hub/quota-origin.ts +20 -0
  312. package/src/hub/recovery-policy.ts +1 -1
  313. package/src/hub/registry.ts +36 -2
  314. package/src/hub/releases-inventory.ts +198 -0
  315. package/src/hub/report.ts +1 -1
  316. package/src/hub/research.ts +1 -1
  317. package/src/hub/review-brief.ts +47 -2
  318. package/src/hub/roster.ts +6 -3
  319. package/src/hub/routing.ts +9 -2
  320. package/src/hub/runtime-capture-prune.ts +25 -3
  321. package/src/hub/runtime-prune-health.ts +8 -1
  322. package/src/hub/sdlc-check.ts +205 -0
  323. package/src/hub/sdlc-release-authorization.ts +42 -21
  324. package/src/hub/sdlc-release-diagnostics.ts +5 -0
  325. package/src/hub/sdlc-release-policy.ts +21 -7
  326. package/src/hub/sdlc-release.ts +80 -20
  327. package/src/hub/sdlc-sync.ts +146 -0
  328. package/src/hub/sdlc.ts +38 -5
  329. package/src/hub/settings.ts +7 -4
  330. package/src/hub/start-agents.ts +1 -1
  331. package/src/hub/start-mode.ts +11 -4
  332. package/src/hub/structure-budget.ts +131 -0
  333. package/src/hub/structure-scan.ts +149 -0
  334. package/src/hub/tasks-experiment.ts +455 -0
  335. package/src/hub/tasks-guidance.ts +606 -0
  336. package/src/hub/tasks-roadmap-plan.ts +419 -0
  337. package/src/hub/tasks-roadmap.ts +491 -0
  338. package/src/hub/tasks-study.ts +661 -0
  339. package/src/hub/tasks-survey.ts +192 -0
  340. package/src/hub/tasks.ts +457 -2584
  341. package/src/hub/terminal-open.ts +5 -3
  342. package/src/hub/tooling.ts +3 -19
  343. package/src/hub/usage-rollup.ts +9 -3
  344. package/src/local/tools.ts +5 -0
  345. package/src/ui/index.html +1 -1
  346. package/src/ui/needs.ts +17 -5
  347. package/src/ui/peer-palette.ts +2 -4
  348. package/src/ui/plugin.ts +1 -1
  349. package/templates/presets/agents.json +60 -0
  350. package/templates/presets/confirmation-matrix.json +8 -8
package/CHANGELOG.md CHANGED
@@ -4,6 +4,57 @@ 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.52.0
8
+
9
+ - Release N-1 for 0.52.x is published 0.51.0, which declares agent-mem `>=0.42.0 <1.0.0`; its fixture lock pins the 0.43.0 that the 0.51.0 release resolved (with cli-output 0.1.4 and mcp-stdio 0.5.0), with control protocol 17 (descriptor floor 16). Wire and protocol, daemon features, `hub.db` format and MCP tools are unchanged and compatible both ways. Exceptions: a 0.51.0 hub refuses at startup the settings this release adds (`[structure]` in `.agenthub/sdlc.toml`, `accounts` and `instances.<id>.account`, `host.shared`, `upgrade.bridge_window_days` and `bridge_window_min`, and a configured kind with `transport: "pull"` in `.agenthub/config.local.json`), so leave them unset until every hub that reads the file runs 0.52.0; the new commands (`ahub host`, `ahub accounts import`, `ahub agents presets` and `add`, `ahub structure`, `ahub sdlc check` and `sync`) are not in the 0.51.0 CLI. The declared agent-mem range rises (to 0.47.0 or later): hub notes may carry a writer `session` key, which a 0.51.0 hub on agent-mem 0.43.0 still reads from the same home, though an older strict `amem project import` skips JSONL notes that carry it. No capability or format ceiling is raised. The N-1 fixture and matrix pin that package; the separate protocol-16 fixture stays at 0.25.0.
10
+ - Probe mode refuses a hardlinked file as `hardlinked_target` on every run; on APFS, realpath could name another link of the same inode and report it as `outside_workspace` instead (Refs #541).
11
+ - Raise the agent-mem floor to 0.47.0 for capture-only MCP startup outside the placement inventory and placement diagnostics fixes (agent-mem#734, #731, #732).
12
+ - Hub-saved notes carry a pseudonymous writer session key when the daemon knows the session (#1879). The bundled agent-mem dependency now requires 0.46.0 or later in the current major-compatible range.
13
+ - Show the safe cause class when CI admission cannot verify full-gate evidence (Refs #548).
14
+ - A stale MCP endpoint socket is replaced automatically by a daemon that holds its project's fixed control port; a live socket or a daemon on another port keeps the refusal (Refs #1780).
15
+ - `ahub jcode` replaces its wrapper process with the Jcode TUI through `process.execve`, so no ahub process stays resident and the agent's exit status or signal reaches the caller directly (Refs #1778, T6a). A runtime without `execve`, or a program that cannot be found or run, keeps the spawn path; Codex, Claude, Kimi, Pi and Qwen are unchanged.
16
+ - `ahub version` and `ahub instruction-hook` run from the person's own shell without loading `src/cli/main.ts`: measured on an installed scratch tarball, each takes 10 ms and under 23 MB peak RSS (was 80 ms and 63 MB), inside the 40 ms and 40 MB budget; any flagged call or agent-marked caller still takes the shared path, and the import-graph check now guards the light path (#1778 T7).
17
+ - Reduce CLI startup cost and plugin bundle size (Refs #1778). On the measured Mac, `ahub version` went from 150 to 80 ms and the per-event instruction hook from 160 to 80 ms. Both still exceed the 40 ms and 40 MB targets. The Claude plugin bundle fell from 1,849,835 to 954,919 bytes; agent-mem 0.47.0 brings the released bundle back to 1,130,786 bytes.
18
+ - Qualify Antigravity CLI 1.5.21 for the agy peer (Refs #843): all five account-free legs passed, the exact provider declaration list is now 18 (run_workflow, swarm and update_steps added) and each new function reached the PreToolUse hook and was refused with no effect. The agy producers moved into `docs/verification/agy/` with a version parameter; receipt `docs/verification/2026-12-02-agy-1.5.21.md`.
19
+ - `ahub sdlc sync --write-roadmap` refreshes the tracked `docs/roadmap.json` and `docs/roadmap.md` in your worktree, and `--close-settled-issues` previews `gh issue close` for issues whose linked tasks are all settled with a merged PR and whose live body has no unchecked item; closing needs the person or the unique conductor with `roadmap.github_write` and is refused otherwise, naming the person's command. Both ride the same fingerprint and `--apply --confirm` revalidation, and no milestone is ever marked done or dropped (#1856).
20
+ - `ahub sdlc sync` previews board receipt repairs (an issue link from a single `#N` in the title, an open PR and its newer head, merged-PR adoption) as a deterministic plan with a SHA-256 fingerprint and writes nothing; `--apply --confirm <fingerprint>` re-plans, refuses on any board, origin or authority drift, and writes only through `recordSdlc` and `adoptMerge`. Ambiguous matches are reported, an `in_review` task never loses its reviewed head, and private tasks are only counted (#1856).
21
+ - `ahub sdlc check [--json]` audits the lifecycle setup in one read-only pass (config and roles, repository and required checks, active task bindings, roadmap hygiene), shares one 20 s GitHub deadline and counts private tasks without describing them; `ahub doctor` gains an offline `sdlc` row. The `draft_deferred_checks` sub-check is omitted until that setting exists (#1856).
22
+ - Add `ahub host --runtime <root>` and the `host.shared` setting (#1779 T3a): a project that sets `host.shared: true` runs inside one host process shared by the projects of its runtime, each keeping its own control port, token and state directory, with errors and `project stop` isolated per project. Off by default; the one-process-per-project path is unchanged.
23
+ - `ahub sdlc status` with no task now lists the unsettled tasks (and those of a release train that has not shipped), at most 100, and names the hidden settled count; `--all` keeps the earlier first-100 view and `status <task>` is unchanged (Refs #1856).
24
+ - Qualify Claude Code 2.1.334 for the headless implementer (Refs #888): the 2.1.332 procedure passed 22 of 22 cases on each binary with identical results; receipt `docs/verification/2026-12-02-claude-implementer-2.1.334.md`.
25
+ - Dependencies: @staix/cli-output 0.1.5 and @staix/agent-mem 0.45.0 or later (brings @staix/mcp-stdio 1.1.0). A fresh install no longer resolves an agent-mem whose cli-output pin differs from the hub's, which made 0.51.0's upgrade, restart and recovery checks refuse. Refs STAIxBWLB/cli-output#5.
26
+ - Projects with structure budgets get plan notices for over-budget baseline files and review briefs that show new structure findings (Refs #1829).
27
+ - Add `ahub accounts import --from orca` (#1811): a person-only command that reads `orca account list --json` once and prints an `accounts` block for `config.local.json`, with `<kind>-<n>` labels only (no email, id, organization or workspace name), a home placeholder where Orca gives none, and nothing written. The confirmation matrix now records the plugin-in-Orca-profile question as unverified, from a dated receipt.
28
+ - Finish the declared-accounts spec (#1810 T4 to T6): `instances.<id>.account` names a declared account of the instance's own kind (refused at config load when undeclared or of another kind) and a headless Codex or Claude instance starts with that account's home; `ahub setup` adds the declared Claude homes to the homes it discovers and lists each with its label; and a paused account's work can go to a peer of the same kind on another declared account, with a `budget_handoff` event naming both labels. `budget.cross_account_handoff: false` turns that off.
29
+ - Add the configured pull kind (#1809): a `transport: "pull"` declaration is a person-run TUI that reads its inbox through the hub bridge and is never pushed to; `ahub <kind>` starts it with its peer identity, `tasks` accepts only `false` so routing refuses it as an owner of any task, a `reviewer` role is refused at configuration load, `ahub agents add <preset> --pull` writes the declaration and prints the bridge registration command for that CLI, and `ahub doctor` reports a missing registration.
30
+ - Add declared accounts (#1810): `accounts` in untracked `.agenthub/config.local.json` names up to eight Claude or Codex homes by label. A Claude session reports its home at hello, the hub maps it to a label (never storing or showing the path), and the quota budget is keyed `claude:<label>` from one statusline reading per home. A project without `accounts` keeps today's keys. `instances.<id>.account` is not part of this change.
31
+ - Add agent presets (#1809): `ahub agents presets` lists gemini, opencode, kiro and copilot with their recorded CLI version and a `verified` or `untested` status (verified only when a receipt file exists), `ahub agents add <preset> [--as <kind>]` writes the launch line as a configured kind into the untracked `.agenthub/config.local.json`, and `ahub status` shows the preset and its status beside the kind.
32
+ - A corrupt stored budget renewal marker still stops the hub, and its error now names the recovery step (stop the hub and restore a trusted `hub.db` backup before retrying) without printing the row (Refs #1806).
33
+ - A peer whose delivery stays unaccepted for two minutes in a recorded Orca pane that Orca reports as blocked or waiting now raises one Attention item with the `orca terminal switch` command. The hub reads `orca agent list --json` once a minute per peer at most, bounded at five seconds, never for a peer without a recorded pane, and never answers the prompt (Refs #1811).
34
+ - Watch the Orca CLI the upgrade recovery depends on: `ahub doctor` and the plan of `ahub restart` and `ahub upgrade` check that `orca terminal list --json` and `orca worktree list --json` still carry the fields the recovery reads. A missing field fails the doctor row and blocks that project's Orca rows before anything is closed, and an Orca newer than 1.4.250 is only a note (Refs #1808).
35
+ - Each release now publishes its compatibility table as `plugins/agent-hub/compat.json`, and `ahub agents --latest` (person only, reads the network) says which release verifies each refused or trusted agent CLI version. It writes nothing and the hub makes no request for it (Refs #1808).
36
+ - A launch from an Orca pane also records the pane key, tab id and workspace id, so recovery finds the pane by its key (`tabId:leafId` of the listed row) when Orca has reassigned the handle and still names the peer as the agent in it, and a terminal opened for an extra implementer lands in the Orca workspace of its own worktree (the base peer and any unmatched root keep the project root's). Nothing is read from Orca outside an Orca pane or without `orca` on the path (Refs #1811).
37
+ - Quota renewal clears stale account readings and rejects repeated provider readings within reset-time jitter. The next budget gate still applies. Kimi counts only usage measured after renewal in its new window. Early quota warnings show reset and switch options and use a separate provider baseline for each reading source in windows open at renewal (Refs #1806).
38
+ - Watch the capability listings of Kimi, Qwen and Codex as three `COMPAT` entries without a `line`, so a newer CLI is reported, and let the person trust an exact untested version with `ahub agents trust` (the note says what trust covers). People who do not use shared capabilities see these rows in `ahub doctor` and `ahub agents` too, and only the capability listing is refused for an untrusted version, never the start of the CLI. The Kimi and Qwen listing-shape legs have a producer that was tested only with fake executables, so no real candidate has been measured, and a pass adds a drift row and never a PR or a verified version. The Codex leg has a macOS-only producer that runs the app-server under the seatbelt with a same-process network control, also tested only with fake executables. Raise the id limit of the daily watch, preparation and publish scripts from eight to sixteen. An `observe` gate entry never refuses, and a recovery preflight accepts it even when its version probe fails. Two watch-only entries, `codex-appserver` (the app-server `initialize` handshake, run under the same macOS sandbox and network control as the Codex listing leg) and `kimi-acp` (the ACP `initialize` and `session/new` handshake, on the Kimi listing producer's isolation), are tested only with fake executables, so no real candidate has been measured. The daily watch reports a leg of such an entry that failed with a proof failure or a timeout as a new `contract-drift` row in the tracking issue (read from a trusted `observe` marker in the manifest that a test pins to the version table); every other failure keeps its cause, and a version that cannot be read stays `unknown`. A third watch-only entry, `claude-channel` (its 2.1.332 is only the install reference, shown as "reference 2.1.332 (not verified)", and every version reads `observed`), has one leg that starts the installed Claude Code three times under that sandbox with random option names and checks that its parser does not name the launcher's development-channel flag as unknown (it does not prove that a live session accepts channel messages, and a real candidate may always be not-run; tested only with fake executables) (Refs #1808).
39
+ - Keep the Claude bridge session open after a wire mismatch. It reports the refusal and retries the project hub every five minutes. Configure the accepted bridge protocol window on restart and see its effective range in status (Refs #1807).
40
+ - Add `ahub structure check` for project file budgets and shared names, and `ahub structure baseline --write` to initialize or shrink the baseline (Refs #1829).
41
+
42
+ ## 0.51.0
43
+
44
+ - Release N-1 for 0.51.x is published 0.50.0, which declares agent-mem `>=0.42.0 <1.0.0`; its fixture lock pins the 0.43.0 that the 0.50.0 release resolved (with cli-output 0.1.4 and mcp-stdio 0.5.0), with control protocol 17 (descriptor floor 16). Wire and protocol, file and format floors, CLI and MCP tools stay compatible both ways, with one exception: a 0.50.0 hub refuses the new optional `ci_shard_retries` field in `.agenthub/sdlc.toml` at startup, so leave it unset until every hub that reads the file runs 0.51.0. No capability or format ceiling is raised. The N-1 fixture and matrix pin that package; the separate protocol-16 fixture stays at 0.25.0.
45
+ - Approving a dependency now tells the owner of each owned dependent with nothing left to wait for (`ready: hub task N approved; nothing left to wait for`), and the planner notice lists such tasks as `owned_ready` (Refs #1801).
46
+ - Report Claude channel argument failures before launch, with a retry command (Refs #1798).
47
+ - Restore channel push for managed Claude launches by keeping the development-channel flag ahead of the generated session ID (Refs #1794).
48
+ - Verify Kimi Code 2.8.1 for fresh reviewers on macOS arm64. Interactive TUI completion stays verified at 2.5.2 (Refs #888).
49
+ - Release authorization can use a committed project documentation checker and bind it to the candidate receipt (Refs #1775).
50
+ - Add opt-in automatic retries for one failed required CI shard on ready PRs. Retry counts are tied to the PR head and survive hub restarts (Refs #1801).
51
+ - Notify owners when draft CI finishes and tell reviewers and conductors when an approved PR is ready to merge. The same watcher reports conflicts and missing runs (Refs #1801).
52
+ - Claude profile hooks installed by `ahub setup` skip Bun outside hub sessions and refresh older hook commands in place (Refs #1783).
53
+ - Every `ahub <agent>` wrapper prints a `Hub check` before the agent starts when stderr is a terminal (nothing prints, and `ahub claude` makes no connection for it, when stderr is redirected: `ahub status` shows the same state), and Claude shows it again when the session starts, only once its own channel is verified as this session's (Refs #1798).
54
+ - `ahub status` and `--json` carry one `hubCheck` (version, control port and each peer's expected and observed link, evidence, queued count and next step), a peer whose link is weaker than expected is an Attention item, `ahub up` prints a `Hub check` block after a bounded `--wait`, and a refused jcode hello is shown only while the owned launch is live (Refs #1798).
55
+ - `ahub releases list` shows every entry under the hub home's `releases` directory with its kind, version, digest, size and what refers to it, and `ahub releases prune` previews, then with `--apply` removes, coordinator sources and registry installs that no project `runtime.json`, recovery operation or live process refers to. An unreadable reference keeps the entry, and unknown layouts and symlinks are never removed (Refs #1781).
56
+ - `ahub status` no longer reports a live owned jcode launch as detached when a tools hello is refused (it shows the refused hello), and `ahub queue show` prints the stored failure reason (the public stub for a private delivery) while ACP failure paths record a specific cause (Refs #1795).
57
+
7
58
  ## 0.50.0
8
59
 
9
60
  - Release N-1 for 0.50.x is published 0.49.1, which declares agent-mem `>=0.42.0 <1.0.0`; its fixture lock pins the 0.42.0 that the 0.49.1 release resolved (with cli-output 0.1.4 and mcp-stdio 0.4.0), with control protocol 17 (descriptor floor 16). Wire and protocol, file and format floors, CLI and MCP tools stay compatible both ways; no capability or format ceiling is raised. The N-1 fixture and matrix pin that package; the separate protocol-16 fixture stays at 0.25.0.
package/README.md CHANGED
@@ -5,7 +5,7 @@ Code, Codex, Kimi Code, Pi and a hub-owned local worker (plus Qwen Code, Jcode a
5
5
  Antigravity if you want them) share a message bus, a task board and a memory, each
6
6
  connected through its own native interface.
7
7
 
8
- Status: 0.50.0, control protocol 17 (accepts 16). Bun + TypeScript, one loopback daemon per
8
+ Status: 0.52.0, control protocol 17 (accepts 16). Bun + TypeScript, one loopback daemon per
9
9
  project. Site: [agent-hub.staix.net](https://agent-hub.staix.net).
10
10
 
11
11
  Inspect bounded task and attempt metadata with `ahub lineage show`; admit external
@@ -13,7 +13,7 @@ Under **Adapter API 1** (issue #451), every tool is integrated as an `AdapterDef
13
13
  3. **Strict Conformance**: Every builtin adapter must run the conformance test kit (`test/conformance/`). Unsupported legs must provide explicit, documented reasons rather than silent test skips. (A4 exports the same callable contracts for external package CI.)
14
14
  4. **Trust & Security Boundaries**:
15
15
  - **On-prem vs. Cloud**: `trust.onPrem` controls whether private/PII tasks may be routed to the agent. A cloud agent (`trust.onPrem: false`) never receives PII task text or memory entries.
16
- - **Path Protection**: Any workspace configuration directory owned by the agent (e.g., `.agents/`, `.codex/`) must be listed in `AGENT_CONFIG_SEGMENTS` (`src/hub/permission-mode.ts`) so agents cannot self-modify their own hooks or plugins.
16
+ - **Path Protection**: Any workspace configuration directory owned by the agent (e.g., `.agents/`, `.codex/`) must be listed in `AGENT_CONFIG_SEGMENTS` (`src/hub/permission-paths.ts`) so agents cannot self-modify their own hooks or plugins.
17
17
  - **Process Isolation**: Spawns must run in their own process groups and are stopped as a whole group by the hub.
18
18
 
19
19
  ---
@@ -110,6 +110,16 @@ Configured kinds are headless and off roster by default. Before a start can succ
110
110
 
111
111
  Grok declarations require explicit `--no-leader`, since native defaults can inherit ambient `[cli] use_leader`. Grok 1.0.62 remains unsupported: its isolated probe lacked initialize identity and refused session creation. The [T0 receipt](verification/2026-10-21-grok-config-acp-t0.md) records the remaining evidence. The full A3 schema and proof boundary are in the [spec amendment](specs/2026-09-19-agent-hub-design.md#amendment-config-only-acp-adapters-a3-451-486).
112
112
 
113
+ For `transport: "pull"` (#1809), declare `command`, `args`, `displayName`, `roles` and `versionArgs`;
114
+ `tasks` is optional and only `false` is accepted. `ahub <kind>` runs the command in the person's
115
+ terminal with `AGENTHUB_PEER_ID` and the project context set, after a version probe and a check that the
116
+ running hub loaded the kind and has it on the roster. The session reaches the hub through the bridge
117
+ (`plugins/agent-hub/server.js`) the person registered in that CLI, in the pull-only peer mode agy uses:
118
+ it reads `hub_inbox` and calls hub tools, and nothing is pushed. A `reviewer` role is refused at
119
+ configuration load, and routing refuses the kind as an owner of any task, whoever names it, because
120
+ the definition carries `tasks: false`. The hub never writes another tool's configuration:
121
+ `ahub agents add <preset> --pull` prints the registration command and `ahub doctor` reports a missing one.
122
+
113
123
  For `transport: "print"`, declare `command`, `args`, `displayName`, `roles`,
114
124
  `versionArgs`, `versionPin` and `timeoutS` (1 to 300 seconds). Supply one
115
125
  `{prompt}` placeholder in `args` or set `stdin: true` with no placeholder.
@@ -127,6 +137,19 @@ resume or native launch overrides. AC5 remains a person-run receipt.
127
137
 
128
138
  ---
129
139
 
140
+ ### Four ways to add a tool (#1809)
141
+
142
+ | Way | Use it when | You write | Transport | Surface | Roles | PII | Quota | Instances |
143
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- |
144
+ | Preset | the tool is gemini, opencode, kiro or copilot | `ahub agents add <preset>` (check `ahub agents presets` for `verified` or `untested`) | ACP stdio, no attach or leader selector; copilot has no ACP line | headless only, no TUI | planner, implementer, verifier, reviewer; no conductor | no PII (cloud trust) | quota unknown | headless instances |
145
+ | Config-only ACP | the tool speaks ACP over stdio | an `adapters.<kind>` entry by hand, as above | ACP stdio, no attach or leader selector | headless only, no TUI | planner, implementer, verifier, reviewer; no conductor | no PII (cloud trust) | quota unknown | headless instances |
146
+ | Config-only pull | you run the tool in your own terminal and it has an MCP client | a `transport: "pull"` entry, or `ahub agents add <preset> --pull`, then register the bridge in the tool yourself | the tool's own TUI over the hub bridge, no hub launch of an agent process | the person's TUI, pull-only, never pushed to | planner, implementer, verifier are recorded but grant no board role while `tasks` is false; no reviewer, owns no task (`tasks: false`) | no PII (cloud trust) | quota unknown | no instances |
147
+ | Config-only print | the tool answers one prompt per run | a `transport: "print"` entry, as above | print, one sandboxed process per message | headless only, no TUI | reviewer and advisor only, never owns a task | no PII (cloud trust) | quota unknown | no instances |
148
+ | External module | it needs its own start or session code | a module, section 5 | the headless ACP host port only, no own protocol | headless only | planner, implementer, verifier, reviewer; no conductor | no PII (cloud trust) | quota unknown | headlessInstances only |
149
+ | Built-in definition | it ships with the hub | an `AdapterDefinition`, section 3 | any the hub supports | any | any | on-prem allowed | readers allowed | any |
150
+
151
+ `test/agent-presets-1809.test.ts` tries each forbidden combination in this table and checks that its row says the same.
152
+
130
153
  ## 5. External Adapter Modules (#451 A4)
131
154
 
132
155
  A person can authorize a bundled adapter in an untracked
@@ -178,8 +201,7 @@ a host default rather than isolation from a module that overrides its options. T
178
201
  fields rather than silently ignoring them. See `validateExternalDefinition` for
179
202
  the exact accepted subset.
180
203
 
181
- External kind instances are explicitly unsupported in A4. Follow-up board task
182
- #287 owns execution roots, CLI identity and recovery for them. Broadening the
204
+ External kinds may declare `headlessInstances` (a headless form and its roles); the loader refuses the builtin `instances` field and says to use `headlessInstances`. Execution roots, CLI identity and recovery for those instances were follow-up board task #287. Broadening the
183
205
  module transport beyond the existing headless ACP host port also needs a reviewed
184
206
  host contract (#625 phase 6); selecting a different native engine is not a generic extension.
185
207
 
@@ -242,7 +264,7 @@ When adding or updating an adapter, verify each item before opening a PR:
242
264
  - [ ] **T0 Receipt Recorded**: Document native CLI version, observed hook payloads, and protocol outputs in `docs/verification/YYYY-MM-DD-<kind>-t0.md`.
243
265
  - [ ] **Registered in ADAPTERS**: the definition is declared under `src/adapters/definitions/` (or its own directory) with explicit `displayName`, `family`, `transport`, `trust` and `projection`, and listed in `ADAPTERS` (`src/adapters/registry.ts`). The peer lists are derived from it. The hand-kept cross-release copies in `src/hub/peer-catalog.ts` and `src/hub/start-mode.ts` and the pinned tests listed in `docs/agent-notes/adapters.md` change with it, and the PR names them as expected test changes.
244
266
  - [ ] **Hub skills host**: for a builtin kind that reads a user skill directory, add it to `SKILL_HOSTS` and `hostSkillDir` in `src/adapters/definitions/native-cli-skills.ts` and record the directory's source in `docs/agent-notes/adapters.md` ("Other hosts' user skill directories"); for one that reads none, add it to the exclusions in `test/skills-install.test.ts`, which fails while `SKILL_HOSTS` differs from `SUPPORTED_PEERS` minus claude and local.
245
- - [ ] **Config Path Protection**: Agent configuration directories added to `AGENT_CONFIG_SEGMENTS` in `src/hub/permission-mode.ts`.
267
+ - [ ] **Config Path Protection**: Agent configuration directories added to `AGENT_CONFIG_SEGMENTS` in `src/hub/permission-paths.ts`.
246
268
  - [ ] **PII Safety Verified**: Cloud models have `trust.onPrem: false`; verify PII markers refuse routing to this peer.
247
269
  - [ ] **Process Group Teardown**: Daemon-spawned processes use process groups and exit cleanly on stop.
248
270
  - [ ] **Conformance Kit Passes**: `bun test test/conformance` passes with zero regressions and no silent skips.
@@ -122,6 +122,7 @@ revision preserves both behaviors; capture still uses its stricter turn fence.
122
122
 
123
123
  ## Changes
124
124
 
125
+ - 2026-11-30: #1801 starts draft CI observation when a PR head is recorded. A reviewer can record the same identity when the owner cannot see the lifecycle tool, without claiming a local result.
125
126
  - 2026-11-15: #1447 T5 prepares dependencies from reviewed Git-base install inputs because validating a peer-writable manifest and later running it on the host leaves a race. Fixed readiness guidance does not turn an installer failure into failed acceptance. The localhost listener leg moved to a follow-up, and this slice keeps Pi's network profile unchanged.
126
127
  - 2026-11-15: #1447 T4 reproduces a digest prepared before a task-move notice was queued. Conditional queue re-selection keeps that notice in the next host turn without changing durable ACKs; the later provider-prompt window remains unmeasured and open. Checkpoint ownership epochs prevent a pending notice from permitting former-owner summary effects.
127
128
  - 2026-11-14: #1473 follows the #1328 cooperative direct-instruction precedent for one conductor-recorded question answer. Visible actor provenance avoids a second terminal step while a DB-only quote and unchanged person/private/self-answer boundaries keep the claim separate from blanket delegation or release consent.
@@ -1,6 +1,6 @@
1
1
  # Native adapters and spawned agents
2
2
 
3
- Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` and `activity` events), peer turn state, approvals, and the agent processes the hub spawns and stops. Read before editing `src/adapters/`, `src/pi/`, `src/hub/peers.ts`, `src/hub/peer-activity.ts`, `src/hub/permission-mode.ts`, `src/hub/tool-refusal.ts`, `src/hub/action-enforce.ts`, `src/hub/permission-payload.ts`, `src/hub/claude-shell-wrapper.ts`, `src/hub/task-shell-command.ts`, `src/hub/task-shell-default.ts`, `src/hub/task-shell-proof.ts`, `src/hub/task-shell-sandbox.ts`, `src/cli/claude-shell-wrapper.ts`, `src/hub/child-process.ts`, `src/hub/lifecycle.ts` (shutdown deadline), `src/hub/start-mode.ts`, `src/hub/terminal-open.ts`, `src/memory/capture.ts` (session end), `src/hub/native-hook-launch.ts`, `src/hub/peer-catalog.ts`, the launcher-managed MCP entries (`src/cli/agy-mcp.ts`, `src/cli/kimi-mcp.ts`, `src/cli/jcode-mcp.ts`), `src/cli/configured-acp-entry.ts`, the version policy (`src/adapters/compat.ts`, `src/cli/agents.ts`) or the process-tree stop in `scripts/benchmarks/teardown.ts`, or before adding a native peer.
3
+ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` and `activity` events), peer turn state, approvals, and the agent processes the hub spawns and stops. Read before editing `src/adapters/`, `src/pi/`, `src/hub/peers.ts`, `src/hub/peer-activity.ts`, `src/hub/permission-mode.ts`, `src/hub/permission-paths.ts`, `src/hub/tool-refusal.ts`, `src/hub/action-enforce.ts`, `src/hub/permission-payload.ts`, `src/hub/claude-shell-wrapper.ts`, `src/hub/task-shell-command.ts`, `src/hub/task-shell-default.ts`, `src/hub/task-shell-proof.ts`, `src/hub/task-shell-sandbox.ts`, `src/cli/claude-shell-wrapper.ts`, `src/hub/child-process.ts`, `src/hub/lifecycle.ts` (shutdown deadline), `src/hub/start-mode.ts`, `src/hub/terminal-open.ts`, `src/memory/capture.ts` (session end), `src/hub/native-hook-launch.ts`, `src/hub/peer-catalog.ts`, the launcher-managed MCP entries (`src/cli/agy-mcp.ts`, `src/cli/kimi-mcp.ts`, `src/cli/jcode-mcp.ts`), `src/cli/configured-acp-entry.ts`, the version policy (`src/adapters/compat.ts`, `src/cli/agents.ts`) or the process-tree stop in `scripts/benchmarks/teardown.ts`, or before adding a native peer.
4
4
 
5
5
  - For conceptual architecture, definition fields, generic ACP config and the new-adapter review checklist, see [Adding an AI Tool](../adding-an-ai-tool.md). For definition interfaces, see [registry-types.ts](../../src/adapters/registry-types.ts).
6
6
 
@@ -13,8 +13,9 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
13
13
  - Registry load runs `assertDaemonEngine` and `assertNativeCapabilityScope` before publication. A definition that is not a fixed builtin (object identity in `fixedBuiltinDefinitions`, never a kind name) may not declare `start.acpCommand`, `start.upStart`, `attach.admission`, `budget.resetSoftTokensOnResume`, `session.crashIdentity`, `session.nativeRevert`, a `pi-rpc` or `claude-implementer` daemon port, `identity.currentChild`, `routing`, `projection`, `reviewerVariant`, `headlessVariant`, `reviewer`, `hooks.factsHook`, `cli.entry`, `cli.preview`, `cli.usage` or `instances.modelSelect`. Only `definitionOf(id, instances)` picks a kind's `reviewerVariant`, for a declared extra with `start_mode: "headless"`, roles exactly `["reviewer"]`, and either a variant whose `reviewer.declaration` is `"automatic"` (Claude, agy) or `review_mode: "fresh"` (Codex, Kimi); without that opt-in a reviewer-only Codex or Kimi instance keeps its native adapter. It picks a kind's `headlessVariant` (Claude, #525-4) for a declared headless extra whose roles include `implementer` and hold only `implementer` and `verifier`. Metadata-only reviewer variants never establish native peer support; `isSupportedPeer` shares the registry runtime/validated-instance predicate with the catalog and daemon. A new field that depends on fixed-builtin assumptions or host-global native state joins that list (`test/adapter-capability-scope.test.ts`). `trust.onPrem` admits PII work (rule: `tasks.md`).
14
14
  - Native branch ratchet (#625): `test/daemon-native-branches.test.ts` counts every call of a native class predicate (an `is*Peer` imported from an adapter module other than `registry.ts`) per enclosing function in `src/hub/daemon.ts` and `src/hub/claude-launch-proof.ts`, and the counts must equal `test/daemon-native-branches.json` (`predicate`, `function`, `count`, `reason`). A PR that adds, moves or removes such a call edits its row by hand with a concrete reason; never regenerate the table from a test. Bind a predicate alias with `const` only and never call one through a computed namespace key: the scan refuses both.
15
15
  - Native proof state (`frontendProxy`, builtin `statusNotice`, `revertTurn` with `session.nativeRevert`, the Claude launch proof and terminal execution root) is read in the daemon only after `isFixedBuiltinDefinition(definitionOf(peer))`: a same-name foreign definition gets none of it. A product of a definition that is not a fixed builtin may not have a `frontendProxy`, `statusNotice` or `revertTurn` member at all, even undefined (`assertNativeProofPorts`, run by `createFromDefinition` and the conformance kit). Use `frontendProxyState` for the daemon proxy reads: absence keeps the generic path, present undefined refuses with `frontend proxy state unknown`. Keep approval policies and restoration debt inside CodexPeer. The remaining Codex `actionEnforcement`/`actionGated` predicate is intentional until a separately specified action-policy port; never add it to `FrontendProxyPort`.
16
+ - Quota renewal calls the optional `PeerAdapter.compareQuotaHome` and `readQuotaNow` ports. Verify fixed builtin definition identity before reading either member. Refuse foreign products with either member present, even undefined. Compare synchronously before renewal and at the save boundary. Fall back to the next launch only when comparison returns undefined or the port is absent. A throw means unknown. Keep home paths in memory. Read quota only after saving, and preserve the success reply if the read throws.
16
17
  - Adding a native peer: declare its `AdapterDefinition` under `src/adapters/definitions/` (or its own directory, as agy) and list it in `ADAPTERS` (`src/adapters/registry.ts`). `KNOWN_PEERS`, `OPTIONAL_PEERS`, `SUPPORTED_PEERS`, `START_MODE_PEERS` (a kind with both a TUI and a headless form), `ROLE_ORDER`, `HELP_ORDER` and `PLANNER_PEERS` are derived from it by `deriveAdapterLists`: set `optional`, `projection` (`roleRank`, `startRank`, `helpRank`, `plannerEligible`, `conductorEligible`, `reviewerEligible`; absent eligibility is false; a configured or external definition cannot) and, for an `ahub <kind>` launcher, `cli.entry`, `cli.usage`, `cli.preview` and `cli.startWords`, never a list edit (`builtinCliEntries(definitions)` projects the entries). The literal cross-release copies `KNOWN_PEERS` and `OPTIONAL_PEERS` in `src/hub/peer-catalog.ts` and `START_MODE_PEERS` in `src/hub/start-mode.ts` stay hand-kept for older coordinators: `test/registry-guard.test.ts` fails when one differs from the derived list. Adding a peer is the one change that updates their probe counts and `VENDORS` in `test/helpers/registry-inventory.ts` (`REGISTRY_COMPATIBILITY_PROBES`), the probe literal in `test/adapter-registry-a2.test.ts`, the `ADAPTERS` order in `test/adapter-registry.test.ts` and the literal in `test/adapter-catalog-a2.test.ts`; say so in the PR as an expected test change. `isSupportedPeer` answers from `ADAPTERS`, and for a declared instance from its kind's runtime definition unless the instance resolves to an unavailable reviewer variant; `isKnownPeer` and `defaultPeerRoles` answer from `definitionOf`; `STARTABLE_PEERS` reuses `SUPPORTED_PEERS`. Role eligibility (#1408) is read only through `roleEligibility` / `applyRoleCeiling` (`src/adapters/role-eligibility.ts`): a new kind changes the generated table in `docs/roles.md` (`renderEligibilityTable`; `test/roles-doc.test.ts` fails until the doc matches) and, when `conductorEligible`, the pinned conductor set in `test/conformance/conductor.test.ts`, and the conductor-start wording comes from `conductorStartText()` (`src/adapters/registry.ts`), never a text edit. It also adds the kind's `kinds` entry and its rows to `templates/presets/confirmation-matrix.json` (#999 T0): `test/confirmation-matrix.test.ts` fails without a tool-approval and a classed-action row per environment, and when the entry's forms, pull-only forms, conductor start or hub-mode fact differ from the definition. Add the same kind to `kinds` in `templates/presets/autonomous.json`, with a permission per form (`null` where the hub mode is `unmanaged`, or for `tui` under `unmanaged-in-tui`) and a start per environment: `test/autonomy.test.ts` fails when the preset and matrix kinds differ or a mode is unsupported. A builtin kind that reads a user skill directory joins `SKILL_HOSTS` and `hostSkillDir` (`src/adapters/definitions/native-cli-skills.ts`); one that reads none joins the exclusions in `test/skills-install.test.ts`.
17
- - When an adapter lands, add its project config directories to `AGENT_CONFIG_SEGMENTS` (`src/hub/permission-mode.ts`); scoped automatic writes must ask there, while explicit approval and `never-ask` keep their existing behavior.
18
+ - When an adapter lands, add its project config directories to `AGENT_CONFIG_SEGMENTS` (`src/hub/permission-paths.ts`); scoped automatic writes must ask there, while explicit approval and `never-ask` keep their existing behavior.
18
19
  - Load external modules only at daemon startup from trusted untracked local declarations: verify the self-contained bundle and content pin before importing captured bytes. Keep CLI/reload paths metadata-only, modules restart-bound and never settings-editable, builtin capabilities restricted, and external-kind instances admitted only under the accepted #754 headless opt-in, live captured catalog, separate worktree and host-managed current-owner proof; preserve the live-module controlled-recovery refusal. Export conformance registrations and fake assets without starting them on import.
19
20
  - Bind scanned external runtime SDK imports to this daemon's own `/adapter` entry; never resolve them against project packages. Refuse `/conformance`, `bun:ffi`, `bun:test` and CommonJS loading at runtime. Isolate module refusals from hub startup and retain unknown module roster rows as inert when metadata is unavailable.
20
21
  - Require the immutable captured project catalog at instance, roster, execution and permission resolver boundaries; choose a builtin catalog explicitly only for builtin-only callers; accept `adapters` only as wholly machine-local trusted data and require restart for changes. Refuse missing/mismatched pins, non-echoed load sessions, leader/attach argv and unknown owned-group evidence; require an explicit standalone `--no-leader` before argv termination for Grok (kind, executable or pinned native name); signal only the original verified group. Keep unmapped policy unmanaged, absent budgets exempt and read-only instances non-raisable through native acknowledgement plus host/MCP mutation gates. Claim native support only with its isolated T0 receipt.
@@ -122,7 +123,7 @@ Scope: the Codex, ACP and Pi adapters and the Pi extension (turn `generation` an
122
123
  - 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.
123
124
  - A project MCP entry the hub wrote is its own after the project directory moved (#1423): the directory fields are compared by real path (`sameDirectory`, `src/adapters/same-directory.ts`), not by text: `AGENTHUB_PROJECT_DIR` in the Jcode entry (`foreignField`), and `AGENTHUB_PROJECT_DIR` and `AGENTHUB_STATE_DIR` in agy's MCP entry and hook commands; a refusal names the differing field and the remedy. `jcodeMcpReady` still requires the exact current entry, so the launcher rewrites a moved one. Never loosen the rest of the shape (command, args, mode, peer id): only the directory fields follow a symlink. Kimi's entry is rewritten from the current paths and has no ownership check.
124
125
  - 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.
125
- - 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.
126
+ - 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-paths.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.
126
127
  - `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.
127
128
 
128
129
  ## Reviewers
@@ -1,6 +1,6 @@
1
1
  # Budget, pause and handoff
2
2
 
3
- Scope: quota and native context readings, checkpoints, pause, handoff and resume, and the status line tee. Read before editing `src/hub/budget.ts`, `src/hub/window-kind.ts`, `src/hub/budget-notes.ts`, `src/hub/context-window.ts`, `src/cli/statusline-tee.ts`, `src/adapters/definitions/native-quota.ts`, `src/adapters/definitions/native-context.ts`, `src/hub/bus.ts`, `src/hub/delivery-journal.ts`, `src/hub/restart.ts` (pause persistence), the per-account fanout in `src/hub/instance-budget.ts`, the usage roll-up in `src/hub/usage-rollup.ts` or Kimi's count (`src/adapters/kimi-wire-usage.ts`, `src/hub/kimi-usage.ts`, `src/hub/token-window.ts`), or the exhaustion projection (`src/hub/budget-projection.ts`).
3
+ Scope: quota and native context readings, checkpoints, pause, handoff and resume, and the status line tee. Read before editing `src/hub/budget.ts`, `src/hub/window-kind.ts`, `src/hub/budget-notes.ts`, `src/hub/context-window.ts`, `src/cli/statusline-tee.ts`, `src/adapters/definitions/native-quota.ts`, `src/adapters/definitions/native-context.ts`, `src/hub/bus.ts`, `src/hub/delivery-journal.ts`, `src/hub/restart.ts` (pause persistence), the per-account fanout in `src/hub/instance-budget.ts`, the usage roll-up in `src/hub/usage-rollup.ts` or Kimi's count (`src/adapters/kimi-wire-usage.ts`, `src/hub/kimi-usage.ts`, `src/hub/token-window.ts`), the exhaustion projection (`src/hub/budget-projection.ts`), declared accounts (`src/hub/accounts.ts`, `src/hub/home-tag.ts`) or the renewal boundary (`src/hub/quota-origin.ts`).
4
4
 
5
5
  - Reviewer quota admission opt-outs (#1467): keep defaults `review.gate = 0.8` and `review.unknown_quota = "skip"`. `unknown_quota = "pass"` admits unknown observations only, retaining the known floor and never treating admitted unknown as quota-wait evidence. Gate `"off"` bypasses floor/unknown checks and all quota waits, while actual Budget/manual pauses and every other routing guard remain binding. Report the active rule through the shared policy description; do not turn an opt-out into a reading, account transport, cleanup release or resume path. Require `reviewer_quota` on recovery for explicitly configured unknown policy, including skip, or gate off.
6
6
  - Reviewer quota (#1446): accept only the pinned native outer Claude/Codex refusal frames in `native-quota.ts`, or the narrowly documented Kimi nonzero owned-child complete-stderr exception. Never match assistant/tool/model text. Keep reset unknown unless a typed native timestamp supplies it; credits do not affect admission. Record the hard pause through canonical-account `Budget.report` immediately when an admitted frame is observed (Kimi stderr only after confirmed settlement), independently of task fallback. Defer handoff until that owned attempt settles; only the existing Budget reset/resume policy releases the pause.
@@ -19,7 +19,7 @@ Scope: quota and native context readings, checkpoints, pause, handoff and resume
19
19
  - Keep native context occupancy (`src/hub/context-window.ts`, readers in `src/adapters/definitions/native-context.ts`) separate from quota accounting; never use Codex's accumulated `total` as occupancy or estimate Pi counters. Host code reads quota and context only through `readNativeQuota` (`budget.ts`) and `readNativeContext` on the resolved definition's declared `budget.reader` / `budget.context`; no declared reader is unknown, never an empty reading (rule: `adapters.md`).
20
20
  - Context checkpoint completion requires its request id and the current attached peer/native session. Invalidate its transport generation synchronously at a new peer claim, before asynchronous recall or attachment. Never pause, reassign or replace a session on context pressure; `ContextWindows.admission` (#802) only copies the reading for new-offer routing and never changes the crossing latch. Refuse private-turn, PII-pattern and all associated open PII-task summaries (owner or reviewer, including in_review, with the current routing policy; use `isClosedTaskState` to exclude approved and cancelled work) before local persistence or cloud memory; never broadcast checkpoint text.
21
21
  - A quota or context checkpoint also snapshots each owned task's creation and ownership-change epoch (#1506). Before accepting a summary, require that task binding and the original peer/session to remain current. If ownership moved or the task was cancelled, refuse the stale answer with a body-free cause retained only until that request's original deadline; a new request replaces the refusal. A changed peer/session reveals no prior task ids.
22
- - Invalid/stale context readings expose unknown and do not rearm a crossing. Latch a crossing only after its event is accepted; reconsider paused/recovery-held crossings after release with fresh current-session readings. Tee context fields contain finite numeric values or null only, bound to daemon instance, launcher and native session. Context and session go to the per-peer file `claudeStateFile(base, peer)` (the builtin keeps the unsuffixed name); `claude-usage.json` stays one shared file per account.
22
+ - Invalid/stale context readings expose unknown and do not rearm a crossing. Latch a crossing only after its event is accepted; reconsider paused/recovery-held crossings after release with fresh current-session readings. Tee context fields contain finite numeric values or null only, bound to daemon instance, launcher and native session. Context and session go to the per-peer file `claudeStateFile(base, peer)` (the builtin keeps the unsuffixed name); `claude-usage.json` stays one shared file per account. A session under an absolute `CLAUDE_CONFIG_DIR` also writes `claude-usage.<homeTag>.json` (#1810, `homeTag` in `src/hub/home-tag.ts`: a hash, never the path), which the daemon reports under `claude:<label>` for each declared Claude account; a reading in the shared file whose `home` tag is a declared home is skipped (`isDeclaredReading`), so it never pauses the default key.
23
23
 
24
24
  - A provider hard refusal ends a reading override and supersedes a soft evaluation still awaiting its checkpoint; never let the obsolete checkpoint overwrite that pause. An ACP provider quota refusal reports a hard budget reading and confirms the live pause before the adapter requeues work, so the pause fences retries and the existing relay handles assignments. Use the observed window length for an unknown reset; repeated quota refusals while paused do not consume poison-envelope retries, except for an `invocation` request: it gets at most one automatic retry, only when `canRetryInvocation` says so, paused or not (rule: `bus.md`).
25
25
  - Kimi's ACP `{used, size}` occupancy is a context reading (`acpContext`, source `acp_usage_update`) bound to the adapter's own session id: never a `tokens` event or a budget window, and an invalid shape reports unknown, not the previous value. A gate crossing sends a checkpoint request only to definitions with `budget.checkpoint` (Claude and Codex); an ACP peer gets the event and the notice (#285).
@@ -29,6 +29,7 @@ Scope: quota and native context readings, checkpoints, pause, handoff and resume
29
29
  - `Budget.report` resolves the reporter and its account through `hooks.definitionOf` (the daemon's startup-bound project catalog; builtin-only when absent) and skips `user`, `hub` and a registered kind, configured and external module kinds included, with no `budget` block or with `budget.quotaExempt` (only local); an unregistered id keeps quota accounting. `budget.instrumented` (execution budget) never exempts quota.
30
30
 
31
31
  - Key quota readings, pause records, overrides, checkpoints and handoffs by the canonical account (`hooks.account`, idempotent); telemetry keeps the reporter id and native context occupancy stays per instance. `instanceBudgetHooks` fans pause, resume, checkpoint and handoff out to every member, and `canHandOff` excludes the paused account's siblings. Startup normalization merges old alias pause rows without dropping a row or marking an unfinished handoff done. A manual pause stays per member. Reviewer and headless implementer variants keep their base kind's `budget.account`.
32
+ - Declared accounts (#1810, `src/hub/accounts.ts`): resolve a peer's budget key only through the daemon's `accountOf` (`accountKeyFor`): the bare kind for the default label and `<kind>:<label>` for a declared one, so a project without `accounts` keeps its keys. A home path stays in `config.local.json` and the `accounts.ts` return values; events, logs, status and CLI output carry labels only (`labelForHome`). With `budget.cross_account_handoff = false`, same-kind peers on other labels are siblings (`handoffSiblings`, and `canHandOff` compares the base kind), and a move across accounts writes one `budget_handoff` event with peer ids and labels only (`handoffEvents`).
32
33
  - Release-cut quota admission (`releaseQuotaSnapshot` in `src/hub/daemon.ts`, #481 S11): an account has a quota source only when one of its members' definitions has `budget.reader`, or `budget.resetSoftTokensOnResume` with `kimi_tokens_5h > 0`. Without a source a registered account is reported `no quota source` and never defers; with one, an unknown, stale or below-gate reading defers. Manual and budget-record pauses defer for every attached peer.
33
34
 
34
35
  - Window kinds (#285 AC6, AC8): classify a window only through `windowKind` (`src/hub/window-kind.ts`: `native`, `count`, `manual`); a reporter that knows its kind passes it (`ahub budget set` is `manual`, the Kimi count `count`). Readings are kept per window id and kind, never overwriting each other. The gate and `headroom` act only on `gating()`: a fresh `manual` reading replaces the others for its window, and the hub `count` never gates while a fresh `native` or `manual` reading exists. A hard refusal drops the `manual` reading of each window it reports. `status()` lists the gating reading first and marks the information-only fresh ones `superseded`; never gate or route from `status()` windows.
@@ -43,3 +44,8 @@ Scope: quota and native context readings, checkpoints, pause, handoff and resume
43
44
 
44
45
  - Controlled recovery with retained reviewer accounting/wait history or explicitly configured reviewer quota keys requires `reviewer_quota`. Bind accounting replay completeness and safe ordered journal commitment through the existing snapshot integrity; missing/changed journal refuses restoration before optimistic counts can be published. Empty legacy state keeps older-target compatibility.
45
46
  - Exhaustion projection (#1513): `projectExhaustion` (`src/hub/budget-projection.ts`) stays pure. An unusable reading answers `unknown` with a cause, never a time. The page's `PROJECTION_CAUSE`/`projectionText` in `src/ui/index.html` must render the same sentence as `projectionText` in `budget-projection.ts` (`test/budget-surfaces.test.ts` runs the page copy).
47
+
48
+
49
+ - Renewal (#1806): fence old soft readings with the durable canonical-account marker, cancel the pending checkpoint, and reuse resume's moved-task notice. Never write an override or remove a manual or conductor hold. A stalled handoff leaves renewal unsaved and keeps its own eventual notice. Switched Codex requires known app-server issuance after the saved boundary. Keep home comparisons in memory and out of all records. Keep switched Claude provider quota unknown with the soft gate off. A Claude launch/session ID alone does not prove a new account. While a Codex reviewer attempt is in flight, return unknown for its home comparison.
50
+ - Use the shared window-jitter comparison to reject equal provider usage after renewal, including when either reset time is missing. Manual readings and the trusted Kimi counter have their own admission rules. Preserve the provider forecast baseline through adjacent reset-time jitter and small dips. A missing reset time does not replace the last known reset time. For windows predating renewal, use the average provider usage rise over at least 15 minutes and at least five percentage points. Require a fresh native baseline after restart and keep hourly tokens out of this forecast. Keep forecast series separate by Claude session and launch or by Codex peer and process. Never serialize those IDs or let them influence admission. Keep the projection cache bound to the shown observation.
51
+ - Kimi renewal: admit only trusted hub counts of rows measured strictly after the saved canonical renewal. Apply the same cutoff to live and reviewer rows and replay. Replay also uses the existing resume filter on recording time. Reject future measurements from the renewed soft count, keeping usage events, attribution, dedupe ids and unreadable or tainted states.
@@ -30,14 +30,15 @@
30
30
 
31
31
  - Console attention navigation selects a delivery only by an exact visible row id. A missing id or row prints read-only guidance; never select by peer or fall back to the first Queue row.
32
32
 
33
- Scope: the operator console, control WS and its protocol, state files, the dashboard listener and settings, the Claude channel's reconnect, `ahub setup`, git snapshots, upgrade and recovery. Read before editing `src/adapters/definitions/native-recovery*.ts`, `src/adapters/definitions/native-policy-aux.ts`, `src/adapters/definitions/native-config-*.ts`, `src/adapters/definitions/native-cli-*.ts`, `src/cli/console.ts`, `src/cli/console-state.ts`, `src/cli/console-versions.ts`, `src/cli/attention.ts`, `src/ui/needs.ts`, `src/hub/daemon.ts`, `src/hub/ui.ts`, `src/hub/settings.ts`, `src/hub/control-client.ts`, `src/adapters/claude-channel.ts`, `src/hub/restart.ts`, `src/hub/recovery-store.ts`, `src/hub/snapshots.ts`, `src/hub/manager.ts`, `src/hub/lifecycle.ts`, the runtime selection and retention modules (`src/hub/project-runtime-state.ts`, `src/hub/project-runtime.ts`, `src/hub/runtime-capture-prune.ts`, `src/hub/runtime-prune-health.ts`, `src/hub/registry.ts`), `src/hub/crash.ts`, `src/hub/start-mode.ts`, `src/hub/terminal-open.ts`, `src/hub/recovery-error.ts`, `src/hub/db-timeout.ts`, `src/hub/db-schema.ts`, `src/hub/protocol-window.ts`, `src/hub/config-reload.ts`, `src/hub/config-apply.ts`, `src/hub/config-tier.ts`, `src/hub/config-edit.ts`, `src/hub/config-edit-host.ts`, `src/hub/claude-launch-proof.ts`, the session and provenance modules (`src/hub/session-identity.ts`, `src/hub/provenance.ts`, `src/hub/channel-project.ts`), `src/hub/recovery-continuity.ts`, `src/cli/recovery-presentation-options.ts`, `src/cli/setup.ts`, the default agent set (`src/hub/start-agents.ts`, `src/cli/start-agents-run.ts`), `src/cli/upgrade*.ts`, `src/cli/runtime-version-warning.ts`, `src/cli/terminal-recovery.ts`, `src/cli/recovery-package.ts`, `src/cli/facts-hook.ts`, `src/hub/usage.ts`, `src/hub/memory-profile.ts`, the memory code modules (`src/hub/memory-symbols.ts`, `src/hub/memory-code-overlay.ts`, `src/hub/memory-code-head.ts`, `src/hub/memory-stale-anchors.ts`, `src/cli/memory.ts`), the task brief host (`src/memory/brief.ts`, `src/hub/memory-plan-guard.ts`), `src/hub/native-hook-launch.ts`, `src/cli/output.ts`, `src/cli/warn-line.ts`, `src/ui/index.html`, the dashboard view models (`src/ui/roadmap-model.ts`, `src/ui/overview-model.ts`), the acon plugin (`src/ui/plugin.ts`, `src/ui/office-space.ts`, `src/cli/acon-register.ts`), `ahub study` (`src/cli/study.ts`, `src/cli/study-output.ts`), `src/hub/task-code-group.ts` (dashboard Code group), the agent drift sweep (`src/hub/agent-drift.ts`, `src/cli/agents.ts`) or the instance modules (`src/hub/instances.ts`, `src/hub/instance-config.ts`, `src/hub/instance-execution.ts`), or before adding a native peer.
33
+ Scope: the operator console, control WS and its protocol, state files, the dashboard listener and settings, the Claude channel's reconnect, `ahub setup`, git snapshots, upgrade and recovery. Read before editing `src/adapters/definitions/native-recovery*.ts`, `src/adapters/definitions/native-policy-aux.ts`, `src/adapters/definitions/native-config-*.ts`, `src/adapters/definitions/native-cli-*.ts`, `src/cli/console.ts`, `src/cli/console-state.ts`, `src/cli/report-layout.ts`, `src/cli/console-versions.ts`, `src/cli/attention.ts`, `src/ui/needs.ts`, `src/hub/daemon.ts`, `src/hub/config.ts`, `src/hub/ui.ts`, `src/hub/settings.ts`, `src/hub/control-client.ts`, `src/adapters/claude-channel.ts`, `src/hub/restart.ts`, `src/hub/recovery-store.ts`, `src/hub/snapshots.ts`, `src/hub/manager.ts`, `src/hub/lifecycle.ts`, the runtime selection and retention modules (`src/hub/project-runtime-state.ts`, `src/hub/project-runtime.ts`, `src/hub/runtime-capture-prune.ts`, `src/hub/runtime-prune-health.ts`, `src/hub/registry.ts`), `src/hub/crash.ts`, `src/hub/start-mode.ts`, `src/hub/terminal-open.ts`, `src/hub/recovery-error.ts`, `src/hub/db-timeout.ts`, `src/hub/db-schema.ts`, `src/hub/protocol-window.ts`, `src/hub/config-reload.ts`, `src/hub/config-apply.ts`, `src/hub/config-tier.ts`, `src/hub/config-edit.ts`, `src/hub/config-edit-host.ts`, `src/hub/claude-launch-proof.ts`, the session and provenance modules (`src/hub/session-identity.ts`, `src/hub/provenance.ts`, `src/hub/channel-project.ts`), `src/hub/recovery-continuity.ts`, `src/cli/recovery-presentation-options.ts`, `src/cli/setup.ts`, the default agent set (`src/hub/start-agents.ts`, `src/cli/start-agents-run.ts`), `src/cli/upgrade*.ts`, `src/cli/runtime-version-warning.ts`, `src/cli/terminal-recovery.ts`, `src/cli/recovery-package.ts`, `src/cli/facts-hook.ts`, `src/hub/usage.ts`, `src/hub/memory-profile.ts`, the memory code modules (`src/hub/memory-symbols.ts`, `src/hub/memory-code-overlay.ts`, `src/hub/memory-code-head.ts`, `src/hub/memory-stale-anchors.ts`, `src/cli/memory.ts`), the task brief host (`src/memory/brief.ts`, `src/hub/memory-plan-guard.ts`), `src/hub/native-hook-launch.ts`, `src/cli/output.ts`, `src/cli/warn-line.ts`, `src/ui/index.html`, the dashboard view models (`src/ui/roadmap-model.ts`, `src/ui/overview-model.ts`), the acon plugin (`src/ui/plugin.ts`, `src/ui/office-space.ts`, `src/cli/acon-register.ts`), `ahub study` (`src/cli/study.ts`, `src/cli/study-output.ts`), `src/hub/task-code-group.ts` (dashboard Code group), the agent drift sweep (`src/hub/agent-drift.ts`, `src/cli/agents.ts`) or the instance modules (`src/hub/instances.ts`, `src/hub/instance-config.ts`, `src/hub/instance-execution.ts`), the shared host (`src/hub/host.ts`), the MCP endpoint and its bridge core (`src/hub/mcp-endpoint.ts`, `src/hub/mcp-bridge-core.ts`), the Orca pane watch (`src/hub/orca-state.ts`), the light CLI path (`src/cli/light-dispatch.ts`), or before adding a native peer.
34
34
 
35
- - The plugin bundle is installed apart from the daemon. Breaking a control WS message contract bumps `PROTOCOL` in `control-client.ts`; a new request answered as unknown or an optional field preserves it, as does additive optional public task metadata in `ui_snapshot` that older clients ignore (such as `deps` in #246).
35
+ - The plugin bundle is installed apart from the daemon. Breaking a control WS message contract bumps `PROTOCOL` in `control-client.ts`; a new request answered as unknown or an optional field preserves it, as does additive optional public task metadata in `ui_snapshot` that older clients ignore (such as `deps` in #246). When `PROTOCOL` advances, the release PR adds a row to `BRIDGE_PROTOCOL_RELEASES` (`src/hub/protocol-window.ts`), leaves the prior row frozen and runs `bun scripts/bridge-protocol-table.ts --write`.
36
+ - Bundle closure and the light path (#1778): the plugin bundle carries what `src/adapters/claude-channel.ts` imports, so it must not reach `src/hub/conductor.ts`, `src/hub/tasks.ts` or `src/hub/tooling.ts` (`test/channel-import-closure.test.ts`; instance configuration comes from `src/adapters/declaration-data.ts`), and `bun scripts/build.mjs --check` fails a stale bundle. `src/cli/light-dispatch.ts` (#1778 T7) runs `version` and `instruction-hook` from their `src/cli/commands/` modules without `main.ts` or `src/hub/config.ts`, and only when no agent, recovery or project marker is in the environment; `bun scripts/check-import-graph.ts --check` fails an import that reaches the shared setup from those entries.
36
37
  - `hub_invoke` over the control WS (#445, #991): the daemon binds each admission to its socket and `rid` with an `AbortController` (`invocationRequests`, at most 64 per connection; a duplicate `rid` refuses). `request_cancel` and socket close abort it, and every check after an await confirms the socket is open and still maps that `rid` to the same controller before any effect. Clients go through `ControlClient.request`, whose `controlRequestTimeout` raises a `hub_invoke` wait to `INVOCATION_CONTROL_TIMEOUT_MS`; never call it with a shorter bound.
37
38
  - Control write outcomes (#1106, `src/hub/tool-request.ts`): `toolWriteOperation` is the one list of writes whose transport result can be lost (`hub_task_propose`, `hub_review`, `delivery_complete`). After a timeout, a cancel or a closed socket, `ControlClient` answers `outcome: unknown` with the settling read (`toolWriteUnknownReply`), never a plain failure. Replay goes only through `ToolWriteRegistry`, keyed by `requestId` and `toolWriteScope`, with one bucket per actor. `toolWriteCurrent` rechecks authority and privacy before a retained result is returned. The channel strips MCP `request_id` before `taskOp`, and `Tasks` never reads it. An explicit key is refused before sending to a hub without `tool_write_idempotency`. `delivery_complete` keeps the journal's idempotence and never uses the registry. A new retryable write joins `toolWriteOperation`; never add a second key path.
38
39
  - Control-write diagnostics (#1126, `src/hub/control-write-trace.ts`): `onControlMessage` wraps the original `onMessage`, keeps its name for the native-branch ratchet, and returns to it untraced before any argument traversal for a client that is not admitted. Privacy guards are factories over primitives (`controlWritePrivacyGuard`), raw-input screens are passed as lazy admission-only callbacks and never retained, and an expired trace is settled and suppressed without touching the operation. Never add a timeout, retry or authority decision to this path; a new boundary is one more closed `ControlWritePhase`, and a test that extracts these closures binds the real guards (tests.md).
39
40
  - `peer_stop` is the console's or an admitted conductor's (`admitOperational(sock, "stop")`) and stops, through its adapter, only an owner whose adapter reports `hubOwned === true` and whose `form` is not `tui` (today headless ACP, Pi, local, print-reviewer, configured print and Claude implementer); a present `undefined` form refuses. Refuse native-terminal peers and recovery-held mutations; serialize with starts and permission changes, and refuse a recovery `prepare` while a stop runs. An admitted stop holds delivery through `BusOptions.deliveryHeld` before any teardown await (never a console pause that resume can undo, or a global recovery hold that blocks unrelated peers) and withdraws the peer's pending approvals before the adapter stops. A requested stop holds an in-flight delivery as `needs_review` with an ids-only stop reason, suppresses restart/escalation, and never resolves that delivery automatically.
40
- - Console review guidance (#711): `r` on a task in review opens `reviewChoice` (`src/cli/console-review.ts`, modelled on `modeChoice`) from the row or the open task detail, never a bare prefill; `a` and `c` prefill `review N approved|changes_requested ` with a guide line, a `changes_requested` line with no note is refused in `reduceConsole` before any effect, and the result of a review command is shown as a notice in panels mode (`reviewResult`). The console only prefills and runs `ahub review` as the person: never grant it extra authority, and keep a private task's title out of the choice line (`[pii]`). The CLI cause line (`agentShellCause`, `src/cli/identity.ts`) is printed for the `tools` identity and a person-only hub refusal only, never for the console identity, and never replaces the refusal.
41
+ - Console review guidance (#711): `r` on a task in review opens the choice built by `reviewChoiceFor` (`src/cli/console-review.ts`, modelled on `modeChoice`) from the row or the open task detail, never a bare prefill; `a` and `c` prefill `review N approved|changes_requested ` with a guide line, a `changes_requested` line with no note is refused in `reduceConsole` before any effect, and the result of a review command is shown as a notice in panels mode (`reviewResult`). The console only prefills and runs `ahub review` as the person: never grant it extra authority, and keep a private task's title out of the choice line (`[pii]`). The CLI cause line (`agentShellCause`, `src/cli/identity.ts`) is printed for the `tools` identity and a person-only hub refusal only, never for the console identity, and never replaces the refusal.
41
42
  - Console changed-symbols block (#684 2b): `symbolFields` (`src/cli/console-symbols.ts`) adds `symbols` after `plan` for a task_show-shaped detail only, from the public `codeSymbols`; never from a raw `Task`, never for a private task, never from a stored receipt (one with `repositoryKey` reads as unknown: only the screened public receipt is shown), never as a second copy of the match rule (`planSymbolMatches` in `review-brief.ts`). Unknown is `unknown (no code facts)`, never an empty list.
42
43
  - Console Queue `D` (#713) only prefills `queue discard --peer <selected row's peer> --reason `; Enter refuses a missing peer or reason and arms a `y` confirm that names the count, then runs the person's `ahub queue discard ... --yes`. Without `--state` the confirm counts the peer's queued and unsettled failed rows; the console sends that form only when the hub's `features` list `queue_discard_states`, otherwise it sends `--state queued` (#1103). Beyond `list`, the `queue` op is the console's or an admitted conductor's (`admitOperational`, `show`/`resolve`/`discard` only); `discard` without `confirmed` only counts, and a confirmed one needs a reason, is refused during recovery or shutdown and discards row by row through `resolveDelivery` (rule: `bus.md`).
43
44
  - Console Usage panel (#683 U3): tab `7`, text from `src/cli/console-usage.ts` (pure strings, no terminal or state import), rendered in `console-state.ts`, fetched in `console.ts` `refresh()` only while panel 7 is open. It reads the `usage` op and nothing else: no event-log read, no board field beyond the task id selected in Tasks. A refusal shows `usage unavailable`, never empty usage; an unknown counter is `unknown`, never 0; a private task is `#id [pii]` from the op's `taskPii`, never a title. The `usage` op folds with `catchUp(250)` and answers `behind: true` when it is not done: never answer from one pass of a big log. Keep Left/Right from 7 wrapping like Settings so the `1`..`5` cycle (#309) stays pinned, and keep PAUSE and 7D out of the width drop list.
@@ -46,7 +47,8 @@ Scope: the operator console, control WS and its protocol, state files, the dashb
46
47
  - Dashboard Usage view (#683 U4): `uiSnapshot` builds `usage` only when the request's view is `agents`, never on a hidden view's poll. It folds with `catchUp(100)` and sets `behind: true` when that is not done, so a partial figure is never shown as the whole. A failed read answers `{ unavailable: true }`, never `undefined`, which the page reads as a hidden view and keeps the old figures. The snapshot carries task ids, a `pii` flag and numbers only, never a title; the page shows a private task as `#id [pii]`. Daily figures come only from `UsageRollup.daily` (rule: `budget.md`).
47
48
  - Dashboard Code group (#684 2c): `codeGroup` (`src/hub/task-code-group.ts`) is the only dashboard classifier of changed symbols against `plan.symbols`, called in `uiSnapshot` with the public `codeSymbols`, `tasks.publicMetadataText` and `tasks.isPii`; the page (`codeGroupSection`) draws it and never matches names. A private task gets no `codeGroup`. A stored receipt (one with `repositoryKey`), a missing or an unknown one is `state: "unknown"`. A malformed or screened-out plan name is counted in `planWithheld` and marks the group incomplete, never dropped. Lists stop at `CODE_GROUP_MAX` (40) with the rest in `more`, and `counts` are totals. The memory view reads a `node` of up to 512 characters only when it starts with `symbol:` (200 otherwise).
48
49
  - Worktree shelf (#1057, `worktreeShelf` and `worktreesView` in `src/hub/daemon.ts`; spec `docs/design/task-board.md`): never add a worktree or branch removal to the daemon (its only one stays the empty hub-made task worktree in `src/hub/task-worktree.ts`); shelf removal exists only in the person's `ahub worktrees tidy --confirm` (`src/cli/worktree-tidy.ts`), which `daemon.ts`, `worktree-shelf.ts`, `board.ts`, `ui.ts` and `plugin.ts` never import. GitHub is read only by `worktrees_refresh_prs` (`refreshPrStates`); a snapshot, `ahub worktrees` and the inbox alert never reach it, and `worktreesView` answers from its 30 s cache without awaiting git. The `worktrees` read is open to a tools caller outside a private turn; override set/clear and the refresh are console-only and refused for a live-test dashboard session. After the awaited git reads, ask the recovery/stopping fence again, then read and write the board with nothing awaited between. The board keeps only the person's Park/Pin (`worktree_override`), never a derived settled state, and accepts one only for a path the shelf just listed, never the main checkout or an instance worktree.
49
- - Agent CLI drift (#843 AC3): the daemon's `sweepAgentDrift` (once after start, then `agentDriftEveryMs`, default one day, on its own timer apart from the task sweep) is the only caller of `noticeDrift` (`src/hub/agent-drift.ts`). It reads versions only through `agentVersionsAsync` (`src/cli/agents.ts`), which shares `probeTarget` and `probeRow` with the `ahub agents` probe: never add a second probe path, a network read or an install. The first probe is owed until one has run (`agentDriftOwed`): a daemon that starts inside a controlled recovery skips it and the 1 s tick pays it once `recoveryActive()` ends, so a restart or upgrade never waits a day for the first notice. `startDaemon` probes only when `agentDrift` is set (`lifecycle.ts` sets `true`; tests inject a function), so a test daemon never spawns a real CLI. Drift is an installed executable with a readable version whose state is not `verified`; a missing or unreadable one is silent. The notice carries id, version, state and the receipt path only, is marked per (id, version, planner) in `agent_drift_notices` before it is published to that planner alone (and forgotten if it cannot be queued, so only that planner is retried), and goes to `plannerPeers()` that are rostered; with none, nothing is recorded. `agentVersionsAsync` reads stdout as a stream with the 64 KiB cap enforced as it arrives (kill and cancel on overflow) and cancels the reader at its deadline and a short grace after the probe exits, so a descendant holding the pipe cannot hang it. Never put CLI output in it.
50
+ - Agent CLI drift (#843 AC3): the daemon's `sweepAgentDrift` (once after start, then `agentDriftEveryMs`, default one day, on its own timer apart from the task sweep) is the only caller of `noticeDrift` (`src/hub/agent-drift.ts`). It reads versions only through `agentVersionsAsync` (`src/cli/agents.ts`), which shares `probeTarget` and `probeRow` with the `ahub agents` probe: never add a second probe path, a network read or an install. The first probe is owed until one has run (`agentDriftOwed`): a daemon that starts inside a controlled recovery skips it and the 1 s tick pays it once `recoveryActive()` ends, so a restart or upgrade never waits a day for the first notice. `startDaemon` probes only when `agentDrift` is set (`lifecycle.ts` sets `true`; tests inject a function), so a test daemon never spawns a real CLI. Drift is an installed executable with a readable version whose state is not `verified`; a missing or unreadable one is silent. The notice carries id, version, state and the receipt path only, is marked per (id, version, planner) in `agent_drift_notices` before it is published to that planner alone (and forgotten if it cannot be queued, so only that planner is retried), and goes to `plannerPeers()` that are rostered; with none, nothing is recorded. `agentVersionsAsync` reads stdout as a stream with the 64 KiB cap enforced as it arrives (kill and cancel on overflow) and cancels the reader at its deadline and a short grace after the probe exits, so a descendant holding the pipe cannot hang it. Never put CLI output in it. The one network read, `ahub agents --latest` (#1808 T5, `src/cli/agents-latest.ts`), is person-run and the daemon never imports it, so no hub path reaches the network for it.
51
+ - Orca pane watch (#1811 T2, `OrcaPaneWatch` in `src/hub/orca-state.ts`): ask Orca only about a peer whose oldest delivery stayed unaccepted for 2 min and whose live launch record names a pane, at most once a minute per peer, with one `orca agent list --json --worktree id:<id>` read killed at 5 s, and never during recovery. Only a unique `blocked` or `waiting` row for that `paneKey` becomes an Attention item; an error, a timeout or any other shape clears it, and the hub never answers the prompt.
50
52
  - SDLC band timer (#481 S7): the daemon's band interval (`bandsEveryMs`, default 5 min) is the only caller of `tasks.proposeFromBands`. It skips while stopping or in recovery, when `tasks.bandsState()` is not ready or `bandsHeld` holds, and when `board.statusRevision()` with the band signature is unchanged since the last pass that ran; it records that key after the write. A failure is one sanitized `hub.log` line. Writer rules: `tasks.md`.
51
53
  - `ahub board` (#724): `renderBoard` prints one line per task only with a terminal width and without `--full`; `--full`, `ahub task show` and output without a width keep the full table and SDLC advice. `STAGE_CODES` (`src/cli/output.ts`) keys on blocker-text prefixes from `src/hub/sdlc.ts`: rewording a blocker there updates its code in the same PR. TITLE is cut, never wrapped; STAGE is never dropped (it falls back to the meter and the code); a PII row keeps its `(ahub task show N)` hint while 8 title columns remain.
52
54
  - CLI output default (#814): a command prints for a person unless `--json` is given. The recovery and upgrade commands follow it too (`src/cli/upgrade-output.ts` composes `planLines`, `renderPlan`, `renderOperation`, `renderBlocked` and `choiceInstruction`, so the non-interactive text never says what the screens would not): a pipe and `--dry-run` print the plan with blockers, reconnect-only and fresh-start peers in stdout, `--json` keeps the document and the stderr lines (#206), and `recoveryDisplay` takes a pipe's width from `COLUMNS`. Hub tool text (`task show`, the backlog and release commands) is parsed on the CLI side by `showToolText` and rendered by `src/cli/task-output.ts`; `--json` prints the text byte for byte, unparseable text prints as it came, and a private task is rendered as the stub the hub sent, never asked for more. A command that takes free text reads `--json`, `--full` and `--color=` through `splitPresentation` (`edges`): only a leading or trailing run is a flag, and a value flag's value never is, so a reason keeps its words. `test/cli-json-guard.test.ts` also scans every file in `src/cli/` for a print of a hub tool's text (`console.log(await taskOp(<op>))`, or `console.log(x)` where `x` is bound from one) and passes only when the print is inside a `--json` branch, the op is in the named `SENTENCE_OPS` (ops whose daemon case returns prose, each checked against the daemon), or it is named debt with a reason (`TEXT_DEBT` for JSON ops a later task converts, `CONDUCTOR_DEBT` for the conductor-role commands, `REFUSAL_FALLBACK` for the refusal sentence printed after `--json` and the table were handled); a new JSON-returning op printed bare fails it, and an entry that matches no print fails too. Convert a command by rendering it through `showToolText`, never by adding it to a list. A renderer is a pure function in `src/cli/` (`sdlc-output.ts` for the `sdlc` read commands) and the call site keeps its own visible `if (options.json) console.log(JSON.stringify(...))`, so `test/cli-json-guard.test.ts` can see the branch. Never print JSON by default: add the command's `--json` branch, or name the site in the guard's `DATA_FORMAT` (JSON by purpose: `export`, `sdlc export`, `bench export`, the PreToolUse hook reply) with its reason. The guard accepts a `--json` branch only when the condition PROVES the flag (`selectsJson`): `X.json` on an option holder (`options`, `display`, `present`), `args|flags.includes("--json")`, a known alias, `&&` when either side does, `||` only when both do, `=== true`. Anything else (`!x`, `=== false`, `|| other`, `?? x`, a comparison, an unknown name) is not a guard, so a new shape fails until it is written one of these ways. A renderer table never exceeds the terminal: `grid` (`sdlc-output.ts`) wraps cells, then falls back to one labelled block per row, and keeps every identifier whole. `NOT_YET_CONVERTED` is debt the later #814 tasks delete; an entry that matches no site fails the test, so the list only shrinks. `sdlc` drops `--json`, `--full` and `--color=` from its operands only for its read subcommands (`sdlcOperands`): the others keep their argv exactly. A hub tool's JSON text that does not parse prints as it came, never as an empty report.
@@ -66,13 +68,16 @@ Scope: the operator console, control WS and its protocol, state files, the dashb
66
68
  - `ahub setup` reads Claude Code's state from `--json` listings and takes one step at a time, re-reading after each; never match paths or names by substring. It installs and judges only the `user`-scope agent-hub plugin row; a `project` or `local` row is reported as preserved and never removed, and a marketplace removal that would remove one is blocked, not run (#1073).
67
69
  - A copy of the git index keeps the original's mtime (`snapshot()`): git's racy-entry check compares entries with the index file's time in whole seconds, and a fresh copy makes a same-size edit look clean.
68
70
  - State files that clients read (`status.json`, `control-token`) are written after the port is bound, and `status.json` via temp file + rename.
71
+ - Project context (#1779 T2): daemon code takes its root, state directory and child environment only from `ctx` (`daemonProjectContext` or `hostedProjectContext`, `src/hub/project.ts`), and a child bound to the project gets its variables only from `projectChildEnv(ctx)`. Never read `process.cwd()`, `AGENTHUB_STATE_DIR` or `AGENTHUB_PROJECT_DIR` under `src/hub`: `scripts/check-process-identity.ts` (run by `test/process-identity-check.test.ts`) fails such a read unless its exact line is on `ALLOWED` with its side and reason, and fails a stale entry.
72
+ - Shared host (#1779 T3a, `src/hub/host.ts`, `ahub host`): `host.shared` (off by default) runs a project's daemon in the one `Host` of its runtime. Only the winner of `Registry.claimHost` serves `hosts/<hash>.sock` or removes a stale one; a loser joins the answering host through `askHost` or fails closed, and a recovery operation or live test never runs shared. Launch a hosted project only through `launchHostedProject` inside `Host.within(id, ...)`, so an uncaught error stops that project alone; an unattributed one stops the whole host.
73
+ - MCP endpoint (#1780, `startMcpEndpoint` in `src/hub/mcp-endpoint.ts`): it starts only when the lifecycle passes `mcpHome`, so a test daemon never writes into the person's hub home; `run/` and `run/<projectId>/` stay `0700` and this user's, `mcp.sock` `0600`, and a refusal is logged while the hub runs without the endpoint. A session opens only on a valid hello (the control token compared in constant time, within 5 s and 8 KiB, from a pid `ps` reports as this user) and keeps an account label, never the home path. Only an `exclusiveOwner` daemon (it holds its fixed control port) replaces a stale socket, after a refused connect and the same inode on two `lstat`s; never add another unlink path.
69
74
  - Open native memory through the shared profile-aware helper with an explicit current selector binding; never fall back to shared v1 after invalid/missing generation metadata. Check that binding at hub call-site entry and before candidate/counter writes, including callbacks retained across awaits; do not intercept store methods with proxies/private hooks or claim atomic in-flight cutover. Quiesce and close consumers before migration/selection changes, then reopen through the supported lifecycle. Keep the sidecar at the independent memory root, not inside the selected generation. Report memory availability separately from bus health; never hot-rebind or migrate as a startup repair (`docs/memory.md` §Selected memory profile).
70
75
  - Take the memory project only from `memoryProjectFor` (the alias-resolved `memoryProjectKey` in the ambient memory home) in the daemon, `ahub memory` and `ahub goal`, or from `memoryProjectForStore` for a caller-injected store, which resolves the alias in that store's own `profile.home`; bind an injected sharded store with `bindProfileMemory(store, _, memoryProjectKey(cwd))` so a remap latches it unavailable; never use a raw `memoryProjectKey` as the project of a store, screen or raw command. The daemon resolves it once at start (falling back to the raw key, so the memory home never blocks startup) and passes both `project` and the raw `projectKey`, so the binding latches unavailable once the alias log maps the key elsewhere; a restart binds the new key.
71
76
  - Ask whether a curated store holds a derived index only through `memoryIndexExists` (`src/hub/memory-profile.ts`, read-only directory listing): agent-mem names the file per index version (`index.db`, `index-v4.db` since 0.25.0), so never test or open a fixed `index.db`.
72
77
  - Detect a curated split by `lstat` of `shards.json` (`splitMarked`), never `existsSync`. An inactive, malformed, dangling or unreadable marker throws `MEMORY_SPLIT_INCOMPLETE` before any shard read, and callers show that message instead of the generic profile refusal. On a split home open only through `openShardStore` with the canonical memory dir and a project key; never a plain `MemoryStore`, and refuse without a key. Profile inspection and `profile-check` on a split home read the shard seals (`shardProfileForProject` for each hub's own project), never the legacy selector (#536).
73
- - The channel's reconnect loop stops on closes a retry cannot fix (`TERMINAL_CLOSES` in `claude-channel.ts`); a new daemon close code that means "do not come back" belongs there, or two clients fight over it forever.
74
- - The channel advertises `tools.listChanged`; build its tool list only through `toolListFor` and record `listedTools` from each `ListTools` reply, so a reconnect sends `sendToolListChanged` when the whole definitions differ or the lifecycle stays unreadable (#490).
75
- - Close 4000 is the one close that ends on its own, so it is not in `TERMINAL_CLOSES`: the session stands by and reconnects only once `status.json` reports the peer offline and not `claiming`. One exception (#205, `peerHeld` in `claude-channel.ts`): a session with channel pushes also reconnects when the holder is reported `toolsOnly` and not `claiming`, and takes the peer; the daemon refuses the reverse with 4000. Reconnecting blind would evict whoever holds the id now, and the two would trade it forever. `status.json` is advisory: a reconnecting standby sends `standby: true`, and the daemon refuses it with 4000 while `standbyHeld` holds (a claim, or an open socket; only a channel-capable standby may replace a pull-only holder). A hello whose `launchId` differs from this instance's current `claude-launch` record closes with 4430, which is in `TERMINAL_CLOSES`; no launch id or no record keeps the old admission (#551). `claim()` happens at hello and `attach()` only after the preface, so the peer reads as offline in between: the daemon writes the status file at the claim and the flag covers that window.
78
+ - The channel's reconnect loop stops on closes a retry cannot fix (`TERMINAL_CLOSES` in `claude-channel.ts`); a new daemon close code that means "do not come back" belongs there, or two clients fight over it forever. Close 4426 (wire version mismatch) is not terminal: the session logs the cause and retries every `WIRE_MISMATCH_RETRY_MS` (5 min), so an upgraded hub takes it back without a restart.
79
+ - The channel advertises `tools.listChanged`; build its tool list only through `toolListFor`, a wrapper of `mcpToolList` in `src/hub/mcp-bridge-core.ts`, which also holds the instructions (`mcpServerOptions`); both take explicit `McpSurface` values and read no environment or file, so the MCP endpoint (#1780 T2a) can share them. Change the channel's tools or text there. Record `listedTools` from each `ListTools` reply, so a reconnect sends `sendToolListChanged` when the whole definitions differ or the lifecycle stays unreadable (#490).
80
+ - Close 4000 ends on its own (4426 retries on its own timer, above), so it is not in `TERMINAL_CLOSES`: the session stands by and reconnects only once `status.json` reports the peer offline and not `claiming`. One exception (#205, `peerHeld` in `claude-channel.ts`): a session with channel pushes also reconnects when the holder is reported `toolsOnly` and not `claiming`, and takes the peer; the daemon refuses the reverse with 4000. Reconnecting blind would evict whoever holds the id now, and the two would trade it forever. `status.json` is advisory: a reconnecting standby sends `standby: true`, and the daemon refuses it with 4000 while `standbyHeld` holds (a claim, or an open socket; only a channel-capable standby may replace a pull-only holder). A hello whose `launchId` differs from this instance's current `claude-launch` record closes with 4430, which is in `TERMINAL_CLOSES`; no launch id or no record keeps the old admission (#551). `claim()` happens at hello and `attach()` only after the preface, so the peer reads as offline in between: the daemon writes the status file at the claim and the flag covers that window.
76
81
  - Peer takeover (#1174): `peer_takeover` is console-role only, with closed fields (`peer`, optional `standbyId` of at most 64 characters, no control or format characters), and `ahub peer takeover` is in `liveTestRefusal`. It refuses without detaching the owner when no eligible standby remains, and answers `outcome: "requested"`; attachment is confirmed only by status. A connection detached by the person (`detachedByPerson`) refuses every peer request with the fixed detached text, and the plugin stops reconnecting on 4405. Never treat a standby id or reported PID as session, launch or permission evidence.
77
82
  - Channel push evidence (#1171): the plugin pushes only when `currentClaudeChannelEvidence()` (`src/adapters/claude-channel-evidence.ts`) reads `development-channel-launch` from the direct parent's bounded process row. The inherited `AGENTHUB_CHANNEL` marker alone, or unknown, malformed or changed-parent evidence, keeps it tools-only. The hello's `channelEvidence` is a closed, display-only label: an unlisted value becomes `unknown`, a missing one `unreported`. Never admit, deliver or authorize from it, and never walk ancestors.
78
83
  - Adding a native peer requires testing the command emitted by the actual recovery driver, not only its inspection or launch helpers. Never let a generic non-Codex branch treat a new peer as Claude.
@@ -175,7 +180,7 @@ Scope: the operator console, control WS and its protocol, state files, the dashb
175
180
  - Experiment comparisons (#599): preserve the separate conditional `research_comparisons` floor and integrity for plans, exact protocol/evaluator approvals and causal protocol-context rows. Never backfill legacy order from timestamps or carry approval to a changed hash. Keep the approval op under the console-only `study_` dispatch guard.
176
181
  - Doctor memory capture (#1008, #1025): the `memory capture: <tool>` rows come only from `amem setup <tool> --json`, a preview that writes nothing (`readMemorySetup` in `src/cli/main.ts`: no shell, 10 s, 256 KiB), judged by the pure `nativeMemoryCaptureRow` (`src/adapters/definitions/native-cli-doctor.ts`). A plan not in the documented shape, a non-zero exit, a timeout or unparsable output is unknown, never ready; never read dotfiles text or a client's config, and do not scrub the caller's identity before the call.
177
182
  - Handoff transport (#604): `handoffOut` connects to the target as a `console` role through `ControlClient` (same token file and machine user as every control message; the hello checks the target's project root and instance), and the target answers every handoff message, an unknown one included. `handoffNotifyOrigin` hangs off `board.onChange` inside its own try, so a task move never waits for, or fails because of, another project's daemon. A target is judged by its own `status.json` features (`checkTarget`), never by a guess from its version. The inbound `task_handoff` is refused while recovery is active, counts in `taskOpsInFlight` so a recovery commit waits for it, and hands `handoffIn` a fence (recovery or `stopping`) that it asks again right before the board write, after the PII screen's await. Keep `task_handoff` in `DAEMON_FEATURES` and its recovery guard beside `research_experiments`; no `PROTOCOL` bump, because a new message type is answered as unknown by an older hub and an optional field is ignored. Handoff diagnostics (#1203 T3): a connection failure to a target is classified by `handoffConnectFailure` from the error's `code` (4426, 4404, `AHUB_CONNECT_TIMEOUT`, anything else), never from its message, and every handoff failure log goes through `handoffLog`, which keeps the last cause per target (`handoffFailures`, read by `handoffListView`) and rate-limits the line with `handoffLogGate`; a new silent `catch` in the handoff block is a defect. `handoffListView` opens no connection (registry and descriptor files only), so `--list` never waits on a target. `hub_task_handoff_sync` is a control op and not in `hub-tools.ts`: an agent never sees it, and `Tasks.handoffSyncAuthority` refuses anyone but the person or the conductor. `handoffCatchUp(only, wait)` with `wait` waits for the running pass and then runs its own, so a sync answers after a pass that began when it was asked, but never for longer than `handoffSyncBoundMs` (20 s, below the CLI's 30 s control timeout): a slower pass makes it answer `syncing: true` with the list, and a sync must never end in the generic "no answer from the hub". Handoff sequence (#1203 T2): `recordHandoffOutbound` applies a write with a `seq` only when it is newer, inside the one statement; `handoffEvent` returns `recorded: false` for a stale one before it publishes, so never publish a follow-back before the write says `applied`. `handoffCatchUp` reads `handoffOutboundOpen` (no cap; `handoffOutbound` is the capped display list, never the catch-up's input), runs one pass at a time and queues a request that arrives meanwhile (the targets it names, or all) to be drained when the pass ends, so the guard never drops a watcher's request; `handoffWatch` asks once for the whole changed set; it asks in chunks of `HANDOFF_STATES_CHUNK`, and checks `stopping` between requests; its timers go in `intervals`. A new handoff event goes only to an origin that advertises `task_handoff_seq`. Handoff key (#1203 T1): `handoffOut` sends a key only to a target whose status descriptor lists `task_handoff_key`; a timeout or closed connection (`handoffOutcomeUnknown`, which reads the client's fixed wording and anchors it) is resent once with the same key, then asked by key (`task_handoff_by_key`), then `outcome_unknown`, never `invalid`. A refusal of the resend never settles an unknown first attempt (its PII screen may still file the task): it is kept as a note and the by-key lookup still runs. The caller's deadline covers the whole recovery: `controlRequestTimeout` gives `hub_task_handoff` `HANDOFF_CONTROL_TIMEOUT_MS`, built from the same `HANDOFF_*` budgets `handoffOut` spends, so the CLI and the MCP path (both ask for 30 s) receive `outcome_unknown` with the key instead of a generic timeout; change a budget there and the deadline moves with it. Never write the outbound row before an answer, and never reset an existing one (`handoffSent`). The follow-back envelope carries `refs.handoff` and no `refs.task`: a new envelope field that names a task in another project must not reuse `refs.task`, which the bus judges against this board.
178
- - Staged upgrades (#1039): retain `status.protocol` at the compatibility floor and publish `protocolMin`/`protocolMax`; negotiate the highest common control version and preserve each attached channel's actual negotiated protocol in recovery metadata. New scoped recovery receipts use schema 3 and per-project holds; keep legacy unscoped receipt behavior. Start ordinary project daemons from verified versioned release captures. Check `hub.db` with `db-schema.ts` before startup effects and every writable opener; advance its marker only with an incompatible format migration, never merely on opening with a newer binary. Before source replacement, controlled targets require `schema_guard`; preserve the retained target evidence of fully committed legacy receipts. Unguarded published binaries remain outside the bootstrap guarantee. Keep project runtime selection in bounded project-bound `runtime.json`; refuse Git-tracked or indeterminate repository state before using or replacing that authority. Updated 0.26+ up/manager/dashboard paths use its verified capture or a named version refusal. Preserve the explicit pre-0.26 published-CLI ceiling with a `ponytail:` note; never raise a DB/bootstrap floor for this selection. Compute path-scoped Git trust once per startup outside the writer lock; reuse its project-bound access for runtime reads and writes. Record selection and synchronous launch under the same registry lock used for capture publication and prune quarantine; confirm the unchanged selection and owner at readiness, and require the internal daemon to execute from that exact root. Scoped recovery must not refresh the shared manager. Prune only verified unreferenced versioned source captures, keep newest three/version, and defer on active recovery, unknown reference inventory or exhausted budgets. Schedule rate-limited maintenance after startup returns; keep only bounded metadata validation and atomic quarantine inside the registry writer lock, with candidate hashing and recursive deletion outside it. Refuse managed execution from reserved `.runtime-prune-*` paths; leave changed quarantine contents undeleted. Keep the 1 ms ledger wait on startup admission only; worker statements use the normal bounded wait. Record PID plus process signature and replace only a proven-gone running owner atomically under the admission transaction, with id/phase-fenced completion. Doctor names uncertain ledger state and leftover quarantine paths without repairing or deleting them. Reject empty recovery plans before source preservation.
183
+ - Staged upgrades (#1039): retain `status.protocol` at the compatibility floor and publish `protocolMin`/`protocolMax`; negotiate the highest common control version and preserve each attached channel's actual negotiated protocol in recovery metadata. The accepted window is `acceptedBridgeWindow`: `bridgeProtocolWindow` over `BRIDGE_PROTOCOL_RELEASES`, the wider of `upgrade.bridge_window_days` (default 90) and the last `upgrade.bridge_window_min` protocol rows (default 3), validated by `bridgeWindowSettings` and clamped to `PROTOCOL_MIN`..`PROTOCOL`; a hello outside it closes 4426. New scoped recovery receipts use schema 3 and per-project holds; keep legacy unscoped receipt behavior. Start ordinary project daemons from verified versioned release captures. Check `hub.db` with `db-schema.ts` before startup effects and every writable opener; advance its marker only with an incompatible format migration, never merely on opening with a newer binary. Before source replacement, controlled targets require `schema_guard`; preserve the retained target evidence of fully committed legacy receipts. Unguarded published binaries remain outside the bootstrap guarantee. Keep project runtime selection in bounded project-bound `runtime.json`; refuse Git-tracked or indeterminate repository state before using or replacing that authority. Updated 0.26+ up/manager/dashboard paths use its verified capture or a named version refusal. Preserve the explicit pre-0.26 published-CLI ceiling with a `ponytail:` note; never raise a DB/bootstrap floor for this selection. Compute path-scoped Git trust once per startup outside the writer lock; reuse its project-bound access for runtime reads and writes. Record selection and synchronous launch under the same registry lock used for capture publication and prune quarantine; confirm the unchanged selection and owner at readiness, and require the internal daemon to execute from that exact root. Scoped recovery must not refresh the shared manager. Prune only verified unreferenced versioned source captures, keep newest three/version, and defer on active recovery, unknown reference inventory or exhausted budgets. Schedule rate-limited maintenance after startup returns; keep only bounded metadata validation and atomic quarantine inside the registry writer lock, with candidate hashing and recursive deletion outside it. Refuse managed execution from reserved `.runtime-prune-*` paths; leave changed quarantine contents undeleted. Keep the 1 ms ledger wait on startup admission only; worker statements use the normal bounded wait. Record PID plus process signature and replace only a proven-gone running owner atomically under the admission transaction, with id/phase-fenced completion. Doctor names uncertain ledger state and leftover quarantine paths without repairing or deleting them. Reject empty recovery plans before source preservation.
179
184
  - Questions (#1053, `src/hub/questions.ts`, `src/hub/question-desk.ts`): the store owns the row and its ONE terminal transition (`UPDATE ... WHERE state = 'open'`; of concurrent answer, stop and expiry exactly one sees `changes === 1`), the desk owns the waiting call and the hub-built envelope, and the daemon only supplies ports. Keep `questions` console-only and ordinary person answers unchanged. Permit `hub_ask_answer` and instructed `answer` only for the current unique conductor on the person's explicit per-set instruction in its own session; require a non-empty quote, open public set and public caller, and refuse self-answer, wrong actor, live-test/delegated execution and child/tools ownership. Never infer instruction from hub/task/review/file/peer text, permit blanket delegation or answer across projects. Keep every control rid answered and retain the existing question validation/one terminal transition. Read `docs/security.md` "Questions a peer asks the person" before changing this exception or its #1328 precedent. Persist the instruction quote only in hub.db; remove it from all read views, tool responses, envelopes, logs, events and capture. Publish only actor/instructed provenance (including `agent_cli`); include `hub_ask_answer` in the existing question capture/progress exclusions. Nothing a peer sends as a `hub_send` body, tool result or ordinary envelope is parsed as an answer. A late answer is `kind: "answer"`, `from: user`, id `answer-<set>` (so a republish after a crash is dropped by the bus's own dedupe) with `refs.question`; an expiry notice is `kind: "status"` from the hub, never an answer. Supersede keys on `from === USER && kind !== "answer"` in the bus tap, never on the body, and never on the hub's own answer envelope. Question text and answers are stored in hub.db; the answer envelope goes only to the asking peer, while person surfaces use `questionView` (instruction quote removed). The `answeredQuestions` dashboard, CLI and Acon projections include only non-private, non-PII rows. The tap's log line, `redactBusEvent` and the `question` event stub question/answer text; `QUESTION_TOOLS` skips capture and the progress observer skips `hub_ask`. `hub_ask` holds its control request open (`controlRequestTimeout`, `request_cancel` through the shared `invocationRequests` map, so a closed socket or an aborted turn cancels the row) and Pi's bridge lifts its idle timeout for that one call. A new peer kind gets `questionWaitMs` on its definition (fixed builtins only, `assertNativeCapabilityScope`), never a wait chosen by the caller. The `questions` feature label is a recovery label: an older target ignores the table, so keep it in `DAEMON_FEATURES`. Start repair runs once after `ready`'s locals exist (`questionDesk.repair()` just before `ready = true`), and the sweep timer is pushed only after the desk exists.
180
185
  - Completions (#1054 T2/T3, `src/hub/completions.ts`, `src/hub/completions-store.ts`): a run opens at the `turn_start` that consumes a `from: user` delivery (never the hub's own `answer`), only for a peer whose definition declares `settle`. An unattached pull-only peer creates none; a launcher-bound Kimi TUI opens one only after native readback proves a person origin. `settleCheck(peer)` is the ONE settle check and never throws; call it from every place a pending-work fact can change (turn end, `bus.onQueues`, a permission or question closing, an isolated check ending, `Tasks.checkEnded`, a native task notification or a native-background re-read). The bus takes a delivery out of its queue before the peer's idle reaches the state tap, so `queuedContinuations` also counts `dispatching` rows and `deliveredAwaitingTurn` (bounded to 10 s, `ponytail:` in the code); drop either and a continuation reads as nothing pending. Claude settles only on the verified native Stop (a lost channel or watchdog carries no id and never settles). Kimi TUI settles only on correlated final-turn readback plus a known-empty background inventory; a running or unknown inventory and an active native turn stay working. A `limit` or budget pause ends the run with no completion (`budget.record`), an explicit stop calls `quietStop`, and `completions` is a recovery feature label (`hasPending`: an open run or an unread completion). The store keys a completion by the run's first turn id (`UNIQUE`), so repeated restarts yield one `interrupted` completion; never reconstruct from `events.jsonl`, which cannot say who started a turn. Launcher end/socket loss also settles an open run `interrupted`, once. Receipts (#1054 T4/T5): `completion_receipts` has a UNIQUE index on `completion_id`, so `markSeen` is one compare-and-set and a mark-unread has exactly one row to delete; `result_seen` and `results` are console-role control cases (rid always) placed before `case "kill"`, and nothing else writes a receipt: never mark read from a snapshot, a status read, a listing or an envelope. The `result` need is level `watch` and is not in the `waiting`/`blocked` lists in `needs()`; keep it that way so a result never reads as something to act on. Reconstruction drops an open run whose peer has a budget pause record before it would settle it `interrupted` (persist before remove, per run), and `CompletionStore.prune` bounds the table to the newest 500 read completions at start; never prune an unread completion or an open run. The title of a result is computed at display (`resultView`), a stub when private, and no prompt or reply text is ever stored. Native-person results always stay private.
181
186
  - `src/ui/roadmap-model.ts` and `src/ui/overview-model.ts` (#1514) are injected into the page by source (`/* ROADMAP_MODEL */` and `/* OVERVIEW_MODEL */` in `src/hub/ui.ts`). Keep them self-contained, with no imports or module closures. The roadmap view writes through `textContent` only; the `roadmap` snapshot block rides only `view: "roadmap"` and the `overview` block only `view: "overview"`. The Overview reads the same `taskSample` as `ahub sdlc metrics`; an underivable figure is `null` (shown `unknown`, never 0), and a private task is only counted in `withheld`.
@@ -1,6 +1,6 @@
1
1
  # Local worker and sandbox
2
2
 
3
- Scope: the hub-native local worker, its tools, path guard, denylist and seatbelt sandbox. Read before editing `src/adapters/local-worker.ts`, `src/local/`, `src/memory/capture.ts` (reads the denylist), `src/hub/facts.ts` (denylist and large-file stamps), `src/hub/git.ts`, the grant filter in `src/hub/permission-mode.ts`, or the sandbox root in `src/hub/instance-execution.ts`.
3
+ Scope: the hub-native local worker, its tools, path guard, denylist and seatbelt sandbox. Read before editing `src/adapters/local-worker.ts`, `src/local/`, `src/memory/capture.ts` (reads the denylist), `src/hub/facts.ts` (denylist and large-file stamps), `src/hub/git.ts`, the grant filter in `src/hub/permission-mode.ts` and `src/hub/permission-paths.ts`, or the sandbox root in `src/hub/instance-execution.ts`.
4
4
 
5
5
  - Before editing a probe-only lifecycle, capability or sandbox branch, read `docs/design/guidance-probes.md` (T2 confined adapter contract).
6
6
  - Nothing the local worker executes may run outside `sandboxedExec`; a new tool that spawns a process goes through it, and a tool that touches a path goes through `guardPath`.
@@ -23,9 +23,9 @@ Scope: the hub-native local worker, its tools, path guard, denylist and seatbelt
23
23
  - `ctx.permit` answers a `ToolApproval` (`true`, `false`, `"expired"`, `"aborted"`, #253): only `true` permits an effect, so never test it for truthiness. A tool returns `approvalError`'s text for the rest: a denial, the expiry (which tells the model not to retry) or the withdrawal. A turn that two unanswered approvals ended (`ApprovalWaitStop`; counting rule: `adapters.md`) completes its missing tool results, settles its delivery `completed` with the reason and is never handed back for replay, also when no tool had a side effect.
24
24
  - `Facts` (`src/hub/facts.ts`, #428) names a large file whose ctime is under `RACY_MS` by its git blob id: in `load()` and `observe()` only through `racyBlob()` (per-file `RACY_HASH_MAX_BYTES`, per-store `RACY_BURST_BYTES` per event-loop turn, memo cleared at `boundary()`), past which it keeps the stat-only stamp and makes no claim; `atHead()` keeps its own `HASHED_BYTES` bound, `tree()` reads large files by stat only, and `largeBlob()` caches only settled stamps.
25
25
  - Hub tool calls (`hub_send`, `TASK_TOOL_NAMES`, `CONDUCTOR_TOOL_NAMES`) are never passed to `capture.observe`; `Tasks` alone decides what hub tool text reaches memory (#230). Keep `hub_ask_answer` explicitly excluded from `observeTool` too: its question and answer are not capture evidence (authority and read-view rules: `daemon.md` and `tasks.md`). Every live `capture.observe` passes a host `sourceId` (`<session>.<turn>.<step>.<n>`, #752); a new host caller supplies one too. Capture stores `paths` only for `read`/`write`/`edit` and only project-relative ones: command argv is never path metadata.
26
- - A tool that asks for approval passes its name to `ctx.permit`, and `write`/`edit` also the `guardPath` result, never the model's path string: also pass the original path separately through every permit wrapper, and every tool its parsed arguments as `input` (the always-ask classifier reads it, #750; rule: `adapters.md`); `ask-when-needed` grants only when both the original project-relative spelling and the real path avoid protected names through `grantablePath` (`src/hub/permission-mode.ts`). `bash` and mutating `git` pass no path. After the awaited approval `write`/`edit` run `guardPath` again and refuse a target that changed (#242).
26
+ - A tool that asks for approval passes its name to `ctx.permit`, and `write`/`edit` also the `guardPath` result, never the model's path string: also pass the original path separately through every permit wrapper, and every tool its parsed arguments as `input` (the always-ask classifier reads it, #750; rule: `adapters.md`); `ask-when-needed` grants only when both the original project-relative spelling and the real path avoid protected names through `grantablePath` (`src/hub/permission-paths.ts`). `bash` and mutating `git` pass no path. After the awaited approval `write`/`edit` run `guardPath` again and refuse a target that changed (#242).
27
27
 
28
- - Honor the live `protect_instruction_files` policy in scoped grants for the instruction names in `INSTRUCTION_FILES` (`src/hub/permission-mode.ts`: `AGENTS.md`, `CLAUDE.md`, `QWEN.md`, `GEMINI.md`); keep reads, explicit approval and never-ask unchanged. Only the settings registry writes this machine-local policy (#323).
28
+ - Honor the live `protect_instruction_files` policy in scoped grants for the instruction names in `INSTRUCTION_FILES` (`src/hub/permission-paths.ts`: `AGENTS.md`, `CLAUDE.md`, `QWEN.md`, `GEMINI.md`); keep reads, explicit approval and never-ask unchanged. Only the settings registry writes this machine-local policy (#323).
29
29
 
30
30
  - Bounded task wait (#1454): the daemon passes `taskWait` to `LocalPeer`; `profileTaskTools` includes `hub_task_wait` only when the idle sweep is enabled. Do not infer or read that setting in the worker; the authority and wait rules live in `tasks.md`.
31
31
 
@@ -1,6 +1,6 @@
1
1
  # Security review
2
2
 
3
- Scope: the security pass of a review (`REVIEW.md`), and any change under `src/local/`, `src/omniroute/`, `src/hub/envelope.ts`, `src/hub/memory-policy.ts`, `src/hub/project.ts`, `src/hub/tool-refusal.ts`, `.github/workflows/` or `scripts/release-*`. Read before reviewing such a change or giving a `security` finding. The boundaries themselves are described in `docs/security.md`.
3
+ Scope: the security pass of a review (`REVIEW.md`), and any change under `src/local/`, `src/omniroute/`, `src/hub/envelope.ts`, `src/hub/memory-policy.ts`, `src/hub/project.ts`, `src/hub/tool-refusal.ts`, `src/hub/mcp-endpoint.ts`, `src/hub/host.ts`, `src/hub/mcp-bridge-core.ts`, `.github/workflows/` or `scripts/release-*`. Read before reviewing such a change or giving a `security` finding. The boundaries themselves are described in `docs/security.md`.
4
4
 
5
5
  ## Rules for every security pass
6
6
 
@@ -17,8 +17,8 @@ Scope: the security pass of a review (`REVIEW.md`), and any change under `src/lo
17
17
 
18
18
  - Every body rendered beside a hub-written header passes `sanitize()` (`src/hub/envelope.ts`). A new render path that skips it lets one agent forge another's header.
19
19
  - The Claude channel escapes a leading `/` in every notification body (`channelBody` in `src/adapters/claude-channel.ts`), so a peer's body cannot read as a typed slash command. Keep it on both the single and the digest path.
20
- - Hub messages stay untrusted in the receiver's instructions: `STANDING_INSTRUCTION` and `HUB_MESSAGE_INSTRUCTION` (`src/hub/envelope.ts`), the channel instructions (`src/adapters/claude-channel.ts`) and `templates/AGENTS.block.md` say the same thing. A change that weakens one of them weakens all peers of that kind.
21
- - Authority comes from the caller's role, checked in the daemon on every call, never from message text or from which tools a peer was shown: `requireConductor` (`src/hub/conductor.ts`), the planner and reviewer checks in `Tasks` (`src/hub/tasks.ts`). A refusal that must happen before any effect throws `PreEffectToolRefusal` (`src/hub/tool-refusal.ts`). The one exception is instructed execution (#1622): a confirmed person-typed transcript receipt lets an agent run admitted `ahub` forms as the person. Review it against the instructed rules in `daemon.md` and `adapters.md`.
20
+ - Hub messages stay untrusted in the receiver's instructions: `STANDING_INSTRUCTION` and `HUB_MESSAGE_INSTRUCTION` (`src/hub/envelope.ts`), the channel instructions (`mcpServerOptions` in `src/hub/mcp-bridge-core.ts`) and `templates/AGENTS.block.md` say the same thing. A change that weakens one of them weakens all peers of that kind.
21
+ - Authority comes from the caller's role, checked in the daemon on every call, never from message text or from which tools a peer was shown: `requireConductor` (`src/hub/conductor.ts`), the planner and reviewer checks in `Tasks` (`src/hub/tasks.ts` and its domain modules `src/hub/tasks-*.ts`). A refusal that must happen before any effect throws `PreEffectToolRefusal` (`src/hub/tool-refusal.ts`). The one exception is instructed execution (#1622): a confirmed person-typed transcript receipt lets an agent run admitted `ahub` forms as the person. Review it against the instructed rules in `daemon.md` and `adapters.md`.
22
22
  - What a model wrote is stored as a model's answer and kept out of later evidence (`src/hub/ask.ts`, `src/hub/inference.ts`). A model label that reaches an event or a record goes through `safeModelLabel` (`src/omniroute/usage.ts`).
23
23
  - Review-observer exclusion is one function, `isReviewObserverExcluded` (`src/hub/memory-policy.ts`); a new memory or telemetry path asks it.
24
24
 
@@ -26,14 +26,15 @@ Scope: the security pass of a review (`REVIEW.md`), and any change under `src/lo
26
26
 
27
27
  - The daemon's HTTP and WebSocket listener refuses any request that carries an `Origin` header and requires the control token in `hello` (`src/hub/daemon.ts`). The dashboard accepts only its own origin (`src/hub/ui.ts`). The Pi relay refuses an `Origin` too (`src/adapters/pi.ts`). A new loopback listener needs both the origin refusal and a secret.
28
28
  - Every control message with a `rid` is answered, unknown ones included (`src/hub/daemon.ts`); an unanswered one hangs a newer client.
29
- - A fresh reviewer's MCP endpoint compares its authority in constant time (`src/adapters/reviewer-mcp.ts`). Do not replace it with `===`.
29
+ - A local endpoint's secret is compared in constant time: the fresh reviewer's MCP authority (`src/adapters/reviewer-mcp.ts`) and the MCP endpoint's hello token (`validateHello` in `src/hub/mcp-endpoint.ts`). Do not replace either with `===`.
30
+ - Unix sockets take the place of the origin refusal with the file system: the MCP endpoint (`src/hub/mcp-endpoint.ts`, #1780) keeps `run/<projectId>/` at `0700` and `mcp.sock` at `0600` and still requires the control token and a same-user pid in its hello; the shared host socket (`src/hub/host.ts`, #1779 T3a) has no secret, so its `hosts/` directory (created `0700`, an existing one not rechecked) is the whole authority. Review a new socket against the MCP endpoint's checks (`privateDirectory`, token, same-user pid).
30
31
 
31
32
  ## Data isolation and paths (companion `data-isolation`)
32
33
 
33
34
  - PII is redacted where the envelope and the public view are built: `Tasks.publicTitle` and the task public view (`src/hub/tasks.ts`), event fields through the allowlists in `src/hub/operational-view.ts`. A new log line, notice, tool result or memory call that shows task text uses them; a redaction added at a call site is the finding.
34
35
  - PII decisions ask `onCampus()` (`src/omniroute/client.ts`), never `!offCampus()`: unknown is not on campus.
35
36
  - Paths resolve through `realPath` (`src/hub/project.ts`, from `@staix/agent-mem/platform`), and a deny or hub-owned check runs on the name the caller typed as well as the resolved one. The local worker's `guardPath` (`src/local/tools.ts`) checks names; never rebuild a real path from the names you were given.
36
- - A lock is never removed on behalf of a dead holder with a check followed by an unlink. `SourceRegistry.locked` (`src/hub/sources.ts`) is the reference.
37
+ - A lock is never removed on behalf of a dead holder with a check followed by an unlink. `SourceRegistry.locked` (`src/hub/sources.ts`) is the reference. Two socket replacements are bound to a claim instead: the MCP endpoint replaces a stale `mcp.sock` only as `exclusiveOwner` (the daemon holding its fixed control port) after a refused connect and an unchanged inode, and `serveHost` removes a host socket only as the holder of `Registry.claimHost`. A new replacement needs such a claim.
37
38
  - The gateway key and Access headers are read only under `src/omniroute/`.
38
39
 
39
40
  ## Supply chain and release (companion `supply-chain`)