create-merlin-brain 1.1.3 → 1.1.5

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.js CHANGED
@@ -185,14 +185,43 @@ _merlin_check_update() {
185
185
  fi
186
186
  }
187
187
 
188
- # Main claude wrapper with Merlin branding
188
+ # Main claude wrapper with Merlin branding and Sights pre-check
189
189
  claude() {
190
- # Show Merlin branding
191
- echo -e "\\033[35m✦ Merlin\\033[0m"
192
-
193
190
  # Check for updates in background (silent, non-blocking)
194
191
  (_merlin_check_update &) 2>/dev/null
195
192
 
193
+ # Pre-flight: Check Sights connection (enforced at terminal level)
194
+ local status_output=$(merlin status 2>/dev/null)
195
+ local status_code=$(echo "$status_output" | head -1)
196
+
197
+ case "$status_code" in
198
+ CONNECTED)
199
+ local repo_name=$(echo "$status_output" | sed -n '2p')
200
+ echo -e "\\033[35m🔮 Merlin Sights:\\033[0m \\033[32mCONNECTED\\033[0m ✓"
201
+ echo -e " Repository: $repo_name"
202
+ ;;
203
+ NOT_CONNECTED)
204
+ local repo_url=$(echo "$status_output" | sed -n '2p')
205
+ echo -e "\\033[35m🔮 Merlin Sights:\\033[0m \\033[33mNOT CONNECTED\\033[0m"
206
+ echo ""
207
+ echo " This repo isn't in Sights yet: $repo_url"
208
+ echo ""
209
+ echo -e " \\033[36m[1]\\033[0m Connect now (analysis takes 2-5 min)"
210
+ echo -e " \\033[36m[2]\\033[0m Skip - work without Sights"
211
+ echo ""
212
+ echo -n " Choice [1/2]: "
213
+ read -r choice
214
+ if [ "$choice" = "1" ]; then
215
+ merlin connect
216
+ echo ""
217
+ fi
218
+ ;;
219
+ *)
220
+ # Not in git repo or CLI not available - just show branding
221
+ echo -e "\\033[35m✦ Merlin\\033[0m"
222
+ ;;
223
+ esac
224
+
196
225
  # Run claude with Merlin agent
197
226
  command claude --agent merlin "$@"
198
227
  }
@@ -254,20 +283,84 @@ function cleanupLegacy() {
254
283
  }
255
284
  }
256
285
 
257
- // Clean settings.local.json - remove old tool permissions
286
+ // Clean settings.local.json - remove old tool permissions AND broken hooks
258
287
  const settingsPath = path.join(CLAUDE_DIR, 'settings.local.json');
259
288
  if (fs.existsSync(settingsPath)) {
260
289
  try {
261
290
  let content = fs.readFileSync(settingsPath, 'utf8');
291
+ let modified = false;
292
+
293
+ // Remove old tool permissions
262
294
  if (content.includes('mcp__briefed__') || content.includes('ccwiki')) {
263
- // Remove old tool permissions, keep everything else
264
295
  content = content.replace(/"mcp__briefed__[^"]+",?\s*/g, '');
265
- fs.writeFileSync(settingsPath, content);
266
- cleaned.push('~/.claude/settings.local.json (removed old tools)');
296
+ modified = true;
297
+ }
298
+
299
+ // Parse as JSON to clean up hooks properly
300
+ try {
301
+ let settings = JSON.parse(content);
302
+
303
+ // Remove broken hooks (contain $HOME, gsd-, or old paths)
304
+ if (settings.hooks) {
305
+ const hookTypes = ['PreToolUse', 'PostToolUse', 'Stop', 'Start'];
306
+ for (const hookType of hookTypes) {
307
+ if (Array.isArray(settings.hooks[hookType])) {
308
+ const originalLength = settings.hooks[hookType].length;
309
+ settings.hooks[hookType] = settings.hooks[hookType].filter(hook => {
310
+ // Remove hooks with $HOME (doesn't work on Windows)
311
+ // Remove hooks with gsd- (old Get Shit Done)
312
+ // Remove hooks referencing non-existent files
313
+ const hookPath = typeof hook === 'string' ? hook : hook?.command || hook?.path || '';
314
+ if (hookPath.includes('$HOME') ||
315
+ hookPath.includes('gsd-') ||
316
+ hookPath.includes('ccwiki') ||
317
+ hookPath.includes('briefed')) {
318
+ return false;
319
+ }
320
+ return true;
321
+ });
322
+ if (settings.hooks[hookType].length !== originalLength) {
323
+ modified = true;
324
+ }
325
+ // Remove empty hook arrays
326
+ if (settings.hooks[hookType].length === 0) {
327
+ delete settings.hooks[hookType];
328
+ }
329
+ }
330
+ }
331
+ // Remove hooks object if empty
332
+ if (Object.keys(settings.hooks).length === 0) {
333
+ delete settings.hooks;
334
+ }
335
+ }
336
+
337
+ if (modified) {
338
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
339
+ cleaned.push('~/.claude/settings.local.json (removed old tools and broken hooks)');
340
+ }
341
+ } catch (jsonErr) {
342
+ // If JSON parsing fails, just do string replacement
343
+ if (modified) {
344
+ fs.writeFileSync(settingsPath, content);
345
+ cleaned.push('~/.claude/settings.local.json (removed old tools)');
346
+ }
267
347
  }
268
348
  } catch (e) { /* ignore */ }
269
349
  }
270
350
 
351
+ // Clean up old hooks directory
352
+ const hooksDir = path.join(CLAUDE_DIR, 'hooks');
353
+ if (fs.existsSync(hooksDir)) {
354
+ const hookFiles = fs.readdirSync(hooksDir);
355
+ for (const file of hookFiles) {
356
+ // Remove old gsd-* hook files
357
+ if (file.startsWith('gsd-') || file.includes('ccwiki') || file.includes('briefed')) {
358
+ removeFile(path.join(hooksDir, file));
359
+ cleaned.push(`~/.claude/hooks/${file}`);
360
+ }
361
+ }
362
+ }
363
+
271
364
  // Clean config.json - remove briefed server, fix merlin server
272
365
  const configPath = path.join(CLAUDE_DIR, 'config.json');
273
366
  if (fs.existsSync(configPath)) {
package/bin/merlin-cli.js CHANGED
@@ -17,7 +17,7 @@
17
17
  const https = require('https');
18
18
  const { execSync } = require('child_process');
19
19
 
20
- const API_URL = process.env.MERLIN_API_URL || 'https://claude-codeapi-production.up.railway.app';
20
+ const API_URL = process.env.MERLIN_API_URL || 'https://auth.merlin.build';
21
21
  const API_KEY = process.env.MERLIN_API_KEY || '';
22
22
 
23
23
  // ============================================================
@@ -243,21 +243,53 @@ async function connect() {
243
243
  }
244
244
  }
245
245
 
246
+ async function status() {
247
+ const repoUrl = detectGitRepo();
248
+ if (!repoUrl) {
249
+ // Not in a git repo - output for shell parsing
250
+ console.log('NO_GIT_REPO');
251
+ process.exit(1);
252
+ }
253
+
254
+ const repoId = await findRepoId(repoUrl);
255
+ if (!repoId) {
256
+ // Repo not connected
257
+ console.log('NOT_CONNECTED');
258
+ console.log(repoUrl);
259
+ process.exit(0);
260
+ }
261
+
262
+ // Connected - get repo name
263
+ try {
264
+ const overview = await apiRequest(`/api/agent/${repoId}/overview`);
265
+ const nameMatch = overview.match(/Name:\s*(.+)/);
266
+ const repoName = nameMatch ? nameMatch[1].trim() : repoUrl.split('/').pop();
267
+ console.log('CONNECTED');
268
+ console.log(repoName);
269
+ console.log(repoId);
270
+ } catch {
271
+ console.log('CONNECTED');
272
+ console.log(repoUrl.split('/').pop());
273
+ console.log(repoId);
274
+ }
275
+ }
276
+
246
277
  function showHelp() {
247
278
  console.log(`
248
279
  Merlin CLI - Universal codebase intelligence for ALL AI agents
249
280
 
250
281
  Usage:
282
+ merlin status Check if current repo is connected to Sights
283
+ merlin connect Connect repo to Merlin Sights
251
284
  merlin context <task> Get context for a task
252
285
  merlin search <query> Search the codebase
253
286
  merlin brief Get project overview
254
287
  merlin rules Get coding rules
255
288
  merlin files <purpose> Find files by purpose
256
- merlin connect Connect repo to Merlin Sights
257
289
 
258
290
  Environment:
259
291
  MERLIN_API_KEY Your merlin.build API key
260
- MERLIN_API_URL API URL (default: https://claude-codeapi-production.up.railway.app)
292
+ MERLIN_API_URL API URL (default: https://auth.merlin.build)
261
293
 
262
294
  Works with: Claude, Cursor, Windsurf, Copilot, Aider, and any AI agent!
263
295
  `);
@@ -290,6 +322,9 @@ async function main() {
290
322
  case 'connect':
291
323
  await connect();
292
324
  break;
325
+ case 'status':
326
+ await status();
327
+ break;
293
328
  case 'help':
294
329
  case '--help':
295
330
  case '-h':
package/files/CLAUDE.md CHANGED
@@ -4,16 +4,16 @@
4
4
 
5
5
  **DO NOT read the user's message yet. DO NOT start working. FIRST:**
6
6
 
7
- 1. **Call this tool NOW:** `merlin_get_selected_repo`
7
+ ### Step 1: Connect to Sights
8
8
 
9
- 2. **Then show ONE of these responses:**
9
+ ```
10
+ Call: merlin_get_selected_repo
11
+ ```
10
12
 
11
13
  **If repo IS connected:**
12
14
  ```
13
15
  🔮 Merlin Sights: CONNECTED ✓
14
16
  Repository: {repo_name}
15
-
16
- What would you like to work on?
17
17
  ```
18
18
 
19
19
  **If repo is NOT connected:**
@@ -28,13 +28,52 @@ This repository isn't in Sights yet.
28
28
  Which would you like?
29
29
  ```
30
30
 
31
- 3. **WAIT for user response if not connected**
31
+ Wait for user response if not connected.
32
+
33
+ ### Step 2: Check Project Status (THE ENFORCEMENT LOOP)
34
+
35
+ ```
36
+ Call: merlin_get_project_status
37
+ ```
38
+
39
+ **This returns:**
40
+ - Vision completeness (PROJECT.md, ROADMAP.md exist?)
41
+ - Task counts (pending, in progress, completed)
42
+ - Checkpoint to resume from (if exists)
43
+ - Next recommended action
32
44
 
33
- 4. **ONLY THEN proceed with their actual request**
45
+ **Display the status:**
46
+ ```
47
+ 📊 Project Status
48
+ ├── Vision: [✓ Complete / ❌ Missing PROJECT.md / ❌ Missing ROADMAP.md]
49
+ ├── Tasks: [X] done, [Y] pending
50
+ ├── Progress: [████████░░] 80%
51
+ └── Next: [recommended action]
52
+ ```
53
+
54
+ ### Step 3: Route Based on Status
55
+
56
+ | Status | What To Do |
57
+ |--------|------------|
58
+ | No PROJECT.md | Show: "No project defined. Run `/merlin:new-project` to start." |
59
+ | No ROADMAP.md | Show: "No roadmap. Run `/merlin:discuss-milestone` to plan." |
60
+ | Has checkpoint | Show: "Resume from [task]?" and offer to continue |
61
+ | Empty backlog | Show: "⚠️ No tasks! Run `/merlin:discuss-milestone` to plan more." |
62
+ | Has pending tasks | Show next task and "Ready to work?" |
63
+
64
+ ### Step 4: Only THEN Proceed
65
+
66
+ After showing status and routing, THEN read the user's actual request.
34
67
 
35
68
  ---
36
69
 
37
- **WHY THIS MATTERS:** The user needs visual confirmation that Sights is working. Always show the 🔮 status box at session start. Never skip this step.
70
+ **WHY THIS MATTERS:**
71
+ - Visual confirmation that Sights is working
72
+ - Projects always have vision documented
73
+ - Projects always have tasks until complete
74
+ - Any agent can pick up where work left off
75
+
76
+ **THE RULE:** A project should NEVER have zero tasks unless explicitly marked complete.
38
77
 
39
78
  ---
40
79
 
@@ -257,6 +296,14 @@ After EVERY Merlin tool call, display a cue box showing what you found and wheth
257
296
  - `merlin_get_rules` - Get all coding rules for this project
258
297
  - `merlin_remove_rule` - Remove a coding rule
259
298
 
299
+ **Project Management Tools (NEW):**
300
+ - `merlin_get_project_status` - Get vision/task/progress status (call at session start!)
301
+ - `merlin_ensure_tasks` - Verify backlog health, trigger planning if empty
302
+ - `merlin_get_next_task` - Get highest priority task with pre-assembled context
303
+ - `merlin_sync_planning` - Sync .planning/ folder to/from cloud
304
+ - `merlin_save_checkpoint` - Save resume point for later pickup
305
+ - `merlin_mark_complete` - Mark project done (stops task enforcement)
306
+
260
307
  **When to call Merlin Sights:**
261
308
 
262
309
  | Moment | Why |
@@ -10,6 +10,9 @@ allowed-tools:
10
10
  - Task
11
11
  - TodoWrite
12
12
  - AskUserQuestion
13
+ - mcp__merlin__merlin_get_context
14
+ - mcp__merlin__merlin_sync_task
15
+ - mcp__merlin__merlin_save_checkpoint
13
16
  ---
14
17
 
15
18
  <objective>
@@ -36,7 +39,34 @@ Plan path: $ARGUMENTS
36
39
  - Confirm file at $ARGUMENTS exists
37
40
  - Error if not found: "Plan not found: {path}"
38
41
 
39
- 2. **Check if already executed**
42
+ 2. **Fetch pre-assembled context from Merlin Sights**
43
+
44
+ Before executing, get relevant context from Sights:
45
+
46
+ ```
47
+ Call: merlin_get_context
48
+ Task: "[objective from plan - what we're building]"
49
+ ```
50
+
51
+ This returns:
52
+ - Relevant code files for this task
53
+ - Conventions to follow
54
+ - Anti-patterns to avoid
55
+ - How-to guide
56
+
57
+ Store this context to pass to the executor subagent.
58
+
59
+ Also sync task start to cloud:
60
+
61
+ ```
62
+ Call: merlin_sync_task
63
+ Title: "[plan objective]"
64
+ Status: "in_progress"
65
+ Phase: "[phase name]"
66
+ Plan: "[plan name]"
67
+ ```
68
+
69
+ 3. **Check if already executed**
40
70
  - Derive SUMMARY path from plan path (replace PLAN.md with SUMMARY.md)
41
71
  - If SUMMARY exists: "Plan already executed. SUMMARY: {path}"
42
72
  - Offer: re-execute or exit
@@ -120,19 +120,52 @@ Consult `questioning.md` for techniques:
120
120
 
121
121
  As you go, mentally check the context checklist from `questioning.md`. If gaps remain, weave questions naturally. Don't suddenly switch to checklist mode.
122
122
 
123
- **Decision gate:**
123
+ </step>
124
+
125
+ <step name="completeness_gate">
126
+
127
+ **VISION COMPLETENESS CHECKLIST — Must pass before proceeding**
124
128
 
125
- When you could write a clear PROJECT.md, use AskUserQuestion:
129
+ Before allowing "Create PROJECT.md", silently verify you have gathered ALL of these:
130
+
131
+ ```
132
+ COMPLETENESS CHECKLIST:
133
+ [ ] WHAT: Clear description of what we're building (not vague)
134
+ [ ] WHO: Target users or audience defined
135
+ [ ] WHY: Problem being solved or value delivered
136
+ [ ] CORE: The ONE thing that makes this valuable (core differentiator)
137
+ [ ] SCOPE: At least 3 concrete features or capabilities
138
+ [ ] NON-SCOPE: At least 1 explicit exclusion (what we're NOT building)
139
+ [ ] CONSTRAINTS: Any technical, time, or resource constraints
140
+ [ ] SUCCESS: How we'll know it's working (success metric or signal)
141
+ ```
126
142
 
127
- - header: "Ready?"
128
- - question: "I think I understand what you're after. Ready to create PROJECT.md?"
143
+ **If ANY item is missing:**
144
+
145
+ Do NOT offer "Create PROJECT.md" yet. Instead, naturally ask a question that fills the gap:
146
+
147
+ | Missing | Question to ask |
148
+ |---------|-----------------|
149
+ | WHO | "Who exactly will use this? Paint me a picture of that person." |
150
+ | WHY | "What problem does this solve? What's painful about the current situation?" |
151
+ | CORE | "If this does ONE thing really well, what is it?" |
152
+ | SCOPE | "Give me 3 concrete things a user can do with this." |
153
+ | NON-SCOPE | "What should this explicitly NOT do? What's out of scope?" |
154
+ | CONSTRAINTS | "Any constraints I should know? Timeline, tech choices, budget?" |
155
+ | SUCCESS | "How will you know this is successful? What's the signal?" |
156
+
157
+ **Only when ALL 8 items are covered:**
158
+
159
+ Use AskUserQuestion:
160
+ - header: "Vision Complete ✓"
161
+ - question: "I have a clear picture of what we're building. Ready to create PROJECT.md?"
129
162
  - options:
130
163
  - "Create PROJECT.md" — Let's move forward
131
- - "Keep exploring" — I want to share more / ask me more
164
+ - "I want to add more" There's more context to share
132
165
 
133
- If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally.
166
+ If "I want to add more" — ask what they want to add, capture it, then offer again.
134
167
 
135
- Loop until "Create PROJECT.md" selected.
168
+ Loop until "Create PROJECT.md" selected AND checklist passes.
136
169
 
137
170
  </step>
138
171
 
@@ -358,6 +391,37 @@ EOF
358
391
 
359
392
  </step>
360
393
 
394
+ <step name="cloud_sync">
395
+
396
+ **Sync to Merlin Cloud for team access:**
397
+
398
+ Call `merlin_sync_planning` with direction "push" to upload:
399
+ - PROJECT.md → cloud storage
400
+ - config.json → cloud storage
401
+ - Vision completeness status → cloud storage
402
+
403
+ Also save coding rules to cloud:
404
+
405
+ Call `merlin_save_rule` for each rule in config.json:
406
+ - max_file_lines rule
407
+ - testing rule
408
+ - type_strictness rule
409
+ - each custom rule
410
+
411
+ This enables:
412
+ - Any team member to pick up the project
413
+ - Cross-session memory of decisions
414
+ - Rules enforced across all agents
415
+
416
+ ```
417
+ Synced to Merlin Cloud ✓
418
+ - PROJECT.md uploaded
419
+ - Coding rules saved (X rules)
420
+ - Team can now access this project
421
+ ```
422
+
423
+ </step>
424
+
361
425
  <step name="done">
362
426
 
363
427
  Present completion with next steps (see ~/.claude/merlin/references/continuation-format.md):
@@ -406,6 +470,7 @@ Skip research, define requirements from what you know, then create roadmap.
406
470
 
407
471
  <success_criteria>
408
472
 
473
+ - [ ] **Vision completeness checklist PASSED** (all 8 items covered)
409
474
  - [ ] Deep questioning completed (not rushed, threads followed)
410
475
  - [ ] PROJECT.md captures full context with evolutionary structure
411
476
  - [ ] Requirements initialized as hypotheses (greenfield) or with inferred Validated (brownfield)
@@ -413,5 +478,6 @@ Skip research, define requirements from what you know, then create roadmap.
413
478
  - [ ] Coding preferences gathered (file size, testing, type safety, custom rules)
414
479
  - [ ] config.json has workflow mode, depth, parallelization, AND rules
415
480
  - [ ] All committed to git
481
+ - [ ] **Synced to Merlin Cloud** (PROJECT.md, rules uploaded)
416
482
 
417
483
  </success_criteria>
@@ -7,17 +7,88 @@ allowed-tools:
7
7
  - Grep
8
8
  - Glob
9
9
  - SlashCommand
10
+ - mcp__merlin__merlin_get_project_status
11
+ - mcp__merlin__merlin_ensure_tasks
12
+ - mcp__merlin__merlin_get_next_task
13
+ - mcp__merlin__merlin_sync_planning
14
+ - AskUserQuestion
10
15
  ---
11
16
 
12
17
  <objective>
13
- Check project progress, summarize recent work and what's ahead, then intelligently route to the next action - either executing an existing plan or creating the next one.
18
+ Check project progress, ensure backlog health, and route to next action.
14
19
 
15
- Provides situational awareness before continuing work.
20
+ This is the "ALWAYS HAVE TASKS" enforcer. Call at session start or when
21
+ deciding what to do next. Ensures the project always has work until complete.
22
+
23
+ Provides situational awareness and smart routing.
16
24
  </objective>
17
25
 
18
26
 
19
27
  <process>
20
28
 
29
+ <step name="cloud_status">
30
+ **FIRST: Get project status from Merlin Cloud.**
31
+
32
+ ```
33
+ Call: merlin_get_project_status
34
+ ```
35
+
36
+ This returns:
37
+ - Vision status (PROJECT.md, ROADMAP.md, REQUIREMENTS.md)
38
+ - Task counts (pending, in_progress, completed)
39
+ - Progress percentage
40
+ - Last checkpoint if exists
41
+ - Recommended next action
42
+
43
+ **If checkpoint exists:**
44
+
45
+ Show resume prompt before continuing:
46
+ ```
47
+ 📍 Resume Point Found
48
+
49
+ Last session stopped at: [description]
50
+ Working on: [task]
51
+ Phase: [phase]
52
+
53
+ Resume from checkpoint? (Y/n)
54
+ ```
55
+
56
+ If yes: Route to checkpoint task with context.
57
+ If no: Continue with normal flow.
58
+ </step>
59
+
60
+ <step name="backlog_health">
61
+ **CRITICAL: Ensure backlog is never empty until project complete.**
62
+
63
+ ```
64
+ Call: merlin_ensure_tasks
65
+ ```
66
+
67
+ **If backlog is EMPTY but project NOT complete:**
68
+
69
+ ```
70
+ ⚠️ EMPTY BACKLOG DETECTED
71
+
72
+ No tasks remaining, but project is not marked complete.
73
+
74
+ The project should ALWAYS have tasks until explicitly finished.
75
+
76
+ What would you like to do?
77
+ ```
78
+
79
+ Use AskUserQuestion:
80
+ - header: "Empty Backlog"
81
+ - question: "No tasks remaining. What's next?"
82
+ - options:
83
+ - "Plan more work" — Run /merlin:discuss-milestone to define next milestone
84
+ - "Project is complete" — Run /merlin:complete-milestone to wrap up
85
+ - "Review first" — Run /merlin:verify-work to validate what was built
86
+
87
+ Route based on selection and EXIT. Do not continue to local file checks.
88
+
89
+ **If backlog is healthy:** Continue to local verification.
90
+ </step>
91
+
21
92
  <step name="verify">
22
93
  **Verify planning structure exists:**
23
94
 
@@ -0,0 +1,236 @@
1
+ <purpose>
2
+ Check project progress, ensure backlog health, and route to next action.
3
+
4
+ This is the "always have tasks" enforcer. Call this at session start or when
5
+ checking what to do next. It ensures the project always has work until complete.
6
+ </purpose>
7
+
8
+ <required_reading>
9
+ **Read these files NOW:**
10
+
11
+ 1. .planning/STATE.md
12
+ 2. .planning/ROADMAP.md
13
+ 3. .planning/PROJECT.md
14
+ </required_reading>
15
+
16
+ <merlin_context>
17
+ **MERLIN: Check project and task state from cloud.**
18
+
19
+ ```
20
+ Call: merlin_get_project_status
21
+ (returns vision status, task counts, next action, checkpoint)
22
+
23
+ Call: merlin_ensure_tasks
24
+ (verifies backlog health, triggers milestone discussion if empty)
25
+ ```
26
+ </merlin_context>
27
+
28
+ <process>
29
+
30
+ <step name="check_status">
31
+ **Get comprehensive project status:**
32
+
33
+ Call `merlin_get_project_status` to get:
34
+ - Vision completeness (PROJECT.md, ROADMAP.md, REQUIREMENTS.md)
35
+ - Task counts (pending, in_progress, completed)
36
+ - Progress percentage
37
+ - Last checkpoint (if any)
38
+ - Recommended next action
39
+
40
+ Display the status to user:
41
+
42
+ ```
43
+ # Project Progress
44
+
45
+ ## Vision
46
+ - PROJECT.md: [status]
47
+ - ROADMAP.md: [status]
48
+ - REQUIREMENTS.md: [status]
49
+
50
+ ## Tasks
51
+ Progress: [████████░░] 80%
52
+ - Completed: X
53
+ - In Progress: Y
54
+ - Pending: Z
55
+
56
+ ## Resume Point (if exists)
57
+ Last session stopped at: [description]
58
+ Working on: [task]
59
+ ```
60
+ </step>
61
+
62
+ <step name="backlog_health">
63
+ **CRITICAL: Ensure backlog is never empty until project complete.**
64
+
65
+ Call `merlin_ensure_tasks` to verify:
66
+ - If pending tasks > 0: Backlog healthy
67
+ - If pending tasks = 0 AND project not complete: TRIGGER MILESTONE DISCUSSION
68
+
69
+ **If backlog is empty:**
70
+
71
+ ```
72
+ ⚠️ EMPTY BACKLOG DETECTED
73
+
74
+ No tasks remaining, but project is not marked complete.
75
+
76
+ The project should ALWAYS have tasks until explicitly finished.
77
+
78
+ What would you like to do?
79
+ 1. Plan more work → /merlin:discuss-milestone
80
+ 2. Mark project complete → /merlin:complete-milestone
81
+ 3. Review what was built → /merlin:verify-work
82
+ ```
83
+
84
+ Use AskUserQuestion:
85
+ - header: "Empty Backlog"
86
+ - question: "No tasks remaining. What's next?"
87
+ - options:
88
+ - "Plan more work" — Run /merlin:discuss-milestone to define next milestone
89
+ - "Project is complete" — Run /merlin:complete-milestone to wrap up
90
+ - "Review first" — Run /merlin:verify-work to validate what was built
91
+
92
+ Route based on selection.
93
+
94
+ **If backlog is healthy:** Continue to route_next.
95
+ </step>
96
+
97
+ <step name="checkpoint_resume">
98
+ **Check for resume context:**
99
+
100
+ If `merlin_get_project_status` returned a checkpoint:
101
+
102
+ ```
103
+ 📍 Resume Point Found
104
+
105
+ Last session by: [agent]
106
+ Stopped at: [description]
107
+ Working on: [task]
108
+ Phase: [phase]
109
+
110
+ Next steps recorded:
111
+ 1. [step 1]
112
+ 2. [step 2]
113
+ ```
114
+
115
+ Use AskUserQuestion:
116
+ - header: "Resume"
117
+ - question: "Found a checkpoint from a previous session. Resume from there?"
118
+ - options:
119
+ - "Resume from checkpoint" — Pick up exactly where we left off
120
+ - "Start fresh" — Ignore checkpoint, show me the task list
121
+ - "Clear checkpoint" — Delete the checkpoint and choose new work
122
+
123
+ If "Resume from checkpoint":
124
+ - Load the checkpoint context
125
+ - Display the task and next steps
126
+ - Ready to execute
127
+
128
+ If "Start fresh" or no checkpoint: Continue to route_next.
129
+ </step>
130
+
131
+ <step name="route_next">
132
+ **Route to appropriate next action:**
133
+
134
+ Based on project status, recommend the best next step:
135
+
136
+ | Status | Next Action |
137
+ |--------|-------------|
138
+ | No PROJECT.md | `/merlin:new-project` — Define what we're building |
139
+ | No ROADMAP.md | `/merlin:discuss-milestone` → `/merlin:create-roadmap` |
140
+ | No active tasks | `/merlin:discuss-milestone` — Plan more work |
141
+ | Has pending tasks | `/merlin:execute-phase` or show task list |
142
+ | All tasks done | `/merlin:verify-work` — Validate the build |
143
+
144
+ **If has pending tasks:**
145
+
146
+ Call `merlin_get_next_task` to show the highest priority task with context:
147
+
148
+ ```
149
+ ## ▶ Next Task
150
+
151
+ **[Task Title]**
152
+ Phase: [phase] | Plan: [plan]
153
+
154
+ [Task description]
155
+
156
+ ### Pre-Assembled Context
157
+ [Relevant spec sections, code files, decisions]
158
+
159
+ Ready to start?
160
+ - `/merlin:execute-plan` — Execute the current plan
161
+ - "Show all tasks" — See the full task list
162
+ ```
163
+
164
+ **If no pending tasks but project incomplete:**
165
+
166
+ ```
167
+ ## ▶ Next Up
168
+
169
+ All current tasks complete! Time to plan more work.
170
+
171
+ `/merlin:discuss-milestone`
172
+
173
+ This will:
174
+ 1. Review what was accomplished
175
+ 2. Discuss what's next
176
+ 3. Create new phases and tasks
177
+ ```
178
+ </step>
179
+
180
+ <step name="display_summary">
181
+ **Show progress summary with visual indicators:**
182
+
183
+ ```
184
+ ================================================================================
185
+ PROJECT: [name]
186
+ ================================================================================
187
+
188
+ VISION: [✓ Complete / ⚠️ Gaps exist]
189
+ ├── What: [one-liner]
190
+ ├── Who: [target users]
191
+ └── Core Value: [differentiator]
192
+
193
+ PROGRESS: [████████░░] 80%
194
+ ├── Phase [N] of [M]: [current phase name]
195
+ ├── Tasks: [X] done, [Y] in progress, [Z] pending
196
+ └── Runway: ~[N] tasks / ~[X] hours remaining
197
+
198
+ HEALTH: [✓ Healthy / ⚠️ Empty backlog / ❌ Stalled]
199
+
200
+ ================================================================================
201
+
202
+ ▶ NEXT: [recommended action]
203
+
204
+ ================================================================================
205
+ ```
206
+ </step>
207
+
208
+ </process>
209
+
210
+ <backlog_enforcement>
211
+ **THE ALWAYS-HAVE-TASKS RULE:**
212
+
213
+ A project should NEVER have zero pending tasks unless:
214
+ 1. Project is explicitly marked complete (`merlin_mark_complete`)
215
+ 2. User is actively in `/merlin:discuss-milestone` planning more
216
+
217
+ If backlog empties during execution:
218
+ 1. Pause execution
219
+ 2. Alert user: "Backlog empty but project not complete"
220
+ 3. Route to `/merlin:discuss-milestone`
221
+
222
+ This ensures:
223
+ - Autonomous agents always have work
224
+ - No "what should I do next?" dead ends
225
+ - Projects progress to completion or explicit pause
226
+ </backlog_enforcement>
227
+
228
+ <success_criteria>
229
+ - [ ] Project status retrieved from cloud
230
+ - [ ] Vision completeness displayed
231
+ - [ ] Task progress shown with visual indicator
232
+ - [ ] Backlog health verified (empty → trigger milestone discussion)
233
+ - [ ] Checkpoint offered if exists
234
+ - [ ] Next action clearly routed
235
+ - [ ] User knows exactly what to do next
236
+ </success_criteria>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-merlin-brain",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "The Ultimate AI Brain for Claude Code - Install Merlin workflows, agents, and sights integration",
5
5
  "main": "index.js",
6
6
  "bin": {