@monoes/monomindcli 1.9.16 → 1.10.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 (118) hide show
  1. package/.claude/commands/mastermind/_repeat.md +182 -39
  2. package/.claude/commands/mastermind/architect.md +17 -11
  3. package/.claude/commands/mastermind/brain.md +4 -0
  4. package/.claude/commands/mastermind/build.md +4 -0
  5. package/.claude/commands/mastermind/content.md +4 -0
  6. package/.claude/commands/mastermind/createorg.md +5 -3
  7. package/.claude/commands/mastermind/finance.md +4 -0
  8. package/.claude/commands/mastermind/idea.md +4 -0
  9. package/.claude/commands/mastermind/marketing.md +4 -0
  10. package/.claude/commands/mastermind/master.md +100 -46
  11. package/.claude/commands/mastermind/ops.md +4 -0
  12. package/.claude/commands/mastermind/release.md +4 -0
  13. package/.claude/commands/mastermind/research.md +4 -0
  14. package/.claude/commands/mastermind/review.md +4 -0
  15. package/.claude/commands/mastermind/runorg.md +5 -3
  16. package/.claude/commands/mastermind/sales.md +4 -0
  17. package/.claude/commands/mastermind/techport.md +9 -0
  18. package/.claude/commands/monomind/do.md +5 -1
  19. package/.claude/commands/monomind/idea.md +5 -1
  20. package/.claude/commands/monomind/improve.md +5 -1
  21. package/.claude/commands/monomind/repeat.md +85 -29
  22. package/.claude/commands/monomind/review.md +6 -2
  23. package/.claude/commands/monomind/understand.md +10 -8
  24. package/.claude/helpers/extras-registry.json +235 -235
  25. package/.claude/helpers/graphify-freshen.cjs +13 -1
  26. package/.claude/helpers/hook-handler.cjs +1 -1
  27. package/.claude/helpers/router.cjs +4 -1
  28. package/.claude/skills/mastermind/_protocol.md +37 -21
  29. package/.claude/skills/mastermind/access.md +236 -0
  30. package/.claude/skills/mastermind/activity.md +191 -0
  31. package/.claude/skills/mastermind/adapter-manager.md +259 -0
  32. package/.claude/skills/mastermind/adapters.md +204 -0
  33. package/.claude/skills/mastermind/agent-detail.md +242 -0
  34. package/.claude/skills/mastermind/agents.md +178 -0
  35. package/.claude/skills/mastermind/approval-detail.md +259 -0
  36. package/.claude/skills/mastermind/approve.md +181 -0
  37. package/.claude/skills/mastermind/architect.md +24 -8
  38. package/.claude/skills/mastermind/backup.md +197 -0
  39. package/.claude/skills/mastermind/bootstrap.md +190 -0
  40. package/.claude/skills/mastermind/budgets.md +237 -0
  41. package/.claude/skills/mastermind/companies.md +256 -0
  42. package/.claude/skills/mastermind/costs.md +151 -0
  43. package/.claude/skills/mastermind/createorg.md +23 -5
  44. package/.claude/skills/mastermind/diagnose.md +249 -0
  45. package/.claude/skills/mastermind/env.md +198 -0
  46. package/.claude/skills/mastermind/environments.md +250 -0
  47. package/.claude/skills/mastermind/export.md +324 -0
  48. package/.claude/skills/mastermind/goal-detail.md +255 -0
  49. package/.claude/skills/mastermind/goals.md +149 -0
  50. package/.claude/skills/mastermind/heartbeat.md +164 -0
  51. package/.claude/skills/mastermind/idea.md +318 -186
  52. package/.claude/skills/mastermind/import.md +281 -0
  53. package/.claude/skills/mastermind/inbox.md +214 -0
  54. package/.claude/skills/mastermind/instance-settings.md +315 -0
  55. package/.claude/skills/mastermind/instance.md +231 -0
  56. package/.claude/skills/mastermind/invite-landing.md +227 -0
  57. package/.claude/skills/mastermind/invites.md +254 -0
  58. package/.claude/skills/mastermind/issue-detail.md +291 -0
  59. package/.claude/skills/mastermind/issues.md +235 -0
  60. package/.claude/skills/mastermind/join-queue.md +170 -0
  61. package/.claude/skills/mastermind/liveness.md +392 -0
  62. package/.claude/skills/mastermind/memory.md +321 -0
  63. package/.claude/skills/mastermind/my-issues.md +146 -0
  64. package/.claude/skills/mastermind/new-agent.md +241 -0
  65. package/.claude/skills/mastermind/org-chart.md +207 -0
  66. package/.claude/skills/mastermind/org-settings.md +217 -0
  67. package/.claude/skills/mastermind/plan-to-tasks.md +136 -0
  68. package/.claude/skills/mastermind/plugin-manager.md +241 -0
  69. package/.claude/skills/mastermind/plugin-settings.md +273 -0
  70. package/.claude/skills/mastermind/plugins.md +190 -0
  71. package/.claude/skills/mastermind/profile.md +187 -0
  72. package/.claude/skills/mastermind/project-detail.md +249 -0
  73. package/.claude/skills/mastermind/project-workspace.md +244 -0
  74. package/.claude/skills/mastermind/projects.md +164 -0
  75. package/.claude/skills/mastermind/routine-detail.md +253 -0
  76. package/.claude/skills/mastermind/routines.md +202 -0
  77. package/.claude/skills/mastermind/runorg.md +74 -9
  78. package/.claude/skills/mastermind/search.md +186 -0
  79. package/.claude/skills/mastermind/secrets.md +199 -0
  80. package/.claude/skills/mastermind/skills.md +156 -0
  81. package/.claude/skills/mastermind/tasks.md +149 -0
  82. package/.claude/skills/mastermind/techport.md +5 -5
  83. package/.claude/skills/mastermind/threads.md +259 -0
  84. package/.claude/skills/mastermind/tree-control.md +250 -0
  85. package/.claude/skills/mastermind/wiki.md +314 -0
  86. package/.claude/skills/mastermind/workspace-detail.md +317 -0
  87. package/.claude/skills/mastermind/workspaces.md +261 -0
  88. package/.claude/skills/mastermind/worktree.md +187 -0
  89. package/dist/src/init/executor.js +8 -8
  90. package/dist/src/init/executor.js.map +1 -1
  91. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  92. package/dist/src/init/statusline-generator.js +12 -0
  93. package/dist/src/init/statusline-generator.js.map +1 -1
  94. package/dist/src/ui/.monomind/data/ranked-context.json +1 -1
  95. package/dist/src/ui/.monomind/loops/mastermind-review-1778664132789.json +16 -0
  96. package/dist/src/ui/.monomind/sessions/current.json +5 -5
  97. package/dist/src/ui/.monomind/sessions/session-1776778451399.json +15 -0
  98. package/dist/src/ui/dashboard.html +3030 -181
  99. package/dist/src/ui/data/mastermind-events.jsonl +8 -0
  100. package/dist/src/ui/data/mastermind-sessions.json +1 -0
  101. package/dist/src/ui/server.mjs +738 -0
  102. package/dist/tsconfig.tsbuildinfo +1 -1
  103. package/package.json +1 -1
  104. package/.claude/skills/.monomind/data/ranked-context.json +0 -5
  105. package/.claude/skills/.monomind/sessions/current.json +0 -13
  106. package/.claude/skills/.monomind/sessions/session-1777829336455.json +0 -15
  107. package/.claude/skills/.monomind/sessions/session-1777831614725.json +0 -15
  108. package/.claude/skills/.monomind/sessions/session-1777832095857.json +0 -15
  109. package/.claude/skills/.monomind/sessions/session-1777839814183.json +0 -15
  110. package/.claude/skills/.monomind/sessions/session-1777841847131.json +0 -15
  111. package/.claude/skills/.monomind/sessions/session-1777843309463.json +0 -15
  112. package/.claude/skills/.monomind/sessions/session-1777880867159.json +0 -15
  113. package/.claude/skills/.monomind/sessions/session-1777881884593.json +0 -15
  114. package/.claude/skills/.monomind/sessions/session-1777884090471.json +0 -15
  115. package/.claude/skills/.monomind/sessions/session-1777884808221.json +0 -15
  116. package/.claude/skills/.monomind/sessions/session-1777885672155.json +0 -15
  117. package/.claude/skills/.monomind/sessions/session-1777886852818.json +0 -15
  118. package/.claude/skills/.monomind/sessions/session-1777896532690.json +0 -15
@@ -55,6 +55,11 @@ Extract from `$ARGUMENTS`:
55
55
  - `--iterate <N>` → iterate = N (integer ≥ 1; when flag is absent, no iteration runs)
56
56
  - Remaining text = prompt
57
57
 
58
+ If `--project` was not provided, default `project_name` to the current directory name:
59
+ ```bash
60
+ project_name="${project_name:-$(basename "$PWD")}"
61
+ ```
62
+
58
63
  ### Step 2 — Brain Load
59
64
 
60
65
  Follow the Brain Load Procedure from `_protocol.md`:
@@ -90,7 +95,8 @@ jq -n --arg sid "$SESSION_ID" --arg proj "$project_name" --arg prompt "$resolved
90
95
  > "$REPO_ROOT/.monomind/sessions/current.json.tmp" \
91
96
  && mv "$REPO_ROOT/.monomind/sessions/current.json.tmp" \
92
97
  "$REPO_ROOT/.monomind/sessions/current.json"
93
- curl -s -o /dev/null -X POST "http://localhost:4242/api/mastermind/event" \
98
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
99
+ curl -s -o /dev/null -X POST "${CTRL_URL}/api/mastermind/event" \
94
100
  -H "Content-Type: application/json" \
95
101
  -d "$(jq -cn --arg sid "$SESSION_ID" --arg prompt "$resolved_prompt" --arg mode "$mode" --arg proj "$(pwd)" \
96
102
  '{type:"session:start",session:$sid,prompt:$prompt,mode:$mode,project:$proj,ts:(now*1000|floor)}')" || true
@@ -173,6 +179,17 @@ Follow the Monotask Space+Board Setup Procedure from `_protocol.md`. Resolve the
173
179
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
174
180
  SESSION_STATE="$REPO_ROOT/.monomind/sessions/current.json"
175
181
 
182
+ # monotask availability guard — all card/board operations below require it
183
+ if ! command -v monotask >/dev/null 2>&1; then
184
+ echo "WARN: monotask CLI not found — board and card creation will be skipped."
185
+ echo "Install via: npm install -g monotask"
186
+ echo "Domain managers will run without board IDs (text-only output)."
187
+ # Write marker to current.json so Step 7 Phase C skips Task spawning with empty boards
188
+ jq '. + {monotask_available: false}' "$SESSION_STATE" > "$SESSION_STATE.tmp" \
189
+ && mv "$SESSION_STATE.tmp" "$SESSION_STATE" 2>/dev/null || true
190
+ exit 0
191
+ fi
192
+
176
193
  SESSION_ID=$(jq -r '.sessionId // empty' "$SESSION_STATE" 2>/dev/null)
177
194
  [ -z "$SESSION_ID" ] && { echo "ERROR: SESSION_ID missing in current.json — run Step 3 first"; exit 1; }
178
195
  project_name=$(jq -r '.project_name // ""' "$SESSION_STATE")
@@ -197,26 +214,45 @@ for domain in $domains_needed; do
197
214
  canonical="${project_name}-${domain}"
198
215
 
199
216
  # Find existing board by canonical name — reuse across runs
200
- board_id=$(monotask board list 2>/dev/null | awk -F'|' '{gsub(/^ +| +$/,"",$1);gsub(/^ +| +$/,"",$2);if($2==n)print $1}' n="$canonical" | head -1)
217
+ # board list format is "uuid: name" (colon-space separator, NOT pipe)
218
+ board_id=$(monotask board list 2>/dev/null | awk -F': ' '{gsub(/^ +| +$/,"",$1);gsub(/^ +| +$/,"",$2);if($2==n)print $1}' n="$canonical" | head -1)
219
+
220
+ # Domain-specific column schema:
221
+ # idea → New | Evaluated | Elaborated | Tasked | Iced | Rejected (intake = "New")
222
+ # all others → Todo | In Progress | Human in Loop | Review | Done | Cancelled (intake = "Todo")
223
+ if [ "$domain" = "idea" ]; then
224
+ intake_col_name="New"
225
+ else
226
+ intake_col_name="Todo"
227
+ fi
201
228
 
202
229
  if [ -n "$board_id" ]; then
203
230
  echo "Reusing board: $board_id ($canonical)"
204
- # Fetch existing column IDs
205
231
  cols_json=$(monotask column list "$board_id" --json 2>/dev/null || echo '[]')
206
- todo_col=$(echo "$cols_json" | jq -r '[.[] | select(.title=="Todo" or .title=="Backlog")] | .[0].id // empty')
207
- doing_col=$(echo "$cols_json" | jq -r '[.[] | select(.title=="Doing" or .title=="In Progress")] | .[0].id // empty')
232
+ todo_col=$(echo "$cols_json" | jq -r --arg n "$intake_col_name" '[.[] | select(.title==$n)] | .[0].id // empty')
233
+ doing_col=$(echo "$cols_json" | jq -r '[.[] | select(.title=="In Progress" or .title=="Doing")] | .[0].id // empty')
208
234
  done_col=$(echo "$cols_json" | jq -r '[.[] | select(.title=="Done")] | .[0].id // empty')
209
235
  else
210
236
  echo "Creating board: $canonical"
211
237
  board_id=$(monotask board create --space "$space_id" "$canonical" --json 2>/dev/null | jq -r '.id // empty')
212
238
  [ -z "$board_id" ] && { echo "ERROR: Failed to create board '$canonical'"; exit 1; }
213
239
  monotask space boards add "$space_id" "$board_id" >/dev/null 2>&1 || true
214
- todo_col=$(monotask column create "$board_id" "Todo" --json | jq -r '.id // empty')
215
- [ -z "$todo_col" ] && { echo "ERROR: Failed to create Todo column for $domain"; exit 1; }
216
- doing_col=$(monotask column create "$board_id" "Doing" --json | jq -r '.id // empty')
217
- [ -z "$doing_col" ] && { echo "ERROR: Failed to create Doing column for $domain"; exit 1; }
218
- done_col=$(monotask column create "$board_id" "Done" --json | jq -r '.id // empty')
219
- [ -z "$done_col" ] && { echo "ERROR: Failed to create Done column for $domain"; exit 1; }
240
+ if [ "$domain" = "idea" ]; then
241
+ todo_col=$(monotask column create "$board_id" "New" --json | jq -r '.id // empty')
242
+ doing_col=$(monotask column create "$board_id" "Evaluated" --json | jq -r '.id // empty')
243
+ monotask column create "$board_id" "Elaborated" --json >/dev/null
244
+ monotask column create "$board_id" "Tasked" --json >/dev/null
245
+ monotask column create "$board_id" "Iced" --json >/dev/null
246
+ done_col=$(monotask column create "$board_id" "Rejected" --json | jq -r '.id // empty')
247
+ else
248
+ todo_col=$(monotask column create "$board_id" "Todo" --json | jq -r '.id // empty')
249
+ doing_col=$(monotask column create "$board_id" "In Progress" --json | jq -r '.id // empty')
250
+ monotask column create "$board_id" "Human in Loop" --json >/dev/null
251
+ monotask column create "$board_id" "Review" --json >/dev/null
252
+ done_col=$(monotask column create "$board_id" "Done" --json | jq -r '.id // empty')
253
+ monotask column create "$board_id" "Cancelled" --json >/dev/null
254
+ fi
255
+ [ -z "$todo_col" ] && { echo "ERROR: Failed to create intake column for $domain"; exit 1; }
220
256
  fi
221
257
 
222
258
  domain_goal=$(jq -r --arg d "$domain" '.domain_goals[$d] // empty' "$SESSION_STATE")
@@ -241,7 +277,17 @@ echo "Session state saved to current.json"
241
277
 
242
278
  ### Step 7 — Spawn Domain Managers
243
279
 
244
- **BEFORE THIS STEP:** If `idea` is in `domains_needed`, invoke `Skill("mastermind:idea")` directly now (master context has Skill tool access). Pass the resolved prompt, project path, and mode. Write the result to `.monomind/sessions/<SESSION_ID>/idea.json` and mark the `idea` domain as handled. Do NOT include `idea` in the Task spawning below.
280
+ **BEFORE THIS STEP:** If `idea` is in `domains_needed`, invoke `Skill("mastermind:idea")` directly now (master context has Skill tool access). Pass the resolved prompt, project path, and mode. The idea skill's Step 7 writes its output to `.monomind/sessions/<SESSION_ID>/idea.json` automatically do not write it again. Mark the `idea` domain as handled. Do NOT include `idea` in the Task spawning below.
281
+
282
+ **IDEA PIPELINE REQUIREMENT:** `mastermind:idea` runs a multi-step pipeline (Steps 3–6 inside idea.md). You MUST follow all of those steps — do NOT shortcut to manually creating cards. The full pipeline is:
283
+ - Step 3: Board setup — find-or-create `<project_name>-idea` board (master's Step 6 already created it with correct columns: New → Evaluated → Elaborated → Tasked → Iced → Rejected). Load column IDs from existing board.
284
+ - Step 4: Spawn Idea Manager agent (coordinator) with specialist sub-agents per angle — generates ideas as cards in the `New` column.
285
+ - Step 5: Spawn PM agent for validation — moves each card to `Evaluated`, `Iced`, or `Rejected`, sets impact/effort.
286
+ - Step 6a: Elaboration agents enrich each `Evaluated` card and move it to `Elaborated`.
287
+ - Step 6b: User gate (skip in auto mode).
288
+ - Step 6c: Task decomposition — creates subtask cards on `<project_name>-tasks-dev` and `<project_name>-tasks-ops` boards, linked as subtasks of their parent idea card. Moves parent idea cards to `Tasked`.
289
+
290
+ Skipping any of these steps produces an incomplete pipeline run — card content is generated but no evaluation, elaboration, or task breakdown occurs.
245
291
 
246
292
  **Before spawning**, select the best domain manager agent type from the registry for each active domain. Do not hardcode `coordinator` — pick the agent whose expertise best fits the domain goal.
247
293
 
@@ -250,18 +296,20 @@ echo "Session state saved to current.json"
250
296
  **Phase A — Registry selection** (run as one Bash call; must complete before Phase C):
251
297
 
252
298
  ```bash
253
- # Require bash 4.3+ for associative arrays and namerefs
254
- (( BASH_VERSINFO[0] * 100 + BASH_VERSINFO[1] < 403 )) && \
255
- { echo "ERROR: bash 4.3+ required (current: $BASH_VERSION). Install: brew install bash"; exit 1; }
256
-
299
+ # Compatible with macOS bash 3.2 uses jq accumulation instead of declare -A
257
300
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
258
301
  REGISTRY="$REPO_ROOT/.monomind/registry.json"
259
302
 
260
303
  # Reload state from current.json — this is a new shell; no inherited variables
261
304
  SESSION_STATE="$REPO_ROOT/.monomind/sessions/current.json"
262
305
  [ -f "$SESSION_STATE" ] || { echo "ERROR: current.json not found — run from Step 3"; exit 1; }
263
- domains_needed=$(jq -r '.domains_needed[]? // empty' "$SESSION_STATE" | tr '\n' ' ')
264
- [ -z "$domains_needed" ] && { echo "ERROR: domains_needed is empty in current.json"; exit 1; }
306
+ # If Step 6 skipped due to missing monotask, board_ids are empty skip Task agent spawning
307
+ if [ "$(jq -r '.monotask_available // true' "$SESSION_STATE")" = "false" ]; then
308
+ echo "INFO: monotask_available=false — domain managers will be spawned in text-only mode (no board IDs)"
309
+ echo " Install monotask (npm install -g monotask) and re-run to enable board tracking."
310
+ fi
311
+ domains_needed=$(jq -r '.domains_needed[]? // empty' "$SESSION_STATE" | grep -v '^idea$' | tr '\n' ' ')
312
+ [ -z "$domains_needed" ] && { echo "INFO: no non-idea domains to spawn as Task agents"; } # idea-only runs are valid
265
313
 
266
314
  # Returns: best agent name from registry for the given domain+goal
267
315
  pick_domain_manager() {
@@ -307,19 +355,17 @@ pick_domain_manager() {
307
355
  fi
308
356
  }
309
357
 
310
- declare -A domain_managers
358
+ # jq accumulation (replaces bash 4.3+ declare -A — compatible with macOS bash 3.2)
359
+ domain_managers_json='{}'
311
360
  for domain in $domains_needed; do
312
361
  goal=$(jq -r --arg d "$domain" '.domain_goals[$d] // empty' "$SESSION_STATE")
313
362
  [ -z "$goal" ] && goal=$(jq -r '.prompt // ""' "$SESSION_STATE")
314
363
  manager=$(pick_domain_manager "$domain" "$goal")
315
- domain_managers[$domain]="$manager"
364
+ domain_managers_json=$(echo "$domain_managers_json" | jq --arg d "$domain" --arg m "$manager" '. + {($d): $m}')
316
365
  echo "Domain manager for $domain: $manager"
317
366
  done
318
367
 
319
368
  # Persist domain_managers so Phase C can reload them without stdout parsing
320
- domain_managers_json=$(for k in "${!domain_managers[@]}"; do
321
- jq -n --arg k "$k" --arg v "${domain_managers[$k]}" '{key:$k,value:$v}'
322
- done | jq -s 'from_entries // {}')
323
369
  [ -z "$domain_managers_json" ] && domain_managers_json="{}"
324
370
  jq --argjson mgrs "$domain_managers_json" '. + {domain_managers:$mgrs}' \
325
371
  "$SESSION_STATE" > "$SESSION_STATE.tmp" && mv "$SESSION_STATE.tmp" "$SESSION_STATE"
@@ -344,11 +390,13 @@ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
344
390
  SESSION_STATE="$REPO_ROOT/.monomind/sessions/current.json"
345
391
  SESSION_ID=$(jq -r '.sessionId // empty' "$SESSION_STATE" 2>/dev/null)
346
392
  [ -z "$SESSION_ID" ] && { echo "ERROR: SESSION_ID not found in current.json"; exit 1; }
347
- domains_needed=$(jq -r '.domains_needed[]? // empty' "$SESSION_STATE" | tr '\n' ' ')
393
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
394
+ # Filter idea — it was already handled by Skill tool before Phase A, not dispatched as a Task agent
395
+ domains_needed=$(jq -r '.domains_needed[]? // empty' "$SESSION_STATE" | grep -v '^idea$' | tr '\n' ' ')
348
396
  for domain in $domains_needed; do
349
397
  goal=$(jq -r --arg d "$domain" '.domain_goals[$d] // empty' "$SESSION_STATE")
350
398
  [ -z "$goal" ] && goal=$(jq -r '.prompt // ""' "$SESSION_STATE")
351
- curl -s -o /dev/null -X POST "http://localhost:4242/api/mastermind/event" \
399
+ curl -s -o /dev/null -X POST "${CTRL_URL}/api/mastermind/event" \
352
400
  -H "Content-Type: application/json" \
353
401
  -d "$(jq -cn --arg sid "$SESSION_ID" --arg d "$domain" --arg cmd "$goal" \
354
402
  '{type:"domain:dispatch",session:$sid,domain:$d,cmd:$cmd,ts:(now*1000|floor)}')" || true
@@ -366,10 +414,14 @@ SESSION_ID=$(jq -r '.sessionId // empty' "$SESSION_STATE" 2>/dev/null)
366
414
  [ -z "$SESSION_ID" ] && { echo "ERROR: SESSION_ID missing"; exit 1; }
367
415
 
368
416
  # Emit one line per domain for LLM to read before constructing Task calls
369
- for domain in $(jq -r '.domains_needed[]? // empty' "$SESSION_STATE"); do
417
+ for domain in $(jq -r '.domains_needed[]? // empty' "$SESSION_STATE" | grep -v '^idea$'); do
418
+ board_id=$(jq -r --arg d "$domain" '.board_ids[$d] // ""' "$SESSION_STATE")
419
+ if [ -z "$board_id" ]; then
420
+ echo "WARN: DOMAIN=$domain has no board_id — Step 6 may not have run or monotask is missing. Task agent will run without board tracking."
421
+ fi
370
422
  echo "DOMAIN=$domain \
371
423
  MANAGER=$(jq -r --arg d "$domain" '.domain_managers[$d] // "coordinator"' "$SESSION_STATE") \
372
- BOARD=$(jq -r --arg d "$domain" '.board_ids[$d] // ""' "$SESSION_STATE") \
424
+ BOARD=$board_id \
373
425
  TODO=$(jq -r --arg d "$domain" '.todo_cols[$d] // ""' "$SESSION_STATE") \
374
426
  DOING=$(jq -r --arg d "$domain" '.doing_cols[$d] // ""' "$SESSION_STATE") \
375
427
  DONE=$(jq -r --arg d "$domain" '.done_cols[$d] // ""' "$SESSION_STATE") \
@@ -385,7 +437,7 @@ Each Task call must include a complete briefing following the Monotask Task Brie
385
437
  - The specific goal for this domain
386
438
  - The project name and run context
387
439
  - Instruction to create monotask cards directly using `monotask card create $BOARD_ID $COL_TODO_ID "<title>" --json` for all sub-tasks
388
- - Instruction to use `/monomind:do` to execute
440
+ - Instruction to use `Skill("monomind:do")` to execute tasks (Task agents have Skill tool access — do NOT use slash command syntax)
389
441
  - Instruction to spawn specialized agents using the domain-appropriate swarm topology
390
442
  - Instruction to return the unified output schema when done
391
443
 
@@ -424,26 +476,29 @@ Task({
424
476
  " - Code review: subagent_type 'reviewer'\n" +
425
477
  " Default swarm: hierarchical 6 agents raft\n\n" +
426
478
  "3. BEFORE spawning each agent, emit agent:spawn via curl (NOT WebFetch — use jq for correct ms timestamps):\n" +
427
- " curl -s -o /dev/null -X POST http://localhost:4242/api/mastermind/event \\\n" +
479
+ " REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)\n" +
480
+ " CTRL_URL=$(jq -r '.url // \"http://localhost:4242\"' \"$REPO_ROOT/.monomind/control.json\" 2>/dev/null || echo \"http://localhost:4242\")\n" +
481
+ " curl -s -o /dev/null -X POST ${CTRL_URL}/api/mastermind/event \\\n" +
428
482
  " -H 'Content-Type: application/json' \\\n" +
429
483
  " -d \"$(jq -cn --arg sid '<SESSION_ID>' --arg agent '<slug>' --arg task '<title>' \\\n" +
430
484
  " '{type:\"agent:spawn\",session:$sid,domain:\"build\",agent:$agent,task:$task,ts:(now*1000|floor)}')\" || true\n\n" +
431
485
  "4. If handing off artifacts to another domain, emit intercom via curl:\n" +
432
- " curl -s -o /dev/null -X POST http://localhost:4242/api/mastermind/event \\\n" +
486
+ " curl -s -o /dev/null -X POST ${CTRL_URL}/api/mastermind/event \\\n" +
433
487
  " -H 'Content-Type: application/json' \\\n" +
434
488
  " -d \"$(jq -cn --arg sid '<SESSION_ID>' --arg to '<domain>' --arg msg '<summary>' \\\n" +
435
489
  " '{type:\"intercom\",session:$sid,from:\"build\",to:$to,msg:$msg,ts:(now*1000|floor)}')\" || true\n\n" +
436
- "5. Execute tasks via /monomind:do --board <board_build>\n" +
490
+ "5. Execute tasks via Skill(\"monomind:do\") --board <board_build> (use Skill tool — slash command syntax does not work inside a Task agent)\n" +
437
491
  "6. Collect all agent outputs\n\n" +
438
492
  "7. BEFORE returning, write your output schema to disk AND emit domain:complete:\n" +
439
493
  " REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)\n" +
494
+ " CTRL_URL=$(jq -r '.url // \"http://localhost:4242\"' \"$REPO_ROOT/.monomind/control.json\" 2>/dev/null || echo \"http://localhost:4242\")\n" +
440
495
  " mkdir -p \"$REPO_ROOT/.monomind/sessions/<SESSION_ID>\"\n" +
441
496
  " jq -n --arg domain 'build' --arg status '<status>' \\\n" +
442
497
  " --argjson artifacts '[\"<path1>\",\"<path2>\"]' \\\n" +
443
498
  " --argjson next_actions '[\"<action1>\"]' \\\n" +
444
499
  " '{domain:$domain,status:$status,artifacts:$artifacts,next_actions:$next_actions}' \\\n" +
445
500
  " > \"$REPO_ROOT/.monomind/sessions/<SESSION_ID>/build.json\"\n" +
446
- " curl -s -o /dev/null -X POST http://localhost:4242/api/mastermind/event \\\n" +
501
+ " curl -s -o /dev/null -X POST ${CTRL_URL}/api/mastermind/event \\\n" +
447
502
  " -H 'Content-Type: application/json' \\\n" +
448
503
  " -d \"$(jq -cn --arg sid '<SESSION_ID>' --arg status '<status>' \\\n" +
449
504
  " '{type:\"domain:complete\",session:$sid,domain:\"build\",status:$status,ts:(now*1000|floor)}')\" || true\n\n" +
@@ -471,11 +526,11 @@ Domain managers run in foreground (no `run_in_background`), so their unified out
471
526
  ```bash
472
527
  # Single bash block: aggregate status + emit dashboard event
473
528
  # (variables don't persist between Bash tool calls — keep aggregation and curl together)
474
- (( BASH_VERSINFO[0] * 100 + BASH_VERSINFO[1] < 400 )) && \
475
- { echo "ERROR: bash 4+ required (current: $BASH_VERSION). Install: brew install bash"; exit 1; }
529
+ # Compatible with macOS bash 3.2 only uses indexed arrays
476
530
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
477
531
  SESSION_ID=$(jq -r '.sessionId // empty' "$REPO_ROOT/.monomind/sessions/current.json" 2>/dev/null)
478
532
  [ -z "$SESSION_ID" ] && { echo "ERROR: SESSION_ID missing"; exit 1; }
533
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
479
534
 
480
535
  overall_status="complete"
481
536
  completed_domains=()
@@ -497,7 +552,7 @@ echo "overall_status=$overall_status completed_domains=${completed_domains[*]}"
497
552
 
498
553
  completed_domains_json=$(jq -n '$ARGS.positional' --args "${completed_domains[@]}")
499
554
 
500
- curl -s -o /dev/null -X POST "http://localhost:4242/api/mastermind/event" \
555
+ curl -s -o /dev/null -X POST "${CTRL_URL}/api/mastermind/event" \
501
556
  -H "Content-Type: application/json" \
502
557
  -d "$(jq -cn \
503
558
  --arg sid "$SESSION_ID" \
@@ -551,8 +606,7 @@ Show the action summary (Step 9). If any compaction ran during Step 10, append:
551
606
  **Persist session state for iteration cycles:** Aggregate artifacts from per-domain output files written by each domain manager, then persist to disk so Step 12 can load it:
552
607
 
553
608
  ```bash
554
- (( BASH_VERSINFO[0] * 100 + BASH_VERSINFO[1] < 400 )) && \
555
- { echo "ERROR: bash 4+ required (current: $BASH_VERSION). Install: brew install bash"; exit 1; }
609
+ # Compatible with macOS bash 3.2 only uses indexed arrays
556
610
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
557
611
  SESSION_STATE="$REPO_ROOT/.monomind/sessions/current.json"
558
612
 
@@ -668,16 +722,16 @@ Log this as a decision in the cycle's output schema with `confidence` set accord
668
722
 
669
723
  #### 12c — Execute
670
724
 
671
- Execute the chosen activity by invoking the appropriate domain skill directly (Steps 4–10 of the main flow, condensed):
725
+ Execute the chosen activity by invoking the appropriate domain skill via the `Skill` tool (Steps 4–10 of the main flow, condensed). Use `Skill("mastermind:<domain>")` — do NOT use slash command syntax (`/<name>`), which only works in the Claude Code CLI prompt and not inside a running skill:
672
726
 
673
- - Test → invoke `/mastermind:build` with a testing-focused prompt
674
- - Debug/Fix → invoke `/mastermind:build` with the specific failing test or error as prompt
675
- - Review → invoke `/mastermind:review` with scope = artifacts from last run
676
- - Improve/Refactor → invoke `/mastermind:build` with refactor prompt
677
- - Add feature → invoke `/mastermind:build` with the next feature from the `next_actions` array printed by the Step 12a output above
678
- - Research → invoke `/mastermind:research` with the open question as prompt
679
- - Content/Docs → invoke `/mastermind:content` with scope = new artifacts
680
- - Release → invoke `/mastermind:release` with project scope
727
+ - Test → `Skill("mastermind:build")` with a testing-focused prompt
728
+ - Debug/Fix → `Skill("mastermind:build")` with the specific failing test or error as prompt
729
+ - Review → `Skill("mastermind:review")` with scope = artifacts from last run
730
+ - Improve/Refactor → `Skill("mastermind:build")` with refactor prompt
731
+ - Add feature → `Skill("mastermind:build")` with the next feature from the `next_actions` array printed by the Step 12a output above
732
+ - Research → `Skill("mastermind:research")` with the open question as prompt
733
+ - Content/Docs → `Skill("mastermind:content")` with scope = new artifacts
734
+ - Release → `Skill("mastermind:release")` with project scope
681
735
 
682
736
  Always pass: the current brain_context, project_name (from the `project_name` field above), the relevant board_id (look up `.board_ids[<chosen_domain>]` from the `board_ids` map printed above), and mode = auto (iteration cycles never pause for confirmation).
683
737
 
@@ -3,6 +3,8 @@ name: mastermind-ops
3
3
  description: Mastermind ops domain — workflow automation, reporting, process optimization. Default mode: auto.
4
4
  ---
5
5
 
6
+ **First — extract repeat flags:** Follow the REPEAT PREAMBLE from `_repeat.md`. Extracts `--repeat`, `--tillend`, `--maxruns`, `--wait`, `--rep`, `--loop` from `$ARGUMENTS` before all other parsing. If `is_continuation = true`, skip the empty-prompt check and intake below.
7
+
6
8
  Parse `$ARGUMENTS` for:
7
9
  - `--auto` flag → mode = auto
8
10
  - `--confirm` flag → mode = confirm
@@ -20,3 +22,5 @@ Default mode for this command: **auto** (unless `--confirm` flag present or inta
20
22
  Invoke `Skill("mastermind:ops")` passing: brain_context, prompt, project_name, board_id (create if needed), mode.
21
23
 
22
24
  After skill returns: follow _protocol.md Brain Write Procedure for domain `ops`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: mastermind-release
3
3
  description: Mastermind release domain — versioning, changelog, deployment. Default mode: auto.
4
4
  ---
5
5
 
6
+ **First — extract repeat flags:** Follow the REPEAT PREAMBLE from `_repeat.md`. Extracts `--repeat`, `--tillend`, `--maxruns`, `--wait`, `--rep`, `--loop` from `$ARGUMENTS` before all other parsing. If `is_continuation = true`, skip the empty-prompt check and intake below.
7
+
6
8
  Parse `$ARGUMENTS` for:
7
9
  - `--auto` flag → mode = auto
8
10
  - `--confirm` flag → mode = confirm
@@ -20,3 +22,5 @@ Default mode for this command: **auto** (unless `--confirm` flag present or inta
20
22
  Invoke `Skill("mastermind:release")` passing: brain_context, prompt, project_name, board_id (create if needed), mode.
21
23
 
22
24
  After skill returns: follow _protocol.md Brain Write Procedure for domain `release`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: mastermind-research
3
3
  description: Mastermind research domain — market research, competitor analysis, user research, trend scanning. Default mode: auto.
4
4
  ---
5
5
 
6
+ **First — extract repeat flags:** Follow the REPEAT PREAMBLE from `_repeat.md`. Extracts `--repeat`, `--tillend`, `--maxruns`, `--wait`, `--rep`, `--loop` from `$ARGUMENTS` before all other parsing. If `is_continuation = true`, skip the empty-prompt check and intake below.
7
+
6
8
  Parse `$ARGUMENTS` for:
7
9
  - `--auto` flag → mode = auto
8
10
  - `--confirm` flag → mode = confirm
@@ -20,3 +22,5 @@ Default mode for this command: **auto** (unless `--confirm` flag present or inta
20
22
  Invoke `Skill("mastermind:research")` passing: brain_context, prompt, project_name, board_id (create if needed), mode.
21
23
 
22
24
  After skill returns: follow _protocol.md Brain Write Procedure for domain `research`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: mastermind-review
3
3
  description: Mastermind review domain — code review, security audit, content and strategy review. Default mode: auto.
4
4
  ---
5
5
 
6
+ **First — extract repeat flags:** Follow the REPEAT PREAMBLE from `_repeat.md`. Extracts `--repeat`, `--tillend`, `--maxruns`, `--wait`, `--rep`, `--loop` from `$ARGUMENTS` before all other parsing. If `is_continuation = true`, skip the empty-prompt check and intake below.
7
+
6
8
  Parse `$ARGUMENTS` for:
7
9
  - `--auto` flag → mode = auto
8
10
  - `--confirm` flag → mode = confirm
@@ -20,3 +22,5 @@ Default mode for this command: **auto** (unless `--confirm` flag present or inta
20
22
  Invoke `Skill("mastermind:review")` passing: brain_context, prompt, project_name, board_id (create if needed), mode.
21
23
 
22
24
  After skill returns: follow _protocol.md Brain Write Procedure for domain `review`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -68,12 +68,14 @@ Load brain context for the `ops` domain (follow _protocol.md Brain Load Procedur
68
68
 
69
69
  Generate a session ID as a real shell variable:
70
70
  ```bash
71
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
71
72
  session_id="mm-$(date -u +%Y%m%dT%H%M%S)"
73
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
72
74
  ```
73
75
 
74
76
  Emit `session:start` to dashboard:
75
77
  ```bash
76
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
78
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
77
79
  -H "Content-Type: application/json" \
78
80
  -d "$(jq -cn \
79
81
  --arg session "$session_id" \
@@ -84,7 +86,7 @@ curl -s -X POST "http://localhost:4242/api/mastermind/event" \
84
86
 
85
87
  Emit `domain:dispatch`:
86
88
  ```bash
87
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
89
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
88
90
  -H "Content-Type: application/json" \
89
91
  -d "$(jq -cn \
90
92
  --arg session "$session_id" \
@@ -96,7 +98,7 @@ Invoke `Skill("mastermind:runorg")` passing: brain_context, org_name: `$org_name
96
98
 
97
99
  After the skill spawns the boss agent and returns: note the status. Emit `session:complete`:
98
100
  ```bash
99
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
101
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
100
102
  -H "Content-Type: application/json" \
101
103
  -d "$(jq -cn \
102
104
  --arg session "$session_id" \
@@ -3,6 +3,8 @@ name: mastermind-sales
3
3
  description: Mastermind sales domain — outreach sequences, proposals, pipeline management. Default mode: confirm.
4
4
  ---
5
5
 
6
+ **First — extract repeat flags:** Follow the REPEAT PREAMBLE from `_repeat.md`. Extracts `--repeat`, `--tillend`, `--maxruns`, `--wait`, `--rep`, `--loop` from `$ARGUMENTS` before all other parsing. If `is_continuation = true`, skip the empty-prompt check and intake below.
7
+
6
8
  Parse `$ARGUMENTS` for:
7
9
  - `--auto` flag → mode = auto
8
10
  - `--confirm` flag → mode = confirm
@@ -20,3 +22,5 @@ Default mode for this command: **confirm** (unless `--auto` flag present or inta
20
22
  Invoke `Skill("mastermind:sales")` passing: brain_context, prompt, project_name, board_id (create if needed), mode.
21
23
 
22
24
  After skill returns: follow _protocol.md Brain Write Procedure for domain `sales`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: mastermind-techport
3
3
  description: Tech Port — deep-analyzes a foreign project folder and recommends porting valuable features, patterns, or infrastructure into the current monomind base project.
4
4
  ---
5
5
 
6
+ **First — extract repeat flags:** Follow the REPEAT PREAMBLE from `_repeat.md`. Extracts `--repeat`, `--tillend`, `--maxruns`, `--wait`, `--rep`, `--loop` from `$ARGUMENTS` before all other parsing. If `is_continuation = true`, skip the empty-prompt check below.
7
+
6
8
  Parse `$ARGUMENTS` for:
7
9
  - First path-like token (starts with `/`, `./`, `../`, or `~`) → source_path
8
10
  - `--auto` flag → mode = auto (port immediately after analysis)
@@ -14,4 +16,11 @@ If source_path is empty: ask "What is the path to the project you want to analyz
14
16
 
15
17
  Default mode: **confirm** (show analysis + port plan, wait before executing anything).
16
18
 
19
+ > **Note for `--tillend` / `--repeat` loops:** This command defaults to `--confirm`, which presents a plan but doesn't execute it. In an unattended loop, this means each run will find items (findings = yes) but take no action (actions = no), so `TILLEND_EMPTY` never becomes true and the loop runs until the safety cap. Always add `--auto` when using this command in a loop:
20
+ > ```
21
+ > /mastermind:techport --tillend --auto /path/to/project
22
+ > ```
23
+
17
24
  Invoke `Skill("mastermind:techport")` passing: source_path, focus_hint, mode.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,9 +3,13 @@ name: monomind:do
3
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
+ ## Repeat Flag Extraction
7
+
8
+ **Before all other parsing:** Extract and discard `--repeat`, `--tillend`, `--maxruns`, `--wait` from `$ARGUMENTS` so they don't interfere with the command's own argument parser. `monomind:do` manages its own task-board-driven loop internally (see end of command) — the REPEAT POSTAMBLE is NOT used. To wrap this command with an external loop, use `/monomind:repeat -- /monomind:do ...`.
9
+
6
10
  ## Argument Parsing
7
11
 
8
- Parse `$ARGUMENTS` for the following flags (in any order):
12
+ Parse remaining `$ARGUMENTS` for the following flags (in any order):
9
13
 
10
14
  - `--space <SPACE_ID>` — use this space directly (skip space discovery)
11
15
  - `--board <BOARD_ID>` — use this task board directly (skip board discovery)
@@ -3,6 +3,8 @@ name: monomind:idea
3
3
  description: "Monomind — Research ideas from a prompt, evaluate them, and decompose into subtasks on monotask boards"
4
4
  ---
5
5
 
6
+ **First — extract repeat flags:** Follow the REPEAT PREAMBLE from `_repeat.md`. Extracts `--repeat`, `--tillend`, `--maxruns`, `--wait`, `--rep`, `--loop` from `$ARGUMENTS` before all other parsing. If `is_continuation = true`, skip the empty-arguments check below.
7
+
6
8
  If `$ARGUMENTS` is empty, output this and STOP:
7
9
 
8
10
  > **Usage:** `/monomind:idea <prompt>`
@@ -266,4 +268,6 @@ If there are tasks in Todo, offer:
266
268
  Skill("monomind:do", "--space $SPACE_ID --board $TASK_BOARD_ID --mode <parallel|minimal|sequential>")
267
269
  ```
268
270
 
269
- To repeat this command on a schedule, wrap it with `/monomind:repeat`.
271
+ To repeat this command on a schedule, wrap it with `/monomind:repeat` or use `--repeat N` / `--tillend` directly.
272
+
273
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: monomind:improve
3
3
  description: "Monomind — Deeply analyze a project component, research improvements online, and create improvement tasks on monotask boards"
4
4
  ---
5
5
 
6
+ **First — extract repeat flags:** Follow the REPEAT PREAMBLE from `_repeat.md`. Extracts `--repeat`, `--tillend`, `--maxruns`, `--wait`, `--rep`, `--loop` from `$ARGUMENTS` before all other parsing. If `is_continuation = true`, skip the empty-arguments check below.
7
+
6
8
  If `$ARGUMENTS` is empty, output this and STOP:
7
9
 
8
10
  > **Usage:** `/monomind:improve <component or concept>`
@@ -343,4 +345,6 @@ If there are tasks in Todo, offer:
343
345
  Skill("monomind:do", "--space $SPACE_ID --board $TASK_BOARD_ID --mode <parallel|minimal|sequential>")
344
346
  ```
345
347
 
346
- To repeat this command on a schedule, wrap it with `/monomind:repeat`.
348
+ To repeat this command on a schedule, wrap it with `/monomind:repeat` or use `--repeat N` / `--tillend` directly.
349
+
350
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.