5-phase-workflow 2.1.0 → 3.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.
package/README.md CHANGED
@@ -6,18 +6,18 @@
6
6
 
7
7
  **Project setup** — The `/5:configure` command detects your stack, generates a `CLAUDE.md` / `AGENTS.md` tailored to your project, writes a `.5/index/` knowledge base, and installs project-specific skills and rules. This gives every AI session the right context from the start rather than letting the model guess.
8
8
 
9
- **Status line** — foifi installs an informative Claude Code status line that surfaces the active feature, current workflow phase, and relevant state directly in the terminal footer. No more digging through files to remember where you left off.
9
+ **Status line** — foifi installs a Claude Code status line that surfaces the installed version, available updates, and pending reconfigure/migration reminders directly in the terminal footer.
10
10
 
11
11
  **Structured implementation workflow** — Instead of asking Claude or Codex to "just implement this," foifi enforces a three-phase loop:
12
- 1. **Plan** (`/5:plan`) — writes a single human-reviewed `plan.md` with scope, acceptance criteria, component checklist, and decisions.
13
- 2. **Implement** (`/5:implement`) — an orchestrator agent turns the plan into a typed execution graph (`state.json`), then delegates each component to a focused executor agent. A verification agent checks completeness, correctness, and test coverage at the end of every run.
14
- 3. **Review** (`/5:review`) — triages changed files, produces structured findings, and feeds them into `/5:address-review-findings` for interactive fix decisions and PR replies.
12
+ 1. **Plan** (`/5:plan`) — wraps Claude Code's native plan mode and persists the approved result as a single human-reviewed `plan.md` with scope, acceptance criteria, component checklist, and decisions. Run it again on the same feature to refine that plan. Small plans are implemented right there on approval; larger ones hand off to step 2.
13
+ 2. **Implement** (`/5:implement`) — an orchestrator agent turns the plan into a typed execution graph, then delegates each component to a focused executor agent, firing independent components in parallel waves. A verification agent checks completeness, correctness, and test coverage at the end of every run.
14
+ 3. **Review** (`/5:review`) — wraps Claude Code's built-in `code-review` skill, produces structured findings, and feeds them into `/5:address-review-findings` for interactive fix decisions and PR replies.
15
15
 
16
- This separation keeps planning readable, implementation mechanical, and review structured.
16
+ This separation keeps planning readable, implementation mechanical, and review structured. Where Claude Code ships a native capability, foifi wraps it rather than reimplementing it — what foifi adds is the durable repo-local artifact and the ticket/config conventions around it.
17
17
 
18
18
  **Code review and findings** — `/5:review` triages changed files and produces structured `review-findings-*.md`. `/5:address-review-findings` presents each finding interactively, records `fix`/`wont_fix`/`wait` decisions, applies approved local fixes, handles PR comment replies, and keeps a decision log — all without losing context between sessions.
19
19
 
20
- **Plan management helpers** — `/5:discuss-feature` refines an existing plan in conversation. `/5:split` breaks a large plan into smaller linked child plans. `/5:unlock` clears a stale planning lock. `/5:reconfigure` refreshes docs and skills when the project evolves.
20
+ **Plan management helpers** — `/5:split` breaks a large plan into smaller linked child plans. `/5:reconfigure` refreshes docs and skills when the project evolves.
21
21
 
22
22
  **Codex support** — Every command has a `$5-*` Codex equivalent. Codex runs are token-budgeted: simple steps use a lighter model and low reasoning, complex or security-sensitive steps escalate automatically.
23
23
 
@@ -81,24 +81,22 @@ $5-review
81
81
  $5-address-review-findings {feature-name}
82
82
  ```
83
83
 
84
- Verification runs at the end of `/5:implement` and records concise results in `state.json`.
84
+ Verification runs at the end of `/5:implement` and records a concise result in `state.json`.
85
85
 
86
86
  ## Commands
87
87
 
88
88
  | Command | Purpose |
89
89
  |---------|---------|
90
90
  | `/5:configure` / `$5-configure` | Detect project settings and write the CONFIGURE plan |
91
- | `/5:plan` / `$5-plan` | Create one unified `plan.md` from requirements, codebase exploration, and user decisions |
92
- | `/5:discuss-feature` / `$5-discuss-feature` | Refine an existing `plan.md` |
91
+ | `/5:plan` / `$5-plan` | Create one unified `plan.md` from requirements, codebase exploration, and user decisions — or refine an existing one |
93
92
  | `/5:split` / `$5-split` | Split an existing plan into smaller linked plans for separate implementation |
94
- | `/5:implement` / `$5-implement` | Derive `state.json`, execute steps with agents, and verify inline |
93
+ | `/5:implement` / `$5-implement` | Derive the execution graph, execute steps with agents, and verify inline |
95
94
  | `/5:review` / `$5-review` | Review code changes and save findings |
96
95
  | `/5:commit` / `$5-commit` | Create a git commit using the configured commit message template |
97
96
  | `/5:address-review-findings` / `$5-address-review-findings` | Decide on review findings interactively, then apply approved fixes and PR comments |
98
97
  | `/5:reconfigure` / `$5-reconfigure` | Refresh docs, index, skills, and rules |
99
98
  | `/5:update` / `$5-update` | Upgrade installed workflow files |
100
99
  | `/5:eject` / `$5-eject` | Stop workflow-managed updates |
101
- | `/5:unlock` / `$5-unlock` | Remove a stale planning guard lock |
102
100
  | `/5:synchronize-agents` / `$5-synchronize-agents` | Sync user content between Claude Code and Codex |
103
101
 
104
102
  ## Artifacts
@@ -107,8 +105,7 @@ Each feature lives under `.5/features/{feature-name}/`:
107
105
 
108
106
  - `plan.md` - single human-reviewed planning artifact
109
107
  - `codebase-scan.md` - cached discovery used to reduce repeated scanning
110
- - `state.json` - enriched execution state derived by `step-orchestrator-agent`
111
- - `state-events.jsonl` - detailed execution history for retries, commands, commits, and verification
108
+ - `state.json` - small resume record: status, completed components, verification result
112
109
  - `split-manifest-*.json` - parent feature record for child plans created by `/5:split`
113
110
  - `review-findings-*.md` - review output for `/5:address-review-findings`
114
111
  - `review-decisions-*.json` - interactive fix/wont-fix/wait decisions for local findings
@@ -116,13 +113,15 @@ Each feature lives under `.5/features/{feature-name}/`:
116
113
 
117
114
  ## Design
118
115
 
119
- Planning stays human-readable. `plan.md` contains scope, acceptance criteria, decisions, module impact, and a clean component checklist. Small low-risk changes can use the compact plan template. Plans intentionally do not ask the planner to fill model choices, verify commands, step grouping, or pattern-file wiring.
116
+ Planning stays human-readable. Claude Code's native plan mode does the exploring, the asking, and the approval gate; `/5:plan` contributes the ticket lookup, the feature folder convention, and the artifact schema, then persists the approved plan. `plan.md` contains scope, acceptance criteria, decisions, module impact, and a clean component checklist. Small low-risk changes can use the compact plan template. Plans intentionally do not ask the planner to fill model choices, verify commands, step grouping, or pattern-file wiring.
120
117
 
121
- Implementation is mechanical. `step-orchestrator-agent` reads `plan.md` and `codebase-scan.md`, derives the execution graph into compact `state.json`, then `/5:implement` delegates each component to `step-executor-agent` with an inline executor contract. Pattern context is passed as targeted references instead of broad file lists so executors can read only the relevant ranges. Detailed history is appended to `state-events.jsonl`. This reduces planning token cost and avoids brittle prompt-table metadata.
118
+ Delegation is matched to the size of the job. Approving a plan means you want it built, so `/5:plan` finishes compact plans itself — for one or two files, the already-warm session beats anything an orchestrator can set up. Full plans go to `/5:implement`, where the cost is repaid: `step-orchestrator-agent` reads `plan.md` and `codebase-scan.md` and returns an execution graph, then each component goes to a `step-executor-agent` with an inline executor contract, independent components firing in parallel. Pattern context is passed as targeted references instead of broad file lists so executors read only the relevant ranges, and mechanical components run on a cheaper model than the ones that need reasoning.
122
119
 
123
- Verification uses a dedicated agent. `/5:implement` runs `verification-agent` at the end and records a concise final status in `state.json` without generating an extra report.
120
+ State is kept to what is actually read. The execution graph is derived fresh on every run and never written to disk; `state.json` persists only the status, the completed component names, and the verification result, which is all a resume needs. Component names are copied verbatim from the plan's checklist, so a re-derived graph still matches what already ran. Live progress comes from the task list, not from a file.
124
121
 
125
- Review is risk-based. Native review triages changed files first and reads full files only for risky changes or when diff context is insufficient. `/5:address-review-findings` presents each finding one by one with a recommendation, records `fix`/`wont_fix`/`wait` decisions, then coordinates narrower helpers for approved local fixes, PR comment triage, and PR replies so the common path stays compact.
122
+ Verification uses a dedicated agent. `/5:implement` runs `verification-agent` at the end, passing it the pre-change baseline so pre-existing failures are not blamed on the change, and records a concise final status without generating an extra report.
123
+
124
+ Review delegates to Claude Code's built-in `code-review` skill (default effort `high`, override with `/5:review {low|medium|high|max}`) and maps its findings into the workflow's findings file. Where that skill is unavailable — Codex, for example — a built-in review agent takes over and triages changed files by risk instead. `/5:address-review-findings` presents each finding one by one with a recommendation, records `fix`/`wont_fix`/`wait` decisions, then coordinates narrower helpers for approved local fixes, PR comment triage, and PR replies so the common path stays compact.
126
125
 
127
126
  Reconfiguration uses a compact `.5/reconfigure-manifest.json` to pass refresh decisions to documentation and skill generation helpers without duplicating long detection summaries in prompts.
128
127
 
package/bin/install.js CHANGED
@@ -372,7 +372,14 @@ const LEGACY_REMOVED_FILES = [
372
372
  'skills/5-verify-implementation',
373
373
  'skills/5-review-code',
374
374
  'skills/5-quick-implement',
375
- 'skills/configure-project'
375
+ 'skills/configure-project',
376
+ // v2.2: native plan mode replaces the plan guard; /5:plan absorbed discuss-feature
377
+ 'hooks/plan-guard.js',
378
+ 'commands/5/unlock.md',
379
+ 'commands/5/discuss-feature.md',
380
+ 'templates/workflow/STATE.json',
381
+ 'skills/5-unlock',
382
+ 'skills/5-discuss-feature'
376
383
  ];
377
384
 
378
385
  // Get list of workflow-owned files/directories (not user-created)
@@ -406,7 +413,6 @@ function getWorkflowManagedFiles() {
406
413
  'statusline.js',
407
414
  'check-updates.js',
408
415
  'check-reconfig.js',
409
- 'plan-guard.js',
410
416
  'config-guard.js'
411
417
  ],
412
418
 
@@ -431,7 +437,6 @@ function getWorkflowManagedFiles() {
431
437
  // Workflow output templates
432
438
  'workflow/PLAN.md',
433
439
  'workflow/PLAN-COMPACT.md',
434
- 'workflow/STATE.json',
435
440
  'workflow/REVIEW-FINDINGS.md',
436
441
  'workflow/REVIEW-SUMMARY.md',
437
442
  'workflow/FIX-PLAN.md'
@@ -570,10 +575,11 @@ This skill was authored for Claude Code. Map these tool references:
570
575
  | \`Grep\` | \`grep\` / \`search\` |
571
576
  | \`TaskCreate/TaskUpdate\` | Track progress internally |
572
577
  | \`Workflow\` | Not available — run the command's prose fallback loop instead |
573
- | \`EnterPlanMode\` | Not available — use structured output instead |
578
+ | \`Skill(skill="code-review")\` | Not available — run the command's prose fallback loop instead |
579
+ | \`EnterPlanMode\` | Not available — run the command's prose fallback loop instead |
574
580
 
575
581
  ## Model Mapping (single source of truth)
576
- When a skill, plan, or \`state.json\` component names a model, map it to Codex as:
582
+ When a skill, plan, or execution-graph component names a model, map it to Codex as:
577
583
 
578
584
  | Named model | Codex model | reasoning_effort |
579
585
  |-------------|-------------|------------------|
@@ -589,12 +595,14 @@ This table is authoritative — skill bodies do not repeat per-call model mappin
589
595
  - Use stronger models only when a previous cheaper attempt failed for reasoning reasons.
590
596
  - Keep the parent skill context lean: delegate read-heavy exploration to explorer agents and pass only compact findings, target paths, pattern references, and command summaries between agents.
591
597
 
592
- ## Guard Rules (replaces plan-guard hook)
593
- During the planning phase ($5-plan):
598
+ ## Guard Rules (Codex has no plan mode)
599
+ Claude Code enforces these at the harness level via native plan mode. Codex has no equivalent, so honour them yourself while running \`$5-plan\`, **until the user approves the plan**:
594
600
  - Do NOT write to any file outside \`.5/\`
595
601
  - Do NOT write source code — only the unified plan and scan cache
596
602
  - Do NOT spawn implementation agents — only Explore/research agents
597
603
 
604
+ After approval, \`$5-plan\` implements compact plans inline and hands larger ones to \`$5-implement\`.
605
+
598
606
  ## Update & Migration Notices (replaces statusline hooks)
599
607
  At the very start of this skill, before doing anything else, read these two files if they exist:
600
608
  - \`.5/.update-cache.json\` — if \`latestAvailableVersion\` is set, compare it to \`packageVersion\` in \`.5/version.json\`. If a newer version is available, tell the user: "foifi update available: <version> — run \`npx foifi --codex --upgrade\` to update."
@@ -1065,7 +1073,7 @@ function checkExistingInstallation(targetPath) {
1065
1073
  function showCommandsHelp(isGlobal) {
1066
1074
  if (activeRuntime === 'codex') {
1067
1075
  log.info('Available skills (invoke with $ prefix in Codex):');
1068
- log.info(' $5-plan - Create unified plan');
1076
+ log.info(' $5-plan - Create or refine a unified plan');
1069
1077
  log.info(' $5-split - Split plan into smaller plans');
1070
1078
  log.info(' $5-implement - Execute implementation + verification');
1071
1079
  log.info(' $5-review - Code review');
@@ -1074,11 +1082,10 @@ function showCommandsHelp(isGlobal) {
1074
1082
  log.info(' $5-configure - Interactive project setup');
1075
1083
  log.info(' $5-reconfigure - Refresh docs/skills (no Q&A)');
1076
1084
  log.info(' $5-eject - Eject from update mechanism');
1077
- log.info(' $5-unlock - Remove planning guard lock');
1078
1085
  log.info(' $5-synchronize-agents - Sync user content between runtimes');
1079
1086
  } else {
1080
1087
  log.info('Available commands:');
1081
- log.info(' /5:plan - Create unified plan');
1088
+ log.info(' /5:plan - Create or refine a unified plan');
1082
1089
  log.info(' /5:split - Split plan into smaller plans');
1083
1090
  log.info(' /5:implement - Execute implementation + verification');
1084
1091
  log.info(' /5:review - Code review');
@@ -1087,7 +1094,6 @@ function showCommandsHelp(isGlobal) {
1087
1094
  log.info(' /5:configure - Interactive project setup');
1088
1095
  log.info(' /5:reconfigure - Refresh docs/skills (no Q&A)');
1089
1096
  log.info(' /5:eject - Eject from update mechanism');
1090
- log.info(' /5:unlock - Remove planning guard lock');
1091
1097
  log.info(' /5:synchronize-agents - Sync user content between runtimes');
1092
1098
  }
1093
1099
  log.info('');
@@ -1186,6 +1192,38 @@ function removeContextForkFromSkills(targetPath) {
1186
1192
  } catch (e) {}
1187
1193
  }
1188
1194
 
1195
+ // Remove the plan-guard PreToolUse hook entry from an existing settings.json.
1196
+ // Native plan mode enforces read-only planning at the harness level, so the hook
1197
+ // is gone. Claude Code only — Codex never had a settings.json.
1198
+ function removePlanGuardHook(targetPath) {
1199
+ const settingsFile = path.join(targetPath, 'settings.json');
1200
+ if (!fs.existsSync(settingsFile)) return;
1201
+ try {
1202
+ const settings = JSON.parse(fs.readFileSync(settingsFile, 'utf8'));
1203
+ const pre = settings.hooks && settings.hooks.PreToolUse;
1204
+ if (!Array.isArray(pre)) return;
1205
+ const kept = pre.filter(entry =>
1206
+ !(entry.hooks || []).some(h => typeof h.command === 'string' && h.command.includes('plan-guard.js')));
1207
+ if (kept.length === pre.length) return;
1208
+ if (kept.length) settings.hooks.PreToolUse = kept;
1209
+ else delete settings.hooks.PreToolUse;
1210
+ if (settings.hooks && !Object.keys(settings.hooks).length) delete settings.hooks;
1211
+ fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2));
1212
+ log.info('Removed plan-guard hook from settings.json (native plan mode replaces it)');
1213
+ } catch (e) {}
1214
+ }
1215
+
1216
+ // Delete the stale .5/.planning-active marker. It only existed to drive plan-guard.
1217
+ function removePlanningActiveMarker(dataDir) {
1218
+ try {
1219
+ const marker = path.join(dataDir, '.planning-active');
1220
+ if (fs.existsSync(marker)) {
1221
+ fs.unlinkSync(marker);
1222
+ log.info('Removed stale .5/.planning-active marker');
1223
+ }
1224
+ } catch (e) {}
1225
+ }
1226
+
1189
1227
  // Perform update (preserves user-created files, updates .5/ data directory)
1190
1228
  function performUpdate(targetPath, sourcePath, isGlobal, versionInfo) {
1191
1229
  log.header(`Updating from ${versionInfo.installed || 'legacy'} to ${versionInfo.available}`);
@@ -1207,6 +1245,10 @@ function performUpdate(targetPath, sourcePath, isGlobal, versionInfo) {
1207
1245
  // Strip `context: fork` from generated skills — caused infinite loops
1208
1246
  removeContextForkFromSkills(targetPath);
1209
1247
 
1248
+ // Native plan mode replaces the plan-guard hook and its marker file
1249
+ removePlanGuardHook(targetPath);
1250
+ removePlanningActiveMarker(dataDir);
1251
+
1210
1252
  // Flag v1 → v2 major upgrade so statusline can prompt for reconfigure
1211
1253
  const prevMajor = versionInfo.installed ? parseInt(versionInfo.installed.split('.')[0], 10) : 0;
1212
1254
  const newMajor = versionInfo.available ? parseInt(versionInfo.available.split('.')[0], 10) : 0;
@@ -1256,14 +1298,13 @@ The workflow provides structured feature development:
1256
1298
  All workflow state lives in \`.5/\` at the project root:
1257
1299
  - \`.5/config.json\` — Project configuration
1258
1300
  - \`.5/features/{name}/plan.md\` — Unified plan
1259
- - \`.5/features/{name}/state.json\` — Implementation state
1301
+ - \`.5/features/{name}/state.json\` — Implementation resume state
1260
1302
 
1261
1303
  ## Guard Rules
1262
1304
 
1263
- During the planning phase ($5-plan):
1305
+ During the planning phase ($5-plan), until the user approves the plan:
1264
1306
  - Do NOT write files outside \`.5/\`
1265
1307
  - Do NOT write source code — only the unified plan and scan cache
1266
- - The \`.5/.planning-active\` marker indicates planning is in progress
1267
1308
 
1268
1309
  ## Configuration
1269
1310
 
@@ -1460,6 +1501,9 @@ function performCodexUpdate(targetPath, sourcePath, isGlobal, versionInfo) {
1460
1501
  // Rename create-* skill dirs to bare pattern names (create-dto → dto)
1461
1502
  renameCreateSkills(targetPath);
1462
1503
 
1504
+ // The plan-guard marker is shared .5/ state; Codex has no settings.json hook to remove
1505
+ removePlanningActiveMarker(dataDir);
1506
+
1463
1507
  // Flag v1 → v2 major upgrade so skills can prompt for reconfigure
1464
1508
  const prevMajor = versionInfo.installed ? parseInt(versionInfo.installed.split('.')[0], 10) : 0;
1465
1509
  const newMajor = versionInfo.available ? parseInt(versionInfo.available.split('.')[0], 10) : 0;
@@ -14,9 +14,10 @@ The workflow separates human decisions from mechanical execution.
14
14
 
15
15
  - `plan.md` is the only planning artifact.
16
16
  - `codebase-scan.md` caches discovery so later phases avoid repeated scanning.
17
- - `state.json` is generated by `step-orchestrator-agent` and drives implementation.
18
- - `state-events.jsonl` stores detailed execution history so `state.json` stays compact.
19
- - `verification-agent` records final verification status in `state.json`.
17
+ - The execution graph is derived by `step-orchestrator-agent` on every run and is never written to disk.
18
+ - `state.json` persists only what a resume needs: status, completed component names, and the verification result.
19
+
20
+ Where Claude Code ships a native capability, the workflow wraps it: `/5:plan` runs inside native plan mode and `/5:review` calls the built-in `code-review` skill. Codex has neither, so both commands keep a prose fallback.
20
21
 
21
22
  This keeps planning short and reviewable while still giving implementation agents enough structured data to work reliably.
22
23
 
@@ -56,41 +57,46 @@ The planner gathers requirements, explores the codebase, asks targeted questions
56
57
 
57
58
  The component checklist has only four columns: component, action, target path, intent. It does not contain step grouping, model selection, verify commands, or pattern-reference wiring.
58
59
 
60
+ Which template gets chosen also decides what happens on approval: a compact plan is implemented immediately in the same session, while a full plan stops after writing the artifacts and points you at `/5:implement`.
61
+
59
62
  ## Refining A Plan
60
63
 
61
64
  Run:
62
65
 
63
66
  ```text
64
- /5:discuss-feature {feature-name}
67
+ /5:plan {feature-name}
65
68
  ```
66
69
 
67
- Use this when the reviewed plan needs changed scope, additional acceptance criteria, or a corrected component checklist.
70
+ With an existing `plan.md`, `/5:plan` enters refine mode: it seeds plan mode with the current plan, discusses the changes, then overwrites the file and appends a `## Discussion History` entry. Use this when the reviewed plan needs changed scope, additional acceptance criteria, or a corrected component checklist.
68
71
 
69
72
  ## Implement
70
73
 
74
+ Compact plans never reach this command. Approving a plan means you want it built, so `/5:plan` implements a 1-2 component plan inline in the session that planned it and writes the same `state.json` — orchestration would cost more than it saves at that size. What follows applies to full plans.
75
+
71
76
  Run:
72
77
 
73
78
  ```text
74
79
  /5:implement {feature-name}
75
80
  ```
76
81
 
82
+ Prefer a fresh context first — `/clear` in Claude Code, a new conversation in Codex. This command needs only `plan.md` and `codebase-scan.md`, and dropping the planning conversation is the point of the handoff. It is a recommendation, not a requirement.
83
+
77
84
  Implementation does three things:
78
85
 
79
- 1. Spawns `step-orchestrator-agent` to derive compact `state.json` from `plan.md` and `codebase-scan.md`.
86
+ 1. Spawns `step-orchestrator-agent` to derive the execution graph from `plan.md` and `codebase-scan.md` — steps, execution mode, dependency edges, model choice, targeted pattern references, and verify commands.
80
87
  2. Spawns executor agents for each component using an inline executor contract, parallelizing independent work.
81
- 3. Spawns `verification-agent` to verify completeness, correctness, build/tests, acceptance criteria, and test coverage, then records the result in `state.json`.
88
+ 3. Spawns `verification-agent` to verify completeness, correctness, build/tests, acceptance criteria, and test coverage.
89
+
90
+ The graph is transient. `state.json` records only:
82
91
 
83
- `state.json` tracks:
92
+ - `status` — `in-progress`, `completed`, or `failed`
93
+ - `completedComponents` — the names of components that finished
94
+ - `verification` — final status plus a one-line summary
95
+ - `startedAt` / `lastUpdated`
84
96
 
85
- - steps and execution mode
86
- - pending/completed/failed components
87
- - dependency edges
88
- - targeted pattern references
89
- - verify commands
90
- - baseline and verification results
91
- - compact latest command/commit summaries, with detailed history in `state-events.jsonl`
97
+ Live progress during a run comes from the task list rather than the file.
92
98
 
93
- If implementation is interrupted, rerun `/5:implement {feature-name}` to resume from the recorded step.
99
+ If implementation is interrupted, rerun `/5:implement {feature-name}` to resume. The graph is re-derived and components already in `completedComponents` are skipped — which works because component names are copied verbatim from the plan's checklist. Note that the Workflow path writes `state.json` only when the run returns, so a run killed mid-way repeats the components it had finished.
94
100
 
95
101
  Verification runs inline during `/5:implement`. It checks planned files, final build/test commands, acceptance criteria, and recorded component verification outcomes.
96
102
 
@@ -102,13 +108,13 @@ Run:
102
108
  /5:review
103
109
  ```
104
110
 
105
- Review can use native agent review or CodeRabbit if configured. Native review triages changed files by risk and reads full files only for high-risk changes or when diff context is insufficient. It saves findings to:
111
+ On Claude Code, review delegates to the built-in `code-review` skill. Effort defaults to `high`; pass `/5:review low|medium|high|max` to override. Where that skill is unavailable (Codex), a built-in review agent triages changed files by risk and reads full files only for high-risk changes or when diff context is insufficient. Either way it saves findings to:
106
112
 
107
113
  ```text
108
114
  .5/features/{feature-name}/review-findings-{timestamp}.md
109
115
  ```
110
116
 
111
- Then apply approved findings:
117
+ When findings exist, `/5:review` asks whether to address them right away and hands off automatically if you say yes. To pick it up later instead:
112
118
 
113
119
  ```text
114
120
  /5:address-review-findings {feature-name}
@@ -143,12 +149,6 @@ Refresh generated docs/index/skills later with:
143
149
 
144
150
  ## Troubleshooting
145
151
 
146
- If planning is blocked by a stale guard:
147
-
148
- ```text
149
- /5:unlock
150
- ```
151
-
152
152
  If an implementation failed:
153
153
 
154
154
  1. Read `.5/features/{feature-name}/state.json`.
@@ -174,8 +174,7 @@ v2.0.0 removes old commands during upgrade:
174
174
 
175
175
  | Command | Purpose |
176
176
  |---------|---------|
177
- | `/5:plan` | Create unified plan |
178
- | `/5:discuss-feature` | Refine existing plan |
177
+ | `/5:plan` | Create a unified plan, or refine an existing one |
179
178
  | `/5:implement` | Implement and verify |
180
179
  | `/5:review` | Review changes |
181
180
  | `/5:commit` | Create a templated git commit |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5-phase-workflow",
3
- "version": "2.1.0",
3
+ "version": "3.0.0",
4
4
  "description": "A dev-workflow for Claude Code and Codex",
5
5
  "bin": {
6
6
  "foifi": "bin/install.js"
@@ -1,19 +1,20 @@
1
1
  ---
2
2
  name: step-orchestrator-agent
3
- description: Converts a clean human plan into enriched state.json steps, component wiring, model choices, pattern references, and verify commands.
4
- tools: Read, Write, Glob, Grep
3
+ description: Converts a clean human plan into an execution graph — steps, component wiring, model choices, pattern references, and verify commands.
4
+ tools: Read, Glob, Grep
5
5
  ---
6
6
 
7
7
  <role>
8
- You are a Step Orchestrator. You do not implement code. You read `plan.md`, `codebase-scan.md`, and config, then write `.5/features/{name}/state.json`.
8
+ You are a Step Orchestrator. You do not implement code and you do not write files. You read `plan.md`, `codebase-scan.md`, and config, then return an execution graph.
9
9
  </role>
10
10
 
11
11
  ## Goal
12
12
 
13
- Turn the human-readable component checklist in `plan.md` into execution state that `/5:implement` can run without rethinking the plan.
13
+ Turn the human-readable component checklist in `plan.md` into execution state that `/5:implement` can run without rethinking the plan. The graph is transient — it is derived fresh on every run, including resumes.
14
14
 
15
15
  ## Derivation Rules
16
16
 
17
+ - **Copy every component name verbatim from the plan's Component Checklist.** Resume matches components by name across runs; renaming or reformatting a name makes completed work run twice.
17
18
  - Group independent components into the same step with `mode: "parallel"`.
18
19
  - Use `mode: "sequential"` when components touch the same file, one imports another, or an explicit dependency exists.
19
20
  - Prefer fewer steps when dependencies allow.
@@ -24,17 +25,12 @@ Turn the human-readable component checklist in `plan.md` into execution state th
24
25
  - Pick `verifyCommands` from `.5/config.json`, the scan, package scripts, and target-specific checks. Prefer narrow checks first, then project-level build/test.
25
26
  - Preserve user decisions exactly. Exclude `[DEFERRED]` work.
26
27
 
27
- ## State Schema
28
+ ## Output
28
29
 
29
- Write valid JSON:
30
+ Return this shape:
30
31
 
31
32
  ```json
32
33
  {
33
- "ticket": "{ticket-id}",
34
- "feature": "{feature-name}",
35
- "status": "in-progress",
36
- "currentStep": 1,
37
- "totalSteps": 1,
38
34
  "steps": [
39
35
  {
40
36
  "number": 1,
@@ -65,46 +61,17 @@ Write valid JSON:
65
61
  "verifyCommands": ["command"],
66
62
  "notes": []
67
63
  }
68
- ],
69
- "completedComponents": [],
70
- "recentFailures": [],
71
- "baseline": {},
72
- "latestCommandResults": [],
73
- "verificationResults": {},
74
- "latestCommitResults": [],
75
- "eventLog": ".5/features/{feature-name}/state-events.jsonl",
76
- "startedAt": "{ISO-timestamp}",
77
- "lastUpdated": "{ISO-timestamp}"
64
+ ]
78
65
  }
79
66
  ```
80
67
 
81
68
  ## Quality Bar
82
69
 
83
- Before writing state:
70
+ Before returning:
84
71
 
72
+ - Every component name matches the plan's Component Checklist character for character.
85
73
  - Every component from `plan.md` is represented once unless it is explicitly deferred.
86
74
  - Every non-first-step dependency refers to an existing component name.
87
75
  - Every component has 1-2 high-signal `patternRefs`, or a note explaining why no pattern exists.
88
76
  - Every component has at least one verify command or a note explaining why verification is manual.
89
77
  - Rename components must set `sourceFile` to the original path and `file` to the destination path.
90
- - `totalSteps` equals `steps.length`.
91
-
92
- ## Event Log
93
-
94
- Keep `state.json` small. Append historical details to `.5/features/{name}/state-events.jsonl` as one JSON object per line. Keep only the latest compact summaries in `state.json`.
95
-
96
- Each event must include:
97
-
98
- ```json
99
- {
100
- "type": "command|component_result|retry|commit|verification|state_change",
101
- "timestamp": "{ISO-timestamp}",
102
- "step": 1,
103
- "component": "{component-name-or-null}",
104
- "status": "passed|failed|skipped|success|partial",
105
- "summary": "one line",
106
- "details": {}
107
- }
108
- ```
109
-
110
- Use `details` for command text, files, commit SHA, errors, or verification evidence. Do not duplicate large logs or diffs.
@@ -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": "satisfied/total",
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.