macro-agent 0.1.8 → 0.1.11

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 (306) hide show
  1. package/CLAUDE.md +263 -33
  2. package/README.md +781 -131
  3. package/dist/acp/claude-code-replay.d.ts +11 -0
  4. package/dist/acp/claude-code-replay.d.ts.map +1 -0
  5. package/dist/acp/claude-code-replay.js +190 -0
  6. package/dist/acp/claude-code-replay.js.map +1 -0
  7. package/dist/acp/macro-agent.d.ts.map +1 -1
  8. package/dist/acp/macro-agent.js +192 -7
  9. package/dist/acp/macro-agent.js.map +1 -1
  10. package/dist/acp/types.d.ts +9 -0
  11. package/dist/acp/types.d.ts.map +1 -1
  12. package/dist/acp/types.js.map +1 -1
  13. package/dist/adapters/tasks-adapter.d.ts.map +1 -1
  14. package/dist/adapters/tasks-adapter.js +3 -0
  15. package/dist/adapters/tasks-adapter.js.map +1 -1
  16. package/dist/adapters/types.d.ts +1 -0
  17. package/dist/adapters/types.d.ts.map +1 -1
  18. package/dist/agent/agent-manager-v2.d.ts +21 -0
  19. package/dist/agent/agent-manager-v2.d.ts.map +1 -1
  20. package/dist/agent/agent-manager-v2.js +308 -54
  21. package/dist/agent/agent-manager-v2.js.map +1 -1
  22. package/dist/agent/agent-manager.d.ts +12 -0
  23. package/dist/agent/agent-manager.d.ts.map +1 -1
  24. package/dist/agent/agent-manager.js.map +1 -1
  25. package/dist/agent/agent-store.d.ts +10 -0
  26. package/dist/agent/agent-store.d.ts.map +1 -1
  27. package/dist/agent/agent-store.js +22 -0
  28. package/dist/agent/agent-store.js.map +1 -1
  29. package/dist/agent/types.d.ts +15 -2
  30. package/dist/agent/types.d.ts.map +1 -1
  31. package/dist/agent/types.js.map +1 -1
  32. package/dist/boot-v2.d.ts +129 -1
  33. package/dist/boot-v2.d.ts.map +1 -1
  34. package/dist/boot-v2.js +359 -8
  35. package/dist/boot-v2.js.map +1 -1
  36. package/dist/cli/acp.js +4 -0
  37. package/dist/cli/acp.js.map +1 -1
  38. package/dist/cli/index.js +56 -0
  39. package/dist/cli/index.js.map +1 -1
  40. package/dist/cognitive/macro-agent-backend.d.ts.map +1 -1
  41. package/dist/cognitive/macro-agent-backend.js +40 -22
  42. package/dist/cognitive/macro-agent-backend.js.map +1 -1
  43. package/dist/integrations/skilltree.d.ts.map +1 -1
  44. package/dist/integrations/skilltree.js +1 -0
  45. package/dist/integrations/skilltree.js.map +1 -1
  46. package/dist/lifecycle/cascade.d.ts +25 -2
  47. package/dist/lifecycle/cascade.d.ts.map +1 -1
  48. package/dist/lifecycle/cascade.js +70 -2
  49. package/dist/lifecycle/cascade.js.map +1 -1
  50. package/dist/lifecycle/cleanup.d.ts +33 -2
  51. package/dist/lifecycle/cleanup.d.ts.map +1 -1
  52. package/dist/lifecycle/cleanup.js +28 -6
  53. package/dist/lifecycle/cleanup.js.map +1 -1
  54. package/dist/lifecycle/handlers-v2.d.ts +7 -0
  55. package/dist/lifecycle/handlers-v2.d.ts.map +1 -1
  56. package/dist/lifecycle/handlers-v2.js +28 -2
  57. package/dist/lifecycle/handlers-v2.js.map +1 -1
  58. package/dist/lifecycle/types.d.ts +11 -0
  59. package/dist/lifecycle/types.d.ts.map +1 -1
  60. package/dist/lifecycle/types.js.map +1 -1
  61. package/dist/map/acp-bridge.d.ts +9 -0
  62. package/dist/map/acp-bridge.d.ts.map +1 -1
  63. package/dist/map/acp-bridge.js +15 -2
  64. package/dist/map/acp-bridge.js.map +1 -1
  65. package/dist/map/cascade-action-handler.d.ts +24 -0
  66. package/dist/map/cascade-action-handler.d.ts.map +1 -0
  67. package/dist/map/cascade-action-handler.js +170 -0
  68. package/dist/map/cascade-action-handler.js.map +1 -0
  69. package/dist/map/cascade-bridge.d.ts +44 -0
  70. package/dist/map/cascade-bridge.d.ts.map +1 -0
  71. package/dist/map/cascade-bridge.js +294 -0
  72. package/dist/map/cascade-bridge.js.map +1 -0
  73. package/dist/map/coordination-handler.d.ts.map +1 -1
  74. package/dist/map/coordination-handler.js +12 -1
  75. package/dist/map/coordination-handler.js.map +1 -1
  76. package/dist/map/lifecycle-bridge.d.ts +1 -1
  77. package/dist/map/lifecycle-bridge.d.ts.map +1 -1
  78. package/dist/map/lifecycle-bridge.js +58 -23
  79. package/dist/map/lifecycle-bridge.js.map +1 -1
  80. package/dist/map/server.d.ts.map +1 -1
  81. package/dist/map/server.js +219 -7
  82. package/dist/map/server.js.map +1 -1
  83. package/dist/map/sidecar.d.ts.map +1 -1
  84. package/dist/map/sidecar.js +49 -2
  85. package/dist/map/sidecar.js.map +1 -1
  86. package/dist/map/types.d.ts +22 -0
  87. package/dist/map/types.d.ts.map +1 -1
  88. package/dist/mcp/tools/done-v2.d.ts.map +1 -1
  89. package/dist/mcp/tools/done-v2.js +8 -0
  90. package/dist/mcp/tools/done-v2.js.map +1 -1
  91. package/dist/teams/team-manager-v2.d.ts.map +1 -1
  92. package/dist/teams/team-manager-v2.js +26 -0
  93. package/dist/teams/team-manager-v2.js.map +1 -1
  94. package/dist/teams/team-runtime-v2.d.ts.map +1 -1
  95. package/dist/teams/team-runtime-v2.js +16 -3
  96. package/dist/teams/team-runtime-v2.js.map +1 -1
  97. package/dist/workspace/config.d.ts +10 -10
  98. package/dist/workspace/config.d.ts.map +1 -1
  99. package/dist/workspace/config.js +4 -4
  100. package/dist/workspace/config.js.map +1 -1
  101. package/dist/workspace/git-cascade-adapter.d.ts +510 -0
  102. package/dist/workspace/git-cascade-adapter.d.ts.map +1 -0
  103. package/dist/workspace/git-cascade-adapter.js +934 -0
  104. package/dist/workspace/git-cascade-adapter.js.map +1 -0
  105. package/dist/workspace/index.d.ts +3 -3
  106. package/dist/workspace/index.d.ts.map +1 -1
  107. package/dist/workspace/index.js +4 -4
  108. package/dist/workspace/index.js.map +1 -1
  109. package/dist/workspace/landing/direct-push.d.ts +20 -0
  110. package/dist/workspace/landing/direct-push.d.ts.map +1 -0
  111. package/dist/workspace/landing/direct-push.js +74 -0
  112. package/dist/workspace/landing/direct-push.js.map +1 -0
  113. package/dist/workspace/landing/index.d.ts +29 -0
  114. package/dist/workspace/landing/index.d.ts.map +1 -0
  115. package/dist/workspace/landing/index.js +37 -0
  116. package/dist/workspace/landing/index.js.map +1 -0
  117. package/dist/workspace/landing/merge-to-parent.d.ts +41 -0
  118. package/dist/workspace/landing/merge-to-parent.d.ts.map +1 -0
  119. package/dist/workspace/landing/merge-to-parent.js +186 -0
  120. package/dist/workspace/landing/merge-to-parent.js.map +1 -0
  121. package/dist/workspace/landing/optimistic-push.d.ts +16 -0
  122. package/dist/workspace/landing/optimistic-push.d.ts.map +1 -0
  123. package/dist/workspace/landing/optimistic-push.js +27 -0
  124. package/dist/workspace/landing/optimistic-push.js.map +1 -0
  125. package/dist/workspace/landing/queue-to-branch.d.ts +24 -0
  126. package/dist/workspace/landing/queue-to-branch.d.ts.map +1 -0
  127. package/dist/workspace/landing/queue-to-branch.js +79 -0
  128. package/dist/workspace/landing/queue-to-branch.js.map +1 -0
  129. package/dist/workspace/merge-queue/merge-queue.d.ts +10 -0
  130. package/dist/workspace/merge-queue/merge-queue.d.ts.map +1 -1
  131. package/dist/workspace/merge-queue/merge-queue.js +10 -0
  132. package/dist/workspace/merge-queue/merge-queue.js.map +1 -1
  133. package/dist/workspace/merge-queue/types.d.ts +16 -2
  134. package/dist/workspace/merge-queue/types.d.ts.map +1 -1
  135. package/dist/workspace/merge-queue/types.js +9 -0
  136. package/dist/workspace/merge-queue/types.js.map +1 -1
  137. package/dist/workspace/pool/types.d.ts +1 -0
  138. package/dist/workspace/pool/types.d.ts.map +1 -1
  139. package/dist/workspace/pool/worktree-pool.d.ts.map +1 -1
  140. package/dist/workspace/pool/worktree-pool.js +1 -0
  141. package/dist/workspace/pool/worktree-pool.js.map +1 -1
  142. package/dist/workspace/recovery/abandon.d.ts +15 -0
  143. package/dist/workspace/recovery/abandon.d.ts.map +1 -0
  144. package/dist/workspace/recovery/abandon.js +45 -0
  145. package/dist/workspace/recovery/abandon.js.map +1 -0
  146. package/dist/workspace/recovery/auto-resolve.d.ts +27 -0
  147. package/dist/workspace/recovery/auto-resolve.d.ts.map +1 -0
  148. package/dist/workspace/recovery/auto-resolve.js +99 -0
  149. package/dist/workspace/recovery/auto-resolve.js.map +1 -0
  150. package/dist/workspace/recovery/defer.d.ts +15 -0
  151. package/dist/workspace/recovery/defer.d.ts.map +1 -0
  152. package/dist/workspace/recovery/defer.js +16 -0
  153. package/dist/workspace/recovery/defer.js.map +1 -0
  154. package/dist/workspace/recovery/escalate.d.ts +16 -0
  155. package/dist/workspace/recovery/escalate.d.ts.map +1 -0
  156. package/dist/workspace/recovery/escalate.js +24 -0
  157. package/dist/workspace/recovery/escalate.js.map +1 -0
  158. package/dist/workspace/recovery/index.d.ts +32 -0
  159. package/dist/workspace/recovery/index.d.ts.map +1 -0
  160. package/dist/workspace/recovery/index.js +45 -0
  161. package/dist/workspace/recovery/index.js.map +1 -0
  162. package/dist/workspace/recovery/spawn-resolver.d.ts +45 -0
  163. package/dist/workspace/recovery/spawn-resolver.d.ts.map +1 -0
  164. package/dist/workspace/recovery/spawn-resolver.js +118 -0
  165. package/dist/workspace/recovery/spawn-resolver.js.map +1 -0
  166. package/dist/workspace/recovery/types.d.ts +63 -0
  167. package/dist/workspace/recovery/types.d.ts.map +1 -0
  168. package/dist/workspace/recovery/types.js +12 -0
  169. package/dist/workspace/recovery/types.js.map +1 -0
  170. package/dist/workspace/topology/index.d.ts +9 -0
  171. package/dist/workspace/topology/index.d.ts.map +1 -0
  172. package/dist/workspace/topology/index.js +8 -0
  173. package/dist/workspace/topology/index.js.map +1 -0
  174. package/dist/workspace/topology/no-workspace.d.ts +18 -0
  175. package/dist/workspace/topology/no-workspace.d.ts.map +1 -0
  176. package/dist/workspace/topology/no-workspace.js +25 -0
  177. package/dist/workspace/topology/no-workspace.js.map +1 -0
  178. package/dist/workspace/topology/types.d.ts +97 -0
  179. package/dist/workspace/topology/types.d.ts.map +1 -0
  180. package/dist/workspace/topology/types.js +20 -0
  181. package/dist/workspace/topology/types.js.map +1 -0
  182. package/dist/workspace/topology/yaml-driven.d.ts +69 -0
  183. package/dist/workspace/topology/yaml-driven.d.ts.map +1 -0
  184. package/dist/workspace/topology/yaml-driven.js +273 -0
  185. package/dist/workspace/topology/yaml-driven.js.map +1 -0
  186. package/dist/workspace/types-v3.d.ts +117 -0
  187. package/dist/workspace/types-v3.d.ts.map +1 -0
  188. package/dist/workspace/types-v3.js +20 -0
  189. package/dist/workspace/types-v3.js.map +1 -0
  190. package/dist/workspace/types.d.ts +162 -17
  191. package/dist/workspace/types.d.ts.map +1 -1
  192. package/dist/workspace/workspace-manager.d.ts +101 -13
  193. package/dist/workspace/workspace-manager.d.ts.map +1 -1
  194. package/dist/workspace/workspace-manager.js +416 -13
  195. package/dist/workspace/workspace-manager.js.map +1 -1
  196. package/dist/workspace/yaml-schema.d.ts +254 -0
  197. package/dist/workspace/yaml-schema.d.ts.map +1 -0
  198. package/dist/workspace/yaml-schema.js +170 -0
  199. package/dist/workspace/yaml-schema.js.map +1 -0
  200. package/docs/conflict-recovery.md +472 -0
  201. package/docs/design/task-dispatcher.md +880 -0
  202. package/docs/git-cascade-integration-gaps.md +678 -0
  203. package/docs/workspace-interfaces.md +731 -0
  204. package/docs/workspace-redesign-plan.md +302 -0
  205. package/package.json +6 -5
  206. package/src/__tests__/boot-v2.test.ts +435 -0
  207. package/src/__tests__/e2e/acp-over-map.e2e.test.ts +92 -0
  208. package/src/__tests__/e2e/auto-sync.e2e.test.ts +257 -0
  209. package/src/__tests__/e2e/bootstrap.e2e.test.ts +319 -0
  210. package/src/__tests__/e2e/cascade-rebase.e2e.test.ts +254 -0
  211. package/src/__tests__/e2e/cli-run.e2e.test.ts +167 -0
  212. package/src/__tests__/e2e/dispatch-coordination.e2e.test.ts +495 -0
  213. package/src/__tests__/e2e/dispatch-live.e2e.test.ts +564 -0
  214. package/src/__tests__/e2e/dispatch-opentasks.e2e.test.ts +496 -0
  215. package/src/__tests__/e2e/dispatch-phase2-live.e2e.test.ts +456 -0
  216. package/src/__tests__/e2e/dispatch-phase2.e2e.test.ts +386 -0
  217. package/src/__tests__/e2e/dispatch.e2e.test.ts +376 -0
  218. package/src/__tests__/e2e/self-driving-v3.e2e.test.ts +197 -0
  219. package/src/__tests__/e2e/spawn-resolver.e2e.test.ts +200 -0
  220. package/src/__tests__/e2e/workspace-lifecycle.e2e.test.ts +30 -22
  221. package/src/__tests__/e2e/workspace-v3.e2e.test.ts +413 -0
  222. package/src/acp/__tests__/claude-code-replay.test.ts +225 -0
  223. package/src/acp/__tests__/macro-agent.test.ts +39 -1
  224. package/src/acp/claude-code-replay.ts +208 -0
  225. package/src/acp/macro-agent.ts +203 -10
  226. package/src/acp/types.ts +10 -0
  227. package/src/adapters/__tests__/tasks-adapter.test.ts +1 -0
  228. package/src/adapters/tasks-adapter.ts +3 -0
  229. package/src/adapters/types.ts +1 -0
  230. package/src/agent/__tests__/agent-manager-topology.test.ts +73 -0
  231. package/src/agent/__tests__/agent-manager-v2.test.ts +66 -0
  232. package/src/agent/__tests__/agent-store.test.ts +52 -0
  233. package/src/agent/__tests__/task-ref-resolution.test.ts +231 -0
  234. package/src/agent/agent-manager-v2.ts +372 -59
  235. package/src/agent/agent-manager.ts +14 -0
  236. package/src/agent/agent-store.ts +24 -0
  237. package/src/agent/types.ts +16 -2
  238. package/src/boot-v2.ts +589 -35
  239. package/src/cli/acp.ts +4 -0
  240. package/src/cli/index.ts +61 -0
  241. package/src/cognitive/macro-agent-backend.ts +45 -29
  242. package/src/integrations/skilltree.ts +1 -0
  243. package/src/lifecycle/__tests__/cascade-consolidation.test.ts +240 -0
  244. package/src/lifecycle/cascade.ts +77 -2
  245. package/src/lifecycle/cleanup.ts +52 -3
  246. package/src/lifecycle/handlers-v2.ts +40 -3
  247. package/src/lifecycle/types.ts +12 -0
  248. package/src/map/__tests__/cascade-bridge.test.ts +229 -0
  249. package/src/map/__tests__/emit-event.test.ts +71 -0
  250. package/src/map/__tests__/lifecycle-bridge.test.ts +86 -10
  251. package/src/map/acp-bridge.ts +26 -3
  252. package/src/map/cascade-action-handler.ts +205 -0
  253. package/src/map/cascade-bridge.ts +339 -0
  254. package/src/map/coordination-handler.ts +13 -1
  255. package/src/map/lifecycle-bridge.ts +52 -17
  256. package/src/map/server.ts +225 -7
  257. package/src/map/sidecar.ts +48 -1
  258. package/src/map/types.ts +23 -0
  259. package/src/mcp/tools/done-v2.ts +9 -0
  260. package/src/teams/team-manager-v2.ts +37 -0
  261. package/src/teams/team-runtime-v2.ts +23 -3
  262. package/src/workspace/__tests__/{dataplane-adapter.test.ts → git-cascade-adapter.test.ts} +209 -14
  263. package/src/workspace/__tests__/land-dispatch.test.ts +214 -0
  264. package/src/workspace/__tests__/self-driving-yaml.test.ts +114 -0
  265. package/src/workspace/__tests__/shared-worktree-refcount.test.ts +154 -0
  266. package/src/workspace/__tests__/standalone-mode.test.ts +118 -0
  267. package/src/workspace/__tests__/workspace-manager-v3.test.ts +245 -0
  268. package/src/workspace/__tests__/yaml-schema.test.ts +210 -0
  269. package/src/workspace/config.ts +11 -11
  270. package/src/workspace/git-cascade-adapter.ts +1213 -0
  271. package/src/workspace/index.ts +11 -11
  272. package/src/workspace/landing/__tests__/strategies.test.ts +184 -0
  273. package/src/workspace/landing/direct-push.ts +91 -0
  274. package/src/workspace/landing/index.ts +40 -0
  275. package/src/workspace/landing/merge-to-parent.ts +229 -0
  276. package/src/workspace/landing/optimistic-push.ts +36 -0
  277. package/src/workspace/landing/queue-to-branch.ts +108 -0
  278. package/src/workspace/merge-queue/merge-queue.ts +10 -0
  279. package/src/workspace/merge-queue/types.ts +16 -2
  280. package/src/workspace/pool/__tests__/worktree-pool.integration.test.ts +5 -5
  281. package/src/workspace/pool/types.ts +1 -0
  282. package/src/workspace/pool/worktree-pool.ts +1 -0
  283. package/src/workspace/recovery/__tests__/auto-resolve-integration.test.ts +127 -0
  284. package/src/workspace/recovery/__tests__/spawn-resolver.test.ts +139 -0
  285. package/src/workspace/recovery/__tests__/strategies.test.ts +145 -0
  286. package/src/workspace/recovery/abandon.ts +51 -0
  287. package/src/workspace/recovery/auto-resolve.ts +119 -0
  288. package/src/workspace/recovery/defer.ts +23 -0
  289. package/src/workspace/recovery/escalate.ts +30 -0
  290. package/src/workspace/recovery/index.ts +58 -0
  291. package/src/workspace/recovery/spawn-resolver.ts +152 -0
  292. package/src/workspace/recovery/types.ts +54 -0
  293. package/src/workspace/topology/__tests__/yaml-driven.test.ts +345 -0
  294. package/src/workspace/topology/index.ts +18 -0
  295. package/src/workspace/topology/no-workspace.ts +39 -0
  296. package/src/workspace/topology/types.ts +116 -0
  297. package/src/workspace/topology/yaml-driven.ts +316 -0
  298. package/src/workspace/types-v3.ts +162 -0
  299. package/src/workspace/types.ts +211 -20
  300. package/src/workspace/workspace-manager.ts +533 -19
  301. package/src/workspace/yaml-schema.ts +216 -0
  302. package/dist/workspace/dataplane-adapter.d.ts +0 -260
  303. package/dist/workspace/dataplane-adapter.d.ts.map +0 -1
  304. package/dist/workspace/dataplane-adapter.js +0 -416
  305. package/dist/workspace/dataplane-adapter.js.map +0 -1
  306. package/src/workspace/dataplane-adapter.ts +0 -546
package/CLAUDE.md CHANGED
@@ -7,14 +7,16 @@ A multi-agent orchestration system for spawning and managing hierarchical AI cod
7
7
  macro-agent enables coordinated work across multiple AI agents with:
8
8
  - **Role-based agents** (Worker, Integrator, Coordinator, Monitor, Analyst + custom team roles)
9
9
  - **Team templates** for declarative multi-agent topologies (YAML config)
10
- - **Pluggable integration strategies** (queue, trunk, optimistic)
11
- - **Workspace isolation** via git worktrees (powered by git-cascade)
12
- - **Merge queue** for serialized integration
10
+ - **Stream-first workspace layer (V3)** YAML-driven `TopologyPolicy` compiles role config into per-spawn workspace decisions; falls back to capability-based dispatch for programmatic callers
11
+ - **Pluggable `LandingStrategy`** `merge-to-parent`, `queue-to-branch`, `direct-push`, `optimistic-push` built-ins; registered on WorkspaceManager, selected per-role via YAML
12
+ - **Pluggable `ConflictRecoveryStrategy`** `defer`, `abandon`, `escalate`, `auto-resolve` (real git `-X` merge), `spawn-resolver` (LLM resolver agent)
13
+ - **Workspace isolation** via git worktrees + Change-Id tracking (powered by git-cascade 0.0.3+)
13
14
  - **Messaging** via agent-inbox (structured inbox/outbox, threading, federation)
14
15
  - **Task management** via opentasks (graph-based dependencies, providers, claiming)
15
16
  - **Control socket** for MCP subprocess lifecycle RPC (NDJSON over UNIX socket)
16
17
  - **Composite signal filtering and emission enforcement** for multi-team communication topology
17
18
  - **Trigger system** with pluggable routing strategies (including AI router), wake management, cron, and webhooks
19
+ - **Task dispatch** (opt-in, via `swarm-dispatch` v0.3+) — autonomous orchestrator that polls opentasks for ready work, routes to idle agents via agent-inbox or spawns new ones, tracks lifecycle with continuation/retry split, detects stalls, and reconciles external state changes
18
20
  - **Agent detection** for discovering installed CLI coding agents (Claude Code, Codex, etc.)
19
21
  - **Health check heartbeats** from MCP subprocesses to the control server
20
22
  - **ACP protocol server** with WebSocket transport for external client integration
@@ -271,26 +273,46 @@ src/
271
273
  │ │ └── index.ts
272
274
  │ └── index.ts # Public exports
273
275
 
274
- └── workspace/ # Workspace isolation
275
- ├── workspace-manager.ts # WorkspaceManager implementation
276
- ├── dataplane-adapter.ts # Bridges to git-cascade dataplane
277
- ├── config.ts # Workspace configuration
278
- ├── types.ts # Workspace, WorkspaceManager interface
276
+ └── workspace/ # Workspace isolation — V3 stream-first + legacy role-shaped
277
+ ├── workspace-manager.ts # WorkspaceManager implementation (legacy + V3 surfaces)
278
+ ├── git-cascade-adapter.ts # Wraps git-cascade tracker (40+ primitives surfaced)
279
+ ├── config.ts # GitCascadeConfig + pool config
280
+ ├── types.ts # WorkspaceManager interface (legacy + V3), events
281
+ ├── types-v3.ts # V3 types: Principal, StreamSpec, LandingStrategy, etc.
282
+ ├── yaml-schema.ts # Zod schema for `macro_agent.workspace`
283
+ ├── topology/ # TopologyPolicy — compiles YAML → spawn decisions
284
+ │ ├── types.ts # TopologyPolicy, WorkspaceDecision, contexts
285
+ │ ├── yaml-driven.ts # YamlDrivenTopology (primary)
286
+ │ ├── no-workspace.ts # NoWorkspaceTopology (null policy)
287
+ │ └── index.ts
288
+ ├── landing/ # LandingStrategy — pluggable merge/push algorithms
289
+ │ ├── merge-to-parent.ts # mergeStream into parent + optional cascadeRebase
290
+ │ ├── queue-to-branch.ts # git-cascade built-in merge queue
291
+ │ ├── direct-push.ts # rebase + push
292
+ │ ├── optimistic-push.ts # direct-push + validation event
293
+ │ └── index.ts # registerBuiltinLandingStrategies()
294
+ ├── recovery/ # ConflictRecoveryStrategy
295
+ │ ├── types.ts # ConflictContext, ConflictResolution
296
+ │ ├── defer.ts # Leave conflict record; no-op
297
+ │ ├── abandon.ts # Abandon the conflicted stream
298
+ │ ├── escalate.ts # Pause + notify human
299
+ │ ├── auto-resolve.ts # Replay merge with -X ours|theirs|union
300
+ │ ├── spawn-resolver.ts # Spawn a resolver agent (requires AgentManager)
301
+ │ └── index.ts # buildBuiltinRecoveryRegistry()
279
302
  ├── pool/ # Worktree pool management
280
303
  │ ├── worktree-pool.ts
281
304
  │ ├── types.ts
282
305
  │ └── index.ts
283
- ├── merge-queue/ # SQLite-backed merge queue
284
- │ ├── merge-queue.ts
285
- │ ├── schema.ts
286
- │ ├── types.ts
306
+ ├── merge-queue/ # @deprecated — legacy SQLite-backed queue,
307
+ │ ├── merge-queue.ts # duplicates git-cascade's built-in. Use
308
+ │ ├── schema.ts # GitCascadeAdapter.addToMergeQueue for
309
+ │ ├── types.ts # new code (via QueueToBranchStrategy).
287
310
  │ └── index.ts
288
- ├── strategies/ # Integration strategies
289
- │ ├── types.ts # IntegrationStrategy interface
290
- │ ├── registry.ts # Strategy factory registry
291
- │ ├── queue.ts # Queue strategy (wraps merge queue)
292
- │ ├── trunk.ts # Trunk strategy (direct push + rebase)
293
- │ ├── optimistic.ts # Optimistic strategy (push + validation event)
311
+ ├── strategies/ # @deprecated — old IntegrationStrategy.
312
+ │ ├── types.ts # Superseded by workspace/landing/.
313
+ │ ├── queue.ts # Scheduled for removal once all teams
314
+ │ ├── trunk.ts # migrate to macro_agent.workspace YAML.
315
+ │ ├── optimistic.ts
294
316
  │ └── index.ts
295
317
  └── index.ts # Public exports
296
318
  ```
@@ -371,16 +393,98 @@ Agents are assigned roles that determine their capabilities:
371
393
 
372
394
  Teams can define custom roles (e.g., planner, grinder, judge) that extend built-in roles via `extends` in `roles/<name>.yaml`. Tool filtering is role-based — `isToolAllowedForRole()` checks the role's capabilities before registering each MCP tool.
373
395
 
374
- ### Integration Strategies
396
+ ### Workspace Layer (V3 Stream-First)
397
+
398
+ The workspace layer went through a v3 redesign. Two paths coexist:
399
+
400
+ **V3 path (YAML-driven, recommended for teams):**
401
+ - `macro_agent.workspace` block in `team.yaml` declares per-role workspace decisions
402
+ - `TopologyPolicy` (`workspace/topology/`) compiles YAML → `WorkspaceDecision` per spawn
403
+ - `LandingStrategy` (`workspace/landing/`) finalizes work at `done()` time
404
+ - `ConflictRecoveryStrategy` (`workspace/recovery/`) dispatches on conflicts
405
+ - Auto-wired by `TeamManagerV2.startTeam()` when workspace config is present
406
+
407
+ **Legacy path (programmatic / capability-based):**
408
+ - Direct `agentManager.spawn({ capabilities: ['workspace.worktree'|'workspace.stream'|'workspace.integrate'], streamId, streamConfig })`
409
+ - `capabilityBasedDispatch` in `AgentManagerV2` routes to role-shaped `WorkspaceManager` methods (`createWorkerWorkspace`, etc.)
410
+ - Retained for programmatic callers (tools, libraries, tests that don't load team YAML)
411
+
412
+ **Dispatch priority in `AgentManagerV2.createWorkspaceForRole()`:**
413
+ 1. If `topologyPolicy` is set → V3 path via `executeWorkspaceDecision`
414
+ 2. Else → `capabilityBasedDispatch` using role-shaped methods
415
+
416
+ ### TopologyPolicy (V3)
417
+
418
+ `TopologyPolicy` (`workspace/topology/types.ts`) is the contract for compiling
419
+ team YAML into per-spawn workspace decisions. Three built-ins:
420
+
421
+ | Policy | Module | Purpose |
422
+ |---|---|---|
423
+ | **YamlDrivenTopology** | `topology/yaml-driven.ts` | Primary; reads `macro_agent.workspace` |
424
+ | **NoWorkspaceTopology** | `topology/no-workspace.ts` | Null policy; returns `share-parent-cwd` for all |
425
+
426
+ Hook methods:
427
+ - `onTeamStart(ctx)` → creates team-root stream if any role needs it
428
+ - `onAgentSpawn(ctx)` → returns `WorkspaceDecision` (`none` / `share-parent-cwd` / `share-with-agent` / `attach-to-stream` / `new-stream`)
429
+ - `onAgentComplete(ctx)` → deallocates the agent's worktree
430
+ - `onTeamStop(ctx)` → applies `on_team_complete` action (`keep` / `merge_to_main` / `abandon`)
431
+
432
+ The YAML schema (`workspace/yaml-schema.ts`) supports:
433
+ - `workspace`: `none` / `attach_to_team_root` / `share_with_agent` / `share_parent_cwd` / `new_stream`
434
+ - `stream_lineage`: `from_team_root` / `fork_from_team_root` / `fork_from_parent` / `independent` / `track_existing_branch`
435
+ - `allocation`, `landing`, `landing_config`, `on_conflict`, `on_conflict_recovery`, `conflict_recovery_config`, `cascade_on_parent_update`, `on_parent_advanced`, `share_with`, `track_branch`, `capabilities`
436
+
437
+ ### LandingStrategies (V3)
438
+
439
+ `LandingStrategy` (`workspace/types-v3.ts`) is how a streamed agent finalizes
440
+ its work. Registered on `WorkspaceManager` via `registerLandingStrategy(s)`
441
+ and selected per-role via YAML `landing:`. Four built-ins registered by
442
+ `registerBuiltinLandingStrategies()`:
443
+
444
+ | Strategy | Module | Semantics |
445
+ |---|---|---|
446
+ | **merge-to-parent** | `landing/merge-to-parent.ts` | `mergeStream(source → parent)`, optional `cascadeRebase` via `strategyConfig.cascade: true` |
447
+ | **queue-to-branch** | `landing/queue-to-branch.ts` | `GitCascadeAdapter.addToMergeQueue(streamId, targetBranch)` — drained by integrator-capable agents |
448
+ | **direct-push** | `landing/direct-push.ts` | Rebase + `git push` with retries (trunk flow) |
449
+ | **optimistic-push** | `landing/optimistic-push.ts` | `direct-push` + emits validation event |
450
+
451
+ `LandingContext` carries: `agentId`, `streamId`, `sourceWorktree`,
452
+ `targetStreamId`, `strategyConfig` (from YAML `landing_config`), and a back-
453
+ reference to `WorkspaceManager`.
454
+
455
+ ### Conflict Recovery (V3)
375
456
 
376
- Pluggable strategies for landing worker changes:
377
- - **Queue** (`queue.ts`): Wraps merge queue with serialized integration
378
- - **Trunk** (`trunk.ts`): Direct push with rebase-retry loop
379
- - **Optimistic** (`optimistic.ts`): Same as trunk + emits validation event
457
+ When a landing returns a conflict, the agent's `done()` flow dispatches to a
458
+ `ConflictRecoveryStrategy` (`workspace/recovery/types.ts`) selected via YAML
459
+ `on_conflict_recovery:` or team default. Five built-ins:
380
460
 
381
- ### Workspace Isolation
461
+ | Strategy | Mode | Behavior |
462
+ |---|---|---|
463
+ | **defer** | sync | No-op — leaves conflict record for later manual recovery |
464
+ | **abandon** | sync | `abandonStream(streamId)` — throwaway work |
465
+ | **escalate** | async | `pauseStream` + emit escalation — awaits external `resolve_conflict` MCP call |
466
+ | **auto-resolve** | sync | Replays merge with `-X ours|theirs|union` in the agent's worktree, commits, notifies `workspaceManager.resolveConflict` |
467
+ | **spawn-resolver** | async | Spawns a resolver agent on the conflicted stream; awaits `conflict:resolved` event or timeout |
382
468
 
383
- Each worker gets an isolated git worktree via the WorkspaceManager (backed by git-cascade). Changes are merged at the terminate level — `AgentManagerV2.terminate()` calls `terminateWithChangeConsolidation()` which handles merge requests. Agents never construct merge requests directly.
469
+ `spawn-resolver` requires `AgentManager` injection (not in default registry;
470
+ register via `createSpawnResolverStrategy({ agentManager })`). Max concurrent
471
+ resolvers per stream is configurable; timeout falls back to `escalated`.
472
+
473
+ `ConflictContext` carries: `conflictId`, `streamId`, `paths`, `operation`
474
+ (`merge` | `sync` | `rebase` | `cascade`), `worktree?` (required for
475
+ `auto-resolve`), `landingAgentId?`, `recoveryDepth`, `strategyConfig`.
476
+
477
+ ### Workspace Isolation (shared across paths)
478
+
479
+ Each streamed agent gets an isolated git worktree via `WorkspaceManager`,
480
+ backed by git-cascade's `MultiAgentRepoTracker`. V3 agents use
481
+ `allocateWorktree({ agentId, streamId })`; legacy agents use role-specific
482
+ `createWorkerWorkspace` / `createIntegratorWorkspace` / `createCoordinatorWorkspace`.
483
+ Both produce the same underlying git worktree structure.
484
+
485
+ Change-Id tracking via `commitChanges({ agentId, streamId, worktree, message })`
486
+ (v3) — each commit gets a stable `Change-Id: c-xxxxxxxx` trailer that survives
487
+ rebases. Legacy callers that use raw `git commit` bypass this tracking.
384
488
 
385
489
  ### MCP Tool Surface
386
490
 
@@ -422,6 +526,81 @@ Strategy resolution order: explicit `strategyName` > first `canHandle()` match >
422
526
  - Importance is mapped to wake action: `urgent` → interrupt/wake, `high` → inject/wake, `normal` → queue/wake, `low` → queue
423
527
  - Events are enqueued in SystemEventQueue, then WakeManager handles delivery
424
528
 
529
+ ### Task Dispatch (Autonomous Mode)
530
+
531
+ Opt-in autonomous dispatch mode powered by [`swarm-dispatch`](https://www.npmjs.com/package/swarm-dispatch) (v0.3+). The orchestrator polls opentasks for ready work, routes to idle agents or spawns new ones, tracks lifecycle, retries failures with exponential backoff, detects stalls, and reconciles external state changes.
532
+
533
+ Enabled via `config.dispatch.enabled` in boot. The orchestrator, state machine, eligibility, concurrency, retry, continuation, and reconciliation are all provided by `swarm-dispatch` — macro-agent provides adapters for the five ports:
534
+
535
+ 1. **TaskSource adapter** — wraps `TasksAdapter` (opentasks IPC) for task queries, claiming, and state transitions
536
+ 2. **AgentRuntime adapter** — wraps `AgentManagerV2` for agent spawning, termination, and lifecycle event subscription
537
+ 3. **MessagePort adapter** — wraps the embedded `agent-inbox` for mail-based work routing and result envelopes (via `createAgentInboxPort`)
538
+ 4. **AgentRoster adapter** — queries inbox agent storage for idle agents to route work to before spawning
539
+ 5. **Dispatch mode** — auto-selects `prefer-route` when MessagePort + Roster are present (mail-first, spawn-fallback); falls back to `spawn-only` when either is absent
540
+
541
+ **Boot wiring** (`boot-v2.ts`):
542
+ ```typescript
543
+ import { createOrchestrator, createAgentInboxPort } from "swarm-dispatch";
544
+
545
+ const orchestrator = createOrchestrator(source, runtime, {
546
+ claimantId,
547
+ pollIntervalMs: 15_000,
548
+ concurrency: { global: 3 },
549
+ retry: { maxRetries: 3, baseDelayMs: 10_000, maxDelayMs: 300_000 },
550
+ continuation: { delayMs: 1_000, maxTurns: 20 },
551
+ reconcile: { enabled: true, intervalMs: 60_000, stallTimeoutMs: 300_000 },
552
+ messagePort, // agent-inbox adapter (opt-in)
553
+ roster, // inbox agent listing (opt-in)
554
+ dispatchMode, // prefer-route | spawn-only | route-only | prefer-spawn
555
+ });
556
+ await orchestrator.start();
557
+ ```
558
+
559
+ The `Orchestrator` is exposed on `MacroAgentSystemV2.taskDispatcher` (optional, only present when dispatch is enabled) for observability, snapshots, and manual triggering via `dispatchNow()` / `reconcileNow()`.
560
+
561
+ **Configuration** (in `BootV2Config.dispatch`):
562
+ ```yaml
563
+ dispatch:
564
+ enabled: true
565
+ pollIntervalMs: 15000 # Dispatch poll cadence
566
+ maxConcurrent: 3 # Global concurrency limit
567
+ defaultRole: worker # Role for spawned agents
568
+ tags: [auto] # Only dispatch tasks with these tags
569
+ maxRetries: 3 # Retry attempts per task
570
+ dispatchMode: prefer-route # route-only | spawn-only | prefer-route | prefer-spawn
571
+ enableMailRouting: true # Wire MessagePort via agent-inbox (default: true)
572
+ enableRoster: true # Wire AgentRoster via inbox agent listing (default: true)
573
+ continuation:
574
+ delayMs: 1000 # Delay before continuation re-dispatch
575
+ maxTurns: 20 # Max continuation turns per task
576
+ reconcile:
577
+ enabled: true
578
+ intervalMs: 60000 # Reconciliation cadence
579
+ stallTimeoutMs: 300000 # Terminate agents with no activity past this
580
+ eligibility:
581
+ minPriority: 2
582
+ excludeTags: [wip]
583
+ ```
584
+
585
+ **Dispatch flow:**
586
+ 1. Orchestrator polls opentasks for ready tasks
587
+ 2. For each eligible task: check AgentRoster for idle agents → route via MessagePort if found → spawn via AgentRuntime if not
588
+ 3. Agent works on the task; lifecycle events flow back through `onStopped`
589
+ 4. On normal completion: check if task is still active → if yes, schedule continuation (same logical run, next turn)
590
+ 5. On abnormal exit: queue retry with exponential backoff
591
+ 6. Reconcile tick: check external state (task closed? reassigned?), detect stalls, terminate stale agents
592
+
593
+ **Key design decisions:**
594
+ - Dispatch logic lives in `swarm-dispatch` (runtime-agnostic npm package), not macro-agent
595
+ - **Mail-first, spawn-fallback**: when MessagePort + Roster are wired, the orchestrator prefers routing to existing idle agents over spawning new ones
596
+ - Agents spawn parentless (`parent: null`) — the dispatcher is the coordination layer, not a parent agent
597
+ - **Continuation vs retry**: normal exit + still-active task = continuation (short delay, turn counter). Abnormal exit = retry (exponential backoff, attempt counter). Never mixed.
598
+ - Each dispatcher instance uses a unique `claimantId` (`hostname:pid:instanceHash`) for multi-instance awareness
599
+ - The dispatcher registers itself as an agent in the inbox (`dispatcher:<claimantId>`) to receive mail-based work delegation from other agents
600
+ - **Cancellation propagation**: spawned agents are terminated via `runtime.terminate`; routed agents receive `x-dispatch/cancel` messages via MessagePort
601
+ - `promptUntilDone()` auto-terminates the agent when `done()` signals `shouldTerminate: true`
602
+ - See [swarm-dispatch README](https://www.npmjs.com/package/swarm-dispatch) for the full API
603
+
425
604
  ### Agent Detection
426
605
 
427
606
  The `agent-detection/` module discovers installed CLI coding agents on the system (e.g., Claude Code, Codex, Goose). It:
@@ -515,15 +694,16 @@ Teams configure communication via:
515
694
 
516
695
  All filtering is adapter-side — agent-inbox is a dumb pipe, macro-agent enforces policy via composite filters on the InboxAdapter.
517
696
 
518
- ### Done Handler Flow (V2)
697
+ ### Done Handler Flow
519
698
 
520
699
  1. Agent calls `done()` MCP tool with status + summary
521
700
  2. MCPServerV2 dispatches to `createDoneHandlerV2()` which builds a handler using `HandlerDepsV2` (InboxAdapter, TasksAdapter, AgentManager)
522
701
  3. Role-specific handler runs:
523
- - **Worker**: Commits changes, emits `work:done` signal to parent via InboxAdapter
702
+ - **Worker / V3 streamed agent**: Commits changes via `commitChanges` (Change-Id tracked), invokes `LandingStrategy.land()` per YAML config, emits `work:done` signal
524
703
  - **Coordinator**: Emits completion signal, cascade-terminates children if needed
525
704
  - **Monitor**: Emits health report
526
- 4. If `shouldTerminate`, AgentManagerV2 handles termination including workspace cleanup and change consolidation
705
+ 4. If landing returns a conflict, the recovery dispatcher selects a `ConflictRecoveryStrategy` per role's `on_conflict_recovery` YAML (or team default); strategy runs sync or async
706
+ 5. If `shouldTerminate`, AgentManagerV2 handles termination: `TopologyPolicy.onAgentComplete` deallocates the worktree; cascade termination consolidates changes for child agents
527
707
 
528
708
  ## Conventions
529
709
 
@@ -542,8 +722,8 @@ All filtering is adapter-side — agent-inbox is a dumb pipe, macro-agent enforc
542
722
 
543
723
  ### Testing
544
724
 
545
- - **Unit tests**: `*.test.ts` — Fast, mocked dependencies (~40 test files)
546
- - **E2E tests**: `*.e2e.test.ts` — Full system tests (11 test files)
725
+ - **Unit tests**: `*.test.ts` — Fast tests, mixed real-git and mocked dependencies (~58 test files, ~990 tests)
726
+ - **E2E tests**: `*.e2e.test.ts` — Full system tests gated by `RUN_E2E_TESTS=true`
547
727
 
548
728
  Run tests:
549
729
  ```bash
@@ -553,16 +733,23 @@ npm run test:e2e # E2E tests (mocked agent sessions)
553
733
  npm run test:e2e-full-agents # E2E tests with real agent spawning (RUN_FULL_AGENT_TESTS=true)
554
734
  ```
555
735
 
556
- E2E test files:
736
+ E2E test files (selected):
557
737
  - `agent-lifecycle.e2e.test.ts` — Spawn, prompt, terminate flows
738
+ - `workspace-lifecycle.e2e.test.ts` — Legacy capability-based workspace path (programmatic API)
739
+ - `workspace-v3.e2e.test.ts` — V3 YAML-driven path: peer swarm, merge-to-parent landing, conflict recovery, legacy regression guard
558
740
  - `cognitive-workspace.e2e.test.ts` — Cognitive-core backend workspace operations
559
741
  - `done-scenarios.e2e.test.ts` — Done handler scenarios per role
560
- - `workspace-lifecycle.e2e.test.ts` — Worktree allocation and cleanup
561
742
  - `trigger-wake.e2e.test.ts` — Trigger delivery and wake flows
562
743
  - `resume-continue.e2e.test.ts` — Session continuation
563
744
  - `pull-mode.e2e.test.ts` — Task claiming workflows
564
745
  - `opentasks-integration.e2e.test.ts` — TasksAdapter integration
565
746
  - `live-agent.e2e.test.ts` — Full agent with real Claude Code (requires `RUN_FULL_AGENT_TESTS`)
747
+ - `dispatch.e2e.test.ts` — Task dispatch Phase 1 boot wiring via swarm-dispatch (mocked agents)
748
+ - `dispatch-phase2.e2e.test.ts` — Task dispatch Phase 2 boot wiring: MessagePort, AgentRoster, dispatch modes, snapshot, stall config (mocked agents)
749
+ - `dispatch-live.e2e.test.ts` — Task dispatch with real agents via swarm-dispatch (requires `RUN_FULL_AGENT_TESTS`)
750
+ - `dispatch-phase2-live.e2e.test.ts` — Task dispatch Phase 2 with real agents: prefer-route fallback, snapshot, lifecycle tracking, reconciliation (requires `RUN_FULL_AGENT_TESTS`)
751
+ - `dispatch-opentasks.e2e.test.ts` — Task dispatch with real agents + real opentasks daemon via swarm-dispatch (requires `RUN_FULL_AGENT_TESTS`)
752
+ - `dispatch-coordination.e2e.test.ts` — Dispatch coordination with mock MAP connection
566
753
  - `conflict-resolution-git.e2e.test.ts` — Git merge conflict handling
567
754
  - `real-git-operations.e2e.test.ts` — Real git worktree operations
568
755
 
@@ -602,6 +789,27 @@ E2E test files:
602
789
  3. Register with `triggerSystem.router.registerStrategy(strategy)`
603
790
  4. Optionally set as default: `triggerSystem.router.setDefaultStrategy(name)`
604
791
 
792
+ ### Adding a Landing Strategy (V3)
793
+
794
+ 1. Implement the `LandingStrategy` interface from `src/workspace/types-v3.ts`
795
+ 2. Define `name`, `land(ctx)`, optionally `canLand(ctx)`, `initialize()`, `close()`
796
+ 3. Register via `workspaceManager.registerLandingStrategy(new YourStrategy())` (typically at boot after built-ins)
797
+ 4. Reference from team YAML: `roles.<role>.landing: your_strategy_name`; pass config via `landing_config`
798
+
799
+ ### Adding a Conflict Recovery Strategy (V3)
800
+
801
+ 1. Implement the `ConflictRecoveryStrategy` interface from `src/workspace/recovery/types.ts`
802
+ 2. Define `name`, `mode` (`sync` | `async`), `recover(ctx)`, optionally `canHandle(ctx)`
803
+ 3. If the strategy needs `AgentManager` (like `spawn-resolver`), expose a factory that accepts it
804
+ 4. Register into the team's recovery registry; selected per-role via `on_conflict_recovery:` or team default
805
+
806
+ ### Adding a Topology Policy (V3)
807
+
808
+ 1. Implement the `TopologyPolicy` interface from `src/workspace/topology/types.ts`
809
+ 2. Define `onTeamStart`, `onAgentSpawn`, `onAgentComplete`, `onTeamStop`
810
+ 3. Return `WorkspaceDecision` values from `onAgentSpawn` (`none` / `share-parent-cwd` / `share-with-agent` / `attach-to-stream` / `new-stream`)
811
+ 4. Inject via `agentManager.setTopologyPolicy(policy)` — or have `TeamManagerV2.startTeam` auto-wire from YAML via `YamlDrivenTopology`
812
+
605
813
  ### Adding a Control Command
606
814
 
607
815
  1. Add the command type to `ControlCommand` union in `src/control/types.ts`
@@ -631,6 +839,20 @@ E2E test files:
631
839
  | `federation.systemId` | Unique instance ID for federation | -- |
632
840
  | `federation.peers` | Peer instances to federate with | `[]` |
633
841
  | `federation.trust.allowedSystems` | Trusted system ID whitelist | -- |
842
+ | `dispatch.enabled` | Enable autonomous task dispatch mode | `false` |
843
+ | `dispatch.pollIntervalMs` | Dispatch poll cadence (ms) | `15000` |
844
+ | `dispatch.maxConcurrent` | Max concurrent dispatched agents | `3` |
845
+ | `dispatch.defaultRole` | Role for spawned agents | `"worker"` |
846
+ | `dispatch.tags` | Only dispatch tasks with these tags | -- |
847
+ | `dispatch.maxRetries` | Retry attempts per failed task | `3` |
848
+ | `dispatch.dispatchMode` | `route-only`, `spawn-only`, `prefer-route`, `prefer-spawn` | auto (`prefer-route` if inbox wired) |
849
+ | `dispatch.enableMailRouting` | Wire MessagePort via agent-inbox | `true` |
850
+ | `dispatch.enableRoster` | Wire AgentRoster via inbox agent listing | `true` |
851
+ | `dispatch.continuation.delayMs` | Delay before continuation re-dispatch (ms) | `1000` |
852
+ | `dispatch.continuation.maxTurns` | Max continuation turns per task | `20` |
853
+ | `dispatch.reconcile.enabled` | Enable external state reconciliation | `true` |
854
+ | `dispatch.reconcile.intervalMs` | Reconciliation cadence (ms) | `60000` |
855
+ | `dispatch.reconcile.stallTimeoutMs` | Terminate agents with no activity past this (ms) | `300000` |
634
856
 
635
857
  ### Injected into MCP subprocesses (by AgentManagerV2)
636
858
 
@@ -664,8 +886,9 @@ E2E test files:
664
886
  | `agent-inbox` | Messaging, threading, federation (embedded in-process) |
665
887
  | `opentasks` | Task graph, dependencies, providers (IPC to daemon) |
666
888
  | `acp-factory` | Agent process management (Claude Code sessions) |
889
+ | `swarm-dispatch` | Autonomous task dispatch orchestrator (poll, route, spawn, continuation, retry, reconcile, mail-inbound, roster-aware) |
667
890
  | `openteams` | Team template loading and resolution |
668
- | `git-cascade` | Git worktree and merge queue operations |
891
+ | `git-cascade` | Git worktree, stream/fork/merge/rebase, Change-Id tracking, cascade namespace, event emitter (0.0.3+) |
669
892
  | `better-sqlite3` | AgentStore + InboxAdapter persistence |
670
893
  | `@modelcontextprotocol/sdk` | MCP server implementation |
671
894
  | `@multi-agent-protocol/sdk` | MAP protocol types |
@@ -689,5 +912,12 @@ E2E test files:
689
912
 
690
913
  ## References
691
914
 
915
+ ### Team configuration
692
916
  - [docs/teams.md](docs/teams.md) - Team template schema reference
693
917
  - [docs/team-templates.md](docs/team-templates.md) - Team template format and examples
918
+
919
+ ### Workspace redesign (V3)
920
+ - [docs/workspace-redesign-plan.md](docs/workspace-redesign-plan.md) - Implementation plan + status
921
+ - [docs/workspace-interfaces.md](docs/workspace-interfaces.md) - V3 interface contracts (TypeScript)
922
+ - [docs/git-cascade-integration-gaps.md](docs/git-cascade-integration-gaps.md) - Design narrative, workflow traces, migration plan
923
+ - [docs/conflict-recovery.md](docs/conflict-recovery.md) - Conflict recovery strategy design