5-phase-workflow 1.9.4 → 2.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.
Files changed (44) hide show
  1. package/README.md +68 -420
  2. package/bin/install.js +294 -64
  3. package/bin/sync-agents.js +50 -11
  4. package/docs/findings.md +3 -3
  5. package/docs/workflow-guide.md +110 -1046
  6. package/package.json +6 -5
  7. package/src/agents/step-executor-agent.md +49 -0
  8. package/src/agents/step-orchestrator-agent.md +111 -0
  9. package/src/agents/verification-agent.md +78 -0
  10. package/src/commands/5/address-review-findings.md +69 -403
  11. package/src/commands/5/apply-review-findings.md +66 -0
  12. package/src/commands/5/configure.md +113 -77
  13. package/src/commands/5/discuss-feature.md +47 -57
  14. package/src/commands/5/eject.md +7 -6
  15. package/src/commands/5/implement.md +202 -0
  16. package/src/commands/5/plan.md +164 -0
  17. package/src/commands/5/reconfigure.md +30 -29
  18. package/src/commands/5/reply-pr-comments.md +46 -0
  19. package/src/commands/5/review.md +95 -0
  20. package/src/commands/5/split.md +190 -0
  21. package/src/commands/5/synchronize-agents.md +4 -4
  22. package/src/commands/5/triage-pr-comments.md +70 -0
  23. package/src/commands/5/update.md +8 -8
  24. package/src/hooks/check-updates.js +50 -7
  25. package/src/hooks/plan-guard.js +28 -22
  26. package/src/hooks/statusline.js +50 -4
  27. package/src/skills/configure-docs-index/SKILL.md +16 -20
  28. package/src/skills/configure-skills/SKILL.md +12 -12
  29. package/src/templates/AGENTS.md +94 -0
  30. package/src/templates/workflow/FIX-PLAN.md +1 -1
  31. package/src/templates/workflow/PLAN-COMPACT.md +42 -0
  32. package/src/templates/workflow/PLAN.md +58 -34
  33. package/src/templates/workflow/REVIEW-FINDINGS.md +7 -16
  34. package/src/templates/workflow/REVIEW-SUMMARY.md +5 -0
  35. package/src/templates/workflow/STATE.json +32 -3
  36. package/src/agents/component-executor.md +0 -57
  37. package/src/commands/5/implement-feature.md +0 -381
  38. package/src/commands/5/plan-feature.md +0 -248
  39. package/src/commands/5/plan-implementation.md +0 -333
  40. package/src/commands/5/quick-implement.md +0 -375
  41. package/src/commands/5/review-code.md +0 -213
  42. package/src/commands/5/verify-implementation.md +0 -277
  43. package/src/templates/workflow/FEATURE-SPEC.md +0 -100
  44. package/src/templates/workflow/VERIFICATION-REPORT.md +0 -103
@@ -1,277 +0,0 @@
1
- ---
2
- name: 5:verify-implementation
3
- description: Verifies a feature implementation is complete and working with multi-layer checks. Phase 4 of the 5-phase workflow.
4
- allowed-tools: Read, Glob, Grep, Bash, Write, Agent, AskUserQuestion
5
- user-invocable: true
6
- model: sonnet
7
- context: fork
8
- ---
9
-
10
- <role>
11
- You are an Implementation Verifier. You check that code meets requirements across 3 layers.
12
- You read artifacts, run build/tests, cross-reference specs, and generate a verification report.
13
- You do NOT implement new features. You do NOT refactor code beyond fixing identified verification gaps.
14
- After the verification report and optional fix application, you are DONE.
15
- </role>
16
-
17
- # Verify Implementation (Phase 4)
18
-
19
- Verify that an implementation is complete, correct, and meets feature requirements through multi-layer verification.
20
-
21
- ## Scope
22
-
23
- **This command verifies the implementation across three layers:**
24
- 1. Infrastructure — files exist, build passes, tests pass
25
- 2. Feature completeness — code satisfies acceptance criteria and requirements from the feature spec
26
- 3. Quality — new files have corresponding tests
27
-
28
- If verification finds gaps, it generates a fix plan and offers to apply fixes automatically.
29
-
30
- ## Process
31
-
32
- ### Step 1: Load All Artifacts
33
-
34
- Read all workflow artifacts for the feature:
35
-
36
- **Required:**
37
- - `.5/features/{feature-name}/plan.md` — implementation plan (Phase 2)
38
- - `.5/features/{feature-name}/state.json` — implementation state (Phase 3)
39
-
40
- **Optional:**
41
- - `.5/features/{feature-name}/feature.md` — feature spec (Phase 1)
42
-
43
- **If `plan.md` or `state.json` is missing:** hard stop.
44
- ```
45
- Cannot verify — missing required artifacts.
46
-
47
- Missing: {plan.md | state.json | both}
48
-
49
- Run these first:
50
- - /5:plan-implementation {feature-name} (creates plan.md)
51
- - /5:implement-feature {feature-name} (creates state.json)
52
- ```
53
-
54
- **If `feature.md` is missing:** warn and continue. Feature completeness verification (Layer 2) will be skipped.
55
- ```
56
- Note: feature.md not found — skipping feature completeness checks.
57
- This is normal for quick-implement workflows. Infrastructure and quality checks will still run.
58
- ```
59
-
60
- Also read `.5/config.json` and extract:
61
- - `git.autoCommit` (boolean, default `false`)
62
- - `git.commitMessage.pattern` (string, default `{ticket-id} {short-description}`)
63
-
64
- Extract from artifacts:
65
- - Components table from `plan.md` (step, component, action, file, description, complexity)
66
- - Build and test commands from `plan.md`
67
- - Completed/failed components from `state.json`
68
- - Acceptance criteria and functional requirements from `feature.md` (if present)
69
- - Number of commits created from `state.json` `commitResults` (if auto-commit was used)
70
-
71
- ### Step 2: Infrastructure Verification (Layer 1)
72
-
73
- #### 2a. Check Files Exist
74
-
75
- For each component in the plan:
76
- - Use Glob to verify the file exists
77
- - Record: EXISTS / MISSING
78
-
79
- #### 2b. Run Build
80
-
81
- Execute the build command from the plan (or auto-detect from `.5/config.json`):
82
-
83
- ```bash
84
- {build-command}
85
- ```
86
-
87
- Record: SUCCESS / FAILED with errors.
88
-
89
- **If build fails, stop here.** Broken code cannot be meaningfully verified for completeness. Set overall status to FAILED and skip to Step 6.
90
-
91
- #### 2c. Run Tests
92
-
93
- Execute the test command from the plan (or auto-detect):
94
-
95
- ```bash
96
- {test-command}
97
- ```
98
-
99
- Record: SUCCESS / FAILED with details (which tests failed, error messages).
100
-
101
- ### Step 3: Feature Completeness Verification (Layer 2)
102
-
103
- **Skip this step entirely if `feature.md` was not found in Step 1.**
104
-
105
- Spawn a sonnet agent to cross-reference the implementation against the feature spec:
106
-
107
- ```
108
- Agent tool call:
109
- subagent_type: general-purpose
110
- model: sonnet
111
- description: "Verify feature completeness for {feature-name}"
112
- prompt: |
113
- Verify that an implementation satisfies its feature specification.
114
-
115
- ## Feature Specification
116
- {full text of feature.md}
117
-
118
- ## Implementation Plan
119
- {full text of plan.md}
120
-
121
- ## Instructions
122
- 1. Read each file in the components table
123
- 2. For each acceptance criterion: SATISFIED (cite file:line) or NOT_SATISFIED
124
- 3. For each requirement: IMPLEMENTED (cite file:line) or NOT_IMPLEMENTED
125
- 4. For each component: COMPLETE, PARTIAL (note what's missing), or MISSING
126
-
127
- ## Output Format
128
- End with a results block:
129
-
130
- ---VERIFICATION---
131
- ---ACCEPTANCE_CRITERIA---
132
- {SATISFIED | NOT_SATISFIED | criterion text | file:line or "none"} (one per line)
133
- ---REQUIREMENTS---
134
- {IMPLEMENTED | NOT_IMPLEMENTED | requirement text | file:line or "none"} (one per line)
135
- ---COMPONENTS---
136
- {COMPLETE | PARTIAL | MISSING | component name | file path | notes} (one per line)
137
- ---SUMMARY---
138
- criteria_satisfied: {N}/{M}
139
- requirements_implemented: {N}/{M}
140
- components_complete: {N}/{M}
141
- ---END_VERIFICATION---
142
-
143
- Rules: Read every file. Cite file:line evidence. Do NOT modify files or interact with user.
144
- ```
145
-
146
- Parse the `---VERIFICATION---` ... `---END_VERIFICATION---` block. If malformed, fall back to extracting summary counts from prose.
147
-
148
- From the parsed output, collect:
149
- - Acceptance criteria results (satisfied/not satisfied counts)
150
- - Requirements results (implemented/not implemented counts)
151
- - Component completeness results (complete/partial/missing counts)
152
-
153
- ### Step 4: Quality Checks (Layer 3)
154
-
155
- For each component with action `create` in the plan:
156
- - Determine the expected test file path using common patterns:
157
- - `src/foo/Bar.ts` → look for `src/foo/Bar.test.ts`, `src/foo/Bar.spec.ts`, `test/foo/Bar.test.ts`, `tests/foo/Bar.test.ts`
158
- - `src/foo/bar.py` → look for `tests/foo/test_bar.py`, `tests/test_bar.py`, `src/foo/test_bar.py`
159
- - Adapt pattern based on project conventions
160
- - Use Glob to check if a test file exists
161
- - Record: HAS TEST / NO TEST
162
-
163
- This is a lightweight check — it only verifies test files exist for new code, not test quality.
164
-
165
- **Test requirement enforcement:**
166
- - Components with logic (services, controllers, repositories, hooks, utilities, helpers) without tests → MISSING_REQUIRED_TEST (error-level)
167
- - Declarative components (types, interfaces, models without logic) without tests → MISSING_OPTIONAL_TEST (info-level, not counted as issues)
168
-
169
- If no test framework detected (no test runner in config, no existing test files found via Glob for `**/*.test.*`, `**/*.spec.*`, `**/test_*.*`), downgrade all MISSING_REQUIRED_TEST to warnings with note: "No test framework detected."
170
-
171
- ### Step 5: Determine Status
172
-
173
- Evaluate all three layers:
174
-
175
- **PASSED** — all conditions met:
176
- - All files exist
177
- - Build succeeds
178
- - Tests pass
179
- - All acceptance criteria satisfied (or Layer 2 skipped)
180
- - All requirements implemented (or Layer 2 skipped)
181
- - All components complete
182
-
183
- **PARTIAL** — infrastructure OK but gaps exist:
184
- - All files exist AND build succeeds AND tests pass
185
- - BUT: some acceptance criteria not satisfied, OR some requirements not implemented, OR some components partial, OR logic-bearing components lack tests but project has no test framework
186
-
187
- **FAILED** — infrastructure problems:
188
- - Any files missing, OR build fails, OR tests fail
189
- - Any logic-bearing components lack test files (MISSING_REQUIRED_TEST) AND project has a test framework
190
-
191
- ### Step 6: Generate Verification Report
192
-
193
- Write `.5/features/{feature-name}/verification.md` using the template structure from `.claude/templates/workflow/VERIFICATION-REPORT.md`.
194
-
195
- The report covers:
196
- - **Header:** ticket, feature, status, timestamp
197
- - **Layer 1 — Infrastructure:** file existence checklist, build result, test result
198
- - **Layer 2 — Feature Completeness:** acceptance criteria status, requirements status, component completeness (or "Skipped — no feature.md" if not available)
199
- - **Layer 3 — Quality:** test coverage for new files
200
- - **Summary table:** layer-by-layer pass/fail overview
201
-
202
- ### Step 7: Update State
203
-
204
- Update `.5/features/{feature-name}/state.json`:
205
- ```json
206
- {
207
- "verificationStatus": "passed | partial | failed",
208
- "verifiedAt": "{ISO-timestamp}",
209
- "verificationLayers": {
210
- "infrastructure": "passed | failed",
211
- "featureCompleteness": "passed | partial | skipped",
212
- "quality": "passed | partial"
213
- }
214
- }
215
- ```
216
-
217
- ### Step 8: Handle Results
218
-
219
- Report the status with layer-by-layer summary and link to `verification.md`.
220
-
221
- - **PASSED:** If `git.autoCommit: false`, offer to commit via AskUserQuestion. If `git.autoCommit: true`, note commits were already made. Go to Step 11.
222
- - **PARTIAL or FAILED:** Note issue count, continue to Step 9.
223
-
224
- ### Step 9: Generate Fix Plan (PARTIAL or FAILED only)
225
-
226
- Write `.5/features/{feature-name}/fix-plan.md` using the template structure from `.claude/templates/workflow/FIX-PLAN.md`.
227
-
228
- Build fix entries from verification results:
229
-
230
- **From Layer 1 (Infrastructure):**
231
- - Missing files → fix: create the file (reference the plan component)
232
- - Build failures → fix: describe the build error and likely cause
233
- - Test failures → fix: describe failing test and likely cause
234
-
235
- **From Layer 2 (Feature Completeness):**
236
- - Unsatisfied acceptance criteria → fix: describe what code needs to change
237
- - Unimplemented requirements → fix: describe what needs to be added
238
- - Partial components → fix: describe what's missing from the component
239
-
240
- **From Layer 3 (Quality):**
241
- - Missing required test files (logic-bearing components) → fix: create test file for the component (priority: high)
242
- - Missing optional test files (declarative components) → note in report, no fix entry
243
-
244
- Each fix entry follows the same table format as `plan.md`:
245
-
246
- | # | Category | File | Issue | Fix | Complexity |
247
- |---|----------|------|-------|-----|------------|
248
- | 1 | infrastructure | src/models/Foo.ts | File missing | Create file per plan component #3 | simple |
249
- | 2 | feature-gap | src/services/Bar.ts | Missing validation for criterion "..." | Add input validation in processOrder() | moderate |
250
- | 3 | quality | tests/services/Bar.test.ts | No test file for BarService | Create test file with basic CRUD tests | simple |
251
-
252
- ### Step 10: Offer Fix Options
253
-
254
- Use AskUserQuestion:
255
- 1. "Apply fixes automatically (Recommended)" — spawn agents to apply each fix
256
- 2. "I'll fix manually, then re-run /5:verify-implementation"
257
-
258
- **If user selects "Apply fixes automatically":**
259
-
260
- Spawn agents following `implement-feature` patterns (simple→haiku, moderate→haiku/sonnet, complex→sonnet). Group independent fixes for parallel execution; same-file fixes must be sequential.
261
-
262
- Each agent prompt includes: category, file path, issue description, fix description, and relevant context from plan/feature spec. Agent finds similar files via Glob, reads patterns, applies fix with Write/Edit.
263
-
264
- After fixes: re-run build and tests. If `git.autoCommit: true` and fixes succeeded, commit fix files with `{ticket-id} fix verification issues`. Update `fix-plan.md` with APPLIED/FAILED status per fix.
265
-
266
- **If user selects manual fix:** save `fix-plan.md` and exit with re-run guidance.
267
-
268
- **Iteration limit:** On 3rd+ verify+fix cycle, warn user to consider manual fixes or revisiting the plan.
269
-
270
- ### Step 11: Next Steps
271
-
272
- Tell user:
273
- ```
274
- Next steps:
275
- 1. Run `/clear` to reset context (recommended between phases)
276
- 2. Run `/5:review-code`
277
- ```
@@ -1,100 +0,0 @@
1
- <!-- TEMPLATE RULES:
2
- - Write naturally
3
- - Reference existing classes, modules, and patterns by name for precision
4
- - Entity definitions include field names and domain types
5
- - Acceptance criteria describe observable behavior
6
- - No code blocks, no pseudo-code, no class hierarchy designs
7
- - Delete any OPTIONAL section that doesn't add value for this feature
8
- -->
9
-
10
- # Feature: {TICKET-ID} - {Title}
11
-
12
- **Ticket:** {TICKET-ID}
13
-
14
- ## Overview
15
-
16
- {What is the problem or gap, and what capability is being added? Write this as a short narrative
17
- that covers who is affected, why the change matters, and what the end result looks like.}
18
-
19
- <!-- OPTIONAL: Include mermaid diagrams only when they add clarity.
20
- Delete this section for simple features. Use whichever diagram type fits. -->
21
-
22
- ```mermaid
23
- flowchart TD
24
- A[Current state] --> B[Change]
25
- B --> C[New capability]
26
- ```
27
-
28
- ## What Changes
29
-
30
- {Describe what the feature does in natural, flowing prose. Name existing classes, modules, and patterns
31
- where relevant. Group by logical concern, not by module layer. Each subsection should tell the reader
32
- what happens and which parts of the codebase are involved.}
33
-
34
- ### {Logical concern 1, e.g., "New data model"}
35
-
36
- {Describe the change. Name affected modules and classes. If a new entity is introduced, describe its
37
- fields and types in a table:}
38
-
39
- | Field | Type | Required | Description |
40
- |-------|------|----------|-------------|
41
- | ... | ... | ... | ... |
42
-
43
- ### {Logical concern 2, e.g., "CRUD operations"}
44
-
45
- {Describe the behavior. Reference existing patterns to follow, e.g.,
46
- "Follow the same approach as the UserService update flow."}
47
-
48
- ### {Logical concern 3, e.g., "API exposure"}
49
-
50
- {Describe what gets exposed and how.}
51
-
52
- ### Business Rules
53
-
54
- - {Rule 1}
55
- - {Rule 2}
56
-
57
- ## Existing Patterns to Follow
58
-
59
- {List concrete patterns from the codebase that the implementation should mirror.
60
- These are high-value pointers for Phase 2 -- be specific.}
61
-
62
- - **{Pattern name}** -- {where it lives and what to reuse from it}
63
- - ...
64
-
65
- ## Constraints
66
-
67
- - {Business rules that limit the solution space}
68
- - {Technical boundaries from existing architecture}
69
-
70
- ## Scope
71
-
72
- **In scope:**
73
- - {What is included}
74
-
75
- **Out of scope:**
76
- - {What is explicitly excluded and why}
77
-
78
- ## Acceptance Criteria
79
-
80
- - [ ] {Observable behavior that proves a requirement is met}
81
- - [ ] ...
82
-
83
- ## Decisions
84
-
85
- <!-- Tag each: [DECIDED] = locked, [FLEXIBLE] = planner chooses, [DEFERRED] = not in this iteration -->
86
-
87
- - **{Topic}:** {What was decided and why} **[DECIDED]**
88
- - **{Topic}:** {General direction, planner chooses specifics} **[FLEXIBLE]**
89
- - **{Topic}:** {Not addressing now -- reason} **[DEFERRED]**
90
-
91
- <!-- OPTIONAL: Only include if alternatives were genuinely discussed and the reasoning matters -->
92
- ## Alternatives Considered
93
-
94
- - **{Alternative}:** Rejected because {reason}
95
- - **{Chosen approach}:** Selected because {reason}
96
-
97
- ## Next Steps
98
-
99
- 1. Run `/clear` to reset context (optional)
100
- 2. Run `/5:plan-implementation {TICKET-ID}-{description}`
@@ -1,103 +0,0 @@
1
- # Verification Report: {TICKET-ID}
2
-
3
- **Feature:** {feature-name}
4
- **Status:** PASSED | PARTIAL | FAILED
5
- **Verified:** {timestamp}
6
-
7
- ---
8
-
9
- ## Layer 1: Infrastructure
10
-
11
- ### Files
12
-
13
- - [x] {path} — exists
14
- - [ ] {path} — MISSING
15
-
16
- **Result:** {N}/{M} files exist
17
-
18
- ### Build
19
-
20
- **Command:** `{build-command}`
21
- **Status:** SUCCESS | FAILED
22
-
23
- {build errors if any}
24
-
25
- ### Tests
26
-
27
- **Command:** `{test-command}`
28
- **Status:** SUCCESS | FAILED
29
- **Total:** {N} | **Passed:** {N} | **Failed:** {N}
30
-
31
- {test failure details if any}
32
-
33
- **Layer 1 Result:** PASSED | FAILED
34
-
35
- ---
36
-
37
- ## Layer 2: Feature Completeness
38
-
39
- {If feature.md was not found: "Skipped — no feature.md available (normal for quick-implement workflows)"}
40
-
41
- ### Acceptance Criteria
42
-
43
- | # | Criterion | Status | Evidence |
44
- |---|-----------|--------|----------|
45
- | 1 | {criterion text} | SATISFIED | {file:line} |
46
- | 2 | {criterion text} | NOT SATISFIED | — |
47
-
48
- **Result:** {N}/{M} criteria satisfied
49
-
50
- ### Functional Requirements
51
-
52
- | # | Requirement | Status | Evidence |
53
- |---|-------------|--------|----------|
54
- | 1 | {requirement text} | IMPLEMENTED | {file:line} |
55
- | 2 | {requirement text} | NOT IMPLEMENTED | — |
56
-
57
- **Result:** {N}/{M} requirements implemented
58
-
59
- ### Component Completeness
60
-
61
- | Component | File | Status | Notes |
62
- |-----------|------|--------|-------|
63
- | {name} | {path} | COMPLETE | — |
64
- | {name} | {path} | PARTIAL | {what's missing} |
65
-
66
- **Result:** {N}/{M} components complete
67
-
68
- **Layer 2 Result:** PASSED | PARTIAL | SKIPPED
69
-
70
- ---
71
-
72
- ## Layer 3: Quality
73
-
74
- ### Test Coverage for New Files
75
-
76
- **Required Tests (logic-bearing components):**
77
-
78
- | New File | Test File | Status |
79
- |----------|-----------|--------|
80
- | {src/path/Service.ts} | {src/path/Service.test.ts} | HAS TEST |
81
- | {src/path/Controller.ts} | — | MISSING REQUIRED TEST |
82
-
83
- **Optional Tests (declarative components):**
84
-
85
- | New File | Test File | Status |
86
- |----------|-----------|--------|
87
- | {src/path/types.ts} | — | NO TEST (exempt) |
88
-
89
- **Result:** {N}/{M} required test files exist
90
-
91
- **Layer 3 Result:** PASSED | FAILED | PARTIAL
92
-
93
- ---
94
-
95
- ## Summary
96
-
97
- | Layer | Result | Details |
98
- |-------|--------|---------|
99
- | Infrastructure | PASSED / FAILED | {N}/{M} files, build {status}, tests {status} |
100
- | Feature Completeness | PASSED / PARTIAL / SKIPPED | {N}/{M} criteria, {N}/{M} requirements |
101
- | Quality | PASSED / PARTIAL | {N}/{M} new files have tests |
102
-
103
- **Overall:** PASSED | PARTIAL | FAILED