@slamb2k/mad-skills 2.0.7 → 2.0.8

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.
@@ -1,13 +1,8 @@
1
1
  ---
2
2
  name: brace
3
- description: >
4
- Initialize any project directory with the GOTCHA/BRACE framework for agentic
5
- AI systems. Creates the 6-layer structure (Goals, Orchestration, Tools,
6
- Context, Hard prompts, Args), BRACE build methodology, and a project
7
- CLAUDE.md. Recommends claude-mem for persistent memory. Idempotent — safe
8
- to run on existing projects. Triggers: "init gotcha", "setup brace", "brace",
9
- "initialize framework", "bootstrap gotcha".
10
- argument-hint: [--no-brace] [--force]
3
+ description: 'Initialize any project directory with the GOTCHA/BRACE framework for agentic AI systems. Creates the 6-layer structure (Goals, Orchestration, Tools, Context, Hard prompts, Args), BRACE build methodology, and a project CLAUDE.md. Recommends claude-mem for persistent memory. Idempotent — safe to run on existing projects. Triggers: "init gotcha", "setup brace", "brace", "initialize framework", "bootstrap gotcha".'
4
+ argument-hint: "[--no-brace] [--force]"
5
+ allowed-tools: Bash, Read, Write, Edit, Glob, Grep, AskUserQuestion
11
6
  ---
12
7
 
13
8
  # Brace - GOTCHA/BRACE Framework Bootstrap
@@ -37,15 +32,246 @@ Taglines:
37
32
  - Structural integrity confirmed!
38
33
  - Brace for impact!
39
34
 
40
- Follow instructions in: [instructions.md](instructions.md)
35
+ ---
36
+
37
+ Initialize any project directory with the GOTCHA/BRACE framework. Idempotent —
38
+ safe to re-run on existing projects. Content templates and subagent prompts
39
+ are in `references/`.
41
40
 
42
- ## Subagent Architecture
41
+ **Key principle:** Scan first, present plan, get approval, then act.
43
42
 
44
- - Phase 1 (scan): **Bash** subagent, **haiku** model
45
- - Phase 4 (scaffold): **general-purpose** subagent (content generation)
46
- - Phase 5 (verify): **Bash** subagent, **haiku** model
43
+ Phase prompts: `references/phase-prompts.md`
44
+ Scaffold manifest: `references/scaffold-manifest.md`
45
+ Report format: `references/report-template.md`
46
+
47
+ ---
47
48
 
48
49
  ## Flags
49
50
 
50
- - `--no-brace` Skip BRACE build methodology
51
+ Parse optional flags from the request:
52
+ - `--no-brace` — Skip BRACE build methodology (goals/build_app.md)
51
53
  - `--force` — Overwrite existing files without prompting
54
+
55
+ ---
56
+
57
+ ## Pre-flight
58
+
59
+ Before starting, check all dependencies in this table:
60
+
61
+ | Dependency | Type | Check | Required | Resolution | Detail |
62
+ |-----------|------|-------|----------|------------|--------|
63
+ | claude-mem | plugin | — | no | ask | `claude plugin install claude-mem` |
64
+
65
+ For each row, in order:
66
+ 1. Run the Check command (for cli/npm) or test file existence (for agent/skill)
67
+ 2. If found: continue silently
68
+ 3. If missing: apply Resolution strategy
69
+ - **stop**: notify user with Detail, halt execution
70
+ - **url**: notify user with Detail (install link), halt execution
71
+ - **install**: notify user, run the command in Detail, continue if successful
72
+ - **ask**: notify user, offer to run command in Detail, continue either way (or halt if required)
73
+ - **fallback**: notify user with Detail, continue with degraded behavior
74
+ 4. After all checks: summarize what's available and what's degraded
75
+
76
+ 1. Capture **FLAGS** from the user's request
77
+ 2. Create a task list tracking all 5 phases
78
+
79
+ ---
80
+
81
+ ## Phase 1: Directory Scan
82
+
83
+ Launch **Bash** subagent (**haiku**):
84
+
85
+ ```
86
+ Task(
87
+ subagent_type: "Bash",
88
+ model: "haiku",
89
+ description: "Scan directory for existing GOTCHA structure",
90
+ prompt: <read from references/phase-prompts.md#phase-1>
91
+ )
92
+ ```
93
+
94
+ Parse SCAN_REPORT. Extract:
95
+ - `directory_name` (used as default project name)
96
+ - `existing_dirs` / `missing_dirs`
97
+ - `existing_files` / `missing_files`
98
+ - `has_claude_md` / `has_gitignore`
99
+ - `has_atlas` (legacy ATLAS naming detected)
100
+ - `has_forge` (legacy FORGE naming detected)
101
+ - `has_legacy_memory` (old tools/memory system detected)
102
+
103
+ ---
104
+
105
+ ## Phase 1b: Legacy Upgrade Detection
106
+
107
+ **Skip if none of `has_atlas`, `has_forge`, or `has_legacy_memory` is true.**
108
+
109
+ Build a description of what was found:
110
+ - If `has_atlas` or `has_forge`: "Legacy ATLAS/FORGE naming detected"
111
+ - If `has_legacy_memory`: "Legacy memory system (tools/memory/, memory/) detected"
112
+
113
+ Ask the user via AskUserQuestion:
114
+
115
+ Question: "Legacy components detected: {description}. Upgrade and clean up?"
116
+ Options:
117
+ - "Yes, upgrade all" — Replace legacy naming with BRACE and remove old memory system
118
+ - "No, leave as-is" — Keep existing naming and memory system
119
+
120
+ Store result as `upgrade_legacy: true|false` in USER_CONFIG.
121
+
122
+ ---
123
+
124
+ ## Phase 2: Project Inquiry
125
+
126
+ **Runs on primary thread** (user interaction required).
127
+
128
+ 1. Derive default project name from SCAN_REPORT `directory_name`
129
+ 2. Present via AskUserQuestion:
130
+
131
+ Question: "What to include in GOTCHA setup?"
132
+ Options:
133
+ - "Full GOTCHA + BRACE (Recommended)"
134
+ - "GOTCHA structure only (no BRACE methodology)"
135
+ - "Cancel"
136
+
137
+ 3. If not cancelled, ask for project description (one sentence) via
138
+ AskUserQuestion with free text.
139
+
140
+ 4. Ask installation level via AskUserQuestion:
141
+
142
+ Question: "Where should global preferences and universal principles go?"
143
+ Options:
144
+ - "Both — global + project (Recommended)" → portable AND global coverage
145
+ - "Global (~/.claude/CLAUDE.md) only" → applies to all projects
146
+ - "Project level only" → self-contained, portable
147
+
148
+ 5. Store as USER_CONFIG:
149
+ - project_name: from directory name or user override
150
+ - description: from user input
151
+ - include_brace: true/false (based on selection and `--no-brace`)
152
+ - install_level: "both" | "global" | "project"
153
+
154
+ **If cancelled, stop here.**
155
+
156
+ ---
157
+
158
+ ## Phase 3: Present Plan & Approve
159
+
160
+ Build the ACTION_PLAN from SCAN_REPORT + USER_CONFIG + FLAGS.
161
+
162
+ For each item in `references/scaffold-manifest.md`:
163
+ - If component not selected in USER_CONFIG → status: "not selected"
164
+ - If item already exists (from SCAN_REPORT) and no `--force` → status: "skip"
165
+ - If item exists and `--force` → status: "overwrite"
166
+ - If CLAUDE.md exists → status: "merge" (append GOTCHA section)
167
+ - If .gitignore exists → status: "merge" (append missing entries)
168
+ - Otherwise → status: "create"
169
+
170
+ If `upgrade_legacy` is true in USER_CONFIG, set status "upgrade" for:
171
+ - CLAUDE.md (replaces "merge" or "skip" — upgrade takes priority)
172
+ - goals/build_app.md (replaces "skip")
173
+ - goals/manifest.md (replaces "skip")
174
+
175
+ If `upgrade_legacy` is true AND `has_legacy_memory` is true, additionally:
176
+ - `tools/memory/` → status: "remove"
177
+ - `memory/` → status: "remove"
178
+ - CLAUDE.md also gets memory section replacement (handled alongside upgrade)
179
+ - `tools/manifest.md` → status: "cleanup" (remove memory tool rows)
180
+ - `.gitignore` → status: "cleanup" (remove memory/*.npy entry)
181
+
182
+ Present plan summary to user via AskUserQuestion:
183
+
184
+ ```
185
+ GOTCHA Framework Setup for: {project_name}
186
+
187
+ Will create: {list of items with status "create"}
188
+ Will merge: {list of items with status "merge"}
189
+ Will upgrade: {list of items with status "upgrade" — legacy → BRACE}
190
+ Will remove: {list of items with status "remove" — legacy memory system}
191
+ Will clean: {list of items with status "cleanup" — remove legacy references}
192
+ Will skip: {count} existing items
193
+ Not selected: {count} items
194
+ Global config: {install_level description}
195
+
196
+ Proceed?
197
+ ```
198
+
199
+ Options: "Yes, proceed" / "Cancel"
200
+
201
+ **If cancelled, stop here.**
202
+
203
+ ---
204
+
205
+ ## Phase 4: Scaffold Structure
206
+
207
+ Launch **general-purpose** subagent:
208
+
209
+ ```
210
+ Task(
211
+ subagent_type: "general-purpose",
212
+ description: "Create GOTCHA framework structure",
213
+ prompt: <read from references/phase-prompts.md#phase-4>
214
+ )
215
+ ```
216
+
217
+ Before sending the prompt, substitute these variables:
218
+ - `{ACTION_PLAN}` — the action plan from Phase 3
219
+ - `{PROJECT_NAME}` — from USER_CONFIG
220
+ - `{PROJECT_DESCRIPTION}` — from USER_CONFIG
221
+ - `{INSTALL_LEVEL}` — from USER_CONFIG ("both", "global", or "project")
222
+ - `{CLAUDE_MD_TEMPLATE}` — read from `references/claude-md-template.md`
223
+ (the section between BEGIN TEMPLATE and END TEMPLATE)
224
+ - `{GITIGNORE_CONTENT}` — read from `assets/gitignore-template`
225
+ - `{GOALS_MANIFEST}` — read from `references/scaffold-manifest.md`
226
+ (the goals/manifest.md content block)
227
+ - `{TOOLS_MANIFEST}` — read from `references/scaffold-manifest.md`
228
+ (the tools/manifest.md content block)
229
+ - `{BRACE_WORKFLOW}` — read from `references/brace-workflow.md`
230
+ (the section after the header, used for goals/build_app.md)
231
+ - `{GLOBAL_PREFERENCES_CONTENT}` — read from `assets/global-preferences-template.md`
232
+ (the section between BEGIN TEMPLATE and END TEMPLATE)
233
+
234
+ Parse SCAFFOLD_REPORT. If status is "failed", report to user and stop.
235
+
236
+ ---
237
+
238
+ ## Phase 5: Verification & Report
239
+
240
+ Launch **Bash** subagent (**haiku**):
241
+
242
+ ```
243
+ Task(
244
+ subagent_type: "Bash",
245
+ model: "haiku",
246
+ description: "Verify GOTCHA structure",
247
+ prompt: <read from references/phase-prompts.md#phase-5>
248
+ )
249
+ ```
250
+
251
+ Parse VERIFY_REPORT. Present the final summary using the format in
252
+ `references/report-template.md`.
253
+
254
+ ---
255
+
256
+ ## Idempotency Rules
257
+
258
+ - **Skip** directories and files that already exist (unless `--force`)
259
+ - **Merge** CLAUDE.md: append GOTCHA section if file exists but lacks it
260
+ - **Merge** .gitignore: append missing entries only
261
+ - **Never delete** user content
262
+ - **Never overwrite** without `--force` or explicit user approval
263
+
264
+ ---
265
+
266
+ ## Error Handling
267
+
268
+ Standard escalation pattern:
269
+ 1. If retryable (permission issue after mkdir): retry once
270
+ 2. If persistent: report to user with specific error
271
+ 3. Offer: skip and continue / abort
272
+ 4. Never silently swallow errors
273
+
274
+ Common issues:
275
+ - Permission denied → report, suggest checking directory permissions
276
+ - CLAUDE.md merge conflict → show both versions, let user choose
277
+ - Directory is read-only → abort with clear message
@@ -15,9 +15,6 @@ data/
15
15
  # Temp & scratch
16
16
  .tmp/
17
17
 
18
- # Memory embeddings cache
19
- memory/*.npy
20
-
21
18
  # Python
22
19
  __pycache__/
23
20
  *.pyc
@@ -47,6 +47,12 @@ Limit your SCAN_REPORT to 20 lines maximum.
47
47
  fi
48
48
  done
49
49
 
50
+ 7. Check for legacy memory system:
51
+ legacy_memory=false
52
+ if [ -d "tools/memory" ] || [ -f "memory/MEMORY.md" ]; then
53
+ legacy_memory=true
54
+ fi
55
+
50
56
  ## Output Format
51
57
 
52
58
  SCAN_REPORT:
@@ -60,6 +66,7 @@ SCAN_REPORT:
60
66
  has_gitignore: true|false
61
67
  has_atlas: true|false
62
68
  has_forge: true|false
69
+ has_legacy_memory: true|false
63
70
  ```
64
71
 
65
72
  ---
@@ -114,6 +121,25 @@ legacy methodology references with BRACE equivalents while preserving all other
114
121
  - **goals/build_app.md:** Replace the entire file with the BRACE workflow content below.
115
122
  - **goals/manifest.md:** Replace "ATLAS" or "FORGE" with "BRACE" in the description column.
116
123
 
124
+ ### For "remove" items (legacy memory cleanup):
125
+
126
+ 1. Before deleting `memory/MEMORY.md`, check if it contains a "## Key Decisions"
127
+ section. If so, extract that section content into `preserved_content` for the
128
+ SCAFFOLD_REPORT so the user can relocate it.
129
+ 2. Remove `tools/memory/` — use `git rm -r tools/memory` if tracked, otherwise `rm -rf tools/memory`
130
+ 3. Remove `memory/` — use `git rm -r memory` if tracked, otherwise `rm -rf memory`
131
+
132
+ ### For "cleanup" items (legacy memory references):
133
+
134
+ - **tools/manifest.md:** Remove any rows referencing `memory/` tools (e.g. search, embed, store scripts)
135
+ - **.gitignore:** Remove the `memory/*.npy` line and its `# Memory embeddings cache` comment if present
136
+ - **CLAUDE.md:** If a `## Memory System` section exists, replace it with:
137
+ ```
138
+ ## Memory
139
+ This project uses claude-mem for persistent cross-session memory.
140
+ ```
141
+ Also remove `tools/memory/` and `memory/` from any directory tree listings in CLAUDE.md.
142
+
117
143
  ### Global preferences (conditional)
118
144
 
119
145
  If INSTALL_LEVEL is "global" or "both":
@@ -178,6 +204,9 @@ SCAFFOLD_REPORT:
178
204
  created: [list of files/dirs created]
179
205
  merged: [list of files merged]
180
206
  upgraded: [list of files upgraded to BRACE]
207
+ removed: [list of legacy items removed]
208
+ cleaned: [list of files cleaned of legacy references]
209
+ preserved_content: [any key decisions extracted from memory/MEMORY.md, or empty]
181
210
  skipped: [list of items skipped]
182
211
  global_updated: true|false|skipped
183
212
  errors: [any errors encountered]
@@ -216,6 +245,13 @@ Limit your VERIFY_REPORT to 15 lines maximum.
216
245
  done
217
246
  echo "gitignore entries: $entries/2"
218
247
 
248
+ 5. If legacy memory cleanup was performed, verify removal:
249
+ if [ -d "tools/memory" ]; then echo "legacy: tools/memory still exists"; fi
250
+ if [ -d "memory" ]; then echo "legacy: memory/ still exists"; fi
251
+ if [ -f "CLAUDE.md" ] && grep -q "tools/memory" CLAUDE.md; then
252
+ echo "legacy: CLAUDE.md still references tools/memory"
253
+ fi
254
+
219
255
  ## Output Format
220
256
 
221
257
  VERIFY_REPORT:
@@ -224,5 +260,6 @@ VERIFY_REPORT:
224
260
  files_verified: {count}/{expected}
225
261
  claude_md_has_gotcha: true|false
226
262
  gitignore_entries: {count}/{expected}
263
+ legacy_memory_cleaned: true|false|not_applicable
227
264
  issues: [any problems found]
228
265
  ```
@@ -25,6 +25,10 @@ Brace Complete!
25
25
  {status} goals/build_app.md
26
26
  {status} tools/manifest.md
27
27
 
28
+ Removed: (only if legacy memory was cleaned up)
29
+ {status} tools/memory/ Legacy memory scripts
30
+ {status} memory/ Legacy memory directory
31
+
28
32
  Notes:
29
33
  {any warnings or skipped items}
30
34
 
@@ -35,4 +39,4 @@ Brace Complete!
35
39
  4. Start building with the BRACE methodology
36
40
  ```
37
41
 
38
- Status indicators: [created] [exists] [merged] [upgraded] [skipped] [failed]
42
+ Status indicators: [created] [exists] [merged] [upgraded] [removed] [skipped] [failed]
@@ -1,12 +1,8 @@
1
1
  ---
2
2
  name: build
3
- description: >
4
- Context-isolated feature development pipeline. Takes a detailed design/plan
5
- as argument and executes the full feature-dev lifecycle (explore, question,
6
- architect, implement, review, ship) inside subagents so the primary
7
- conversation stays compact. Use when you have a well-defined plan and want
8
- autonomous execution with minimal context window consumption.
9
- argument-hint: Detailed design/plan to implement
3
+ description: Context-isolated feature development pipeline. Takes a detailed design/plan as argument and executes the full feature-dev lifecycle (explore, question, architect, implement, review, ship) inside subagents so the primary conversation stays compact. Use when you have a well-defined plan and want autonomous execution with minimal context window consumption.
4
+ argument-hint: <detailed design/plan to implement> [--skip-questions] [--skip-review] [--no-ship] [--parallel-impl]
5
+ allowed-tools: Bash, Read, Write, Edit, Glob, Grep, AskUserQuestion
10
6
  ---
11
7
 
12
8
  # Build - Context-Isolated Feature Development
@@ -36,13 +32,296 @@ Taglines:
36
32
  - 🧱 Bricks, mortar, and semicolons!
37
33
  - 🏎️ Let's see what this baby can do!
38
34
 
39
- Follow instructions in: [instructions.md](instructions.md)
35
+ ---
36
+
37
+ Execute a detailed design/plan through the full feature-dev lifecycle with
38
+ maximum context isolation. Every heavy stage runs in a subagent so the primary
39
+ conversation only accumulates structured reports.
40
40
 
41
- Architecture, agent types, and report budgets are documented in `references/`.
41
+ Stage prompts: `references/stage-prompts.md`
42
+ Report budgets: `references/report-contracts.md`
43
+ Agent selection: `references/architecture-notes.md`
44
+ Project detection: `references/project-detection.md`
42
45
 
43
46
  ## Flags
44
47
 
45
- - `--skip-questions`: Skip clarifying questions (plan is fully specified)
46
- - `--skip-review`: Skip code review stage
47
- - `--no-ship`: Stop after docs update (don't commit/push/PR)
48
- - `--parallel-impl`: Allow parallel implementation agents
48
+ Parse optional flags from the request:
49
+ - `--skip-questions`: Skip Stage 2 (clarifying questions)
50
+ - `--skip-review`: Skip Stage 5 (code review)
51
+ - `--no-ship`: Stop after Stage 8 docs update
52
+ - `--parallel-impl`: Split implementation into parallel agents when independent
53
+
54
+ ---
55
+
56
+ ## Pre-flight
57
+
58
+ Before starting, check all dependencies in this table:
59
+
60
+ | Dependency | Type | Check | Required | Resolution | Detail |
61
+ |-----------|------|-------|----------|------------|--------|
62
+ | ship | skill | `.claude/skills/ship/SKILL.md` | yes | stop | Install with: npx skills add slamb2k/mad-skills --skill ship |
63
+ | feature-dev:code-explorer | agent | — | no | fallback | Uses general-purpose agent |
64
+ | feature-dev:code-architect | agent | — | no | fallback | Uses general-purpose agent |
65
+ | feature-dev:code-reviewer | agent | — | no | fallback | Uses general-purpose agent |
66
+
67
+ For each row, in order:
68
+ 1. Run the Check command (for cli/npm) or test file existence (for agent/skill)
69
+ 2. If found: continue silently
70
+ 3. If missing: apply Resolution strategy
71
+ - **stop**: notify user with Detail, halt execution
72
+ - **url**: notify user with Detail (install link), halt execution
73
+ - **install**: notify user, run the command in Detail, continue if successful
74
+ - **ask**: notify user, offer to run command in Detail, continue either way (or halt if required)
75
+ - **fallback**: notify user with Detail, continue with degraded behavior
76
+ 4. After all checks: summarize what's available and what's degraded
77
+
78
+ 1. Capture **PLAN** (the user's argument) and **FLAGS**
79
+ 2. Detect project type using `references/project-detection.md` to populate
80
+ **PROJECT_CONFIG** (language, test_runner, test_setup)
81
+ 3. Check for outstanding questions from previous work:
82
+ - Search CLAUDE.md for a "Known Issues" or "Open Questions" section
83
+ - Search `goals/` for files containing "open_question" or "unresolved"
84
+ - Search memory (if available) for recent items of type "task" or
85
+ "open_question" that are unresolved
86
+ - Check for `DEBRIEF_ITEMS` in any recent build logs
87
+ 4. If outstanding items found, present via AskUserQuestion:
88
+ ```
89
+ "Found {count} outstanding items from previous work:"
90
+ {numbered list with summary of each}
91
+ "Address any of these before starting the build?"
92
+ ```
93
+ Options:
94
+ - **"Yes, let me choose which ones"** → present each; options:
95
+ "Incorporate into this build" / "Skip for now" / "Explain more"
96
+ Items marked "incorporate" get appended to the PLAN as additional
97
+ requirements for Stage 1 to explore.
98
+ - **"No, proceed with the build"** → continue normally
99
+ 5. Create a task list tracking all stages
100
+
101
+ ---
102
+
103
+ ## Stage 1: Explore
104
+
105
+ Launch **feature-dev:code-explorer** (fallback: general-purpose):
106
+
107
+ ```
108
+ Task(
109
+ subagent_type: "feature-dev:code-explorer",
110
+ description: "Explore codebase for build plan",
111
+ prompt: <read from references/stage-prompts.md#stage-1>
112
+ )
113
+ ```
114
+
115
+ Substitute `{PLAN}` into the prompt.
116
+ Parse EXPLORE_REPORT. Extract `questions` for Stage 2.
117
+
118
+ ---
119
+
120
+ ## Stage 2: Clarifying Questions
121
+
122
+ **Skip if `--skip-questions` or no questions found.**
123
+
124
+ Runs on the **primary thread** (requires user interaction).
125
+
126
+ 1. Review EXPLORE_REPORT `questions` and `potential_issues`
127
+ 2. Present questions to user via AskUserQuestion
128
+ 3. Store answers as CLARIFICATIONS
129
+
130
+ ---
131
+
132
+ ## Stage 3: Architecture Design
133
+
134
+ Launch **feature-dev:code-architect** (fallback: general-purpose):
135
+
136
+ ```
137
+ Task(
138
+ subagent_type: "feature-dev:code-architect",
139
+ description: "Design implementation architecture",
140
+ prompt: <read from references/stage-prompts.md#stage-3>
141
+ )
142
+ ```
143
+
144
+ Substitute `{PLAN}`, `{EXPLORE_REPORT}`, `{CLARIFICATIONS}`.
145
+ Parse ARCH_REPORT. Present `approach_summary` to user for confirmation.
146
+
147
+ If rejected, incorporate feedback and re-run.
148
+
149
+ ---
150
+
151
+ ## Stage 4: Implementation
152
+
153
+ If `--parallel-impl` and ARCH_REPORT has independent `parallel_groups`,
154
+ launch **multiple general-purpose subagents in parallel**.
155
+
156
+ Otherwise launch **one general-purpose subagent**:
157
+
158
+ ```
159
+ Task(
160
+ subagent_type: "general-purpose",
161
+ description: "Implement plan",
162
+ prompt: <read from references/stage-prompts.md#stage-4>
163
+ )
164
+ ```
165
+
166
+ Substitute `{PLAN}`, `{ARCH_REPORT}`, conventions, `{PROJECT_CONFIG.test_runner}`.
167
+ Parse IMPL_REPORT(s). If any failed, assess retry or abort.
168
+
169
+ ---
170
+
171
+ ## Stage 5: Code Review
172
+
173
+ **Skip if `--skip-review`.**
174
+
175
+ Launch **3 feature-dev:code-reviewer subagents in parallel** (fallback: general-purpose):
176
+
177
+ 1. Simplicity & DRY
178
+ 2. Bugs & Correctness
179
+ 3. Conventions & Integration
180
+
181
+ Prompts in `references/stage-prompts.md#stage-5`.
182
+
183
+ Consolidate reports. Present **only critical and high severity findings**.
184
+ Ask: "Fix these now, or proceed as-is?"
185
+
186
+ ---
187
+
188
+ ## Stage 6: Fix Review Findings
189
+
190
+ **Only if Stage 5 found issues AND user wants them fixed.**
191
+
192
+ Launch **general-purpose subagent**:
193
+
194
+ ```
195
+ Task(
196
+ subagent_type: "general-purpose",
197
+ description: "Fix review findings",
198
+ prompt: <read from references/stage-prompts.md#stage-6>
199
+ )
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Stage 7: Verify
205
+
206
+ Launch **Bash subagent** (haiku):
207
+
208
+ ```
209
+ Task(
210
+ subagent_type: "Bash",
211
+ model: "haiku",
212
+ description: "Run verification tests",
213
+ prompt: <read from references/stage-prompts.md#stage-7>
214
+ )
215
+ ```
216
+
217
+ Substitute `{PROJECT_CONFIG.test_runner}` and `{PROJECT_CONFIG.test_setup}`.
218
+
219
+ If tests fail:
220
+ - First failure: launch general-purpose agent to fix, retry
221
+ - Second failure: report to user and stop
222
+
223
+ ---
224
+
225
+ ## Stage 8: Update Progress Documentation
226
+
227
+ **Skip if EXPLORE_REPORT has no `source_docs`.**
228
+
229
+ Launch **general-purpose subagent**:
230
+
231
+ ```
232
+ Task(
233
+ subagent_type: "general-purpose",
234
+ description: "Update progress documentation",
235
+ prompt: <read from references/stage-prompts.md#stage-8>
236
+ )
237
+ ```
238
+
239
+ **If `--no-ship`: Stop here and present final summary.**
240
+
241
+ ---
242
+
243
+ ## Stage 9: Ship
244
+
245
+ Invoke the `/ship` skill:
246
+
247
+ ```
248
+ /ship {approach_summary from ARCH_REPORT}. Files: {files from IMPL_REPORT}
249
+ ```
250
+
251
+ ---
252
+
253
+ ## Stage 10: Debrief
254
+
255
+ **Always runs** on the primary thread (requires user interaction).
256
+
257
+ 1. Scan all stage reports for unresolved items:
258
+ - EXPLORE_REPORT: `potential_issues` not addressed by implementation
259
+ - ARCH_REPORT: `risks` with deferred mitigations
260
+ - REVIEW_REPORT: `medium`/`low` findings not fixed in Stage 6
261
+ - TEST_REPORT: warnings, skipped tests, flaky results
262
+ - DOCS_REPORT: `docs_skipped` items
263
+ - IMPL_REPORT: `issues_encountered` that were worked around
264
+
265
+ 2. Compile into DEBRIEF_ITEMS (see `references/stage-prompts.md#stage-10`).
266
+ Categorise each as: unresolved_risk, deferred_fix, open_question,
267
+ assumption, or tech_debt.
268
+
269
+ 3. **If no items found, skip to Final Report.**
270
+
271
+ 4. Present numbered summary via AskUserQuestion grouped by category.
272
+ Each item shows: `[category] summary (effort)`.
273
+
274
+ Options:
275
+ - **"Fix now"** → create a task list of resolution activities for
276
+ each item; present for user confirmation, then work through them
277
+ - **"Create goals for future sessions"** → write goal files to `goals/`
278
+ (if GOTCHA structure exists) or append to CLAUDE.md as Known Issues
279
+ - **"Note and continue"** → acknowledge items without formal tracking;
280
+ log to memory (if exists) or as source file comments. No further action.
281
+ - **"Let me choose per item"** → present each individually with full
282
+ description, evidence, and impact. Options per item:
283
+ "Fix now" / "Add to goals" / "Explain more" / "Note and continue".
284
+ "Explain more" reads source files cited in evidence, provides
285
+ expanded context, then re-presents the item for decision.
286
+
287
+ 5. After resolution, include debrief summary in the Final Report.
288
+
289
+ ---
290
+
291
+ ## Final Report
292
+
293
+ ```
294
+ Build complete
295
+
296
+ Plan: {first line of PLAN}
297
+ Approach: {approach_summary}
298
+
299
+ Files modified: {count}
300
+ Files created: {count}
301
+ Tests: {passed}/{total}
302
+
303
+ Docs updated: {count or "none"}
304
+
305
+ PR: {pr_url} (merged at {merge_commit})
306
+
307
+ Key decisions:
308
+ - {decision 1}
309
+ - {decision 2}
310
+
311
+ Review findings addressed: {count fixed} / {count found}
312
+
313
+ Debrief: {count resolved} / {count surfaced} items addressed
314
+ {list of items created as goals or tasks, if any}
315
+ ```
316
+
317
+ If any stage failed, report the failure point and what was accomplished.
318
+
319
+ ---
320
+
321
+ ## Rollback
322
+
323
+ If implementation succeeds but later stages fail:
324
+ - Tests fail: fix agent attempts repair, then reports to user
325
+ - Review critical: user decides fix or proceed
326
+ - Ship fails: code is still committed locally; user can manually push
327
+ - Never silently revert completed implementation work