agentleFS
timdevaitimdevai/proteus/skills/context-compactor/SKILL.md

context-compactor

Skill1 starsChanged 5 months agoMITView on GitHub

Tells you when to /clear vs keep, what to dump to a memory file before clearing, and how to re-seed the next session efficiently. Trigger phrases: context full, running low, should I clear, compact this, lots of files read, /compact. Auto-trigger at 70% of the context window if Claude Code exposes that metric. Warn at 85%, force-suggest at 95%. Before clearing, write a hand-off document at .proteus/sessions/<date>-<topic>.md: Then run /clear. Re-seed the next session by pasting the brief or by…

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before clearing, write a hand-off document at .proteus/sessions/<date>-<topic>.md:

    line 24
  2. Distinctive:

    Ask: "Save brief and clear?

    line 61

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

context-compactor

Tells you when to /clear vs keep, what to dump to a memory file before clearing, and how to re-seed the next session efficiently.

When to activate

Trigger phrases: context full, running low, should I clear, compact this, lots of files read, /compact.

Auto-trigger at 70% of the context window if Claude Code exposes that metric. Warn at 85%, force-suggest at 95%.

Decision tree

Is the current task done?
├── YES → Suggest /clear. Save anything durable to a vault note first.
└── NO → 
    Is most context now stale (reading files we won't touch again)?
    ├── YES → Suggest dumping current state to a session brief, then /clear, then re-seed.
    └── NO → Stay. The model still needs this context.

The "session brief" pattern

Before clearing, write a hand-off document at .proteus/sessions/<date>-<topic>.md:

# Session brief: <topic>

## What I was doing
<2-3 sentences>

## What's done
- <thing 1>
- <thing 2>

## Where I am right now
<the next concrete action>

## Files I touched
- path/file.py — <one-line change summary>
- ...

## Decisions made
- <decision> — (see ADR-NNNN if recorded)

## Open questions
- <q>

Then run /clear. Re-seed the next session by pasting the brief or by saying "read .proteus/sessions/<date>-<topic>.md and continue."

Process

  1. Detect context pressure (token count vs window size)
  2. Categorize what's in context:
    • Active code (keep)
    • Stale file reads (drop)
    • Verbose tool outputs (drop)
    • Decisions / current task state (preserve as brief)
  3. Generate the session brief
  4. Ask: "Save brief and clear? (y / no / brief-only / clear-only)"
  5. On approval: write brief, then /clear

Inputs

  • Current context token usage
  • Tool call history (to find stale reads)
  • The user's stated task

Outputs

  • Session brief file (at .proteus/sessions/)
  • /clear invocation (if approved)
  • Re-seed instructions for next session

Slash command

/compact — start the flow regardless of context pressure.

Why this skill

Cherny's data: 80% of "Claude got dumb" complaints trace to bloated context. Compacting is the single highest-impact session hygiene practice.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.