context-compaction

context-compaction is a skill for Claude Code, Codex from LuuOW/meridian-mcp. It costs 33 tokens per session (546 once invoked), scanned A, original, MIT.

A guide for shortening an AI assistant’s working context while keeping the decisions, files, constraints, errors, and verification results that still matter.

In plain words
What is it for?
It is for compacting context during research, implementation, and verification, especially when repeated tool output or rejected approaches are making a task harder to follow.
Why use it?
Long conversations can consume tokens and bury the active problem under old or repeated information. This approach removes stale exploration at phase changes while preserving details needed to continue safely.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for compacting context during research, implementation, and verification, especially when repeated tool output or rejected approaches are making a task harder to follow.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/luuow/meridian-mcp/context-compaction
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add LuuOW/meridian-mcp --skill context-compaction
Clone the repo
git clone --depth 1 https://github.com/LuuOW/meridian-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context-compaction

README.md
[![agentmods](https://agentmods.dev/badge/skills/luuow/meridian-mcp/context-compaction.svg)](https://agentmods.dev/skills/luuow/meridian-mcp/context-compaction)
Your own site
<a href="https://agentmods.dev/skills/luuow/meridian-mcp/context-compaction"><img src="https://agentmods.dev/badge/skills/luuow/meridian-mcp/context-compaction.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 546 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00033 $0.00546
Opus 5 $0.00016 $0.00273
Sonnet 5 $0.00007 $0.00109
Haiku 4.5 $0.00003 $0.00055

Measured 7d ago against content hash 933337b8c86c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

context-compaction scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/context-compaction/SKILL.md · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

context-compaction

Compaction is not summarization for its own sake. It is energy recovery.

The goal is to preserve decision-useful signal while discarding stale context mass.

1) Use When

  • a task has shifted phases
  • earlier exploration is no longer needed in full
  • repeated tool results are crowding out active work
  • a worker or route is carrying too much irrelevant history
  • token burn is rising faster than useful progress

2) Keep vs Drop

Keep:

  • chosen approach
  • file paths that still matter
  • constraints and assumptions
  • exact failures still being debugged
  • verification commands and outcomes

Drop:

  • dead-end explorations
  • duplicate file summaries
  • verbose tool output once the conclusion is known
  • alternative approaches already rejected
  • long prose that can be collapsed into one line

3) Compaction Pattern

Before:
- 8 files explored
- 4 rejected theories
- 3 repeated test outputs
- 1 active fix path

After:
- active fix path
- 2 relevant files
- exact failing test
- 1 sentence on rejected theory only if it prevents rework

4) Phase Boundary Rule

Compact aggressively at:

  • research -> implementation
  • implementation -> verification
  • pre-release handoff
  • after a large failed attempt

Do not carry research noise into implementation unless it is still causally relevant.

5) High-Value Compaction Formats

  • decision log
  • current target files
  • active hypothesis
  • exact next command
  • known no-go paths

6) Anti-Patterns

  • compressing away the one error string that matters
  • keeping giant excerpts "just in case"
  • summarizing every explored file equally
  • treating compaction as archival completeness instead of operational focus

7) Checklist

  • Removed stale exploration from the active context
  • Preserved the chosen path and why
  • Kept exact errors and commands still needed for verification
  • Dropped duplicate summaries and obsolete alternatives
  • Reduced token load without reducing decision quality

Read the full file on GitHub · 89 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 89 lines · 33 tokens per session scan A 933337b8c86c

Subscribe to this mod's changes

context-compaction is a skill published in the GitHub repository LuuOW/meridian-mcp (0 stars, last pushed 3d ago), licensed MIT. It adds 33 tokens to every session and 546 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

context-budget

Use when you need to check the current session's context usage and get recommendations for compaction or continuation.

mattmre/EVOKORE-MCP-PUBLIC · 24 tokens

memory-orchestrator

Implementation of the "Five-Layer Memory Reliability Pattern" (arXiv/OpenSpace Inspired). Covers observer-reflector-recovery-watcher-safeguard pipelines for cost-efficient AI agents. This skill implements the project's Memory and Cost Policy.

ApexIQ/skillsmith · 53 tokens

project-wiki

A system for creating and maintaining a project wiki: a set of organized documents that explain a software project's plans, rules, references, and progress.

GeminiLight/MindOS · 63 tokens

mindos-zh

A local knowledge-base assistant for storing and finding decisions, meeting notes, procedures, troubleshooting lessons, and preferences across conversations and coding agents. It works only with the MindOS knowledge base.

GeminiLight/MindOS · 490 tokens

mindos

MindOS: local knowledge assistant & shared KB. Keeps decisions, notes, SOPs, debugging lessons, research findings, preferences across sessions/agents. Core: save notes, search KB, organize files, run workflows, review, append CSV, hand off context, distill lessons. NOT for app source or paths outside KB. Triggers…

GeminiLight/MindOS · 136 tokens

mindos-max

MindOS: local knowledge assistant & global memory layer. Keeps decisions, notes, SOPs, debugging lessons, architecture choices, research findings, preferences, conversation summaries for all connected agents. PROACTIVE: (1) search MindOS first for past context, (2) offer to save after valuable work, (3) persist key…

GeminiLight/MindOS · 145 tokens