---
type: Glossary Term
title: "Context compaction"
description: "Context compaction is the set of protocol and runtime patterns used to keep an AI agent's working context window bounded across multi-turn tool invocations—preventing attention degradation and redundant token spend."
resource: "https://agenticweb.wiki/terms/context-compaction/"
tags: ["glossary", "read"]
status: stable
generated: { by: agenticweb-builder/1.0, at: 2026-10-23T00:00:00Z }
verified: { by: process:agenticweb-engine, at: 2026-10-23T00:00:00Z }
stale_after: 2026-11-22T00:00:00Z
sources:
  - id: ref-1
    resource: "https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/"
    last_modified: 2026-09-05T00:00:00Z
  - id: ref-2
    resource: "https://agenticweb.wiki/AGENTS.md"
    last_modified: 2026-10-15T00:00:00Z
---

# Context compaction

**Context compaction** is the set of protocol and runtime patterns used to keep an AI agent's working context window bounded across multi-turn tool invocations—preventing attention degradation and redundant token spend. On the network side, agentic protocols support compaction by serving **Markdown twins** (`Accept: text/markdown` instead of raw DOM HTML), exposing `compact: true` projections on verbose discovery/probe tools, and isolating noisy exploratory searches inside disposable **subagents** that return only structured summaries to the parent trajectory. Used by: mcp, llms-txt, cloudflare-markdown-for-agents.

# Knowledge Graph

* **Related standards**: [Model Context Protocol](/okf/protocols/mcp.md), [llms.txt](/okf/protocols/llms-txt.md), [Markdown for Agents](/okf/protocols/cloudflare-markdown-for-agents.md)

[^ref-1]: https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/ (https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/)
[^ref-2]: https://agenticweb.wiki/AGENTS.md (https://agenticweb.wiki/AGENTS.md)
