kaizen-agent 1.7.1 → 1.7.2
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/LICENSE +21 -21
- package/README.md +657 -657
- package/agents/kaizen-builder.md +77 -77
- package/agents/kaizen-planner.md +250 -250
- package/agents/kaizen-reviewer.md +127 -127
- package/cli/dashboard.ts +1187 -1187
- package/cli/install.ts +947 -947
- package/cli/publish-gh.sh +27 -27
- package/cli/release.sh +45 -45
- package/cli/settings.ts +415 -415
- package/cli/state.test.ts +197 -197
- package/cli/state.ts +704 -704
- package/cli/web.ts +423 -423
- package/commands/kaizen-abort.md +5 -5
- package/commands/kaizen-approve.md +5 -5
- package/commands/kaizen-auto.md +6 -6
- package/commands/kaizen-backlog.md +5 -5
- package/commands/kaizen-config.md +5 -5
- package/commands/kaizen-full.md +5 -5
- package/commands/kaizen-init.md +5 -5
- package/commands/kaizen-install.md +5 -5
- package/commands/kaizen-lite.md +5 -5
- package/commands/kaizen-plan.md +6 -6
- package/commands/kaizen-reject.md +6 -6
- package/commands/kaizen-review.md +6 -6
- package/commands/kaizen-run.md +5 -5
- package/commands/kaizen-status.md +5 -5
- package/package.json +1 -1
- package/skills/kaizen/README.md +281 -281
- package/skills/kaizen/SKILL.md +440 -440
- package/skills/kaizen/adapters.md +77 -77
- package/skills/kaizen/config.default.yml +167 -167
- package/skills/kaizen/spec-build.md +119 -119
- package/skills/kaizen/spec-main.md +104 -104
- package/skills/kaizen/spec-plan.md +201 -201
- package/skills/kaizen/spec-review.md +121 -121
- package/skills/kaizen/spec.md +153 -153
- package/skills/kaizen-help/SKILL.md +129 -129
- package/web/board.html +520 -513
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
# Kaizen — implement stage
|
|
2
|
-
|
|
3
|
-
Read with [`spec.md`](spec.md) (core: track, intake, resume). This file is the
|
|
4
|
-
builder's contract. The planner and reviewer do not read it.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
## Stage 2 — Implement
|
|
8
|
-
|
|
9
|
-
**Agent:** builder. **Input:** `01-plan.md`, `02-approval.md`, the track.
|
|
10
|
-
**Output:** the deliverable itself, plus `03-impl.md`.
|
|
11
|
-
|
|
12
|
-
The builder produces whatever the track's deliverable is — code, a chapter, the
|
|
13
|
-
campaign copy, the runbook — and nothing else.
|
|
14
|
-
|
|
15
|
-
This file is the contract whether the builder is a dispatched agent or the main
|
|
16
|
-
thread working inline (see `build.executor`). Working inline changes who is typing,
|
|
17
|
-
not what is owed: the plan is still the scope, a step that turns out wrong still
|
|
18
|
-
stops the stage instead of being improvised around, and `03-impl.md` is still written
|
|
19
|
-
before the reviewer is called. The temptation inline is to skip the file because the
|
|
20
|
-
work is already visible in the conversation — but the reviewer never sees that
|
|
21
|
-
conversation, and reads the file instead.
|
|
22
|
-
|
|
23
|
-
Rules:
|
|
24
|
-
|
|
25
|
-
- Work only within the plan's scope. Something out of scope that clearly needs doing
|
|
26
|
-
is written to `03-impl.md` as a note, not produced.
|
|
27
|
-
- If a step turns out to be impossible or wrong, stop and report. Do not improvise a
|
|
28
|
-
different approach — that silently discards the approval the plan received.
|
|
29
|
-
- Match what is already there: a codebase's conventions and idioms, a manuscript's
|
|
30
|
-
voice and structure, a brand's tone. New work should be indistinguishable in style
|
|
31
|
-
from the surrounding material.
|
|
32
|
-
- Carry out the plan's verification and record the real result, whatever the track's
|
|
33
|
-
verification is.
|
|
34
|
-
- Every technique the plan's `reason`-tier gate covers — a new dependency, a new
|
|
35
|
-
abstraction, a new file, a new section — is allowed, and costs one written line
|
|
36
|
-
saying what it serves. The line is the price of the technique, not a request for
|
|
37
|
-
permission. No line means the reviewer records a finding.
|
|
38
|
-
- The `git.*` settings apply only where the work sits in a git repository. In a plain
|
|
39
|
-
folder there is no branch to make and no commit to skip, and that absence is not a
|
|
40
|
-
finding.
|
|
41
|
-
|
|
42
|
-
**Baseline first, in any track with an existing suite of checks.** Before changing
|
|
43
|
-
anything, run whatever already proves the existing material correct — the test suite,
|
|
44
|
-
the linter, the link checker, the fact-check pass — and record the result in
|
|
45
|
-
`03-impl.md`. Run it again after. Two results, before and after, are what turn "my
|
|
46
|
-
change works" into "nothing else broke". A check already failing before the change is
|
|
47
|
-
not this run's finding; a check that passed before and fails after is, and it stops
|
|
48
|
-
the stage.
|
|
49
|
-
|
|
50
|
-
**Keep the working transcript small.** Everything the builder reads stays in its
|
|
51
|
-
context and is re-read on every request that follows, so a full test-suite dump at the
|
|
52
|
-
start of the stage is paid for again at every step after it. Pipe long output through
|
|
53
|
-
a filter that keeps the decisive lines — the failure count, the failing test names, the
|
|
54
|
-
first error — and read the full output only when a check actually fails. The same holds
|
|
55
|
-
for reading material: open the manifest's paths at the ranges the plan names, not whole
|
|
56
|
-
files, and never re-read a file this stage already changed. `03-impl.md` records the
|
|
57
|
-
result, not the transcript.
|
|
58
|
-
|
|
59
|
-
**Read the plan's File manifest instead of searching.** The planner already located
|
|
60
|
-
every path this run touches. Search the material only for what the manifest does not
|
|
61
|
-
cover, and note in `03-impl.md` what was missing from it.
|
|
62
|
-
|
|
63
|
-
`03-impl.md` must list: what was produced or changed with a one-line reason each,
|
|
64
|
-
deviations from the plan and why, verification carried out with its actual result,
|
|
65
|
-
and anything deliberately left undone. Report failures honestly; a false claim of
|
|
66
|
-
success poisons the review stage, which trusts this report.
|
|
67
|
-
|
|
68
|
-
**A `## Preview` section says how to see the result.** For an app or service: the
|
|
69
|
-
commands to start it locally and the URL to open, copied from the material's own README
|
|
70
|
-
where one exists. For anything else — a document, copy, a runbook, a memo — the path
|
|
71
|
-
to open, or the result itself when it fits in a screen. The board shows this section on
|
|
72
|
-
the run's card, so a person can try the work without reading the rest of the report.
|
|
73
|
-
|
|
74
|
-
**The gate block closes the stage.** `03-impl.md` ends with one line per gate item
|
|
75
|
-
from the plan's Verification section:
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
G-01 PASS: ran `php artisan test --filter=Payroll` — 214 passed, 0 failed
|
|
79
|
-
G-02 PASS: cash→transfer switch exercised in the UI; bank rows validated, 422 gone
|
|
80
|
-
G-03 FAIL: payslip PDF still prints the old label
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
A `PASS` states what was actually done and what came back — the command and its
|
|
84
|
-
output, the page opened and what appeared, the person who read it and what they
|
|
85
|
-
understood. `PASS` on its own is not a result, and neither is a restatement of the
|
|
86
|
-
gate item; both are read as an admission the check did not happen.
|
|
87
|
-
|
|
88
|
-
**Work that was never executed cannot pass.** In any track where the deliverable can
|
|
89
|
-
be run, opened, or read by someone, doing so is part of building it: the suite run,
|
|
90
|
-
the page opened and clicked, the runbook walked start to finish, the copy read aloud.
|
|
91
|
-
A gate item whose evidence is an argument that the code should work is a `FAIL`.
|
|
92
|
-
|
|
93
|
-
The stage does not hand off with a `FAIL` standing. Fix it and re-run the gate, or —
|
|
94
|
-
if it cannot be fixed inside the plan's scope — stop and report, exactly as with an
|
|
95
|
-
impossible step. A `FAIL` carried into review wastes the reviewer's pass on something
|
|
96
|
-
already known to be broken.
|
|
97
|
-
|
|
98
|
-
## Stage 4 — Fix loop
|
|
99
|
-
|
|
100
|
-
Governed by `auto_fix`. See the skill's fix-loop section for the exact behavior.
|
|
101
|
-
|
|
102
|
-
Each iteration writes `05-iterations/NN-fix.md` (what the builder changed) and
|
|
103
|
-
`NN-recheck.md` (what the reviewer found afterward). The loop ends when the reviewer
|
|
104
|
-
reports nothing at or above the threshold, or `max_iterations` is reached.
|
|
105
|
-
|
|
106
|
-
A finding the loop could not close is escalated to the user with the reviewer's
|
|
107
|
-
description intact — never quietly downgraded to make the run look clean.
|
|
108
|
-
|
|
109
|
-
**An iteration reads the finding, the work, and the gate.** Not the plan. Fixing a
|
|
110
|
-
named defect needs the reviewer's line, the diff so far, and the gate the result must
|
|
111
|
-
still pass; it does not need the framing, the alternatives rejected, or the out-of-scope
|
|
112
|
-
list, all of which were settled before the finding existed. Read `01-plan.md` only when
|
|
113
|
-
a finding turns on what was approved — a scope question, or a fix that would take the
|
|
114
|
-
work outside it.
|
|
115
|
-
|
|
116
|
-
Fix what the finding names and stop. A second defect noticed while fixing the first is
|
|
117
|
-
a note in the iteration file, not a second fix: it has not been reviewed, and the
|
|
118
|
-
recheck is scoped to what the iteration claims to have changed.
|
|
119
|
-
|
|
1
|
+
# Kaizen — implement stage
|
|
2
|
+
|
|
3
|
+
Read with [`spec.md`](spec.md) (core: track, intake, resume). This file is the
|
|
4
|
+
builder's contract. The planner and reviewer do not read it.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
## Stage 2 — Implement
|
|
8
|
+
|
|
9
|
+
**Agent:** builder. **Input:** `01-plan.md`, `02-approval.md`, the track.
|
|
10
|
+
**Output:** the deliverable itself, plus `03-impl.md`.
|
|
11
|
+
|
|
12
|
+
The builder produces whatever the track's deliverable is — code, a chapter, the
|
|
13
|
+
campaign copy, the runbook — and nothing else.
|
|
14
|
+
|
|
15
|
+
This file is the contract whether the builder is a dispatched agent or the main
|
|
16
|
+
thread working inline (see `build.executor`). Working inline changes who is typing,
|
|
17
|
+
not what is owed: the plan is still the scope, a step that turns out wrong still
|
|
18
|
+
stops the stage instead of being improvised around, and `03-impl.md` is still written
|
|
19
|
+
before the reviewer is called. The temptation inline is to skip the file because the
|
|
20
|
+
work is already visible in the conversation — but the reviewer never sees that
|
|
21
|
+
conversation, and reads the file instead.
|
|
22
|
+
|
|
23
|
+
Rules:
|
|
24
|
+
|
|
25
|
+
- Work only within the plan's scope. Something out of scope that clearly needs doing
|
|
26
|
+
is written to `03-impl.md` as a note, not produced.
|
|
27
|
+
- If a step turns out to be impossible or wrong, stop and report. Do not improvise a
|
|
28
|
+
different approach — that silently discards the approval the plan received.
|
|
29
|
+
- Match what is already there: a codebase's conventions and idioms, a manuscript's
|
|
30
|
+
voice and structure, a brand's tone. New work should be indistinguishable in style
|
|
31
|
+
from the surrounding material.
|
|
32
|
+
- Carry out the plan's verification and record the real result, whatever the track's
|
|
33
|
+
verification is.
|
|
34
|
+
- Every technique the plan's `reason`-tier gate covers — a new dependency, a new
|
|
35
|
+
abstraction, a new file, a new section — is allowed, and costs one written line
|
|
36
|
+
saying what it serves. The line is the price of the technique, not a request for
|
|
37
|
+
permission. No line means the reviewer records a finding.
|
|
38
|
+
- The `git.*` settings apply only where the work sits in a git repository. In a plain
|
|
39
|
+
folder there is no branch to make and no commit to skip, and that absence is not a
|
|
40
|
+
finding.
|
|
41
|
+
|
|
42
|
+
**Baseline first, in any track with an existing suite of checks.** Before changing
|
|
43
|
+
anything, run whatever already proves the existing material correct — the test suite,
|
|
44
|
+
the linter, the link checker, the fact-check pass — and record the result in
|
|
45
|
+
`03-impl.md`. Run it again after. Two results, before and after, are what turn "my
|
|
46
|
+
change works" into "nothing else broke". A check already failing before the change is
|
|
47
|
+
not this run's finding; a check that passed before and fails after is, and it stops
|
|
48
|
+
the stage.
|
|
49
|
+
|
|
50
|
+
**Keep the working transcript small.** Everything the builder reads stays in its
|
|
51
|
+
context and is re-read on every request that follows, so a full test-suite dump at the
|
|
52
|
+
start of the stage is paid for again at every step after it. Pipe long output through
|
|
53
|
+
a filter that keeps the decisive lines — the failure count, the failing test names, the
|
|
54
|
+
first error — and read the full output only when a check actually fails. The same holds
|
|
55
|
+
for reading material: open the manifest's paths at the ranges the plan names, not whole
|
|
56
|
+
files, and never re-read a file this stage already changed. `03-impl.md` records the
|
|
57
|
+
result, not the transcript.
|
|
58
|
+
|
|
59
|
+
**Read the plan's File manifest instead of searching.** The planner already located
|
|
60
|
+
every path this run touches. Search the material only for what the manifest does not
|
|
61
|
+
cover, and note in `03-impl.md` what was missing from it.
|
|
62
|
+
|
|
63
|
+
`03-impl.md` must list: what was produced or changed with a one-line reason each,
|
|
64
|
+
deviations from the plan and why, verification carried out with its actual result,
|
|
65
|
+
and anything deliberately left undone. Report failures honestly; a false claim of
|
|
66
|
+
success poisons the review stage, which trusts this report.
|
|
67
|
+
|
|
68
|
+
**A `## Preview` section says how to see the result.** For an app or service: the
|
|
69
|
+
commands to start it locally and the URL to open, copied from the material's own README
|
|
70
|
+
where one exists. For anything else — a document, copy, a runbook, a memo — the path
|
|
71
|
+
to open, or the result itself when it fits in a screen. The board shows this section on
|
|
72
|
+
the run's card, so a person can try the work without reading the rest of the report.
|
|
73
|
+
|
|
74
|
+
**The gate block closes the stage.** `03-impl.md` ends with one line per gate item
|
|
75
|
+
from the plan's Verification section:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
G-01 PASS: ran `php artisan test --filter=Payroll` — 214 passed, 0 failed
|
|
79
|
+
G-02 PASS: cash→transfer switch exercised in the UI; bank rows validated, 422 gone
|
|
80
|
+
G-03 FAIL: payslip PDF still prints the old label
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
A `PASS` states what was actually done and what came back — the command and its
|
|
84
|
+
output, the page opened and what appeared, the person who read it and what they
|
|
85
|
+
understood. `PASS` on its own is not a result, and neither is a restatement of the
|
|
86
|
+
gate item; both are read as an admission the check did not happen.
|
|
87
|
+
|
|
88
|
+
**Work that was never executed cannot pass.** In any track where the deliverable can
|
|
89
|
+
be run, opened, or read by someone, doing so is part of building it: the suite run,
|
|
90
|
+
the page opened and clicked, the runbook walked start to finish, the copy read aloud.
|
|
91
|
+
A gate item whose evidence is an argument that the code should work is a `FAIL`.
|
|
92
|
+
|
|
93
|
+
The stage does not hand off with a `FAIL` standing. Fix it and re-run the gate, or —
|
|
94
|
+
if it cannot be fixed inside the plan's scope — stop and report, exactly as with an
|
|
95
|
+
impossible step. A `FAIL` carried into review wastes the reviewer's pass on something
|
|
96
|
+
already known to be broken.
|
|
97
|
+
|
|
98
|
+
## Stage 4 — Fix loop
|
|
99
|
+
|
|
100
|
+
Governed by `auto_fix`. See the skill's fix-loop section for the exact behavior.
|
|
101
|
+
|
|
102
|
+
Each iteration writes `05-iterations/NN-fix.md` (what the builder changed) and
|
|
103
|
+
`NN-recheck.md` (what the reviewer found afterward). The loop ends when the reviewer
|
|
104
|
+
reports nothing at or above the threshold, or `max_iterations` is reached.
|
|
105
|
+
|
|
106
|
+
A finding the loop could not close is escalated to the user with the reviewer's
|
|
107
|
+
description intact — never quietly downgraded to make the run look clean.
|
|
108
|
+
|
|
109
|
+
**An iteration reads the finding, the work, and the gate.** Not the plan. Fixing a
|
|
110
|
+
named defect needs the reviewer's line, the diff so far, and the gate the result must
|
|
111
|
+
still pass; it does not need the framing, the alternatives rejected, or the out-of-scope
|
|
112
|
+
list, all of which were settled before the finding existed. Read `01-plan.md` only when
|
|
113
|
+
a finding turns on what was approved — a scope question, or a fix that would take the
|
|
114
|
+
work outside it.
|
|
115
|
+
|
|
116
|
+
Fix what the finding names and stop. A second defect noticed while fixing the first is
|
|
117
|
+
a note in the iteration file, not a second fix: it has not been reviewed, and the
|
|
118
|
+
recheck is scoped to what the iteration claims to have changed.
|
|
119
|
+
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
# Kaizen — main thread
|
|
2
|
-
|
|
3
|
-
Read with [`spec.md`](spec.md) (core: track, intake, resume). Backlog bookkeeping and
|
|
4
|
-
the final approval. No subagent reads this file.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
## Backlog
|
|
8
|
-
|
|
9
|
-
Every run produces work it deliberately does not do. Three sources, all already
|
|
10
|
-
written down by the time a run ends:
|
|
11
|
-
|
|
12
|
-
1. Out of scope suggestions the planner listed and the user did not fold into the
|
|
13
|
-
approved scope.
|
|
14
|
-
2. Findings below `auto_fix.min_severity`, and findings the fix loop could not close.
|
|
15
|
-
3. Debts deferred at an approval because they fell outside the approved scope.
|
|
16
|
-
|
|
17
|
-
Without capture these survive only in the conversation that produced them.
|
|
18
|
-
|
|
19
|
-
`backlog.enabled: false` skips both capture points — the `02-approval.md` append at
|
|
20
|
-
plan approval and the `06-backlog.md` append at final approval — for that run. The run
|
|
21
|
-
still executes normally; it simply ends without a backlog file.
|
|
22
|
-
|
|
23
|
-
**Where it lives.** Each run holds its own backlog at `runs/<id>/06-backlog.md`, beside
|
|
24
|
-
the plan and the review that produced the items. There is no central backlog file to
|
|
25
|
-
keep in sync, and no copying: provenance is the directory the item sits in.
|
|
26
|
-
|
|
27
|
-
`<state.dir>/backlog.md`, beside `memory.md`, exists for exactly one purpose — an
|
|
28
|
-
orphanage. Before `state.keep_runs` prunes a run directory, that run's **open** items
|
|
29
|
-
are moved into it, so pruning never destroys outstanding work. Items already `done` or
|
|
30
|
-
`rejected` are pruned with their run. Nothing else is ever written there, and
|
|
31
|
-
`06-backlog.md` is never replaced by it.
|
|
32
|
-
|
|
33
|
-
`/kaizen backlog` reads `<state.dir>/backlog.md` as well as every
|
|
34
|
-
`runs/*/06-backlog.md`, and prints its open items last, under an **Orphaned** group —
|
|
35
|
-
otherwise a rescued item would be invisible to the only command that lists outstanding
|
|
36
|
-
work. Orphaned items count towards the open backlog count `/kaizen status` reports.
|
|
37
|
-
|
|
38
|
-
An abandoned run — `stage: "abandoned"`, set by `/kaizen abort` — is not open work. Its
|
|
39
|
-
`06-backlog.md` is left as it stands, and its items are neither printed by `/kaizen
|
|
40
|
-
backlog` nor counted.
|
|
41
|
-
|
|
42
|
-
**Item format.** One item per line:
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
- <status>: <item text> | <reason>
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
`<status>` is `open`, `done`, or `rejected`. A finding moved into the backlog keeps the
|
|
49
|
-
reviewer's line verbatim — `<where>: <severity>: <problem>. <fix>.` — so nothing is
|
|
50
|
-
rewritten in transit. `rejected` requires a reason after `|` on the same line; "not
|
|
51
|
-
doing this" with no reason is how the same suggestion returns three runs later. `done`
|
|
52
|
-
may carry a reason the same way, and usually names the run that closed it.
|
|
53
|
-
|
|
54
|
-
Items are appended, never deleted. Closing an item means editing its status in place;
|
|
55
|
-
it stays in its run's file as record. `/kaizen backlog` prints `open` items only, so
|
|
56
|
-
the active list is bounded by what is genuinely outstanding rather than by history.
|
|
57
|
-
|
|
58
|
-
Because a `<where>` reference must still resolve after its run closes, it is written as
|
|
59
|
-
a path relative to the repository, not to the run directory.
|
|
60
|
-
|
|
61
|
-
**Who writes it.** The main thread, at two file writes that already happen
|
|
62
|
-
unconditionally:
|
|
63
|
-
|
|
64
|
-
| Capture point | Stage | What gets appended |
|
|
65
|
-
|---|---|---|
|
|
66
|
-
| Writing `02-approval.md`, when the decision is an approval | Plan approval | Every out-of-scope suggestion not folded into the approved scope, and anything cut from scope at the approval |
|
|
67
|
-
| Setting `stage: "done"` | Final approval | Findings still open, findings below the fix threshold, and out-of-scope notes the builder wrote into `03-impl.md` |
|
|
68
|
-
|
|
69
|
-
Neither is optional and neither is a separate step to remember — a run cannot finish
|
|
70
|
-
without touching both files.
|
|
71
|
-
|
|
72
|
-
No subagent writes the backlog. The reviewer runs *before* the fix loop and cannot know
|
|
73
|
-
which of its findings will be closed; it would log items that get fixed minutes later.
|
|
74
|
-
The planner is not present at the approval where its suggestions are accepted or
|
|
75
|
-
declined. This also keeps the workflow working under adapters where there are no
|
|
76
|
-
subagents at all.
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## Final approval
|
|
81
|
-
|
|
82
|
-
Controlled by `approvals.review`, skipped in `auto`.
|
|
83
|
-
|
|
84
|
-
Report: what was built, verification results, findings fixed, findings still open,
|
|
85
|
-
and anything the builder noted as out of scope. Where the run used `runner: lite`, say
|
|
86
|
-
so in that report — the reviewer saw the work, and nobody should read a same-session
|
|
87
|
-
review as an independent one because the output looked the same. Then stop. Committing, pushing, or
|
|
88
|
-
opening a pull request happens only if the user asks.
|
|
89
|
-
|
|
90
|
-
**Open findings are offered by number.** List them with the reviewer's numbering
|
|
91
|
-
intact and let the user name which to fix — "fix 2 and 5". A number not named is not
|
|
92
|
-
touched, and goes to the backlog as `open` like any other deferred item. This is the
|
|
93
|
-
same granularity the fix loop already works at; the only change is that the user
|
|
94
|
-
picks the subset instead of accepting or declining the whole review.
|
|
95
|
-
|
|
96
|
-
Before setting `stage: "done"`, append the same three categories just reported —
|
|
97
|
-
findings still open, findings below the fix threshold, and the builder's out-of-scope
|
|
98
|
-
notes from `03-impl.md` — to `runs/<id>/06-backlog.md`, each as `open`, in the format
|
|
99
|
-
given in *Backlog* above. Every input is already assembled at this moment; the only
|
|
100
|
-
change is that it is written down rather than spoken and discarded.
|
|
101
|
-
|
|
102
|
-
Set `stage: "done"` in `state.json` once the user accepts.
|
|
103
|
-
|
|
104
|
-
---
|
|
1
|
+
# Kaizen — main thread
|
|
2
|
+
|
|
3
|
+
Read with [`spec.md`](spec.md) (core: track, intake, resume). Backlog bookkeeping and
|
|
4
|
+
the final approval. No subagent reads this file.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
## Backlog
|
|
8
|
+
|
|
9
|
+
Every run produces work it deliberately does not do. Three sources, all already
|
|
10
|
+
written down by the time a run ends:
|
|
11
|
+
|
|
12
|
+
1. Out of scope suggestions the planner listed and the user did not fold into the
|
|
13
|
+
approved scope.
|
|
14
|
+
2. Findings below `auto_fix.min_severity`, and findings the fix loop could not close.
|
|
15
|
+
3. Debts deferred at an approval because they fell outside the approved scope.
|
|
16
|
+
|
|
17
|
+
Without capture these survive only in the conversation that produced them.
|
|
18
|
+
|
|
19
|
+
`backlog.enabled: false` skips both capture points — the `02-approval.md` append at
|
|
20
|
+
plan approval and the `06-backlog.md` append at final approval — for that run. The run
|
|
21
|
+
still executes normally; it simply ends without a backlog file.
|
|
22
|
+
|
|
23
|
+
**Where it lives.** Each run holds its own backlog at `runs/<id>/06-backlog.md`, beside
|
|
24
|
+
the plan and the review that produced the items. There is no central backlog file to
|
|
25
|
+
keep in sync, and no copying: provenance is the directory the item sits in.
|
|
26
|
+
|
|
27
|
+
`<state.dir>/backlog.md`, beside `memory.md`, exists for exactly one purpose — an
|
|
28
|
+
orphanage. Before `state.keep_runs` prunes a run directory, that run's **open** items
|
|
29
|
+
are moved into it, so pruning never destroys outstanding work. Items already `done` or
|
|
30
|
+
`rejected` are pruned with their run. Nothing else is ever written there, and
|
|
31
|
+
`06-backlog.md` is never replaced by it.
|
|
32
|
+
|
|
33
|
+
`/kaizen backlog` reads `<state.dir>/backlog.md` as well as every
|
|
34
|
+
`runs/*/06-backlog.md`, and prints its open items last, under an **Orphaned** group —
|
|
35
|
+
otherwise a rescued item would be invisible to the only command that lists outstanding
|
|
36
|
+
work. Orphaned items count towards the open backlog count `/kaizen status` reports.
|
|
37
|
+
|
|
38
|
+
An abandoned run — `stage: "abandoned"`, set by `/kaizen abort` — is not open work. Its
|
|
39
|
+
`06-backlog.md` is left as it stands, and its items are neither printed by `/kaizen
|
|
40
|
+
backlog` nor counted.
|
|
41
|
+
|
|
42
|
+
**Item format.** One item per line:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
- <status>: <item text> | <reason>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`<status>` is `open`, `done`, or `rejected`. A finding moved into the backlog keeps the
|
|
49
|
+
reviewer's line verbatim — `<where>: <severity>: <problem>. <fix>.` — so nothing is
|
|
50
|
+
rewritten in transit. `rejected` requires a reason after `|` on the same line; "not
|
|
51
|
+
doing this" with no reason is how the same suggestion returns three runs later. `done`
|
|
52
|
+
may carry a reason the same way, and usually names the run that closed it.
|
|
53
|
+
|
|
54
|
+
Items are appended, never deleted. Closing an item means editing its status in place;
|
|
55
|
+
it stays in its run's file as record. `/kaizen backlog` prints `open` items only, so
|
|
56
|
+
the active list is bounded by what is genuinely outstanding rather than by history.
|
|
57
|
+
|
|
58
|
+
Because a `<where>` reference must still resolve after its run closes, it is written as
|
|
59
|
+
a path relative to the repository, not to the run directory.
|
|
60
|
+
|
|
61
|
+
**Who writes it.** The main thread, at two file writes that already happen
|
|
62
|
+
unconditionally:
|
|
63
|
+
|
|
64
|
+
| Capture point | Stage | What gets appended |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| Writing `02-approval.md`, when the decision is an approval | Plan approval | Every out-of-scope suggestion not folded into the approved scope, and anything cut from scope at the approval |
|
|
67
|
+
| Setting `stage: "done"` | Final approval | Findings still open, findings below the fix threshold, and out-of-scope notes the builder wrote into `03-impl.md` |
|
|
68
|
+
|
|
69
|
+
Neither is optional and neither is a separate step to remember — a run cannot finish
|
|
70
|
+
without touching both files.
|
|
71
|
+
|
|
72
|
+
No subagent writes the backlog. The reviewer runs *before* the fix loop and cannot know
|
|
73
|
+
which of its findings will be closed; it would log items that get fixed minutes later.
|
|
74
|
+
The planner is not present at the approval where its suggestions are accepted or
|
|
75
|
+
declined. This also keeps the workflow working under adapters where there are no
|
|
76
|
+
subagents at all.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Final approval
|
|
81
|
+
|
|
82
|
+
Controlled by `approvals.review`, skipped in `auto`.
|
|
83
|
+
|
|
84
|
+
Report: what was built, verification results, findings fixed, findings still open,
|
|
85
|
+
and anything the builder noted as out of scope. Where the run used `runner: lite`, say
|
|
86
|
+
so in that report — the reviewer saw the work, and nobody should read a same-session
|
|
87
|
+
review as an independent one because the output looked the same. Then stop. Committing, pushing, or
|
|
88
|
+
opening a pull request happens only if the user asks.
|
|
89
|
+
|
|
90
|
+
**Open findings are offered by number.** List them with the reviewer's numbering
|
|
91
|
+
intact and let the user name which to fix — "fix 2 and 5". A number not named is not
|
|
92
|
+
touched, and goes to the backlog as `open` like any other deferred item. This is the
|
|
93
|
+
same granularity the fix loop already works at; the only change is that the user
|
|
94
|
+
picks the subset instead of accepting or declining the whole review.
|
|
95
|
+
|
|
96
|
+
Before setting `stage: "done"`, append the same three categories just reported —
|
|
97
|
+
findings still open, findings below the fix threshold, and the builder's out-of-scope
|
|
98
|
+
notes from `03-impl.md` — to `runs/<id>/06-backlog.md`, each as `open`, in the format
|
|
99
|
+
given in *Backlog* above. Every input is already assembled at this moment; the only
|
|
100
|
+
change is that it is written down rather than spoken and discarded.
|
|
101
|
+
|
|
102
|
+
Set `stage: "done"` in `state.json` once the user accepts.
|
|
103
|
+
|
|
104
|
+
---
|