create-merlin-brain 3.11.0 → 3.13.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 +156 -32
- package/bin/runtime-adapters.cjs +396 -0
- package/dist/server/api/types.d.ts +7 -0
- package/dist/server/api/types.d.ts.map +1 -1
- 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/__tests__/augmentation.test.d.ts +8 -0
- package/dist/server/tools/__tests__/augmentation.test.d.ts.map +1 -0
- package/dist/server/tools/__tests__/augmentation.test.js +76 -0
- package/dist/server/tools/__tests__/augmentation.test.js.map +1 -0
- package/dist/server/tools/__tests__/route-helpers.test.d.ts +5 -0
- package/dist/server/tools/__tests__/route-helpers.test.d.ts.map +1 -0
- package/dist/server/tools/__tests__/route-helpers.test.js +49 -0
- package/dist/server/tools/__tests__/route-helpers.test.js.map +1 -0
- package/dist/server/tools/adaptive.js +1 -1
- package/dist/server/tools/adaptive.js.map +1 -1
- package/dist/server/tools/agent-spawn.d.ts +25 -0
- package/dist/server/tools/agent-spawn.d.ts.map +1 -0
- package/dist/server/tools/agent-spawn.js +95 -0
- package/dist/server/tools/agent-spawn.js.map +1 -0
- 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/augmentation.d.ts +45 -0
- package/dist/server/tools/augmentation.d.ts.map +1 -0
- package/dist/server/tools/augmentation.js +167 -0
- package/dist/server/tools/augmentation.js.map +1 -0
- 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-helpers.d.ts +45 -0
- package/dist/server/tools/route-helpers.d.ts.map +1 -0
- package/dist/server/tools/route-helpers.js +93 -0
- package/dist/server/tools/route-helpers.js.map +1 -0
- package/dist/server/tools/route.d.ts +4 -3
- package/dist/server/tools/route.d.ts.map +1 -1
- package/dist/server/tools/route.js +80 -284
- 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 +1 -0
- package/files/agents/context-guardian.md +1 -0
- package/files/agents/docs-keeper.md +1 -0
- package/files/agents/dry-refactor.md +1 -0
- package/files/agents/elite-code-refactorer.md +1 -0
- package/files/agents/hardening-guard.md +1 -0
- package/files/agents/implementation-dev.md +1 -0
- package/files/agents/merlin-access-control-reviewer.md +248 -0
- package/files/agents/merlin-codebase-mapper.md +1 -1
- package/files/agents/merlin-dependency-auditor.md +216 -0
- package/files/agents/merlin-executor.md +1 -0
- package/files/agents/merlin-input-validator.md +247 -0
- package/files/agents/merlin-reviewer.md +1 -0
- package/files/agents/merlin-sast-reviewer.md +182 -0
- package/files/agents/merlin-secret-scanner.md +203 -0
- package/files/agents/tests-qa.md +1 -0
- package/files/commands/merlin/execute-phase.md +94 -197
- package/files/commands/merlin/execute-plan.md +116 -180
- package/files/commands/merlin/health.md +385 -0
- package/files/commands/merlin/loop-recipes.md +93 -36
- package/files/commands/merlin/optimize-prompts.md +158 -0
- 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/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/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 +5 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: merlin:execute-phase
|
|
3
3
|
description: Execute all plans in a phase with wave-based parallelization
|
|
4
|
-
argument-hint: "<phase-number>"
|
|
4
|
+
argument-hint: "<phase-number> [--teams] [--automated]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
7
7
|
- Write
|
|
@@ -14,15 +14,13 @@ allowed-tools:
|
|
|
14
14
|
|
|
15
15
|
<objective>
|
|
16
16
|
Execute all plans in a phase using wave-based parallel execution with FRESH processes.
|
|
17
|
-
|
|
18
17
|
Each plan gets its own fresh `claude --agent merlin-executor -p` process with 200K context.
|
|
19
|
-
Parallel plans
|
|
20
|
-
|
|
21
|
-
No Task(). No shared context. Deterministic wave execution.
|
|
18
|
+
Parallel plans use git worktrees for file isolation, or Agent Teams when available.
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
- **Interactive**:
|
|
25
|
-
- **Automated**:
|
|
20
|
+
Three modes:
|
|
21
|
+
- **Interactive**: Ask user before each wave, handle checkpoints
|
|
22
|
+
- **Automated**: Sequential without user input, agents make assumptions
|
|
23
|
+
- **Teams**: Lead + teammates for true parallel execution (experimental, additive)
|
|
26
24
|
</objective>
|
|
27
25
|
|
|
28
26
|
<process>
|
|
@@ -30,12 +28,7 @@ Two modes:
|
|
|
30
28
|
## Step 1: Validate Phase Exists
|
|
31
29
|
|
|
32
30
|
```bash
|
|
33
|
-
# Find phase directory
|
|
34
31
|
ls -d .planning/phases/${PHASE_NUM}*/ 2>/dev/null
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Count PLAN.md files:
|
|
38
|
-
```bash
|
|
39
32
|
ls -1 .planning/phases/${PHASE_DIR}/*-PLAN.md 2>/dev/null | wc -l
|
|
40
33
|
```
|
|
41
34
|
|
|
@@ -43,219 +36,162 @@ Error if no plans found.
|
|
|
43
36
|
|
|
44
37
|
## Step 2: Determine Mode
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
3. Check `~/.claude/merlin/settings.local.json`
|
|
39
|
+
1. Check args for `--teams`, `--automated`, `--interactive`
|
|
40
|
+
2. If no `--teams` flag, check env: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`
|
|
41
|
+
3. Check `.planning/config.json`, then `~/.claude/merlin/settings.local.json`
|
|
50
42
|
4. Default: `interactive`
|
|
51
43
|
|
|
52
|
-
## Step 3: Discover Plans
|
|
53
|
-
|
|
54
|
-
List all *-PLAN.md files in phase directory.
|
|
55
|
-
Check which have *-SUMMARY.md (already complete).
|
|
56
|
-
Build list of incomplete plans.
|
|
57
|
-
|
|
58
44
|
```bash
|
|
59
|
-
|
|
60
|
-
|
|
45
|
+
TEAMS_MODE=false
|
|
46
|
+
if echo "${ARGUMENTS}" | grep -q '\-\-teams'; then
|
|
47
|
+
TEAMS_MODE=true
|
|
48
|
+
elif [ "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-0}" = "1" ]; then
|
|
49
|
+
TEAMS_MODE=true
|
|
50
|
+
fi
|
|
51
|
+
```
|
|
61
52
|
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
## Step 3: Discover Plans
|
|
54
|
+
|
|
55
|
+
List all `*-PLAN.md` files. Check which have matching `*-SUMMARY.md` (complete).
|
|
56
|
+
Report wave structure:
|
|
64
57
|
|
|
65
|
-
|
|
58
|
+
```
|
|
59
|
+
Phase {N}: {name} | Mode: {interactive|automated|teams}
|
|
60
|
+
Wave 1: plan-01, plan-02 (parallel)
|
|
61
|
+
Wave 2: plan-03 (sequential)
|
|
62
|
+
{X} plans total, {Y} incomplete, {Z} waves
|
|
66
63
|
```
|
|
67
64
|
|
|
68
65
|
## Step 4: Group by Wave
|
|
69
66
|
|
|
70
|
-
Read `wave` from each plan's frontmatter:
|
|
71
67
|
```bash
|
|
72
68
|
head -10 .planning/phases/${PHASE_DIR}/*-PLAN.md 2>/dev/null | grep -i "wave"
|
|
73
69
|
```
|
|
74
70
|
|
|
75
|
-
|
|
71
|
+
## Step 5: Interactive Wave Confirmation (interactive + teams only)
|
|
72
|
+
|
|
73
|
+
Before each wave show:
|
|
74
|
+
```
|
|
75
|
+
Wave {W}: Ready to execute — {list of plans}
|
|
76
|
+
[1] Execute [2] Skip [3] Single plan [4] Stop
|
|
76
77
|
```
|
|
77
|
-
Phase {N}: {name}
|
|
78
|
-
Mode: {interactive|automated}
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
Wave 2: plan-03 (sequential, depends on wave 1)
|
|
79
|
+
## Step 6: Execute Waves
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
```
|
|
81
|
+
### Teams Mode (TEAMS_MODE=true)
|
|
85
82
|
|
|
86
|
-
|
|
83
|
+
Orchestrator is the Lead. Each plan in a wave becomes a named Teammate.
|
|
87
84
|
|
|
88
|
-
|
|
85
|
+
Write per-plan handoffs, spawn teammates.
|
|
89
86
|
|
|
90
|
-
|
|
87
|
+
**Session naming (required — shows in VS Code Spark panel):**
|
|
91
88
|
```
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
Merlin: {agent-name} — {plan-label}
|
|
90
|
+
```
|
|
91
|
+
Where `plan-label` is the plan filename without the path and `-PLAN.md` suffix,
|
|
92
|
+
truncated to 40 chars. Example: `Merlin: merlin-executor — build-auth-middleware`
|
|
96
93
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
Show live progress during execution:
|
|
95
|
+
```
|
|
96
|
+
Wave {W} — {N} teammates active:
|
|
97
|
+
Teammate 1: implementation-dev — "Build auth middleware"
|
|
98
|
+
Teammate 2: tests-qa — "Write auth tests"
|
|
99
|
+
Teammate 3: docs-keeper — "Update API docs" (done)
|
|
101
100
|
```
|
|
102
101
|
|
|
103
|
-
|
|
102
|
+
Cross-agent context: when Wave N completes, append upstream SUMMARY findings
|
|
103
|
+
to Wave N+1 teammate handoffs (enables architect → impl-dev → tests-qa pipeline).
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
**Fallback:** If Agent Teams unavailable or spawn fails, log:
|
|
106
|
+
`[merlin] Agent Teams unavailable — falling back to worktree parallel mode`
|
|
107
|
+
then continue with the worktree strategy below.
|
|
106
108
|
|
|
107
|
-
|
|
109
|
+
Teammates never checkpoint — they make reasonable assumptions.
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
### Single Plan in Wave
|
|
110
112
|
|
|
111
113
|
```bash
|
|
112
114
|
HANDOFF_DIR="/tmp/merlin-phase-$$-wave-${W}"
|
|
113
115
|
mkdir -p "$HANDOFF_DIR"
|
|
114
116
|
|
|
115
|
-
# Write handoff for this plan
|
|
116
117
|
cat > "$HANDOFF_DIR/handoff.md" << EOF
|
|
117
118
|
# Execution Handoff
|
|
118
|
-
|
|
119
|
-
##
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
## Mode
|
|
123
|
-
${MODE}
|
|
124
|
-
${MODE_INSTRUCTION}
|
|
125
|
-
|
|
126
|
-
## Instructions
|
|
127
|
-
Read the plan file yourself. You have fresh 200K context.
|
|
128
|
-
Execute all tasks, make per-task commits, create SUMMARY.md.
|
|
129
|
-
|
|
130
|
-
## Result Protocol
|
|
119
|
+
## Plan: ${plan_path}
|
|
120
|
+
## Mode: ${MODE} — ${MODE_INSTRUCTION}
|
|
121
|
+
## Instructions: Read the plan file. Execute all tasks. Create SUMMARY.md.
|
|
122
|
+
## Result Protocol:
|
|
131
123
|
---EXEC_RESULT---
|
|
132
124
|
Status: completed | checkpoint | error
|
|
133
125
|
Summary: <2-3 sentences>
|
|
134
|
-
Tasks-Completed: <N>
|
|
135
|
-
|
|
136
|
-
Commits: <hash list>
|
|
137
|
-
Files-Changed: <file list>
|
|
126
|
+
Tasks-Completed: <N> Tasks-Total: <N>
|
|
127
|
+
Commits: <hash list> Files-Changed: <file list>
|
|
138
128
|
Checkpoint: <if needed>
|
|
139
129
|
---END_EXEC_RESULT---
|
|
140
130
|
EOF
|
|
141
131
|
|
|
142
|
-
# Spawn fresh executor
|
|
143
132
|
RESULT=$(unset CLAUDECODE && cat "$HANDOFF_DIR/handoff.md" | claude \
|
|
144
|
-
--agent merlin-executor \
|
|
145
|
-
-
|
|
146
|
-
--permission-mode acceptEdits \
|
|
147
|
-
--output-format text \
|
|
148
|
-
2>&1)
|
|
133
|
+
--agent merlin-executor -p --permission-mode acceptEdits \
|
|
134
|
+
--output-format text 2>&1)
|
|
149
135
|
```
|
|
150
136
|
|
|
151
|
-
### Multiple Plans in Wave (
|
|
152
|
-
|
|
153
|
-
Create git worktree per plan for file isolation:
|
|
137
|
+
### Multiple Plans in Wave (worktrees)
|
|
154
138
|
|
|
155
139
|
```bash
|
|
156
140
|
REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
157
141
|
REPO_NAME=$(basename "$REPO_ROOT")
|
|
158
|
-
CURRENT_BRANCH=$(git branch --show-current)
|
|
159
142
|
|
|
160
|
-
# Create worktree for each plan
|
|
161
143
|
git worktree add "${REPO_ROOT}/../${REPO_NAME}-worktree-01" -b merlin/worktree-01
|
|
162
144
|
git worktree add "${REPO_ROOT}/../${REPO_NAME}-worktree-02" -b merlin/worktree-02
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Spawn parallel fresh processes (use `&` and `wait`):
|
|
166
145
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
unset CLAUDECODE && cat "$HANDOFF_DIR/plan-01.md" | claude \
|
|
171
|
-
--agent merlin-executor \
|
|
172
|
-
-p \
|
|
173
|
-
--permission-mode acceptEdits \
|
|
174
|
-
--output-format text \
|
|
146
|
+
(cd "${REPO_ROOT}/../${REPO_NAME}-worktree-01" && unset CLAUDECODE && \
|
|
147
|
+
cat "$HANDOFF_DIR/plan-01.md" | claude --agent merlin-executor -p \
|
|
148
|
+
--permission-mode acceptEdits --output-format text \
|
|
175
149
|
> "$HANDOFF_DIR/result-01.txt" 2>&1) &
|
|
176
150
|
PID1=$!
|
|
177
151
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
--agent merlin-executor \
|
|
182
|
-
-p \
|
|
183
|
-
--permission-mode acceptEdits \
|
|
184
|
-
--output-format text \
|
|
152
|
+
(cd "${REPO_ROOT}/../${REPO_NAME}-worktree-02" && unset CLAUDECODE && \
|
|
153
|
+
cat "$HANDOFF_DIR/plan-02.md" | claude --agent merlin-executor -p \
|
|
154
|
+
--permission-mode acceptEdits --output-format text \
|
|
185
155
|
> "$HANDOFF_DIR/result-02.txt" 2>&1) &
|
|
186
156
|
PID2=$!
|
|
187
157
|
|
|
188
|
-
# Wait for all to complete
|
|
189
158
|
wait $PID1 $PID2
|
|
190
|
-
```
|
|
191
159
|
|
|
192
|
-
**After wave completes, merge back:**
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
160
|
cd "$REPO_ROOT"
|
|
196
161
|
git merge merlin/worktree-01 --no-edit
|
|
197
162
|
git merge merlin/worktree-02 --no-edit
|
|
198
|
-
|
|
199
|
-
# Clean up
|
|
200
163
|
git worktree remove "${REPO_ROOT}/../${REPO_NAME}-worktree-01" --force
|
|
201
164
|
git worktree remove "${REPO_ROOT}/../${REPO_NAME}-worktree-02" --force
|
|
202
165
|
git branch -d merlin/worktree-01 merlin/worktree-02
|
|
203
166
|
```
|
|
204
167
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
**Fallback (worktree fails):** Run plans sequentially in main repo.
|
|
168
|
+
If merge conflicts: abort, report files, offer resolution.
|
|
169
|
+
Fallback if worktree fails: run plans sequentially.
|
|
208
170
|
|
|
209
|
-
### Checkpoint Handling
|
|
171
|
+
### Checkpoint Handling (interactive mode only)
|
|
210
172
|
|
|
211
|
-
If
|
|
212
|
-
1. Present
|
|
213
|
-
2.
|
|
214
|
-
3.
|
|
215
|
-
4. Wait for completion before proceeding to next wave
|
|
173
|
+
If a plan returns `status: checkpoint`:
|
|
174
|
+
1. Present checkpoint, collect user response
|
|
175
|
+
2. Spawn NEW fresh process with continuation handoff
|
|
176
|
+
3. Wait for completion before next wave
|
|
216
177
|
|
|
217
|
-
|
|
178
|
+
Automated and teams mode: agents make assumptions, no checkpoints expected.
|
|
218
179
|
|
|
219
180
|
## Step 7: Verify Phase Goal
|
|
220
181
|
|
|
221
|
-
After all plans complete, spawn merlin-verifier as fresh process:
|
|
222
|
-
|
|
223
182
|
```bash
|
|
224
|
-
cat > "/tmp/merlin-verify-$$/handoff.md" << EOF
|
|
225
|
-
Verify phase ${PHASE_NUM} goal achievement.
|
|
226
|
-
|
|
227
|
-
Phase: ${PHASE_NUM} - ${PHASE_NAME}
|
|
228
|
-
Phase goal: ${PHASE_GOAL}
|
|
229
|
-
Phase directory: ${PHASE_DIR}
|
|
230
|
-
|
|
231
|
-
Check must_haves against actual codebase.
|
|
232
|
-
Create VERIFICATION.md in the phase directory.
|
|
233
|
-
|
|
234
|
-
---VERIFY_RESULT---
|
|
235
|
-
Status: passed | gaps_found | human_needed
|
|
236
|
-
Score: X/Y must-haves verified
|
|
237
|
-
Summary: <verification summary>
|
|
238
|
-
---END_VERIFY_RESULT---
|
|
239
|
-
EOF
|
|
240
|
-
|
|
241
183
|
VERIFY_RESULT=$(unset CLAUDECODE && cat "/tmp/merlin-verify-$$/handoff.md" | claude \
|
|
242
|
-
--agent merlin-verifier \
|
|
243
|
-
-
|
|
244
|
-
--permission-mode acceptEdits \
|
|
245
|
-
--output-format text \
|
|
246
|
-
2>&1)
|
|
184
|
+
--agent merlin-verifier -p --permission-mode acceptEdits \
|
|
185
|
+
--output-format text 2>&1)
|
|
247
186
|
```
|
|
248
187
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
- `gaps_found` → Present gaps, offer `/merlin:plan-phase {X} --gaps`
|
|
188
|
+
Handoff asks verifier to check must_haves against codebase and create VERIFICATION.md.
|
|
189
|
+
|
|
190
|
+
Route: `passed` → Step 8 | `human_needed` → present items | `gaps_found` → offer `--gaps`
|
|
253
191
|
|
|
254
192
|
## Step 8: Update Roadmap, State, and Requirements
|
|
255
193
|
|
|
256
|
-
Update ROADMAP.md phase status to
|
|
257
|
-
Update STATE.md with new position.
|
|
258
|
-
Update REQUIREMENTS.md — mark phase requirements as "Complete".
|
|
194
|
+
Update ROADMAP.md phase status, STATE.md position, REQUIREMENTS.md phase items to "Complete".
|
|
259
195
|
|
|
260
196
|
## Step 9: Commit Phase Completion
|
|
261
197
|
|
|
@@ -268,75 +204,36 @@ git commit -m "docs(${PHASE_NUM}): complete ${PHASE_NAME} phase"
|
|
|
268
204
|
|
|
269
205
|
## Step 10: Offer Next Steps
|
|
270
206
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
```
|
|
275
|
-
## Phase {Z}: {Name} Complete
|
|
276
|
-
|
|
277
|
-
All {Y} plans finished. Phase goal verified.
|
|
278
|
-
|
|
279
|
-
---
|
|
280
|
-
|
|
281
|
-
## Next Up
|
|
282
|
-
|
|
283
|
-
**Phase {Z+1}: {Name}** — {Goal}
|
|
284
|
-
|
|
285
|
-
`/merlin:plan-phase {Z+1}`
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
**Phase verified, milestone complete:**
|
|
289
|
-
```
|
|
290
|
-
ALL PHASES COMPLETE!
|
|
291
|
-
|
|
292
|
-
`/merlin:audit-milestone`
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
**Gaps found:**
|
|
296
|
-
```
|
|
297
|
-
## Phase {Z}: {Name} — Gaps Found
|
|
298
|
-
|
|
299
|
-
Score: {N}/{M} must-haves verified
|
|
300
|
-
|
|
301
|
-
`/merlin:plan-phase {Z} --gaps`
|
|
302
|
-
```
|
|
207
|
+
- More phases remain: suggest `/merlin:plan-phase {Z+1}`
|
|
208
|
+
- Milestone complete: suggest `/merlin:audit-milestone`
|
|
209
|
+
- Gaps found: suggest `/merlin:plan-phase {Z} --gaps`
|
|
303
210
|
|
|
304
211
|
</process>
|
|
305
212
|
|
|
306
213
|
<deviation_rules>
|
|
307
|
-
Deviations
|
|
308
|
-
- Auto-fix bugs:
|
|
309
|
-
-
|
|
310
|
-
- Auto-fix blockers: Executor handles, documents in Summary
|
|
311
|
-
- Architectural changes: Executor checkpoints (interactive) or makes decision (automated)
|
|
214
|
+
Deviations handled by executor processes, not this orchestrator.
|
|
215
|
+
- Auto-fix bugs / critical additions / blockers: executor handles, documents in Summary
|
|
216
|
+
- Architectural changes: executor checkpoints (interactive) or decides (automated/teams)
|
|
312
217
|
</deviation_rules>
|
|
313
218
|
|
|
314
219
|
<critical_rules>
|
|
315
|
-
|
|
316
220
|
**NEVER USE Task().** All execution uses `claude --agent -p` via Bash.
|
|
317
|
-
|
|
318
221
|
**EVERY PLAN = FRESH PROCESS.** Each plan in a wave gets its own 200K context.
|
|
319
|
-
|
|
320
|
-
**PARALLEL = WORKTREES.** Multiple plans in a wave use git worktrees for file isolation.
|
|
321
|
-
|
|
222
|
+
**PARALLEL = WORKTREES OR TEAMS.** Never share file state between parallel plans.
|
|
322
223
|
**ALWAYS CLEAN UP.** Remove worktrees and /tmp files after processing.
|
|
323
|
-
|
|
324
224
|
**CHECKPOINT = NEW PROCESS.** After checkpoints, spawn fresh continuation processes.
|
|
325
|
-
|
|
326
225
|
**ORCHESTRATOR STAYS LEAN.** Only reads wave structure and result summaries.
|
|
327
|
-
|
|
328
|
-
|
|
226
|
+
**TEAMS MODE IS ADDITIVE.** Worktree and sequential modes always work as fallback.
|
|
329
227
|
</critical_rules>
|
|
330
228
|
|
|
331
229
|
<success_criteria>
|
|
332
|
-
- [ ] All incomplete plans
|
|
230
|
+
- [ ] All incomplete plans executed via fresh processes
|
|
333
231
|
- [ ] Each plan has SUMMARY.md
|
|
334
|
-
- [ ] Parallel plans used worktrees for isolation
|
|
232
|
+
- [ ] Parallel plans used worktrees or Agent Teams for isolation
|
|
335
233
|
- [ ] Phase goal verified (fresh verifier process)
|
|
336
234
|
- [ ] VERIFICATION.md created in phase directory
|
|
337
|
-
- [ ] STATE.md
|
|
338
|
-
- [ ] ROADMAP.md updated
|
|
339
|
-
- [ ] REQUIREMENTS.md updated
|
|
235
|
+
- [ ] STATE.md, ROADMAP.md, REQUIREMENTS.md updated
|
|
340
236
|
- [ ] All worktrees and temp files cleaned up
|
|
341
237
|
- [ ] User informed of next steps
|
|
238
|
+
- [ ] Teams: teammate names displayed, cross-agent context passed between waves
|
|
342
239
|
</success_criteria>
|