PrepGenAICerts

Tool-Output Pruning and Compaction

Core

Apply context curation techniques: pruning, compaction, isolation, and retrieval · Difficulty 2/5

0%
pruningcompactiontool-outputtruncation

Explanation

Tool-Output Pruning

After a tool returns a large payload, keep only what later steps actually need; drop raw dumps from the ongoing history. A verbose tool result that was necessary to inspect once does not need to persist in full for the rest of the session.

Compaction

Periodically summarize older turns into a compact recap and continue from it, reclaiming budget while preserving the thread. This is how long agent sessions avoid drift -- rather than carrying the entire transcript forward indefinitely, the session's history is condensed into what still matters.

Compaction vs. Truncation

Compaction is not the same as truncation. Compaction summarizes to reclaim budget while preserving the thread; truncation blindly drops tokens and can lose critical facts the task still depends on.

Common exam traps

  • Confusing compaction (summarize to reclaim budget) with simply truncating (dropping tokens blindly, which can lose critical facts). They look similar in effect (context shrinks) but differ sharply in whether meaning is preserved.

Key Takeaways

  • Prune large tool payloads down to what later steps actually need; don't carry raw dumps in history
  • Compaction summarizes older turns into a compact recap, reclaiming budget while preserving the thread
  • Compaction is not the same as truncation -- truncation blindly drops tokens and can lose critical facts
  • Compaction is the mechanism that lets long agent sessions avoid drift

Glossary Terms

Related Concepts

PrepGenAICerts.com is an independent third-party exam-prep platform for the Claude Certified Architect (CCA-F) certification. We are not affiliated with, endorsed by, or acting on behalf of Anthropic PBC.

Note: New premium upgrades are temporarily paused while we resolve an issue with our payment provider. Existing premium members retain full access.