monomind 2.3.2 → 2.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +37 -4
  2. package/package.json +1 -1
  3. package/packages/@monomind/cli/.claude/commands/mastermind/_repeat.md +9 -9
  4. package/packages/@monomind/cli/.claude/commands/mastermind/{approve.md → approvev1.md} +14 -11
  5. package/packages/@monomind/cli/.claude/commands/mastermind/architect.md +3 -3
  6. package/packages/@monomind/cli/.claude/commands/mastermind/createorg.md +4 -4
  7. package/packages/@monomind/cli/.claude/commands/mastermind/help.md +18 -0
  8. package/packages/@monomind/cli/.claude/commands/mastermind/master.md +6 -6
  9. package/packages/@monomind/cli/.claude/commands/mastermind/repeat.md +5 -5
  10. package/packages/@monomind/cli/.claude/commands/mastermind/runorg.md +20 -108
  11. package/packages/@monomind/cli/.claude/commands/mastermind/runorgv1.md +159 -0
  12. package/packages/@monomind/cli/.claude/commands/mastermind/stoporg.md +1 -1
  13. package/packages/@monomind/cli/.claude/helpers/control-start.cjs +52 -4
  14. package/packages/@monomind/cli/.claude/helpers/event-logger.cjs +9 -1
  15. package/packages/@monomind/cli/.claude/helpers/handlers/capture-handler.cjs +9 -1
  16. package/packages/@monomind/cli/.claude/helpers/handlers/route-handler.cjs +88 -15
  17. package/packages/@monomind/cli/.claude/helpers/handlers/session-restore-handler.cjs +25 -18
  18. package/packages/@monomind/cli/.claude/skills/mastermind-skills/_protocol.md +1 -1
  19. package/packages/@monomind/cli/.claude/skills/mastermind-skills/_repeat.md +3 -3
  20. package/packages/@monomind/cli/.claude/skills/mastermind-skills/adapters.md +1 -1
  21. package/packages/@monomind/cli/.claude/skills/mastermind-skills/agents.md +6 -2
  22. package/packages/@monomind/cli/.claude/skills/mastermind-skills/{approve.md → approvev1.md} +8 -5
  23. package/packages/@monomind/cli/.claude/skills/mastermind-skills/architect.md +8 -8
  24. package/packages/@monomind/cli/.claude/skills/mastermind-skills/backup.md +1 -1
  25. package/packages/@monomind/cli/.claude/skills/mastermind-skills/bootstrap.md +1 -1
  26. package/packages/@monomind/cli/.claude/skills/mastermind-skills/costs.md +1 -1
  27. package/packages/@monomind/cli/.claude/skills/mastermind-skills/env.md +7 -2
  28. package/packages/@monomind/cli/.claude/skills/mastermind-skills/{heartbeat.md → heartbeatv1.md} +9 -6
  29. package/packages/@monomind/cli/.claude/skills/mastermind-skills/idea.md +1 -1
  30. package/packages/@monomind/cli/.claude/skills/mastermind-skills/inbox.md +14 -2
  31. package/packages/@monomind/cli/.claude/skills/mastermind-skills/instance.md +3 -1
  32. package/packages/@monomind/cli/.claude/skills/mastermind-skills/monitor.md +2 -2
  33. package/packages/@monomind/cli/.claude/skills/mastermind-skills/org-settings.md +5 -2
  34. package/packages/@monomind/cli/.claude/skills/mastermind-skills/orgs.md +14 -13
  35. package/packages/@monomind/cli/.claude/skills/mastermind-skills/orgstatus.md +19 -8
  36. package/packages/@monomind/cli/.claude/skills/mastermind-skills/plugins.md +1 -1
  37. package/packages/@monomind/cli/.claude/skills/mastermind-skills/projects.md +3 -0
  38. package/packages/@monomind/cli/.claude/skills/mastermind-skills/runorg.md +37 -719
  39. package/packages/@monomind/cli/.claude/skills/mastermind-skills/runorgv1.md +731 -0
  40. package/packages/@monomind/cli/.claude/skills/mastermind-skills/stoporg.md +12 -5
  41. package/packages/@monomind/cli/.claude/skills/mastermind-skills/tasks.md +4 -1
  42. package/packages/@monomind/cli/README.md +37 -4
  43. package/packages/@monomind/cli/dist/src/commands/cleanup.js +30 -8
  44. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +23 -10
  45. package/packages/@monomind/cli/dist/src/commands/org-observe.js +30 -26
  46. package/packages/@monomind/cli/dist/src/commands/org.js +52 -2
  47. package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.js +0 -0
  48. package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +31 -12
  49. package/packages/@monomind/cli/dist/src/orgrt/daemon.js +45 -9
  50. package/packages/@monomind/cli/dist/src/orgrt/mailbox.d.ts +23 -0
  51. package/packages/@monomind/cli/dist/src/orgrt/mailbox.js +33 -1
  52. package/packages/@monomind/cli/dist/src/orgrt/migrate.d.ts +26 -0
  53. package/packages/@monomind/cli/dist/src/orgrt/migrate.js +111 -0
  54. package/packages/@monomind/cli/dist/src/orgrt/reporting.js +8 -1
  55. package/packages/@monomind/cli/dist/src/orgrt/session.js +8 -2
  56. package/packages/@monomind/cli/dist/src/ui/dashboard.html +44 -0
  57. package/packages/@monomind/cli/dist/src/ui/orgs.html +2 -2
  58. package/packages/@monomind/cli/dist/src/ui/server.mjs +86 -0
  59. package/packages/@monomind/cli/package.json +2 -2
package/README.md CHANGED
@@ -102,11 +102,25 @@ monomind org run content-team --task "Build and publish 3 blog posts per week"
102
102
  # assigns work to role agents, coordinates until the task completes
103
103
  # or you stop it. Every event streams into the dashboard above.
104
104
 
105
- monomind org status content-team # runtime state
105
+ monomind org status content-team # runtime state (detects crashed daemons)
106
106
  monomind org stop content-team # request a graceful stop
107
- monomind org list # every org + status
107
+ monomind org list # every org + roles, schedule, status
108
108
  ```
109
109
 
110
+ ### Observe, steer, and let it learn
111
+
112
+ ```bash
113
+ monomind org logs content-team --follow # live event stream in the terminal
114
+ monomind org report content-team # outcome, per-role tokens vs budget, assets
115
+ monomind org questions content-team # what agents asked via ask_human
116
+ monomind org answer content-team q-123 "yes" # answer live or queued — no dashboard needed
117
+ monomind org create blog --template content-team --goal "3 posts/week" # scaffold from a template
118
+ monomind org validate blog # schema + structural checks before running
119
+ monomind org run blog --dry-run # preview each role's exact briefing
120
+ ```
121
+
122
+ Orgs are self-improving: the coordinator records every run's outcome (`org_complete`), the next run is briefed on it, and all agents can query accumulated cross-run memory with `org_recall` — a scheduled org gets smarter every cycle instead of starting cold. Crashed agent sessions restart automatically with backoff.
123
+
110
124
  ### What runs under the hood
111
125
 
112
126
  | What | How |
@@ -196,9 +210,28 @@ monomind org run my-team # run your first AI org (see .monomind/orgs/sa
196
210
 
197
211
  ---
198
212
 
213
+ ## 📚 Second Brain — Your Documents, Retrieved by Meaning
214
+
215
+ Drop documents (Markdown, TXT, PDF, DOCX) anywhere in your project and run `monomind init` — the Second Brain activates itself. No flags, no configuration, no accounts. Everything runs on your machine: a local embedding model (MiniLM via transformers.js) and a local SQLite vector store. **Your notes never leave your computer.**
216
+
217
+ From then on, every substantive prompt you type in Claude Code is automatically answered *with your own knowledge in context* — a hook retrieves the most relevant excerpts semantically (the always-on dashboard keeps the model warm, ~60ms per lookup) and injects them before Claude starts thinking. Ask "when do new parents get time off" and the parental-leave section of your handbook is already on the table, even though you never used the word "leave".
218
+
219
+ ```bash
220
+ monomind doc ingest ./notes # index documents (init + session-start do this automatically)
221
+ monomind doc search -q "pricing psychology in checkout" # semantic search, by meaning not keywords
222
+ monomind doc list # what's indexed
223
+ monomind doc export # portable OKF bundle — move your brain between machines
224
+ ```
225
+
226
+ Retrieval quality is a tested invariant, not a hope: a golden-set eval (paraphrase queries against notes written in different vocabulary) runs in CI with an 80% recall bar.
227
+
228
+ > **Privacy note:** the embedding model (~90MB) is fetched once from HuggingFace's CDN when your first document is indexed, then cached locally forever. That download is the only outbound request the Second Brain ever makes — your documents and queries never leave your machine. Offline at first index? Search degrades gracefully to keyword matching and `monomind doctor` tells you how to warm up later.
229
+
230
+ ---
231
+
199
232
  ## 🧠 Memory That Persists
200
233
 
201
- Every session, every agent, every org writes to a persistent memory store — a JSON pattern store with episodic recall that survives across sessions. The next time you run anything, Monomind already knows what was built, what failed, and which patterns work.
234
+ Every session, every agent, every org writes to a persistent memory store that survives across sessions text plus embedding vectors in local SQLite (better-sqlite3, pure-WASM fallback), embedded by a local model. No cloud vector database, no API keys, no data transmission. The next time you run anything, Monomind already knows what was built, what failed, and which patterns work.
202
235
 
203
236
  ```mermaid
204
237
  graph TD
@@ -217,7 +250,7 @@ graph TD
217
250
 
218
251
  ```bash
219
252
  monomind memory store "key insight" --namespace my-project
220
- monomind memory search "auth implementation" # BM25 + semantic hybrid
253
+ monomind memory search "auth implementation" # semantic (local embeddings) with keyword fallback
221
254
  ```
222
255
 
223
256
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monomind",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "description": "Open-source CLI extension for Claude Code. Adds an MCP server with a codebase knowledge graph, persistent memory, multi-agent coordination, and reusable slash commands. MIT licensed, runs locally, no data leaves your machine.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -80,7 +80,7 @@ fi
80
80
  ```bash
81
81
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
82
82
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
83
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
83
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
84
84
  -H "Content-Type: application/json" \
85
85
  -d "{\"type\":\"loop:hil:waiting\",\"loopId\":\"${LOOP_ID}\",\"hilFile\":\"${HIL_FILE}\",\"rep\":<current_rep>,\"ts\":$(date +%s)000}" || true
86
86
  ```
@@ -97,7 +97,7 @@ fi
97
97
  ```bash
98
98
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
99
99
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
100
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
100
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
101
101
  -H "Content-Type: application/json" \
102
102
  -d "{\"type\":\"loop:hil:resolved\",\"loopId\":\"${LOOP_ID}\",\"rep\":<current_rep>,\"ts\":$(date +%s)000}" || true
103
103
  ```
@@ -185,7 +185,7 @@ If neither condition is true, skip to Section 4.
185
185
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
186
186
  # For tillend mode, repeat field is the safety cap
187
187
  REPEAT_VAL=$( [ "<tillend_mode>" = "true" ] && echo "<tillend_maxruns>(cap)" || echo "<repeat_count>" )
188
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
188
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
189
189
  -H "Content-Type: application/json" \
190
190
  -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
191
191
  ```
@@ -274,7 +274,7 @@ RECENT_HIL=$(find . -maxdepth 3 \( -name "humaninloop*.md" -o -name "humaninloop
274
274
  ```bash
275
275
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
276
276
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
277
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
277
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
278
278
  -H "Content-Type: application/json" \
279
279
  -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
280
280
  ```
@@ -300,7 +300,7 @@ RECENT_HIL=$(find . -maxdepth 3 \( -name "humaninloop*.md" -o -name "humaninloop
300
300
  ```bash
301
301
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
302
302
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
303
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
303
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
304
304
  -H "Content-Type: application/json" \
305
305
  -d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"ranReps\":<repeat_count>,\"hilPending\":true,\"ts\":$(date +%s)000}" || true
306
306
  ```
@@ -364,7 +364,7 @@ Only if `GIT_CHANGES` was empty, answer these two questions about this run:
364
364
  ```bash
365
365
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
366
366
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
367
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
367
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
368
368
  -H "Content-Type: application/json" \
369
369
  -d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"mode\":\"tillend\",\"ranReps\":<current_rep>,\"reason\":\"empty-round\",\"ts\":$(date +%s)000}" || true
370
370
  ```
@@ -381,7 +381,7 @@ Only if `GIT_CHANGES` was empty, answer these two questions about this run:
381
381
  ```bash
382
382
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
383
383
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
384
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
384
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
385
385
  -H "Content-Type: application/json" \
386
386
  -d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"mode\":\"tillend\",\"ranReps\":<current_rep>,\"reason\":\"safety-cap\",\"ts\":$(date +%s)000}" || true
387
387
  ```
@@ -404,7 +404,7 @@ Only if `GIT_CHANGES` was empty, answer these two questions about this run:
404
404
  ```bash
405
405
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
406
406
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
407
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
407
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
408
408
  -H "Content-Type: application/json" \
409
409
  -d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"ranReps\":<repeat_count>,\"ts\":$(date +%s)000}" || true
410
410
  ```
@@ -452,7 +452,7 @@ Emit `loop:tick`:
452
452
  ```bash
453
453
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
454
454
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
455
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
455
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
456
456
  -H "Content-Type: application/json" \
457
457
  -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
458
458
  ```
@@ -1,20 +1,23 @@
1
- <!-- Review and action pending approval requests from agents in a running org. -->
1
+ <!-- LEGACY-ORG-V1 — Review and action pending approval requests from agents in a running v1 (prompt-orchestrated) org. Reach it only via /mastermind:approvev1. -->
2
+
3
+ > **LEGACY-ORG-V1 (2026-07): v2 approvals arrive as question events in the dashboard Human Input tab — no command needed.**
4
+ > This file-based approval queue applies only to v1 orgs not yet migrated off the `board_id`/`topology` config shape. Reach this legacy path only via `/mastermind:approvev1`.
2
5
 
3
6
  **If $ARGUMENTS is empty:** Output the following and wait.
4
7
 
5
8
  ---
6
9
 
7
- **MASTERMIND: APPROVE**
10
+ **MASTERMIND: APPROVE (v1, legacy)**
8
11
 
9
- Review and action pending approval requests from agents running inside an autonomous org. Agents request human approval before executing sensitive actions (publishing content, sending emails, making purchases, modifying infrastructure).
12
+ Review and action pending approval requests from agents running inside a v1 (prompt-orchestrated) autonomous org. Agents request human approval before executing sensitive actions (publishing content, sending emails, making purchases, modifying infrastructure). v2 orgs surface approvals directly in the dashboard Human Input tab — no command needed.
10
13
 
11
14
  **Usage:**
12
15
 
13
16
  ```
14
- /mastermind:approve --org <name> List all pending approvals
15
- /mastermind:approve --org <name> --action approve --id <id>
16
- /mastermind:approve --org <name> --action reject --id <id> --reason "Too risky"
17
- /mastermind:approve --org <name> --action inspect --id <id>
17
+ /mastermind:approvev1 --org <name> List all pending approvals
18
+ /mastermind:approvev1 --org <name> --action approve --id <id>
19
+ /mastermind:approvev1 --org <name> --action reject --id <id> --reason "Too risky"
20
+ /mastermind:approvev1 --org <name> --action inspect --id <id>
18
21
  ```
19
22
 
20
23
  **Options:**
@@ -23,7 +26,7 @@ Review and action pending approval requests from agents running inside an autono
23
26
  `--id <approval_id>` — specific approval to approve/reject/inspect
24
27
  `--reason <text>` — reason for rejection (optional)
25
28
 
26
- No running orgs yet? Run `/mastermind:createorg` then `/mastermind:runorg`.
29
+ No running orgs yet? Run `/mastermind:createorg` then `/mastermind:runorgv1` (v1 orgs only — v2 orgs use `/mastermind:runorg`).
27
30
 
28
31
  ---
29
32
 
@@ -65,7 +68,7 @@ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control
65
68
 
66
69
  Emit `session:start`:
67
70
  ```bash
68
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
71
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
69
72
  -H "Content-Type: application/json" \
70
73
  -d "$(jq -cn \
71
74
  --arg session "$session_id" \
@@ -74,11 +77,11 @@ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
74
77
  '{type:"session:start",session:$session,domain:"ops",prompt:("Approve requests for org: "+$org),mode:"confirm",project:$proj,ts:(now*1000|floor)}')" || true
75
78
  ```
76
79
 
77
- Invoke `Skill("mastermind-skills:approve")` passing: brain_context, org_name, action, approval_id, reason, caller: "command".
80
+ Invoke `Skill("mastermind-skills:approvev1")` passing: brain_context, org_name, action, approval_id, reason, caller: "command".
78
81
 
79
82
  After skill returns: note the status. Emit `session:complete`:
80
83
  ```bash
81
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
84
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
82
85
  -H "Content-Type: application/json" \
83
86
  -d "$(jq -cn \
84
87
  --arg session "$session_id" \
@@ -28,14 +28,14 @@ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control
28
28
 
29
29
  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>`:
30
30
  ```bash
31
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
31
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
32
32
  -H "Content-Type: application/json" \
33
33
  -d '{"type":"session:start","session":"<sessionId>","domain":"architect","prompt":'"$(jq -Rn --arg p "$prompt" '$p')"',"ts":'"$(date +%s)"'000}' || true
34
34
  ```
35
35
 
36
36
  Emit `domain:dispatch` immediately after session:start. Before executing the curl below, substitute the generated sessionId for `<sessionId>`:
37
37
  ```bash
38
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
38
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
39
39
  -H "Content-Type: application/json" \
40
40
  -d '{"type":"domain:dispatch","session":"<sessionId>","domain":"architect","ts":'"$(date +%s)"'000}' || true
41
41
  ```
@@ -44,7 +44,7 @@ Invoke `Skill("mastermind-skills:architect")` passing: brain_context, prompt, pr
44
44
 
45
45
  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>`:
46
46
  ```bash
47
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
47
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
48
48
  -H "Content-Type: application/json" \
49
49
  -d '{"type":"session:complete","session":"<sessionId>","domain":"architect","status":"<status>","domains":["architect"],"ts":'"$(date +%s)"'000}' || true
50
50
  ```
@@ -85,7 +85,7 @@ Stop after listing. Do not proceed to skill invocation.
85
85
  npx -y monomind@latest org delete "${delete_name}" --yes || {
86
86
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
87
87
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
88
- result=$(curl -s -X DELETE "${CTRL_URL}/api/orgs/${delete_name}")
88
+ result=$(curl -s -X DELETE -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" "${CTRL_URL}/api/orgs/${delete_name}")
89
89
  echo "$result" | jq -r 'if .ok then "Org '\'''"${delete_name}"'''\'' deleted." else "Error: " + (.error // "unknown") end'
90
90
  }
91
91
  ```
@@ -106,7 +106,7 @@ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control
106
106
 
107
107
  Emit `session:start` to dashboard:
108
108
  ```bash
109
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
109
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
110
110
  -H "Content-Type: application/json" \
111
111
  -d "$(jq -cn \
112
112
  --arg session "$session_id" \
@@ -118,7 +118,7 @@ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
118
118
 
119
119
  Emit `domain:dispatch`:
120
120
  ```bash
121
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
121
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
122
122
  -H "Content-Type: application/json" \
123
123
  -d "$(jq -cn \
124
124
  --arg session "$session_id" \
@@ -129,7 +129,7 @@ Invoke `Skill("mastermind-skills:createorg")` passing: brain_context, prompt, or
129
129
 
130
130
  After skill returns: note the status (`complete`, `partial`, or `blocked`). Emit `session:complete`:
131
131
  ```bash
132
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
132
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
133
133
  -H "Content-Type: application/json" \
134
134
  -d "$(jq -cn \
135
135
  --arg session "$session_id" \
@@ -18,6 +18,24 @@ Quick reference for all Mastermind skills and CLI commands available in this pro
18
18
  | `mastermind:swarm` | Swarm coordination reference — topologies, strategies, init patterns |
19
19
  | `mastermind:memory` | Memory CLI quick reference |
20
20
 
21
+ ## Org Runtime (v2 default)
22
+
23
+ | Command | Description |
24
+ |-------|-------------|
25
+ | `/mastermind:createorg` | Define and save an org (always v2-shaped) |
26
+ | `/mastermind:runorg` | Start a saved org via the Org Runtime v2 daemon (`monomind org run`/`serve`) — auto-migrates v1-shaped configs first |
27
+ | `/mastermind:stoporg` | Stop a running scheduled org loop |
28
+ | `/mastermind:orgstatus` | Detailed status for a single org |
29
+ | `/mastermind:orgs` | List all saved orgs |
30
+
31
+ ### Legacy v1 (marker `LEGACY-ORG-V1` — reachable only under these explicit names)
32
+
33
+ | Command | Description |
34
+ |-------|-------------|
35
+ | `/mastermind:runorgv1` | Legacy prompt-orchestrated org runner — superseded by `/mastermind:runorg` |
36
+ | `/mastermind:approvev1` | Legacy approval queue for v1 orgs — v2 approvals arrive as dashboard question events instead |
37
+ | `/mastermind:heartbeatv1` | Legacy manual agent wake-up for v1 orgs — v2 roles are live SDK sessions with no wake cycle |
38
+
21
39
  ## Core CLI Commands
22
40
 
23
41
  ```bash
@@ -118,7 +118,7 @@ digraph mastermind_routing {
118
118
  | Inspect or manage brain memory | `Skill("mastermind-skills:brain")` |
119
119
  | Technical portfolio, project state assessment | `Skill("mastermind-skills:techport")` |
120
120
  | Define/run an agent organization | `Skill("mastermind-skills:createorg")` / `Skill("mastermind-skills:runorg")` |
121
- | Review and action pending agent approval requests | `Skill("mastermind-skills:approve")` |
121
+ | Review and action pending agent approval requests | `Skill("mastermind-skills:approvev1")` (v1 orgs only — v2 approvals arrive in the dashboard Human Input tab) |
122
122
  | Autonomous build + review until clean | `Skill("mastermind-skills:autodev")` |
123
123
  | Isolate work in a git worktree | `Skill("mastermind-skills:worktree")` |
124
124
  | Write or improve a mastermind skill | `Skill("mastermind-skills:skill-builder")` |
@@ -253,8 +253,8 @@ Describe your goal. Mastermind identifies the relevant domains, spawns specialis
253
253
 
254
254
  **Persistent agent orgs** — named teams that coordinate across sessions
255
255
  `/mastermind:createorg` — define an org: roles, hierarchy, goal
256
- `/mastermind:runorg` — start a saved org; boss agent assigns work to all roles
257
- `/mastermind:approve` — review and action pending approval requests from running org agents
256
+ `/mastermind:runorg` — start a saved org via the Org Runtime v2 daemon (auto-migrates v1 configs); legacy prompt-orchestrated path: `/mastermind:runorgv1`
257
+ `/mastermind:approvev1` — review and action pending approval requests from running org agents (v1 orgs only — v2 approvals arrive in the dashboard Human Input tab)
258
258
 
259
259
  **Autonomous & advanced**
260
260
  `/mastermind:autodev` — research → build → review loop until clean (`--tillend` supported)
@@ -338,7 +338,7 @@ jq -n --arg sid "$SESSION_ID" --arg proj "$project_name" --arg prompt "$resolved
338
338
  && mv "$MONO_DIR/sessions/current.json.tmp" \
339
339
  "$MONO_DIR/sessions/current.json"
340
340
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
341
- curl -s -o /dev/null -X POST "${CTRL_URL}/api/mastermind/event" \
341
+ curl -s -o /dev/null -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
342
342
  -H "Content-Type: application/json" \
343
343
  -d "$(jq -cn --arg sid "$SESSION_ID" --arg prompt "$resolved_prompt" --arg mode "$mode" --arg proj "$REPO_ROOT" \
344
344
  '{type:"session:start",session:$sid,prompt:$prompt,mode:$mode,project:$proj,ts:(now*1000|floor)}')" || true
@@ -715,7 +715,7 @@ domains_needed=$(jq -r '.domains_needed[]? // empty' "$SESSION_STATE" | grep -v
715
715
  for domain in $domains_needed; do
716
716
  goal=$(jq -r --arg d "$domain" '.domain_goals[$d] // empty' "$SESSION_STATE")
717
717
  [ -z "$goal" ] && goal=$(jq -r '.prompt // ""' "$SESSION_STATE")
718
- curl -s -o /dev/null -X POST "${CTRL_URL}/api/mastermind/event" \
718
+ curl -s -o /dev/null -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
719
719
  -H "Content-Type: application/json" \
720
720
  -d "$(jq -cn --arg sid "$SESSION_ID" --arg d "$domain" --arg cmd "$goal" \
721
721
  '{type:"domain:dispatch",session:$sid,domain:$d,cmd:$cmd,ts:(now*1000|floor)}')" || true
@@ -889,7 +889,7 @@ echo "overall_status=$overall_status completed_domains=${completed_domains[*]}"
889
889
 
890
890
  completed_domains_json=$(jq -n '$ARGS.positional' --args "${completed_domains[@]}")
891
891
 
892
- curl -s -o /dev/null -X POST "${CTRL_URL}/api/mastermind/event" \
892
+ curl -s -o /dev/null -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
893
893
  -H "Content-Type: application/json" \
894
894
  -d "$(jq -cn \
895
895
  --arg sid "$SESSION_ID" \
@@ -101,7 +101,7 @@ EOF
101
101
  echo "LOOP_ID=${LOOP_ID}"
102
102
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
103
103
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
104
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
104
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
105
105
  -H "Content-Type: application/json" \
106
106
  -d "{\"type\":\"loop:start\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/mastermind:repeat\",\"mode\":\"${LOOP_TYPE}\",\"maxReps\":${LOOP_MAXREPS},\"interval\":<INTERVAL>,\"ts\":$(date +%s)000}" || true
107
107
  ```
@@ -165,7 +165,7 @@ If `TILLEND_EMPTY=true`:
165
165
  rm -f ".monomind/loops/<LOOP_ID>.json" ".monomind/loops/<LOOP_ID>.stop"
166
166
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
167
167
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
168
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
168
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
169
169
  -H "Content-Type: application/json" \
170
170
  -d "{\"type\":\"loop:complete\",\"loopId\":\"<LOOP_ID>\",\"command\":\"/mastermind:repeat\",\"mode\":\"tillend\",\"ranReps\":<PREV_REP>,\"reason\":\"empty-round\",\"ts\":$(date +%s)000}" || true
171
171
  ```
@@ -178,7 +178,7 @@ If `--tillend` is active AND `CURRENT_REP > MAXRUNS` (safety cap reached):
178
178
  rm -f ".monomind/loops/<LOOP_ID>.json" ".monomind/loops/<LOOP_ID>.stop"
179
179
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
180
180
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
181
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
181
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
182
182
  -H "Content-Type: application/json" \
183
183
  -d "{\"type\":\"loop:complete\",\"loopId\":\"<LOOP_ID>\",\"command\":\"/mastermind:repeat\",\"mode\":\"tillend\",\"ranReps\":<PREV_REP>,\"reason\":\"safety-cap\",\"ts\":$(date +%s)000}" || true
184
184
  ```
@@ -193,7 +193,7 @@ Remove the state file and emit loop:complete:
193
193
  rm -f ".monomind/loops/<LOOP_ID>.json" ".monomind/loops/<LOOP_ID>.stop"
194
194
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
195
195
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
196
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
196
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
197
197
  -H "Content-Type: application/json" \
198
198
  -d "{\"type\":\"loop:complete\",\"loopId\":\"<LOOP_ID>\",\"command\":\"/mastermind:repeat\",\"ranReps\":<MAX_REPS>,\"ts\":$(date +%s)000}" || true
199
199
  ```
@@ -229,7 +229,7 @@ cat > ".monomind/loops/<LOOP_ID>.json" << EOF
229
229
  EOF
230
230
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
231
231
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
232
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
232
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
233
233
  -H "Content-Type: application/json" \
234
234
  -d "{\"type\":\"loop:tick\",\"loopId\":\"<LOOP_ID>\",\"command\":\"/mastermind:repeat\",\"mode\":\"${LOOP_TYPE}\",\"completedRep\":<PREV_REP>,\"nextRep\":<CURRENT_REP>,\"nextAt\":${NEXT_AT},\"ts\":$(date +%s)000}" || true
235
235
  ```
@@ -1,28 +1,14 @@
1
- <!-- Start a saved org as a persistent autonomous agent organization. The boss agent coordinates all roles; agents pick up tasks from a shared board and run until stopped. -->
1
+ <!-- Start a saved org via the Org Runtime v2 daemon (monomind org run/serve). Validates the config, auto-migrates v1-shaped configs, starts the daemon, and confirms liveness. The legacy prompt-orchestrated path lives at /mastermind:runorgv1. -->
2
2
 
3
- > **DEPRECATED (2026-07): superseded by `monomind org run <name>` (SDK org runtime v2).**
4
- > This prompt-orchestrated path has no delivery guarantees and no ground-truth event stream.
5
- > It remains only for orgs not yet migrated. New orgs MUST use the daemon.
6
-
7
- **If $ARGUMENTS is empty:** List saved orgs and display the following.
3
+ **If $ARGUMENTS is empty:** Output the following and wait.
8
4
 
9
5
  ---
10
6
 
11
7
  **MASTERMIND: RUN ORG**
12
8
 
13
- Running an org starts an autonomous agent organization. There are two modes:
14
-
15
- **Persistent org** (no schedule): a boss agent loads the org definition, assigns work to specialists from a shared board, and loops indefinitely. Stop with `/mastermind:stoporg --org <name>`.
16
-
17
- **Scheduled org** (created with `--schedule`): sets the org to `active` and runs the first iteration immediately. Subsequent iterations are self-scheduled via ScheduleWakeup. The loop stops cleanly within one interval after `/mastermind:stoporg --org <name>`.
18
-
19
- **Your saved orgs:**
20
-
21
- ```bash
22
- npx -y monomind@latest org list 2>/dev/null \
23
- || ls .monomind/orgs/*.json 2>/dev/null | grep -vE -- '-(state|goals|threads|activity|approvals|members|secrets|budgets|routines|issues|projects|workspaces|worktrees|environments|plugins|adapters|join-requests|bootstrap|project-workspaces|approval-comments|skills)\.json$' | xargs -I{} basename {} .json 2>/dev/null \
24
- || echo "(none — run /mastermind:createorg to define one)"
25
- ```
9
+ Running an org starts it through the Org Runtime v2 daemon. Every role becomes
10
+ a live SDK session; the daemon forwards dashboard events itself — no boss
11
+ agent, no monotask board, no manual curl emissions.
26
12
 
27
13
  **Usage:**
28
14
 
@@ -30,130 +16,56 @@ npx -y monomind@latest org list 2>/dev/null \
30
16
  /mastermind:runorg --org <name>
31
17
 
32
18
  /mastermind:runorg --org content-team --task "Publish the Q2 product roundup post by Friday"
33
-
34
- /mastermind:runorg --org research-pod "Focus this week on competitor pricing changes"
35
19
  ```
36
20
 
37
21
  **Options:**
38
22
  `--org <name>` — which saved org to start (required; prompted if omitted)
39
23
  `--task <task>` — override the org's default goal for this run
40
- Any remaining text is passed as additional context to the boss agent.
41
24
 
42
25
  No orgs yet? Run `/mastermind:createorg` to define one.
43
26
 
44
- ---
27
+ Your saved orgs:
45
28
 
46
- **If $ARGUMENTS is non-empty:** Execute the flow below.
29
+ ```bash
30
+ npx -y monomind@latest org list 2>/dev/null || echo "(none — run /mastermind:createorg to define one)"
31
+ ```
47
32
 
48
33
  ---
49
34
 
50
- **STEP 0 Extract loop-control flags (do this FIRST, before any other parsing)**
51
-
52
- Scan `$ARGUMENTS` for these flags and store their values. Remove them from the argument string before Step 1:
53
-
54
- | Flag | Variable | Default |
55
- |---|---|---|
56
- | `--rep <N>` | `current_rep = N` | absent |
57
- | `--loop <id>` | `LOOP_ID = id` | absent |
58
- | `--tillend` | `tillend_mode = true` | false |
59
- | `--maxruns <N>` | `tillend_maxruns = N` | 50 |
60
- | `--wait <N>` | `wait_seconds = N` | 60 |
61
- | `--repeat <N>` | `repeat_count = N` | 0 |
62
-
63
- ⚠️ **CRITICAL — CONTINUATION RUNS DO NOT SKIP WORK.** When `--rep N` is present, this is a scheduled continuation triggered by ScheduleWakeup. The org's FULL work cycle MUST still execute every time: session variables → session:start event → Skill("mastermind-skills:runorg") → session:complete event. NEVER short-circuit or skip the org work because `--rep` is present. The `--rep` / `--loop` flags are only consumed by `Skill("mastermind-skills:_repeat")` at the end.
35
+ **If $ARGUMENTS is non-empty:** Execute the flow below.
64
36
 
65
37
  ---
66
38
 
67
- **STEP 1 — Parse org-specific flags**
68
-
69
- From the remaining `$ARGUMENTS` (after loop flags removed in Step 0):
39
+ Parse `$ARGUMENTS` for:
70
40
  - `--org <name>` → org_name = <name>
71
- - `--task <task>` → task_override = <task> (if omitted, task_override = null — the skill uses org's stored goal)
72
- - Remaining text = additional context passed to the boss agent
41
+ - `--task <task>` → task_override = <task> (if omitted, task_override = null — the skill uses the org's stored goal)
73
42
 
74
43
  If `--org` is not provided, list saved orgs and ask which to run:
75
44
  ```bash
76
- orgs=$(ls .monomind/orgs/*.json 2>/dev/null | xargs -I{} basename {} .json 2>/dev/null)
77
- if [ -z "$orgs" ]; then
78
- echo "No saved orgs found. Run /mastermind:createorg first."
79
- exit 1
80
- fi
81
- echo "$orgs"
82
- ```
83
- Ask: "Which org would you like to start? Available: <list from above>"
84
-
85
- Verify the org file exists before proceeding:
86
- ```bash
87
- [ -f ".monomind/orgs/${org_name}.json" ] || { echo "Org '${org_name}' not found."; exit 1; }
45
+ npx -y monomind@latest org list 2>/dev/null || echo "(none run /mastermind:createorg to define one)"
88
46
  ```
89
- If the file does not exist, stop and suggest running `/mastermind:createorg --name ${org_name}`.
90
47
 
91
48
  Load brain context for the `ops` domain (follow _protocol.md Brain Load Procedure, namespace: `ops`).
92
49
 
93
- Resolve session ID and project root:
50
+ Generate a session ID:
94
51
  ```bash
95
52
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
53
+ session_id="mm-$(date -u +%Y%m%dT%H%M%S)"
96
54
  CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
97
- # Reuse the loop's original sessionId for continuation runs (keeps all reps under one session)
98
- if [ -n "${LOOP_ID:-}" ] && [ -f ".monomind/loops/${LOOP_ID}.json" ]; then
99
- session_id=$(jq -r '.sessionId // empty' ".monomind/loops/${LOOP_ID}.json" 2>/dev/null)
100
- fi
101
- session_id="${session_id:-mm-$(date -u +%Y%m%dT%H%M%S)}"
102
- ```
103
-
104
- Emit `session:start` to dashboard:
105
- ```bash
106
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
107
- -H "Content-Type: application/json" \
108
- -d "$(jq -cn \
109
- --arg session "$session_id" \
110
- --arg org "$org_name" \
111
- --arg proj "$REPO_ROOT" \
112
- '{type:"session:start",session:$session,domain:"ops",prompt:("Running org: "+$org),mode:"auto",project:$proj,ts:(now*1000|floor)}')" || true
113
- ```
114
-
115
- Emit `domain:dispatch`:
116
- ```bash
117
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
118
- -H "Content-Type: application/json" \
119
- -d "$(jq -cn \
120
- --arg session "$session_id" \
121
- --arg org "$org_name" \
122
- --arg proj "$REPO_ROOT" \
123
- '{type:"domain:dispatch",session:$session,domain:"ops",cmd:("Starting org "+$org+" as persistent daemon"),project:$proj,ts:(now*1000|floor)}')" || true
124
55
  ```
125
56
 
126
- Invoke `Skill("mastermind-skills:runorg")` passing: brain_context, org_name: `$org_name`, session_id: `$session_id`, task: task_override, caller: "command".
57
+ Invoke `Skill("mastermind-skills:runorg")` passing: org_name: `$org_name`, task: task_override, session_id: `$session_id`, caller: "command".
127
58
 
128
- After the skill spawns the boss agent and returns: note the status. Emit `session:complete`:
59
+ After skill returns: emit `session:complete`:
129
60
  ```bash
130
- curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
61
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" -H "x-monomind-token: $(cat "${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/.monomind/dashboard-token" 2>/dev/null || true)" \
131
62
  -H "Content-Type: application/json" \
132
63
  -d "$(jq -cn \
133
64
  --arg session "$session_id" \
134
65
  --arg status "<status>" \
135
- --arg proj "$REPO_ROOT" \
136
- '{type:"session:complete",session:$session,domain:"ops",status:$status,domains:["ops"],project:$proj,ts:(now*1000|floor)}')" || true
66
+ '{type:"session:complete",session:$session,domain:"ops",status:$status,domains:["ops"],ts:(now*1000|floor)}')" || true
137
67
  ```
138
68
 
139
69
  Follow _protocol.md Brain Write Procedure for domain `ops`.
140
70
 
141
-
142
- **MANDATORY — invoke `Skill("mastermind-skills:_repeat")` now.** This is required regardless of how the skill above completed, regardless of whether you think the work is done, regardless of whether you plan to end your response. For `--repeat N`: the count is non-negotiable — all N runs must happen. For `--tillend`: only a verified empty round (confirmed by git diff) stops the loop. Do not end your response without invoking this skill.
143
-
144
- After the REPEAT POSTAMBLE completes, if a loop was started or continued (LOOP_ID is set), write the org name into the loop state file so the dashboard can detect running status:
145
- ```bash
146
- if [ -n "${LOOP_ID:-}" ]; then
147
- LOOP_FILE=".monomind/loops/${LOOP_ID}.json"
148
- if [ -f "$LOOP_FILE" ]; then
149
- python3 -c "
150
- import json, sys
151
- f = sys.argv[1]; org = sys.argv[2]
152
- d = json.load(open(f))
153
- if 'orgName' not in d:
154
- d['orgName'] = org
155
- open(f, 'w').write(json.dumps(d, indent=2))
156
- " "$LOOP_FILE" "${org_name}" 2>/dev/null || true
157
- fi
158
- fi
159
- ```
71
+ Invoke `Skill("mastermind-skills:_repeat")` now to execute the REPEAT POSTAMBLE. This is a required tool call — do not skip it.