Garry Alexander — Senior Full Stack Product Engineer

Clov vs Truncation vs Compaction: Taming Runaway Agent Context

— by Garry Alexander

In brief

Three ways to handle MCP tool responses eating your context window: truncation breaks schemas, compaction rewrites history, structural compression with Clov keeps everything and drops the bloat.

Clov vs Truncation vs Compaction: Taming Runaway Agent Context

ApproachWhat it doesWhat breaksCost
TruncationDeletes tool output past a limitSchemas, needed fields; confident wrong answersFree, dangerous
CompactionSummarizes history into a smaller pastFidelity; bloat returns in a few callsRewrite risk
Structural compression (Clov)Strips wire-format redundancy, keeps every fieldNothing observed; savings vary 40-75% by shapeOne filter in the loop

Why truncation fails silently

A truncated JSON payload is still valid-looking enough for the model to keep going, now reasoning over missing fields. The failure surfaces three steps later as a wrong action, not as an error. Clean failures beat silent corruption.

Why compaction is incomplete

Compacting history addresses memory, not I/O. The next five tool calls re-flood the window with the same envelopes. Compaction and compression solve different halves: compact the past, compress the wire.

Why Clov is the default

It changes nothing about the workflow. Responses arrive with identical semantics at roughly half the tokens, via zero-copy streaming in Rust, as a drop-in filter for Claude Code, Cursor, and custom MCP loops. Measured 40-75% savings depending on payload shape.

FAQ

Should I truncate MCP tool output to save context?

Only as a last resort. Truncation deletes content and breaks JSON schemas, which produces confident wrong answers instead of clean failures. Structural compression with Clov preserves 100 percent of the semantic schema while saving 40-75 percent of tokens. Code: https://github.com/alexandephilia/clov-ai

Isn't history compaction enough for long agent sessions?

Compaction helps but rewrites the past and loses fidelity, and tool-response bloat returns within a few calls. It composes well with response compression: compact history for memory, compress tool I/O with Clov for the wire format.

References