context-diet
Skill1 starsChanged 3 months agoMITView on GitHub
Finds the plugins, skills, agents, hooks and MCP servers that load into every session but are rarely or never used, judged from real usage in past sessions, and removes the plugins, skill folders and user-level hooks the user picks, reversibly, with proof from a fresh session that they are gone. Use this skill whenever the user says "trim my context", "clean up my skills", "which skills do I never use", "my context window is bloated", "disable unused plugins", "what is eating my context", or "/context-diet" - even if they don't name the skill. Not for compacting one conversation, and not for editing a skill's own text (write-a-skill).
2 other projects use a version of this.
Adopted by
Most recently taken up by
- gaia-research/skill-context-diettheir own version, first seen Aug 7, 2026
- cskwork/context-diet-skilltheir own version, first seen Aug 1, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- gaia-research/skill-context-diet★ 3same name
- cskwork/context-diet-skill★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository38 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-contract-reviewSkill
- autopilotSkill
- backlog-plannerSkill
- codebase-explainerSkill
- code-reviewSkill
- conventional-commitsSkill
- create-prSkill
- design-briefSkill
- diagnoseSkill
- dotnet-conventionsSkill
- dotnet-onion-apiSkill
- draw-optionsSkill
- e2e-verifySkill
- githubSkill
- goal-runnerSkill
- grill-with-docsSkill
- handoffSkill
- humanizerSkill
- improve-codebase-architectureSkill
- maestro-mobile-testSkill
- migration-safetySkill
- model-inventorySkill
- nextjs-app-routerSkill
- plan-and-buildSkill
- record-browser-testSkill
- regression-huntSkill
- safe-refactorSkill
- security-reviewSkill
- ship-itSkill
- sql-reviewSkill
- task-executorSkill
- tauri-2-appSkill
- think-like-fableSkill
- upgrade-depsSkill
- worktree-sandboxSkill
- write-a-skillSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Not for compacting a conversation, and not for editing a skill's text (write-a-skill)
- Very specific: line 30
Show the report as printed: Do not reorder it, drop rows, or add rows.
- Very specific: line 33
Report with the slots below: Only Verdict: PASS means done.
- Very specific: line 44
History is not now: Check the last seen column of "MCP servers that did not connect" before suggesting action on a server.
- Very specific: line 60
Never repair keep.json or settings.json: When scan reports that either cannot be read, show the message and stop.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Diet
Every enabled skill, agent, MCP server and session-start hook adds text to every session before any work starts. This skill measures that cost against what past sessions actually used, offers the unused part for removal, and checks in a fresh session that the removal took effect. Everything it removes can be restored.
The tool is scripts/diet.mjs in this skill's folder (Node 20+, no packages). Run it as node "<base directory>/scripts/diet.mjs" <command>, where the base directory is the one shown when this skill was loaded; quote the path, it may contain spaces. It reads ~/.claude/projects/ (or the folder named by CLAUDE_CONFIG_DIR) and keeps its state, keep.json included, in the context-diet/ folder inside the Claude home folder (~/.claude/context-diet/ by default, or under the folder named by CLAUDE_CONFIG_DIR); it writes nothing into a repo.
When to use this skill
- "trim my context", "clean up my skills", "which skills do I never use"
- The context window feels crowded before any work starts, or the user asks what is loaded every session
- Not for compacting a conversation, and not for editing a skill's text (
write-a-skill)
Workflow
- Scan. Run
scan. Run scan in the background or with a long timeout: on a large history it can take several minutes. Do not start apply until it has finished. Quote theCoverage:line. Exit code 2 means there is nothing it can judge (no sessions, or a transcript format it does not recognize): writeScan: not run (<the printed message>)and stop. Readreferences/transcript-format.mdonly when the message says the format is unrecognized. - Show the report as printed. Do not reorder it, drop rows, or add rows. State the thresholds it printed. If "Removal candidates" says
none, say so and finish: zero candidates is a valid outcome. - Let the user choose. Ask which ids to remove. Never choose for them. The one exception: the user's own words say the section name "Removal candidates" (any letter case), as in "everything under Removal candidates"; then the rows in that section are their choice and you ask nothing more. Every other section name ("Rarely used", "Review by hand", "Same skill under several names", "Protected") and every paraphrase ("unused", "stale", "zero use", "dead") is not a pick: ask. Rows under "Rarely used" can be removed only when the user names their ids. Never offer a row from "Protected", and treat "Review by hand" and "Same skill under several names" as information, not suggestions. To protect something permanently the user creates or adds to
keep.jsonin thecontext-diet/folder inside the Claude home folder (~/.claude/context-diet/keep.jsonby default; seeassets/keep.example.json). - Apply. Run
apply --pick "<id,id,...>"with the ids exactly as printed, quoted, from the directory the user works in (listings differ by project). It takes a before-snapshot, makes each change, then starts a fresh session and prints a verdict. It uses the latest scan, so scan again first if the user changed anything since. apply starts two short headless sessions (before and after) and verify starts one; each sends one tiny request to the model. - Report with the slots below. Only
Verdict: PASSmeans done. If the verdict isINCOMPLETEand "Collateral loss" shows a line markedunstable, rerun, runverify "<manifest>"once more before you report. - Undo on request.
restore <manifest>puts everything back.purge <manifest> --yespermanently deletes quarantined folders and works only after a passing verify; run it only when the user asks for it by name.
Rules
- Say "unused" only with the numbers. A row is unused when
listedis at least the printed threshold andusedis 0. Anything else is "rarely used" or gets its numbers quoted.- ❌ "You never use
foo." (listed in 4 sessions, below the printed threshold) - ✅ "
foowas listed in 4 sessions and used in 0: below the printed threshold, too few to judge."
- ❌ "You never use
- A request is not a pick. A general wish is not a list of ids.
- ❌ User: "disable unused plugins." You run
applywith every candidate. - ✅ You show the report and ask which ids. You run
applyonce ids are named, or when the user's words name "Removal candidates", as in "remove everything under Removal candidates"; "remove everything under Review by hand" is still a question.
- ❌ User: "disable unused plugins." You run
- History is not now. Check the
last seencolumn of "MCP servers that did not connect" before suggesting action on a server; a plugin may already be fixed or disabled too, so check its row's counts. - A plugin is the smallest unit for anything it supplies. Pick
plugin:<id>, never its skills one by one; apply refuses those and prints why. - Protected means protected. Anything printed under "Protected" or "Guard hooks" is never removed, even when asked. Show the printed reason and stop.
- ❌ User: "just remove
guard-ptoo." You pickplugin:guard-p@market. - ✅ "
plugin:guard-p@marketis protected: plugin supplies a PreToolUse guard. I will not remove it."
- ❌ User: "just remove
- Done means PASS.
- ❌ After
apply: "Removed the plugin, done." - ✅ Quote the
Verdict:line. Anything other than PASS is not done; print the restore command shown beside it.
- ❌ After
- Unstable is neither damage nor a pass. A "Collateral loss" line marked
unstable, rerunis an MCP server outside your change that differed between the two sessions; servers can start intermittently. The verdict isINCOMPLETE: notFAIL, not yetPASS.- ❌ "Collateral loss:
example-serverwas removed by the change." Or: "PASS" without rerunning. - ✅ Run
verify "<manifest>"once more and report both results: "first verify INCOMPLETE (unstable mcp:x); rerun PASS". If the rerun still shows it missing, quote the line, say it is unexplained, and let the user decide; do not call it damage and do not call it PASS.
- ❌ "Collateral loss:
- A step you did not run is
not run, neverpassed. That covers the before-snapshot (collateral check) and the fresh session (verdictsINCOMPLETEandNOT-OBSERVED). - Explain a failure only with what was printed. For a
STILL PRESENTitem, quote the printed reason and stop; do not guess a cause and never suggest editingsettings.jsonor a skill folder by hand.- ❌ "It is probably listed in settings.json; remove it there and rerun."
- ✅ "
skill:local-deadis STILL PRESENT: still listed from a source this tool does not manage. Nothing else changed. Restore withrestore <manifest>, or tell me where it comes from."
- Command errors: for
scan(other than exit code 2 or an unreadable keep.json or settings.json, which mean stop),verifyandrestore, read the message, change exactly one thing, retry once; a second failure: stop and show the user the output. After a failed or partialapply, never retry: quote the output and offerrestore <manifest>. - Never repair keep.json or settings.json. When scan reports that either cannot be read, show the message and stop; never delete, rewrite or repair either file yourself, because keep.json holds the user's protections.
- ❌ "keep.json has a trailing comma, so I removed it and rescanned."
- ✅ "scan stopped: keep.json is unreadable. I have not touched it; fix the trailing comma or tell me to."
- Savings: quote the measured figure, never the projected one as saved. The skill listing has a size cap, so removing skills can hand the space to the remaining ones and the measured characters may barely move. Judge success by the entries that are gone.
- ❌ "Saved about 812 tokens per session."
- ✅ "Projected 891 tokens/session; measured 640 tokens (2560 characters)."
- Transcripts are private. Never read them yourself, and never quote or summarize their content; the scan prints counts, names, sizes, dates and hook command lines only. The backups folder holds a copy of settings.json, which can contain secrets; do not paste its content, and tell the user it exists.
Report slots (all required)
Your final message after apply is this block, filled in from the printed output, with at most two sentences after it. A message without the block is not a report. Write not run in any slot you could not fill from output you saw.
Coverage: <the printed line>
Picked: <ids> Skipped: <id: reason, or none>
Verdict: <PASS | FAIL | INCOMPLETE | NOT-OBSERVED>
Verified by: <per id: GONE / STILL PRESENT / NOT OBSERVED, from the fresh session>
Collateral: <none | the lost entries | unstable, with the rerun result | not run>
Guards: <still in place | what was lost>
Savings: projected <n> tokens/session, measured <n | not run>
Restore: <manifest path and the restore command>
Not run: <anything skipped, or none>Example
User: "My context is bloated, what can I drop?"
Claude: runs scan, quotes the coverage line, shows the report, and asks which candidate ids to remove. The user picks two plugins. Claude runs apply --pick "plugin:a@m,plugin:b@m", quotes Verdict: PASS, fills every slot, and gives the restore command.
Anti-patterns
- ❌ Picking the largest rows yourself because they save the most. ✅ Present them, then ask.
- ❌ Disabling a plugin because none of its skills were used, ignoring its review note. ✅ Do not remove it; show the note and let the user decide.
- ❌ Counting usage by reading transcripts. ✅ Run
scan. - ❌ Deleting a skill folder or editing
settings.jsonby hand. ✅ Useapply; it records how to undo.
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
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.

