monomind 2.2.0 → 2.3.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.
- package/package.json +2 -2
- package/packages/@monomind/cli/.claude/commands/mastermind/createorg.md +24 -16
- package/packages/@monomind/cli/.claude/commands/mastermind/master.md +23 -7
- package/packages/@monomind/cli/.claude/commands/mastermind/runorg.md +3 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/stoporg.md +6 -3
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/code-quality-reviewer-prompt.md +3 -3
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/createorg.md +19 -24
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/debug.md +49 -4
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/design.md +11 -10
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/final-reviewer-prompt.md +144 -0
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/implementer-prompt.md +9 -4
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/org-settings.md +20 -2
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/orgs.md +40 -19
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/orgstatus.md +90 -41
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/plan.md +19 -0
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/skill-builder.md +171 -0
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/spec-reviewer-prompt.md +19 -2
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/stoporg.md +7 -5
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/taskdev.md +83 -15
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/tdd.md +30 -0
- package/packages/@monomind/cli/dist/src/autopilot-state.js +6 -4
- package/packages/@monomind/cli/dist/src/browser/dashboard/server.js +4 -1
- package/packages/@monomind/cli/dist/src/capabilities/manager.js +3 -1
- package/packages/@monomind/cli/dist/src/commands/agent-lifecycle.js +26 -0
- package/packages/@monomind/cli/dist/src/commands/agent-ops.js +28 -46
- package/packages/@monomind/cli/dist/src/commands/cleanup.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/commands/cleanup.js +120 -0
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +13 -4
- package/packages/@monomind/cli/dist/src/commands/hooks-routing-commands.js +34 -18
- package/packages/@monomind/cli/dist/src/commands/hooks-workers.js +8 -2
- package/packages/@monomind/cli/dist/src/commands/hooks.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/mcp.js +4 -1
- package/packages/@monomind/cli/dist/src/commands/memory-admin.js +7 -1
- package/packages/@monomind/cli/dist/src/commands/org-observe.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/commands/org-observe.js +295 -0
- package/packages/@monomind/cli/dist/src/commands/org.d.ts +9 -1
- package/packages/@monomind/cli/dist/src/commands/org.js +191 -9
- package/packages/@monomind/cli/dist/src/commands/performance.js +4 -1
- package/packages/@monomind/cli/dist/src/commands/platforms.js +4 -1
- package/packages/@monomind/cli/dist/src/commands/security-scan.js +8 -2
- package/packages/@monomind/cli/dist/src/commands/start.js +4 -1
- package/packages/@monomind/cli/dist/src/commands/swarm.js +3 -2
- package/packages/@monomind/cli/dist/src/index.js +13 -3
- package/packages/@monomind/cli/dist/src/init/executor.js +19 -5
- package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.js +3 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.d.ts +1 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +63 -20
- package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.js +3 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.js +3 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/daa-tools.js +3 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.js +6 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +35 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +24 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-embedding.js +13 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-intelligence.js +9 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.d.ts +1 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.js +112 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +2 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +8 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +3 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.js +15 -5
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +4 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +6 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.d.ts +20 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.js +38 -16
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.d.ts +2 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.js +41 -24
- package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.js +6 -2
- package/packages/@monomind/cli/dist/src/memory/intelligence.js +32 -10
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +16 -4
- package/packages/@monomind/cli/dist/src/memory/memory-crud.js +26 -2
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +3 -2
- package/packages/@monomind/cli/dist/src/memory/memory-migrations.js +2 -0
- package/packages/@monomind/cli/dist/src/monovector/command-outcomes.js +4 -1
- package/packages/@monomind/cli/dist/src/orgrt/bus.js +4 -1
- package/packages/@monomind/cli/dist/src/orgrt/daemon.js +74 -19
- package/packages/@monomind/cli/dist/src/orgrt/inbox.js +3 -1
- package/packages/@monomind/cli/dist/src/orgrt/reporting.d.ts +40 -0
- package/packages/@monomind/cli/dist/src/orgrt/reporting.js +127 -0
- package/packages/@monomind/cli/dist/src/orgrt/session.d.ts +2 -0
- package/packages/@monomind/cli/dist/src/orgrt/session.js +10 -2
- package/packages/@monomind/cli/dist/src/orgrt/templates.d.ts +16 -0
- package/packages/@monomind/cli/dist/src/orgrt/templates.js +57 -0
- package/packages/@monomind/cli/dist/src/services/config-file-manager.js +10 -1
- package/packages/@monomind/cli/dist/src/transfer/storage/gcs.js +6 -2
- package/packages/@monomind/cli/dist/src/ui/orgs.html +32 -0
- package/packages/@monomind/cli/dist/src/ui/server.mjs +25 -0
- package/packages/@monomind/cli/dist/src/update/executor.js +3 -1
- package/packages/@monomind/cli/dist/src/update/rate-limiter.js +3 -1
- package/packages/@monomind/cli/package.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monomind",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
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",
|
|
@@ -183,4 +183,4 @@
|
|
|
183
183
|
"access": "public",
|
|
184
184
|
"tag": "latest"
|
|
185
185
|
}
|
|
186
|
-
}
|
|
186
|
+
}
|
|
@@ -53,17 +53,21 @@ Parse `$ARGUMENTS` for:
|
|
|
53
53
|
|
|
54
54
|
**If `--list` flag is set:**
|
|
55
55
|
```bash
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
# org list knows how to skip artifact side-car files (-state/-goals/…) and
|
|
57
|
+
# shows role count, schedule, and runtime status per org
|
|
58
|
+
npx -y monomind@latest org list || {
|
|
59
|
+
# fallback for environments without the CLI: config files only
|
|
60
|
+
orgs_dir=".monomind/orgs"
|
|
61
|
+
if [ ! -d "$orgs_dir" ] || [ -z "$(ls "$orgs_dir"/*.json 2>/dev/null)" ]; then
|
|
62
|
+
echo "No saved orgs. Run /mastermind:createorg <goal> to create one."
|
|
63
|
+
else
|
|
64
|
+
echo "Saved orgs:"
|
|
65
|
+
ls "$orgs_dir"/*.json | 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$' \
|
|
66
|
+
| while IFS= read -r f; do
|
|
67
|
+
echo " • $(basename "$f" .json) — $(jq -r '.goal // ""' "$f" 2>/dev/null | cut -c1-60)"
|
|
68
|
+
done
|
|
69
|
+
fi
|
|
70
|
+
}
|
|
67
71
|
```
|
|
68
72
|
Stop after listing. Do not proceed to skill invocation.
|
|
69
73
|
|
|
@@ -74,12 +78,16 @@ Stop after listing. Do not proceed to skill invocation.
|
|
|
74
78
|
```
|
|
75
79
|
2. In confirm mode (default): ask "Delete org '${delete_name}' and all its data? This cannot be undone. Type 'yes' to confirm."
|
|
76
80
|
In auto mode: proceed without asking.
|
|
77
|
-
3.
|
|
81
|
+
3. Delete via the CLI (it refuses to delete a running org unless --force, and
|
|
82
|
+
removes every artifact side-car file); fall back to the dashboard server's
|
|
83
|
+
DELETE endpoint only if the CLI is unavailable:
|
|
78
84
|
```bash
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
npx -y monomind@latest org delete "${delete_name}" --yes || {
|
|
86
|
+
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
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}")
|
|
89
|
+
echo "$result" | jq -r 'if .ok then "Org '\'''"${delete_name}"'''\'' deleted." else "Error: " + (.error // "unknown") end'
|
|
90
|
+
}
|
|
83
91
|
```
|
|
84
92
|
4. Stop after deleting. Do not proceed to skill invocation.
|
|
85
93
|
|
|
@@ -172,13 +172,13 @@ These thoughts mean **STOP** — you are rationalizing. Check for a skill first.
|
|
|
172
172
|
| "Should I continue?" (in auto mode) | Never ask. Auto mode means execute continuously until blocked or all tasks complete. |
|
|
173
173
|
| "TBD / TODO / implement later" (in a plan) | Placeholder = plan failure. Every step needs exact paths, complete code, runnable commands. |
|
|
174
174
|
| "Code quality review first, then spec" | Wrong order every time. Spec compliance FIRST, code quality SECOND. Never reversed. |
|
|
175
|
-
| "The subagent can read the plan file itself" | Controller
|
|
175
|
+
| "The subagent can read the plan file itself" | Controller extracts each task into a brief file and hands over that path. Subagents never read whole plan files. |
|
|
176
176
|
|
|
177
177
|
### Mandatory Patterns
|
|
178
178
|
|
|
179
179
|
These sequences are non-negotiable in all modes:
|
|
180
180
|
|
|
181
|
-
- **Before building**: Load brain → `mastermind:design`
|
|
181
|
+
- **Before building**: Load brain → `mastermind:design` (questions → approaches → approved spec) → `mastermind:plan` (complete plan + execution handoff) → then build
|
|
182
182
|
- **When fixing bugs**: `mastermind:debug` first (root cause) → write failing test via `mastermind:tdd` → fix → `mastermind:verify`
|
|
183
183
|
- **After building**: `mastermind:review` — at minimum one pass before reporting complete
|
|
184
184
|
- **Consuming a review**: `mastermind:receive-review` — verify before implementing, clarify unclear items first
|
|
@@ -186,8 +186,8 @@ These sequences are non-negotiable in all modes:
|
|
|
186
186
|
- **Before releasing**: `mastermind:review --tillend --auto` → `mastermind:verify` → `mastermind:finish`
|
|
187
187
|
- **Isolated work**: `mastermind:worktree` before making changes to avoid contaminating main
|
|
188
188
|
- **Before claiming complete**: Run `mastermind:verify` — never claim completion based on agent reports, linter passes, or partial checks
|
|
189
|
-
- **When writing a plan**: Map file structure first →
|
|
190
|
-
- **When executing with subagents**:
|
|
189
|
+
- **When writing a plan**: Map file structure first → copy spec-wide Global Constraints into the plan header → right-size tasks (smallest unit with its own test cycle) with exact paths, complete code, and Interfaces (Consumes/Produces) blocks — no placeholders → self-review (spec coverage, placeholder scan, type consistency) → offer execution mode choice (subagent-driven vs inline)
|
|
190
|
+
- **When executing with subagents**: Hand each implementer its task as a brief file (never make them read the plan file) → spec compliance review FIRST → code quality review SECOND → re-review until both ✅ → record each completed task in the durable progress ledger (`.monomind/taskdev/progress.md`) → dispatch final whole-branch reviewer (most capable model, diff handed over as a file) after all tasks complete → then `mastermind:finish`
|
|
191
191
|
- **When blocked during execution**: Stop immediately — do not guess or force through. Diagnose, provide context, re-dispatch with more capable model, or escalate to user
|
|
192
192
|
|
|
193
193
|
### Iron Laws
|
|
@@ -359,6 +359,22 @@ If `domains_needed` contains ONLY non-build domains (marketing, sales, research,
|
|
|
359
359
|
Rationale: without a design gate, master spawns agents before the user has confirmed what to build. The design gate replicates the superpowers workflow: questions → approaches → spec approval → plan → execute.
|
|
360
360
|
</HARD-GATE>
|
|
361
361
|
|
|
362
|
+
### Step 3.6 — Plan Gate
|
|
363
|
+
|
|
364
|
+
<HARD-GATE>
|
|
365
|
+
If the Design Gate ran (build work), do NOT skip planning. After `mastermind:design` returns with an approved spec:
|
|
366
|
+
|
|
367
|
+
1. Invoke `Skill("mastermind-skills:plan")` NOW — pass `build_spec`, the brain context, and mode
|
|
368
|
+
2. The plan skill produces `docs/mastermind/plans/YYYY-MM-DD-<feature>.md` with the complete header (Goal, Architecture, Tech Stack, Global Constraints), right-sized tasks with Interfaces (Consumes/Produces) blocks, bite-sized TDD steps, and no placeholders — then runs its self-review (spec coverage, placeholder scan, type consistency)
|
|
369
|
+
3. The plan skill's Execution Handoff resolves the execution mode. Record it: `build_exec_mode` = `taskdev` (subagent-driven) or `execute` (inline), and save the plan path as `build_plan` in `current.json`
|
|
370
|
+
4. Step 5 MUST NOT re-ask the execution-mode question when this gate already resolved `build_exec_mode`
|
|
371
|
+
5. Only then continue to Step 4
|
|
372
|
+
|
|
373
|
+
If `domains_needed` contains ONLY non-build domains: skip this gate (same rule as Step 3.5).
|
|
374
|
+
|
|
375
|
+
Rationale: superpowers' pipeline is brainstorm → spec approval → writing-plans → execution handoff. Without a plan gate, master hands an un-planned spec straight to domain managers and the plan discipline (exact paths, complete code, interface contracts between tasks) is lost.
|
|
376
|
+
</HARD-GATE>
|
|
377
|
+
|
|
362
378
|
### Step 4 — Decompose
|
|
363
379
|
|
|
364
380
|
For each domain in `domains_needed`, assess complexity:
|
|
@@ -435,14 +451,14 @@ If mode = confirm: show plan and wait for user response. Valid responses:
|
|
|
435
451
|
- Any modification (e.g. "add sales domain", "remove marketing") — apply the change, re-show the plan, wait again
|
|
436
452
|
- "cancel" or "stop" — emit `session:complete` with `status: blocked`, reason "cancelled by user", then STOP
|
|
437
453
|
|
|
438
|
-
|
|
454
|
+
If the Step 3.6 Plan Gate already resolved `build_exec_mode`, skip the question below and use that value. Otherwise, after the user says "go" (and `build` is in `domains_needed`), ask once:
|
|
439
455
|
> "For the build work: **subagents** (recommended — fresh agent per task with 2-stage review, like mastermind:taskdev) or **inline** (direct execution, mastermind:execute)?"
|
|
440
456
|
|
|
441
457
|
- "subagents" → `build_exec_mode = "taskdev"`
|
|
442
458
|
- "inline" → `build_exec_mode = "execute"`
|
|
443
459
|
- No answer / skipped → `build_exec_mode = "taskdev"` (default)
|
|
444
460
|
|
|
445
|
-
If mode = auto: `build_exec_mode = "taskdev"` (default).
|
|
461
|
+
If mode = auto and Step 3.6 did not set it: `build_exec_mode = "taskdev"` (default).
|
|
446
462
|
|
|
447
463
|
**Persist `build_exec_mode` to `current.json`** (required — Phase C reads it from there):
|
|
448
464
|
|
|
@@ -745,7 +761,7 @@ Each Task call must include a complete briefing following the Monotask Task Brie
|
|
|
745
761
|
- Instruction to create monotask cards directly using `monotask card create $BOARD_ID $COL_TODO_ID "<title>" --json` for all sub-tasks
|
|
746
762
|
- Instruction to use `Skill("mastermind-skills:do")` to execute tasks (Task agents have Skill tool access — do NOT use slash command syntax)
|
|
747
763
|
- Instruction to spawn specialized agents using the domain-appropriate swarm topology
|
|
748
|
-
- **For the `build` domain only:** include `build_exec_mode` (value: `"taskdev"` or `"execute"`) and instruct the manager: "Use `Skill("mastermind-skills:taskdev")` if build_exec_mode is `taskdev`, or `Skill("mastermind-skills:execute")` if `execute`. This was
|
|
764
|
+
- **For the `build` domain only:** include `build_exec_mode` (value: `"taskdev"` or `"execute"`) and instruct the manager: "Use `Skill("mastermind-skills:taskdev")` if build_exec_mode is `taskdev`, or `Skill("mastermind-skills:execute")` if `execute`. This was resolved in the Step 3.6 Plan Gate (or Step 5)." If `build_plan` is set in `current.json`, include the plan path and instruct the manager to execute THAT plan task-by-task rather than re-deriving tasks from the goal.
|
|
749
765
|
- Instruction to return the unified output schema when done
|
|
750
766
|
|
|
751
767
|
Example Task call for Development Manager. Substitute all **pre-known** `<…>` placeholders (project_name, SESSION_ID, board/col IDs, goals, manager name) before calling Task. Placeholders like `<status>`, `<path1>`, `<action1>` are filled at runtime by the spawned agent — do not attempt to substitute them. `subagent_type` is the **string value** of `$domain_manager_build` (e.g. `"Backend Architect"`), not a variable reference.
|
|
@@ -19,7 +19,9 @@ Running an org starts an autonomous agent organization. There are two modes:
|
|
|
19
19
|
**Your saved orgs:**
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
|
|
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)"
|
|
23
25
|
```
|
|
24
26
|
|
|
25
27
|
**Usage:**
|
|
@@ -29,11 +29,14 @@ active → (HIL) → paused (set manually in .monomind/orgs/<name>.j
|
|
|
29
29
|
paused → (set active) → active (resume by setting status back to "active" in the JSON)
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
**Note:** v2 orgs (the default) are stopped via `monomind org stop <name>` — this
|
|
33
|
+
command handles both: it routes v2 orgs to the CLI and legacy `.loop` orgs
|
|
34
|
+
through the v1 status-flip path.
|
|
35
|
+
|
|
36
|
+
Your orgs (with live runtime status):
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
|
-
|
|
36
|
-
xargs -I{} sh -c 'name=$(jq -r ".name" "{}"); status=$(jq -r ".status // \"no-loop\"" "{}"); interval=$(jq -r "if .loop.poll_interval_minutes then \"\(.loop.poll_interval_minutes)m\" else \"—\" end" "{}"); echo " $name ($status, $interval)"' 2>/dev/null || echo "(none)"
|
|
39
|
+
npx -y monomind@latest org list 2>/dev/null || echo "(none — run /mastermind:createorg to define one)"
|
|
37
40
|
```
|
|
38
41
|
|
|
39
42
|
---
|
package/packages/@monomind/cli/.claude/skills/mastermind-skills/code-quality-reviewer-prompt.md
CHANGED
|
@@ -18,10 +18,10 @@ Task tool (general-purpose):
|
|
|
18
18
|
|
|
19
19
|
## Diff to Review
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
Read this file — it contains the commit list, stat summary, and full
|
|
22
|
+
diff from [BASE_SHA] to [HEAD_SHA]:
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
[DIFF_FILE_PATH — e.g. .monomind/taskdev/task-N-review.diff]
|
|
25
25
|
|
|
26
26
|
## What to Check
|
|
27
27
|
|
|
@@ -181,32 +181,25 @@ jq -n \
|
|
|
181
181
|
> "${orgJson}.tmp" && mv "${orgJson}.tmp" "$orgJson"
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
**POST-SAVE VALIDATION (run immediately after saving — abort if
|
|
184
|
+
**POST-SAVE VALIDATION (run immediately after saving — abort if it fails):**
|
|
185
185
|
|
|
186
186
|
```bash
|
|
187
|
-
#
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
# Parses with OrgDefSchema (the exact code path org run/serve use) and checks the
|
|
188
|
+
# structural invariants: exactly one root role, every reports_to resolves, unique
|
|
189
|
+
# role ids, parseable schedule, name/filename agreement.
|
|
190
|
+
if npx -y monomind@latest org validate "$org_name"; then
|
|
191
|
+
echo "✓ Org config validated — ready for: monomind org run ${org_name}"
|
|
192
|
+
else
|
|
193
|
+
# CLI < 2.1.8 has no `org validate` — fall back to the two structural checks:
|
|
194
|
+
root_count=$(jq '[.roles[] | select(.reports_to == null)] | length' "$orgJson")
|
|
195
|
+
bad_reports=$(jq -r '([.roles[].id]) as $ids |
|
|
196
|
+
[.roles[] | select(.reports_to != null and (.reports_to as $r | $ids | index($r) | not)) | .id] | join(", ")' "$orgJson")
|
|
197
|
+
if [ "$root_count" -ne 1 ] || [ -n "$bad_reports" ]; then
|
|
198
|
+
echo "ERROR: org config invalid (roots: $root_count, unresolved reports_to: ${bad_reports:-none}) — fix the roles array and re-save."
|
|
199
|
+
exit 1
|
|
200
|
+
fi
|
|
201
|
+
echo "✓ Structural checks passed (upgrade monomind for full schema validation)"
|
|
192
202
|
fi
|
|
193
|
-
echo "✓ Exactly one root role"
|
|
194
|
-
|
|
195
|
-
# Check 2 — every non-root role's reports_to resolves to a real role id
|
|
196
|
-
bad_reports=$(jq -r '
|
|
197
|
-
([.roles[].id]) as $ids |
|
|
198
|
-
[.roles[] | select(.reports_to != null and (.reports_to as $r | $ids | index($r) | not)) | .id]
|
|
199
|
-
| join(", ")' "$orgJson")
|
|
200
|
-
if [ -n "$bad_reports" ]; then
|
|
201
|
-
echo "ERROR: these roles have a reports_to that doesn't match any role id: $bad_reports"
|
|
202
|
-
exit 1
|
|
203
|
-
fi
|
|
204
|
-
echo "✓ All reports_to values resolve"
|
|
205
|
-
|
|
206
|
-
# Check 3 — schema sanity check via the CLI itself (parses with OrgDefSchema, same code path org run/serve use)
|
|
207
|
-
npx monomind@latest org list >/dev/null 2>&1 || echo "WARNING: could not verify via CLI — check .monomind/orgs manually"
|
|
208
|
-
|
|
209
|
-
echo "✓ Org config validated — ready for: monomind org run ${org_name}"
|
|
210
203
|
```
|
|
211
204
|
|
|
212
205
|
---
|
|
@@ -228,7 +221,9 @@ lessons:
|
|
|
228
221
|
- what_worked: "Auto-suggested roles matched user intent"
|
|
229
222
|
- what_didnt: ""
|
|
230
223
|
next_actions:
|
|
231
|
-
- "Run `monomind org run <org_name>` to start the organization in the foreground"
|
|
224
|
+
- "Run `monomind org run <org_name>` to start the organization in the foreground (add --dry-run to preview each role's briefing first)"
|
|
225
|
+
- "After hand-editing the config, re-check it with `monomind org validate <org_name>`"
|
|
226
|
+
- "While running: `monomind org logs <org_name> --follow`; afterwards: `monomind org report <org_name>` for outcome, per-role activity, and token usage"
|
|
232
227
|
- "Or `monomind org serve` to host it (and any other scheduled orgs) as a background daemon"
|
|
233
228
|
- "Edit .monomind/orgs/<org_name>.json directly, or use /mastermind:org-settings, to change goal/budget/roles"
|
|
234
229
|
- "`monomind org status <org_name>` to check runtime state; `monomind org stop <org_name>` to stop a running org"
|
|
@@ -101,6 +101,14 @@ You MUST complete each phase before proceeding to the next.
|
|
|
101
101
|
echo "=== Final state: ==="
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
5. **Trace Data Flow**
|
|
105
|
+
|
|
106
|
+
**WHEN the error is deep in a call stack:**
|
|
107
|
+
- Where does the bad value originate?
|
|
108
|
+
- What called this with the bad value?
|
|
109
|
+
- Keep tracing up until you find the source
|
|
110
|
+
- Fix at the source, not at the symptom — a `null` crashing in layer 4 usually entered in layer 1
|
|
111
|
+
|
|
104
112
|
---
|
|
105
113
|
|
|
106
114
|
### Phase 2: Pattern Analysis
|
|
@@ -112,11 +120,21 @@ Once you understand WHERE the break is, find existing working examples:
|
|
|
112
120
|
- Check git history for when this worked
|
|
113
121
|
- Find the canonical implementation to compare against
|
|
114
122
|
|
|
115
|
-
2. **Compare
|
|
123
|
+
2. **Compare against references**
|
|
124
|
+
- If implementing a pattern, read the reference implementation COMPLETELY
|
|
125
|
+
- Don't skim — read every line
|
|
126
|
+
- Understand the pattern fully before applying it
|
|
127
|
+
|
|
128
|
+
3. **Compare broken vs. working**
|
|
116
129
|
- What's different?
|
|
117
|
-
- List every difference, not just the obvious one
|
|
130
|
+
- List every difference, not just the obvious one — don't assume "that can't matter"
|
|
118
131
|
- Environment, config, data, timing
|
|
119
132
|
|
|
133
|
+
4. **Understand dependencies**
|
|
134
|
+
- What other components does this need?
|
|
135
|
+
- What settings, config, environment?
|
|
136
|
+
- What assumptions does it make?
|
|
137
|
+
|
|
120
138
|
---
|
|
121
139
|
|
|
122
140
|
### Phase 3: Form and Test a Hypothesis
|
|
@@ -131,13 +149,15 @@ Once you understand WHERE the break is, find existing working examples:
|
|
|
131
149
|
|
|
132
150
|
3. **If hypothesis is wrong:** Do NOT add more fixes. Return to Phase 1 with the new information.
|
|
133
151
|
|
|
152
|
+
4. **When you don't know:** Say "I don't understand X". Don't pretend to know. Research more or ask the user — a stated unknown beats a confident guess.
|
|
153
|
+
|
|
134
154
|
---
|
|
135
155
|
|
|
136
156
|
### Phase 4: Implementation
|
|
137
157
|
|
|
138
158
|
1. **Write a failing test first** (before touching production code)
|
|
139
|
-
- Automated test where possible
|
|
140
|
-
- Use `Skill("mastermind-skills:
|
|
159
|
+
- Automated test where possible; a one-off test script if no framework
|
|
160
|
+
- Use `Skill("mastermind-skills:tdd")` for writing proper failing tests
|
|
141
161
|
- The test MUST fail before the fix proves it
|
|
142
162
|
|
|
143
163
|
2. **Implement a single fix**
|
|
@@ -186,6 +206,9 @@ If you catch yourself thinking or doing any of these:
|
|
|
186
206
|
| "Quick fix for now, investigate later" | You're skipping root cause. Return to Phase 1. |
|
|
187
207
|
| "Just try changing X and see if it works" | Guessing. Return to Phase 1. |
|
|
188
208
|
| "Add multiple changes, run tests" | Can't isolate what worked. Return to Phase 1. |
|
|
209
|
+
| "Skip the test, I'll manually verify" | Untested fixes don't stick. Write the failing test. |
|
|
210
|
+
| "Pattern says X but I'll adapt it differently" | Partial understanding guarantees bugs. Read the reference completely. |
|
|
211
|
+
| "Here are the main problems: …" (listing fixes without investigation) | Solutions before evidence. Return to Phase 1. |
|
|
189
212
|
| "It's probably X, let me fix that" | Assumed root cause. Verify it first. Return to Phase 1. |
|
|
190
213
|
| "I don't fully understand but this might work" | You don't have a hypothesis. Return to Phase 1. |
|
|
191
214
|
| Proposing solutions before tracing data flow | No root cause. Return to Phase 1. |
|
|
@@ -212,6 +235,7 @@ Watch for these redirections from the user:
|
|
|
212
235
|
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
|
|
213
236
|
| "I'll write the test after confirming the fix works" | Untested fixes don't stick. Test first proves it. |
|
|
214
237
|
| "Multiple fixes at once saves time" | Can't isolate what worked. Creates new bugs. |
|
|
238
|
+
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
|
|
215
239
|
| "I can see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
|
|
216
240
|
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question the pattern. |
|
|
217
241
|
|
|
@@ -224,6 +248,27 @@ Watch for these redirections from the user:
|
|
|
224
248
|
| **3. Hypothesis** | Form theory, test minimally | Confirmed or new hypothesis |
|
|
225
249
|
| **4. Implementation** | Write failing test, fix, verify | Bug resolved, tests pass |
|
|
226
250
|
|
|
251
|
+
## When the Process Reveals "No Root Cause"
|
|
252
|
+
|
|
253
|
+
If systematic investigation reveals the issue is truly environmental, timing-dependent, or external:
|
|
254
|
+
|
|
255
|
+
1. You've completed the process
|
|
256
|
+
2. Document what you investigated
|
|
257
|
+
3. Implement appropriate handling (retry, timeout, clear error message)
|
|
258
|
+
4. Add monitoring/logging for future investigation
|
|
259
|
+
|
|
260
|
+
**But:** 95% of "no root cause" cases are incomplete investigation.
|
|
261
|
+
|
|
262
|
+
## Supporting Techniques
|
|
263
|
+
|
|
264
|
+
- **Root-cause tracing:** when a bad value crashes deep in the stack, trace it backward caller by caller until you find where it was created; fix there. Adding a guard at the crash site only hides the origin.
|
|
265
|
+
- **Defense in depth:** AFTER fixing the root cause, add validation at the layers the bad value passed through unchecked — so the next bad value fails loudly at its first boundary, not silently at its fourth.
|
|
266
|
+
- **Condition-based waiting:** replace arbitrary sleeps/timeouts in flaky tests and scripts with polling for the actual condition ("wait until the file exists / the port answers"), with a hard cap. Timing guesses are bugs waiting for a slower machine.
|
|
267
|
+
|
|
268
|
+
**Related skills:**
|
|
269
|
+
- `Skill("mastermind-skills:tdd")` — for creating the failing test case (Phase 4, Step 1)
|
|
270
|
+
- `Skill("mastermind-skills:verify")` — verify the fix worked before claiming success
|
|
271
|
+
|
|
227
272
|
## Impact
|
|
228
273
|
|
|
229
274
|
Systematic approach vs random fixing:
|
|
@@ -37,7 +37,7 @@ Every feature goes through this process. A todo list, a single-function utility,
|
|
|
37
37
|
Complete these items in order:
|
|
38
38
|
|
|
39
39
|
1. **Explore project context** — check files, docs, recent commits
|
|
40
|
-
2. **Offer visual companion**
|
|
40
|
+
2. **Offer the visual companion just-in-time** — NOT upfront. The first time a question would genuinely be clearer shown than described, offer it then (its own message, not combined with a clarifying question). If no visual question ever arises, never offer it. See the Visual Companion section below.
|
|
41
41
|
3. **Ask clarifying questions** — one at a time; understand purpose, constraints, success criteria
|
|
42
42
|
4. **Propose 2-3 approaches** — with trade-offs and your recommendation
|
|
43
43
|
5. **Present design** — in sections scaled to their complexity; get user approval after each section
|
|
@@ -53,10 +53,9 @@ Complete these items in order:
|
|
|
53
53
|
```
|
|
54
54
|
Explore project context
|
|
55
55
|
↓
|
|
56
|
-
Visual questions ahead?
|
|
57
|
-
yes → Offer Visual Companion (own message, no other content)
|
|
58
|
-
no ↓
|
|
59
56
|
Ask clarifying questions (one at a time)
|
|
57
|
+
(a question is clearer shown than described?
|
|
58
|
+
→ offer Visual Companion just-in-time — own message, no other content)
|
|
60
59
|
↓
|
|
61
60
|
Propose 2-3 approaches
|
|
62
61
|
↓
|
|
@@ -167,16 +166,18 @@ Wait for the user's response. If they request changes, make them and re-run the
|
|
|
167
166
|
|
|
168
167
|
A browser-based companion for showing mockups, diagrams, and visual options during design sessions. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser.
|
|
169
168
|
|
|
170
|
-
**Offering the companion:**
|
|
169
|
+
**Offering the companion (just-in-time):** Do NOT offer it upfront. Wait until a question would genuinely be clearer shown than told — a real mockup / layout / diagram question, not merely a UI *topic*. The first time that happens, offer it then, as its own message:
|
|
171
170
|
|
|
172
|
-
> "
|
|
171
|
+
> "This next part might be easier if I show you — I can put together mockups, diagrams, and comparisons in a browser tab as we go. It's still new and can be token-intensive. Want me to? I'll open it for you."
|
|
173
172
|
|
|
174
|
-
**This offer MUST be its own message.**
|
|
173
|
+
**This offer MUST be its own message.** Only the offer — no clarifying question, summary, or other content. Wait for the user's response. If they decline, continue text-only and don't offer again unless they raise it.
|
|
175
174
|
|
|
176
|
-
**Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal.
|
|
175
|
+
**Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: **would the user understand this better by seeing it than reading it?**
|
|
177
176
|
|
|
178
|
-
- **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams
|
|
179
|
-
- **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, scope decisions
|
|
177
|
+
- **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
|
|
178
|
+
- **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
|
|
179
|
+
|
|
180
|
+
A question about a UI topic is not automatically a visual question. "What does personality mean in this context?" is a conceptual question — use the terminal. "Which wizard layout works better?" is a visual question — use the browser.
|
|
180
181
|
|
|
181
182
|
If they agree to the companion, use `Skill("mastermind-skills:worktree")` to set up an isolated workspace, then invoke `Skill("agent-browser-testing")` to open the browser.
|
|
182
183
|
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Final Whole-Branch Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching the final code reviewer subagent from `mastermind:taskdev` (after all tasks complete) or `mastermind:review`. Dispatch it on the **most capable available model**.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Review the entire branch against its plan/spec before merge — the one broad pass after all task-scoped gates.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Task tool (general-purpose):
|
|
9
|
+
description: "Final whole-branch review"
|
|
10
|
+
prompt: |
|
|
11
|
+
You are a Senior Code Reviewer with expertise in software architecture,
|
|
12
|
+
design patterns, and best practices. Your job is to review completed work
|
|
13
|
+
against its plan or requirements and identify issues before they cascade.
|
|
14
|
+
|
|
15
|
+
## What Was Implemented
|
|
16
|
+
|
|
17
|
+
[DESCRIPTION]
|
|
18
|
+
|
|
19
|
+
## Requirements / Plan
|
|
20
|
+
|
|
21
|
+
[PLAN_OR_REQUIREMENTS]
|
|
22
|
+
|
|
23
|
+
## Diff to Review
|
|
24
|
+
|
|
25
|
+
Read this file — it contains the commit list, stat summary, and full diff
|
|
26
|
+
from [BASE_SHA] to [HEAD_SHA]:
|
|
27
|
+
|
|
28
|
+
[DIFF_FILE_PATH]
|
|
29
|
+
|
|
30
|
+
## Minor Findings Carried Forward
|
|
31
|
+
|
|
32
|
+
[MINOR_FINDINGS_LIST — from the progress ledger; triage which must be
|
|
33
|
+
fixed before merge]
|
|
34
|
+
|
|
35
|
+
## Read-Only Review
|
|
36
|
+
|
|
37
|
+
Your review is read-only on this checkout. Do not mutate the working
|
|
38
|
+
tree, the index, HEAD, or branch state in any way. Use `git show`,
|
|
39
|
+
`git diff`, and `git log` to inspect history.
|
|
40
|
+
|
|
41
|
+
## What to Check
|
|
42
|
+
|
|
43
|
+
**Plan alignment:**
|
|
44
|
+
- Does the implementation match the plan / requirements?
|
|
45
|
+
- Are deviations justified improvements, or problematic departures?
|
|
46
|
+
- Is all planned functionality present?
|
|
47
|
+
|
|
48
|
+
**Code quality:**
|
|
49
|
+
- Clean separation of concerns?
|
|
50
|
+
- Proper error handling?
|
|
51
|
+
- Type safety where applicable?
|
|
52
|
+
- DRY without premature abstraction?
|
|
53
|
+
- Edge cases handled?
|
|
54
|
+
|
|
55
|
+
**Architecture:**
|
|
56
|
+
- Sound design decisions?
|
|
57
|
+
- Reasonable scalability and performance?
|
|
58
|
+
- Security concerns?
|
|
59
|
+
- Integrates cleanly with surrounding code?
|
|
60
|
+
|
|
61
|
+
**Testing:**
|
|
62
|
+
- Tests verify real behavior, not mocks?
|
|
63
|
+
- Edge cases covered?
|
|
64
|
+
- Integration tests where they matter?
|
|
65
|
+
- All tests passing?
|
|
66
|
+
|
|
67
|
+
**Production readiness:**
|
|
68
|
+
- Migration strategy if schema changed?
|
|
69
|
+
- Backward compatibility considered?
|
|
70
|
+
- Documentation complete?
|
|
71
|
+
- No obvious bugs?
|
|
72
|
+
|
|
73
|
+
## Calibration
|
|
74
|
+
|
|
75
|
+
Categorize issues by actual severity. Not everything is Critical.
|
|
76
|
+
Acknowledge what was done well before listing issues — accurate praise
|
|
77
|
+
helps the implementer trust the rest of the feedback.
|
|
78
|
+
|
|
79
|
+
If you find significant deviations from the plan, flag them specifically
|
|
80
|
+
so the implementer can confirm whether the deviation was intentional.
|
|
81
|
+
If you find issues with the plan itself rather than the implementation,
|
|
82
|
+
say so.
|
|
83
|
+
|
|
84
|
+
## Output Format
|
|
85
|
+
|
|
86
|
+
### Strengths
|
|
87
|
+
[What's well done? Be specific.]
|
|
88
|
+
|
|
89
|
+
### Issues
|
|
90
|
+
|
|
91
|
+
#### Critical (Must Fix)
|
|
92
|
+
[Bugs, security issues, data loss risks, broken functionality]
|
|
93
|
+
|
|
94
|
+
#### Important (Should Fix)
|
|
95
|
+
[Architecture problems, missing features, poor error handling, test gaps]
|
|
96
|
+
|
|
97
|
+
#### Minor (Nice to Have)
|
|
98
|
+
[Code style, optimization opportunities, documentation polish]
|
|
99
|
+
|
|
100
|
+
For each issue:
|
|
101
|
+
- File:line reference
|
|
102
|
+
- What's wrong
|
|
103
|
+
- Why it matters
|
|
104
|
+
- How to fix (if not obvious)
|
|
105
|
+
|
|
106
|
+
### Recommendations
|
|
107
|
+
[Improvements for code quality, architecture, or process]
|
|
108
|
+
|
|
109
|
+
### Assessment
|
|
110
|
+
|
|
111
|
+
**Ready to merge?** [Yes | No | With fixes]
|
|
112
|
+
|
|
113
|
+
**Reasoning:** [1-2 sentence technical assessment]
|
|
114
|
+
|
|
115
|
+
## Critical Rules
|
|
116
|
+
|
|
117
|
+
**DO:**
|
|
118
|
+
- Categorize by actual severity
|
|
119
|
+
- Be specific (file:line, not vague)
|
|
120
|
+
- Explain WHY each issue matters
|
|
121
|
+
- Acknowledge strengths
|
|
122
|
+
- Give a clear verdict
|
|
123
|
+
|
|
124
|
+
**DON'T:**
|
|
125
|
+
- Say "looks good" without checking
|
|
126
|
+
- Mark nitpicks as Critical
|
|
127
|
+
- Give feedback on code you didn't actually read
|
|
128
|
+
- Be vague ("improve error handling")
|
|
129
|
+
- Avoid giving a clear verdict
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Placeholders:**
|
|
133
|
+
- `[DESCRIPTION]` — brief summary of what was built across the branch
|
|
134
|
+
- `[PLAN_OR_REQUIREMENTS]` — the plan file path or spec text
|
|
135
|
+
- `[BASE_SHA]` — the merge base (`git merge-base main HEAD`)
|
|
136
|
+
- `[HEAD_SHA]` — branch head
|
|
137
|
+
- `[DIFF_FILE_PATH]` — the diff file generated from BASE..HEAD (commit list + stat + `git diff -U10`)
|
|
138
|
+
- `[MINOR_FINDINGS_LIST]` — accumulated Minor findings from per-task reviews
|
|
139
|
+
|
|
140
|
+
**Acting on feedback (controller):**
|
|
141
|
+
- Fix Critical issues immediately; fix Important issues before merge
|
|
142
|
+
- Dispatch ONE fix subagent with the complete findings list — not one fixer per finding
|
|
143
|
+
- Push back on findings that are wrong — with technical reasoning and evidence, never performative agreement
|
|
144
|
+
- Never skip this review because "the per-task reviews all passed" — task gates are narrow by design
|
|
@@ -95,13 +95,18 @@ Task tool (general-purpose):
|
|
|
95
95
|
|
|
96
96
|
## Report Format
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
Write your full report to the report file named in this dispatch
|
|
99
|
+
([REPORT_FILE_PATH]), covering:
|
|
100
100
|
- What you implemented (or what you attempted, if blocked)
|
|
101
|
-
- What you tested and test results
|
|
101
|
+
- What you tested and test results (commands run + output summary)
|
|
102
102
|
- Files changed
|
|
103
103
|
- Self-review findings (if any)
|
|
104
|
-
|
|
104
|
+
|
|
105
|
+
Then return only:
|
|
106
|
+
- **Status:** DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
|
|
107
|
+
- Commits created
|
|
108
|
+
- One-line test summary
|
|
109
|
+
- Any concerns
|
|
105
110
|
|
|
106
111
|
Use DONE_WITH_CONCERNS if you completed the work but have doubts about correctness.
|
|
107
112
|
Use BLOCKED if you cannot complete the task. Use NEEDS_CONTEXT if you need
|
|
@@ -82,9 +82,14 @@ case "$field" in
|
|
|
82
82
|
[ -f "$newOrgFile" ] && { echo "ERROR: An org named '${value}' already exists."; exit 1; }
|
|
83
83
|
# Refuse to rename while the daemon has this org running — it holds the old
|
|
84
84
|
# name's paths (defPath, cwd, runtime.json) in memory; a rename mid-run would
|
|
85
|
-
# orphan that live state instead of moving it.
|
|
85
|
+
# orphan that live state instead of moving it. A runtime.json left by a
|
|
86
|
+
# crashed daemon (dead pid) does NOT count as running — same semantics as
|
|
87
|
+
# isOrgRunning in packages/@monomind/cli/src/commands/org.ts.
|
|
86
88
|
runtime_status=$(jq -r '.status // "stopped"' ".monomind/orgs/${org_name}/runtime.json" 2>/dev/null || echo "stopped")
|
|
87
|
-
|
|
89
|
+
runtime_pid=$(jq -r '.pid // 0' ".monomind/orgs/${org_name}/runtime.json" 2>/dev/null || echo 0)
|
|
90
|
+
if [ "$runtime_status" = "running" ] && [ "$runtime_pid" -gt 0 ] && kill -0 "$runtime_pid" 2>/dev/null; then
|
|
91
|
+
echo "ERROR: org '${org_name}' is running (pid ${runtime_pid}) — stop it first: monomind org stop ${org_name}"; exit 1
|
|
92
|
+
fi
|
|
88
93
|
# Update the name field inside the JSON
|
|
89
94
|
jq --arg v "$value" '.name = $v' "$orgFile" > "$tmp" && mv "$tmp" "$orgFile"
|
|
90
95
|
# Rename the main config file
|
|
@@ -144,6 +149,13 @@ case "$field" in
|
|
|
144
149
|
esac
|
|
145
150
|
```
|
|
146
151
|
|
|
152
|
+
After any edit, re-validate the config the same way createorg does (non-fatal — the file is already written; this tells the user immediately if the org can no longer start):
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npx -y monomind@latest org validate "$org_name" \
|
|
156
|
+
|| echo "WARNING: '${org_name}' no longer passes validation — fix it before 'monomind org run ${org_name}'"
|
|
157
|
+
```
|
|
158
|
+
|
|
147
159
|
Emit `org:settings:updated` event:
|
|
148
160
|
|
|
149
161
|
```bash
|
|
@@ -231,6 +243,12 @@ fi
|
|
|
231
243
|
|
|
232
244
|
echo "Imported org '${targetOrg}' from ${import_path}"
|
|
233
245
|
echo "Agents: $(jq '.config.roles | length' "$import_path")"
|
|
246
|
+
|
|
247
|
+
# An imported bundle is untrusted input — validate before declaring success
|
|
248
|
+
# (schema + single root role + resolvable reports_to + parseable schedule).
|
|
249
|
+
npx -y monomind@latest org validate "$targetOrg" \
|
|
250
|
+
|| { echo "ERROR: imported org failed validation — fix .monomind/orgs/${targetOrg}.json before running it."; exit 1; }
|
|
251
|
+
|
|
234
252
|
echo "Run /mastermind:env --org ${targetOrg} --action validate to check provider keys."
|
|
235
253
|
```
|
|
236
254
|
|