# Context compaction keep or drop

> Context compaction keep or drop is an open-source agent skill for developer tools. Trims a long agent session by keeping, dropping or pointing to each context chunk. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/mrmps/classifier-dev/tree/main/skills/_rejected/context-compaction-keep-or-drop
- **Repository:** https://github.com/mrmps/classifier-dev
- **GitHub stars:** 440
- **License:** MIT
- **Skill name:** context-compaction-keep-or-drop
- **Collection:** https://github.com/mrmps/classifier-dev
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill gives an agent a way to shrink a crowded session without summarising it. Each context chunk, such as a tool result, message or file read, is labelled as keep, drop or replace-with-a-pointer, and the kept chunks are passed through unchanged. Every chunk gets a ledger row with a short checksum and a refetch command, so a dropped or pointered item can be retrieved later.

The workflow runs in two stages. Chunks that contain bearer text, keys, tokens, passwords, armoured blocks or NAME=value lines are labelled by a local rule and never leave the machine. Other chunks are redacted for secret-like fields, long strings and email addresses, then sent to a hosted classifier with the current task, and the returned scores decide the label. The skill sets a higher bar for dropping than for pointing, because dropping cannot be undone inside the session.

The included Python sketch needs Python with network access to the classifier endpoint, and it expects the agent to supply chunks with an id, text, head, live flag and refetch command. The skill's own notes state that the hosted service forwards input text to a model provider, so teams with confidential transcripts should run the same three labels on the agent's own model instead.

## When your agent uses it

> Label each context chunk keep, drop or replace-with-a-pointer and pass the survivors through byte for byte instead of summarising, with key-shaped chunks decided locally and never sent, and a checksum row per chunk. Use when a session runs out of room, or on "compact" or "trim the history".

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/mrmps/classifier-dev/tree/HEAD/skills/_rejected/context-compaction-keep-or-drop)
- [License: MIT](https://github.com/mrmps/classifier-dev/tree/HEAD/skills/_rejected/context-compaction-keep-or-drop)

## Features

- **Three-way chunk labels:** Each context chunk is marked keep, drop or replace with a pointer based on whether its exact text is needed for the current task.
- **Verbatim survivors:** Kept chunks are passed through byte for byte rather than rewritten into a summary.
- **Local sensitive-data rule:** Chunks holding keys, tokens, passwords or armoured blocks are labelled on the machine and are not sent out.
- **Redaction before sending:** Bearer headers, key-named fields, long strings and email addresses are replaced with placeholders before any classification request.
- **Checksum ledger:** Each chunk gets a ledger row with a truncated SHA-256 digest, its score and a refetch command, and the run asserts that no row is lost.
- **Asymmetric thresholds:** Dropping requires a high score, pointers need a moderate score, and anything uncertain stays in context.

## Good for

- Free up room in a long coding session without losing the exact error output needed for the fix
- Trim a session history while keeping a checksum and refetch command for dropped tool results
- Decide which earlier file reads and command outputs still matter for the current debugging task
- Compact an agent transcript that contains credentials without sending those lines to a remote service

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/context-compaction-keep-or-drop` to use it in all your projects:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mrmps/classifier-dev.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/context-compaction-keep-or-drop &&
cp -R "$tmp/skills/_rejected/context-compaction-keep-or-drop" ~/.claude/skills/context-compaction-keep-or-drop &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/context-compaction-keep-or-drop` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/context-compaction-keep-or-drop` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mrmps/classifier-dev.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/context-compaction-keep-or-drop &&
cp -R "$tmp/skills/_rejected/context-compaction-keep-or-drop" ~/.agents/skills/context-compaction-keep-or-drop &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/context-compaction-keep-or-drop` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/context-compaction-keep-or-drop` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mrmps/classifier-dev.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/context-compaction-keep-or-drop &&
cp -R "$tmp/skills/_rejected/context-compaction-keep-or-drop" ~/.cursor/skills/context-compaction-keep-or-drop &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/context-compaction-keep-or-drop` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/mrmps/classifier-dev.git --path skills/_rejected/context-compaction-keep-or-drop
```

Or copy the folder to `~/.gemini/skills/context-compaction-keep-or-drop` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/context-compaction-keep-or-drop`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mrmps/classifier-dev.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/context-compaction-keep-or-drop &&
cp -R "$tmp/skills/_rejected/context-compaction-keep-or-drop" ~/.copilot/skills/context-compaction-keep-or-drop &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/context-compaction-keep-or-drop` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/mrmps/classifier-dev.git
```

Then copy `classifier-dev/skills/_rejected/context-compaction-keep-or-drop` into your agent's skills folder as `context-compaction-keep-or-drop`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Context compaction keep or drop trigger?

It is meant for sessions that run out of room, or when the user says compact or trim the history.

### Does Context compaction keep or drop summarise the conversation?

No. It labels each chunk and passes kept chunks through unchanged, and the skill states that summarising is what it avoids.

### Are secrets sent to the classifier?

Chunks with bearer text, keys, tokens, secrets, passwords, armoured blocks or NAME=value lines are labelled locally and never sent. Other chunks are redacted before sending.

### What does Context compaction keep or drop need to run?

The example is Python using only the standard library, plus network access to the classifier endpoint at classifier.dev. The skill notes that the service forwards input text to a model provider.

### How do I install Context compaction keep or drop in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/context-compaction-keep-or-drop to use it in all your projects, or to .claude/skills/context-compaction-keep-or-drop in one project.

### Does Context compaction keep or drop run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Context compaction keep or drop?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Context compaction keep or drop?

The closest alternatives to Context compaction keep or drop are Context engineering, Principle guard the context window, Note, Context manager and Entroly context control.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Context engineering](https://ai-powered.com/skills/context-engineering): Context engineering is an open-source agent skill for developer tools.
- [Principle guard the context window](https://ai-powered.com/skills/principle-guard-the-context-window): Principle guard the context window is an open-source agent skill for developer tools.
- [Note](https://ai-powered.com/skills/note): Note is an open-source agent skill for developer tools.
- [Context manager](https://ai-powered.com/skills/context-manager): Context manager is an open-source agent skill for developer tools.
- [Entroly context control](https://ai-powered.com/skills/entroly-context-control): Entroly context control is an open-source agent skill for developer tools.
- [Context budget](https://ai-powered.com/skills/context-budget): Context budget is an open-source agent skill for developer tools.
- [Context strategy](https://ai-powered.com/skills/context-strategy): Context strategy is an open-source agent skill for developer tools.
- [Subagent brief](https://ai-powered.com/skills/subagent-brief): Subagent brief is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/context-compaction-keep-or-drop
