@tgoodington/intuition 8.1.3 → 9.2.1

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 (154) hide show
  1. package/README.md +9 -9
  2. package/docs/project_notes/.project-memory-state.json +100 -0
  3. package/docs/project_notes/branches/.gitkeep +0 -0
  4. package/docs/project_notes/bugs.md +41 -0
  5. package/docs/project_notes/decisions.md +147 -0
  6. package/docs/project_notes/issues.md +101 -0
  7. package/docs/project_notes/key_facts.md +88 -0
  8. package/docs/project_notes/trunk/.gitkeep +0 -0
  9. package/docs/project_notes/trunk/.planning_research/decision_file_naming.md +15 -0
  10. package/docs/project_notes/trunk/.planning_research/decisions_log.md +32 -0
  11. package/docs/project_notes/trunk/.planning_research/orientation.md +51 -0
  12. package/docs/project_notes/trunk/audit/plan-rename-hitlist.md +654 -0
  13. package/docs/project_notes/trunk/blueprint-conflicts.md +109 -0
  14. package/docs/project_notes/trunk/blueprints/database-architect.md +416 -0
  15. package/docs/project_notes/trunk/blueprints/devops-infrastructure.md +514 -0
  16. package/docs/project_notes/trunk/blueprints/technical-writer.md +788 -0
  17. package/docs/project_notes/trunk/build_brief.md +119 -0
  18. package/docs/project_notes/trunk/build_report.md +250 -0
  19. package/docs/project_notes/trunk/detail_brief.md +94 -0
  20. package/docs/project_notes/trunk/plan.md +182 -0
  21. package/docs/project_notes/trunk/planning_brief.md +96 -0
  22. package/docs/project_notes/trunk/prompt_brief.md +60 -0
  23. package/docs/project_notes/trunk/prompt_output.json +98 -0
  24. package/docs/project_notes/trunk/scratch/database-architect-decisions.json +72 -0
  25. package/docs/project_notes/trunk/scratch/database-architect-research-plan.md +10 -0
  26. package/docs/project_notes/trunk/scratch/database-architect-stage1.md +226 -0
  27. package/docs/project_notes/trunk/scratch/devops-infrastructure-decisions.json +71 -0
  28. package/docs/project_notes/trunk/scratch/devops-infrastructure-research-plan.md +7 -0
  29. package/docs/project_notes/trunk/scratch/devops-infrastructure-stage1.md +164 -0
  30. package/docs/project_notes/trunk/scratch/technical-writer-decisions.json +88 -0
  31. package/docs/project_notes/trunk/scratch/technical-writer-research-plan.md +7 -0
  32. package/docs/project_notes/trunk/scratch/technical-writer-stage1.md +266 -0
  33. package/docs/project_notes/trunk/team_assignment.json +108 -0
  34. package/docs/project_notes/trunk/test_brief.md +75 -0
  35. package/docs/project_notes/trunk/test_report.md +26 -0
  36. package/docs/project_notes/trunk/verification/devops-infrastructure-verification.md +172 -0
  37. package/docs/v9/decision-framework-direction.md +142 -0
  38. package/docs/v9/decision-framework-implementation.md +114 -0
  39. package/docs/v9/domain-adaptive-team-architecture.md +1016 -0
  40. package/docs/v9/test/SESSION_SUMMARY.md +117 -0
  41. package/docs/v9/test/TEST_PLAN.md +119 -0
  42. package/docs/v9/test/blueprints/legal-analyst.md +166 -0
  43. package/docs/v9/test/output/07_cover_letter.md +41 -0
  44. package/docs/v9/test/phase2/mock_plan.md +89 -0
  45. package/docs/v9/test/phase2/producers.json +32 -0
  46. package/docs/v9/test/phase2/specialists/database-architect.specialist.md +10 -0
  47. package/docs/v9/test/phase2/specialists/financial-analyst.specialist.md +10 -0
  48. package/docs/v9/test/phase2/specialists/legal-analyst.specialist.md +10 -0
  49. package/docs/v9/test/phase2/specialists/technical-writer.specialist.md +10 -0
  50. package/docs/v9/test/phase2/team_assignment.json +61 -0
  51. package/docs/v9/test/phase3/blueprints/legal-analyst.md +840 -0
  52. package/docs/v9/test/phase3/legal-analyst-full.specialist.md +111 -0
  53. package/docs/v9/test/phase3/project_context/nh_landlord_tenant_notes.md +35 -0
  54. package/docs/v9/test/phase3/project_context/property_facts.md +32 -0
  55. package/docs/v9/test/phase3b/blueprints/legal-analyst.md +1715 -0
  56. package/docs/v9/test/phase3b/legal-analyst.specialist.md +153 -0
  57. package/docs/v9/test/phase3b/scratch/legal-analyst-stage1.md +270 -0
  58. package/docs/v9/test/phase4/TEST_PLAN.md +32 -0
  59. package/docs/v9/test/phase4/blueprints/financial-analyst-T2.md +538 -0
  60. package/docs/v9/test/phase4/blueprints/legal-analyst-T4.md +253 -0
  61. package/docs/v9/test/phase4/cross-blueprint-check.md +280 -0
  62. package/docs/v9/test/phase4/scratch/financial-analyst-T2-stage1.md +67 -0
  63. package/docs/v9/test/phase4/scratch/legal-analyst-T4-stage1.md +54 -0
  64. package/docs/v9/test/phase4/specialists/financial-analyst.specialist.md +156 -0
  65. package/docs/v9/test/phase4/specialists/legal-analyst.specialist.md +153 -0
  66. package/docs/v9/test/phase5/TEST_PLAN.md +35 -0
  67. package/docs/v9/test/phase5/blueprints/code-architect-hw-vetter.md +375 -0
  68. package/docs/v9/test/phase5/output/04_compliance_checklist.md +149 -0
  69. package/docs/v9/test/phase5/output/hardware-vetter-SKILL-v2.md +561 -0
  70. package/docs/v9/test/phase5/output/hardware-vetter-SKILL.md +459 -0
  71. package/docs/v9/test/phase5/producers/code-writer.producer.md +49 -0
  72. package/docs/v9/test/phase5/producers/document-writer.producer.md +62 -0
  73. package/docs/v9/test/phase5/regression-comparison-v2.md +60 -0
  74. package/docs/v9/test/phase5/regression-comparison.md +197 -0
  75. package/docs/v9/test/phase5/review-5A-specialist.md +213 -0
  76. package/docs/v9/test/phase5/specialist-test/TEST_PLAN.md +60 -0
  77. package/docs/v9/test/phase5/specialist-test/blueprint-comparison.md +252 -0
  78. package/docs/v9/test/phase5/specialist-test/blueprints/code-architect-hw-vetter.md +916 -0
  79. package/docs/v9/test/phase5/specialist-test/scratch/code-architect-stage1.md +427 -0
  80. package/docs/v9/test/phase5/specialists/code-architect.specialist.md +168 -0
  81. package/docs/v9/test/phase5b/TEST_PLAN.md +219 -0
  82. package/docs/v9/test/phase5b/blueprints/5B-10-stage2-with-decisions.md +286 -0
  83. package/docs/v9/test/phase5b/decisions/5B-2-accept-all-decisions.json +68 -0
  84. package/docs/v9/test/phase5b/decisions/5B-3-promote-decisions.json +70 -0
  85. package/docs/v9/test/phase5b/decisions/5B-4-individual-decisions.json +68 -0
  86. package/docs/v9/test/phase5b/decisions/5B-5-triage-decisions.json +110 -0
  87. package/docs/v9/test/phase5b/decisions/5B-6-fallback-decisions.json +40 -0
  88. package/docs/v9/test/phase5b/decisions/5B-8-partial-decisions.json +46 -0
  89. package/docs/v9/test/phase5b/decisions/5B-9-complete-decisions.json +54 -0
  90. package/docs/v9/test/phase5b/scratch/code-architect-stage1.md +133 -0
  91. package/docs/v9/test/phase5b/specialists/code-architect.specialist.md +202 -0
  92. package/docs/v9/test/phase5b/stage1-many-decisions.md +139 -0
  93. package/docs/v9/test/phase5b/stage1-no-assumptions.md +70 -0
  94. package/docs/v9/test/phase5b/stage1-with-assumptions.md +86 -0
  95. package/docs/v9/test/phase5b/test-5B-1-results.md +157 -0
  96. package/docs/v9/test/phase5b/test-5B-10-results.md +130 -0
  97. package/docs/v9/test/phase5b/test-5B-2-results.md +75 -0
  98. package/docs/v9/test/phase5b/test-5B-3-results.md +104 -0
  99. package/docs/v9/test/phase5b/test-5B-4-results.md +114 -0
  100. package/docs/v9/test/phase5b/test-5B-5-results.md +126 -0
  101. package/docs/v9/test/phase5b/test-5B-6-results.md +60 -0
  102. package/docs/v9/test/phase5b/test-5B-7-results.md +141 -0
  103. package/docs/v9/test/phase5b/test-5B-8-results.md +115 -0
  104. package/docs/v9/test/phase5b/test-5B-9-results.md +76 -0
  105. package/docs/v9/test/producers/document-writer.producer.md +62 -0
  106. package/docs/v9/test/specialists/legal-analyst.specialist.md +58 -0
  107. package/package.json +4 -2
  108. package/producers/code-writer/code-writer.producer.md +86 -0
  109. package/producers/data-file-writer/data-file-writer.producer.md +116 -0
  110. package/producers/document-writer/document-writer.producer.md +117 -0
  111. package/producers/form-filler/form-filler.producer.md +99 -0
  112. package/producers/presentation-creator/presentation-creator.producer.md +109 -0
  113. package/producers/spreadsheet-builder/spreadsheet-builder.producer.md +107 -0
  114. package/scripts/install-skills.js +97 -9
  115. package/scripts/uninstall-skills.js +7 -2
  116. package/skills/intuition-agent-advisor/SKILL.md +327 -220
  117. package/skills/intuition-assemble/SKILL.md +261 -0
  118. package/skills/intuition-build/SKILL.md +379 -319
  119. package/skills/intuition-debugger/SKILL.md +390 -390
  120. package/skills/intuition-design/SKILL.md +385 -381
  121. package/skills/intuition-detail/SKILL.md +377 -0
  122. package/skills/intuition-engineer/SKILL.md +307 -303
  123. package/skills/intuition-handoff/SKILL.md +264 -222
  124. package/skills/intuition-handoff/references/handoff_core.md +54 -54
  125. package/skills/intuition-initialize/SKILL.md +21 -6
  126. package/skills/intuition-initialize/references/agents_template.md +118 -118
  127. package/skills/intuition-initialize/references/claude_template.md +134 -134
  128. package/skills/intuition-initialize/references/intuition_readme_template.md +4 -4
  129. package/skills/intuition-initialize/references/state_template.json +17 -2
  130. package/skills/{intuition-plan → intuition-outline}/SKILL.md +561 -481
  131. package/skills/{intuition-plan → intuition-outline}/references/magellan_core.md +16 -16
  132. package/skills/{intuition-plan → intuition-outline}/references/templates/plan_template.md +6 -6
  133. package/skills/intuition-prompt/SKILL.md +374 -312
  134. package/skills/intuition-start/SKILL.md +46 -13
  135. package/skills/intuition-start/references/start_core.md +60 -60
  136. package/skills/intuition-test/SKILL.md +345 -0
  137. package/specialists/api-designer/api-designer.specialist.md +291 -0
  138. package/specialists/business-analyst/business-analyst.specialist.md +270 -0
  139. package/specialists/copywriter/copywriter.specialist.md +268 -0
  140. package/specialists/database-architect/database-architect.specialist.md +275 -0
  141. package/specialists/devops-infrastructure/devops-infrastructure.specialist.md +314 -0
  142. package/specialists/financial-analyst/financial-analyst.specialist.md +269 -0
  143. package/specialists/frontend-component/frontend-component.specialist.md +293 -0
  144. package/specialists/instructional-designer/instructional-designer.specialist.md +285 -0
  145. package/specialists/legal-analyst/legal-analyst.specialist.md +260 -0
  146. package/specialists/marketing-strategist/marketing-strategist.specialist.md +281 -0
  147. package/specialists/project-manager/project-manager.specialist.md +266 -0
  148. package/specialists/research-analyst/research-analyst.specialist.md +273 -0
  149. package/specialists/security-auditor/security-auditor.specialist.md +354 -0
  150. package/specialists/technical-writer/technical-writer.specialist.md +275 -0
  151. /package/skills/{intuition-plan → intuition-outline}/references/sub_agents.md +0 -0
  152. /package/skills/{intuition-plan → intuition-outline}/references/templates/confidence_scoring.md +0 -0
  153. /package/skills/{intuition-plan → intuition-outline}/references/templates/plan_format.md +0 -0
  154. /package/skills/{intuition-plan → intuition-outline}/references/templates/planning_process.md +0 -0
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: intuition-handoff
3
- description: Universal phase transition orchestrator. Processes phase outputs, updates project memory, generates fresh briefs for next agent. Manages the design loop for multi-item design cycles.
4
- model: haiku
3
+ description: Universal phase transition orchestrator. Processes phase outputs, updates project memory, generates fresh briefs for next agent. Manages the design loop for multi-item design cycles and v9 team assembly for specialist workflows.
4
+ model: sonnet
5
5
  tools: Read, Write, Glob, Grep, AskUserQuestion, Bash
6
6
  allowed-tools: Read, Write, Glob, Grep, Bash
7
7
  ---
@@ -21,9 +21,9 @@ These are non-negotiable. Violating any of these means the protocol has failed.
21
21
  5. You MUST generate a brief for the next agent.
22
22
  6. You MUST update `.project-memory-state.json` — you are the ONLY skill that writes to this file.
23
23
  7. You MUST NOT evaluate or critique phase outputs. Process and document, never judge.
24
- 8. You MUST NOT skip the user profile merge step during prompt→planning transitions.
24
+ 8. You MUST NOT skip the user profile merge step during prompt→outline transitions.
25
25
  9. You MUST suggest the correct next skill after completing the transition.
26
- 10. You MUST NOT modify discovery_brief.md, plan.md, design_spec_*.md, code_specs.md, or other phase output files — they are read-only inputs.
26
+ 10. You MUST NOT modify prompt_brief.md, outline.md, design_spec_*.md, code_specs.md, or other phase output files — they are read-only inputs.
27
27
  11. You MUST manage the design loop: track which items are designed, route to next item or to engineer when all are done.
28
28
 
29
29
  ## CONTEXT PATH RESOLUTION
@@ -41,15 +41,25 @@ Before ANY transition, resolve the active context:
41
41
  6. Use `context_workflow` for all status checks and state writes
42
42
  7. Shared files (key_facts.md, decisions.md, issues.md, bugs.md) always stay at `docs/project_notes/` — do NOT use context_path for these.
43
43
 
44
+ ## MODE DETECTION
45
+
46
+ After resolving context_path, determine the workflow version:
47
+
48
+ 1. Read `{context_path}outline.md` (if it exists)
49
+ 2. IF outline contains a `### 6.5 Detail Assessment` section → **v9 mode**
50
+ 3. IF outline contains a `Design Recommendations` section OR no outline exists yet → **v8 mode**
51
+ 4. Store the detected mode for use in transition detection below.
52
+
44
53
  ## PROTOCOL: COMPLETE FLOW
45
54
 
46
55
  ```
47
56
  Step 1: Resolve context_path and context_workflow (see above)
57
+ Step 1.5: Detect mode (v8 or v9)
48
58
  Step 2: Detect transition type from context_workflow
49
59
  Step 3: Read phase output files from {context_path}
50
60
  Step 4: Extract insights and structure findings
51
61
  Step 5: Update shared memory files (key_facts.md, decisions.md, issues.md)
52
- Step 6: Merge user profile learnings (prompt→planning only)
62
+ Step 6: Merge user profile learnings (prompt→outline only)
53
63
  Step 7: Generate brief for next agent at {context_path}
54
64
  Step 8: Update .project-memory-state.json (target active context object)
55
65
  Step 9: Report what was processed and suggest next skill
@@ -57,18 +67,30 @@ Step 9: Report what was processed and suggest next skill
57
67
 
58
68
  ## STEP 1: DETECT TRANSITION
59
69
 
60
- After resolving context_path and context_workflow, determine:
70
+ After resolving context_path, context_workflow, and mode:
61
71
 
62
72
  ```
63
73
  IF context_workflow.status == "prompt" AND workflow.prompt.completed == true
64
- AND workflow.planning.started == false:
65
- → TRANSITION: Prompt → Planning (Transition 1)
66
-
67
- IF context_workflow.status == "planning" AND workflow.planning.completed == true
68
- AND workflow.design.started == false AND workflow.engineering.started == false:
69
- TRANSITION: Planning → Design (Transition 2) OR Planning → Engineer (Transition 2B)
70
-
71
- IF context_workflow.status == "design":
74
+ AND workflow.outline.started == false:
75
+ → TRANSITION: Prompt → Outline (Transition 1)
76
+
77
+ IF context_workflow.status == "outline" AND workflow.outline.completed == true:
78
+ IF v9 mode AND NOT (workflow.detail exists AND workflow.detail.started == true):
79
+ IF {context_path}team_assignment.json exists:
80
+ → TRANSITION: Assemble → Detail (Transition 2.5v9)
81
+ ELSE:
82
+ → TRANSITION: Outline → Assemble (Transition 2v9)
83
+ ELSE IF v8 mode AND workflow.design.started == false AND workflow.engineering.started == false:
84
+ → TRANSITION: Outline → Design (Transition 2) OR Outline → Engineer (Transition 2B)
85
+
86
+ IF v9 mode AND context_workflow.status == "detail":
87
+ → Check workflow.detail.specialists array
88
+ → IF current specialist status == "completed" AND more specialists remain in current or later execution phases:
89
+ → TRANSITION: Specialist → Specialist (Transition 3v9)
90
+ → IF ALL specialists completed:
91
+ → TRANSITION: Detail → Build (Transition 4v9)
92
+
93
+ IF v8 mode AND context_workflow.status == "design":
72
94
  → Check workflow.design.items array
73
95
  → IF current item just completed AND more items remain:
74
96
  → TRANSITION: Design → Design (Transition 3)
@@ -77,32 +99,44 @@ IF context_workflow.status == "design":
77
99
 
78
100
  IF context_workflow.status == "engineering" AND workflow.engineering.completed == true
79
101
  AND workflow.build.started == false:
80
- → TRANSITION: Engineer → Build (Transition 5)
102
+ → TRANSITION: Engineer → Build (Transition 5) — v8 only
81
103
 
82
104
  IF context_workflow.status == "building" AND workflow.build.completed == true:
83
- TRANSITION: Build Complete (Transition 6)
105
+ IF v9 mode AND workflow.test.started == false:
106
+ Read {context_path}/team_assignment.json
107
+ IF any producer_assignments entry has producer == "code-writer":
108
+ → TRANSITION: Build → Test (Transition 6.5v9)
109
+ ELSE:
110
+ → TRANSITION: Build → Complete (Transition 6)
111
+ ELSE IF v8 mode:
112
+ → TRANSITION: Build → Complete (Transition 6)
113
+
114
+ IF context_workflow.status == "testing" AND workflow.test.completed == true:
115
+ → TRANSITION: Test → Complete (Transition 7)
84
116
 
85
117
  IF no clear transition detected:
86
118
  → ASK USER: "Which phase just completed?" (use AskUserQuestion)
87
119
  ```
88
120
 
89
- ## STATE SCHEMA (v5.0)
121
+ ## STATE SCHEMA (v8.0)
90
122
 
91
123
  This is the authoritative schema for `.project-memory-state.json`:
92
124
 
93
125
  ```json
94
126
  {
95
127
  "initialized": true,
96
- "version": "5.0",
128
+ "version": "8.0",
97
129
  "active_context": "trunk",
98
130
  "trunk": {
99
- "status": "none | prompt | planning | design | engineering | building | complete",
131
+ "status": "none | prompt | outline | design | engineering | building | testing | detail | complete",
100
132
  "workflow": {
101
133
  "prompt": { "started": false, "completed": false, "started_at": null, "completed_at": null, "output_files": [] },
102
- "planning": { "started": false, "completed": false, "completed_at": null, "approved": false },
134
+ "outline": { "started": false, "completed": false, "completed_at": null, "approved": false },
103
135
  "design": { "started": false, "completed": false, "completed_at": null, "items": [], "current_item": null },
104
136
  "engineering": { "started": false, "completed": false, "completed_at": null },
105
- "build": { "started": false, "completed": false, "completed_at": null }
137
+ "build": { "started": false, "completed": false, "completed_at": null },
138
+ "test": { "started": false, "completed": false, "completed_at": null, "skipped": false },
139
+ "detail": { "started": false, "completed": false, "completed_at": null, "team_assignment": null, "specialists": [], "current_specialist": null, "execution_phase": 1 }
106
140
  }
107
141
  },
108
142
  "branches": {},
@@ -113,12 +147,16 @@ This is the authoritative schema for `.project-memory-state.json`:
113
147
 
114
148
  ### Branch Entry Schema
115
149
 
116
- Each branch in `branches` has: `display_name`, `created_from`, `created_at`, `purpose`, `status`, and a `workflow` object identical to trunk's workflow structure (including `engineering` and `build` phases).
150
+ Each branch in `branches` has: `display_name`, `created_from`, `created_at`, `purpose`, `status`, and a `workflow` object identical to trunk's workflow structure (including `engineering`, `build`, `test`, and `detail` phases).
117
151
 
118
152
  ### Design Items Schema
119
153
 
120
154
  Each item in `design.items`: `{ "name": "snake_case", "display_name": "Human Name", "status": "pending|in_progress|completed|skipped", "plan_tasks": [N], "spec_file": null, "flagged_reason": "..." }`
121
155
 
156
+ ### Detail Specialist Schema (v9)
157
+
158
+ Each entry in `detail.specialists`: `{ "name": "specialist-name", "tasks": [{"task_id": "T1", "depth": "Deep"}], "status": "pending|in_progress|completed", "stage": "stage1|user_gate|stage2|done", "stage1_path": null, "decisions_path": null, "blueprint_path": null }`
159
+
122
160
  When updating state, preserve all existing fields and only modify the relevant ones. Always set `last_handoff` to the current ISO timestamp and `last_handoff_transition` to the transition name.
123
161
 
124
162
  ### State Write Pattern
@@ -146,309 +184,306 @@ Triggered when start routes to handoff with branch creation intent. User has pro
146
184
  - `created_at`: ISO timestamp
147
185
  - `purpose`: user-provided sentence
148
186
  - `status`: "none"
149
- - `workflow`: identical structure to trunk's workflow (all false/null/empty — including `engineering` and `build` phases)
187
+ - `workflow`: identical structure to trunk's workflow (all false/null/empty — including `engineering`, `build`, `test`, and `detail` phases)
150
188
  4. **Set `active_context`** to the new branch key.
151
189
  5. **Write updated state**. Set `last_handoff_transition` to "branch_creation".
152
190
  6. **Route user**: "Branch **[display_name]** created. Run `/clear` then `/intuition-prompt` to define what this branch will accomplish."
153
191
 
154
- ## V4 STATE MIGRATION
192
+ ## V7 STATE MIGRATION
155
193
 
156
- Fires automatically when handoff detects a v4.0 state before processing any transition.
194
+ Fires when handoff detects `version == "7.0"`. For trunk and every branch: rename the `planning` key to `outline` in the `workflow` object (preserving all sub-fields: started, completed, completed_at, approved), and change any `status == "planning"` to `"outline"`. Set `version: "8.0"`, preserve all other fields, write state. Report: "Migrated state from v7.0 to v8.0 (renamed planning → outline)." Then continue with the original transition.
157
195
 
158
- ### Detection
196
+ ## V5 STATE MIGRATION
159
197
 
160
- `version == "4.0"` OR (state has `execution` phase in workflow but no `engineering` phase).
198
+ Fires when handoff detects `version == "5.0"`. For trunk and every branch: if `workflow.detail` does not exist, add `"detail": { "started": false, "completed": false, "completed_at": null, "team_assignment": null, "specialists": [], "current_specialist": null, "execution_phase": 1 }` after `build` in the workflow object. Also add `"test": { "started": false, "completed": false, "completed_at": null, "skipped": false }` after `build`. Set `version: "7.0"`, preserve all other fields, write state. Report: "Migrated state from v5.0 to v7.0 (added detail phase + test phase)." Then continue with the original transition.
161
199
 
162
- ### Migration Steps
200
+ ## V6 STATE MIGRATION
163
201
 
164
- 1. For trunk and every branch, transform the workflow object:
165
- - Rename `execution` → `build` (preserve all field values)
166
- - Add `engineering: { "started": false, "completed": false, "completed_at": null }` before `build`
167
- - If a context has `status == "executing"`, change to `status = "building"`
168
- 2. Set `version: "5.0"`
169
- 3. Preserve all other fields unchanged.
170
- 4. Write updated state.
171
- 5. Report to user: "Migrated state from v4.0 to v5.0 (added engineering phase, renamed execution → build)." Then continue with the original transition.
202
+ Fires when handoff detects `version == "6.0"`. For trunk and every branch: if `workflow.test` does not exist, add `"test": { "started": false, "completed": false, "completed_at": null, "skipped": false }` after `build` in the workflow object. Set `version: "7.0"`, preserve all other fields, write state. Report: "Migrated state from v6.0 to v7.0 (added test phase for post-build quality gate)." Then continue with the original transition.
203
+
204
+ ## V4 STATE MIGRATION
205
+
206
+ Fires when handoff detects `version == "4.0"` OR (`execution` phase exists but no `engineering` phase). For trunk and every branch: rename `execution` → `build`, add `engineering: { "started": false, "completed": false, "completed_at": null }` before `build`, change any `status == "executing"` to `"building"`. Set `version: "5.0"`, preserve all other fields, write state. Report: "Migrated state from v4.0 to v5.0 (added engineering phase, renamed execution → build)." Then continue with the original transition.
172
207
 
173
208
  ## V3 STATE MIGRATION
174
209
 
175
- Fires automatically when handoff detects a v3.0 state before processing any transition.
210
+ Fires when handoff detects `version == "3.0"` OR missing `active_context`. Create `docs/project_notes/trunk/`. Move existing workflow artifacts (`prompt_brief.md`, `prompt_output.json`, `planning_brief.md`, `plan.md`, `design_brief.md`, `design_spec_*.md`, `execution_brief.md`, `.planning_research/`) from `docs/project_notes/` into `trunk/` — skip missing files. Restructure state: wrap existing `status` + `workflow` into `trunk` object, add `active_context: "trunk"`, `branches: {}`, rename `execution` → `build`, add `engineering` phase, set `version: "5.0"`. Preserve `initialized`, `last_handoff`, `last_handoff_transition`. Write state. Report what was migrated and confirm v5.0 upgrade. Leave shared files (`key_facts.md`, `decisions.md`, `issues.md`, `bugs.md`) at `docs/project_notes/`.
176
211
 
177
- ### Detection
212
+ ## TRANSITION 1: PROMPT → OUTLINE
178
213
 
179
- `version == "3.0"` OR missing `active_context` field in state.
214
+ Read `{context_path}prompt_brief.md` and `{context_path}prompt_output.json` (if exists fall back to extracting from brief manually).
180
215
 
181
- ### Migration Steps
216
+ **Extract and Structure:** Key facts → `key_facts.md`, constraints → `key_facts.md` (constraints category), suggested decisions → ADRs in `decisions.md`, assumptions → reference in brief only, follow-up items → `issues.md`.
182
217
 
183
- 1. Create `docs/project_notes/trunk/` directory.
184
- 2. Move existing workflow artifacts from `docs/project_notes/` into `docs/project_notes/trunk/`:
185
- - `discovery_brief.md`, `discovery_output.json`, `planning_brief.md`, `plan.md`
186
- - `design_brief.md`, `design_spec_*.md`, `execution_brief.md`
187
- - `.planning_research/` directory (entire folder)
188
- - Only move files that exist. Skip missing files silently.
189
- 3. Restructure state:
190
- - Wrap existing `status` and `workflow` into a `trunk` object
191
- - Add `active_context: "trunk"`
192
- - Add `branches: {}`
193
- - Transform workflow: rename `execution` → `build`, add `engineering` phase
194
- - Set `version: "5.0"`
195
- - Preserve all other top-level fields (`initialized`, `last_handoff`, `last_handoff_transition`)
196
- 4. Write updated state.
197
- 5. Report to user: list which files were migrated and confirm v5.0 upgrade. Then continue with the original transition.
218
+ **User Profile Merge:** If `prompt_output.json` has `user_profile_learnings` AND `.claude/USER_PROFILE.json` exists: read profile, merge (null fields get new values, populated fields overwrite only if confidence "high"), save. Skip if no USER_PROFILE.json.
198
219
 
199
- Leave shared files (`key_facts.md`, `decisions.md`, `issues.md`, `bugs.md`) at `docs/project_notes/` do NOT move them.
220
+ **Generate Outline Brief:** Write `{context_path}outline_brief.md` with: Discovery Summary (1-2 paragraphs), Problem Statement, Goals & Success Criteria, Key Constraints, Architectural Context, Assumptions & Risks (with confidence levels), References (prompt_brief path, ADR numbers).
200
221
 
201
- ## TRANSITION 1: PROMPT PLANNING
222
+ Update state: set `status` to `"outline"`, mark `prompt.completed = true` with timestamp, set `outline.started = true`. Route: "Prompt output processed. Outline brief saved to `{context_path}outline_brief.md`. Run `/clear` then `/intuition-outline` to create a structured plan."
202
223
 
203
- ### Read Outputs
224
+ ## TRANSITION 2: OUTLINE → DESIGN (Initial Setup)
204
225
 
205
- Read from `{context_path}`:
206
- - `{context_path}discovery_brief.md` — human-readable discovery summary
207
- - `{context_path}discovery_output.json` — structured data (if exists)
226
+ v8 mode only. Read `{context_path}outline.md`. Find "Design Recommendations" section — extract items flagged for design with rationale and task numbers (if no section, assess tasks yourself). Extract: decisions → `decisions.md`, risks/dependencies → include in brief, outline work → `issues.md`.
208
227
 
209
- If `discovery_output.json` doesn't exist, extract insights manually from `discovery_brief.md`.
228
+ **Present to user** via AskUserQuestion (header: "Design Items"): list each flagged item with rationale. Options: "All recommended items need design" / "Some items — let me specify" / "None — skip design, go straight to engineering". If "Some," follow up. If "None," use Transition 2B.
210
229
 
211
- ### Extract and Structure
230
+ **Generate Design Brief:** Write `{context_path}design_brief.md` for FIRST item with: Current Item, Plan Context (1-2 paragraphs), Task Details (numbers, description, acceptance criteria, dependencies), Design Rationale, Constraints, Design Queue (all items with status), References.
212
231
 
213
- From the outputs, identify:
214
- - **Key facts** → add to `docs/project_notes/key_facts.md`
215
- - **Constraints** → add to `docs/project_notes/key_facts.md` under constraints category
216
- - **Suggested decisions** → create ADRs in `docs/project_notes/decisions.md`
217
- - **Assumptions** → reference in brief, not directly added to memory
218
- - **Follow-up items** → add to `docs/project_notes/issues.md`
232
+ Update state: set `status` to `"design"`, mark `outline.completed = true` with timestamp and `approved = true`, set `design.started = true`, populate `design.items`, set `design.current_item` to first item (`"in_progress"`). Route: "Outline processed. Design brief prepared for **[First Item Name]**. Run `/clear` then `/intuition-design` to begin design exploration."
219
233
 
220
- ### User Profile Merge
234
+ ## TRANSITION 2B: OUTLINE → ENGINEER (Skip Design)
221
235
 
222
- If `{context_path}discovery_output.json` contains `user_profile_learnings` AND `.claude/USER_PROFILE.json` exists:
223
- 1. Read existing USER_PROFILE.json
224
- 2. Merge learnings (null fields get new values; populated fields only overwrite if confidence is "high")
225
- 3. Save updated profile
236
+ v8 mode only. Used when user confirms NO items need design. Write `{context_path}engineering_brief.md` with: Plan Summary (1-2 paragraphs), Objective, Discovery Context, Task Summary, Known Risks, References.
226
237
 
227
- If USER_PROFILE.json does NOT exist, skip this step.
238
+ Update state: set `status` to `"engineering"`, mark `outline.completed = true` with timestamp and `approved = true`, set `design.started = false`, `design.completed = false`, `design.items = []`, set `engineering.started = true`. Route: "Outline processed. No design items flagged. Engineering brief saved to `{context_path}engineering_brief.md`. Run `/clear` then `/intuition-engineer` to create code specs."
228
239
 
229
- ### Generate Planning Brief
240
+ ## TRANSITION 2v9: OUTLINE → ASSEMBLE
230
241
 
231
- Write `{context_path}planning_brief.md` with these sections:
232
- - **Discovery Summary** (1-2 paragraphs)
233
- - **Problem Statement**
234
- - **Goals & Success Criteria**
235
- - **Key Constraints**
236
- - **Architectural Context** (existing decisions/patterns)
237
- - **Assumptions & Risks** (with confidence levels)
238
- - **References** (discovery_brief path, relevant ADR numbers)
242
+ v9 mode only. Triggers when outline completes and the plan contains a `### 6.5 Detail Assessment` section.
239
243
 
240
- ### Update State
244
+ ### Protocol
241
245
 
242
- Update the active context: set `status` to `"planning"`, mark `prompt.completed = true` with timestamp, set `planning.started = true`.
246
+ 1. **Extract and structure** from outline.md: architectural decisions `docs/project_notes/decisions.md`, risks/dependencies note for brief, outline insights → `docs/project_notes/issues.md`.
247
+ 2. **Update state**: Set `status` to `"outline"`, mark `outline.completed = true` with timestamp, `approved = true`.
248
+ 3. **Route user**: "Outline processed. Run `/clear` then `/intuition-assemble` to build the specialist team and begin the detail phase."
243
249
 
244
- ### Route User
250
+ ## TRANSITION 2.5v9: ASSEMBLE → DETAIL
245
251
 
246
- "Discovery processed. Planning brief saved to `{context_path}planning_brief.md`. Run `/clear` then `/intuition-plan` to create a structured plan."
252
+ v9 mode only. Triggers when outline is complete, `{context_path}team_assignment.json` exists, and detail has not started. This means assemble has finished and the team is ready.
247
253
 
248
- ## TRANSITION 2: PLANNING → DESIGN (Initial Setup)
254
+ ### Protocol
249
255
 
250
- ### Read Outputs
256
+ 1. **Read team assignment**: Read `{context_path}team_assignment.json`. Extract specialist_assignments, execution_order, and producer_assignments.
251
257
 
252
- Read: `{context_path}plan.md`
258
+ 2. **Read specialist profiles**: For each specialist in specialist_assignments, read their profile to get `display_name` and `domain`.
253
259
 
254
- ### Extract Design Items
260
+ 3. **Determine first specialist**: From execution_order phase 1, pick the first specialist alphabetically (or the only one if solo).
255
261
 
256
- From the plan, find "Design Recommendations" section. Extract all items flagged for design with rationale and task numbers. If no section exists, assess tasks yourself and present to user.
262
+ 4. **Generate detail brief**: Write `{context_path}detail_brief.md` with:
257
263
 
258
- ### Extract and Structure
264
+ ```markdown
265
+ # Detail Brief
259
266
 
260
- From the plan: new architectural decisions → `docs/project_notes/decisions.md`, risks/dependencies → include in brief, planning work → `docs/project_notes/issues.md`.
267
+ ## Current Specialist
268
+ - **Name**: {specialist name}
269
+ - **Display Name**: {display_name from profile}
270
+ - **Domain**: {domain from profile}
271
+ - **Profile Path**: {absolute path to the specialist profile file}
261
272
 
262
- ### Present Design Items to User
273
+ ## Assigned Tasks
274
+ {For each task assigned to this specialist:}
275
+ ### Task {task_id}: {title}
276
+ - **Depth**: {depth}
277
+ - **Description**: {from plan}
278
+ - **Acceptance Criteria**: {from plan}
279
+ - **Dependencies**: {from plan}
263
280
 
264
- Use AskUserQuestion:
265
- - Header: "Design Items"
266
- - Question: List each flagged item with rationale
267
- - Options: "All recommended items need design" / "Some items let me specify" / "None — skip design, go straight to engineering"
281
+ ## Known Research
282
+ {Extract from outline.md the sections relevant to THIS specialist's domain and assigned tasks:}
283
+ {- Section 2 (Discovery Summary) full content, always include}
284
+ {- Section 4 (Risk Analysis)risks relevant to this specialist's tasks}
285
+ {- Section 7 (Architectural Decisions) — decisions touching this specialist's domain}
286
+ {- Any other outline sections that contain research findings relevant to the assigned tasks}
287
+ {Omit sections with no relevance to this specialist. If the outline has no research relevant to this specialist, write "No prior research overlaps with this specialist's domain."}
268
288
 
269
- If "Some items," follow up. If "None," use Transition 2B.
289
+ ## Prior Blueprints
290
+ None (first specialist in execution order)
270
291
 
271
- ### Generate Design Brief
292
+ ## Outline Context
293
+ {Relevant content from outline.md Section 10, if present}
272
294
 
273
- Write `{context_path}design_brief.md` for the FIRST item with these sections:
274
- - **Current Item** (name + description)
275
- - **Plan Context** (1-2 paragraphs)
276
- - **Task Details** (task numbers, description, acceptance criteria, dependencies)
277
- - **Design Rationale** (why flagged)
278
- - **Constraints**
279
- - **Design Queue** (all items with status)
280
- - **References** (plan path, discovery path)
295
+ ## Detail Queue
296
+ {All specialists with status:}
297
+ - [in_progress] {first specialist display_name}
298
+ - [pending] {second specialist display_name}
299
+ - [pending] ...
300
+ ```
281
301
 
282
- ### Update State
302
+ 5. **Update state**:
303
+ - Set `status` to `"detail"`
304
+ - Set `detail.started` to `true`, `detail.completed` to `false`
305
+ - Set `detail.team_assignment` to `"team_assignment.json"`
306
+ - Populate `detail.specialists` array from specialist_assignments. Each entry:
307
+ - `name`: specialist name
308
+ - `tasks`: task list from assignment
309
+ - `status`: `"pending"` (except first specialist: `"in_progress"`)
310
+ - `stage`: `"stage1"`
311
+ - `stage1_path`: null
312
+ - `decisions_path`: null
313
+ - `blueprint_path`: null
314
+ - Set `detail.current_specialist` to the first specialist name
315
+ - Set `detail.execution_phase` to `1`
283
316
 
284
- Update active context: set `status` to `"design"`, mark `planning.completed = true` with timestamp and `approved = true`, set `design.started = true`, populate `design.items` array with all confirmed items, set `design.current_item` to first item, mark first item status `"in_progress"`.
317
+ 6. **Route user**: "Team assignment processed. Detail brief prepared for **[First Specialist Display Name]**. Run `/clear` then `/intuition-detail` to begin specialist consultation."
285
318
 
286
- ### Route User
319
+ ## TRANSITION 3v9: SPECIALIST → SPECIALIST (Next Specialist)
287
320
 
288
- "Plan processed. Design brief prepared for **[First Item Name]**. Run `/clear` then `/intuition-design` to begin design exploration."
321
+ v9 mode only. Triggers when the current specialist's blueprint is complete and more specialists remain.
289
322
 
290
- ## TRANSITION 2B: PLANNING → ENGINEER (Skip Design)
323
+ ### Protocol
291
324
 
292
- Used when user confirms NO items need design.
325
+ 1. **Read completed blueprint**: Read `{context_path}/blueprints/{completed-specialist-name}.md`. Extract: key decisions → `docs/project_notes/decisions.md`, domain facts → `docs/project_notes/key_facts.md`.
293
326
 
294
- ### Generate Engineering Brief
327
+ 2. **Update specialist status**: In `detail.specialists`, mark the completed specialist as `status: "completed"`, `stage: "done"`, set `blueprint_path` to the blueprint file path.
295
328
 
296
- Write `{context_path}engineering_brief.md` with these sections:
297
- - **Plan Summary** (1-2 paragraphs)
298
- - **Objective**
299
- - **Discovery Context** (brief reminder)
300
- - **Task Summary** (task list with brief descriptions)
301
- - **Known Risks** (with mitigations)
302
- - **References** (plan path, discovery path)
329
+ 3. **Determine next specialist**: Check `detail.execution_order` from `{context_path}/team_assignment.json`. Within the current `execution_phase`, find the next specialist with `status: "pending"`. If all specialists in the current phase are complete, advance `execution_phase` and pick the first pending specialist in the next phase.
303
330
 
304
- ### Update State
331
+ 4. **Check dependencies**: Read `team_assignment.json` dependencies array. If the next specialist has `reads_blueprint_from` entries, verify those blueprints exist. If any dependency blueprint is missing, skip to the next eligible specialist or halt if none are ready.
305
332
 
306
- Update active context: set `status` to `"engineering"`, mark `planning.completed = true` with timestamp and `approved = true`, set `design.started = false`, `design.completed = false`, `design.items = []`, set `engineering.started = true`.
333
+ 5. **Generate detail brief for next specialist**: Overwrite `{context_path}/detail_brief.md` with:
334
+ - **Current Specialist**: name, display_name, domain (from next specialist's profile)
335
+ - **Assigned Tasks**: task details from outline
336
+ - **Specialist Profile Path**: absolute path to the next specialist's profile
337
+ - **Known Research**: same extraction as Transition 2.5v9 — outline sections relevant to this specialist's domain and tasks (Section 2 always, Sections 4/7 filtered by relevance). Omit sections with no relevance.
338
+ - **Prior Blueprints**: paths to ALL completed blueprints in `{context_path}/blueprints/` (the next specialist may need to reference them)
339
+ - **Outline Context**: section 10 content
340
+ - **Detail Queue**: all specialists with status (completed/in_progress/pending)
307
341
 
308
- ### Route User
342
+ 6. **Update state**: Set `detail.current_specialist` to next specialist name, mark next specialist `status: "in_progress"`, `stage: "stage1"`. Update `detail.execution_phase` if advanced.
309
343
 
310
- "Plan processed. No design items flagged. Engineering brief saved to `{context_path}engineering_brief.md`. Run `/clear` then `/intuition-engineer` to create code specs."
344
+ 7. **Route user**: "[Completed Specialist] blueprint complete. Detail brief updated for **[Next Specialist Display Name]** ([N] of [total], [remaining] remaining). Run `/clear` then `/intuition-detail` to continue."
311
345
 
312
- ## TRANSITION 3: DESIGNDESIGN (Next Item)
346
+ ## TRANSITION 4v9: DETAILBUILD (Conflict Check + Completeness Gate)
313
347
 
314
- ### Read Outputs
348
+ v9 mode only. Triggers when ALL specialists in `detail.specialists` have `status: "completed"`.
315
349
 
316
- Read:
317
- - `{context_path}design_spec_[completed_item].md`
318
- - Current `.project-memory-state.json`
350
+ ### Protocol
319
351
 
320
- ### Extract and Structure
352
+ 1. **Extract from all blueprints**: For each blueprint in `{context_path}/blueprints/*.md`, extract decisions → `docs/project_notes/decisions.md`, key facts → `docs/project_notes/key_facts.md`.
321
353
 
322
- From completed spec: decisions `docs/project_notes/decisions.md`, key facts `docs/project_notes/key_facts.md`, design work → `docs/project_notes/issues.md`.
354
+ 2. **Conflict detection**: Spawn a haiku Task subagent to scan all blueprints:
355
+ - **Prompt**: "Read all blueprint files in `{context_path}/blueprints/`. Compare them for: contradictory decisions (same field/resource specified differently), overlapping file modifications (multiple blueprints targeting the same file with conflicting changes), inconsistent interface assumptions (one blueprint expects an API that another defines differently), and duplicated work (two blueprints specifying the same deliverable). Write findings to `{context_path}/blueprint-conflicts.md`. If no conflicts found, write 'No conflicts detected.' to the file."
356
+ - If conflicts found → present to user via AskUserQuestion, ask how to resolve. Do NOT proceed to build until resolved or user explicitly accepts the conflicts.
323
357
 
324
- ### Determine Next Item
358
+ 3. **Completeness gate**: For each blueprint, verify:
359
+ - Section 8 "Open Items" is empty (or contains only `[VERIFY]` / execution-time items)
360
+ - All 9 mandatory sections are present and non-empty
361
+ - Acceptance Mapping section addresses every acceptance criterion from the plan
362
+ - Producer Handoff section references a valid producer
363
+ - If any blueprint fails → report the specific failures, do NOT proceed to build.
325
364
 
326
- Find next item with status `"pending"` in `design.items`. If none remain, proceed to Transition 4.
365
+ 4. **Generate build brief**: Write `{context_path}/build_brief.md` with:
366
+ - **Plan Summary** (1-2 paragraphs)
367
+ - **Objective**
368
+ - **Team Summary**: specialists involved, blueprint count, producer assignments
369
+ - **Blueprint Index**: each blueprint with specialist, tasks covered, producer, output format
370
+ - **Conflict Check**: results (clean or resolved conflicts)
371
+ - **Quality Gates**: security review, domain specialist reviews, cross-cutting reviews
372
+ - **Known Risks**: aggregated from blueprints
373
+ - **References**: plan path, all blueprint paths, team_assignment.json path
327
374
 
328
- ### Update Design Brief
375
+ 5. **Update state**: Set `status` to `"building"`, mark `detail.completed = true` with timestamp, set `build.started = true`.
329
376
 
330
- Overwrite `{context_path}design_brief.md` for the next item with these sections:
331
- - **Current Item** (name + description)
332
- - **Plan Context**
333
- - **Task Details**
334
- - **Design Rationale**
335
- - **Prior Design Context** (relevant prior design decisions)
336
- - **Constraints** (updated with prior design decisions)
337
- - **Design Queue** (show completed, current, pending items)
338
- - **References** (plan path, completed spec paths)
377
+ 6. **Route user**: "All blueprints complete. Conflict check [passed/resolved]. Build brief saved to `{context_path}/build_brief.md`. Run `/clear` then `/intuition-build` to begin production."
339
378
 
340
- ### Update State
379
+ ## TRANSITION 3: DESIGN → DESIGN (Next Item)
341
380
 
342
- Update active context's `design.items`: mark completed item as `"completed"` with `spec_file`, mark next item as `"in_progress"`, set `design.current_item` to next item.
381
+ v8 mode only. Read `{context_path}design_spec_[completed_item].md` and current state. Extract from completed spec: decisions `decisions.md`, key facts → `key_facts.md`, design work `issues.md`. Find next `"pending"` item in `design.items`. If none remain, proceed to Transition 4.
343
382
 
344
- ### Route User
383
+ Overwrite `{context_path}design_brief.md` for the next item with: Current Item (name + description), Outline Context, Task Details, Design Rationale, Prior Design Context, Constraints (updated with prior decisions), Design Queue (completed/current/pending), References (outline path, completed spec paths).
345
384
 
346
- "[Previous Item] design complete. Design brief updated for **[Next Item Name]** ([N] of [total], [remaining] remaining). Run `/clear` then `/intuition-design` to continue."
385
+ Update state: mark completed item `"completed"` with `spec_file`, mark next item `"in_progress"`, set `design.current_item`. Route: "[Previous Item] design complete. Design brief updated for **[Next Item Name]** ([N] of [total], [remaining] remaining). Run `/clear` then `/intuition-design` to continue."
347
386
 
348
387
  ## TRANSITION 4: DESIGN → ENGINEER
349
388
 
350
- Triggers when ALL design items have status `"completed"` or `"skipped"`.
389
+ v8 mode only. Triggers when ALL design items are `"completed"` or `"skipped"`. Read all `{context_path}design_spec_*.md` and `outline.md`. Extract from specs: decisions → `decisions.md`, key facts → `key_facts.md`, design work → `issues.md`.
351
390
 
352
- ### Read Outputs
391
+ Write `{context_path}engineering_brief.md` with: Outline Summary (1-2 paragraphs), Objective, Discovery Context, Design Specifications (list each spec; include "Engineer MUST read these specs before creating code specs for flagged tasks"), Task Summary (mark tasks with design specs), Known Risks, References (outline, discovery, design spec paths).
353
392
 
354
- Read all design specs: `{context_path}design_spec_*.md`
355
- Read: `{context_path}plan.md`
393
+ Update state: set `status` to `"engineering"`, mark `design.completed = true` with timestamp, set `engineering.started = true`. Route: "All design specs processed. Engineering brief saved to `{context_path}engineering_brief.md`. Run `/clear` then `/intuition-engineer` to create code specs."
356
394
 
357
- ### Extract and Structure
395
+ ## TRANSITION 5: ENGINEER → BUILD
358
396
 
359
- From design specs: decisions → `docs/project_notes/decisions.md`, key facts → `docs/project_notes/key_facts.md`, design work → `docs/project_notes/issues.md`.
397
+ Read `{context_path}code_specs.md` and `outline.md`. Extract: engineering decisions → `decisions.md`, implementation approach facts → `key_facts.md`.
360
398
 
361
- ### Generate Engineering Brief
399
+ Write `{context_path}build_brief.md` with: Outline Summary (1-2 paragraphs), Objective, Code Specs Summary (task count, key decisions — 1 line each), Required User Steps, Quality Gates (security review, tests, code review), Known Risks, References (outline, code_specs, design spec paths if any).
362
400
 
363
- Write `{context_path}engineering_brief.md` with these sections:
364
- - **Plan Summary** (1-2 paragraphs)
365
- - **Objective**
366
- - **Discovery Context** (brief reminder)
367
- - **Design Specifications** (list each spec with one-line summary; include: "Engineer MUST read these specs before creating code specs for flagged tasks.")
368
- - **Task Summary** (list tasks, mark tasks with design specs)
369
- - **Known Risks** (with mitigations)
370
- - **References** (plan path, discovery path, design spec paths)
401
+ Update state: set `status` to `"building"`, mark `engineering.completed = true` with timestamp, set `build.started = true`. Route: "Code specs processed. Build brief saved to `{context_path}build_brief.md`. Run `/clear` then `/intuition-build` to begin implementation."
371
402
 
372
- ### Update State
403
+ ## TRANSITION 6.5v9: BUILD → TEST
373
404
 
374
- Update active context: set `status` to `"engineering"`, mark `design.completed = true` with timestamp, set `engineering.started = true`.
405
+ v9 mode only. Triggers when build completes and `team_assignment.json` contains at least one `producer_assignments` entry with `producer == "code-writer"`.
375
406
 
376
- ### Route User
407
+ ### Protocol
377
408
 
378
- "All design specs processed. Engineering brief saved to `{context_path}engineering_brief.md`. Run `/clear` then `/intuition-engineer` to create code specs."
409
+ 1. **Read build_report.md**: Extract files modified, task results, deviations from blueprints.
379
410
 
380
- ## TRANSITION 5: ENGINEERBUILD
411
+ 2. **Extract to memory files**: Same extraction as Transition 6 — bugs `bugs.md`, lessons/deviations → `key_facts.md`, work completed → `issues.md`. Do NOT mark build as the final step.
381
412
 
382
- ### Read Outputs
413
+ 3. **Generate test brief**: Write `{context_path}/test_brief.md`:
383
414
 
384
- Read: `{context_path}code_specs.md`
385
- Read: `{context_path}plan.md`
415
+ ```markdown
416
+ # Test Brief
386
417
 
387
- ### Extract and Structure
418
+ ## Build Summary
419
+ - **Status**: [from build_report]
420
+ - **Tasks completed**: [count and list]
421
+ - **Files modified**: [list from build_report]
388
422
 
389
- From code specs: engineering decisions → `docs/project_notes/decisions.md`, key facts about implementation approach → `docs/project_notes/key_facts.md`.
423
+ ## Code Producers Used
424
+ [For each producer_assignments entry where producer == "code-writer":]
425
+ - **Specialist**: [specialist name]
426
+ - **Tasks**: [task IDs]
427
+ - **Output files**: [from build_report]
390
428
 
391
- ### Generate Build Brief
429
+ ## Acceptance Criteria
430
+ [For each code-writer task, extract acceptance criteria from outline.md]
392
431
 
393
- Write `{context_path}build_brief.md` with these sections:
394
- - **Plan Summary** (1-2 paragraphs)
395
- - **Objective**
396
- - **Code Specs Summary** (task count, key engineering decisions — 1 line each)
397
- - **Required User Steps** (from code_specs.md — things the user must do manually)
398
- - **Quality Gates** (security review, tests, code review)
399
- - **Known Risks** (from code specs risk notes)
400
- - **References** (plan path, code_specs path, design spec paths if any)
432
+ ## Decision Log References
433
+ - Specialist decision logs: [paths to {context_path}/scratch/*-decisions.json]
434
+ - Project decisions: docs/project_notes/decisions.md
401
435
 
402
- ### Update State
436
+ ## Blueprint References
437
+ [Paths to blueprints for code-writer tasks in {context_path}/blueprints/]
403
438
 
404
- Update active context: set `status` to `"building"`, mark `engineering.completed = true` with timestamp, set `build.started = true`.
439
+ ## Specialist Test Recommendations
440
+ [From build_report "Test Deliverables Deferred" section — any test specs/files that specialists recommended but build skipped. Include the blueprint source for each so test can read the full context.]
405
441
 
406
- ### Route User
442
+ | Blueprint Source | Deferred File | Description |
443
+ |-----------------|---------------|-------------|
444
+ | [specialist-name.md] | [file path] | [what the specialist recommended] |
407
445
 
408
- "Code specs processed. Build brief saved to `{context_path}build_brief.md`. Run `/clear` then `/intuition-build` to begin implementation."
446
+ [If build_report has no "Test Deliverables Deferred" section or it says "No test deliverables found", write "No specialist test recommendations."]
409
447
 
410
- ## TRANSITION 6: BUILD → COMPLETE
448
+ ## Known Issues
449
+ [From build_report — any issues, deviations, or flagged items]
450
+ ```
411
451
 
412
- ### Read Outputs
452
+ 4. **Update state**: Set `status` to `"testing"`, mark `build.completed = true` with timestamp, set `test.started = true`.
413
453
 
414
- Read `{context_path}/build_report.md` REQUIRED. Contains task outcomes, files modified, verification results, and any deviations from specs. If missing, warn the user that build may not have completed properly, then proceed with what's available.
454
+ 5. **Route**: "Build complete. Code was produced test phase needed. Run `/clear` then `/intuition-test`."
415
455
 
416
- ### Extract and Structure
456
+ ## TRANSITION 7: TEST → COMPLETE
417
457
 
418
- From the build report:
419
- - Bugs found or issues encountered → `docs/project_notes/bugs.md`
420
- - Lessons learned or deviations → `docs/project_notes/key_facts.md`
421
- - Work completed → `docs/project_notes/issues.md`
458
+ Triggers when `context_workflow.status == "testing"` and `workflow.test.completed == true`.
422
459
 
423
- ### Git Commit Offer
460
+ ### Protocol
424
461
 
425
- Check if a `.git` directory exists at the project root (use Bash: `test -d .git && echo "yes" || echo "no"`).
462
+ 1. **Read test_report.md**: Read `{context_path}/test_report.md`. If missing, warn user but proceed with build_report only.
426
463
 
427
- If git repo exists, use AskUserQuestion:
428
- ```
429
- Question: "Build complete. Would you like to commit the changes?"
430
- Header: "Git Commit"
431
- Options:
432
- - "Yes — commit and push"
433
- - "Yes — commit only (no push)"
434
- - "No — skip git"
435
- ```
464
+ 2. **Extract to memory files**: Implementation fixes → `docs/project_notes/bugs.md`, test coverage insights → `docs/project_notes/key_facts.md`, escalated issues → `docs/project_notes/issues.md`.
465
+
466
+ 3. **Fall through to Transition 6 completion protocol**: Proceed with the full Transition 6 protocol below (build_report reading, generated specialist saving, git commit offer, state updates). When coming from test, also read test_report.md during the completion extraction and mark `test.completed = true` with timestamp.
467
+
468
+ ## TRANSITION 6: BUILD → COMPLETE
436
469
 
437
- If user approves commit:
438
- 1. Run `git status` to see changed files
439
- 2. Run `git add` for files listed in the build report's "Files Modified" section. Cross-reference with `git status` to catch any files the report missed.
440
- 3. Run `git commit` with a descriptive message summarizing the build
441
- 4. If user chose push: run `git push`
470
+ This transition also serves as the completion protocol for Transition 7 fallthrough. When coming from test (status == "testing"), also read `{context_path}/test_report.md` and include test results in memory extraction. Mark `test.completed = true` with timestamp if applicable. When coming from build with no code-writer (v9) or any v8 build, mark `test.skipped = true`.
442
471
 
443
- If no git repo or user skips: proceed without git operations.
472
+ Read `{context_path}/build_report.md` REQUIRED (warn user if missing, proceed with what's available). Extract: bugs → `bugs.md`, lessons/deviations → `key_facts.md`, work completed → `issues.md`.
444
473
 
445
- ### Update State
474
+ **Save Generated Specialists to User Pool:** Check if `{context_path}/generated-specialists/` directory exists (Glob: `{context_path}generated-specialists/*/*.specialist.md`). If any `.specialist.md` files are found, for EACH file:
475
+ 1. Read the file's YAML frontmatter to extract `display_name` and `name`.
476
+ 2. Use AskUserQuestion with header "Save Generated Specialist":
477
+ - Question: "The specialist **[display_name]** was generated during this workflow. Save it to your personal library for future projects?"
478
+ - Options: "Yes — save to ~/.claude/specialists/" / "No — discard (session-only)"
479
+ 3. If "Yes": Create the target directory and copy the file via Bash: `mkdir -p ~/.claude/specialists/{name} && cp "{source_path}" ~/.claude/specialists/{name}/{name}.specialist.md`. Log: "Saved **[display_name]** to `~/.claude/specialists/{name}/`."
480
+ 4. If "No": Skip. Log: "Skipped **[display_name]** (session-only)."
446
481
 
447
- Update active context: set `status` to `"complete"`, mark `build.completed = true` with timestamp.
482
+ This step runs only once per completed build, and only if generated specialists exist. If the glob returns no results, skip this step entirely.
448
483
 
449
- ### Route User
484
+ **Git Commit Offer:** Check for `.git` directory (Bash: `test -d .git`). If git repo exists, use AskUserQuestion with header "Git Commit", options: "Yes — commit and push" / "Yes — commit only (no push)" / "No — skip git". If approved: `git status`, `git add` files from build report's "Files Modified" (cross-reference with status), `git commit` with descriptive message, optionally `git push`. Skip if no repo or user declines.
450
485
 
451
- "Workflow cycle complete for [context display name]. Run `/clear` then `/intuition-start` to see your project status and decide what's next."
486
+ Update state: set `status` to `"complete"`, mark `build.completed = true` with timestamp. Route: "Workflow cycle complete for [context display name]. Run `/clear` then `/intuition-start` to see your project status and decide what's next."
452
487
 
453
488
  ## MEMORY FILE FORMATS
454
489
 
@@ -462,15 +497,22 @@ All shared memory files live at `docs/project_notes/` (never context_path).
462
497
 
463
498
  ## EDGE CASES
464
499
 
465
- - **Missing discovery_output.json**: Extract insights from discovery_brief.md manually.
500
+ - **Missing prompt_output.json**: Extract insights from prompt_brief.md manually.
466
501
  - **Poor output quality**: Process as-is. Note concerns in brief. Do NOT fix outputs.
467
- - **New constraints from planning**: Update key_facts.md, create ADR if architectural.
502
+ - **New constraints from outline**: Update key_facts.md, create ADR if architectural.
468
503
  - **Interrupted handoff**: Check what's updated, continue from there, don't duplicate.
469
504
  - **Corrupted state**: Infer phase from existing files. Ask user to confirm.
470
505
  - **Design item skipped mid-loop**: Mark as `"skipped"`, proceed to next. Note in engineering brief.
471
- - **No Design Recommendations in plan**: Present tasks to user, ask if any need design. If none, use 2B.
472
- - **Plan revision after design started**: Alert user. Ask whether to continue or re-evaluate.
506
+ - **No Design Recommendations in outline**: Present tasks to user, ask if any need design. If none, use 2B.
507
+ - **Outline revision after design started**: Alert user. Ask whether to continue or re-evaluate.
473
508
  - **Missing code_specs.md at Transition 5**: Tell user to run `/intuition-engineer` first.
509
+ - **v9 outline detected but no assemble run yet**: Route to `/intuition-assemble`.
510
+ - **v9 specialist dependency blueprint missing**: Skip to next eligible specialist. If none are eligible, halt and ask user.
511
+ - **v9 conflict detection finds issues**: Present all conflicts, ask user to resolve before build. Do not auto-resolve.
512
+ - **v9 completeness gate fails**: Report exact failures per blueprint. User must fix blueprints (re-run detail) before build.
513
+ - **v9 build with no code-writer**: Skip test, mark `test.skipped = true`, direct to Transition 6 completion.
514
+ - **Test report missing at Transition 7**: Warn user, proceed with build report only for memory extraction.
515
+ - **Test skipped by user**: Set `test.skipped = true`, `test.completed = true`, proceed to completion.
474
516
 
475
517
  ## VOICE
476
518