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
package/README.md CHANGED
@@ -1,131 +1,57 @@
1
1
  # foifi
2
2
 
3
- **foifi** is an opinionated AI development workflow layer that sits on top of Claude Code and Codex. It handles project setup, structured feature implementation, and code review — so you spend less time managing the AI and more time shipping.
3
+ ## Vision
4
4
 
5
- ### What it does
5
+ Install foifi in a project and it sets up Claude Code (or Codex) for you, so you don't have to micromanage the AI setup. The result is an assistant that:
6
6
 
7
- **Project setup** — The `/5:configure` command detects your stack, generates a `CLAUDE.md` / `AGENTS.md` tailored to your project, writes a `.5/index/` knowledge base, and installs project-specific skills and rules. This gives every AI session the right context from the start rather than letting the model guess.
7
+ - **plans well**, and backs its plans with diagrams where a picture explains more than text
8
+ - **writes good, stable, well-structured, and secure code**, and prefers clean code
9
+ - **reviews its own work automatically** before you see it
8
10
 
9
- **Status line** — foifi installs a Claude Code status line that surfaces the installed version, available updates, and pending reconfigure/migration reminders directly in the terminal footer.
11
+ Two rules keep foifi honest:
10
12
 
11
- **Structured implementation workflow** — Instead of asking Claude or Codex to "just implement this," foifi enforces a three-phase loop:
12
- 1. **Plan** (`/5:plan`) — wraps Claude Code's native plan mode and persists the approved result as a single human-reviewed `plan.md` with scope, acceptance criteria, component checklist, and decisions. Run it again on the same feature to refine that plan. Small plans are implemented right there on approval; larger ones hand off to step 2.
13
- 2. **Implement** (`/5:implement`) — an orchestrator agent turns the plan into a typed execution graph, then delegates each component to a focused executor agent, firing independent components in parallel waves. A verification agent checks completeness, correctness, and test coverage at the end of every run.
14
- 3. **Review** (`/5:review`) — wraps Claude Code's built-in `code-review` skill, produces structured findings, and feeds them into `/5:address-review-findings` for interactive fix decisions and PR replies.
15
-
16
- This separation keeps planning readable, implementation mechanical, and review structured. Where Claude Code ships a native capability, foifi wraps it rather than reimplementing it — what foifi adds is the durable repo-local artifact and the ticket/config conventions around it.
17
-
18
- **Code review and findings** — `/5:review` triages changed files and produces structured `review-findings-*.md`. `/5:address-review-findings` presents each finding interactively, records `fix`/`wont_fix`/`wait` decisions, applies approved local fixes, handles PR comment replies, and keeps a decision log — all without losing context between sessions.
19
-
20
- **Plan management helpers** — `/5:split` breaks a large plan into smaller linked child plans. `/5:reconfigure` refreshes docs and skills when the project evolves.
21
-
22
- **Codex support** — Every command has a `$5-*` Codex equivalent. Codex runs are token-budgeted: simple steps use a lighter model and low reasoning, complex or security-sensitive steps escalate automatically.
23
-
24
- ### The name
25
-
26
- "foifi" is Swiss German for *five*. The name comes from the project's original 5-phase workflow. That workflow has since been streamlined into the current 3-phase plan → implement → review loop, but the name stuck — and all commands still carry the `/5:` prefix.
13
+ - **Stay lean.** What Claude Code already does well — plan mode, code review, exploring the code — foifi uses as it is. foifi adds only the glue: conventions, durable artifacts, and checks. It never runs a parallel process that competes with the native one.
14
+ - **Your standards win.** foifi reads the standards a project already has, such as `CONTRIBUTING.md`, a code style guide, or an existing `CLAUDE.md` / `AGENTS.md`, and follows them. It never overwrites them. Its own style rules only fill the gaps a project leaves open.
27
15
 
28
16
  ## Install
29
17
 
30
18
  ```bash
31
- npx foifi
32
- npx foifi --codex
19
+ npx foifi # Claude Code, this project
20
+ npx foifi --codex # Codex
21
+ npx foifi --global # all projects (~/.claude/)
33
22
  ```
34
23
 
35
- Global installs are also supported:
36
-
37
- ```bash
38
- npx foifi --global
39
- npx foifi --codex --global
40
- ```
41
-
42
- Claude Code installs commands under `.claude/`. Codex installs converted skills under `.codex/skills/`.
43
-
44
- ## Configure
45
-
46
- Run configuration once per project:
24
+ Then configure the project once:
47
25
 
48
26
  ```bash
49
27
  /5:configure
50
- # or in Codex
51
- $5-configure
52
- ```
53
-
54
- Configuration writes `.5/config.json` and `.5/features/CONFIGURE/plan.md`. Then run:
55
-
56
- ```bash
57
28
  /5:implement CONFIGURE
58
- # or
59
- $5-implement CONFIGURE
60
29
  ```
61
30
 
62
- That generates project documentation, a rebuildable `.5/index/`, AGENTS.md, a CLAUDE.md shim, and selected project-specific skills/rules.
31
+ This adds the foifi rules to `AGENTS.md` as one marked block, links your existing standards from it, and makes `CLAUDE.md` include it. Nothing else in your files or settings changes.
63
32
 
64
33
  ## Workflow
65
34
 
66
- ```bash
67
- /5:plan
68
- /5:split {feature-name}
69
- /5:implement {feature-name}
70
- /5:review
71
- /5:address-review-findings {feature-name}
72
- ```
73
-
74
- Codex equivalents:
75
-
76
- ```bash
77
- $5-plan
78
- $5-split {feature-name}
79
- $5-implement {feature-name}
80
- $5-review
81
- $5-address-review-findings {feature-name}
82
- ```
35
+ 1. **Plan** — use Claude Code's plan mode (shift+tab). Plans include a mermaid diagram where it helps.
36
+ 2. **Approve** — Claude runs `/5:implement` on its own: small plans directly, larger ones with parallel agents. It checks that the build and tests pass.
37
+ 3. **Review** — runs automatically after the implementation: correctness, security, and your standards. Claude fixes the clear findings itself and asks you only about real decisions, one question at a time.
83
38
 
84
- Verification runs at the end of `/5:implement` and records a concise result in `state.json`.
39
+ On Codex, start with `$5-plan`; the rest is the same.
85
40
 
86
41
  ## Commands
87
42
 
88
43
  | Command | Purpose |
89
44
  |---------|---------|
90
- | `/5:configure` / `$5-configure` | Detect project settings and write the CONFIGURE plan |
91
- | `/5:plan` / `$5-plan` | Create one unified `plan.md` from requirements, codebase exploration, and user decisions — or refine an existing one |
92
- | `/5:split` / `$5-split` | Split an existing plan into smaller linked plans for separate implementation |
93
- | `/5:implement` / `$5-implement` | Derive the execution graph, execute steps with agents, and verify inline |
94
- | `/5:review` / `$5-review` | Review code changes and save findings |
95
- | `/5:commit` / `$5-commit` | Create a git commit using the configured commit message template |
96
- | `/5:address-review-findings` / `$5-address-review-findings` | Decide on review findings interactively, then apply approved fixes and PR comments |
97
- | `/5:reconfigure` / `$5-reconfigure` | Refresh docs, index, skills, and rules |
98
- | `/5:update` / `$5-update` | Upgrade installed workflow files |
99
- | `/5:eject` / `$5-eject` | Stop workflow-managed updates |
100
- | `/5:synchronize-agents` / `$5-synchronize-agents` | Sync user content between Claude Code and Codex |
101
-
102
- ## Artifacts
103
-
104
- Each feature lives under `.5/features/{feature-name}/`:
105
-
106
- - `plan.md` - single human-reviewed planning artifact
107
- - `codebase-scan.md` - cached discovery used to reduce repeated scanning
108
- - `state.json` - small resume record: status, completed components, verification result
109
- - `split-manifest-*.json` - parent feature record for child plans created by `/5:split`
110
- - `review-findings-*.md` - review output for `/5:address-review-findings`
111
- - `review-decisions-*.json` - interactive fix/wont-fix/wait decisions for local findings
112
- - `pr-comment-decisions.json` - PR review comment decisions when PR handling is used
113
-
114
- ## Design
45
+ | `/5:implement [plan]` | Implement a plan (runs automatically after approval) |
46
+ | `/5:review [low\|medium\|high\|max]` | Review any change on its own |
47
+ | `/5:address-review-findings [--interactive]` | Address saved review findings again; `--interactive` asks about each one |
48
+ | `/5:lean-check` | Check a diff for scope drift and over-engineering |
49
+ | `/5:analyze-feature` | Document an existing feature with diagrams |
50
+ | `/5:configure` / `/5:reconfigure` | Set up the project / refresh the AGENTS.md block and rules |
51
+ | `/5:update` / `/5:eject` | Update foifi / stop automatic updates |
52
+ | `/5:synchronize-agents` | Sync your own skills and rules between Claude Code and Codex |
115
53
 
116
- Planning stays human-readable. Claude Code's native plan mode does the exploring, the asking, and the approval gate; `/5:plan` contributes the ticket lookup, the feature folder convention, and the artifact schema, then persists the approved plan. `plan.md` contains scope, acceptance criteria, decisions, module impact, and a clean component checklist. Small low-risk changes can use the compact plan template. Plans intentionally do not ask the planner to fill model choices, verify commands, step grouping, or pattern-file wiring.
117
-
118
- Delegation is matched to the size of the job. Approving a plan means you want it built, so `/5:plan` finishes compact plans itself — for one or two files, the already-warm session beats anything an orchestrator can set up. Full plans go to `/5:implement`, where the cost is repaid: `step-orchestrator-agent` reads `plan.md` and `codebase-scan.md` and returns an execution graph, then each component goes to a `step-executor-agent` with an inline executor contract, independent components firing in parallel. Pattern context is passed as targeted references instead of broad file lists so executors read only the relevant ranges, and mechanical components run on a cheaper model than the ones that need reasoning.
119
-
120
- State is kept to what is actually read. The execution graph is derived fresh on every run and never written to disk; `state.json` persists only the status, the completed component names, and the verification result, which is all a resume needs. Component names are copied verbatim from the plan's checklist, so a re-derived graph still matches what already ran. Live progress comes from the task list, not from a file.
121
-
122
- Verification uses a dedicated agent. `/5:implement` runs `verification-agent` at the end, passing it the pre-change baseline so pre-existing failures are not blamed on the change, and records a concise final status without generating an extra report.
123
-
124
- Review delegates to Claude Code's built-in `code-review` skill (default effort `high`, override with `/5:review {low|medium|high|max}`) and maps its findings into the workflow's findings file. Where that skill is unavailable — Codex, for example — a built-in review agent takes over and triages changed files by risk instead. `/5:address-review-findings` presents each finding one by one with a recommendation, records `fix`/`wont_fix`/`wait` decisions, then coordinates narrower helpers for approved local fixes, PR comment triage, and PR replies so the common path stays compact.
125
-
126
- Reconfiguration uses a compact `.5/reconfigure-manifest.json` to pass refresh decisions to documentation and skill generation helpers without duplicating long detection summaries in prompts.
127
-
128
- For Codex installs, the workflow is token-budgeted: exploration, orchestration, and simple executors default to `gpt-5.4-mini` with low reasoning. Complex logic, security-sensitive work, data migrations, public API changes, final verification that needs deeper review, and failed retries escalate to `gpt-5.4` with medium reasoning.
54
+ Codex uses `$5-…` instead of `/5:…`.
129
55
 
130
56
  ## Updating
131
57
 
@@ -134,4 +60,8 @@ npx foifi --upgrade
134
60
  npx foifi --codex --upgrade
135
61
  ```
136
62
 
137
- v2.0.0 is a hard migration. Finish in-progress v1.9.5 features before upgrading; v1 `feature.md` and old `state.json` formats are not supported.
63
+ The status line shows when an update is available. Run `/5:reconfigure` after a major version.
64
+
65
+ ## The name
66
+
67
+ "foifi" is Swiss German for *five*. The name comes from the original 5-phase workflow; the commands still carry the `/5:` prefix.