@monoes/monomindcli 2.9.3 → 2.9.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 (189) hide show
  1. package/.claude/helpers/intelligence.cjs +27 -6
  2. package/.claude/skills/agentic-jujutsu/SKILL.md +17 -15
  3. package/.claude/skills/hive-mind-advanced/SKILL.md +212 -559
  4. package/.claude/skills/hooks-automation/SKILL.md +1 -1
  5. package/.claude/skills/mastermind-createorg/SKILL.md +2 -1
  6. package/.claude/skills/pair-programming/SKILL.md +1 -1
  7. package/.claude/skills/performance-analysis/SKILL.md +228 -484
  8. package/.claude/skills/swarm-advanced/SKILL.md +2 -2
  9. package/.claude/skills/swarm-orchestration/SKILL.md +220 -150
  10. package/.claude/skills/verification-quality/SKILL.md +247 -571
  11. package/README.md +6 -2
  12. package/dist/src/autopilot-state.d.ts +16 -4
  13. package/dist/src/autopilot-state.d.ts.map +1 -1
  14. package/dist/src/autopilot-state.js +42 -19
  15. package/dist/src/autopilot-state.js.map +1 -1
  16. package/dist/src/commands/agent-lifecycle.js +3 -3
  17. package/dist/src/commands/agent-lifecycle.js.map +1 -1
  18. package/dist/src/commands/autopilot.d.ts.map +1 -1
  19. package/dist/src/commands/autopilot.js +113 -26
  20. package/dist/src/commands/autopilot.js.map +1 -1
  21. package/dist/src/commands/doc.d.ts.map +1 -1
  22. package/dist/src/commands/doc.js +14 -3
  23. package/dist/src/commands/doc.js.map +1 -1
  24. package/dist/src/commands/doctor-env-checks.d.ts +1 -1
  25. package/dist/src/commands/doctor-env-checks.d.ts.map +1 -1
  26. package/dist/src/commands/doctor.d.ts.map +1 -1
  27. package/dist/src/commands/doctor.js +30 -1
  28. package/dist/src/commands/doctor.js.map +1 -1
  29. package/dist/src/commands/hooks-routing-commands.d.ts.map +1 -1
  30. package/dist/src/commands/hooks-routing-commands.js +12 -26
  31. package/dist/src/commands/hooks-routing-commands.js.map +1 -1
  32. package/dist/src/commands/hooks-workers.js +8 -8
  33. package/dist/src/commands/hooks-workers.js.map +1 -1
  34. package/dist/src/commands/hooks.d.ts.map +1 -1
  35. package/dist/src/commands/hooks.js +96 -54
  36. package/dist/src/commands/hooks.js.map +1 -1
  37. package/dist/src/commands/init.d.ts.map +1 -1
  38. package/dist/src/commands/init.js +80 -7
  39. package/dist/src/commands/init.js.map +1 -1
  40. package/dist/src/commands/mcp.d.ts.map +1 -1
  41. package/dist/src/commands/mcp.js +78 -2
  42. package/dist/src/commands/mcp.js.map +1 -1
  43. package/dist/src/commands/memory-list.d.ts.map +1 -1
  44. package/dist/src/commands/memory-list.js +79 -36
  45. package/dist/src/commands/memory-list.js.map +1 -1
  46. package/dist/src/commands/org.d.ts.map +1 -1
  47. package/dist/src/commands/org.js +114 -1
  48. package/dist/src/commands/org.js.map +1 -1
  49. package/dist/src/commands/performance.js +1 -1
  50. package/dist/src/commands/performance.js.map +1 -1
  51. package/dist/src/commands/swarm.d.ts.map +1 -1
  52. package/dist/src/commands/swarm.js +144 -98
  53. package/dist/src/commands/swarm.js.map +1 -1
  54. package/dist/src/init/claudemd-generator.js +1 -1
  55. package/dist/src/init/executor.d.ts.map +1 -1
  56. package/dist/src/init/executor.js +13 -3
  57. package/dist/src/init/executor.js.map +1 -1
  58. package/dist/src/init/kimi-generator.d.ts +3 -2
  59. package/dist/src/init/kimi-generator.d.ts.map +1 -1
  60. package/dist/src/init/kimi-generator.js +45 -13
  61. package/dist/src/init/kimi-generator.js.map +1 -1
  62. package/dist/src/init/statusline-generator.d.ts +1 -1
  63. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  64. package/dist/src/init/statusline-generator.js +48 -46
  65. package/dist/src/init/statusline-generator.js.map +1 -1
  66. package/dist/src/init/types.d.ts +1 -1
  67. package/dist/src/init/types.d.ts.map +1 -1
  68. package/dist/src/init/types.js +5 -1
  69. package/dist/src/init/types.js.map +1 -1
  70. package/dist/src/mcp-server.d.ts +6 -0
  71. package/dist/src/mcp-server.d.ts.map +1 -1
  72. package/dist/src/mcp-server.js +47 -22
  73. package/dist/src/mcp-server.js.map +1 -1
  74. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
  75. package/dist/src/mcp-tools/hive-mind-tools.js +13 -11
  76. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  77. package/dist/src/mcp-tools/hooks-intelligence.d.ts.map +1 -1
  78. package/dist/src/mcp-tools/hooks-intelligence.js +97 -40
  79. package/dist/src/mcp-tools/hooks-intelligence.js.map +1 -1
  80. package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
  81. package/dist/src/mcp-tools/hooks-routing.js +406 -205
  82. package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
  83. package/dist/src/mcp-tools/monograph/impact-tools.d.ts.map +1 -1
  84. package/dist/src/mcp-tools/monograph/impact-tools.js +109 -44
  85. package/dist/src/mcp-tools/monograph/impact-tools.js.map +1 -1
  86. package/dist/src/mcp-tools/monograph/query-tools.d.ts.map +1 -1
  87. package/dist/src/mcp-tools/monograph/query-tools.js +48 -18
  88. package/dist/src/mcp-tools/monograph/query-tools.js.map +1 -1
  89. package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
  90. package/dist/src/mcp-tools/system-tools.js +100 -38
  91. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  92. package/dist/src/memory/embedding-operations.d.ts +4 -0
  93. package/dist/src/memory/embedding-operations.d.ts.map +1 -1
  94. package/dist/src/memory/embedding-operations.js +125 -32
  95. package/dist/src/memory/embedding-operations.js.map +1 -1
  96. package/dist/src/memory/hnsw-operations.d.ts +1 -1
  97. package/dist/src/memory/hnsw-operations.js +1 -1
  98. package/dist/src/memory/memory-bridge.d.ts.map +1 -1
  99. package/dist/src/memory/memory-bridge.js +172 -69
  100. package/dist/src/memory/memory-bridge.js.map +1 -1
  101. package/dist/src/memory/memory-read.d.ts +1 -1
  102. package/dist/src/memory/memory-read.js +2 -2
  103. package/dist/src/memory/memory-read.js.map +1 -1
  104. package/dist/src/orgrt/checkpoint-ops.d.ts +11 -1
  105. package/dist/src/orgrt/checkpoint-ops.d.ts.map +1 -1
  106. package/dist/src/orgrt/checkpoint-ops.js +15 -1
  107. package/dist/src/orgrt/checkpoint-ops.js.map +1 -1
  108. package/dist/src/orgrt/checkpoint.js +1 -1
  109. package/dist/src/orgrt/checkpoint.js.map +1 -1
  110. package/dist/src/orgrt/daemon.d.ts +11 -3
  111. package/dist/src/orgrt/daemon.d.ts.map +1 -1
  112. package/dist/src/orgrt/daemon.js +317 -93
  113. package/dist/src/orgrt/daemon.js.map +1 -1
  114. package/dist/src/orgrt/decisions.d.ts +13 -0
  115. package/dist/src/orgrt/decisions.d.ts.map +1 -1
  116. package/dist/src/orgrt/decisions.js +95 -0
  117. package/dist/src/orgrt/decisions.js.map +1 -1
  118. package/dist/src/orgrt/remote.d.ts.map +1 -1
  119. package/dist/src/orgrt/remote.js +12 -6
  120. package/dist/src/orgrt/remote.js.map +1 -1
  121. package/dist/src/orgrt/server.d.ts.map +1 -1
  122. package/dist/src/orgrt/server.js +71 -14
  123. package/dist/src/orgrt/server.js.map +1 -1
  124. package/dist/src/orgrt/session.d.ts +27 -1
  125. package/dist/src/orgrt/session.d.ts.map +1 -1
  126. package/dist/src/orgrt/session.js +42 -3
  127. package/dist/src/orgrt/session.js.map +1 -1
  128. package/dist/src/orgrt/task-dag.d.ts +11 -1
  129. package/dist/src/orgrt/task-dag.d.ts.map +1 -1
  130. package/dist/src/orgrt/task-dag.js +93 -2
  131. package/dist/src/orgrt/task-dag.js.map +1 -1
  132. package/dist/src/orgrt/templates.d.ts.map +1 -1
  133. package/dist/src/orgrt/templates.js +24 -0
  134. package/dist/src/orgrt/templates.js.map +1 -1
  135. package/dist/src/orgrt/types.d.ts +70 -1
  136. package/dist/src/orgrt/types.d.ts.map +1 -1
  137. package/dist/src/orgrt/types.js +19 -0
  138. package/dist/src/orgrt/types.js.map +1 -1
  139. package/dist/src/orgrt/vercel-providers.d.ts.map +1 -1
  140. package/dist/src/orgrt/vercel-providers.js +9 -4
  141. package/dist/src/orgrt/vercel-providers.js.map +1 -1
  142. package/dist/src/orgrt/vercel-runner.d.ts +0 -23
  143. package/dist/src/orgrt/vercel-runner.d.ts.map +1 -1
  144. package/dist/src/orgrt/vercel-runner.js +26 -1
  145. package/dist/src/orgrt/vercel-runner.js.map +1 -1
  146. package/dist/src/types.d.ts +1 -1
  147. package/dist/src/types.d.ts.map +1 -1
  148. package/dist/src/ui/server.mjs +2647 -838
  149. package/dist/tsconfig.tsbuildinfo +1 -1
  150. package/package.json +7 -7
  151. package/.claude/commands/mastermind/approvev1.md +0 -94
  152. package/.claude/commands/mastermind/architect.md +0 -52
  153. package/.claude/commands/mastermind/autodev.md +0 -28
  154. package/.claude/commands/mastermind/build.md +0 -23
  155. package/.claude/commands/mastermind/finish.md +0 -17
  156. package/.claude/commands/mastermind/runorgv1.md +0 -159
  157. package/.claude/commands/mastermind/taskdev.md +0 -23
  158. package/.claude/commands/mastermind/tdd.md +0 -19
  159. package/.claude/commands/mastermind/verify.md +0 -19
  160. package/.claude/skills/mastermind-approvev1/SKILL.md +0 -191
  161. package/.claude/skills/mastermind-architect/SKILL.md +0 -862
  162. package/.claude/skills/mastermind-autodev/SKILL.md +0 -360
  163. package/.claude/skills/mastermind-build/SKILL.md +0 -169
  164. package/.claude/skills/mastermind-companies/SKILL.md +0 -256
  165. package/.claude/skills/mastermind-content/SKILL.md +0 -197
  166. package/.claude/skills/mastermind-costs/SKILL.md +0 -151
  167. package/.claude/skills/mastermind-finance/SKILL.md +0 -166
  168. package/.claude/skills/mastermind-finish/SKILL.md +0 -251
  169. package/.claude/skills/mastermind-heartbeatv1/SKILL.md +0 -167
  170. package/.claude/skills/mastermind-instance-settings/SKILL.md +0 -315
  171. package/.claude/skills/mastermind-marketing/SKILL.md +0 -228
  172. package/.claude/skills/mastermind-marketing/references/copywriting-frameworks.md +0 -181
  173. package/.claude/skills/mastermind-marketing/references/persuasion-psychology.md +0 -158
  174. package/.claude/skills/mastermind-ops/SKILL.md +0 -168
  175. package/.claude/skills/mastermind-org-chart/SKILL.md +0 -209
  176. package/.claude/skills/mastermind-project-detail/SKILL.md +0 -249
  177. package/.claude/skills/mastermind-project-workspace/SKILL.md +0 -244
  178. package/.claude/skills/mastermind-projects/SKILL.md +0 -167
  179. package/.claude/skills/mastermind-runorgv1/SKILL.md +0 -731
  180. package/.claude/skills/mastermind-sales/SKILL.md +0 -170
  181. package/.claude/skills/mastermind-taskdev/SKILL.md +0 -377
  182. package/.claude/skills/mastermind-taskdev/code-quality-reviewer-prompt.md +0 -60
  183. package/.claude/skills/mastermind-taskdev/final-reviewer-prompt.md +0 -144
  184. package/.claude/skills/mastermind-taskdev/implementer-prompt.md +0 -114
  185. package/.claude/skills/mastermind-taskdev/spec-reviewer-prompt.md +0 -80
  186. package/.claude/skills/mastermind-tdd/SKILL.md +0 -424
  187. package/.claude/skills/mastermind-verify/SKILL.md +0 -196
  188. package/.claude/skills/mastermind-wiki/SKILL.md +0 -314
  189. package/.claude/skills/monolean-review/SKILL.md +0 -57
@@ -13,10 +13,10 @@ Master advanced swarm patterns for distributed research, development, and testin
13
13
  ### Prerequisites
14
14
  ```bash
15
15
  # Ensure Monomind is installed
16
- npm install -g monomind@alpha
16
+ npm install -g monomind@latest
17
17
 
18
18
  # Add MCP server (if using MCP tools)
19
- claude mcp add monomind npx monomind@alpha mcp start
19
+ claude mcp add monomind npx monomind@latest mcp start
20
20
  ```
21
21
 
22
22
  ### Basic Pattern
@@ -1,179 +1,249 @@
1
1
  ---
2
2
  name: swarm-orchestration
3
- description: "Orchestrate multi-agent swarms with monomind for parallel task execution, dynamic topology, and intelligent coordination. Use when scaling beyond single agents, implementing complex workflows, or building distributed AI systems."
3
+ description: Orchestrate in-process multi-agent swarms with monomind for parallel task execution, topology selection, and shared memory coordination. Use when scaling beyond a single agent on tasks with clear decomposition.
4
4
  ---
5
5
 
6
6
  # Swarm Orchestration
7
7
 
8
8
  ## What This Skill Does
9
9
 
10
- Orchestrates multi-agent swarms using monomind's advanced coordination system. Supports mesh, hierarchical, and adaptive topologies with automatic task distribution, load balancing, and fault tolerance.
10
+ Coordinates multiple Claude Code Task-tool agents inside a single monomind process. The swarm layer tracks topology, agent lifecycle, and task assignment. **Real work happens in spawned Task-tool agents** — the swarm coordinates, agents execute.
11
+
12
+ ## What Swarm Is (and Is Not)
13
+
14
+ **Is:** In-process coordination — topology bookkeeping, agent lifecycle, task routing, vote-count consensus. State persists to `.monomind/swarm/`.
15
+
16
+ **Is not:** A distributed system. There is no networking between separate machines. "Consensus" strategies (`raft`, `bft`, `quorum`) are vote-count thresholds applied inside one process — not Raft/Paxos protocols.
17
+
18
+ If you need persistent, scheduled, autonomous agent organizations, use `monomind org run` instead. **Swarm coordinates a single task; org runtime governs a long-running org.** (See "Successor: Org Runtime" below.)
11
19
 
12
20
  ## Prerequisites
13
21
 
14
- - monomind v1.8.0+
15
- - Node.js 18+
16
- - Understanding of distributed systems (helpful)
22
+ - monomind v2.9.4+
23
+ - Claude Code's Task tool available (agents execute via Task tool, not CLI alone)
24
+ - A task that decomposes into 2+ independent subtasks
25
+
26
+ ## Topology Selection
27
+
28
+ Choose topology by task shape:
29
+
30
+ | Topology | When | Example |
31
+ |---|---|---|
32
+ | `hierarchical` | Default — clear task decomposition, one coordinator | Feature build (architect → coders → testers) |
33
+ | `mesh` | Peer-to-peer exploration, research, knowledge sharing | Multi-source research synthesis |
34
+ | `hierarchical-mesh` | 10+ agents — hierarchy with peer side-channels | Large refactor touching many modules |
35
+ | `ring` | Circular handoff (review → fix → re-review) | Code review cycle |
36
+ | `star` | Central hub with specialist spokes | Coordinator dispatching to niche experts |
37
+ | `hybrid` | Mixed work needing both hierarchy and peer comms | Migration + new feature in parallel |
38
+
39
+ **Rule of thumb:** ≤8 agents → `hierarchical`. 10+ agents → `hierarchical-mesh`. Research/exploration → `mesh`.
40
+
41
+ ## Strategy Selection
42
+
43
+ | Strategy | When |
44
+ |---|---|
45
+ | `specialized` | Fixed roles (default for feature work) |
46
+ | `balanced` | Even work distribution, homogeneous tasks |
47
+ | `development` | Dev pipeline (plan → code → test → review) |
48
+
49
+ ## Lifecycle
17
50
 
18
- ## Quick Start
51
+ ### 1. Initialize
19
52
 
20
53
  ```bash
21
- # Initialize swarm
22
- npx monomind swarm init --topology mesh --max-agents 5
23
-
24
- # Spawn agents
25
- npx monomind agent spawn --type coder
26
- npx monomind agent spawn --type tester
27
- npx monomind agent spawn --type reviewer
28
-
29
- # Orchestrate task
30
- npx monomind task run \
31
- --task "Build REST API with tests" \
32
- --mode parallel
33
- ```
34
-
35
- ## Topology Patterns
36
-
37
- ### 1. Mesh (Peer-to-Peer)
38
- ```typescript
39
- // Equal peers, distributed decision-making
40
- await swarm.init({
41
- topology: 'mesh',
42
- agents: ['coder', 'tester', 'reviewer'],
43
- communication: 'broadcast'
44
- });
45
- ```
46
-
47
- ### 2. Hierarchical (Queen-Worker)
48
- ```typescript
49
- // Centralized coordination, specialized workers
50
- await swarm.init({
51
- topology: 'hierarchical',
52
- queen: 'architect',
53
- workers: ['backend-dev', 'frontend-dev', 'db-designer']
54
- });
55
- ```
56
-
57
- ### 3. Adaptive (Dynamic)
58
- ```typescript
59
- // Automatically switches topology based on task
60
- await swarm.init({
61
- topology: 'adaptive',
62
- optimization: 'task-complexity'
63
- });
64
- ```
65
-
66
- ## Task Orchestration
67
-
68
- ### Parallel Execution
69
- ```typescript
70
- // Execute tasks concurrently
71
- const results = await swarm.execute({
72
- tasks: [
73
- { agent: 'coder', task: 'Implement API endpoints' },
74
- { agent: 'frontend', task: 'Build UI components' },
75
- { agent: 'tester', task: 'Write test suite' }
76
- ],
77
- mode: 'parallel',
78
- timeout: 300000 // 5 minutes
79
- });
80
- ```
81
-
82
- ### Pipeline Execution
83
- ```typescript
84
- // Sequential pipeline with dependencies
85
- await swarm.pipeline([
86
- { stage: 'design', agent: 'architect' },
87
- { stage: 'implement', agent: 'coder', after: 'design' },
88
- { stage: 'test', agent: 'tester', after: 'implement' },
89
- { stage: 'review', agent: 'reviewer', after: 'test' }
90
- ]);
91
- ```
92
-
93
- ### Adaptive Execution
94
- ```typescript
95
- // Let swarm decide execution strategy
96
- await swarm.autoOrchestrate({
97
- goal: 'Build production-ready API',
98
- constraints: {
99
- maxTime: 3600,
100
- maxAgents: 8,
101
- quality: 'high'
102
- }
103
- });
104
- ```
105
-
106
- ## Memory Coordination
107
-
108
- ```typescript
109
- // Share state across swarm
110
- await swarm.memory.store('api-schema', {
111
- endpoints: [...],
112
- models: [...]
113
- });
114
-
115
- // Agents read shared memory
116
- const schema = await swarm.memory.retrieve('api-schema');
117
- ```
118
-
119
- ## Advanced Features
120
-
121
- ### Load Balancing
122
- ```typescript
123
- // Automatic work distribution
124
- await swarm.enableLoadBalancing({
125
- strategy: 'dynamic',
126
- metrics: ['cpu', 'memory', 'task-queue']
127
- });
128
- ```
129
-
130
- ### Fault Tolerance
131
- ```typescript
132
- // Handle agent failures
133
- await swarm.setResiliency({
134
- retry: { maxAttempts: 3, backoff: 'exponential' },
135
- fallback: 'reassign-task'
136
- });
137
- ```
138
-
139
- ### Performance Monitoring
140
- ```typescript
141
- // Track swarm metrics
142
- const metrics = await swarm.getMetrics();
143
- // { throughput, latency, success_rate, agent_utilization }
144
- ```
54
+ npx monomind@latest swarm init \
55
+ --topology hierarchical \
56
+ --max-agents 8 \
57
+ --strategy specialized
58
+ ```
59
+
60
+ ### 2. Spawn agents (CLI or MCP)
61
+
62
+ ```bash
63
+ npx monomind@latest agent spawn -t coordinator --name lead
64
+ npx monomind@latest agent spawn -t coder --name impl
65
+ npx monomind@latest agent spawn -t tester --name qa
66
+ ```
145
67
 
146
- ## Integration with Hooks
68
+ Equivalent MCP: `mcp__monomind__agent_spawn { type: "...", name: "..." }`.
69
+
70
+ ### 3. Start work
147
71
 
148
72
  ```bash
149
- # Pre-task coordination
150
- npx monomind hooks pre-task --description "Build API"
73
+ npx monomind@latest swarm start \
74
+ --objective "Add OAuth2 login with tests" \
75
+ --strategy specialized \
76
+ --agents 4
77
+ ```
151
78
 
152
- # Post-task synchronization
153
- npx monomind hooks post-task --task-id "task-123"
79
+ ### 4. Monitor and stop
154
80
 
155
- # Session restore
156
- npx monomind hooks session-restore --session-id "swarm-001"
81
+ ```bash
82
+ npx monomind@latest swarm status
83
+ npx monomind@latest agent list
84
+ npx monomind@latest agent status <id>
85
+ npx monomind@latest swarm stop
157
86
  ```
158
87
 
88
+ ## Agent Role Assignment
89
+
90
+ Match agent type to task category. Use `mcp__monomind__hooks_route` to auto-pick instead of guessing:
91
+
92
+ ```
93
+ mcp__monomind__hooks_route { task: "implement JWT auth" }
94
+ # → returns the recommended agent type
95
+ ```
96
+
97
+ Common assignments (see `doc/concepts/swarm.md` for the full routing table):
98
+
99
+ | Task | Recommended agents |
100
+ |---|---|
101
+ | Bug fix | coordinator, researcher, coder, tester |
102
+ | Feature | coordinator, architect, coder, tester, reviewer |
103
+ | Refactor | coordinator, architect, coder, reviewer |
104
+ | Performance | coordinator, performance-engineer, coder |
105
+ | Security | coordinator, security-architect, security-auditor |
106
+ | Docs | researcher, documenter |
107
+
108
+ ## Workflow Patterns
109
+
110
+ ### Sequential pipeline (design → code → test → review)
111
+
112
+ ```bash
113
+ npx monomind@latest swarm init --topology hierarchical --strategy development --max-agents 4
114
+ npx monomind@latest swarm start --objective "Build user-profile API with full test coverage"
115
+ ```
116
+
117
+ Drive each stage via task assignment — the next stage picks up when the previous completes:
118
+
119
+ ```
120
+ mcp__monomind__task_create { description: "Design schema", agent_type: "architect" }
121
+ # after architect completes:
122
+ mcp__monomind__task_assign { task_id: "...", agent_id: "<coder-id>" }
123
+ # after coder completes:
124
+ mcp__monomind__task_assign { task_id: "...", agent_id: "<tester-id>" }
125
+ ```
126
+
127
+ ### Parallel fan-out (independent subtasks)
128
+
129
+ ```bash
130
+ npx monomind@latest swarm init --topology mesh --strategy balanced --max-agents 6
131
+ npx monomind@latest swarm start --objective "Audit 6 modules for security issues" --agents 6
132
+ ```
133
+
134
+ Spawn one Task-tool agent per module; each writes findings to the shared namespace.
135
+
136
+ ### Mixed (parallel sub-trees, sequential stages)
137
+
138
+ Use `hierarchical-mesh` — the coordinator fans out parallel work while stages run sequentially. Best for 10+ agent workloads:
139
+
140
+ ```
141
+ mcp__monomind__swarm_init { topology: "hierarchical-mesh", max_agents: 12, strategy: "specialized" }
142
+ ```
143
+
144
+ ## Memory Sharing Across Agents
145
+
146
+ Swarm agents share state through monomind memory (SQLite/JSON) — there is no separate "swarm memory" API. Each agent reads/writes the same namespace.
147
+
148
+ Store context once (CLI), or via MCP inside an agent:
149
+
150
+ ```bash
151
+ npx monomind@latest memory store \
152
+ --key "feature-spec" \
153
+ --value "OAuth2 with PKCE, refresh tokens, 15-min access TTL" \
154
+ --namespace swarm-001 --tags spec,auth
155
+ ```
156
+
157
+ ```
158
+ mcp__monomind__memory_kg_ingest { key: "feature-spec", value: "...", namespace: "swarm-001" }
159
+ ```
160
+
161
+ Retrieve during work:
162
+
163
+ ```bash
164
+ npx monomind@latest memory retrieve --key feature-spec --namespace swarm-001
165
+ npx monomind@latest memory search --query "auth requirements"
166
+ ```
167
+
168
+ **Use one shared namespace per swarm run** so every agent sees the same context.
169
+
170
+ ## Load Balancing (Concept)
171
+
172
+ In-process "load balancing" is task routing, not network LB. Two mechanisms: `hooks_route` (picks the optimal agent type from the routing table) and `strategy` (`balanced` evens work, `specialized` keeps roles fixed).
173
+
174
+ For uneven workloads, scale up and reassign stalled tasks:
175
+
176
+ ```bash
177
+ npx monomind@latest swarm scale --agents 12
178
+ npx monomind@latest swarm status
179
+ npx monomind@latest agent status <id>
180
+ ```
181
+
182
+ ```
183
+ mcp__monomind__task_assign { task_id: "...", agent_id: "<idle-agent-id>" }
184
+ ```
185
+
186
+ ## Full Example: Feature Build
187
+
188
+ ```bash
189
+ npx monomind@latest swarm init --topology hierarchical --max-agents 5 --strategy specialized
190
+
191
+ # Share the spec once — all agents read this
192
+ npx monomind@latest memory store \
193
+ --key "feature-spec" \
194
+ --value "Add CSV import: parse, validate, persist, report errors" \
195
+ --namespace swarm-csv
196
+
197
+ npx monomind@latest agent spawn -t coordinator --name lead
198
+ npx monomind@latest agent spawn -t coder --name impl
199
+ npx monomind@latest agent spawn -t tester --name qa
200
+ npx monomind@latest agent spawn -t reviewer --name audit
201
+
202
+ npx monomind@latest swarm start --objective "Implement CSV import end-to-end" --agents 4
203
+ npx monomind@latest swarm status
204
+ npx monomind@latest swarm stop
205
+ ```
206
+
207
+ Execution happens in Claude Code Task-tool agents. The CLI coordinates; Task agents do the work.
208
+
209
+ ## Successor: Org Runtime
210
+
211
+ For autonomous, recurring, or long-running work, prefer `monomind org run`:
212
+
213
+ ```bash
214
+ npx monomind@latest org run my-team --task "Maintain CI hygiene"
215
+ npx monomind@latest org status
216
+ npx monomind@latest org logs my-team --follow
217
+ npx monomind@latest org stop my-team
218
+ ```
219
+
220
+ Org runtime adds: scheduled wakeups, governance gates, budget enforcement, persistent state across runs. **Swarm is a single coordinated session; org runtime is a durable organization.**
221
+
222
+ - Use **swarm** for: one-off parallel tasks today.
223
+ - Use **org runtime** for: recurring autonomous work, scheduled agents, multi-session goals.
224
+
159
225
  ## Best Practices
160
226
 
161
- 1. **Start small**: Begin with 2-3 agents, scale up
162
- 2. **Use memory**: Share context through swarm memory
163
- 3. **Monitor metrics**: Track performance and bottlenecks
164
- 4. **Enable hooks**: Automatic coordination and sync
165
- 5. **Set timeouts**: Prevent hung tasks
227
+ 1. **Right-size the swarm.** Start with 3–4 agents; scale only when utilization is high.
228
+ 2. **One shared memory namespace per run.** All agents read/write the same context.
229
+ 3. **Pick topology by agent count.** ≤8 → `hierarchical`; 10+ → `hierarchical-mesh`.
230
+ 4. **Route before assigning.** `hooks_route` picks better agent types than guessing.
231
+ 5. **Let Task-tool agents do the work.** CLI coordinates; execution lives in Claude Code Task agents.
232
+ 6. **Set clear boundaries.** Every subtask needs clear inputs and outputs, or agents will thrash.
166
233
 
167
234
  ## Troubleshooting
168
235
 
169
- ### Issue: Agents not coordinating
170
- **Solution**: Verify memory access and enable hooks
171
-
172
- ### Issue: Poor performance
173
- **Solution**: Check topology (use adaptive) and enable load balancing
236
+ | Symptom | Likely cause | Fix |
237
+ |---|---|---|
238
+ | Agents not coordinating | Different namespace per agent | Use one shared `--namespace` |
239
+ | Stalled agent | Blocked on upstream stage | `agent status <id>`, then reassign task |
240
+ | Poor throughput | Wrong topology for count | Switch to `hierarchical-mesh` at 10+ agents |
241
+ | Duplicate work | No shared memory | `memory store` the spec; agents `retrieve` before acting |
242
+ | Swarm won't start | Bad topology/strategy combo | Verify flags against `doc/concepts/swarm.md` |
174
243
 
175
244
  ## Learn More
176
245
 
177
- - Swarm Guide: docs/swarm/orchestration.md
178
- - Topology Patterns: docs/swarm/topologies.md
179
- - Hooks Integration: docs/hooks/coordination.md
246
+ - `doc/concepts/swarm.md` — honest scope, topologies, agent types, full MCP tool list
247
+ - Hive-mind (MCP only): `mcp__monomind__hive-mind_*` tools for vote-count consensus
248
+ - `/mastermind:topology` — interactive topology picker
249
+ - Org runtime: `npx monomind@latest org --help`