Debug mode and traces
Debug mode records what the harness does in a session, so you can review it afterwards or watch it live: each prompt, every model request as it was sent (system prompt, tools, messages, parameters), each response with its timing, token use and cost, the raw HTTP exchange with the provider, tool calls with their input and output, permission answers and how long they waited, hooks, notices and compactions. Subagents are recorded in their own lanes.
Turn it on with larik --debug (also larik -p --debug and larik serve --debug), LARIK_DEBUG=1, "debug": true in personal settings, or /debug on in a session (/debug off stops it, /debug shows where it's recording). While it records, the footer shows ● rec.
Review a trace with /trace in the TUI, or larik trace from a shell, which opens the latest traced session in this directory (larik trace <session-id> for another). It serves a page on 127.0.0.1 behind a random token and opens your browser. In the TUI, when browser tools are on and the window is wide enough, /trace shows it in Larik's own browser panel instead, in a tab of its own that the agent's browser_* tools never touch (the panel follows whichever tab was used last, so the agent's next browser action switches it away; run /trace again to return). /trace external always uses the system browser, /trace browser insists on the panel and says why if it can't, and "trace": {"open_in": "auto" | "browser" | "external"} in your personal settings sets the default. In auto mode, panel setup or browser startup failures fall back to the system browser; forced browser mode reports the error without opening an external window. Tab ownership keeps trace tabs and their popups out of the agent-facing tab, snapshot, console and network APIs; it is not a separate Chrome profile or an OS security boundary. The URL is printed either way. The token is part of the URL, so the browser's saved history can hold it; it stops working when Larik exits:
- Timeline: one lane per agent. Each request is split into waiting for the first output and generating; tool calls, permission waits and hooks sit beside them, with prompts marked. Long idle stretches are collapsed. Scroll to zoom, drag to pan, shift+drag to filter the list to a time range, double-click to reset. It follows a live session as it grows.
- List: every record in order, grouped by prompt, filterable by kind, agent and text.
- Inspector: for a request, its overview (model, timing, tokens per second, usage, cost), the prompt as sent with the system prompt and tool list diffed against the previous request and new messages marked, the response, and the raw HTTP request and streamed response. For a tool call, its input, output and permission answer.
larik trace --html trace.html writes one self-contained page instead, to keep or share.
Traces are stored next to the session, in <session>.trace/ under the data directory (owner-only), and deleted after 14 days (debug_retention_days; negative keeps them). Only new messages are written with each request, so a trace grows with the conversation rather than with its square; the raw HTTP bodies, though, hold each full request. API keys and other credential headers are redacted; prompts, file contents and tool output are not, so treat a trace like the session itself.