create-merlin-brain 3.10.0 → 3.12.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/bin/install.cjs +146 -22
- package/bin/runtime-adapters.cjs +396 -0
- package/dist/server/cost/tracker.d.ts +38 -2
- package/dist/server/cost/tracker.d.ts.map +1 -1
- package/dist/server/cost/tracker.js +87 -15
- package/dist/server/cost/tracker.js.map +1 -1
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +74 -30
- package/dist/server/server.js.map +1 -1
- package/dist/server/tools/adaptive.js +1 -1
- package/dist/server/tools/adaptive.js.map +1 -1
- package/dist/server/tools/agents-index.js +3 -3
- package/dist/server/tools/agents-index.js.map +1 -1
- package/dist/server/tools/agents.js +5 -5
- package/dist/server/tools/agents.js.map +1 -1
- package/dist/server/tools/behaviors.js +4 -4
- package/dist/server/tools/behaviors.js.map +1 -1
- package/dist/server/tools/context.js +7 -7
- package/dist/server/tools/context.js.map +1 -1
- package/dist/server/tools/cost.d.ts +3 -1
- package/dist/server/tools/cost.d.ts.map +1 -1
- package/dist/server/tools/cost.js +66 -13
- package/dist/server/tools/cost.js.map +1 -1
- package/dist/server/tools/discoveries.js +6 -6
- package/dist/server/tools/discoveries.js.map +1 -1
- package/dist/server/tools/index.d.ts +4 -0
- package/dist/server/tools/index.d.ts.map +1 -1
- package/dist/server/tools/index.js +4 -0
- package/dist/server/tools/index.js.map +1 -1
- package/dist/server/tools/learning.d.ts +12 -0
- package/dist/server/tools/learning.d.ts.map +1 -0
- package/dist/server/tools/learning.js +269 -0
- package/dist/server/tools/learning.js.map +1 -0
- package/dist/server/tools/project.js +7 -7
- package/dist/server/tools/project.js.map +1 -1
- package/dist/server/tools/promote.d.ts +11 -0
- package/dist/server/tools/promote.d.ts.map +1 -0
- package/dist/server/tools/promote.js +315 -0
- package/dist/server/tools/promote.js.map +1 -0
- package/dist/server/tools/route.d.ts.map +1 -1
- package/dist/server/tools/route.js +65 -24
- package/dist/server/tools/route.js.map +1 -1
- package/dist/server/tools/session-restore.d.ts +18 -0
- package/dist/server/tools/session-restore.d.ts.map +1 -0
- package/dist/server/tools/session-restore.js +154 -0
- package/dist/server/tools/session-restore.js.map +1 -0
- package/dist/server/tools/session-search.d.ts +16 -0
- package/dist/server/tools/session-search.d.ts.map +1 -0
- package/dist/server/tools/session-search.js +240 -0
- package/dist/server/tools/session-search.js.map +1 -0
- package/dist/server/tools/sights-index.js +2 -2
- package/dist/server/tools/sights-index.js.map +1 -1
- package/dist/server/tools/smart-route.d.ts.map +1 -1
- package/dist/server/tools/smart-route.js +4 -5
- package/dist/server/tools/smart-route.js.map +1 -1
- package/dist/server/tools/verification.js +1 -1
- package/dist/server/tools/verification.js.map +1 -1
- package/files/agents/code-organization-supervisor.md +9 -0
- package/files/agents/context-guardian.md +9 -0
- package/files/agents/docs-keeper.md +11 -1
- package/files/agents/dry-refactor.md +12 -1
- package/files/agents/elite-code-refactorer.md +10 -0
- package/files/agents/hardening-guard.md +13 -1
- package/files/agents/implementation-dev.md +12 -1
- package/files/agents/merlin-access-control-reviewer.md +248 -0
- package/files/agents/merlin-api-designer.md +9 -0
- package/files/agents/merlin-codebase-mapper.md +9 -1
- package/files/agents/merlin-debugger.md +10 -0
- package/files/agents/merlin-dependency-auditor.md +216 -0
- package/files/agents/merlin-executor.md +12 -1
- package/files/agents/merlin-frontend.md +9 -0
- package/files/agents/merlin-input-validator.md +247 -0
- package/files/agents/merlin-integration-checker.md +9 -1
- package/files/agents/merlin-migrator.md +9 -0
- package/files/agents/merlin-milestone-auditor.md +8 -0
- package/files/agents/merlin-performance.md +8 -0
- package/files/agents/merlin-planner.md +10 -0
- package/files/agents/merlin-researcher.md +10 -0
- package/files/agents/merlin-reviewer.md +42 -7
- package/files/agents/merlin-sast-reviewer.md +182 -0
- package/files/agents/merlin-secret-scanner.md +203 -0
- package/files/agents/merlin-security.md +9 -0
- package/files/agents/merlin-verifier.md +9 -0
- package/files/agents/merlin-work-verifier.md +9 -0
- package/files/agents/merlin.md +10 -0
- package/files/agents/ops-railway.md +11 -1
- package/files/agents/orchestrator-retrofit.md +9 -1
- package/files/agents/product-spec.md +11 -1
- package/files/agents/remotion.md +8 -0
- package/files/agents/system-architect.md +11 -1
- package/files/agents/tests-qa.md +12 -1
- package/files/commands/merlin/course-correct.md +219 -0
- package/files/commands/merlin/debug.md +2 -2
- package/files/commands/merlin/execute-phase.md +96 -199
- package/files/commands/merlin/execute-plan.md +118 -182
- package/files/commands/merlin/health.md +385 -0
- package/files/commands/merlin/loop-recipes.md +93 -36
- package/files/commands/merlin/map-codebase.md +4 -4
- package/files/commands/merlin/next.md +240 -0
- package/files/commands/merlin/optimize-prompts.md +158 -0
- package/files/commands/merlin/plan-phase.md +1 -1
- package/files/commands/merlin/profiles.md +215 -0
- package/files/commands/merlin/promote.md +176 -0
- package/files/commands/merlin/quick.md +229 -0
- package/files/commands/merlin/readiness-gate.md +208 -0
- package/files/commands/merlin/research-phase.md +2 -2
- package/files/commands/merlin/research-project.md +4 -4
- package/files/commands/merlin/resume-work.md +27 -1
- package/files/commands/merlin/route.md +43 -1
- package/files/commands/merlin/sandbox.md +359 -0
- package/files/commands/merlin/usage.md +55 -0
- package/files/commands/merlin/verify-work.md +1 -1
- package/files/docker/Dockerfile.merlin +20 -0
- package/files/docker/docker-compose.merlin.yml +23 -0
- package/files/hook-templates/auto-commit.sh +64 -0
- package/files/hook-templates/auto-format.sh +95 -0
- package/files/hook-templates/auto-test.sh +117 -0
- package/files/hook-templates/branch-protection.sh +72 -0
- package/files/hook-templates/changelog-reminder.sh +76 -0
- package/files/hook-templates/complexity-check.sh +112 -0
- package/files/hook-templates/import-audit.sh +83 -0
- package/files/hook-templates/license-header.sh +84 -0
- package/files/hook-templates/pr-description.sh +100 -0
- package/files/hook-templates/todo-tracker.sh +80 -0
- package/files/hooks/check-file-size.sh +17 -4
- package/files/hooks/config-change.sh +44 -16
- package/files/hooks/instructions-loaded.sh +22 -5
- package/files/hooks/notify-desktop.sh +157 -0
- package/files/hooks/notify-webhook.sh +141 -0
- package/files/hooks/pre-edit-sights-check.sh +76 -9
- package/files/hooks/security-scanner.sh +153 -0
- package/files/hooks/session-end-memory-sync.sh +97 -0
- package/files/hooks/session-end.sh +274 -1
- package/files/hooks/session-start.sh +19 -6
- package/files/hooks/smart-approve.sh +270 -0
- package/files/hooks/teammate-idle-verify.sh +87 -12
- package/files/hooks/worktree-create.sh +20 -3
- package/files/hooks/worktree-remove.sh +21 -3
- package/files/merlin/references/plan-format.md +37 -9
- package/files/merlin/sandbox.json +9 -0
- package/files/merlin/security.json +11 -0
- package/files/merlin/templates/ci/docs-update.yml +81 -0
- package/files/merlin/templates/ci/pr-review.yml +50 -0
- package/files/merlin/templates/ci/security-audit.yml +74 -0
- package/files/merlin/templates/config.json +9 -1
- package/files/rules/api-rules.md +30 -0
- package/files/rules/frontend-rules.md +25 -0
- package/files/rules/hooks-rules.md +36 -0
- package/files/rules/mcp-rules.md +30 -0
- package/files/rules/worker-rules.md +29 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: merlin:execute-plan
|
|
3
3
|
description: Execute a PLAN.md file
|
|
4
|
-
argument-hint: "[path-to-PLAN.md]"
|
|
4
|
+
argument-hint: "[path-to-PLAN.md] [--teams]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
7
7
|
- Glob
|
|
@@ -22,13 +22,15 @@ Orchestrator stays lean: validate plan, determine mode, write handoff, spawn fre
|
|
|
22
22
|
handle checkpoints, report completion. The executor gets full 200K context.
|
|
23
23
|
|
|
24
24
|
No Task(). No shared context. Deterministic execution.
|
|
25
|
+
|
|
26
|
+
When a plan contains parallel task groups and `--teams` is active, each group spawns
|
|
27
|
+
as a named Teammate for true parallel execution within the single plan.
|
|
25
28
|
</objective>
|
|
26
29
|
|
|
27
30
|
<process>
|
|
28
31
|
|
|
29
32
|
## Step 1: Validate Plan Exists
|
|
30
33
|
|
|
31
|
-
Confirm file at $ARGUMENTS exists.
|
|
32
34
|
```bash
|
|
33
35
|
ls "$PLAN_PATH" 2>/dev/null
|
|
34
36
|
```
|
|
@@ -36,26 +38,30 @@ Error if not found: "Plan not found: {path}"
|
|
|
36
38
|
|
|
37
39
|
## Step 2: Check If Already Executed
|
|
38
40
|
|
|
39
|
-
Derive SUMMARY path from plan path (replace PLAN.md with SUMMARY.md).
|
|
40
41
|
```bash
|
|
41
42
|
SUMMARY_PATH="${PLAN_PATH/PLAN.md/SUMMARY.md}"
|
|
42
43
|
ls "$SUMMARY_PATH" 2>/dev/null
|
|
43
44
|
```
|
|
44
|
-
|
|
45
|
-
If SUMMARY exists: "Plan already executed. SUMMARY: {path}"
|
|
46
|
-
Offer: re-execute or exit.
|
|
45
|
+
If SUMMARY exists: "Plan already executed." Offer re-execute or exit.
|
|
47
46
|
|
|
48
47
|
## Step 3: Determine Mode
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
3. Check `~/.claude/merlin/settings.local.json`
|
|
49
|
+
1. Check args for `--teams`, `--automated`, `--interactive`
|
|
50
|
+
2. If no `--teams` flag, check env: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`
|
|
51
|
+
3. Check `.planning/config.json`, then `~/.claude/merlin/settings.local.json`
|
|
54
52
|
4. Default: `interactive`
|
|
55
53
|
|
|
54
|
+
```bash
|
|
55
|
+
TEAMS_MODE=false
|
|
56
|
+
if echo "${ARGUMENTS}" | grep -q '\-\-teams'; then
|
|
57
|
+
TEAMS_MODE=true
|
|
58
|
+
elif [ "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-0}" = "1" ]; then
|
|
59
|
+
TEAMS_MODE=true
|
|
60
|
+
fi
|
|
61
|
+
```
|
|
62
|
+
|
|
56
63
|
## Step 4: Get Sights Context
|
|
57
64
|
|
|
58
|
-
Parse plan to get the objective:
|
|
59
65
|
```bash
|
|
60
66
|
head -30 "$PLAN_PATH" 2>/dev/null
|
|
61
67
|
```
|
|
@@ -68,92 +74,74 @@ Task: "{objective from plan}"
|
|
|
68
74
|
## Step 5: Parse Plan Identifiers
|
|
69
75
|
|
|
70
76
|
Extract from path like `.planning/phases/03-auth/03-02-PLAN.md`:
|
|
71
|
-
|
|
72
|
-
- phase_name: `auth`
|
|
73
|
-
- plan_number: `02`
|
|
77
|
+
`phase_number=03`, `phase_name=auth`, `plan_number=02`
|
|
74
78
|
|
|
75
79
|
## Step 6: Pre-Execution Summary
|
|
76
80
|
|
|
77
|
-
Parse PLAN.md
|
|
78
|
-
- objective: First sentence from `<objective>` element
|
|
79
|
-
- task_count: Count of `<task` elements
|
|
80
|
-
- files: Collect unique file paths from `<files>` elements
|
|
81
|
+
Parse PLAN.md: objective, task_count, files, parallel_groups.
|
|
81
82
|
|
|
82
|
-
Display:
|
|
83
83
|
```
|
|
84
84
|
════════════════════════════════════════
|
|
85
85
|
EXECUTING: {phase_number}-{plan_number} {phase_name}
|
|
86
86
|
════════════════════════════════════════
|
|
87
|
-
|
|
88
87
|
Building: {objective one-liner}
|
|
89
|
-
Tasks: {task_count}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
Tasks: {task_count} | Files: {file list}
|
|
89
|
+
Mode: {interactive|automated|teams}
|
|
90
|
+
{if teams + parallel groups: "Parallel groups: {N} — will spawn {N} teammates"}
|
|
93
91
|
Full plan: {plan_path}
|
|
94
92
|
════════════════════════════════════════
|
|
95
93
|
```
|
|
96
94
|
|
|
97
95
|
## Step 7: Interactive Pre-Flight (interactive mode only)
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Ask user if they have any notes before execution:
|
|
102
|
-
- "Any specific concerns or constraints for this plan?"
|
|
103
|
-
- If user has none, proceed directly.
|
|
97
|
+
Ask: "Any specific concerns or constraints for this plan?"
|
|
98
|
+
Skip in automated and teams mode.
|
|
104
99
|
|
|
105
100
|
## Step 8: Write Handoff File
|
|
106
101
|
|
|
107
102
|
```bash
|
|
108
103
|
HANDOFF_DIR="/tmp/merlin-exec-$$"
|
|
109
104
|
mkdir -p "$HANDOFF_DIR"
|
|
110
|
-
HANDOFF_FILE="$HANDOFF_DIR/handoff.md"
|
|
111
105
|
```
|
|
112
106
|
|
|
113
|
-
|
|
107
|
+
Derive a concise session label (max 40 chars) from the plan path:
|
|
108
|
+
```bash
|
|
109
|
+
PLAN_LABEL=$(basename "${PLAN_PATH}" -PLAN.md | sed 's/^[0-9]*-[0-9]*-//')
|
|
110
|
+
SESSION_NAME="Merlin: merlin-executor — ${PLAN_LABEL}"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The `SESSION_NAME` appears in VS Code's Spark panel — keep it concise but descriptive.
|
|
114
114
|
|
|
115
115
|
```markdown
|
|
116
116
|
# Execution Handoff
|
|
117
|
-
|
|
118
|
-
## Plan
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
## Sights Context
|
|
127
|
-
{SIGHTS_CONTEXT}
|
|
128
|
-
|
|
129
|
-
## User Inputs
|
|
130
|
-
{USER_INPUTS or "Automated mode — make reasonable assumptions"}
|
|
131
|
-
|
|
132
|
-
## Files to Read
|
|
133
|
-
- Plan: {plan_path}
|
|
134
|
-
- State: .planning/STATE.md
|
|
135
|
-
- Config: .planning/config.json (if exists)
|
|
117
|
+
## Session: {SESSION_NAME}
|
|
118
|
+
## Plan: {plan_path}
|
|
119
|
+
## Mode: {interactive|automated|teams}
|
|
120
|
+
- automated: "Make reasonable assumptions. Do NOT checkpoint."
|
|
121
|
+
- interactive: "At decision points, output CHECKPOINT_NEEDED and stop."
|
|
122
|
+
- teams: "You are a Teammate. Make reasonable assumptions. Do NOT checkpoint."
|
|
123
|
+
## Sights Context: {SIGHTS_CONTEXT}
|
|
124
|
+
## User Inputs: {USER_INPUTS or "Automated — make reasonable assumptions"}
|
|
125
|
+
## Files to Read: plan_path, .planning/STATE.md, .planning/config.json
|
|
136
126
|
|
|
137
127
|
Read the plan file yourself — you have fresh 200K context.
|
|
138
128
|
|
|
139
|
-
## Result Protocol
|
|
140
|
-
When done, output:
|
|
141
|
-
|
|
129
|
+
## Result Protocol:
|
|
142
130
|
---EXEC_RESULT---
|
|
143
131
|
Status: completed | checkpoint | error
|
|
144
|
-
Summary: <2-3
|
|
145
|
-
Tasks-Completed: <
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
Files-Changed: <comma-separated list>
|
|
149
|
-
Checkpoint: <only if status=checkpoint — what you need>
|
|
132
|
+
Summary: <2-3 sentences>
|
|
133
|
+
Tasks-Completed: <N> Tasks-Total: <N>
|
|
134
|
+
Commits: <hash list> Files-Changed: <file list>
|
|
135
|
+
Checkpoint: <only if status=checkpoint>
|
|
150
136
|
---END_EXEC_RESULT---
|
|
151
137
|
```
|
|
152
138
|
|
|
153
|
-
## Step 9: Spawn
|
|
139
|
+
## Step 9: Spawn Executor
|
|
140
|
+
|
|
141
|
+
### Standard mode (interactive or automated)
|
|
154
142
|
|
|
155
143
|
```bash
|
|
156
|
-
RESULT=$(cat "$HANDOFF_FILE" | claude \
|
|
144
|
+
RESULT=$(unset CLAUDECODE && cat "$HANDOFF_FILE" | claude \
|
|
157
145
|
--agent merlin-executor \
|
|
158
146
|
-p \
|
|
159
147
|
--permission-mode acceptEdits \
|
|
@@ -164,157 +152,110 @@ EXIT_CODE=$?
|
|
|
164
152
|
|
|
165
153
|
Use Bash tool with `timeout: 600000` (10 minutes).
|
|
166
154
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
Parse result between `---EXEC_RESULT---` and `---END_EXEC_RESULT---`.
|
|
155
|
+
### Teams mode — parallel task groups within plan
|
|
170
156
|
|
|
171
|
-
|
|
157
|
+
When `TEAMS_MODE=true` and the plan has parallel task groups:
|
|
172
158
|
|
|
173
|
-
1.
|
|
159
|
+
1. Count parallel groups:
|
|
174
160
|
```bash
|
|
175
|
-
|
|
161
|
+
PARALLEL_GROUPS=$(grep -c "^parallel: true" "$PLAN_PATH" 2>/dev/null || echo "0")
|
|
176
162
|
```
|
|
177
|
-
|
|
163
|
+
|
|
164
|
+
2. If groups exist, write a per-group teammate handoff:
|
|
165
|
+
```markdown
|
|
166
|
+
# Teammate Task — Plan {PLAN_LABEL}, Group {GROUP_ID}
|
|
167
|
+
## Session Name: Merlin: merlin-executor — {PLAN_LABEL} group-{GROUP_ID}
|
|
168
|
+
## Plan: {PLAN_PATH} — execute only tasks in group {GROUP_ID}
|
|
169
|
+
## Mode: teams — make assumptions, do NOT checkpoint
|
|
170
|
+
## Sights Context: {SIGHTS_CONTEXT}
|
|
171
|
+
## Result Protocol: (same standard format)
|
|
178
172
|
```
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
Status: "completed"
|
|
173
|
+
|
|
174
|
+
3. Show live status during execution:
|
|
182
175
|
```
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
176
|
+
Plan {PLAN_LABEL} — {N} teammates active:
|
|
177
|
+
Teammate 1: merlin-executor — "Group 1: API endpoints"
|
|
178
|
+
Teammate 2: merlin-executor — "Group 2: Database schema" (done)
|
|
186
179
|
```
|
|
187
|
-
4. Go to Step 11 (Present Result).
|
|
188
180
|
|
|
189
|
-
|
|
181
|
+
4. Fallback if no parallel groups or Teams spawn fails: single executor.
|
|
182
|
+
Log: `[merlin] Running as single executor (no parallel groups or Teams unavailable)`
|
|
190
183
|
|
|
191
|
-
|
|
184
|
+
## Step 10: Handle Result
|
|
192
185
|
|
|
193
|
-
|
|
186
|
+
Parse result between `---EXEC_RESULT---` and `---END_EXEC_RESULT---`.
|
|
194
187
|
|
|
195
|
-
|
|
188
|
+
**completed:**
|
|
189
|
+
1. Verify SUMMARY.md created
|
|
190
|
+
2. Sync: `merlin_sync_task` → status: completed
|
|
191
|
+
3. `rm -rf "$HANDOFF_DIR"`
|
|
192
|
+
4. Go to Step 11
|
|
193
|
+
|
|
194
|
+
**checkpoint (interactive only):** Run Step 10a loop.
|
|
195
|
+
|
|
196
|
+
**error:** Present error, offer retry or skip.
|
|
196
197
|
|
|
197
198
|
## Step 10a: Checkpoint Loop (interactive mode only)
|
|
198
199
|
|
|
199
200
|
When executor returns `status: checkpoint`:
|
|
200
201
|
|
|
201
|
-
1.
|
|
202
|
+
1. Present to user:
|
|
202
203
|
```
|
|
203
|
-
|
|
204
|
-
║ CHECKPOINT: Executor needs input
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
Progress: {tasks-completed}/{tasks-total} tasks complete
|
|
208
|
-
|
|
204
|
+
╔═══════════════════════════════════════╗
|
|
205
|
+
║ CHECKPOINT: Executor needs input ║
|
|
206
|
+
╚═══════════════════════════════════════╝
|
|
207
|
+
Progress: {tasks-completed}/{tasks-total}
|
|
209
208
|
{checkpoint details}
|
|
210
|
-
|
|
211
|
-
────────────────────────────────────────────────────────────
|
|
212
209
|
Your response:
|
|
213
210
|
```
|
|
214
211
|
|
|
215
|
-
2.
|
|
212
|
+
2. Collect user response.
|
|
216
213
|
|
|
217
|
-
3.
|
|
214
|
+
3. Write continuation handoff:
|
|
218
215
|
```markdown
|
|
219
216
|
# Execution Continuation
|
|
220
|
-
|
|
221
|
-
##
|
|
222
|
-
{
|
|
223
|
-
|
|
224
|
-
##
|
|
225
|
-
|
|
226
|
-
Commits so far: {commits list}
|
|
227
|
-
Files changed so far: {files list}
|
|
228
|
-
|
|
229
|
-
## Checkpoint Response
|
|
230
|
-
User said: {user_response}
|
|
231
|
-
|
|
232
|
-
## Instructions
|
|
233
|
-
Continue executing the plan from where you left off.
|
|
234
|
-
Read the plan file to find remaining tasks.
|
|
235
|
-
The user has answered your checkpoint question.
|
|
236
|
-
|
|
237
|
-
## Result Protocol
|
|
238
|
-
(same as original)
|
|
217
|
+
## Original Plan: {plan_path}
|
|
218
|
+
## Previous Progress: {tasks-completed}/{tasks-total} complete
|
|
219
|
+
## Commits so far: {list} Files changed: {list}
|
|
220
|
+
## Checkpoint Response: User said: {user_response}
|
|
221
|
+
## Instructions: Continue from where you left off. Read plan for remaining tasks.
|
|
222
|
+
## Result Protocol: (same as original)
|
|
239
223
|
```
|
|
240
224
|
|
|
241
|
-
4.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
5. **Repeat** until `completed` or `error` (max 5 cycles).
|
|
225
|
+
4. Spawn NEW fresh process. NOT a resume.
|
|
226
|
+
5. Repeat until `completed` or `error` (max 5 cycles).
|
|
245
227
|
|
|
246
228
|
## Step 11: Present Result and Next Steps
|
|
247
229
|
|
|
248
|
-
Check remaining plans in phase:
|
|
249
230
|
```bash
|
|
250
231
|
PHASE_DIR=$(dirname "$PLAN_PATH")
|
|
251
232
|
PLAN_COUNT=$(ls -1 "$PHASE_DIR"/*-PLAN.md 2>/dev/null | wc -l)
|
|
252
233
|
SUMMARY_COUNT=$(ls -1 "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null | wc -l)
|
|
253
234
|
```
|
|
254
235
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
Find next PLAN.md without matching SUMMARY.md:
|
|
258
|
-
|
|
236
|
+
**More plans remain:**
|
|
259
237
|
```
|
|
260
|
-
Plan {phase}-{plan} complete.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
{SUMMARY_COUNT} of {PLAN_COUNT} plans complete for Phase {Z}.
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
|
|
267
|
-
## Next Up
|
|
268
|
-
|
|
269
|
-
**{phase}-{next-plan}: [Plan Name]**
|
|
270
|
-
|
|
271
|
-
`/merlin:execute-plan {next-plan-path}`
|
|
238
|
+
Plan {phase}-{plan} complete. {SUMMARY_COUNT}/{PLAN_COUNT} plans done for Phase {Z}.
|
|
239
|
+
Next: /merlin:execute-plan {next-plan-path}
|
|
272
240
|
```
|
|
273
241
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
Check verification status — spawn merlin-verifier as fresh process:
|
|
277
|
-
|
|
242
|
+
**Phase complete — spawn verifier:**
|
|
278
243
|
```bash
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
Phase: {phase_number} - {phase_name}
|
|
284
|
-
Phase goal: {phase_goal}
|
|
285
|
-
Phase directory: {phase_dir}
|
|
286
|
-
|
|
287
|
-
Check must_haves against actual codebase (not SUMMARY claims).
|
|
288
|
-
Create VERIFICATION.md in the phase directory.
|
|
289
|
-
|
|
290
|
-
---VERIFY_RESULT---
|
|
291
|
-
Status: passed | gaps_found | human_needed
|
|
292
|
-
Score: X/Y must-haves verified
|
|
293
|
-
Summary: <what was verified>
|
|
294
|
-
---END_VERIFY_RESULT---
|
|
295
|
-
VERIFY
|
|
296
|
-
|
|
297
|
-
# Spawn fresh verifier
|
|
298
|
-
VERIFY_RESULT=$(cat "/tmp/merlin-verify-$$/handoff.md" | claude \
|
|
299
|
-
--agent merlin-verifier \
|
|
300
|
-
-p \
|
|
301
|
-
--permission-mode acceptEdits \
|
|
302
|
-
--output-format text \
|
|
303
|
-
2>&1)
|
|
244
|
+
VERIFY_RESULT=$(unset CLAUDECODE && cat "/tmp/merlin-verify-$$/handoff.md" | claude \
|
|
245
|
+
--agent merlin-verifier -p --permission-mode acceptEdits \
|
|
246
|
+
--output-format text 2>&1)
|
|
304
247
|
```
|
|
305
248
|
|
|
306
|
-
|
|
307
|
-
- **passed + more phases:** Suggest `/merlin:plan-phase {next}`
|
|
308
|
-
- **passed + last phase:** Suggest `/merlin:complete-milestone`
|
|
309
|
-
- **gaps_found:** Suggest `/merlin:plan-phase {current} --gaps`
|
|
310
|
-
- **human_needed:** Present items for user review
|
|
311
|
-
|
|
312
|
-
### Update Requirements (when phase complete + verified)
|
|
249
|
+
Verifier handoff: check must_haves against actual codebase, create VERIFICATION.md.
|
|
313
250
|
|
|
314
|
-
|
|
251
|
+
Route: `passed + more phases` → `/merlin:plan-phase {next}` |
|
|
252
|
+
`passed + last phase` → `/merlin:complete-milestone` |
|
|
253
|
+
`gaps_found` → `/merlin:plan-phase {current} --gaps` |
|
|
254
|
+
`human_needed` → present items
|
|
315
255
|
|
|
316
|
-
|
|
256
|
+
**When phase complete + verified:** Update REQUIREMENTS.md status to "Complete".
|
|
317
257
|
|
|
258
|
+
**Commit phase metadata:**
|
|
318
259
|
```bash
|
|
319
260
|
git add .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md 2>/dev/null
|
|
320
261
|
git commit -m "docs({phase}): complete {phase-name} phase"
|
|
@@ -323,38 +264,33 @@ git commit -m "docs({phase}): complete {phase-name} phase"
|
|
|
323
264
|
</process>
|
|
324
265
|
|
|
325
266
|
<commit_rules>
|
|
326
|
-
**Per-Task Commits:** Handled by
|
|
327
|
-
**Plan Metadata Commit:** Handled by
|
|
267
|
+
**Per-Task Commits:** Handled by executor process (atomic per task).
|
|
268
|
+
**Plan Metadata Commit:** Handled by executor process (PLAN.md + SUMMARY.md).
|
|
328
269
|
**Phase Completion Commit:** Handled by this orchestrator (ROADMAP.md + STATE.md + REQUIREMENTS.md).
|
|
329
|
-
|
|
330
|
-
**NEVER use:** `git add .` or `git add -A`. Always stage files individually.
|
|
270
|
+
**NEVER use:** `git add .` or `git add -A`. Stage files individually.
|
|
331
271
|
</commit_rules>
|
|
332
272
|
|
|
333
273
|
<critical_rules>
|
|
334
|
-
|
|
335
274
|
**NEVER USE Task().** Task() shares parent context. Use `claude --agent -p` via Bash.
|
|
336
|
-
|
|
337
275
|
**ALWAYS FRESH PROCESS.** Every execution spawns a new `claude` process.
|
|
338
|
-
|
|
339
|
-
**CHECKPOINT = NEW PROCESS.** After a checkpoint, spawn a NEW fresh process with continuation state.
|
|
340
|
-
Never try to resume the old process.
|
|
341
|
-
|
|
276
|
+
**CHECKPOINT = NEW PROCESS.** Spawn NEW fresh process after checkpoint. Never resume old.
|
|
342
277
|
**MAX 10 MINUTES PER SPAWN.** For longer tasks, use `merlin-loop`.
|
|
343
|
-
|
|
344
278
|
**CLEAN UP HANDOFFS.** Remove /tmp files after processing.
|
|
345
|
-
|
|
279
|
+
**TEAMS MODE IS ADDITIVE.** Single-executor mode always works as fallback.
|
|
280
|
+
**TEAMS = NO CHECKPOINTS.** Teammates make assumptions, never checkpoint.
|
|
346
281
|
</critical_rules>
|
|
347
282
|
|
|
348
283
|
<success_criteria>
|
|
349
284
|
- [ ] Plan validated and not already executed
|
|
350
|
-
- [ ] Mode determined (interactive or
|
|
285
|
+
- [ ] Mode determined (interactive, automated, or teams)
|
|
351
286
|
- [ ] Handoff file written to /tmp
|
|
352
287
|
- [ ] Fresh `claude --agent merlin-executor -p` spawned via Bash
|
|
353
|
-
- [ ]
|
|
288
|
+
- [ ] Checkpoints handled (interactive) or none expected (automated/teams)
|
|
354
289
|
- [ ] SUMMARY.md created by executor
|
|
355
290
|
- [ ] Tasks synced to cloud
|
|
356
291
|
- [ ] Phase verification triggered if phase complete
|
|
357
292
|
- [ ] Requirements updated if phase complete
|
|
358
293
|
- [ ] Temp files cleaned up
|
|
359
294
|
- [ ] Next steps offered
|
|
295
|
+
- [ ] Teams: parallel groups shown with teammate names, fallback to single on failure
|
|
360
296
|
</success_criteria>
|