5-phase-workflow 3.0.0 → 3.1.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 (56) hide show
  1. package/README.md +31 -101
  2. package/bin/install.js +168 -176
  3. package/bin/sync-agents.js +59 -54
  4. package/docs/workflow-guide.md +35 -79
  5. package/package.json +2 -2
  6. package/src/agents/step-executor-agent.md +5 -4
  7. package/src/agents/step-orchestrator-agent.md +12 -12
  8. package/src/agents/verification-agent.md +7 -8
  9. package/src/codex-commands/plan.md +65 -0
  10. package/src/commands/5/address-review-findings.md +43 -52
  11. package/src/commands/5/analyze-feature.md +1 -1
  12. package/src/commands/5/configure.md +75 -179
  13. package/src/commands/5/eject.md +0 -1
  14. package/src/commands/5/implement.md +78 -68
  15. package/src/commands/5/lean-check.md +75 -0
  16. package/src/commands/5/reconfigure.md +48 -129
  17. package/src/commands/5/review.md +42 -14
  18. package/src/commands/5/synchronize-agents.md +1 -1
  19. package/src/commands/5/update.md +2 -2
  20. package/src/hooks/dependency-guard.js +150 -0
  21. package/src/hooks/statusline.js +5 -3
  22. package/src/references/configure-tables.md +0 -33
  23. package/src/settings.json +3 -4
  24. package/src/skills/baseline-conventions/SKILL.md +37 -0
  25. package/src/skills/cognitive-load/SKILL.md +52 -0
  26. package/src/skills/configure-agents-md/SKILL.md +72 -0
  27. package/src/skills/configure-rules/SKILL.md +146 -0
  28. package/src/skills/documentation-style/SKILL.md +32 -0
  29. package/src/skills/fowler-code-smells/SKILL.md +25 -0
  30. package/src/skills/review-style/SKILL.md +142 -0
  31. package/src/templates/AGENTS.md +31 -31
  32. package/src/templates/workflow/REVIEW-FINDINGS.md +2 -9
  33. package/src/workflows/5-implement.js +67 -92
  34. package/docs/findings.md +0 -361
  35. package/docs/progress.md +0 -102
  36. package/src/commands/5/apply-review-findings.md +0 -66
  37. package/src/commands/5/commit.md +0 -43
  38. package/src/commands/5/plan.md +0 -189
  39. package/src/commands/5/reply-pr-comments.md +0 -48
  40. package/src/commands/5/split.md +0 -86
  41. package/src/commands/5/triage-pr-comments.md +0 -70
  42. package/src/hooks/config-guard.js +0 -30
  43. package/src/skills/configure-docs-index/SKILL.md +0 -243
  44. package/src/skills/configure-skills/SKILL.md +0 -311
  45. package/src/skills/generate-readme/EXAMPLES.md +0 -168
  46. package/src/skills/generate-readme/SKILL.md +0 -122
  47. package/src/skills/generate-readme/TEMPLATE.md +0 -141
  48. package/src/skills/use-index/SKILL.md +0 -49
  49. package/src/templates/ARCHITECTURE.md +0 -33
  50. package/src/templates/CONCERNS.md +0 -33
  51. package/src/templates/CONVENTIONS.md +0 -74
  52. package/src/templates/TESTING.md +0 -24
  53. package/src/templates/workflow/FIX-PLAN.md +0 -55
  54. package/src/templates/workflow/PLAN-COMPACT.md +0 -42
  55. package/src/templates/workflow/PLAN.md +0 -76
  56. package/src/templates/workflow/REVIEW-SUMMARY.md +0 -53
@@ -26,9 +26,13 @@ const log = {
26
26
  // ── Workflow-managed file lists (must match install.js) ────────────────────
27
27
 
28
28
  const WORKFLOW_MANAGED_SKILLS = new Set([
29
- 'configure-docs-index',
30
- 'configure-skills',
31
- 'generate-readme'
29
+ 'configure-agents-md',
30
+ 'configure-rules',
31
+ 'review-style',
32
+ 'fowler-code-smells',
33
+ 'cognitive-load',
34
+ 'documentation-style',
35
+ 'baseline-conventions'
32
36
  ]);
33
37
 
34
38
  const WORKFLOW_MANAGED_AGENTS = new Set([
@@ -42,6 +46,8 @@ const RULES_SYNC_START = '<!-- 5-sync:rules-start -->';
42
46
  const RULES_SYNC_END = '<!-- 5-sync:rules-end -->';
43
47
  const AGENTS_SYNC_START = '<!-- 5-sync:agents-start -->';
44
48
  const AGENTS_SYNC_END = '<!-- 5-sync:agents-end -->';
49
+ // Codex reads only AGENTS.md, so synced rules and agents live in its foifi block.
50
+ const FOIFI_BLOCK_END = '<!-- foifi:end -->';
45
51
 
46
52
  // ── Conversion functions (mirrors install.js logic) ────────────────────────
47
53
 
@@ -73,14 +79,6 @@ function convertClaudeSetupCommandsToCodexNotes(content) {
73
79
  .replace(
74
80
  /- If user selects "Install now": execute the install command/g,
75
81
  '- If user selects "Install now": explain that Codex cannot run the Claude Code installer command; leave `tools.context7.available = false` unless Context7 is already detected'
76
- )
77
- .replace(
78
- /1\. "Install now \(recommended\)" — run `claude plugin install skill-creator@claude-plugins-official` via Bash/g,
79
- '1. "Install now" — not supported automatically in Codex; install an equivalent skill authoring workflow outside this command, then rerun configuration'
80
- )
81
- .replace(
82
- /- If user selects "Install now": execute the install command, then set `tools\.skillCreator\.available = true` in the config/g,
83
- '- If user selects "Install now": explain that Codex cannot run the Claude Code plugin installer; leave `tools.skillCreator.available = false` unless an equivalent tool is already detected'
84
82
  );
85
83
  }
86
84
 
@@ -107,6 +105,7 @@ This skill was authored for Claude Code. Map these tool references:
107
105
  | \`Agent(subagent_type="Explore")\` | \`spawn_agent(agent_type="explorer", model="gpt-5.4-mini", reasoning_effort="low", message="...")\` |
108
106
  | \`Agent(prompt="...", model="haiku")\` | \`spawn_agent(model="gpt-5.4-mini", reasoning_effort="low", message="...")\` |
109
107
  | \`Agent(prompt="...", model="sonnet")\` | \`spawn_agent(model="gpt-5.4", reasoning_effort="medium", message="...")\` |
108
+ | \`Agent(prompt="...", model="opus", effort="medium")\` | \`spawn_agent(model="gpt-5.4", reasoning_effort="high", message="...")\` |
110
109
  | \`Agent(prompt="...")\` | \`spawn_agent(model="gpt-5.4-mini", reasoning_effort="low", message="...")\` unless the prompt explicitly requires complex reasoning |
111
110
  | \`Read\` | \`read_file\` |
112
111
  | \`Write\` | \`write_file\` |
@@ -230,8 +229,8 @@ function findProjectRoot() {
230
229
  }
231
230
 
232
231
  function isClaudeInstalled(root) {
233
- return fs.existsSync(path.join(root, '.claude', 'commands', '5', 'plan.md')) ||
234
- fs.existsSync(path.join(root, '.claude', 'commands', '5', 'plan-feature.md'));
232
+ return ['implement.md', 'plan.md', 'plan-feature.md']
233
+ .some(file => fs.existsSync(path.join(root, '.claude', 'commands', '5', file)));
235
234
  }
236
235
 
237
236
  function isCodexInstalled(root) {
@@ -352,22 +351,22 @@ function classifyRulesActions(root) {
352
351
  const rules = getClaudeRules(root);
353
352
  if (rules.length === 0) return [];
354
353
 
355
- const instructionsPath = path.join(root, '.codex', 'instructions.md');
356
- if (!fs.existsSync(instructionsPath)) {
354
+ const agentsPath = path.join(root, 'AGENTS.md');
355
+ if (!fs.existsSync(agentsPath)) {
357
356
  return [{ type: 'new', direction: 'claude-to-codex', category: 'rules', name: `${rules.length} rule file(s)` }];
358
357
  }
359
358
 
360
- const instructions = fs.readFileSync(instructionsPath, 'utf8');
359
+ const agentsMd = fs.readFileSync(agentsPath, 'utf8');
361
360
  const newSection = buildRulesSection(root, rules);
362
361
 
363
362
  // Extract existing section
364
- const startIdx = instructions.indexOf(RULES_SYNC_START);
365
- const endIdx = instructions.indexOf(RULES_SYNC_END);
363
+ const startIdx = agentsMd.indexOf(RULES_SYNC_START);
364
+ const endIdx = agentsMd.indexOf(RULES_SYNC_END);
366
365
  if (startIdx === -1 || endIdx === -1) {
367
366
  return [{ type: 'new', direction: 'claude-to-codex', category: 'rules', name: `${rules.length} rule file(s)` }];
368
367
  }
369
368
 
370
- const existing = instructions.substring(startIdx, endIdx + RULES_SYNC_END.length);
369
+ const existing = agentsMd.substring(startIdx, endIdx + RULES_SYNC_END.length);
371
370
  if (existing === newSection) {
372
371
  return [{ type: 'in-sync', direction: 'both', category: 'rules', name: `${rules.length} rule file(s)` }];
373
372
  }
@@ -378,21 +377,21 @@ function classifyAgentActions(root) {
378
377
  const agents = getClaudeCustomAgents(root);
379
378
  if (agents.length === 0) return [];
380
379
 
381
- const instructionsPath = path.join(root, '.codex', 'instructions.md');
382
- if (!fs.existsSync(instructionsPath)) {
380
+ const agentsPath = path.join(root, 'AGENTS.md');
381
+ if (!fs.existsSync(agentsPath)) {
383
382
  return [{ type: 'new', direction: 'claude-to-codex', category: 'agents', name: `${agents.length} agent(s)` }];
384
383
  }
385
384
 
386
- const instructions = fs.readFileSync(instructionsPath, 'utf8');
385
+ const agentsMd = fs.readFileSync(agentsPath, 'utf8');
387
386
  const newSection = buildAgentsSection(root, agents);
388
387
 
389
- const startIdx = instructions.indexOf(AGENTS_SYNC_START);
390
- const endIdx = instructions.indexOf(AGENTS_SYNC_END);
388
+ const startIdx = agentsMd.indexOf(AGENTS_SYNC_START);
389
+ const endIdx = agentsMd.indexOf(AGENTS_SYNC_END);
391
390
  if (startIdx === -1 || endIdx === -1) {
392
391
  return [{ type: 'new', direction: 'claude-to-codex', category: 'agents', name: `${agents.length} agent(s)` }];
393
392
  }
394
393
 
395
- const existing = instructions.substring(startIdx, endIdx + AGENTS_SYNC_END.length);
394
+ const existing = agentsMd.substring(startIdx, endIdx + AGENTS_SYNC_END.length);
396
395
  if (existing === newSection) {
397
396
  return [{ type: 'in-sync', direction: 'both', category: 'agents', name: `${agents.length} agent(s)` }];
398
397
  }
@@ -403,15 +402,17 @@ function classifyAgentActions(root) {
403
402
 
404
403
  function buildRulesSection(root, ruleFiles) {
405
404
  const rulesDir = path.join(root, '.claude', 'rules');
406
- let section = `${RULES_SYNC_START}\n## Project Rules\n\n`;
405
+ let section = `${RULES_SYNC_START}\n## File-Scoped Rules\n\n`;
407
406
  section += '> Synced from .claude/rules/ — do not edit this section manually.\n';
408
407
  section += '> Re-run /5:synchronize-agents (or $5-synchronize-agents) to update.\n\n';
409
408
 
410
409
  for (const file of ruleFiles) {
411
410
  const content = fs.readFileSync(path.join(rulesDir, file), 'utf8');
412
- const { body } = extractFrontmatterAndBody(content);
411
+ const { frontmatter, body } = extractFrontmatterAndBody(content);
412
+ const globs = frontmatter ? [...frontmatter.matchAll(/^\s*-\s*["']?([^"'\n]+?)["']?\s*$/gm)].map(m => `\`${m[1]}\``) : [];
413
413
  const name = file.replace('.md', '');
414
- section += `### ${name}\n\n${body.trim()}\n\n`;
414
+ const directives = body.replace('<!-- foifi:generated -->', '').trim();
415
+ section += `### ${name}\nApplies to: ${globs.length ? globs.join(', ') : 'all files'}\n\n${directives}\n\n`;
415
416
  }
416
417
 
417
418
  section += RULES_SYNC_END;
@@ -435,18 +436,32 @@ function buildAgentsSection(root, agentFiles) {
435
436
  return section;
436
437
  }
437
438
 
438
- function updateInstructionsSection(instructionsContent, startMarker, endMarker, newSection) {
439
- const startIdx = instructionsContent.indexOf(startMarker);
440
- const endIdx = instructionsContent.indexOf(endMarker);
439
+ // Replace the marked section inside the foifi block of AGENTS.md, or insert it just before the
440
+ // block's end. Returns null when there is no foifi block: content outside it belongs to the user.
441
+ function updateFoifiBlockSection(content, startMarker, endMarker, newSection) {
442
+ const startIdx = content.indexOf(startMarker);
443
+ const endIdx = content.indexOf(endMarker);
441
444
 
442
445
  if (startIdx !== -1 && endIdx !== -1) {
443
- // Replace existing section
444
- return instructionsContent.substring(0, startIdx) +
446
+ return content.substring(0, startIdx) +
445
447
  newSection +
446
- instructionsContent.substring(endIdx + endMarker.length);
448
+ content.substring(endIdx + endMarker.length);
449
+ }
450
+ const blockEnd = content.indexOf(FOIFI_BLOCK_END);
451
+ if (blockEnd === -1) return null;
452
+ return content.substring(0, blockEnd) + newSection + '\n\n' + content.substring(blockEnd);
453
+ }
454
+
455
+ function writeFoifiBlockSection(root, startMarker, endMarker, section, label) {
456
+ const agentsPath = path.join(root, 'AGENTS.md');
457
+ const content = fs.existsSync(agentsPath) ? fs.readFileSync(agentsPath, 'utf8') : '';
458
+ const updated = updateFoifiBlockSection(content, startMarker, endMarker, section);
459
+ if (updated === null) {
460
+ log.warn(`${label}: AGENTS.md has no foifi block — run /5:configure first`);
461
+ return;
447
462
  }
448
- // Append
449
- return instructionsContent.trimEnd() + '\n\n' + newSection + '\n';
463
+ fs.writeFileSync(agentsPath, updated);
464
+ log.dim(`${label} → AGENTS.md (foifi block)`);
450
465
  }
451
466
 
452
467
  // ── Execute sync ───────────────────────────────────────────────────────────
@@ -474,17 +489,17 @@ function executeSync(root, actions) {
474
489
  // rules and agents are handled separately in batch
475
490
  }
476
491
 
477
- // Sync rules to instructions.md
492
+ // Sync rules into the AGENTS.md foifi block
478
493
  const ruleActions = actions.filter(a => a.category === 'rules' && a.type !== 'in-sync');
479
494
  if (ruleActions.length > 0) {
480
- syncRulesToInstructions(root);
495
+ syncRulesToAgentsMd(root);
481
496
  for (const a of ruleActions) counts['claude-to-codex'][a.type]++;
482
497
  }
483
498
 
484
- // Sync agents to instructions.md
499
+ // Sync agents into the AGENTS.md foifi block
485
500
  const agentActions = actions.filter(a => a.category === 'agents' && a.type !== 'in-sync');
486
501
  if (agentActions.length > 0) {
487
- syncAgentsToInstructions(root);
502
+ syncAgentsToAgentsMd(root);
488
503
  for (const a of agentActions) counts['claude-to-codex'][a.type]++;
489
504
  }
490
505
 
@@ -519,24 +534,14 @@ function syncCommandClaudeToCodex(root, action) {
519
534
  log.dim(`command: ${action.name} → .codex/skills/${action.skillName}/`);
520
535
  }
521
536
 
522
- function syncRulesToInstructions(root) {
537
+ function syncRulesToAgentsMd(root) {
523
538
  const rules = getClaudeRules(root);
524
- const section = buildRulesSection(root, rules);
525
- const instructionsPath = path.join(root, '.codex', 'instructions.md');
526
- let content = fs.existsSync(instructionsPath) ? fs.readFileSync(instructionsPath, 'utf8') : '';
527
- content = updateInstructionsSection(content, RULES_SYNC_START, RULES_SYNC_END, section);
528
- fs.writeFileSync(instructionsPath, content);
529
- log.dim(`rules: ${rules.length} file(s) → .codex/instructions.md`);
539
+ writeFoifiBlockSection(root, RULES_SYNC_START, RULES_SYNC_END, buildRulesSection(root, rules), `rules: ${rules.length} file(s)`);
530
540
  }
531
541
 
532
- function syncAgentsToInstructions(root) {
542
+ function syncAgentsToAgentsMd(root) {
533
543
  const agents = getClaudeCustomAgents(root);
534
- const section = buildAgentsSection(root, agents);
535
- const instructionsPath = path.join(root, '.codex', 'instructions.md');
536
- let content = fs.existsSync(instructionsPath) ? fs.readFileSync(instructionsPath, 'utf8') : '';
537
- content = updateInstructionsSection(content, AGENTS_SYNC_START, AGENTS_SYNC_END, section);
538
- fs.writeFileSync(instructionsPath, content);
539
- log.dim(`agents: ${agents.length} file(s) → .codex/instructions.md`);
544
+ writeFoifiBlockSection(root, AGENTS_SYNC_START, AGENTS_SYNC_END, buildAgentsSection(root, agents), `agents: ${agents.length} file(s)`);
540
545
  }
541
546
 
542
547
  // ── Display ────────────────────────────────────────────────────────────────
@@ -3,7 +3,7 @@
3
3
  v2.0.0 collapses the old five command path into the dev-workflow command path:
4
4
 
5
5
  ```text
6
- /5:plan -> /5:implement -> /5:review
6
+ plan mode -> /5:implement -> /5:review
7
7
  ```
8
8
 
9
9
  The package is named `foifi`.
@@ -12,93 +12,55 @@ The package is named `foifi`.
12
12
 
13
13
  The workflow separates human decisions from mechanical execution.
14
14
 
15
- - `plan.md` is the only planning artifact.
16
- - `codebase-scan.md` caches discovery so later phases avoid repeated scanning.
15
+ - The plan in `.5/planning/` is the only planning artifact. Claude Code's plan mode saves it there because `/5:configure` sets `plansDirectory`.
16
+ - There is no codebase index or scan cache. What implementation needs, such as the patterns to follow, goes into the plan.
17
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.
18
+ - Nothing about a run is persisted; a rerun of `/5:implement` starts over.
19
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
+ Where Claude Code ships a native capability, the workflow uses it: planning happens in native plan mode, shaped by the `AGENTS.md` rules, and `/5:review` calls the built-in `code-review` skill. Codex has neither, so it gets `$5-plan` and a prose review fallback.
21
+
22
+ Code quality follows a fixed order. The repository's own standards, such as `CONTRIBUTING.md` or `CODESTYLE.md`, always win. The style skills `fowler-code-smells`, `cognitive-load`, `documentation-style`, and `baseline-conventions` set the baseline wherever the repository says nothing. The `review-style` skill checks a change against both.
21
23
 
22
24
  This keeps planning short and reviewable while still giving implementation agents enough structured data to work reliably.
23
25
 
24
26
  ## Plan
25
27
 
26
- Run:
27
-
28
- ```text
29
- /5:plan
30
- ```
31
-
32
- or:
28
+ On Claude Code there is no plan command. Plan in native plan mode (shift+tab, or ask Claude to plan). The "Planning" section of the generated `AGENTS.md` shapes every plan, and plan mode saves it as:
33
29
 
34
30
  ```text
35
- $5-plan
31
+ .5/planning/{generated-name}.md
36
32
  ```
37
33
 
38
- The planner gathers requirements, explores the codebase, asks targeted questions, and writes:
39
-
40
- ```text
41
- .5/features/{feature-name}/plan.md
42
- .5/features/{feature-name}/codebase-scan.md
43
- ```
44
-
45
- `plan.md` uses either the normal template or `PLAN-COMPACT.md` for small, low-risk changes with 1-2 components and no migration, security/auth, or public API contract change. It contains:
46
-
47
- - overview
48
- - what changes
49
- - existing patterns to follow
50
- - constraints
51
- - scope in/out
52
- - acceptance criteria
53
- - decisions
54
- - module impact
55
- - component checklist
56
- - technical notes
34
+ On Codex, which has no plan mode, run `$5-plan`; it writes `.5/planning/{feature-name}.md`.
57
35
 
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.
36
+ The plan has no prescribed structure; Claude shapes it as the change needs, with a mermaid diagram where a flow, state machine, or component relationships explain the change better than text. When the request names a ticket, Claude fetches it and confirms the content with you first.
59
37
 
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`.
38
+ Approving a plan means you want it built: Claude runs `/5:implement {plan-path}` right away. A small plan (1-2 files, no migration, security/auth, or public API change) skips the orchestrator there.
61
39
 
62
40
  ## Refining A Plan
63
41
 
64
- Run:
65
-
66
- ```text
67
- /5:plan {feature-name}
68
- ```
69
-
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.
42
+ Ask Claude in plan mode to refine an existing plan, by feature name or path. It starts from the plan's content. On Codex, run `$5-plan {feature-name}` or `$5-plan {path-to-plan}`.
71
43
 
72
44
  ## Implement
73
45
 
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
-
76
46
  Run:
77
47
 
78
48
  ```text
79
49
  /5:implement {feature-name}
80
50
  ```
81
51
 
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.
52
+ Claude runs it right after you approve a plan; run it yourself to run a plan again.
83
53
 
84
- Implementation does three things:
54
+ A compact plan (1-2 files, no migration, security/auth, or public API change) is implemented inline in that session — no agents. Then build and tests run once, and a scope check compares the diff with the plan. `/5:review` follows, as for a full plan.
85
55
 
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.
87
- 2. Spawns executor agents for each component using an inline executor contract, parallelizing independent work.
88
- 3. Spawns `verification-agent` to verify completeness, correctness, build/tests, acceptance criteria, and test coverage.
56
+ A full plan goes through four steps:
89
57
 
90
- The graph is transient. `state.json` records only:
58
+ 1. `step-orchestrator-agent` derives the execution graph — steps, execution mode, dependency edges, model choice, targeted pattern references, and verify commands.
59
+ 2. Executor agents implement the components using an inline executor contract, independent ones in parallel. Each follows the repository standards and style skills that apply to its target. Mechanical work runs on `haiku`, ordinary logic on `sonnet`, complex work and every retry on `opus` at medium effort.
60
+ 3. When every component was mechanical and passed, build and tests run once plus the scope check. Otherwise `verification-agent` checks completeness, build/tests, the plan's acceptance criteria when it states any, and scope.
61
+ 4. `/5:review` runs once on the files the run changed — `code-review`, `security-review` for security-sensitive files, and `review-style` — and `/5:address-review-findings` then fixes the clear findings on its own and asks you only about real decisions, one question at a time. Auto-commit comes after, so approved fixes land in the same commit.
91
62
 
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`
96
-
97
- Live progress during a run comes from the task list rather than the file.
98
-
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.
100
-
101
- Verification runs inline during `/5:implement`. It checks planned files, final build/test commands, acceptance criteria, and recorded component verification outcomes.
63
+ Nothing is persisted. If a run fails or is interrupted, fix the cause and rerun `/5:implement`; executors see work already in the files.
102
64
 
103
65
  ## Review
104
66
 
@@ -108,25 +70,19 @@ Run:
108
70
  /5:review
109
71
  ```
110
72
 
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:
73
+ 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. When the diff touches authentication, user input, secrets, cryptography, or SQL/shell/path construction, the built-in `security-review` skill runs as well. Then `review-style` checks the same changes against the repository's standards and the style skills, in report-only mode. Either way it saves findings to:
112
74
 
113
75
  ```text
114
76
  .5/features/{feature-name}/review-findings-{timestamp}.md
115
77
  ```
116
78
 
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:
79
+ When findings exist after `/5:implement`, `/5:review` hands them straight to `/5:address-review-findings`. When you start `/5:review` yourself — possibly on someone else's branch — it asks once before fixing anything and running build and tests. It fixes clear findings on its own — confirmed bugs, security issues, breaches of a repository standard, and style findings with a clear local fix — skips obsolete or out-of-scope ones, and asks you only about real decisions, one question at a time. Then it runs build, tests, and lint, and reports what it fixed, what it skipped, and what you decided. To go through saved findings again, or to decide on every finding yourself:
118
80
 
119
81
  ```text
120
- /5:address-review-findings {feature-name}
82
+ /5:address-review-findings {feature-name} [--interactive]
121
83
  ```
122
84
 
123
- `/5:address-review-findings` is a compact coordinator. It routes local fixes, PR comment triage, and PR replies through focused helper commands:
124
-
125
- - `/5:apply-review-findings`
126
- - `/5:triage-pr-comments`
127
- - `/5:reply-pr-comments`
128
-
129
- PR comment decisions are recorded in `.5/features/{feature-name}/pr-comment-decisions.json` when PR handling is used.
85
+ For comments on a GitHub PR, ask Claude directly.
130
86
 
131
87
  ## Configuration
132
88
 
@@ -137,23 +93,23 @@ First-time setup:
137
93
  /5:implement CONFIGURE
138
94
  ```
139
95
 
140
- `/5:configure` writes `.5/config.json` and a CONFIGURE plan. `/5:implement CONFIGURE` generates documentation, the codebase index, AGENTS.md, CLAUDE.md shim, selected skills, and scoped rules.
96
+ `/5:configure` writes `.5/config.json`, sets `plansDirectory` to `.5/planning` in `.claude/settings.json`, and writes the CONFIGURE plan. `/5:implement CONFIGURE` adds the workflow rules to AGENTS.md as one marked block that links the repository's own standards, appends `@AGENTS.md` to CLAUDE.md when it lacks that line, and generates scoped rules. Nothing outside the block changes.
141
97
 
142
- Refresh generated docs/index/skills later with:
98
+ Refresh the AGENTS.md block and the rules later with:
143
99
 
144
100
  ```text
145
101
  /5:reconfigure
146
102
  ```
147
103
 
148
- `/5:reconfigure` writes `.5/reconfigure-manifest.json` and passes that compact manifest to documentation and skill refresh helpers instead of duplicating long detection summaries in prompts.
104
+ `/5:reconfigure` writes `.5/reconfigure-manifest.json` and passes that compact manifest to the AGENTS.md and rule refresh helpers instead of duplicating long detection summaries in prompts. It is also the upgrade path after a major update: it sets `plansDirectory` and removes the legacy `.5/index/`. Existing `.5/*.md` docs stay untouched.
149
105
 
150
106
  ## Troubleshooting
151
107
 
152
108
  If an implementation failed:
153
109
 
154
- 1. Read `.5/features/{feature-name}/state.json`.
110
+ 1. Read the verification result in the `/5:implement` report.
155
111
  2. Fix external blockers if needed.
156
- 3. Re-run `/5:implement {feature-name}` to resume.
112
+ 3. Re-run `/5:implement {feature-name}`.
157
113
 
158
114
  If an upgrade left old command files installed, run:
159
115
 
@@ -174,10 +130,10 @@ v2.0.0 removes old commands during upgrade:
174
130
 
175
131
  | Command | Purpose |
176
132
  |---------|---------|
177
- | `/5:plan` | Create a unified plan, or refine an existing one |
133
+ | plan mode / `$5-plan` | Create a plan, or refine an existing one |
178
134
  | `/5:implement` | Implement and verify |
179
- | `/5:review` | Review changes |
180
- | `/5:commit` | Create a templated git commit |
181
- | `/5:address-review-findings` | Apply approved findings |
135
+ | `/5:review` | Review changes for correctness and standards |
136
+ | `/5:address-review-findings` | Fix clear findings, ask about real decisions |
137
+ | `/5:analyze-feature` | Document a feature with mermaid diagrams |
182
138
  | `/5:configure` | Create project config and CONFIGURE plan |
183
- | `/5:reconfigure` | Refresh generated project context |
139
+ | `/5:reconfigure` | Refresh the AGENTS.md block and rules |
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "5-phase-workflow",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "A dev-workflow for Claude Code and Codex",
5
5
  "bin": {
6
6
  "foifi": "bin/install.js"
7
7
  },
8
8
  "scripts": {
9
- "test": "bash test/verify-install-js.sh && bash test/test-version-compare.sh && bash test/test-check-updates-hook.sh && bash test/test-update-system.sh",
9
+ "test": "bash test/verify-install-js.sh && bash test/test-version-compare.sh && bash test/test-check-updates-hook.sh && bash test/test-dependency-guard.sh && bash test/test-update-system.sh",
10
10
  "test:install": "bash test/verify-install-js.sh",
11
11
  "test:hook": "bash test/test-check-updates-hook.sh",
12
12
  "test:update": "bash test/test-update-system.sh",
@@ -6,7 +6,7 @@ tools: Read, Write, Edit, Glob, Grep, Bash, context7
6
6
 
7
7
  <role>
8
8
  You are a Step Executor. You implement exactly the assigned component or tightly grouped components.
9
- You follow the plan, state entry, and existing codebase patterns. You do not widen scope.
9
+ You follow the plan, your component, and existing codebase patterns. You do not widen scope.
10
10
  </role>
11
11
 
12
12
  ## Process
@@ -14,14 +14,14 @@ You follow the plan, state entry, and existing codebase patterns. You do not wid
14
14
  1. Read only the listed `patternRefs` ranges or symbols before editing. If a component only has legacy `patternFiles`, read the smallest relevant sections of those files instead of the whole file whenever possible.
15
15
  2. For `modify`, read the target file first and make the smallest coherent change.
16
16
  3. For `rename`, read both `sourceFile` and `file` first, then move content with the smallest coherent change.
17
- 4. For `create`, mirror naming, exports, layout, and test style from the pattern files.
18
- 5. If the target area has a local skill or rule, follow it.
17
+ 4. For `create`, mirror naming, exports, layout, and test style from the pattern files. Nothing is persisted between runs, so the target may exist from an earlier run: read it first; if it already fulfils the intent, report success with no change, otherwise complete it — never overwrite it blindly.
18
+ 5. Follow the standards `/5:implement` assigns: read the parts of the repository standards and style skills that apply to your target. Repository standards win over the style skills. If the target area has a local skill or rule, follow it too.
19
19
  6. Run every verify command assigned to your component. If none is assigned, verify touched files exist and run the narrowest relevant test/build command you can infer.
20
20
  7. Fix local mechanical issues you caused. Stop for architectural changes, auth gates, missing external services, or unclear product decisions.
21
21
 
22
22
  ## Simplicity
23
23
 
24
- Write the minimum that satisfies the component (the "smallest coherent change"): prefer the standard library, a native framework feature, or an already-installed dependency over anything new. Add no new dependency, no abstraction for single-use code, no unrequested flexibility, and no error handling for impossible cases. Follow `Simplicity First` in the project `AGENTS.md`.
24
+ Write the minimum that satisfies the component (the "smallest coherent change"): reuse what already exists in this codebase first, then prefer the standard library, a native framework feature, or an already-installed dependency over anything new. Add no new dependency, no abstraction for single-use code, no unrequested flexibility, and no error handling for impossible cases. Touch only the target file and what it strictly needs (its test, an import site). Follow `Simplicity First` in the project `AGENTS.md`.
25
25
 
26
26
  End with exactly:
27
27
 
@@ -32,6 +32,7 @@ FILES_CREATED: [comma-separated paths]
32
32
  FILES_MODIFIED: [comma-separated paths]
33
33
  VERIFY: passed | failed | skipped
34
34
  DEVIATIONS: none | {brief list}
35
+ SKIPPED: none | {what you deliberately did not build — add when ...}
35
36
  ERROR: none | {error description}
36
37
  ---END---
37
38
  ```
@@ -1,29 +1,30 @@
1
1
  ---
2
2
  name: step-orchestrator-agent
3
- description: Converts a clean human plan into an execution graph — steps, component wiring, model choices, pattern references, and verify commands.
3
+ description: Converts a human plan of any shape into an execution graph — steps, component wiring, model choices, pattern references, and verify commands.
4
4
  tools: Read, Glob, Grep
5
5
  ---
6
6
 
7
7
  <role>
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.
8
+ You are a Step Orchestrator. You do not implement code and you do not write files. You read the plan 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. The graph is transient — it is derived fresh on every run, including resumes.
13
+ Turn the plan into execution state that `/5:implement` can run without rethinking the plan. The plan has no fixed shape; derive the components from whatever it describes, one per target file or tightly coupled file group. The graph is transient — it is derived fresh on every run.
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
+ - Name each component in short kebab-case.
18
18
  - Group independent components into the same step with `mode: "parallel"`.
19
19
  - Use `mode: "sequential"` when components touch the same file, one imports another, or an explicit dependency exists.
20
20
  - Prefer fewer steps when dependencies allow.
21
21
  - Tests normally run after the components they validate.
22
- - Choose `model: "haiku"` by default for simple mechanical work, localized UI changes, tests, docs, config edits, and single-file changes.
23
- - Choose `model: "sonnet"` only for complex logic, cross-module behavior, security/auth, data migrations, public API contracts, or work likely to require reasoning.
24
- - Pick `patternRefs` from `Existing Patterns to Follow`, `codebase-scan.md`, or nearby existing files found with Glob/Grep. Prefer one primary reference; use a second only when it adds a distinct convention. Include line ranges or symbols when known so executors avoid reading whole files.
25
- - Pick `verifyCommands` from `.5/config.json`, the scan, package scripts, and target-specific checks. Prefer narrow checks first, then project-level build/test.
26
- - Preserve user decisions exactly. Exclude `[DEFERRED]` work.
22
+ - Choose `model: "haiku"` for mechanical work: localized UI changes, tests, docs, config edits, and simple single-file changes.
23
+ - Choose `model: "sonnet"` for ordinary logic.
24
+ - Choose `model: "opus"` only for complex logic, cross-module behavior, security/auth, data migrations, or public API contracts. `/5:implement` runs it at medium effort.
25
+ - Pick `patternRefs` from patterns the plan names, or from nearby existing files found with Glob/Grep. Prefer one primary reference; use a second only when it adds a distinct convention. Include line ranges or symbols when known so executors avoid reading whole files.
26
+ - Pick `verifyCommands` from `.5/config.json`, the plan, package scripts, and target-specific checks. Prefer narrow checks first, then project-level build/test.
27
+ - Preserve user decisions exactly. Exclude work the plan defers or rules out.
27
28
 
28
29
  ## Output
29
30
 
@@ -46,7 +47,7 @@ Return this shape:
46
47
  "action": "create|modify|delete|rename",
47
48
  "step": 1,
48
49
  "mode": "parallel|sequential",
49
- "model": "haiku|sonnet",
50
+ "model": "haiku|sonnet|opus",
50
51
  "file": "path/to/file",
51
52
  "sourceFile": null,
52
53
  "description": "one sentence",
@@ -69,8 +70,7 @@ Return this shape:
69
70
 
70
71
  Before returning:
71
72
 
72
- - Every component name matches the plan's Component Checklist character for character.
73
- - Every component from `plan.md` is represented once unless it is explicitly deferred.
73
+ - Every piece of planned work is represented once unless the plan defers it.
74
74
  - Every non-first-step dependency refers to an existing component name.
75
75
  - Every component has 1-2 high-signal `patternRefs`, or a note explaining why no pattern exists.
76
76
  - Every component has at least one verify command or a note explaining why verification is manual.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: verification-agent
3
- description: Verifies a workflow implementation across completeness, correctness, infrastructure, acceptance criteria, and quality. Used by /5:implement.
3
+ description: Verifies that a workflow implementation was built as planned and works — completeness, infrastructure, acceptance criteria, and scope. Code quality and correctness belong to /5:review. Used by /5:implement.
4
4
  tools: Read, Glob, Grep, Bash
5
5
  ---
6
6
 
@@ -10,18 +10,17 @@ You are a Verification Agent. You verify only. You do not implement fixes and yo
10
10
 
11
11
  ## Inputs
12
12
 
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.
13
+ Read the plan `/5:implement` names and `.5/config.json` if present.
14
14
 
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.
15
+ `/5:implement` passes you the component results, the repository standards, 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.
16
16
 
17
17
  ## Checks
18
18
 
19
- 1. Completeness: every planned component is completed, none remain pending, and all planned acceptance criteria are addressed.
19
+ 1. Completeness: every planned component is completed, none remain pending, and any acceptance criteria the plan states are addressed.
20
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.
21
21
  3. Build: run the configured build command unless it is `none` or the baseline and component results already prove its status.
22
22
  4. Tests: run the configured test command unless it is `none` or the baseline and component results already prove its status.
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.
24
- 6. Quality: logic-bearing created or modified components have tests when the project has a test framework.
23
+ 5. Scope: run `git status --short` and `git diff HEAD --stat`, and read untracked (`??`) files directly — `git diff HEAD` omits them. Every changed file traces to a planned component (its target, its test, or an import site it needs) or is a file a repository standard requires, such as a changelog entry. Flag files outside the plan, work the plan rules out or defers, new dependencies no component requires, and abstractions or configurability no acceptance criterion asks for. Report drift only in `SCOPE`; it does not change `STATUS` — the user decides what to revert.
25
24
 
26
25
  Rerun only the commands whose inputs changed. Do not rerun an identical passing command just to see it pass again.
27
26
 
@@ -35,9 +34,9 @@ STATUS: passed | partial | failed
35
34
  COMPLETENESS: passed | partial | failed
36
35
  INFRASTRUCTURE: passed | failed
37
36
  ACCEPTANCE_CRITERIA: satisfied/total
38
- QUALITY: passed | partial | failed
37
+ SCOPE: passed | drift
39
38
  ERRORS: none | {summary}
40
39
  ---END_VERIFICATION---
41
40
  ```
42
41
 
43
- Keep `ERRORS` to a compact summary. Do not paste command logs or diffs.
42
+ Keep `ERRORS` to a compact summary; list each drift finding there as `drift: {path} — {why}`. Do not paste command logs or diffs.