Skip to content

Latest commit

 

History

History
113 lines (76 loc) · 56.6 KB

development.md

File metadata and controls

113 lines (76 loc) · 56.6 KB

Development

The crates

  • plugin-agy/: the studio's plugin for agy (#43). hooks.json runs plotkeeper-hook for agy's six events through an inline wrapper that always exits 0 with empty stdout; plotkeeper-hook writes an agy event from any terminal, and drops every event from a process with PLOTKEEPER_INTERNAL=1 (#323). plotkeeper install renders it with the path of plotkeeper-hook in the data folder's bin/ and installs it with agy plugin install, which copies the folder (install).
  • plugin-codex/: plotkeeper's entries for Codex's user-level hook file (#359). hooks.json runs plotkeeper-hook --agent codex on eight of Codex's events; plotkeeper install renders it with the data folder's bin/ and adds its groups to ~/.codex/hooks.json beside the user's own (install). core/src/codex.rs reads the lines.
  • plugin-cursor/: plotkeeper's entries for Cursor's user-level hook file (#362). hooks.json runs plotkeeper-hook --agent cursor on seven of Cursor's events that wait on no answer; plotkeeper install renders it with the data folder's bin/ and adds its entries to ~/.cursor/hooks.json beside the user's own (install). core/src/cursor.rs reads the lines.
  • plugin-copilot/: plotkeeper's plugin for Copilot, CLI and VS Code's agent (#361). hooks.json runs plotkeeper-hook --agent copilot --event <name> on seven of Copilot's camelCase events, whose payloads name no event; plotkeeper install renders it with the data folder's bin/ and installs it with copilot plugin install (install). core/src/copilot.rs reads the lines, in either casing.
  • plugin/: the Claude Code plugin, which plotkeeper install renders with the data folder's bin/ and installs with claude plugin install (install). On thirteen hook events, SubagentStart and SubagentStop among them, it runs plotkeeper-hook. On the PreToolUse of AskUserQuestion and ExitPlanMode, on every PermissionRequest, and on the PermissionDenied and PreToolUse of Bash, it also runs plotkeeper-answer, synchronously.
  • hook/: plotkeeper-hook, which appends each hook payload as one line to the event log, and the log's path; it also records each turn's and worker's trees and the worktree roots a call touched (studio_touched_roots), from the folders and paths the call names, the roots git worktree list gives and the roots it already knows; and plotkeeper-answer, the answer hook (danielrispler/Falinks#477, danielrispler/Falinks#478): while the studio watches the asking session, it waits up to 120 seconds for an answer from the card and returns it: a question's answers, a plan's approval or rejection, a permission's allow or deny. It logs that answer as a StudioAnswer line, which clears "needs you" for a plan or a permission at once. Otherwise it returns at once with no decision and the terminal asks. A Bash PermissionDenied it never waits on: the agent's own UI handles it (#572).
    • Its files and trust boundary are in hook/src/answer.rs.
  • core/: the studio core, plain Rust whose only I/O is reading the sessions' transcripts (src/transcript.rs, .jsonl files only), and scrub, which turns event log lines into test fixtures. At start the app takes the state its last start saved, studio-state.json beside the log, and replays only the log from where that state stopped, then feeds it each new line live; a pruned log, a state of another format or one that does not read means a replay from the start. It keeps the step ledger (ledger), the checks (checks: the statement parser, a run's worktree and exit code, running checks and checks sent to the background, the feed's checks, and the typical durations with the 2-minute rule: their recording, median and lookup, which lib.rs calls), each turn's files (turn_files) and the facts Ask shows (ask). The Studio type is in src/studio.rs, its methods by responsibility in src/studio/: take (one hook event), roots (worktree roots and fingerprints), replay (a log line applied or replayed), turn_files (the turns the shell diffs), tasks (what the shell found about each task and its PR) and selection (the session list, the selection and the subagent logs).
    • Only live lines request cards and notifications.
  • understanding/: the understanding layer's I/O: the writer interface (turn summaries, goals, "Design so far", Ask, names and risk notes), the claude -p writer and the other CLI writers (agy, Codex, Copilot, Cursor) in writer.rs, the API-key writers' HTTP calls (http_writer.rs: Anthropic's API and an OpenAI-compatible one) and a fake, the worktree fingerprint, the card store with the briefs, the turn summaries, Turn writing (turn_writing.rs: what a turn's end and a worker's return write, on a queue for each session), which files are logic and which are tests (logic_file.rs), Claude Code's version kept beside the event log, and weekly, the command that prints the drift: unrecognised wake-ups and version changes.
  • workbench/: workbench git (danielrispler/Falinks#328, module 7): a folder's main checkout, fetch and what removing a task's worktree would lose; the gh to run; and agy's plugin. Its run module (src/run.rs, #548) is the one process runner: git(dir) and gh(dir) build every git and gh the workspace starts, with --no-optional-locks, GIT_TERMINAL_PROMPT=0, GH_PROMPT_DISABLED=1 and no input, and a caller adds its own arguments; run_until(command, deadline) runs a command in a process group of its own and kills the group at the deadline, and its RunError tells apart a command that did not start, one that timed out and one that exited non-zero; run_logged(command, deadline, given_up) does the same for a command whose output goes to a file, gives its exit status, and also kills what it left in its group when it exits (#568). A new git or gh call uses both, with its deadline a named constant beside it: 30 s for a lookup or a read, 120 s for a fetch. Every wait on a child with a deadline goes through the runner: the launcher's check, setup and harness and the micro-world checks too (#568). A command streamed into another program (the hook's untracked-file listing, git archive into tar) is built by the runner and waited on by its caller. What only its own tests used is in archive/workbench/ (#415).
  • system-map/: studio-system-map, a library and the system-map binary that check system-map.json against the repository, say which parts a change touches and count how well the parts follow the imports (imports) (docs/studio/behaviour/map.md). Its scan module is First map's free scan (#753: the parts proposed from folders and manifests, the loose files and tests, the reference-copy candidates and the placeholder parts and ids), and cli its command line, which plotkeeper map check and map scan share. npm run check runs system-map check after the tests.
  • server/: studio-server, the state and the logic behind the page's commands, and the plotkeeper program that serves it (src/bin/plotkeeper.rs, the local page in src/web.rs, one function for each command in src/api.rs). Its modules include the read loop (read_loop.rs), the Map view's (spec #306: map.rs the payload, Daniel's positions and tiers and the guarded git fetch; fog.rs the commits since Daniel last caught up, kept per part, and what reading a brief clears; history.rs a part's history, the map at a past commit, a commit's files and a PR's; ci_laws.rs the default branch's last finished CI run, the law tests that failed in it and the words for a failed check; stop_rules.rs the usage log and the one-time review's counts) and the PR briefs' (spec #334: prs.rs which PRs are ready, pr_briefs.rs writing, keeping and rewriting the briefs, ratify.rs what Daniel accepted or overturned), settings.rs (with the API keys' stores: the Keychain on macOS, the Secret Service through secret-tool on Linux), install.rs (plotkeeper install and uninstall: the harnesses' plugins and hook files, and what it records to undo them; install), hook_copies.rs (the hook binaries' copies in the data folder's bin/, #356) and runner.rs (the background runs, spec #378: the queue and its batches, the ends told to the modules that listen, the claude command with its sandbox block and allow list, a run's lock, status and outcome, Cancel, and the logic of the launcher, the crate's second program plotkeeper-run, src/bin/plotkeeper-run.rs), back_a_law.rs (Back a law, #398–#401: the clone, plotkeeper's own proof of a run's patches in srt, the kept patches, Open draft PR, and a new law drafted from a PR's brief) micro_worlds.rs (micro-worlds, #399: the run, the host checks under the network guard micro_world_guard.mjs, the kept pages) and map_review.rs (the map text review, #642: the items a PR's map text changed, the read-only run on its head, when it starts, the verdicts kept), map_scan.rs (First map's scan screen, #753: the skeleton's lines and its Ignore, Home, Merge and Split) and map_draft.rs (the Map draft, #753: the writers' and reviewers' runs, retry, redraft and Discard, Accept's Write and Open a draft PR, and following that PR). ui/: its TypeScript page.
  • archive/: retired code, never built, tested, linted or formatted (#415; its README.md): the Tauri desktop app (src-tauri/) and the daemon that owned its terminals (terminal-daemon/, #334, #332; each folder's README.md), the spikes, real-calls.sh, and the code and tests that only their own tests used.

The tests

cargo test runs:

  • core/tests/: hook events replayed through the core: what the pane shows and the two recorded logs (replay), the session list, its states and the selection on the recorded day (sessions), needs you (needs_you), the subagent tree, workers and helpers, their status, end and fading, and the waits they raise on their session (subagents), agents' questions, who asks them and their answers (questions), notifications: their triggers, text and combining (notices), the change requests at Stop, the prompt each belongs to, the Stop a row tells about, where the shell fingerprints, and the recorded worker's requests at its commit and its end, a session's touch of a running worker's home, and a worktree root a hook lists (cards), and wake-ups, the needs you a wake-up leaves in place and the ask for Claude Code's version (wake_ups); the step ledger's rows, offsets and details, workers' included, and the roots a call's start and end touched (ledger); a turn's files from its two trees, and the checks of the project's list: what runs one, each statement of a command a run of its own, its worktree, when its exit code counts in a chain, last run, retries, ran, a running or background check and its notification, and the same checks on a log that arrives live (turn_checks), the checks the feed lists with their typical durations (check_feed), the files another session's command names by path boundaries, the homes of a turn's workers, a worker spawned in an earlier turn included, and a Codex apply_patch and a Cursor Delete keeping their file from another session's edit (turn_files); the recorded facts Ask shows for each anchor (ask_facts); and the saved state, a restored studio compared with a full replay field by field, a state of another format replayed from the start, and an older log's terminal fields ignored (saved);
  • understanding/tests/: the claude -p commands for a Goal, built but never run, the claude lookup with a stand-in shell, the writer's replies, summaries with their Headline, typed lines and grounding, its retry, and a name request saying "here" is the session's folder, not the writer's (writer); the fingerprint against real git in temporary repositories, a worktree's creation counted from a turn's or worker's own start, the root cache's prune and a removed worktree's path (fingerprint); the core, the fingerprint, git diff --stat, a fake writer and the card store joined through Turn writing, its jobs run in order on the test's thread: a turn's end writing its summary and its Goal and no card, a code-only turn with a short reply getting no summary and its row showing the reply's first line, a summary kept for opening, written once and returned before Design so far, a failed write parked again, a session deleted while its job waited, workers and prompts read when the job runs, every entry point returning against a core with no such turn, and one thread for a session's queue that ends with its last job; and a Goal written only when your prompt count changes, each case of a row's line, a worker's brief in its own worktree, a killed worker's Goal at its wake-up, a wake-up's turn, and a helper made a worker by its command, and not by others' changes before it (turn_writing); the card store, the briefs, the decision history, the live facts, its move aside and the summaries (store); the seven files the card store opens at start, each frozen in a full and a minimal-fields sample that today's code must load, with the loaded values asserted, a check's runs among them, and the risk notes' file in its own full-2 and minimal-2 samples, which also freeze its key's hash (stored_fixtures; never edit a sample, see understanding/tests/fixtures/stored/README.md); the risk note's judge: its command built and never run, the command fenced as data with the folder and never the agent's words, its own 15-second limit with the writer's others kept, a canned reply read into each of the six levels, and an unreadable reply or a timeout a failure (writer); the risk notes' store: kept across a reopen, one note for a card whose call id changed and for two cards of one command and folder, a failure not kept, asked once per run and never for an ended session or a card with no button, a corrupt file opening empty, and the judge run with the store unlocked (store); the version read from a transcript, its notice and weekly's drift lines (drift); the Brief's slots and "Design so far" with its citations (brief); the model's answers grounded on Ask's facts (ask); a turn's trees and hunks, also after git gc, and the reads of a turn's files with the core unlocked (diff_turn, found_files, turn_facts, in understanding/src/turn_trees.rs, which the shell's turn-files pass and Turn writing both call), with the oversized-turn warning and its settling (turn_trees); and the saved state with the card store (saved_state);
  • workbench/tests/: against real git in temporary repositories, fetch (fetch.rs) and what removing a task's worktree would lose, with no code path passing git's force option (tasks.rs); agy's plugin (agy_plugin.rs); and the runner (run.rs): a fake git and gh that print how they were started, a deadline that kills a command and the helper it started, RunError's three kinds, and a search of the workspace's sources that fails when a git or gh is built outside the runner (archive/, tests/ folders, test-support/ and a file's own test module aside);
  • system-map/tests/: the library's two entry points and the binary, on temporary git repositories the tests build (also the lenient parser that the Map view reads with, and the law tags' resolver that tells which test follows each @law tag): each failure of the check with a repository that causes it and one that does not, ownership (the last match winning, ignored winning, the three pattern forms) through touched, which still answers a map over a cap, law tags, each extractor on a small tree, a link's kind and reason and the pass line's counts of proven and unproven import links (edges.rs), a part's purpose and held items, their caps and messages, and a version 1 map's conversion (parts.rs), the imports' counts, hubs and the imports command (imports.rs), and the binary's exit status, output and --json; and the free scan over small fixture repositories (scan.rs: the step into the folder holding most of the code, manifests and Go main packages, loose files and tests, the reference-copy candidates and which are ticked, the cap of 15);
  • the unit tests of system-map/src/extract/: the contract cases each registered extractor runs through its fixture kit (the anchor case, a file that is not UTF-8, a missing and a malformed config, each skipped case printing its reason), and the core's rules on fake extractors (untracked and self pairs dropped, duplicates kept once with their lowest line, ignored files, declaration pairs, problem order);
  • the unit tests of the Map view's modules in server/src/, on temporary repositories and a temporary data folder: the fetch cooldown and in-flight lock, also after a panic, and a merge fetching only on its transition (map); the fog walk, its strengths, a walk overtaken by another not filed twice and "I know this" (fog); a part's history, the map at a commit and a commit's files (history); the failed log's tests read for cargo nextest and Node's runner, the law each failure holds, the last finished result kept across a restart (ci_laws); and the usage log's append after a torn line, tolerance of older and newer lines and the counts of the one-time review (stop_rules);
  • core/tests/agents.rs: a line read by the agent its hook entry names, and a line that names none read by its shape; core/tests/codex.rs, qwen.rs, cursor.rs and copilot.rs: each adapter's run, built from its hook docs (opencode.rs: real runs of OpenCode 2.4.1 and 2.4.2 through its plugin, two folders at once with a subagent's wake-up, asks before an edit and a command, a turn that wrote a file by a relative path listing it, and the context size each turn's end carries, which a subagent's end and an end without one keep; cline.rs: a real run of Cline CLI 3.0.76 through its plugin), replayed into sessions, turns and calls, its own turn ends (Codex's Interrupt, Cursor's aborted stop), a Codex and a Cursor turn from wave 1's trial (fixtures/codex/trial.jsonl, fixtures/cursor/trial.jsonl) listing the file it changed and its summary's facts carrying it, Cursor.app's empty-window sessionStart adding no row and a prompt in that window showing its session from its start (cursor.rs), an IDE-hosted session with no pid going idle, and a session ended by the process check or a StudioInterrupted line keeping its agent;
  • core/tests/interrupted.rs: a StudioInterrupted line ends its turn live and through a replay, never a later turn, and a late hook event or Stop of that turn does not reopen it; a first turn cancelled before any call is named again from the next prompt;
  • core/tests/close_rename.rs: a rename line keeps the session's name through a replay, as at a restart; a delete line hides the row through a replay, until the session starts again;
  • core/tests/blocked_commands.rs: blocked commands replayed through the core: the command's fields, block order, a subagent's block, needs you until the session moves on (the agent's next call, Daniel's next prompt, a subagent's end, not the turn's end), which blocks count as waiting, and an older log's Allow, Decline, decision and retry.
  • hook/tests/named_roots.rs: the hook binary in a scratch HOME and a temporary repository with a second worktree: the roots a Bash call names and touches, the deepest root on a path boundary, a worktree an earlier command made, a removed worktree's folder (by path or as the event's folder) touching nothing, a new folder in a listed one touching it, a known root not listed again, and a worktree made mid-turn starting from its creation commit;
  • hook/tests/harness_trees.rs: the hook binary in a scratch HOME and a temporary repository fed wave 1's trial lines of a Codex and a Cursor turn and a real OpenCode turn, each recording its worktree's start and end trees, which differ by the file it changed; OpenCode turns whose hooks run at once and out of order, their appends waiting on the log's lock together, each listing their own edit once the core replays the log; a Cursor turn writing in its second workspace root listing the file, a Cursor prompt starting every workspace root but touching only its folder's, a Cursor Shell call touching the folder its input names, a Cursor line logged in time while git hangs, and a Cursor prompt's trees given up past the budget leaving the worktree's start to the turn's next touch;
  • hook/tests/agents.rs: the agent a hook entry names stored on the line, and another harness's payload dropped by the Claude entry and recorded once by its own; hook/tests/names.rs: every name a user sees says plotkeeper; hook/tests/prune.rs: the two heavy fields left out and the ended sessions' archive, each session's lines kept together by its agent's own id, and the log's lock, events.lock (a line waiting through a swap landing in the new log, a held lock leaving the log readable and an append waiting or giving up, whole lines from threads at once, the lock file made on first use, a prune's tail copy, and no file but the log code naming the log and opening a file to write);
  • server/tests/runner.rs: the background runner with a fake harness that is a real child process, a shell script run through the real launcher: a run's result, cost, exit and record, denials in a 0 exit, a failed run's prompt, a refused run (no harness, no checks), checks and setup read for each run, one run at a time per project, a run picked up after a restart, a dead run failed live and at a start, Cancel killing the group and removing the folder and refusing a process whose start time differs, Cancel of a run that ends at that moment, the pause on a login or limit failure and Resume, the time limit, the cores, an orphaned folder, a running run a start cannot read left alone, a queued run never started beside a running one, a refusal that removes nothing but a new run's folder, a finished run's stray children stopped, standard input closed and the command's removed variables, a pause told to every project, the page's two commands, and the claude command, sandbox block and allow list as built, never run;
  • server/tests/back_a_law.rs: Back a law end to end against a temporary repository with a bare origin, a fake agent run by the real launcher, a fake srt that runs its command as it is and a recorded gh: the clone of the default branch with no remote, a well-formed run proven and kept with Daniel's repository untouched byte for byte, each rejection (no test patch, a test patch outside its scope, a plant that edits the test or breaks the build, a red run that does not name the new test, a test that fails alone, a law left on trust), Discard, the prompt's text, a missing srt copying the prompt, a proof with no home folder or with a settings file that cannot be written rejected before srt starts, Dismiss refused while the proof runs, a proof plotkeeper stopped in rejected at the next start, Open draft PR from a temporary worktree (its branch, body and ratify record), a retry after gh failed past the push, Daniel's other worktrees left alone, an out-of-date patch, and the new-law variant (the writer's draft, the confirmed sentence alone in the prompt, its proof and PR);
  • server/tests/micro_worlds.rs: micro-worlds with the real launcher, a fake harness that writes the page and the fake dsh-visual (tests/fake-dsh-visual/): a flow's topic, a checked page stored and served with its policy first, a failing page never served, rewritten once and then falling back to the prompt to copy, no run without microWorlds.dshVisual, out of date and Rebuild, Dismiss refused while the host check runs, a check plotkeeper stopped in failing with why at the next start, and a folder of its own for each project;
  • server/tests/map_review.rs: the map text review with the real launcher, a fake harness that records the real claude command and answers as a review, and a fake gh: the items a PR's map adds or changes and none it removes, a review of Daniel's own PR on the head's files with read-only tools, no Edit rule, no setup, no .git and no map text in its prompt, no start for another login's PR without the request, verdicts reused by id and hash, a new head cancelling an older head's run, and a failed answer run again on request;
  • server/tests/map_draft.rs: First map's drafting through the real launcher, a stub claude that answers canned JSON and a recorded gh, on studio-test-support's repositories: the groups landing in order and each reviewer reading its group alone, a failed group (no JSON, a reviewer that cannot start, a purpose without a verdict, one answered twice) kept apart and retried alone, Redraft this part with its flag, Discard mid-batch and a Discard refused half way, a limit pausing the queues, a restart mid-batch, Accept's Write and its refusals and replace question, Open a draft PR from a temporary worktree, muted, and pressed again after it stopped short, and the pending PR followed merged, closed or open; server/tests/map_check.rs: plotkeeper map check printing what system-map check prints, with its exit codes, and map scan;
  • server/tests/install.rs: plotkeeper install and uninstall on a temporary home with stand-in claude, agy, codex and copilot: every file byte-identical after both, Claude Code's settings file never opened, each harness's hooks naming the data folder's bin/, Codex's and Cursor's hook files edited beside the user's own hooks, ~/.zshrc with only its removed lines kept, and an uninstall that retries only its failed steps; server/tests/hook_copies.rs: the hook binaries' copies made, left when equal, replaced by rename when they differ, and kept when a binary is missing; server/tests/api_key.rs: the API keys saved, replaced and removed through a key store in memory, never reaching the page or the log; understanding/tests/http_writer.rs: the API-key writers against a local fake HTTP server, the request's shape and each error status's failure kind;
  • hook/tests/answer.rs: the answer hook's contract (Seam 4), including a blocked command's denial returned at once with no decision, a payload on stdin and the studio played by the test in a scratch HOME: an answer's allow with the questions and each label, a multi-select's joined; an approved plan's allow with its input and a rejected one's deny; a permission's allow or deny; each card answer logged as StudioAnswer, a terminal one not; for questions, plans and permissions alike, an immediate return with no decision when nobody watches, another session is watched, the studio's pid is dead or its heartbeat old; no decision at the timeout or for "Answer in the terminal"; a wrong nonce or an answer file others may write refused;
  • the unit tests of the event log's path and of the turn the shell's StudioInterrupted line ends, its own and never a later one (hook), of what scrub keeps (studio-core), of the weekly rates' dates (understanding), of the shell's risk-note log lines, which keep no reply and no command, and of a worker's view joining its session's risk notes and asks and of the cards key changing with a second card of a judged command and of the server's own lines waiting for the log's lock, then landing whole (server/src/lib.rs) and of the settings file's reads (server/src/settings.rs: the writer, briefBackfill.hours and its older name catchUp.hours, prBriefs.model, Opus unless it says another, prBriefs.effort, low unless it names another claude takes or default, and a background run's backgroundRuns, checks and setup, its project's own with no default) and of the settings' write: a comment and a trailing comma beside the edited key kept byte for byte, a value replaced, a missing parent inserted, reset removing the key, a text that does not parse or a file that changed refused and left as it was, a missing file created, the file replaced whole with nothing left beside it, and a symbolic link written through and kept. and of the PR briefs (server/src/prs.rs: which PRs are ready from the sessions' branches and the repository's open list, a failed lookup keeping what was known; pr_briefs.rs: the write once per head, stale on a new head, no lock held across a write, a failed head not retried, what waits for Daniel and what a chapter lights, and which ready PRs the start writes, at most 3, the newest head first within briefBackfill.hours; part_catch_ups.rs: which fogged part gets a part catch-up and which opens its one PR's chapter, completion clearing the part's fog and completing no brief, a stored catch-up read only for the fog list it covers, and, with a fake writer, a shown map writing at most 8 fogged Core parts' catch-ups oldest fog first and none of the others, a part that is not Core written on click, the catch-up's state carrying the stage as each call starts, a new fog entry rewriting it on the next show and an unchanged one never, and two shows in a row starting one write; ratify.rs: the decisions file read and written back whole, what has landed; fog.rs: reads and the fog a push after reading files; history.rs: a PR's files for the drawer).

Each crate's integration tests are one test binary, it: its Cargo.toml sets autotests = false, and tests/main.rs declares each tests/*.rs file as a module, so a new test file needs a mod line there. Helpers the files share live in tests/common.rs; the git helpers that hook, understanding and workbench share (an isolated git, a one-commit repository, also in a folder the test names, a bare origin) and the LauncherGuard that server's tests hold to stop the plotkeeper-run launchers a test leaves running live in the studio-test-support crate (test-support/), a dev-dependency that depends on no workspace crate. The fake writers of understanding/tests are Scripted in its common.rs. In ui/tests/, dom.mjs holds the fake document (fakeDocument) and the invoke stub (tauri), and delegate-fixtures.mjs the stand-in programs and scratch checkouts the delegate-*.test.mjs files share.

npm test (after npm ci), or npm run test:node, builds the UI with tsc, type-checks the tests against the build's dist/*.d.ts (npm run test:types, ui/tests/tsconfig.json, #554) and runs ui/tests/: the UI's pure functions on the tsc output in dist/, such as the page's frame: the list's width and focus mode (layout), the page's key mapping (keys), what "now" holds in each state, a folded turn's line, and the story's draws keeping its turns, folds, buttons, counting times, focus and open folds the same nodes, on a stand-in that is in a page (rail), the evidence line (evidence), the banner's 14 and 15 minutes (banner), hover as a state machine on an injected clock (hover), and Ask and the diff pane (ask, diff), the agent logos and the rows that show them (logos), each text the layout cuts, whole in its own element and scrolled into view in place, or, shortened or very long, whole in a hint, and no title left (full-text), a listener-path hint across redraws: the trigger patch keeps opens the hint of its current words, a hint gains no listeners per draw and goes once its trigger is dropped, and a step's detail drops the last step's hint (hint-redraw), the note toast, its fade held by the pointer or the focus on an injected clock, and the unseen chip (notes), the what's-new toast's decision after an update (whats-new), the toasts in the keyboard (focus), the PR brief's logic (map-brief: a story's and a chapter's playlist, the player that reopens where it left off, the reading gate on the last story step, the checks, the story steps without the Ratify one), the tray's rows (map-tray), the background runs' rows, Cancel and its wait for the server's answer, the pause's indicator, the prompt a failed run copies and its note kept across a redraw (map-runs), back a law's rows, the patch review, Open draft PR's line and Guard with a law's confirm step (patch-review), Explore this's offers and the micro-world's sandboxed frame and overlay (micro-world), the host check's network guard on a fake and, when PLOTKEEPER_DSH_VISUAL names it, the real verify.mjs (micro-world-guard), the rail's row of a brief waiting (rail-brief) and the accept and overturn rows (ratify), the snap page and its fixtures (snap: the stub, the rail's and the recorded terminal's), and the README's limits, links and npm rewrite (readme), and the Map view's logic: the map file, placement, drag, links and the layered Esc, and which scrub is the newest (map), live agents on the parts and the not-placed line (map-agents), broken laws and the proof drawer (map-drawer), when an element counts as seen (seen), and the stop rules' review (stop-rules); opening a thing in place leaves every other node of the rail the same object, on the tests' small DOM (dom.mjs).

The window calls the shell only through invoke (ui/dom.ts), which takes a command of the Commands map in ui/types.ts and gives its reply that command's type. The snap fixtures (scripts/snap/fixtures.ts, rail-fixtures.ts) are typed against the map, and scripts/snap/base.ts answers every command whose reply the window reads, so npm run build (tsc -p scripts/snap) fails on a reply that lacks a field, and on a command base.ts does not answer. A fixture may leave a command out: each starts from ...base.

The Rust half of that map is checked by the wire tests (#246), with no code generator: core/tests/wire.rs, understanding/tests/wire.rs and server/tests/wire.rs serialize real values of the types the shell sends (sessions replayed from the fixtures, the session list's rows, the selection, checks, a subagent's log, a session's cards with its brief and Open items, a turn's summary, Ask's facts, a hunk, a check's output, the workspaces, git state, branches, losses and plan usage, and the Map view's MapState, the UserState its commands return, #333, a project header's Mark, and the server's other replies, #374: a part's history, a commit's files, the proof, a PR brief and a part catch-up as opened, the waiting briefs, the ratify rows, the review's facts, the pre-flight's, Explore this's, Back a law's and Guard with a law's answers, the saved projects, why a session didn't touch a name, who took a blocked command's answer, and plotkeeper's version, #527) as the shell does, and write them as const literals, each typed with its mirror in ui/, into scripts/wire/<crate>.ts (scripts/wire/samples.rs). tsc -p scripts/wire then checks them: a typed object literal fails on a field its type does not have, so a field renamed or added in Rust, or a saved-only field (skip_serializing_if = "crate::saved::unsaved") that reaches the wire, fails npm run check, as does a required field the wire lacks. A field the shell sends that the window never reads is optional in ui/types.ts, so the snap fixtures may leave it out; its removal from the wire passes, its rename does not. Each crate's test writes only its own file, and the files are gitignored, so a file whose test was deleted stays behind and fails tsc against a newer ui/. npm run check deletes scripts/wire/*.ts before the tests; by hand, do the same and run the wire tests before tsc -p scripts/wire, or it checks an older run's samples. The limit: the check sees only the shapes its samples produce, so an optional field no sample fills, or an enum value none holds, is not checked. Two replies are outside the law: settings_files (server/src/settings.rs) and watch (server/src/answer.rs) are built as a bare serde_json::Value, so there is no Rust type to sample; their mirrors, SettingsFiles and Ask, are checked by nothing but the window's own use. Replies that are a string, a number, a map of strings (map_place) or nothing have no shape to drift.

npm run snap:rail -- <folder> renders the rail's states from fixtures in Chrome, which npm run check leaves out. npm run snap:all renders every fixture once, one per core at a time (SNAP_JOBS=<n> caps that, for a machine running several at once), and fails if one ends in snap:fail or an uncaught error in the page, and when Chrome itself exits non-zero it prints Chrome's exit status and the tail of its stderr first; --shard=<i>/<n> renders only every n-th fixture from the i-th (scripts/snap/shard.mjs); CI runs it as two shard jobs, beside npm run check. npm run snap:readme draws the README's three pictures into docs/studio/assets/readme/ the same way. A fixture's snapScript that needs input as a person gives it sets realPointer: true for real mouse input (await __snapClick(node), __snapDoubleClick(node), __snapDrag(node, dx, dy)) or realKeys: true for real keys: await __snapKey(key) presses one of Tab, Shift+Tab, Enter, Space, Escape, ArrowUp and ArrowDown, down and up, and resolves once Chrome has taken it (#454), or Composing Enter, an Enter that confirms an input method's word, so the page sees isComposing (#461). Both are sent as Chrome's own input through its DevTools port (scripts/snap/snap.mjs), so a real Tab moves focus and a real Esc closes an open [popover], which a synthetic KeyboardEvent does neither of; snapRealKeys is the demo. A fixture with neither runs Chrome without the DevTools port. A fixture that tests motion sets motion: "full" or "reduce", which pins prefers-reduced-motion with Chrome's --force-prefers-no-reduced-motion or --force-prefers-reduced-motion: CI's macOS runner asks for reduced motion, a desk Mac usually not (cutText, cutTextStill).

node scripts/review/outside-review.mjs [--force] [--model <id>] [--out <folder>] is the outside review (#279): Gemini, through agy, reads a risky diff before its PR is opened (AGENTS.md, "Finish with a PR"). It reads HEAD's commits since the merge-base with origin/main, and only when the diff changes a struct or enum that derives Deserialize outside a tests/ folder (judged from the whole type in the file after the change, not from the changed lines), a hunk of code that names one of the card store's files, or the turn-writing job queue (understanding/src/turn_writing.rs), or when the branch's issue has sub-issues, a spec. --force reviews any diff. The review has one round: the fixes of its findings get no second review. Any other diff prints skipped: no risk match. The review is one agy -p run with gemini-4-neon-medium, in a throwaway folder that holds a detached worktree of HEAD, the diff and the file lists. scripts/review/deny-hook.mjs denies it every tool but a read inside that folder (#283) and finish, through which agy --json-schema hands over its answer, and PLOTKEEPER_INTERNAL=1 keeps Studio from recording it. Afterwards the script checks that the throwaway tree is clean, says so if it is not, and removes it; killed mid-review, it ends agy and removes the tree first. It prints reviewed: <n> findings, then the findings' JSON file (in --out, else the system's temp folder), the minutes, the tokens and the Gemini quota left before and after. Whatever stops it (no agy, the 15-minute cut, a used-up quota) prints review unavailable: <reason> and exits 0; only a wrong option exits 2, before any review. Every run, whatever its verdict, also appends one line to local-evidence/outside-review/runs.jsonl in the main checkout (the time, branch, head, base, verdict, why it ran, model, round, findings, tokens, seconds and the quota before and after), and a reviewed run's findings file is kept beside it (#302); it records only where git ignores local-evidence/, and a record that cannot be written changes nothing else. ui/tests/outside-review.test.mjs tests the decision, the options, the agy call, the verdicts and the hook, and runs the script in a scratch repository with a stand-in agy; the real agy run was checked by hand (local-evidence/2026-11-22-outside-review/).

A review trial (#502) compared this review with gemini-4-neon-high and with medium splitting its reading among subagents, on the same diffs. High spent about twice medium's tokens for one more finding; subagents spent about four times medium's quota for 193k tokens against medium's 141k, and found more only on one big diff. Medium alone stayed, and the trial, its skill and the --subagents option were removed.

npm run lint runs Biome over the TS, JS, HTML and CSS, lint only (biome lint --error-on-warnings ., biome.json), and fails on a warning as on an error: it never formats or rewrites a file, and it leaves out what git ignores, archive/ and docs/studio/mockups/. It turns off five rules the page breaks on purpose (noImportantStyles, noDescendingSpecificity, useTemplate, noConfusingVoidType, useIterableCallbackReturn), and turns on, beyond the recommended set, non-null assertions, the comma operator, assignments in expressions, optional chains, floating and misused promises, an async with no await, throwing a non-Error, long functions, import cycles (noImportCycles) and exhaustive switches (#554). An existing site a rule allows carries a biome-ignore comment with its reason. tsconfig.json adds noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitOverride and noUnusedParameters to strict.

npm run check takes a check slot (below), then runs npm run check:steps, which runs them all in order: cargo fmt --all --check, cargo machete (unused Rust dependencies), npm run lint, npm run build, knip --no-progress (unused exports and files, knip.jsonc), cargo clippy --locked --workspace --all-targets -- -D warnings, rm -f scripts/wire/*.ts, cargo nextest run --locked --workspace (the shell included), the map check (cargo run --locked -q -p studio-system-map -- check), tsc -p scripts/wire on the samples the wire tests just wrote, among them each command's argument names as server/src/api.rs reads them (server-args.ts, checked against Commands in ui/types.ts, #554), and npm run test:node, which builds again and type-checks the tests before it runs them. nextest runs the same tests as cargo test, but runs every test in a process of its own, all binaries' at once; install it with brew install cargo-nextest on macOS (on Linux, cargo install --locked cargo-nextest), and cargo machete with cargo install --locked cargo-machete. Clippy's lints are the [workspace.lints] table of the root Cargo.toml, which every crate takes; an allow names its lint and says its reason. CI runs npm ci and npm run check in two jobs in .github/workflows/studio.yml, macos and ubuntu (#699: the same steps on ubuntu-latest, not required until the suite passes there, spec #510; research in cross-platform), and npm run build and npm run snap:all -- --shard=<i>/2 in two shard jobs in .github/workflows/snap.yml (#432), on macOS (the snap jobs stay there). Both run for each push to main and for each pull request that is not a draft: a draft runs nothing until it is marked ready, then each push to it runs. A change to Markdown files alone, or to archive/ alone, runs no check job; snap runs only when ui/, scripts/snap/, package.json, package-lock.json, tsconfig.json or snap.yml changes, as it reads nothing else (the server is stubbed). The engine's checks.yml and ci-checks skip the studio.

At most two npm run check run on a machine at once, across every worktree and clone (#783, spec #778): four at once kept a 10-core Mac at load 15-35, half of it in the kernel. scripts/check/slot.mjs takes one of two slots, files 1 and 2 in check-slots/ beside the runs folder (~/Library/Caches/plotkeeper/check-slots/ on macOS; on Linux $XDG_CACHE_HOME/plotkeeper/check-slots/ when it holds an absolute path, else ~/.cache/plotkeeper/check-slots/), each holding its check's pid, worktree and start time; cat one to see who holds it. It then runs npm run check:steps in a process group of its own and passes on its output, its exit code and a stop (a Ctrl+C, a SIGTERM or a closed terminal's SIGHUP), and gives the slot back when it ends. A third check prints check: waiting for a check slot, held by <worktree> (<age>) and <worktree> (<age>) once and starts when a slot frees, polling once a second; stopped while it waits, it exits without running anything. A slot whose pid is gone, or which its holder has not touched for 60 s (a holder touches its slot every 10 s), is taken back, so a killed check never blocks the rest. A check whose slot folder can't be made or written, as in a sandboxed background run, runs without a slot and says so in one line. The wait counts against a foreground command's timeout, such as Claude Code's 10-minute Bash limit: with both slots busy, run the check as a background task. On macOS, when the first git on PATH is /usr/bin/git, a stub that runs xcrun on every call, the wrapper puts the folder of the git it forwards to (xcrun -f git) right before /usr/bin on the steps' PATH, so the folders before it keep their place. The tests make about 18,000 git calls, 78% of the test run's CPU, and the stub more than doubles a short call's cost (#803). Any other first git, such as Homebrew's or a test's fake, stays first. npm run check:steps runs the same steps without a slot or that PATH. ui/tests/check-slot.test.mjs drives the wrapper with its folder and limits set through CHECK_SLOT_DIR and the CHECK_SLOT_*_MS variables, which are for the tests, not a setting.

The npm package

npm i -g plotkeeper, or npx plotkeeper, installs plotkeeper on a Mac or on Linux on x64 or arm64 with no Rust (#368, #706). It is four npm packages, the pattern of Codex, esbuild and ccusage (research/install-one-command.md, section 1):

  • plotkeeper, the launcher package, npm/: its package.json, launcher.js (the plotkeeper command npm links onto the PATH) and, once built, README.md (generated from root README.md by scripts/npm/prepare-readme.mjs with relative links and images rewritten to absolute GitHub URLs) and LICENSE. Its optionalDependencies are the three platform packages at its own version, which release.mjs bump keeps in step. launcher.js runs the plotkeeper of the platform package npm installed for this machine, passing the arguments, the standard streams, the exit code and SIGINT, SIGTERM and SIGHUP through, and ends by the same signal when plotkeeper is killed by one (ui/tests/launcher.test.mjs). A missing platform package, as under --omit=optional, fails naming the platform and the package.
  • plotkeeper-darwin, plotkeeper-linux-x64 and plotkeeper-linux-arm64, the platform packages, each marked with the os and cpu npm installs it on, so npm installs only the matching one. Each holds a bin/ with plotkeeper, plotkeeper-hook, plotkeeper-answer and plotkeeper-run (the launcher of a background run) side by side, the page embedded in plotkeeper: universal binaries (Apple silicon and Intel) for macOS, static musl builds (x86_64-unknown-linux-musl, aarch64-unknown-linux-musl) for Linux, so they need no particular glibc. Their package.json and README.md are written at pack time from the launcher's (release.mjs platform). Each start copies the hook binaries beside plotkeeper into the data folder's bin/ (#356), which the hooks call, so a switch of Node version leaves them recording.

npm run pack:npm -- <folder> (scripts/npm/pack.sh) builds the page and this machine's platform package in target/npm/, prepares npm/README.md and npm/LICENSE, and packs the launcher's tarball and the platform package's into the folder. On macOS it builds both architectures, which needs rustup target add aarch64-apple-darwin x86_64-apple-darwin, and fails when the arm64 slice of a binary is not validly signed (codesign -v -a arm64): Apple silicon refuses an unsigned binary, and the linker's ad-hoc signature, which lipo keeps, is enough. The x86_64 slice is unsigned by design, since the linker does not sign x86_64 output and macOS does not require it, so it is not checked. On Linux it builds this architecture's musl target, which needs that rustup target and musl-gcc (musl-tools) for ring's C code. npm run smoke:npm -- <folder> (scripts/npm/smoke.sh) installs the two tarballs with npx and npm i -g into a throwaway home and npm prefix with no Rust on the PATH, the platform package beside the launcher since the registry has no unreleased version of it, and checks the bundled README.md and LICENSE, plotkeeper --version through the launcher, the four binaries (on Linux, static and of this architecture), plotkeeper install with a stand-in claude, a start that serves the page and stops on Ctrl+C, and a hook that still records once the packages are removed.

.github/workflows/release.yml runs both on every run, each platform on its own runner: it packs the darwin package on macos-latest and smokes it there and on macos-26-intel, and packs and smokes the Linux ones on ubuntu-latest and ubuntu-24.04-arm, with musl-tools installed. Each pack job uploads the launcher's tarball and its platform's as the artifact npm-<platform>. It runs on each push to main, by hand, and for a pull request that is not a draft and touches what the package is built from: Cargo.lock, a Cargo.toml, rust-toolchain.toml, package.json or its lock, npm/, scripts/npm/, a plugin*/ folder, README.md, LICENSE, or the workflow itself. A pull request's other changes, an Intel-only build break among them, show in it only after the merge to main. A run by hand without "publish", from any branch, is a dry run: gh workflow run release.yml --ref <branch> packs and smokes all four and publishes nothing.

Cutting a release

A release is a Release PR that Daniel approves by merging, then a publish he starts (spec #512, #509's resolution). The versions and notes are never edited by hand.

  1. /release. Daniel types it. The skill (.claude/skills/release/, mirrored in .agents/skills/release/) reads the commits and PRs merged since the newest v* tag, recommends patch or minor (minor for a new user-visible feature or a breaking change, patch for fixes and polish, never major or 1.0.0) and drafts user-facing notes in chat; with nothing user-facing since the tag it says "nothing to release" and stops. On Daniel's agreement it runs node scripts/npm/release.mjs bump <patch|minor>, which writes the version into npm/package.json (its own and the three platform packages' it asks for), server/Cargo.toml and studio-server's entry in Cargo.lock and nothing else (plotkeeper --version prints the crate's; server/tests/plotkeeper_bin.rs fails when they differ), prepends the version's section to CHANGELOG.md, and opens Release vX.Y.Z. Its body holds the notes and lists README sentences the release made wrong, or says none; the README itself is left to Daniel.
  2. The Release PR's CI runs npm run check, whose node test fails when CHANGELOG.md has no section for the package's version, and this workflow's pack and smoke jobs, since the PR touches npm/ and a Cargo.toml. Merging it, through /ship when Daniel asks, is the approval.
  3. The publish. Daniel alone starts it, from main with "publish" ticked: gh workflow run release.yml --ref main -f publish=true, or "npm package" in the Actions tab. The release commit guard (release.mjs guard) first fails the run unless HEAD is the commit that changed npm/package.json's version, so a PR merged after the Release PR cannot ship under its notes; then run /release again. The workflow packs and smokes the four packages as above. The publish job upgrades npm to 11.5.1 or later (Node 22's npm is 10, too old for trusted publishing) and publishes the tarballs its own smoke jobs tested, with provenance: the three platform packages first, then the launcher, so the launcher is never on npm before a package it asks for, and it skips a package npm already has at this version, so a publish that failed partway is finished by "Re-run failed jobs". It holds no token: npm trusted publishing authenticates it through the job's id-token: write. Without "publish", or from another branch, the workflow only builds and tests.
  4. The release job, after npm accepts the version, tags vX.Y.Z at the run's commit and creates the GitHub Release from the version's CHANGELOG.md section (release.mjs tag). It is idempotent: a tag already at that commit is kept, one at another commit fails, and an existing Release is left as it is. When it fails, retry it with "Re-run failed jobs" (gh run rerun <id> --failed), which reruns only it.

Background: the first publish was by hand. npm trusted publishing cannot create a new package, so Daniel published 0.1.0 from his own login with 2FA, from the npm-package artifact a run's smoke jobs had tested (npm publish <tarball> --access public), then added the trusted publisher on npmjs.com: GitHub Actions, repository danielrispler/plotkeeper, workflow release.yml. 0.1.1 and 0.1.2 were published by the workflow before tags existed; #516 made their tags by hand with the tag subcommand, v0.1.1 at f3a84bf6c and v0.1.2 at e118acf0c, with their Releases. The three platform packages need the same first step (#706): Daniel publishes a placeholder 0.0.0 of each from his login with a handed-over script, which checks npm whoami and stops on a name already taken, then adds the same trusted publisher to each on npmjs.com, before the first release that asks for them.

The live run

The tests above run on events written by hand. core/tests/run-unisolated-worker.sh proves that Claude Code's real events have the shape they assume (#214): a scripted session in a temporary repository, with this checkout's plugin, spawns a background subagent that is not isolated, which makes a worktree with git worktree add, writes a 42-line file in it through Bash from the session's folder and commits. The script passes when the subagent's events carry the worktree in studio_touched_roots with a start and an end tree whose diff holds the file; it prints pass or fail with the line that decided it.

It adds one throwaway session to your list, copies nothing into the repository and removes its temporary repository and worktree. It runs a nested claude on your subscription, so run it yourself, outside auto mode:

core/tests/run-unisolated-worker.sh | tee run.txt

Recorded logs

Three fixtures in core/tests/fixtures/ are real event logs, scrubbed by scrub (core/src/bin/scrub.rs). Each event keeps its shape and loses its content: text becomes …, and lists and objects become empty, except for what stays. What stays: ids, event names, cwd, the permission mode, a session's start source and end reason, agent ids and types, the description of a spawn or a Bash command, isolation, the paths of the files a tool reads or writes, skill names, the types and statuses in tool results, background tasks without their commands, exit codes, numbers, flags and timings.

An MCP tool keeps no text. Transcript and output paths become …. A prompt keeps only the markup Claude Code adds, with its ids and statuses, so a wake-up stays one; any other tag becomes <…>. A last message that asks Daniel something becomes …?.

  • checkpoint-day.jsonl: the events of 2026-10-30, the checkpoint day of danielrispler/Falinks#347. Some of its sessions were still open at midnight.

  • subagent-run.jsonl: a scripted session in a temporary repository that spawns a worktree worker and a read-only helper in the background, then stops the helper.

  • blocked-run.jsonl: an interactive session in auto mode, in a temporary repository, whose foreground and background nested claude -p are blocked, allowed by a fake studio, retried and run, with the background one's wake-up. A command stays only when it carries the marker studio-fixture-; a wake-up's summary keeps its status and exit code and loses its quoted description. core/tests/blocked_commands.rs replays it. It was recorded before the blocked-command card and its Allow went (#572), so it is not re-recorded: it keeps the core's reading of older logs.

Re-record the second when Claude Code's version changes. The script runs a nested claude on your subscription, so run it yourself, outside auto mode:

core/tests/record-subagent-run.sh

Quit the studio app first: it would take the session as live and ask for cards. The script builds plotkeeper-hook, runs the session with this checkout's plugin, and scrubs the session's events from the event log into the fixture. Before you commit the new fixture, run cargo test and check that each text it keeps is a label, an id or a path.

The app tells you when the version changed. At a session's first Stop, it reads Claude Code's version from the session's transcript, the .jsonl file at the event's transcript_path, and opens no other file. It keeps each new version, with when it was first seen, in claude-versions.txt beside the event log. A version that differs from the last one kept shows a one-line notice at the top of the pane, a line in the Studio log, and a line in weekly. The first version kept has nothing to compare with, so it shows nothing.