create-merlin-brain 2.5.1 → 2.6.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/files/commands/merlin/execute-phase.md +62 -6
- package/files/commands/merlin/help.md +11 -0
- package/files/commands/merlin/standup.md +151 -0
- package/files/merlin/workflows/execute-phase.md +192 -8
- package/files/merlin/workflows/plan-phase.md +73 -2
- package/files/merlin/workflows/standup.md +198 -0
- package/package.json +1 -1
|
@@ -205,19 +205,75 @@ After user runs `/merlin:plan-phase {Z} --gaps`:
|
|
|
205
205
|
</offer_next>
|
|
206
206
|
|
|
207
207
|
<wave_execution>
|
|
208
|
-
**
|
|
208
|
+
**Worktree-isolated parallel spawning (default for 2+ plans in a wave):**
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
Before spawning, create a git worktree per plan so agents work in isolation:
|
|
211
211
|
|
|
212
|
+
```bash
|
|
213
|
+
REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
214
|
+
REPO_NAME=$(basename "$REPO_ROOT")
|
|
215
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
216
|
+
|
|
217
|
+
# Create worktree for each plan
|
|
218
|
+
git worktree add "${REPO_ROOT}/../${REPO_NAME}-worktree-01" -b merlin/worktree-01
|
|
219
|
+
git worktree add "${REPO_ROOT}/../${REPO_NAME}-worktree-02" -b merlin/worktree-02
|
|
212
220
|
```
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
221
|
+
|
|
222
|
+
Then spawn with worktree context:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
Task(prompt="Execute plan at {plan_01_path}
|
|
226
|
+
|
|
227
|
+
<worktree_context>
|
|
228
|
+
Working directory: {worktree_01_dir}
|
|
229
|
+
Branch: merlin/worktree-01
|
|
230
|
+
Main branch: {current_branch}
|
|
231
|
+
All paths relative to worktree. Commit normally. Do NOT switch branches.
|
|
232
|
+
</worktree_context>
|
|
233
|
+
|
|
234
|
+
Plan: @{plan_01_path}
|
|
235
|
+
Project state: @.planning/STATE.md", subagent_type="merlin-executor")
|
|
236
|
+
|
|
237
|
+
Task(prompt="Execute plan at {plan_02_path}
|
|
238
|
+
|
|
239
|
+
<worktree_context>
|
|
240
|
+
Working directory: {worktree_02_dir}
|
|
241
|
+
Branch: merlin/worktree-02
|
|
242
|
+
Main branch: {current_branch}
|
|
243
|
+
All paths relative to worktree. Commit normally. Do NOT switch branches.
|
|
244
|
+
</worktree_context>
|
|
245
|
+
|
|
246
|
+
Plan: @{plan_02_path}
|
|
247
|
+
Project state: @.planning/STATE.md", subagent_type="merlin-executor")
|
|
216
248
|
```
|
|
217
249
|
|
|
218
|
-
All
|
|
250
|
+
All run in parallel. Task tool blocks until all complete.
|
|
251
|
+
|
|
252
|
+
**After wave completes, merge back:**
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
cd "$REPO_ROOT"
|
|
256
|
+
git merge merlin/worktree-01 --no-edit
|
|
257
|
+
git merge merlin/worktree-02 --no-edit
|
|
258
|
+
# Clean up
|
|
259
|
+
git worktree remove "${REPO_ROOT}/../${REPO_NAME}-worktree-01" --force
|
|
260
|
+
git worktree remove "${REPO_ROOT}/../${REPO_NAME}-worktree-02" --force
|
|
261
|
+
git branch -d merlin/worktree-01 merlin/worktree-02
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**If merge conflicts:** abort merge, report conflicting files, offer user resolution options (manual resolve, re-run sequentially, or skip).
|
|
265
|
+
|
|
266
|
+
**Fallback (single plan or no git):**
|
|
267
|
+
|
|
268
|
+
If wave has only 1 plan, or worktree creation fails, spawn directly in main repo:
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
Task(prompt="Execute plan at {plan_path}\n\nPlan: @{plan_path}\nProject state: @.planning/STATE.md", subagent_type="merlin-executor")
|
|
272
|
+
```
|
|
219
273
|
|
|
220
274
|
**No polling.** No background agents. No TaskOutput loops.
|
|
275
|
+
|
|
276
|
+
**Always clean up worktrees** on success, failure, or abort.
|
|
221
277
|
</wave_execution>
|
|
222
278
|
|
|
223
279
|
<checkpoint_handling>
|
|
@@ -220,6 +220,17 @@ Check project status and intelligently route to next action.
|
|
|
220
220
|
|
|
221
221
|
Usage: `/merlin:progress`
|
|
222
222
|
|
|
223
|
+
**`/merlin:standup`**
|
|
224
|
+
Generate a daily standup summary from git history and planning state.
|
|
225
|
+
|
|
226
|
+
- Shows what was done (commits grouped by feature)
|
|
227
|
+
- Shows what's in progress (current phase/plan)
|
|
228
|
+
- Shows blockers and issues needing attention
|
|
229
|
+
- Shows overall progress with percentages
|
|
230
|
+
- Scannable in under 30 seconds
|
|
231
|
+
|
|
232
|
+
Usage: `/merlin:standup`
|
|
233
|
+
|
|
223
234
|
### Session Management
|
|
224
235
|
|
|
225
236
|
**`/merlin:resume-work`**
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merlin:standup
|
|
3
|
+
description: Generate daily standup summary — done, in progress, blocked
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Bash
|
|
7
|
+
- Grep
|
|
8
|
+
- Glob
|
|
9
|
+
- mcp__merlin__merlin_get_project_status
|
|
10
|
+
- mcp__merlin__merlin_get_blockers
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<objective>
|
|
14
|
+
Generate a quick daily standup summary from git history, planning state, and task status.
|
|
15
|
+
|
|
16
|
+
Shows what was done, what's in progress, and what's blocked — like a dev standup but assembled automatically from the codebase state.
|
|
17
|
+
|
|
18
|
+
Output is concise and actionable. No fluff.
|
|
19
|
+
</objective>
|
|
20
|
+
|
|
21
|
+
<execution_context>
|
|
22
|
+
@~/.claude/merlin/workflows/standup.md
|
|
23
|
+
</execution_context>
|
|
24
|
+
|
|
25
|
+
<context>
|
|
26
|
+
@.planning/STATE.md
|
|
27
|
+
@.planning/ROADMAP.md
|
|
28
|
+
</context>
|
|
29
|
+
|
|
30
|
+
<process>
|
|
31
|
+
1. **Gather git activity (last 24 hours):**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Commits in last 24h
|
|
35
|
+
git log --oneline --since="24 hours ago" --no-merges 2>/dev/null
|
|
36
|
+
|
|
37
|
+
# Files changed in last 24h
|
|
38
|
+
git log --since="24 hours ago" --no-merges --name-only --pretty=format: 2>/dev/null | sort -u | grep -v '^$'
|
|
39
|
+
|
|
40
|
+
# Lines changed summary
|
|
41
|
+
git diff --stat HEAD~$(git log --oneline --since="24 hours ago" --no-merges 2>/dev/null | wc -l | tr -d ' ')..HEAD 2>/dev/null
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. **Gather planning state:**
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Current phase and status from ROADMAP
|
|
48
|
+
grep -A2 "🚧\|In Progress\|Building" .planning/ROADMAP.md 2>/dev/null
|
|
49
|
+
|
|
50
|
+
# Completed summaries (recently created)
|
|
51
|
+
find .planning/phases -name "*-SUMMARY.md" -newer .planning/STATE.md 2>/dev/null
|
|
52
|
+
|
|
53
|
+
# Pending plans
|
|
54
|
+
find .planning/phases -name "*-PLAN.md" 2>/dev/null | while read plan; do
|
|
55
|
+
summary="${plan/-PLAN.md/-SUMMARY.md}"
|
|
56
|
+
if [ ! -f "$summary" ]; then
|
|
57
|
+
echo "PENDING: $plan"
|
|
58
|
+
fi
|
|
59
|
+
done
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
3. **Check for blockers:**
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Call: merlin_get_blockers (if available)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Also scan for:
|
|
69
|
+
```bash
|
|
70
|
+
# TODO/FIXME/HACK in recently changed files
|
|
71
|
+
git log --since="24 hours ago" --no-merges --name-only --pretty=format: 2>/dev/null | sort -u | grep -v '^$' | while read f; do
|
|
72
|
+
grep -n "TODO\|FIXME\|HACK\|XXX" "$f" 2>/dev/null | head -3
|
|
73
|
+
done
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
4. **Get project status from Merlin Cloud:**
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Call: merlin_get_project_status
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
5. **Generate standup report:**
|
|
83
|
+
|
|
84
|
+
Format and display the standup (see <standup_format>).
|
|
85
|
+
|
|
86
|
+
</process>
|
|
87
|
+
|
|
88
|
+
<standup_format>
|
|
89
|
+
```
|
|
90
|
+
═══════════════════════════════════════
|
|
91
|
+
📊 STANDUP — {date}
|
|
92
|
+
═══════════════════════════════════════
|
|
93
|
+
|
|
94
|
+
## ✅ Done (last 24h)
|
|
95
|
+
|
|
96
|
+
{For each meaningful commit group:}
|
|
97
|
+
- **{feature/area}**: {what was accomplished}
|
|
98
|
+
{commit count} commits, {files changed} files
|
|
99
|
+
|
|
100
|
+
{If no commits:}
|
|
101
|
+
- No commits in the last 24 hours.
|
|
102
|
+
|
|
103
|
+
## 🚧 In Progress
|
|
104
|
+
|
|
105
|
+
- **Phase {N}: {Name}** — {status from ROADMAP}
|
|
106
|
+
{Current plan being executed, if any}
|
|
107
|
+
{Task count: X done, Y pending}
|
|
108
|
+
|
|
109
|
+
## 🔴 Blocked / Needs Attention
|
|
110
|
+
|
|
111
|
+
{For each blocker:}
|
|
112
|
+
- **{blocker type}**: {description}
|
|
113
|
+
{Where: file or context}
|
|
114
|
+
|
|
115
|
+
{If no blockers:}
|
|
116
|
+
- No blockers. Clear to proceed.
|
|
117
|
+
|
|
118
|
+
## 📈 Progress
|
|
119
|
+
|
|
120
|
+
{From merlin_get_project_status:}
|
|
121
|
+
- Milestone: {current milestone}
|
|
122
|
+
- Phase: {current phase} of {total phases}
|
|
123
|
+
- Tasks: {done}/{total} ({percentage}%)
|
|
124
|
+
|
|
125
|
+
───────────────────────────────────────
|
|
126
|
+
Next: {recommended action}
|
|
127
|
+
═══════════════════════════════════════
|
|
128
|
+
```
|
|
129
|
+
</standup_format>
|
|
130
|
+
|
|
131
|
+
<grouping_rules>
|
|
132
|
+
**Group commits by feature/area, not individually.**
|
|
133
|
+
|
|
134
|
+
- Group by commit prefix: `feat(auth)`, `fix(billing)`, `docs(phase-3)` → group by scope
|
|
135
|
+
- If no conventional commits, group by directory: all `src/routes/auth/*` → "Auth routes"
|
|
136
|
+
- Collapse "docs(phase-X): complete..." into "Phase X planning complete"
|
|
137
|
+
- Skip merge commits and trivial formatting
|
|
138
|
+
|
|
139
|
+
**Summarize, don't list:**
|
|
140
|
+
- Bad: "feat(auth): add login", "feat(auth): add logout", "feat(auth): add refresh"
|
|
141
|
+
- Good: "**Auth**: Login, logout, and refresh token endpoints (3 commits, 5 files)"
|
|
142
|
+
</grouping_rules>
|
|
143
|
+
|
|
144
|
+
<success_criteria>
|
|
145
|
+
- [ ] Git activity from last 24h summarized
|
|
146
|
+
- [ ] Current phase/plan status shown
|
|
147
|
+
- [ ] Blockers identified (if any)
|
|
148
|
+
- [ ] Progress percentage shown
|
|
149
|
+
- [ ] Next recommended action shown
|
|
150
|
+
- [ ] Output is scannable in under 30 seconds
|
|
151
|
+
</success_criteria>
|
|
@@ -143,6 +143,128 @@ Report wave structure with context:
|
|
|
143
143
|
The "What it builds" column comes from skimming plan names and objectives. Keep it brief (3 to 8 words).
|
|
144
144
|
</step>
|
|
145
145
|
|
|
146
|
+
<step name="worktree_management">
|
|
147
|
+
**Git worktree isolation for parallel wave execution.**
|
|
148
|
+
|
|
149
|
+
When multiple plans in a wave run simultaneously, they can conflict on file changes. Git worktrees give each agent its own working directory on a separate branch, then merge results back.
|
|
150
|
+
|
|
151
|
+
**When to use worktrees:**
|
|
152
|
+
- Wave has 2+ plans (parallel execution)
|
|
153
|
+
- Git is available and repo has at least one commit
|
|
154
|
+
- No `--no-worktrees` flag passed
|
|
155
|
+
|
|
156
|
+
**When to skip worktrees (fallback to sequential):**
|
|
157
|
+
- Wave has only 1 plan (no parallelism needed)
|
|
158
|
+
- Git is not available or not a git repo
|
|
159
|
+
- Worktree creation fails for any reason
|
|
160
|
+
- User explicitly disabled worktrees
|
|
161
|
+
|
|
162
|
+
**Create worktrees before spawning wave agents:**
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Get current branch name
|
|
166
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
167
|
+
|
|
168
|
+
# For each plan in the wave, create a worktree
|
|
169
|
+
# Use a sibling directory to avoid nesting inside the repo
|
|
170
|
+
REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
171
|
+
REPO_NAME=$(basename "$REPO_ROOT")
|
|
172
|
+
|
|
173
|
+
for PLAN_ID in {plan_ids_in_wave}; do
|
|
174
|
+
WORKTREE_DIR="${REPO_ROOT}/../${REPO_NAME}-worktree-${PLAN_ID}"
|
|
175
|
+
WORKTREE_BRANCH="merlin/worktree-${PLAN_ID}"
|
|
176
|
+
|
|
177
|
+
# Create branch from current HEAD and worktree
|
|
178
|
+
git worktree add "$WORKTREE_DIR" -b "$WORKTREE_BRANCH" 2>/dev/null
|
|
179
|
+
|
|
180
|
+
if [ $? -ne 0 ]; then
|
|
181
|
+
echo "WORKTREE_FAILED: Could not create worktree for ${PLAN_ID}"
|
|
182
|
+
# Fallback: run this wave sequentially in main tree
|
|
183
|
+
fi
|
|
184
|
+
done
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Pass worktree path to each agent:**
|
|
188
|
+
|
|
189
|
+
Each spawned agent receives its worktree directory as working directory context. The agent runs ALL file operations (Read, Write, Edit, Bash) relative to that worktree, not the main repo.
|
|
190
|
+
|
|
191
|
+
Add to each agent's prompt:
|
|
192
|
+
```
|
|
193
|
+
<worktree_context>
|
|
194
|
+
IMPORTANT: You are working in a git worktree, NOT the main repo.
|
|
195
|
+
Working directory: {worktree_dir}
|
|
196
|
+
Branch: merlin/worktree-{plan_id}
|
|
197
|
+
Main branch: {current_branch}
|
|
198
|
+
|
|
199
|
+
All file paths are relative to your worktree directory.
|
|
200
|
+
Commit your work normally — commits go to your worktree branch.
|
|
201
|
+
Do NOT switch branches or modify the main branch.
|
|
202
|
+
</worktree_context>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Merge worktrees back after wave completes:**
|
|
206
|
+
|
|
207
|
+
After all agents in a wave finish:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Switch to main branch
|
|
211
|
+
cd "$REPO_ROOT"
|
|
212
|
+
|
|
213
|
+
for PLAN_ID in {completed_plan_ids}; do
|
|
214
|
+
WORKTREE_BRANCH="merlin/worktree-${PLAN_ID}"
|
|
215
|
+
WORKTREE_DIR="${REPO_ROOT}/../${REPO_NAME}-worktree-${PLAN_ID}"
|
|
216
|
+
|
|
217
|
+
# Merge the worktree branch into main
|
|
218
|
+
git merge "$WORKTREE_BRANCH" --no-edit 2>&1
|
|
219
|
+
MERGE_EXIT=$?
|
|
220
|
+
|
|
221
|
+
if [ $MERGE_EXIT -ne 0 ]; then
|
|
222
|
+
echo "MERGE_CONFLICT: ${PLAN_ID} has conflicts with other plans"
|
|
223
|
+
# Abort the merge, report to user
|
|
224
|
+
git merge --abort
|
|
225
|
+
# See conflict_handling below
|
|
226
|
+
else
|
|
227
|
+
echo "MERGED: ${PLAN_ID} merged successfully"
|
|
228
|
+
fi
|
|
229
|
+
|
|
230
|
+
# Clean up worktree and branch
|
|
231
|
+
git worktree remove "$WORKTREE_DIR" --force 2>/dev/null
|
|
232
|
+
git branch -d "$WORKTREE_BRANCH" 2>/dev/null
|
|
233
|
+
done
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Handle merge conflicts:**
|
|
237
|
+
|
|
238
|
+
If a merge conflict occurs:
|
|
239
|
+
1. Abort the failed merge: `git merge --abort`
|
|
240
|
+
2. Report to user which plans conflicted and which files
|
|
241
|
+
3. Present options:
|
|
242
|
+
```
|
|
243
|
+
⚠️ Merge conflict: Plan {A} and Plan {B} both modified {files}
|
|
244
|
+
|
|
245
|
+
[1] Resolve manually (show conflicting files)
|
|
246
|
+
[2] Re-run Plan {B} sequentially on top of Plan {A}
|
|
247
|
+
[3] Skip Plan {B} for now
|
|
248
|
+
```
|
|
249
|
+
4. If re-running: spawn a fresh agent for Plan B on the already-merged main branch
|
|
250
|
+
|
|
251
|
+
**Cleanup on failure or abort:**
|
|
252
|
+
|
|
253
|
+
Always clean up worktrees, even if execution fails:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# List and remove all merlin worktrees
|
|
257
|
+
git worktree list | grep "worktree-" | awk '{print $1}' | while read dir; do
|
|
258
|
+
git worktree remove "$dir" --force 2>/dev/null
|
|
259
|
+
done
|
|
260
|
+
|
|
261
|
+
# Remove leftover worktree branches
|
|
262
|
+
git branch --list "merlin/worktree-*" | while read branch; do
|
|
263
|
+
git branch -D "$branch" 2>/dev/null
|
|
264
|
+
done
|
|
265
|
+
```
|
|
266
|
+
</step>
|
|
267
|
+
|
|
146
268
|
<step name="execute_waves">
|
|
147
269
|
Execute each wave in sequence. Autonomous plans within a wave run in parallel.
|
|
148
270
|
|
|
@@ -174,7 +296,29 @@ Examples:
|
|
|
174
296
|
- Bad: "Executing terrain generation plan"
|
|
175
297
|
- Good: "Procedural terrain generator using Perlin noise, creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
|
|
176
298
|
|
|
177
|
-
2. **
|
|
299
|
+
2. **Set up worktrees for parallel waves:**
|
|
300
|
+
|
|
301
|
+
If this wave has 2+ plans:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Check git availability and worktree support
|
|
305
|
+
git rev-parse --is-inside-work-tree 2>/dev/null
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
If git is available, follow the `worktree_management` step to create a worktree per plan. Store the mapping:
|
|
309
|
+
```
|
|
310
|
+
worktree_map = {
|
|
311
|
+
"plan-01": "/path/to/repo-worktree-plan-01",
|
|
312
|
+
"plan-02": "/path/to/repo-worktree-plan-02"
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
If worktree creation fails for any plan, fall back to sequential execution for the entire wave:
|
|
317
|
+
```
|
|
318
|
+
⚠️ Worktree creation failed. Falling back to sequential execution for Wave {N}.
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
3. **Spawn all autonomous agents in wave simultaneously:**
|
|
178
322
|
|
|
179
323
|
Use Task tool with multiple parallel calls. Each agent gets prompt from subagent-task-prompt template:
|
|
180
324
|
|
|
@@ -185,6 +329,22 @@ Execute plan {plan_number} of phase {phase_number}-{phase_name}.
|
|
|
185
329
|
Commit each task atomically. Create SUMMARY.md. Update STATE.md.
|
|
186
330
|
</objective>
|
|
187
331
|
|
|
332
|
+
<worktree_context>
|
|
333
|
+
{IF using worktrees:}
|
|
334
|
+
IMPORTANT: You are working in a git worktree, NOT the main repo.
|
|
335
|
+
Working directory: {worktree_dir}
|
|
336
|
+
Branch: merlin/worktree-{plan_id}
|
|
337
|
+
Main branch: {current_branch}
|
|
338
|
+
|
|
339
|
+
All file paths are relative to your worktree directory.
|
|
340
|
+
Commit your work normally — commits go to your worktree branch.
|
|
341
|
+
Do NOT switch branches or modify the main branch.
|
|
342
|
+
|
|
343
|
+
{IF not using worktrees (single plan or fallback):}
|
|
344
|
+
Working in main repository directory.
|
|
345
|
+
No worktree isolation — you have direct access to the main branch.
|
|
346
|
+
</worktree_context>
|
|
347
|
+
|
|
188
348
|
<merlin_requirement>
|
|
189
349
|
**CRITICAL: Call Merlin before each task.**
|
|
190
350
|
|
|
@@ -218,11 +378,26 @@ Config: @.planning/config.json (if exists)
|
|
|
218
378
|
</success_criteria>
|
|
219
379
|
```
|
|
220
380
|
|
|
221
|
-
|
|
381
|
+
4. **Wait for all agents in wave to complete:**
|
|
222
382
|
|
|
223
383
|
Task tool blocks until each agent finishes. All parallel agents return together.
|
|
224
384
|
|
|
225
|
-
|
|
385
|
+
5. **Merge worktrees back (if using worktrees):**
|
|
386
|
+
|
|
387
|
+
After all agents complete, follow the `worktree_management` merge procedure:
|
|
388
|
+
- Merge each worktree branch back to the main branch in plan order
|
|
389
|
+
- If merge conflicts occur, follow the conflict resolution flow
|
|
390
|
+
- Clean up all worktrees and branches
|
|
391
|
+
|
|
392
|
+
Report merge results:
|
|
393
|
+
```
|
|
394
|
+
Worktree merge results:
|
|
395
|
+
- Plan {A}: ✓ Merged cleanly
|
|
396
|
+
- Plan {B}: ✓ Merged cleanly
|
|
397
|
+
- Plan {C}: ⚠️ Conflict — {resolution taken}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
6. **Report completion and what was built:**
|
|
226
401
|
|
|
227
402
|
For each completed agent:
|
|
228
403
|
- Verify SUMMARY.md exists at expected path
|
|
@@ -252,7 +427,7 @@ Examples:
|
|
|
252
427
|
- Bad: "Wave 2 complete. Proceeding to Wave 3."
|
|
253
428
|
- Good: "Terrain system complete, 3 biome types, height based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
|
|
254
429
|
|
|
255
|
-
**
|
|
430
|
+
**6.5 Run quality and documentation skills after the wave:**
|
|
256
431
|
|
|
257
432
|
After all plans in the wave complete and their SUMMARY.md files are created:
|
|
258
433
|
|
|
@@ -281,19 +456,20 @@ Keep these skill runs pragmatic:
|
|
|
281
456
|
- Prefer small, continuous improvements over big rewrites.
|
|
282
457
|
- Do not over abstract. Favor clarity and maintainability.
|
|
283
458
|
|
|
284
|
-
|
|
459
|
+
7. **Handle failures:**
|
|
285
460
|
|
|
286
461
|
If any agent in wave fails:
|
|
287
462
|
- Report which plan failed and why
|
|
463
|
+
- If using worktrees: clean up that plan's worktree before proceeding
|
|
288
464
|
- Ask user: "Continue with remaining waves?" or "Stop execution?"
|
|
289
465
|
- If continue: proceed to next wave (dependent plans may also fail)
|
|
290
|
-
- If stop: exit with partial completion report
|
|
466
|
+
- If stop: clean up all worktrees, exit with partial completion report
|
|
291
467
|
|
|
292
|
-
|
|
468
|
+
8. **Execute checkpoint plans between waves:**
|
|
293
469
|
|
|
294
470
|
See <checkpoint_handling> for details.
|
|
295
471
|
|
|
296
|
-
|
|
472
|
+
9. **Proceed to next wave**
|
|
297
473
|
</step>
|
|
298
474
|
|
|
299
475
|
<step name="checkpoint_handling">
|
|
@@ -585,6 +761,7 @@ No context bleed. Orchestrator never reads workflow internals. Just paths and re
|
|
|
585
761
|
Subagent fails mid-plan:
|
|
586
762
|
- SUMMARY.md will not exist
|
|
587
763
|
- Orchestrator detects missing SUMMARY
|
|
764
|
+
- If using worktrees: clean up that plan's worktree and branch
|
|
588
765
|
- Reports failure, asks user how to proceed
|
|
589
766
|
|
|
590
767
|
Dependency chain breaks:
|
|
@@ -595,13 +772,20 @@ Dependency chain breaks:
|
|
|
595
772
|
|
|
596
773
|
All agents in wave fail:
|
|
597
774
|
- Something systemic (git issues, permissions, etc)
|
|
775
|
+
- Clean up ALL worktrees before stopping
|
|
598
776
|
- Stop execution
|
|
599
777
|
- Report for manual investigation
|
|
600
778
|
|
|
779
|
+
Worktree-specific failures:
|
|
780
|
+
- Worktree creation fails: fall back to sequential execution for that wave
|
|
781
|
+
- Merge conflict after wave: present conflict to user with resolution options
|
|
782
|
+
- Orphaned worktrees: always run cleanup at end of execution (success or failure)
|
|
783
|
+
|
|
601
784
|
Checkpoint fails to resolve:
|
|
602
785
|
- User cannot approve or provides repeated issues
|
|
603
786
|
- Ask: "Skip this plan?" or "Abort phase execution?"
|
|
604
787
|
- Record partial progress in STATE.md
|
|
788
|
+
- Clean up any active worktrees
|
|
605
789
|
</failure_handling>
|
|
606
790
|
|
|
607
791
|
<resumption>
|
|
@@ -575,6 +575,73 @@ Plan 05: depends_on: ["03", "04"] → wave: 3
|
|
|
575
575
|
Store wave number with each plan in memory. Write to frontmatter in next step.
|
|
576
576
|
</step>
|
|
577
577
|
|
|
578
|
+
<step name="detect_file_conflicts">
|
|
579
|
+
**Analyze file overlap between same-wave plans to prevent unsafe parallel execution.**
|
|
580
|
+
|
|
581
|
+
After assigning waves, check every pair of plans in the same wave for file conflicts:
|
|
582
|
+
|
|
583
|
+
```
|
|
584
|
+
for each wave W:
|
|
585
|
+
plans_in_wave = [plans where plan.wave == W]
|
|
586
|
+
|
|
587
|
+
for each pair (plan_A, plan_B) in plans_in_wave:
|
|
588
|
+
shared_files = intersection(plan_A.files_modified, plan_B.files_modified)
|
|
589
|
+
|
|
590
|
+
if shared_files is not empty:
|
|
591
|
+
# These plans cannot safely run in parallel
|
|
592
|
+
plan_A.conflicts_with.append(plan_B.id)
|
|
593
|
+
plan_B.conflicts_with.append(plan_A.id)
|
|
594
|
+
|
|
595
|
+
# Serialize: move plan_B to next wave
|
|
596
|
+
plan_B.wave = W + 1
|
|
597
|
+
plan_B.depends_on.append(plan_A.id)
|
|
598
|
+
|
|
599
|
+
# Log the conflict for the user
|
|
600
|
+
log: "⚠️ File conflict: Plan {A} and Plan {B} both modify {shared_files}"
|
|
601
|
+
log: " → Plan {B} moved to Wave {W+1} (serialized after Plan {A})"
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
**What counts as a file conflict:**
|
|
605
|
+
- Exact same file path in both plans' `files_modified`
|
|
606
|
+
- Same directory + wildcard overlap (e.g., both modify files in `src/routes/auth/`)
|
|
607
|
+
- Shared config files (package.json, tsconfig.json, .env) — these ALWAYS conflict
|
|
608
|
+
|
|
609
|
+
**What does NOT count as a conflict:**
|
|
610
|
+
- Reading the same file (only writes conflict)
|
|
611
|
+
- Different files in the same directory (unless a plan modifies an index/barrel file)
|
|
612
|
+
- Test files for different features
|
|
613
|
+
|
|
614
|
+
**Record conflicts in plan frontmatter:**
|
|
615
|
+
|
|
616
|
+
```yaml
|
|
617
|
+
---
|
|
618
|
+
phase: XX-name
|
|
619
|
+
plan: NN
|
|
620
|
+
wave: 2 # Bumped from 1 due to conflict
|
|
621
|
+
depends_on: ["01"] # Added due to conflict
|
|
622
|
+
files_modified: ["src/routes/auth/login.ts", "src/middleware/auth.ts"]
|
|
623
|
+
conflicts_with: ["01"] # Plans that touch same files
|
|
624
|
+
conflict_files: ["src/middleware/auth.ts"] # The specific shared files
|
|
625
|
+
autonomous: true
|
|
626
|
+
---
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
**Report conflict analysis to user:**
|
|
630
|
+
|
|
631
|
+
```
|
|
632
|
+
## File Conflict Analysis
|
|
633
|
+
|
|
634
|
+
| Plan A | Plan B | Shared Files | Resolution |
|
|
635
|
+
|--------|--------|-------------|------------|
|
|
636
|
+
| 01 | 02 | src/middleware/auth.ts | Plan 02 → Wave 2 (serialized) |
|
|
637
|
+
|
|
638
|
+
Original waves: Plan 01 (W1), Plan 02 (W1)
|
|
639
|
+
Adjusted waves: Plan 01 (W1), Plan 02 (W2, after 01)
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
**After conflict resolution, re-run wave assignment** to propagate any cascading changes (plans that depended on the moved plan may also shift).
|
|
643
|
+
</step>
|
|
644
|
+
|
|
578
645
|
<step name="group_into_plans">
|
|
579
646
|
**Group tasks into plans based on dependency waves and autonomy.**
|
|
580
647
|
|
|
@@ -732,6 +799,8 @@ type: execute
|
|
|
732
799
|
wave: N # Execution wave (1, 2, 3...). Computed at plan time.
|
|
733
800
|
depends_on: [] # Plan IDs this plan requires.
|
|
734
801
|
files_modified: [] # Files this plan touches.
|
|
802
|
+
conflicts_with: [] # Plans that touch same files (detected by conflict analysis). Omit if empty.
|
|
803
|
+
conflict_files: [] # Specific shared files causing conflicts. Omit if empty.
|
|
735
804
|
autonomous: true # false if plan has checkpoints requiring user interaction
|
|
736
805
|
domain: [optional]
|
|
737
806
|
user_setup: [] # Human-required setup (omit if empty)
|
|
@@ -889,15 +958,17 @@ Tasks are instructions for Claude, not Jira tickets.
|
|
|
889
958
|
- [ ] Mandatory discovery completed (Level 0-3)
|
|
890
959
|
- [ ] Prior decisions, issues, concerns synthesized
|
|
891
960
|
- [ ] Dependency graph built (needs/creates for each task)
|
|
961
|
+
- [ ] File conflict analysis run on same-wave plans
|
|
962
|
+
- [ ] Conflicting plans serialized (moved to later waves) with conflicts_with metadata
|
|
892
963
|
- [ ] Tasks grouped into plans by wave, not by sequence
|
|
893
964
|
- [ ] PLAN file(s) exist with XML structure
|
|
894
|
-
- [ ] Each plan: depends_on, files_modified, autonomous in frontmatter
|
|
965
|
+
- [ ] Each plan: depends_on, files_modified, conflicts_with, autonomous in frontmatter
|
|
895
966
|
- [ ] Each plan: user_setup declared if external services involved
|
|
896
967
|
- [ ] Each plan: Objective, context, tasks, verification, success criteria, output
|
|
897
968
|
- [ ] Each plan: 2-3 tasks (~50% context)
|
|
898
969
|
- [ ] Each task: Type, Files (if auto), Action, Verify, Done
|
|
899
970
|
- [ ] Checkpoints properly structured
|
|
900
|
-
- [ ] Wave structure maximizes parallelism
|
|
971
|
+
- [ ] Wave structure maximizes parallelism (with conflicts resolved)
|
|
901
972
|
- [ ] PLAN file(s) committed to git
|
|
902
973
|
- [ ] User knows next steps and wave structure
|
|
903
974
|
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Generate a daily standup summary from git history, planning state, and task status. Provides a quick "what happened, what's next, what's stuck" view.
|
|
3
|
+
</purpose>
|
|
4
|
+
|
|
5
|
+
<process>
|
|
6
|
+
|
|
7
|
+
<step name="gather_git_activity">
|
|
8
|
+
**Collect commit history from the last 24 hours.**
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Get all commits from last 24h (excluding merges)
|
|
12
|
+
git log --oneline --since="24 hours ago" --no-merges 2>/dev/null
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If no commits found, try last 48 hours as fallback:
|
|
16
|
+
```bash
|
|
17
|
+
git log --oneline --since="48 hours ago" --no-merges 2>/dev/null
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
For each commit, extract:
|
|
21
|
+
- Commit hash (short)
|
|
22
|
+
- Commit message
|
|
23
|
+
- Files changed: `git diff-tree --no-commit-id --name-only -r {hash}`
|
|
24
|
+
- Conventional commit prefix if present (feat, fix, docs, etc.)
|
|
25
|
+
|
|
26
|
+
**Group commits by scope/area:**
|
|
27
|
+
|
|
28
|
+
Parse conventional commit format `{type}({scope}): {message}`:
|
|
29
|
+
- Group all commits with same scope together
|
|
30
|
+
- If no conventional format, group by top-level directory of changed files
|
|
31
|
+
- Collapse documentation/planning commits: "docs(phase-X): ..." → "Phase X planning"
|
|
32
|
+
|
|
33
|
+
**Produce grouped summary:**
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
groups = {
|
|
37
|
+
"auth": ["add login endpoint", "add refresh token", "add logout"],
|
|
38
|
+
"billing": ["fix token balance query"],
|
|
39
|
+
"planning": ["complete phase 2 plan", "update roadmap"]
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Summarize each group in one line:
|
|
44
|
+
- "**Auth**: Login, refresh, and logout endpoints (3 commits, 8 files)"
|
|
45
|
+
- "**Billing**: Fixed token balance query reading from wrong table (1 commit, 3 files)"
|
|
46
|
+
</step>
|
|
47
|
+
|
|
48
|
+
<step name="gather_planning_state">
|
|
49
|
+
**Read current project planning state.**
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Current roadmap status
|
|
53
|
+
cat .planning/ROADMAP.md 2>/dev/null
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Extract:
|
|
57
|
+
- Current milestone name and status
|
|
58
|
+
- Current phase number, name, and status (look for 🚧 or "In Progress" or "Building")
|
|
59
|
+
- Total phases in milestone
|
|
60
|
+
- How many phases complete vs remaining
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Find recently completed plans (SUMMARYs created in last 24h)
|
|
64
|
+
find .planning/phases -name "*-SUMMARY.md" -newer .planning/STATE.md 2>/dev/null
|
|
65
|
+
|
|
66
|
+
# Find pending plans (PLAN exists but no SUMMARY)
|
|
67
|
+
find .planning/phases -name "*-PLAN.md" 2>/dev/null | while read plan; do
|
|
68
|
+
summary="${plan/-PLAN.md/-SUMMARY.md}"
|
|
69
|
+
if [ ! -f "$summary" ]; then
|
|
70
|
+
echo "$plan"
|
|
71
|
+
fi
|
|
72
|
+
done
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Read STATE.md for current position:
|
|
76
|
+
```bash
|
|
77
|
+
cat .planning/STATE.md 2>/dev/null
|
|
78
|
+
```
|
|
79
|
+
</step>
|
|
80
|
+
|
|
81
|
+
<step name="gather_blockers">
|
|
82
|
+
**Check for blockers and issues.**
|
|
83
|
+
|
|
84
|
+
1. **Merlin Cloud blockers:**
|
|
85
|
+
```
|
|
86
|
+
Call: merlin_get_blockers (if MCP available)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
2. **Code-level blockers (scan recent files):**
|
|
90
|
+
```bash
|
|
91
|
+
# Find TODO/FIXME/HACK in files changed in last 24h
|
|
92
|
+
git log --since="24 hours ago" --no-merges --name-only --pretty=format: 2>/dev/null | sort -u | grep -v '^$' | while read f; do
|
|
93
|
+
if [ -f "$f" ]; then
|
|
94
|
+
matches=$(grep -n "TODO\|FIXME\|HACK\|XXX\|BLOCKED" "$f" 2>/dev/null)
|
|
95
|
+
if [ -n "$matches" ]; then
|
|
96
|
+
echo "=== $f ==="
|
|
97
|
+
echo "$matches" | head -5
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
done
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
3. **Build/type errors (quick check):**
|
|
104
|
+
```bash
|
|
105
|
+
# Check if project has TypeScript
|
|
106
|
+
if [ -f "tsconfig.json" ]; then
|
|
107
|
+
npx tsc --noEmit 2>&1 | tail -5
|
|
108
|
+
fi
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Categorize blockers:
|
|
112
|
+
- **Hard blocker**: Build fails, type errors, test failures
|
|
113
|
+
- **Soft blocker**: TODOs, FIXMEs that need attention
|
|
114
|
+
- **External blocker**: Waiting on user input, API keys, third-party
|
|
115
|
+
</step>
|
|
116
|
+
|
|
117
|
+
<step name="gather_progress">
|
|
118
|
+
**Get overall project progress.**
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
Call: merlin_get_project_status (if MCP available)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
If MCP not available, calculate from files:
|
|
125
|
+
```bash
|
|
126
|
+
# Count completed vs total plans
|
|
127
|
+
TOTAL=$(find .planning/phases -name "*-PLAN.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
128
|
+
DONE=$(find .planning/phases -name "*-SUMMARY.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
129
|
+
echo "Plans: $DONE/$TOTAL"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Extract:
|
|
133
|
+
- Milestone name
|
|
134
|
+
- Phase X of Y
|
|
135
|
+
- Tasks done / total
|
|
136
|
+
- Percentage complete
|
|
137
|
+
</step>
|
|
138
|
+
|
|
139
|
+
<step name="format_standup">
|
|
140
|
+
**Assemble the standup report.**
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
═══════════════════════════════════════
|
|
144
|
+
📊 STANDUP — {YYYY-MM-DD}
|
|
145
|
+
═══════════════════════════════════════
|
|
146
|
+
|
|
147
|
+
## ✅ Done (last 24h)
|
|
148
|
+
|
|
149
|
+
{grouped commit summaries, one line per group}
|
|
150
|
+
{If nothing: "No commits in the last 24 hours."}
|
|
151
|
+
|
|
152
|
+
## 🚧 In Progress
|
|
153
|
+
|
|
154
|
+
- **Phase {N}: {Name}** — {status}
|
|
155
|
+
{Plan being executed / next plan to execute}
|
|
156
|
+
{X of Y plans complete in this phase}
|
|
157
|
+
|
|
158
|
+
## 🔴 Blocked / Needs Attention
|
|
159
|
+
|
|
160
|
+
{hard blockers first, then soft blockers}
|
|
161
|
+
{If nothing: "No blockers. Clear to proceed."}
|
|
162
|
+
|
|
163
|
+
## 📈 Progress
|
|
164
|
+
|
|
165
|
+
- Milestone: {name} ({version})
|
|
166
|
+
- Phase: {current} of {total}
|
|
167
|
+
- Plans: {done}/{total} ({pct}%)
|
|
168
|
+
|
|
169
|
+
───────────────────────────────────────
|
|
170
|
+
Next: {recommended action from project status or STATE.md}
|
|
171
|
+
═══════════════════════════════════════
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Formatting rules:**
|
|
175
|
+
- Keep each "Done" item to ONE line
|
|
176
|
+
- Blockers should be actionable (say what needs to happen)
|
|
177
|
+
- "Next" should be a specific command or action, not vague
|
|
178
|
+
- Entire standup should be readable in under 30 seconds
|
|
179
|
+
</step>
|
|
180
|
+
|
|
181
|
+
</process>
|
|
182
|
+
|
|
183
|
+
<customization>
|
|
184
|
+
**Time range override:**
|
|
185
|
+
|
|
186
|
+
If user passes an argument like "week" or "3d":
|
|
187
|
+
- "week" → `--since="7 days ago"`
|
|
188
|
+
- "3d" → `--since="3 days ago"`
|
|
189
|
+
- Default → `--since="24 hours ago"`
|
|
190
|
+
|
|
191
|
+
**Quiet mode:**
|
|
192
|
+
|
|
193
|
+
If user passes "--quiet" or "-q":
|
|
194
|
+
- Skip blockers scan
|
|
195
|
+
- Skip build check
|
|
196
|
+
- Only show Done + In Progress + Next
|
|
197
|
+
- Fastest possible standup
|
|
198
|
+
</customization>
|
package/package.json
CHANGED