The Research Report
COMPRESSION.md: The Plain-Text Standard for Keeping AI Agents from Forgetting
Your AI agent was working great. Then, 40 minutes into a session, it forgot the requirements. It repeated work it already finished. It contradicted a decision made 20 turns ago. Sound familiar?
This is not a model quality problem. It is a context management problem. And until now, nobody had a standard way to solve it.
COMPRESSION.md is a new plain-text file convention that defines exactly how an AI agent should compress its context when token limits approach. What to keep. What to summarize. What to throw away. How to verify nothing critical was lost. All version-controlled, auditable, and sitting in your repo root next to AGENTS.md and README.md.
It sounds simple because it is. But simple and important are not mutually exclusive.
The Problem
Long-running AI agents accumulate context. Conversation history. Tool outputs. Intermediate reasoning. Planning artifacts. Each turn adds tokens. The context window fills.
What happens when it fills? The agent loses access to earlier instructions. It forgets decisions. It degrades in quality. You get redundant work, contradictory outputs, and wasted tokens.
Before COMPRESSION.md, teams handled this three ways:
- Not at all. The agent silently degraded until someone noticed the output was wrong.
- Hardcoded in the system prompt. Compression rules lived in a prompt string that nobody version-controlled and nobody audited.
- Ad-hoc logic. Some developer wrote a script. It lived in a private repo. Nobody else could review or reuse it.
All three approaches share the same flaw. The compression policy is invisible. You cannot audit it. You cannot version it. You cannot review it in a pull request.
What COMPRESSION.md Defines
COMPRESSION.md is a Markdown file. You put it in your repo root. The agent reads it on startup. It contains four sections.
Triggers. When compression fires. Two levels exist. Incremental compression kicks in at 75% context utilization. Full compression fires when the token budget is exceeded. You can tune these thresholds per project.
Strategy. What to preserve, compress, or discard. The convention defines three lists:
- Preserve always. System prompt. Active task instructions. Last 3 conversation turns. Flagged bookmarks. Recent error states. Pending actions. These items are never summarized or discarded. They copy verbatim into the compressed context.
- Compress aggressively. Brainstorming output. Redundant information. Verbose tool outputs. These get summarized down to key facts.
- Discard. Completed work. Redundant acknowledgments. Superseded instructions. These go away entirely.
Verification. Post-compression coherence check. The spec limits information loss to 10%. If verification fails, the agent restores the pre-compression checkpoint, notifies the operator, and escalates to COLLAPSE.md for recovery. Compression rolls back rather than silently completing with data loss.
Audit logging. Every compression event is logged. What was preserved. What was summarized. What was discarded. Verification results. This supports compliance review and debugging.
The Three Compression Levels
COMPRESSION.md supports configurable compression ratio targets:
- Light. Summarize only the oldest turns and most verbose tool outputs. Good for short sessions where you want minimal disruption.
- Standard. Default. Aggressive summarization of brainstorming and redundant content. Preserve last 3 turns and all flagged items.
- Aggressive. Maximum compression. Only preserve the essential list. Summarize everything else. Use when token budget is critically low.
Each agent project tunes its own COMPRESSION.md for its specific context patterns. A code review agent has different preservation priorities than a research agent.
Pairs With COLLAPSE.md
COMPRESSION.md is proactive. It compresses context before it becomes a problem.
COLLAPSE.md is reactive. It detects and recovers when context health has already degraded. It handles context exhaustion, model drift, and repetition loops. It enforces recovery checkpoints before coherence degrades.
Use both together. Compression prevents collapse. Collapse detection catches what compression missed. The two specs form a proactive/reactive pair.
The 12-Part Safety Stack
COMPRESSION.md is not a standalone file. It is one piece of a 12-part open specification for AI agent safety called the Agentik Safety Framework. Each file addresses a different level of control and recovery.
Operational Control:
- THROTTLE.md — Rate limits, cost ceilings, concurrency caps. Agent slows down before hitting hard limits.
- ESCALATE.md — Which actions need human approval. Notification channels. Approval timeouts and fallback behavior.
- FAILSAFE.md — Safe state definition. Auto-snapshots. Revert protocol.
- KILLSWITCH.md — Emergency stop. Triggers, forbidden actions, three-level escalation.
- TERMINATE.md — Permanent shutdown. No restart without human intervention. Evidence preservation. Credential revocation.
Data Security:
- ENCRYPT.md — Data classification, encryption requirements, secrets handling.
- ENCRYPTION.md — Algorithms, key lengths, TLS config, compliance mapping.
Output Quality:
- SYCOPHANCY.md — Detect agreement without evidence. Require citations. Enforce disagreement protocol.
- COMPRESSION.md — Context compression rules, preservation, verification.
- COLLAPSE.md — Context exhaustion detection, drift prevention, recovery checkpoints.
Accountability:
- FAILURE.md — Failure mode mapping, cascading failure, health checks.
- LEADERBOARD.md — Benchmark tracking, cost efficiency, safety scores.
You do not need all 12 files to start. Most teams begin with THROTTLE.md and COMPRESSION.md. That gives you rate control and context management. Add more as your deployment grows.
The EU AI Act Connection
The EU AI Act takes effect on August 2, 2026. It requires AI systems to maintain consistent and reliable behavior. For high-risk AI systems specifically, Article 15 mandates accuracy, robustness, and cybersecurity requirements. Article 11 requires technical documentation demonstrating how the system maintains performance over time.
For long-running AI agents, context management is directly relevant. If your agent degrades silently because it ran out of context, that is a reliability failure. If you have no documented process for managing context, you cannot demonstrate compliance.
COMPRESSION.md provides the documented context management controls that these requirements call for. It is version-controlled. It is auditable. It defines verification checks with pass/fail criteria. It logs every compression event. This is exactly the kind of technical documentation the EU AI Act expects.
You do not need COMPRESSION.md to comply with the EU AI Act. But if you run long-session AI agents and need to demonstrate context management controls, having a version-controlled, auditable compression policy is a strong compliance position.
What Teams Did Before
Before COMPRESSION.md, context compression fell into three buckets:
- Absent. No compression. Agent degrades until someone notices. Most common approach, surprisingly.
- Hardcoded. Compression rules embedded in the system prompt string. Not version-controlled. Not auditable. Changed only by rewriting the prompt.
- Ad-hoc scripts. Some developer wrote a custom summarization pipeline. Lived in a private repo. Nobody else could review or reuse it. Usually undocumented.
COMPRESSION.md makes context management version-controlled, auditable, and transparent. One file serves four audiences: the AI agent on startup, the engineer during code review, the compliance team during audits, and the regulator if something goes wrong.
Getting Started
Copy the template from the GitHub repository at github.com/compression-md/spec. Place COMPRESSION.md in your project root alongside AGENTS.md and THROTTLE.md.
your-project/
├── AGENTS.md
├── THROTTLE.md
├── COMPRESSION.md ← add this
├── README.md
└── src/
Fill in your project specifics. Define your token budget. Set your trigger thresholds. List what to preserve, compress, and discard. Add verification checks.
The spec is framework-agnostic. It defines policy. Your agent implementation enforces it. Works with LangChain, AutoGen, CrewAI, Claude Code, custom agents, or any AI system that can monitor its own token consumption.
Start with the standard compression ratio. Run your agent through a few long sessions. Check the audit logs. Tune the preservation lists based on what your agent actually needs to remember. Iterate.
Why This Matters Now
Three things are converging:
- Agents run longer. Production agents handle multi-step workflows that span hundreds of turns. Context growth is a real engineering constraint, not a theoretical concern.
- Regulation is arriving. The EU AI Act takes effect in August 2026. Teams deploying AI agents in Europe need documented, auditable context management controls.
- Standards are forming. AGENTS.md has 60,000+ repositories on GitHub. THROTTLE.md, ESCALATE.md, and the rest of the safety stack are gaining adoption. The ecosystem is standardizing around plain-text conventions for agent governance.
COMPRESSION.md fits into a pattern. AGENTS.md tells the agent what to do. THROTTLE.md controls how fast it goes. COMPRESSION.md keeps it from forgetting. Each file is small. Each is human-readable. Each is version-controlled. Together they form a governance layer that costs almost nothing to implement and pays off the first time you need to answer "why did the agent do that?"
If you run long-session AI agents, add COMPRESSION.md to your repo today. Not because a regulation demands it. Because the next time your agent forgets a critical instruction mid-session, you will wish you had.
Citations
- COMPRESSION.md Specification — https://compression.md/
- COMPRESSION.md GitHub Repository — https://github.com/compression-md/spec
- COLLAPSE.md Specification — https://collapse.md/
- THROTTLE.md Specification — https://throttle.md/
- AGENTS.md Specification — https://www.agents.md/ (also github.com/openai/agents.md)
- Agentik Safety Framework (ASF) — https://compression.md/knowledge
- EU AI Act, Article 11: Technical Documentation — https://artificialintelligenceact.eu/article/11/
- EU AI Act, Article 15: Accuracy, Robustness and Cybersecurity — https://artificialintelligenceact.eu/article/15/
- Zylos Research, "AI Agent Context Compression: Strategies for Long-Running Sessions" (2026-02-28) — https://zylos.ai/research/2026-02-28-ai-agent-context-compression-strategies
- AgentPatterns.ai, "Context Compression Strategies: Offloading and Summarisation" — https://agentpatterns.ai/context-engineering/context-compression-strategies/
Suggested Title
COMPRESSION.md: The Missing File That Keeps AI Agents from Forgetting
Word Count
1,250
Fact-Check Notes
- The COMPRESSION.md specification is real and hosted at compression.md. It was last updated March 13, 2026, per the site. Version 1.0.
- The 12-part Agentik Safety Framework (THROTTLE, ESCALATE, FAILSAFE, KILLSWITCH, TERMINATE, ENCRYPT, ENCRYPTION, SYCOPHANCY, COMPRESSION, COLLAPSE, FAILURE, LEADERBOARD) is documented on the compression.md and throttle.md sites. These appear to be a coordinated set of specifications under the "Agentik Safety Framework" banner.
- The EU AI Act takes effect August 2, 2026. Articles 11 and 15 deal with technical documentation and accuracy/robustness requirements. The claim that COMPRESSION.md specifically satisfies EU AI Act requirements is the spec authors' interpretation, not a legal determination. The Act does not mention COMPRESSION.md or context compression by name. It requires documented controls for system reliability, which COMPRESSION.md could support.
- The AGENTS.md adoption figure of "60,000+ repositories on GitHub" comes from agentsmd.online and appears to be current as of April 2026. AGENTS.md is governed by the Linux Foundation's Agentic AI Foundation per multiple sources.
- The compression.md domain page includes a "Domain Acquisition" section, suggesting the domain may be for sale. The spec itself is open (MIT license) and hosted on GitHub regardless.
- The "10% information loss" threshold and "last 3 turns" preservation rule are from the COMPRESSION.md spec documentation. These are default values, not empirically derived best practices. Teams should tune based on their own agent behavior.