SLOPSHOPPER

track-performance-probe

Disposable native probe for the Track reliability performance acceptance gate

panecommandtoasttimer
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · track-performance-probe
› fix the failing auth test and add an audit log call ⏺ Read(src/auth.ts) ⎿ Read 6 lines ⏺ Update(src/auth.ts) ⎿ Added 2 lines, removed 1 line ⏺ Bash(bun test) ⎿ 3 pass, 1 fail ● Done. refresh now rejects expired claims and logs an audit event. ✻ Worked for 42s · done 4:20 PM › /trackbench ⎿ track-performance-probe: An absolute output path is required. ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts
README

claude-mods

Personal customizations for Claude Code: function-hook plugins ("mods") and the status line.

Get them with git clone https://github.com/ohade/claude-mods.git; each section says how to load its mod.

Landing a change

Use scripts/land.sh <commit-ish> as the only route for putting a change on main. It resolves one commit, tests every top-level mod with a tests/ directory in a temporary detached worktree, and requires successful exit codes and nonzero passing test counts. It then fast-forwards main, updates the detached live worktree, atomically writes a local deployment receipt, and pushes the tested SHA to origin/main last. A concurrent local main change can never substitute an untested commit in the push. No rebase, reset, rollback, force push or automatic retry.

The default layout is ~/git/claude-mods, ~/git/worktrees/claude-mods/live and ~/.claude/state/claude-mods-live.json. Keep the mod-loading symlinks pointed at the live worktree; the script does not install or change them. CLAUDE_MODS_HOME replaces the home prefix for an alternate layout or isolated tests; unset means the current user's home.

The gate also runs each mod's Python tests/helpers/test_*.py suite, Bun tests/helpers/check_*.ts checks, and any declared npm typecheck script. It runs the landing script's shell and Python self-tests once from the tested tree. Python suites need a nonzero test count and an OK footer. Packages need a committed lockfile: npm ci --ignore-scripts --include=dev --no-audit --no-fund installs their development dependencies only in the temporary worktree. Registry access or a populated local cache is required; an offline dependency failure refuses landing before publication. Have Python 3, Bun, Node/npm and ~/.Trash available; keep the real HOME, since OS helpers use it to find the installed checkout. CLAUDE_MODS_HOME changes only the deployment layout.

TypeScript mods also need the engine-written SDK input. Test/validate do not generate it. The input is a mod-layout root containing <mod>/.claude-plugin/types/. By default the gate reads the promoted root for the pinned version, <layout root>/.local/share/claude-mods/sdk/<version>, where the layout root is CLAUDE_MODS_HOME or your home directory and <version> is version in scripts/sdk-types.json. A non-empty CLAUDE_MODS_SDK_ROOT is the only input instead, with no fallback. The live checkout is never read unless you name it there. The engine version must match the manifest, every SDK file must match its reviewed digest, and the API declaration header must name that version. Only then are the checked bytes copied into the temporary test tree. Missing, stale or changed inputs refuse landing.

On an engine update, load the reviewed mod once in the matching Claude Code version, keep the engine-written folder outside the landing tree, and review the API changes and new manifest hashes together. Then promote that capture. Promotion checks every file against the manifest, holds the land lock, and never replaces an existing root. Do not edit the generated declarations or replace them with stubs.

python3 scripts/land-state.py sdk-promote /absolute/path/to/engine-written-mod-layout scripts/sdk-types.json "$HOME"
CLAUDE_MODS_SDK_ROOT=/absolute/path/to/engine-written-mod-layout scripts/land.sh <reviewed-commit>
scripts/land.sh <reviewed-commit>
scripts/land.sh --status

Both worktrees must be clean, the canonical checkout on main, and live detached in the same repository. A directory lock serializes landings. Only a lock older than 30 minutes whose same-host owner PID is provably dead can be reclaimed. An alive, reused or unknown PID stays locked; inspect the printed lock and owner before manually clearing it.

Test/preflight failures leave main, live and the receipt untouched. Publication cannot be atomic across Git worktrees and a remote: a checkout failure can leave main advanced, and a receipt failure can leave both checkouts advanced. Errors print the exact phase and all three SHAs. Rerun the same commit after resolving the cause: it is tested again, already-completed merge and checkout steps are skipped, and the receipt and push are retried. A push failure retains the local deployment and its receipt; the remote may be behind (or have accepted a push before the connection failed). Repeating a non-forced push is safe. Existing successful receipts keep their original previous_commit when that same deployment is retried.

Each mod has a private log under ~/.claude/state/claude-mods-land-logs.*. Tests time out after 10 minutes per native suite or helper command; push after 2 minutes. Interrupted children are stopped before the temporary worktree is removed. Receipts record commit, previous_commit, UTC deployed_at, per-mod native pass/fail counts and log_dir. Additional checks have separate logs in that directory. For TypeScript mods, sdk records the engine version and SHA-256 of the reviewed SDK manifest. An unfamiliar test footer fails closed. Keep failure logs for diagnosis; they are not committed. No arguments/invalid usage exit 2, help/status exit 0 on success, runtime failures exit 1, and Ctrl-C exits 130.

Track checks main, live, receipt agreement and ancestry after startup. A verified main-ahead state shows one status line with the landing command. Missing/invalid state, unrelated histories and Git errors stay silent. It makes no model call and does not await Git during session start. This is a startup snapshot; it does not poll or claim that running sessions loaded the new code.

Run bash scripts/tests/land.test.sh for local Git fixtures with fake Claude, and claude plugin test track for the drift integration fixture and the whole Track suite. Real landing and hot-reload acceptance are separate checks. land.sh is an explicit landing command, not a watcher: running a test command alone does not deploy anything.

image-thumbs

Shows each image you paste into a prompt as a small framed thumbnail under your message.

  • Click the picture to expand it in place, at full resolution, up to 24 rows tall. Click again to shrink it.
  • open in pane under the frame opens the image in a pane. The pane docks beside the transcript in the fullscreen layout when the terminal is at least 110 columns wide; otherwise it opens above the prompt.
  • /image [n] opens image #n, or the latest one, in the same pane.
  • A slash command's pictures (/recall … [Image #1]) show once, above the first row of Claude's reply (a tool call or text), and stay. Claude Code draws the command's own row with no render hook, so they cannot sit under it.

Requirements: macOS (the mod uses sips and base64), Claude Code 2.1.289 or later with function-hook plugins, and a terminal that draws images with the kitty graphics protocol (Ghostty, kitty). Elsewhere the thumbnail shows its [Image #n] label instead.

Limits: thumbnails appear after you submit the prompt, not while you type. Images in a resumed session get no thumbnail. The decoded originals live in a private folder under $TMPDIR and are deleted when the session ends.

Load it in every session with one of:

ln -s ../../git/claude-mods/image-thumbs ~/.claude/skills/image-thumbs   # skills folder
claude --plugin-dir ~/git/claude-mods/image-thumbs                     # one session

or list the folder in CLAUDE_CODE_PLUGIN_DIRS in the env block of ~/.claude/settings.json.

Check it with claude plugin validate image-thumbs, and type-check it with tsc -p image-thumbs once Claude Code has loaded it (loading writes the API types into .claude-plugin/types/).

track

A pane beside the transcript, titled Session Tracker, that keeps substantive questions, their answers, and meaningful work. Claude decides what to register from any sender, including later content in a running turn. Doorbells and informational notifications alone need no row. Track has no transport-specific workflow.

  • Questions. The model sends each question to the pane with track_question and closes it with a completed answer block or mark_answered (answered or deferred); a standing rule in the system prompt asks it to. A question with a verified user source links to that source. Otherwise its tracking call is the visible source. For a normal answer, Claude writes its formatted Markdown once between standalone <!-- A15:start --> and <!-- A15:end --> lines, replacing 15 with the stable numeric id returned by track_question. Track captures the completed main-model response, hides the markers and shows the answer once. Its dim acknowledgement sits outside the answer. Each [ A ] highlights only its own block, leaving other answers and status footers unlit. Incomplete, empty, nested, duplicate or mismatched markers never complete a question; code examples, block quotes, peer hand-backs and subagent responses cannot supply an answer. Unknown and withdrawn ids remain unchanged. For tool/file-only answers, Claude supplies the completed answer_text, or explicitly identifies the latest verified native response with answer_request_id. A bare answered status is refused without changing the ledger; latest progress text cannot supply an answer. The update draws one dim ✓ Q<n>. answered line. If the explicit text has no verified native source, a separate answer row displays the saved words at that call. This can add answer tokens; the call's displayed answer may be the answer's first visible delivery. An answered question turns green. The instruction explicitly includes short follow-up questions before answering; a row still requires Claude to register it.
  • Jump. The fixed [ Q ] and [ A ] columns scroll to the verified source and answer. The row you land on lights up and fades out over about two seconds: your prompt or the actual answer text alone. The acknowledgement is a separate row. [ A ] stays faded until captured answer text exists; an acknowledgement or an older answer with no saved text does not make it ready. Question and step labels use Q1. and S1.. The digits 1–9 press the jumps while the pane has focus (ctrl+x tab). Groups containing an uncleared question's tracking source or displayed restore stay unfolded; unrelated groups retain their native collapsed state. This exposes the ToolUse child that owns the target and changes how those groups appear in the transcript. Composer rows always have an owned wrapper. Transcript jumps use requestId; { key } resolves only plugin panes and AbovePrompt, so it cannot reveal a transcript answer Box. Call-sourced answers use their stable ToolUse call ID. Assistant answers use the exact host render instance observed on this load. The bounded presentation cache is lost on reload; an unseen assistant or restore host refuses visibly, without falling back to an acknowledgement or a guessed key. Shading still selects only the answer text. Native jumps after reload remain an acceptance gate, including oldest and middle rows away from the viewport.
  • Layout. The title stays at the top and the banner at the bottom. Questions and Steps are fixed regions, about a third and two thirds; each scrolls on its own under the wheel, and its header counts the rows hidden above and below (↑2 ↓5). Empty sections say only "None yet." Below 40 body columns, counts use 12/39, questions place their Q/A controls below the text, and step clocks use a separate line. Short controls and hints fit a 17-column body. The banner keeps the state on one line and omits background counts when space is tight. Claude Code owns the draggable transcript/dock divider. Its 2.1.293 plugin API exposes no hover mouse-cursor control for that divider; Track cannot set a horizontal resize cursor there. For plugin authors: native JSX Fragment is a column Box. Horizontal row children must stay flat; wrapping them in a fragment stacks their labels and clips the measured region.
  • Banner. Full-width colored rows at the bottom say where the session stands: Working, Waiting on agents (an Agent call or background agents), Waiting on tasks (background shell tasks), Waiting on you (a question dialog or an explicit waiting step), Paused, Activity unknown, Unsaved, or Idle. Use waiting only when the user must act; peer waits use paused or pending with an optional note. mark_step({ delegated: true }) identifies work owned by agents, including agents launched through other tools. It shows the brown hourglass and agents banner. Use delegated: false when the main session resumes that step. This is explicit ownership, not a peer-liveness probe. Completed steps clear it. Concurrent main work stays grey on its own row. Explicit ownership leaves agent counts unknown; only native-only activity supplies a count. User waiting does not hide concurrent work: unsaved, agents, main work, and waiting on you are separate rows, top to bottom, and only the amber glyph pulses. A short pane collapses to the highest-priority row and a count. Paused, pending and user-waiting rows retain ownership metadata but do not count as active delegated work or show a running hourglass. An open question dialog alone does not imply that the main session is working. Actual native background activity still shows and pulses.
  • Steps. Filled from the model's own TaskCreate, TaskUpdate, TodoWrite and explicit track_steps calls. Successful plan approval adds one reminder to reuse open steps and register missing work. It leaves the entire register unchanged. A Task named like a plan step links to it. The step in progress shows who is on it: a spinner breathing in grey while the main session works, an amber hourglass while it waits on agents, a still blue ◆ while it waits on you. A duration runs only for an in-progress step with a known start and no end. Pending, paused and waiting rows hide their clocks and reserve no clock space, even if an earlier start is retained. Completed rows show a fixed duration only when both times are known. These are wall-clock durations from the first start; resuming does not subtract parked intervals. Below a minute they show <1m; below an hour they show whole minutes such as 4m or 11m, without seconds or padding. At an hour or above they retain 1h 05m. An interrupted main turn pauses only its own in-progress, non-delegated steps with an interrupted note. It preserves other turns, cleared rows and delegated work. Turn ownership survives reload in the same session; restoration into another session drops it while retaining the status and note. A late completion cannot stop a newer main turn's working banner.
  • Rings. ◑ 4 of 8 · 50% per section, counted over visible rows. Clear completed hides finished rows in its own section and removes them from that section's count. Questions has a: clear completed for answered questions; it keeps open and deferred questions and every step. Steps' c: clear completed, in both the header and bottom bar, keeps every question. Narrow panes shorten the labels to a: done and c: done. Each explicit action saves the ledger; rendering does not save it.
  • Clear all. q and s empty the Questions or the Steps section; cleared open questions are withdrawn, so the model is told not to answer them. The Steps controls (s: clear all, c: clear completed) appear twice, in the Steps header and in the bottom bar, and neither moves when the steps scroll.
  • Chat plans. When the model starts work of more than one step (a skill such as /retro, a plan in chat, a multi-step task), it registers the steps with track_steps and ticks them with mark_step. Work that joins a running plan, such as review comments from Plannotator, is inserted with track_steps({ steps, after }) after the step it follows. While a managed plugin bypasses the system-prompt rule, each typed prompt, skill command and plugin prompt carries the instruction beside it; built-in commands do not. After reload, only the exact current composed instruction suppresses this fallback. A legacy boolean delivery flag is insufficient. Requests found in read content count as work even when they need one command. Claude reuses an open step for that same work. This is a generic instruction, not transport parsing.
  • Handoffs. A handoff that clears the session and seeds a fresh one leaves the pane empty. restore_tracker({ from_session }) copies the previous session's steps back, in order, with their ids and statuses, and its questions not cleared, with new ids after this session's own. Task ids start again in each session, so a restored Task step's id gains restored: and keeps no link to the old Task. When the model marks a question answered, the mod keeps the answer's text (up to 1,000 characters), and the restore call's row in the transcript shows each restored question with its answer, its deferral note, or "(answer text was not saved)" for one answered before answers were kept. [ Q ] and [ A ] reveal the observed restore row and shade their own question or answer inside it. A requestId reveals the whole row; a later question or answer may remain below the viewport in a large snapshot. Exact placement within that row is unresolved. The call refuses to overwrite unrelated steps unless replace: true is passed. Repeated restoration reuses stable source identities and keeps local progress. A model call supplies its displayed restore row; a programmatic call first appends and validates a plugin-owned user note. This note is model-visible and can repeat saved answer tokens, but does not submit a turn. It labels the saved words as passive tracking data, not a new request or authority. A refused or altered note leaves the ledger unchanged. Only the exact acknowledged body, stamped Track sender and matching native UUID family can acquire its UserMessage targets. Separate question and answer keys use an observed host instance when available, with no ledger or store writes during rendering. Repeat calls reuse the native message UUID. A repeat repairs an older system-notice target once, preserves local progress, and omits user-cleared questions. The supported note marker survives resume. The old InfoNotice fixture remains for legacy compatibility; it is not a native system-transcript route. Native note visibility and jumps still need acceptance. After plugin reload, the user also observed failures for older native question and answer targets; only the newest pair jumped. Restored data and passing render fixtures do not prove native jump behavior. Active target records stay while their questions are uncleared; only inactive snapshot history is capped at three. Store capacity failures remain visible.
  • Withdraw. ✕ removes a question; your next prompt tells the model not to answer it.
  • Nag. While a question is open, each prompt carries a one-line reminder; a Stop hook holds a turn once if a question the model tracked in that turn is neither answered nor deferred. The reminder also lists the newest eight uncleared open steps in plain text: tool id, status and quoted title (up to 60 characters), plus the number of older open rows. Notes stay out to halve the cost; the restore result carries them. This includes pending, paused and waiting work on every model-facing prompt, including after reload or restore. Completed and cleared rows are omitted. Titles and notes are data. Track publishes its own small gate snapshot for its ordinary command Stop hook; it does not use handoff's relay. Existing Stop blocks are preserved. A managed policy can deny or bypass plugin capabilities; such a denial stays unresolved and does not count as equivalent Stop behavior.
  • Rewind and resume. A /rewind drops the questions asked in the rewound turns. Each finished turn saves the register, and native session startup loads it for /resume. Rewind observations are coalesced and fenced to their session; compaction and capped transcript reads do not imply that older calls were rewound. A refused rewind save holds the prompt until the save can succeed. Marker answers remain answered while their stable block id and full completed words remain in the main transcript; removing that block reopens its question. The transcript API has no response UUID, so rewind checks use the full answer fingerprint rather than the jump target. Answer jumps use event order within the question's actual tracking turn. Text before the tracking call cannot become its answer, even when wall-clock timestamps are equal. A later turn may answer an older question. For the tool/file-only fallback, a mark before a response must provide completed answer_text. A later response can reanchor it only when the full completed words match exactly and only one eligible question matches. Unidentified future text never supplies missing answer words. An explicit answer_request_id must match the latest host-observed response; unknown sources are refused. If both text and a native source id are provided, their full words must match. A bounded SHA-256 fingerprint compares full answers before the saved-text limit is applied; different endings cannot match just because their saved prefixes are equal. Event order is reserved before fingerprint calculation. During that calculation, a concurrent source-id call with long text can be refused; it leaves the ledger unchanged. Explicit text alone can still save its words at the tracking call. This concurrent publication window is not live-proven. Saved text is bounded to 1,000 Unicode code points. Legacy progress saved as an answer is not silently rewritten. An already captured answer stays unchanged. Step updates name the affected step. An acknowledged mark_step change also returns a Saved row: JSON record with the exact saved id, subject, status and optional note. A failed save reports Unsaved and returns no saved-row claim. Step blocker notes stay complete through save, interruption and restore; display limits never shorten their stored values.

It opens by itself by the built-in diff panel's rule, less the git condition: in the fullscreen layout, at least 144 columns wide, and never after you closed it by hand (ctrl+x x). A reload of the mod leaves an open pane open. /track shows or hides it at any width, and like /btw it acts at once while a turn runs and adds nothing to the session; /track status prints the open questions. To keep the diff panel out of the slot, type /diff once.

/track classifier reports the optional question classifier's setting. /track classifier on and /track classifier off change it. Changes share the ledger write queue, session lease and store lock. If ownership, locking or the verified write fails, the command reports that the setting was not saved; later attempts can retry. Reading the setting does not acquire a writer lock.

Requirements: Claude Code with function-hook plugins, macOS/POSIX file locks, and Python 3. The first compatibility target is the generated 2.1.292 API. Engine and fresh-process checks use 2.1.293. A 2.1.292 runtime run and a seated managed-policy Stop run are not available on this Mac.

Load it from the clone folder (cd claude-mods), wherever it sits, with one of:

mkdir -p ~/.claude/skills && ln -s "$PWD/track" ~/.claude/skills/track   # every session
claude --plugin-dir "$PWD/track"                                         # one session

or list the clone's track folder in CLAUDE_CODE_PLUGIN_DIRS in the env block of ~/.claude/settings.json.

Check it with claude plugin validate track and test it with claude plugin test track. Once Claude Code has loaded it

Source 1 files
hooks/register.ts 69 lines
1// Release gate: 500 comparable native mutations/renders for Track reliability.
2// Load only in a fresh disposable session. No model calls and no private store access.
3import type { Register } from 'claude-code'
4
5let running = false
6let renders: Array<{ ms: number; columns: number; rows: number; body_columns: number; body_rows: number; placement: string }> = []
7export const register: Register = on => {
8  // Load this probe before Track in the same user tier so its observer wraps
9  // Track's render response. It records only memory and elapsed time here.
10  on('ui.render', { component: 'Pane', requestId: 'track' }, async (_, e, next) => {
11    const before = Date.now()
12    const result = await next(e)
13    if (running && renders.length < 2500) renders.push({ ms: Date.now() - before, columns: e.viewport!.columns, rows: e.viewport!.rows, body_columns: e.props.bodyColumns, body_rows: e.props.scroll.bodyRows, placement: e.props.placement })
14    return result
15  })
16  on('session.start', async ($, e, next) => {
17    await $.command.register({ name: 'trackbench', description: 'Run 500 native Track updates and write a private receipt', argumentHint: '<absolute-output-path>', immediate: true })
18    return next(e)
19  })
20  on('command.run', { command: 'trackbench' }, async ($, e) => {
21    if (running) return { text: 'The probe is already running.' }
22    const path = e.args.trim()
23    if (!path.startsWith('/') || path.includes('\0')) return { text: 'An absolute output path is required.' }
24    const subject = await $.session.id()
25    running = true
26    renders = []
27    const started = Date.now()
28    const samples: number[] = []
29    const finish = async (failure?: string) => {
30      const tools = await $.tool.list()
31      let checkpoint: unknown
32      if (failure === undefined && tools.some(t => t.name === 'mcp__track__checkpoint')) {
33        const saved = await $.tool.call({ tool: 'mcp__track__checkpoint', expected_session: subject })
34        checkpoint = typeof saved.result === 'string' ? JSON.parse(saved.result) : saved
35        if ((checkpoint as { ok?: boolean }).ok !== true) failure = 'final durable checkpoint was not acknowledged'
36      }
37      const result = { evidence: 'LIVE', subject, started, ended: Date.now(), events: samples.length, cadence_ms: 200, update_ms: samples, update_p95_ms: [...samples].sort((a, b) => a - b)[Math.ceil(samples.length * 0.95) - 1], renders, render_p95_ms: renders.map(r => r.ms).sort((a, b) => a - b)[Math.ceil(renders.length * 0.95) - 1], checkpoint, ...(failure !== undefined && { failure }) }
38      await $.fs.write(path, JSON.stringify(result))
39      if (JSON.parse(await $.fs.read(path) as string).events !== samples.length) throw new Error('probe receipt read-back differs')
40      running = false
41      $.ui.toast(`Track probe: ${samples.length} updates; ${failure ?? `p95 ${result.update_p95_ms} ms`}`)
42    }
43    const step = async () => {
44      try {
45        if (await $.session.id() !== subject) throw new Error('probe session changed')
46        if (samples.length === 0) {
47          const created = await $.tool.call({ tool: 'mcp__track__track_steps', steps: ['Native persistence latency probe'] })
48          if (created.deny !== undefined || created.isError === true) throw new Error('probe step was refused')
49        }
50        const status = samples.length % 2 === 0 ? 'paused' : 'in_progress'
51        const before = Date.now()
52        const result = await $.tool.call({ tool: 'mcp__track__mark_step', id: 'plan:1', status, note: `Native sample ${samples.length + 1}` })
53        if (result.deny !== undefined || result.isError === true || typeof result.result !== 'string' || !result.result.includes(`marked ${status}`) || result.result.includes('unsaved')) throw new Error(`update was not acknowledged: ${JSON.stringify(result)}`)
54        samples.push(Date.now() - before)
55        if (samples.length === 500) {
56          await $.tool.call({ tool: 'mcp__track__mark_step', id: 'plan:1', status: 'completed' })
57          await finish()
58        } else {
59          $.clock.after(Math.max(1, started + samples.length * 200 - Date.now()), () => void step())
60        }
61      } catch (error) {
62        await finish(error instanceof Error ? error.message : String(error))
63      }
64    }
65    $.clock.after(1, () => void step().catch(error => { running = false; $.ui.log(`Track probe failed: ${String(error)}`, { to: 'debug' }) }))
66    return { text: `Native Track probe started for this session; receipt: ${path}` }
67  })
68}
69