kaizen-agent 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,219 @@
1
- # kaizen
1
+ <div align="center">
2
+ <img src="https://raw.githubusercontent.com/hfadhlullah/kaizen/main/assets/banner.png" alt="kaizen" width="760">
3
+ </div>
2
4
 
3
- Staged AI development workflow for Claude Code: plan → human approval → implement →
4
- independent review → bounded fix loop. Each stage runs as its own subagent with clean
5
- context; all run state lives in a portable `.kaizen/` directory so a run can be
6
- resumed later, by another session, or by another AI tool (Codex, Antigravity).
5
+ <p align="center"><i>Your AI agent shows you the plan before it does the work,<br>and a second agent checks what it did.</i></p>
7
6
 
8
- See [`skills/kaizen/SKILL.md`](skills/kaizen/SKILL.md) for the full behavior and
9
- [`skills/kaizen/spec.md`](skills/kaizen/spec.md) for the tool-neutral stage contract.
10
- A quick-reference card ships separately as the `kaizen-help` skill.
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/kaizen-agent"><img alt="npm" src="https://img.shields.io/npm/v/kaizen-agent?color=2d50a5&label=npm"></a>
9
+ <a href="https://github.com/hfadhlullah/kaizen/blob/main/LICENSE"><img alt="license" src="https://img.shields.io/npm/l/kaizen-agent?color=2d50a5"></a>
10
+ <img alt="dependencies" src="https://img.shields.io/badge/dependencies-0-2d50a5">
11
+ <img alt="works with" src="https://img.shields.io/badge/Claude%20Code%20%C2%B7%20Codex%20%C2%B7%20Antigravity-2d50a5">
12
+ </p>
13
+
14
+ ---
15
+
16
+ ## The problem
17
+
18
+ You ask an AI to do something real — write the launch email, draft the policy,
19
+ build the feature, plan the migration. It goes quiet, then hands back a finished
20
+ thing.
21
+
22
+ Now the work is yours. What did it actually change? Did it understand what you
23
+ meant? Is any of it wrong in a way you would only notice next week? And if it
24
+ misread you in the first thirty seconds, everything after that was wasted.
25
+
26
+ kaizen puts two checkpoints in that gap.
27
+
28
+ **Before** it starts, you see a plan and say yes or no. **After** it finishes, a
29
+ second agent — one that never saw the first agent's reasoning, so it has nothing to
30
+ defend — checks the work and tells you what is wrong. You decide what gets fixed.
31
+
32
+ ## See it
33
+
34
+ Pick whichever looks like your work. The five stages are identical in all of them —
35
+ what changes is what *done* and *wrong* mean, which kaizen works out from your
36
+ request rather than asking you.
37
+
38
+ <details open>
39
+ <summary><b>A customer email</b> — pricing change announcement</summary>
40
+
41
+ ```
42
+ you /kaizen rewrite the onboarding email — the new pricing starts on the 1st
43
+
44
+ kaizen Here is the plan.
45
+
46
+ This is a customer email, not a policy page.
47
+ Done means: a customer knows what changes, when, and what to do — in one read.
48
+ Wrong means: a claim we cannot stand behind, or someone thinks they are being
49
+ charged more than they are.
50
+
51
+ What I will do:
52
+ 1. Rewrite the opening so the date and the amount come first
53
+ 2. Add one line on what happens if they do nothing
54
+ 3. Keep the existing sign-off and legal footer untouched
55
+
56
+ Not doing: touching the pricing page itself — say the word if you want that too.
57
+
58
+ Approve this plan? [ approve ] [ change something ]
59
+
60
+ you approve
61
+
62
+ kaizen Done, and reviewed. Two things found:
63
+
64
+ 1. paragraph 2 high "Your price will not change" is not true for annual
65
+ plans renewing after the 1st. Fix: name both cases.
66
+ 2. subject line low 14 words, cut off on mobile. Fix: lead with the date.
67
+
68
+ Fix them? [ both ] [ just 1 ] [ leave it ]
69
+ ```
70
+
71
+ Nobody told the reviewer to look for an untrue claim or a truncated subject line. It
72
+ read the request, concluded this was a customer email, and reviewed it as one.
73
+
74
+ </details>
75
+
76
+ <details>
77
+ <summary><b>Code</b> — a bug in checkout</summary>
78
+
79
+ ```
80
+ you /kaizen the discount field lets you enter more than 100%
81
+
82
+ kaizen Here is the plan.
83
+
84
+ This is a bug fix in the checkout code.
85
+ Done means: a discount above 100 is rejected, and the existing tests still pass.
86
+ Wrong means: valid discounts stop working.
87
+
88
+ What I will do:
89
+ 1. Add a check in apply_discount() — cart.py:9
90
+ 2. Cover it with three tests — 0%, 100%, 101%
91
+
92
+ Approve this plan?
93
+
94
+ you approve
95
+
96
+ kaizen Done, and reviewed.
97
+ Verified: ran the suite — 47 passed, 0 failed. Before the change: 44 passed.
98
+
99
+ One problem found:
100
+
101
+ 1. cart.py:12 medium A discount of exactly 100 now returns 0 instead of
102
+ being rejected. Fix: use > not >=.
103
+ ```
104
+
105
+ `done` is a passing suite, so the builder has to show the run and its numbers —
106
+ before and after. "It should work" is not accepted in any track.
107
+
108
+ </details>
109
+
110
+ <details>
111
+ <summary><b>Marketing</b> — a landing page for a launch</summary>
112
+
113
+ ```
114
+ you /kaizen landing page copy for the Pro tier launch
115
+
116
+ kaizen Here is the plan.
117
+
118
+ This is launch copy aimed at existing free users, not new visitors.
119
+ Done means: a free user understands what Pro adds and what it costs, and can
120
+ act without opening another page.
121
+ Wrong means: an overclaim, a benefit we do not actually ship, or a price that
122
+ disagrees with billing.
123
+
124
+ What I will do:
125
+ 1. Headline and subhead — lead with the one thing free users ask for most
126
+ 2. Four benefits, each tied to a shipped feature
127
+ 3. Price block, pulled from the billing config so it cannot drift
128
+ 4. One CTA, repeated twice
129
+
130
+ Out of scope: the pricing page, the in-app upgrade banner.
131
+
132
+ Approve this plan?
133
+
134
+ you approve
135
+
136
+ kaizen Done, and reviewed. Three things found:
137
+
138
+ 1. benefits 3 high "Unlimited exports" — the shipped limit is 500/month.
139
+ 2. headline medium Names a competitor. Legal reviews those; flagging, not fixing.
140
+ 3. CTA low "Get started" appears on the free signup too. Ambiguous.
141
+ ```
142
+
143
+ The reviewer checked each claim against what actually ships. Finding 2 it refused to
144
+ fix on its own and handed to you — deliberately.
145
+
146
+ </details>
147
+
148
+ <details>
149
+ <summary><b>Research</b> — a decision memo</summary>
150
+
151
+ ```
152
+ you /kaizen should we move from per-seat to usage-based pricing? write it up
153
+
154
+ kaizen Here is the plan.
155
+
156
+ This is a decision memo for the founders, not a market report.
157
+ Done means: a recommendation with the reasoning shown, and the case against it
158
+ stated fairly enough that someone could disagree on the evidence.
159
+ Wrong means: a conclusion the evidence does not support, or only looking at
160
+ the data that agrees with it.
161
+
162
+ What I will do:
163
+ 1. Pull the last 12 months of seat counts and usage from the billing export
164
+ 2. Model both against actual accounts — who pays more, who pays less
165
+ 3. Name the three accounts that break the model, and by how much
166
+ 4. Recommend, with the strongest argument against it stated first
167
+
168
+ Approve this plan?
169
+
170
+ you approve
171
+
172
+ kaizen Done, and reviewed. Two things found:
173
+
174
+ 1. section 3 high The recommendation rests on 4 accounts out of 60. That
175
+ is not stated where the conclusion is.
176
+ 2. section 2 medium Churned accounts were excluded with no reason given —
177
+ they are the ones the model treats worst.
178
+ ```
179
+
180
+ Nothing here was checked for tests or tone. `wrong` was defined as an unsupported
181
+ leap and cherry-picked data, so that is what the reviewer went looking for.
182
+
183
+ </details>
184
+
185
+ <details>
186
+ <summary><b>Operations</b> — a migration runbook</summary>
187
+
188
+ ```
189
+ you /kaizen runbook for moving the database to the new region on Saturday
190
+
191
+ kaizen Here is the plan.
192
+
193
+ This is a runbook someone else executes at 2am, not a description of a plan.
194
+ Done means: a colleague can follow it start to finish without asking a question.
195
+ Wrong means: a missing prerequisite, no way back, or a step that silently
196
+ loses data.
197
+
198
+ What I will do:
199
+ 1. Prerequisites, with how to verify each one is true before starting
200
+ 2. Steps in order, each with the exact command and what you should see
201
+ 3. A rollback for every step that changes state
202
+ 4. The point of no return, marked
203
+
204
+ Approve this plan?
205
+
206
+ you approve
207
+
208
+ kaizen Done, and reviewed. Two things found:
209
+
210
+ 1. step 7 critical No rollback after the DNS cutover, and it is not marked
211
+ as the point of no return. Fix: mark it, add the TTL wait.
212
+ 2. step 3 high Says "restore the backup" but never says which backup or
213
+ how to confirm it is the right one.
214
+ ```
215
+
216
+ </details>
11
217
 
12
218
  ## Install
13
219
 
@@ -15,45 +221,243 @@ A quick-reference card ships separately as the `kaizen-help` skill.
15
221
  bunx kaizen-agent
16
222
  ```
17
223
 
18
- That clones the repo to `~/kaizen` (override with `KAIZEN_HOME`) and links the
19
- skills, agents, and commands into `~/.claude/`. Re-running it pulls and relinks, so
20
- it doubles as the updater. `npx kaizen-agent` works the same way.
224
+ It walks you through where to install, then tells you what to type next. Works with
225
+ `npx` too. Restart your editor afterwards.
226
+
227
+ Run from inside a project it asks whether to install globally or for that project
228
+ alone; anywhere else — your home directory, a plain folder, a script — it installs
229
+ globally without asking, since a project install outside a project has nothing to
230
+ belong to.
231
+
232
+ **It installs for every agent you already have.** The skill folders follow the open
233
+ Agent Skills standard, so the same workflow runs under any of them:
234
+
235
+ | Agent | Gets | Stages run |
236
+ |---|---|---|
237
+ | Claude Code | Skills, the three stage agents, the slash commands | Each as its own subagent |
238
+ | Codex | Skills | Sequentially, one session |
239
+ | Antigravity | Skills | Parallel agents where available, else sequentially |
240
+ | OpenCode, Cursor, Gemini CLI | Skills | Sequentially, one session |
241
+
242
+ Only directories that already exist are touched — installing does not create
243
+ `~/.opencode` for someone who does not use OpenCode. Install again after adding an
244
+ agent and it picks the new one up.
245
+
246
+ The stage agents and slash commands are Claude Code's own formats and are not copied
247
+ elsewhere; under the others you invoke the skill by name. `.kaizen/` is plain files
248
+ either way, so a run started in one tool can be finished in another.
249
+
250
+ Once installed, `kaizen` on its own opens a dashboard rather than installing again:
251
+
252
+ ```
253
+ kaizen 0.5.0 ~/Projects/app
254
+
255
+ Runs
256
+ ● 2026-09-07-fix-discount waiting on you — approvals.plan
257
+ ● 2026-09-06-cache-headers in flight — review
258
+ ● 3 done
21
259
 
22
- To work on kaizen itself, clone first and install from the checkout — the links then
23
- point at your working copy:
260
+ Backlog 4 open
261
+
262
+ Installed for Claude Code, Codex, Antigravity
263
+
264
+ › Settings modes, approvals, who builds
265
+ Upgrade
266
+ Quit
267
+ ```
268
+
269
+ It reads the project you are standing in, so it answers "what is this repo waiting on
270
+ me for" without opening an agent. Installing also puts that `kaizen` command on your
271
+ PATH, so updating later is:
24
272
 
25
273
  ```bash
26
- git clone https://github.com/hfadhlullah/kaizen.git ~/kaizen
27
- cd ~/kaizen && bun run cli/install.ts
274
+ kaizen upgrade
275
+ ```
276
+
277
+ That pulls the latest workflow, relinks anything new, and clears the installer cache
278
+ `bunx` keeps — which is what otherwise leaves you on an old version without saying
279
+ so. `bunx kaizen-agent upgrade` does the same thing if you would rather not have the
280
+ command.
281
+
282
+ Then, in any project, just ask for something:
283
+
28
284
  ```
285
+ /kaizen <what you want done>
286
+ ```
287
+
288
+ The first run sets the project up on its own — a `.kaizen/` folder holding the run's
289
+ files. Nothing to initialise by hand. (`/kaizen-init` exists if you want to do it
290
+ ahead of time, and the installer offers it for the project you install from.)
291
+
292
+ Setup also adds a short section to the project's `CLAUDE.md`, so you can stop typing
293
+ `/kaizen` entirely — ask for something the normal way and work worth a plan goes
294
+ through the stages on its own. It draws the line at work worth a plan: a change
295
+ across more than one file, anything with a migration or a rollback, a document
296
+ someone else will act on. Questions and one-line fixes are answered, not staged.
297
+ Delete that section to go back to `/kaizen` being explicit.
298
+
299
+ That is the whole thing. Everything below is detail.
300
+
301
+ ## How a run goes
29
302
 
30
- Flags, either way:
303
+ | | Stage | What happens |
304
+ |---|---|---|
305
+ | 1 | **Plan** | Reads your request and the existing material, writes a plan. Changes nothing. |
306
+ | 2 | **You approve** | You see the plan and the work list. Say yes, or say what to change. |
307
+ | 3 | **Build** | Does the work, then proves it — runs the tests, checks the claim against its source, walks the steps — and records what actually came back. |
308
+ | 4 | **Review** | A different agent, which never saw stage 3's reasoning, checks the work and lists what is wrong, numbered and graded. |
309
+ | 5 | **Fix** | Serious findings get fixed and re-checked, up to a limit. Anything left over is handed to you, never quietly dropped. |
310
+
311
+ Each stage runs as its own agent with a clean slate, and writes a file before the
312
+ next one starts. That is what makes stage 4 worth anything: a reviewer that watched
313
+ itself do the work will defend it.
314
+
315
+ Stage 3 is the one you can move. Set `build.executor` to `inline` and the agent you
316
+ are already talking to does the work — you watch each step and can interrupt — or
317
+ leave it as `subagent` and it is handed off and reported back, which keeps your
318
+ conversation short and is the only workable choice on a big run. Set it to `ask` to
319
+ be offered the choice each time you approve a plan. Stage 4 does not move: the
320
+ reviewer is a separate agent either way, because that is the whole reason its
321
+ findings are worth reading.
322
+
323
+ ## How it knows what kind of work this is
324
+
325
+ kaizen is not a software workflow. The same five stages hold for a book chapter, a
326
+ launch email, a migration runbook, or a research memo — what changes is what
327
+ *deliverable*, *done*, and *wrong* mean.
328
+
329
+ Each run works that out for itself — its **track** — by answering three questions
330
+ from your request:
331
+
332
+ - **What is the deliverable?** A merged change, a chapter, a landing page, a runbook.
333
+ - **What counts as done?** Tests pass. The chapter reads end to end. A colleague can
334
+ follow the runbook unaided.
335
+ - **What would make it wrong?** A security hole. A claim that is not true. A step
336
+ that silently loses data.
337
+
338
+ The third answer is what the reviewer becomes. A reviewer hunting race conditions in
339
+ a book manuscript is worse than no reviewer at all, and the track is what prevents
340
+ it. You are never asked to categorise your own request — it reads the request and
341
+ tells you what it concluded, so you correct a sentence instead of filling in a form.
342
+
343
+ ## Commands
344
+
345
+ | Command | What it does |
346
+ |---|---|
347
+ | `/kaizen <request>` | Start a run |
348
+ | `/kaizen-plan <request>` | Plan only — stop before anything is built |
349
+ | `/kaizen-auto <request>` | No approval stops; report at the end |
350
+ | `/kaizen-review [target]` | Review something that already exists |
351
+ | `/kaizen-status` | What is waiting on you, in flight, done |
352
+ | `/kaizen-approve` | Approve whatever the run is waiting on |
353
+ | `/kaizen-reject <reason>` | Send it back with a reason, or kill the run |
354
+ | `/kaizen-run` | Carry on with an approved plan |
355
+ | `/kaizen-backlog` | Everything noticed but not done, across all runs |
356
+ | `/kaizen-abort` | Abandon the current run |
357
+ | `/kaizen-config` | Show this project's settings and change them |
358
+ | `/kaizen-init` | Set up the current project — optional, the first run does it |
359
+ | `/kaizen-help` | The full card |
31
360
 
32
- Run interactively and it walks you through it: where to install, and whether to set
33
- up the repository you are standing in. Piped or scripted runs take the global
34
- install and ask nothing.
361
+ ## What it writes
35
362
 
36
- If `bunx` gives you an older version, it is serving its cache — clear it with
37
- `rm -rf /tmp/bunx-*-kaizen-agent*`.
363
+ Everything a run knows lives in files next to the work, not in a chat window:
364
+
365
+ ```
366
+ .kaizen/
367
+ config.yml # how much it asks you, what it fixes on its own
368
+ memory.md # what past reviews learned about this project
369
+ runs/2026-09-07-onboarding-email/
370
+ 00-request.md # what you asked, word for word
371
+ 01-plan.md # the plan you approved
372
+ 02-approval.md # what you decided, and why
373
+ 03-impl.md # what changed, and the proof it works
374
+ 04-review.md # findings, numbered and graded
375
+ 06-backlog.md # what was noticed but not done
376
+ ```
377
+
378
+ Plain files, so you can read them, commit them, and pick a run back up tomorrow —
379
+ or in another tool. kaizen also runs under Codex and Antigravity, and a run started
380
+ in one can be finished in another. See [adapters.md](https://github.com/hfadhlullah/kaizen/blob/main/skills/kaizen/adapters.md).
381
+
382
+ ## Settings
383
+
384
+ `.kaizen/config.yml`, written when the project is set up. The three worth knowing:
385
+
386
+ | Setting | Default | Meaning |
387
+ |---|---|---|
388
+ | `mode` | `approve` | `approve` stops for you; `auto` never does; `plan-only` stops after the plan |
389
+ | `build.executor` | `subagent` | Who does the work: a separate agent, `inline` in the current one, or `ask` each time |
390
+ | `auto_fix.min_severity` | `high` | Findings this bad or worse get fixed without asking |
391
+ | `approvals.plan` | `true` | Stop and show the plan before anything is built |
392
+
393
+ ```bash
394
+ kaizen settings
395
+ ```
396
+
397
+ opens a full-screen browser over the whole file — arrows to move and change, every
398
+ change written as you make it, esc to close:
399
+
400
+ ```
401
+ kaizen settings ~/Projects/app/.kaizen/config.yml
402
+
403
+ mode approve
404
+ › build.executor inline
405
+ approvals.plan true
406
+ approvals.review false
407
+ auto_fix.min_severity high
408
+ auto_fix.max_iterations 2
409
+ ...
410
+
411
+ Who carries out the approved plan
412
+
413
+ ↑↓ move · ←→ change · esc close saved build.executor = inline
414
+ ```
415
+
416
+ It edits each line in place, so the comment above every key survives. `/kaizen-config`
417
+ does the same thing from inside your agent if you would rather not leave it. Everything is also
418
+ in [`config.default.yml`](https://github.com/hfadhlullah/kaizen/blob/main/skills/kaizen/config.default.yml),
419
+ with a comment on each key, if you would rather edit the file.
420
+
421
+ ## Under the hood
422
+
423
+ - [`SKILL.md`](https://github.com/hfadhlullah/kaizen/blob/main/skills/kaizen/SKILL.md) — how the workflow behaves
424
+ - [`spec.md`](https://github.com/hfadhlullah/kaizen/blob/main/skills/kaizen/spec.md) — the tool-neutral contract every stage follows
425
+ - [`adapters.md`](https://github.com/hfadhlullah/kaizen/blob/main/skills/kaizen/adapters.md) — running it under Codex or Antigravity
426
+
427
+ <details>
428
+ <summary>Installer flags, updating, and installing without bun</summary>
38
429
 
39
430
  | Flag | Effect |
40
431
  |---|---|
41
- | *(none)* | Ask, defaulting to every project (`~/.claude/`) |
42
- | `--global` | Every project, no question asked |
43
- | `--project` | Install into `.claude/` in the current directory only |
44
- | `--check` | Report what is linked and exit non-zero if anything is missing |
432
+ | *(none)* | Ask when standing in a project, otherwise install globally |
433
+ | `--global` | Globally, no question asked |
434
+ | `--project` | Into the current directory only |
435
+ | `--check` | Report what is linked, exit non-zero if anything is missing |
45
436
  | `--force` | Replace a real file sitting where a link belongs |
46
437
  | `--yes` | Take every default, ask nothing |
47
438
  | `--verbose` | List every link instead of a one-line summary |
439
+ | `upgrade` | Pull, relink, and clear the installer cache. No prompts. |
440
+ | `settings` | Open the settings browser for the nearest `.kaizen/`. Also `config`. |
48
441
 
49
- It is idempotent — an already-correct link is left alone, so re-running after a
50
- `git pull` is safe and reports what changed.
442
+ A global install also writes `~/.local/bin/kaizen`, a two-line launcher pointing at
443
+ the clone, so `kaizen upgrade` works from anywhere. It tells you if that directory is
444
+ not on your PATH. Delete the file to remove it; `--project` installs skip it.
51
445
 
52
- Restart Claude Code after linking — skills load live, slash commands and the
53
- statusline only pick up on session start.
446
+ Re-running is safe: correct links are left alone.
54
447
 
55
- <details>
56
- <summary>Without bun</summary>
448
+ `bunx` extracts a package once and reuses it without re-resolving, so a plain
449
+ `bunx kaizen-agent` can keep running an old installer even after a new one is
450
+ published. `upgrade` clears that copy, so the next run resolves fresh. The workflow
451
+ itself — skills, agents, commands — comes from the clone and updates on any run.
452
+
453
+ To work on kaizen itself, install from your own checkout so the links point at it:
454
+
455
+ ```bash
456
+ git clone https://github.com/hfadhlullah/kaizen.git ~/kaizen
457
+ cd ~/kaizen && bun run cli/install.ts
458
+ ```
459
+
460
+ Without bun:
57
461
 
58
462
  ```bash
59
463
  mkdir -p ~/.claude/skills ~/.claude/agents ~/.claude/commands
@@ -65,26 +469,7 @@ for f in ~/kaizen/commands/kaizen-*.md; do ln -s "$f" ~/.claude/commands/"$(base
65
469
 
66
470
  </details>
67
471
 
68
- Symlinks instead of copies: `git pull` in the clone updates the live install.
472
+ ## License
69
473
 
70
- ## Update
71
-
72
- ```bash
73
- bunx kaizen-agent
74
- ```
75
-
76
- Symlinks mean a `git pull` in the clone updates the live install by itself; the
77
- command above does the pull and relinks anything new in one step. `bun run
78
- cli/install.ts --check` reports the state of every link without changing anything.
79
-
80
- ## Layout
81
-
82
- ```
83
- kaizen/
84
- skills/kaizen/ # SKILL.md, spec*.md, config.default.yml, adapters.md, README.md
85
- skills/kaizen-help/ # quick-reference card
86
- agents/ # kaizen-planner.md, kaizen-builder.md, kaizen-reviewer.md
87
- commands/ # /kaizen-plan, -auto, -run, -review, -status, -backlog,
88
- # -approve, -reject, -abort, -init, -install
89
- cli/install.ts # bun installer: links the three directories into .claude/
90
- ```
474
+ MIT. *Kaizen (改善) is Japanese for continuous improvement — small changes, checked
475
+ as you go.*