5-phase-workflow 3.0.1 → 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 (55) hide show
  1. package/README.md +31 -104
  2. package/bin/install.js +163 -178
  3. package/bin/sync-agents.js +59 -54
  4. package/docs/workflow-guide.md +35 -79
  5. package/package.json +1 -1
  6. package/src/agents/step-executor-agent.md +3 -3
  7. package/src/agents/step-orchestrator-agent.md +12 -12
  8. package/src/agents/verification-agent.md +5 -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 +68 -74
  15. package/src/commands/5/lean-check.md +7 -5
  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/statusline.js +5 -3
  21. package/src/references/configure-tables.md +0 -33
  22. package/src/settings.json +0 -12
  23. package/src/skills/baseline-conventions/SKILL.md +37 -0
  24. package/src/skills/cognitive-load/SKILL.md +52 -0
  25. package/src/skills/configure-agents-md/SKILL.md +72 -0
  26. package/src/skills/configure-rules/SKILL.md +146 -0
  27. package/src/skills/documentation-style/SKILL.md +32 -0
  28. package/src/skills/fowler-code-smells/SKILL.md +25 -0
  29. package/src/skills/review-style/SKILL.md +142 -0
  30. package/src/templates/AGENTS.md +19 -27
  31. package/src/templates/workflow/REVIEW-FINDINGS.md +2 -9
  32. package/src/workflows/5-implement.js +53 -91
  33. package/docs/findings.md +0 -361
  34. package/docs/progress.md +0 -102
  35. package/src/commands/5/apply-review-findings.md +0 -66
  36. package/src/commands/5/commit.md +0 -43
  37. package/src/commands/5/plan.md +0 -190
  38. package/src/commands/5/reply-pr-comments.md +0 -48
  39. package/src/commands/5/split.md +0 -86
  40. package/src/commands/5/triage-pr-comments.md +0 -70
  41. package/src/hooks/config-guard.js +0 -30
  42. package/src/skills/configure-docs-index/SKILL.md +0 -243
  43. package/src/skills/configure-skills/SKILL.md +0 -311
  44. package/src/skills/generate-readme/EXAMPLES.md +0 -168
  45. package/src/skills/generate-readme/SKILL.md +0 -122
  46. package/src/skills/generate-readme/TEMPLATE.md +0 -141
  47. package/src/skills/use-index/SKILL.md +0 -49
  48. package/src/templates/ARCHITECTURE.md +0 -33
  49. package/src/templates/CONCERNS.md +0 -33
  50. package/src/templates/CONVENTIONS.md +0 -74
  51. package/src/templates/TESTING.md +0 -24
  52. package/src/templates/workflow/FIX-PLAN.md +0 -55
  53. package/src/templates/workflow/PLAN-COMPACT.md +0 -42
  54. package/src/templates/workflow/PLAN.md +0 -76
  55. package/src/templates/workflow/REVIEW-SUMMARY.md +0 -53
@@ -1,68 +1,58 @@
1
1
  ---
2
2
  name: 5:address-review-findings
3
- description: Coordinates interactive review finding decisions and optionally handles GitHub PR review comments.
4
- allowed-tools: Bash, Read, Write, Glob, AskUserQuestion
3
+ description: Fixes clear review findings on its own, asks the user one question at a time only for real decisions, then verifies the result. --interactive asks about every finding.
4
+ allowed-tools: Bash, Read, Edit, Write, Glob, AskUserQuestion, Agent
5
+ argument-hint: [feature-name] [--interactive] [dirty: {paths}]
5
6
  user-invocable: true
6
- model: haiku
7
+ model: sonnet
7
8
  context: inherit
8
9
  ---
9
10
 
10
11
  <role>
11
- You are a Review Fix Coordinator. You keep context lean, collect user decisions one finding at a time, route work to narrower helper commands, and do not review code or implement unrelated changes.
12
+ You are a Review Fix Coordinator. You fix what is clear, ask the user only what they must decide, and do not review code or implement unrelated changes.
12
13
  </role>
13
14
 
14
15
  # Address Review Findings
15
16
 
16
- This is the stable entrypoint after `/5:review`.
17
+ `/5:review` runs this after every review. For comments on a GitHub PR, ask Claude directly; this command handles the findings file only.
17
18
 
18
19
  ## Options
19
20
 
20
- - `--github` - skip local findings and process PR comments only.
21
+ - `--interactive` — ask about every finding, one at a time, instead of deciding the clear ones yourself.
22
+ - `dirty: {paths}` — files that held the user's own uncommitted work before the run (`/5:implement` passes this). A finding in one of them may sit in that earlier work, so it is always **ask**, never fixed on your own.
21
23
 
22
24
  ## Process
23
25
 
24
26
  1. Determine feature context:
25
- - Find `.5/features/*/state.json`.
26
- - Select the most recent `startedAt` or `lastUpdated`.
27
- - If none exists, ask for the feature name.
28
- - Read `.5/config.json` only if needed for git/review settings.
29
- 2. Normal mode:
30
- - Find the latest `.5/features/{feature}/review-findings-*.md`.
31
- - If missing, ask whether to stop or continue with GitHub PR comments only.
27
+ - Use the feature name argument when given.
28
+ - Otherwise use the feature of the most recently modified plan in `.5/planning/`: its `feature` frontmatter field, or its file name without `.md`.
29
+ - If there is none, ask for the feature name.
30
+ 2. Decide:
31
+ - Find the latest `.5/features/{feature}/review-findings-*.md`. If missing, tell the user to run `/5:review` and stop.
32
32
  - Parse each finding into compact records with `id`, `file`, `line`, `category`, `severity`, `description`, `suggestedFix`, and `originalReviewerMessage`.
33
- - For each finding, present one item at a time:
34
- - Show `Comment {current}/{total}`, file and line, category/severity, concise description, suggested fix, and a recommendation.
35
- - Recommendation rules:
36
- - Recommend `fix` for clear, low-risk correctness, test, type, API-contract, or documentation fixes with a specific suggested change.
37
- - Recommend `wont_fix` for findings that are obsolete, duplicates, outside the feature scope, or based on an incorrect premise.
38
- - Recommend `wait` for ambiguous behavior, product decisions, risky refactors, or findings needing external validation.
39
- - Ask the user to choose `fix`, `wont_fix`, `wait`, or provide textual instructions.
40
- - Treat textual instructions as `fix` with `customInstructions` unless the text clearly says to defer or reject the finding.
33
+ - Sort each finding into one group:
34
+ - **fix** — a confirmed bug, security issue, breach of a repository standard, or style finding with a clear, local fix that changes no behavior beyond the finding.
35
+ - **wont_fix** — obsolete, a duplicate, outside the feature scope, or based on an incorrect premise.
36
+ - **ask** — uncertain (`Question` category), spanning several files, or needing a design, product, or API decision; also any fix whose suggested change you cannot apply with confidence.
37
+ - Record `fix` and `wont_fix` yourself, each with a one-line reason.
38
+ - For each **ask** finding, ask the user — **one finding per question, one question at a time**. Show `Decision {current}/{total}`, file and line, a concise description, the suggested fix, and your recommendation. Options: `fix`, `wont_fix`, `wait`, or textual instructions. Treat textual instructions as `fix` with `customInstructions` unless the text clearly says to defer or reject the finding.
39
+ - With `--interactive`, ask about every finding this way instead.
41
40
  - Write decisions to `.5/features/{feature}/review-decisions-{YYYYMMDD-HHmmss}.json`.
42
- - Invoke `/5:apply-review-findings {feature} --decisions .5/features/{feature}/review-decisions-{timestamp}.json` to apply approved local fixes.
43
- 3. GitHub mode or user-approved PR handling:
44
- - Invoke `/5:triage-pr-comments {feature}` to fetch and classify compact PR comments.
45
- - Parse the `---PR-TRIAGE---` block. If triage succeeded, continue even when there are zero actionable comments because duplicate, declined, or deferred comments may still need replies.
46
- - Ask the user for decisions on actionable/manual comments.
47
- - Invoke `/5:apply-review-findings {feature} --pr-approved` for approved PR fixes.
48
- - Invoke `/5:reply-pr-comments {feature}` to post PR replies.
49
- - Parse the `---PR-REPLIES---` block and include `POSTED`, `FAILED`, and `ERRORS` in the review summary.
50
- - Do not proceed to final output in GitHub mode until `/5:reply-pr-comments` has either posted replies or returned an explicit `---PR-REPLIES---` failure/partial result. Reply failures are non-fatal, but silent omission of the reply step is not allowed.
51
- 4. Run post-fix verification. This is mandatory after any approved fix is applied.
52
- - Read `.5/config.json`, project run skills, and common project manifests such as `package.json`, `Makefile`, `pyproject.toml`, `Cargo.toml`, and Gradle files only as needed to identify configured commands.
53
- - Run every available configured command in these categories: `build`, `test`, `e2e`/`test:e2e`, and `lint`.
54
- - Prefer generated run skills when present (`run-build`, `run-tests`, `run-lint`, and any e2e/test-e2e variant). Otherwise run the exact configured command from `.5/config.json` or the project manifest.
55
- - Do not skip a category because another category passed. Skip only when no command exists or the command is explicitly configured as `none`; record the reason.
56
- - If any command fails, continue running remaining independent categories so the user gets a complete verification picture.
57
- - Do not claim the review findings are fully addressed unless every discovered post-fix verification command passes or is explicitly skipped because no command exists.
58
- - Store compact results for each category in the summary: command, status (`passed`, `failed`, or `skipped`), and a one-line reason.
59
- 5. Write `.5/features/{feature}/review-summary-{YYYYMMDD-HHmmss}.md` using `.claude/templates/workflow/REVIEW-SUMMARY.md`.
60
-
61
- Keep all intermediate summaries compact. Do not paste raw diffs, raw PR JSON, or command logs unless a failure needs exact evidence.
62
-
63
- ## Local Decision Format
64
-
65
- Write JSON with this shape:
41
+ 3. Apply the fixes:
42
+ - Take every decision with `fix`. Use `customInstructions` when present; otherwise `suggestedFix`.
43
+ - Group fixes by file. Read each file before editing it.
44
+ - 1-3 simple fixes in a file: edit directly, highest line number first.
45
+ - 4+ fixes or complex logic in a file: spawn one focused agent with only the file path and its numbered fix list. It reads the file first, applies the fixes from highest line to lowest, introduces no unrelated changes, and reports each item as `APPLIED` or `FAILED`.
46
+ - Track each finding as `APPLIED`, `FAILED`, or `SKIPPED` (`wont_fix` and `wait`).
47
+ 4. Run post-fix verification. This is mandatory after any fix is applied.
48
+ - Identify the commands from `.5/config.json` and, only as needed, the project manifests (`package.json`, `Makefile`, `pyproject.toml`, `Cargo.toml`, Gradle files).
49
+ - Run every available command in these categories: `build`, `test`, `e2e`/`test:e2e`, and `lint`. Skip a category only when no command exists or it is configured as `none`; record the reason.
50
+ - If a command fails, still run the remaining independent categories.
51
+ - Do not claim the findings are addressed unless every discovered command passes or is skipped because no command exists.
52
+
53
+ Keep all intermediate summaries compact. Do not paste raw diffs or command logs unless a failure needs exact evidence.
54
+
55
+ ## Decision Format
66
56
 
67
57
  ```json
68
58
  {
@@ -74,7 +64,8 @@ Write JSON with this shape:
74
64
  "file": "path/to/file.ts",
75
65
  "line": 123,
76
66
  "decision": "fix",
77
- "recommendation": "fix",
67
+ "decidedBy": "claude",
68
+ "reason": "Confirmed off-by-one; local fix",
78
69
  "description": "Concise issue summary",
79
70
  "suggestedFix": "Concrete fix to apply",
80
71
  "customInstructions": ""
@@ -83,7 +74,7 @@ Write JSON with this shape:
83
74
  }
84
75
  ```
85
76
 
86
- Allowed `decision` values are `fix`, `wont_fix`, and `wait`.
77
+ Allowed `decision` values are `fix`, `wont_fix`, and `wait`. `decidedBy` is `claude` or `user`.
87
78
 
88
79
  ## Completion
89
80
 
@@ -92,13 +83,13 @@ Output:
92
83
  ```text
93
84
  Review findings addressed: {yes/no}
94
85
 
95
- Local findings: {summary}
96
- PR comments: {summary}
97
- PR replies: {posted/failed/skipped with reason}
98
- Post-fix verification: {passed/failed}
86
+ Fixed on my own: {N} — {one line per finding: id, file, what changed}
87
+ Decided by you: {N} ({fixed} fixed, {deferred} deferred)
88
+ Skipped: {N} — {one line per finding: id, reason}
89
+ Failed: {N}
99
90
  Build: {passed/failed/skipped}
100
91
  Tests: {passed/failed/skipped}
101
92
  E2E: {passed/failed/skipped}
102
93
  Lint: {passed/failed/skipped}
103
- Summary saved at .5/features/{feature}/review-summary-{timestamp}.md
94
+ Decisions saved at .5/features/{feature}/review-decisions-{timestamp}.json
104
95
  ```
@@ -30,7 +30,7 @@ Do NOT proceed until you have a clear understanding of what to analyze.
30
30
 
31
31
  1. Derive a short kebab-case name from the analysis subject (e.g., `user-auth`, `order-processing`, `payment-integration`). This becomes the filename: `{name}-analysis.md`.
32
32
 
33
- 2. Identify the relevant modules and layers to analyze. Invoke the `use-index` skill for a quick structural overview. The skill will rebuild the index if stale; fall back to Glob only if the index is missing.
33
+ 2. Identify the relevant modules and layers to analyze.
34
34
 
35
35
  3. Use Glob and Grep to locate the relevant source files. Search for key classes, interfaces, functions, and types related to the analysis subject.
36
36
 
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: 5:configure
3
- description: Configures the project. Analyzes project, gathers preferences, writes config.json, and creates .5/features/CONFIGURE/plan.md. Follow up with /5:implement CONFIGURE.
3
+ description: Configures the project. Analyzes project, gathers preferences, writes config.json, points Claude Code plan mode at .5/planning/, and creates .5/planning/CONFIGURE.md. Follow up with /5:implement CONFIGURE.
4
4
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion
5
5
  user-invocable: true
6
6
  ---
7
7
 
8
8
  <role>
9
9
  You are a Project Configurator. You analyze a project, gather preferences, and write config.json plus a unified plan.
10
- You do NOT generate AGENTS.md, CLAUDE.md, documentation files, or skills directly — those are /5:implement's job.
11
- You write ONLY to: .5/config.json, .5/version.json, .5/features/CONFIGURE/plan.md, and .gitignore.
10
+ You do NOT write AGENTS.md, CLAUDE.md, or rules directly — those are /5:implement's job.
11
+ You write ONLY to: .5/config.json, .5/version.json, .5/planning/CONFIGURE.md, .gitignore, and the `plansDirectory` key of .claude/settings.json (Claude Code only).
12
12
  After writing config.json and the unified plan, you are DONE. Exit immediately.
13
13
  </role>
14
14
 
@@ -18,11 +18,11 @@ Current commit: !`git rev-parse --short HEAD 2>/dev/null || echo "none"`
18
18
 
19
19
  ## Overview
20
20
 
21
- This command prepares project configuration. It analyzes the project, asks preference questions, writes `.5/config.json`, and writes a unified plan at `.5/features/CONFIGURE/plan.md`.
21
+ This command prepares project configuration. It analyzes the project, asks preference questions, writes `.5/config.json`, points Claude Code plan mode at `.5/planning/`, and writes a plan at `.5/planning/CONFIGURE.md`.
22
22
 
23
23
  After running this command, proceed through the standard phases:
24
24
  1. **`/5:configure`** (this command) - Create config and CONFIGURE plan
25
- 2. `/5:implement CONFIGURE` - Execute configuration (uses `configure-docs-index` and `configure-skills`)
25
+ 2. `/5:implement CONFIGURE` - Execute configuration (uses `configure-agents-md` and `configure-rules`)
26
26
  3. `/5:review` - Review generated files if desired
27
27
 
28
28
  ## ⚠️ CRITICAL SCOPE CONSTRAINT
@@ -33,19 +33,19 @@ Your job in this command:
33
33
  ✅ Analyze project (detect type, build commands, etc.)
34
34
  ✅ Gather user preferences via questions
35
35
  ✅ Write `.5/config.json` directly
36
- ✅ Create unified plan at `.5/features/CONFIGURE/plan.md` for remaining work
36
+ ✅ Set `plansDirectory` in `.claude/settings.json` (Claude Code only)
37
+ ✅ Create the plan at `.5/planning/CONFIGURE.md` for remaining work
37
38
  ✅ Tell user to run /5:implement CONFIGURE
38
39
 
39
40
  Your job is NOT:
40
- ❌ Create AGENTS.md or CLAUDE.md directly (/5:implement does this)
41
- ❌ Generate documentation files directly (/5:implement does this)
42
- ❌ Generate skills directly (/5:implement does this)
41
+ ❌ Write AGENTS.md or CLAUDE.md directly (/5:implement does this)
42
+ ❌ Generate rules directly (/5:implement does this)
43
43
  ❌ Skip user interaction
44
44
  ❌ Assume project structure
45
45
 
46
46
  **After writing config.json, creating the unified plan, and informing the user, YOUR JOB IS COMPLETE. EXIT IMMEDIATELY.**
47
47
 
48
- **If you find yourself creating AGENTS.md, CLAUDE.md, documentation files, or skills, STOP IMMEDIATELY. You should only be writing config.json and the unified plan.**
48
+ **If you find yourself writing AGENTS.md, CLAUDE.md, or rules, STOP IMMEDIATELY. You should only be writing config.json, the settings key, and the plan.**
49
49
 
50
50
  ## Configuration Process
51
51
 
@@ -75,23 +75,16 @@ fi
75
75
 
76
76
  # Context7 - up-to-date documentation MCP server
77
77
  # Check if context7 tools are available (resolve-library-id, query-docs)
78
-
79
- # skill-creator plugin — helps create better project-specific skills
80
- # Check if skill-creator tools are available by looking for known tool names
81
- # in the current session (e.g., create-skill, scaffold-skill).
82
- # Set skill_creator_available=true if any skill-creator tool is found.
83
78
  ```
84
79
 
85
80
  **1e. Check AGENTS.md / CLAUDE.md:**
86
- - If `AGENTS.md` exists, read its content
87
- - If `AGENTS.md` does not exist but `CLAUDE.md` exists with real content (not just `@AGENTS.md`), read it — this is a legacy setup that will be migrated to AGENTS.md during planning
88
-
89
- **1f. Scan existing skills:**
90
- - Check `.claude/skills/` for existing project-specific skills
91
-
92
- **1g. Detect codebase patterns** — Read `.claude/references/configure-tables.md` section "Codebase Pattern Categories to Scan" for the full list and scanning approach.
81
+ - Read `AGENTS.md` and `CLAUDE.md` if they exist. Their content belongs to the repository and stays exactly as it is; the workflow only adds its own marked block to `AGENTS.md` and an `@AGENTS.md` line to `CLAUDE.md`.
82
+ - Note the build/test commands and the commit convention they already document, so the questions below can skip them.
93
83
 
94
- **1h. Detect runnable commands** — Read `.claude/references/configure-tables.md` section "Runnable Command Categories" for categories and scanning approach.
84
+ **1e2. Find repository standards:**
85
+ - Find the files `.claude/skills/review-style/SKILL.md` step 2 counts as repository standards, such as `CONTRIBUTING.md` or `CODESTYLE.md`. Note each path.
86
+ - These always win over the workflow's own rules. AGENTS.md links them, and generated rules must not contradict them.
87
+ - Note whether one of them documents a commit message convention.
95
88
 
96
89
  ### Step 2: Gather User Preferences (interactive via AskUserQuestion)
97
90
 
@@ -149,7 +142,9 @@ If "Cancel": Exit immediately with message "Configuration unchanged."
149
142
  1. "No (recommended)" → `git.autoCommit: false`
150
143
  2. "Yes - commit after each implementation step" → `git.autoCommit: true`
151
144
 
152
- **2g. Commit message pattern (only if auto-commit = Yes):**
145
+ **2g. Commit message pattern:**
146
+
147
+ When the repository already documents a commit convention (step 1e or 1e2), that convention wins and AGENTS.md links it. Skip the question, and derive the closest pattern from the convention with the `{ticket-id}` and `{short-description}` placeholders — for example `feat({ticket-id}): {short-description}` for Conventional Commits — and store it as `git.commitMessage.pattern`, so auto-commits follow the convention too. Otherwise ask:
153
148
  - "What commit message format would you like?"
154
149
  - Options:
155
150
  1. "Default: `{ticket-id} {short-description}` (Recommended)"
@@ -170,23 +165,8 @@ Context7 provides up-to-date, version-specific documentation and code examples d
170
165
  2. "Skip"
171
166
  - If user selects "Install now": execute the install command
172
167
 
173
- **2i. skill-creator plugin:**
174
-
175
- The skill-creator plugin from the official Claude store helps generate higher-quality project-specific skills with structured authoring guidance.
176
-
177
- - If skill-creator was detected in Step 1d:
178
- - "skill-creator plugin is already installed. ✓"
179
- - Set `tools.skillCreator.available = true` in the config
180
- - If skill-creator was NOT detected:
181
- - "Would you like to install the skill-creator plugin? It helps generate higher-quality project-specific skills."
182
- - Options:
183
- 1. "Install now (recommended)" — run `claude plugin install skill-creator@claude-plugins-official` via Bash
184
- 2. "Skip"
185
- - If user selects "Install now": execute the install command, then set `tools.skillCreator.available = true` in the config
186
- - If user selects "Skip": `tools.skillCreator.available` remains `false`
187
-
188
168
  **2j. Confirm AGENTS.md generation:**
189
- - "Generate/update AGENTS.md? This will analyze your codebase to document structure and conventions. (A CLAUDE.md shim will also be created for Claude Code compatibility.)"
169
+ - "Add the workflow rules to AGENTS.md? They go into one marked block that links your repository's own standards; nothing else in AGENTS.md or CLAUDE.md changes. CLAUDE.md gets an `@AGENTS.md` line if it lacks one."
190
170
  - Options: "Yes (recommended)", "Skip"
191
171
 
192
172
  **2j2. Confirm rules generation:**
@@ -194,58 +174,12 @@ The skill-creator plugin from the official Claude store helps generate higher-qu
194
174
  - Options: "Yes (recommended)", "Skip"
195
175
  - Note: Rules complement AGENTS.md — they provide focused, file-type-scoped directives derived from your project's actual conventions.
196
176
 
197
- **2k. Review detected patterns for skill generation:**
198
-
199
- Present ONLY patterns that were actually detected in steps 1g and 1h.
200
-
201
- **Part 1: Architectural patterns (create-* skills)**
202
-
203
- "I analyzed your codebase and found these architectural patterns:
204
-
205
- | Pattern | Files Found | Location | Example |
206
- |---------|-------------|----------|---------|
207
- | Controller | 12 files | src/controllers/ | UserController.ts |
208
- | Service | 8 files | src/services/ | AuthService.ts |
209
- | Component | 25 files | src/components/ | Button.tsx |
210
-
211
- Which patterns would you like `create-*` skills generated for?"
212
-
213
- - Options: Multi-select checkboxes for each detected pattern (use AskUserQuestion with multiSelect: true)
214
- - Include descriptions like: "Controller (12 files) - Generate `create-controller` skill"
215
- - Plus "Other" option for patterns not detected but desired
216
-
217
- **Part 2: Command skills (run-* skills)**
218
-
219
- "I also found these runnable commands:
220
-
221
- | Command | Source | Full Command | Variants |
222
- |---------|--------|--------------|----------|
223
- | build | package.json | npm run build | build:prod, build:dev |
224
- | test | package.json | npm test | test:unit, test:e2e |
225
- | lint | package.json | npm run lint | lint:fix |
226
- | format | Makefile | make format | - |
227
-
228
- Which commands would you like `run-*` skills generated for?"
229
-
230
- - Options: Multi-select checkboxes for each detected command
231
- - Include descriptions like: "test - Generate `run-tests` skill"
232
- - Plus "Other" option for commands not detected
233
-
234
- If no patterns/commands detected:
235
- - Inform user: "No common patterns detected. Would you like to specify patterns manually?"
236
- - Allow manual entry of pattern names/locations or command names
237
-
238
- **2l. Git-ignore `.5/features/` folder:**
239
- - "The `.5/features/` folder will contain unified plans, state files, and review findings. Would you like to add it to `.gitignore`?"
177
+ **2l. Git-ignore workflow folders:**
178
+ - "`.5/planning/` will hold your plans. `.5/features/` will hold implementation state and review findings. Which should git ignore?"
240
179
  - Options:
241
- 1. "Yes, add to .gitignore (recommended)" — workflow artifacts stay local, not tracked in version control
242
- 2. "No, track in git" — useful if you want to share specs and plans with your team
243
-
244
- **2m. Code Conventions:**
245
- - "Generate `.5/CONVENTIONS.md` with coding conventions for this project? It will include a default set of strict rules (typing, code structure, naming, error handling, testing, and documentation standards) plus project-specific conventions derived from your codebase."
246
- - Options:
247
- 1. "Yes (recommended)" → `conventions.generate: true`
248
- 2. "Skip" → `conventions.generate: false`
180
+ 1. "Both (recommended)" — workflow artifacts stay local
181
+ 2. "Only `.5/features/`" — share plans with your team, keep state local
182
+ 3. "Neither" — track plans, state, and findings in git
249
183
 
250
184
  ### Step 2.5: Write config.json
251
185
 
@@ -259,7 +193,7 @@ Using the values gathered from Steps 1 and 2, write `.5/config.json` directly.
259
193
  mkdir -p .5
260
194
  ```
261
195
 
262
- **Schema:** Read `.claude/references/configure-tables.md` section "Config Schema" for the full JSON structure. Fill all values from user responses (including `rules.generate` from step 2j2 and `conventions.generate` from step 2m). Write with pretty-printed JSON. Read back to verify correctness.
196
+ **Schema:** Read `.claude/references/configure-tables.md` section "Config Schema" for the full JSON structure. Fill all values from user responses (including `rules.generate` from step 2j2). Write with pretty-printed JSON. Read back to verify correctness.
263
197
 
264
198
  **Update `.5/version.json` with configure timestamp:**
265
199
 
@@ -269,13 +203,20 @@ After writing config.json, update `.5/version.json` so the reconfigure reminder
269
203
  3. Set `configuredAtCommit` to the current short commit hash injected at the top of this command
270
204
  4. Write back `.5/version.json` preserving all other fields
271
205
 
206
+ **Point plan mode at `.5/planning/` (Claude Code only — skip on Codex):**
207
+
208
+ Native plan mode must save its plans in `.5/planning/`, where `/5:implement` finds them.
209
+ 1. Read `.claude/settings.json` if it exists.
210
+ 2. If `plansDirectory` is missing, set it to `".5/planning"` and keep every other key unchanged. Create the file if it does not exist.
211
+ 3. If `plansDirectory` already holds a different value, ask whether to switch it to `.5/planning`. Explain that `/5:implement` finds plans only there, unless it gets a plan path.
212
+ 4. Inform the user: "Plan mode now saves plans in `.5/planning/`"
213
+
272
214
  **Apply `.gitignore` if selected:**
273
215
 
274
- If the user chose to gitignore the `.5/features/` folder:
275
- 1. Check if `.gitignore` exists in the project root
276
- 2. If it exists, check if `.5/features/` is already listed — if not, append `.5/features/` on a new line
277
- 3. If `.gitignore` does not exist, create it with `.5/features/` as the first entry
278
- 4. Inform the user: "Added `.5/features/` to `.gitignore`"
216
+ For each folder the user chose to ignore in step 2l (`.5/planning/`, `.5/features/`):
217
+ 1. Check if `.gitignore` exists in the project root — create it if not
218
+ 2. Check if the folder is already listed — if not, append it on a new line
219
+ 3. Inform the user which folders were added to `.gitignore`
279
220
 
280
221
  **Always gitignore `.5/.reconfig-reminder`:**
281
222
 
@@ -285,7 +226,7 @@ Ensure `.5/.reconfig-reminder` is gitignored (it's a transient runtime flag that
285
226
 
286
227
  ### Step 3: Create Configuration Plan
287
228
 
288
- Write `.5/features/CONFIGURE/plan.md` containing all gathered data:
229
+ Write `.5/planning/CONFIGURE.md` containing all gathered data:
289
230
 
290
231
  ```markdown
291
232
  ---
@@ -297,131 +238,86 @@ created: {ISO-timestamp}
297
238
  # Plan: CONFIGURE - Project Configuration
298
239
 
299
240
  ## Overview
300
- Generates AGENTS.md, CLAUDE.md shim, a rebuildable codebase index, and project-specific skills. (config.json already written.)
241
+ Adds the workflow block to AGENTS.md, includes AGENTS.md from CLAUDE.md, and generates scoped rules. (config.json and the plans directory setting are already written.)
301
242
 
302
243
  ## What Changes
303
244
 
304
- - Generate focused documentation and a rebuildable codebase index.
305
- - Generate selected project-specific skills and scoped rules.
306
- - Preserve existing user-authored AGENTS.md/CLAUDE.md content.
245
+ - Write the workflow block into AGENTS.md, linking the repository's own standards.
246
+ - Generate scoped rules from detected conventions, when selected.
247
+ - Leave all existing AGENTS.md/CLAUDE.md content unchanged.
307
248
 
308
249
  ## Existing Patterns to Follow
309
250
 
310
- - `.claude/skills/configure-docs-index/SKILL.md` - documentation and index generation behavior.
311
- - `.claude/skills/configure-skills/SKILL.md` - skill and rule generation behavior.
251
+ - `.claude/skills/configure-agents-md/SKILL.md` - the AGENTS.md block and the CLAUDE.md include.
252
+ - `.claude/skills/configure-rules/SKILL.md` - rule generation behavior.
312
253
 
313
254
  ## Constraints
314
255
 
315
256
  - config.json is already written by `/5:configure`.
316
- - Do not generate empty placeholder documentation or index files.
317
- - Preserve user-authored sections in AGENTS.md.
257
+ - Repository standards win over the workflow's own rules. Generated rules must not restate or contradict them.
258
+ - Change nothing outside the foifi block in AGENTS.md, and only append `@AGENTS.md` to CLAUDE.md.
259
+ - Never rewrite or delete existing `.5/*.md` docs. Teams may maintain them.
318
260
 
319
261
  ## Scope
320
262
 
321
263
  ### In
322
264
 
323
- - Documentation files under `.5/`.
324
- - `.5/index/` and rebuild script.
325
- - AGENTS.md plus CLAUDE.md shim.
326
- - Selected create/run skills.
265
+ - The foifi block in AGENTS.md plus the CLAUDE.md include.
327
266
  - Selected scoped rules.
328
267
 
329
268
  ### Out
330
269
 
331
270
  - Changing preferences already saved in `.5/config.json`.
271
+ - Generated architecture, testing, concerns, or conventions docs, codebase indexes, and project-specific skills.
332
272
 
333
273
  ## Acceptance Criteria
334
274
 
335
- - [ ] `.5/ARCHITECTURE.md` exists when architecture knowledge was found.
336
- - [ ] `.5/TESTING.md` exists when test knowledge was found.
337
- - [ ] `.5/CONCERNS.md` exists only if concerns were found.
338
- - [ ] `.5/CONVENTIONS.md` exists when `conventions.generate` is true.
339
- - [ ] `.5/index/rebuild-index.sh` exists and rebuilds the index.
340
- - [ ] `.5/index/README.md` documents generated index files.
341
- - [ ] `AGENTS.md` references created `.5/` files and the index rebuild rule.
342
- - [ ] `CLAUDE.md` contains only `@AGENTS.md`.
343
- - [ ] Selected project-specific skills are generated in `.claude/skills/`.
344
- - [ ] Selected scoped rules are generated in `.claude/rules/`.
345
- - [ ] User-written AGENTS.md/CLAUDE.md content is preserved.
275
+ - [ ] The foifi block in `AGENTS.md` links every repository standard listed below.
276
+ - [ ] `CLAUDE.md` includes `@AGENTS.md`.
277
+ - [ ] Selected scoped rules are generated in `.claude/rules/` — on Codex, as the `File-Scoped Rules` section in the foifi block of `AGENTS.md` instead.
278
+ - [ ] Content outside the foifi block in AGENTS.md and CLAUDE.md is byte-for-byte unchanged.
346
279
 
347
280
  ## Decisions
348
281
 
349
- - [DECIDED] Use the detected project type, build command, test command, ticket settings, review tool, and selected patterns from this configure session.
350
- - [FLEXIBLE] Omit optional generated files when no useful project knowledge exists.
282
+ - [DECIDED] Use the detected project type, build command, test command, ticket settings, and commit convention from this configure session.
283
+ - [FLEXIBLE] Omit optional rules when no useful project knowledge exists.
351
284
  - [DEFERRED] Further preference changes; rerun `/5:configure` for those.
352
285
 
353
286
  ## Module Impact
354
287
 
355
288
  | Module/Area | Impact |
356
289
  |-------------|--------|
357
- | `.5/` | Create/update documentation and index artifacts. |
358
- | `AGENTS.md` / `CLAUDE.md` | Create or update provider instructions. |
359
- | `.claude/skills/` | Create selected project-specific skills. |
360
- | `.claude/rules/` | Create selected scoped rules. |
290
+ | `AGENTS.md` / `CLAUDE.md` | Add or refresh the foifi block; include AGENTS.md from CLAUDE.md. |
291
+ | `.claude/rules/` (Codex: `AGENTS.md`) | Create selected scoped rules. |
361
292
 
362
293
  ## Component Checklist
363
294
 
364
295
  | Component | Action | Target Path | Intent |
365
296
  |-----------|--------|-------------|--------|
366
- | configure docs and index | create | `.5/` | Generate project documentation, codebase index, AGENTS.md, and CLAUDE.md shim. |
367
- | configure skills and rules | create | `.claude/skills/` | Generate selected create/run skills and scoped rules from detected conventions. |
297
+ | configure agents md | modify | `AGENTS.md` | Write the foifi block into AGENTS.md and include it from CLAUDE.md, linking the repository standards. |
298
+ | configure rules | create | `.claude/rules/` (Codex: `AGENTS.md`) | After configure agents md: generate scoped rules from detected conventions — on Codex, as the `File-Scoped Rules` section in the foifi block of `AGENTS.md`. |
368
299
 
369
300
  ## Technical Notes
370
301
 
371
- Analyze the codebase and generate focused documentation capturing only non-derivable knowledge (skip version numbers, dependency lists, directory layouts, linter configs — Claude Code can look these up directly):
372
-
373
- **Create documentation files in `.5/` folder:**
374
- - `.5/ARCHITECTURE.md` - Architecture pattern, layers & data flow, key abstractions, non-obvious conventions, where to add new code
375
- - `.5/TESTING.md` - Test organization, patterns, mocking approach, gotchas
376
- - `.5/CONCERNS.md` - Tech debt, known issues, security/integration/performance notes (**only if concerns found — skip file entirely if nothing detected**)
377
- - `.5/CONVENTIONS.md` - Default strict coding conventions plus project-specific conventions derived from codebase analysis (**only when `conventions.generate` is true**)
378
-
379
- **Create a rebuildable codebase index in `.5/index/`:**
380
- - Generate a repository-local script at `.5/index/rebuild-index.sh`
381
- - Generate multiple focused Markdown index files in `.5/index/` plus `.5/index/README.md`
382
- - Keep the index generic and adapted to the actual project
383
- - Skip empty categories; do not create placeholder index files
384
- - Re-running the script should fully refresh the index in place
385
-
386
- **Create AGENTS.md** (provider-agnostic instructions file):
387
- - Use `.claude/templates/AGENTS.md` as the source template
388
- - Fill `{PROJECT_OVERVIEW}` with 1-2 sentences from README/package.json
389
- - Fill `{BUILD_RUN_COMMANDS}` with build, test, and other detected commands
390
- - Fill `{PROJECT_DOCUMENTATION_LINKS}` with whichever `.5/` documentation files were created
391
- - Fill `{CODEBASE_INDEX_LINKS}` with `.5/index/README.md`, generated index files, and `.5/index/rebuild-index.sh`
392
- - Fill `{CUSTOM_DOCUMENTATION}` with preserved user-authored sections under `## Custom Documentation`; remove the placeholder if there is no custom content
393
- - Preserve static template sections exactly as written, including skill usage, commit messages, workflow rules, coding guidelines, simplicity, testing, surgical changes, goal-driven execution, and index freshness
394
-
395
- **Create CLAUDE.md shim:**
396
- - Contains only `@AGENTS.md` (Claude Code include syntax)
397
-
398
- **Migrate and preserve existing content:**
399
- - If AGENTS.md already exists, preserve user-written custom sections
400
- - If CLAUDE.md exists with real content (not just `@AGENTS.md`), migrate content to AGENTS.md and replace CLAUDE.md with the shim
401
-
402
- ### Requirement 2: Generate Project-Specific Skills
403
- Handled by: `configure-skills`
404
-
405
- **Create-* skills** for each user-selected architectural pattern:
406
- - Skill name: `create-{pattern}` (e.g., `create-controller`, `create-service`)
407
- - Analyze 2-3 existing files, extract conventions, generate SKILL.md with project-specific template
408
- - Set `user-invocable: true`, `model: haiku`
302
+ ### Requirement 1: Write AGENTS.md
303
+ Handled by: `configure-agents-md`
409
304
 
410
- **Run-* skills** for each user-selected command:
411
- - Skill name: `run-{category}` (e.g., `run-tests`, `run-lint`)
412
- - Document exact command syntax, variants, flags
413
- - Set `user-invocable: true`, `model: haiku`
305
+ **Repository standards found:**
306
+ - {one bullet per path from step 1e2, or "none found"}
414
307
 
415
- Include only patterns/commands where user selected "Generate".
308
+ **Write the foifi block into AGENTS.md** as `configure-agents-md` describes:
309
+ - Fill the template from `.claude/templates/AGENTS.md`: build/run commands, the commit message rule, the repository standards above, and links to existing `.5/*.md` docs
310
+ - Never change content outside the block; append `@AGENTS.md` to CLAUDE.md only when it lacks that line
416
311
 
417
- ### Requirement 3: Generate Scoped Rules (if selected)
418
- Handled by: `configure-skills`
312
+ ### Requirement 2: Generate Scoped Rules (if selected)
313
+ Handled by: `configure-rules`. Runs after Requirement 1: on Codex, Codex reads only `AGENTS.md`, so the rules go into its foifi block instead of rule files.
419
314
 
420
315
  Generate `.claude/rules/` files with project-specific conventions scoped to relevant file types.
421
316
  Rules are concise directives (15-40 lines, NOT documentation) derived from codebase analysis.
317
+ They must not restate or contradict the repository standards above.
422
318
  Only generate rules for patterns that were actually detected:
423
319
  - `code-style.md` — naming, formatting, import conventions (scoped to source files)
424
- - `testing.md` — test patterns, mocking, fixtures (scoped to test files)
320
+ - `testing.md` — test patterns, mocking, fixtures, gotchas (scoped to test files)
425
321
  - `api-patterns.md` — API conventions, error handling (scoped to API/route/controller files)
426
322
  - `dependencies.md` — dependency usage patterns, env var conventions (unconditional)
427
323
 
@@ -430,19 +326,19 @@ Only generate rules for patterns that were actually detected:
430
326
  1. Run `/5:implement CONFIGURE`.
431
327
  ```
432
328
 
433
- **Important:** Use `mkdir -p .5/features/CONFIGURE` before writing the unified plan.
329
+ **Important:** Use `mkdir -p .5/planning` before writing the plan.
434
330
 
435
331
  ### Step 4: Guide User to Next Phase
436
332
 
437
333
  Tell the user:
438
334
 
439
335
  1. "Configuration saved to `.5/config.json`"
440
- 2. "Configuration plan written to `.5/features/CONFIGURE/plan.md`"
336
+ 2. "Configuration plan written to `.5/planning/CONFIGURE.md`"
441
337
  3. "Next steps:"
442
338
  - "Run `/clear` to reset context"
443
339
  - "Then run `/5:implement CONFIGURE`"
444
340
  4. "After that: Run `/5:review` if you want a review of generated files"
445
341
 
446
342
  ## Related Documentation
447
- - [configure-docs-index skill](../../skills/configure-docs-index/SKILL.md)
448
- - [configure-skills skill](../../skills/configure-skills/SKILL.md)
343
+ - [configure-agents-md skill](../../skills/configure-agents-md/SKILL.md)
344
+ - [configure-rules skill](../../skills/configure-rules/SKILL.md)
@@ -54,7 +54,6 @@ Tell the user what ejecting means:
54
54
  > For Codex installs:
55
55
  > - `.codex/skills/5-update/` (update skill)
56
56
  > - `.codex/skills/5-eject/` (this skill)
57
- > - `.codex/instructions.md` is removed only if it is workflow-managed and no longer needed for remaining installed workflow files
58
57
  >
59
58
  > All other workflow files remain untouched. To restore updates later, reinstall with `npx foifi`.
60
59