Incident capture

For AI agents: this page is Markdown at https://squiggle.sh/docs/replay/incidents.md. Every docs page is listed at https://squiggle.sh/llms.txt, and all of them are one file at https://squiggle.sh/llms-full.txt.

The recording you need most is the one nobody started. While your app is connected, Studio (or, with Studio closed, your agent’s Squiggle server) keeps its last five seconds in memory, and when something goes wrong it saves them, plus two seconds after, as a recording.

A React web app is watched too while it’s open in Squiggle’s window. A tab writes no crash reports, so it has no crash incidents, and its incidents have no picture of the screen. See React web apps.

What Studio saves

An incident is an ordinary recording that opens on the seconds before the problem. It holds everything the app recorded, plus Studio’s own measurements: CPU, memory, threads, GPU and frame timing. Keeping the five seconds costs almost nothing; no video is recorded.

Replay an incidentStudio tour · 9 steps

Without Studio

Your agent’s Squiggle server watches the app the same way, from the moment the server starts until it stops, so a crash before the agent’s first tool call is caught too. It only watches: Studio, a squiggle flow run and your agent can all drive the app while it does. Its incidents are the same recordings, saved in the same place, and with Studio open too, one of the two saves each incident, never both. That holds when the agent works in a git worktree and Studio has the main checkout open: the recording is saved in Studio’s checkout, and the agent is told which one. The server starts watching an app this project owns on its own; any other app it watches once your agent drives it, and for that app incidents are noted and nothing is saved. On its own it never watches an app that a Squiggle session of another project, or of another checkout of this repository, is driving, and a server pointed at one simulator (SQUIGGLE_UDID) watches only the app on that simulator.

Your agent hears about an incident on its next Squiggle tool call: the result names what went wrong and, for a JS error, the file and line of your code it came from. The incidents tool lists each one with its recording, so the agent can replay it and fix the bug in the same session. A problem that happens while another one is being recorded, such as an error during a stall, is in that recording, and your agent hears about it on its next tool call as an incident of its own, by name, with the recording it landed in.

When the app shows a red box over a blank screen, for example after Fast Refresh applied an edit you were halfway through, every Squiggle tool result says so until the app is back, with the error and the file and line it came from, and status has it as appError. A flow step that meets the red box fails with app_error instead of timing out. Fix the line, then relaunch the app: after a red box, Fast Refresh doesn’t bring it back.

Keep performance findings from crowding your agent

Performance findings (re-renders, memo misses, long tasks) reach your agent as one line per tool result, one clause per detector with how many and the components that hit it most:

Tool result
New performance findings: memo-miss ×4: "ThemedText" 41, "Row" 12, "Button" 9, +1 more; render-storm ×1: "List" 80. Quoted text is the app's own. `perf_insights` has each one and its fix; `incidents` with `mute` keeps a detector or component off these lines.

Your agent hears about each finding once while its Squiggle server runs, even across app relaunches. It hears again only when the finding gets worse: more severe, or at least twice as many renders as when it was told. The incidents tool and perf_insights keep the full list, with each fix.

To stop a detector or a component from appearing at all, add it to watch.mute in .squiggle/config.jsonc (see Set what your agent keeps). That applies to every session. For one session, your agent can mute from the incidents tool and take it back with unmute, which clears what it muted but not the project’s list:

MCP
incidents { "mute": [{ "detector": "memo-miss" }] }incidents { "unmute": true }

If your app builds with React Compiler, a memo-miss doesn’t tell you to add useMemo or useCallback, since the compiler already does. It asks where the recreated value comes from: a hook or library that returns a new value on every render, or a component the compiler skipped. Squiggle recognizes the compiler from your app’s package.json, Babel config, Expo’s experiments.reactCompiler, Next’s reactCompiler option, or your Vite config.

Wake an idle agent

An agent between tasks makes no tool calls, so it hears nothing on its own. squiggle agent watch --incidents prints one line per incident as it’s recorded, from Studio or the agent’s server, and nothing else:

Terminal
squiggle agent watch --incidents2026-10-28T14:03:11.000Z error "TypeError: Cannot read property 'total' of undefined" recording=incident_error_2026-10-28_14-03-11 by=mcp

In Claude Code, ask your agent to run it with the Monitor tool: each line then reaches the agent as it lands. The lines list recorded incidents only. Incidents from an app this project doesn’t own, and repeats of a problem recorded in the last 10 minutes, are listed by the incidents tool.

Set what your agent keeps

The watch block of .squiggle/config.jsonc sets what your agent’s Squiggle server does. Every key is optional:

.squiggle/config.jsonc
{  "watch": {    "push": "notice",    "capture": true,    // ephemeral keeps less, for a sandbox that is thrown away    "profile": "local",    "budget": { "storeMb": 512, "incidentMb": 8, "incidentSeconds": 20 },    // keep these findings off your agent's tool results    "mute": [{ "detector": "memo-miss" }, { "component": "ThemedText" }]  }}
KeyWhat it sets
enabledfalse stops the watch. SQUIGGLE_WATCH=0 in the server’s environment does the same for one session.
pushnotice (the default) names new incidents on the agent’s next tool result. channel does that and also pushes each incident to Claude Code as a channel event, where channels are turned on. none says nothing until the agent calls incidents. Switching channel on or off takes effect when the server restarts.
capturefalse keeps the watch but records nothing: the agent still hears about each incident.
profilelocal (the default) or ephemeral, for a store that’s thrown away with its sandbox. ephemeral keeps hours of performance history instead of days, makes smaller recordings, and holds the whole .squiggle folder under 256 MB. It’s picked for you when the CI environment variable is set, and in a Niteshift task.
budget.storeMbIncident recordings kept, in MB (512, or 128 under ephemeral). Past it, the oldest go first, but never the newest recording of each problem or one a flow uses.
budget.incidentMbOne recording, at most, in MB (8, or 4 under ephemeral).
budget.incidentSecondsHow long one recording runs past the incident, at most (20, or 10 under ephemeral).
mutePerformance findings kept off your agent’s tool results. Each entry names a detector, a component, or both, and then both must match. See Keep performance findings from crowding your agent.

At most 6 incidents are recorded in any 10 minutes (3 under ephemeral), so an app that crashes on every launch can’t fill your disk. Incidents past that are still reported to the agent. When the ephemeral store reaches its 256 MB, the watch stops recording and status says so. The watch also stops recording while the disk holding your project has less than 2 GB free. The agent still hears about each incident, with how much space was free. When a recording can’t be written for another reason, such as a folder it has no permission to write, the agent hears that reason.

What counts as an incident

KindWhen
CrashThe app’s connection closed and the simulator wrote a new crash report for that run of the app, including a crash right after an error that was being recorded. The connection also closes on a Metro reload, so Studio and your agent’s Squiggle server keep looking for as long as that run of the app is alive and for a minute after it ends: a crash while the app reloads or sits without its JS is still caught. A relaunch or a Metro reload on its own isn’t a crash, and neither is a report of a fault the app lived through, such as XPC_EXIT_REASON_FAULT. A crash while the app was closing because Squiggle stopped or relaunched it is titled with the app’s name, as “<app> crashed while Squiggle stopped it”, and reported as a lower-priority incident.
ErrorA thrown JS error, a render error no error boundary caught (the red box), an unhandled promise rejection, or an error boundary catching one.
StallThe app’s main thread stopped responding.
SlowdownA JS task of a second or more (not counting the time Squiggle itself holds the JS thread), event-loop lag of 500 ms or more, or frames taking 100 ms or more (95th percentile).
SpikeCPU or GPU at 95% or more for two samples in a row, memory or the JS heap jumping within ten seconds, or critical memory pressure.

Each kind waits 30 seconds before it can fire again, and a second problem during a capture joins it instead of saving a second file. Spikes are ignored for the first 20 seconds after Studio connects, while its own measuring starts up.

The same problem again within 10 minutes isn’t saved again: it counts toward the recording already saved for it. Two problems are the same when their kind and message match, ignoring numbers, so App CPU at 106% and App CPU at 99% are one spike.

A recording stops 20 seconds after its moment, or at 8 MB, whichever comes first.

Read an incident

Studio shows a notification with Open in Replay. The incident opens on a report: what set it off and the stack, the window’s peak CPU and GPU, how memory moved, the lowest frame rate and the worst lag, the longest JS task, and the errors. Values past a limit are marked, and a value the recording doesn’t have is left out rather than shown as 0. Beside it is the screen at the moment it happened. A crash has no screenshot, because the app is already gone.

Jump to incident moves the playhead to the moment it happened. Incidents that repeat are grouped into one entry, with a count and when each was first and last seen.

Where they go

Files are saved as .squiggle/recordings/incident_<kind>_<time>.sqrec, listed in History, and kept when old performance data is cleaned up, up to 512 MB. Past that, squiggle perf gc removes the oldest, but always keeps the newest recording of each problem. You can also list them from the terminal:

Terminal
squiggle perf sql "select kind, title, datetime(triggered_wall / 1000, 'unixepoch') as at, path                   from incidents order by triggered_wall desc limit 10"