supermind-claude 2.1.1 → 4.0.2

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.
Files changed (42) hide show
  1. package/.claude-plugin/plugin.json +21 -0
  2. package/README.md +34 -46
  3. package/agents/code-reviewer.md +81 -0
  4. package/cli/commands/doctor.js +415 -79
  5. package/cli/commands/install.js +16 -17
  6. package/cli/commands/skill.js +164 -0
  7. package/cli/commands/uninstall.js +32 -3
  8. package/cli/commands/update.js +25 -4
  9. package/cli/index.js +16 -4
  10. package/cli/lib/agents.js +413 -0
  11. package/cli/lib/executor.js +365 -0
  12. package/cli/lib/hooks.js +8 -1
  13. package/cli/lib/logger.js +1 -1
  14. package/cli/lib/planning.js +502 -0
  15. package/cli/lib/platform.js +4 -0
  16. package/cli/lib/plugin.js +127 -0
  17. package/cli/lib/settings.js +2 -40
  18. package/cli/lib/skills.js +39 -2
  19. package/cli/lib/vendor-skills.js +594 -0
  20. package/hooks/bash-permissions.js +196 -176
  21. package/hooks/context-monitor.js +79 -0
  22. package/hooks/improvement-logger.js +94 -0
  23. package/hooks/pre-merge-checklist.js +102 -0
  24. package/hooks/session-start.js +109 -5
  25. package/hooks/statusline-command.js +115 -29
  26. package/package.json +4 -2
  27. package/skills/anti-rationalization/SKILL.md +38 -0
  28. package/skills/brainstorming/SKILL.md +165 -0
  29. package/skills/code-review/SKILL.md +144 -0
  30. package/skills/executing-plans/SKILL.md +138 -0
  31. package/skills/finishing-branches/SKILL.md +144 -0
  32. package/skills/project/SKILL.md +533 -0
  33. package/skills/quick/SKILL.md +178 -0
  34. package/skills/supermind/SKILL.md +58 -4
  35. package/skills/supermind-init/SKILL.md +48 -2
  36. package/skills/systematic-debugging/SKILL.md +129 -0
  37. package/skills/tdd/SKILL.md +179 -0
  38. package/skills/using-git-worktrees/SKILL.md +138 -0
  39. package/skills/verification-before-completion/SKILL.md +54 -0
  40. package/skills/writing-plans/SKILL.md +169 -0
  41. package/templates/CLAUDE.md +124 -62
  42. package/cli/lib/plugins.js +0 -23
@@ -0,0 +1,533 @@
1
+ ---
2
+ name: project
3
+ description: Full six-phase lifecycle — discuss, research, plan, execute (waves), verify, ship
4
+ injects_into: [orchestrator-project]
5
+ ---
6
+
7
+ # Project Mode
8
+
9
+ Full lifecycle orchestrator for features, refactors, new systems, and multi-file changes.
10
+
11
+ ```
12
+ Discuss → Research (4 parallel agents) → Plan → Execute (waves) → Verify → Ship
13
+ ```
14
+
15
+ ## When to Use
16
+
17
+ - Multi-system features or refactors
18
+ - Ambiguous requirements needing discussion
19
+ - Changes spanning many files with dependencies
20
+ - Any task invoked via `/project`
21
+
22
+ ## When NOT to Use
23
+
24
+ - Bug fixes, renames, config changes, adding tests → use `/quick`
25
+
26
+ If in doubt, announce your routing decision and offer the escape hatch:
27
+ *"This looks like a full-lifecycle task — running in project mode. Say `/quick` if you just need a quick fix."*
28
+
29
+ ## Orchestrator Rules
30
+
31
+ - **The orchestrator NEVER writes code** — it only coordinates subagents
32
+ - All code changes happen in executor subagents with fresh context windows
33
+ - The orchestrator stays lean (~15-25% context usage)
34
+ - Each subagent gets the full methodology stack for its task type
35
+
36
+ ## Composable Flags
37
+
38
+ ```
39
+ /project --skip-discuss Skip Phase 1, start at Research
40
+ /project --skip-research Skip Phase 2, start at Plan
41
+ /project --assumptions Phase 1 uses codebase analysis instead of questions
42
+ /project --max-parallel N Override executor parallelism (default 3)
43
+ ```
44
+
45
+ ## State Management
46
+
47
+ All state lives in `.planning/` — human-readable Markdown, git-committable.
48
+
49
+ ### Initialization
50
+
51
+ At the start, initialize the planning directory using `initPlanning()` from `cli/lib/planning.js`:
52
+
53
+ ```javascript
54
+ initPlanning(projectRoot, {
55
+ modelProfile: 'default',
56
+ flags: { skipDiscuss: false, skipResearch: false, assumptions: false, maxParallel: 3 },
57
+ })
58
+ // Creates: .planning/roadmap.md, .planning/config.json, .planning/phases/
59
+ ```
60
+
61
+ Then create a phase for this work using `initPhase()`:
62
+
63
+ ```javascript
64
+ initPhase(projectRoot, 1)
65
+ // Creates: .planning/phases/phase-1/discussion.md, research/, plans/, tasks/, progress.md
66
+ ```
67
+
68
+ Update the roadmap using `updateRoadmap()`:
69
+
70
+ ```javascript
71
+ updateRoadmap(projectRoot, 1, 'active')
72
+ ```
73
+
74
+ ### Session Resumption
75
+
76
+ If `.planning/` already exists when this skill is invoked, the session-start hook has already detected it and reported status. Read progress to determine where to resume:
77
+
78
+ ```javascript
79
+ const progress = readProgress(projectRoot)
80
+ // Returns: { phase, entries, summary: { total, done, pending, failed, currentWave } }
81
+ ```
82
+
83
+ Use `isActive(projectRoot)` to confirm there's an active (non-completed) session. Use `readConfig(projectRoot)` to restore flags and model profile.
84
+
85
+ ---
86
+
87
+ ## Phase 1 — Discuss
88
+
89
+ **Skippable:** `--skip-discuss`
90
+
91
+ Invoke the **brainstorming skill** (`skills/brainstorming/`).
92
+
93
+ ### Two sub-modes
94
+
95
+ **Interactive (default):**
96
+ 1. Ask clarifying questions one at a time
97
+ 2. Propose 2-3 approaches with trade-offs
98
+ 3. Present the design for section-by-section approval
99
+ 4. Gate: user must approve the design before proceeding
100
+
101
+ **Assumptions (`--assumptions` flag):**
102
+ 1. Analyze the codebase to understand patterns, constraints, and context
103
+ 2. Present a set of assumptions about the approach for the user to correct
104
+ 3. Iterate until assumptions are confirmed
105
+ 4. Gate: user must approve the final assumptions
106
+
107
+ ### Output
108
+
109
+ Save the approved design to `.planning/phases/phase-1/discussion.md`:
110
+
111
+ ```javascript
112
+ writeDiscussion(projectRoot, 1, designMarkdown)
113
+ ```
114
+
115
+ The `writeDiscussion()` function appends to the existing file, so you can call it incrementally as the discussion evolves.
116
+
117
+ ### Gate
118
+
119
+ **User must explicitly approve the design before Phase 2 begins.** Do not proceed without approval.
120
+
121
+ ---
122
+
123
+ ## Phase 2 — Research
124
+
125
+ **Skippable:** `--skip-research`
126
+
127
+ Spawn **4 parallel researcher subagents** using the Agent tool. Each gets a focused prompt built from templates in `cli/lib/agents.js` (`RESEARCHER_PROMPTS`):
128
+
129
+ ### Researcher dispatch
130
+
131
+ Build the context object from the approved design (Phase 1) and project state, then generate prompts:
132
+
133
+ | Researcher | Template | Key context fields |
134
+ |-----------|----------|-------------------|
135
+ | Stack | `RESEARCHER_PROMPTS.stackResearcher(ctx)` | `ctx.goal`, `ctx.packageJson`, `ctx.architectureExcerpt` |
136
+ | Feature | `RESEARCHER_PROMPTS.featureResearcher(ctx)` | `ctx.goal`, `ctx.codeExcerpt` |
137
+ | Architecture | `RESEARCHER_PROMPTS.architectureResearcher(ctx)` | `ctx.goal`, `ctx.architectureExcerpt`, `ctx.affectedFiles` |
138
+ | Pitfall | `RESEARCHER_PROMPTS.pitfallResearcher(ctx)` | `ctx.goal`, `ctx.plan` |
139
+
140
+ For all researchers, `ctx.goal` is the approved design summary from Phase 1.
141
+
142
+ Dispatch all 4 as parallel Agent tool calls:
143
+
144
+ ```
145
+ Agent(prompt: RESEARCHER_PROMPTS.stackResearcher(ctx), description: "Research tech stack")
146
+ Agent(prompt: RESEARCHER_PROMPTS.featureResearcher(ctx), description: "Research feature patterns")
147
+ Agent(prompt: RESEARCHER_PROMPTS.architectureResearcher(ctx), description: "Research architecture fit")
148
+ Agent(prompt: RESEARCHER_PROMPTS.pitfallResearcher(ctx), description: "Research pitfalls risks")
149
+ ```
150
+
151
+ ### Output
152
+
153
+ Save each researcher's output using `writeResearch()`:
154
+
155
+ ```javascript
156
+ writeResearch(projectRoot, 1, 'stack', stackResult)
157
+ writeResearch(projectRoot, 1, 'features', featureResult)
158
+ writeResearch(projectRoot, 1, 'architecture', architectureResult)
159
+ writeResearch(projectRoot, 1, 'pitfalls', pitfallResult)
160
+ ```
161
+
162
+ Each call writes to `.planning/phases/phase-1/research/{name}.md`.
163
+
164
+ ---
165
+
166
+ ## Phase 3 — Plan
167
+
168
+ **Not skippable.**
169
+
170
+ Invoke the **writing-plans skill** (`skills/writing-plans/`).
171
+
172
+ ### Planning process
173
+
174
+ 1. Read the design from `discussion.md` and all 4 research outputs from `research/`
175
+ 2. Combine into a research summary for the planner
176
+ 3. Generate the task plan using `PLANNER_PROMPT` from `cli/lib/agents.js`:
177
+
178
+ ```javascript
179
+ const prompt = PLANNER_PROMPT({
180
+ goal: designSummary,
181
+ researchSummary: combinedResearch,
182
+ conventions: projectConventions,
183
+ })
184
+ ```
185
+
186
+ 4. Dispatch a planner Agent with this prompt. The planner returns a JSON array of task objects:
187
+
188
+ ```json
189
+ [
190
+ {
191
+ "id": "1",
192
+ "title": "Short imperative title",
193
+ "type": "write-feature",
194
+ "description": "What to do in detail",
195
+ "files": ["path/to/file.js"],
196
+ "acceptance": ["Criterion 1", "Criterion 2"],
197
+ "dependsOn": []
198
+ }
199
+ ]
200
+ ```
201
+
202
+ ### Plan validation loop
203
+
204
+ Run the plan-checker (max 3 iterations) using `PLAN_CHECKER_PROMPT` from `cli/lib/agents.js`:
205
+
206
+ ```javascript
207
+ const checkerPrompt = PLAN_CHECKER_PROMPT({
208
+ goal: designSummary,
209
+ plan: JSON.stringify(tasks, null, 2),
210
+ iteration: iterationNumber, // 1, 2, or 3
211
+ })
212
+ ```
213
+
214
+ The checker returns:
215
+ ```json
216
+ {
217
+ "approved": true | false,
218
+ "issues": ["issue 1"],
219
+ "suggestions": ["suggestion 1"]
220
+ }
221
+ ```
222
+
223
+ If `approved: false`, incorporate the issues and re-plan. After 3 iterations, proceed with the best plan and note unresolved issues.
224
+
225
+ ### Output
226
+
227
+ Save the plan and individual task specs using `writePlan()` and `writeTask()`:
228
+
229
+ ```javascript
230
+ writePlan(projectRoot, 1, {
231
+ id: 1,
232
+ title: 'Plan title',
233
+ waves: [{ number: 1, tasks: ['Task 1', 'Task 2'] }, { number: 2, tasks: ['Task 3'] }],
234
+ })
235
+
236
+ // For each task:
237
+ writeTask(projectRoot, 1, taskId, {
238
+ title: task.title,
239
+ description: task.description,
240
+ skills: SKILL_MAP[task.type], // from cli/lib/executor.js
241
+ files: task.files,
242
+ acceptance: task.acceptance,
243
+ wave: waveNumber,
244
+ })
245
+ ```
246
+
247
+ Update the roadmap:
248
+
249
+ ```javascript
250
+ updateRoadmap(projectRoot, 1, 'planning-complete')
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Phase 4 — Execute
256
+
257
+ **Not skippable.**
258
+
259
+ Invoke the **executing-plans skill** (`skills/executing-plans/`).
260
+
261
+ ### Wave execution
262
+
263
+ 1. Build the wave plan from the task dependency graph using `buildWavePlan()` from `cli/lib/executor.js`:
264
+
265
+ ```javascript
266
+ const waves = buildWavePlan(tasks)
267
+ // Returns: [{ wave: 1, tasks: [taskA, taskB] }, { wave: 2, tasks: [taskC] }]
268
+ ```
269
+
270
+ 2. Read `maxParallel` from config (default 3):
271
+
272
+ ```javascript
273
+ const config = readConfig(projectRoot)
274
+ const maxParallel = config?.flags?.maxParallel || 3
275
+ ```
276
+
277
+ 3. For each wave, build task packets and dispatch parallel executors:
278
+
279
+ ```javascript
280
+ // For each task in the wave:
281
+ const packet = buildTaskPacket(task, {
282
+ projectRoot,
283
+ branch: currentBranch,
284
+ recentCommits: gitLogOutput,
285
+ architectureExcerpt: relevantSections,
286
+ conventions: claudeMdConventions,
287
+ })
288
+
289
+ const execution = executeTask(packet, {
290
+ useWorktree: true, // when task scope warrants it
291
+ model: 'sonnet', // optional model override
292
+ })
293
+
294
+ // Dispatch via Agent tool:
295
+ Agent(
296
+ prompt: execution.prompt,
297
+ description: execution.description,
298
+ isolation: execution.isolation, // 'worktree' if useWorktree was true
299
+ model: execution.model, // if specified
300
+ )
301
+ ```
302
+
303
+ `buildTaskPacket()` automatically injects methodology skills based on task type via `SKILL_MAP`:
304
+
305
+ | Task type | Skills injected |
306
+ |-----------|----------------|
307
+ | `write-feature` | tdd, verification-before-completion, anti-rationalization, using-git-worktrees |
308
+ | `fix-bug` | systematic-debugging, verification-before-completion, anti-rationalization, using-git-worktrees |
309
+ | `refactor` | verification-before-completion, anti-rationalization, using-git-worktrees |
310
+ | `write-test` | tdd, anti-rationalization |
311
+ | `research` | *(none)* |
312
+
313
+ 4. Limit concurrent agents to `maxParallel`. If a wave has more tasks than `maxParallel`, batch them into sub-groups.
314
+
315
+ 5. Wait for all agents in the wave to complete before starting the next wave.
316
+
317
+ ### Progress tracking
318
+
319
+ After each task completes, record results using `writeProgress()`:
320
+
321
+ ```javascript
322
+ writeProgress(projectRoot, 1, progressEntries)
323
+ // progressEntries: [{ wave, task, status, executor, commit }]
324
+ ```
325
+
326
+ You can also render a progress table for display using `formatWaveProgress()`:
327
+
328
+ ```javascript
329
+ const table = formatWaveProgress(waves, resultsMap)
330
+ // resultsMap: Map<taskId, { status: 'completed'|'failed', commitHash?: string }>
331
+ ```
332
+
333
+ ### Between waves
334
+
335
+ After each wave completes:
336
+ 1. Run `git status` to verify no conflicts
337
+ 2. Run the project's test suite to catch regressions early
338
+ 3. If tests fail, diagnose before starting the next wave
339
+
340
+ ### Failure handling
341
+
342
+ **Single task failure:**
343
+ 1. Spawn a debugger agent using `DEBUGGER_PROMPT` from `cli/lib/agents.js`:
344
+
345
+ ```javascript
346
+ const debugPrompt = DEBUGGER_PROMPT({
347
+ taskTitle: failedTask.title,
348
+ taskDescription: failedTask.description,
349
+ error: errorMessage,
350
+ logs: relevantLogs,
351
+ })
352
+ ```
353
+
354
+ 2. The debugger returns:
355
+ ```json
356
+ {
357
+ "rootCause": "What went wrong",
358
+ "category": "spec | code | environment",
359
+ "fix": "What to do on retry",
360
+ "retryable": true | false
361
+ }
362
+ ```
363
+
364
+ 3. If `retryable: true`, rebuild the task packet with the fix guidance appended to the description and dispatch a new executor. **One retry only.**
365
+
366
+ 4. If the retry also fails, mark the task as `failed` in progress, skip any tasks that depend on it, and continue with independent tasks.
367
+
368
+ **Multiple failures (2+ tasks in the same wave):**
369
+ 1. Pause execution
370
+ 2. Report full status: which tasks succeeded, which failed, what the debuggers found
371
+ 3. Ask the user how to proceed
372
+
373
+ ---
374
+
375
+ ## Phase 5 — Verify
376
+
377
+ **Not skippable.**
378
+
379
+ Invoke the **code-review skill** (`skills/code-review/`).
380
+
381
+ ### Verification process
382
+
383
+ 1. Gather the full diff of all changes:
384
+ ```
385
+ git diff <base-branch>...HEAD
386
+ ```
387
+
388
+ 2. Spawn a code-reviewer agent using `CODE_REVIEWER_PROMPT` from `cli/lib/agents.js`:
389
+
390
+ ```javascript
391
+ const reviewPrompt = CODE_REVIEWER_PROMPT({
392
+ diff: fullDiff,
393
+ plan: planSummary,
394
+ taskSpec: acceptanceCriteria,
395
+ })
396
+ ```
397
+
398
+ The reviewer evaluates against 6 criteria: spec compliance, correctness, test coverage, security, maintainability, consistency.
399
+
400
+ 3. Run the full test suite, linter, and build:
401
+ ```
402
+ npm test (or project-appropriate command)
403
+ npm run lint
404
+ npm run build
405
+ ```
406
+
407
+ 4. Spawn a verification agent using `VERIFIER_PROMPT` from `cli/lib/agents.js`:
408
+
409
+ ```javascript
410
+ const verifyPrompt = VERIFIER_PROMPT({
411
+ goal: originalDesign,
412
+ plan: planJSON,
413
+ results: executionSummary,
414
+ testOutput: testResults,
415
+ })
416
+ ```
417
+
418
+ The verifier returns:
419
+ ```json
420
+ {
421
+ "verified": true | false,
422
+ "issues": [],
423
+ "regressions": [],
424
+ "missingWork": []
425
+ }
426
+ ```
427
+
428
+ ### Fix loop (max 3 rounds)
429
+
430
+ If the code reviewer finds critical or important issues, or the verifier finds problems:
431
+
432
+ 1. Spawn fix executor subagents for each issue (these are fresh-context agents, same as Phase 4 executors)
433
+ 2. Re-run the code reviewer on the updated diff
434
+ 3. Repeat until the review returns PASS (zero critical and zero important issues) or 3 rounds are exhausted
435
+ 4. After 3 rounds, report remaining issues to the user
436
+
437
+ ### Gate
438
+
439
+ **Must pass with zero critical and zero important issues.** Suggestions are acceptable.
440
+
441
+ Update the roadmap:
442
+
443
+ ```javascript
444
+ updateRoadmap(projectRoot, 1, 'verified')
445
+ ```
446
+
447
+ ---
448
+
449
+ ## Phase 6 — Ship
450
+
451
+ **Not skippable.**
452
+
453
+ Invoke the **finishing-branches skill** (`skills/finishing-branches/`).
454
+
455
+ ### Default: Push + Open PR
456
+
457
+ 1. Push the feature branch:
458
+ ```
459
+ git push -u origin <branch-name>
460
+ ```
461
+
462
+ 2. Auto-generate the PR body from `.planning/` state:
463
+ - **Summary:** design decisions from `discussion.md`
464
+ - **Tasks completed:** from `progress.md` entries
465
+ - **Test results:** from the verify phase output
466
+ - **Research highlights:** key findings from `research/`
467
+
468
+ 3. Open the PR:
469
+ ```
470
+ gh pr create --title "<short title>" --body "<generated body>"
471
+ ```
472
+
473
+ 4. Clean up worktrees (if any were used by executors)
474
+
475
+ ### Rules
476
+
477
+ - **NEVER merge to main/master** — the PR is for human review
478
+ - **NEVER force push**
479
+ - Report the PR URL to the user when done
480
+
481
+ ### Final state update
482
+
483
+ ```javascript
484
+ updateRoadmap(projectRoot, 1, 'completed')
485
+ ```
486
+
487
+ ---
488
+
489
+ ## Quick Reference: Module APIs
490
+
491
+ ### cli/lib/planning.js
492
+
493
+ | Function | Purpose |
494
+ |----------|---------|
495
+ | `initPlanning(projectRoot, config)` | Create `.planning/` with roadmap.md and config.json |
496
+ | `initPhase(projectRoot, phaseNum)` | Create phase directory with discussion.md, research/, plans/, tasks/, progress.md |
497
+ | `readProgress(projectRoot, phaseNum?)` | Read wave execution state with summary |
498
+ | `writeProgress(projectRoot, phaseNum, data)` | Update progress.md with current wave state |
499
+ | `readRoadmap(projectRoot)` | Parse roadmap.md to get phase list with statuses |
500
+ | `updateRoadmap(projectRoot, phaseNum, status)` | Update a phase's status in roadmap.md |
501
+ | `readConfig(projectRoot)` | Read .planning/config.json |
502
+ | `writeConfig(projectRoot, config)` | Write .planning/config.json |
503
+ | `writeDiscussion(projectRoot, phaseNum, content)` | Append to discussion.md |
504
+ | `writeResearch(projectRoot, phaseNum, agentName, content)` | Write researcher output to research/ |
505
+ | `writePlan(projectRoot, phaseNum, planData)` | Write plan with wave structure to plans/ |
506
+ | `writeTask(projectRoot, phaseNum, taskId, taskSpec)` | Write individual task spec to tasks/ |
507
+ | `getPlanningRoot(startDir)` | Walk up to find .planning/ (like git finds .git/) |
508
+ | `isActive(projectRoot)` | Check if any phases are non-completed |
509
+
510
+ ### cli/lib/executor.js
511
+
512
+ | Function | Purpose |
513
+ |----------|---------|
514
+ | `buildTaskPacket(task, options)` | Assemble self-contained task packet with spec, context, skills, contract |
515
+ | `executeTask(taskPacket, options)` | Build Agent tool invocation data (prompt, description, isolation, model) |
516
+ | `buildWavePlan(tasks)` | Topological sort into parallel execution waves; throws on cycles |
517
+ | `formatWaveProgress(wavePlan, results)` | Render Markdown progress table |
518
+ | `getSkillContent(skillName, projectRoot)` | Read SKILL.md from ~/.claude/skills/ with project fallback |
519
+ | `SKILL_MAP` | Maps task types to methodology skill arrays |
520
+
521
+ ### cli/lib/agents.js
522
+
523
+ | Export | Purpose |
524
+ |--------|---------|
525
+ | `RESEARCHER_PROMPTS.stackResearcher(ctx)` | Tech stack analysis prompt |
526
+ | `RESEARCHER_PROMPTS.featureResearcher(ctx)` | Pattern discovery prompt |
527
+ | `RESEARCHER_PROMPTS.architectureResearcher(ctx)` | Integration mapping prompt |
528
+ | `RESEARCHER_PROMPTS.pitfallResearcher(ctx)` | Risk identification prompt |
529
+ | `PLANNER_PROMPT(ctx)` | Atomic task plan creation prompt |
530
+ | `PLAN_CHECKER_PROMPT(ctx)` | Plan validation prompt (max 3 iterations) |
531
+ | `DEBUGGER_PROMPT(ctx)` | Task failure diagnosis prompt |
532
+ | `VERIFIER_PROMPT(ctx)` | Execution result verification prompt |
533
+ | `CODE_REVIEWER_PROMPT(ctx)` | Structured code review prompt |
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: quick
3
+ description: Single-executor mode for small tasks — quick fix, rename, config change, add test
4
+ injects_into: [orchestrator-quick]
5
+ ---
6
+
7
+ # Quick Mode
8
+
9
+ Single-executor mode for small, clear tasks. No planning ceremony, no `.planning/` state.
10
+
11
+ ```
12
+ User prompt → Single fresh-context executor → Verify → Done
13
+ ```
14
+
15
+ ## When to Use
16
+
17
+ - Bug fixes, typo corrections
18
+ - Renames, moves, config changes
19
+ - Adding tests for existing code
20
+ - Any task the user prefixes with `quick:` or invokes via `/quick`
21
+
22
+ ## When NOT to Use
23
+
24
+ - Multi-system features → use `/project`
25
+ - Ambiguous requirements needing discussion → use `/project --assumptions`
26
+ - Changes spanning many files with dependencies → use `/project`
27
+
28
+ If in doubt, announce your routing decision and offer the escape hatch:
29
+ *"This looks like a quick fix — running in quick mode. Say `/project` if you want the full lifecycle."*
30
+
31
+ ## Process
32
+
33
+ ### Step 1 — Parse Task and Detect Type
34
+
35
+ Read the user's task description and classify it:
36
+
37
+ | Signal words | Task type |
38
+ |-------------|-----------|
39
+ | "fix", "bug", "broken", "error", "crash", "fails" | `fix-bug` |
40
+ | "test", "spec", "coverage", "add test" | `write-test` |
41
+ | "refactor", "rename", "move", "clean", "extract", "simplify" | `refactor` |
42
+ | Everything else | `write-feature` |
43
+
44
+ Identify relevant files from the description. If the user names specific files, use those. If not, use Grep/Glob to locate the files before dispatching.
45
+
46
+ ### Step 2 — Gather Context (Compact)
47
+
48
+ Collect the minimum context the executor needs:
49
+
50
+ 1. **Branch** — run `git branch --show-current`
51
+ 2. **Recent commits** — run `git log --oneline -5`
52
+ 3. **Architecture excerpt** — read ARCHITECTURE.md, extract only sections relevant to the task (not the whole file). If the file is large, pick the 2-3 most relevant sections.
53
+ 4. **Conventions** — pull key conventions from CLAUDE.md (test framework, module system, naming patterns)
54
+
55
+ Keep context compact. The executor gets a fresh context window — don't waste it on irrelevant architecture.
56
+
57
+ ### Step 3 — Build the Task Packet
58
+
59
+ Use `buildTaskPacket()` from `cli/lib/executor.js` to assemble the executor prompt.
60
+
61
+ The function signature:
62
+
63
+ ```javascript
64
+ buildTaskPacket(task, options)
65
+ ```
66
+
67
+ Where `task` is:
68
+ ```javascript
69
+ {
70
+ id: 'quick-1', // fixed ID for quick mode
71
+ title: '<short imperative title from user description>',
72
+ type: '<detected task type>', // fix-bug | write-test | refactor | write-feature
73
+ description: '<user description + any files/context you gathered>',
74
+ files: ['<relevant file paths>'],
75
+ acceptance: ['<derived from user description>'],
76
+ }
77
+ ```
78
+
79
+ And `options` is:
80
+ ```javascript
81
+ {
82
+ branch: '<current branch>',
83
+ recentCommits: '<git log output>',
84
+ architectureExcerpt: '<relevant ARCHITECTURE.md sections>',
85
+ conventions: '<key CLAUDE.md conventions>',
86
+ projectRoot: '<project root path>',
87
+ }
88
+ ```
89
+
90
+ The function automatically injects methodology skills based on `task.type` using `SKILL_MAP`:
91
+
92
+ | Task type | Skills injected |
93
+ |-----------|----------------|
94
+ | `write-feature` | tdd, verification-before-completion, anti-rationalization, using-git-worktrees |
95
+ | `fix-bug` | systematic-debugging, verification-before-completion, anti-rationalization, using-git-worktrees |
96
+ | `refactor` | verification-before-completion, anti-rationalization, using-git-worktrees |
97
+ | `write-test` | tdd, anti-rationalization |
98
+ | `research` | *(none — not used by Quick Mode's auto-detection, but valid in executor.js)* |
99
+
100
+ ### Step 4 — Decide Worktree
101
+
102
+ - If the task touches **1-2 files** and is a simple fix → no worktree
103
+ - If the task touches **3+ files** or involves logic changes → use worktree isolation
104
+
105
+ Pass this decision when calling `executeTask()`:
106
+
107
+ ```javascript
108
+ executeTask(taskPacket, { useWorktree: true }) // returns { prompt, description, isolation: 'worktree' }
109
+ executeTask(taskPacket, {}) // no worktree
110
+ ```
111
+
112
+ ### Step 5 — Dispatch Executor
113
+
114
+ Spawn a **single** subagent using the Agent tool:
115
+
116
+ ```
117
+ Agent tool call:
118
+ prompt: <the task packet string from buildTaskPacket()>
119
+ description: <5-word summary from executeTask()>
120
+ isolation: 'worktree' (only if useWorktree)
121
+ ```
122
+
123
+ **Do NOT dispatch multiple agents.** Quick mode is a single executor.
124
+
125
+ ### Step 6 — Report Results
126
+
127
+ When the executor returns:
128
+
129
+ **On success**, report to the user:
130
+ - What was done (1-2 sentences)
131
+ - Files changed
132
+ - Tests run and passed
133
+ - Commit hash (if committed)
134
+
135
+ **On failure**, report:
136
+ - What went wrong
137
+ - Root cause if identifiable
138
+ - Offer: *"Want me to retry, or escalate to `/project` mode for the full lifecycle?"*
139
+
140
+ ## Composable Flags
141
+
142
+ ### `--with-research`
143
+
144
+ Before dispatching the executor, spawn a single researcher agent to gather context:
145
+
146
+ 1. Use the `featureResearcher` template from `cli/lib/agents.js`:
147
+ ```javascript
148
+ RESEARCHER_PROMPTS.featureResearcher({ goal: '<user description>' })
149
+ ```
150
+ 2. Run the researcher as an Agent tool call
151
+ 3. Append the researcher's findings to the task packet's `description` field before building the packet
152
+
153
+ ### `--with-discuss`
154
+
155
+ Before dispatching the executor, ask 2-3 clarifying questions:
156
+
157
+ 1. Analyze the user's request for ambiguities
158
+ 2. Ask questions **one at a time** (not batched)
159
+ 3. Once clarified, proceed with the normal quick flow
160
+
161
+ ## What Quick Mode Does NOT Do
162
+
163
+ - **No `.planning/` state** — fully stateless
164
+ - **No wave execution** — single executor only
165
+ - **No roadmap or phases** — no multi-step lifecycle
166
+ - **No multi-task planning** — one task, one executor, done
167
+ - **No parallel researchers** (unless `--with-research`)
168
+
169
+ ## Completion Contract (Inherited by Executor)
170
+
171
+ The executor receives these rules via `buildTaskPacket()`:
172
+
173
+ - Commit atomically when done (one commit)
174
+ - Report: files changed, tests run, tests passed
175
+ - Stay in scope — only modify files related to this task
176
+ - NEVER merge branches or push to main/master
177
+ - NEVER skip tests or verification steps
178
+ - If unable to complete, report what failed and why