Skip to content
Back to skills

Performance

ASecurity

Measure and protect Caxri startup, Server Core responsiveness, Renderer interaction quality, idle CPU, and long-lived memory. Use for slow launch or Session restore, repeated Server Core requests, watcher or file-descriptor growth, PTY responsiveness, Git or Agent probe latency, logging overhead, React re-renders, frame gaps, idle animation or background-window CPU, heap growth, or Renderer bundle regressions.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 24, 2026
developmentjavascriptrustgojavabashreactnodedockerawsdebugging

Works with

  • terminal

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned November 24, 2026

npx -y skills add tjx666/caxri --skill performance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Performance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Performance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tjx666-performance/badge)](https://www.skillsdirectory.com/skills/tjx666-performance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: performance
description: Measure and protect Caxri startup, Server Core responsiveness, Renderer interaction quality, idle CPU, and long-lived memory. Use for slow launch or Session restore, repeated Server Core requests, watcher or file-descriptor growth, PTY responsiveness, Git or Agent probe latency, logging overhead, React re-renders, frame gaps, idle animation or background-window CPU, heap growth, or Renderer bundle regressions.
---

# Measure Caxri Performance

1. Choose a representative large repository. Never benchmark only a synthetic empty directory when
   the report concerns a real Project.
2. When another worktree holds the desktop lease, wrap a benchmark in
   `switch-worktree.ts desktop --label <name> --wait <seconds> -- bun run benchmark:<name>` instead
   of a hand-written retry loop. Establish the baseline with
   `CAXRI_BENCHMARK_PROJECT_ROOT=/path/to/repository bun run benchmark:startup`. Record the
   `CAXRI_STARTUP_BENCHMARK` object. For editor latency, also run
   `CAXRI_BENCHMARK_PROJECT_ROOT=/path/to/repository bun run benchmark:editor` and record
   `CAXRI_EDITOR_BENCHMARK`. The editor benchmark runs isolated cold and idle-preloaded launches. It
   defaults to `vitest.config.ts` and `package.json`; for another representative root, set
   `CAXRI_BENCHMARK_EDITOR_FILE`, a visible unique `CAXRI_BENCHMARK_EDITOR_TEXT`, and a root-level
   `CAXRI_BENCHMARK_EDITOR_DETOUR_FILE` that does not contain that text.
   For Renderer re-renders, frame gaps, Long Animation Frames, and interaction latency, run
   `bun run benchmark:renderer` and record `CAXRI_RENDERER_BENCHMARK`. The command owns its isolated
   Project, seeds eight Sessions plus a populated and expanded file tree, uses a profiling React
   build without observer overhead, measures one `session.switch`, and writes
   `test-results/receipts/renderer-performance.json`. Read the fixed `session.select` and
   `app.bootstrap` request summaries before attributing time to React.
   For switching to a long Agent Chat (blank transcript frames, scroll position, re-reads), run
   `bun run benchmark:chat-switch` and record `CAXRI_AGENT_CHAT_SWITCH_BENCHMARK`. It measures
   twenty switches each to a kept-alive, an evicted-but-cached, and an uncached Chat, plus three after
   a Server Core restart (`cold`), frame by frame after paint in a profiling build, reports each
   scenario's p50/p95 time until the Chat is readable and its composer focused, gates per-surface
   React budgets, runs in CI after `benchmark:renderer`, and writes
   `test-results/receipts/agent-chat-session-switch.json`; see
   [Agent Chat Session switch](../../../docs/renderer-performance.md#agent-chat-session-switch).
   For what a visible Chat costs while it streams (a 50 KB Markdown reply, 600 tool updates, a reply
   full of pull request, issue, file, and skill references after forty tracker cards), run
   `bun run benchmark:chat-streaming` and record `CAXRI_AGENT_CHAT_STREAMING_BENCHMARK`. It reads
   Renderer main-thread time, heap growth after a forced collection, whole-app resident memory, and
   React budgets, and writes `test-results/receipts/agent-chat-streaming.json`; see
   [Agent Chat streaming](../../../docs/renderer-performance.md#agent-chat-streaming). To attribute
   heap growth, diff `HeapProfiler.takeHeapSnapshot` captures from before and after a workload by
   constructor and Fiber component name. To compare two builds on a busy machine, alternate them
   run by run instead of running each three times in a row: load swings moved main-thread time and
   missed frames more than the change did. Swap every `OUTPUT_ROOTS` tree (`scripts/build-receipt.ts`)
   with `cp -Rp` together with `.cache/build-receipt.json` and the matching sources; a plain copy
   changes mtimes, and the launch then fails as a stale build.
   For what the app costs while left alone (CPU share and Activity Monitor footprint per process,
   Terminal and Chat in front), run
   `CAXRI_BENCHMARK_PROJECT_ROOT=/path/to/repository bun run benchmark:idle` and compare
   `test-results/receipts/idle-resources.json` with the baseline in
   [Idle CPU and memory baseline](../../../docs/idle-resources.md), from the same machine only.
   For Claude Agent-state probe latency, run `bun run benchmark:agent-probe` and record
   `CAXRI_AGENT_PROBE_BENCHMARK`. It runs below Electron against a synthetic 512-file
   `sessions/` directory and rewrites one file every ten probes; the production `agent.probe` log
   only keeps samples slower than 250ms, so this is the only source of the full distribution. It
   is a trend tool and never fails on its own: a wall-clock threshold passes on an idle machine
   with the cache fully broken. Read the `cache` counters it prints beside the timings to tell a
   fast run from a cache that stopped working, and keep regression protection in the syscall-count
   assertions in `metadata-cache.test.ts` and `probe-fanout.test.ts`.
   For an SSH Host window on a slow or distant link, run `bun run benchmark:ssh-link` (Docker, about
   20 minutes; `--profiles slow --skip-build` for one profile). It times a real Desktop workload
   through a simulated link and reports the bytes that crossed it; see
   [Slow links](../../../docs/ssh-host.md#slow-links). The other benchmarks run locally, where wire
   size never shows.
3. Read the correlated Desktop Main, Server Core, Terminal Host, and Extension Host JSONL logs
   from the active runtime profile's `<userData>/logs/` directory. Use `app.ready`, `app.startup_profile`,
   `server_connection.attached`, `window.ready_to_show`, `server_core.ready`, `pty.spawned`,
   `file.list`, `git.command`, `agent.probe`, `watcher.ready`, `pty.first_input`, and
   `pty.throughput_summary` to locate the owner. Add timing logs at operation boundaries for new
   non-trivial work so regressions remain attributable.
   A slow Session switch is usually a `session.select` whose `ipc.request` `queueMs` is large: some
   earlier write still holds the connection's ordered lane. The record's `blockedByMethod` and
   `blockedByRequestId` name that write (no need to infer it from overlapping time windows); check its lane in `docs/server-architecture.md`. When a new or
   existing write is slow and its caller does not need later requests to wait on it, give it a lane
   deliberately and list it in `apps/server/src/core/__tests__/control-server-lane.test.ts`; that
   test fails for any unlisted non-read method, so a new write cannot default into the ordered lane
   unnoticed. Start a live investigation with the
   volume signals before reading individual records: every rotated generation opens with a
   `log.rotated` record whose `generationMs` and `topEvents` name what filled the file, so a
   generation that lasted hours instead of days points at a runaway event. To see where a live
   process spends CPU without relaunching it, sample it over the always-on inspector:
   `bun run .agents/skills/performance/scripts/cpu-profile.ts --port 9229 --seconds 10`
   (9230 Extension Host, 9231 Terminal Host, `--renderer --port 9224` for the packaged Renderer).
   To find which request or Git operation is slow, rank first and read records second:
   `caxri diagnostics snapshot --json` lists `ipc.request` rows keyed by method and boundary
   (`handler` or `relay`) and `git.command` rows keyed by operation, each with count, p50, p95, max,
   and the first and last timestamp; then `caxri logs query --event <name>` reads the individual
   records behind the slowest row.
   **Diagnose a reported Session switch lag or frame drop from logs alone.** Every signal below is
   threshold-gated, so a healthy profile writes none of it. Query with `caxri logs query --event <name>`.

   - `renderer.jank` (`info`, `warn` from 1 s): `switches` (`total`, `request`, `converge`, `snapshot`, `apply`, `paint`)
     and `frames` (`duration`, `blocking`, `styleLayout`, `duringSwitch`, `topInvoker`,
     `topMs`, `topFile`, `topFunction`), each with `endedAgo`. Answers whether the user waited in the
     Renderer and which script made the frame long. Chromium's throttling of a hidden, occluded or
     just-created window (a 0.9-1.1 s frame with no scripts, zero blocking and no render work, or any
     frame with no scripts and zero blocking that overlapped a hidden period) is filtered out, so every `frames` entry is real work: a ~1008 ms frame
     with `topInvoker` unset and `blocking=0` can no longer appear and should be distrusted if seen.
   - `ipc.request` for `session.select` (`info` from 250 ms of queue): `queueMs`, `queueDepth`, `lane`,
     `blockedByMethod`, `blockedByRequestId`, `blockedByOverlapMs`. Answers which earlier request it
     waited behind.
   - `process.event_loop_stall` (`warn`/`error`): `stallKind`, `inFlightCount`, `inFlightRequests`,
     `finishedRequests` as `method=ms` pairs, longest first, plus `loadAverage1m` and `cpuCount`.
     Answers whether the Server loop was blocked and by which handlers. A `process-suspension`
     (`info`) whose `loadAverage1m` far exceeds `cpuCount` was CPU starvation by other processes, not a
     frozen machine.
   - `git.command` (`info` when `queueMs` is 250 ms or more or `execMs` is 1 s or more): `operation`,
     `callerMethod`, `repository`. Answers whether Git queued or ran long and for which request.
     `callerMethod` travels with the request id in the async context, so it is present even when the
     Git command ran in a background refresh after the request (e.g. `git.summary`) had returned.
     `background` names the poller (`project-status-poll`, `delivery-watch`, `pull-request-sweep`)
     when one issued it.
   - `server_core.load_changed` (`info`): `state: loaded` on entry, then `state: normal` with
     `loadPerCore`, `peakLoadPerCore`, `durationMs`, and `deferred` (`source=count` rounds skipped). Answers whether
     the machine itself was saturated and how much background work Caxri shed; see
     [Git status snapshot](../../../docs/git-status-snapshot.md#measurement-contract).

   Recipe: (1) Find the `renderer.jank` record near the reported time. `total` splits into `request`
   (Server round trip), `converge`, and `paint` (next frame). `converge` is itself a full `app.bootstrap`
   read (`snapshot`, which includes waiting behind a read already in flight) plus the Renderer's `apply`, so
   a large `converge` with a large `snapshot` points at the Server, not React. Large `request` means the
   Server; large `apply`, large `paint`, or a `frames` entry with `duringSwitch=true` means Renderer work, and `topFile`/`topFunction` name the bundle chunk and function that spent the most time.
   (2) For a large `request`, read the `ipc.request` record of that `session.select` by `requestId`.
   `blockedByMethod` names the write that held the lane; check its lane in `docs/server-architecture.md`.
   A long `queueMs` with no `blockedBy*` fields and a `process.event_loop_stall` at the same time means the
   loop itself was blocked: `inFlightRequests` and `finishedRequests` name the handlers. (3) If the
   handler ran long, look for `git.command` records with the same `requestId` (`callerMethod` repeats its
   method). (4) Only when the logs name nothing, take a CPU profile as above. A `renderer.jank` entry's
   `endedAgo` is milliseconds before the record's own timestamp, so subtract it to place the hitch against
   Server records.

4. Preserve privacy: timings, counts, IDs, relative paths, and byte totals are allowed; terminal
   output, source contents, prompts, credentials, environment values, and agent transcripts are
   not.
5. Share concurrent identical expensive operations. Aggregate high-frequency Terminal telemetry
   instead of synchronously logging each input, resize, or output event. Keep editor-only
   dependencies out of the terminal-first Renderer entry. Send live PTY output only to attached
   Renderer views; restore the bounded snapshot before replaying output buffered during attachment.
   Keep idle cost near zero:
   - Put a continuous `transform` or `opacity` animation on an HTML element, never on an inline
     `<svg>` root or an SVG child: Chromium runs the SVG case on the main thread with a restyle every
     frame (`features/primary-sidebar/running-arc.tsx` wraps its `<svg>` in a spinning `<span>`).
     For a looping figure with several moving parts, give each part its own HTML layer over a shared
     view box and step the loops with `steps()` on one common tick, so the parts redraw in the same
     frame (thinking Buddy in `features/agent-chat/loading/buddy.tsx` went from 120 to 12.5 drawn
     frames per second this way). Compositor-only motion alone still draws every frame on the GPU.
   - Bound decorative animations to the moment they convey something: a finite iteration count
     with `forwards`, replayed on a real trigger (the attention ripple replays on window `focus`).
   - Never hold a still phase inside the keyframes of a non-composited property such as
     `background-position`; the hold restyles every frame. End the animation and restart it after
     the rest (`features/agent-chat/activity/dwell-shimmer-rest.ts`).
   - A hidden `.workbench-session` uses `content-visibility: hidden`, so a transition started as it
     hides (the composer border fading on blur) never retires and keeps 120 Hz frames running.
     `hidden-session-transitions.ts` cancels transitions and pauses running animations after the
     switch paints; verify by switching away and counting `Scheduler::BeginFrame`, which should be 0.
   - Unlocking a `content-visibility: hidden` subtree restyles all of it (about 26 ms for a 10-turn
     Chat, 68 ms for 40 turns). Never toggle `inert` or style it through a descendant selector such
     as `.workbench-session[hidden] *`: either invalidates the whole subtree on each Session
     switch. Use JS (`getAnimations`) for pausing and rely on `content-visibility` for focus and
     accessibility. Measure with a visible window and GPU on (the E2E default hides this cost).
     An animation that mounts after the switch fires no `animationstart` inside the hidden subtree,
     so JS never sees it; pause a looping figure through a rule whose rightmost compound is its root
     class (`.workbench-session[hidden] .agent-chat-glyph` in `agent-chat/loading/loading.css`,
     about 1 ms per toggle on an 8,000-row Session against 26 ms for the `*` form).
   - Gate event-driven refetches and polling on `document.visibilityState`, then catch up once on
     reveal keyed by what changed, not by React Query's `isInvalidated`, which an in-flight fetch
     clears. Route every new Server-backed invalidation through
     `queries/invalidation-hidden-window.ts`, which already covers `git.changed`, `files.changed`,
     and Source Control view changes.
   - Measure minimized or covered-window behavior with `--remote-debugging-port` closed: an open
     CDP port (always on in dev) can keep a minimized window at `visibilityState === 'visible'` and
     120 rAF/s, while a packaged build without it reports `hidden` and stops frames. Launch with
     `--inspect=<port>` instead and probe through Main
     (`BrowserWindow.getAllWindows()[0].webContents.executeJavaScript(...)`).
   - Refresh Server state on a selection change only when something was actually detached: a Session
     switch inside the same Workbench Project keeps its file watcher, so it must not re-run
     `git status` (`updateWatch` in `apps/server/src/domains/background-tasks.ts`).
   - Arm one timer at the next deadline instead of a fixed-rate interval, and run none while there
     is nothing to expire (the held-message expiry in `agent-message-approval-store.ts`).
   - Long-lived caches must not retain a view over a larger allocation: copy a truncated string out
     of its V8 parent and copy a sync zlib result, which is a slice of Node's shared buffer pool
     (`apps/server/src/domains/agent-chat/history/archive.ts`, the agent timeline projection).

   For a quick frame rate, reload, or Session switch reading, open the Performance Monitor
   (`docs/performance-monitor.md`; command palette `Toggle Performance Monitor`) without a debugger. Choose
   Window mode to reload the Workbench from the monitor's `Reload` or `Hard reload` and read DOM ready, loaded,
   and first frame from Main's clock; `Cmd+R` reloads are timed too. Its `fps` is the main thread's
   `requestAnimationFrame` rate, so an idle page reads the display refresh rate; use CDP for compositor
   presentation. The monitor costs about 0.2% Renderer CPU when open and nothing when closed, so compare
   readings taken with it open against each other, never against a closed baseline.

   Measure idle cost over CDP in a frontmost dev window: `SystemInfo.getProcessInfo` CPU time for
   the Renderer and GPU processes plus `Performance.getMetrics` `RecalcStyleCount` and
   `TaskDuration`, comparing before and after in the same instance. Discard samples during which
   `visibilitychange` fired, since an occluded window stops rendering.

6. Add a focused unit or integration test for the optimized boundary and extend the performance E2E
   assertion when a regression can be observed there. Keep React render-count and total-duration
   budgets per stable surface. Browser frame, Long Animation Frame, and Event Timing metrics remain
   diagnostic unless a same-runner experiment proves a deterministic budget.
7. Run `bun run check --lint --test --type`, the focused Electron workflow, and the benchmark
   again. Compare like-for-like repository, build mode, and executable. Reserve the full unit and
   E2E suites for release or CI parity.

For an interactive Renderer scenario, follow [Renderer performance observability](../../../docs/renderer-performance.md).
The strict receipt is the source of truth. Start a component-level investigation only when three
exact-head runs identify the same Profiler surface as the regression. Do not rank components by
subtree-inclusive Fiber `actualDuration`; Caxri removed `react-scan/lite` 0.5.7 after its React 19.2
commit trees failed the parent/child duration consistency required to derive self time. Add a future
attribution tool only with bounded, internally consistent output and an avoidable
props/state/context/hook cause.

For launch latency, measure packaged builds with the median runner in
[startup performance](../../../docs/startup-performance.md) and compare `app.startup_profile`
milestones. Read its "Startup design" and "Not applicable" sections before proposing a startup
trick. A sound, low-risk optimization ships even when today's A/B is within noise, since the
startup path keeps growing; reject one only for a measured regression, real risk, or a dev-debugging
cost.

The large-Project startup gate requires Server Core, Terminal, Files, and single- or
multi-repository Git to become usable within three seconds. A performance change must retain that
benchmark assertion or add a focused regression at its owning boundary.

For a packaged application, run:

```bash
CAXRI_BENCHMARK_EXECUTABLE="$PWD/release.noindex/mac-arm64/Caxri.app/Contents/MacOS/Caxri" \
  CAXRI_BENCHMARK_PROJECT_ROOT=/path/to/repository \
  bunx playwright test e2e/startup.performance.e2e.ts --reporter=line
```

Files in this skill

  • SKILL.md18.9 KB
  • agents/openai.yaml216 B
  • scripts/__tests__/cpu-profile.test.ts1.3 KB
  • scripts/__tests__/startup-profile.test.ts2.5 KB
  • scripts/cpu-profile.ts5.2 KB
  • scripts/startup-profile.ts16.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.