@chankov/agent-fleet 0.0.8 → 0.0.9

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 (340) hide show
  1. package/.pi/agents/model-profiles.yaml +9 -2
  2. package/.pi/agents/peers.yaml +12 -16
  3. package/.pi/agents/teams.yaml +4 -2
  4. package/.pi/harnesses/agent-hub/README.md +20 -5
  5. package/.pi/harnesses/agent-hub/footer.ts +4 -2
  6. package/.pi/harnesses/agent-hub/index.ts +104 -11
  7. package/.pi/harnesses/agent-hub/package.json +1 -1
  8. package/.pi/harnesses/agent-hub/version.ts +25 -1
  9. package/.pi/harnesses/coms/README.md +8 -1
  10. package/.pi/harnesses/coms/package.json +1 -1
  11. package/.pi/harnesses/coms/version.ts +25 -1
  12. package/.pi/harnesses/damage-control-continue/README.md +8 -1
  13. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  14. package/.pi/harnesses/damage-control-continue/version.ts +25 -1
  15. package/.pi/harnesses/lib/herdr-client.ts +10 -1
  16. package/.pi/harnesses/lib/spawned-peers.js +190 -0
  17. package/.versions/0.0.9/.claude/commands/build.md +44 -0
  18. package/.versions/0.0.9/.claude/commands/code-simplify.md +22 -0
  19. package/.versions/0.0.9/.claude/commands/design-agent.md +14 -0
  20. package/.versions/0.0.9/.claude/commands/doctor-agent-fleet.md +17 -0
  21. package/.versions/0.0.9/.claude/commands/orchestrate.md +112 -0
  22. package/.versions/0.0.9/.claude/commands/plan.md +16 -0
  23. package/.versions/0.0.9/.claude/commands/prime.md +22 -0
  24. package/.versions/0.0.9/.claude/commands/review.md +16 -0
  25. package/.versions/0.0.9/.claude/commands/set-hermes-telegram.md +15 -0
  26. package/.versions/0.0.9/.claude/commands/set-hermes-watchdog.md +6 -0
  27. package/.versions/0.0.9/.claude/commands/setup-agent-fleet.md +25 -0
  28. package/.versions/0.0.9/.claude/commands/ship.md +72 -0
  29. package/.versions/0.0.9/.claude/commands/spec.md +15 -0
  30. package/.versions/0.0.9/.claude/commands/test.md +19 -0
  31. package/.versions/0.0.9/.claude/commands/webperf.md +32 -0
  32. package/.versions/0.0.9/.claude/orchestrate-teams.yaml +24 -0
  33. package/.versions/0.0.9/.opencode/commands/af-build.md +17 -0
  34. package/.versions/0.0.9/.opencode/commands/af-code-simplify.md +16 -0
  35. package/.versions/0.0.9/.opencode/commands/af-compound.md +16 -0
  36. package/.versions/0.0.9/.opencode/commands/af-design-agent.md +15 -0
  37. package/.versions/0.0.9/.opencode/commands/af-doctor-agent-fleet.md +17 -0
  38. package/.versions/0.0.9/.opencode/commands/af-orchestrate.md +112 -0
  39. package/.versions/0.0.9/.opencode/commands/af-plan.md +16 -0
  40. package/.versions/0.0.9/.opencode/commands/af-prime.md +22 -0
  41. package/.versions/0.0.9/.opencode/commands/af-review.md +15 -0
  42. package/.versions/0.0.9/.opencode/commands/af-set-hermes-telegram.md +15 -0
  43. package/.versions/0.0.9/.opencode/commands/af-set-hermes-watchdog.md +6 -0
  44. package/.versions/0.0.9/.opencode/commands/af-setup-agent-fleet.md +15 -0
  45. package/.versions/0.0.9/.opencode/commands/af-ship.md +16 -0
  46. package/.versions/0.0.9/.opencode/commands/af-spec.md +16 -0
  47. package/.versions/0.0.9/.opencode/commands/af-test.md +21 -0
  48. package/.versions/0.0.9/.opencode/commands/af-webperf.md +32 -0
  49. package/.versions/0.0.9/.opencode/orchestrate-teams.yaml +24 -0
  50. package/.versions/0.0.9/.pi/agents/dispatch-policy.yaml +32 -0
  51. package/.versions/0.0.9/.pi/agents/model-profiles.yaml +27 -0
  52. package/.versions/0.0.9/.pi/agents/peers.yaml +142 -0
  53. package/.versions/0.0.9/.pi/agents/teams.yaml +41 -0
  54. package/.versions/0.0.9/.pi/damage-control-rules.yaml +297 -0
  55. package/.versions/0.0.9/.pi/extensions/agent-fleet-update-check/README.md +58 -0
  56. package/.versions/0.0.9/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  57. package/.versions/0.0.9/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  58. package/.versions/0.0.9/.pi/extensions/btw/README.md +118 -0
  59. package/.versions/0.0.9/.pi/extensions/btw/index.ts +917 -0
  60. package/.versions/0.0.9/.pi/extensions/btw/package.json +6 -0
  61. package/.versions/0.0.9/.pi/extensions/btw/state.js +179 -0
  62. package/.versions/0.0.9/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
  63. package/.versions/0.0.9/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  64. package/.versions/0.0.9/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  65. package/.versions/0.0.9/.pi/extensions/compact-and-continue/README.md +42 -0
  66. package/.versions/0.0.9/.pi/extensions/compact-and-continue/index.ts +120 -0
  67. package/.versions/0.0.9/.pi/extensions/compact-and-continue/package.json +6 -0
  68. package/.versions/0.0.9/.pi/extensions/mcp-bridge/README.md +46 -0
  69. package/.versions/0.0.9/.pi/extensions/mcp-bridge/index.ts +206 -0
  70. package/.versions/0.0.9/.pi/extensions/mcp-bridge/package.json +6 -0
  71. package/.versions/0.0.9/.pi/extensions/package-lock.json +1143 -0
  72. package/.versions/0.0.9/.pi/extensions/package.json +9 -0
  73. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/README.md +201 -0
  74. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/config.ts +198 -0
  75. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  76. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/index.ts +248 -0
  77. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/package.json +6 -0
  78. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  79. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  80. package/.versions/0.0.9/.pi/harnesses/agent-hub/README.md +872 -0
  81. package/.versions/0.0.9/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  82. package/.versions/0.0.9/.pi/harnesses/agent-hub/artifacts.js +146 -0
  83. package/.versions/0.0.9/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
  84. package/.versions/0.0.9/.pi/harnesses/agent-hub/backend-policy.js +153 -0
  85. package/.versions/0.0.9/.pi/harnesses/agent-hub/context-window.js +106 -0
  86. package/.versions/0.0.9/.pi/harnesses/agent-hub/delegate.ts +435 -0
  87. package/.versions/0.0.9/.pi/harnesses/agent-hub/drift-watchdog.js +211 -0
  88. package/.versions/0.0.9/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  89. package/.versions/0.0.9/.pi/harnesses/agent-hub/footer.ts +31 -0
  90. package/.versions/0.0.9/.pi/harnesses/agent-hub/helpers.ts +248 -0
  91. package/.versions/0.0.9/.pi/harnesses/agent-hub/index.ts +8702 -0
  92. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  93. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  94. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  95. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  96. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  97. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  98. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  99. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-session-bridge.ts +257 -0
  100. package/.versions/0.0.9/.pi/harnesses/agent-hub/package.json +7 -0
  101. package/.versions/0.0.9/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  102. package/.versions/0.0.9/.pi/harnesses/agent-hub/research-retention.js +34 -0
  103. package/.versions/0.0.9/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  104. package/.versions/0.0.9/.pi/harnesses/agent-hub/return-contract.js +293 -0
  105. package/.versions/0.0.9/.pi/harnesses/agent-hub/return-extract.js +75 -0
  106. package/.versions/0.0.9/.pi/harnesses/agent-hub/run-budget.js +181 -0
  107. package/.versions/0.0.9/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  108. package/.versions/0.0.9/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  109. package/.versions/0.0.9/.pi/harnesses/agent-hub/session-health.js +110 -0
  110. package/.versions/0.0.9/.pi/harnesses/agent-hub/spawn.ts +354 -0
  111. package/.versions/0.0.9/.pi/harnesses/agent-hub/version.ts +42 -0
  112. package/.versions/0.0.9/.pi/harnesses/ask-user-remote/README.md +19 -0
  113. package/.versions/0.0.9/.pi/harnesses/ask-user-remote/index.ts +321 -0
  114. package/.versions/0.0.9/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  115. package/.versions/0.0.9/.pi/harnesses/coms/README.md +100 -0
  116. package/.versions/0.0.9/.pi/harnesses/coms/index.ts +1767 -0
  117. package/.versions/0.0.9/.pi/harnesses/coms/package.json +7 -0
  118. package/.versions/0.0.9/.pi/harnesses/coms/version.ts +42 -0
  119. package/.versions/0.0.9/.pi/harnesses/damage-control-continue/README.md +124 -0
  120. package/.versions/0.0.9/.pi/harnesses/damage-control-continue/index.ts +536 -0
  121. package/.versions/0.0.9/.pi/harnesses/damage-control-continue/package.json +7 -0
  122. package/.versions/0.0.9/.pi/harnesses/damage-control-continue/version.ts +42 -0
  123. package/.versions/0.0.9/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  124. package/.versions/0.0.9/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  125. package/.versions/0.0.9/.pi/harnesses/lib/herdr-client.ts +472 -0
  126. package/.versions/0.0.9/.pi/harnesses/lib/herdr-presence.ts +399 -0
  127. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  128. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  129. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  130. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  131. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  132. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  133. package/.versions/0.0.9/.pi/harnesses/lib/spawned-peers.js +190 -0
  134. package/.versions/0.0.9/.pi/harnesses/package-lock.json +35 -0
  135. package/.versions/0.0.9/.pi/harnesses/package.json +9 -0
  136. package/.versions/0.0.9/.pi/prompts/af-build.md +24 -0
  137. package/.versions/0.0.9/.pi/prompts/af-code-simplify.md +22 -0
  138. package/.versions/0.0.9/.pi/prompts/af-doctor-agent-fleet.md +15 -0
  139. package/.versions/0.0.9/.pi/prompts/af-plan.md +16 -0
  140. package/.versions/0.0.9/.pi/prompts/af-review.md +16 -0
  141. package/.versions/0.0.9/.pi/prompts/af-set-hermes-telegram.md +15 -0
  142. package/.versions/0.0.9/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  143. package/.versions/0.0.9/.pi/prompts/af-setup-agent-fleet.md +27 -0
  144. package/.versions/0.0.9/.pi/prompts/af-ship.md +17 -0
  145. package/.versions/0.0.9/.pi/prompts/af-spec.md +15 -0
  146. package/.versions/0.0.9/.pi/prompts/af-test.md +19 -0
  147. package/.versions/0.0.9/.pi/skills/bowser/SKILL.md +145 -0
  148. package/.versions/0.0.9/.version +1 -0
  149. package/.versions/0.0.9/agents/architect.md +24 -0
  150. package/.versions/0.0.9/agents/bowser.md +27 -0
  151. package/.versions/0.0.9/agents/builder.md +54 -0
  152. package/.versions/0.0.9/agents/code-reviewer.md +204 -0
  153. package/.versions/0.0.9/agents/deep-researcher.md +32 -0
  154. package/.versions/0.0.9/agents/documenter.md +18 -0
  155. package/.versions/0.0.9/agents/orchestrator.md +66 -0
  156. package/.versions/0.0.9/agents/plan-reviewer.md +62 -0
  157. package/.versions/0.0.9/agents/planner.md +70 -0
  158. package/.versions/0.0.9/agents/releaser.md +24 -0
  159. package/.versions/0.0.9/agents/researcher.md +28 -0
  160. package/.versions/0.0.9/agents/security-auditor.md +167 -0
  161. package/.versions/0.0.9/agents/test-engineer.md +153 -0
  162. package/.versions/0.0.9/agents/web-debugger.md +43 -0
  163. package/.versions/0.0.9/agents/web-performance-auditor.md +193 -0
  164. package/.versions/0.0.9/codex/CONDUCTOR.md +148 -0
  165. package/.versions/0.0.9/docs/ARCHITECTURE.md +262 -0
  166. package/.versions/0.0.9/docs/agent-fleet-setup.md +366 -0
  167. package/.versions/0.0.9/docs/claude-code-coms-bridge.md +109 -0
  168. package/.versions/0.0.9/docs/codex-remote-conductor.md +170 -0
  169. package/.versions/0.0.9/docs/coms-hermes-bridge.md +189 -0
  170. package/.versions/0.0.9/docs/getting-started.md +231 -0
  171. package/.versions/0.0.9/docs/npm-install.md +337 -0
  172. package/.versions/0.0.9/docs/opencode-setup.md +249 -0
  173. package/.versions/0.0.9/docs/pi-extensions.md +356 -0
  174. package/.versions/0.0.9/docs/pi-setup.md +476 -0
  175. package/.versions/0.0.9/docs/skill-anatomy.md +150 -0
  176. package/.versions/0.0.9/hermes/README.md +347 -0
  177. package/.versions/0.0.9/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  178. package/.versions/0.0.9/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  179. package/.versions/0.0.9/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  180. package/.versions/0.0.9/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  181. package/.versions/0.0.9/hermes/gates/gate-o-capability.md +8 -0
  182. package/.versions/0.0.9/hermes/gates/gate-o-validator-fixtures.json +1 -0
  183. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
  184. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  185. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  186. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  187. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  188. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  189. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  190. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  191. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  192. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  193. package/.versions/0.0.9/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  194. package/.versions/0.0.9/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  195. package/.versions/0.0.9/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  196. package/.versions/0.0.9/hermes/skills/hub-conductor/SKILL.md +84 -0
  197. package/.versions/0.0.9/hermes/skills/hub-liaison/SKILL.md +84 -0
  198. package/.versions/0.0.9/hermes/skills/hub-watchdog/SKILL.md +76 -0
  199. package/.versions/0.0.9/hermes/skills/hub-watchdog/manifest.json +1 -0
  200. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  201. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  202. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  203. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  204. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  205. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  206. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  207. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  208. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  209. package/.versions/0.0.9/hermes/watchdog-tests/__init__.py +0 -0
  210. package/.versions/0.0.9/hooks/SIMPLIFY-IGNORE.md +90 -0
  211. package/.versions/0.0.9/hooks/coms-stop-hook.mjs +84 -0
  212. package/.versions/0.0.9/hooks/hooks.json +14 -0
  213. package/.versions/0.0.9/hooks/session-start.sh +74 -0
  214. package/.versions/0.0.9/hooks/simplify-ignore.sh +302 -0
  215. package/.versions/0.0.9/justfile +254 -0
  216. package/.versions/0.0.9/references/accessibility-checklist.md +160 -0
  217. package/.versions/0.0.9/references/definition-of-done.md +67 -0
  218. package/.versions/0.0.9/references/fleet-coordination-patterns.md +151 -0
  219. package/.versions/0.0.9/references/observability-checklist.md +91 -0
  220. package/.versions/0.0.9/references/orchestration-patterns.md +370 -0
  221. package/.versions/0.0.9/references/performance-checklist.md +153 -0
  222. package/.versions/0.0.9/references/prompting-patterns.md +380 -0
  223. package/.versions/0.0.9/references/security-checklist.md +179 -0
  224. package/.versions/0.0.9/references/testing-patterns.md +236 -0
  225. package/.versions/0.0.9/scripts/codex-conductor.ts +41 -0
  226. package/.versions/0.0.9/scripts/codex-remote-control.ts +167 -0
  227. package/.versions/0.0.9/scripts/coms-claude-bridge.ts +401 -0
  228. package/.versions/0.0.9/scripts/coms-cli.ts +484 -0
  229. package/.versions/0.0.9/scripts/coms-hermes-bridge.ts +413 -0
  230. package/.versions/0.0.9/scripts/fleet.ts +168 -0
  231. package/.versions/0.0.9/scripts/hermes-monitor-capability-runner.ts +25 -0
  232. package/.versions/0.0.9/scripts/hermes-monitor-scenario.ts +474 -0
  233. package/.versions/0.0.9/scripts/hermes-watchdog-capability-probe.ts +45 -0
  234. package/.versions/0.0.9/scripts/install-hermes-plugin.sh +180 -0
  235. package/.versions/0.0.9/scripts/lib/claude-bridge-core.ts +165 -0
  236. package/.versions/0.0.9/scripts/lib/codex-conductor.ts +88 -0
  237. package/.versions/0.0.9/scripts/lib/codex-remote-control.ts +480 -0
  238. package/.versions/0.0.9/scripts/lib/coms-envelope.ts +582 -0
  239. package/.versions/0.0.9/scripts/lib/fake-herdr-server.ts +88 -0
  240. package/.versions/0.0.9/scripts/lib/fleet-command.ts +111 -0
  241. package/.versions/0.0.9/scripts/lib/herdr-layout.ts +281 -0
  242. package/.versions/0.0.9/scripts/lib/hermes-bridge-core.ts +241 -0
  243. package/.versions/0.0.9/scripts/lib/hermes-monitor-events.ts +1 -0
  244. package/.versions/0.0.9/scripts/lib/hermes-monitor-herdr.ts +2 -0
  245. package/.versions/0.0.9/scripts/lib/hermes-monitor-model.ts +3 -0
  246. package/.versions/0.0.9/scripts/lib/hermes-monitor-registry.ts +2 -0
  247. package/.versions/0.0.9/scripts/lib/hermes-monitor-socket.ts +2 -0
  248. package/.versions/0.0.9/scripts/lib/hermes-monitor-store.ts +2 -0
  249. package/.versions/0.0.9/scripts/lib/monitor-env.ts +120 -0
  250. package/.versions/0.0.9/scripts/lib/peer-launch.ts +314 -0
  251. package/.versions/0.0.9/scripts/lib/persona-banner.ts +62 -0
  252. package/.versions/0.0.9/scripts/lib/spawn-stagger.ts +101 -0
  253. package/.versions/0.0.9/scripts/lib/team-project.ts +193 -0
  254. package/.versions/0.0.9/scripts/lib/team-snapshot.ts +147 -0
  255. package/.versions/0.0.9/scripts/peer-banner.ts +40 -0
  256. package/.versions/0.0.9/scripts/peer-launch.ts +259 -0
  257. package/.versions/0.0.9/scripts/team-snapshot.ts +237 -0
  258. package/.versions/0.0.9/scripts/team-up.ts +360 -0
  259. package/.versions/0.0.9/skills/_internal/grilling.md +11 -0
  260. package/.versions/0.0.9/skills/browser-testing-with-devtools/SKILL.md +352 -0
  261. package/.versions/0.0.9/skills/code-review-and-quality/SKILL.md +381 -0
  262. package/.versions/0.0.9/skills/compound-learning/SKILL.md +137 -0
  263. package/.versions/0.0.9/skills/context-engineering/SKILL.md +291 -0
  264. package/.versions/0.0.9/skills/deprecation-and-migration/SKILL.md +206 -0
  265. package/.versions/0.0.9/skills/designing-agents/SKILL.md +394 -0
  266. package/.versions/0.0.9/skills/designing-agents/pi-harness-authoring.md +222 -0
  267. package/.versions/0.0.9/skills/frontend-ui-engineering/SKILL.md +328 -0
  268. package/.versions/0.0.9/skills/git-workflow-and-versioning/SKILL.md +316 -0
  269. package/.versions/0.0.9/skills/guided-workspace-setup/SKILL.md +544 -0
  270. package/.versions/0.0.9/skills/guided-workspace-setup/companion-manifest.json +38 -0
  271. package/.versions/0.0.9/skills/idea-refine/SKILL.md +182 -0
  272. package/.versions/0.0.9/skills/idea-refine/examples.md +238 -0
  273. package/.versions/0.0.9/skills/idea-refine/frameworks.md +99 -0
  274. package/.versions/0.0.9/skills/idea-refine/refinement-criteria.md +113 -0
  275. package/.versions/0.0.9/skills/idea-refine/scripts/idea-refine.sh +15 -0
  276. package/.versions/0.0.9/skills/incremental-implementation/SKILL.md +287 -0
  277. package/.versions/0.0.9/skills/interview-me/SKILL.md +226 -0
  278. package/.versions/0.0.9/skills/orchestration-verification/SKILL.md +181 -0
  279. package/.versions/0.0.9/skills/peer-coms/SKILL.md +90 -0
  280. package/.versions/0.0.9/skills/performance-optimization/SKILL.md +350 -0
  281. package/.versions/0.0.9/skills/planning-and-task-breakdown/SKILL.md +236 -0
  282. package/.versions/0.0.9/skills/security-and-hardening/SKILL.md +461 -0
  283. package/.versions/0.0.9/skills/spec-driven-development/SKILL.md +245 -0
  284. package/.versions/0.0.9/skills/using-agent-skills/SKILL.md +199 -0
  285. package/.versions/0.0.9/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  286. package/.versions/0.0.9/vendor/agent-skills-upstream/LICENSE +21 -0
  287. package/.versions/0.0.9/vendor/agent-skills-upstream/README.md +11 -0
  288. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  289. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  290. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  291. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  292. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  293. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  294. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  295. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  296. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  297. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  298. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  299. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  300. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  301. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  302. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  303. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  304. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  305. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  306. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  307. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  308. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  309. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  310. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  311. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  312. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  313. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  314. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  315. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  316. package/CHANGELOG.md +38 -0
  317. package/agents/architect.md +1 -0
  318. package/agents/bowser.md +1 -0
  319. package/agents/builder.md +1 -0
  320. package/agents/code-reviewer.md +4 -5
  321. package/agents/deep-researcher.md +2 -1
  322. package/agents/orchestrator.md +1 -0
  323. package/agents/plan-reviewer.md +3 -1
  324. package/agents/planner.md +3 -2
  325. package/agents/security-auditor.md +1 -0
  326. package/agents/test-engineer.md +3 -1
  327. package/agents/web-debugger.md +1 -0
  328. package/agents/web-performance-auditor.md +1 -0
  329. package/docs/ARCHITECTURE.md +1 -1
  330. package/docs/pi-extensions.md +66 -3
  331. package/justfile +10 -1
  332. package/package.json +2 -2
  333. package/scripts/fleet.ts +22 -3
  334. package/scripts/lib/fleet-command.ts +5 -3
  335. package/scripts/lib/herdr-layout.ts +18 -0
  336. package/scripts/lib/peer-launch.ts +314 -0
  337. package/scripts/lib/team-project.ts +3 -1
  338. package/scripts/peer-launch.ts +259 -0
  339. package/skills/guided-workspace-setup/companion-manifest.json +2 -0
  340. package/.pi/harnesses/agent-hub/spawned-peers.js +0 -74
@@ -0,0 +1,872 @@
1
+ # agent-hub
2
+
3
+ A multi-agent dispatcher with [`coms`](../coms/README.md) **embedded** — so the dispatcher is
4
+ *also* a peer-to-peer node. The recommended `just fleet hub` mode loads Fleet Core
5
+ first: [`damage-control-continue`](../damage-control-continue/README.md),
6
+ [`ask-user-remote`](../ask-user-remote/README.md), STT, Compact & Continue, BTW, and the
7
+ update checker. The dispatcher therefore has guardrails and an `ask_user` handoff tool
8
+ before `agent-hub` starts. It combines local specialist
9
+ orchestration (fixed specialist grid, read-only research helpers, `/af-zoom`, kill/restart, per-agent
10
+ model, dispatcher persona gate) with peer-to-peer collaboration: it can **hand a session off to
11
+ another main agent** and **use a coms peer as a subagent**.
12
+
13
+ > Consolidates the retired `agent-team` dispatcher into this harness and embeds the ported `coms`
14
+ > P2P layer from [`pi-vs-claude-code`](https://github.com/disler/pi-vs-claude-code) by
15
+ > [disler](https://github.com/disler) (MIT). See the
16
+ > [extension catalog](../../../docs/pi-extensions.md) and the
17
+ > [design plan](../../../docs/plans/agent-hub/).
18
+
19
+ **Optional phone control:** `just fleet team <team> --project <name>` can supply the live peers for the experimental [Codex Android conductor](../../../docs/codex-remote-conductor.md). Configure Codex for the same project; do not also launch `just fleet conductor codex <team>` for the same peers. Hermes remains the inbound `ask_user` route, while Codex performs only human-confirmed, approval-gated outbound delegation.
20
+
21
+ ## What it does
22
+
23
+ The whole dispatch loop, end to end:
24
+
25
+ ```mermaid
26
+ sequenceDiagram
27
+ autonumber
28
+ actor U as You
29
+ participant H as Hub (dispatcher)
30
+ participant S as Specialist (e.g. builder)
31
+ participant R as Research helper
32
+ participant D as Disk (.pi/agent-sessions/)
33
+
34
+ U->>H: task
35
+ H->>D: set_assertions — Verification Contract persisted
36
+ H->>S: dispatch_agent (task + advisory scope)
37
+ S-->>H: NEEDS_RESEARCH: how does X work?
38
+ H->>R: spawn_research (researcher / deep-researcher)
39
+ R->>D: write findings file
40
+ R-->>H: one-line notice + path
41
+ H->>S: resume with file paths — never raw findings
42
+ S-->>H: structured return + named evidence
43
+ H->>D: update_assertion
44
+ H-->>U: Assertions: 2✓ 1○ 1✗ · open: A4
45
+ ```
46
+
47
+ Every borrowed idea from another harness passes one test before it lands: *does this persistently enter the dispatcher context?* If yes, it goes to disk or a one-line status instead.
48
+
49
+ `agent-hub` is the supported home for the former standalone dispatcher features:
50
+
51
+ - **Dispatcher grid** — a live dashboard of fixed specialists from `.pi/agents/teams.yaml`.
52
+ - **Specialist delegation** — `dispatch_agent` sends writable tasks to configured specialists.
53
+ - **Research helpers** — `spawn_research` and `/af-research` launch read-only helper agents. Two
54
+ `kind: research` personas ship by default: `researcher` (fast `gpt-5.3-codex-spark`) for simple
55
+ reads and `deep-researcher` (`gpt-5.5` / xhigh) for hard, cross-cutting investigation. The
56
+ orchestrator routes by persona; each persona's model + thinking level is shown in its catalog.
57
+ Finished helpers are **auto-pruned** so the research row doesn't grow without bound: auto-research
58
+ pipe helpers disappear as soon as they finish (their findings persist as `findings/*.md` files and
59
+ their handles are never resumed), while manual/persona helpers keep only the `research-keep` most
60
+ recently finished (default 4 — resumable via `/af-agents-cont rN`; older cards, and their session
61
+ files, are dropped oldest-first). Set `research-keep: <n>|all` in the overrides file to change
62
+ the cap. Running helpers are never pruned and `rN` handles are never reused.
63
+ - **Human handoff path** — `ask_user` is exposed by the `ask-user-remote` wrapper (capturing stock
64
+ `pi-ask-user` and optionally racing a `user-remote` bridge), so specialists can bubble decisions
65
+ back through the dispatcher.
66
+ - **Auto-research pipe (`NEEDS_RESEARCH:`)** — a specialist that lacks information pauses by ending
67
+ its turn with `NEEDS_RESEARCH: <question>` lines (mirror of the `ASK_USER:` protocol). The hub
68
+ intercepts them **in code**: it fans out read-only research helpers (max 4 questions per pause,
69
+ 2 pauses per dispatch), writes each helper's findings to `.pi/agent-sessions/findings/*.md`, and
70
+ resumes the specialist's session with the file paths. The dispatcher LLM sees only a one-line
71
+ notice — raw findings never enter its context. Findings files are wiped at session start.
72
+ - **Verification Contract (assertion ledger)** — the dispatcher owns a ledger of checkable
73
+ acceptance assertions built from the request *before* any builder runs, so a clearly stated
74
+ requirement is never silently dropped. `set_assertions` records the numbered, tagged assertions
75
+ (`test` | `runtime-ui` | `code-grep` | `manual`, one pass condition each, plus a required
76
+ `source` naming where the requirement comes from) and rebuilds the whole
77
+ ledger on a "wrong again" regression reset; `update_assertion` marks each one proven (named
78
+ evidence required), unproven, or failed after a verification gate; `get_assertions` reads the
79
+ full ledger (ids, tags, pass conditions, evidence) back. The hub persists the ledger to
80
+ `.pi/agent-sessions/assertions.json` (wiped at session start like `findings/`) and renders a
81
+ one-line status (`Assertions: 2✓ 1○ 1✗ · open: A4`) so the contract survives compaction without
82
+ re-flooding the dispatcher LLM context — after a compaction the dispatcher calls `get_assertions`
83
+ to recover the full text the status line omits. The `orchestrator` persona drives it — a deep-researcher
84
+ parity inventory for "behave like" requests, runtime proof for UI/visibility assertions, the
85
+ regression reset on a re-ask — per
86
+ [`orchestration-verification`](../../../skills/orchestration-verification/SKILL.md). The hub also
87
+ machine-parses each assertion-carrying specialist's structured return, writes the full raw output
88
+ to `.pi/agent-sessions/artifacts/returns/<agentKey>-run<N>.md`, surfaces only a compact
89
+ `details.structuredReturn` digest plus `details.returnPath`, and marks contract notices such as
90
+ missing assertion ids or evidence-less `assertions_proven` entries (demoted to unproven in the
91
+ tool text). `details.fullOutput` remains for `/af-zoom`/compatibility, but dispatcher-visible text is
92
+ digest + path oriented. `update_assertion(status: "proven")` validates evidence by assertion tag:
93
+ test evidence needs a command/test and outcome, `code-grep` needs pattern plus result sample,
94
+ manual needs user/`ask_user` confirmation, and `runtime-ui` needs an existing artifact path under
95
+ `.pi/agent-sessions/artifacts/evidence/`. **Advisory by design** (PRD open question 2): status is
96
+ surfaced and "proven" requires named evidence, but a dispatch is never hard-refused on an unproven
97
+ assertion — code-enforcement is the Checkpoint A decision. Two contract rules ARE enforced at the
98
+ tool: a batch with any sourceless assertion is refused with the offending ids named (a specialist
99
+ told to prove `A9` must be able to read its origin instead of spending a dispatch and an ASK_USER
100
+ cycle asking where `A9` was defined), and a batch over **8** open assertions is accepted with a
101
+ warning suggesting the split — declare the batch the next dispatches actually prove, and
102
+ `set_assertions` the next one when it starts.
103
+ - **Artifact bus** — session handoffs live under `.pi/agent-sessions/artifacts/` with conventional
104
+ `returns/`, `failures/`, `plans/`, `reviews/`, `inventories/`, and `evidence/` subdirectories, all
105
+ wiped and recreated at session start like `findings/`. `failures/` is separate on purpose: a run
106
+ that errored or timed out produced no specialist result, so its output goes there and the dispatch
107
+ result names it a **delivery failure** carrying no assertion evidence. Filing a 142-byte coms error
108
+ stub as `returns/code-reviewer-run4.md` once cost a 103-second dispatch investigating a review that
109
+ had in fact succeeded — only its reply was lost. `dispatch_agent` and `spawn_research` accept optional
110
+ `artifacts: string[]` paths (repo-relative or session-artifact-relative); the hub validates that
111
+ they stay inside the repo/session roots and injects only the path plus first heading/one-line
112
+ preview, never file bodies. Document-producing specialists are instructed to write plans, reviews,
113
+ inventories, and reports to the real session path
114
+ `.pi/agent-sessions/artifacts/<kind>/<agentKey>-run<N>.md` when their tools allow it, then report/pass
115
+ the artifact-relative handoff path `artifacts/<kind>/<agentKey>-run<N>.md`, finish with that path plus
116
+ a ≤10-line digest, and still include structured returns when assertions are carried. Repo-root
117
+ `./artifacts/...` files are not session artifacts. Planner's existing PLAN_FILE behavior is preserved;
118
+ the artifact path is an additional handoff channel.
119
+ - **Dispatch scope advisory** — `dispatch_agent` accepts optional `scope: string[]` for writable
120
+ builder-style runs. The orchestrator should derive these globs from the plan task's file list,
121
+ and skip scope for exploratory/reconnaissance work where the right files are not known yet. The
122
+ hub snapshots git status before the writable dispatch, diffs after the whole tool call (including
123
+ auto-research resumes), and reports out-of-scope paths in `details.scopeViolations` plus a ⚠ text
124
+ notice. This is advisory only: the hub never blocks completion, reverts files, or escalates
125
+ automatically. Known limitation: concurrent writable dispatches can only be attributed
126
+ approximately, so overlapping runs are flagged in the notice.
127
+ - **Agent controls** — `/af-zoom` inspects a live agent timeline; `/af-agents-history` replays the run as a
128
+ timeline (orchestrator turns, dispatches, research helpers) with per-agent durations, parallel-run
129
+ markers, and a grand total; kill/restart controls manage running child agents; per-agent `model:`
130
+ fields select models from team config. The `agents-*` commands address **both target kinds** —
131
+ team specialists by persona name, research helpers by `rN` handle (mirroring `/af-zoom`):
132
+ `/af-agents-kill <name|rN|all>` SIGTERMs a specialist (keeping its standing card), while on a
133
+ research helper it kills **and removes** the card + session — helpers are disposable by design
134
+ (`all` clears every helper); `/af-agents-restart <name|rN>` re-runs the last task fresh (a research
135
+ helper must be finished first); `/af-agents-cont rN <prompt>` resumes a finished helper's session.
136
+ The old `/af-research-rm` and `/af-research-clear` spellings remain as aliases of the kill semantics,
137
+ `/af-research-cont` of `/af-agents-cont`.
138
+ Restartable team specialists at or above 70% context render
139
+ their context percentage with a warning marker/color in dashboard and compact views, and their next
140
+ `dispatch_agent` result adds a `/af-agents-restart <persona>` hint. Research helpers are not warned,
141
+ and the hub never restarts specialists automatically.
142
+ - **Model switching** — a persona's frontmatter `models:` list declares the models it may switch to
143
+ (the default `model:` is implicitly a candidate). `/af-agent-model <persona>` picks from that list;
144
+ the choice lasts for the session and takes effect on the persona's next dispatch
145
+ (`/af-agents-restart <persona>` applies it immediately). The dot form
146
+ `/af-agent-model <persona>.<role>` switches a delegate sub-role's model instead — its candidates are
147
+ the role's declared default plus the parent persona's own candidate list; the switch is applied
148
+ when the parent is next dispatched (it lands in the serialized delegate config, so nested
149
+ children inherit it). `/af-models [profile]` applies a named profile
150
+ from `.pi/agents/model-profiles.yaml` — a macro over the same declared candidates, validated at
151
+ session start (a profile with any entry outside a persona's candidates is dropped whole, with an
152
+ error); profiles never touch sub-role models — only `/af-agent-model` reaches those. Nothing
153
+ outside the declared lists is ever selectable. When an effective project or session override
154
+ fails with a model/provider error or aborted request before work begins (including local-model
155
+ memory-limit failures), the hub retries once with the model originally declared in the persona
156
+ frontmatter. For **write-capable** runs this is pre-work only: no fallback occurs after text
157
+ output, a tool call, cancellation, timeout, drift stop, or a Pi process-spawn failure, avoiding
158
+ duplicate writes. **Read-only children and research helpers** (tools limited to
159
+ `read,grep,find,ls`) also retry once when the provider fails *mid-run* — re-running a reader
160
+ repeats nothing, and those are exactly the children that exist to protect their parent's context,
161
+ so losing one to a local-endpoint OOM halfway through discards work for no safety gain. A
162
+ terminated run (watchdog, deadline, cancellation) never retries either way: that is a verdict on
163
+ the work, not a provider outage. The failed attempt is removed from the child session before retry. Per project,
164
+ `model.<persona>:` / `models.<persona>:` keys under `## agent-hub` in
165
+ `.ai/agent-fleet-overrides.md` replace a persona's default model / candidate list.
166
+ Research personas (`researcher` / `deep-researcher`, `kind: research`) are switchable the same
167
+ way — `/af-agent-model <persona>` and `/af-agent-model-thinking <persona>` accept them alongside team
168
+ members. Since research helpers are spawned fresh on each `/af-research` / `spawn_research`, the
169
+ switch lands on their next spawn (there is no running instance to `/af-agents-restart`).
170
+ `/af-agent-models-substitute <source> <target>` is the global one-shot form: walks every loaded
171
+ persona (team + research + orchestrator), and for each whose **current effective model** is
172
+ `<source>` and whose declared candidates include `<target>`, sets the session override to
173
+ `<target>`. One-step flow — the dry-run summary (affected vs skipped, with reasons) is shown
174
+ inline, then the swap is applied immediately and takes effect on each persona's next dispatch
175
+ (`/af-agents-restart` to apply now). It never touches the dispatcher or delegate sub-roles.
176
+ - **Thinking levels** — each persona's frontmatter `thinking:` sets its pi `--thinking`
177
+ reasoning effort (`off` · `minimal` · `low` · `medium` · `high` · `xhigh`). `/af-agent-model-thinking
178
+ <persona>` switches it among those six levels for the session; like a model switch it takes effect
179
+ on the persona's next dispatch (`/af-agents-restart <persona>` applies it now), and selecting the
180
+ frontmatter default clears the override. The level shows as a short badge after the model
181
+ everywhere a model is rendered — `gpt-5.5 (xh)` in the dashboard cards and the compact below-editor
182
+ view (`min`/`low`/`med`/`hi`/`xh`; `off` shows no badge). Per project, a `thinking.<persona>:` key
183
+ under `## agent-hub` in `.ai/agent-fleet-overrides.md` replaces a persona's default level.
184
+ - **Mid-turn delegation (`delegate` tool)** — a persona that declares a `subagents:` map in its
185
+ frontmatter (`role: { model, tools? }` entries, or an indented `model:`/`tools:` block per role)
186
+ gets a real mid-turn `delegate(role, instruction, context?, allow_write?)` tool, injected as an
187
+ extra `-e delegate.ts` extension into its spawned process (the `delegate` tool name is appended to
188
+ its `--tools` allowlist — pi filters extension tools too). Only declared roles are spawnable, on
189
+ their declared models — model choice is configuration, never the child LLM's. Budgets are readable
190
+ refusals: at most 4 delegate children per dispatch, tree-wide, and a per-persona `delegate_depth:`
191
+ budget capped at 1 (the default). Children spawned with remaining depth 0 do not receive the
192
+ `delegate` extension/tool. Write safety: children run read-only (`read,grep,find,ls`) unless a
193
+ SINGLE live child gets `allow_write: true`, which inherits the parent's tools intersected with the
194
+ role's `tools:` cap; if a declared role cap leaves no available tools, delegation is refused.
195
+ Concurrent children are always forced read-only. Children stream timeline events through
196
+ `.pi/agent-sessions/delegations/<persona>/events.jsonl`; the hub tails it and renders nested rows
197
+ under the parent's card (child id, model, tokens, status),
198
+ each openable with `/af-zoom <child-id>`. Each child also writes its full final output to
199
+ `.pi/agent-sessions/delegations/<persona>/results/<childId>.md`; the parent receives only status,
200
+ a required final `DIGEST:` section (≤30 lines with path:line citations), and the result-file path.
201
+ If a child omits `DIGEST:`, the parent gets the first ~30 lines plus a no-DIGEST warning and the
202
+ result path. Spend rolls up: every child row and the parent's subtree
203
+ total show tokens, and a session-wide `Δ delegated` counter sits in the status line.
204
+ `/af-agents-kill` on the parent SIGTERMs its whole process group, so the delegation tree dies with
205
+ it. `context: fork` is accepted but treated as a summary brief in v1. Per project,
206
+ `subagents.<persona>.<role>:` and `delegate-depth.<persona>:` keys under `## agent-hub` in
207
+ `.ai/agent-fleet-overrides.md` replace individual sub-roles / the depth budget. An overridden
208
+ role retains its frontmatter model as a one-shot fallback under the same pre-work-only safety
209
+ rule; delegate cards and results show the model that ultimately ran. Six personas ship with
210
+ declared sub-roles, on a three-tier OpenAI model ladder — `gpt-5.3-codex-spark` for
211
+ recon/grep sweeps, `gpt-5.4` for analysis sweeps, the `gpt-5.5` (or opus) parent reserved for
212
+ synthesis and verdicts:
213
+ - `code-reviewer` — `preflight`+`docs` (spark), `quality`+`perf` (gpt-5.4); its first delegate
214
+ call is always `preflight`, which studies the project rules and the files under review and
215
+ returns a summary that drives the rest of the fan-out. Deep security review is not a
216
+ sub-role — it belongs to the separate `security-auditor` persona, which the reviewer
217
+ recommends dispatching when it spots deeper risk.
218
+ - `planner` — `scout`+`rules` (spark) fan out before the plan is drafted; `risk` (gpt-5.4)
219
+ optionally challenges the draft breakdown.
220
+ - `plan-reviewer` — `feasibility` (gpt-5.4) checks plan claims against the actual codebase;
221
+ `deps` (spark) verifies dependency ordering and file overlap. No preflight — the plan is
222
+ the map.
223
+ - `security-auditor` — solo `recon` (spark) maps the attack surface first, then
224
+ `input-sweep` (gpt-5.4) and `secrets-sweep` (spark) fan out; exploit reasoning stays with
225
+ the parent.
226
+ - `builder` — `recon` (spark) maps call sites before edits; `verifier` (spark, the one
227
+ `allow_write: true` child) runs the test suite after them. Implementation is never
228
+ delegated.
229
+ - `test-engineer` — `coverage-scout`+`conventions` (spark) inventory gaps and test patterns;
230
+ test writing is never delegated.
231
+ - **Dispatcher persona gate** — optional `persona-gate: on` can require an orchestrator persona at
232
+ session start; by default the dispatcher starts without the gate.
233
+ - **Default damage-control guardrails** — `just fleet hub` and `just fleet hub --solo` load the
234
+ `damage-control-continue` harness before `agent-hub`, so dispatcher tool calls are checked against
235
+ `.pi/damage-control-rules.yaml` and a blocked call feeds back instead of aborting the turn. A
236
+ guardrail is also re-loaded into every native specialist, research helper, and nested delegate
237
+ (see [Safety scope](#safety-scope)). Missing safety plumbing refuses child dispatch.
238
+ - **Embedded coms** — the dispatcher is a discoverable peer on the local machine. Multiple
239
+ `agent-hub` (or plain `coms`) sessions on the same box find each other through per-project registry
240
+ files and exchange messages over a unix socket (named pipe on Windows).
241
+
242
+ Inherited `/af-zoom` behavior in this harness expands the latest event by default. Use `Space` or
243
+ `Ctrl+C` to copy the selected row content, and `Q` or `Esc` to close the overlay. The overlay sizes
244
+ to the terminal and keeps the selected (and last) entry fully visible while you navigate with
245
+ `↑/↓`.
246
+
247
+ ### `/af-agents-history`
248
+
249
+ `/af-agents-history` opens a read-only overlay (same chrome as `/af-zoom`) that replays the session as an
250
+ execution **tree**:
251
+
252
+ - **Orchestrator turns** — each dispatcher turn that actually dispatched something is a depth-0 row
253
+ labelled `(dispatcher)`. Chat-only turns add no rows.
254
+ - **Dispatched specialists and research helpers** nest one level beneath the turn that launched them;
255
+ **delegate sub-sub-agents** nest one level deeper still under the specialist that spawned them — in
256
+ start order at every level.
257
+ - **Parallel runs** — siblings whose run times overlap are marked with a `│→` connector, so a
258
+ concurrent fan-out reads as a visually grouped block.
259
+ - **Real-work durations** — each row shows that node's *own* work: its span **minus the time it spent
260
+ awaiting children**. A dispatcher blocked on six concurrent agents is credited only for the time it
261
+ actually worked between/around the awaits, never for the await itself — so the same wall-clock isn't
262
+ counted twice up the tree. The same subtraction applies to a specialist awaiting its own delegate
263
+ children. Format: plain seconds under a minute (`42sec`), `m:ss` above it (`10:20min` for 620s).
264
+ Running rows tick live (the overlay re-renders once a second) and a new dispatch appears the instant
265
+ it starts.
266
+ - **Footer** shows `Σ real work <total> · <n> runs (agents <a> + dispatchers <d>)` — the real work of
267
+ *everyone*: the dispatched specialists' and research helpers' full runtime (`agents`) plus each
268
+ dispatcher turn's own work (`dispatchers` — its span minus the time it awaited agents **and** the
269
+ human via `ask_user`). Wall-clock is deliberately **not** shown: it would fold in the idle gaps
270
+ while you're away between turns, and `ask_user` waits are subtracted for the same reason.
271
+
272
+ Navigate with `↑/↓`, press `G` to jump back to the live tail, and `Q`/`Esc` to close. The log resets
273
+ on each session start.
274
+
275
+ The agent view starts in **compact** mode, showing one line per *running* agent —
276
+ `name · context% · state` — *below* the input box, just above pi's status bar. Idle and done agents
277
+ are hidden, and the coms pool widget collapses too, so an idle session collapses to just the prompt
278
+ and footer. Press **`Alt+A`** to toggle to the full **dashboard** (bordered card grid drawn *above*
279
+ the input box) and back. The current mode and binding are shown in the footer
280
+ (`Alt+A view:compact` / `Alt+A view:dashboard`).
281
+
282
+ ### Version footer
283
+
284
+ `agent-hub` renders its local harness version first in its custom footer:
285
+ `agent fleet v<version> · <model><thinking> · <team>`. It replaces pi's default footer, so it does **not**
286
+ consume or render the shared version status; it reads its own adjacent stamped manifest directly.
287
+ The three persistent-UI harnesses (`agent-hub`, `coms`, and
288
+ `damage-control-continue`) still register that one shared key, which gives default footers one
289
+ version in stacked non-hub sessions. In the supported guardrail-plus-hub stack, the hub's custom
290
+ footer supplies the single visible version. Damage-Control can update its own safety status after
291
+ a violation without overwriting the shared version entry. The canonical source is the
292
+ repository-root `package.json`; the adjacent harness manifest is a synchronized stamp maintained
293
+ by `bin/sync-harness-versions.js`. Its local `version.ts` reader intentionally stays with the
294
+ harness for copied or symlinked installs, but those installs still need the pre-existing full
295
+ `.pi/harnesses/` dependency installation.
296
+
297
+ The `agent fleet` half of the label is an OSC 8 terminal hyperlink to the project homepage —
298
+ clickable in terminals that support hyperlinks, ignored (rendered as plain text) elsewhere, and
299
+ free of footer columns because pi strips OSC sequences before measuring width. It opens the
300
+ repository in a browser, not a TUI panel: pi has no mouse tracking, so a click never reaches the
301
+ harness. `AGENT_FLEET_NO_LINKS=1` restores the plain label on multiplexers that mangle OSC 8
302
+ (GNU screen, tmux before 3.4).
303
+
304
+ ### Voice dictation indicator
305
+
306
+ The custom footer renders the optional [`pi-voice-stt`](../../extensions/pi-voice-stt/README.md)
307
+ extension's recording indicator on a line **below the model line** — e.g.
308
+ `● REC 0:01 ⏎ send · esc cancel` while recording, or a `transcribing…` dot. Because agent-hub
309
+ replaces pi's built-in footer (where that indicator normally lives), it reads the extension's
310
+ `setStatus("voice-stt", …)` value via the footer data provider and surfaces it itself. The
311
+ indicator only appears once `pi-voice-stt` is installed and configured; otherwise the footer is
312
+ the single model line. Press **`Alt+S`** to start/stop dictation as in a normal pi session.
313
+
314
+ ### Compact-view agent switcher
315
+
316
+ In **compact view**, the running-subagents list below the input doubles as a switcher. **`Alt+]`**
317
+ and **`Alt+[`** move a marker (`›` + highlight) to the next/previous running subagent; **`Alt+\`**
318
+ opens the read-only `/af-zoom` overlay on the marked one (`Q`/`Esc` to close). This only changes what
319
+ you *view* — **the input box always prompts the main session**, and `main` is never a marker target
320
+ (it is the session under the input, not a subagent). There is no transcript takeover: a subagent's
321
+ stream is surfaced through the modal zoom overlay, never by replacing the main scrollback. The keys
322
+ are inert in dashboard mode (use `/af-zoom <name>` there).
323
+
324
+ > Terminal note: `Alt+[` emits `ESC [` (a CSI prefix) and may be swallowed by some terminals'
325
+ > escape parsers; `Alt+]` and `Alt+\` are the reliable pair. `Alt+↑/↓/←/→` are reserved by the pi
326
+ > editor, which is why the switcher uses the bracket/backslash keys.
327
+
328
+ ## Configuration
329
+
330
+ At session start, `agent-hub` reads `.ai/agent-fleet-overrides.md` in the workspace. The
331
+ canonical section name is `## agent-hub` (the legacy `## agent-team` name is still accepted):
332
+
333
+ ```markdown
334
+ ## agent-hub
335
+ # Replace Bulgarian with any language name.
336
+ language: Bulgarian
337
+ ```
338
+
339
+ Omit the section to keep the default `English`. `language` applies to dispatcher replies,
340
+ `ask_user` questions and `context` fields, handoff summaries, and user-facing status text;
341
+ specialist task strings stay in English.
342
+
343
+ The same section can point the team at the project's own rule files and documentation
344
+ entry points:
345
+
346
+ ```markdown
347
+ ## agent-hub
348
+ rules: docs/rules, .ai/rules
349
+ docs: Docs/AGENTS.md, Docs/architecture/ARCHITECTURE_OVERVIEW.md
350
+ ```
351
+
352
+ `rules:` lists repo-relative folders of HOW rules — implementation patterns the work must
353
+ comply with. Resolution is **index-first**: a folder with a top-level `README.md`/`index.md`
354
+ is treated as curated — personas read the index first and follow its loading manifest
355
+ (session bundles, conditional-load lists) instead of bulk-reading the tree; a folder without
356
+ an index is searched **recursively** through all subfolders. When set, every dispatched
357
+ specialist's system prompt gains a "Project rules" block naming the folders and the
358
+ resolution order; the planner and code-reviewer personas additionally validate their subject
359
+ against the relevant rules and pass them on (cited in plan acceptance criteria / handed to
360
+ delegate sub-reviewers).
361
+
362
+ `docs:` lists repo-relative WHAT/WHY documentation entry points — canonical files (e.g. an
363
+ `AGENTS.md`, an architecture overview) or doc folders (personas start from the folder's
364
+ README/index). Docs orient rather than bind: every dispatched specialist **and every research
365
+ helper** gains a "Project docs" block telling it to read the entry points relevant to its
366
+ task and follow their links instead of bulk-reading doc trees. The code-reviewer flags
367
+ changes that alter documented behavior without a doc update; the documenter treats the entry
368
+ points and the trees they link as the documentation it maintains.
369
+
370
+ The same section also tunes research-helper retention:
371
+
372
+ ```markdown
373
+ ## agent-hub
374
+ research-keep: 8
375
+ ```
376
+
377
+ `research-keep:` caps how many **finished** manual/persona research helpers stay resumable
378
+ (LRU by finish time, default 4; `all` disables the cap). Auto-research pipe helpers are
379
+ always pruned as soon as they finish, regardless of this key.
380
+
381
+ ### Bounded local-disk searches
382
+
383
+ Every `read`, `grep`, `find`, and `ls` call made by a native research helper or a nested
384
+ `delegate` child has a **parent-side** watchdog. The default is **120 seconds per tool call**;
385
+ it is a per-tool bound, not a whole-run deadline — the whole-run bound is the execution
386
+ mode's per-run deadline below. Configure it in the repository-standard overrides file:
387
+
388
+ ```markdown
389
+ ## agent-hub
390
+ recon-search-timeout-s: 120 # integer 1..3600
391
+ # recon-search-timeout-s: off # disable this per-tool watchdog
392
+ ```
393
+
394
+ Invalid values warn at session start and use 120. Calls are tracked independently by their
395
+ JSONL `toolCallId`; a repeated start/update cannot extend an existing deadline. A timeout returns
396
+ `tool_timeout` with the call metadata, ends the research/delegate lifecycle, sends SIGTERM to the
397
+ child's explicitly owned process group, then SIGKILL after a finite grace period. The parent also
398
+ has a final settlement timer, so it settles rather than waiting indefinitely for `close` or
399
+ inherited pipe drain. If child/process-group death cannot be confirmed after this bounded cleanup,
400
+ the timeout metadata reports `terminationConfirmed: false`: this prevents the parent hanging, but
401
+ may indicate an uninterruptible OS-level process that needs operator attention. This group
402
+ ownership covers descendants even when the pi leader exits first; nested delegates own their groups
403
+ and forward parent cancellation, avoiding detached-orphan processes. Caller
404
+ cancellation follows the same bounded cleanup path but is reported as `cancelled`, not
405
+ `tool_timeout`.
406
+
407
+ ### Execution modes & turn budgets
408
+
409
+ The hub runs one of three **execution modes** — `fast`, `standard` (default), `strict` —
410
+ with **per-user-turn budgets enforced in code**, not prose. This is the guardrail against
411
+ runaway orchestration (the observed failure mode: 100+ dispatches and 100M+ tokens for one
412
+ task, most of it re-billed stale specialist context).
413
+
414
+ | Budget (per user turn) | fast | standard | strict |
415
+ |-----------------------------------|--------|----------|---------|
416
+ | `dispatch_agent` calls | 2 | 8 | 24 |
417
+ | `spawn_research` calls | 1 | 4 | 12 |
418
+ | Turn wall clock | 15 min | 60 min | 240 min |
419
+ | Per-run deadline (specialist/research/delegate) | 10 min | 30 min | off |
420
+ | Specialist session recycled after | 3 runs | 5 runs | 5 runs |
421
+ | Nested delegation | off | on | on |
422
+
423
+ - **fast** — single-specialist path for small, low-risk asks; assertion ledger optional,
424
+ no nested delegation.
425
+ - **standard** — batched execution: one recon max, builder batches of 4–6 plan tasks with
426
+ one gate each, one review gate at the end.
427
+ - **strict** — the full Verification Contract (parity inventories, per-batch gates,
428
+ second confirming reads); use for production migrations and security-sensitive work.
429
+
430
+ When a budget is exhausted, `dispatch_agent`/`spawn_research` **refuse** with instructions
431
+ to summarize and ask the user; the next user message opens a fresh window. Switch modes
432
+ live with `/af-hub-mode fast|standard|strict` (no argument shows the current mode and usage);
433
+ set the project default and per-axis overrides in the overrides file:
434
+
435
+ ```markdown
436
+ ## agent-hub
437
+ mode: standard # fast|standard|strict
438
+ max-dispatches-per-turn: 8 # integer or off
439
+ max-research-per-turn: 4 # integer or off
440
+ turn-wall-time-s: 3600 # integer or off
441
+ agent-turn-timeout-s: 1800 # whole-run deadline per spawned run; integer or off
442
+ session-recycle-runs: 5 # recycle a specialist session after N resumed runs; integer or off
443
+ ```
444
+
445
+ Two related always-on behaviors: specialist **context pressure is measured over
446
+ input + cacheRead + cacheWrite** (resumed sessions re-send their whole accumulated context
447
+ as cache reads — counting `input` alone hid that entirely), and a specialist session is
448
+ **recycled** (fresh session, no `-c` resume) once it has served `session-recycle-runs` runs
449
+ or its measured context passes 60%. The dispatch result notes the recycle so the dispatcher
450
+ knows the specialist starts without session memory — task text and `artifacts:` paths must
451
+ carry the state, which the deliverable-to-file protocol already ensures.
452
+
453
+ Context is measured against **that agent's own** model window, resolved from pi's model
454
+ registry (`ctx.modelRegistry.find`) with the source recorded on every resolution. Dividing a
455
+ 49k local model's usage by the dispatcher's window is what produced unactionable readings
456
+ like `⚠ Planner context at 315%`; a reading above 100% now emits a one-time diagnostic that
457
+ names the window and where the number came from, so a mis-resolved window is distinguishable
458
+ from a genuine overflow. Two recycle rules follow from it: a session at or past a **full**
459
+ window is recycled unconditionally (no threshold override keeps it alive), and a resumed
460
+ session whose *projected* prompt — prior tokens plus this task — would overflow is recycled
461
+ **before** the spawn instead of after the run.
462
+
463
+ #### Per-provider concurrency
464
+
465
+ A dispatch may fan out to four delegate children at once and several specialists can be
466
+ mid-run, with nothing bounding how many requests land on one provider. That is fine against
467
+ a hosted endpoint and not against a local one. Requests are capped per process — **2 in
468
+ flight for `custom/*` by default, unlimited elsewhere**:
469
+
470
+ ```bash
471
+ AGENT_HUB_PROVIDER_LIMITS="custom=4" # raise the local cap
472
+ AGENT_HUB_PROVIDER_LIMITS="custom=off" # disable it
473
+ AGENT_HUB_PROVIDER_LIMITS="custom=2,ollama=1"
474
+ ```
475
+
476
+ Queued runs still execute — they wait for a permit, and the wait is announced rather than
477
+ looking like a hang. The cap applies per **level** of the delegation tree (each pi process
478
+ runs its own semaphore over the children it spawns), and a nested spawn reuses its parent's
479
+ permit, so a child can never wait on its own ancestor. The drift judge and the return
480
+ extractor are deliberately ungated: both run while a specialist holds a permit, so queueing
481
+ them behind it would stall the watchdog meant to stop it.
482
+
483
+ The per-run deadline lands as `turn_timeout` (exit 124) with partial output preserved, for
484
+ dispatched specialists, research helpers, and nested delegate children alike — a hung child
485
+ can no longer hold its parent for hours.
486
+
487
+ ### Task triage (complexity tiers)
488
+
489
+ The dispatcher classifies each user turn with the `set_task_tier` tool BEFORE its first
490
+ dispatch — `trivial` / `small` / `feature` / `project` — and the hub lowers the enforced
491
+ dispatch/research caps to **min(mode, tier)**: trivial = 1 dispatch / 1 research,
492
+ small = 2 / 2, feature = 6 / 4, `project` defers to the mode. Skipping the call makes the
493
+ first dispatch assume `feature` (except in strict mode, where tiers are opt-in). The tier
494
+ resets every user turn and shows in the `hub-mode` status chip (`Mode: standard·small · …`).
495
+ The system prompt ties the tier to the anti-over-engineering rules: a provided plan is a
496
+ spec (no re-planning), assertions stay ≤3 for trivial/small asks, and "using every persona"
497
+ is called out as a smell. Two hygiene guards are enforced in code, not prose: a
498
+ **duplicate-dispatch guard** refuses re-dispatching the same agent with a near-identical
499
+ task inside one turn, and every budget/duplicate refusal is counted in `/af-hub-report`.
500
+
501
+ ### Drift watchdog (in-flight observation)
502
+
503
+ An armed dispatch is observed **while it runs**, from the same JSON event stream that
504
+ drives the cards — not post-hoc:
505
+
506
+ - **Layer 1 — deterministic rules, zero tokens** (`drift-watchdog.js`): a write/edit
507
+ outside the dispatch's declared `scope` globs, the identical tool call repeated 4×,
508
+ 5 consecutive failed tool calls, or 200 total tool calls in one run.
509
+ - **Layer 2 — LLM judge, escalation only**: when a rule fires (single-flight, 90 s
510
+ cooldown), a one-shot cheap run (default model: the researcher persona's; override with
511
+ `watchdog-judge-model`) reads the original task + declared scope + recent tool trail and
512
+ answers `VERDICT: ON_TRACK|DRIFTING|STUCK`. Judge failures fail open.
513
+ - **Intervention**: DRIFTING/STUCK terminates the run as **`drift_stop`** (exit 125,
514
+ partial output preserved) and the dispatch result instructs: re-dispatch ONCE with a
515
+ corrected, narrowed task — never the same task unchanged.
516
+
517
+ Enablement is dynamic, precedence top to bottom: the `watchdog: true|false` param on a
518
+ single `dispatch_agent` call → a per-agent override (`/af-watchdog builder on|off|clear`) →
519
+ the hub-wide setting (`/af-watchdog on|off|auto`, default `auto`, project default via the
520
+ `watchdog:` overrides key). Read-only research helpers are not monitored — they already
521
+ run under the per-tool watchdog + turn deadline and cannot write.
522
+
523
+ ### Dynamic teams
524
+
525
+ Rosters start from `.pi/agents/teams.yaml` but are not frozen there:
526
+
527
+ - `/af-agents-add <persona>…` / `/af-agents-drop <persona>…` — restructure the ACTIVE team
528
+ live (drop refuses running or last members; session files are kept for re-adding).
529
+ - `/af-agents-save <name>` — persist the current roster as a named team back into
530
+ `teams.yaml` (targeted block upsert; comments and other teams untouched).
531
+ - `team_adjust` — the dispatcher itself may add/drop a persona **with a stated reason**;
532
+ disabled in fast mode, capped at 8 roster members, and every change is notified to the
533
+ human. The system prompt is rebuilt each turn, so changes take effect immediately.
534
+
535
+ ### `/af-hub-report`
536
+
537
+ Per-turn cost accounting: dispatches (agent, status, elapsed, billed/output tokens),
538
+ research runs, session recycles, drift stops, and budget/duplicate refusals — for the
539
+ current turn, the last completed turn, and session totals. Billed tokens count
540
+ input + cacheRead + cacheWrite, the same measure the recycler uses.
541
+
542
+ Paths that don't exist produce a session-start warning, never an error. The full key list for
543
+ `## agent-hub` (models, sub-roles, depth budgets, persona gate, research retention, watchdog,
544
+ mode/budget keys) is documented in `docs/agent-fleet-setup.md`.
545
+
546
+ ## The coms layer
547
+
548
+ > The runtime coordination protocols this layer implements (sentinels, push over
549
+ > polling, barriers, fan-out digests, racing) are catalogued in
550
+ > [references/fleet-coordination-patterns.md](../../../references/fleet-coordination-patterns.md).
551
+
552
+ ### Fleet tools (herdr)
553
+
554
+ Inside a [herdr](https://herdr.dev) pane with a live server, the dispatcher's tool
555
+ surface additionally gets (absent otherwise, like coms):
556
+
557
+ - `herdr_spawn_peer` — stand up a persona peer (joins the coms pool via `just _peer`) or a
558
+ raw command pane in the current workspace. The peer joins **this session's `--project` pool**, and
559
+ a name declared in `.pi/agents/peers.yaml` keeps its declared `runner:`/`extensions:`/`env_file:`,
560
+ so a spawn by name is the same agent a team launch would produce. A persona peer **boots idle**
561
+ and does nothing until a `coms_send` reaches it, so the call waits (bounded, ~45s) for it to
562
+ register and returns `peer_ready` plus its coms name instead of a bare pane id; on failure it
563
+ returns the pane's last output, which means the peer did not start rather than that it is slow.
564
+ Peers spawned but never addressed are named at turn end and in `/af-hub-report` with a close
565
+ suggestion — closing stays the human's call.
566
+ Mechanism: herdr's `pane.split` takes **no command** — it opens a shell — so the spawn splits,
567
+ waits for the pane's prompt, and types the argv (text and Enter sent separately, because bash
568
+ bracketed paste would swallow a newline). Only `layout.apply` pane nodes carry an argv, which is
569
+ why `just fleet team` was never affected by this
570
+ - `herdr_read_pane` — bounded `pane.read` (≤200 lines), read-to-decide on workers/tools;
571
+ messaging still goes through coms, and peer busy state comes from `coms_list`, not from
572
+ reading the screen
573
+ - `herdr_close_pane` — kills a pane; **asks the human to confirm every call**; the
574
+ bash-level `herdr pane close`/`workspace close`/`server stop` verbs are hard-blocked
575
+ for spawned specialists by `.pi/damage-control-rules.yaml`
576
+ - `herdr_notify` — desktop notification to reach the human when they are away
577
+
578
+ This closes the fleet loop: spawn a worker, watch it, notify the human, tear it down —
579
+ without leaving the session. Claude Code panes join the same pool via the
580
+ [coms bridge](../../../docs/claude-code-coms-bridge.md).
581
+
582
+ ### Presence backend (herdr or files)
583
+
584
+ Presence is pluggable, exactly as in the standalone [coms harness](../coms/README.md#presence-backends-herdr-vs-files):
585
+ inside a [herdr](https://herdr.dev) pane with a live server, the ping cycle is replaced by
586
+ push events (`agent.list` + `events.subscribe`) and the hub reports itself into the herdr
587
+ sidebar (`custom_status` = `<name> <pct>% q<depth>`); everywhere else the original 10s
588
+ ping loop runs unchanged. The file registry is written in both backends, and the
589
+ pool-scope boundary is enforced identically.
590
+
591
+ ### Identity
592
+
593
+ Each session registers a coms identity at start-up, resolved in this precedence order:
594
+
595
+ 1. **CLI flags** — `--name`, `--purpose`, `--project`, `--color`, `--explicit`
596
+ 2. **Dispatcher persona frontmatter** — `name`, `description` (→ purpose), `color` from the
597
+ selected `kind: orchestrator` persona (see [persona sync](#persona--coms-purpose-sync))
598
+ 3. **Defaults** — auto-generated name `hub-<id>`, purpose `agent-hub dispatcher`, project
599
+ `default`, a deterministic color derived from the session id
600
+
601
+ Names are de-duplicated per project (`resolveUniqueName`), so two hubs that both want `architect`
602
+ become `architect` and `architect-2`. `--explicit` marks a **private** peer — kept out of every
603
+ pool by default, so it is neither listed nor reachable until a human opts in with `/af-coms --all`
604
+ (see [Pool scope is the reach boundary](#pool-scope-is-the-reach-boundary)). The registry lives
605
+ under `~/.pi/coms/projects/<project>/agents/<name>.json` and is created at runtime.
606
+
607
+ ### Commands & tools (local dispatcher plus coms)
608
+
609
+ - `/af-coms` — coms control surface (peer list / status)
610
+ - `/af-handoff <peer>` — hand the whole session off to a coms peer (see [Handoff](#handoff))
611
+ - `/af-compound [focus]` — end-of-session **compound-learning pass**: the dispatcher composes a
612
+ candidate-lessons brief from the session (corrections, recurring findings, root causes),
613
+ confirms it with the user, then dispatches the `documenter` to land the approved lessons as
614
+ minimal diffs on the project's `rules:`/`docs:` targets per `skills/compound-learning/SKILL.md`.
615
+ Requires the `documenter` persona in the active team; run it before `/af-handoff` or session end.
616
+ - `coms_list` — discover the peers in your pool: names, models, live context usage, purpose,
617
+ `pane_id`, and `status` (`idle` | `working` | `booting`). Check status before sending: `working`
618
+ means your send waits behind the peer's current turn, `booting` means it is not addressable yet.
619
+ This is the field whose absence drove 127 `herdr_read_pane` calls in one session. Scoped
620
+ to your project and excluding private peers; the LLM cannot widen it (see
621
+ [Pool scope is the reach boundary](#pool-scope-is-the-reach-boundary)).
622
+ - `coms_send` — send a prompt to a peer **in your pool**; returns a `msg_id`
623
+ - `coms_await` — **block** until that `msg_id`'s reply lands (default 30 min,
624
+ `PI_COMS_TIMEOUT_MS`)
625
+ - `coms_get` — **non-blocking** poll of a `msg_id` (status `pending|complete|error`)
626
+
627
+ `/af-coms` and `/af-handoff` tab-complete live peer names **in your pool**.
628
+
629
+ ### Pool scope is the reach boundary
630
+
631
+ The set of peers shown in the pool widget is the security boundary: **a peer is reachable only if it
632
+ is in your pool.** `coms_list`, `coms_send`, and `/af-handoff` all resolve targets through the same
633
+ `peersInScope()` helper, so the dispatcher can never message a peer it cannot see. Two knobs define
634
+ the pool, and **both are human-only** — the LLM cannot widen scope to reach more peers:
635
+
636
+ - **Project** — defaults to your own `identity.project`. A human can retarget with `/af-coms --project
637
+ <name>` (one project) or `/af-coms --all` (every project). `coms_list`'s own parameters cannot
638
+ override this; an LLM request for a wider project is clamped back to the current pool and flagged.
639
+ - **Explicit (private) peers** — excluded from every pool by default. `/af-coms --all` opts them in.
640
+
641
+ This closes a cross-project leak where a peer reachable through the mesh was *not* shown in the
642
+ default project-scoped pool — so it could be messaged without being "connected." Now the reachable
643
+ set is always a subset of what the widget shows. To reach a peer outside the pool, a human widens
644
+ scope first; the dispatcher is told to **ask** rather than attempt it, and not to pass cross-project
645
+ context to a peer the human has not approved.
646
+
647
+ ### Peer as subagent
648
+
649
+ The dispatcher uses a peer as a subagent by pairing the tools: `coms_send(target, prompt)` to
650
+ issue the task, then `coms_await(msg_id)` to block for the reply (or `coms_get` to poll). This sits
651
+ alongside `dispatch_agent` — local persona specialists are dispatched as subprocesses; remote peers
652
+ are reached over coms. The two paths stay explicit for the LLM, but
653
+ [coms-backed dispatch](#coms-backed-dispatch-dispatch-policyyaml) can route a `dispatch_agent` call
654
+ to a same-name peer under the hood. (The specialist-level `delegate` tool is a third,
655
+ nested path: a dispatched specialist spawning its own declared sub-agents — it does not auto-route
656
+ between local and remote either.) Multi-hop is inherited from coms: a peer handling a dispatched task can `coms_send`
657
+ onward, hops accumulating up to `MAX_HOPS` (5).
658
+
659
+ ### Coms-backed dispatch (dispatch-policy.yaml)
660
+
661
+ `just fleet team <team>` boots the Hub next to standing peers from `.pi/agents/peers.yaml` — and some
662
+ of them (e.g. `code-reviewer`, `plan-reviewer` with `runner: claude-code`) intentionally share a name
663
+ with a team member. `.pi/agents/dispatch-policy.yaml` tells the dispatcher to serve such members
664
+ **through the peer** instead of spawning a native subagent:
665
+
666
+ ```yaml
667
+ default: native # coms = substitute ANY member with a live same-name pool peer
668
+ grace_s: 30 # poll window for coms-required members
669
+ substitutions:
670
+ code-reviewer:
671
+ prefer: coms
672
+ fallback: native # none = coms-required: refuse with guidance instead of spawning
673
+ # timeout_s: 3600 # per-member reply timeout (default PI_COMS_TIMEOUT_MS, 30 min)
674
+ ```
675
+
676
+ Semantics:
677
+
678
+ - **One API.** The dispatcher LLM always calls `dispatch_agent("code-reviewer", …)`; the backend is
679
+ resolved inside `dispatchAgent()`. The whole downstream pipeline — structured return contract,
680
+ `ASK_USER:` extraction, the NEEDS_RESEARCH auto-research pipe, assertions, history, the grid —
681
+ consumes a coms reply exactly like a subagent's final output (the dispatch protocols ride in the
682
+ message body, since a standing peer only receives a user prompt).
683
+ - **Decided per dispatch, against the live pool.** Hub and peers boot in parallel, so the first
684
+ dispatch may land before the peer registers: with `fallback: native` it runs natively (one notice
685
+ per member per team activation), and later dispatches pick up the peer once it is live. With
686
+ `fallback: none` the dispatch polls the pool for `grace_s` seconds, then refuses with remediation
687
+ steps. The name match is scoped to the coms pool — the same security boundary as `coms_send`.
688
+ - **Standing context is the point.** Re-dispatches (ASK_USER answers, research resumes) go back to
689
+ the same peer session, so a Claude Code reviewer keeps its review context across rounds.
690
+ - **Visibility.** The member's grid card shows a `⇄coms <peer-model>` badge, history entries are
691
+ annotated `(coms)`, and `/af-dispatch-policy` prints the resolved routing per member with live-peer
692
+ status.
693
+ - **Limitations.** `/af-agents-kill` on a coms-backed run only abandons the wait — the peer keeps
694
+ running in its own pane and cannot be killed from the hub (`/af-agents-restart` abandons, then
695
+ re-dispatches). `/af-zoom` shows only the final reply (there is no stream), tool counts stay 0, and
696
+ context% is a registry snapshot. `/af-agent-model` overrides apply only to native(-fallback) runs —
697
+ the peer's model is set in `peers.yaml`.
698
+
699
+ Missing file = everything native. HOW a peer runs (persona, model, `runner: claude-code`, env) stays
700
+ in `peers.yaml`; this file only decides WHEN the hub prefers a peer over a native spawn.
701
+
702
+ ### Handoff
703
+
704
+ `/af-handoff <peer>` transfers the session to another **main** agent. Following the plan's
705
+ **decision G1**, it does *not* try to extract a compaction summary; instead it asks the dispatcher
706
+ LLM to compose a **self-contained brief** ("everything the target needs, assume no shared history"),
707
+ then `coms_send`s that brief to the peer, `coms_await`s the reply, and relays it back — in the
708
+ configured user-facing language. When the handoff `coms_send` fires, the hub appends machine-generated
709
+ sections after the LLM brief: `## Verification ledger (verbatim, machine-appended)` with every current
710
+ assertion in canonical ledger form, and `## Artifact index` with artifact paths plus first headings.
711
+ The target peer must treat the machine-appended ledger as the contract, not the paraphrased brief.
712
+ The target peer takes over; the source relays the result. There is no raw session copy (pi sessions
713
+ aren't portable between live agents). The target must be a peer in your pool — `/af-handoff` resolves
714
+ through the same [scope boundary](#pool-scope-is-the-reach-boundary) as `coms_send`, so you cannot
715
+ hand a session to a peer you cannot see.
716
+
717
+ ### Pool widget
718
+
719
+ A live "pool" widget lists connected peers with name, model, and live context usage, refreshed by a
720
+ ping cycle; a keepalive cycle re-writes this session's own registry entry (and self-heals it if an
721
+ external prune removed it). Both timers are `unref`'d so they never hold the process open.
722
+
723
+ ### Persona → coms purpose sync
724
+
725
+ The dispatcher persona gate fires *after* coms init, so the identity's `purpose` starts from the
726
+ flag/frontmatter/default and is then reconciled to the chosen persona: `syncComsPurpose()` maps the
727
+ selected `kind: orchestrator` persona to `"<Name> — <description>"` and re-writes the live registry
728
+ entry — **unless** `--purpose` was passed explicitly (an explicit flag always wins). Switching or
729
+ resetting the persona via `/af-persona` re-syncs.
730
+
731
+ ### Graceful degradation
732
+
733
+ If the coms socket can't bind at start-up (`comsReady` stays `false`), the session degrades to a
734
+ local dispatcher without coms: the `coms_*` tools are withheld from `setActiveTools`, the
735
+ `/af-handoff` command refuses with a notice, and the "Peer agents (coms)" prompt section is omitted.
736
+ Orchestration, research helpers, and the grid keep working.
737
+
738
+ ### Tool surface
739
+
740
+ `setActiveTools` always preserves the orchestration surface and adds coms when ready:
741
+
742
+ ```ts
743
+ const dispatcherTools = ["dispatch_agent", "spawn_research", "set_assertions", "update_assertion", "get_assertions"];
744
+ if (comsReady) dispatcherTools.push("coms_list", "coms_send", "coms_get", "coms_await");
745
+ if (askUserAvailable) dispatcherTools.push("ask_user");
746
+ ```
747
+
748
+ `set_assertions` / `update_assertion` / `get_assertions` are the always-on Verification Contract ledger tools (see
749
+ [What it does](#what-it-does)); like `dispatch_agent` / `spawn_research` they are part of the
750
+ orchestration surface the dispatcher persona never narrows.
751
+
752
+ The dispatcher persona is **flavor-only** (decision G4 / 9) — it enriches the role but never narrows
753
+ this tool set, so coms and dispatch stay available regardless of the chosen persona.
754
+
755
+ ## Optional Hermes local monitor transport
756
+
757
+ The optional monitor is an Agent Fleet-owned transport boundary, not a Hermes runtime API or a
758
+ bundled Hermes plugin. When enabled, `agent-hub` publishes dispatcher-turn and specialist-run
759
+ state and owns generation-safe cancellation. A separate local Hermes UI or operator client may
760
+ consume the owner-only discovery + Unix-socket contract documented in
761
+ [`hermes/README.md`](../../../hermes/README.md#local-agent-hub-monitor-integration).
762
+
763
+ Set these before the hub starts:
764
+
765
+ ```bash
766
+ export AGENT_FLEET_PROFILE_ID="approved-profile-id"
767
+ export AGENT_FLEET_MONITOR_RUNTIME_DIR="/absolute/owner-only/runtime-root"
768
+ ```
769
+
770
+ Both are required for monitor startup; the runtime root must be absolute and owner-only, and the
771
+ profile ID must be a safe identifier. The monitor also starts only for a Herdr-backed hub with
772
+ `HERDR_WORKSPACE_ID` and `HERDR_PANE_ID`; retain those values and `HERDR_SOCKET_PATH` in the
773
+ standard `just fleet team <team>` flow. Workspace labels are display metadata, not monitor identity.
774
+
775
+ The live contract exposes three authenticated newline-delimited JSON requests: `snapshot`, cursor-
776
+ based `output`, and exact-generation `cancel`. The monitor is local-only and fails closed when its
777
+ profile discovery, lease, token, or Unix socket is unavailable. A native cancel targets only the
778
+ matching hub-owned process generation. A coms cancel abandons the local wait only; its peer can
779
+ continue. Neither path controls or closes a Herdr workspace/pane.
780
+
781
+ Example startup:
782
+
783
+ ```bash
784
+ monitor_runtime="${XDG_RUNTIME_DIR:?}/agent-fleet-monitor"
785
+ install -d -m 700 "$monitor_runtime"
786
+ AGENT_FLEET_PROFILE_ID=dev \
787
+ AGENT_FLEET_MONITOR_RUNTIME_DIR="$monitor_runtime" \
788
+ just fleet team default
789
+ ```
790
+
791
+ No Desktop/backend plugin installation is required or provided. Consumers must re-discover after
792
+ lease or socket loss and must never persist or log the token.
793
+
794
+ ## Requires
795
+
796
+ - `.pi/agents/teams.yaml` for fixed specialist teams, the referenced persona `.md` files, and
797
+ (strongly recommended) [`pi-ask-user`](https://github.com/edlsh/pi-ask-user).
798
+ - `.pi/damage-control-rules.yaml` for every guarded `just fleet` Pi mode.
799
+ - Nothing extra in-repo for coms — the peer registry lives at `~/.pi/coms/` and is created at
800
+ runtime.
801
+
802
+ ## Usage
803
+
804
+ ```bash
805
+ # Unified Fleet interface (Fleet Core is loaded first)
806
+ just fleet hub
807
+ just fleet hub --name architect --purpose "owns the migration design" --project myrepo
808
+
809
+ # equivalent direct guarded launch
810
+ pi -e .pi/harnesses/damage-control-continue/index.ts -e .pi/harnesses/ask-user-remote/index.ts -e .pi/harnesses/agent-hub/index.ts
811
+ pi -e .pi/harnesses/damage-control-continue/index.ts -e .pi/harnesses/ask-user-remote/index.ts -e .pi/harnesses/agent-hub/index.ts --name releaser --explicit
812
+
813
+ # direct unguarded launch, only when you intentionally want to skip damage-control
814
+ pi -e .pi/harnesses/agent-hub/index.ts
815
+ ```
816
+
817
+ Identity flags: `--name`, `--purpose`, `--project`, `--color`, `--explicit`.
818
+
819
+ ### Safety scope
820
+
821
+ `just fleet hub` and `just fleet hub --solo` load Fleet Core before `agent-hub`, so guardrails and `ask_user` apply
822
+ to hub/dispatcher tool calls in that parent pi process — and because it is the *continue* variant, a
823
+ blocked dispatcher call feeds back and the turn keeps going rather than aborting. Specialist and
824
+ research agents are spawned as separate pi subprocesses with `--no-extensions` — but `agent-hub`
825
+ resolves `damage-control-continue` from this session's `-e` flags, else the repo-local harness, and
826
+ re-loads it into every native specialist, research helper, and nested delegate via explicit `-e`.
827
+ `--no-extensions` keeps discovery off, so children never auto-load `.pi/extensions/` utilities or
828
+ recursively re-load `agent-hub`; the explicit guardrail still checks every child's tool calls against
829
+ `.pi/damage-control-rules.yaml`. Protected-path blocks escalate to the hub for explicit approval;
830
+ protected deletions offer only Deny or Allow once, while inherently dangerous command patterns are
831
+ non-exemptible. Denial or timeout blocks the call without aborting the child's turn. If continue
832
+ cannot be resolved, dispatch is refused—children are never spawned unguarded. Research helpers are
833
+ additionally read-only by construction. Guided setup enforces `agent-hub` ⇒
834
+ `damage-control-continue` + `ask-user-remote`.
835
+
836
+ ### Related recipes
837
+
838
+ ```bash
839
+ # Hub without coms (fixed specialists + research only)
840
+ just fleet hub --solo
841
+
842
+ # Guarded peers only in a tiled Herdr workspace
843
+ just fleet team full --no-hub
844
+ just fleet team full --no-hub --dry-run
845
+
846
+ # Guarded Hub + peers in one workspace
847
+ just fleet team docs
848
+
849
+ # Snapshot refs / close cleanly / restore conversations
850
+ just fleet snapshot docs
851
+ just fleet down docs
852
+ just fleet resume docs
853
+ ```
854
+
855
+ `peers.yaml` groups reusable peers into named teams; each entry is `name` / `persona`
856
+ (+ optional `model`). The persona's frontmatter `description`/`color` become the peer's
857
+ coms purpose/color.
858
+
859
+ ## How it differs from its sources
860
+
861
+ - **Embedded, not stacked (decision 1).** coms is folded into this one `index.ts`; the identity
862
+ flags are registered once. Loading `coms` as a second `-e` would double-register
863
+ `--name/--purpose/...` and abort start-up.
864
+ - **Single `session_start`.** coms init is folded into the former dispatcher's `session_start` and
865
+ guarded by `if (!comsReady)`, so `/new` reuses the same peer identity (no leaked socket).
866
+ - **Dispatcher is also a peer.** `setActiveTools` lists `coms_*` alongside `dispatch_agent` +
867
+ `spawn_research` (+ `ask_user`); the system prompt gains a "Peer agents (coms)" section when coms
868
+ is ready. The persona's `description` drives the coms `purpose` (decision 6 / Phase 6 peer
869
+ mapping) instead of a static `--purpose`.
870
+ - **`/af-handoff` uses an LLM-composed brief**, not a compaction-summary extraction (decision G1).
871
+ - **Clean shutdown** SIGTERMs any running specialist/research children, clears the coms pool
872
+ widget, and removes the registry entry on `session_shutdown` / SIGINT / SIGTERM.