@monoes/monomindcli 1.9.17 → 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 +63 -37
  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 +28 -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 +250 -122
  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
@@ -5,7 +5,7 @@ description: Shared inter-session repeat protocol. Referenced by mastermind and
5
5
 
6
6
  ## Shared Repeat Protocol
7
7
 
8
- Adds `--repeat <N> --wait <seconds>` inter-session looping to any command. Uses `ScheduleWakeup` to pause between runs and `.monomind/loops/<id>.json` for dashboard tracking.
8
+ Adds `--repeat <N> --wait <seconds>` and `--tillend --wait <seconds>` inter-session looping to any command. Uses `ScheduleWakeup` to pause between runs and `.monomind/loops/<id>.json` for dashboard tracking.
9
9
 
10
10
  ---
11
11
 
@@ -20,10 +20,14 @@ Extract and remove these flags from `$ARGUMENTS` before passing the remainder to
20
20
  | Flag | Variable | Default | Notes |
21
21
  |---|---|---|---|
22
22
  | `--repeat <N>` | `repeat_count` | `0` | N ≥ 2 activates repeat; N < 2 = disabled |
23
+ | `--tillend` | `tillend_mode` | `false` | Run until empty round (no findings, no actions). Overrides --repeat. |
24
+ | `--maxruns <N>` | `tillend_maxruns` | `50` | Safety cap for --tillend; stops after N runs even if AI hasn't signaled done |
23
25
  | `--wait <seconds>` | `wait_seconds` | `60` | Minimum 60 (enforced by ScheduleWakeup) |
24
26
  | `--rep <N>` | `current_rep` | absent | Internal; injected by ScheduleWakeup on continuation runs |
25
27
  | `--loop <id>` | `loop_id` | absent | Internal; preserves loop identity across runs |
26
28
 
29
+ If both `--tillend` and `--repeat <N>` are present, `--tillend` takes precedence.
30
+
27
31
  ### 2. If `--rep N` is present (continuation run)
28
32
 
29
33
  - Set `current_rep` = N, `loop_id` from `--loop <id>`
@@ -47,7 +51,8 @@ fi
47
51
  ```
48
52
 
49
53
  **If `LOOP_HIL_PENDING=true` (HIL file exists but unanswered):**
50
- - Output: `[repeat] Loop paused before run <current_rep>/<repeat_count>: waiting for human responses in ${HIL_FILE}.`
54
+ - Output (tillend mode): `[tillend] Loop paused before run <current_rep>: waiting for human responses in ${HIL_FILE}.`
55
+ - Output (fixed-count mode): `[repeat] Loop paused before run <current_rep>/<repeat_count>: waiting for human responses in ${HIL_FILE}.`
51
56
  - Update state file:
52
57
  ```bash
53
58
  python3 -c "import json; f='.monomind/loops/${LOOP_ID}.json'; d=json.load(open(f)); d['status']='hil:pending'; open(f,'w').write(json.dumps(d,indent=2))" 2>/dev/null \
@@ -55,14 +60,16 @@ fi
55
60
  ```
56
61
  - Emit `loop:hil:waiting`:
57
62
  ```bash
58
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
63
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
64
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
65
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
59
66
  -H "Content-Type: application/json" \
60
67
  -d "{\"type\":\"loop:hil:waiting\",\"loopId\":\"${LOOP_ID}\",\"hilFile\":\"${HIL_FILE}\",\"rep\":<current_rep>,\"ts\":$(date +%s)000}" || true
61
68
  ```
62
69
  - Re-schedule a check (not a full run) using ScheduleWakeup:
63
70
  - `delaySeconds`: `min(wait_seconds, 300)` — check at most every 5 minutes
64
71
  - `prompt`: same full continuation prompt (same `--rep <N>`)
65
- - `reason`: `"HIL pending for /<command> run <current_rep>/<repeat_count> — re-checking"`
72
+ - `reason`: tillend mode: `"HIL pending for /<command> tillend run <current_rep> — re-checking"` / fixed-count: `"HIL pending for /<command> run <current_rep>/<repeat_count> — re-checking"`
66
73
  - STOP. Do not execute the command yet.
67
74
 
68
75
  **If `LOOP_HIL_ANSWERED=true` (human responded):**
@@ -70,7 +77,9 @@ fi
70
77
  - Archive: `mv "$HIL_FILE" ".monomind/loops/${LOOP_ID}-hil-resolved-$(date +%s).md"`
71
78
  - Emit `loop:hil:resolved`:
72
79
  ```bash
73
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
80
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
81
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
82
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
74
83
  -H "Content-Type: application/json" \
75
84
  -d "{\"type\":\"loop:hil:resolved\",\"loopId\":\"${LOOP_ID}\",\"rep\":<current_rep>,\"ts\":$(date +%s)000}" || true
76
85
  ```
@@ -79,11 +88,21 @@ fi
79
88
  python3 -c "import json; f='.monomind/loops/${LOOP_ID}.json'; d=json.load(open(f)); d['status']='running'; open(f,'w').write(json.dumps(d,indent=2))" 2>/dev/null \
80
89
  || jq '.status="running"' ".monomind/loops/${LOOP_ID}.json" > ".monomind/loops/${LOOP_ID}.json.tmp" && mv ".monomind/loops/${LOOP_ID}.json.tmp" ".monomind/loops/${LOOP_ID}.json" 2>/dev/null || true
81
90
  ```
82
- - Proceed to execute the command (output: `[repeat] Run <current_rep>/<repeat_count> of /<command> starting...`)
91
+ - Proceed to execute the command:
92
+ - Tillend mode: `[tillend] Run <current_rep> of /<command> starting...`
93
+ - Fixed-count: `[repeat] Run <current_rep>/<repeat_count> of /<command> starting...`
94
+
95
+ **If no HIL file:**
96
+ - Tillend mode: `[tillend] Run <current_rep> of /<command> starting...`
97
+ - Fixed-count: `[repeat] Run <current_rep>/<repeat_count> of /<command> starting...`
98
+
99
+ Proceed to the command's core logic.
100
+
101
+ ### 3. If `--rep` is absent — first run
83
102
 
84
- **If no HIL file:** Output: `[repeat] Run <current_rep>/<repeat_count> of /<command> starting...` and proceed to the command's core logic.
103
+ **Branch A: `tillend_mode = true`** OR **Branch B: `repeat_count 2`**
85
104
 
86
- ### 3. If `--rep` is absent and `repeat_count 2` (first run)
105
+ If neither condition is true, skip to Section 4.
87
106
 
88
107
  1. Generate loop ID and write state file:
89
108
  ```bash
@@ -91,11 +110,37 @@ fi
91
110
  # Portable millisecond timestamp (BSD date has no %N; GNU date has %3N)
92
111
  NOW_MS=$(python3 -c 'import time;print(int(time.time()*1000))' 2>/dev/null || echo "$(date +%s)000")
93
112
  LOOP_ID="<command_slug>-${NOW_MS}"
94
- # Dashboard expects interval in MINUTES (rounded), maxReps as the total run count
113
+ # Dashboard expects interval in MINUTES (rounded)
95
114
  INTERVAL_MIN=$(( (<wait_seconds> + 30) / 60 ))
96
115
  PROMPT_JSON=$(printf '%s' "<prompt>" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))" 2>/dev/null \
97
116
  || printf '%s' "<prompt>" | node -e "process.stdout.write(JSON.stringify(require('fs').readFileSync('/dev/stdin','utf8')))" 2>/dev/null \
98
117
  || printf '"%s"' "$(printf '%s' "<prompt>" | sed 's/\\/\\\\/g; s/"/\\"/g; s/$/\\n/g' | tr -d '\n' | sed 's/\\n$//')")
118
+ ```
119
+
120
+ **If `tillend_mode = true`:**
121
+ ```bash
122
+ cat > ".monomind/loops/${LOOP_ID}.json" << EOF
123
+ {
124
+ "id": "${LOOP_ID}",
125
+ "sessionId": "${LOOP_ID}",
126
+ "type": "tillend",
127
+ "command": "/<command>",
128
+ "prompt": ${PROMPT_JSON},
129
+ "maxReps": <tillend_maxruns>,
130
+ "interval": ${INTERVAL_MIN},
131
+ "wait": <wait_seconds>,
132
+ "currentRep": 1,
133
+ "startedAt": ${NOW_MS},
134
+ "lastRunAt": ${NOW_MS},
135
+ "nextRunAt": ${NOW_MS},
136
+ "status": "running",
137
+ "source": "_repeat.md"
138
+ }
139
+ EOF
140
+ ```
141
+
142
+ **If `repeat_count ≥ 2` (fixed-count mode):**
143
+ ```bash
99
144
  cat > ".monomind/loops/${LOOP_ID}.json" << EOF
100
145
  {
101
146
  "id": "${LOOP_ID}",
@@ -118,15 +163,21 @@ fi
118
163
 
119
164
  2. Emit `loop:start` to dashboard (failure is non-fatal):
120
165
  ```bash
121
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
166
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
167
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
168
+ # For tillend mode, repeat field is the safety cap
169
+ REPEAT_VAL=$( [ "<tillend_mode>" = "true" ] && echo "<tillend_maxruns>(cap)" || echo "<repeat_count>" )
170
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
122
171
  -H "Content-Type: application/json" \
123
- -d "{\"type\":\"loop:start\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"repeat\":<repeat_count>,\"wait\":<wait_seconds>,\"ts\":$(date +%s)000}" || true
172
+ -d "{\"type\":\"loop:start\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"mode\":\"$( [ '<tillend_mode>' = 'true' ] && echo 'tillend' || echo 'repeat' )\",\"repeat\":\"${REPEAT_VAL}\",\"wait\":<wait_seconds>,\"ts\":$(date +%s)000}" || true
124
173
  ```
125
174
 
126
175
  3. Set `current_rep` = 1, `is_continuation` = false
127
- 4. Output: `[repeat] Starting <repeat_count> runs of /<command> (<wait_seconds>s between each). Run 1/<repeat_count>...`
176
+ 4. Output:
177
+ - **tillend mode**: `[tillend] Starting tillend loop for /<command> (runs until empty round, safety cap: <tillend_maxruns>, <wait_seconds>s between runs). Run 1...`
178
+ - **fixed-count mode**: `[repeat] Starting <repeat_count> runs of /<command> (<wait_seconds>s between each). Run 1/<repeat_count>...`
128
179
 
129
- ### 4. If `repeat_count < 2`
180
+ ### 4. If neither `tillend_mode` nor `repeat_count 2`
130
181
 
131
182
  No repeat behavior. Proceed normally. The REPEAT POSTAMBLE is a no-op.
132
183
 
@@ -136,7 +187,7 @@ No repeat behavior. Proceed normally. The REPEAT POSTAMBLE is a no-op.
136
187
 
137
188
  Apply after the command's core logic fully completes (after skill returns, after final step, etc.).
138
189
 
139
- **If `repeat_count < 2`:** skip this section entirely.
190
+ **If neither `tillend_mode` nor `repeat_count 2`:** skip this section entirely.
140
191
 
141
192
  **Otherwise:**
142
193
 
@@ -153,7 +204,9 @@ If `REPEAT_STOP=true`:
153
204
 
154
205
  ### 2. Report this run complete
155
206
 
156
- Output: `[repeat] Run <current_rep>/<repeat_count> complete.`
207
+ Output:
208
+ - Tillend mode: `[tillend] Run <current_rep> complete.`
209
+ - Fixed-count: `[repeat] Run <current_rep>/<repeat_count> complete.`
157
210
 
158
211
  ### 3. Detect HIL items from this run
159
212
 
@@ -170,8 +223,10 @@ RECENT_HIL=$(find . -maxdepth 3 \( -name "humaninloop*.md" -o -name "humaninloop
170
223
  1. Write a loop HIL file aggregating all items:
171
224
  ```bash
172
225
  HIL_FILE=".monomind/loops/${LOOP_ID}-hil.md"
226
+ # Use run label appropriate to mode
227
+ RUN_LABEL=$( [ "<tillend_mode>" = "true" ] && echo "run <current_rep> (tillend)" || echo "run <current_rep>/<repeat_count>" )
173
228
  cat > "$HIL_FILE" << EOF
174
- # Human-in-Loop — /<command> run <current_rep>/<repeat_count>
229
+ # Human-in-Loop — /<command> ${RUN_LABEL}
175
230
  Loop: ${LOOP_ID}
176
231
  Created: $(date -u +"%Y-%m-%d %H:%M UTC")
177
232
  Status: pending
@@ -183,7 +238,7 @@ RECENT_HIL=$(find . -maxdepth 3 \( -name "humaninloop*.md" -o -name "humaninloop
183
238
  ## Instructions
184
239
 
185
240
  1. Open each file listed above and fill in **Your response** for each item.
186
- 2. Any non-empty response after a `> ` line is treated as "answered".
241
+ 2. Any non-empty response after a \`> \` line is treated as "answered".
187
242
  3. Once you have filled in at least one response, the loop will auto-resume on the next check.
188
243
 
189
244
  **Your answer (fill in to resume):**
@@ -199,52 +254,124 @@ RECENT_HIL=$(find . -maxdepth 3 \( -name "humaninloop*.md" -o -name "humaninloop
199
254
 
200
255
  3. Emit `loop:hil` to dashboard:
201
256
  ```bash
202
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
257
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
258
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
259
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
203
260
  -H "Content-Type: application/json" \
204
261
  -d "{\"type\":\"loop:hil\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"hilFile\":\"${HIL_FILE}\",\"rep\":<current_rep>,\"files\":$(echo "$RECENT_HIL" | grep -v '^$' | jq -R . | jq -cs .),\"ts\":$(date +%s)000}" || true
205
262
  ```
206
263
 
207
264
  4. Output:
208
265
  ```
209
- [repeat] Human-in-loop items detected from run <current_rep>/<repeat_count>.
266
+ [repeat] Human-in-loop items detected from run <current_rep>.
210
267
  Action required: open the files listed in ${HIL_FILE} and fill in responses.
211
268
  ```
212
269
 
213
- 5. Compute `next_rep = current_rep + 1`. Then branch on whether this was the last run:
270
+ 5. Compute `next_rep = current_rep + 1`. Build the HIL poll continuation prompt:
214
271
 
215
- **If `current_rep >= repeat_count`** (HIL detected on the final run — do not schedule another execution):
272
+ **If `tillend_mode = true`:**
273
+ - HIL continuation prompt: `/<command> --tillend --maxruns <tillend_maxruns> --wait <wait_seconds> --rep <next_rep> --loop ${LOOP_ID} <original prompt>`
274
+ - Output: `Loop will resume automatically once responses are provided.`
275
+ - `delaySeconds`: `min(wait_seconds, 300)`
276
+ - `reason`: `"HIL pending for /<command> tillend run <current_rep> — waiting for human response"`
277
+ - Schedule via `ScheduleWakeup` and STOP.
278
+
279
+ **If `current_rep >= repeat_count`** (HIL detected on the final fixed-count run):
216
280
  - Output: `[repeat] All <repeat_count> runs of /<command> complete (HIL items pending in ${HIL_FILE}).`
217
281
  - Emit `loop:complete`:
218
282
  ```bash
219
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
283
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
284
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
285
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
220
286
  -H "Content-Type: application/json" \
221
287
  -d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"ranReps\":<repeat_count>,\"hilPending\":true,\"ts\":$(date +%s)000}" || true
222
288
  ```
223
289
  - `rm -f ".monomind/loops/${LOOP_ID}.json"`
224
290
  - STOP. (HIL file remains for human review; loop is done.)
225
291
 
226
- **Otherwise** (HIL on an intermediate run — schedule a poll check):
292
+ **Otherwise** (HIL on an intermediate fixed-count run):
227
293
  - Output: `Loop will resume automatically at run <next_rep>/<repeat_count> once responses are provided.`
228
- - `delaySeconds`: `min(wait_seconds, 300)` — re-check every 5 min max while waiting
294
+ - `delaySeconds`: `min(wait_seconds, 300)`
229
295
  - `prompt`: `/<command> --repeat <repeat_count> --wait <wait_seconds> --rep <next_rep> --loop ${LOOP_ID} <original flags and prompt>`
230
296
  - `reason`: `"HIL pending for /<command> run <current_rep>/<repeat_count> — waiting for human response"`
231
- - Schedule via `ScheduleWakeup` and STOP. Do not proceed to "Schedule next run" below.
297
+ - Schedule via `ScheduleWakeup` and STOP.
298
+
299
+ **If `RECENT_HIL` is empty:** proceed to section 4.
300
+
301
+ ---
302
+
303
+ ### 4. Tillend completion check (tillend mode only)
304
+
305
+ **Skip this section if `tillend_mode` is not true.** Proceed to section 5.
306
+
307
+ After each run in tillend mode, evaluate whether this run produced **zero findings and zero actions**. The loop stops only when a complete round finds nothing new and makes no changes — not when the AI predicts there is nothing left.
308
+
309
+ **You (the AI running the loop) must now assess your own output from this run.** Answer these two questions:
310
+
311
+ 1. **Were any findings produced?** — issues found, problems detected, items identified, things flagged, errors reported, tasks discovered, security vulnerabilities found, etc.
312
+ 2. **Were any actions taken?** — files edited, code fixed, tasks created, cards moved, commits made, content written, configs changed, etc.
313
+
314
+ **Set `TILLEND_EMPTY=true` only if BOTH answers are "no" — zero findings AND zero actions this round.**
315
+
316
+ **Important:** If this round found things AND fixed them all, `TILLEND_EMPTY=false`. The loop must run once more to verify the fixes didn't introduce new issues. A "clean" prediction after a productive round is not enough — only an actually empty round stops the loop.
317
+
318
+ **If `TILLEND_EMPTY=true` (round produced nothing):**
319
+ - Output:
320
+ ```
321
+ [tillend] Empty round — nothing found, nothing changed in run <current_rep>.
322
+ /<command> tillend loop complete (ran <current_rep> run(s)).
323
+ ```
324
+ - Emit `loop:complete`:
325
+ ```bash
326
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
327
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
328
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
329
+ -H "Content-Type: application/json" \
330
+ -d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"mode\":\"tillend\",\"ranReps\":<current_rep>,\"reason\":\"empty-round\",\"ts\":$(date +%s)000}" || true
331
+ ```
332
+ - `rm -f ".monomind/loops/${LOOP_ID}.json"`
333
+ - STOP.
232
334
 
233
- **If `RECENT_HIL` is empty:** proceed to step 4 (schedule next run normally).
335
+ **If `current_rep >= tillend_maxruns` (safety cap reached):**
336
+ - Output:
337
+ ```
338
+ [tillend] Safety cap reached (<tillend_maxruns> runs). Stopping loop.
339
+ If work is still incomplete, re-run: /<command> --tillend --maxruns <N> --wait <wait_seconds> <prompt>
340
+ ```
341
+ - Emit `loop:complete`:
342
+ ```bash
343
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
344
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
345
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
346
+ -H "Content-Type: application/json" \
347
+ -d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"mode\":\"tillend\",\"ranReps\":<current_rep>,\"reason\":\"safety-cap\",\"ts\":$(date +%s)000}" || true
348
+ ```
349
+ - `rm -f ".monomind/loops/${LOOP_ID}.json"`
350
+ - STOP.
234
351
 
235
- ### 4. If all runs done (`current_rep ≥ repeat_count`)
352
+ **Otherwise (`TILLEND_EMPTY=false` and cap not reached):**
353
+ - Output: `[tillend] Run <current_rep> produced work (findings or actions). Continuing...`
354
+ - Proceed to section 5 to schedule the next run.
355
+
356
+ ---
357
+
358
+ ### 5. Fixed-count: check if all runs done (`current_rep ≥ repeat_count`)
359
+
360
+ **Skip this section if `tillend_mode = true`** (tillend has no fixed count; section 4 handles its termination).
236
361
 
237
362
  - Output: `[repeat] All <repeat_count> runs of /<command> complete.`
238
363
  - `rm -f ".monomind/loops/${LOOP_ID}.json"`
239
364
  - Emit `loop:complete`:
240
365
  ```bash
241
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
366
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
367
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
368
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
242
369
  -H "Content-Type: application/json" \
243
370
  -d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"ranReps\":<repeat_count>,\"ts\":$(date +%s)000}" || true
244
371
  ```
245
372
  - STOP (do not schedule another run).
246
373
 
247
- ### 5. Schedule next run
374
+ ### 6. Schedule next run
248
375
 
249
376
  Set `next_rep` = current_rep + 1.
250
377
 
@@ -254,6 +381,8 @@ Update state file (read `prompt` and `startedAt` from the existing file to prese
254
381
  NOW_MS=$(python3 -c 'import time;print(int(time.time()*1000))' 2>/dev/null || echo "$(date +%s)000")
255
382
  NEXT_AT=$(( NOW_MS + <wait_seconds> * 1000 ))
256
383
  INTERVAL_MIN=$(( (<wait_seconds> + 30) / 60 ))
384
+ LOOP_TYPE=$( [ "<tillend_mode>" = "true" ] && echo "tillend" || echo "repeat" )
385
+ MAX_REPS=$( [ "<tillend_mode>" = "true" ] && echo "<tillend_maxruns>" || echo "<repeat_count>" )
257
386
  PROMPT_JSON=$(jq '.prompt' ".monomind/loops/${LOOP_ID}.json" 2>/dev/null \
258
387
  || python3 -c "import json,sys; json.dump(json.load(open('.monomind/loops/${LOOP_ID}.json'))['prompt'], sys.stdout)" 2>/dev/null \
259
388
  || echo '"<prompt>"')
@@ -264,10 +393,10 @@ cat > ".monomind/loops/${LOOP_ID}.json" << EOF
264
393
  {
265
394
  "id": "${LOOP_ID}",
266
395
  "sessionId": "${LOOP_ID}",
267
- "type": "repeat",
396
+ "type": "${LOOP_TYPE}",
268
397
  "command": "/<command>",
269
398
  "prompt": ${PROMPT_JSON},
270
- "maxReps": <repeat_count>,
399
+ "maxReps": ${MAX_REPS},
271
400
  "interval": ${INTERVAL_MIN},
272
401
  "wait": <wait_seconds>,
273
402
  "currentRep": <next_rep>,
@@ -282,27 +411,41 @@ EOF
282
411
 
283
412
  Emit `loop:tick`:
284
413
  ```bash
285
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
414
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
415
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
416
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
286
417
  -H "Content-Type: application/json" \
287
- -d "{\"type\":\"loop:tick\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"completedRep\":<current_rep>,\"nextRep\":<next_rep>,\"nextAt\":${NEXT_AT},\"ts\":$(date +%s)000}" || true
418
+ -d "{\"type\":\"loop:tick\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"mode\":\"${LOOP_TYPE}\",\"completedRep\":<current_rep>,\"nextRep\":<next_rep>,\"nextAt\":${NEXT_AT},\"ts\":$(date +%s)000}" || true
288
419
  ```
289
420
 
290
- Output: `[repeat] Next run in <wait_seconds>s (run <next_rep>/<repeat_count>)...`
421
+ **Output and ScheduleWakeup:**
422
+
423
+ **If `tillend_mode = true`:**
424
+ - Output: `[tillend] Work remains. Next run in <wait_seconds>s (run <next_rep>, cap: <tillend_maxruns>)...`
425
+ - `ScheduleWakeup`:
426
+ - `delaySeconds`: `<wait_seconds>`
427
+ - `prompt`: `/<command> --tillend --maxruns <tillend_maxruns> --wait <wait_seconds> --rep <next_rep> --loop ${LOOP_ID} <all original flags and prompt text, minus --rep and --loop>`
428
+ - `reason`: `"tillend run <next_rep> of /<command> (cap: <tillend_maxruns>)"`
291
429
 
292
- Call `ScheduleWakeup`:
293
- - `delaySeconds`: `<wait_seconds>` (runtime clamps to minimum 60)
294
- - `prompt`: `/<command> --repeat <repeat_count> --wait <wait_seconds> --rep <next_rep> --loop ${LOOP_ID} <all original flags and prompt text, minus --rep and --loop>`
295
- - `reason`: `"repeat run <next_rep>/<repeat_count> of /<command>"`
430
+ **If fixed-count mode:**
431
+ - Output: `[repeat] Next run in <wait_seconds>s (run <next_rep>/<repeat_count>)...`
432
+ - `ScheduleWakeup`:
433
+ - `delaySeconds`: `<wait_seconds>`
434
+ - `prompt`: `/<command> --repeat <repeat_count> --wait <wait_seconds> --rep <next_rep> --loop ${LOOP_ID} <all original flags and prompt text, minus --rep and --loop>`
435
+ - `reason`: `"repeat run <next_rep>/<repeat_count> of /<command>"`
296
436
 
297
437
  ---
298
438
 
299
439
  ## Notes for Calling Commands
300
440
 
301
441
  - **`<command_slug>`**: lowercase command name without namespace (`build` for `/mastermind:build`, `monomind-idea` for `/monomind:idea`)
302
- - **Dashboard**: the monomind panel reads `.monomind/loops/*.json` to show active repeat loops; HIL status shows as `"hil:pending"` in the status field
442
+ - **Dashboard**: the monomind panel reads `.monomind/loops/*.json`; `type` field is `"repeat"` or `"tillend"`; HIL status shows as `"hil:pending"`
303
443
  - **Stopping a loop**: create `.monomind/loops/${LOOP_ID}.stop` or delete the `.json` file; the next wake-up detects it
304
444
  - **`wait_seconds` < 60**: ScheduleWakeup clamps to 60; the state file may reflect the user's requested value
305
445
  - **Continuation runs skip intake**: calling commands check `is_continuation` and bypass empty-prompt checks and vague-prompt intake
306
446
  - **HIL file naming**: commands write `humaninloop*.md` or `humaninloopreview*.md`; the repeat protocol detects these automatically via `find` — no changes needed in individual commands
307
447
  - **HIL resume**: the human fills in any `> ` answer line in the HIL files; the next check detects this via `grep -cE "^[[:space:]]*>[[:space:]]+[^[:space:]]"` and resumes the loop
308
448
  - **HIL check interval**: while HIL is pending, ScheduleWakeup fires every `min(wait_seconds, 300)` seconds to poll; this is transparent to the user
449
+ - **`--tillend` termination**: the loop stops only when a complete round produces ZERO findings AND ZERO actions. If the round found+fixed things, it continues — even if the AI predicts "all done". Only a genuinely empty verification round stops the loop. `reason: "empty-round"` in the `loop:complete` event.
450
+ - **`--tillend` safety cap**: default 50 runs. Override with `--maxruns <N>`. Always emit a warning when stopping on cap so user knows to re-run if needed
451
+ - **Combining flags**: `--tillend` overrides `--repeat N` if both are present. `--maxruns` only applies to `--tillend`
@@ -3,6 +3,8 @@ name: mastermind-architect
3
3
  description: Mastermind architect domain — architecture review, file structure deduplication, coupling analysis, design pattern audit, DDD mapping, and system design. 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 (default)
@@ -20,21 +22,23 @@ Run intake if prompt is vague (follow _intake.md — stop at Q3, domain is alrea
20
22
 
21
23
  Default mode for this command: **confirm** (show architecture plan before executing, unless `--auto` flag present).
22
24
 
23
- Generate a session ID: take the current UTC datetime formatted as `YYYYMMDDTHHmmss` and prefix with `mm-` (e.g. `mm-20260506T142345`)
25
+ Generate a session ID and resolve the dashboard URL:
26
+ ```bash
27
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
28
+ sessionId="mm-$(date -u +%Y%m%dT%H%M%S)"
29
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
30
+ ```
24
31
 
25
- Emit `session:start` before invoking the skill using WebFetch (handles prompt encoding safely for any characters):
26
- ```javascript
27
- WebFetch({
28
- url: "http://localhost:4242/api/mastermind/event",
29
- method: "POST",
30
- headers: { "Content-Type": "application/json" },
31
- body: JSON.stringify({ type: "session:start", session: sessionId, domain: "architect", prompt: prompt, ts: Date.now() })
32
- })
32
+ Emit `session:start` before invoking the skill (use curl WebFetch is blocked for localhost in Claude Code runtimes). Before executing the curl below, substitute the generated sessionId for `<sessionId>`:
33
+ ```bash
34
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
35
+ -H "Content-Type: application/json" \
36
+ -d '{"type":"session:start","session":"<sessionId>","domain":"architect","prompt":'"$(jq -Rn --arg p "$prompt" '$p')"',"ts":'"$(date +%s)"'000}' || true
33
37
  ```
34
38
 
35
39
  Emit `domain:dispatch` immediately after session:start. Before executing the curl below, substitute the generated sessionId for `<sessionId>`:
36
40
  ```bash
37
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
41
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
38
42
  -H "Content-Type: application/json" \
39
43
  -d '{"type":"domain:dispatch","session":"<sessionId>","domain":"architect","ts":'"$(date +%s)"'000}' || true
40
44
  ```
@@ -43,7 +47,9 @@ Invoke `Skill("mastermind:architect")` passing: brain_context, prompt, project_n
43
47
 
44
48
  After skill returns: note the status from the skill's output (`complete`, `partial`, or `blocked`). Emit `session:complete` using that status, then follow _protocol.md Brain Write Procedure for domain `architect`. Before executing the curl below, substitute the generated sessionId for `<sessionId>` and the skill's actual status for `<status>`:
45
49
  ```bash
46
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
50
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
47
51
  -H "Content-Type: application/json" \
48
52
  -d '{"type":"session:complete","session":"<sessionId>","domain":"architect","status":"<status>","domains":["architect"],"ts":'"$(date +%s)"'000}' || true
49
53
  ```
54
+
55
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: mastermind-brain
3
3
  description: Mastermind brain management — inspect, compact, refresh, and control the three-tier business memory (AgentDB + Monograph)
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.
7
+
6
8
  Parse `$ARGUMENTS` to determine the sub-command and flags.
7
9
 
8
10
  ## Sub-Commands
@@ -96,3 +98,5 @@ If `--confirm` is present:
96
98
 
97
99
  If `--confirm` is missing:
98
100
  > "This will permanently delete all brain memory for domain '<name>'. To confirm, run: `/mastermind:brain reset --domain <name> --confirm`"
101
+
102
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: mastermind-build
3
3
  description: Mastermind build domain — ship features, fix bugs, refactor code. Spawns a Development Manager who creates monotask tasks and coordinates specialized dev agents. 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:build")` 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 `build`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: mastermind-content
3
3
  description: Mastermind content domain — blog posts, threads, docs, newsletters. 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:content")` 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 `content`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -56,12 +56,14 @@ Load brain context for the `ops` domain (follow _protocol.md Brain Load Procedur
56
56
 
57
57
  Generate a session ID as a real shell variable:
58
58
  ```bash
59
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
59
60
  session_id="mm-$(date -u +%Y%m%dT%H%M%S)"
61
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
60
62
  ```
61
63
 
62
64
  Emit `session:start` to dashboard:
63
65
  ```bash
64
- curl -s -X POST "http://localhost:4242/api/mastermind/event" \
66
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
65
67
  -H "Content-Type: application/json" \
66
68
  -d "$(jq -cn \
67
69
  --arg session "$session_id" \
@@ -73,7 +75,7 @@ curl -s -X POST "http://localhost:4242/api/mastermind/event" \
73
75
 
74
76
  Emit `domain:dispatch`:
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 @@ Invoke `Skill("mastermind:createorg")` passing: brain_context, prompt, org_name,
84
86
 
85
87
  After skill returns: note the status (`complete`, `partial`, or `blocked`). Emit `session:complete`:
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" \
@@ -3,6 +3,8 @@ name: mastermind-finance
3
3
  description: Mastermind finance domain — invoicing, budget tracking, financial forecasting. 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:finance")` 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 `finance`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: mastermind-idea
3
3
  description: Mastermind idea domain — brainstorm products, features, pivots. 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:idea")` 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 `idea`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.
@@ -3,6 +3,8 @@ name: mastermind-marketing
3
3
  description: Mastermind marketing domain — campaigns, copy, SEO, social media. 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:marketing")` 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 `marketing`.
25
+
26
+ Follow the REPEAT POSTAMBLE from `_repeat.md`.