Building Atomic from source or contributing to the repository? See DEV_SETUP.md and CONTRIBUTING.md.
Debugging
Enable debug mode from Debug mode in/settings (the global debug setting), by passing --debug, by setting ATOMIC_DEBUG=1 (legacy PI_DEBUG=1; see Environment variables), or over RPC with set_debug ({"type": "set_debug", "enabled": true}, which leaves saved settings unchanged). The footer shows a debug badge while debug mode is active.
Only the exact value
"1" enables debug mode through the environment variable (true and yes are ignored). If "debug": true is saved in ~/.atomic/agent/settings.json, setting ATOMIC_DEBUG=0 does not turn debug mode off for that run; toggle Debug mode in /settings or edit settings.json instead.~/.atomic/agent/atomic-debug.log in the form {"at", "pid", "area", "event", "data"}:
Debug mode logs record IDs, names, counts, and status details—never prompts or conversation text, except what code printed to the terminal, which
engine-stderr and terminal-output keep as printed (objects a console call prints are shown three levels deep, with the first 100 items of an array and the first 2,000 characters of a string). Common credential formats (bearer tokens, JWTs, GitHub tokens, private key blocks, sk-... API keys, URL credentials, and key/token/secret/password pairs) are replaced with [redacted], and individual text fields truncate at 2,000 characters. Review the log before sharing it because unusual secret formats can still pass through.
The Intercom broker and other child processes started while debug mode is on inherit it, and subagents follow it right away. Already-running processes keep the setting they started with until restart. If the debug log cannot be written, Atomic shows one warning and continues: in the chat when the interactive TUI starts or is on screen, and otherwise on stderr as Atomic exits.
Extensions and SDK programs can read debug state and append records with the debug output API.
Capture a UI and message snapshot (/debug)
Run /debug (an unlisted slash command) or press Shift+Ctrl+D anywhere in the TUI (regardless of which element has focus) to append a plain-text diagnostic snapshot to ~/.atomic/agent/atomic-debug.log.
Each snapshot records:
- Timestamp, terminal dimensions (
columns x rows), and total rendered line count - Every rendered TUI line, JSON-escaped with ANSI codes and visible widths
- All messages in the current session context as JSONL, completely unredacted
- The most recent 200 records of log and warning output the session kept off the screen (
terminal-output,engine-stderrandmupdf-diagnostic), whether or not debug mode is on, each cut to 2,000 characters with common credential formats redacted
Finding what freezes the UI
If the interactive UI stalls and keystrokes or streamed output appear late, setATOMIC_EVENT_LOOP_BLOCK_MS to the shortest stall duration in milliseconds you want to capture, reproduce the stall, and quit:
ATOMIC_EVENT_LOOP_BLOCK_MS must be a positive whole number (1 or greater); "0", negative numbers, decimals, and non-numeric values are ignored and no monitor starts.
Interactive sessions log both the terminal UI process (role: "host") and the background session worker (role: "engine") to ~/.atomic/agent/event-loop-blocks.jsonl. Single-process runs write only role: "host". Override the path with ATOMIC_EVENT_LOOP_BLOCK_LOG (relative paths resolve from the startup working directory). If the file cannot be written at startup, Atomic prints one warning and skips monitoring.
Quit Atomic cleanly, close the terminal or console window, or sign out of Windows so the final
shutdown delay summary flushes to disk. Block records contain function names and source paths—never prompts or message text. Atomic never trims event-loop-blocks.jsonl, so delete it before reproducing a new issue.
The monitor checks the event loop every 20 ms, tracks delay histograms at 10 ms resolution, and samples CPU stacks every 2 ms using a sampling profiler rather than debugger pauses. A debugger; statement does not pause Atomic just because monitoring is active, and an attached debugger keeps control of its own breakpoints.
Because CPU sampling adds some overhead, pass ATOMIC_EVENT_LOOP_BLOCK_STACKS=0 (must be exact "0"; "false" leaves stacks enabled) when measuring raw latency:
start records report stacks: "disabled" and block records have zero samples, while every stall duration and delay summary is still recorded.
Terminal rendering diagnostics
Capture raw terminal output and main-screen redraw logs with three environment variables (legacyPI_* aliases work when the ATOMIC_* variable is unset; see TUI debug logging and Environment variables):
Subsystem status and native troubleshooting
Check subsystem health before collecting full traces:
For process-spawning or native-module errors:
- Set
ATOMIC_HOST_SPAWN=child-processto launch helper processes (Git snapshots,rg,fd, worktree setup, and standalone shell commands) through standard Node child spawning instead of Atomic’s native spawner (Environment variables). - If startup fails because the native module cannot load, check Package manager troubleshooting or point
NAPI_RS_NATIVE_LIBRARY_PATHat a locally built.nodebinary (which bypasses Atomic’s exact release version check).
Document conversion diagnostics
Diagnostics from document conversion (.pdf, .doc, .docx, .ppt, .pptx, .xls, .xlsx, .rtf, and .epub) appear in tool error results when conversion fails. Interactive sessions never show them, or anything else the background session worker writes to stderr, in the chat: they go to the debug log while debug mode is on. Other modes write them to stderr or console output, and RPC clients receive them separately from JSON responses.
Long or noisy diagnostics may truncate. Copy the conversion error, and the debug log’s mupdf-diagnostic and engine-stderr records, when reporting a document conversion issue.
Startup timing and bug reports
To profile slow startup or session resume (see Environment variables):- Set
ATOMIC_TIMING=1(legacyPI_TIMING=1) to print startup timings andatomic --sessionresume timings to stderr (Inspecting snapshots). - Set
ATOMIC_STARTUP_TRACE=/tmp/atomic-startup.jsonl(legacyPI_STARTUP_TRACE) to append JSONL startup milestones with wall-clock timestamps. The file also gets each stepATOMIC_TIMINGwould print, such as each step of a resume, from the terminal UI and from its background session process.
- Your OS and version
- Your terminal emulator (and tmux or Herdr version if applicable)
- Your installation method (npm/package manager, self-contained release archive, or standalone binary)
- Output of
atomic --version - Relevant redacted diagnostic logs