Agent skill

Context Compaction Keep Or Drop

by mrmps in mrmps/classifier-dev

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…

MITAuto-check passedAgent Workflows

Install Context Compaction Keep Or Drop

skills CLI
$ npx skills add mrmps/classifier-dev --skill context-compaction-keep-or-drop -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mrmps/classifier-dev context-compaction-keep-or-drop --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mrmps/classifier-dev.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/_rejected/context-compaction-keep-or-drop .claude/skills/context-compaction-keep-or-drop && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
context-compaction-keep-or-drop
GitHub stars
424
Token cost
~1.5k tokens
SKILL.md length
493 words
Files
1
Skills in repo
21
Repo updated
First seen
Licence
MIT

At a glance

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…

  • A session runs out of room
  • SKILL.md covers What leaves the machine, Chunk, classify, ledger, Two thresholds, deliberately… and Pitfalls, plus 1 more section
  • Reaches classifier.dev
  • Trim the history

What it does

Context Compaction Keep Or Drop is an agent skill from mrmps/classifier-dev. 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".

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Context engineering. It works with Bash. The repository describes itself as: Zero-shot text classification over plain HTTP — no API key, no account. One Cloudflare Worker, a CLI, and an MCP server. https://classifier.dev. The licence is MIT.

When your agent uses it

  • A session runs out of room
  • Trim the history

Example prompts

  • “compact”
  • “trim the history”
  • “/context-compaction-keep-or-drop”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 629df75. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • classifier.dev

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Context Compaction Keep Or Drop loads about 1.5k tokens when it runs. Until then it costs about 81 tokens; SKILL.md has 493 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~81
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mrmps/classifier-dev at commit 629df75, republished under its MIT licence (© mrmps). 493 words, ~1,511 tokens.

Download SKILL.mdSave it as .claude/skills/context-compaction-keep-or-drop/SKILL.md (or your agent's skills folder).
name
context-compaction-keep-or-drop
description
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".
license
MIT

Compact by deciding, not by summarising

A summary rewrites the one line you needed into a sentence about it. Label each chunk instead and pass the keepers through unchanged: verbatim in, verbatim out.

What leaves the machine

Never the transcript. Per chunk, a header line and at most its first 2,000 characters, redacted, and only if it passes a local rule:

  • Decided here, never sent. A chunk holding bearer text, a key, token, secret or password word, an armoured block or NAME=value lines is labelled by rule: kept if it is part of the live step, dropped if not, as local.

  • Redacted, then sent. The rest has bearer headers, fields named for a key, token, secret or password, runs of 40 characters or more and mail addresses replaced by a placeholder. Past two placeholders it falls back to the rule above.

    in   curl -H 'authorization: Bearer tok_9f2a7c31d4' https://api.example.com/charges
    out  curl -H 'authorization: Bearer [redacted]' https://api.example.com/charges

The service states that it stores no input text, and forwards it to the model provider that answers: https://classifier.dev/privacy. Read that against your policy. If the transcript is confidential, put none of it on a network: ask the agent's own model the same three labels with the same thresholds. Only who answers changes.

Chunk, classify, ledger

A chunk is one tool result, message or file read, with a header naming it and how to fetch it again. Every chunk gets a ledger row, and the assertion fails if one is lost.

python
import hashlib, json, re, urllib.request

LABELS = ["keep in context, the current task needs the exact text",
          "drop, it is noise or already superseded",
          "replace with a pointer, it can be fetched again if needed"]
KEEP, DROP, POINTER = LABELS

SENSITIVE = re.compile(r"\b(bearer|api[_-]?key|token|secret|password)\b"
                       r"|-{5}BEGIN|^[A-Z_]{3,}=\S+$", re.I | re.M)
REDACT = [(re.compile(r"\b(bearer|basic)\s+[^\s'\"]+", re.I), r"\1 [redacted]"),
          (re.compile(r"([\w.-]*(?:key|token|secret|password)[\w.-]*)\s*[=:]\s*\S+", re.I), r"\1=[redacted]"),
          (re.compile(r"\b[A-Za-z0-9_-]{40,}\b"), "[redacted]"),
          (re.compile(r"\b[\w.+-]+@[\w-]+\.[\w.]+\b"), "[redacted]")]

digest = lambda t: hashlib.sha256(t.encode("utf-8")).hexdigest()[:12]

def local(chunk):                    # decided here, never sent
    t = chunk["head"]
    for rx, to in REDACT: t = rx.sub(to, t)
    if SENSITIVE.search(chunk["head"]) or t.count("[redacted]") > 2:
        return (KEEP if chunk["live"] else DROP), t
    return None, t

def classify(texts, task):
    body = json.dumps({"labels": LABELS, "inputs": [t[:2000] for t in texts],
        "instructions": f"The current task is: {task}. Judge each chunk only "
                        "by whether its exact text is needed to finish it."}).encode()
    req = urllib.request.Request("https://classifier.dev/v1/classify", data=body,
        headers={"content-type": "application/json", "user-agent": "compact/1"})
    return json.load(urllib.request.urlopen(req))["results"]

def compact(chunks, task):
    held = [local(c) for c in chunks]
    send = [i for i, (v, _) in enumerate(held) if v is None]
    got = dict(zip(send, classify([held[i][1] for i in send], task) if send else []))
    kept, ledger = [], []
    for i, (c, (v, _)) in enumerate(zip(chunks, held)):
        score = "local"
        if v is None:
            s = got[i]["scores"]
            v = DROP if s[DROP] >= 0.9 else POINTER if s[POINTER] >= 0.5 else KEEP
            score = s[v]                                # unsure keeps
        ledger.append({"id": c["id"], "sha": digest(c["text"]), "score": score,
                       "verdict": v.split(",")[0], "refetch": c["refetch"]})
        if v == KEEP: kept.append(c["text"])        # verbatim, not rewritten
        elif v == POINTER:
            kept.append(f"[{c['id']} {digest(c['text'])} refetch: {c['refetch']}]")
    assert len(ledger) == len(chunks)
    return kept, ledger

Four of ten rows, task "fix a double charge in the retry path":

Bash#14      e8428025c464  drop                    0.9
Bash#19      0652466c0d6d  keep in context         local
Grep#8       a09ee1f0a8ae  replace with a pointer  0.62
Read#7       7ddbe075eee8  drop                    local
10 chunks in, 8 sent, 6 kept

Bash#19 was a worker environment block, Read#7 a scratch file with a bearer header: both decided by rule, neither left the machine.

Show full SKILL.md (184 more words)Show less

Two thresholds, deliberately different

The classifier returns labels, scores and a calibrated confidence, and writes nothing. The usual rule is act at 0.9 and above, look again from 0.5 to 0.9, escalate below. Here the reversible and irreversible outcomes get different bars: drop at 0.9 and above only, since dropping is the one move you cannot undo from inside the session; pointer at 0.5 and above, since it keeps the id, checksum and refetch command; the rest is kept. Threshold on scores[label], not confidence, which is the top label's.

Pitfalls

  • Name the labels in full. Shortened to keep and drop, these chunks scored an install log 0 to drop where the full ones gave 0.9.
  • Scores do not validate chunks: a minified bundle or hash still receives the model's preference among your labels. Give each a descriptive header or add a label that covers it.

When not to use

Skip it when you are not near the limit, when the harness already compacts, or when everything in context is cheap to refetch. If losing anything is unacceptable, use the pointer and keep verdicts only.

© mrmps, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/_rejected/context-compaction-keep-or-drop of mrmps/classifier-dev.

Open the folder on GitHubat commit 629df75

Compare with similar skills

Context Compaction Keep Or Drop next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Context Compaction Keep Or Drop compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Context Compaction Keep Or Drop this skillmrmps/classifier-dev424—~1.5kAutomated safety check: PassMIT
Subagent OrchestrationPostHog/code179—~1.5kAutomated safety check: PassMIT
Hook Development for Claude Code Pluginsanthropics/claude-plugins-official38k11 repos~4.1kAutomated safety check: NotesApache-2.0
Plugin Settings Patternanthropics/claude-plugins-official38k7 repos~3kAutomated safety check: PassApache-2.0
Neat-Freak Knowledge CloseoutKKKKhazix/khazix-skills21k—~1.9kAutomated safety check: PassMIT
Crush Configurationcharmbracelet/crush29k—~3.7kAutomated safety check: PassCustom licence

Similar skills

  • Official

    How and when to delegate work to subagents via the subagent tool (Explore, Plan, General).

    179 GitHub stars~1.5k tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • Hook Development for Claude Code Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.

    38k GitHub starsUsed in 11 repos~4.1k tokens
    Agent WorkflowsAuto-check: notes
  • Plugin Settings Pattern

    anthropics/claude-plugins-official

    Official

    Shows how Claude Code plugins keep per-project settings and state in .claude/plugin-name.local.md files with YAML frontmatter and a markdown body.

    38k GitHub starsUsed in 7 repos~3k tokens
    Agent WorkflowsAuto-check passed
  • Neat-Freak Knowledge Closeout

    KKKKhazix/khazix-skills

    Brings project docs, agent rule files, authorized memory and leftover workspace files back in line with what the code and runtime actually do at the end of a work session.

    21k GitHub stars~1.9k tokensUpdated 7 days ago
    Agent WorkflowsAuto-check passed
  • Crush Configuration

    charmbracelet/crush

    Explains how to configure the Crush coding agent with crushrc or crush.json, covering providers, models, LSPs, MCP servers, hooks, permissions and config precedence.

    29k GitHub stars~3.7k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Context Mode Output Sandbox

    mksglu/context-mode

    Routes large command, file, API and browser output through context-mode tools so only the needed result enters the agent's context, instead of dumping it via Bash.

    26k GitHub stars~4.1k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed

More from mrmps/classifier-dev

All 21 skills in this repo
  • Bulk Classify

    mrmps/classifier-dev

    Sort many texts into your own categories without reading them, using a keyless HTTP API that returns a calibrated confidence per answer.

    424 GitHub stars~3.1k tokensUpdated yesterday
    Auto-check passed
  • Computer Use Action Picker

    mrmps/classifier-dev

    Pick a browser or desktop agent's next action by choosing among the actions actually on screen instead of inventing one.

    424 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Content Moderation Gate

    mrmps/classifier-dev

    Check user-generated text against a written policy before it is published.

    424 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Document Intake Routing

    mrmps/classifier-dev

    Label each page of an intake packet with a document type and a page role before extraction runs, so only confident pages reach an extractor and the rest reach a person.

    424 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Headline Filter Map Reduce

    mrmps/classifier-dev

    Filter hundreds or thousands of headlines, search results or feed items against a written brief before opening any of them, using a two-stage cascade that spends a fast model on everything and a…

    424 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Type candidate (subject, sentence, object) triples against a fixed relation schema and flag triples that contradict each other, batched, with a calibrated confidence per edge so only confident edges…

    424 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Context Compaction Keep Or Drop

What does Context Compaction Keep Or Drop do?

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…. Context Compaction Keep Or Drop is an agent skill from mrmps/classifier-dev. 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.

When should I use Context Compaction Keep Or Drop?

Context Compaction Keep Or Drop fits situations like: A session runs out of room; trim the history.

How do I install Context Compaction Keep Or Drop in Claude Code?

Run `npx skills add mrmps/classifier-dev --skill context-compaction-keep-or-drop -a claude-code`. Or copy the skill folder (skills/_rejected/context-compaction-keep-or-drop in mrmps/classifier-dev) into .claude/skills/context-compaction-keep-or-drop in your project. Claude Code loads it when a task matches its description.

How do I install Context Compaction Keep Or Drop in Codex?

Run `npx skills add mrmps/classifier-dev --skill context-compaction-keep-or-drop -a codex`. Or copy the skill folder (skills/_rejected/context-compaction-keep-or-drop in mrmps/classifier-dev) into .agents/skills/context-compaction-keep-or-drop in your project. Codex loads it when a task matches its description.

Can I use Context Compaction Keep Or Drop in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mrmps/classifier-dev --skill context-compaction-keep-or-drop -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/context-compaction-keep-or-drop, .gemini/skills/context-compaction-keep-or-drop, .github/skills/context-compaction-keep-or-drop and .opencode/skills/context-compaction-keep-or-drop in your project.

What does Context Compaction Keep Or Drop need to run?

SKILL.md names no scripts, command-line tools or credentials: Context Compaction Keep Or Drop is instructions for the agent only. Our summary lists: Python 3.

Does Context Compaction Keep Or Drop access the network?

SKILL.md names 1 domain. In commands or code: classifier.dev; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Context Compaction Keep Or Drop safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Context Compaction Keep Or Drop use?

Context Compaction Keep Or Drop is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Context Compaction Keep Or Drop use?

About 1.5k tokens (SKILL.md is roughly 6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Context Compaction Keep Or Drop?

Skills that share tags, products or a category with Context Compaction Keep Or Drop: Subagent Orchestration (PostHog/code, 179 stars), Hook Development for Claude Code Plugins (anthropics/claude-plugins-official, 38k stars), Plugin Settings Pattern (anthropics/claude-plugins-official, 38k stars) and Neat-Freak Knowledge Closeout (KKKKhazix/khazix-skills, 21k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Context Compaction Keep Or Drop?

mrmps (a GitHub user) maintains it in mrmps/classifier-dev, which has 424 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on October 7, 2026.

Source: mrmps/classifier-dev on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.