kaizen-agent 1.53.1 → 1.54.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/agents/kaizen-planner.md +4 -1
- package/agents/kaizen-reviewer.md +5 -0
- package/cli/chat.test.ts +2 -2
- package/cli/chat.ts +1 -1
- package/cli/install.ts +20 -1
- package/cli/knowledge.test.ts +179 -0
- package/cli/knowledge.ts +216 -0
- package/cli/video.test.ts +6 -1
- package/cli/web.ts +14 -4
- package/package.json +1 -1
- package/skills/kaizen/adapters.md +3 -0
- package/skills/kaizen/config.default.yml +6 -0
- package/skills/kaizen/spec-main.md +3 -1
- package/skills/kaizen/spec-plan.md +5 -1
- package/skills/kaizen/spec-review.md +52 -0
- package/skills/kaizen-help/SKILL.md +2 -0
- package/web/board/settings.ts +1 -1
- package/web/board/toast.test.ts +77 -0
- package/web/board/toast.ts +8 -3
- package/web/board.js +21 -21
- package/web/notebook.js +1 -1
- package/web/sounds/Adara.mp3 +0 -0
- package/web/sounds/Alya.mp3 +0 -0
- package/web/sounds/Bellatrix.mp3 +0 -0
- package/web/sounds/Beryllium.mp3 +0 -0
- package/web/sounds/Cobalt.mp3 +0 -0
- package/web/sounds/Fluorine.mp3 +0 -0
- package/web/sounds/Krypton.mp3 +0 -0
- package/web/sounds/LICENSE-2.0.txt +202 -0
- package/web/sounds/Palladium.mp3 +0 -0
- package/web/sounds/Rubidium.mp3 +0 -0
- package/web/sounds/SOURCES.md +14 -0
- package/web/sounds/Xenon.mp3 +0 -0
- package/web/term.js +1 -1
- package/web/video.js +1 -1
|
@@ -10,7 +10,11 @@ planner's and the plan approval's contract. The builder and reviewer do not read
|
|
|
10
10
|
the run directory when present — links, paths, and background the user attached from
|
|
11
11
|
the board, binding like the request itself — `memory.md`, `notes/Project/Index.md` in the state
|
|
12
12
|
directory when present — the project's map, written by `/kaizen docs`; open only the
|
|
13
|
-
notes it lists for areas the request touches —
|
|
13
|
+
notes it lists for areas the request touches — the output of
|
|
14
|
+
`kaizen recall --track <track> --tags <stack tags> --query "<words from the request>"`
|
|
15
|
+
— past experience from other projects, to verify against this one, never binding
|
|
16
|
+
like project rules; the Framing ends with `Recalled: <n> lessons; used: <the lines it
|
|
17
|
+
relied on>` or `Recalled: none` — and the existing material —
|
|
14
18
|
the codebase, the manuscript, the current campaign, whatever this run builds on.
|
|
15
19
|
**Output:** `01-plan.md`.
|
|
16
20
|
|
|
@@ -135,6 +135,58 @@ them. Keep it under `review.memory_max_lines` (default 100): before appending, d
|
|
|
135
135
|
any lesson that is now wrong, already enforced by a test or a lint rule, or restated
|
|
136
136
|
by a newer entry. A memory file that only grows stops being read carefully.
|
|
137
137
|
|
|
138
|
+
**Global knowledge.** Some lessons hold beyond this project — still true in another
|
|
139
|
+
repository on the same stack, or another piece of work on the same track. For each
|
|
140
|
+
lesson, decide its scope. Project lessons go to `memory.md` as above.
|
|
141
|
+
|
|
142
|
+
Global knowledge is read by every future project, so it stays high-signal, not a
|
|
143
|
+
history of what was built. A lesson goes global only when all four hold:
|
|
144
|
+
|
|
145
|
+
1. **Reusable** — still true in another repository on the same stack or track.
|
|
146
|
+
2. **High-signal** — knowing it would change what someone does: a discovery that cost
|
|
147
|
+
real investigation, a measured improvement, an architectural trade-off and when it
|
|
148
|
+
tips, or a fix that saves the next person the same search. Documented behaviour
|
|
149
|
+
counts when it was the answer to a real problem here; rare is not the test, useful is.
|
|
150
|
+
3. **Evidenced** — it comes from something this run actually hit: a finding, a failing
|
|
151
|
+
test, an error, a measurement. Name it in `--applies` (`seen: finding 3`). An opinion
|
|
152
|
+
with nothing behind it in this run is not a lesson.
|
|
153
|
+
4. **New** — run `kaizen recall --tags <tags> --query "<key words>"` first. If a line
|
|
154
|
+
already says it, skip yours, or `--replace` that line only when this run adds a
|
|
155
|
+
correction, a version limit or stronger evidence.
|
|
156
|
+
|
|
157
|
+
Skip: framework basics a competent developer already knows, routine implementation,
|
|
158
|
+
trivial and typo fixes, this project's own conventions (those are `memory.md`), and
|
|
159
|
+
anything recall already returned. Zero global lessons is the normal outcome. More
|
|
160
|
+
than two from one run is a reason to re-check each against the four tests, not to
|
|
161
|
+
drop them.
|
|
162
|
+
|
|
163
|
+
Global lessons go through `kaizen remember`, never by editing `~/.kaizen/knowledge/`
|
|
164
|
+
directly:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
kaizen remember --track <code|writing|communication|operations|research> \
|
|
168
|
+
--tags <tag,tag@version> --applies "<versions, platform, limits>" --run <run id> "<lesson>"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
- Generalize before saving. Keep commands, flags, versions, error strings and public
|
|
172
|
+
documentation URLs: they are the lesson. Replace paths, hosts, client and person
|
|
173
|
+
names, internal URLs and business figures with `<project>`, `<host>` and the like.
|
|
174
|
+
- Phrase it as a fact about behaviour ("X causes Y"), never as an order to an agent.
|
|
175
|
+
- `--applies` is required: where the lesson holds and where it does not, so it never
|
|
176
|
+
reads as a universal rule. Versions and frameworks also go in the tags (`bun@1.2`),
|
|
177
|
+
which keeps lessons for different versions apart.
|
|
178
|
+
- `remember` appends and prints any existing lines that share a tag, numbered. If one
|
|
179
|
+
says the same thing, rewrite it with `--replace <n>` or drop yours; nothing is merged
|
|
180
|
+
without that explicit choice.
|
|
181
|
+
- Never write the `preferences` track: the user keeps it by hand.
|
|
182
|
+
- A refusal is final for that wording: the secret check rejects keys, tokens, emails,
|
|
183
|
+
IP addresses and private hosts; `knowledge.global: false` means the project opted out.
|
|
184
|
+
|
|
185
|
+
Record every attempt, project and global, in a `## Remembered` section of
|
|
186
|
+
`04-review.md`, one line each: `Remembered (project): …`, `Remembered (global): …` as
|
|
187
|
+
`remember` printed it, or `Rejected: <reason> — <lesson>`. Write `None` when nothing
|
|
188
|
+
was worth keeping; most runs teach nothing durable, and that is fine.
|
|
189
|
+
|
|
138
190
|
---
|
|
139
191
|
|
|
140
192
|
## Stage 4 — Fix loop
|
|
@@ -38,6 +38,8 @@ anything.
|
|
|
38
38
|
| `/kaizen config` | Show this project's settings and change them, one picker per setting |
|
|
39
39
|
| `/kaizen init` | Set up this project folder: `.kaizen/` with `spec.md`, config, and — in a git repo — the gitignore entry |
|
|
40
40
|
| `/kaizen install` | Install the workflow itself globally or per-project |
|
|
41
|
+
| `kaizen recall [--track t] [--tags a,b] [--query "<words>"]` | Lessons from other projects that match (global knowledge, `~/.kaizen/knowledge/`) |
|
|
42
|
+
| `kaizen remember --track t --tags a,b --applies "<where>" --run <id> "<lesson>"` | Save a lesson that holds beyond this project; the reviewer calls it |
|
|
41
43
|
|
|
42
44
|
`/kaizen` with no argument: `status` if a run is in progress, else ask what to build.
|
|
43
45
|
|
package/web/board/settings.ts
CHANGED
|
@@ -102,7 +102,7 @@ export async function openSettings() {
|
|
|
102
102
|
<h3 class="sg">Browser</h3><div class="sgrp">${row("Theme", ctl("th", ["system", "light", "dark"], cur), "", "th", "theme light dark system browser")}
|
|
103
103
|
${row("Motion", ctl("mo", ["system", "full", "reduce"], document.documentElement.dataset.motion || "system"), "Animations on the board and notes. System follows the device's reduce-motion setting.", "mo", "motion animation reduce reduced browser")}
|
|
104
104
|
${row("Notifications", html`<button class="chk${nton ? " on" : ""}" id="nt" role="switch" aria-checked="${String(nton)}"></button>`, ntHelp, "nt", "notifications " + ntHelp + " browser")}
|
|
105
|
-
${row("Notification sound", ctl("ns", SOUNDS, soundPick()), "Plays with each notice. Changing it plays it.", "ns", "notification sound
|
|
105
|
+
${row("Notification sound", ctl("ns", SOUNDS, soundPick()), "Plays with each notice. Changing it plays it.", "ns", "notification sound audio browser " + SOUNDS.join(" "), !nton)}</div>
|
|
106
106
|
<p class="snone" id="snone" hidden></p>`;
|
|
107
107
|
// Hides rows that do not match, then any group (and its chip) left with none.
|
|
108
108
|
updBar();
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { test, expect } from "bun:test";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join, dirname } from "node:path";
|
|
4
|
+
|
|
5
|
+
test("new notification sounds play real files while saved choices stay intact", async () => {
|
|
6
|
+
const oldListener = globalThis.addEventListener;
|
|
7
|
+
const oldStorage = globalThis.localStorage;
|
|
8
|
+
const oldAudio = globalThis.Audio;
|
|
9
|
+
const oldContext = globalThis.AudioContext;
|
|
10
|
+
const values = new Map<string, string>();
|
|
11
|
+
const played: string[] = [];
|
|
12
|
+
const tones: number[] = [];
|
|
13
|
+
(globalThis as any).addEventListener = () => {};
|
|
14
|
+
(globalThis as any).localStorage = { getItem: (key: string) => values.get(key) ?? null };
|
|
15
|
+
(globalThis as any).Audio = class {
|
|
16
|
+
constructor(readonly src: string) {}
|
|
17
|
+
play() {
|
|
18
|
+
played.push(this.src);
|
|
19
|
+
return Promise.resolve();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
(globalThis as any).AudioContext = class {
|
|
23
|
+
currentTime = 0;
|
|
24
|
+
destination = {};
|
|
25
|
+
resume() {
|
|
26
|
+
return Promise.resolve();
|
|
27
|
+
}
|
|
28
|
+
createOscillator() {
|
|
29
|
+
return {
|
|
30
|
+
type: "",
|
|
31
|
+
frequency: { value: 0 },
|
|
32
|
+
connect(g: unknown) {
|
|
33
|
+
return g;
|
|
34
|
+
},
|
|
35
|
+
start() {
|
|
36
|
+
tones.push(1);
|
|
37
|
+
},
|
|
38
|
+
stop() {},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
createGain() {
|
|
42
|
+
return {
|
|
43
|
+
gain: { setValueAtTime() {}, exponentialRampToValueAtTime() {} },
|
|
44
|
+
connect() {
|
|
45
|
+
return this;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
try {
|
|
51
|
+
const { SOUNDS, soundPick, playSound, notifyUser } = await import("./toast.ts");
|
|
52
|
+
const samples = SOUNDS.filter((s) => !["off", "chime", "bell", "pop"].includes(s));
|
|
53
|
+
expect(samples).toHaveLength(10);
|
|
54
|
+
expect(soundPick()).toBe("Bellatrix");
|
|
55
|
+
notifyUser("done");
|
|
56
|
+
expect(played).toEqual(["/sounds/Bellatrix.mp3"]);
|
|
57
|
+
for (const name of samples) {
|
|
58
|
+
expect(existsSync(join(dirname(import.meta.dir), "sounds", `${name}.mp3`))).toBe(true);
|
|
59
|
+
playSound(name);
|
|
60
|
+
}
|
|
61
|
+
expect(played.slice(1)).toEqual(samples.map((name) => `/sounds/${name}.mp3`));
|
|
62
|
+
values.set("kz-sound", "off");
|
|
63
|
+
notifyUser("quiet");
|
|
64
|
+
expect(played).toHaveLength(11);
|
|
65
|
+
for (const name of ["chime", "bell", "pop"]) {
|
|
66
|
+
values.set("kz-sound", name);
|
|
67
|
+
expect(soundPick()).toBe(name);
|
|
68
|
+
notifyUser("legacy");
|
|
69
|
+
}
|
|
70
|
+
expect(tones).toHaveLength(4);
|
|
71
|
+
} finally {
|
|
72
|
+
globalThis.addEventListener = oldListener;
|
|
73
|
+
globalThis.localStorage = oldStorage;
|
|
74
|
+
globalThis.Audio = oldAudio;
|
|
75
|
+
globalThis.AudioContext = oldContext;
|
|
76
|
+
}
|
|
77
|
+
});
|
package/web/board/toast.ts
CHANGED
|
@@ -26,7 +26,7 @@ export function askNotify() {
|
|
|
26
26
|
}
|
|
27
27
|
// Per browser: whether notices go out at all, and the sound each one plays. The OS
|
|
28
28
|
// notification's own sound is often silent (Windows toasts, focus assist), so the page
|
|
29
|
-
// plays its own
|
|
29
|
+
// plays its own sound.
|
|
30
30
|
const pref = (k, d) => {
|
|
31
31
|
try {
|
|
32
32
|
return localStorage.getItem(k) || d;
|
|
@@ -35,13 +35,18 @@ const pref = (k, d) => {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
export const notifyOn = () => pref("kz-notify", "on") === "on";
|
|
38
|
-
export const soundPick = () => pref("kz-sound", "
|
|
39
|
-
|
|
38
|
+
export const soundPick = () => pref("kz-sound", "Bellatrix");
|
|
39
|
+
const SAMPLES = ["Adara", "Alya", "Bellatrix", "Beryllium", "Cobalt", "Fluorine", "Krypton", "Palladium", "Rubidium", "Xenon"];
|
|
40
|
+
export const SOUNDS = ["off", ...SAMPLES, "chime", "bell", "pop"];
|
|
40
41
|
// [frequency Hz, start s, length s] per note.
|
|
41
42
|
const NOTES = { chime: [[880, 0, 0.25], [1320, 0.12, 0.35]], bell: [[660, 0, 0.9]], pop: [[520, 0, 0.08]] };
|
|
42
43
|
let actx;
|
|
43
44
|
export function playSound(name = soundPick()) {
|
|
44
45
|
try {
|
|
46
|
+
if (SAMPLES.includes(name)) {
|
|
47
|
+
new Audio(`/sounds/${name}.mp3`).play().catch(() => {});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
45
50
|
if (!NOTES[name]) return;
|
|
46
51
|
actx = actx || new AudioContext();
|
|
47
52
|
actx.resume();
|