kaizen-agent 1.6.8 → 1.7.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 (39) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +657 -647
  3. package/agents/kaizen-builder.md +77 -77
  4. package/agents/kaizen-planner.md +250 -250
  5. package/agents/kaizen-reviewer.md +127 -127
  6. package/cli/dashboard.ts +1187 -1187
  7. package/cli/install.ts +959 -959
  8. package/cli/publish-gh.sh +27 -27
  9. package/cli/release.sh +45 -45
  10. package/cli/settings.ts +415 -415
  11. package/cli/state.test.ts +197 -197
  12. package/cli/state.ts +691 -691
  13. package/cli/web.ts +416 -403
  14. package/commands/kaizen-abort.md +5 -5
  15. package/commands/kaizen-approve.md +5 -5
  16. package/commands/kaizen-auto.md +6 -6
  17. package/commands/kaizen-backlog.md +5 -5
  18. package/commands/kaizen-config.md +5 -5
  19. package/commands/kaizen-full.md +5 -5
  20. package/commands/kaizen-init.md +5 -5
  21. package/commands/kaizen-install.md +5 -5
  22. package/commands/kaizen-lite.md +5 -5
  23. package/commands/kaizen-plan.md +6 -6
  24. package/commands/kaizen-reject.md +6 -6
  25. package/commands/kaizen-review.md +6 -6
  26. package/commands/kaizen-run.md +5 -5
  27. package/commands/kaizen-status.md +5 -5
  28. package/package.json +1 -1
  29. package/skills/kaizen/README.md +281 -281
  30. package/skills/kaizen/SKILL.md +440 -440
  31. package/skills/kaizen/adapters.md +77 -77
  32. package/skills/kaizen/config.default.yml +167 -167
  33. package/skills/kaizen/spec-build.md +119 -119
  34. package/skills/kaizen/spec-main.md +104 -104
  35. package/skills/kaizen/spec-plan.md +201 -201
  36. package/skills/kaizen/spec-review.md +121 -121
  37. package/skills/kaizen/spec.md +153 -153
  38. package/skills/kaizen-help/SKILL.md +129 -129
  39. package/web/board.html +513 -444
@@ -1,201 +1,201 @@
1
- # Kaizen — plan stage
2
-
3
- Read with [`spec.md`](spec.md) (core: track, intake, resume). This file is the
4
- planner's and the plan approval's contract. The builder and reviewer do not read it.
5
-
6
- ---
7
- ## Stage 1 — Plan
8
-
9
- **Agent:** planner. **Input:** `00-request.md` (including the track), `notes.md` in
10
- the run directory when present — links, paths, and background the user attached from
11
- the board, binding like the request itself — `memory.md`, and the existing material —
12
- the codebase, the manuscript, the current campaign, whatever this run builds on.
13
- **Output:** `01-plan.md`.
14
-
15
- The request is usually one sentence. The planner's first job is to expand it — but by
16
- proposing, not by interrogating. It restates the problem, brings the nearest good
17
- solution, and names the assumptions it took, so the user reacts to something concrete
18
- instead of answering a questionnaire. Correcting a proposal costs a sentence;
19
- answering five questions costs the user the work they came with.
20
-
21
- The planner has an opinion: it says which approach it would take and why, and says
22
- plainly when the request as stated will not achieve what the user evidently wants. It
23
- asks outright only when a proposal is genuinely impossible — two readings, materially
24
- different work behind each, nothing available to break the tie — and even then brings
25
- its recommendation with the question. Questions the existing material can answer are
26
- never asked; that is the planner's own work.
27
-
28
- **Building from nothing is the exception: settle the foundation first.** When the
29
- track is a new product or app, there is no material to answer the questions that
30
- decide everything after them, and "wrong" for this track is a wrong foundation — the
31
- one thing a review cannot fix, because fixing it is a rebuild. Before the steps are
32
- written, the plan states a decision for each of: platform (web, mobile, PWA, native,
33
- CLI), who and how many will use it, stack, how it is distributed and reached, access
34
- (open, invite, accounts), what data is kept and where, and hosting. Each is either
35
- read from the request, proposed with its reason, or — where two answers lead to
36
- materially different builds — put to the user as an *Open question* with options,
37
- all in one round, before anything is built. Three quick questions and a default for
38
- the rest is how a run ends up writing the second app instead of the first.
39
-
40
- The goals stay the user's. The planner may propose a better solution to what was
41
- asked, or argue that the request as stated will not achieve what the user wants, but
42
- it may not widen the goal on its own. Anything beyond the request goes in *Out of
43
- scope suggestions* for a separate decision.
44
-
45
- The planner reads code but writes none. Its plan must contain:
46
-
47
- 0. **Framing** — the problem in the planner's own words: what is wrong now, what
48
- would be true instead, why it matters, the approach chosen, and the alternatives
49
- rejected with a reason each. The human checks this first; a wrong restatement
50
- makes everything after it wrong.
51
- 1. **Goal** — one paragraph, in the user's terms, on what will be true when done.
52
- 2. **Scope** — what is included, and an explicit *not included* list. The second list
53
- is what prevents the builder from wandering.
54
- 3. **Existing material to reuse** — concrete references: `path:line` for code, section
55
- or page for a document, the existing asset for anything else. A plan that proposes
56
- building something that already exists is a failed plan, in any track.
57
- 4. **File manifest** — every path this run will read or change, as a flat list. The
58
- planner already located them; the builder and the reviewer read this list instead
59
- of searching the material again. A path missing here is a path the later stages
60
- will have to find twice.
61
- 5. **Steps** — ordered, each naming what it touches and what changes.
62
- 6. **Verification** — how the result gets proven, in the track's terms: which tests
63
- and commands for code; which claims get checked against which source for a
64
- document; who reads it and understands what for communication work; who executes
65
- it unaided for a runbook. "It should work" is not verification in any track.
66
-
67
- Write this as a **numbered gate** — `G-01`, `G-02`, … — derived from the track's
68
- third answer, *what would make it wrong*. The numbering is per run, not a standing
69
- catalogue: the sixth kind of work still gets a real gate because its gate is
70
- written from its own request rather than looked up. Each item is one checkable
71
- question, and each carries a tier, which is where its severity comes from:
72
-
73
- - **block** — the run is wrong if this fails. Reviewer severity `critical` or `high`.
74
- - **reason** — the thing is allowed, but the builder must write down why. An
75
- unexplained new dependency, abstraction, file, or section fails this tier.
76
- Reviewer severity `medium`.
77
- - **lock** — consistency with what is already there. Reviewer severity `low`.
78
-
79
- Phrase every item so the answer is yes or no. "Handles errors well" is not a gate
80
- item; "every new query path has a covering test" is. A tier fixes the severity
81
- before the reviewer has an opinion, which is what stops the same class of problem
82
- being `high` in one run and `medium` in the next.
83
- 7. **Design direction, for any work with a visual surface** — a website, a landing
84
- page, a UI, a deck, a printed piece. The direction is settled before the builder
85
- starts, because it is the one decision that cannot be changed afterwards without
86
- redoing the work: copy survives a re-skin, markup does not.
87
-
88
- Look for it in the material first — a `design.md`, a design system, a brand or style
89
- guide, an existing stylesheet with established tokens. Where one exists, the plan
90
- names it and follows it, and asks nothing; the answer is already in the repository.
91
-
92
- Where none exists, the direction is an *Open question* with 3-4 concrete options,
93
- each named for what it signals rather than for its palette, so the user chooses a
94
- positioning rather than a color. Bringing one direction and building it is the
95
- failure this item exists to prevent: the planner has an opinion here as everywhere
96
- else, but a visual direction chosen silently is a decision taken from the user, not
97
- a proposal made to them.
98
-
99
- 8. **Risks** — what could break, what is irreversible, what needs a migration or a
100
- backup taken first.
101
- 9. **Open questions** — assumptions that survived the interview. If this list is
102
- non-empty, the approval must ask the user about it rather than defaulting.
103
- 10. **Out of scope suggestions** — worthwhile things noticed but not asked for, each
104
- its own proposal. Never folded into a step.
105
-
106
- The plan is a proposal, not a decision. It never edits files, runs migrations, or
107
- installs packages.
108
-
109
- **Length is a cost the whole run pays.** Every later stage reads this file, and the
110
- fix loop reads it again per iteration, so a line written once is read five or six
111
- times. Sections 3 to 6 — the material to reuse, the file manifest, the steps, the
112
- verification — earn their length: they are what stop every later stage searching the
113
- material again, and cutting them costs more than it saves. Sections 0, 1, 8 and 10 are
114
- read once by a human at the approval and should be as short as they can be and still
115
- be correct: a paragraph of framing, a paragraph of goal, the risks that are real, the
116
- questions that are open. An alternative rejected gets a line saying what and why, not
117
- a case against it.
118
-
119
- A plan whose framing is longer than its steps is a plan that spent the run's budget
120
- explaining itself.
121
-
122
- ---
123
-
124
- ## Plan approval
125
-
126
- Controlled by `approvals.plan` (default on), skipped in `auto`.
127
-
128
- Present to the user, in this order:
129
-
130
- 1. The track, the goal, and the top risk — a few lines, not the whole plan file.
131
- 2. **The work list**, verbatim from the plan: plain bullets of what will actually be
132
- done. This is the last thing the user sees before anything is produced, so it must
133
- be readable on its own, without the plan's reasoning around it.
134
- 3. The open questions, **as a pick list** — see below.
135
-
136
- **Who builds it.** Governed by `build.executor`. On `subagent` or `inline` the
137
- approval says which is about to happen in one line and moves on; on `ask` it is one
138
- more choice at this approval:
139
-
140
- - **subagent** (default) — dispatch the builder as its own agent. The main thread
141
- keeps its context, and the work is reported back rather than watched. Right for
142
- most runs, and the only sane option for a large one.
143
- - **inline** — the main thread does the work itself, against this plan. You watch it
144
- happen and can interrupt mid-step, and it already holds the conversation the plan
145
- came out of. It costs main-thread context, and a long run will exhaust it.
146
-
147
- Either way the builder's contract is unchanged: the plan is the scope, `03-impl.md`
148
- is written the same way, and the gate is answered with the same evidence. **The
149
- reviewer is always a separate agent, in both.** Its independence is what the review
150
- is worth, and it is not the user's to trade away — an inline build is judged by an
151
- agent that never saw it happen, exactly as a dispatched one is.
152
-
153
- Do not dump the whole plan into the terminal; point at its path for the detail.
154
-
155
- **Ask with options, not open prose.** Every question the plan raises is put to the
156
- user as a selectable choice with 2–4 concrete options, using whatever mechanism the
157
- tool provides for structured questions (in Claude Code, the AskUserQuestion tool).
158
- The planner writes the options; the main thread renders them, because a subagent
159
- cannot prompt the user directly. Never add an "other" option by hand — a free-text
160
- answer is always available, and the user may ignore the options entirely.
161
-
162
- This applies to any question the workflow asks at any stage, not only at this
163
- approval.
164
-
165
- **This approval is a conversation, not a form.** The user does not have to type an
166
- approval command. "Yes but drop step three", "do it", "no — I meant the other panel",
167
- "what happens if it fails halfway?" are all valid responses and are handled as what
168
- they plainly are. Answer questions at the approval without treating them as rejections;
169
- a person interrogating the plan is doing exactly what the approval exists for.
170
-
171
- Partial approval is normal: apply the modification to the plan, restate what changed
172
- in one line, and proceed on the modified plan. A change large enough to alter the
173
- goal goes back through the planner instead.
174
-
175
- Write the outcome to `02-approval.md`: decision, reason, timestamp, and any
176
- modification the user asked for. When the decision is an approval — full or partial —
177
- the same write appends to `runs/<id>/06-backlog.md` every out-of-scope suggestion that
178
- was not folded into the approved scope, plus anything cut from scope at this approval,
179
- each as `open` — see *Backlog* below for the format. The backlog is a candidate list,
180
- not a commitment list, so silence at the approval captures the item rather than losing
181
- it. A rejection appends nothing: there is no approved scope yet to measure against, and
182
- the approval of the revised plan is what captures the items, once.
183
-
184
- **A rejection is one of two different things, and the reason says which.** "Do it
185
- differently" is a revise: hand the file back to the planner with the reason, it
186
- produces a new `01-plan.md`, and the run returns to this same approval. "Not doing
187
- this" is a kill: the request itself was wrong, not just the approach — mark
188
- `stage: "abandoned"` in `state.json` and stop; there is nothing to revise toward.
189
-
190
- Read the reason to tell which. Revise-shaped: disagreement with an approach, a step,
191
- a scope boundary, an assumption — anything where a different plan would be accepted.
192
- Kill-shaped: the goal is no longer wanted, was based on a misunderstanding now
193
- resolved outside the plan, or a "no" with no implied alternative. When genuinely
194
- unclear, state which reading was taken in `02-approval.md` rather than guessing
195
- silently — a wrong revise wastes one planner cycle; a wrong kill discards a plan that
196
- should have been fixed instead, silently and without a record.
197
-
198
- Either way, do not proceed to implementation on a rejected plan under any mode. A
199
- revised plan returns through this same approval; a killed run's `stage` never advances
200
- past `"abandoned"`.
201
-
1
+ # Kaizen — plan stage
2
+
3
+ Read with [`spec.md`](spec.md) (core: track, intake, resume). This file is the
4
+ planner's and the plan approval's contract. The builder and reviewer do not read it.
5
+
6
+ ---
7
+ ## Stage 1 — Plan
8
+
9
+ **Agent:** planner. **Input:** `00-request.md` (including the track), `notes.md` in
10
+ the run directory when present — links, paths, and background the user attached from
11
+ the board, binding like the request itself — `memory.md`, and the existing material —
12
+ the codebase, the manuscript, the current campaign, whatever this run builds on.
13
+ **Output:** `01-plan.md`.
14
+
15
+ The request is usually one sentence. The planner's first job is to expand it — but by
16
+ proposing, not by interrogating. It restates the problem, brings the nearest good
17
+ solution, and names the assumptions it took, so the user reacts to something concrete
18
+ instead of answering a questionnaire. Correcting a proposal costs a sentence;
19
+ answering five questions costs the user the work they came with.
20
+
21
+ The planner has an opinion: it says which approach it would take and why, and says
22
+ plainly when the request as stated will not achieve what the user evidently wants. It
23
+ asks outright only when a proposal is genuinely impossible — two readings, materially
24
+ different work behind each, nothing available to break the tie — and even then brings
25
+ its recommendation with the question. Questions the existing material can answer are
26
+ never asked; that is the planner's own work.
27
+
28
+ **Building from nothing is the exception: settle the foundation first.** When the
29
+ track is a new product or app, there is no material to answer the questions that
30
+ decide everything after them, and "wrong" for this track is a wrong foundation — the
31
+ one thing a review cannot fix, because fixing it is a rebuild. Before the steps are
32
+ written, the plan states a decision for each of: platform (web, mobile, PWA, native,
33
+ CLI), who and how many will use it, stack, how it is distributed and reached, access
34
+ (open, invite, accounts), what data is kept and where, and hosting. Each is either
35
+ read from the request, proposed with its reason, or — where two answers lead to
36
+ materially different builds — put to the user as an *Open question* with options,
37
+ all in one round, before anything is built. Three quick questions and a default for
38
+ the rest is how a run ends up writing the second app instead of the first.
39
+
40
+ The goals stay the user's. The planner may propose a better solution to what was
41
+ asked, or argue that the request as stated will not achieve what the user wants, but
42
+ it may not widen the goal on its own. Anything beyond the request goes in *Out of
43
+ scope suggestions* for a separate decision.
44
+
45
+ The planner reads code but writes none. Its plan must contain:
46
+
47
+ 0. **Framing** — the problem in the planner's own words: what is wrong now, what
48
+ would be true instead, why it matters, the approach chosen, and the alternatives
49
+ rejected with a reason each. The human checks this first; a wrong restatement
50
+ makes everything after it wrong.
51
+ 1. **Goal** — one paragraph, in the user's terms, on what will be true when done.
52
+ 2. **Scope** — what is included, and an explicit *not included* list. The second list
53
+ is what prevents the builder from wandering.
54
+ 3. **Existing material to reuse** — concrete references: `path:line` for code, section
55
+ or page for a document, the existing asset for anything else. A plan that proposes
56
+ building something that already exists is a failed plan, in any track.
57
+ 4. **File manifest** — every path this run will read or change, as a flat list. The
58
+ planner already located them; the builder and the reviewer read this list instead
59
+ of searching the material again. A path missing here is a path the later stages
60
+ will have to find twice.
61
+ 5. **Steps** — ordered, each naming what it touches and what changes.
62
+ 6. **Verification** — how the result gets proven, in the track's terms: which tests
63
+ and commands for code; which claims get checked against which source for a
64
+ document; who reads it and understands what for communication work; who executes
65
+ it unaided for a runbook. "It should work" is not verification in any track.
66
+
67
+ Write this as a **numbered gate** — `G-01`, `G-02`, … — derived from the track's
68
+ third answer, *what would make it wrong*. The numbering is per run, not a standing
69
+ catalogue: the sixth kind of work still gets a real gate because its gate is
70
+ written from its own request rather than looked up. Each item is one checkable
71
+ question, and each carries a tier, which is where its severity comes from:
72
+
73
+ - **block** — the run is wrong if this fails. Reviewer severity `critical` or `high`.
74
+ - **reason** — the thing is allowed, but the builder must write down why. An
75
+ unexplained new dependency, abstraction, file, or section fails this tier.
76
+ Reviewer severity `medium`.
77
+ - **lock** — consistency with what is already there. Reviewer severity `low`.
78
+
79
+ Phrase every item so the answer is yes or no. "Handles errors well" is not a gate
80
+ item; "every new query path has a covering test" is. A tier fixes the severity
81
+ before the reviewer has an opinion, which is what stops the same class of problem
82
+ being `high` in one run and `medium` in the next.
83
+ 7. **Design direction, for any work with a visual surface** — a website, a landing
84
+ page, a UI, a deck, a printed piece. The direction is settled before the builder
85
+ starts, because it is the one decision that cannot be changed afterwards without
86
+ redoing the work: copy survives a re-skin, markup does not.
87
+
88
+ Look for it in the material first — a `design.md`, a design system, a brand or style
89
+ guide, an existing stylesheet with established tokens. Where one exists, the plan
90
+ names it and follows it, and asks nothing; the answer is already in the repository.
91
+
92
+ Where none exists, the direction is an *Open question* with 3-4 concrete options,
93
+ each named for what it signals rather than for its palette, so the user chooses a
94
+ positioning rather than a color. Bringing one direction and building it is the
95
+ failure this item exists to prevent: the planner has an opinion here as everywhere
96
+ else, but a visual direction chosen silently is a decision taken from the user, not
97
+ a proposal made to them.
98
+
99
+ 8. **Risks** — what could break, what is irreversible, what needs a migration or a
100
+ backup taken first.
101
+ 9. **Open questions** — assumptions that survived the interview. If this list is
102
+ non-empty, the approval must ask the user about it rather than defaulting.
103
+ 10. **Out of scope suggestions** — worthwhile things noticed but not asked for, each
104
+ its own proposal. Never folded into a step.
105
+
106
+ The plan is a proposal, not a decision. It never edits files, runs migrations, or
107
+ installs packages.
108
+
109
+ **Length is a cost the whole run pays.** Every later stage reads this file, and the
110
+ fix loop reads it again per iteration, so a line written once is read five or six
111
+ times. Sections 3 to 6 — the material to reuse, the file manifest, the steps, the
112
+ verification — earn their length: they are what stop every later stage searching the
113
+ material again, and cutting them costs more than it saves. Sections 0, 1, 8 and 10 are
114
+ read once by a human at the approval and should be as short as they can be and still
115
+ be correct: a paragraph of framing, a paragraph of goal, the risks that are real, the
116
+ questions that are open. An alternative rejected gets a line saying what and why, not
117
+ a case against it.
118
+
119
+ A plan whose framing is longer than its steps is a plan that spent the run's budget
120
+ explaining itself.
121
+
122
+ ---
123
+
124
+ ## Plan approval
125
+
126
+ Controlled by `approvals.plan` (default on), skipped in `auto`.
127
+
128
+ Present to the user, in this order:
129
+
130
+ 1. The track, the goal, and the top risk — a few lines, not the whole plan file.
131
+ 2. **The work list**, verbatim from the plan: plain bullets of what will actually be
132
+ done. This is the last thing the user sees before anything is produced, so it must
133
+ be readable on its own, without the plan's reasoning around it.
134
+ 3. The open questions, **as a pick list** — see below.
135
+
136
+ **Who builds it.** Governed by `build.executor`. On `subagent` or `inline` the
137
+ approval says which is about to happen in one line and moves on; on `ask` it is one
138
+ more choice at this approval:
139
+
140
+ - **subagent** (default) — dispatch the builder as its own agent. The main thread
141
+ keeps its context, and the work is reported back rather than watched. Right for
142
+ most runs, and the only sane option for a large one.
143
+ - **inline** — the main thread does the work itself, against this plan. You watch it
144
+ happen and can interrupt mid-step, and it already holds the conversation the plan
145
+ came out of. It costs main-thread context, and a long run will exhaust it.
146
+
147
+ Either way the builder's contract is unchanged: the plan is the scope, `03-impl.md`
148
+ is written the same way, and the gate is answered with the same evidence. **The
149
+ reviewer is always a separate agent, in both.** Its independence is what the review
150
+ is worth, and it is not the user's to trade away — an inline build is judged by an
151
+ agent that never saw it happen, exactly as a dispatched one is.
152
+
153
+ Do not dump the whole plan into the terminal; point at its path for the detail.
154
+
155
+ **Ask with options, not open prose.** Every question the plan raises is put to the
156
+ user as a selectable choice with 2–4 concrete options, using whatever mechanism the
157
+ tool provides for structured questions (in Claude Code, the AskUserQuestion tool).
158
+ The planner writes the options; the main thread renders them, because a subagent
159
+ cannot prompt the user directly. Never add an "other" option by hand — a free-text
160
+ answer is always available, and the user may ignore the options entirely.
161
+
162
+ This applies to any question the workflow asks at any stage, not only at this
163
+ approval.
164
+
165
+ **This approval is a conversation, not a form.** The user does not have to type an
166
+ approval command. "Yes but drop step three", "do it", "no — I meant the other panel",
167
+ "what happens if it fails halfway?" are all valid responses and are handled as what
168
+ they plainly are. Answer questions at the approval without treating them as rejections;
169
+ a person interrogating the plan is doing exactly what the approval exists for.
170
+
171
+ Partial approval is normal: apply the modification to the plan, restate what changed
172
+ in one line, and proceed on the modified plan. A change large enough to alter the
173
+ goal goes back through the planner instead.
174
+
175
+ Write the outcome to `02-approval.md`: decision, reason, timestamp, and any
176
+ modification the user asked for. When the decision is an approval — full or partial —
177
+ the same write appends to `runs/<id>/06-backlog.md` every out-of-scope suggestion that
178
+ was not folded into the approved scope, plus anything cut from scope at this approval,
179
+ each as `open` — see *Backlog* below for the format. The backlog is a candidate list,
180
+ not a commitment list, so silence at the approval captures the item rather than losing
181
+ it. A rejection appends nothing: there is no approved scope yet to measure against, and
182
+ the approval of the revised plan is what captures the items, once.
183
+
184
+ **A rejection is one of two different things, and the reason says which.** "Do it
185
+ differently" is a revise: hand the file back to the planner with the reason, it
186
+ produces a new `01-plan.md`, and the run returns to this same approval. "Not doing
187
+ this" is a kill: the request itself was wrong, not just the approach — mark
188
+ `stage: "abandoned"` in `state.json` and stop; there is nothing to revise toward.
189
+
190
+ Read the reason to tell which. Revise-shaped: disagreement with an approach, a step,
191
+ a scope boundary, an assumption — anything where a different plan would be accepted.
192
+ Kill-shaped: the goal is no longer wanted, was based on a misunderstanding now
193
+ resolved outside the plan, or a "no" with no implied alternative. When genuinely
194
+ unclear, state which reading was taken in `02-approval.md` rather than guessing
195
+ silently — a wrong revise wastes one planner cycle; a wrong kill discards a plan that
196
+ should have been fixed instead, silently and without a record.
197
+
198
+ Either way, do not proceed to implementation on a rejected plan under any mode. A
199
+ revised plan returns through this same approval; a killed run's `stage` never advances
200
+ past `"abandoned"`.
201
+