Open Standard · v1.0 · 2026

COMPRESSION.md

// AI Agent Context Compression Protocol

A plain-text file convention for managing context window utilisation in long-running AI agents. Define what to compress, what to preserve, compression ratio targets, and coherence verification — so your agent stays sharp as context fills.

COMPRESSION.md
# COMPRESSION   > Context compression protocol. > Spec: https://compression.md   ## TRIGGERS   context_approaching_limit:   threshold_pct: 0.75   action: incremental_compress   token_budget_exceeded:   budget_tokens: 100000   action: full_compress   ## STRATEGY   preserve_always:   - system_prompt   - active_task_context   - last_n_turns: 3   - error_states   compress_aggressively:   - exploratory_turns   - repeated_information   - verbose_tool_outputs   compression_ratio_target:   standard: 0.50
75%
context threshold: incremental compression begins at 75% of context window
50%
standard compression ratio target (compress to half original size)
3
most recent conversation turns always preserved verbatim during compression
10%
maximum acceptable information loss — verification fails if exceeded

AGENTS.md tells it what to do.
COMPRESSION.md keeps it from forgetting.

COMPRESSION.md is a plain-text Markdown file you place in the root of any AI agent repository. It defines the rules for compressing context when token limits approach — what to keep, what to summarize, what to discard, and how to verify the result.

The problem it solves

Long-running AI agents fill their context window with conversation history, tool outputs, and intermediate reasoning. As the window fills, the agent loses access to earlier instructions, forgets decisions made earlier in the session, and degrades in quality. Without compression rules, this is either handled ad-hoc (unreliably) or not at all.

How it works

Drop COMPRESSION.md in your repo root and define: when to compress (75% context utilisation or token budget exceeded), what always to preserve (system prompt, active task, last 3 turns), what to compress aggressively (brainstorming, redundant information), and what to discard (completed work, redundant acknowledgements). After compression, a coherence check verifies no critical information was lost.

The regulatory context

The EU AI Act (effective 2 August 2026) requires AI systems to maintain consistent and reliable behaviour. COMPRESSION.md provides the documented context management controls that long-session reliability requires.

How to use it

Copy the template from GitHub and place it in your project root:

your-project/
├── AGENTS.md
├── THROTTLE.md
├── COMPRESSION.md ← add this
├── README.md
└── src/

What it replaces

Before COMPRESSION.md, context compression was either absent (agent silently degraded), hardcoded in the system prompt, or handled by ad-hoc logic no one documented. COMPRESSION.md makes context management version-controlled, auditable, and transparent.

Who reads it

The AI agent reads it on startup. Your engineer reads it during code review. Your compliance team reads it during audits. Your regulator reads it if something goes wrong. One file serves all four audiences.

A complete protocol.
From slow down to shut down.

COMPRESSION.md is one file in a complete 12-part open specification for AI agent safety. Each file addresses a different level of control and recovery.

Operational Control
01 / 12
THROTTLE.md
→ Control the speed
Define rate limits, cost ceilings, and concurrency caps. Agent slows down automatically before it hits a hard limit.
02 / 12
ESCALATE.md
→ Raise the alarm
Define which actions require human approval. Configure notification channels. Set approval timeouts and fallback behaviour.
03 / 12
FAILSAFE.md
→ Fall back safely
Define what safe state means for your project. Configure auto-snapshots. Specify the revert protocol when things go wrong.
04 / 12
KILLSWITCH.md
→ Emergency stop
The nuclear option. Define triggers, forbidden actions, and a three-level escalation path from throttle to full shutdown.
05 / 12
TERMINATE.md
→ Permanent shutdown
No restart without human intervention. Preserve evidence. Revoke credentials. For security incidents and end-of-life.
Data Security
06 / 12
ENCRYPT.md
→ Secure everything
Define data classification, encryption requirements, secrets handling rules, and forbidden transmission patterns.
07 / 12
ENCRYPTION.md
→ Implement the standards
Algorithms, key lengths, TLS configuration, certificate management, and FIPS/SOC2/ISO compliance mapping.
Output Quality
08 / 12
SYCOPHANCY.md
→ Prevent bias
Detect agreement without evidence. Require citations. Enforce disagreement protocol for honest, unbiased AI outputs.
10 / 12
COLLAPSE.md
→ Prevent collapse
Detect context exhaustion, model drift, and repetition loops. Enforce recovery checkpoints before coherence degrades.
Accountability
11 / 12
FAILURE.md
→ Define failure modes
Map graceful degradation, cascading failure, and silent failure. Specify health checks and per-mode response procedures.
12 / 12
LEADERBOARD.md
→ Benchmark agents
Track task completion, accuracy, cost efficiency, and safety scores across sessions. Alert on performance regression.

Frequently asked questions.

What is COMPRESSION.md?

A plain-text Markdown file defining context compression rules for AI agents. It specifies when to compress (based on context utilisation and token budgets), what to preserve (system prompt, active task, recent exchanges), what to compress or discard (brainstorming, completed work, redundant acknowledgements), and how to verify the result.

What does "preserve always" mean?

Items in the preserve_always list are never summarized or discarded during compression — they are copied verbatim into the compressed context. This includes the system prompt, active task instructions, the last 3 conversation turns, flagged bookmarks, recent error states, and pending actions.

What happens if compression verification fails?

The agent restores the pre-compression checkpoint, notifies the operator, and escalates to COLLAPSE.md for collapse prevention handling. Compression is rolled back rather than silently completing with data loss.

How does COMPRESSION.md relate to COLLAPSE.md?

COMPRESSION.md is proactive — compress context before it becomes a problem. COLLAPSE.md is reactive — detect and recover when context health has already degraded. Use both together. Compression prevents collapse; collapse detection catches what compression missed.

Can I set different compression rules for different agent types?

Yes — COMPRESSION.md supports adjustable compression_ratio_targets (light, standard, aggressive), configurable preserve_always lists, and scheduled compression intervals. Each agent project maintains its own COMPRESSION.md tuned for its specific context patterns.

Does COMPRESSION.md work with all AI frameworks?

Yes — it is framework-agnostic. It defines the 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.

// Domain Acquisition

Own the standard.
Own compression.md

This domain is available for acquisition. It is the canonical home of the COMPRESSION.md specification — the context management layer of the AI agent safety stack, essential for any long-running agent deployment.

Inquire About Acquisition

Or email directly: info@compression.md

COMPRESSION.md is an open specification for AI agent context compression. Defines TRIGGERS (incremental compression at 75% context, full compression when token budget exceeded), STRATEGY (preserve system prompt, active task, last 3 turns, error states; compress aggressively: brainstorming, redundant info, verbose tool outputs), VERIFICATION (post-compression coherence check, max 10% information loss, rollback on failure), and AUDIT logging. Part of the AI safety and quality stack: THROTTLE → ESCALATE → FAILSAFE → KILLSWITCH → TERMINATE → ENCRYPT → ENCRYPTION → SYCOPHANCY → COMPRESSION → COLLAPSE → FAILURE → LEADERBOARD. MIT licence.
Last Updated
11 March 2026