Replaces the content of old tool result messages with a small placeholder, preserving the message structure (and the assistant's tool call reasoning) so the model still sees that the tool was invoked.
This is the cheapest compaction strategy: no turns are dropped, only oversized historical payloads (large file reads, command output, etc.) are elided. Often enough on its own for coding agents.
Options
:keep_recent- number of trailing tool results to leave intact (default:5).:max_size- tool result payloads larger than this many bytes are elided when they fall outside the recent window (default:4096).
Example
MyApp.Agent.start_link(
compactor: {Condukt.Compactor.ToolResultPrune, keep_recent: 10, max_size: 2_000}
)