@tgoodington/intuition 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,8 @@
2
2
  name: intuition-handoff
3
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
4
  model: haiku
5
- tools: Read, Write, Glob, Grep, AskUserQuestion
6
- allowed-tools: Read, Write, Glob, Grep
5
+ tools: Read, Write, Glob, Grep, AskUserQuestion, Bash
6
+ allowed-tools: Read, Write, Glob, Grep, Bash
7
7
  ---
8
8
 
9
9
  # Handoff - Phase Transition Orchestrator Protocol
@@ -23,8 +23,8 @@ These are non-negotiable. Violating any of these means the protocol has failed.
23
23
  7. You MUST NOT evaluate or critique phase outputs. Process and document, never judge.
24
24
  8. You MUST NOT skip the user profile merge step during prompt→planning 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, or other phase output files — they are read-only inputs.
27
- 11. You MUST manage the design loop: track which items are designed, route to next item or to execute when all are done.
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.
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
30
30
 
@@ -62,42 +62,47 @@ After resolving context_path and context_workflow, determine:
62
62
  ```
63
63
  IF context_workflow.status == "prompt" AND workflow.prompt.completed == true
64
64
  AND workflow.planning.started == false:
65
- → TRANSITION: Prompt → Planning
65
+ → TRANSITION: Prompt → Planning (Transition 1)
66
66
 
67
67
  IF context_workflow.status == "planning" AND workflow.planning.completed == true
68
- AND workflow.design.started == false:
69
- → TRANSITION: Planning → Design (initial setup)
68
+ AND workflow.design.started == false AND workflow.engineering.started == false:
69
+ → TRANSITION: Planning → Design (Transition 2) OR Planning → Engineer (Transition 2B)
70
70
 
71
71
  IF context_workflow.status == "design":
72
72
  → Check workflow.design.items array
73
73
  → IF current item just completed AND more items remain:
74
- → TRANSITION: Design → Design (next item)
74
+ → TRANSITION: Design → Design (Transition 3)
75
75
  → IF all items completed:
76
- → TRANSITION: Design → Execution
76
+ → TRANSITION: Design → Engineer (Transition 4)
77
77
 
78
- IF context_workflow.status == "executing" AND workflow.execution.completed == true:
79
- TRANSITION: Execution → Complete
78
+ IF context_workflow.status == "engineering" AND workflow.engineering.completed == true
79
+ AND workflow.build.started == false:
80
+ → TRANSITION: Engineer → Build (Transition 5)
81
+
82
+ IF context_workflow.status == "building" AND workflow.build.completed == true:
83
+ → TRANSITION: Build → Complete (Transition 6)
80
84
 
81
85
  IF no clear transition detected:
82
86
  → ASK USER: "Which phase just completed?" (use AskUserQuestion)
83
87
  ```
84
88
 
85
- ## STATE SCHEMA (v4.0)
89
+ ## STATE SCHEMA (v5.0)
86
90
 
87
91
  This is the authoritative schema for `.project-memory-state.json`:
88
92
 
89
93
  ```json
90
94
  {
91
95
  "initialized": true,
92
- "version": "4.0",
96
+ "version": "5.0",
93
97
  "active_context": "trunk",
94
98
  "trunk": {
95
- "status": "none | prompt | planning | design | executing | complete",
99
+ "status": "none | prompt | planning | design | engineering | building | complete",
96
100
  "workflow": {
97
101
  "prompt": { "started": false, "completed": false, "started_at": null, "completed_at": null, "output_files": [] },
98
102
  "planning": { "started": false, "completed": false, "completed_at": null, "approved": false },
99
103
  "design": { "started": false, "completed": false, "completed_at": null, "items": [], "current_item": null },
100
- "execution": { "started": false, "completed": false, "completed_at": null }
104
+ "engineering": { "started": false, "completed": false, "completed_at": null },
105
+ "build": { "started": false, "completed": false, "completed_at": null }
101
106
  }
102
107
  },
103
108
  "branches": {},
@@ -108,7 +113,7 @@ This is the authoritative schema for `.project-memory-state.json`:
108
113
 
109
114
  ### Branch Entry Schema
110
115
 
111
- Each branch in `branches` has: `display_name`, `created_from`, `created_at`, `purpose`, `status`, and a `workflow` object identical to trunk's workflow structure.
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).
112
117
 
113
118
  ### Design Items Schema
114
119
 
@@ -141,11 +146,30 @@ Triggered when start routes to handoff with branch creation intent. User has pro
141
146
  - `created_at`: ISO timestamp
142
147
  - `purpose`: user-provided sentence
143
148
  - `status`: "none"
144
- - `workflow`: identical structure to trunk's workflow (all false/null/empty)
149
+ - `workflow`: identical structure to trunk's workflow (all false/null/empty — including `engineering` and `build` phases)
145
150
  4. **Set `active_context`** to the new branch key.
146
151
  5. **Write updated state**. Set `last_handoff_transition` to "branch_creation".
147
152
  6. **Route user**: "Branch **[display_name]** created. Run `/intuition-prompt` to define what this branch will accomplish."
148
153
 
154
+ ## V4 STATE MIGRATION
155
+
156
+ Fires automatically when handoff detects a v4.0 state before processing any transition.
157
+
158
+ ### Detection
159
+
160
+ `version == "4.0"` OR (state has `execution` phase in workflow but no `engineering` phase).
161
+
162
+ ### Migration Steps
163
+
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.
172
+
149
173
  ## V3 STATE MIGRATION
150
174
 
151
175
  Fires automatically when handoff detects a v3.0 state before processing any transition.
@@ -166,10 +190,11 @@ Fires automatically when handoff detects a v3.0 state before processing any tran
166
190
  - Wrap existing `status` and `workflow` into a `trunk` object
167
191
  - Add `active_context: "trunk"`
168
192
  - Add `branches: {}`
169
- - Set `version: "4.0"`
193
+ - Transform workflow: rename `execution` → `build`, add `engineering` phase
194
+ - Set `version: "5.0"`
170
195
  - Preserve all other top-level fields (`initialized`, `last_handoff`, `last_handoff_transition`)
171
196
  4. Write updated state.
172
- 5. Report to user: list which files were migrated and confirm v4.0 upgrade. Then continue with the original transition.
197
+ 5. Report to user: list which files were migrated and confirm v5.0 upgrade. Then continue with the original transition.
173
198
 
174
199
  Leave shared files (`key_facts.md`, `decisions.md`, `issues.md`, `bugs.md`) at `docs/project_notes/` — do NOT move them.
175
200
 
@@ -239,9 +264,9 @@ From the plan: new architectural decisions → `docs/project_notes/decisions.md`
239
264
  Use AskUserQuestion:
240
265
  - Header: "Design Items"
241
266
  - Question: List each flagged item with rationale
242
- - Options: "All recommended items need design" / "Some items — let me specify" / "None — skip design, go straight to execution"
267
+ - Options: "All recommended items need design" / "Some items — let me specify" / "None — skip design, go straight to engineering"
243
268
 
244
- If "Some items," follow up. If "None," use Transition 4B.
269
+ If "Some items," follow up. If "None," use Transition 2B.
245
270
 
246
271
  ### Generate Design Brief
247
272
 
@@ -262,6 +287,28 @@ Update active context: set `status` to `"design"`, mark `planning.completed = tr
262
287
 
263
288
  "Plan processed. Design brief prepared for **[First Item Name]**. Run `/intuition-design` to begin design exploration."
264
289
 
290
+ ## TRANSITION 2B: PLANNING → ENGINEER (Skip Design)
291
+
292
+ Used when user confirms NO items need design.
293
+
294
+ ### Generate Engineering Brief
295
+
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)
303
+
304
+ ### Update State
305
+
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`.
307
+
308
+ ### Route User
309
+
310
+ "Plan processed. No design items flagged. Engineering brief saved to `{context_path}engineering_brief.md`. Run `/intuition-engineer` to create code specs."
311
+
265
312
  ## TRANSITION 3: DESIGN → DESIGN (Next Item)
266
313
 
267
314
  ### Read Outputs
@@ -298,7 +345,7 @@ Update active context's `design.items`: mark completed item as `"completed"` wit
298
345
 
299
346
  "[Previous Item] design complete. Design brief updated for **[Next Item Name]** ([N] of [total], [remaining] remaining). Run `/intuition-design` to continue."
300
347
 
301
- ## TRANSITION 4: DESIGN → EXECUTION
348
+ ## TRANSITION 4: DESIGN → ENGINEER
302
349
 
303
350
  Triggers when ALL design items have status `"completed"` or `"skipped"`.
304
351
 
@@ -311,55 +358,90 @@ Read: `{context_path}plan.md`
311
358
 
312
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`.
313
360
 
314
- ### Generate Execution Brief
361
+ ### Generate Engineering Brief
315
362
 
316
- Write `{context_path}execution_brief.md` with these sections:
363
+ Write `{context_path}engineering_brief.md` with these sections:
317
364
  - **Plan Summary** (1-2 paragraphs)
318
365
  - **Objective**
319
366
  - **Discovery Context** (brief reminder)
320
- - **Design Specifications** (list each spec with one-line summary; include: "Execute agents MUST read these specs before implementing flagged tasks.")
321
- - **Task Summary** (execution order, mark tasks with design specs)
322
- - **Quality Gates** (security review, tests, code review)
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)
323
369
  - **Known Risks** (with mitigations)
324
370
  - **References** (plan path, discovery path, design spec paths)
325
371
 
326
372
  ### Update State
327
373
 
328
- Update active context: set `status` to `"executing"`, mark `design.completed = true` with timestamp, set `execution.started = true`.
374
+ Update active context: set `status` to `"engineering"`, mark `design.completed = true` with timestamp, set `engineering.started = true`.
329
375
 
330
376
  ### Route User
331
377
 
332
- "All design specs processed. Execution brief saved to `{context_path}execution_brief.md`. Run `/intuition-execute` to begin implementation."
378
+ "All design specs processed. Engineering brief saved to `{context_path}engineering_brief.md`. Run `/intuition-engineer` to create code specs."
333
379
 
334
- ## TRANSITION 4B: PLANNINGEXECUTION (Skip Design)
380
+ ## TRANSITION 5: ENGINEERBUILD
335
381
 
336
- Used when user confirms NO items need design.
382
+ ### Read Outputs
383
+
384
+ Read: `{context_path}code_specs.md`
385
+ Read: `{context_path}plan.md`
386
+
387
+ ### Extract and Structure
337
388
 
338
- ### Generate Execution Brief
389
+ From code specs: engineering decisions → `docs/project_notes/decisions.md`, key facts about implementation approach → `docs/project_notes/key_facts.md`.
339
390
 
340
- Same format as Transition 4 but without the "Design Specifications" section. Write to `{context_path}execution_brief.md`.
391
+ ### Generate Build Brief
392
+
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)
341
401
 
342
402
  ### Update State
343
403
 
344
- Update active context: set `status` to `"executing"`, mark `planning.completed = true` with timestamp and `approved = true`, set `design.started = false`, `design.completed = false`, `design.items = []`, set `execution.started = true`.
404
+ Update active context: set `status` to `"building"`, mark `engineering.completed = true` with timestamp, set `build.started = true`.
345
405
 
346
406
  ### Route User
347
407
 
348
- "Plan processed. No design items flagged. Execution brief saved to `{context_path}execution_brief.md`. Run `/intuition-execute` to begin implementation."
408
+ "Code specs processed. Build brief saved to `{context_path}build_brief.md`. Run `/intuition-build` to begin implementation."
349
409
 
350
- ## TRANSITION 5: EXECUTION → COMPLETE
410
+ ## TRANSITION 6: BUILD → COMPLETE
351
411
 
352
412
  ### Read Outputs
353
413
 
354
- Read execution results from `{context_path}` for any reports the execution phase produced.
414
+ Read build results from `{context_path}` for any reports the build phase produced.
355
415
 
356
416
  ### Extract and Structure
357
417
 
358
418
  Bugs found → `docs/project_notes/bugs.md`, lessons learned → `docs/project_notes/key_facts.md`, work completed → `docs/project_notes/issues.md`.
359
419
 
420
+ ### Git Commit Offer
421
+
422
+ Check if a `.git` directory exists at the project root (use Bash: `test -d .git && echo "yes" || echo "no"`).
423
+
424
+ If git repo exists, use AskUserQuestion:
425
+ ```
426
+ Question: "Build complete. Would you like to commit the changes?"
427
+ Header: "Git Commit"
428
+ Options:
429
+ - "Yes — commit and push"
430
+ - "Yes — commit only (no push)"
431
+ - "No — skip git"
432
+ ```
433
+
434
+ If user approves commit:
435
+ 1. Run `git status` to see changed files
436
+ 2. Run `git add [specific files from build report]` — only add files that were part of the build
437
+ 3. Run `git commit` with a descriptive message summarizing the build
438
+ 4. If user chose push: run `git push`
439
+
440
+ If no git repo or user skips: proceed without git operations.
441
+
360
442
  ### Update State
361
443
 
362
- Update active context: set `status` to `"complete"`, mark `execution.completed = true` with timestamp.
444
+ Update active context: set `status` to `"complete"`, mark `build.completed = true` with timestamp.
363
445
 
364
446
  ### Route User
365
447
 
@@ -382,9 +464,10 @@ All shared memory files live at `docs/project_notes/` (never context_path).
382
464
  - **New constraints from planning**: Update key_facts.md, create ADR if architectural.
383
465
  - **Interrupted handoff**: Check what's updated, continue from there, don't duplicate.
384
466
  - **Corrupted state**: Infer phase from existing files. Ask user to confirm.
385
- - **Design item skipped mid-loop**: Mark as `"skipped"`, proceed to next. Note in execution brief.
386
- - **No Design Recommendations in plan**: Present tasks to user, ask if any need design. If none, use 4B.
467
+ - **Design item skipped mid-loop**: Mark as `"skipped"`, proceed to next. Note in engineering brief.
468
+ - **No Design Recommendations in plan**: Present tasks to user, ask if any need design. If none, use 2B.
387
469
  - **Plan revision after design started**: Alert user. Ask whether to continue or re-evaluate.
470
+ - **Missing code_specs.md at Transition 5**: Tell user to run `/intuition-engineer` first.
388
471
 
389
472
  ## VOICE
390
473
 
@@ -7,12 +7,12 @@ This project uses a four-phase workflow coordinated by the Intuition system, wit
7
7
  The Intuition workflow uses a trunk-and-branch model:
8
8
  - **Trunk**: The first prompt→plan→design→execute cycle. Represents the core vision.
9
9
  - **Branches**: Subsequent cycles that build on, extend, or diverge from trunk or other branches.
10
- - **Engineer**: Post-execution troubleshooting with holistic codebase awareness.
10
+ - **Debugger**: Post-execution diagnostic specialist for hard problems.
11
11
 
12
12
  All phases: `/intuition-prompt` → `/intuition-handoff` → `/intuition-plan` → `/intuition-handoff` →
13
13
  `[/intuition-design loop]` → `/intuition-handoff` → `/intuition-execute` → `/intuition-handoff` → complete
14
14
 
15
- After completion: `/intuition-start` to create branches or `/intuition-engineer` to troubleshoot.
15
+ After completion: `/intuition-start` to create branches or `/intuition-debugger` to debug issues.
16
16
 
17
17
  ### Workflow Phases
18
18
 
@@ -54,7 +54,7 @@ The project follows a structured workflow with handoff transitions between phase
54
54
 
55
55
  **Recommended Flow**: Prompt → Handoff → Plan → Handoff → [Design Loop] → Handoff → Execute → Handoff → complete
56
56
 
57
- After completion, run `/intuition-start` to create a branch or invoke `/intuition-engineer` to troubleshoot.
57
+ After completion, run `/intuition-start` to create a branch or invoke `/intuition-debugger` to debug issues.
58
58
 
59
59
  ### Memory Files
60
60
 
@@ -119,4 +119,4 @@ After completion, run `/intuition-start` to create a branch or invoke `/intuitio
119
119
  - "Execution brief is ready! Use `/intuition-execute` to kick off coordinated implementation."
120
120
 
121
121
  **When execution is complete:**
122
- - "Workflow cycle complete! Use `/intuition-start` to create a branch for new work, or `/intuition-engineer` to troubleshoot any issues."
122
+ - "Workflow cycle complete! Use `/intuition-start` to create a branch for new work, or `/intuition-debugger` to debug any issues."
@@ -1,6 +1,6 @@
1
1
  # Intuition
2
2
 
3
- A trunk-and-branch workflow system for Claude Code. Turns rough ideas into structured plans, detailed designs, and executed implementations through guided dialogue. Supports iterative development through independent branch cycles and post-execution troubleshooting.
3
+ A trunk-and-branch workflow system for Claude Code. Turns rough ideas into structured plans, detailed designs, and executed implementations through guided dialogue. Supports iterative development through independent branch cycles and post-execution debugging.
4
4
 
5
5
  ## Workflow
6
6
 
@@ -13,12 +13,12 @@ A trunk-and-branch workflow system for Claude Code. Turns rough ideas into struc
13
13
 
14
14
  /intuition-handoff → complete
15
15
 
16
- /intuition-start → create branch or /intuition-engineer
16
+ /intuition-start → create branch or /intuition-debugger
17
17
  ```
18
18
 
19
19
  Run `/intuition-handoff` between every phase. It manages state, generates briefs, and routes you forward.
20
20
 
21
- The first prompt→execute cycle is the **trunk**. After trunk completes, create **branches** for new features or changes. Use `/intuition-engineer` to troubleshoot issues in any completed context.
21
+ The first prompt→execute cycle is the **trunk**. After trunk completes, create **branches** for new features or changes. Use `/intuition-debugger` to investigate hard problems in any completed context.
22
22
 
23
23
  ## Skills
24
24
 
@@ -28,8 +28,8 @@ The first prompt→execute cycle is the **trunk**. After trunk completes, create
28
28
  | `/intuition-prompt` | Sharpens a rough idea into a planning-ready brief through focused Q&A |
29
29
  | `/intuition-plan` | Builds a strategic blueprint with tasks, decisions, and design flags |
30
30
  | `/intuition-design` | Elaborates flagged items through collaborative design exploration (ECD framework) |
31
- | `/intuition-execute` | Delegates implementation to specialized subagents and verifies quality |
32
- | `/intuition-engineer` | Holistic post-execution troubleshooter diagnoses and fixes issues with full codebase awareness |
31
+ | `/intuition-execute` | Tech lead orchestrator engineering assessment, implementation guide, informed delegation |
32
+ | `/intuition-debugger` | Expert debuggerdiagnostic specialist for complex bugs, cross-context failures, performance issues |
33
33
  | `/intuition-handoff` | Processes phase outputs, updates memory, prepares the next phase |
34
34
  | `/intuition-initialize` | Sets up project memory (you already ran this) |
35
35
 
@@ -53,8 +53,8 @@ Not every project needs design. If the plan is clear enough, handoff skips strai
53
53
 
54
54
  10. `/intuition-start` — see project status and choose next step
55
55
  - **Create a branch** — start a new feature or change cycle, informed by trunk
56
- - **Open the engineer** — diagnose and fix issues in any completed context
56
+ - **Open the debugger** — investigate hard problems in any completed context
57
57
 
58
- ### Troubleshooting
58
+ ### Debugging
59
59
 
60
- Run `/intuition-engineer` at any time after a context is complete. It loads your workflow artifacts, investigates issues holistically, and delegates fixes to subagents.
60
+ Run `/intuition-debugger` at any time after a context is complete. It classifies issues into diagnostic categories (causal chain, cross-context, emergent, performance, plan-was-wrong) and runs specialized investigation protocols.
@@ -299,13 +299,15 @@ Ordered list forming a valid dependency DAG. Each task:
299
299
  - **Component**: [which architectural component]
300
300
  - **Description**: [WHAT to do, not HOW — execution decides HOW]
301
301
  - **Acceptance Criteria**:
302
- 1. [Measurable, objective criterion]
303
- 2. [Measurable, objective criterion]
302
+ 1. [Outcome-based criterion — verifiable without prescribing implementation]
303
+ 2. [Outcome-based criterion]
304
304
  [minimum 2 per task]
305
305
  - **Dependencies**: [Task numbers] or "None"
306
306
  - **Files**: [Specific paths when known] or "TBD — [component area]"
307
307
  ```
308
308
 
309
+ **Acceptance criteria rule:** If a criterion can only be satisfied ONE way, it is over-specified. Criteria describe outcomes ("users can reset passwords via email"), not implementations ("add a resetPassword() method that calls sendEmail()"). The engineer and build phases decide the code-level HOW.
310
+
309
311
  ### 7. Testing Strategy (Standard+, when code is produced)
310
312
  Test types required. Which tasks need tests (reference task numbers). Critical test scenarios. Infrastructure needed.
311
313
 
@@ -323,18 +325,20 @@ Test types required. Which tasks need tests (reference task numbers). Critical t
323
325
 
324
326
  Every open question MUST have a Recommended Default. The execution phase uses the default unless the user provides direction. If you cannot write a reasonable default, the question is not ready to be left open — resolve it during dialogue.
325
327
 
326
- ### 10. Execution Notes (always)
327
- - Recommended execution order (may differ from task numbering for parallelization)
328
- - Which tasks can run in parallel
329
- - Watch points (areas requiring caution)
330
- - Fallback strategies for high-risk tasks
331
- - Additional context not captured in tasks
328
+ ### 10. Planning Context for Engineer (always)
329
+ Context and considerations for the engineering phase NOT instructions. Engineer owns all implementation decisions.
330
+
331
+ - **Sequencing Considerations**: Factors that affect task ordering (NOT a prescribed order — Engineer decides)
332
+ - **Parallelization Opportunities**: Which tasks touch independent surfaces (Engineer validates and decides)
333
+ - **Engineering Questions**: Open implementation questions Engineer must resolve during code spec creation (e.g., "How should error propagation work across Tasks 3-5?" / "Tasks 2 and 6 both touch the auth layer — shared abstraction or independent?")
334
+ - **Constraints**: Hard boundaries Engineer must respect (performance targets, API contracts, backward compatibility)
335
+ - **Risk Context**: What could go wrong and why — Engineer decides mitigation strategy
332
336
 
333
337
  ## Architect-Engineer Boundary
334
338
 
335
- The planning phase decides WHAT to build, WHERE it lives in the architecture, and WHY each decision was made. The execution phase decides HOW to build it at the code level — internal implementation, code patterns, file decomposition within components.
339
+ The planning phase decides WHAT to build, WHERE it lives in the architecture, and WHY each decision was made. The engineering phase decides HOW to build it at the code level — internal implementation, code patterns, file decomposition within components. Engineer produces `code_specs.md` documenting its engineering decisions, then Build implements against those specs.
336
340
 
337
- Overlap resolution: Planning specifies public interfaces between components and known file paths. Execution owns everything internal to a component and determines paths for new files marked TBD.
341
+ Overlap resolution: Planning specifies public interfaces between components and known file paths. Engineer owns everything internal to a component and determines paths for new files marked TBD.
338
342
 
339
343
  Interim artifacts in `.planning_research/` are working files for planning context management. They are NOT part of the plan-execute contract. Only `plan.md` crosses the handoff boundary.
340
344
 
@@ -389,7 +393,7 @@ Validate ALL before presenting the draft:
389
393
  - [ ] Technology decisions explicitly marked Locked or Recommended (Standard+)
390
394
  - [ ] Interface contracts provided where components interact (Comprehensive)
391
395
  - [ ] Risks have mitigations (Standard+)
392
- - [ ] Execution phase has enough context in Execution Notes to begin independently
396
+ - [ ] Planning Context for Engineer includes engineering questions, not prescriptive instructions
393
397
  - [ ] Design Recommendations section included with every task assessed
394
398
  - [ ] Each DESIGN REQUIRED flag has a specific rationale (not generic)
395
399
 
@@ -76,14 +76,14 @@ IF state.version == "3.0" OR state.active_context is missing:
76
76
  → STOP phase detection
77
77
  → OUTPUT:
78
78
  "This project uses the v3.0 state schema, which is no longer compatible
79
- with Intuition v7.0+. Run /intuition-handoff or /intuition-initialize
80
- to upgrade to v4.0."
79
+ with Intuition v8.0+. Run /intuition-handoff or /intuition-initialize
80
+ to upgrade to v5.0."
81
81
  → END protocol here
82
82
  ```
83
83
 
84
84
  ## CONTEXT PATH RESOLUTION (Step 3)
85
85
 
86
- After confirming v4.0 schema:
86
+ After confirming v4.0+ schema:
87
87
 
88
88
  ```
89
89
  active_context = state.active_context (e.g. "trunk" or "feature-auth")
@@ -128,11 +128,17 @@ ELSE IF a context is in-progress (active_context has status not "complete"):
128
128
  AND context_workflow.workflow.design.completed == false:
129
129
  → PHASE: design_in_progress
130
130
 
131
- ELSE IF context_workflow.workflow.execution.started == false:
132
- → PHASE: ready_for_execution
131
+ ELSE IF context_workflow.workflow.engineering.started == false:
132
+ → PHASE: ready_for_engineering
133
133
 
134
- ELSE IF context_workflow.workflow.execution.completed == false:
135
- → PHASE: execution_in_progress
134
+ ELSE IF context_workflow.workflow.engineering.completed == false:
135
+ → PHASE: engineering_in_progress
136
+
137
+ ELSE IF context_workflow.workflow.build.started == false:
138
+ → PHASE: ready_for_build
139
+
140
+ ELSE IF context_workflow.workflow.build.completed == false:
141
+ → PHASE: build_in_progress
136
142
 
137
143
  ELSE:
138
144
  → PHASE: post_completion
@@ -140,12 +146,13 @@ ELSE IF a context is in-progress (active_context has status not "complete"):
140
146
 
141
147
  **"Any context is complete"** means: `state.trunk.status == "complete"` OR any entry in `state.branches` has `status == "complete"`.
142
148
 
143
- **"No context is in-progress"** means: `state.trunk.status` is not in `["prompt","planning","design","executing"]` AND no branch has status in those values.
149
+ **"No context is in-progress"** means: `state.trunk.status` is not in `["prompt","planning","design","engineering","building"]` AND no branch has status in those values.
144
150
 
145
151
  If `.project-memory-state.json` exists but is corrupted or unreadable, infer phase from which files exist under `context_path`:
146
152
  - `{context_path}discovery_brief.md` exists → prompt complete
147
153
  - `{context_path}plan.md` exists → planning complete
148
154
  - `{context_path}design_spec_*.md` exist → design in progress or complete
155
+ - `{context_path}code_specs.md` exists → engineering complete
149
156
  - Ask user to confirm if ambiguous.
150
157
 
151
158
  ## PHASE HANDLERS
@@ -178,7 +185,7 @@ Project Status:
178
185
  │ └── "[purpose]"
179
186
  ```
180
187
 
181
- Status labels: `none` → "Not started", `prompt` → "Prompting...", `planning` → "Planning...", `design` → "Designing...", `executing` → "Executing...", `complete` → "Complete"
188
+ Status labels: `none` → "Not started", `prompt` → "Prompting...", `planning` → "Planning...", `design` → "Designing...", `engineering` → "Engineering...", `building` → "Building...", `complete` → "Complete"
182
189
 
183
190
  **If any context is in-progress:**
184
191
 
@@ -198,7 +205,7 @@ Question: "All current work is complete. What's next?"
198
205
  Header: "Next Step"
199
206
  Options:
200
207
  - "Create a new branch (new feature or change)"
201
- - "Troubleshoot an issue (/intuition-engineer)"
208
+ - "Debug an issue (/intuition-debugger)"
202
209
  ```
203
210
 
204
211
  **If "Create a new branch":**
@@ -222,7 +229,9 @@ Pass along: branch name "[name]", purpose "[purpose]", parent "[parent]".
222
229
  **If "Troubleshoot":**
223
230
 
224
231
  ```
225
- Run /intuition-engineer to diagnose and fix issues in any completed context.
232
+ Run /intuition-debugger to investigate and debug issues in any completed context.
233
+ The debugger specializes in hard problems — causal chain bugs, cross-context failures,
234
+ performance issues, and cases where the plan or design was wrong.
226
235
  ```
227
236
 
228
237
  ### Prompt In Progress
@@ -297,21 +306,59 @@ Design Queue:
297
306
  [If current item just completed]: Run /intuition-handoff to process the design and move to the next item.
298
307
  ```
299
308
 
300
- ### Ready for Execution
309
+ ### Ready for Engineering
301
310
 
302
311
  Read and curate from:
303
- - `{context_path}plan.md` — extract objective, task count, approach
304
- - `{context_path}execution_brief.md` — reference location
312
+ - `{context_path}plan.md` — extract objective, task count
313
+ - `{context_path}engineering_brief.md` — reference location
305
314
  - `docs/project_notes/decisions.md` — relevant ADRs
306
315
  - `{context_path}design_spec_*.md` — list any design specs
307
316
 
308
317
  ```
309
- Welcome back! Your plan is approved and ready.
318
+ Welcome back! Ready for engineering.
319
+
320
+ Discovery: Complete
321
+ Plan: Approved
322
+ [If design specs exist]: Design: Complete ([N] specs)
323
+ Engineering: Ready
324
+
325
+ - [N] tasks to spec
326
+ - Objective: [1 sentence]
327
+
328
+ Engineering brief ready at: {context_path}engineering_brief.md
329
+
330
+ Run /intuition-engineer to create code specs.
331
+ ```
332
+
333
+ ### Engineering In Progress
334
+
335
+ ```
336
+ Welcome back! Engineering is in progress.
337
+
338
+ Discovery: Complete
339
+ Plan: Approved
340
+ [If design specs exist]: Design: Complete
341
+ Engineering: In progress
342
+
343
+ Run /intuition-engineer to continue creating code specs.
344
+ ```
345
+
346
+ ### Ready for Build
347
+
348
+ Read and curate from:
349
+ - `{context_path}plan.md` — extract objective, task count, approach
350
+ - `{context_path}code_specs.md` — reference location
351
+ - `{context_path}build_brief.md` — reference location
352
+ - `docs/project_notes/decisions.md` — relevant ADRs
353
+
354
+ ```
355
+ Welcome back! Code specs are ready.
310
356
 
311
357
  Discovery: Complete
312
358
  Plan: Approved
313
359
  [If design specs exist]: Design: Complete ([N] specs)
314
- Execution: Ready
360
+ Engineering: Complete
361
+ Build: Ready
315
362
 
316
363
  - [N] tasks
317
364
  - Approach: [1 sentence]
@@ -321,24 +368,25 @@ Key context:
321
368
  - Problem: [1 sentence from discovery]
322
369
  - Main constraint: [most limiting]
323
370
 
324
- Execution brief ready at: {context_path}execution_brief.md
371
+ Build brief ready at: {context_path}build_brief.md
325
372
 
326
- Run /intuition-execute to begin implementation.
373
+ Run /intuition-build to begin implementation.
327
374
  ```
328
375
 
329
- ### Execution In Progress
376
+ ### Build In Progress
330
377
 
331
- Read `{context_path}plan.md` for total tasks and any execution state available.
378
+ Read `{context_path}plan.md` for total tasks and any build state available.
332
379
 
333
380
  ```
334
- Welcome back! Execution is in progress.
381
+ Welcome back! Build is in progress.
335
382
 
336
383
  Discovery: Complete
337
384
  Plan: Approved
338
385
  [If design specs exist]: Design: Complete
339
- Execution: In progress
386
+ Engineering: Complete
387
+ Build: In progress
340
388
 
341
- Run /intuition-execute to continue.
389
+ Run /intuition-build to continue.
342
390
  ```
343
391
 
344
392
  ## BRIEF CURATION RULES
@@ -379,6 +427,7 @@ You are curating information for the user, not dumping files. Follow these rules
379
427
  - **Old v2.0 state schema detected** (has `discovery` instead of `prompt`): Treat `discovery` fields as `prompt` fields. Suggest running `/intuition-initialize` to update to current schema.
380
428
  - **State file exists but active_context is null or missing**: Treat as v3.0 — output the upgrade warning and stop.
381
429
  - **Branch referenced in active_context but not found in branches map**: Report the inconsistency and suggest `/intuition-handoff` to reconcile state.
430
+ - **v4.0 state detected** (has `execution` instead of `build`): Warn user: "State uses v4.0 schema. Run `/intuition-handoff` to migrate to v5.0."
382
431
 
383
432
  ## VOICE
384
433