create-merlin-brain 3.9.0 → 3.11.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/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +11 -0
- package/dist/server/server.js.map +1 -1
- package/dist/server/tools/route.d.ts.map +1 -1
- package/dist/server/tools/route.js +72 -21
- package/dist/server/tools/route.js.map +1 -1
- package/dist/server/tools/smart-route.d.ts +12 -0
- package/dist/server/tools/smart-route.d.ts.map +1 -0
- package/dist/server/tools/smart-route.js +156 -0
- package/dist/server/tools/smart-route.js.map +1 -0
- package/files/agents/code-organization-supervisor.md +8 -0
- package/files/agents/context-guardian.md +8 -0
- package/files/agents/docs-keeper.md +10 -1
- package/files/agents/dry-refactor.md +11 -1
- package/files/agents/elite-code-refactorer.md +9 -0
- package/files/agents/hardening-guard.md +12 -1
- package/files/agents/implementation-dev.md +11 -1
- package/files/agents/merlin-api-designer.md +9 -0
- package/files/agents/merlin-codebase-mapper.md +8 -0
- package/files/agents/merlin-debugger.md +10 -0
- package/files/agents/merlin-executor.md +11 -1
- package/files/agents/merlin-frontend.md +9 -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 +41 -7
- 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 +28 -3
- 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 +11 -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 +4 -4
- package/files/commands/merlin/execute-plan.md +2 -2
- package/files/commands/merlin/map-codebase.md +4 -4
- package/files/commands/merlin/next.md +240 -0
- package/files/commands/merlin/plan-phase.md +1 -1
- 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/verify-work.md +1 -1
- package/files/hooks/session-start.sh +47 -1
- package/package.json +1 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merlin:next
|
|
3
|
+
description: Smart navigator — detects state and recommends the single best next action
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Bash
|
|
7
|
+
- Grep
|
|
8
|
+
- Glob
|
|
9
|
+
- mcp__merlin__merlin_get_project_status
|
|
10
|
+
- mcp__merlin__merlin_get_context
|
|
11
|
+
- mcp__merlin__merlin_get_next_task
|
|
12
|
+
- mcp__merlin__merlin_ensure_tasks
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
Answer one question: what should you do RIGHT NOW?
|
|
17
|
+
|
|
18
|
+
This is the "I just opened my laptop" command. No long reports. No history.
|
|
19
|
+
One recommended action, instantly. Merlin Sights powers the detection so the
|
|
20
|
+
answer reflects real project state, not guesswork.
|
|
21
|
+
</objective>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<process>
|
|
25
|
+
|
|
26
|
+
<step name="status">
|
|
27
|
+
**Get project status from Merlin Cloud.**
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Call: merlin_get_project_status
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Note: checkpoint existence, blocker flags, task counts, recommended_action.
|
|
34
|
+
</step>
|
|
35
|
+
|
|
36
|
+
<step name="detect">
|
|
37
|
+
**Detect state in priority order. Stop at the first match.**
|
|
38
|
+
|
|
39
|
+
**P1 — Active checkpoint**
|
|
40
|
+
|
|
41
|
+
If `merlin_get_project_status` reports a checkpoint, or if
|
|
42
|
+
`.planning/HANDOFF.md` exists → go to **Route: Resume**.
|
|
43
|
+
|
|
44
|
+
**P2 — Blockers**
|
|
45
|
+
|
|
46
|
+
If STATE.md contains lines under a "Blockers" heading with content →
|
|
47
|
+
go to **Route: Blocker**.
|
|
48
|
+
|
|
49
|
+
**P3 — UAT gaps**
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
grep -rl "status: diagnosed" .planning/phases/ 2>/dev/null | head -1
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If any file found → go to **Route: UAT Gaps**.
|
|
56
|
+
|
|
57
|
+
**P4 — Unexecuted plans**
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
ls -1 .planning/phases/*/*.planning*-PLAN.md 2>/dev/null
|
|
61
|
+
ls -1 .planning/phases/*/*-PLAN.md 2>/dev/null
|
|
62
|
+
ls -1 .planning/phases/*/*-SUMMARY.md 2>/dev/null
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Compare plan count vs summary count per phase directory.
|
|
66
|
+
If any phase has more PLANs than SUMMARYs → go to **Route: Execute Plan**.
|
|
67
|
+
|
|
68
|
+
**P5 — Unplanned phase**
|
|
69
|
+
|
|
70
|
+
Read ROADMAP.md. Check current phase number from STATE.md.
|
|
71
|
+
If the current phase directory has 0 PLAN.md files → go to **Route: Plan Phase**.
|
|
72
|
+
If the next phase directory does not exist yet → go to **Route: Plan Phase** (next N).
|
|
73
|
+
|
|
74
|
+
**P6 — Pending todos**
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
ls .planning/todos/pending/*.md 2>/dev/null | wc -l
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If count > 0 → go to **Route: Todos**.
|
|
81
|
+
|
|
82
|
+
**P7 — Milestone complete**
|
|
83
|
+
|
|
84
|
+
If all phases in current milestone have matching PLAN+SUMMARY counts and
|
|
85
|
+
no ROADMAP.md exists but PROJECT.md does → go to **Route: Between Milestones**.
|
|
86
|
+
|
|
87
|
+
If ROADMAP.md exists and current phase = highest phase number in milestone
|
|
88
|
+
and all plans have summaries → go to **Route: Complete Milestone**.
|
|
89
|
+
|
|
90
|
+
**P8 — No planning structure**
|
|
91
|
+
|
|
92
|
+
If no `.planning/` directory → go to **Route: No Project**.
|
|
93
|
+
If no ROADMAP.md and no PROJECT.md → go to **Route: No Project**.
|
|
94
|
+
If PROJECT.md exists but no ROADMAP.md → go to **Route: New Roadmap**.
|
|
95
|
+
</step>
|
|
96
|
+
|
|
97
|
+
<step name="output">
|
|
98
|
+
**Output exactly one recommendation. Be brief.**
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
**Route: Resume**
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Next -> /merlin:resume-work
|
|
106
|
+
Checkpoint found: [description from HANDOFF.md or status]
|
|
107
|
+
|
|
108
|
+
[1] Resume from checkpoint
|
|
109
|
+
[2] See full status (/merlin:progress)
|
|
110
|
+
[3] Do something else
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
**Route: Blocker**
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
Next -> Address blocker first
|
|
119
|
+
[blocker description from STATE.md]
|
|
120
|
+
|
|
121
|
+
Resolve the blocker, then re-run /merlin:next.
|
|
122
|
+
|
|
123
|
+
[1] See full status (/merlin:progress)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
**Route: UAT Gaps**
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
Next -> /merlin:plan-phase [N] --gaps
|
|
132
|
+
[N] gap(s) found in [phase-name] UAT
|
|
133
|
+
|
|
134
|
+
[1] Plan gap fixes
|
|
135
|
+
[2] See full status (/merlin:progress)
|
|
136
|
+
[3] Skip and continue
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
**Route: Execute Plan**
|
|
142
|
+
|
|
143
|
+
Find the first PLAN.md without a matching SUMMARY.md. Read its `<objective>`.
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
Next -> /merlin:execute-plan [full-path-to-PLAN.md]
|
|
147
|
+
[Phase N, Plan M]: [one-line objective]
|
|
148
|
+
|
|
149
|
+
[1] Execute this plan
|
|
150
|
+
[2] See full status (/merlin:progress)
|
|
151
|
+
[3] Do something else
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
**Route: Plan Phase**
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
Next -> /merlin:plan-phase [N]
|
|
160
|
+
Phase [N]: [phase name from ROADMAP.md]
|
|
161
|
+
|
|
162
|
+
[1] Plan this phase
|
|
163
|
+
[2] Gather context first (/merlin:discuss-phase [N])
|
|
164
|
+
[3] See full status (/merlin:progress)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
**Route: Todos**
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
Next -> /merlin:check-todos
|
|
173
|
+
[count] pending todo(s) need review
|
|
174
|
+
|
|
175
|
+
[1] Review todos
|
|
176
|
+
[2] See full status (/merlin:progress)
|
|
177
|
+
[3] Skip for now
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
**Route: Complete Milestone**
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
Next -> /merlin:complete-milestone
|
|
186
|
+
All phases done — milestone ready to close
|
|
187
|
+
|
|
188
|
+
[1] Complete milestone
|
|
189
|
+
[2] Verify first (/merlin:verify-work)
|
|
190
|
+
[3] See full status (/merlin:progress)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
**Route: Between Milestones**
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
Next -> /merlin:discuss-milestone
|
|
199
|
+
Last milestone complete — ready to plan what's next
|
|
200
|
+
|
|
201
|
+
[1] Discuss next milestone
|
|
202
|
+
[2] See full status (/merlin:progress)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
**Route: New Roadmap**
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
Next -> /merlin:create-roadmap
|
|
211
|
+
PROJECT.md exists but no roadmap yet
|
|
212
|
+
|
|
213
|
+
[1] Create roadmap
|
|
214
|
+
[2] See full status (/merlin:progress)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
**Route: No Project**
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
Next -> /merlin:new-project
|
|
223
|
+
No planning structure found
|
|
224
|
+
|
|
225
|
+
[1] Start a new project
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
</step>
|
|
231
|
+
|
|
232
|
+
</process>
|
|
233
|
+
|
|
234
|
+
<success_criteria>
|
|
235
|
+
- [ ] Responds in under 10 lines of output
|
|
236
|
+
- [ ] One clear action recommended
|
|
237
|
+
- [ ] Priority order respected (checkpoint > blockers > UAT > execute > plan)
|
|
238
|
+
- [ ] Numbered options always present
|
|
239
|
+
- [ ] Full status always available as an option
|
|
240
|
+
</success_criteria>
|
|
@@ -149,7 +149,7 @@ Summary: <2-3 sentence summary>
|
|
|
149
149
|
## Step 8: Spawn Fresh Planner Process
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
|
-
RESULT=$(cat "$HANDOFF_FILE" | claude \
|
|
152
|
+
RESULT=$(unset CLAUDECODE && cat "$HANDOFF_FILE" | claude \
|
|
153
153
|
--agent merlin-planner \
|
|
154
154
|
-p \
|
|
155
155
|
--permission-mode acceptEdits \
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merlin:readiness-gate
|
|
3
|
+
description: Validate planning completeness before implementation begins
|
|
4
|
+
argument-hint: "<phase-number>"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Bash
|
|
8
|
+
- Grep
|
|
9
|
+
- Glob
|
|
10
|
+
- mcp__merlin__merlin_get_context
|
|
11
|
+
- mcp__merlin__merlin_get_project_status
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<objective>
|
|
15
|
+
Validate that planning artifacts are complete and coherent before any implementation begins.
|
|
16
|
+
|
|
17
|
+
Prevents the #1 failure mode: starting to code with incomplete, ambiguous, or uncovered specs.
|
|
18
|
+
|
|
19
|
+
Runs 6 checks and returns a READY / NEEDS WORK / NOT READY verdict with specific issues to fix.
|
|
20
|
+
</objective>
|
|
21
|
+
|
|
22
|
+
<process>
|
|
23
|
+
|
|
24
|
+
## Step 1: Parse Arguments
|
|
25
|
+
|
|
26
|
+
Extract from $ARGUMENTS:
|
|
27
|
+
- **phase**: Phase number (e.g., "4", "2.1") — or "current" to auto-detect from STATE.md
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# If "current" or empty, read current phase from STATE
|
|
31
|
+
head -30 .planning/STATE.md 2>/dev/null
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Resolve phase name from ROADMAP.md:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
grep -A 5 "Phase ${PHASE_NUM}" .planning/ROADMAP.md 2>/dev/null | head -6
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Step 2: Document Discovery
|
|
41
|
+
|
|
42
|
+
Check that required planning documents exist. Record each as present (✅) or missing (❌).
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
ls .planning/PROJECT.md 2>/dev/null
|
|
46
|
+
ls .planning/ROADMAP.md 2>/dev/null
|
|
47
|
+
ls .planning/REQUIREMENTS.md 2>/dev/null
|
|
48
|
+
ls .planning/phases/${PHASE_DIR}/*-PLAN.md 2>/dev/null
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Track:
|
|
52
|
+
- `doc_project`: present or missing
|
|
53
|
+
- `doc_roadmap`: present or missing
|
|
54
|
+
- `doc_requirements`: present or missing
|
|
55
|
+
- `plan_count`: number of PLAN.md files found for the phase
|
|
56
|
+
|
|
57
|
+
If `doc_project`, `doc_roadmap`, and `doc_requirements` are all missing: emit **NOT READY** immediately — planning has not started. Skip remaining steps.
|
|
58
|
+
|
|
59
|
+
## Step 3: Requirements Analysis
|
|
60
|
+
|
|
61
|
+
Read `.planning/REQUIREMENTS.md`. For each requirement, check:
|
|
62
|
+
|
|
63
|
+
1. Has at least one explicit acceptance criterion (a testable condition — not a vague goal)
|
|
64
|
+
2. Does not contain ambiguous modal verbs: "should", "might", "could", "may"
|
|
65
|
+
3. Is expressed as a testable condition (something that can pass or fail a test)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
grep -n "should\|might\|could\| may " .planning/REQUIREMENTS.md 2>/dev/null
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Track:
|
|
72
|
+
- `req_total`: total requirements found
|
|
73
|
+
- `req_testable`: requirements that meet all three conditions
|
|
74
|
+
- `req_ambiguous`: list of requirement IDs / lines with vague language
|
|
75
|
+
|
|
76
|
+
Result label: `{req_testable}/{req_total} requirements are testable`
|
|
77
|
+
|
|
78
|
+
## Step 4: Plan Coverage
|
|
79
|
+
|
|
80
|
+
Cross-reference PLAN.md task descriptions against requirement IDs in REQUIREMENTS.md.
|
|
81
|
+
|
|
82
|
+
For each requirement ID (e.g., R-4.1, R-4.2), check whether at least one PLAN.md file references or addresses it — either by ID or by matching keyword.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# List requirement IDs
|
|
86
|
+
grep -E "^R-[0-9]" .planning/REQUIREMENTS.md 2>/dev/null
|
|
87
|
+
|
|
88
|
+
# Check plan files for coverage
|
|
89
|
+
grep -l "${REQ_ID}" .planning/phases/${PHASE_DIR}/*-PLAN.md 2>/dev/null
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Track:
|
|
93
|
+
- `covered_reqs`: requirements mentioned in at least one plan
|
|
94
|
+
- `uncovered_reqs`: requirements with no matching plan task (list them)
|
|
95
|
+
|
|
96
|
+
Result label: flag each uncovered requirement by ID.
|
|
97
|
+
|
|
98
|
+
## Step 5: Dependency Check
|
|
99
|
+
|
|
100
|
+
Verify upstream phases are complete and external dependencies are documented.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Check that all prior phases have SUMMARY.md
|
|
104
|
+
for prev_phase in all phases numbered below current; do
|
|
105
|
+
ls .planning/phases/${prev_phase_dir}/*-SUMMARY.md 2>/dev/null
|
|
106
|
+
done
|
|
107
|
+
|
|
108
|
+
# Check STATE.md for documented external dependencies
|
|
109
|
+
grep -i "depend\|external\|blocker\|prerequisite" .planning/STATE.md 2>/dev/null
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Track:
|
|
113
|
+
- `prior_phases_complete`: all prior phases have at least one SUMMARY.md (true/false)
|
|
114
|
+
- `missing_summaries`: list of prior phase directories with no SUMMARY.md
|
|
115
|
+
- `external_deps_noted`: whether dependencies section exists in STATE.md
|
|
116
|
+
|
|
117
|
+
## Step 6: Plan Quality
|
|
118
|
+
|
|
119
|
+
For each PLAN.md in the phase, check:
|
|
120
|
+
|
|
121
|
+
1. Has a non-empty `<objective>` section
|
|
122
|
+
2. Has at least one explicit success criterion
|
|
123
|
+
3. References specific file paths (not just vague descriptions like "update the code")
|
|
124
|
+
4. Scope is reasonable — fewer than 15 distinct tasks in one plan
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Read each PLAN.md for the phase
|
|
128
|
+
for plan in .planning/phases/${PHASE_DIR}/*-PLAN.md; do
|
|
129
|
+
grep -c "<objective>" "$plan" 2>/dev/null
|
|
130
|
+
grep -i "success.criteria\|acceptance\|done when" "$plan" 2>/dev/null
|
|
131
|
+
grep -E "\.(ts|js|py|go|md|json|yaml|sh)" "$plan" 2>/dev/null | wc -l
|
|
132
|
+
done
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Track per plan:
|
|
136
|
+
- `has_objective`: true/false
|
|
137
|
+
- `has_success_criteria`: true/false
|
|
138
|
+
- `has_file_refs`: true/false
|
|
139
|
+
- `quality_issues`: list of specific deficiencies per plan name
|
|
140
|
+
|
|
141
|
+
## Step 7: Final Assessment
|
|
142
|
+
|
|
143
|
+
Compute verdict:
|
|
144
|
+
|
|
145
|
+
| Condition | Verdict |
|
|
146
|
+
|-----------|---------|
|
|
147
|
+
| Any required doc missing | NOT READY |
|
|
148
|
+
| Prior phases incomplete | NOT READY |
|
|
149
|
+
| req_testable < 50% of req_total | NOT READY |
|
|
150
|
+
| 1–2 uncovered requirements OR plan quality issues | NEEDS WORK |
|
|
151
|
+
| All checks pass | READY |
|
|
152
|
+
|
|
153
|
+
Collect all issues into a numbered list.
|
|
154
|
+
|
|
155
|
+
Present the full report:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
🔮 **Readiness Gate** · Phase {N}: {Phase Name}
|
|
159
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
160
|
+
|
|
161
|
+
{icon} Document Discovery — {summary}
|
|
162
|
+
{icon} Requirements Analysis — {req_testable}/{req_total} requirements are testable
|
|
163
|
+
{icon} Plan Coverage — {covered}/{total} requirements addressed
|
|
164
|
+
{icon} Dependency Check — {prior phases summary}
|
|
165
|
+
{icon} Plan Quality — {plan_count} plans, {quality_summary}
|
|
166
|
+
{icon} Final Assessment — {READY | NEEDS WORK | NOT READY}
|
|
167
|
+
|
|
168
|
+
### Issues to Address:
|
|
169
|
+
{numbered list of specific issues — omit if READY}
|
|
170
|
+
|
|
171
|
+
### Verdict: {icon} {READY | NEEDS WORK | NOT READY}
|
|
172
|
+
{one-line action — e.g., "Fix 2 issues before executing." or "You're clear to start."}
|
|
173
|
+
|
|
174
|
+
[1] Fix issues and re-check
|
|
175
|
+
[2] Execute anyway (not recommended — only shown for NEEDS WORK)
|
|
176
|
+
[3] See per-plan detail
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Icons: ✅ pass · ⚠️ warn · ❌ fail
|
|
180
|
+
|
|
181
|
+
For READY: do not show options [1] and [2]. Offer only:
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
[1] Execute phase: /merlin:execute-phase {N}
|
|
185
|
+
[2] See per-plan detail
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
</process>
|
|
189
|
+
|
|
190
|
+
<critical_rules>
|
|
191
|
+
|
|
192
|
+
**READ, DO NOT MODIFY.** This command never writes or edits planning files. It reports only.
|
|
193
|
+
|
|
194
|
+
**BE SPECIFIC.** Every issue in the Issues list must name the exact file, requirement ID, or plan that needs attention.
|
|
195
|
+
|
|
196
|
+
**FAIL FAST.** If all required docs are missing, emit NOT READY after Step 2 and stop.
|
|
197
|
+
|
|
198
|
+
**DO NOT BLOCK UNCONDITIONALLY.** NEEDS WORK means improvable — still offer an override path. Only NOT READY hard-stops execution.
|
|
199
|
+
|
|
200
|
+
</critical_rules>
|
|
201
|
+
|
|
202
|
+
<success_criteria>
|
|
203
|
+
- [ ] Phase resolved from args or STATE.md
|
|
204
|
+
- [ ] All 6 checks executed and reported
|
|
205
|
+
- [ ] Specific issues listed by file/ID (no vague feedback)
|
|
206
|
+
- [ ] Correct verdict emitted (READY / NEEDS WORK / NOT READY)
|
|
207
|
+
- [ ] Next steps offered based on verdict
|
|
208
|
+
</success_criteria>
|
|
@@ -117,7 +117,7 @@ Write to: .planning/phases/{phase}-{slug}/{phase}-RESEARCH.md
|
|
|
117
117
|
|
|
118
118
|
```
|
|
119
119
|
## Spawn fresh researcher process via Bash:
|
|
120
|
-
cat "$HANDOFF_DIR/handoff.md" | claude \
|
|
120
|
+
unset CLAUDECODE && cat "$HANDOFF_DIR/handoff.md" | claude \
|
|
121
121
|
--agent merlin-researcher \
|
|
122
122
|
-p \
|
|
123
123
|
--permission-mode acceptEdits \
|
|
@@ -152,7 +152,7 @@ Research file: @.planning/phases/{phase}-{slug}/{phase}-RESEARCH.md
|
|
|
152
152
|
|
|
153
153
|
```
|
|
154
154
|
## Spawn fresh continuation process via Bash:
|
|
155
|
-
cat "$HANDOFF_DIR/continuation.md" | claude \
|
|
155
|
+
unset CLAUDECODE && cat "$HANDOFF_DIR/continuation.md" | claude \
|
|
156
156
|
--agent merlin-researcher \
|
|
157
157
|
-p \
|
|
158
158
|
--permission-mode acceptEdits \
|
|
@@ -71,7 +71,7 @@ Spawn all 4 in parallel with rich context:
|
|
|
71
71
|
|
|
72
72
|
```
|
|
73
73
|
## Spawn fresh researcher via Bash:
|
|
74
|
-
## Write the following to a handoff file, then: cat handoff.md | claude --agent merlin-researcher -p --permission-mode acceptEdits --output-format text
|
|
74
|
+
## Write the following to a handoff file, then: unset CLAUDECODE && cat handoff.md | claude --agent merlin-researcher -p --permission-mode acceptEdits --output-format text
|
|
75
75
|
## Handoff content:
|
|
76
76
|
# "
|
|
77
77
|
<research_type>
|
|
@@ -113,7 +113,7 @@ Use template: ~/.claude/merlin/templates/research-project/STACK.md
|
|
|
113
113
|
## End of Stack research handoff
|
|
114
114
|
|
|
115
115
|
## Spawn fresh researcher via Bash:
|
|
116
|
-
## Write the following to a handoff file, then: cat handoff.md | claude --agent merlin-researcher -p --permission-mode acceptEdits --output-format text
|
|
116
|
+
## Write the following to a handoff file, then: unset CLAUDECODE && cat handoff.md | claude --agent merlin-researcher -p --permission-mode acceptEdits --output-format text
|
|
117
117
|
## Handoff content:
|
|
118
118
|
# "
|
|
119
119
|
<research_type>
|
|
@@ -155,7 +155,7 @@ Use template: ~/.claude/merlin/templates/research-project/FEATURES.md
|
|
|
155
155
|
## End of Features research handoff
|
|
156
156
|
|
|
157
157
|
## Spawn fresh researcher via Bash:
|
|
158
|
-
## Write the following to a handoff file, then: cat handoff.md | claude --agent merlin-researcher -p --permission-mode acceptEdits --output-format text
|
|
158
|
+
## Write the following to a handoff file, then: unset CLAUDECODE && cat handoff.md | claude --agent merlin-researcher -p --permission-mode acceptEdits --output-format text
|
|
159
159
|
## Handoff content:
|
|
160
160
|
# "
|
|
161
161
|
<research_type>
|
|
@@ -197,7 +197,7 @@ Use template: ~/.claude/merlin/templates/research-project/ARCHITECTURE.md
|
|
|
197
197
|
## End of Architecture research handoff
|
|
198
198
|
|
|
199
199
|
## Spawn fresh researcher via Bash:
|
|
200
|
-
## Write the following to a handoff file, then: cat handoff.md | claude --agent merlin-researcher -p --permission-mode acceptEdits --output-format text
|
|
200
|
+
## Write the following to a handoff file, then: unset CLAUDECODE && cat handoff.md | claude --agent merlin-researcher -p --permission-mode acceptEdits --output-format text
|
|
201
201
|
## Handoff content:
|
|
202
202
|
# "
|
|
203
203
|
<research_type>
|
|
@@ -83,7 +83,7 @@ Summary: <verification summary>
|
|
|
83
83
|
---END_VERIFY_RESULT---
|
|
84
84
|
EOF
|
|
85
85
|
|
|
86
|
-
RESULT=$(cat "$HANDOFF_DIR/handoff.md" | claude \
|
|
86
|
+
RESULT=$(unset CLAUDECODE && cat "$HANDOFF_DIR/handoff.md" | claude \
|
|
87
87
|
--agent merlin-work-verifier \
|
|
88
88
|
-p \
|
|
89
89
|
--permission-mode acceptEdits \
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
#
|
|
3
3
|
# Merlin Hook: SessionStart (consolidated)
|
|
4
|
-
# Does
|
|
4
|
+
# Does four things in a single hook (avoids multiple "success" messages):
|
|
5
5
|
# 1. Analytics: initialize session, log start event
|
|
6
6
|
# 2. Agent sync: refresh agent files from cloud (background, max once/hour)
|
|
7
|
+
# 2.5. Auto-update: check npm for new Merlin version (background, max once/24h)
|
|
7
8
|
# 3. Context injection: output additionalContext for the session
|
|
8
9
|
#
|
|
9
10
|
# Always exits 0 — never blocks Claude Code startup.
|
|
@@ -130,6 +131,51 @@ _merlin_sync_agents() {
|
|
|
130
131
|
}
|
|
131
132
|
_merlin_sync_agents &
|
|
132
133
|
|
|
134
|
+
# ── 2.5. Auto-update check (background, max once/24h) ─────────
|
|
135
|
+
# Proactively upgrades Merlin when a new version is published.
|
|
136
|
+
# Runs silently in background — never blocks session startup.
|
|
137
|
+
_merlin_auto_update() {
|
|
138
|
+
local merlin_dir="${HOME}/.claude/merlin"
|
|
139
|
+
local last_check="${merlin_dir}/.last-update-check"
|
|
140
|
+
local version_file="${merlin_dir}/VERSION"
|
|
141
|
+
local check_interval=86400 # 24 hours
|
|
142
|
+
|
|
143
|
+
[ -d "${merlin_dir}" ] || return 0
|
|
144
|
+
|
|
145
|
+
# Skip if checked within the last 24 hours
|
|
146
|
+
if [ -f "${last_check}" ]; then
|
|
147
|
+
local last
|
|
148
|
+
last=$(cat "${last_check}" 2>/dev/null || echo "0")
|
|
149
|
+
[ $(($(date +%s) - last)) -lt ${check_interval} ] && return 0
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
# Record check time immediately (prevents parallel checks)
|
|
153
|
+
date +%s > "${last_check}"
|
|
154
|
+
|
|
155
|
+
# Read installed version
|
|
156
|
+
local installed="0.0.0"
|
|
157
|
+
[ -f "${version_file}" ] && installed=$(cat "${version_file}" 2>/dev/null || echo "0.0.0")
|
|
158
|
+
|
|
159
|
+
# Determine channel from version string
|
|
160
|
+
local channel="latest"
|
|
161
|
+
echo "${installed}" | grep -q "beta" && channel="beta"
|
|
162
|
+
|
|
163
|
+
# Check npm for latest version (5s timeout)
|
|
164
|
+
local available
|
|
165
|
+
available=$(npm view "create-merlin-brain@${channel}" version 2>/dev/null) || return 0
|
|
166
|
+
[ -z "${available}" ] && return 0
|
|
167
|
+
|
|
168
|
+
# Compare versions (simple: if they differ and available is newer)
|
|
169
|
+
[ "${installed}" = "${available}" ] && return 0
|
|
170
|
+
|
|
171
|
+
# Version differs — run the upgrade
|
|
172
|
+
echo "merlin: updating ${installed} → ${available} ..." >&2
|
|
173
|
+
if npx "create-merlin-brain@${channel}" --yes 2>/dev/null; then
|
|
174
|
+
echo "merlin: updated to v${available}. Restart Claude Code for full effect." >&2
|
|
175
|
+
fi
|
|
176
|
+
}
|
|
177
|
+
_merlin_auto_update &
|
|
178
|
+
|
|
133
179
|
# ── 3. Context injection (the only stdout output) ──────────────
|
|
134
180
|
# Output additionalContext JSON for Claude to see at session start.
|
|
135
181
|
# Full boot instructions are in CLAUDE.md — this is a lightweight nudge.
|
package/package.json
CHANGED