← 2.1.2 Primitive tested · runtime-test

Large Tool Outputs to Disk

Feature works as documented. Large outputs are saved to disk with a preview shown in context.

Large outputs from bash commands and tools automatically persist to disk when they exceed the context-window threshold, with a 2KB preview shown inline and the full file accessible for reading.

How It Works

When a tool (like Bash) produces output larger than ~900KB to 1MB, Claude Code no longer truncates it. Instead, the runtime wraps the output in <persisted-output> tags, saves the full content to ~/.claude/projects/{project-hash}/{session-id}/tool-results/toolu_{ID}.txt, and displays only the first 2KB inline as a preview. The agent can then read the persisted file using the Read tool to access the complete output without losing data.

Test Results (2026-01-16, Claude Code 2.1.2)

A runtime test created files ranging from 25KB to 1MB and captured behavior across the threshold. Files up to 850KB were truncated inline. At 900KB–950KB, outputs became inconsistent (sometimes persisted, sometimes inline). At 1MB and above, the system consistently persisted to disk. The threshold is not a hard byte limit; it varies based on current context size and token count. The full output is never truncated, only the in-context representation.

Why It Matters

Large tool outputs routinely exceed context limits during development (logs, data exports, test output). Previously, the agent would lose the excess data; now it remains accessible throughout the session. The disk persistence saves roughly 28KB of context tokens per 1MB output (showing only 2KB preview instead of 30KB truncated content), freeing capacity for reasoning while preserving completeness.

Known Gaps

Binary output behavior and upper limits (10MB+) were not tested. Behavior with concurrent large outputs is untested. The threshold may drift with session state and future context-window changes.

Evidence & receipt
  • file2.1.2/tests/02-large-outputs/TEST-RESULTS.md
◇ ed25519 receipt
idprimitive_cb2489b44603d1ef93b4a54f
alged25519
pubkey9b87705613b1e2fd064d57fa75a6b679d2856ceafad6b1daa8f982493871b6dd
sig3ac8af2986ca28c5c953e113412ac75cc3e3d15d5d1d75d86480ef006b7288e82b9ed768aaa358ff4192240df99399c03cbed4f6a5aa51d37f04e013854d2504

Signed with an ed25519 key held off the repo. Anyone can verify against the published public key; nobody without the secret key can forge it. Click verify: it recomputes the signature in your browser. The signature proves integrity and authorship of this exact content — not a third-party timestamp or that the underlying claim is objectively true. signedAt is when the @f3/attest pipeline ran, not when the work happened; the evidence refs carry the source dates.

Connected