{
 "id": "context-compaction",
 "name": "Context compaction",
 "aliases": [
  "compaction",
  "trajectory folding",
  "compact mode"
 ],
 "definition_md": "**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.",
 "step": "read",
 "related_protocols": [
  "mcp",
  "llms-txt",
  "cloudflare-markdown-for-agents"
 ],
 "sources": [
  {
   "url": "https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/",
   "date": "2026-09-05",
   "label": "VERIFIED"
  },
  {
   "url": "https://agenticweb.wiki/AGENTS.md",
   "date": "2026-10-15",
   "label": "VERIFIED"
  }
 ],
 "part_of": null,
 "group": null,
 "url": "https://agenticweb.wiki/terms/context-compaction/",
 "okf_url": "https://agenticweb.wiki/okf/terms/context-compaction.md",
 "category": "read",
 "type": "term"
}