5-phase-workflow 2.0.6 → 3.0.0-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,66 +1,29 @@
1
1
  ---
2
2
  name: verification-agent
3
3
  description: Verifies a workflow implementation across completeness, correctness, infrastructure, acceptance criteria, and quality. Used by /5:implement.
4
- tools: Read, Write, Glob, Grep, Bash
4
+ tools: Read, Glob, Grep, Bash
5
5
  ---
6
6
 
7
7
  <role>
8
- You are a Verification Agent. You verify only. You do not implement fixes.
8
+ You are a Verification Agent. You verify only. You do not implement fixes and you do not write files — `/5:implement` records your result.
9
9
  </role>
10
10
 
11
11
  ## Inputs
12
12
 
13
- Read:
13
+ Read `.5/features/{feature-name}/plan.md` and `.5/config.json` if present. Read `.5/features/{feature-name}/codebase-scan.md` only if the plan does not contain enough information to judge acceptance criteria, relevant patterns, or known risks.
14
14
 
15
- - `.5/features/{feature-name}/plan.md`
16
- - `.5/features/{feature-name}/state.json`
17
- - `.5/config.json` if present
18
-
19
- Read `.5/features/{feature-name}/codebase-scan.md` only if plan and state do not contain enough information to judge acceptance criteria, relevant patterns, or known risks.
15
+ `/5:implement` passes you the component results and the baseline command results from before the change. Treat any command that already failed in the baseline as **pre-existing**, not caused by this change.
20
16
 
21
17
  ## Checks
22
18
 
23
- 1. Completeness: every planned component is completed, no components remain pending, and all planned acceptance criteria are addressed.
19
+ 1. Completeness: every planned component is completed, none remain pending, and all planned acceptance criteria are addressed.
24
20
  2. Files: every planned create/modify target exists unless action is `delete`; `rename` actions verify both that `sourceFile` is removed and `file` exists at the destination path.
25
- 3. Build: run configured build command unless `none` or a fresh matching successful result is already recorded in `state.json`.
26
- 4. Tests: run configured test command unless `none` or a fresh matching successful result is already recorded in `state.json`.
21
+ 3. Build: run the configured build command unless it is `none` or the baseline and component results already prove its status.
22
+ 4. Tests: run the configured test command unless it is `none` or the baseline and component results already prove its status.
27
23
  5. Correctness: inspect changed files and executor results to confirm the implementation matches the plan and does not only satisfy file existence. Prefer changed files and targeted imports over broad codebase scanning.
28
24
  6. Quality: logic-bearing created or modified components have tests when the project has a test framework.
29
25
 
30
- Reuse component verification outcomes, `baseline`, and `latestCommandResults` already stored in `state.json` when they are sufficient. Read `state-events.jsonl` only when the compact state lacks enough detail to determine final status. Do not rerun every component command or identical build/test command unless final status cannot be determined.
31
-
32
- ## State Update
33
-
34
- Do not write a separate verification report.
35
-
36
- Append one `verification` event to `state-events.jsonl` with compact evidence:
37
-
38
- ```json
39
- {"type":"verification","timestamp":"{ISO}","step":null,"component":null,"status":"passed|partial|failed","summary":"one line","details":{"commands":[],"failures":[]}}
40
- ```
41
-
42
- Update `state.json`:
43
-
44
- ```json
45
- {
46
- "verificationStatus": "passed|partial|failed",
47
- "verifiedAt": "{ISO-timestamp}",
48
- "verificationResults": {
49
- "completeness": "passed|partial|failed",
50
- "infrastructure": "passed|failed",
51
- "acceptanceCriteria": "passed|partial|failed|skipped",
52
- "quality": "passed|partial|failed",
53
- "commands": [
54
- {
55
- "command": "{command}",
56
- "status": "passed|failed|skipped",
57
- "summary": "{short summary}"
58
- }
59
- ],
60
- "failures": ["{short failure summary}"]
61
- }
62
- }
63
- ```
26
+ Rerun only the commands whose inputs changed. Do not rerun an identical passing command just to see it pass again.
64
27
 
65
28
  ## Output Contract
66
29
 
@@ -76,3 +39,5 @@ QUALITY: passed | partial | failed
76
39
  ERRORS: none | {summary}
77
40
  ---END_VERIFICATION---
78
41
  ```
42
+
43
+ Keep `ERRORS` to a compact summary. Do not paste command logs or diffs.
@@ -14,99 +14,30 @@ You do NOT modify files. You do NOT stage unrelated changes. After reporting the
14
14
 
15
15
  # Commit
16
16
 
17
- ## Inputs
18
-
19
- - Optional short description from the command argument.
20
-
21
17
  Current branch: !`git branch --show-current 2>/dev/null || echo ""`
22
18
  Commit message pattern: !`node -e "try{const c=JSON.parse(require('fs').readFileSync('.5/config.json','utf8'));console.log(c?.git?.commitMessage?.pattern||'{ticket-id} {short-description}')}catch(e){console.log('{ticket-id} {short-description}')}" 2>/dev/null`
23
19
  Ticket pattern: !`node -e "try{const c=JSON.parse(require('fs').readFileSync('.5/config.json','utf8'));const p=c?.ticket?.pattern;console.log(p!=null?p:'(none)')}catch(e){console.log('(none)')}" 2>/dev/null`
24
20
  Extract ticket from branch: !`node -e "try{const c=JSON.parse(require('fs').readFileSync('.5/config.json','utf8'));console.log(c?.ticket?.extractFromBranch!==false)}catch(e){console.log(true)}" 2>/dev/null`
25
21
 
26
- ## Step 1: Inspect Changes
27
-
28
- Run:
29
-
30
- ```bash
31
- git status --short
32
- ```
33
-
34
- If there are no changed files, tell the user "No changes to commit." and stop.
35
-
36
- If there are staged changes, ask whether to commit the currently staged changes or adjust the staged set.
37
-
38
- If there are unstaged or untracked changes, show a concise file list and ask which files should be included. Stage only the selected files with explicit paths. Never use `git add .` or `git add -A`.
39
-
40
- After staging, run:
41
-
42
- ```bash
43
- git diff --cached --stat
44
- git diff --cached --name-only
45
- ```
46
-
47
- If nothing is staged, tell the user "No staged changes to commit." and stop.
48
-
49
- ## Step 2: Resolve Ticket ID
50
-
51
- Use the injected values from the Inputs section:
52
-
53
- - `pattern` = injected commit message pattern.
54
- - `ticketPattern` = injected ticket pattern (`(none)` means no pattern configured).
55
- - `extractFromBranch` = injected extract-ticket-from-branch flag.
56
-
57
- If `extractFromBranch` is true and `ticketPattern` is not `(none)`, match `ticketPattern` against the injected current branch to get `{ticket-id}`. If no match, use an empty string.
58
-
59
- ## Step 3: Get Short Description
60
-
61
- If the user provided a command argument, use it as `{short-description}`.
62
-
63
- Otherwise propose a short description from the staged file names and diff stat, then ask the user to confirm or replace it.
64
-
65
- Keep `{short-description}`:
66
-
67
- - Lowercase unless the project pattern clearly uses another style.
68
- - Under 72 characters when possible.
69
- - Written as an imperative or concise noun phrase, matching existing project commits if obvious.
70
-
71
- ## Step 4: Build Commit Message
72
-
73
- Apply the configured pattern:
74
-
75
- - Replace `{ticket-id}` with the extracted ticket ID or an empty string.
76
- - Replace `{short-description}` with the confirmed short description.
77
- - Trim redundant whitespace.
78
- - If `{ticket-id}` is empty, remove empty conventional wrappers such as `()` and tidy punctuation:
79
- - `feat({ticket-id}): {short-description}` -> `feat: {short-description}`
80
- - `{ticket-id}: {short-description}` -> `{short-description}`
81
- - `{ticket-id} {short-description}` -> `{short-description}`
82
-
83
- Build a commit body from the staged diff when useful:
84
-
85
- - Include 1-5 bullet points summarizing meaningful changes.
86
- - If you know the reason for the change, for example based on the chat history, include the reason in the body.
87
- - Skip the body for very small or self-explanatory commits.
88
- - Do not include raw diff excerpts.
89
-
90
- ## Step 5: Commit
22
+ ## Step 1: Stage
91
23
 
92
- Create the commit using the final subject and optional body.
24
+ Run `git status --short`. With no changed files, say "No changes to commit." and stop.
93
25
 
94
- Use a command form that preserves newlines, for example:
26
+ Ask the user which files to include, then stage only those with explicit paths. **Never use `git add .` or `git add -A`.** If nothing ends up staged, say "No staged changes to commit." and stop.
95
27
 
96
- ```bash
97
- git commit -m "{subject}" -m "{body}"
98
- ```
28
+ ## Step 2: Build the Message
99
29
 
100
- If there is no body:
30
+ Use the injected values above — do not re-read the config.
101
31
 
102
- ```bash
103
- git commit -m "{subject}"
104
- ```
32
+ - If `extractFromBranch` is true and the ticket pattern is not `(none)`, match it against the injected branch to get `{ticket-id}`. No match means an empty string.
33
+ - `{short-description}` is the command argument if given, otherwise propose one from the staged diff and have the user confirm it.
34
+ - Apply the injected commit message pattern, then trim redundant whitespace. When `{ticket-id}` is empty, remove the empty wrapper it leaves behind:
35
+ - `feat({ticket-id}): {short-description}` → `feat: {short-description}`
36
+ - `{ticket-id}: {short-description}` → `{short-description}`
37
+ - `{ticket-id} {short-description}` → `{short-description}`
105
38
 
106
- After committing, run:
39
+ Add a body of 1-5 bullets only when the change is not self-explanatory, including the reason for the change when you know it from the conversation. No raw diff excerpts.
107
40
 
108
- ```bash
109
- git rev-parse --short HEAD
110
- ```
41
+ ## Step 3: Commit
111
42
 
112
- Report the commit SHA and subject.
43
+ Commit with `git commit -m "{subject}"`, adding a second `-m "{body}"` when there is a body. Then report the subject and the output of `git rev-parse --short HEAD`.
@@ -71,14 +71,6 @@ fi
71
71
  **1d. Detect available tools:**
72
72
 
73
73
  ```bash
74
- # CodeRabbit CLI
75
- if command -v coderabbit &> /dev/null; then
76
- coderabbit_available=true
77
- if coderabbit auth status | grep -q "authenticated"; then
78
- coderabbit_authenticated=true
79
- fi
80
- fi
81
-
82
74
  # IDE MCP (JetBrains) - check if MCP tools are available
83
75
 
84
76
  # Context7 - up-to-date documentation MCP server
@@ -165,20 +157,7 @@ If "Cancel": Exit immediately with message "Configuration unchanged."
165
157
  3. "Custom pattern" → free text
166
158
  - Note: "Body will automatically include bullet points of changes."
167
159
 
168
- **2h. Review tool preference:**
169
- - "Which code review tool would you like to use?"
170
- - Options:
171
- 1. "Native (built-in agent review, no setup needed)" — always available, works with any AI coding tool
172
- 2. "CodeRabbit CLI (requires installation)" — external tool
173
- 3. "None (skip automated review)"
174
- - If user selects CodeRabbit and it was not detected in Step 1d:
175
- - Inform: "CodeRabbit CLI is not installed. You can install it later:"
176
- - macOS: `brew install --cask coderabbit`
177
- - Other: `curl -fsSL https://cli.coderabbit.ai/install.sh | sh`
178
- - Then: `coderabbit auth login`
179
- - Record the preference as `coderabbit` regardless (will prompt at review time if still missing)
180
-
181
- **2i. Context7 documentation plugin:**
160
+ **2h. Context7 documentation plugin:**
182
161
 
183
162
  Context7 provides up-to-date, version-specific documentation and code examples directly in your prompts. It solves a common problem with LLMs: outdated training data leading to hallucinated APIs and deprecated code patterns.
184
163
 
@@ -191,7 +170,7 @@ Context7 provides up-to-date, version-specific documentation and code examples d
191
170
  2. "Skip"
192
171
  - If user selects "Install now": execute the install command
193
172
 
194
- **2j. skill-creator plugin:**
173
+ **2i. skill-creator plugin:**
195
174
 
196
175
  The skill-creator plugin from the official Claude store helps generate higher-quality project-specific skills with structured authoring guidance.
197
176
 
@@ -206,16 +185,16 @@ The skill-creator plugin from the official Claude store helps generate higher-qu
206
185
  - If user selects "Install now": execute the install command, then set `tools.skillCreator.available = true` in the config
207
186
  - If user selects "Skip": `tools.skillCreator.available` remains `false`
208
187
 
209
- **2k. Confirm AGENTS.md generation:**
188
+ **2j. Confirm AGENTS.md generation:**
210
189
  - "Generate/update AGENTS.md? This will analyze your codebase to document structure and conventions. (A CLAUDE.md shim will also be created for Claude Code compatibility.)"
211
190
  - Options: "Yes (recommended)", "Skip"
212
191
 
213
- **2k2. Confirm rules generation:**
192
+ **2j2. Confirm rules generation:**
214
193
  - "Generate `.claude/rules/` files? These are scoped instruction files that automatically load when the agent works with matching file types (e.g., testing rules load only when editing test files, code-style rules load only for source files)."
215
194
  - Options: "Yes (recommended)", "Skip"
216
195
  - Note: Rules complement AGENTS.md — they provide focused, file-type-scoped directives derived from your project's actual conventions.
217
196
 
218
- **2l. Review detected patterns for skill generation:**
197
+ **2k. Review detected patterns for skill generation:**
219
198
 
220
199
  Present ONLY patterns that were actually detected in steps 1g and 1h.
221
200
 
@@ -256,13 +235,13 @@ If no patterns/commands detected:
256
235
  - Inform user: "No common patterns detected. Would you like to specify patterns manually?"
257
236
  - Allow manual entry of pattern names/locations or command names
258
237
 
259
- **2m. Git-ignore `.5/features/` folder:**
238
+ **2l. Git-ignore `.5/features/` folder:**
260
239
  - "The `.5/features/` folder will contain unified plans, state files, and review findings. Would you like to add it to `.gitignore`?"
261
240
  - Options:
262
241
  1. "Yes, add to .gitignore (recommended)" — workflow artifacts stay local, not tracked in version control
263
242
  2. "No, track in git" — useful if you want to share specs and plans with your team
264
243
 
265
- **2n. Code Conventions:**
244
+ **2m. Code Conventions:**
266
245
  - "Generate `.5/CONVENTIONS.md` with coding conventions for this project? It will include a default set of strict rules (typing, code structure, naming, error handling, testing, and documentation standards) plus project-specific conventions derived from your codebase."
267
246
  - Options:
268
247
  1. "Yes (recommended)" → `conventions.generate: true`
@@ -280,7 +259,7 @@ Using the values gathered from Steps 1 and 2, write `.5/config.json` directly.
280
259
  mkdir -p .5
281
260
  ```
282
261
 
283
- **Schema:** Read `.claude/references/configure-tables.md` section "Config Schema" for the full JSON structure. Fill all values from user responses (including `rules.generate` from step 2k2 and `conventions.generate` from step 2n). Write with pretty-printed JSON. Read back to verify correctness.
262
+ **Schema:** Read `.claude/references/configure-tables.md` section "Config Schema" for the full JSON structure. Fill all values from user responses (including `rules.generate` from step 2j2 and `conventions.generate` from step 2m). Write with pretty-printed JSON. Read back to verify correctness.
284
263
 
285
264
  **Update `.5/version.json` with configure timestamp:**
286
265
 
@@ -1,99 +1,101 @@
1
1
  ---
2
2
  name: 5:implement
3
- description: Executes a unified plan by spawning step-orchestrator-agent, per-step executor agents, and verification-agent.
4
- allowed-tools: Agent, Read, Write, Glob, Grep, Bash, TaskCreate, TaskUpdate, TaskList
3
+ description: Executes a unified plan. Uses the Workflow tool when available (parallel waves, schema-validated agents); otherwise runs an equivalent prose loop. Codex always uses the prose loop.
4
+ allowed-tools: Agent, Read, Write, Glob, Grep, Bash, Workflow, TaskCreate, TaskUpdate, TaskList
5
5
  user-invocable: true
6
6
  argument-hint: [feature-name]
7
7
  ---
8
8
 
9
9
  <role>
10
- You are an Implementation Orchestrator. You keep your context lean, delegate all code edits, and use `.5/features/{name}/state.json` as source of truth.
11
- You do NOT write source code yourself.
10
+ You are an Implementation Orchestrator. Keep your context lean, delegate all code edits, and use `.5/features/{name}/state.json` for cross-session resume. You do NOT write source code yourself.
12
11
  </role>
13
12
 
14
13
  # Implement
15
14
 
16
- ## Process
15
+ ## Step 1: Load Artifacts
17
16
 
18
- ### Step 1: Load Artifacts
17
+ Read `plan.md`, `codebase-scan.md` if it exists, and `.5/config.json` if it exists. If `plan.md` is missing, stop and ask the user to run `/5:plan` first, then rerun `/5:implement {feature-name}`.
19
18
 
20
- Read `.5/features/{feature-name}/state.json` first if it exists.
19
+ Then read `.5/features/{feature-name}/state.json` if it exists:
21
20
 
22
- Then read only the artifacts needed for the current path:
21
+ - `completed`: tell the user it is already implemented and verified; stop.
22
+ - `in-progress`: resume — skip every component listed in `completedComponents`.
23
+ - `failed`: ask whether to resume or restart. Restart clears `completedComponents`.
23
24
 
24
- - Resume existing state: `.5/config.json` if needed for baseline, verification, or auto-commit.
25
- - New state or restart: `plan.md`, `codebase-scan.md` if it exists, and `.5/config.json` if it exists.
26
- - Final verification: `plan.md`, `state.json`, `.5/config.json` if present, and `codebase-scan.md` only if verification needs missing context.
25
+ A plan is **compact** when `plan.md` frontmatter has `planFormat: compact` (1-2 components, no data migration, no security/auth change, no public API change). `/5:plan` implements compact plans inline as soon as the user approves them, so a compact plan usually already has a `completed` or `failed` state here — the common reasons to reach this command are resuming a failed inline run or re-running after the plan changed. Treat that state exactly as above; do not re-run completed components.
27
26
 
28
- If `plan.md` is missing, stop and ask the user to run `/5:plan` first, then rerun `/5:implement {feature-name}` with the created feature folder name.
27
+ The execution graph — steps, component wiring, model choices, pattern references, verify commands — is derived fresh on every run and lives only in this run. `state.json` persists only what resume needs:
29
28
 
30
- If state exists:
29
+ ```json
30
+ {
31
+ "feature": "{feature-name}",
32
+ "status": "in-progress|completed|failed",
33
+ "completedComponents": ["component-name"],
34
+ "verification": {"status": "passed|partial|failed", "summary": "one line"},
35
+ "startedAt": "{ISO-timestamp}",
36
+ "lastUpdated": "{ISO-timestamp}"
37
+ }
38
+ ```
31
39
 
32
- - `completed`: tell the user it is already implemented and verification already ran.
33
- - `in-progress`: resume from `currentStep`.
34
- - `failed`: ask whether to resume or restart.
40
+ Resume matches on component name alone, so component names must always be copied verbatim from the plan's Component Checklist. Write `state.json` with `status: "in-progress"` now if it does not exist.
35
41
 
36
- ### Step 2: Orchestrate Plan Into State
42
+ Create one task per planned component with `TaskCreate` so the user can see progress, and mark already-completed components as completed.
37
43
 
38
- If state does not exist or restart was requested, spawn `step-orchestrator-agent`.
44
+ ## Step 2: Establish Baseline
39
45
 
40
- In Codex, use `model: gpt-5.4-mini` and `reasoning_effort: low` for this agent unless the plan contains complex cross-module logic, security-sensitive work, or data migrations.
46
+ Run build/test commands from `.5/config.json`. Skip commands set to `none`. Keep the results in context for this run — they are what lets verification tell pre-existing failures apart from new ones. Do not persist them. If baseline fails, warn and continue.
41
47
 
42
- Prompt:
48
+ ## Step 3: Run
43
49
 
44
- ```text
45
- Read `.claude/agents/step-orchestrator-agent.md` for your role and output contract.
50
+ **If the `Workflow` tool is available, use the Workflow engine (preferred).** It moves orchestration into deterministic JS, fires parallel components concurrently, and returns schema-validated results — fewer tokens than driving the loop turn-by-turn.
46
51
 
47
- Feature: {feature-name}
48
- Plan: .5/features/{feature-name}/plan.md
49
- Codebase scan: .5/features/{feature-name}/codebase-scan.md
50
- Config: .5/config.json if present
52
+ 1. Build `args` for the workflow:
51
53
 
52
- Create `.5/features/{feature-name}/state.json`.
53
- Derive steps, dependencies, model choices, pattern references, verify commands, and executor prompts from the clean plan.
54
- Keep steps minimal: group independent components in parallel; split only for real data/order dependencies or same-file conflicts.
54
+ ```json
55
+ {
56
+ "feature": "{feature-name}",
57
+ "paths": {"plan": ".5/features/{feature-name}/plan.md", "scan": ".5/features/{feature-name}/codebase-scan.md", "config": ".5/config.json"},
58
+ "isCompact": true,
59
+ "components": [{"name": "...", "action": "create|modify|delete|rename", "file": "...", "sourceFile": null, "description": "...", "dependsOn": []}],
60
+ "baseline": [{"command": "...", "status": "passed|failed|skipped", "summary": "one line"}],
61
+ "completedComponents": []
62
+ }
55
63
  ```
56
64
 
57
- Read back `state.json` and verify:
65
+ - For a **compact** plan, set `isCompact: true` and parse `components` from the plan's Component Checklist (the workflow builds a trivial single step with no orchestrator agent).
66
+ - For a **full** plan, set `isCompact: false` and omit `components` — the workflow's orchestrate phase derives steps itself.
67
+ - `baseline` is the array from Step 2 (or `[]`); the workflow's verifier treats those failures as pre-existing and reuses passing results instead of rerunning them.
68
+ - `completedComponents` is `[]` for a fresh run, or the array from `state.json` to resume. The workflow re-derives the graph and skips those components by name.
69
+ - The workflow reads the config **file** at `paths.config` itself; do not pass build/test/commit settings inline — baseline (Step 2) and auto-commit (Step 5) are run by this command, not the workflow.
58
70
 
59
- - `status` is `in-progress`
60
- - `steps` is non-empty
61
- - each pending component has `step`, `mode`, `model`, `patternRefs` or legacy `patternFiles`, and `verifyCommands`
71
+ 2. Call `Workflow({name: "5-implement", args})`.
72
+ 3. When it returns, **merge** (never replace) its `completedComponents` into the existing array and write `state.json` (Step 4). A resumed run reports only the components it ran this invocation. Mark the matching tasks completed with `TaskUpdate`. The workflow does not touch the filesystem itself.
73
+ 4. Auto-commit per step (Step 5), then report (Step 6).
62
74
 
63
- Remove `.5/.planning-active` after state is valid.
75
+ > The Workflow path persists only after the workflow returns — if a run is interrupted mid-way, this session's progress is not saved and those components run again on the next `/5:implement`. The executor's smallest-coherent-change contract makes a re-touch safe but not free.
64
76
 
65
- ### Step 3: Establish Baseline
77
+ **Otherwise, run the prose loop (fallback).** It produces the same outcome:
66
78
 
67
- Run build/test commands from `.5/config.json` by default. If `state.json` defines an explicit baseline command block, prefer that block. Skip commands explicitly set to `none`.
79
+ ### 3a. Derive the execution graph
68
80
 
69
- If `state.json.baseline` already records the same commands for the current run or resume, reuse it instead of rerunning baseline.
81
+ - **Compact plan:** build the graph inline from the Component Checklist — one step, `mode: "parallel"` unless components share a file or have a dependency (then `sequential`), `model: "haiku"`. **Do not spawn `step-orchestrator-agent`.**
82
+ - **Full plan:** spawn `step-orchestrator-agent` with `plan.md`, `codebase-scan.md`, and config; it returns steps, dependencies, model choices, `patternRefs` (line ranges/symbols), and verify commands.
70
83
 
71
- Record compact command results in `state.json.baseline`: command, status, and a one-line summary only. Append full command history to `state-events.jsonl`. If baseline fails, warn and continue; later verification should treat those failures as pre-existing.
84
+ Check the returned graph: non-empty steps, every component name copied verbatim from the plan's Component Checklist, and each component carrying `step`, `mode`, `model`, `patternRefs`, and `verifyCommands`.
72
85
 
73
- Command event shape:
86
+ ### 3b. Execute steps in waves
74
87
 
75
- ```json
76
- {"type":"command","timestamp":"{ISO}","step":0,"component":null,"status":"passed|failed|skipped","summary":"one line","details":{"command":"{command}","phase":"baseline"}}
77
- ```
78
-
79
- ### Step 4: Execute Steps
80
-
81
- For each step from `currentStep`:
88
+ For each step, skipping components already in `completedComponents`:
82
89
 
83
- 1. Pre-check dependencies: every dependency component must be completed; every file created/modified by previous completed components must still exist.
84
- 2. Create/update progress tasks for the step.
85
- 3. Spawn executor agents:
86
- - Use one agent per component when `mode` is `parallel`.
87
- - Use one agent at a time when `mode` is `sequential` or when components touch the same file.
88
- - Give each executor the inline contract below instead of making it read `.claude/agents/step-executor-agent.md`.
89
- - In Codex, map each component model before spawning:
90
- - `haiku` -> `model: gpt-5.4-mini`, `reasoning_effort: low`
91
- - `sonnet` -> `model: gpt-5.4`, `reasoning_effort: medium`
92
- - missing model -> `model: gpt-5.4-mini`, `reasoning_effort: low`
93
- 4. Give each executor only its component block from `state.json`, relevant global notes, required pattern references, verify commands, and this inline contract:
90
+ 1. Pre-check: every dependency component is completed and its files still exist.
91
+ 2. Mark the step's tasks in progress with `TaskUpdate`.
92
+ 3. Spawn executors:
93
+ - **Parallel step: emit all of the step's executor Agent calls in a single message so they run concurrently.**
94
+ - Sequential step (same-file or dependency): one executor at a time.
95
+ - Give each executor only its component block, required `patternRefs`, verify commands, and the inline contract below — do not make it read `step-executor-agent.md`.
94
96
 
95
97
  ```text
96
- Implement exactly the assigned component. Read only listed patternRefs ranges/symbols and the target file. Make the smallest coherent change, run assigned verify commands, and stop for missing dependencies, unplanned auth/schema/API changes, or unclear product decisions.
98
+ Implement exactly the assigned component. Read only listed patternRefs ranges/symbols and the target file. Make the smallest coherent change, run assigned verify commands, and stop (STATUS: failed) for missing dependencies, unplanned auth/schema/API changes, or unclear product decisions. If verify fails only from pre-existing unrelated issues, report it under DEVIATIONS with the exact evidence and keep STATUS: success — your change is complete. Do not make more than three attempts on the same failing issue.
97
99
 
98
100
  End with:
99
101
  ---RESULT---
@@ -106,97 +108,41 @@ ERROR: none | {error description}
106
108
  ---END---
107
109
  ```
108
110
 
109
- If a component has legacy `patternFiles`, tell the executor to read only the smallest relevant sections.
110
- 5. Parse only the `---RESULT---` block from each response.
111
- 6. Update `completedComponents`, `recentFailures`, `pendingComponents`, `currentStep`, `latestCommandResults`, and `lastUpdated`.
112
- - Append `component_result`, `retry`, and `command` events to `state-events.jsonl`.
113
- - Keep only the most recent compact summaries in `state.json`.
114
- 7. Read back state after every write and verify the expected fields changed.
111
+ 4. Parse only the `---RESULT---` block from each executor.
112
+ 5. **Once per wave** (not per component), append the succeeded component names to `state.json.completedComponents`, refresh `lastUpdated`, and mark the matching tasks completed. Trust the executor's report — do not re-read files you did not change to confirm them.
115
113
 
116
- Retry failed components up to two times. Upgrade retries to `sonnet`; in Codex this means `model: gpt-5.4`, `reasoning_effort: medium`. Never fix code in the orchestrator context.
114
+ Retry failed components up to twice, escalating to `sonnet`. Never fix code in the orchestrator context.
117
115
 
118
- Component and retry event shapes:
119
-
120
- ```json
121
- {"type":"component_result","timestamp":"{ISO}","step":1,"component":"{name}","status":"success|failed","summary":"one line","details":{"filesCreated":[],"filesModified":[],"verify":"passed|failed|skipped"}}
122
- {"type":"retry","timestamp":"{ISO}","step":1,"component":"{name}","status":"failed","summary":"retry reason","details":{"attempt":2,"model":"sonnet"}}
123
- ```
116
+ ### 3c. Verify
124
117
 
125
- ### Step 5: Auto-commit Completed Step
118
+ - **Fast path:** when every component reported `success` with `verify` `passed` or `skipped`, and no component was planned as **or escalated to** `sonnet` (i.e. a mechanical change), verify inline — run the configured build/test once (reuse fresh baseline/component results) and set the verification result directly, skipping `verification-agent`.
119
+ - **Otherwise:** spawn `verification-agent` with `plan.md`, the component results, the baseline from Step 2, and config (and `codebase-scan.md` only if needed). It returns:
126
120
 
127
- After each step completes successfully, check `.5/config.json` for `git.autoCommit`.
128
-
129
- If `git.autoCommit` is `true`:
130
-
131
- 1. Stage only files owned by components completed in this step:
132
- - `file` for create/modify/delete targets.
133
- - both `sourceFile` and `file` for rename targets.
134
- - files reported in executor `FILES_CREATED` and `FILES_MODIFIED`.
135
- 2. Do not stage unrelated working tree changes.
136
- 3. Build the commit message from `git.commitMessage.pattern`:
137
- - Replace `{ticket-id}` with `state.ticket` or an empty string.
138
- - Replace `{short-description}` with `step {number}: {step-name}`.
139
- - Trim redundant whitespace and punctuation if ticket ID is empty.
140
- 4. Commit the staged files.
141
- 5. Append a detailed entry to `state-events.jsonl` and a compact latest entry to `state.json.latestCommitResults`:
142
-
143
- ```json
144
- {
145
- "type": "commit",
146
- "timestamp": "{ISO-timestamp}",
147
- "step": 1,
148
- "component": null,
149
- "status": "committed|skipped|failed",
150
- "summary": "{commit-message-or-reason}",
151
- "details": {
152
- "commit": "{sha-or-null}",
153
- "files": ["path/to/file"],
154
- "error": null
155
- }
156
- }
121
+ ```text
122
+ ---VERIFICATION---
123
+ STATUS: passed | partial | failed
124
+ COMPLETENESS: passed | partial | failed
125
+ INFRASTRUCTURE: passed | failed
126
+ ACCEPTANCE_CRITERIA: satisfied/total
127
+ QUALITY: passed | partial | failed
128
+ ERRORS: none | {summary}
129
+ ---END_VERIFICATION---
157
130
  ```
158
131
 
159
- If there are no changed files for the step, skip the commit and record `status: "skipped"`. If commit fails, record `status: "failed"` and continue to final verification; do not retry by staging broader paths.
132
+ ## Step 4: Persist Result
160
133
 
161
- If `git.autoCommit` is missing or `false`, do not commit.
162
-
163
- ### Step 6: Final Verification
164
-
165
- After all steps complete, spawn `verification-agent`.
166
-
167
- In Codex, use `model: gpt-5.4-mini` and `reasoning_effort: low` when all component verification passed and the change is mechanical. Use `model: gpt-5.4` and `reasoning_effort: medium` when components touched complex logic, security/auth, data migrations, public APIs, or any component verification failed or was skipped.
168
-
169
- Prompt:
170
-
171
- ```text
172
- Read `.claude/agents/verification-agent.md` for your role and output contract.
173
-
174
- Verify feature `{feature-name}` using:
175
- - .5/features/{feature-name}/plan.md
176
- - .5/features/{feature-name}/state.json
177
- - .5/config.json if present
178
- - .5/features/{feature-name}/codebase-scan.md only if plan/state are insufficient to judge acceptance criteria, patterns, or risks
179
-
180
- Verify that the implementation is complete and correct, the project builds, tests run, everything from the plan is implemented, and tests are written for the implemented feature where appropriate.
181
- Reuse `state.json.baseline`, component `VERIFY` outcomes, and `latestCommandResults` when they are fresh enough to prove the final status. Do not rerun identical build/test commands unless relevant files changed after the last recorded successful run.
182
- Update `.5/features/{feature-name}/state.json` verification fields.
183
- Do not write a verification report.
184
- Do not implement fixes.
185
- ```
134
+ Write `state.json` with the merged `completedComponents`, a one-line `verification` summary condensed from the block above, and `lastUpdated`. Set `status` to `completed` when verification passed; otherwise `failed`, and tell the user to fix the reported issues and rerun `/5:implement {feature-name}` to resume.
186
135
 
187
- Parse only the `---VERIFICATION---` block from the response.
136
+ ## Step 5: Auto-commit
188
137
 
189
- If final verification passes, set state `status` to `completed`. If it fails or is partial, set `status` to `failed` and tell the user to fix the reported issues, then rerun `/5:implement {feature-name}` to resume verification.
138
+ If `.5/config.json` `git.autoCommit` is `true`, commit once per completed step:
190
139
 
191
- ### Step 7: Report
140
+ 1. Stage only files owned by that step's components: `file` for create/modify/delete, both `sourceFile` and `file` for rename, plus the executor's reported `FILES_CREATED`/`FILES_MODIFIED`. Do not stage unrelated changes.
141
+ 2. Build the message from `git.commitMessage.pattern`, replacing `{ticket-id}` with the ticket from the plan frontmatter (or empty) and `{short-description}` with `step {number}: {step-name}`; trim redundant whitespace/punctuation when the ticket is empty.
142
+ 3. Commit.
192
143
 
193
- Report:
144
+ No changed files → skip. Commit error → report it and continue; do not retry with broader paths. If `git.autoCommit` is missing/`false`, do not commit.
194
145
 
195
- - Completed component count
196
- - Failed component count
197
- - Verification status
198
- - Path to `state.json`
199
- - Auto-commit count and any failed commit attempts, if `git.autoCommit` is true
200
- - Failed commands, missing tests, or unmet acceptance criteria, if any
146
+ ## Step 6: Report
201
147
 
202
- Stop.
148
+ Report: completed/failed component counts, verification status, path to `state.json`, auto-commit count and any failures, and any failed commands, missing tests, or unmet acceptance criteria. Then stop.