Chapter 37: Tiered Compression

Compression quality comes from preserving decision value, not from maximizing characters removed.

Public-source snapshot: implementation details are examples from public Kocoro origin/main at commit 4ec6772, reviewed 2026-07-27. Treat the invariant as the lesson and re-check constants against current source.

37.1 The problem

Uniform truncation treats the result needed for the next decision exactly like stale output from twenty steps ago. It also destroys read/search payloads whose content—not metadata—is the reason the tool was called.

37.2 The design rule

Keep the newest evidence intact, compress middle-aged large results into semantic summaries or head-and-tail excerpts, and reduce truly old results to metadata. Give content-bearing inspection tools a Tier-2 floor. Limit semantic work per pass so compression does not become a hidden cascade of model calls.

37.3 Snapshot evidence

Source snapshotObservation
4ec6772newest 8 tool-result messages remain full
4ec6772distance 8-19 uses Tier 2; distance 20+ uses Tier 1, except content-bearing inspection and browser tools, which keep a Tier-2 floor
4ec6772Tier-2 semantic threshold: 2,000 chars; compressed fallback cap: 300 chars

The values above describe one dated implementation, not a universal contract.

37.4 Implementation checklist

  • Classify tools by whether content remains decision-relevant.
  • Preserve tool-call/result pairing after rewrites.
  • Measure added summary calls and cache impact.

37.5 Takeaway

Compression quality comes from preserving decision value, not from maximizing characters removed.

Read these chapters as one system: context, tool schemas, persistence, steering, time discipline, loop detection, and concurrency affect one another.

Cite this article
Zhang, Wayland (2026). Chapter 37: Tiered Compression. In AI Agent Architecture: From Single Agent to Enterprise Multi-Agent Systems. https://waylandz.com/ai-agent-book-en/chapter-37-tiered-compression/
@incollection{zhang2026aiagent_en_chapter-37-tiered-compression,
  author = {Zhang, Wayland},
  title = {Chapter 37: Tiered Compression},
  booktitle = {AI Agent Architecture: From Single Agent to Enterprise Multi-Agent Systems},
  year = {2026},
  url = {https://waylandz.com/ai-agent-book-en/chapter-37-tiered-compression/}
}