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.
- package/README.md +31 -101
- package/bin/install.js +168 -176
- package/bin/sync-agents.js +59 -54
- package/docs/workflow-guide.md +35 -79
- package/package.json +2 -2
- package/src/agents/step-executor-agent.md +5 -4
- package/src/agents/step-orchestrator-agent.md +12 -12
- package/src/agents/verification-agent.md +7 -8
- package/src/codex-commands/plan.md +65 -0
- package/src/commands/5/address-review-findings.md +43 -52
- package/src/commands/5/analyze-feature.md +1 -1
- package/src/commands/5/configure.md +75 -179
- package/src/commands/5/eject.md +0 -1
- package/src/commands/5/implement.md +78 -68
- package/src/commands/5/lean-check.md +75 -0
- package/src/commands/5/reconfigure.md +48 -129
- package/src/commands/5/review.md +42 -14
- package/src/commands/5/synchronize-agents.md +1 -1
- package/src/commands/5/update.md +2 -2
- package/src/hooks/dependency-guard.js +150 -0
- package/src/hooks/statusline.js +5 -3
- package/src/references/configure-tables.md +0 -33
- package/src/settings.json +3 -4
- package/src/skills/baseline-conventions/SKILL.md +37 -0
- package/src/skills/cognitive-load/SKILL.md +52 -0
- package/src/skills/configure-agents-md/SKILL.md +72 -0
- package/src/skills/configure-rules/SKILL.md +146 -0
- package/src/skills/documentation-style/SKILL.md +32 -0
- package/src/skills/fowler-code-smells/SKILL.md +25 -0
- package/src/skills/review-style/SKILL.md +142 -0
- package/src/templates/AGENTS.md +31 -31
- package/src/templates/workflow/REVIEW-FINDINGS.md +2 -9
- package/src/workflows/5-implement.js +67 -92
- package/docs/findings.md +0 -361
- package/docs/progress.md +0 -102
- package/src/commands/5/apply-review-findings.md +0 -66
- package/src/commands/5/commit.md +0 -43
- package/src/commands/5/plan.md +0 -189
- package/src/commands/5/reply-pr-comments.md +0 -48
- package/src/commands/5/split.md +0 -86
- package/src/commands/5/triage-pr-comments.md +0 -70
- package/src/hooks/config-guard.js +0 -30
- package/src/skills/configure-docs-index/SKILL.md +0 -243
- package/src/skills/configure-skills/SKILL.md +0 -311
- package/src/skills/generate-readme/EXAMPLES.md +0 -168
- package/src/skills/generate-readme/SKILL.md +0 -122
- package/src/skills/generate-readme/TEMPLATE.md +0 -141
- package/src/skills/use-index/SKILL.md +0 -49
- package/src/templates/ARCHITECTURE.md +0 -33
- package/src/templates/CONCERNS.md +0 -33
- package/src/templates/CONVENTIONS.md +0 -74
- package/src/templates/TESTING.md +0 -24
- package/src/templates/workflow/FIX-PLAN.md +0 -55
- package/src/templates/workflow/PLAN-COMPACT.md +0 -42
- package/src/templates/workflow/PLAN.md +0 -76
- package/src/templates/workflow/REVIEW-SUMMARY.md +0 -53
package/bin/sync-agents.js
CHANGED
|
@@ -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-
|
|
30
|
-
'configure-
|
|
31
|
-
'
|
|
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
|
|
234
|
-
fs.existsSync(path.join(root, '.claude', 'commands', '5',
|
|
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
|
|
356
|
-
if (!fs.existsSync(
|
|
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
|
|
359
|
+
const agentsMd = fs.readFileSync(agentsPath, 'utf8');
|
|
361
360
|
const newSection = buildRulesSection(root, rules);
|
|
362
361
|
|
|
363
362
|
// Extract existing section
|
|
364
|
-
const startIdx =
|
|
365
|
-
const endIdx =
|
|
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 =
|
|
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
|
|
382
|
-
if (!fs.existsSync(
|
|
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
|
|
385
|
+
const agentsMd = fs.readFileSync(agentsPath, 'utf8');
|
|
387
386
|
const newSection = buildAgentsSection(root, agents);
|
|
388
387
|
|
|
389
|
-
const startIdx =
|
|
390
|
-
const endIdx =
|
|
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 =
|
|
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##
|
|
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
|
-
|
|
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
|
-
|
|
439
|
-
|
|
440
|
-
|
|
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
|
-
|
|
444
|
-
return instructionsContent.substring(0, startIdx) +
|
|
446
|
+
return content.substring(0, startIdx) +
|
|
445
447
|
newSection +
|
|
446
|
-
|
|
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
|
-
|
|
449
|
-
|
|
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
|
|
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
|
-
|
|
495
|
+
syncRulesToAgentsMd(root);
|
|
481
496
|
for (const a of ruleActions) counts['claude-to-codex'][a.type]++;
|
|
482
497
|
}
|
|
483
498
|
|
|
484
|
-
// Sync agents
|
|
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
|
-
|
|
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
|
|
537
|
+
function syncRulesToAgentsMd(root) {
|
|
523
538
|
const rules = getClaudeRules(root);
|
|
524
|
-
|
|
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
|
|
542
|
+
function syncAgentsToAgentsMd(root) {
|
|
533
543
|
const agents = getClaudeCustomAgents(root);
|
|
534
|
-
|
|
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 ────────────────────────────────────────────────────────────────
|
package/docs/workflow-guide.md
CHANGED
|
@@ -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
|
-
|
|
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
|
-
-
|
|
16
|
-
-
|
|
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
|
-
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
31
|
+
.5/planning/{generated-name}.md
|
|
36
32
|
```
|
|
37
33
|
|
|
38
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
52
|
+
Claude runs it right after you approve a plan; run it yourself to run a plan again.
|
|
83
53
|
|
|
84
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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}
|
|
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
|
-
|
|
|
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:
|
|
181
|
-
| `/5:
|
|
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
|
|
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.
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
-
-
|
|
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"`
|
|
23
|
-
- Choose `model: "sonnet"`
|
|
24
|
-
-
|
|
25
|
-
- Pick `
|
|
26
|
-
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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
|
-
|
|
37
|
+
SCOPE: passed | drift
|
|
39
38
|
ERRORS: none | {summary}
|
|
40
39
|
---END_VERIFICATION---
|
|
41
40
|
```
|
|
42
41
|
|
|
43
|
-
Keep `ERRORS` to a compact summary
|
|
42
|
+
Keep `ERRORS` to a compact summary; list each drift finding there as `drift: {path} — {why}`. Do not paste command logs or diffs.
|