kaizen-agent 1.87.3 → 1.87.4

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 (57) hide show
  1. package/cli/activity.ts +86 -0
  2. package/cli/add-project.ts +64 -1
  3. package/cli/auto-update.ts +33 -0
  4. package/cli/chat.ts +88 -13
  5. package/cli/install.ts +65 -36
  6. package/cli/look.ts +1 -0
  7. package/cli/onboarding.ts +9 -4
  8. package/cli/pty.ts +27 -12
  9. package/cli/release.ts +13 -1
  10. package/cli/settings.ts +39 -7
  11. package/cli/state.ts +54 -1
  12. package/cli/task-service.ts +8 -3
  13. package/cli/usage.ts +15 -2
  14. package/cli/web.ts +88 -41
  15. package/cli/whats-new.json +38 -0
  16. package/cli/whats-new.ts +43 -0
  17. package/cli/workers.ts +2 -2
  18. package/package.json +1 -1
  19. package/skills/kaizen/config.default.yml +3 -0
  20. package/skills/kaizen/spec.md +6 -0
  21. package/skills/kaizen-explore/SKILL.md +7 -0
  22. package/web/components/home/index.ts +1 -0
  23. package/web/components/home/onboarding-dialog.tsx +44 -7
  24. package/web/components/home/works-flow.tsx +119 -0
  25. package/web/components/project/add-project-dialog.tsx +1 -1
  26. package/web/components/rail/rail-list.tsx +8 -6
  27. package/web/components/run/doc-body.tsx +43 -0
  28. package/web/components/settings/agent-rows.tsx +15 -11
  29. package/web/components/settings/browser-row.tsx +1 -1
  30. package/web/components/settings/setting-row.tsx +2 -1
  31. package/web/components/settings/skill-card.tsx +32 -2
  32. package/web/components/settings/update-bar.tsx +53 -35
  33. package/web/components/settings/whats-new-card.tsx +70 -0
  34. package/web/components/shell/rail.tsx +8 -4
  35. package/web/dist/annotate.js +1 -1
  36. package/web/dist/board.css +3 -3
  37. package/web/dist/board.js +83 -58
  38. package/web/dist/boot.js +1 -1
  39. package/web/dist/notebook.css +2 -2
  40. package/web/dist/notebook.js +27 -27
  41. package/web/dist/popup.css +1 -1
  42. package/web/dist/popup.js +1 -1
  43. package/web/dist/term.js +1 -1
  44. package/web/dist/ui.css +2 -2
  45. package/web/dist/video.js +1 -1
  46. package/web/lib/footer/footer-rules.ts +8 -2
  47. package/web/lib/footer/footer-store.ts +2 -2
  48. package/web/lib/home/onboarding.ts +63 -17
  49. package/web/lib/project/add-project.ts +6 -0
  50. package/web/lib/run/panel-derive.ts +1 -1
  51. package/web/lib/run/panel-store.ts +1 -0
  52. package/web/lib/settings/index.ts +1 -0
  53. package/web/lib/settings/settings.ts +6 -1
  54. package/web/lib/settings/whats-new.ts +36 -0
  55. package/web/pages/board/App.tsx +2 -1
  56. package/web/pages/task-page.tsx +17 -4
  57. package/web/ui/legacy/board.css +1 -1
package/cli/web.ts CHANGED
@@ -17,7 +17,7 @@ import { MAX_FILE, MAX_IMAGE, saveFile, saveImage } from "./term-image.ts";
17
17
  import { shellHistory } from "./term-history.ts";
18
18
  import { bundledSkills, repairSkill, setSkill, skillsHeld, skillsOff, skillStatus } from "./skills.ts";
19
19
  import * as rea from "./rea.ts";
20
- import { accountEnv, accountForRun, agentUsable, CHILD_ENV, promptArgs, heartbeatMinutes, keepAwake, launchPreview, trustFolder, YOLO_FLAGS } from "./state.ts";
20
+ import { accountEnv, accountForRun, agentUsable, CHILD_ENV, detectDefaultAgent, promptArgs, heartbeatMinutes, keepAwake, launchPreview, trustFolder, YOLO_FLAGS, bypassFlags } from "./state.ts";
21
21
  import { agentLine, failStart, handoffModel, markRunning, readWorkers, requested, startWorker, sweep, workerStale } from "./workers.ts";
22
22
  import { childDied, childQuiet, markWoken, move, requestOpen, readHandoff, refused, started, wakeAction, wakeLine, type Handoff } from "./handoff.ts";
23
23
  import { processTable, storage, systemMemory, treeRss, type Root } from "./resources.ts";
@@ -28,6 +28,9 @@ import { claudeUsage, claudeUsageAt, codexUsage, codexUsageAt, phonePeers, type
28
28
  import { readSources, addSource, removeSource, moveSource, setCategory, setWriteback, setPaused, readIcebox, applySort, setLinkMedia, redditPost, iceDir, promote, dismiss, restore, capture, editItem, setKind, setTags, setBoard, saveBoard, removeBoard, snooze, unsnooze, readBoards, kindOf, isSnoozed, markDone, markReplied, gatherSource, freshImages, gatherAll, gatherDirs, due, socialUrl, socialOf } from "./sources.ts";
29
29
  import { projectLogo, LOGO_TYPES } from "./logo.ts";
30
30
  import * as chatgpt from "./chatgpt.ts";
31
+ import { whatsNew, markSeen } from "./whats-new.ts";
32
+ import { autoUpdateTick } from "./auto-update.ts";
33
+ import { readActivity } from "./activity.ts";
31
34
  import * as google from "./google.ts";
32
35
  import { writeBacks } from "./writeback.ts";
33
36
  import { postLink, sendReply } from "./browser.ts";
@@ -45,7 +48,7 @@ import { workspaces, workspacesNow, forgetWorkspaces, workspacesAge, addWorktree
45
48
  import * as tasks from "./tasks.ts";
46
49
  import * as taskService from "./task-service.ts";
47
50
  import { artifactResponse as taskArtifactResponse } from "./task-results.ts";
48
- import { gitUrl, destDir, winBad, cloneInto, branchesOf, ignoreKaizen } from "./add-project.ts";
51
+ import { gitUrl, destDir, winBad, cloneInto, branchesOf, ignoreKaizen, writePointer } from "./add-project.ts";
49
52
 
50
53
  const PAGE = join(dirname(import.meta.dir), "web", "html", "board.html");
51
54
  // The board's script: web/pages/board/main.ts with web/lib and web/components, bundled into one file by `bun run build:web`.
@@ -60,6 +63,8 @@ const NOTES_JS = join(dirname(import.meta.dir), "web", "dist", "notebook.js");
60
63
  const TERM_JS = join(dirname(import.meta.dir), "web", "dist", "term.js");
61
64
  const ANNOTATE_JS = join(dirname(import.meta.dir), "web", "dist", "annotate.js");
62
65
  const TERM_CSS = join(dirname(import.meta.dir), "web", "dist", "term.css");
66
+ // A project added from the board gets the kaizen note (what plain chat offers), as `kaizen init` writes it; a folder that cannot be written still adds.
67
+ const notePointer = (dir: string) => { try { writePointer(dir, KNOWN_AGENTS.filter((a) => agentUsable(a.cmd)).map((a) => a.cmd)); } catch { /* the project still works */ } };
63
68
  // The Video page (kaizen-video's library, editor and renders) and its bundle.
64
69
  const VIDEO_PAGE = join(dirname(import.meta.dir), "web", "html", "video.html");
65
70
  const POPUP_PAGE = join(dirname(import.meta.dir), "web", "html", "popup.html");
@@ -279,6 +284,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
279
284
  // A failed git init leaves a project without a repository: said, not rolled back.
280
285
  const inited = git ? run(["git", "init", "-q", "--", to], to).ok : undefined;
281
286
  if (inited) try { ignoreKaizen(to); } catch { /* the project still works */ }
287
+ notePointer(to);
282
288
  remember(to);
283
289
  changed();
284
290
  return { dir: join(to, ".kaizen"), ...(git ? { git: inited } : {}) };
@@ -768,6 +774,59 @@ export async function web(repoDir: string, opts: Opts = {}) {
768
774
 
769
775
  // Automations: a due rule starts a run in its own project. Own busy flag; a fire may wait on a precheck.
770
776
  let autoBusy = false;
777
+ // `kaizen upgrade`, then a new board on this port. The Update button and the automatic update (below) both run it.
778
+ const runUpgrade = async (): Promise<{ ok: true; version?: string } | { error: string; status: number }> => {
779
+ if (upgrading) return { error: "an upgrade is already running", status: 409 };
780
+ if (DESKTOP_BUNDLED) return { error: "this board is the desktop app's copy; the app updates itself", status: 409 };
781
+ // Windows will not rename ~/kaizen while this board holds files in it, so the
782
+ // upgrade waits in its own process for this one to exit, then starts the board
783
+ // again; ~/.kaizen/upgrade.log keeps what it said. It runs from a copy of cli/,
784
+ // so nothing runs out of ~/kaizen while it is renamed.
785
+ if (process.platform === "win32") {
786
+ const helper = join(home, ".kaizen", "upgrader");
787
+ rmSync(helper, { recursive: true, force: true });
788
+ cpSync(join(repoDir, "cli"), join(helper, "cli"), { recursive: true });
789
+ const log = Bun.file(UPGRADE_LOG);
790
+ Bun.spawn([process.execPath, join(helper, "cli", "install.ts"), "upgrade", "--wait", String(process.pid), "--restart", String(srv.port)], {
791
+ cwd: home, detached: true, stdio: ["ignore", log, log], windowsHide: true,
792
+ }).unref();
793
+ saveLive();
794
+ setTimeout(() => process.exit(0), 300);
795
+ return { ok: true as const };
796
+ }
797
+ upgrading = true;
798
+ try {
799
+ const p = Bun.spawn([process.execPath, join(repoDir, "cli", "install.ts"), "upgrade"], { stdin: "ignore", stdout: "pipe", stderr: "pipe", windowsHide: true });
800
+ const [out, err, code] = await Promise.all([new Response(p.stdout).text(), new Response(p.stderr).text(), p.exited]);
801
+ const why = (out + err).replace(/\x1b\[[0-9;]*m/g, "").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("+")).slice(-2).join(" — ");
802
+ if (code !== 0) return { error: why || `kaizen upgrade exited ${code}`, status: 500 };
803
+ if (installed() === VERSION) return { error: why || "Already up to date", status: 400 };
804
+ const port = srv.port;
805
+ saveLive();
806
+ setTimeout(() => {
807
+ Bun.spawn([process.execPath, join(repoDir, "cli", "install.ts"), "web", "--port", String(port), "--no-open", "--foreground"], {
808
+ detached: true, stdio: ["ignore", "ignore", "ignore"], windowsHide: true,
809
+ }).unref();
810
+ }, 300);
811
+ return { ok: true as const, version: installed() };
812
+ } finally { upgrading = false; }
813
+
814
+ };
815
+ // Update automatically (Settings → General → Updates): every 30 minutes, and once shortly after the board starts, when the switch is
816
+ // on, npm has a newer version, no terminal is alive and no board page is open (an update restarts the board).
817
+ const autoUpd = () => autoUpdateTick({
818
+ on: async () => (await setting("board.auto_update")) === "true",
819
+ latest: () => npmLatest(),
820
+ newer: (v) => newer(v, VERSION),
821
+ desktop: DESKTOP_BUNDLED,
822
+ upgrading: () => upgrading,
823
+ terminalsAlive: () => ptyKeys().some((k) => ptyState(k)?.alive),
824
+ pagesOpen: () => clients.size > 0,
825
+ upgrade: runUpgrade,
826
+ }).catch(() => "off" as const); // the next tick tries again
827
+ const autoUpdate = setInterval(autoUpd, 30 * 60_000);
828
+ const autoFirst = setTimeout(autoUpd, 90_000);
829
+
771
830
  const automate = setInterval(async () => {
772
831
  if (autoBusy) return;
773
832
  autoBusy = true;
@@ -1159,7 +1218,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
1159
1218
  // A first message for the agent (the Storage panel's Cleanup: "/disk-cleanup"), passed as its
1160
1219
  // argument the way a run's prompt is (promptArgs), never through a shell.
1161
1220
  const first = !signIn && typeof body.prompt === "string" && body.prompt.trim() && body.prompt.length <= 2000 ? body.prompt.trim() : "";
1162
- const line = signIn ? [commandOf(a.cmd), ...(a.cmd === "codex" ? ["login"] : [])] : withEnv([commandOf(a.cmd), ...(bypass ? YOLO_FLAGS[a.cmd]! : []), ...argsOf(a.cmd), ...promptArgs(a.cmd, first)], a.cmd);
1221
+ const line = signIn ? [commandOf(a.cmd), ...(a.cmd === "codex" ? ["login"] : [])] : withEnv([commandOf(a.cmd), ...(bypass ? bypassFlags(a.cmd) : []), ...argsOf(a.cmd), ...promptArgs(a.cmd, first)], a.cmd);
1163
1222
  cmd = acct.dir ? ["env", ...accountEnv(acct), ...line] : line;
1164
1223
  }
1165
1224
  // A workspace folder: only an exact path from this project's own `git worktree list`.
@@ -1282,6 +1341,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
1282
1341
  const already = knownProjects().includes(d.dir);
1283
1342
  try { mkdirSync(join(d.dir, ".kaizen"), { recursive: true }); }
1284
1343
  catch (e) { return bad(`could not set up ${d.dir}: ${(e as Error).message}`); }
1344
+ notePointer(d.dir);
1285
1345
  remember(d.dir);
1286
1346
  changed();
1287
1347
  return json({ ok: true, dir: join(d.dir, ".kaizen"), already });
@@ -1300,6 +1360,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
1300
1360
  const c = await cloneInto(g.url, to);
1301
1361
  if (!c.ok) return bad(c.why, 500);
1302
1362
  mkdirSync(join(to, ".kaizen"), { recursive: true });
1363
+ notePointer(to);
1303
1364
  remember(to);
1304
1365
  changed();
1305
1366
  return json({ ok: true, dir: join(to, ".kaizen") });
@@ -1506,7 +1567,8 @@ export async function web(repoDir: string, opts: Opts = {}) {
1506
1567
  const out: Usage[] = [];
1507
1568
  if (onPath("claude")) { const u = await claudeUsage(home); if (u) out.push(u); }
1508
1569
  if (onPath("codex")) { const u = codexUsage(home); if (u) out.push(u); }
1509
- usageCache = out;
1570
+ // A rate-limit or network error keeps the last good reading instead of blanking the chip.
1571
+ usageCache = out.map((u) => (u.error ? usageCache.find((o) => o.agent === u.agent && !o.error) ?? u : u));
1510
1572
  usageAt = Date.now();
1511
1573
  }
1512
1574
  return json(usageCache);
@@ -1547,7 +1609,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
1547
1609
  await p.exited;
1548
1610
  } catch { return json({ tailscale: false }); }
1549
1611
  const r = phonePeers(out);
1550
- return json({ tailscale: r.running, phones: r.phones.length, online: r.phones.some((x) => x.online), self: r.self, computers: r.computers });
1612
+ return json({ tailscale: r.running, phones: r.phones.length, online: r.phones.some((x) => x.online), devices: r.phones.filter((x) => x.online), self: r.self, computers: r.computers });
1551
1613
  }
1552
1614
 
1553
1615
  // Every note of one project, text included: search, tags and backlinks are the page's.
@@ -1743,6 +1805,8 @@ export async function web(repoDir: string, opts: Opts = {}) {
1743
1805
  request: read("00-request.md"), explore: read("00-explore.md"), plan: read("01-plan.md"), approval: read("02-approval.md"),
1744
1806
  impl: read("03-impl.md"), review: read("04-review.md"), backlog: read("06-backlog.md"),
1745
1807
  notes: read("notes.md"), progress: read("progress.md"),
1808
+ // What the agent is doing right now, from its own hooks (cli/activity.ts); empty for any other agent.
1809
+ activity: readActivity(dir, (() => { try { return JSON.parse(readText(join(base, "state.json"))).session; } catch { return null; } })()),
1746
1810
  // Notebook notes whose [[run:…]] links name this run.
1747
1811
  linkedFrom: linksTo(dir, id),
1748
1812
  // Nothing to pick in the global state dir: /fix refuses it.
@@ -1800,7 +1864,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
1800
1864
  }
1801
1865
  const projects = states(true).filter((d) => d !== join(home, ".kaizen")).length;
1802
1866
  const ch = agentChoices(repoDir);
1803
- return json({ ...onboardingView(home, projects), default: ch.default, installed: ch.agents.map((a) => a.cmd), agents: KNOWN_AGENTS.map((a) => ({ cmd: a.cmd, name: a.name })), install: installHelp(process.platform === "win32") });
1867
+ return json({ ...onboardingView(home, projects), preset: (await setting("preset")) || "medium", default: ch.default, installed: ch.agents.map((a) => a.cmd), agents: KNOWN_AGENTS.map((a) => ({ cmd: a.cmd, name: a.name })), install: installHelp(process.platform === "win32") });
1804
1868
  }
1805
1869
 
1806
1870
  // Names, folders' sign-in lines and usage only: tokens stay in the tools' own files.
@@ -2068,6 +2132,20 @@ export async function web(repoDir: string, opts: Opts = {}) {
2068
2132
  }
2069
2133
 
2070
2134
  // What this board runs and what npm has: the page shows an Update button on a newer one.
2135
+ // What's New under Settings → General → About: the installed version's highlights and fixes, and whether this machine has seen them
2136
+ // (cli/whats-new.ts). A brand-new install (no project yet) gets none: it has the welcome. POST records it as seen.
2137
+ if (path === "/whats-new" && (req.method === "GET" || req.method === "POST")) {
2138
+ const fresh = states(true).filter((d) => d !== join(home, ".kaizen")).length === 0;
2139
+ if (req.method === "POST") {
2140
+ const refused = strict(req);
2141
+ if (refused) return refused;
2142
+ if (!local(req)) return bad("cross-origin write refused", 403);
2143
+ const w = whatsNew(home, VERSION, fresh);
2144
+ if (w.entry) markSeen(home, w.entry.version);
2145
+ }
2146
+ return json(whatsNew(home, VERSION, fresh));
2147
+ }
2148
+
2071
2149
  if (req.method === "GET" && path === "/version") {
2072
2150
  const v = await npmLatest(url.searchParams.has("fresh"));
2073
2151
  // The desktop app's own copy is read-only and updates with the app, so no
@@ -2084,40 +2162,8 @@ export async function web(repoDir: string, opts: Opts = {}) {
2084
2162
  // this board running and says why.
2085
2163
  if (req.method === "POST" && path === "/upgrade") {
2086
2164
  if (!local(req)) return bad("cross-origin write refused", 403);
2087
- if (upgrading) return bad("an upgrade is already running", 409);
2088
- if (DESKTOP_BUNDLED) return bad("this board is the desktop app's copy; the app updates itself", 409);
2089
- // Windows will not rename ~/kaizen while this board holds files in it, so the
2090
- // upgrade waits in its own process for this one to exit, then starts the board
2091
- // again; ~/.kaizen/upgrade.log keeps what it said. It runs from a copy of cli/,
2092
- // so nothing runs out of ~/kaizen while it is renamed.
2093
- if (process.platform === "win32") {
2094
- const helper = join(home, ".kaizen", "upgrader");
2095
- rmSync(helper, { recursive: true, force: true });
2096
- cpSync(join(repoDir, "cli"), join(helper, "cli"), { recursive: true });
2097
- const log = Bun.file(UPGRADE_LOG);
2098
- Bun.spawn([process.execPath, join(helper, "cli", "install.ts"), "upgrade", "--wait", String(process.pid), "--restart", String(srv.port)], {
2099
- cwd: home, detached: true, stdio: ["ignore", log, log], windowsHide: true,
2100
- }).unref();
2101
- saveLive();
2102
- setTimeout(() => process.exit(0), 300);
2103
- return json({ ok: true });
2104
- }
2105
- upgrading = true;
2106
- try {
2107
- const p = Bun.spawn([process.execPath, join(repoDir, "cli", "install.ts"), "upgrade"], { stdin: "ignore", stdout: "pipe", stderr: "pipe", windowsHide: true });
2108
- const [out, err, code] = await Promise.all([new Response(p.stdout).text(), new Response(p.stderr).text(), p.exited]);
2109
- const why = (out + err).replace(/\x1b\[[0-9;]*m/g, "").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("+")).slice(-2).join(" — ");
2110
- if (code !== 0) return bad(why || `kaizen upgrade exited ${code}`, 500);
2111
- if (installed() === VERSION) return bad(why || "Already up to date");
2112
- const port = srv.port;
2113
- saveLive();
2114
- setTimeout(() => {
2115
- Bun.spawn([process.execPath, join(repoDir, "cli", "install.ts"), "web", "--port", String(port), "--no-open", "--foreground"], {
2116
- detached: true, stdio: ["ignore", "ignore", "ignore"], windowsHide: true,
2117
- }).unref();
2118
- }, 300);
2119
- return json({ ok: true, version: installed() });
2120
- } finally { upgrading = false; }
2165
+ const r = await runUpgrade();
2166
+ return "error" in r ? bad(r.error, r.status) : json(r);
2121
2167
  }
2122
2168
 
2123
2169
  // The user's Firecrawl key for `kaizen search` / `kaizen scrape` (cli/research.ts).
@@ -2293,6 +2339,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
2293
2339
  return "error" in r ? { error: r.error } : { dir: (r as { dir: string }).dir };
2294
2340
  },
2295
2341
  agents: KNOWN_AGENTS.filter((a) => agentUsable(a.cmd)).map((a) => a.cmd),
2342
+ defaultAgent: detectDefaultAgent(repoDir).cmd,
2296
2343
  // A draft task: saved on the Tasks list, no agent started (the task page starts it).
2297
2344
  task: (d: string, goal: string) => {
2298
2345
  try { tasks.createTask(d, { goal, project: dirname(d) }, `chat:${Date.now()}:${Math.random().toString(36).slice(2, 8)}`); changed(); return { ok: true as const }; }
@@ -3056,7 +3103,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
3056
3103
  saveLive();
3057
3104
  awake.stop();
3058
3105
  closeAllProxies();
3059
- clearInterval(poll); clearInterval(ping); clearInterval(gather); clearInterval(automate); clearInterval(loop); clearInterval(keepList);
3106
+ clearInterval(autoUpdate); clearTimeout(autoFirst); clearInterval(poll); clearInterval(ping); clearInterval(gather); clearInterval(automate); clearInterval(loop); clearInterval(keepList);
3060
3107
  for (const w of watchers) { try { w.close(); } catch { /* gone */ } }
3061
3108
  setTimeout(() => { server.stop(true); resolve(); }, live ? 400 : 0);
3062
3109
  };
@@ -0,0 +1,38 @@
1
+ [
2
+ {
3
+ "version": "1.87.4",
4
+ "highlights": [
5
+ {
6
+ "title": "What's New, right in Settings",
7
+ "text": "After an update, Settings → General → About shows what changed in this release, with a dot on the Settings gear until you have seen it."
8
+ },
9
+ {
10
+ "title": "See what the agent is doing, live",
11
+ "text": "While Claude Code builds a task, its panel shows the file it is editing or the command it is running right now, with the last few actions below."
12
+ },
13
+ {
14
+ "title": "Update automatically",
15
+ "text": "A new switch under Settings → General → Updates lets kaizen update itself when nothing is running and no board page is open. Off by default."
16
+ },
17
+ {
18
+ "title": "A welcome that explains how kaizen works",
19
+ "text": "New users see how a run goes, from ask to review, and the setup no longer ends until a project is added."
20
+ },
21
+ {
22
+ "title": "Agents offer kaizen's skills",
23
+ "text": "Ask for a video, a deck or a plan in plain chat and the matching skill is offered first."
24
+ },
25
+ {
26
+ "title": "Permission prompts on the task page",
27
+ "text": "When an agent waits for permission, Allow and Deny are on the task. Kaizen's own file reads no longer ask."
28
+ }
29
+ ],
30
+ "fixes": [
31
+ "A task no longer gets stuck after its review; \"Looks good\" comes back and finishes it.",
32
+ "Explore asks its questions before it starts investigating.",
33
+ "Steam Deck: the app uses software rendering, which stops the GPU crash.",
34
+ "The footer checks your connected phone every 15 seconds.",
35
+ "The last Claude usage reading is kept when its endpoint errors."
36
+ ]
37
+ }
38
+ ]
@@ -0,0 +1,43 @@
1
+ // What's New: a short, hand-written list of a release's big improvements and its fixes (cli/whats-new.json, newest first), shown once
2
+ // per machine under Settings → General → About after an update. The text is written at release time (`bun run release` refuses to
3
+ // publish a version that has no entry, unless told `--no-notes`); what a machine has seen lives in ~/.kaizen/whats-new-seen.json.
4
+ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
5
+ import { dirname, join } from "node:path";
6
+
7
+ export type Entry = { version: string; highlights: { title: string; text: string }[]; fixes: string[] };
8
+
9
+ const here = join(dirname(import.meta.path), "whats-new.json");
10
+ export const entries = (): Entry[] => { try { return JSON.parse(readFileSync(here, "utf8")); } catch { return []; } };
11
+
12
+ // 1.10.0 is newer than 1.9.0: numbers, not text.
13
+ export const cmp = (a: string, b: string) => {
14
+ const x = a.split(".").map(Number), y = b.split(".").map(Number);
15
+ for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) - (y[i] || 0);
16
+ return 0;
17
+ };
18
+ // The entry a machine on `installed` shows: the one for exactly that version, nothing otherwise. A release with no entry of its own shows
19
+ // nothing, rather than the notes of an older release under a newer version (`bun run release` refuses to publish without one).
20
+ export const entryFor = (list: Entry[], installed: string): Entry | null => list.find((e) => e.version === installed) ?? null;
21
+
22
+ const file = (home: string) => join(home, ".kaizen", "whats-new-seen.json");
23
+ export const seenVersion = (home: string): string | null => {
24
+ try { const v = JSON.parse(readFileSync(file(home), "utf8"))?.version; return typeof v === "string" ? v : null; } catch { return null; }
25
+ };
26
+ export function markSeen(home: string, version: string) {
27
+ const cur = seenVersion(home);
28
+ if (cur && cmp(cur, version) >= 0) return;
29
+ mkdirSync(dirname(file(home)), { recursive: true });
30
+ writeFileSync(file(home) + ".tmp", JSON.stringify({ version }) + "\n");
31
+ renameSync(file(home) + ".tmp", file(home));
32
+ }
33
+
34
+ // What the page gets. `fresh`: a brand-new install (no project yet), which has the welcome instead and is recorded as having seen
35
+ // this version, so the card never greets it; someone who already has projects sees it once, the first time.
36
+ export function whatsNew(home: string, installed: string, fresh: boolean, list: Entry[] = entries()) {
37
+ const entry = entryFor(list, installed);
38
+ if (!entry) return { version: installed, entry: null, unseen: false };
39
+ const seen = seenVersion(home);
40
+ if (seen === null && fresh) { markSeen(home, entry.version); return { version: installed, entry, unseen: false }; }
41
+ return { version: installed, entry, unseen: seen === null || cmp(entry.version, seen) > 0 };
42
+ }
43
+ export const hasEntry = (version: string, list: Entry[] = entries()) => list.some((e) => e.version === version);
package/cli/workers.ts CHANGED
@@ -9,7 +9,7 @@ import { join } from "node:path";
9
9
  import { argsOf, commandOf, readPrefs, withEnv, type Prefs } from "./agent-prefs.ts";
10
10
  import { clip, reportBlocked, reportUnblock, validId } from "./report.ts";
11
11
  import { read } from "./settings.ts";
12
- import { accountEnv, accountForRun, agentFlags, agentUsable, detectDefaultAgent, MODEL_FLAGS, plainModel, promptArgs, readText, runAgent, subagentEnv, YOLO_FLAGS } from "./state.ts";
12
+ import { accountEnv, accountForRun, agentFlags, agentUsable, detectDefaultAgent, MODEL_FLAGS, plainModel, promptArgs, readText, runAgent, subagentEnv, YOLO_FLAGS, bypassFlags } from "./state.ts";
13
13
  import { branchFor, branchOf, run as sh } from "./worktree.ts";
14
14
 
15
15
  export type Status = "planned" | "requested" | "running" | "blocked" | "succeeded" | "failed" | "unverified" | "conflict" | "merged" | "stopped";
@@ -222,7 +222,7 @@ export function agentLine(project: string, id: string, prompt: string, permissio
222
222
  const acct = accountForRun(project, id, agent.cmd);
223
223
  if (acct.error) return acct.error;
224
224
  const bypass = permissions === "bypass" && !!YOLO_FLAGS[agent.cmd];
225
- const flags = [...agentFlags(project, agent.cmd, undefined, model), ...(bypass ? YOLO_FLAGS[agent.cmd]! : []), ...argsOf(agent.cmd, prefs)];
225
+ const flags = [...agentFlags(project, agent.cmd, undefined, model), ...(bypass ? bypassFlags(agent.cmd) : []), ...argsOf(agent.cmd, prefs)];
226
226
  const line = withEnv([commandOf(agent.cmd, prefs), ...flags, ...promptArgs(agent.cmd, prompt)], agent.cmd, prefs);
227
227
  // Windows has no env command: there only an account, as before, gets one.
228
228
  const vars = [...(process.platform !== "win32" ? subagentEnv(project, agent.cmd) : []), ...accountEnv(acct)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaizen-agent",
3
- "version": "1.87.3",
3
+ "version": "1.87.4",
4
4
  "description": "Staged workflow for AI agents — code, writing, research, operations: plan, human approval, build, independent review, bounded fix loop.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -249,6 +249,9 @@ agent:
249
249
  # gemini: { model: gemini-2.5-pro }
250
250
 
251
251
  board:
252
+ # Update kaizen by itself when a newer version is out and no terminal is running
253
+ # (an update restarts the board). The desktop app updates itself either way.
254
+ auto_update: false
252
255
  # A folder your projects live in, e.g. ~/Projects, or C:\Users\you\Projects on
253
256
  # Windows. Every folder inside it is offered in kaizen's project list;
254
257
  # choosing one creates its .kaizen and moves kaizen there. A folder that is
@@ -261,4 +261,10 @@ Task-specific exception to the general follow-up confirmation rule.
261
261
  Task acceptance (Looks good) is distinct from workflow completion, technical git
262
262
  housekeeping and publication. Finish genuine checks and workflow decisions, publish
263
263
  checks/limitations honestly, then leave the completed result for user acceptance.
264
+ End the run explicitly once the result is published and the review is over: with
265
+ `approvals.review` off run `kaizen done <run>` (the task then waits on Looks good);
266
+ with it on run `kaizen state <run> stage=review awaiting=approvals.review` and stop,
267
+ so the task page offers the approval. Never stop at `review` with `awaiting` empty:
268
+ the board cannot tell that from a review still running, and offers Looks good only
269
+ after two quiet minutes.
264
270
  A rendered event form is not evidence of registration storage or delivery.
@@ -35,6 +35,13 @@ them in your questions and recommendations. Stop at three searches unless the
35
35
  topic is still unclear; deep research comes after the decisions. Skip this only
36
36
  for work internal to the project (its own bugs, refactors).
37
37
 
38
+ Then ask before you investigate. Hands-on work (driving the app, installing it,
39
+ walking every screen, a study across many files or sources) waits until the user
40
+ has answered the first round, at least who it is for and how deep to go. This
41
+ holds most for a request that is itself research, such as an audit or a
42
+ walkthrough: do not deliver the research inside Explore before its scope is set.
43
+ Save each step to `00-explore.md` as it happens, not only at the end.
44
+
38
45
  Web tools, in this order:
39
46
 
40
47
  1. `kaizen search "<query>" --recent m` (add `--read` for page text, `--limit N`)
@@ -4,3 +4,4 @@ export * from "./home-message.tsx";
4
4
  export * from "./home-window.tsx";
5
5
  export * from "./home-ws-add.tsx";
6
6
  export * from "./onboarding-dialog.tsx";
7
+ export * from "./works-flow.tsx";
@@ -2,6 +2,7 @@ import { useState, type ReactNode } from "react";
2
2
  import {
3
3
  agentGroups,
4
4
  answerOffer,
5
+ ASK,
5
6
  back,
6
7
  COPY,
7
8
  goto,
@@ -12,15 +13,19 @@ import {
12
13
  notifState,
13
14
  offerText,
14
15
  pickAgent,
16
+ pickPreset,
15
17
  pickTheme,
16
18
  skip,
19
+ STEP,
17
20
  toggleMore,
18
21
  useOnboarding,
19
22
  type Cfg,
23
+ type Flow as FlowState,
20
24
  } from "@lib/home";
21
25
  import { cn } from "@lib/core";
22
26
  import { Button, Dialog, DialogContent, DialogDescription, DialogTitle, Icon } from "@web/ui";
23
27
  import { PhoneCard } from "@components/phone";
28
+ import { WorksFlow } from "./works-flow.tsx";
24
29
 
25
30
  const MOD = typeof navigator !== "undefined" && /Mac|iP(hone|ad)/.test(navigator.platform) ? "⌘" : "Ctrl";
26
31
 
@@ -245,10 +250,36 @@ function AlertStep() {
245
250
  );
246
251
  }
247
252
 
248
- // The setup flow: four steps in one panel, a progress bar that jumps between them, then Add your first project.
253
+ // How much kaizen asks: the three presets in plain words, starting on the one the board has. Picking saves it when the step is left.
254
+ function AskStep({ preset }: { preset: string }) {
255
+ return (
256
+ <>
257
+ <div role="radiogroup" aria-label="How much kaizen asks you" className="flex flex-col gap-2.5">
258
+ {ASK.map((a) => (
259
+ <Card key={a.id} on={preset === a.id} onPick={() => pickPreset(a.id)} className="items-start py-3">
260
+ <span>
261
+ <b className="font-medium">{a.name}</b>
262
+ <small className="ml-2 rounded-full border border-border px-2 py-px text-xs font-normal text-muted-foreground">
263
+ {a.tag}
264
+ </small>
265
+ <small className="mt-0.5 block text-sm font-normal text-muted-foreground">{a.text}</small>
266
+ </span>
267
+ </Card>
268
+ ))}
269
+ </div>
270
+ <p className="text-sm text-muted-foreground">
271
+ {preset
272
+ ? "It starts on your current setting and changes only if you pick another card."
273
+ : "You have custom settings. They stay as they are unless you pick a card."}
274
+ </p>
275
+ </>
276
+ );
277
+ }
278
+
279
+ // The setup flow: five steps in one panel, a progress bar that jumps between them, then Add your first project.
249
280
  // Escape and Skip ask first; clicking outside does nothing. Ctrl/Cmd+Enter always continues, a bare Enter does unless a
250
281
  // button (other than a choice card) or a field holds focus.
251
- function Flow({ cfg, flow }: { cfg: Cfg; flow: { step: number; agent: string; theme: string; more: boolean } }) {
282
+ function Flow({ cfg, flow }: { cfg: Cfg; flow: FlowState }) {
252
283
  const { step } = flow,
253
284
  last = step === cfg.total - 1,
254
285
  s = COPY[step]!;
@@ -301,7 +332,7 @@ function Flow({ cfg, flow }: { cfg: Cfg; flow: { step: number; agent: string; th
301
332
  </span>
302
333
  </div>
303
334
  <div className="flex min-h-0 flex-1 flex-col gap-3.5 overflow-auto px-0.5 pb-1.5 pt-[30px]">
304
- {step === 0 && (
335
+ {step === STEP.works && (
305
336
  <small className="text-xs uppercase tracking-[0.14em] text-muted-foreground">Welcome to kaizen</small>
306
337
  )}
307
338
  <DialogTitle className="text-[30px] font-bold leading-[1.15] text-strong max-[640px]:text-2xl">
@@ -310,10 +341,16 @@ function Flow({ cfg, flow }: { cfg: Cfg; flow: { step: number; agent: string; th
310
341
  <DialogDescription id="onb-sub" className="mb-3 max-w-[56ch] text-lg">
311
342
  {s.sub}
312
343
  </DialogDescription>
313
- {step === 0 && <AgentStep cfg={cfg} agent={flow.agent} more={flow.more} />}
314
- {step === 1 && <LookStep theme={flow.theme} />}
315
- {step === 2 && <AlertStep />}
316
- {step === 3 && (
344
+ {step === STEP.works && <WorksFlow />}
345
+ {step === STEP.agent && <AgentStep cfg={cfg} agent={flow.agent} more={flow.more} />}
346
+ {step === STEP.ask && <AskStep preset={flow.preset} />}
347
+ {step === STEP.look && (
348
+ <>
349
+ <LookStep theme={flow.theme} />
350
+ <AlertStep />
351
+ </>
352
+ )}
353
+ {step === STEP.phone && (
317
354
  <Panel>
318
355
  <PhoneCard />
319
356
  </Panel>
@@ -0,0 +1,119 @@
1
+ import type { ReactNode } from "react";
2
+ import { FLOW } from "@lib/home";
3
+
4
+ // The first welcome step's picture, drawn like Settings → Orchestration's: rounded boxes joined by beams of light. ask → plan →
5
+ // approve → build → review; the boxes where you decide are solid, where an agent works outlined. One 10 s timeline: the beam
6
+ // travels start to end and each box lights up for 1.4 s when it arrives, with a little work in it (plan draws its lines, ask and
7
+ // build blink a cursor, approve draws its check). Two rows on a narrow screen. currentColor and var(--accent), so it follows light
8
+ // and dark. CSS only; with reduced motion the lines stay lit and nothing moves.
9
+ const CSS = `.wk svg{overflow:visible;width:100%;height:auto;fill:none}
10
+ .wk .l{fill:none;stroke:currentColor;stroke-width:2;opacity:.16}
11
+ .wk .b{fill:none;stroke:var(--accent);stroke-width:3;stroke-linecap:round;filter:drop-shadow(0 0 4px var(--accent));opacity:0;stroke-dasharray:25 100;stroke-dashoffset:125}
12
+ .wk rect.bx{fill:var(--bg);stroke:currentColor;stroke-width:1.6}
13
+ .wk rect.you{fill:currentColor}
14
+ .wk .i path,.wk .i circle{fill:none;stroke:var(--accent);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
15
+ .wk .y .i path,.wk .y .i circle{stroke:var(--bg)}
16
+ .wk text{fill:currentColor;stroke:none;font:600 21px var(--mono,ui-monospace,monospace)}
17
+ .wk .y text{fill:var(--bg)}
18
+ .wk .cur{fill:currentColor;stroke:none;opacity:0}
19
+ .wk .y .cur{fill:var(--bg)}
20
+ .wk .wb{fill:var(--accent);stroke:none;transform-box:fill-box;transform-origin:left;transform:scaleX(0)}
21
+ .wk .ck{stroke-dasharray:1;stroke-dashoffset:0}
22
+ @media (prefers-reduced-motion:no-preference){
23
+ .wk rect.ag{animation:wk-ag 10s linear infinite}
24
+ .wk rect.you{animation:wk-you 10s linear infinite}
25
+ .wk .b{animation:wk-beam 10s linear infinite}
26
+ .wk .cur{animation:wk-blink 10s linear infinite}
27
+ .wk .wb{animation:wk-grow 10s linear infinite}
28
+ .wk .ck{animation:wk-draw 10s linear infinite}}
29
+ @keyframes wk-ag{0%,14%{stroke-width:3.2;fill:color-mix(in srgb,currentColor 12%,var(--bg));filter:drop-shadow(0 0 6px var(--accent))}16%,100%{stroke-width:1.6;fill:var(--bg);filter:none}}
30
+ @keyframes wk-you{0%,14%{stroke-width:3.2;filter:drop-shadow(0 0 6px var(--accent))}16%,100%{stroke-width:1.6;filter:none}}
31
+ @keyframes wk-beam{0%{stroke-dashoffset:125;opacity:1}7%{stroke-dashoffset:-25;opacity:1}7.5%,100%{stroke-dashoffset:-25;opacity:0}}
32
+ @keyframes wk-blink{0%{opacity:1}3.5%{opacity:0}7%{opacity:1}10.5%{opacity:0}14%{opacity:1}15%,100%{opacity:0}}
33
+ @keyframes wk-grow{0%{transform:scaleX(0)}5%{transform:scaleX(1)}9%{transform:scaleX(.55)}13%{transform:scaleX(1)}15%,100%{transform:scaleX(0)}}
34
+ @keyframes wk-draw{0%{stroke-dashoffset:1}8%,100%{stroke-dashoffset:0}}`;
35
+
36
+ const ICONS: Record<string, ReactNode> = {
37
+ ask: (
38
+ <>
39
+ <circle cx="6.5" cy="4" r="2.6" />
40
+ <path d="M1.5 12.5c.8-3 3-4 5-4s4.2 1 5 4" />
41
+ </>
42
+ ),
43
+ plan: <path d="M1 1h7l4 4v9H1zM8 1v4h4" />,
44
+ approve: (
45
+ <>
46
+ <circle cx="6.5" cy="6.5" r="6" />
47
+ <path className="ck" pathLength={1} d="M4 6.5l2 2 3.5-4" />
48
+ </>
49
+ ),
50
+ build: <path d="M1 2l4 3-4 3M7 10h5" />,
51
+ review: (
52
+ <>
53
+ <circle cx="5.5" cy="5.5" r="4" />
54
+ <path d="M8.5 8.5L12.5 12.5" />
55
+ </>
56
+ ),
57
+ };
58
+ // Where each box sits and how the beams join them: one row of five, or two rows (3 and 2) with the line wrapping down.
59
+ const WIDE = {
60
+ view: "0 0 960 120",
61
+ boxes: [[0, 30], [202, 30], [404, 30], [606, 30], [808, 30]],
62
+ lines: ["M152 60H202", "M354 60H404", "M556 60H606", "M758 60H808"],
63
+ };
64
+ const NARROW = {
65
+ view: "0 0 560 230",
66
+ boxes: [[0, 10], [204, 10], [408, 10], [0, 150], [204, 150]],
67
+ lines: ["M152 40H204", "M356 40H408", "M484 70V100Q484 120 464 120H96Q76 120 76 140V150", "M152 180H204"],
68
+ };
69
+ const LABEL = "You ask, kaizen plans, you approve, an agent builds it, a second agent reviews it.";
70
+
71
+ function Flow({ g, className }: { g: typeof WIDE; className: string }) {
72
+ return (
73
+ <svg viewBox={g.view} role="img" aria-label={LABEL} className={className}>
74
+ {g.lines.map((d) => (
75
+ <path key={"l" + d} className="l" d={d} />
76
+ ))}
77
+ {g.lines.map((d, k) => (
78
+ <path key={"b" + d} className="b" pathLength={100} style={{ animationDelay: `${k * 2 + 1.2}s` }} d={d} />
79
+ ))}
80
+ {FLOW.map((f, i) => (
81
+ <g key={f.name} className={f.you ? "y" : ""} transform={`translate(${g.boxes[i]![0]} ${g.boxes[i]![1]})`}>
82
+ <rect className={`bx ${f.you ? "you" : "ag"}`} style={{ animationDelay: `${i * 2}s` }} width={152} height={60} rx={12} />
83
+ <g className="i" transform="translate(16 20) scale(1.15)">
84
+ {ICONS[f.name]}
85
+ </g>
86
+ <text x={46} y={37}>
87
+ {f.name}
88
+ </text>
89
+ {f.name === "ask" && <rect className="cur" style={{ animationDelay: "0s" }} x={86} y={19} width={2.5} height={22} rx={1} />}
90
+ {f.name === "build" && <rect className="cur" style={{ animationDelay: "6s" }} x={114} y={19} width={2.5} height={22} rx={1} />}
91
+ {f.name === "plan" &&
92
+ [34, 26, 30].map((w, j) => (
93
+ <rect key={j} className="wb" style={{ animationDelay: `${2 + j * 0.25}s` }} x={102} y={17 + j * 10} width={w} height={4} rx={2} />
94
+ ))}
95
+ </g>
96
+ ))}
97
+ </svg>
98
+ );
99
+ }
100
+
101
+ export function WorksFlow() {
102
+ return (
103
+ <div className="wk my-1 block w-full py-1" data-testid="works-flow">
104
+ <style>{CSS}</style>
105
+ <Flow g={WIDE} className="block max-[560px]:hidden" />
106
+ <Flow g={NARROW} className="hidden max-[560px]:block" />
107
+ <div className="mt-2 flex gap-4 text-xs text-muted-foreground">
108
+ <span className="inline-flex items-center gap-1.5">
109
+ <i className="inline-block size-3 rounded-[3px] border-[1.5px] border-foreground bg-foreground" />
110
+ you
111
+ </span>
112
+ <span className="inline-flex items-center gap-1.5">
113
+ <i className="inline-block size-3 rounded-[3px] border-[1.5px] border-foreground" />
114
+ agent
115
+ </span>
116
+ </div>
117
+ </div>
118
+ );
119
+ }
@@ -121,7 +121,7 @@ function FolderStep({ back }: { back?: () => void }) {
121
121
  return (
122
122
  <Step
123
123
  title="Existing folder"
124
- hint="Pick a folder, or type its path. A .kaizen folder is added to it."
124
+ hint="Pick a folder, or type its path. A .kaizen folder and a short kaizen note in CLAUDE.md are added to it."
125
125
  err={err}
126
126
  go="Add project"
127
127
  busy={busy ? "Adding..." : ""}