@monoes/monomindcli 1.6.9 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.claude/commands/monomind-createtask.md +75 -113
  2. package/.claude/commands/monomind-do.md +227 -115
  3. package/.claude/commands/monomind-idea.md +30 -104
  4. package/.claude/commands/monomind-improve.md +31 -103
  5. package/.claude/helpers/graphify-freshen.cjs +12 -97
  6. package/.claude/helpers/hook-handler.cjs +16 -0
  7. package/.claude/helpers/learning-service.mjs +0 -0
  8. package/.claude/helpers/metrics-db.mjs +0 -0
  9. package/.claude/helpers/statusline.cjs +89 -65
  10. package/.claude/helpers/swarm-hooks.sh +0 -0
  11. package/.claude/skills/monomind-task-engine/SKILL.md +358 -0
  12. package/LICENSE +21 -0
  13. package/dist/src/commands/doctor.d.ts.map +1 -1
  14. package/dist/src/commands/doctor.js +36 -9
  15. package/dist/src/commands/doctor.js.map +1 -1
  16. package/dist/src/init/executor.d.ts.map +1 -1
  17. package/dist/src/init/executor.js +99 -28
  18. package/dist/src/init/executor.js.map +1 -1
  19. package/dist/src/init/helpers-generator.js +14 -14
  20. package/dist/src/init/helpers-generator.js.map +1 -1
  21. package/dist/src/init/shared-instructions-generator.d.ts +38 -0
  22. package/dist/src/init/shared-instructions-generator.d.ts.map +1 -0
  23. package/dist/src/init/shared-instructions-generator.js +571 -0
  24. package/dist/src/init/shared-instructions-generator.js.map +1 -0
  25. package/dist/src/init/types.d.ts +1 -1
  26. package/dist/src/init/types.d.ts.map +1 -1
  27. package/dist/src/mcp-client.d.ts.map +1 -1
  28. package/dist/src/mcp-client.js +5 -2
  29. package/dist/src/mcp-client.js.map +1 -1
  30. package/dist/src/mcp-tools/graphify-tools.d.ts +4 -67
  31. package/dist/src/mcp-tools/graphify-tools.d.ts.map +1 -1
  32. package/dist/src/mcp-tools/graphify-tools.js +40 -1226
  33. package/dist/src/mcp-tools/graphify-tools.js.map +1 -1
  34. package/dist/src/mcp-tools/index.d.ts +1 -0
  35. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  36. package/dist/src/mcp-tools/index.js +1 -0
  37. package/dist/src/mcp-tools/index.js.map +1 -1
  38. package/dist/src/mcp-tools/monograph-tools.d.ts +9 -0
  39. package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -0
  40. package/dist/src/mcp-tools/monograph-tools.js +495 -0
  41. package/dist/src/mcp-tools/monograph-tools.js.map +1 -0
  42. package/dist/src/ui/dashboard.html +219 -45
  43. package/dist/src/ui/server.mjs +202 -16
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +11 -11
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: monomind-do
3
- description: "Monomind — Pick up tasks from monomind-task board, execute them with smart agent selection, review, fix bugs, then loop every 2 minutes"
3
+ description: "Monomind — Execute tasks from monomind-task board with parallel, minimal, or sequential agent modes, smart context group routing, and review cycles"
4
4
  ---
5
5
 
6
6
  ## Argument Parsing
@@ -10,6 +10,8 @@ Parse `$ARGUMENTS` for the following flags (in any order):
10
10
  - `--space <SPACE_ID>` — use this space directly (skip space discovery)
11
11
  - `--board <BOARD_ID>` — use this task board directly (skip board discovery)
12
12
  - `--filter <text>` — only process tasks whose title contains this text (case-insensitive)
13
+ - `--mode <parallel|minimal|sequential>` — execution mode (default: ask user)
14
+ - `--max-agents <N>` — cap total agent spawns per run (default: 20). Prevents runaway costs on large boards.
13
15
 
14
16
  If `$ARGUMENTS` contains none of these flags, treat the entire string as a filter (legacy mode).
15
17
 
@@ -41,7 +43,7 @@ If `cargo` is also missing, output this and STOP:
41
43
 
42
44
  ## Step 1: Find the Task Board
43
45
 
44
- **If `--space` and `--board` were provided:** Skip discovery. Use the provided `SPACE_ID` and `TASK_BOARD_ID` directly. Jump to step 4.
46
+ **If `--space` and `--board` were provided:** Skip discovery. Use the provided `SPACE_ID` and `TASK_BOARD_ID` directly. Jump to column discovery.
45
47
 
46
48
  **Otherwise, discover them:**
47
49
 
@@ -55,9 +57,73 @@ If `cargo` is also missing, output this and STOP:
55
57
 
56
58
  ---
57
59
 
58
- ## Step 1.5: Initialize Loop State
60
+ ## Step 2: Scan All Tasks and Build Execution Plan
59
61
 
60
- Generate a loop ID and write the initial state file so the dashboard can track this run:
62
+ ### 2a: Load all pending tasks
63
+
64
+ List cards in `Todo` and `Backlog`:
65
+ ```bash
66
+ monotask card list $TASK_BOARD_ID $COL_TODO --json
67
+ monotask card list $TASK_BOARD_ID $COL_BACKLOG --json
68
+ ```
69
+
70
+ If `--filter` was set, filter by title match.
71
+
72
+ If no cards found, output:
73
+ ```
74
+ [monomind:do] No tasks in Todo or Backlog. Queue empty.
75
+ ```
76
+ Remove any loop state files and STOP.
77
+
78
+ ### 2b: Read task metadata
79
+
80
+ For each card, read its comments to extract:
81
+ - **Assigned agent type** (from "Assigned agent:" comment)
82
+ - **Context group** (from "Context group:" comment)
83
+ - **Prerequisites** (from "Prerequisites:" comment)
84
+ - **Parallel safe** (from "Parallel safe:" comment, default `true`)
85
+
86
+ ### 2c: Build context groups
87
+
88
+ Group tasks by their `context_group` value:
89
+ - Tasks with the same context group form a **chain** — they run sequentially on the same agent
90
+ - Tasks with `context_group: independent` or no group are **independent** — they can run on any agent
91
+ - Within a chain, order by prerequisites (prerequisite first)
92
+
93
+ ### 2d: Check session memory for execution strategy
94
+
95
+ Call `mcp__monomind__memory_search` with `"task-strategy:<REPO_NAME>"`. If a recent strategy exists, use its `recommended_execution_mode` as the default.
96
+
97
+ ### 2e: Choose execution mode
98
+
99
+ **If `--mode` was provided:** Use that mode.
100
+
101
+ **If session memory has a recommendation:** Present it as default.
102
+
103
+ **Otherwise, ask the user:**
104
+
105
+ ```
106
+ [monomind:do] Found N tasks: X in context groups, Y independent.
107
+
108
+ Context groups:
109
+ - <group-1>: 3 tasks (agent: backend-dev, sequential)
110
+ - <group-2>: 2 tasks (agent: Frontend Developer, sequential)
111
+ - independent: 4 tasks (mixed agents, parallelizable)
112
+
113
+ How do you want to execute?
114
+
115
+ 1. **Parallel** — Spawn one agent per context group + one per independent task. (~N agents, fastest)
116
+ 2. **Minimal** — One agent per context group + one shared agent for all independents. (~M agents, balanced)
117
+ 3. **Sequential** — One agent processes everything in order. (1 agent, cheapest)
118
+ ```
119
+
120
+ Store chosen mode as `EXEC_MODE`.
121
+
122
+ ---
123
+
124
+ ## Step 3: Initialize Loop State
125
+
126
+ Generate a loop ID and write the initial state file:
61
127
  ```bash
62
128
  mkdir -p .monomind/loops
63
129
  export DO_LOOP_ID="do-$(date +%s%3N)"
@@ -66,7 +132,8 @@ cat > ".monomind/loops/${DO_LOOP_ID}.json" << EOF
66
132
  "id": "${DO_LOOP_ID}",
67
133
  "type": "do",
68
134
  "prompt": "/monomind:do $ARGUMENTS",
69
- "currentTask": "discovering...",
135
+ "mode": "${EXEC_MODE}",
136
+ "currentTask": "starting...",
70
137
  "spaceId": "${SPACE_ID:-}",
71
138
  "boardId": "${TASK_BOARD_ID:-}",
72
139
  "filter": "${FILTER:-}",
@@ -78,142 +145,168 @@ cat > ".monomind/loops/${DO_LOOP_ID}.json" << EOF
78
145
  EOF
79
146
  ```
80
147
 
81
- Also check if a stop was requested from a previous cycle:
148
+ Check if a stop was requested:
82
149
  ```bash
83
150
  [ -f ".monomind/loops/${DO_LOOP_ID}.stop" ] && echo "DO_STOP_REQUESTED=true"
84
151
  ```
85
152
  If `DO_STOP_REQUESTED=true`, output `[monomind:do] Stop requested via dashboard. Halting.`, remove state files, and STOP.
86
153
 
87
- ## Step 2: Find Next Task
88
-
89
- 1. List cards in `Todo` first (prioritized), then `Backlog`:
90
- ```bash
91
- monotask card list $TASK_BOARD_ID $COL_TODO --json
92
- monotask card list $TASK_BOARD_ID $COL_BACKLOG --json
93
- ```
94
-
95
- 2. If `$ARGUMENTS` was provided, filter by title match.
154
+ ---
96
155
 
97
- 3. Pick the **first available card** (Todo before Backlog). If no cards found, output:
98
- ```
99
- [monomind:do] No tasks in Todo or Backlog. Checking again in 2 minutes...
100
- ```
101
- Update loop state before scheduling:
102
- ```bash
103
- NEXT_AT=$(( $(date +%s%3N) + 120000 ))
104
- cat > ".monomind/loops/${DO_LOOP_ID}.json" << EOF
105
- {"id":"${DO_LOOP_ID}","type":"do","prompt":"/monomind:do $ARGUMENTS","currentTask":"queue empty — waiting","spaceId":"${SPACE_ID:-}","boardId":"${TASK_BOARD_ID:-}","filter":"${FILTER:-}","startedAt":$(cat .monomind/loops/${DO_LOOP_ID}.json 2>/dev/null | python3 -c "import sys,json;print(json.load(sys.stdin).get('startedAt',0))" 2>/dev/null || date +%s%3N),"lastRunAt":$(date +%s%3N),"nextRunAt":${NEXT_AT},"status":"waiting"}
106
- EOF
107
- ```
108
- Then use `ScheduleWakeup` with `delaySeconds: 120` and prompt `/monomind:do --space $SPACE_ID --board $TASK_BOARD_ID` (plus `--filter` if one was set) to check again. STOP this iteration.
156
+ ## Step 4: Execute Based on Mode
109
157
 
110
- 4. Store `CURRENT_CARD_ID` and `CURRENT_CARD_TITLE`.
158
+ ### Agent Budget Guard
111
159
 
112
- ---
160
+ Before spawning, count total agents needed:
161
+ - **Parallel**: one per context group + one per independent task
162
+ - **Minimal**: one per context group + one shared
163
+ - **Sequential**: one
113
164
 
114
- ## Step 3: Read Full Task Context
165
+ If total exceeds `--max-agents` (default: 20), downgrade mode automatically:
166
+ - Parallel → Minimal (if still over budget → Sequential)
167
+ - Output: `[monomind:do] Agent budget exceeded (N > max-agents). Downgrading to <mode>.`
115
168
 
116
- Gather ALL context for the selected card:
169
+ Track `AGENTS_SPAWNED` counter. If it hits the limit mid-run (e.g., during review cycles), stop spawning and queue remaining work for the next cycle.
117
170
 
118
- 1. **Card details**: Run `monotask card view $TASK_BOARD_ID $CURRENT_CARD_ID` to get title, description, impact, effort, and priority.
171
+ ### Mode: Parallel
119
172
 
120
- 2. **Comments**: Run `monotask card comment list $TASK_BOARD_ID $CURRENT_CARD_ID --json`. Parse for:
121
- - Task description (first comment)
122
- - **Assigned agent type** — look for a comment starting with "Assigned agent:" and extract the type
123
- - Additional context, edge cases, technical notes
173
+ Spawn ALL agents in ONE message using the Agent tool:
124
174
 
125
- 3. **Checklist**: Run `monotask card checklist list $TASK_BOARD_ID $CURRENT_CARD_ID --json`. If a checklist exists, treat each unchecked item as a sub-step.
175
+ **For each context group chain:**
176
+ - Spawn ONE agent of the chain's recommended type
177
+ - Provide it with ALL tasks in the chain, in prerequisite order
178
+ - The agent executes them sequentially, committing after each
179
+ - Agent prompt includes: full task context for ALL tasks in the chain, project context, instruction to execute in order
126
180
 
127
- 4. **Subtasks**: Check if comments reference subtask card IDs or child cards.
181
+ **For each independent task:**
182
+ - Spawn ONE agent of the task's assigned type
183
+ - Provide it with that single task's context
184
+ - The agent executes and commits
128
185
 
129
- 5. **Attached images**: If comments contain image paths or URLs, read them with the Read tool.
186
+ All agents run concurrently via `run_in_background: true`.
130
187
 
131
- Bundle into `TASK_CONTEXT`.
188
+ **Agent prompt template for chain execution:**
189
+ ```
190
+ You have N tasks to execute in order. Complete each one before moving to the next.
191
+ Tasks share context — knowledge from earlier tasks applies to later ones.
192
+
193
+ TASK 1 of N: <title>
194
+ <full task context, checklist, acceptance criteria>
195
+
196
+ TASK 2 of N: <title>
197
+ <full task context, checklist, acceptance criteria>
198
+ ...
199
+
200
+ For each task:
201
+ 1. Implement the changes following the checklist
202
+ 2. Write/update tests
203
+ 3. Verify tests pass
204
+ 4. Commit with descriptive message
205
+ 5. Write a HANDOFF CONTEXT section (3-5 lines): what files changed, what decisions were made, what the next task needs to know
206
+ 6. Report: DONE | DONE_WITH_CONCERNS | BLOCKED (with details)
207
+
208
+ IMPORTANT — Handoff Context:
209
+ After completing each task in the chain, write a brief ## Handoff Context block:
210
+ - Files created/modified (with paths)
211
+ - Key decisions made (naming, patterns chosen, trade-offs)
212
+ - State the next task inherits (new types, config values, API shapes)
213
+ This ensures continuity even if context is compressed between tasks.
214
+
215
+ If you are BLOCKED on any task, STOP the entire chain. Do not attempt subsequent tasks.
216
+ Report which task is blocked and list the remaining unstarted tasks.
217
+ ```
132
218
 
133
- ---
219
+ **Agent prompt template for independent tasks:**
220
+ ```
221
+ Execute this single task:
134
222
 
135
- ## Step 4: Gather Project Context
223
+ TASK: <title>
224
+ <full task context, checklist, acceptance criteria>
136
225
 
137
- Collect in parallel (skip any that error):
226
+ 1. Implement the changes following the checklist
227
+ 2. Write/update tests
228
+ 3. Verify tests pass
229
+ 4. Commit with descriptive message
230
+ 5. Report: DONE | DONE_WITH_CONCERNS | BLOCKED (with details)
231
+ ```
138
232
 
139
- 1. **README**: Read `README.md` (first 200 lines).
140
- 2. **Package manifest**: Read whichever exists first: `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`.
141
- 3. **Memory search**: Call `mcp__monomind__memory_search` with the card title.
142
- 4. **Knowledge graph**: Call `mcp__monomind__graphify_suggest` with the card title.
233
+ Move all cards to `In Progress` before spawning agents:
234
+ ```bash
235
+ monotask card move $TASK_BOARD_ID $CARD_ID $COL_IN_PROGRESS --json
236
+ ```
143
237
 
144
- Bundle into `PROJECT_CONTEXT`.
238
+ ### Mode: Minimal
145
239
 
146
- ---
240
+ Same as parallel, but:
241
+ - One agent per context group chain (same as parallel)
242
+ - ONE shared agent for ALL independent tasks (executes them sequentially)
243
+ - Total agents = number of context groups + 1
147
244
 
148
- ## Step 5: Move to In Progress
245
+ ### Mode: Sequential
149
246
 
150
- ```bash
151
- monotask card move $TASK_BOARD_ID $CURRENT_CARD_ID $COL_IN_PROGRESS --json
152
- monotask card comment add $TASK_BOARD_ID $CURRENT_CARD_ID "Work started by monomind:do"
153
- ```
247
+ Spawn ONE agent with ALL tasks (all chains flattened into prerequisite order, then independents):
248
+ - The single agent receives every task
249
+ - Executes them in order, committing after each
250
+ - Maximum context preservation, minimum cost
154
251
 
155
252
  ---
156
253
 
157
- ## Step 6: Assess Complexity and Choose Execution Mode
254
+ ## Step 5: Gather Project Context (for agent prompts)
158
255
 
159
- Analyze the task to determine complexity:
256
+ Collect in parallel (skip any that error):
160
257
 
161
- **Simple task** (single agent) use when:
162
- - Task touches 1-2 files
163
- - Clear, self-contained scope
164
- - Checklist has fewer than 4 items
165
- - Effort score is 0-4
258
+ 1. **README**: Read `README.md` (first 200 lines).
259
+ 2. **Package manifest**: Read whichever exists first: `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`.
260
+ 3. **Memory search**: Call `mcp__monomind__memory_search` with the first task's title.
261
+ 4. **Knowledge graph**: Call `mcp__monomind__monograph_suggest` with the first task's title.
166
262
 
167
- **Complex task** (swarm) use when:
168
- - Task touches 3+ files or multiple modules
169
- - Has subtasks or long checklist (4+ items)
170
- - Involves cross-cutting concerns (API + DB + tests + docs)
171
- - Effort score is 5-10
263
+ Bundle into `PROJECT_CONTEXT` and include in every agent prompt.
172
264
 
173
- ### Simple mode: Single Agent
265
+ ---
174
266
 
175
- Determine the agent type from the "Assigned agent:" comment. If none specified, default to `coder`.
267
+ ## Step 6: Read Full Task Context (for each task)
176
268
 
177
- Spawn the agent via the Agent tool with:
178
- - Full `TASK_CONTEXT` and `PROJECT_CONTEXT`
179
- - The checklist items as step-by-step guide
180
- - Instructions to commit changes with a descriptive message
269
+ For each task being assigned to an agent, gather:
181
270
 
182
- ### Complex mode: Swarm
271
+ 1. **Card details**: Run `monotask card view $TASK_BOARD_ID $CARD_ID` to get title, description, impact, effort, priority.
183
272
 
184
- Use a `hierarchical` swarm with `raft` consensus and `specialized` strategy.
273
+ 2. **Comments**: Run `monotask card comment list $TASK_BOARD_ID $CARD_ID --json`. Parse for:
274
+ - Task description and context
275
+ - Assigned agent type
276
+ - Context group and prerequisites
277
+ - Acceptance criteria
278
+ - Additional notes
185
279
 
186
- Agent team (4-6 agents based on task domain):
187
- - **coordinator** — plans and delegates subtasks
188
- - **assigned agent type** (from card) — primary implementer
189
- - **tester** — writes and runs tests for the changes
190
- - Additional agents as needed based on task domain (e.g., `backend-dev` + `Frontend Developer` for full-stack work)
280
+ 3. **Checklist**: Run `monotask card checklist list $TASK_BOARD_ID $CARD_ID --json`. If a checklist exists, include as step-by-step guide.
191
281
 
192
- Spawn all agents in ONE message via the Agent tool. The coordinator receives the full task context and delegates to specialists.
282
+ Bundle into `TASK_CONTEXT` for that task.
193
283
 
194
- ### Agent prompt requirements (both modes):
284
+ ---
195
285
 
196
- The agent(s) MUST:
197
- - Implement the task as described
198
- - Follow the checklist if one exists
199
- - Write or update tests for all changes
200
- - Commit changes with descriptive messages
201
- - Report back with one of:
202
- - **DONE**: Task completed. Include summary of changes and list of files modified.
203
- - **DONE_WITH_CONCERNS**: Task completed with concerns. Include concerns.
204
- - **BLOCKED**: Cannot complete. Include the specific question or blocker.
286
+ ## Step 7: Handle Agent Results
205
287
 
206
- ---
288
+ After each agent completes (or all agents in parallel mode), process results:
207
289
 
208
- ## Step 7: Handle Subtasks
290
+ ### For each completed task:
209
291
 
210
- After the main task completes, check for subtasks (child cards or referenced cards).
292
+ **If DONE or DONE_WITH_CONCERNS:**
293
+ - Proceed to review cycle (Step 8)
211
294
 
212
- For each subtask:
213
- 1. Read its full context (same as Step 3)
214
- 2. Move to `In Progress`
215
- 3. Assess complexity and execute (same as Step 6, using the subtask's assigned agent or inheriting from parent)
216
- 4. Run through the review cycle (Step 8) independently
295
+ **If BLOCKED:**
296
+ 1. Add the blocking question as a comment:
297
+ ```bash
298
+ monotask card comment add $TASK_BOARD_ID $CARD_ID "Blocked: <question or issue>"
299
+ ```
300
+ 2. Move card to `Human in Loop`:
301
+ ```bash
302
+ monotask card move $TASK_BOARD_ID $CARD_ID $COL_HUMAN_IN_LOOP --json
303
+ ```
304
+ 3. **Chain failure propagation**: If this task belongs to a context group chain, ALL remaining tasks in that chain are now blocked. For each subsequent task in the chain:
305
+ ```bash
306
+ monotask card move $TASK_BOARD_ID $DEPENDENT_CARD_ID $COL_BACKLOG --json
307
+ monotask card comment add $TASK_BOARD_ID $DEPENDENT_CARD_ID "Chain paused: prerequisite '<blocked task title>' is blocked. Reason: <blocker summary>"
308
+ ```
309
+ Do NOT attempt to execute remaining chain tasks — they depend on the blocked task's output and context.
217
310
 
218
311
  ---
219
312
 
@@ -257,38 +350,38 @@ Proceed to Step 9.
257
350
  ### If APPROVED (from review cycle):
258
351
  1. Add a comment summarizing the changes and review outcome:
259
352
  ```bash
260
- monotask card comment add $TASK_BOARD_ID $CURRENT_CARD_ID "Completed and reviewed: <summary>"
353
+ monotask card comment add $TASK_BOARD_ID $CARD_ID "Completed and reviewed: <summary>"
261
354
  ```
262
355
  2. If there's a checklist, mark completed items:
263
356
  ```bash
264
- monotask card checklist check $TASK_BOARD_ID $CURRENT_CARD_ID <ITEM_ID>
357
+ monotask card checklist check $TASK_BOARD_ID $CARD_ID <ITEM_ID>
265
358
  ```
266
359
  3. If DONE_WITH_CONCERNS, add concerns:
267
360
  ```bash
268
- monotask card comment add $TASK_BOARD_ID $CURRENT_CARD_ID "Concerns: <concerns>"
361
+ monotask card comment add $TASK_BOARD_ID $CARD_ID "Concerns: <concerns>"
269
362
  ```
270
363
  4. Move card to `Review`:
271
364
  ```bash
272
- monotask card move $TASK_BOARD_ID $CURRENT_CARD_ID $COL_REVIEW --json
365
+ monotask card move $TASK_BOARD_ID $CARD_ID $COL_REVIEW --json
273
366
  ```
274
-
275
- ### If BLOCKED (from execution):
276
- 1. Add the blocking question:
367
+ 5. **Unblock dependents**: If this task was a prerequisite for other tasks, move those from `Backlog` to `Todo`:
277
368
  ```bash
278
- monotask card comment add $TASK_BOARD_ID $CURRENT_CARD_ID "Blocked: <question or issue>"
279
- ```
280
- 2. Move card to `Human in Loop`:
281
- ```bash
282
- monotask card move $TASK_BOARD_ID $CURRENT_CARD_ID $COL_HUMAN_IN_LOOP --json
369
+ monotask card move $TASK_BOARD_ID $DEPENDENT_CARD_ID $COL_TODO --json
283
370
  ```
284
371
 
285
372
  ---
286
373
 
287
374
  ## Step 10: Summary and Next Cycle
288
375
 
289
- Output a single status line:
376
+ Output a status summary:
290
377
  ```
291
- [monomind:do] "<title>" <Review | Human in Loop> (agent: <type>, mode: <single|swarm>, review: <approved|blocked>)
378
+ [monomind:do] Execution complete (mode: <parallel|minimal|sequential>)
379
+
380
+ | Task | Status | Agent | Review |
381
+ |-------------------------------|----------------|-------------|------------|
382
+ | <title> | Review | backend-dev | approved |
383
+ | <title> | Review | coder | approved |
384
+ | <title> | Human in Loop | coder | blocked |
292
385
  ```
293
386
 
294
387
  Then check for remaining tasks:
@@ -297,18 +390,37 @@ monotask card list $TASK_BOARD_ID $COL_TODO --json
297
390
  monotask card list $TASK_BOARD_ID $COL_BACKLOG --json
298
391
  ```
299
392
 
300
- If tasks remain, output:
393
+ If tasks remain (including newly unblocked ones), output:
301
394
  ```
302
- [monomind:do] Remaining: N in Todo, M in Backlog. Next task in 2 minutes...
395
+ [monomind:do] Remaining: N in Todo, M in Backlog. Processing next batch in 2 minutes...
303
396
  ```
304
397
 
305
- Use `ScheduleWakeup` with `delaySeconds: 120` and prompt `/monomind:do --space $SPACE_ID --board $TASK_BOARD_ID` (plus `--filter` if one was set) to process the next task.
398
+ Update loop state and use `ScheduleWakeup` with `delaySeconds: 120` and prompt `/monomind:do --space $SPACE_ID --board $TASK_BOARD_ID --mode $EXEC_MODE` (plus `--filter` if one was set).
306
399
 
307
400
  If no tasks remain, output:
308
401
  ```
309
402
  [monomind:do] All tasks processed. Queue empty.
310
403
  ```
311
404
 
405
+ ### Store execution outcome in session memory
406
+
407
+ Call `mcp__monomind__memory_store` with:
408
+ ```json
409
+ {
410
+ "key": "execution-outcome:<REPO_NAME>:<timestamp>",
411
+ "content": {
412
+ "mode": "<EXEC_MODE>",
413
+ "tasks_completed": N,
414
+ "tasks_blocked": M,
415
+ "agents_spawned": K,
416
+ "review_cycles": L,
417
+ "outcome": "success | partial | blocked",
418
+ "lessons": ["any patterns observed — e.g. 'context groups worked well', 'task X was too large']"
419
+ },
420
+ "tags": ["execution-outcome", "monomind-do"]
421
+ }
422
+ ```
423
+
312
424
  Remove the loop state file:
313
425
  ```bash
314
426
  rm -f ".monomind/loops/${DO_LOOP_ID}.json" ".monomind/loops/${DO_LOOP_ID}.stop"
@@ -49,7 +49,7 @@ Collect ALL of the following in parallel (skip any that error):
49
49
 
50
50
  3. **Package manifest**: Read whichever exists first: `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`. Extract name, description, and keywords/tags.
51
51
 
52
- 4. **Knowledge graph**: Call `mcp__monomind__graphify_suggest` with the user's prompt (`$ARGUMENTS`). Skip if it errors or returns empty.
52
+ 4. **Knowledge graph**: Call `mcp__monomind__monograph_suggest` with the user's prompt (`$ARGUMENTS`). Skip if it errors or returns empty.
53
53
 
54
54
  5. **Memory search**: Call `mcp__monomind__memory_search` with the user's prompt (`$ARGUMENTS`). Use the top 5 results.
55
55
 
@@ -199,113 +199,44 @@ Also move any `skipElaboration: true` ideas directly to `Elaborated`.
199
199
 
200
200
  ---
201
201
 
202
- ## Step 6: Task Decomposer -- Break Ideas into Subtasks
202
+ ## Step 6: Task Decomposer Break Ideas into Subtasks
203
203
 
204
- ### Task Board Setup
205
- - Check if a `monomind-task` board exists in the space (same lookup method as Step 2).
206
- - If not, create it with these columns:
207
- - `Backlog`
208
- - `Todo`
209
- - `In Progress`
210
- - `Review`
211
- - `Human in Loop`
212
- - `Done`
213
- - Store column IDs (especially `COL_BACKLOG`).
214
-
215
- ### Decomposition into Professional Task Cards
204
+ ### Generate the TASKS Array
216
205
 
217
206
  Spawn a single `Software Architect` agent via the Agent tool. Provide it with:
218
207
  - All ideas in the `Elaborated` column (titles, descriptions, and all comments)
219
208
  - The `PROJECT_CONTEXT`
209
+ - **The Task Grouping Rules and Card Format from `monomind-task-engine` skill (Sections 1 & 2)** — include them verbatim in the agent prompt so it produces correctly structured tasks
220
210
 
221
- For each elaborated idea, the agent must:
222
-
223
- 1. **Analyze and decompose** into 2-6 subtasks. Each subtask must be a professional task card following this structure:
224
-
225
- ```json
226
- {
227
- "title": "Action-oriented title (verb + noun + context)",
228
- "description": "## What\nExact deliverable (new file, modified function, endpoint, etc.).\n\n## Why\nBusiness or technical motivation — what breaks without this?\n\n## Where\nFile paths, module boundaries, related components.\n\n## Patterns\nExisting conventions to follow (naming, error handling, test style).",
229
- "definition_of_done": [
230
- "Specific, binary, verifiable condition (include HTTP codes, error shapes, edge cases)",
231
- "Quantified thresholds where applicable (rate limits, timeouts, sizes)"
232
- ],
233
- "testing_criteria": {
234
- "unit_tests": ["function(input) → expected outcome"],
235
- "integration_tests": ["endpoint + method → status + response shape"],
236
- "edge_cases": ["boundary condition → expected behavior"]
237
- },
238
- "checklist": [
239
- "Write failing test for [specific behavior]",
240
- "Implement [function/class] in [file path]",
241
- "Run tests — verify green",
242
- "Commit: '[type]: [description]'"
243
- ],
244
- "agent_type": "best-fit agent from 230+ roster (e.g., backend-dev, Frontend Developer, Security Engineer)",
245
- "priority": "critical | high | medium | low",
246
- "effort": "1-10 (1=trivial, 10=full day)",
247
- "dependencies": ["titles of prerequisite tasks, or empty"]
248
- }
249
- ```
250
-
251
- **Task generation rules:**
252
- - Tasks MUST be ordered so dependencies come first
253
- - Each task: 5-30 minutes for a single agent
254
- - Split anything larger
255
- - Every task starts with writing a test (TDD)
256
- - DOD items must be binary (pass/fail, not "looks good")
257
- - Testing criteria must name specific functions, endpoints, inputs
258
-
259
- 2. **Create each subtask** as a card in `Backlog` (has deps) or `Todo` (no deps):
260
- ```bash
261
- monotask card create $TASK_BOARD_ID $COLUMN_ID "<title>" --json
262
- monotask card tag add $TASK_BOARD_ID $CARD_ID "monomind-idea"
263
- ```
264
-
265
- 3. **Set description** with full context block:
266
- ```bash
267
- monotask card set-description $TASK_BOARD_ID $CARD_ID "<description with What/Why/Where/Patterns>"
268
- ```
269
-
270
- 4. **Add DOD comment**:
271
- ```bash
272
- monotask card comment add $TASK_BOARD_ID $CARD_ID "## Definition of Done\n- [ ] <condition 1>\n- [ ] <condition 2>\n..."
273
- ```
274
-
275
- 5. **Add testing criteria comment**:
276
- ```bash
277
- monotask card comment add $TASK_BOARD_ID $CARD_ID "## Testing Criteria\n\n### Unit Tests\n- <test 1>\n\n### Integration Tests\n- <test 1>\n\n### Edge Cases\n- <case 1>"
278
- ```
211
+ The agent MUST produce a `TASKS` array following the `monomind-task-engine` card format (Section 2). Each task must comply with all 7 grouping rules (Section 1). For each elaborated idea, decompose into 2-6 subtasks.
279
212
 
280
- 6. **Add agent assignment + metadata**:
281
- ```bash
282
- monotask card comment add $TASK_BOARD_ID $CARD_ID "Assigned agent: <agent_type>\nPriority: <priority>\nEffort: <effort>/10\nDependencies: <dep titles or none>"
283
- ```
213
+ **If the architect has doubts** about decomposing an idea (unclear scope, missing info), they should:
214
+ - Add a comment with the question
215
+ - Move the idea to `Iced` instead of `Tasked`
284
216
 
285
- 7. **Set priority**: `monotask card set-priority $TASK_BOARD_ID $CARD_ID <1-4>`
217
+ Store the result as `TASKS` array.
286
218
 
287
- 8. **Create checklist** (TDD implementation steps):
288
- ```bash
289
- monotask checklist add $TASK_BOARD_ID $CARD_ID "Implementation Steps" --json
290
- ```
291
- Then for each step:
292
- ```bash
293
- monotask checklist item-add $TASK_BOARD_ID $CARD_ID $CHECKLIST_ID "<step>"
294
- ```
219
+ ### Invoke the Unified Task Engine
295
220
 
296
- 9. **Comment on original idea card** listing all subtask titles with their assigned agents:
297
- ```bash
298
- monotask card comment add $BOARD_ID $IDEA_CARD_ID "Subtasks created:\n- <title> (agent: <type>, effort: <N>/10)\n- <title> (agent: <type>, effort: <N>/10)\n..."
299
- ```
221
+ Invoke the `monomind-task-engine` skill (Sections 3-7) with these parameters:
300
222
 
301
- 10. **Move the idea card** to `Tasked`:
302
- ```bash
303
- monotask card move $BOARD_ID $IDEA_CARD_ID $COL_TASKED --json
304
- ```
223
+ | Parameter | Value |
224
+ |-----------|-------|
225
+ | `TASKS` | The array from the architect agent |
226
+ | `TASK_BOARD_ID` | From Step 2 (or let the engine set up the board) |
227
+ | `REPO_NAME` | From Step 1 |
228
+ | `SOURCE_TAG` | `"monomind-idea"` |
229
+ | `SOURCE_SUMMARY` | First 100 chars of `$ARGUMENTS` |
230
+ | `PARENT_CARD_ID` | Each `IDEA_CARD_ID` in the Elaborated column |
231
+ | `PARENT_BOARD_ID` | `$BOARD_ID` (the monomind-idea board) |
232
+ | `PARENT_DONE_COLUMN` | `$COL_TASKED` |
305
233
 
306
- **If the architect has doubts** about decomposing an idea (unclear scope, missing info), they should:
307
- - Add a comment with the question
308
- - Move the idea to `Iced` instead of `Tasked`
234
+ The engine will:
235
+ 1. Create all cards on the monotask board (Section 4)
236
+ 2. Store execution strategy in session memory (Section 5)
237
+ 3. Run the **Final Dependency & Critical Path Review** (Section 6) — a fresh Code Reviewer agent validates prerequisites, context groups, critical path, parallel safety, and agent assignments
238
+ 4. Fix any blocker issues automatically, present warnings to user
239
+ 5. Present execution offer with mode recommendation (Section 7)
309
240
 
310
241
  ---
311
242
 
@@ -335,15 +266,10 @@ Then output:
335
266
 
336
267
  ## Step 8: Offer to Execute Tasks
337
268
 
338
- If there are any tasked ideas (subtasks in Backlog), ask the user:
269
+ The `monomind-task-engine` (Section 7) already presents the execution offer after the final review passes. If the user picks a mode there, it invokes `monomind-do` automatically.
339
270
 
340
- > **M subtasks are ready in the backlog.** Want me to start executing them now?
341
- >
342
- > Say **yes** to launch `/monomind:do` — it will pick up tasks one by one, execute them with the assigned agent, review for bugs, and loop every 2 minutes until the queue is empty.
271
+ If the engine's execution offer was skipped or the user deferred, and there are tasks in Todo, offer:
343
272
 
344
- If the user says yes (or any affirmative), invoke the Skill tool with:
345
273
  ```
346
- Skill("monomind-do", "--space $SPACE_ID --board $TASK_BOARD_ID")
274
+ Skill("monomind-do", "--space $SPACE_ID --board $TASK_BOARD_ID --mode <parallel|minimal|sequential>")
347
275
  ```
348
-
349
- This passes the exact space and board IDs so `monomind:do` skips discovery and starts executing immediately.