@chankov/agent-fleet 1.0.2 → 1.0.4

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 (624) hide show
  1. package/.pi/harnesses/agent-hub/README.md +85 -71
  2. package/.pi/harnesses/agent-hub/context-window.js +1 -1
  3. package/.pi/harnesses/agent-hub/delegate.ts +14 -3
  4. package/.pi/harnesses/agent-hub/drift-watchdog.js +11 -4
  5. package/.pi/harnesses/agent-hub/execution-profile.ts +69 -0
  6. package/.pi/harnesses/agent-hub/footer.ts +3 -2
  7. package/.pi/harnesses/agent-hub/hub-state-audit.js +0 -14
  8. package/.pi/harnesses/agent-hub/index.ts +562 -300
  9. package/.pi/harnesses/agent-hub/package.json +1 -1
  10. package/.pi/harnesses/agent-hub/provider-semaphore.js +1 -1
  11. package/.pi/harnesses/agent-hub/run-budget.js +67 -69
  12. package/.pi/harnesses/agent-hub/spawn.ts +25 -3
  13. package/.pi/harnesses/coms/package.json +1 -1
  14. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  15. package/.pi/harnesses/lib/fleet-dashboard-ops.ts +2 -2
  16. package/.pi/harnesses/lib/fleet-dashboard-view.ts +3 -1
  17. package/.pi/harnesses/lib/fleet-detail-view.ts +134 -20
  18. package/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  19. package/.pi/prompts/af-plan.md +6 -5
  20. package/.versions/1.0.3/.pi/agents/dispatch-policy.yaml +32 -0
  21. package/.versions/1.0.3/.pi/agents/model-profiles.yaml +27 -0
  22. package/.versions/1.0.3/.pi/agents/peers.yaml +142 -0
  23. package/.versions/1.0.3/.pi/agents/teams.yaml +41 -0
  24. package/.versions/1.0.3/.pi/damage-control-rules.yaml +297 -0
  25. package/.versions/1.0.3/.pi/extensions/agent-fleet-update-check/README.md +57 -0
  26. package/.versions/1.0.3/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  27. package/.versions/1.0.3/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  28. package/.versions/1.0.3/.pi/extensions/btw/README.md +120 -0
  29. package/.versions/1.0.3/.pi/extensions/btw/index.ts +914 -0
  30. package/.versions/1.0.3/.pi/extensions/btw/package.json +6 -0
  31. package/.versions/1.0.3/.pi/extensions/btw/state.js +179 -0
  32. package/.versions/1.0.3/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  33. package/.versions/1.0.3/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  34. package/.versions/1.0.3/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  35. package/.versions/1.0.3/.pi/extensions/compact-and-continue/README.md +42 -0
  36. package/.versions/1.0.3/.pi/extensions/compact-and-continue/index.ts +120 -0
  37. package/.versions/1.0.3/.pi/extensions/compact-and-continue/package.json +6 -0
  38. package/.versions/1.0.3/.pi/extensions/mcp-bridge/README.md +46 -0
  39. package/.versions/1.0.3/.pi/extensions/mcp-bridge/index.ts +206 -0
  40. package/.versions/1.0.3/.pi/extensions/mcp-bridge/package.json +6 -0
  41. package/.versions/1.0.3/.pi/extensions/package-lock.json +1175 -0
  42. package/.versions/1.0.3/.pi/extensions/package.json +9 -0
  43. package/.versions/1.0.3/.pi/extensions/pi-voice-stt/README.md +205 -0
  44. package/.versions/1.0.3/.pi/extensions/pi-voice-stt/config.ts +198 -0
  45. package/.versions/1.0.3/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  46. package/.versions/1.0.3/.pi/extensions/pi-voice-stt/index.ts +248 -0
  47. package/.versions/1.0.3/.pi/extensions/pi-voice-stt/package.json +6 -0
  48. package/.versions/1.0.3/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  49. package/.versions/1.0.3/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  50. package/.versions/1.0.3/.pi/harnesses/agent-hub/README.md +1156 -0
  51. package/.versions/1.0.3/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  52. package/.versions/1.0.3/.pi/harnesses/agent-hub/artifacts.js +146 -0
  53. package/.versions/1.0.3/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
  54. package/.versions/1.0.3/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  55. package/.versions/1.0.3/.pi/harnesses/agent-hub/budget-continuation.ts +73 -0
  56. package/.versions/1.0.3/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  57. package/.versions/1.0.3/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
  58. package/.versions/1.0.3/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  59. package/.versions/1.0.3/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
  60. package/.versions/1.0.3/.pi/harnesses/agent-hub/context-window.js +106 -0
  61. package/.versions/1.0.3/.pi/harnesses/agent-hub/delegate.ts +435 -0
  62. package/.versions/1.0.3/.pi/harnesses/agent-hub/docs-lane.js +122 -0
  63. package/.versions/1.0.3/.pi/harnesses/agent-hub/drift-watchdog.js +218 -0
  64. package/.versions/1.0.3/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  65. package/.versions/1.0.3/.pi/harnesses/agent-hub/execution-profile.ts +69 -0
  66. package/.versions/1.0.3/.pi/harnesses/agent-hub/external-blocker.js +85 -0
  67. package/.versions/1.0.3/.pi/harnesses/agent-hub/footer.ts +36 -0
  68. package/.versions/1.0.3/.pi/harnesses/agent-hub/helpers.ts +266 -0
  69. package/.versions/1.0.3/.pi/harnesses/agent-hub/hub-state-audit.js +59 -0
  70. package/.versions/1.0.3/.pi/harnesses/agent-hub/index.ts +9999 -0
  71. package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  72. package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  73. package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  74. package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  75. package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  76. package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  77. package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  78. package/.versions/1.0.3/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  79. package/.versions/1.0.3/.pi/harnesses/agent-hub/package.json +7 -0
  80. package/.versions/1.0.3/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  81. package/.versions/1.0.3/.pi/harnesses/agent-hub/posture.ts +158 -0
  82. package/.versions/1.0.3/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  83. package/.versions/1.0.3/.pi/harnesses/agent-hub/research-retention.js +34 -0
  84. package/.versions/1.0.3/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  85. package/.versions/1.0.3/.pi/harnesses/agent-hub/return-contract.js +293 -0
  86. package/.versions/1.0.3/.pi/harnesses/agent-hub/return-extract.js +75 -0
  87. package/.versions/1.0.3/.pi/harnesses/agent-hub/review-findings.js +102 -0
  88. package/.versions/1.0.3/.pi/harnesses/agent-hub/run-budget.js +537 -0
  89. package/.versions/1.0.3/.pi/harnesses/agent-hub/run-namespace.js +87 -0
  90. package/.versions/1.0.3/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  91. package/.versions/1.0.3/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  92. package/.versions/1.0.3/.pi/harnesses/agent-hub/session-health.js +110 -0
  93. package/.versions/1.0.3/.pi/harnesses/agent-hub/spawn.ts +366 -0
  94. package/.versions/1.0.3/.pi/harnesses/agent-hub/version.ts +42 -0
  95. package/.versions/1.0.3/.pi/harnesses/ask-user-remote/README.md +53 -0
  96. package/.versions/1.0.3/.pi/harnesses/ask-user-remote/index.ts +532 -0
  97. package/.versions/1.0.3/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  98. package/.versions/1.0.3/.pi/harnesses/coms/README.md +100 -0
  99. package/.versions/1.0.3/.pi/harnesses/coms/index.ts +1767 -0
  100. package/.versions/1.0.3/.pi/harnesses/coms/package.json +7 -0
  101. package/.versions/1.0.3/.pi/harnesses/coms/version.ts +42 -0
  102. package/.versions/1.0.3/.pi/harnesses/damage-control-continue/README.md +124 -0
  103. package/.versions/1.0.3/.pi/harnesses/damage-control-continue/index.ts +536 -0
  104. package/.versions/1.0.3/.pi/harnesses/damage-control-continue/package.json +7 -0
  105. package/.versions/1.0.3/.pi/harnesses/damage-control-continue/version.ts +42 -0
  106. package/.versions/1.0.3/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  107. package/.versions/1.0.3/.pi/harnesses/lib/context-budget-child-prompt.ts +179 -0
  108. package/.versions/1.0.3/.pi/harnesses/lib/context-budget-hub-prompt.ts +116 -0
  109. package/.versions/1.0.3/.pi/harnesses/lib/context-budget-view.ts +107 -0
  110. package/.versions/1.0.3/.pi/harnesses/lib/context-budget.ts +114 -0
  111. package/.versions/1.0.3/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  112. package/.versions/1.0.3/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  113. package/.versions/1.0.3/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  114. package/.versions/1.0.3/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  115. package/.versions/1.0.3/.pi/harnesses/lib/fleet-dashboard-ops.ts +155 -0
  116. package/.versions/1.0.3/.pi/harnesses/lib/fleet-dashboard-view.ts +142 -0
  117. package/.versions/1.0.3/.pi/harnesses/lib/fleet-detail-view.ts +168 -0
  118. package/.versions/1.0.3/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  119. package/.versions/1.0.3/.pi/harnesses/lib/fleet-panel.ts +34 -0
  120. package/.versions/1.0.3/.pi/harnesses/lib/fleet-read-model.ts +131 -0
  121. package/.versions/1.0.3/.pi/harnesses/lib/fleet-selection.ts +24 -0
  122. package/.versions/1.0.3/.pi/harnesses/lib/herdr-client.ts +472 -0
  123. package/.versions/1.0.3/.pi/harnesses/lib/herdr-presence.ts +399 -0
  124. package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  125. package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  126. package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  127. package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  128. package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  129. package/.versions/1.0.3/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  130. package/.versions/1.0.3/.pi/harnesses/lib/spawned-peers.js +190 -0
  131. package/.versions/1.0.3/.pi/harnesses/package-lock.json +2039 -0
  132. package/.versions/1.0.3/.pi/harnesses/package.json +10 -0
  133. package/.versions/1.0.3/.pi/prompts/af-build.md +24 -0
  134. package/.versions/1.0.3/.pi/prompts/af-code-simplify.md +22 -0
  135. package/.versions/1.0.3/.pi/prompts/af-plan.md +16 -0
  136. package/.versions/1.0.3/.pi/prompts/af-review.md +16 -0
  137. package/.versions/1.0.3/.pi/prompts/af-set-hermes-telegram.md +15 -0
  138. package/.versions/1.0.3/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  139. package/.versions/1.0.3/.pi/prompts/af-ship.md +17 -0
  140. package/.versions/1.0.3/.pi/prompts/af-spec.md +15 -0
  141. package/.versions/1.0.3/.pi/prompts/af-test.md +19 -0
  142. package/.versions/1.0.3/.pi/skills/bowser/SKILL.md +145 -0
  143. package/.versions/1.0.3/.version +1 -0
  144. package/.versions/1.0.3/agents/architect.md +25 -0
  145. package/.versions/1.0.3/agents/bowser.md +28 -0
  146. package/.versions/1.0.3/agents/builder.md +55 -0
  147. package/.versions/1.0.3/agents/code-reviewer.md +209 -0
  148. package/.versions/1.0.3/agents/deep-researcher.md +33 -0
  149. package/.versions/1.0.3/agents/documenter.md +19 -0
  150. package/.versions/1.0.3/agents/orchestrator.md +21 -0
  151. package/.versions/1.0.3/agents/plan-reviewer.md +84 -0
  152. package/.versions/1.0.3/agents/planner.md +71 -0
  153. package/.versions/1.0.3/agents/releaser.md +25 -0
  154. package/.versions/1.0.3/agents/researcher.md +29 -0
  155. package/.versions/1.0.3/agents/security-auditor.md +168 -0
  156. package/.versions/1.0.3/agents/test-engineer.md +154 -0
  157. package/.versions/1.0.3/agents/web-debugger.md +44 -0
  158. package/.versions/1.0.3/agents/web-performance-auditor.md +194 -0
  159. package/.versions/1.0.3/bin/catalog/harness-runtime-closure.json +38 -0
  160. package/.versions/1.0.3/codex/CONDUCTOR.md +148 -0
  161. package/.versions/1.0.3/docs/ARCHITECTURE.md +375 -0
  162. package/.versions/1.0.3/docs/agent-fleet-setup.md +468 -0
  163. package/.versions/1.0.3/docs/claude-code-coms-bridge.md +128 -0
  164. package/.versions/1.0.3/docs/codex-remote-conductor.md +170 -0
  165. package/.versions/1.0.3/docs/coms-hermes-bridge.md +189 -0
  166. package/.versions/1.0.3/docs/getting-started.md +98 -0
  167. package/.versions/1.0.3/docs/npm-install.md +292 -0
  168. package/.versions/1.0.3/docs/pi-extensions.md +441 -0
  169. package/.versions/1.0.3/docs/pi-setup.md +74 -0
  170. package/.versions/1.0.3/docs/skill-anatomy.md +150 -0
  171. package/.versions/1.0.3/hermes/README.md +347 -0
  172. package/.versions/1.0.3/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  173. package/.versions/1.0.3/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  174. package/.versions/1.0.3/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  175. package/.versions/1.0.3/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  176. package/.versions/1.0.3/hermes/gates/gate-o-capability.md +8 -0
  177. package/.versions/1.0.3/hermes/gates/gate-o-validator-fixtures.json +1 -0
  178. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
  179. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  180. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  181. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  182. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  183. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  184. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  185. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  186. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  187. package/.versions/1.0.3/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  188. package/.versions/1.0.3/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  189. package/.versions/1.0.3/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  190. package/.versions/1.0.3/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  191. package/.versions/1.0.3/hermes/skills/hub-conductor/SKILL.md +84 -0
  192. package/.versions/1.0.3/hermes/skills/hub-liaison/SKILL.md +84 -0
  193. package/.versions/1.0.3/hermes/skills/hub-watchdog/SKILL.md +76 -0
  194. package/.versions/1.0.3/hermes/skills/hub-watchdog/manifest.json +1 -0
  195. package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  196. package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  197. package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  198. package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  199. package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  200. package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  201. package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  202. package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  203. package/.versions/1.0.3/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  204. package/.versions/1.0.3/hermes/watchdog-tests/__init__.py +0 -0
  205. package/.versions/1.0.3/hooks/coms-stop-hook.mjs +84 -0
  206. package/.versions/1.0.3/install-manifest.json +2745 -0
  207. package/.versions/1.0.3/justfile +272 -0
  208. package/.versions/1.0.3/manifest-meta.json +882 -0
  209. package/.versions/1.0.3/references/accessibility-checklist.md +160 -0
  210. package/.versions/1.0.3/references/definition-of-done.md +67 -0
  211. package/.versions/1.0.3/references/fleet-coordination-patterns.md +151 -0
  212. package/.versions/1.0.3/references/observability-checklist.md +91 -0
  213. package/.versions/1.0.3/references/orchestration-patterns.md +370 -0
  214. package/.versions/1.0.3/references/performance-checklist.md +153 -0
  215. package/.versions/1.0.3/references/prompting-patterns.md +380 -0
  216. package/.versions/1.0.3/references/security-checklist.md +179 -0
  217. package/.versions/1.0.3/references/testing-patterns.md +236 -0
  218. package/.versions/1.0.3/scripts/codex-conductor.ts +41 -0
  219. package/.versions/1.0.3/scripts/codex-remote-control.ts +167 -0
  220. package/.versions/1.0.3/scripts/coms-claude-bridge.ts +411 -0
  221. package/.versions/1.0.3/scripts/coms-cli.ts +484 -0
  222. package/.versions/1.0.3/scripts/coms-hermes-bridge.ts +413 -0
  223. package/.versions/1.0.3/scripts/fleet.ts +185 -0
  224. package/.versions/1.0.3/scripts/hermes-monitor-capability-runner.ts +25 -0
  225. package/.versions/1.0.3/scripts/hermes-monitor-scenario.ts +474 -0
  226. package/.versions/1.0.3/scripts/hermes-watchdog-capability-probe.ts +45 -0
  227. package/.versions/1.0.3/scripts/install-hermes-plugin.sh +180 -0
  228. package/.versions/1.0.3/scripts/lib/claude-bridge-core.ts +210 -0
  229. package/.versions/1.0.3/scripts/lib/codex-conductor.ts +88 -0
  230. package/.versions/1.0.3/scripts/lib/codex-remote-control.ts +480 -0
  231. package/.versions/1.0.3/scripts/lib/coms-envelope.ts +582 -0
  232. package/.versions/1.0.3/scripts/lib/fake-herdr-server.ts +88 -0
  233. package/.versions/1.0.3/scripts/lib/fleet-command.ts +266 -0
  234. package/.versions/1.0.3/scripts/lib/herdr-layout.ts +281 -0
  235. package/.versions/1.0.3/scripts/lib/hermes-bridge-core.ts +241 -0
  236. package/.versions/1.0.3/scripts/lib/hermes-monitor-events.ts +1 -0
  237. package/.versions/1.0.3/scripts/lib/hermes-monitor-herdr.ts +2 -0
  238. package/.versions/1.0.3/scripts/lib/hermes-monitor-model.ts +3 -0
  239. package/.versions/1.0.3/scripts/lib/hermes-monitor-registry.ts +2 -0
  240. package/.versions/1.0.3/scripts/lib/hermes-monitor-socket.ts +2 -0
  241. package/.versions/1.0.3/scripts/lib/hermes-monitor-store.ts +2 -0
  242. package/.versions/1.0.3/scripts/lib/monitor-env.ts +146 -0
  243. package/.versions/1.0.3/scripts/lib/peer-launch.ts +318 -0
  244. package/.versions/1.0.3/scripts/lib/persona-banner.ts +62 -0
  245. package/.versions/1.0.3/scripts/lib/spawn-stagger.ts +101 -0
  246. package/.versions/1.0.3/scripts/lib/team-project.ts +213 -0
  247. package/.versions/1.0.3/scripts/lib/team-snapshot.ts +147 -0
  248. package/.versions/1.0.3/scripts/peer-banner.ts +40 -0
  249. package/.versions/1.0.3/scripts/peer-launch.ts +259 -0
  250. package/.versions/1.0.3/scripts/team-snapshot.ts +237 -0
  251. package/.versions/1.0.3/scripts/team-up.ts +406 -0
  252. package/.versions/1.0.3/skills/_internal/grilling.md +11 -0
  253. package/.versions/1.0.3/skills/browser-testing-with-devtools/SKILL.md +351 -0
  254. package/.versions/1.0.3/skills/code-review-and-quality/SKILL.md +381 -0
  255. package/.versions/1.0.3/skills/compound-learning/SKILL.md +137 -0
  256. package/.versions/1.0.3/skills/context-engineering/SKILL.md +291 -0
  257. package/.versions/1.0.3/skills/deprecation-and-migration/SKILL.md +206 -0
  258. package/.versions/1.0.3/skills/designing-agents/SKILL.md +394 -0
  259. package/.versions/1.0.3/skills/designing-agents/pi-harness-authoring.md +222 -0
  260. package/.versions/1.0.3/skills/frontend-ui-engineering/SKILL.md +328 -0
  261. package/.versions/1.0.3/skills/git-workflow-and-versioning/SKILL.md +316 -0
  262. package/.versions/1.0.3/skills/idea-refine/SKILL.md +182 -0
  263. package/.versions/1.0.3/skills/idea-refine/examples.md +238 -0
  264. package/.versions/1.0.3/skills/idea-refine/frameworks.md +99 -0
  265. package/.versions/1.0.3/skills/idea-refine/refinement-criteria.md +113 -0
  266. package/.versions/1.0.3/skills/idea-refine/scripts/idea-refine.sh +15 -0
  267. package/.versions/1.0.3/skills/incremental-implementation/SKILL.md +287 -0
  268. package/.versions/1.0.3/skills/interview-me/SKILL.md +226 -0
  269. package/.versions/1.0.3/skills/orchestration-verification/SKILL.md +181 -0
  270. package/.versions/1.0.3/skills/peer-coms/SKILL.md +90 -0
  271. package/.versions/1.0.3/skills/performance-optimization/SKILL.md +350 -0
  272. package/.versions/1.0.3/skills/planning-and-task-breakdown/SKILL.md +254 -0
  273. package/.versions/1.0.3/skills/security-and-hardening/SKILL.md +461 -0
  274. package/.versions/1.0.3/skills/spec-driven-development/SKILL.md +257 -0
  275. package/.versions/1.0.3/skills/using-agent-skills/SKILL.md +199 -0
  276. package/.versions/1.0.3/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  277. package/.versions/1.0.3/vendor/agent-skills-upstream/LICENSE +21 -0
  278. package/.versions/1.0.3/vendor/agent-skills-upstream/README.md +11 -0
  279. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  280. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  281. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  282. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  283. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  284. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  285. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  286. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  287. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  288. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  289. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  290. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  291. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  292. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  293. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  294. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  295. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  296. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  297. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  298. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  299. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  300. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  301. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  302. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  303. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  304. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  305. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  306. package/.versions/1.0.3/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  307. package/.versions/1.0.4/.pi/agents/dispatch-policy.yaml +32 -0
  308. package/.versions/1.0.4/.pi/agents/model-profiles.yaml +27 -0
  309. package/.versions/1.0.4/.pi/agents/peers.yaml +142 -0
  310. package/.versions/1.0.4/.pi/agents/teams.yaml +41 -0
  311. package/.versions/1.0.4/.pi/damage-control-rules.yaml +297 -0
  312. package/.versions/1.0.4/.pi/extensions/agent-fleet-update-check/README.md +57 -0
  313. package/.versions/1.0.4/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  314. package/.versions/1.0.4/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  315. package/.versions/1.0.4/.pi/extensions/btw/README.md +120 -0
  316. package/.versions/1.0.4/.pi/extensions/btw/index.ts +914 -0
  317. package/.versions/1.0.4/.pi/extensions/btw/package.json +6 -0
  318. package/.versions/1.0.4/.pi/extensions/btw/state.js +179 -0
  319. package/.versions/1.0.4/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  320. package/.versions/1.0.4/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  321. package/.versions/1.0.4/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  322. package/.versions/1.0.4/.pi/extensions/compact-and-continue/README.md +42 -0
  323. package/.versions/1.0.4/.pi/extensions/compact-and-continue/index.ts +120 -0
  324. package/.versions/1.0.4/.pi/extensions/compact-and-continue/package.json +6 -0
  325. package/.versions/1.0.4/.pi/extensions/mcp-bridge/README.md +46 -0
  326. package/.versions/1.0.4/.pi/extensions/mcp-bridge/index.ts +206 -0
  327. package/.versions/1.0.4/.pi/extensions/mcp-bridge/package.json +6 -0
  328. package/.versions/1.0.4/.pi/extensions/package-lock.json +1175 -0
  329. package/.versions/1.0.4/.pi/extensions/package.json +9 -0
  330. package/.versions/1.0.4/.pi/extensions/pi-voice-stt/README.md +205 -0
  331. package/.versions/1.0.4/.pi/extensions/pi-voice-stt/config.ts +198 -0
  332. package/.versions/1.0.4/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  333. package/.versions/1.0.4/.pi/extensions/pi-voice-stt/index.ts +248 -0
  334. package/.versions/1.0.4/.pi/extensions/pi-voice-stt/package.json +6 -0
  335. package/.versions/1.0.4/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  336. package/.versions/1.0.4/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  337. package/.versions/1.0.4/.pi/harnesses/agent-hub/README.md +1170 -0
  338. package/.versions/1.0.4/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  339. package/.versions/1.0.4/.pi/harnesses/agent-hub/artifacts.js +146 -0
  340. package/.versions/1.0.4/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
  341. package/.versions/1.0.4/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  342. package/.versions/1.0.4/.pi/harnesses/agent-hub/budget-continuation.ts +73 -0
  343. package/.versions/1.0.4/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  344. package/.versions/1.0.4/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
  345. package/.versions/1.0.4/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  346. package/.versions/1.0.4/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
  347. package/.versions/1.0.4/.pi/harnesses/agent-hub/context-window.js +106 -0
  348. package/.versions/1.0.4/.pi/harnesses/agent-hub/delegate.ts +446 -0
  349. package/.versions/1.0.4/.pi/harnesses/agent-hub/docs-lane.js +122 -0
  350. package/.versions/1.0.4/.pi/harnesses/agent-hub/drift-watchdog.js +218 -0
  351. package/.versions/1.0.4/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  352. package/.versions/1.0.4/.pi/harnesses/agent-hub/execution-profile.ts +69 -0
  353. package/.versions/1.0.4/.pi/harnesses/agent-hub/external-blocker.js +85 -0
  354. package/.versions/1.0.4/.pi/harnesses/agent-hub/footer.ts +36 -0
  355. package/.versions/1.0.4/.pi/harnesses/agent-hub/helpers.ts +266 -0
  356. package/.versions/1.0.4/.pi/harnesses/agent-hub/hub-state-audit.js +59 -0
  357. package/.versions/1.0.4/.pi/harnesses/agent-hub/index.ts +10171 -0
  358. package/.versions/1.0.4/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  359. package/.versions/1.0.4/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  360. package/.versions/1.0.4/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  361. package/.versions/1.0.4/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  362. package/.versions/1.0.4/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  363. package/.versions/1.0.4/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  364. package/.versions/1.0.4/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  365. package/.versions/1.0.4/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  366. package/.versions/1.0.4/.pi/harnesses/agent-hub/package.json +7 -0
  367. package/.versions/1.0.4/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  368. package/.versions/1.0.4/.pi/harnesses/agent-hub/posture.ts +158 -0
  369. package/.versions/1.0.4/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  370. package/.versions/1.0.4/.pi/harnesses/agent-hub/research-retention.js +34 -0
  371. package/.versions/1.0.4/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  372. package/.versions/1.0.4/.pi/harnesses/agent-hub/return-contract.js +293 -0
  373. package/.versions/1.0.4/.pi/harnesses/agent-hub/return-extract.js +75 -0
  374. package/.versions/1.0.4/.pi/harnesses/agent-hub/review-findings.js +102 -0
  375. package/.versions/1.0.4/.pi/harnesses/agent-hub/run-budget.js +537 -0
  376. package/.versions/1.0.4/.pi/harnesses/agent-hub/run-namespace.js +87 -0
  377. package/.versions/1.0.4/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  378. package/.versions/1.0.4/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  379. package/.versions/1.0.4/.pi/harnesses/agent-hub/session-health.js +110 -0
  380. package/.versions/1.0.4/.pi/harnesses/agent-hub/spawn.ts +388 -0
  381. package/.versions/1.0.4/.pi/harnesses/agent-hub/version.ts +42 -0
  382. package/.versions/1.0.4/.pi/harnesses/ask-user-remote/README.md +53 -0
  383. package/.versions/1.0.4/.pi/harnesses/ask-user-remote/index.ts +532 -0
  384. package/.versions/1.0.4/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  385. package/.versions/1.0.4/.pi/harnesses/coms/README.md +100 -0
  386. package/.versions/1.0.4/.pi/harnesses/coms/index.ts +1767 -0
  387. package/.versions/1.0.4/.pi/harnesses/coms/package.json +7 -0
  388. package/.versions/1.0.4/.pi/harnesses/coms/version.ts +42 -0
  389. package/.versions/1.0.4/.pi/harnesses/damage-control-continue/README.md +124 -0
  390. package/.versions/1.0.4/.pi/harnesses/damage-control-continue/index.ts +536 -0
  391. package/.versions/1.0.4/.pi/harnesses/damage-control-continue/package.json +7 -0
  392. package/.versions/1.0.4/.pi/harnesses/damage-control-continue/version.ts +42 -0
  393. package/.versions/1.0.4/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  394. package/.versions/1.0.4/.pi/harnesses/lib/context-budget-child-prompt.ts +179 -0
  395. package/.versions/1.0.4/.pi/harnesses/lib/context-budget-hub-prompt.ts +116 -0
  396. package/.versions/1.0.4/.pi/harnesses/lib/context-budget-view.ts +107 -0
  397. package/.versions/1.0.4/.pi/harnesses/lib/context-budget.ts +114 -0
  398. package/.versions/1.0.4/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  399. package/.versions/1.0.4/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  400. package/.versions/1.0.4/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  401. package/.versions/1.0.4/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  402. package/.versions/1.0.4/.pi/harnesses/lib/fleet-dashboard-ops.ts +155 -0
  403. package/.versions/1.0.4/.pi/harnesses/lib/fleet-dashboard-view.ts +142 -0
  404. package/.versions/1.0.4/.pi/harnesses/lib/fleet-detail-view.ts +247 -0
  405. package/.versions/1.0.4/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  406. package/.versions/1.0.4/.pi/harnesses/lib/fleet-panel.ts +34 -0
  407. package/.versions/1.0.4/.pi/harnesses/lib/fleet-read-model.ts +131 -0
  408. package/.versions/1.0.4/.pi/harnesses/lib/fleet-selection.ts +24 -0
  409. package/.versions/1.0.4/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  410. package/.versions/1.0.4/.pi/harnesses/lib/herdr-client.ts +472 -0
  411. package/.versions/1.0.4/.pi/harnesses/lib/herdr-presence.ts +399 -0
  412. package/.versions/1.0.4/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  413. package/.versions/1.0.4/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  414. package/.versions/1.0.4/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  415. package/.versions/1.0.4/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  416. package/.versions/1.0.4/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  417. package/.versions/1.0.4/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  418. package/.versions/1.0.4/.pi/harnesses/lib/spawned-peers.js +190 -0
  419. package/.versions/1.0.4/.pi/harnesses/package-lock.json +2039 -0
  420. package/.versions/1.0.4/.pi/harnesses/package.json +10 -0
  421. package/.versions/1.0.4/.pi/prompts/af-build.md +24 -0
  422. package/.versions/1.0.4/.pi/prompts/af-code-simplify.md +22 -0
  423. package/.versions/1.0.4/.pi/prompts/af-plan.md +17 -0
  424. package/.versions/1.0.4/.pi/prompts/af-review.md +16 -0
  425. package/.versions/1.0.4/.pi/prompts/af-set-hermes-telegram.md +15 -0
  426. package/.versions/1.0.4/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  427. package/.versions/1.0.4/.pi/prompts/af-ship.md +17 -0
  428. package/.versions/1.0.4/.pi/prompts/af-spec.md +15 -0
  429. package/.versions/1.0.4/.pi/prompts/af-test.md +19 -0
  430. package/.versions/1.0.4/.pi/skills/bowser/SKILL.md +145 -0
  431. package/.versions/1.0.4/.version +1 -0
  432. package/.versions/1.0.4/agents/architect.md +25 -0
  433. package/.versions/1.0.4/agents/bowser.md +28 -0
  434. package/.versions/1.0.4/agents/builder.md +56 -0
  435. package/.versions/1.0.4/agents/code-reviewer.md +209 -0
  436. package/.versions/1.0.4/agents/deep-researcher.md +33 -0
  437. package/.versions/1.0.4/agents/documenter.md +19 -0
  438. package/.versions/1.0.4/agents/orchestrator.md +21 -0
  439. package/.versions/1.0.4/agents/plan-reviewer.md +84 -0
  440. package/.versions/1.0.4/agents/planner.md +71 -0
  441. package/.versions/1.0.4/agents/releaser.md +25 -0
  442. package/.versions/1.0.4/agents/researcher.md +29 -0
  443. package/.versions/1.0.4/agents/security-auditor.md +168 -0
  444. package/.versions/1.0.4/agents/test-engineer.md +154 -0
  445. package/.versions/1.0.4/agents/web-debugger.md +44 -0
  446. package/.versions/1.0.4/agents/web-performance-auditor.md +194 -0
  447. package/.versions/1.0.4/bin/catalog/harness-runtime-closure.json +38 -0
  448. package/.versions/1.0.4/codex/CONDUCTOR.md +148 -0
  449. package/.versions/1.0.4/docs/ARCHITECTURE.md +375 -0
  450. package/.versions/1.0.4/docs/agent-fleet-setup.md +468 -0
  451. package/.versions/1.0.4/docs/claude-code-coms-bridge.md +128 -0
  452. package/.versions/1.0.4/docs/codex-remote-conductor.md +170 -0
  453. package/.versions/1.0.4/docs/coms-hermes-bridge.md +189 -0
  454. package/.versions/1.0.4/docs/getting-started.md +98 -0
  455. package/.versions/1.0.4/docs/npm-install.md +292 -0
  456. package/.versions/1.0.4/docs/pi-extensions.md +441 -0
  457. package/.versions/1.0.4/docs/pi-setup.md +74 -0
  458. package/.versions/1.0.4/docs/skill-anatomy.md +150 -0
  459. package/.versions/1.0.4/hermes/README.md +347 -0
  460. package/.versions/1.0.4/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  461. package/.versions/1.0.4/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  462. package/.versions/1.0.4/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  463. package/.versions/1.0.4/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  464. package/.versions/1.0.4/hermes/gates/gate-o-capability.md +8 -0
  465. package/.versions/1.0.4/hermes/gates/gate-o-validator-fixtures.json +1 -0
  466. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
  467. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  468. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  469. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  470. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  471. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  472. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  473. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  474. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  475. package/.versions/1.0.4/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  476. package/.versions/1.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  477. package/.versions/1.0.4/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  478. package/.versions/1.0.4/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  479. package/.versions/1.0.4/hermes/skills/hub-conductor/SKILL.md +84 -0
  480. package/.versions/1.0.4/hermes/skills/hub-liaison/SKILL.md +84 -0
  481. package/.versions/1.0.4/hermes/skills/hub-watchdog/SKILL.md +76 -0
  482. package/.versions/1.0.4/hermes/skills/hub-watchdog/manifest.json +1 -0
  483. package/.versions/1.0.4/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  484. package/.versions/1.0.4/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  485. package/.versions/1.0.4/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  486. package/.versions/1.0.4/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  487. package/.versions/1.0.4/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  488. package/.versions/1.0.4/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  489. package/.versions/1.0.4/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  490. package/.versions/1.0.4/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  491. package/.versions/1.0.4/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  492. package/.versions/1.0.4/hermes/watchdog-tests/__init__.py +0 -0
  493. package/.versions/1.0.4/hooks/coms-stop-hook.mjs +84 -0
  494. package/.versions/1.0.4/install-manifest.json +2745 -0
  495. package/.versions/1.0.4/justfile +272 -0
  496. package/.versions/1.0.4/manifest-meta.json +882 -0
  497. package/.versions/1.0.4/references/accessibility-checklist.md +160 -0
  498. package/.versions/1.0.4/references/definition-of-done.md +67 -0
  499. package/.versions/1.0.4/references/fleet-coordination-patterns.md +151 -0
  500. package/.versions/1.0.4/references/observability-checklist.md +91 -0
  501. package/.versions/1.0.4/references/orchestration-patterns.md +370 -0
  502. package/.versions/1.0.4/references/performance-checklist.md +153 -0
  503. package/.versions/1.0.4/references/prompting-patterns.md +380 -0
  504. package/.versions/1.0.4/references/security-checklist.md +179 -0
  505. package/.versions/1.0.4/references/testing-patterns.md +236 -0
  506. package/.versions/1.0.4/scripts/codex-conductor.ts +41 -0
  507. package/.versions/1.0.4/scripts/codex-remote-control.ts +167 -0
  508. package/.versions/1.0.4/scripts/coms-claude-bridge.ts +411 -0
  509. package/.versions/1.0.4/scripts/coms-cli.ts +484 -0
  510. package/.versions/1.0.4/scripts/coms-hermes-bridge.ts +413 -0
  511. package/.versions/1.0.4/scripts/fleet.ts +185 -0
  512. package/.versions/1.0.4/scripts/hermes-monitor-capability-runner.ts +25 -0
  513. package/.versions/1.0.4/scripts/hermes-monitor-scenario.ts +474 -0
  514. package/.versions/1.0.4/scripts/hermes-watchdog-capability-probe.ts +45 -0
  515. package/.versions/1.0.4/scripts/install-hermes-plugin.sh +180 -0
  516. package/.versions/1.0.4/scripts/lib/claude-bridge-core.ts +210 -0
  517. package/.versions/1.0.4/scripts/lib/codex-conductor.ts +88 -0
  518. package/.versions/1.0.4/scripts/lib/codex-remote-control.ts +480 -0
  519. package/.versions/1.0.4/scripts/lib/coms-envelope.ts +582 -0
  520. package/.versions/1.0.4/scripts/lib/fake-herdr-server.ts +88 -0
  521. package/.versions/1.0.4/scripts/lib/fleet-command.ts +266 -0
  522. package/.versions/1.0.4/scripts/lib/herdr-layout.ts +281 -0
  523. package/.versions/1.0.4/scripts/lib/hermes-bridge-core.ts +241 -0
  524. package/.versions/1.0.4/scripts/lib/hermes-monitor-events.ts +1 -0
  525. package/.versions/1.0.4/scripts/lib/hermes-monitor-herdr.ts +2 -0
  526. package/.versions/1.0.4/scripts/lib/hermes-monitor-model.ts +3 -0
  527. package/.versions/1.0.4/scripts/lib/hermes-monitor-registry.ts +2 -0
  528. package/.versions/1.0.4/scripts/lib/hermes-monitor-socket.ts +2 -0
  529. package/.versions/1.0.4/scripts/lib/hermes-monitor-store.ts +2 -0
  530. package/.versions/1.0.4/scripts/lib/monitor-env.ts +146 -0
  531. package/.versions/1.0.4/scripts/lib/peer-launch.ts +318 -0
  532. package/.versions/1.0.4/scripts/lib/persona-banner.ts +62 -0
  533. package/.versions/1.0.4/scripts/lib/spawn-stagger.ts +101 -0
  534. package/.versions/1.0.4/scripts/lib/team-project.ts +213 -0
  535. package/.versions/1.0.4/scripts/lib/team-snapshot.ts +147 -0
  536. package/.versions/1.0.4/scripts/peer-banner.ts +40 -0
  537. package/.versions/1.0.4/scripts/peer-launch.ts +259 -0
  538. package/.versions/1.0.4/scripts/team-snapshot.ts +237 -0
  539. package/.versions/1.0.4/scripts/team-up.ts +406 -0
  540. package/.versions/1.0.4/skills/_internal/grilling.md +59 -0
  541. package/.versions/1.0.4/skills/browser-testing-with-devtools/SKILL.md +351 -0
  542. package/.versions/1.0.4/skills/code-review-and-quality/SKILL.md +381 -0
  543. package/.versions/1.0.4/skills/compound-learning/SKILL.md +137 -0
  544. package/.versions/1.0.4/skills/context-engineering/SKILL.md +291 -0
  545. package/.versions/1.0.4/skills/deprecation-and-migration/SKILL.md +206 -0
  546. package/.versions/1.0.4/skills/designing-agents/SKILL.md +394 -0
  547. package/.versions/1.0.4/skills/designing-agents/pi-harness-authoring.md +222 -0
  548. package/.versions/1.0.4/skills/frontend-ui-engineering/SKILL.md +328 -0
  549. package/.versions/1.0.4/skills/git-workflow-and-versioning/SKILL.md +316 -0
  550. package/.versions/1.0.4/skills/idea-refine/SKILL.md +182 -0
  551. package/.versions/1.0.4/skills/idea-refine/examples.md +238 -0
  552. package/.versions/1.0.4/skills/idea-refine/frameworks.md +99 -0
  553. package/.versions/1.0.4/skills/idea-refine/refinement-criteria.md +113 -0
  554. package/.versions/1.0.4/skills/idea-refine/scripts/idea-refine.sh +15 -0
  555. package/.versions/1.0.4/skills/incremental-implementation/SKILL.md +298 -0
  556. package/.versions/1.0.4/skills/interview-me/SKILL.md +226 -0
  557. package/.versions/1.0.4/skills/orchestration-verification/SKILL.md +181 -0
  558. package/.versions/1.0.4/skills/peer-coms/SKILL.md +90 -0
  559. package/.versions/1.0.4/skills/performance-optimization/SKILL.md +350 -0
  560. package/.versions/1.0.4/skills/planning-and-task-breakdown/SKILL.md +263 -0
  561. package/.versions/1.0.4/skills/security-and-hardening/SKILL.md +461 -0
  562. package/.versions/1.0.4/skills/spec-driven-development/SKILL.md +256 -0
  563. package/.versions/1.0.4/skills/using-agent-skills/SKILL.md +197 -0
  564. package/.versions/1.0.4/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  565. package/.versions/1.0.4/vendor/agent-skills-upstream/LICENSE +21 -0
  566. package/.versions/1.0.4/vendor/agent-skills-upstream/README.md +11 -0
  567. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  568. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  569. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  570. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  571. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  572. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  573. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  574. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  575. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  576. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  577. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  578. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  579. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  580. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  581. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  582. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  583. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  584. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  585. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  586. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  587. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  588. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  589. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  590. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  591. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  592. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  593. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  594. package/.versions/1.0.4/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  595. package/CHANGELOG.md +13 -0
  596. package/README.md +5 -4
  597. package/agents/architect.md +1 -0
  598. package/agents/bowser.md +1 -0
  599. package/agents/builder.md +2 -0
  600. package/agents/code-reviewer.md +1 -0
  601. package/agents/deep-researcher.md +1 -0
  602. package/agents/documenter.md +1 -0
  603. package/agents/orchestrator.md +1 -0
  604. package/agents/plan-reviewer.md +1 -0
  605. package/agents/planner.md +2 -1
  606. package/agents/releaser.md +1 -0
  607. package/agents/researcher.md +1 -0
  608. package/agents/security-auditor.md +1 -0
  609. package/agents/test-engineer.md +1 -0
  610. package/agents/web-debugger.md +1 -0
  611. package/agents/web-performance-auditor.md +1 -0
  612. package/bin/lib/validate-overrides.js +1 -1
  613. package/docs/ARCHITECTURE.md +25 -19
  614. package/docs/agent-fleet-setup.md +8 -8
  615. package/docs/pi-extensions.md +4 -2
  616. package/install-manifest.json +3 -3
  617. package/package.json +2 -2
  618. package/scripts/fleet.ts +1 -1
  619. package/skills/_internal/grilling.md +53 -5
  620. package/skills/idea-refine/SKILL.md +2 -2
  621. package/skills/incremental-implementation/SKILL.md +12 -1
  622. package/skills/planning-and-task-breakdown/SKILL.md +14 -5
  623. package/skills/spec-driven-development/SKILL.md +10 -11
  624. package/skills/using-agent-skills/SKILL.md +13 -15
@@ -23,7 +23,7 @@
23
23
  * /af-agent-model-thinking <persona> — switch a team or research persona's thinking
24
24
  * level (off|minimal|low|medium|high|xhigh)
25
25
  * /af-models [profile] — apply a named model profile (.pi/agents/model-profiles.yaml)
26
- * /af-agent-models-substitute <source> <target> — swap one model across all personas
26
+ * /af-agent-models-substitute [<source> <target>] — visually pick/save a session-wide model substitution
27
27
  * /af-dispatch-policy — show which members route to coms peers (.pi/agents/dispatch-policy.yaml)
28
28
  * /af-agents-kill <name|rN|all> — SIGTERM a frozen specialist (and its delegation
29
29
  * tree); on a research helper it kills AND removes the
@@ -35,6 +35,9 @@
35
35
  * (team member, research helper rN, or delegate child id)
36
36
  * /af-research <task> — spawn a read-only research helper (@persona, --model)
37
37
  * /af-agents-cont rN ... — resume a finished research helper (alias: /af-research-cont)
38
+ * /af-work-mode [operator|orchestrator]
39
+ * — posture picker (alias of /af-posture; Alt+M)
40
+ * /af-posture [operator|orchestrator] — show/switch direct vs delegate-only
38
41
  *
39
42
  * Finished research helpers are auto-pruned: auto-research pipe helpers as soon
40
43
  * as they finish (findings persist as files under findings/), manual/persona
@@ -47,9 +50,9 @@
47
50
  * documenter to land them in the project's rules/docs
48
51
  *
49
52
  * Shortcuts:
50
- * Alt+A — toggle agent view: dashboard grid (above editor) ↔
51
- * compact running-agents list (below editor: one line
52
- * per *running* agent — name · context · state)
53
+ * Alt+A — open the Fleet Dashboard
54
+ * Alt+M — open the posture picker (operator | orchestrator)
55
+ * Alt+Shift+A — toggle the compact running-agents widget
53
56
  * Alt+] / Alt+[ — compact view: mark next/previous running subagent
54
57
  * Alt+\ — compact view: zoom the marked subagent (Q/Esc closes)
55
58
  *
@@ -90,8 +93,8 @@ import {
90
93
  exemptionsFilePath, type AccessRequest,
91
94
  } from "../lib/damage-control-shared.ts";
92
95
  import { applyModelOverride, clampDelegateDepth, DELEGATE_TREE_SPAWN_BUDGET, fallbackModelFor, isReadOnlyToolList, MAX_DELEGATE_DEPTH, normalizeAgentInput, orchestratorNeedsRoster, parseTeamsYaml, safeAgentKey, safePathWithin, taskFingerprint, upsertTeamInYaml } from "./helpers.ts";
93
- import { DEFAULT_HUB_MODE, DEFAULT_TASK_TIER, HUB_MODES, TASK_BUDGET_MULTIPLIER, addTaskClockWait, applyTierChange, blockingFindingCap, budgetStatusLine, checkReviewRoundCap, checkTaskBudget, checkTierPersonaGate, checkTurnBudget, closeTaskClock, contextOverflowDiagnostic, createTaskClock, isReviewPersona, normalizeHubMode, openTaskClock, remainingTaskResearch, resetTaskClock, resolveTaskBudget, resolveTurnBudget, reviewBudgetClause, reviewRoundCap, shouldRecycleSession, taskClockElapsedMs } from "./run-budget.js";
94
- import { buildBudgetContinuationAudit, buildHubAuditIdentity, buildHubModeAudit, buildTaskResetAudit } from "./hub-state-audit.js";
96
+ import { DEFAULT_TASK_TIER, addTaskClockWait, applyTierChange, blockingFindingCap, budgetStatusLine, checkReviewRoundCap, checkTaskBudget, checkTierPersonaGate, checkTurnBudget, closeTaskClock, contextOverflowDiagnostic, createTaskClock, isReviewPersona, openTaskClock, remainingTaskResearch, resetTaskClock, resolveTaskBudget, resolveTurnBudget, reviewBudgetClause, reviewRoundCap, shouldRecycleSession, taskClockElapsedMs } from "./run-budget.js";
97
+ import { buildBudgetContinuationAudit, buildHubAuditIdentity, buildTaskResetAudit } from "./hub-state-audit.js";
95
98
  import { countReviewFindings, findingBudgetNotice } from "./review-findings.js";
96
99
  import { checkDocsLane, docsLaneNotice } from "./docs-lane.js";
97
100
  import { checkExternalBlockerGate, externalBlockedProtocol, extractExternalBlockers } from "./external-blocker.js";
@@ -117,6 +120,13 @@ import { checkScope, diffAgainst, snapshotWorktree } from "./scope-gate.js";
117
120
  import { validateEvidence } from "./evidence-rules.js";
118
121
  import { comsRequiredRefusal, explicitComsRefusal, parseDispatchPolicy, resolveDispatchBackend } from "./backend-policy.js";
119
122
  import { NATIVE_ROSTER_ENTRY_TYPE, parsePosture, persistedNativeRosterState, posturePrompt, resolvePostureTools, resolveSessionPosture, resolveSessionRoster, type Posture } from "./posture.ts";
123
+ import {
124
+ compactPosture,
125
+ executionPairBlockedByRoster,
126
+ parseWorkModeArgs,
127
+ posturePickerOptions,
128
+ selectedPickerValue,
129
+ } from "./execution-profile.ts";
120
130
  import { CAPABILITY_PACKS, latestPersistedCapabilityState, persistedCapabilityState, resolveCapabilityPacks, type CapabilityPack, type CapabilityResolution, type ContextState, type PendingOperation } from "./capability-packs.ts";
121
131
  import { contextPressureDiagnostic, createContextPressureState, transitionContextPressure, type ContextPressureState } from "./context-pressure.ts";
122
132
  import { confirmationGate, confirmationOutcome, capabilityConfirmationPack, capabilityConfirmationQuestion, type CapabilityConfirmationState, type ConfirmableCapabilityPack } from "./capability-confirmation.ts";
@@ -142,7 +152,8 @@ import { createPanelResources } from "../lib/fleet-panel.ts";
142
152
  import { buildFleetRows, fleetTiming, summarise, unionMs, type DelegateInput, type FleetRow, type FleetSource, type PeerInput, type ResearchInput, type SpecialistInput } from "../lib/fleet-read-model.ts";
143
153
  import { attachFleetDashboardTicker, compactWidgetsEnabled, gridColumnsForItems, gridColumnsForSize, liveTimeline, renderCardGrid, resolveFleetKill, resolveFleetRestart } from "../lib/fleet-dashboard-ops.ts";
144
154
  import { dashboardTransition, renderFleetDashboard, FLEET_CHROME_ROWS, type DashboardConfirm } from "../lib/fleet-dashboard-view.ts";
145
- import { detailContent, detailTransition, fleetModelChoices, modelPickerTransition, normalizeFleetDetailInput, renderFleetDetail, renderFleetModelPicker, DETAIL_CHROME_ROWS, type FleetDetailKey, type FleetModelChoice } from "../lib/fleet-detail-view.ts";
155
+ import { detailContent, detailEntryOffsets, detailTransition, fleetModelChoices, modelPickerTransition, normalizeFleetDetailInput, renderFleetDetail, renderFleetModelPicker, renderFleetSubstitutionPicker, DETAIL_CHROME_ROWS, type FleetDetailKey, type FleetModelChoice } from "../lib/fleet-detail-view.ts";
156
+ import { createFleetTranscriptStore, readFleetTranscript, readFleetTranscriptBefore, readFleetTranscriptTail, redactTimelineEvent, type FleetTranscriptRecord, type FleetTranscriptStore } from "../lib/fleet-transcript-store.ts";
146
157
  import { reconcileSelection, type Selection } from "../lib/fleet-selection.ts";
147
158
  import { collectContextBudgetSnapshot, type LivePlane } from "./context-budget-snapshot.ts";
148
159
  import { CONTEXT_BUDGET_CHROME_ROWS, contextBudgetTransition, renderContextBudget, type ContextBudgetViewState } from "../lib/context-budget-view.ts";
@@ -203,10 +214,13 @@ interface AgentDef {
203
214
  // deltas are coalesced into the trailing entry of the same kind; each tool call
204
215
  // is its own entry.
205
216
  interface TimelineEntry {
206
- kind: "text" | "tool" | "thinking";
217
+ kind: "text" | "tool" | "thinking" | "tool-start" | "tool-result";
207
218
  title: string;
208
219
  content: string;
209
220
  timestamp: number;
221
+ callId?: string;
222
+ status?: "success" | "error";
223
+ durationMs?: number;
210
224
  }
211
225
 
212
226
  // A delegate child (or grandchild) of a dispatched specialist, reconstructed
@@ -228,6 +242,7 @@ interface DelegationChild {
228
242
  startedAt: number;
229
243
  elapsed: number;
230
244
  timeline: TimelineEntry[];
245
+ transcriptStore?: FleetTranscriptStore;
231
246
  zoomRender?: (force?: boolean) => void;
232
247
  // The /af-agents-history node for this delegate child, set on its spawn event so
233
248
  // the exit event can close it. Lets a delegating specialist's row subtract the
@@ -285,6 +300,7 @@ interface AgentState {
285
300
  // while a `/af-zoom` overlay is open so the stream parser can refresh it live
286
301
  // (throttled; pass force=true for the final frame).
287
302
  timeline: TimelineEntry[];
303
+ transcriptStore?: FleetTranscriptStore;
288
304
  zoomRender?: (force?: boolean) => void;
289
305
  // The /af-agents-history node for the current dispatch, so delegate children parsed
290
306
  // from the event file can attach to it as the root parent of their subtree.
@@ -327,6 +343,7 @@ interface ResearchState {
327
343
  proc?: ChildProcess;
328
344
  killedByOperator?: boolean;
329
345
  timeline: TimelineEntry[];
346
+ transcriptStore?: FleetTranscriptStore;
330
347
  zoomRender?: (force?: boolean) => void;
331
348
  histEntry?: HistoryEntry;
332
349
  }
@@ -337,6 +354,7 @@ interface Zoomable {
337
354
  def: { name: string };
338
355
  status: string;
339
356
  timeline: TimelineEntry[];
357
+ transcriptStore?: FleetTranscriptStore;
340
358
  zoomRender?: (force?: boolean) => void;
341
359
  }
342
360
 
@@ -444,12 +462,10 @@ function extractNeedsResearch(output: string): string[] {
444
462
  // recon-search-timeout-s: <1..3600>|off — parent-side deadline for each
445
463
  // read/grep/find/ls call made by research helpers
446
464
  // and read-only delegate children (default 120).
447
- // mode: fast|standard|strict — default execution mode (see run-budget.js).
448
- // fast = single-specialist path, standard = batched
449
- // work with turn budgets (default), strict = full
450
- // Verification Contract with wide budgets.
451
- // max-dispatches-per-turn: <n>|off — dispatch_agent calls allowed per user turn
452
- // (replaces the mode default; "off" = unlimited).
465
+ // mode: — REMOVED. Ignored with a warning; budgets follow
466
+ // task tier (see run-budget.js).
467
+ // max-dispatches-per-turn: <n>|off — ceiling on dispatch_agent calls per user turn
468
+ // (min with the task-tier envelope; "off" stays at the tier).
453
469
  // max-research-per-turn: <n>|off — spawn_research calls allowed per user turn.
454
470
  // turn-wall-time-s: <n>|off — active-time budget per user turn (ask_user waits excluded).
455
471
  // agent-turn-timeout-s: <n>|off — whole-run deadline for each spawned
@@ -480,10 +496,8 @@ interface AgentTeamOverrides {
480
496
  docsPaths: string[];
481
497
  researchKeep: number;
482
498
  reconSearchTimeoutMs: number | null;
483
- hubMode: string;
484
- hubModeSource: "default" | "project-override";
485
- // Per-axis turn-budget overrides for run-budget.js resolveTurnBudget():
486
- // number replaces the mode default, null = "off", undefined = keep default.
499
+ // Per-axis turn-budget ceilings for run-budget.js resolveTurnBudget():
500
+ // number is min()'d with the task tier; null/"off" stays at the tier.
487
501
  budgetOverrides: {
488
502
  maxDispatches?: number | null;
489
503
  maxResearch?: number | null;
@@ -511,8 +525,6 @@ const DEFAULT_OVERRIDES: AgentTeamOverrides = {
511
525
  docsPaths: [],
512
526
  researchKeep: DEFAULT_RESEARCH_KEEP,
513
527
  reconSearchTimeoutMs: 120_000,
514
- hubMode: DEFAULT_HUB_MODE,
515
- hubModeSource: "default",
516
528
  budgetOverrides: {},
517
529
  watchdogSetting: DEFAULT_WATCHDOG_SETTING,
518
530
  watchdogJudgeModel: null,
@@ -595,13 +607,7 @@ function parseAgentTeamOverrides(cwd: string): AgentTeamOverrides {
595
607
  }
596
608
  }
597
609
  if (key === "mode" && value) {
598
- const mode = normalizeHubMode(value);
599
- if (mode) {
600
- result.hubMode = mode;
601
- result.hubModeSource = "project-override";
602
- } else {
603
- result.warnings.push(`mode "${value}" is not one of ${HUB_MODES.join("|")} — using the default (${DEFAULT_HUB_MODE})`);
604
- }
610
+ result.warnings.push(`mode "${value}" is ignored — execution modes were removed; budgets follow task tier. Remove this key.`);
605
611
  }
606
612
  if (key === "watchdog" && value) {
607
613
  const setting = normalizeWatchdogSetting(value);
@@ -612,8 +618,8 @@ function parseAgentTeamOverrides(cwd: string): AgentTeamOverrides {
612
618
  }
613
619
  }
614
620
  if (key === "watchdog-judge-model" && value) result.watchdogJudgeModel = value;
615
- // Turn-budget keys: a positive integer replaces the mode default, "off"
616
- // disables the axis. Counts are unitless; *-s keys are seconds → ms.
621
+ // Turn-budget keys: a positive integer is a ceiling (min with the tier);
622
+ // "off" stays at the tier. Counts are unitless; *-s keys are seconds → ms.
617
623
  const budgetKeys: Record<string, { field: keyof AgentTeamOverrides["budgetOverrides"]; scaleMs: boolean }> = {
618
624
  "max-dispatches-per-turn": { field: "maxDispatches", scaleMs: false },
619
625
  "max-research-per-turn": { field: "maxResearch", scaleMs: false },
@@ -628,7 +634,7 @@ function parseAgentTeamOverrides(cwd: string): AgentTeamOverrides {
628
634
  } else if (/^\d+$/.test(value) && Number(value) >= 1) {
629
635
  result.budgetOverrides[field] = Number(value) * (scaleMs ? 1000 : 1);
630
636
  } else {
631
- result.warnings.push(`${key} "${value}" is not a positive integer or "off" — using the ${result.hubMode} mode default`);
637
+ result.warnings.push(`${key} "${value}" is not a positive integer or "off" — using the task-tier default`);
632
638
  }
633
639
  }
634
640
  const slug = "[a-z0-9]+(?:-[a-z0-9]+)*";
@@ -861,16 +867,65 @@ function abbrevThinking(level: string): string {
861
867
  return THINKING_ABBREV[level] ?? "";
862
868
  }
863
869
 
864
- // Coalesce a streaming text/thinking delta into the timeline: extend the trailing
865
- // entry when it's the same kind, otherwise start a new one.
866
- function appendTimelineText(timeline: TimelineEntry[], kind: "text" | "thinking", delta: string) {
870
+ const MAX_LIVE_TIMELINE_ENTRIES = 500;
871
+ const MAX_LIVE_ENTRY_CHARS = 64 * 1024;
872
+
873
+ type TimelineTarget = {
874
+ timeline: TimelineEntry[];
875
+ transcriptStore?: FleetTranscriptStore;
876
+ transcriptPending?: TimelineEntry;
877
+ transcriptFlushTimer?: ReturnType<typeof setTimeout>;
878
+ zoomRender?: (force?: boolean) => void;
879
+ };
880
+
881
+ function flushTimelineStore(target: TimelineTarget): void {
882
+ if (target.transcriptFlushTimer) clearTimeout(target.transcriptFlushTimer);
883
+ target.transcriptFlushTimer = undefined;
884
+ if (!target.transcriptPending) return;
885
+ target.transcriptStore?.append(target.transcriptPending as any);
886
+ target.transcriptPending = undefined;
887
+ }
888
+
889
+ /** Redact before both persistence and display, while keeping live memory bounded. */
890
+ function appendTimelineEvent(target: TimelineTarget, event: TimelineEntry): TimelineEntry {
891
+ flushTimelineStore(target);
892
+ const safe = redactTimelineEvent(event) as TimelineEntry;
893
+ target.transcriptStore?.append(safe as any);
894
+ target.timeline.push({ ...safe, content: safe.content.slice(-MAX_LIVE_ENTRY_CHARS) });
895
+ if (target.timeline.length > MAX_LIVE_TIMELINE_ENTRIES) target.timeline.splice(0, target.timeline.length - MAX_LIVE_TIMELINE_ENTRIES);
896
+ return safe;
897
+ }
898
+
899
+ // Coalesce streaming deltas in the bounded live window; the append-only store
900
+ // still receives every redacted delta, so compacting memory cannot lose history.
901
+ function appendTimelineText(target: TimelineTarget, kind: "text" | "thinking", delta: string) {
867
902
  if (!delta) return;
868
- const last = timeline[timeline.length - 1];
869
- if (last && last.kind === kind) {
870
- last.content += delta;
871
- } else {
872
- timeline.push({ kind, title: kind === "text" ? "Assistant" : "Thinking", content: delta, timestamp: Date.now() });
903
+ const safe = redactTimelineEvent({ kind, title: kind === "text" ? "Assistant" : "Thinking", content: delta, timestamp: Date.now() }) as TimelineEntry;
904
+ if (target.transcriptPending?.kind === kind) target.transcriptPending.content += safe.content;
905
+ else {
906
+ flushTimelineStore(target);
907
+ target.transcriptPending = { ...safe };
908
+ }
909
+ if (!target.transcriptFlushTimer) {
910
+ target.transcriptFlushTimer = setTimeout(() => {
911
+ flushTimelineStore(target);
912
+ target.zoomRender?.();
913
+ }, 100);
914
+ try { (target.transcriptFlushTimer as any).unref?.(); } catch {}
915
+ }
916
+ let remaining = safe.content;
917
+ while (remaining) {
918
+ const last = target.timeline[target.timeline.length - 1];
919
+ if (last && last.kind === kind && last.content.length < MAX_LIVE_ENTRY_CHARS) {
920
+ const room = MAX_LIVE_ENTRY_CHARS - last.content.length;
921
+ last.content += remaining.slice(0, room);
922
+ remaining = remaining.slice(room);
923
+ } else {
924
+ target.timeline.push({ ...safe, content: remaining.slice(0, MAX_LIVE_ENTRY_CHARS) });
925
+ remaining = remaining.slice(MAX_LIVE_ENTRY_CHARS);
926
+ }
873
927
  }
928
+ if (target.timeline.length > MAX_LIVE_TIMELINE_ENTRIES) target.timeline.splice(0, target.timeline.length - MAX_LIVE_TIMELINE_ENTRIES);
874
929
  }
875
930
 
876
931
  // ── Zoom overlay (Phase 3) ───────────────────────
@@ -1970,6 +2025,10 @@ export default function (pi: ExtensionAPI) {
1970
2025
  // One "coms peer missing → native" notice per member per team activation.
1971
2026
  const comsMissNotified = new Set<string>();
1972
2027
  const modelOverrides = new Map<string, string>();
2028
+ // Session-wide source → target substitutions. Unlike the eager per-persona map,
2029
+ // these are resolved at spawn time, so personas and delegate roles activated or
2030
+ // created later in the same session inherit the substitution automatically.
2031
+ const modelSubstitutions = new Map<string, string>();
1973
2032
  // Session-lifetime per-persona thinking-level overrides set by
1974
2033
  // /af-agent-model-thinking (lowercase persona name → pi --thinking level). Wins
1975
2034
  // over the persona's frontmatter `thinking:`; resets on session_start; takes
@@ -1978,7 +2037,8 @@ export default function (pi: ExtensionAPI) {
1978
2037
  // Session-lifetime model overrides for delegate sub-roles, set by
1979
2038
  // /af-agent-model <persona>.<role>. Keyed "<persona>.<role>" (lowercase); applied
1980
2039
  // when the dispatch serializes AGENT_HUB_DELEGATE_CONFIG, so nested children
1981
- // inherit them. Resets on session_start. /af-models profiles never touch these.
2040
+ // inherit them. Session-wide source substitutions are resolved after this map.
2041
+ // Resets on session_start. /af-models profiles never touch these.
1982
2042
  const subagentModelOverrides = new Map<string, string>();
1983
2043
  let activeTeamName = "";
1984
2044
  let gridCols = 2;
@@ -2090,12 +2150,11 @@ APIs, commands, structure), say so in your final response so the docs can be upd
2090
2150
  // Per-tool deadline for read/grep/find/ls in research helpers/delegates. The
2091
2151
  // whole-run bound is separate: the turn budget's agentTurnMs (run-budget.js).
2092
2152
  let reconSearchTimeoutMs: number | null = 120_000;
2093
- // ── Execution mode & per-turn budgets (run-budget.js) ──
2094
- // hubMode: overrides-file default, switchable live via /af-hub-mode (session-
2095
- // lifetime). Budgets are per USER TURN: counters reset in before_agent_start,
2096
- // or after an explicit one-click continuation. currentTurnStartedAt (above)
2097
- // is the active-time base; ask_user waits are subtracted.
2098
- let hubMode: string = DEFAULT_HUB_MODE;
2153
+ // ── Per-turn budgets (run-budget.js) ──
2154
+ // Envelopes follow task tier. Override keys are a ceiling (min with the tier).
2155
+ // Counters reset in before_agent_start, or after an explicit one-click
2156
+ // continuation. currentTurnStartedAt (above) is the active-time base; ask_user
2157
+ // waits are subtracted.
2099
2158
  let budgetOverrides: AgentTeamOverrides["budgetOverrides"] = {};
2100
2159
  let turnDispatchCount = 0;
2101
2160
  let turnResearchCount = 0;
@@ -2120,7 +2179,7 @@ APIs, commands, structure), say so in your final response so the docs can be upd
2120
2179
  // The task clock charges ACTIVE time only — turns that ran, minus the time the
2121
2180
  // dispatcher spent blocked on ask_user. Raw wall clock would bill the human's
2122
2181
  // lunch break, an overnight pause, and every long answer against the task, and
2123
- // at fast mode's 45-minute envelope that hard-stops a task with two dispatches
2182
+ // at small tier's 45-minute envelope that hard-stops a task with two dispatches
2124
2183
  // spent. A false stop is worse than no stop: it teaches people to reset the
2125
2184
  // task window reflexively, which is the one thing that must stay deliberate.
2126
2185
  // The explicit clock state makes `active` authoritative: a stale timestamp can
@@ -2131,7 +2190,7 @@ APIs, commands, structure), say so in your final response so the docs can be upd
2131
2190
  // Task tier (complexity triage): declared by the dispatcher via set_task_tier.
2132
2191
  // TASK-scoped, not turn-scoped, and it moves by ratchet — down freely, up only
2133
2192
  // with a stated reason (applyTierChange). Null until declared; the first
2134
- // dispatch assumes DEFAULT_TASK_TIER outside strict mode. Caps = min(mode, tier).
2193
+ // dispatch assumes DEFAULT_TASK_TIER. Caps come from the tier envelope.
2135
2194
  let taskTier: string | null = null;
2136
2195
  // Was the tier ASSUMED by the hub rather than declared by the dispatcher? The
2137
2196
  // distinction matters to the ratchet: an assumed tier must not turn the
@@ -2152,13 +2211,15 @@ APIs, commands, structure), say so in your final response so the docs can be upd
2152
2211
  let runHistoryKeep: number | null = DEFAULT_RUN_HISTORY_KEEP;
2153
2212
  // ── Drift watchdog (drift-watchdog.js) ──
2154
2213
  // Hub-wide setting from the overrides file, live-switchable via /af-watchdog;
2155
- // per-agent overrides ("on"/"off") win over it; a dispatch_agent `watchdog`
2156
- // param wins over both.
2214
+ // per-agent overrides ("on"/"off") win over it. In operator posture a
2215
+ // dispatch_agent `watchdog` param wins over both. In orchestrator posture the
2216
+ // watchdog auto-arms unless hub or per-agent is explicitly off; dispatch
2217
+ // `watchdog: false` cannot disarm it.
2157
2218
  let watchdogSetting: string = DEFAULT_WATCHDOG_SETTING;
2158
2219
  let watchdogJudgeModel: string | null = null;
2159
2220
  const watchdogAgentOverrides = new Map<string, "on" | "off">();
2160
2221
  function currentBudget() {
2161
- return resolveTurnBudget(hubMode, budgetOverrides, taskTier);
2222
+ return resolveTurnBudget(taskTier ?? DEFAULT_TASK_TIER, budgetOverrides);
2162
2223
  }
2163
2224
  function currentTaskBudget() {
2164
2225
  return resolveTaskBudget(currentBudget());
@@ -2244,23 +2305,6 @@ APIs, commands, structure), say so in your final response so the docs can be upd
2244
2305
  const where = hubAuditIdentity(ctx);
2245
2306
  return `\nRepository: ${where.cwd ?? "unknown"}${where.herdr_pane_id ? ` · pane ${where.herdr_pane_id}` : ""}`;
2246
2307
  }
2247
- function appendHubModeEntry(input: {
2248
- previousMode: string;
2249
- mode: string;
2250
- source: "slash-command" | "project-override" | "default";
2251
- overrideFile?: string | null;
2252
- ctx?: ExtensionContext;
2253
- }) {
2254
- try {
2255
- pi.appendEntry("agent-hub-mode", buildHubModeAudit({
2256
- ...input,
2257
- taskTier,
2258
- turnDispatches: turnDispatchCount,
2259
- turnResearch: turnResearchCount,
2260
- identity: hubAuditIdentity(input.ctx),
2261
- }));
2262
- } catch { /* diagnostics are best-effort; state changes still succeed */ }
2263
- }
2264
2308
  function taskResetSnapshot(now = Date.now()) {
2265
2309
  return {
2266
2310
  tier: taskTier,
@@ -2303,14 +2347,13 @@ APIs, commands, structure), say so in your final response so the docs can be upd
2303
2347
  function updateModeStatus() {
2304
2348
  try {
2305
2349
  widgetCtx?.ui?.setStatus(
2306
- "hub-mode",
2350
+ "hub-tier",
2307
2351
  budgetStatusLine(
2308
- hubMode,
2309
2352
  { dispatches: turnDispatchCount, research: turnResearchCount },
2310
2353
  currentBudget(),
2311
2354
  // A trailing "?" marks a tier the hub assumed rather than one the
2312
2355
  // dispatcher declared — the human can see that triage was skipped.
2313
- taskTier && taskTierAssumed ? `${taskTier}?` : taskTier,
2356
+ taskTier && taskTierAssumed ? `${taskTier}?` : (taskTier ?? DEFAULT_TASK_TIER),
2314
2357
  { counters: taskCounters(), budget: currentTaskBudget() },
2315
2358
  ),
2316
2359
  );
@@ -2321,6 +2364,14 @@ APIs, commands, structure), say so in your final response so the docs can be upd
2321
2364
  * order: an unacknowledged external blocker, then the tier's persona gate.
2322
2365
  * Returns the refusal text, or null when the call may proceed.
2323
2366
  */
2367
+ /** Latch the conservative tier before any fleet action can pass a persona gate. */
2368
+ function ensureTaskTier(): void {
2369
+ if (taskTier !== null) return;
2370
+ taskTier = DEFAULT_TASK_TIER;
2371
+ taskTierAssumed = true;
2372
+ turnReport.tier = taskTier;
2373
+ updateModeStatus();
2374
+ }
2324
2375
  function preflightGate(persona: string): { reason: string; message: string } | null {
2325
2376
  const blocked = checkExternalBlockerGate({
2326
2377
  blockers: externalBlockers,
@@ -2433,10 +2484,20 @@ APIs, commands, structure), say so in your final response so the docs can be upd
2433
2484
  return out;
2434
2485
  }
2435
2486
 
2436
- // The model a persona would dispatch on right now: session override →
2437
- // frontmatter default → undefined (dispatcher's model).
2487
+ function substitutedModel(model: string | undefined): string | undefined {
2488
+ return model ? (modelSubstitutions.get(model) ?? model) : undefined;
2489
+ }
2490
+
2491
+ // The model a persona would dispatch on right now: explicit per-persona
2492
+ // override → frontmatter default, then the session-wide source substitution.
2493
+ // Resolving here (rather than eagerly rewriting every loaded def) makes the
2494
+ // mapping apply to agents activated or spawned later in the same session.
2438
2495
  function resolvedModel(def: AgentDef): string | undefined {
2439
- return modelOverrides.get(def.name.toLowerCase()) ?? def.model;
2496
+ return substitutedModel(modelOverrides.get(def.name.toLowerCase()) ?? def.model);
2497
+ }
2498
+
2499
+ function resolvedSubagentModel(persona: string, role: string, declared: string): string {
2500
+ return substitutedModel(subagentModelOverrides.get(`${persona.toLowerCase()}.${role.toLowerCase()}`) ?? declared) ?? declared;
2440
2501
  }
2441
2502
 
2442
2503
  // The raw thinking value a persona would dispatch with right now: session
@@ -2689,6 +2750,7 @@ APIs, commands, structure), say so in your final response so the docs can be upd
2689
2750
  // dirs (delegate children's events + sessions).
2690
2751
  try { rmSync(safePathWithin(sessionDir, "findings"), { recursive: true, force: true }); } catch {}
2691
2752
  try { rmSync(safePathWithin(sessionDir, "delegations"), { recursive: true, force: true }); } catch {}
2753
+ try { rmSync(safePathWithin(sessionDir, "transcripts"), { recursive: true, force: true }); } catch {}
2692
2754
  // Artifacts are NOT ephemeral, and deleting them here is what made a
2693
2755
  // post-mortem record eleven specialist returns and two reviews as NOT
2694
2756
  // RECOVERABLE: the next session's `builder-run1.md` reused the same path as
@@ -3237,6 +3299,7 @@ APIs, commands, structure), say so in your final response so the docs can be upd
3237
3299
  startedAt,
3238
3300
  elapsed: 0,
3239
3301
  timeline: [],
3302
+ transcriptStore: createFleetTranscriptStore(safePathWithin(sessionDir, "transcripts", `${safeAgentKey(state.def.name)}-${safeAgentKey(e.id)}.jsonl`)),
3240
3303
  histEntry,
3241
3304
  });
3242
3305
  return;
@@ -3244,7 +3307,7 @@ APIs, commands, structure), say so in your final response so the docs can be upd
3244
3307
  const child = state.delegations.get(e.id);
3245
3308
  if (!child) return;
3246
3309
  if (e.t === "timeline") {
3247
- appendTimelineText(child.timeline, e.kind === "thinking" ? "thinking" : "text", e.delta || "");
3310
+ appendTimelineText(child, e.kind === "thinking" ? "thinking" : "text", e.delta || "");
3248
3311
  if (e.kind !== "thinking") {
3249
3312
  const trailing = child.timeline[child.timeline.length - 1];
3250
3313
  if (trailing?.kind === "text") {
@@ -3255,20 +3318,32 @@ APIs, commands, structure), say so in your final response so the docs can be upd
3255
3318
  } else if (e.t === "model_fallback") {
3256
3319
  child.model = e.to || child.model;
3257
3320
  child.lastWork = `model fallback: ${e.from || "override"} → ${e.to || "original"}`;
3258
- child.timeline.push({
3321
+ appendTimelineEvent(child, {
3259
3322
  kind: "text",
3260
3323
  title: "Model fallback",
3261
3324
  content: `${e.from || "override"} failed before work began; retrying with ${e.to || "original"}. ${e.reason || ""}`.trim(),
3262
3325
  timestamp: Date.now(),
3263
3326
  });
3264
3327
  child.zoomRender?.();
3265
- } else if (e.t === "tool") {
3328
+ } else if (e.t === "tool" || e.t === "tool_start") {
3266
3329
  child.toolCount++;
3267
- child.timeline.push({
3268
- kind: "tool",
3330
+ appendTimelineEvent(child, {
3331
+ kind: "tool-start",
3269
3332
  title: `Tool: ${e.name || "tool"}`,
3270
3333
  content: e.args || "",
3271
- timestamp: Date.now(),
3334
+ timestamp: e.ts || Date.now(),
3335
+ ...(e.callId ? { callId: e.callId } : {}),
3336
+ });
3337
+ child.zoomRender?.();
3338
+ } else if (e.t === "tool_result") {
3339
+ appendTimelineEvent(child, {
3340
+ kind: "tool-result",
3341
+ title: `Result: ${e.name || "tool"}`,
3342
+ content: e.output || "",
3343
+ timestamp: e.ts || Date.now(),
3344
+ ...(e.callId ? { callId: e.callId } : {}),
3345
+ status: e.isError ? "error" : "success",
3346
+ ...(typeof e.durationMs === "number" ? { durationMs: e.durationMs } : {}),
3272
3347
  });
3273
3348
  child.zoomRender?.();
3274
3349
  } else if (e.t === "usage") {
@@ -3320,7 +3395,7 @@ APIs, commands, structure), say so in your final response so the docs can be upd
3320
3395
  }
3321
3396
  if (dirty) updateWidget();
3322
3397
  };
3323
- const timer = setInterval(drain, 1000);
3398
+ const timer = setInterval(drain, 2000);
3324
3399
  try { (timer as any).unref?.(); } catch {}
3325
3400
  let watcher: fs.FSWatcher | null = null;
3326
3401
  try { watcher = fs.watch(dir, () => drain()); } catch {}
@@ -3603,7 +3678,9 @@ ${externalBlockedProtocol()}
3603
3678
  state.runCount++;
3604
3679
  state.killedByOperator = false;
3605
3680
  state.restarting = false;
3681
+ flushTimelineStore(state);
3606
3682
  state.timeline = [];
3683
+ state.transcriptStore = createFleetTranscriptStore(safePathWithin(sessionDir, "transcripts", `${safeAgentKey(state.def.name)}-run${state.runCount}.jsonl`));
3607
3684
  state.delegationsWatcher?.close();
3608
3685
  state.delegationsWatcher = undefined;
3609
3686
  state.delegations = undefined;
@@ -3639,7 +3716,7 @@ ${externalBlockedProtocol()}
3639
3716
  state.elapsed = Date.now() - startTime;
3640
3717
  state.status = opts?.idle ? "idle" : exitCode === 0 ? "done" : "error";
3641
3718
  state.lastWork = output.split("\n").filter((l: string) => l.trim()).pop() || "";
3642
- if (output.trim()) appendTimelineText(state.timeline, "text", output);
3719
+ if (output.trim()) appendTimelineText(state, "text", output);
3643
3720
  updateWidget();
3644
3721
  state.zoomRender?.(true);
3645
3722
  historyEnd(histEntry, state.status);
@@ -3714,7 +3791,8 @@ ${externalBlockedProtocol()}
3714
3791
  ?? (ctx.model
3715
3792
  ? `${ctx.model.provider}/${ctx.model.id}`
3716
3793
  : "openrouter/google/gemini-3-flash-preview");
3717
- const originalModelFallback = fallbackModelFor(state.def, model);
3794
+ const fallbackCandidate = substitutedModel(fallbackModelFor(state.def, model));
3795
+ const originalModelFallback = fallbackCandidate === model ? undefined : fallbackCandidate;
3718
3796
 
3719
3797
  // THIS specialist's window, not the dispatcher's. Measuring a 49k local
3720
3798
  // model against a hosted model's window is what produced readings like
@@ -3785,11 +3863,13 @@ ${externalBlockedProtocol()}
3785
3863
  // delegate config, so nested children inherit the switch for free.
3786
3864
  const subagentRoles = state.def.subagents && Object.keys(state.def.subagents).length > 0
3787
3865
  ? Object.fromEntries(Object.entries(state.def.subagents).map(([role, r]) => {
3788
- const override = subagentModelOverrides.get(`${personaKey}.${role.toLowerCase()}`);
3789
- return [role, override ? applyModelOverride(r, override) : r];
3866
+ const effective = resolvedSubagentModel(personaKey, role, r.model);
3867
+ const configured = effective !== r.model ? applyModelOverride(r, effective) : r;
3868
+ const fallback = substitutedModel(configured.fallbackModel);
3869
+ return [role, fallback === configured.model ? { ...configured, fallbackModel: undefined } : { ...configured, fallbackModel: fallback }];
3790
3870
  }))
3791
3871
  : null;
3792
- // Fast mode is a single-specialist path: no nested delegation trees.
3872
+ // Nested delegation follows the task-tier envelope (off at trivial/small).
3793
3873
  const delegationActive = turnBudget.delegation && !!subagentRoles && !!delegateExtPath;
3794
3874
  const safety = requireSafetyHarness(safetyHarnessPath);
3795
3875
  if (!safety.ok) return finishRun(safety.error, 1);
@@ -3799,7 +3879,8 @@ ${externalBlockedProtocol()}
3799
3879
  if (delegationActive) {
3800
3880
  const delegationDir = safePathWithin(sessionDir, "delegations", agentKey);
3801
3881
  try { rmSync(delegationDir, { recursive: true, force: true }); } catch {}
3802
- mkdirSync(delegationDir, { recursive: true });
3882
+ mkdirSync(delegationDir, { recursive: true, mode: 0o700 });
3883
+ try { chmodSync(delegationDir, 0o700); } catch {}
3803
3884
  extensions.push(delegateExtPath!);
3804
3885
  effectiveTools = `${state.def.tools},delegate`;
3805
3886
  delegateEnv = {
@@ -3849,7 +3930,7 @@ ${externalBlockedProtocol()}
3849
3930
 
3850
3931
  // ── Drift watchdog: layer-1 rules on the live stream, judge on escalation ──
3851
3932
  // Precedence: dispatch param > per-agent /af-watchdog override > hub setting.
3852
- const watchdogArmed = resolveWatchdogActive(watchdogParam, watchdogAgentOverrides.get(key), watchdogSetting);
3933
+ const watchdogArmed = resolveWatchdogActive(watchdogParam, watchdogAgentOverrides.get(key), watchdogSetting, posture);
3853
3934
  // The hub ORDERS every specialist to write its deliverable under the session
3854
3935
  // artifacts tree, which no dispatcher `scope:` ever lists — so those paths are
3855
3936
  // implicitly in scope. Both path forms: the specialist may use either.
@@ -3951,29 +4032,40 @@ ${externalBlockedProtocol()}
3951
4032
  void monitorStart?.then(task => monitorBridge?.appendOutputFor(task, delta));
3952
4033
  fullText += delta;
3953
4034
  state.lastWork = fullText.split("\n").filter((l: string) => l.trim()).pop() || "";
3954
- appendTimelineText(state.timeline, "text", delta);
4035
+ appendTimelineText(state, "text", delta);
3955
4036
  updateWidget();
3956
4037
  state.zoomRender?.();
3957
4038
  },
3958
4039
  onThinkingDelta: (delta) => {
3959
4040
  if (!wantThinking) return;
3960
- appendTimelineText(state.timeline, "thinking", delta);
4041
+ appendTimelineText(state, "thinking", delta);
3961
4042
  state.zoomRender?.();
3962
4043
  },
3963
- onToolStart: (toolName, argStr) => {
4044
+ onToolStart: (toolName, argStr, callId) => {
3964
4045
  state.toolCount++;
3965
- state.timeline.push({
3966
- kind: "tool",
4046
+ appendTimelineEvent(state, {
4047
+ kind: "tool-start",
3967
4048
  title: `Tool: ${toolName}`,
3968
4049
  content: argStr,
3969
4050
  timestamp: Date.now(),
4051
+ ...(callId ? { callId } : {}),
3970
4052
  });
3971
4053
  updateWidget();
3972
4054
  state.zoomRender?.();
3973
4055
  const violation = driftMonitor?.onToolStart(toolName, argStr);
3974
4056
  if (violation) escalateDrift(violation);
3975
4057
  },
3976
- onToolEnd: (toolName, _id, isError) => {
4058
+ onToolEnd: (toolName, callId, isError, resultText, durationMs) => {
4059
+ appendTimelineEvent(state, {
4060
+ kind: "tool-result",
4061
+ title: `Result: ${toolName}`,
4062
+ content: resultText ?? "",
4063
+ timestamp: Date.now(),
4064
+ ...(callId ? { callId } : {}),
4065
+ status: isError ? "error" : "success",
4066
+ ...(durationMs == null ? {} : { durationMs }),
4067
+ });
4068
+ state.zoomRender?.();
3977
4069
  const violation = driftMonitor?.onToolEnd(toolName, isError);
3978
4070
  if (violation) escalateDrift(violation);
3979
4071
  },
@@ -4317,7 +4409,9 @@ ${externalBlockedProtocol()}
4317
4409
  state.elapsed = 0;
4318
4410
  state.lastWork = "";
4319
4411
  state.killedByOperator = false;
4412
+ flushTimelineStore(state);
4320
4413
  state.timeline = [];
4414
+ state.transcriptStore = createFleetTranscriptStore(safePathWithin(sessionDir, "transcripts", `research-r${state.id}-turn${state.turnCount}.jsonl`));
4321
4415
  updateResearchWidget();
4322
4416
 
4323
4417
  const histEntry = historyStart("research", `Research r${state.id}`);
@@ -4336,6 +4430,8 @@ ${externalBlockedProtocol()}
4336
4430
  // READ-ONLY by construction: RESEARCH_TOOLS only, regardless of persona frontmatter.
4337
4431
  let fullText = "";
4338
4432
  const researchWindow = resolveContextWindow(state.model, { lookup: modelWindowLookup(ctx), fallbackWindow: contextWindow });
4433
+ const researchFallbackCandidate = substitutedModel(fallbackModelFor(state.def, state.model));
4434
+ const researchFallback = researchFallbackCandidate === state.model ? undefined : researchFallbackCandidate;
4339
4435
  notifyProviderQueue(state.model, `Research r${state.id}`, ctx);
4340
4436
  const res = await providerSemaphore.run(state.model, () => spawnPiAgentWithModelFallback({
4341
4437
  model: state.model,
@@ -4361,7 +4457,7 @@ ${externalBlockedProtocol()}
4361
4457
  ...researchWatchdogSpawnOptions(reconSearchTimeoutMs, signal),
4362
4458
  // Whole-run deadline from the active mode's budget (null in strict mode).
4363
4459
  turnDeadlineMs: currentBudget().agentTurnMs,
4364
- }, fallbackModelFor(state.def, state.model), {
4460
+ }, researchFallback, {
4365
4461
  onProcess: (p) => { state.proc = p; },
4366
4462
  onModelFallback: ({ from, to, reason }) => {
4367
4463
  state.lastWork = `model fallback: ${shortModel(from)} → ${shortModel(to)}`;
@@ -4371,26 +4467,39 @@ ${externalBlockedProtocol()}
4371
4467
  onTextDelta: (delta) => {
4372
4468
  fullText += delta;
4373
4469
  state.lastWork = fullText.split("\n").filter((l: string) => l.trim()).pop() || "";
4374
- appendTimelineText(state.timeline, "text", delta);
4470
+ appendTimelineText(state, "text", delta);
4375
4471
  updateResearchWidget();
4376
4472
  state.zoomRender?.();
4377
4473
  },
4378
4474
  onThinkingDelta: (delta) => {
4379
4475
  if (!wantThinking) return;
4380
- appendTimelineText(state.timeline, "thinking", delta);
4476
+ appendTimelineText(state, "thinking", delta);
4381
4477
  state.zoomRender?.();
4382
4478
  },
4383
- onToolStart: (toolName, argStr) => {
4479
+ onToolStart: (toolName, argStr, callId) => {
4384
4480
  state.toolCount++;
4385
- state.timeline.push({
4386
- kind: "tool",
4481
+ appendTimelineEvent(state, {
4482
+ kind: "tool-start",
4387
4483
  title: `Tool: ${toolName}`,
4388
4484
  content: argStr,
4389
4485
  timestamp: Date.now(),
4486
+ ...(callId ? { callId } : {}),
4390
4487
  });
4391
4488
  updateResearchWidget();
4392
4489
  state.zoomRender?.();
4393
4490
  },
4491
+ onToolEnd: (toolName, callId, isError, resultText, durationMs) => {
4492
+ appendTimelineEvent(state, {
4493
+ kind: "tool-result",
4494
+ title: `Result: ${toolName}`,
4495
+ content: resultText ?? "",
4496
+ timestamp: Date.now(),
4497
+ ...(callId ? { callId } : {}),
4498
+ status: isError ? "error" : "success",
4499
+ ...(durationMs == null ? {} : { durationMs }),
4500
+ });
4501
+ state.zoomRender?.();
4502
+ },
4394
4503
  onUsage: (usage) => {
4395
4504
  state.contextTokens = (usage.input || 0) + (usage.cacheRead || 0) + (usage.cacheWrite || 0);
4396
4505
  if (researchWindow.window > 0) {
@@ -5062,15 +5171,9 @@ ${externalBlockedProtocol()}
5062
5171
  // Display names / underscores resolve to the persona slug key space, so
5063
5172
  // `agent: "Test Engineer"` never burns a dispatch on a lookup error.
5064
5173
  const agent = normalizeAgentInput((params as { agent: string }).agent);
5065
- // Unclassified task: assume the default tier (outside strict, whose full
5066
- // contract runs uncapped by tiers). The prompt asks for set_task_tier
5067
- // FIRST; this is the fail-safe, not the intended path.
5068
- if (taskTier === null && hubMode !== "strict") {
5069
- taskTier = DEFAULT_TASK_TIER;
5070
- taskTierAssumed = true;
5071
- turnReport.tier = taskTier;
5072
- updateModeStatus();
5073
- }
5174
+ // Unclassified task: assume the default tier. The prompt asks for
5175
+ // set_task_tier FIRST; this is the fail-safe, not the intended path.
5176
+ ensureTaskTier();
5074
5177
  // Pre-flight refusals, in severity order, BEFORE anything is charged: an
5075
5178
  // unacknowledged external blocker, the tier's persona gate, the review-round
5076
5179
  // cap, then the docs-only lane. None of these reached a specialist, so none
@@ -5112,7 +5215,7 @@ ${externalBlockedProtocol()}
5112
5215
  { dispatches: turnDispatchCount, research: turnResearchCount },
5113
5216
  currentBudget(),
5114
5217
  turnBudgetActiveElapsedMs(),
5115
- hubMode,
5218
+ taskTier,
5116
5219
  );
5117
5220
  if (budgetRefusal) {
5118
5221
  turnReport.refusals++;
@@ -5530,6 +5633,9 @@ ${externalBlockedProtocol()}
5530
5633
  if (confirmationRefusal) return confirmationRefusal;
5531
5634
  const { task, persona, model, artifacts } = params as { task: string; persona?: string; model?: string; artifacts?: string[] };
5532
5635
 
5636
+ // Research is also a fleet action: latch the conservative tier before
5637
+ // its persona gate, so research-first cannot bypass assumed-small.
5638
+ ensureTaskTier();
5533
5639
  // Pre-flight refusals before anything is charged: an unacknowledged
5534
5640
  // external blocker, then the tier's persona gate (deep-researcher is the
5535
5641
  // most expensive helper in the system and is not a trivial-tier tool).
@@ -5566,7 +5672,7 @@ ${externalBlockedProtocol()}
5566
5672
  { dispatches: turnDispatchCount, research: turnResearchCount },
5567
5673
  currentBudget(),
5568
5674
  turnBudgetActiveElapsedMs(),
5569
- hubMode,
5675
+ taskTier,
5570
5676
  );
5571
5677
  if (budgetRefusal) {
5572
5678
  turnReport.refusals++;
@@ -5702,15 +5808,15 @@ ${externalBlockedProtocol()}
5702
5808
  });
5703
5809
 
5704
5810
  // ── set_task_tier Tool (complexity triage) ──
5705
- // The dispatcher classifies each user turn BEFORE its first dispatch; the
5706
- // declared tier lowers the dispatch/research caps to min(mode, tier) in code.
5707
- // Skipping it makes the first dispatch assume the default tier (run-budget.js).
5811
+ // The dispatcher classifies each TASK before its first dispatch; the declared
5812
+ // tier *is* the budget envelope (run-budget.js). Skipping it makes the first
5813
+ // dispatch assume DEFAULT_TASK_TIER.
5708
5814
 
5709
5815
  pi.registerTool({
5710
5816
  name: "set_task_tier",
5711
5817
  label: "Set Task Tier",
5712
5818
  description:
5713
- "Classify the CURRENT TASK before your first dispatch: trivial (one obvious, low-risk change — 1 dispatch), small (a contained change, no planning pipeline — 2 dispatches), feature (a normal multi-step feature — 6 dispatches), project (a large effort — mode budget applies). The tier persists across user messages and moves by ratchet: LOWERING it is always free, RAISING it requires `reason` naming what the ask turned out to contain. Pass `new_task: true` only when the human has moved on to a genuinely different piece of work — it also resets the task budget.",
5819
+ "Classify the CURRENT TASK before your first dispatch: trivial (one obvious, low-risk change — 1 dispatch), small (a contained change, no planning pipeline — 2 dispatches), feature (a normal multi-step feature — 8 dispatches), project (a large effort — 12 dispatches). Nested delegation is off at trivial/small. The tier persists across user messages and moves by ratchet: LOWERING it is always free, RAISING it requires `reason` naming what the ask turned out to contain. Pass `new_task: true` only when the human has moved on to a genuinely different piece of work — it also resets the task budget.",
5714
5820
  parameters: Type.Object({
5715
5821
  tier: Type.String({ description: "One of: trivial | small | feature | project" }),
5716
5822
  reason: Type.Optional(Type.String({ description: "One line on why this tier fits the ask. REQUIRED when raising the tier above the current one." })),
@@ -5771,15 +5877,16 @@ ${externalBlockedProtocol()}
5771
5877
  });
5772
5878
 
5773
5879
  // ── team_adjust Tool (dispatcher-driven roster changes, gated) ──
5774
- // The dispatcher may restructure its own team mid-session — but never in fast
5775
- // mode, never past the roster cap, and the human is notified of every change.
5880
+ // The dispatcher may restructure its own team mid-session — but never when the
5881
+ // current tier has nested delegation off, never past the roster cap, and the
5882
+ // human is notified of every change.
5776
5883
  const TEAM_ADJUST_ROSTER_CAP = 8;
5777
5884
 
5778
5885
  pi.registerTool({
5779
5886
  name: "team_adjust",
5780
5887
  label: "Team Adjust",
5781
5888
  description:
5782
- "Add or drop a specialist persona in the ACTIVE team (the roster you can dispatch to). Use sparingly, when the current roster genuinely cannot serve the task (e.g. add security-auditor for a security-sensitive change, drop an unused specialist). Not available in fast mode. The human sees every change and can revert with /af-agents-add /af-agents-drop.",
5889
+ "Add or drop a specialist persona in the ACTIVE team (the roster you can dispatch to). Use sparingly, when the current roster genuinely cannot serve the task (e.g. add security-auditor for a security-sensitive change, drop an unused specialist). Not available at trivial/small tiers. The human sees every change and can revert with /af-agents-add /af-agents-drop.",
5783
5890
  parameters: Type.Object({
5784
5891
  action: Type.String({ description: "add | drop" }),
5785
5892
  agent: Type.String({ description: "Persona name (case-insensitive), e.g. security-auditor" }),
@@ -5790,9 +5897,10 @@ ${externalBlockedProtocol()}
5790
5897
  if (confirmationRefusal) return confirmationRefusal;
5791
5898
  const { action, agent, reason } = params as { action: string; agent: string; reason: string };
5792
5899
  const act = String(action || "").trim().toLowerCase();
5793
- if (hubMode === "fast") {
5900
+ if (!currentBudget().delegation) {
5901
+ const tier = taskTier ?? DEFAULT_TASK_TIER;
5794
5902
  return {
5795
- content: [{ type: "text" as const, text: "team_adjust is disabled in fast mode — a single-specialist path never needs roster changes. Ask the user to /af-hub-mode standard if the task outgrew fast mode." }],
5903
+ content: [{ type: "text" as const, text: `team_adjust is disabled at tier "${tier}" — a single-specialist path never needs roster changes. Raise the task tier with set_task_tier if the work outgrew "${tier}".` }],
5796
5904
  details: { status: "refused" },
5797
5905
  };
5798
5906
  }
@@ -6888,29 +6996,78 @@ ${externalBlockedProtocol()}
6888
6996
  return null;
6889
6997
  }
6890
6998
  const overrideKey = `${delegation.owner.def.name.toLowerCase()}.${role[0].toLowerCase()}`;
6891
- return { kind: "delegate", current: subagentModelOverrides.get(overrideKey) ?? role[1].model, delegation, role, overrideKey };
6999
+ return { kind: "delegate", current: resolvedSubagentModel(delegation.owner.def.name, role[0], role[1].model), delegation, role, overrideKey };
6892
7000
  }
6893
7001
 
6894
- /** Load every model Pi currently reports as available for the inline picker. */
6895
- async function loadFleetDetailModelChoices(row: FleetRow, ctx: any): Promise<{ choices: FleetModelChoice[]; current: string } | null> {
6896
- const target = resolveFleetDetailModelTarget(row, ctx);
6897
- if (!target) return null;
7002
+ async function loadAvailableModelChoices(ctx: any, current?: string): Promise<FleetModelChoice[] | null> {
6898
7003
  try { await ctx.modelRegistry?.refresh?.(); } catch { /* retain the registry's last-known available list */ }
6899
- const choices = fleetModelChoices(ctx.modelRegistry?.getAvailable?.() ?? [], target.current);
7004
+ const choices = fleetModelChoices(ctx.modelRegistry?.getAvailable?.() ?? [], current);
6900
7005
  if (choices.length === 0) {
6901
7006
  const diagnostic = ctx.modelRegistry?.getError?.();
6902
7007
  ctx.ui.notify(`Pi reports no available models${diagnostic ? `: ${diagnostic}` : "."}`, "warning");
6903
7008
  return null;
6904
7009
  }
6905
- return { choices, current: target.current };
7010
+ return choices;
7011
+ }
7012
+
7013
+ /** Load every model Pi currently reports as available for the inline picker. */
7014
+ async function loadFleetDetailModelChoices(row: FleetRow, ctx: any): Promise<{ choices: FleetModelChoice[]; current: string } | null> {
7015
+ const target = resolveFleetDetailModelTarget(row, ctx);
7016
+ if (!target) return null;
7017
+ const choices = await loadAvailableModelChoices(ctx, target.current);
7018
+ return choices ? { choices, current: target.current } : null;
7019
+ }
7020
+
7021
+ function substitutionSourceChoices(): FleetModelChoice[] {
7022
+ return allKnownModels().map(spec => {
7023
+ const target = modelSubstitutions.get(spec);
7024
+ return { spec, label: target ? `${spec} → ${target} (active this session)` : spec };
7025
+ });
7026
+ }
7027
+
7028
+ async function applySessionModelSubstitution(source: string, target: string, ctx: any): Promise<boolean> {
7029
+ const known = allKnownModels();
7030
+ if (!known.includes(source)) {
7031
+ ctx.ui.notify(`Unknown configured source model "${source}". Choose one of: ${known.join(", ") || "none"}.`, "error");
7032
+ return false;
7033
+ }
7034
+ const available = await loadAvailableModelChoices(ctx, modelSubstitutions.get(source));
7035
+ if (!available) return false;
7036
+ if (!available.some(choice => choice.spec === target)) {
7037
+ ctx.ui.notify(`Target model "${target}" is not currently available in Pi.`, "error");
7038
+ return false;
7039
+ }
7040
+ if (source === target) {
7041
+ ctx.ui.notify(`Source and target are the same (${source}); the session substitution was not changed.`, "info");
7042
+ return false;
7043
+ }
7044
+ const previous = modelSubstitutions.get(source);
7045
+ if (previous === target) {
7046
+ ctx.ui.notify(`Substitution ${source} → ${target} is already active for this session.`, "info");
7047
+ return false;
7048
+ }
7049
+ modelSubstitutions.set(source, target);
7050
+ const personas = allAgentDefs.filter(def => (modelOverrides.get(def.name.toLowerCase()) ?? def.model) === source);
7051
+ const roles = allAgentDefs.flatMap(def => Object.entries(def.subagents ?? {})
7052
+ .filter(([role, config]) => (subagentModelOverrides.get(`${def.name.toLowerCase()}.${role.toLowerCase()}`) ?? config.model) === source)
7053
+ .map(([role]) => `${def.name}.${role}`));
7054
+ updateWidget();
7055
+ ctx.ui.notify(
7056
+ `${previous ? "Updated" : "Saved"} session substitution ${source} → ${target}. ` +
7057
+ `${personas.length} persona${personas.length === 1 ? "" : "s"} and ${roles.length} sub-role${roles.length === 1 ? "" : "s"} currently resolve through it; ` +
7058
+ `future agents spawned from the same configured source inherit it automatically. Current runs are not interrupted.`,
7059
+ "success",
7060
+ );
7061
+ return true;
6906
7062
  }
6907
7063
 
6908
7064
  /** Apply an inline-picker choice to the next run; never interrupt a live child. */
6909
7065
  function applyFleetDetailModel(row: FleetRow, picked: string, ctx: any): boolean {
6910
7066
  const target = resolveFleetDetailModelTarget(row, ctx);
6911
7067
  if (!target) return false;
6912
- if (picked === target.current) {
6913
- ctx.ui.notify(`${row.name} is already on ${picked}`, "info");
7068
+ const effectivePicked = substitutedModel(picked) ?? picked;
7069
+ if (effectivePicked === target.current) {
7070
+ ctx.ui.notify(`${row.name} is already on ${effectivePicked}`, "info");
6914
7071
  return false;
6915
7072
  }
6916
7073
  let applyHint = "applies on the next run";
@@ -6928,7 +7085,7 @@ ${externalBlockedProtocol()}
6928
7085
  applyHint = `applies on the next ${displayName(target.delegation.owner.def.name)} dispatch`;
6929
7086
  }
6930
7087
  updateWidget();
6931
- ctx.ui.notify(`${row.name} → ${picked} (${applyHint}; current runs are not interrupted)`, "success");
7088
+ ctx.ui.notify(`${row.name} → ${effectivePicked} (${applyHint}; current runs are not interrupted)`, "success");
6932
7089
  if (target.kind === "specialist" && (dispatchPolicy.substitutions[target.state.def.name.toLowerCase()]?.prefer ?? dispatchPolicy.default) === "coms") {
6933
7090
  ctx.ui.notify("This specialist prefers a coms peer; the choice applies to native fallback runs, while the peer keeps its own model.", "info");
6934
7091
  }
@@ -6950,22 +7107,80 @@ ${externalBlockedProtocol()}
6950
7107
  return normalizeFleetDetailInput(data, key);
6951
7108
  }
6952
7109
 
6953
- async function openFleetDetail(row: FleetRow, ctx: any): Promise<void> {
7110
+ async function openFleetDetail(row: FleetRow, ctx: any, initialVerbose = false): Promise<boolean> {
6954
7111
  const target = row.kind === "research" ? researchStates.get(parseResearchHandle(row.key)!) : row.kind === "delegate" ? findDelegationChild(row.key)?.child : agentStates.get(row.key);
6955
7112
  const resources = createPanelResources();
6956
7113
  let detailRow = row;
6957
7114
  let modelPicker: { choices: FleetModelChoice[]; index: number; scrollOffset: number } | null = null;
6958
- let scrollOffset = 0, selectedIndex = 0, expandedIndex: number | null = null, followTail = true, lastRender = 0;
6959
- const timeline = () => liveTimeline(target);
7115
+ let scrollOffset = 0, selectedIndex = 0, expandedIndex: number | null = null, followTail = true, verbose = initialVerbose, lastRender = 0;
7116
+ const transcriptPath = target?.transcriptStore?.path;
7117
+ let transcriptRecords: FleetTranscriptRecord[] | null = transcriptPath
7118
+ ? readFleetTranscriptTail(transcriptPath, { limit: 2000 }).records
7119
+ : null;
7120
+ const compactRecords = (records: readonly FleetTranscriptRecord[]): TimelineEntry[] => {
7121
+ const entries: TimelineEntry[] = [];
7122
+ for (const { event } of records) {
7123
+ const current = event as TimelineEntry;
7124
+ const last = entries[entries.length - 1];
7125
+ const merge = last && last.kind === current.kind
7126
+ && (current.kind === "text" || current.kind === "thinking" || (last.callId && last.callId === current.callId));
7127
+ if (merge && last.content.length < MAX_LIVE_ENTRY_CHARS) {
7128
+ const room = MAX_LIVE_ENTRY_CHARS - last.content.length;
7129
+ last.content += current.content.slice(0, room);
7130
+ if (current.content.length > room) entries.push({ ...current, content: current.content.slice(room) });
7131
+ } else entries.push({ ...current });
7132
+ }
7133
+ return entries;
7134
+ };
7135
+ const timeline = () => transcriptRecords ? compactRecords(transcriptRecords) : [...liveTimeline(target)] as TimelineEntry[];
7136
+ const syncTranscriptTail = () => {
7137
+ if (!transcriptPath || !transcriptRecords || !followTail) return;
7138
+ const after = transcriptRecords[transcriptRecords.length - 1]?.endOffset ?? 0;
7139
+ const page = readFleetTranscript(transcriptPath, { after, limit: 500 });
7140
+ if (page.records.length > 0) transcriptRecords.push(...page.records);
7141
+ if (transcriptRecords.length > 2000) transcriptRecords.splice(0, transcriptRecords.length - 2000);
7142
+ };
7143
+ const loadOlderTranscript = () => {
7144
+ if (!transcriptPath || !transcriptRecords) return 0;
7145
+ const before = transcriptRecords[0]?.startOffset ?? 0;
7146
+ if (before <= 0) return 0;
7147
+ const older = readFleetTranscriptBefore(transcriptPath, { before, limit: 500 }).records;
7148
+ transcriptRecords.unshift(...older);
7149
+ if (transcriptRecords.length > 2000) transcriptRecords.splice(2000);
7150
+ return compactRecords(older).length;
7151
+ };
7152
+ const loadNewerTranscript = (): number => {
7153
+ if (!transcriptPath || !transcriptRecords) return 0;
7154
+ const after = transcriptRecords[transcriptRecords.length - 1]?.endOffset ?? 0;
7155
+ const newer = readFleetTranscript(transcriptPath, { after, limit: 500 }).records;
7156
+ if (newer.length === 0) return 0;
7157
+ transcriptRecords.push(...newer);
7158
+ const overflow = Math.max(0, transcriptRecords.length - 2000);
7159
+ const removed = overflow > 0 ? compactRecords(transcriptRecords.slice(0, overflow)).length : 0;
7160
+ if (overflow > 0) transcriptRecords.splice(0, overflow);
7161
+ return removed;
7162
+ };
7163
+ const reloadTranscriptTail = () => {
7164
+ if (!transcriptPath) return;
7165
+ transcriptRecords = readFleetTranscriptTail(transcriptPath, { limit: 2000 }).records;
7166
+ };
6960
7167
  try { await ctx.ui.custom((tui: any, theme: any, _kb: any, done: () => void) => {
6961
7168
  if (target) target.zoomRender = (force?: boolean) => { const now = Date.now(); if (force || now - lastRender > 80) { lastRender = now; tui.requestRender(); } };
7169
+ resources.every(2000, () => tui.requestRender());
6962
7170
  return {
6963
7171
  render: (w: number) => {
6964
7172
  const body = bodyRows(tui.terminal?.rows, DETAIL_CHROME_ROWS);
6965
7173
  if (modelPicker) return renderFleetModelPicker(detailRow.name, modelPicker.choices, modelPicker, w, body, theme);
7174
+ syncTranscriptTail();
6966
7175
  const entries = timeline();
6967
- if (followTail) scrollOffset = Math.max(0, detailContent(entries, w, expandedIndex).length - body);
6968
- return renderFleetDetail(detailRow, entries, scrollOffset, w, body, theme, expandedIndex);
7176
+ if (followTail) {
7177
+ selectedIndex = Math.max(0, entries.length - 1);
7178
+ scrollOffset = Math.max(0, detailContent(entries, w, expandedIndex, verbose, selectedIndex).length - body);
7179
+ }
7180
+ const liveRow = detailRow.status === "running" && detailRow.startedAt != null
7181
+ ? { ...detailRow, elapsed: Date.now() - detailRow.startedAt }
7182
+ : detailRow;
7183
+ return renderFleetDetail(liveRow, entries, scrollOffset, w, body, theme, expandedIndex, verbose, selectedIndex);
6969
7184
  },
6970
7185
  handleInput: async (data: string) => {
6971
7186
  const input = matchedFleetDetailInput(data);
@@ -6977,16 +7192,29 @@ ${externalBlockedProtocol()}
6977
7192
  const picked = modelPicker.choices[modelPicker.index]?.spec;
6978
7193
  modelPicker = null;
6979
7194
  if (picked && applyFleetDetailModel(detailRow, picked, ctx)) {
6980
- detailRow = { ...detailRow, model: detailRow.status === "running" ? `${detailRow.model} → ${shortModel(picked)} next` : `${shortModel(picked)} (next)` };
7195
+ const effectivePicked = substitutedModel(picked) ?? picked;
7196
+ detailRow = { ...detailRow, model: detailRow.status === "running" ? `${detailRow.model} → ${shortModel(effectivePicked)} next` : `${shortModel(effectivePicked)} (next)` };
6981
7197
  }
6982
7198
  }
6983
7199
  tui.requestRender();
6984
7200
  return;
6985
7201
  }
6986
- const entries = timeline();
6987
- const state = { scrollOffset, selectedIndex, expandedIndex, followTail };
6988
- const action = detailTransition(input, state, entries, body, detailContent(entries, tui.terminal?.columns ?? 80, expandedIndex).length);
6989
- ({ scrollOffset, selectedIndex, expandedIndex, followTail } = state);
7202
+ if ((input === "\u001b[A" || input === "k" || input === "\u001b[5~" || input === "\u001b[H") && scrollOffset === 0) {
7203
+ const added = loadOlderTranscript();
7204
+ selectedIndex += added;
7205
+ }
7206
+ if (input === "\u001b[F") reloadTranscriptTail();
7207
+ let entries = timeline();
7208
+ if (!followTail && (input === "\u001b[B" || input === "j" || input === "\u001b[6~") && selectedIndex >= entries.length - 1) {
7209
+ selectedIndex = Math.max(0, selectedIndex - loadNewerTranscript());
7210
+ entries = timeline();
7211
+ }
7212
+ const width = tui.terminal?.columns ?? 80;
7213
+ const state = { scrollOffset, selectedIndex, expandedIndex, followTail, verbose };
7214
+ const content = detailContent(entries, width, expandedIndex, verbose, selectedIndex);
7215
+ const offsets = detailEntryOffsets(entries, width, expandedIndex, verbose);
7216
+ const action = detailTransition(input, state, entries, body, content.length, offsets);
7217
+ ({ scrollOffset, selectedIndex, expandedIndex, followTail, verbose } = state);
6990
7218
  if (action === "close") done();
6991
7219
  else if (action === "copy") {
6992
7220
  const item = entries[selectedIndex];
@@ -7004,6 +7232,7 @@ ${externalBlockedProtocol()}
7004
7232
  dispose: () => resources.dispose(),
7005
7233
  };
7006
7234
  }, FULLSCREEN_OVERLAY); } finally { resources.dispose(); if (target) target.zoomRender = undefined; }
7235
+ return verbose;
7007
7236
  }
7008
7237
  async function restartFleetRow(selected: FleetRow, ctx: any): Promise<void> {
7009
7238
  if (modelWorkBlockedByRosterRecovery(ctx)) return;
@@ -7041,12 +7270,24 @@ ${externalBlockedProtocol()}
7041
7270
  const result = await dispatchAgent(state.def.name, state.task, ctx);
7042
7271
  pi.sendMessage({ customType: "agent-restart-result", content: `[${displayName(state.def.name)}] restarted by operator and ${result.exitCode === 0 ? "completed" : "failed"} in ${Math.round(result.elapsed / 1000)}s.`, display: true }, { deliverAs: "followUp", triggerTurn: true });
7043
7272
  }
7044
- async function openFleetDashboard(ctx: any): Promise<void> {
7273
+ type FleetSubstitutionPickerState = {
7274
+ stage: "source" | "target";
7275
+ source?: string;
7276
+ choices: FleetModelChoice[];
7277
+ index: number;
7278
+ scrollOffset: number;
7279
+ };
7280
+
7281
+ async function openFleetDashboard(ctx: any, startSubstitution = false): Promise<void> {
7045
7282
  const resources = createPanelResources();
7046
7283
  const selection: Selection = { index: 0 };
7047
7284
  let scrollOffset = 0;
7048
7285
  let filtering = false;
7286
+ let detailVerbose = false;
7049
7287
  let confirm: DashboardConfirm = null;
7288
+ let substitutionPicker: FleetSubstitutionPickerState | null = startSubstitution
7289
+ ? { stage: "source", choices: substitutionSourceChoices(), index: 0, scrollOffset: 0 }
7290
+ : null;
7050
7291
  const toInput = (data: string): string => {
7051
7292
  if (matchesKey(data, Key.up)) return "\u001b[A";
7052
7293
  if (matchesKey(data, Key.down)) return "\u001b[B";
@@ -7064,6 +7305,12 @@ ${externalBlockedProtocol()}
7064
7305
  const rows = fleetRows();
7065
7306
  reconcileSelection(selection, rows);
7066
7307
  const body = bodyRows(tui.terminal?.rows, FLEET_CHROME_ROWS);
7308
+ if (substitutionPicker) {
7309
+ return renderFleetSubstitutionPicker(
7310
+ substitutionPicker.stage, substitutionPicker.source, substitutionPicker.choices,
7311
+ substitutionPicker, w, body, theme,
7312
+ );
7313
+ }
7067
7314
  scrollOffset = clampScroll(scrollOffset, rows.length, body);
7068
7315
  const summary = summarise(rows);
7069
7316
  return renderFleetDashboard({
@@ -7078,15 +7325,46 @@ ${externalBlockedProtocol()}
7078
7325
  const rows = fleetRows();
7079
7326
  reconcileSelection(selection, rows);
7080
7327
  const body = bodyRows(tui.terminal?.rows, FLEET_CHROME_ROWS);
7328
+ const input = toInput(data);
7329
+ if (substitutionPicker) {
7330
+ const action = modelPickerTransition(input, substitutionPicker, substitutionPicker.choices.length, body);
7331
+ if (action === "cancel") {
7332
+ if (substitutionPicker.stage === "target") {
7333
+ const source = substitutionPicker.source;
7334
+ const choices = substitutionSourceChoices();
7335
+ const index = Math.max(0, choices.findIndex(choice => choice.spec === source));
7336
+ substitutionPicker = { stage: "source", choices, index, scrollOffset: index };
7337
+ } else substitutionPicker = null;
7338
+ } else if (action === "select") {
7339
+ const picked = substitutionPicker.choices[substitutionPicker.index]?.spec;
7340
+ if (picked && substitutionPicker.stage === "source") {
7341
+ const targets = await loadAvailableModelChoices(ctx, modelSubstitutions.get(picked));
7342
+ if (targets) {
7343
+ const current = modelSubstitutions.get(picked);
7344
+ const index = Math.max(0, targets.findIndex(choice => choice.spec === current));
7345
+ substitutionPicker = { stage: "target", source: picked, choices: targets, index, scrollOffset: index };
7346
+ }
7347
+ } else if (picked && substitutionPicker.source) {
7348
+ await applySessionModelSubstitution(substitutionPicker.source, picked, ctx);
7349
+ substitutionPicker = null;
7350
+ }
7351
+ }
7352
+ tui.requestRender();
7353
+ return;
7354
+ }
7081
7355
  const state = { selection, scrollOffset, filtering, filterQuery: fleetFilter, showFinished: fleetShowFinished, confirm };
7082
- const intent = dashboardTransition(toInput(data), state, rows, body);
7356
+ const intent = dashboardTransition(input, state, rows, body);
7083
7357
  ({ scrollOffset, filtering, confirm } = state);
7084
7358
  fleetFilter = state.filterQuery;
7085
7359
  fleetShowFinished = state.showFinished;
7086
7360
  if (intent === "close") done();
7087
- else if (intent && typeof intent === "object" && "open" in intent) {
7361
+ else if (intent === "substitute") {
7362
+ const choices = substitutionSourceChoices();
7363
+ if (choices.length === 0) ctx.ui.notify("No configured persona or sub-role models are available as substitution sources.", "warning");
7364
+ else substitutionPicker = { stage: "source", choices, index: 0, scrollOffset: 0 };
7365
+ } else if (intent && typeof intent === "object" && "open" in intent) {
7088
7366
  const selected = rows.find(r => r.key === intent.open) ?? rows[selection.index];
7089
- if (selected) await openFleetDetail(selected, ctx);
7367
+ if (selected) detailVerbose = await openFleetDetail(selected, ctx, detailVerbose);
7090
7368
  } else if (intent && typeof intent === "object" && "kill" in intent) {
7091
7369
  const selected = rows.find(r => r.key === intent.kill);
7092
7370
  if (!selected) ctx.ui.notify("Selected fleet row no longer exists.", "warning");
@@ -7284,6 +7562,64 @@ ${externalBlockedProtocol()}
7284
7562
  handler: async (_args, ctx) => { widgetCtx = ctx; await openContextBudget(ctx); },
7285
7563
  });
7286
7564
 
7565
+ function rosterRefusalMessage(): string {
7566
+ return "Orchestrator posture requires at least one native specialist. Add one with /af-agents-add or select /af-agents-team first.";
7567
+ }
7568
+
7569
+ function watchdogArmedNote(next: Posture): string {
7570
+ if (next !== "orchestrator") return "";
7571
+ const armed = resolveWatchdogActive(undefined, undefined, watchdogSetting, next);
7572
+ return armed
7573
+ ? "\nDrift watchdog: armed (orchestrator auto). /af-watchdog off to disarm."
7574
+ : "\nDrift watchdog: off (explicit hub setting).";
7575
+ }
7576
+
7577
+ async function commitPosture(next: Posture, ctx: ExtensionContext): Promise<"ok" | "unchanged" | "roster"> {
7578
+ if (orchestratorNeedsRoster(next, agentStates.size)) return "roster";
7579
+ if (next === posture) return "unchanged";
7580
+ posture = next;
7581
+ if (posture === "operator") {
7582
+ rosterRecoveryRequired = false;
7583
+ rosterRecoveryDiagnostic = "";
7584
+ setTimeout(replayDeferredRecoveryInputs, 0);
7585
+ }
7586
+ if (posture === "orchestrator" && personaGateEnabled && !personaGateSatisfied) {
7587
+ await pickDispatcherPersona(ctx);
7588
+ }
7589
+ resolveIncomingCapabilities("");
7590
+ applyPostureTools();
7591
+ updatePostureStatus(ctx);
7592
+ pi.appendEntry("agent-hub-posture", { posture });
7593
+ return "ok";
7594
+ }
7595
+
7596
+ async function applyPostureSelection(next: Posture, ctx: ExtensionContext, deprecatedFrom?: string): Promise<void> {
7597
+ if (executionPairBlockedByRoster(posture, next, agentStates.size)) {
7598
+ ctx.ui.notify(rosterRefusalMessage(), "warning");
7599
+ return;
7600
+ }
7601
+ const result = await commitPosture(next, ctx);
7602
+ if (result === "roster") {
7603
+ ctx.ui.notify(rosterRefusalMessage(), "warning");
7604
+ return;
7605
+ }
7606
+ const deprecation = deprecatedFrom
7607
+ ? `"${deprecatedFrom}" is no longer an execution mode; mapped to ${next} posture.\n`
7608
+ : "";
7609
+ ctx.ui.notify(
7610
+ `${deprecation}${postureStatusText()}\nPrompt and tools update on the next model call.${watchdogArmedNote(next)}`,
7611
+ result === "ok" ? "success" : "info",
7612
+ );
7613
+ }
7614
+
7615
+ async function openPosturePicker(ctx: ExtensionContext): Promise<void> {
7616
+ const picker = posturePickerOptions(posture);
7617
+ const choice = await ctx.ui.select(picker.title, picker.options);
7618
+ const next = selectedPickerValue(picker.options, choice, picker.postures);
7619
+ if (!next) return;
7620
+ await applyPostureSelection(next, ctx);
7621
+ }
7622
+
7287
7623
  // ── /af-posture: direct operator ↔ restricted orchestrator ──
7288
7624
  pi.registerCommand("af-posture", {
7289
7625
  description: "Show or set the Fleet posture: operator (direct tools) | orchestrator (delegate-only)",
@@ -7291,6 +7627,10 @@ ${externalBlockedProtocol()}
7291
7627
  widgetCtx = ctx;
7292
7628
  const requested = (args || "").trim();
7293
7629
  if (!requested) {
7630
+ if (ctx.hasUI && typeof ctx.ui.select === "function") {
7631
+ await openPosturePicker(ctx);
7632
+ return;
7633
+ }
7294
7634
  ctx.ui.notify(`${postureStatusText()}\nSwitch with /af-posture operator|orchestrator`, "info");
7295
7635
  return;
7296
7636
  }
@@ -7299,59 +7639,31 @@ ${externalBlockedProtocol()}
7299
7639
  ctx.ui.notify(`Unknown posture "${requested}" — expected operator|orchestrator.`, "error");
7300
7640
  return;
7301
7641
  }
7302
- if (orchestratorNeedsRoster(next, agentStates.size)) {
7303
- ctx.ui.notify("Orchestrator posture requires at least one native specialist. Add one with /af-agents-add or select /af-agents-team first.", "warning");
7304
- return;
7305
- }
7306
- posture = next;
7307
- if (posture === "operator") {
7308
- rosterRecoveryRequired = false;
7309
- rosterRecoveryDiagnostic = "";
7310
- setTimeout(replayDeferredRecoveryInputs, 0);
7311
- }
7312
- if (posture === "orchestrator" && personaGateEnabled && !personaGateSatisfied) {
7313
- await pickDispatcherPersona(ctx);
7314
- }
7315
- resolveIncomingCapabilities("");
7316
- applyPostureTools();
7317
- updatePostureStatus(ctx);
7318
- pi.appendEntry("agent-hub-posture", { posture });
7319
- ctx.ui.notify(`${postureStatusText()}\nPrompt and tools update on the next model call.`, "success");
7642
+ await applyPostureSelection(next, ctx);
7320
7643
  },
7321
7644
  });
7322
7645
 
7323
- // ── /af-hub-mode: execution mode (fast|standard|strict) ──
7324
- // Session-lifetime switch over the overrides-file default. Budgets bind on
7325
- // the NEXT tool call (counters are per user turn and keep running); the
7326
- // dispatcher prompt rebuilds with the new mode on the next turn.
7327
- pi.registerCommand("af-hub-mode", {
7328
- description: "Show or set the execution mode: fast (single specialist) | standard (batched, default) | strict (full Verification Contract)",
7646
+ pi.registerCommand("af-work-mode", {
7647
+ description: "Show or set Fleet posture (operator | orchestrator). Alt+M opens the picker.",
7329
7648
  handler: async (args, ctx) => {
7330
7649
  widgetCtx = ctx;
7331
- const requested = (args || "").trim();
7332
- if (!requested) {
7333
- const b = currentBudget();
7334
- const cap = (n: number | null) => (n == null ? "∞" : String(n));
7650
+ const parsed = parseWorkModeArgs(args);
7651
+ if (!parsed.ok) {
7652
+ ctx.ui.notify(parsed.error, "error");
7653
+ return;
7654
+ }
7655
+ if (parsed.action === "apply") {
7656
+ await applyPostureSelection(parsed.posture, ctx, parsed.deprecatedFrom);
7657
+ return;
7658
+ }
7659
+ if (!ctx.hasUI || typeof ctx.ui.select !== "function") {
7335
7660
  ctx.ui.notify(
7336
- `Execution mode: ${hubMode}\nThis turn: ${turnDispatchCount}/${cap(b.maxDispatches)} dispatches, ` +
7337
- `${turnResearchCount}/${cap(b.maxResearch)} research\nSwitch with /af-hub-mode ${HUB_MODES.join("|")}`,
7661
+ `${postureStatusText()}\nSwitch with /af-work-mode operator|orchestrator`,
7338
7662
  "info",
7339
7663
  );
7340
7664
  return;
7341
7665
  }
7342
- const mode = normalizeHubMode(requested);
7343
- if (!mode) {
7344
- ctx.ui.notify(`Unknown mode "${requested}" — expected one of: ${HUB_MODES.join(", ")}`, "error");
7345
- return;
7346
- }
7347
- const previousMode = hubMode;
7348
- hubMode = mode;
7349
- updateModeStatus();
7350
- appendHubModeEntry({ previousMode, mode, source: "slash-command", ctx });
7351
- ctx.ui.notify(
7352
- `Execution mode → ${mode} (budgets apply from the next dispatch; prompt updates next turn)` + hubLocationSuffix(ctx),
7353
- "success",
7354
- );
7666
+ await openPosturePicker(ctx);
7355
7667
  },
7356
7668
  });
7357
7669
 
@@ -7514,6 +7826,20 @@ ${externalBlockedProtocol()}
7514
7826
  void openFleetDashboard(ctx);
7515
7827
  },
7516
7828
  });
7829
+ pi.registerShortcut("alt+m", {
7830
+ description: "Open posture picker",
7831
+ handler: (ctx) => {
7832
+ widgetCtx = ctx;
7833
+ if (!ctx.hasUI || typeof ctx.ui.select !== "function") {
7834
+ ctx.ui.notify(
7835
+ `${postureStatusText()}\nSwitch with /af-work-mode operator|orchestrator`,
7836
+ "info",
7837
+ );
7838
+ return;
7839
+ }
7840
+ void openPosturePicker(ctx);
7841
+ },
7842
+ });
7517
7843
  pi.registerShortcut("alt+shift+a", {
7518
7844
  description: "Toggle compact agent widget",
7519
7845
  handler: (ctx) => { widgetCtx = ctx; viewMode = viewMode === "compact" ? "off" : "compact"; updateWidget(); updateResearchWidget(); ctx.ui.notify(`Compact agent widget: ${viewMode}`, "info"); },
@@ -7701,9 +8027,10 @@ ${externalBlockedProtocol()}
7701
8027
  const roleItems = Array.from(agentStates.values()).flatMap(s =>
7702
8028
  Object.entries(s.def.subagents || {}).map(([role, r]) => {
7703
8029
  const override = subagentModelOverrides.get(`${s.def.name.toLowerCase()}.${role.toLowerCase()}`);
8030
+ const effective = resolvedSubagentModel(s.def.name, role, r.model);
7704
8031
  return {
7705
8032
  value: `${s.def.name}.${role}`,
7706
- label: `${s.def.name}.${role} — ${shortModel(override ?? r.model)}${override ? " (switched)" : ""}`,
8033
+ label: `${s.def.name}.${role} — ${shortModel(effective)}${override || effective !== r.model ? " (switched)" : ""}`,
7707
8034
  };
7708
8035
  }),
7709
8036
  );
@@ -7750,7 +8077,7 @@ ${externalBlockedProtocol()}
7750
8077
  for (const m of [role.model, ...allowedModels(parent.def)]) {
7751
8078
  if (m && !candidates.includes(m)) candidates.push(m);
7752
8079
  }
7753
- const current = subagentModelOverrides.get(overrideKey) ?? role.model;
8080
+ const current = resolvedSubagentModel(parent.def.name, roleKey, role.model);
7754
8081
  const options = candidates.map(m => {
7755
8082
  const tags = [m === role.model ? "default" : "", m === current ? "current" : ""].filter(Boolean);
7756
8083
  return tags.length ? `${m} (${tags.join(", ")})` : m;
@@ -7759,8 +8086,9 @@ ${externalBlockedProtocol()}
7759
8086
  const choice = await ctx.ui.select(`Model for ${label}`, options);
7760
8087
  if (choice === undefined) return;
7761
8088
  const picked = candidates[options.indexOf(choice)];
7762
- if (picked === current) {
7763
- ctx.ui.notify(`${label} is already on ${picked}`, "info");
8089
+ const effectivePicked = substitutedModel(picked) ?? picked;
8090
+ if (effectivePicked === current) {
8091
+ ctx.ui.notify(`${label} is already on ${effectivePicked}`, "info");
7764
8092
  return;
7765
8093
  }
7766
8094
  if (picked === role.model) {
@@ -7770,7 +8098,7 @@ ${externalBlockedProtocol()}
7770
8098
  }
7771
8099
  updateWidget();
7772
8100
  ctx.ui.notify(
7773
- `${label} → ${picked} (applies on next dispatch of ${parent.def.name})`,
8101
+ `${label} → ${effectivePicked} (applies on next dispatch of ${parent.def.name})`,
7774
8102
  "success",
7775
8103
  );
7776
8104
  return;
@@ -7809,9 +8137,10 @@ ${externalBlockedProtocol()}
7809
8137
  const choice = await ctx.ui.select(`Model for ${displayName(def.name)}`, options);
7810
8138
  if (choice === undefined) return;
7811
8139
  const picked = candidates[options.indexOf(choice)];
7812
- const pickedIsCurrent = current ? picked === current : picked === DISPATCHER_DEFAULT;
8140
+ const effectivePicked = picked === DISPATCHER_DEFAULT ? picked : (substitutedModel(picked) ?? picked);
8141
+ const pickedIsCurrent = current ? effectivePicked === current : picked === DISPATCHER_DEFAULT;
7813
8142
  if (pickedIsCurrent) {
7814
- ctx.ui.notify(`${displayName(def.name)} is already on ${picked}`, "info");
8143
+ ctx.ui.notify(`${displayName(def.name)} is already on ${effectivePicked}`, "info");
7815
8144
  return;
7816
8145
  }
7817
8146
  if (picked === def.model || picked === DISPATCHER_DEFAULT) {
@@ -7825,7 +8154,7 @@ ${externalBlockedProtocol()}
7825
8154
  const applyHint = (def.kind || "").toLowerCase() === "research"
7826
8155
  ? "applies on next /af-research or spawn_research"
7827
8156
  : `applies on next dispatch; /af-agents-restart ${def.name} to apply now`;
7828
- ctx.ui.notify(`${displayName(def.name)} → ${picked} (${applyHint})`, "success");
8157
+ ctx.ui.notify(`${displayName(def.name)} → ${effectivePicked} (${applyHint})`, "success");
7829
8158
  if ((dispatchPolicy.substitutions[name]?.prefer ?? dispatchPolicy.default) === "coms") {
7830
8159
  ctx.ui.notify(
7831
8160
  `Note: ${displayName(def.name)} prefers a coms peer (dispatch-policy.yaml) — this model override only applies to native(-fallback) runs; the peer keeps its own model.`,
@@ -7953,113 +8282,59 @@ ${externalBlockedProtocol()}
7953
8282
  },
7954
8283
  });
7955
8284
 
7956
- // All known model strings across every persona (allowedModels union), deduped
7957
- // preserving first-seen order. Used for /af-agent-models-substitute autocomplete.
8285
+ // Every configured model source across persona defaults/candidates, retained
8286
+ // fallbacks, and delegate sub-roles. Active mapping keys remain visible so the
8287
+ // operator can replace a session substitution even if the roster changes.
7958
8288
  function allKnownModels(): string[] {
7959
8289
  const seen = new Set<string>();
7960
8290
  const out: string[] = [];
8291
+ const add = (model: string | undefined) => {
8292
+ if (model && !seen.has(model)) { seen.add(model); out.push(model); }
8293
+ };
7961
8294
  for (const def of allAgentDefs) {
7962
- for (const m of allowedModels(def)) {
7963
- if (m && !seen.has(m)) { seen.add(m); out.push(m); }
8295
+ add(def.model);
8296
+ add(def.fallbackModel);
8297
+ for (const model of def.models ?? []) add(model);
8298
+ for (const role of Object.values(def.subagents ?? {})) {
8299
+ add(role.model);
8300
+ add(role.fallbackModel);
7964
8301
  }
7965
8302
  }
8303
+ for (const model of modelOverrides.values()) add(model);
8304
+ for (const model of subagentModelOverrides.values()) add(model);
8305
+ for (const source of modelSubstitutions.keys()) add(source);
7966
8306
  return out;
7967
8307
  }
7968
8308
 
7969
- // Completions for /af-agent-models-substitute: a flat list of known models.
7970
- // Free text allowed too — we just suggest, never restrict, so ad-hoc targets
7971
- // (e.g. a model a persona does not declare) still produce a clean "skipped"
7972
- // report at apply time.
7973
8309
  const substituteCompletions = (prefix: string): AutocompleteItem[] | null => {
7974
- const items = allKnownModels().map(m => ({ value: m, label: m }));
8310
+ const items = substitutionSourceChoices().map(choice => ({ value: choice.spec, label: choice.label }));
7975
8311
  if (items.length === 0) return null;
7976
8312
  const p = prefix.toLowerCase();
7977
8313
  const filtered = items.filter(i => i.value.toLowerCase().startsWith(p));
7978
8314
  return filtered.length > 0 ? filtered : items;
7979
8315
  };
7980
8316
 
7981
- // /af-agent-models-substitute <source> <target> — replace one model across all
7982
- // personas (team members + research + orchestrator; never the dispatcher).
7983
- // Per-persona validity: target must be in that persona's allowedModels.
7984
- // Applies session-lifetime (same lifetime as /af-agent-model); takes effect on
7985
- // the persona's NEXT dispatch (/af-agents-restart applies it immediately).
7986
- // One-step flow: dry-run summary is shown up front, then the swap is
7987
- // applied unconditionally — the operator runs the command to commit.
8317
+ // Bare command opens the exact same source → available-target picker as `m` in
8318
+ // Fleet Dashboard. The two-argument form remains available for scripting.
7988
8319
  pi.registerCommand("af-agent-models-substitute", {
7989
- description: "Replace one model across all personas: /af-agent-models-substitute <source> <target>",
8320
+ description: "Save a session-wide model substitution: /af-agent-models-substitute [<source> <target>]",
7990
8321
  getArgumentCompletions: substituteCompletions,
7991
8322
  handler: async (args, ctx) => {
7992
8323
  widgetCtx = ctx;
7993
8324
  const tokens = (args || "").trim().split(/\s+/).filter(Boolean);
7994
- if (tokens.length !== 2) {
7995
- ctx.ui.notify(
7996
- `Usage: /af-agent-models-substitute <source> <target>. ` +
7997
- `Both must be model specs (e.g. openai-codex/gpt-5.3-codex-spark).`,
7998
- "error",
7999
- );
8000
- return;
8001
- }
8002
- const [source, target] = tokens;
8003
-
8004
- // Build the dry-run. Walk every loaded persona (team + research +
8005
- // orchestrator all live in allAgentDefs) and decide per-persona:
8006
- // - "match" : current effective model === source AND target is a
8007
- // declared candidate → will be switched.
8008
- // - "skip" : any other case, with a reason.
8009
- const matches: { def: AgentDef; current: string }[] = [];
8010
- const skipped: { def: AgentDef; reason: string }[] = [];
8011
- for (const def of allAgentDefs) {
8012
- const current = resolvedModel(def);
8013
- if (!current) {
8014
- skipped.push({ def, reason: "no default model (runs on dispatcher's model)" });
8015
- continue;
8016
- }
8017
- if (current !== source) {
8018
- skipped.push({ def, reason: `current is ${current} (not ${source})` });
8019
- continue;
8020
- }
8021
- if (!allowedModels(def).includes(target)) {
8022
- skipped.push({ def, reason: `target ${target} not in declared candidates (model:/af-models: in ${def.file})` });
8023
- continue;
8325
+ if (tokens.length === 0) {
8326
+ if (allKnownModels().length === 0) {
8327
+ ctx.ui.notify("No configured persona or sub-role models are available as substitution sources.", "warning");
8328
+ return;
8024
8329
  }
8025
- matches.push({ def, current });
8026
- }
8027
-
8028
- // If target === source, the substitution is a no-op. We still report
8029
- // it so the operator sees that the request was understood.
8030
- if (source === target) {
8031
- ctx.ui.notify(
8032
- `Source and target are the same (${source}); nothing to do. ` +
8033
- `Affected: ${matches.length}, skipped: ${skipped.length}.`,
8034
- "info",
8035
- );
8330
+ await openFleetDashboard(ctx, true);
8036
8331
  return;
8037
8332
  }
8038
-
8039
- // Apply: for every match, if the persona's frontmatter default IS the
8040
- // target, clear any existing override (so it tracks frontmatter
8041
- // updates); otherwise record target in modelOverrides. Mirrors
8042
- // /af-agent-model and /af-models.
8043
- const applied: string[] = [];
8044
- for (const { def } of matches) {
8045
- const key = def.name.toLowerCase();
8046
- if (def.model === target) {
8047
- modelOverrides.delete(key);
8048
- } else {
8049
- modelOverrides.set(key, target);
8050
- }
8051
- applied.push(`${displayName(def.name)}: ${source} → ${target}`);
8333
+ if (tokens.length !== 2) {
8334
+ ctx.ui.notify("Usage: /af-agent-models-substitute [<source> <target>]", "error");
8335
+ return;
8052
8336
  }
8053
-
8054
- const skipDetails = skipped.map(s => `${displayName(s.def.name)}: ${s.reason}`);
8055
- const summary = [
8056
- `Substitution ${source} → ${target}:`,
8057
- ` Affected: ${applied.length}${applied.length ? ` (${applied.join(", ")})` : ""}`,
8058
- ` Skipped: ${skipped.length}${skipped.length ? ` (${skipDetails.join("; ")})` : ""}`,
8059
- ` Applies on next dispatch (/af-agents-restart to apply now).`,
8060
- ].join("\n");
8061
- updateWidget();
8062
- ctx.ui.notify(summary, applied.length > 0 ? "success" : "info");
8337
+ await applySessionModelSubstitution(tokens[0], tokens[1], ctx);
8063
8338
  },
8064
8339
  });
8065
8340
 
@@ -8842,10 +9117,10 @@ ask the human. You MUST instead:
8842
9117
  - When a specialist emits an \`ASK_USER:\` line in English, translate it to
8843
9118
  ${userLanguage} before relaying to the user.${userLanguage.toLowerCase() === "english" ? " (If user-language is English this is a no-op.)" : ""}`;
8844
9119
 
8845
- // ── Execution mode section + mode-conditional Verification Contract ──
8846
- // The mode is the dispatcher's operating envelope: the hub ENFORCES the
8847
- // budgets in code (dispatch_agent/spawn_research refuse past them); the
8848
- // prompt teaches the dispatcher to plan within them instead of hitting them.
9120
+ // ── Task triage + Verification Contract ──
9121
+ // The hub ENFORCES budgets in code (dispatch_agent/spawn_research refuse
9122
+ // past the task-tier envelope); the prompt teaches the dispatcher to plan
9123
+ // within them instead of hitting them.
8849
9124
  const budget = currentBudget();
8850
9125
  const taskBudget = currentTaskBudget();
8851
9126
  const cap = (n: number | null) => (n == null ? "unlimited" : String(n));
@@ -8853,7 +9128,7 @@ ask the human. You MUST instead:
8853
9128
  const capabilityState = [...capabilityResolution.active].map(pack => `${pack}:${capabilityResolution.reasons[pack]}`).join(", ");
8854
9129
  const provisionalState = capabilityResolution.provisional.map(pack => `${pack}:${capabilityResolution.reasons[pack]}`).join(", ");
8855
9130
  const stateCapsule = `## Current task state
8856
- - mode: ${hubMode}${taskTier ? ` · tier: ${taskTier}` : ""}; turn dispatches: ${turnDispatchCount}; research: ${turnResearchCount}
9131
+ - tier: ${taskTier ?? DEFAULT_TASK_TIER}${taskTierAssumed ? "?" : ""}; turn dispatches: ${turnDispatchCount}; research: ${turnResearchCount}
8857
9132
  - task dispatches: ${taskDispatchCount}; research: ${taskResearchCount}; review rounds: ${taskReviewRounds}
8858
9133
  - packs active: ${capabilityState}; provisional: ${provisionalState || "none"}
8859
9134
  - provisional confirmation: ${capabilityResolution.provisional.filter(pack => capabilityConfirmation[pack as ConfirmableCapabilityPack] !== "declined").map(pack => `${pack} (${capabilityResolution.reasons[pack]}) → call ask_user exactly once with ${JSON.stringify(capabilityConfirmationQuestion(pack as ConfirmableCapabilityPack))}`).join("; ") || "none"}
@@ -8865,13 +9140,7 @@ Call \`set_task_tier\` honestly: trivial/small work uses minimal ceremony; featu
8865
9140
  const fullVerificationContract = `## Verification Contract
8866
9141
  For non-trivial work, record at most ${MAX_OPEN_ASSERTIONS} narrow, sourced assertions before building and pass them verbatim to specialists. Advance only on named evidence; unproven/failed is not done. Runtime-UI claims require runtime observation. Use \`skills/orchestration-verification/SKILL.md\` for formats, parity inventories, and regression resets. After compaction, read the ledger before continuing.`;
8867
9142
 
8868
- const verificationSection = !verificationActive ? "" : hubMode === "fast"
8869
- ? `## Verification (fast mode)
8870
- The assertion ledger is OPTIONAL in fast mode. State what was asked, dispatch the one
8871
- specialist, and verify from its returned evidence (command output, file:line). If the
8872
- request carries real acceptance criteria or turns risky, ask the user to switch to
8873
- standard/strict instead of improvising rigor here.`
8874
- : fullVerificationContract;
9143
+ const verificationSection = !verificationActive ? "" : fullVerificationContract;
8875
9144
 
8876
9145
  // Peer section only when coms initialised. Decision G4: the coms_* tools are
8877
9146
  // already in the active tool surface when ready; here we just teach the
@@ -9476,8 +9745,6 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
9476
9745
  userLanguage = overrides.language;
9477
9746
  researchKeep = overrides.researchKeep;
9478
9747
  reconSearchTimeoutMs = overrides.reconSearchTimeoutMs;
9479
- const previousMode = hubMode;
9480
- hubMode = overrides.hubMode;
9481
9748
  budgetOverrides = overrides.budgetOverrides;
9482
9749
  watchdogSetting = overrides.watchdogSetting;
9483
9750
  watchdogJudgeModel = overrides.watchdogJudgeModel;
@@ -9486,13 +9753,6 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
9486
9753
  // A new session is a new task by definition.
9487
9754
  resetTaskWindow(null);
9488
9755
  updateModeStatus();
9489
- appendHubModeEntry({
9490
- previousMode,
9491
- mode: hubMode,
9492
- source: overrides.hubModeSource,
9493
- overrideFile: overrides.hubModeSource === "project-override" ? ".ai/agent-fleet-overrides.md" : null,
9494
- ctx: _ctx,
9495
- });
9496
9756
  if (overrides.warnings.length > 0) {
9497
9757
  _ctx.ui.notify(`agent-fleet-overrides warnings:\n${overrides.warnings.join("\n")}`, "warning");
9498
9758
  }
@@ -9516,6 +9776,7 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
9516
9776
  // Model switching state resets each session; per-project overrides replace
9517
9777
  // the persona defs' default model / candidate list before anything reads them.
9518
9778
  modelOverrides.clear();
9779
+ modelSubstitutions.clear();
9519
9780
  subagentModelOverrides.clear();
9520
9781
  thinkingOverrides.clear();
9521
9782
  for (const def of allAgentDefs) {
@@ -9683,7 +9944,8 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
9683
9944
  `Persona gate: ${personaGateLabel}\n` +
9684
9945
  `Coms: ${comsLabel}\n` +
9685
9946
  `Fleet: ${fleetLabel}\n\n` +
9686
- `/af-posture [mode] Show/switch operator|orchestrator posture\n` +
9947
+ `/af-work-mode [posture] Operator | Orchestrator (Alt+M)\n` +
9948
+ `/af-posture [posture] Show/switch operator|orchestrator posture\n` +
9687
9949
  `/af-agents-team Select a team\n` +
9688
9950
  `/af-agents-list Open Fleet Dashboard\n` +
9689
9951
  `/af-agents-history Timeline of agent runs — durations, parallel markers, grand total\n` +
@@ -9691,7 +9953,7 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
9691
9953
  `/af-agent-model <persona>[.<role>] Switch a persona's or sub-role's model\n` +
9692
9954
  `/af-agent-model-thinking <persona> Switch a persona's thinking level\n` +
9693
9955
  `/af-models [profile] Apply a named model profile to the team\n` +
9694
- `/af-agent-models-substitute <src> <tgt> Swap one model across all personas\n` +
9956
+ `/af-agent-models-substitute [src tgt] Pick/save a session-wide source → target model substitution\n` +
9695
9957
  `/af-dispatch-policy Show which members route to coms peers (dispatch-policy.yaml)\n` +
9696
9958
  `/af-agents-kill <name> SIGTERM a frozen specialist (and its delegate children)\n` +
9697
9959
  `/af-agents-restart <name> Kill + re-run its last task fresh\n` +
@@ -9732,7 +9994,7 @@ You are peer "${identity.name}" in project "${identity.project}". Use \`coms_lis
9732
9994
  const bar = "#".repeat(filled) + "-".repeat(10 - filled);
9733
9995
 
9734
9996
  const left = renderHubFooterLeft(theme, HARNESS_VERSION, model, think, activeTeamName);
9735
- const hint = theme.fg("dim", composeFleetFooterHint(viewMode));
9997
+ const hint = theme.fg("dim", composeFleetFooterHint(viewMode, compactPosture(posture)));
9736
9998
  // The btw extension flips this global the first time a /af-btw command or
9737
9999
  // Alt+' is used; surface its reopen shortcut right next to the Alt+A hint.
9738
10000
  const btwHint = (globalThis as { __btwActivated?: boolean }).__btwActivated