kaizen-agent 1.7.4 → 1.7.5

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.
@@ -1,440 +1,440 @@
1
- ---
2
- name: kaizen
3
- description: >
4
- Staged workflow for any kind of work: plan, human approval, build, then independent
5
- review with a bounded fix loop. Not only for code — a run infers its own track (code,
6
- writing, communication, operations, research) and every stage reads "deliverable",
7
- "verification", and "finding" in that track's terms. Each stage runs as its own
8
- subagent with clean context, and all state lives in a portable `.kaizen/` directory so
9
- a run can be resumed later, by another session, or by another AI tool (Codex,
10
- Antigravity). Use when the user says "kaizen", "/kaizen", asks to plan-then-build-then-review
11
- something, wants approval steps before work begins, or wants to resume or check an
12
- existing kaizen run. Also use to install the workflow into a repository.
13
- ---
14
-
15
- # Kaizen
16
-
17
- A staged workflow for non-trivial development work:
18
-
19
- ```
20
- request -> PLAN -> [approval] -> IMPLEMENT -> REVIEW -> [fix loop] -> [approval] -> done
21
- ```
22
-
23
- Three separate subagents do the work. They never share a context window, which is
24
- the point: a reviewer that watched the code being written will rationalize it, a
25
- reviewer that sees only the diff and the plan will not.
26
-
27
- The stage contract is split so no reader loads a stage it is not running:
28
- [`spec.md`](spec.md) is the core (track, intake, resume) and every reader takes it,
29
- plus exactly one of [`spec-plan.md`](spec-plan.md), [`spec-build.md`](spec-build.md),
30
- [`spec-review.md`](spec-review.md), or [`spec-main.md`](spec-main.md) — the main
31
- thread's own file. Read core plus your stage before running it; do not read the
32
- others. Configuration defaults are in [`config.default.yml`](config.default.yml).
33
- Porting the workflow to Codex or Antigravity is covered in [`adapters.md`](adapters.md).
34
-
35
- ## Commands
36
-
37
- | Invocation | Action |
38
- |---|---|
39
- | `/kaizen <request>` | Start a new run in the configured mode (default: `approve`) |
40
- | `/kaizen plan <request>` | Start a run and stop after the plan (`plan-only`) |
41
- | `/kaizen auto <request>` | Start a run in `auto` mode: every stage back to back, no approval stops |
42
- | `/kaizen lite <request>` | Run every stage in this session — cheap, and the reviewer has seen the work |
43
- | `/kaizen full <request>` | Dispatch every stage as its own agent — the reviewer starts cold |
44
- | `/kaizen run` | Resume the current run and execute the approved plan |
45
- | `/kaizen review [target]` | Review-only: audit existing code, no plan, no implementation (`review-only`) |
46
- | `/kaizen status` | List every run grouped waiting-on-you / in flight / done / abandoned, plus the open backlog count |
47
- | `/kaizen backlog` | Print the open backlog items across all runs, grouped by source run, with rescued items last under `Orphaned` |
48
- | `/kaizen approve` | Approve whatever the current run is waiting on |
49
- | `/kaizen reject <reason>` | Reject it; the reason is fed back to the stage that produced it |
50
- | `/kaizen abort` | Mark the current run abandoned |
51
- | `/kaizen config` | Show this project's settings and change them, one picker per setting |
52
- | `/kaizen init` | Set up this project folder: `.kaizen/` with the `spec*.md` files, config, and — in a git repo — the gitignore entry |
53
- | `/kaizen install` | Install the workflow itself globally or per-project (see below) |
54
-
55
- If the user typed `/kaizen` with no argument and a run is in progress, treat it as
56
- `/kaizen status`. If no run is in progress, ask what they want to build.
57
-
58
- ## Before doing anything
59
-
60
- 1. Locate the state directory: `.kaizen/` in the project folder's root, else
61
- `~/.kaizen/` keyed by working directory. If neither exists and the user is starting
62
- work, run `/kaizen init` first: it creates `.kaizen/` with a copy of the `spec*.md`
63
- files and — where the folder is a git repository — the gitignore entry
64
- (see [`adapters.md`](adapters.md)). Also append the project folder's absolute path
65
- to `~/.kaizen/projects` if not already listed: the board only retires an idea when
66
- it can see the run, and it only looks in projects it knows.
67
- 2. Read the config in this order, each file filling in the keys the one before it
68
- does not set: `.kaizen/config.yml`, then `~/.kaizen/config.yml`, then
69
- `config.default.yml` in this skill. A project usually has no `config.yml` of its
70
- own, so the global one is what settings changes reach. `runner` decides whether this run dispatches subagents at
71
- all; read it before the first stage, not when you reach one.
72
- 3. Read `.kaizen/runs/<current>/state.json` if a run is active. Never assume the
73
- stage from conversation memory — the run may have been advanced by another tool
74
- or another session.
75
- 4. Read `.kaizen/memory.md` if present. It holds cross-run lessons and carries real
76
- weight: it is what previous reviewers learned about this codebase.
77
-
78
- ## Settings
79
-
80
- `/kaizen config` reads the same chain — `.kaizen/config.yml`, then `~/.kaizen/config.yml`,
81
- then `config.default.yml` — and prints the current value of each setting below with a
82
- one-line meaning. Then it offers the settings as choices — the tool's structured
83
- question mechanism, one option per legal value, never free text — and writes back
84
- whichever the user picks. Write to whichever file in the chain already exists,
85
- nearest first, so a change lands globally unless this project keeps its own config.
86
-
87
- | Setting | Values | What it decides |
88
- |---|---|---|
89
- | `preset` | `low`, `medium`, `ultra` | Quick preset: low (inline/manual), medium (balanced), ultra (autonomous) |
90
- | `mode` | `approve`, `auto`, `plan-only`, `review-only` | Where a run stops |
91
- | `runner` | `full`, `lite` | Whether each stage is its own cold agent, or this session runs them all |
92
- | `build.executor` | `subagent`, `inline`, `ask` | Who carries out the approved plan |
93
- | `approvals.plan` | `true`, `false` | Stop and show the plan before anything is built |
94
- | `approvals.review` | `true`, `false` | Stop after the review, before the run is called done |
95
- | `approvals.each_file` | `true`, `false` | Confirm every individual edit |
96
- | `auto_fix.enabled` | `true`, `false` | Fix findings without asking, or hand every one over |
97
- | `auto_fix.min_severity` | `critical`, `high`, `medium`, `low` | How bad a finding must be to be fixed automatically |
98
- | `auto_fix.max_iterations` | `1`–`5` | Fix and recheck rounds before what is left is escalated |
99
- | `review.write_memory` | `true`, `false` | Let the reviewer append lessons to `memory.md` |
100
- | `git.auto_commit` | `true`, `false` | Commit the work when a run finishes |
101
- | `git.branch_before_implement` | `true`, `false` | Branch before building when on the default branch |
102
- | `ui.mouse` | `false`, `true` | Click to select, click again to act; while on, the terminal cannot select text |
103
- | `subagents.model` | `inherit`, `opus`, `sonnet`, `haiku` | Model the stage subagents run on (Claude Code only) |
104
- | `subagents.effort` | `inherit`, `low`, `medium`, `high` | Reasoning effort for the stage subagents (Claude Code only) |
105
- | `agent.default` | `auto`, `claude`, `codex`, `agy`, `opencode`, `gemini` | Coding agent to launch from dashboard backlog |
106
-
107
- Rules for writing the file:
108
-
109
- - **Change the value in place.** `config.yml` ships with a comment above every key
110
- explaining it; rewriting the file from a parsed object throws all of them away.
111
- Edit the one line.
112
- - **Only what the user picked.** A key the user did not touch stays absent if it was
113
- absent — an absent key inherits the default, and writing every key out freezes
114
- today's defaults into the project forever.
115
- - If `.kaizen/` does not exist yet, run `init` first, then continue.
116
- - After writing, print the setting and its new value, and nothing else. No summary of
117
- the whole file.
118
-
119
- Settings not in the table — the review checks, backlog and state paths, and the per-tool
120
- `agent.<cmd>.model` / `agent.<cmd>.effort` the board launches a session with — are edited by
121
- hand in `config.yml`, which is commented throughout. Say so rather than offering a
122
- picker with thirty options.
123
-
124
- `kaizen settings` in a terminal opens the same settings as a full-screen browser, for
125
- someone who would rather see the whole file at once. Mention it when the user is
126
- changing several at a time.
127
-
128
- ## What is worth a run
129
-
130
- A run costs several times what the same change costs in one session, because every
131
- stage starts cold and the reviewer is deliberately kept ignorant of how the work was
132
- done. That price buys one thing: an agent with nothing to defend, which is the only
133
- kind that finds the bug in the fix.
134
-
135
- Spend it where being wrong is expensive — money, data loss, a migration, anything a
136
- customer sees, anything hard to undo, anything touching a part of the system nobody
137
- has read in a year. Do not spend it on work where being wrong is cheap and obvious.
138
- A tool that charges the same for a typo and a payroll change gets turned off for both.
139
-
140
- **Small changes take the short path.** Where the approved plan touches roughly two
141
- files or fifty lines, run the stages in this session (`runner: lite`, below)
142
- rather than dispatching them, then stop after the review: report the findings and let
143
- the user choose, rather than entering the fix loop. The loop
144
- exists because a fix to something intricate can be worse than the defect — it is not
145
- worth two more stages to confirm a one-line message now reads correctly. A finding at
146
- `high` or above pulls the run back onto the full path whatever its size, since that
147
- severity is the loop's whole reason for existing.
148
-
149
- This is a judgement, not a threshold to enforce: fifty lines that change how money is
150
- rounded are not a small change. Say which path you took and why, in one line, when the
151
- run starts.
152
-
153
- ## Modes
154
-
155
- Set by `mode` in config, overridable per invocation.
156
-
157
- - **`plan-only`** — produce the plan, write it, stop. No code is touched.
158
- - **`approve`** (default) — stop at every approval enabled in config and wait for an
159
- explicit human decision.
160
- - **`auto`** — run every stage back to back with no approval, report at the end. The fix
161
- loop still respects `max_iterations`.
162
- - **`review-only`** — skip plan and implementation, run the reviewer against existing
163
- code or a diff.
164
-
165
- Mode never overrides a refusal: destructive or irreversible actions still get
166
- confirmed even in `auto`.
167
-
168
- ## Approvals
169
-
170
- Approvals are configured, not hardcoded. Each enabled approval halts the run, writes what it
171
- is waiting for into `state.json`, and reports to the user. The run only advances on
172
- an explicit `/kaizen approve` or a clear approval in conversation.
173
-
174
- - `approvals.plan` — after the plan, before any code is written. On by default.
175
- - `approvals.review` — after the review passes, before the work is called done. Off by
176
- default: with `auto_fix` on, it mostly asks for approval of a report being read anyway.
177
- - `approvals.each_file` — confirm each file edit individually. Off by default; slow.
178
-
179
- A rejected approval is not a failure, and it is not always the same action. Two shapes:
180
- **revise** ("do it differently") sends the plan back to the planner, which produces a
181
- new version and returns to this same approval. **Kill** ("not doing this") means the
182
- request itself was wrong, not the approach — set `stage: "abandoned"` and stop, no
183
- revision to make. The reason says which; state the reading taken in `02-approval.md`
184
- when it is not obvious. See *Plan approval* in [`spec-plan.md`](spec-plan.md) for the full rule.
185
-
186
- **Asking the user anything:** use AskUserQuestion with 2–4 concrete options, taken
187
- from the options the planner wrote into the plan. Subagents cannot prompt the user,
188
- so every question reaches them through you. Do not add an "other" option — free text
189
- is always available. Reserve plain prose questions for things that genuinely have no
190
- discrete answers.
191
-
192
- **Before the builder runs:** show the plan's **Work list** — plain bullets of what
193
- will actually be done. It is the last thing the user sees before anything is
194
- produced, so show it even when they have already approved the plan in conversation.
195
-
196
- ## The fix loop
197
-
198
- When the reviewer reports findings, behavior depends on config:
199
-
200
- - `auto_fix.enabled: false` — always stop and hand every finding to the user as a
201
- decision, listed by the reviewer's number so the user can name a subset. Nothing is
202
- fixed automatically.
203
- - `auto_fix.enabled: true` — the builder fixes findings at or above
204
- `auto_fix.min_severity` (default `high`), the reviewer re-checks, repeating up to
205
- `auto_fix.max_iterations` (default 2). Findings below the threshold, and anything
206
- still open when iterations run out, are reported to the user rather than silently
207
- dropped.
208
-
209
- Every iteration is written to `runs/<id>/05-iterations/` so the loop is auditable.
210
-
211
- ## Backlog and status
212
-
213
- Each run keeps its own backlog at `runs/<id>/06-backlog.md`. You write it, in the main
214
- thread, at two writes that already happen: `02-approval.md` at the plan approval
215
- (out-of-scope suggestions not folded into the approved scope, and anything cut at the
216
- approval) and `stage: "done"` at the final approval (findings still open, findings
217
- below the fix threshold, and the builder's out-of-scope notes). No subagent writes it.
218
- The full rules are in [`spec-main.md`](spec-main.md).
219
-
220
- Items are one line each, `- <status>: <item text>`, with `<status>` one of `open`,
221
- `done`, or `rejected`. Findings keep the reviewer's line verbatim. `rejected` always
222
- carries a reason after a `|`. Closing an item edits its status in place; the line
223
- stays in the run's file as record.
224
-
225
- `/kaizen backlog` reads every `runs/*/06-backlog.md` at read time and prints the `open`
226
- items only, grouped by source run, newest run first. There is no central backlog file
227
- to keep in sync. `<state.dir>/backlog.md` is an orphanage and nothing more: before
228
- `state.keep_runs` prunes a run, move that run's still-open items into it. `/kaizen
229
- backlog` reads that file too and prints its open items last, under an **Orphaned**
230
- group, so a rescued item stays visible after its run is gone.
231
-
232
- **`/kaizen backlog` and `/kaizen status` are read-only.** They print; they never edit
233
- a `06-backlog.md` or `state.json`, even when reading one turns up an inconsistency
234
- (a stale `open` item already closed elsewhere, a duplicate, a bad reference). Report
235
- what looks wrong as part of the output and ask before touching anything — fixing it
236
- unasked is exactly the scope creep the rest of this spec exists to prevent, applied to
237
- kaizen's own bookkeeping instead of a user's code.
238
-
239
- `/kaizen status` reads each `runs/*/state.json` live and prints every run in four
240
- groups:
241
-
242
- ```
243
- Waiting on you — awaiting is non-null and stage is not "abandoned"
244
- In flight — awaiting is null and stage is neither "done" nor "abandoned"
245
- Done — stage is "done"
246
- Abandoned — stage is "abandoned" (set by /kaizen abort)
247
-
248
- Backlog: <n> open
249
- ```
250
-
251
- The count is every open item across all runs plus the orphanage. An abandoned run's
252
- backlog items are not open work: leave them in place, and do not print or count them.
253
-
254
- Each line is the run id, its stage, and what it is awaiting. Grouping is derived from
255
- `state.json` at read time, never from the directory name — run directories are flat and
256
- are never renamed or moved, so a path written into another file cannot break.
257
-
258
- ## Who runs the stages
259
-
260
- `runner` decides, and it is the difference between a run costing about what the work
261
- would cost in one session and several times that. Set it for the project with
262
- `/kaizen config` or `kaizen settings`; override it for one run with `/kaizen lite
263
- <request>` or `/kaizen full <request>`, which does not change the project's setting.
264
-
265
- - **`full`** (default) — each stage is dispatched as its own agent, started cold.
266
- The reviewer has never seen how the work was done, so it has nothing to defend.
267
- That is the entire reason its findings are worth reading, and it is what catches the
268
- bug in a fix rather than the bug in the plan.
269
- - **`lite`** — this session runs every stage itself, in order, as
270
- [`adapters.md`](adapters.md) already describes for tools that have no subagents.
271
- Read only the stage's declared inputs, write its artifact before starting the next,
272
- and when reviewing, judge the work on its own terms rather than defending the
273
- reasoning you used producing it.
274
-
275
- Everything else holds in both: the plan, the approval stop, the numbered gate answered
276
- with evidence, numbered findings, the files, and a run another tool can pick up.
277
-
278
- **Be honest about what `lite` costs you.** Instructing an agent to be impartial
279
- about something it just did is weaker than an agent that cannot be partial, because it
280
- never saw it. A same-session review reliably finds what is visible in the diff. It is
281
- much less likely to find the defect that requires disbelieving the reasoning that
282
- produced it — and a fix that is worse than the finding it closes is exactly that shape.
283
-
284
- So: `lite` where being wrong is cheap and obvious, which is also where the short path
285
- above applies. `full` where being wrong is expensive. When a run is going to
286
- touch money, a migration, or anything hard to undo, say which runner it used at the
287
- final report, so nobody reads a same-session review as an independent one.
288
-
289
- ## Running a stage
290
-
291
- **If the tool you are running in has no subagents** — Codex, and anything else that
292
- runs one session at a time — do not try to fake them. Run the stages sequentially in
293
- the one session, following [`adapters.md`](adapters.md): start each stage by reading
294
- only its declared inputs, write its artifact before moving on, and when reviewing,
295
- judge the work on its own terms rather than defending the reasoning you used writing
296
- it. Everything else in this file holds unchanged.
297
-
298
- **Check `runner` first.**
299
-
300
- - `runner: lite` — do not call the Agent tool. You run plan, build and review
301
- yourself, in that order, reading only each stage's declared inputs and writing its
302
- artifact before starting the next. The stage table below still applies; you are the
303
- agent for every row.
304
- - `runner: full` — dispatch each stage as its own subagent, as follows.
305
-
306
- Under `full`, each stage runs as a subagent via the Agent tool, with the agent type
307
- named below. Pass it the run directory path and let it read its own inputs from there — do not
308
- paste plans or diffs into the prompt, since the file is the shared source of truth
309
- across tools. Name its spec files in the prompt: core `spec.md` plus its own stage
310
- file, never the whole set.
311
-
312
- | Stage | Agent type | Writes |
313
- |---|---|---|
314
- | Plan | `kaizen-planner` | `01-plan.md` |
315
- | Implement | `kaizen-builder`, or the main thread when `build.executor` is `inline` | `03-impl.md` + the actual changes |
316
- | Review | `kaizen-reviewer` | `04-review.md` |
317
-
318
- `build.executor` decides who implements: `subagent` (default), `inline` — the main
319
- thread does it against the same contract in `spec-build.md` — or `ask`, which puts
320
- the choice at the plan approval. Building inline does not make the review less
321
- independent: the reviewer is a separate agent in every case, and never sees the
322
- conversation the work happened in.
323
-
324
- `subagents.model` and `subagents.effort` apply to every stage dispatched this way.
325
- Pass `model` on the Agent call when it is not `inherit`. Effort has no call-time
326
- knob: when it is not `inherit`, make sure the frontmatter of the agent's definition
327
- (`~/.claude/agents/kaizen-<stage>.md`, or the project's `.claude/agents/` copy)
328
- carries `effort: <value>` — edit or add that one line, nothing else — before the
329
- first dispatch of the run. `inherit` means leave the file alone.
330
-
331
- After a subagent returns, update `state.json` yourself in the main thread. Subagents
332
- report; the main thread owns the state machine.
333
-
334
- **Name files, do not narrate them.** The prompt says which paths to read, which
335
- decisions bind the stage, and what to report back. It does not summarize those files:
336
- the subagent is about to read them, and a summary is the same content paid for twice —
337
- once in your prompt and once when it opens the file. Asking for analysis the stage's
338
- own contract does not require costs a stage's worth of tokens for an opinion nobody
339
- will act on.
340
-
341
- **Scope precisely, don't scope narrow.** Each subagent starts cold — no context from
342
- you carries over except what the prompt names. List exactly the files this stage's
343
- task actually touches; don't default to "read everything" for safety. But cutting a
344
- file the task genuinely needs is worse than the tokens it would have cost: a
345
- under-scoped subagent produces a wrong plan or misses a real defect, which costs a fix
346
- iteration — more tokens than the read would have. Precise beats narrow.
347
-
348
- Relay what matters from each subagent's report to the user — their output is not
349
- shown automatically.
350
-
351
- ## State layout
352
-
353
- ```
354
- .kaizen/
355
- spec.md # core contract, copied in by init
356
- spec-plan.md # per-stage contracts; each reader takes core + one
357
- spec-build.md
358
- spec-review.md
359
- spec-main.md
360
- config.yml
361
- memory.md # cross-run lessons, appended by the reviewer
362
- backlog.md # orphanage only: open items rescued before pruning
363
- runs/
364
- 2026-09-02-add-oauth/
365
- 00-request.md # the original request, verbatim
366
- 01-plan.md
367
- 02-approval.md # decisions, with reasons and timestamps
368
- 03-impl.md # what changed, which files, what was skipped
369
- 04-review.md # findings, numbered and severity-tagged
370
- 05-iterations/
371
- 01-fix.md
372
- 01-recheck.md
373
- 06-backlog.md # what this run deliberately did not do
374
- notes.md # context attached from the board; the planner reads it
375
- state.json
376
- ```
377
-
378
- `state.json` is the resume point, and records the runner and the agent the run started with, so a
379
- run picked up later keeps the shape it was reviewed under rather than silently
380
- changing because a setting moved:
381
-
382
- ```json
383
- {
384
- "id": "2026-09-02-add-oauth",
385
- "mode": "approve",
386
- "runner": "full",
387
- "agent": "claude",
388
- "stage": "review",
389
- "awaiting": "approvals.review",
390
- "iteration": 1,
391
- "updated": "2026-09-02T14:31:00+07:00"
392
- }
393
- ```
394
-
395
- In a git repository, `init` also adds a gitignore entry that ignores run state but
396
- keeps the workflow: it ignores `.kaizen/*` and un-ignores `.kaizen/spec*.md` and
397
- `.kaizen/config.yml`, which are meant to be committed (see
398
- [`adapters.md`](adapters.md)). A project folder that is not a repository gets no
399
- gitignore.
400
-
401
- ## Install
402
-
403
- `/kaizen install` asks where the workflow should live: **global** (this machine, every
404
- project) or **per-project** (this repo, committed, shared with the team). Both can
405
- coexist; the project copy wins when present.
406
-
407
- **Global.** Kaizen's source of truth is the repo at `~/kaizen` (symlinked in on this
408
- machine). Installing or updating global kaizen means that repo is current and linked:
409
-
410
- ```bash
411
- [ -d ~/kaizen ] && (cd ~/kaizen && git pull) || git clone <kaizen repo url> ~/kaizen
412
- mkdir -p ~/.claude/skills ~/.claude/agents
413
- ln -sfn ~/kaizen/skills/kaizen ~/.claude/skills/kaizen
414
- for f in kaizen-planner kaizen-builder kaizen-reviewer; do
415
- ln -sfn ~/kaizen/agents/$f.md ~/.claude/agents/$f.md
416
- done
417
- ```
418
-
419
- Symlinks, not copies — future `git pull` in `~/kaizen` updates every project on this
420
- machine at once. This only works because `~/kaizen` is a repo the installing user
421
- controls; it is not something to hand a teammate.
422
-
423
- **Per-project.** A teammate cloning this repo does not have access to `~/kaizen` (it
424
- can be private, or simply not theirs), so the project copy must be self-contained —
425
- real files, not symlinks, committed into the project:
426
-
427
- ```bash
428
- mkdir -p .claude/skills/kaizen .claude/agents
429
- cp ~/kaizen/skills/kaizen/*.md ~/kaizen/skills/kaizen/*.yml .claude/skills/kaizen/
430
- cp ~/kaizen/agents/kaizen-*.md .claude/agents/
431
- git add .claude/skills/kaizen .claude/agents/kaizen-*.md
432
- ```
433
-
434
- Then commit. Updating a per-project copy later means re-running the `cp` lines against
435
- a current `~/kaizen` and committing the diff — there is no live link to keep it in
436
- sync automatically, by design.
437
-
438
- `install` also offers to write the adapter files from [`adapters.md`](adapters.md) so
439
- Codex and Antigravity follow the same spec, per-project only (a global adapter file has
440
- nowhere sensible to live).
1
+ ---
2
+ name: kaizen
3
+ description: >
4
+ Staged workflow for any kind of work: plan, human approval, build, then independent
5
+ review with a bounded fix loop. Not only for code — a run infers its own track (code,
6
+ writing, communication, operations, research) and every stage reads "deliverable",
7
+ "verification", and "finding" in that track's terms. Each stage runs as its own
8
+ subagent with clean context, and all state lives in a portable `.kaizen/` directory so
9
+ a run can be resumed later, by another session, or by another AI tool (Codex,
10
+ Antigravity). Use when the user says "kaizen", "/kaizen", asks to plan-then-build-then-review
11
+ something, wants approval steps before work begins, or wants to resume or check an
12
+ existing kaizen run. Also use to install the workflow into a repository.
13
+ ---
14
+
15
+ # Kaizen
16
+
17
+ A staged workflow for non-trivial development work:
18
+
19
+ ```
20
+ request -> PLAN -> [approval] -> IMPLEMENT -> REVIEW -> [fix loop] -> [approval] -> done
21
+ ```
22
+
23
+ Three separate subagents do the work. They never share a context window, which is
24
+ the point: a reviewer that watched the code being written will rationalize it, a
25
+ reviewer that sees only the diff and the plan will not.
26
+
27
+ The stage contract is split so no reader loads a stage it is not running:
28
+ [`spec.md`](spec.md) is the core (track, intake, resume) and every reader takes it,
29
+ plus exactly one of [`spec-plan.md`](spec-plan.md), [`spec-build.md`](spec-build.md),
30
+ [`spec-review.md`](spec-review.md), or [`spec-main.md`](spec-main.md) — the main
31
+ thread's own file. Read core plus your stage before running it; do not read the
32
+ others. Configuration defaults are in [`config.default.yml`](config.default.yml).
33
+ Porting the workflow to Codex or Antigravity is covered in [`adapters.md`](adapters.md).
34
+
35
+ ## Commands
36
+
37
+ | Invocation | Action |
38
+ |---|---|
39
+ | `/kaizen <request>` | Start a new run in the configured mode (default: `approve`) |
40
+ | `/kaizen plan <request>` | Start a run and stop after the plan (`plan-only`) |
41
+ | `/kaizen auto <request>` | Start a run in `auto` mode: every stage back to back, no approval stops |
42
+ | `/kaizen lite <request>` | Run every stage in this session — cheap, and the reviewer has seen the work |
43
+ | `/kaizen full <request>` | Dispatch every stage as its own agent — the reviewer starts cold |
44
+ | `/kaizen run` | Resume the current run and execute the approved plan |
45
+ | `/kaizen review [target]` | Review-only: audit existing code, no plan, no implementation (`review-only`) |
46
+ | `/kaizen status` | List every run grouped waiting-on-you / in flight / done / abandoned, plus the open backlog count |
47
+ | `/kaizen backlog` | Print the open backlog items across all runs, grouped by source run, with rescued items last under `Orphaned` |
48
+ | `/kaizen approve` | Approve whatever the current run is waiting on |
49
+ | `/kaizen reject <reason>` | Reject it; the reason is fed back to the stage that produced it |
50
+ | `/kaizen abort` | Mark the current run abandoned |
51
+ | `/kaizen config` | Show this project's settings and change them, one picker per setting |
52
+ | `/kaizen init` | Set up this project folder: `.kaizen/` with the `spec*.md` files, config, and — in a git repo — the gitignore entry |
53
+ | `/kaizen install` | Install the workflow itself globally or per-project (see below) |
54
+
55
+ If the user typed `/kaizen` with no argument and a run is in progress, treat it as
56
+ `/kaizen status`. If no run is in progress, ask what they want to build.
57
+
58
+ ## Before doing anything
59
+
60
+ 1. Locate the state directory: `.kaizen/` in the project folder's root, else
61
+ `~/.kaizen/` keyed by working directory. If neither exists and the user is starting
62
+ work, run `/kaizen init` first: it creates `.kaizen/` with a copy of the `spec*.md`
63
+ files and — where the folder is a git repository — the gitignore entry
64
+ (see [`adapters.md`](adapters.md)). Also append the project folder's absolute path
65
+ to `~/.kaizen/projects` if not already listed: the board only retires an idea when
66
+ it can see the run, and it only looks in projects it knows.
67
+ 2. Read the config in this order, each file filling in the keys the one before it
68
+ does not set: `.kaizen/config.yml`, then `~/.kaizen/config.yml`, then
69
+ `config.default.yml` in this skill. A project usually has no `config.yml` of its
70
+ own, so the global one is what settings changes reach. `runner` decides whether this run dispatches subagents at
71
+ all; read it before the first stage, not when you reach one.
72
+ 3. Read `.kaizen/runs/<current>/state.json` if a run is active. Never assume the
73
+ stage from conversation memory — the run may have been advanced by another tool
74
+ or another session.
75
+ 4. Read `.kaizen/memory.md` if present. It holds cross-run lessons and carries real
76
+ weight: it is what previous reviewers learned about this codebase.
77
+
78
+ ## Settings
79
+
80
+ `/kaizen config` reads the same chain — `.kaizen/config.yml`, then `~/.kaizen/config.yml`,
81
+ then `config.default.yml` — and prints the current value of each setting below with a
82
+ one-line meaning. Then it offers the settings as choices — the tool's structured
83
+ question mechanism, one option per legal value, never free text — and writes back
84
+ whichever the user picks. Write to whichever file in the chain already exists,
85
+ nearest first, so a change lands globally unless this project keeps its own config.
86
+
87
+ | Setting | Values | What it decides |
88
+ |---|---|---|
89
+ | `preset` | `low`, `medium`, `ultra` | Quick preset: low (inline/manual), medium (balanced), ultra (autonomous) |
90
+ | `mode` | `approve`, `auto`, `plan-only`, `review-only` | Where a run stops |
91
+ | `runner` | `full`, `lite` | Whether each stage is its own cold agent, or this session runs them all |
92
+ | `build.executor` | `subagent`, `inline`, `ask` | Who carries out the approved plan |
93
+ | `approvals.plan` | `true`, `false` | Stop and show the plan before anything is built |
94
+ | `approvals.review` | `true`, `false` | Stop after the review, before the run is called done |
95
+ | `approvals.each_file` | `true`, `false` | Confirm every individual edit |
96
+ | `auto_fix.enabled` | `true`, `false` | Fix findings without asking, or hand every one over |
97
+ | `auto_fix.min_severity` | `critical`, `high`, `medium`, `low` | How bad a finding must be to be fixed automatically |
98
+ | `auto_fix.max_iterations` | `1`–`5` | Fix and recheck rounds before what is left is escalated |
99
+ | `review.write_memory` | `true`, `false` | Let the reviewer append lessons to `memory.md` |
100
+ | `git.auto_commit` | `true`, `false` | Commit the work when a run finishes |
101
+ | `git.branch_before_implement` | `true`, `false` | Branch before building when on the default branch |
102
+ | `ui.mouse` | `false`, `true` | Click to select, click again to act; while on, the terminal cannot select text |
103
+ | `subagents.model` | `inherit`, `opus`, `sonnet`, `haiku` | Model the stage subagents run on (Claude Code only) |
104
+ | `subagents.effort` | `inherit`, `low`, `medium`, `high` | Reasoning effort for the stage subagents (Claude Code only) |
105
+ | `agent.default` | `auto`, `claude`, `codex`, `agy`, `opencode`, `gemini` | Coding agent to launch from dashboard backlog |
106
+
107
+ Rules for writing the file:
108
+
109
+ - **Change the value in place.** `config.yml` ships with a comment above every key
110
+ explaining it; rewriting the file from a parsed object throws all of them away.
111
+ Edit the one line.
112
+ - **Only what the user picked.** A key the user did not touch stays absent if it was
113
+ absent — an absent key inherits the default, and writing every key out freezes
114
+ today's defaults into the project forever.
115
+ - If `.kaizen/` does not exist yet, run `init` first, then continue.
116
+ - After writing, print the setting and its new value, and nothing else. No summary of
117
+ the whole file.
118
+
119
+ Settings not in the table — the review checks, backlog and state paths, and the per-tool
120
+ `agent.<cmd>.model` / `agent.<cmd>.effort` the board launches a session with — are edited by
121
+ hand in `config.yml`, which is commented throughout. Say so rather than offering a
122
+ picker with thirty options.
123
+
124
+ `kaizen settings` in a terminal opens the same settings as a full-screen browser, for
125
+ someone who would rather see the whole file at once. Mention it when the user is
126
+ changing several at a time.
127
+
128
+ ## What is worth a run
129
+
130
+ A run costs several times what the same change costs in one session, because every
131
+ stage starts cold and the reviewer is deliberately kept ignorant of how the work was
132
+ done. That price buys one thing: an agent with nothing to defend, which is the only
133
+ kind that finds the bug in the fix.
134
+
135
+ Spend it where being wrong is expensive — money, data loss, a migration, anything a
136
+ customer sees, anything hard to undo, anything touching a part of the system nobody
137
+ has read in a year. Do not spend it on work where being wrong is cheap and obvious.
138
+ A tool that charges the same for a typo and a payroll change gets turned off for both.
139
+
140
+ **Small changes take the short path.** Where the approved plan touches roughly two
141
+ files or fifty lines, run the stages in this session (`runner: lite`, below)
142
+ rather than dispatching them, then stop after the review: report the findings and let
143
+ the user choose, rather than entering the fix loop. The loop
144
+ exists because a fix to something intricate can be worse than the defect — it is not
145
+ worth two more stages to confirm a one-line message now reads correctly. A finding at
146
+ `high` or above pulls the run back onto the full path whatever its size, since that
147
+ severity is the loop's whole reason for existing.
148
+
149
+ This is a judgement, not a threshold to enforce: fifty lines that change how money is
150
+ rounded are not a small change. Say which path you took and why, in one line, when the
151
+ run starts.
152
+
153
+ ## Modes
154
+
155
+ Set by `mode` in config, overridable per invocation.
156
+
157
+ - **`plan-only`** — produce the plan, write it, stop. No code is touched.
158
+ - **`approve`** (default) — stop at every approval enabled in config and wait for an
159
+ explicit human decision.
160
+ - **`auto`** — run every stage back to back with no approval, report at the end. The fix
161
+ loop still respects `max_iterations`.
162
+ - **`review-only`** — skip plan and implementation, run the reviewer against existing
163
+ code or a diff.
164
+
165
+ Mode never overrides a refusal: destructive or irreversible actions still get
166
+ confirmed even in `auto`.
167
+
168
+ ## Approvals
169
+
170
+ Approvals are configured, not hardcoded. Each enabled approval halts the run, writes what it
171
+ is waiting for into `state.json`, and reports to the user. The run only advances on
172
+ an explicit `/kaizen approve` or a clear approval in conversation.
173
+
174
+ - `approvals.plan` — after the plan, before any code is written. On by default.
175
+ - `approvals.review` — after the review passes, before the work is called done. Off by
176
+ default: with `auto_fix` on, it mostly asks for approval of a report being read anyway.
177
+ - `approvals.each_file` — confirm each file edit individually. Off by default; slow.
178
+
179
+ A rejected approval is not a failure, and it is not always the same action. Two shapes:
180
+ **revise** ("do it differently") sends the plan back to the planner, which produces a
181
+ new version and returns to this same approval. **Kill** ("not doing this") means the
182
+ request itself was wrong, not the approach — set `stage: "abandoned"` and stop, no
183
+ revision to make. The reason says which; state the reading taken in `02-approval.md`
184
+ when it is not obvious. See *Plan approval* in [`spec-plan.md`](spec-plan.md) for the full rule.
185
+
186
+ **Asking the user anything:** use AskUserQuestion with 2–4 concrete options, taken
187
+ from the options the planner wrote into the plan. Subagents cannot prompt the user,
188
+ so every question reaches them through you. Do not add an "other" option — free text
189
+ is always available. Reserve plain prose questions for things that genuinely have no
190
+ discrete answers.
191
+
192
+ **Before the builder runs:** show the plan's **Work list** — plain bullets of what
193
+ will actually be done. It is the last thing the user sees before anything is
194
+ produced, so show it even when they have already approved the plan in conversation.
195
+
196
+ ## The fix loop
197
+
198
+ When the reviewer reports findings, behavior depends on config:
199
+
200
+ - `auto_fix.enabled: false` — always stop and hand every finding to the user as a
201
+ decision, listed by the reviewer's number so the user can name a subset. Nothing is
202
+ fixed automatically.
203
+ - `auto_fix.enabled: true` — the builder fixes findings at or above
204
+ `auto_fix.min_severity` (default `high`), the reviewer re-checks, repeating up to
205
+ `auto_fix.max_iterations` (default 2). Findings below the threshold, and anything
206
+ still open when iterations run out, are reported to the user rather than silently
207
+ dropped.
208
+
209
+ Every iteration is written to `runs/<id>/05-iterations/` so the loop is auditable.
210
+
211
+ ## Backlog and status
212
+
213
+ Each run keeps its own backlog at `runs/<id>/06-backlog.md`. You write it, in the main
214
+ thread, at two writes that already happen: `02-approval.md` at the plan approval
215
+ (out-of-scope suggestions not folded into the approved scope, and anything cut at the
216
+ approval) and `stage: "done"` at the final approval (findings still open, findings
217
+ below the fix threshold, and the builder's out-of-scope notes). No subagent writes it.
218
+ The full rules are in [`spec-main.md`](spec-main.md).
219
+
220
+ Items are one line each, `- <status>: <item text>`, with `<status>` one of `open`,
221
+ `done`, or `rejected`. Findings keep the reviewer's line verbatim. `rejected` always
222
+ carries a reason after a `|`. Closing an item edits its status in place; the line
223
+ stays in the run's file as record.
224
+
225
+ `/kaizen backlog` reads every `runs/*/06-backlog.md` at read time and prints the `open`
226
+ items only, grouped by source run, newest run first. There is no central backlog file
227
+ to keep in sync. `<state.dir>/backlog.md` is an orphanage and nothing more: before
228
+ `state.keep_runs` prunes a run, move that run's still-open items into it. `/kaizen
229
+ backlog` reads that file too and prints its open items last, under an **Orphaned**
230
+ group, so a rescued item stays visible after its run is gone.
231
+
232
+ **`/kaizen backlog` and `/kaizen status` are read-only.** They print; they never edit
233
+ a `06-backlog.md` or `state.json`, even when reading one turns up an inconsistency
234
+ (a stale `open` item already closed elsewhere, a duplicate, a bad reference). Report
235
+ what looks wrong as part of the output and ask before touching anything — fixing it
236
+ unasked is exactly the scope creep the rest of this spec exists to prevent, applied to
237
+ kaizen's own bookkeeping instead of a user's code.
238
+
239
+ `/kaizen status` reads each `runs/*/state.json` live and prints every run in four
240
+ groups:
241
+
242
+ ```
243
+ Waiting on you — awaiting is non-null and stage is not "abandoned"
244
+ In flight — awaiting is null and stage is neither "done" nor "abandoned"
245
+ Done — stage is "done"
246
+ Abandoned — stage is "abandoned" (set by /kaizen abort)
247
+
248
+ Backlog: <n> open
249
+ ```
250
+
251
+ The count is every open item across all runs plus the orphanage. An abandoned run's
252
+ backlog items are not open work: leave them in place, and do not print or count them.
253
+
254
+ Each line is the run id, its stage, and what it is awaiting. Grouping is derived from
255
+ `state.json` at read time, never from the directory name — run directories are flat and
256
+ are never renamed or moved, so a path written into another file cannot break.
257
+
258
+ ## Who runs the stages
259
+
260
+ `runner` decides, and it is the difference between a run costing about what the work
261
+ would cost in one session and several times that. Set it for the project with
262
+ `/kaizen config` or `kaizen settings`; override it for one run with `/kaizen lite
263
+ <request>` or `/kaizen full <request>`, which does not change the project's setting.
264
+
265
+ - **`full`** (default) — each stage is dispatched as its own agent, started cold.
266
+ The reviewer has never seen how the work was done, so it has nothing to defend.
267
+ That is the entire reason its findings are worth reading, and it is what catches the
268
+ bug in a fix rather than the bug in the plan.
269
+ - **`lite`** — this session runs every stage itself, in order, as
270
+ [`adapters.md`](adapters.md) already describes for tools that have no subagents.
271
+ Read only the stage's declared inputs, write its artifact before starting the next,
272
+ and when reviewing, judge the work on its own terms rather than defending the
273
+ reasoning you used producing it.
274
+
275
+ Everything else holds in both: the plan, the approval stop, the numbered gate answered
276
+ with evidence, numbered findings, the files, and a run another tool can pick up.
277
+
278
+ **Be honest about what `lite` costs you.** Instructing an agent to be impartial
279
+ about something it just did is weaker than an agent that cannot be partial, because it
280
+ never saw it. A same-session review reliably finds what is visible in the diff. It is
281
+ much less likely to find the defect that requires disbelieving the reasoning that
282
+ produced it — and a fix that is worse than the finding it closes is exactly that shape.
283
+
284
+ So: `lite` where being wrong is cheap and obvious, which is also where the short path
285
+ above applies. `full` where being wrong is expensive. When a run is going to
286
+ touch money, a migration, or anything hard to undo, say which runner it used at the
287
+ final report, so nobody reads a same-session review as an independent one.
288
+
289
+ ## Running a stage
290
+
291
+ **If the tool you are running in has no subagents** — Codex, and anything else that
292
+ runs one session at a time — do not try to fake them. Run the stages sequentially in
293
+ the one session, following [`adapters.md`](adapters.md): start each stage by reading
294
+ only its declared inputs, write its artifact before moving on, and when reviewing,
295
+ judge the work on its own terms rather than defending the reasoning you used writing
296
+ it. Everything else in this file holds unchanged.
297
+
298
+ **Check `runner` first.**
299
+
300
+ - `runner: lite` — do not call the Agent tool. You run plan, build and review
301
+ yourself, in that order, reading only each stage's declared inputs and writing its
302
+ artifact before starting the next. The stage table below still applies; you are the
303
+ agent for every row.
304
+ - `runner: full` — dispatch each stage as its own subagent, as follows.
305
+
306
+ Under `full`, each stage runs as a subagent via the Agent tool, with the agent type
307
+ named below. Pass it the run directory path and let it read its own inputs from there — do not
308
+ paste plans or diffs into the prompt, since the file is the shared source of truth
309
+ across tools. Name its spec files in the prompt: core `spec.md` plus its own stage
310
+ file, never the whole set.
311
+
312
+ | Stage | Agent type | Writes |
313
+ |---|---|---|
314
+ | Plan | `kaizen-planner` | `01-plan.md` |
315
+ | Implement | `kaizen-builder`, or the main thread when `build.executor` is `inline` | `03-impl.md` + the actual changes |
316
+ | Review | `kaizen-reviewer` | `04-review.md` |
317
+
318
+ `build.executor` decides who implements: `subagent` (default), `inline` — the main
319
+ thread does it against the same contract in `spec-build.md` — or `ask`, which puts
320
+ the choice at the plan approval. Building inline does not make the review less
321
+ independent: the reviewer is a separate agent in every case, and never sees the
322
+ conversation the work happened in.
323
+
324
+ `subagents.model` and `subagents.effort` apply to every stage dispatched this way.
325
+ Pass `model` on the Agent call when it is not `inherit`. Effort has no call-time
326
+ knob: when it is not `inherit`, make sure the frontmatter of the agent's definition
327
+ (`~/.claude/agents/kaizen-<stage>.md`, or the project's `.claude/agents/` copy)
328
+ carries `effort: <value>` — edit or add that one line, nothing else — before the
329
+ first dispatch of the run. `inherit` means leave the file alone.
330
+
331
+ After a subagent returns, update `state.json` yourself in the main thread. Subagents
332
+ report; the main thread owns the state machine.
333
+
334
+ **Name files, do not narrate them.** The prompt says which paths to read, which
335
+ decisions bind the stage, and what to report back. It does not summarize those files:
336
+ the subagent is about to read them, and a summary is the same content paid for twice —
337
+ once in your prompt and once when it opens the file. Asking for analysis the stage's
338
+ own contract does not require costs a stage's worth of tokens for an opinion nobody
339
+ will act on.
340
+
341
+ **Scope precisely, don't scope narrow.** Each subagent starts cold — no context from
342
+ you carries over except what the prompt names. List exactly the files this stage's
343
+ task actually touches; don't default to "read everything" for safety. But cutting a
344
+ file the task genuinely needs is worse than the tokens it would have cost: a
345
+ under-scoped subagent produces a wrong plan or misses a real defect, which costs a fix
346
+ iteration — more tokens than the read would have. Precise beats narrow.
347
+
348
+ Relay what matters from each subagent's report to the user — their output is not
349
+ shown automatically.
350
+
351
+ ## State layout
352
+
353
+ ```
354
+ .kaizen/
355
+ spec.md # core contract, copied in by init
356
+ spec-plan.md # per-stage contracts; each reader takes core + one
357
+ spec-build.md
358
+ spec-review.md
359
+ spec-main.md
360
+ config.yml
361
+ memory.md # cross-run lessons, appended by the reviewer
362
+ backlog.md # orphanage only: open items rescued before pruning
363
+ runs/
364
+ 2026-09-02-add-oauth/
365
+ 00-request.md # the original request, verbatim
366
+ 01-plan.md
367
+ 02-approval.md # decisions, with reasons and timestamps
368
+ 03-impl.md # what changed, which files, what was skipped
369
+ 04-review.md # findings, numbered and severity-tagged
370
+ 05-iterations/
371
+ 01-fix.md
372
+ 01-recheck.md
373
+ 06-backlog.md # what this run deliberately did not do
374
+ notes.md # context attached from the board; the planner reads it
375
+ state.json
376
+ ```
377
+
378
+ `state.json` is the resume point, and records the runner and the agent the run started with, so a
379
+ run picked up later keeps the shape it was reviewed under rather than silently
380
+ changing because a setting moved:
381
+
382
+ ```json
383
+ {
384
+ "id": "2026-09-02-add-oauth",
385
+ "mode": "approve",
386
+ "runner": "full",
387
+ "agent": "claude",
388
+ "stage": "review",
389
+ "awaiting": "approvals.review",
390
+ "iteration": 1,
391
+ "updated": "2026-09-02T14:31:00+07:00"
392
+ }
393
+ ```
394
+
395
+ In a git repository, `init` also adds a gitignore entry that ignores run state but
396
+ keeps the workflow: it ignores `.kaizen/*` and un-ignores `.kaizen/spec*.md` and
397
+ `.kaizen/config.yml`, which are meant to be committed (see
398
+ [`adapters.md`](adapters.md)). A project folder that is not a repository gets no
399
+ gitignore.
400
+
401
+ ## Install
402
+
403
+ `/kaizen install` asks where the workflow should live: **global** (this machine, every
404
+ project) or **per-project** (this repo, committed, shared with the team). Both can
405
+ coexist; the project copy wins when present.
406
+
407
+ **Global.** Kaizen's source of truth is the repo at `~/kaizen` (symlinked in on this
408
+ machine). Installing or updating global kaizen means that repo is current and linked:
409
+
410
+ ```bash
411
+ [ -d ~/kaizen ] && (cd ~/kaizen && git pull) || git clone <kaizen repo url> ~/kaizen
412
+ mkdir -p ~/.claude/skills ~/.claude/agents
413
+ ln -sfn ~/kaizen/skills/kaizen ~/.claude/skills/kaizen
414
+ for f in kaizen-planner kaizen-builder kaizen-reviewer; do
415
+ ln -sfn ~/kaizen/agents/$f.md ~/.claude/agents/$f.md
416
+ done
417
+ ```
418
+
419
+ Symlinks, not copies — future `git pull` in `~/kaizen` updates every project on this
420
+ machine at once. This only works because `~/kaizen` is a repo the installing user
421
+ controls; it is not something to hand a teammate.
422
+
423
+ **Per-project.** A teammate cloning this repo does not have access to `~/kaizen` (it
424
+ can be private, or simply not theirs), so the project copy must be self-contained —
425
+ real files, not symlinks, committed into the project:
426
+
427
+ ```bash
428
+ mkdir -p .claude/skills/kaizen .claude/agents
429
+ cp ~/kaizen/skills/kaizen/*.md ~/kaizen/skills/kaizen/*.yml .claude/skills/kaizen/
430
+ cp ~/kaizen/agents/kaizen-*.md .claude/agents/
431
+ git add .claude/skills/kaizen .claude/agents/kaizen-*.md
432
+ ```
433
+
434
+ Then commit. Updating a per-project copy later means re-running the `cp` lines against
435
+ a current `~/kaizen` and committing the diff — there is no live link to keep it in
436
+ sync automatically, by design.
437
+
438
+ `install` also offers to write the adapter files from [`adapters.md`](adapters.md) so
439
+ Codex and Antigravity follow the same spec, per-project only (a global adapter file has
440
+ nowhere sensible to live).