trim-context
Skill1 starsChanged 32 days agoMITView on GitHub
Measure and trim what loads into every turn: MCP servers and tools, claude.ai connectors, plugins, skill and agent descriptions, and Codex MCP servers.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- daryaKuto/claude-skillstheir own version, first seen Nov 15, 2026
- akshaypimprikar/pragmatheir own version, first seen Nov 11, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- akshaypimprikar/pragma★ 4same name
- daryaKuto/claude-skills★ 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 repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- auditSkill
- autonomySkill
- batch-wakeupsSkill
- code-mapSkill
- codex-dispatchSkill
- cycleSkill
- flowSkill
- frictionSkill
- guardrailsSkill
- lean-agentsSkill
- modelsSkill
- planningSkill
- reviewSkill
- rosterSkill
- scanSkill
- scheduleSkill
- slim-instructionsSkill
- speedSkill
- startSkill
- test-loopSkill
- tools-before-tokensSkill
- undoSkill
- whats-newSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
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
- Very specific: line 11
Not in Claude Code?: Read docs/hosts.md in the plugin root first.
- Distinctive: line 13
Every MCP tool schema, connector, enabled plugin, skill description and custom-agent description can add tokens to every turn, even if you …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Trim the always-loaded tool and context surface
Plugin root: ${CLAUDE_PLUGIN_ROOT}. If that is still a ${...} placeholder, use the folder that contains skills/ (this file is skills/<name>/SKILL.md), and substitute that path, in quotes, wherever this skill uses CLAUDE_PLUGIN_ROOT.
Not in Claude Code? Read docs/hosts.md in the plugin root first. Skip steps that only work in Claude Code, and follow its propose-only rule before changing any host configuration.
Every MCP tool schema, connector, enabled plugin, skill description and custom-agent description can add tokens to every turn, even if you never use it. Removing what this project never uses saves tokens on every turn after that.
Changes: settings and config, after you approve. Back up each file changed, including .claude/settings.local.json when used, first.
Autonomy: follow ${CLAUDE_PLUGIN_ROOT}/docs/autonomy.md. The mode comes from the skill argument (propose, safe, auto or yolo), else docs/kaizen/config.json, else agent-kaizen.json in your Claude config dir ($CLAUDE_CONFIG_DIR or ~/.claude), else propose. In safe and auto, read every "wait for my OK" below as: apply it yourself if the mode allows (backup, verify, roll back on failure, ledger row), otherwise list it as a proposal. Hard stops always ask. At most maxChangesPerRun changes (default 3). End with a summary of what was applied, skipped and rolled back.
In this skill, <Claude config dir> means $CLAUDE_CONFIG_DIR or ~/.claude, and <Codex home> means $CODEX_HOME or ~/.codex.
Task
1. Measure first. Ask me to run /context and paste the result. In a headless or autonomous
run, estimate instead: file sizes / 4 for instruction files, plus counts of servers, tools,
skills and agents. Then list:
- MCP servers (`claude mcp list`), and which of their tools any transcript in the last
30 days actually called (count tool names starting with mcp__ in <Claude config dir>/projects);
- claude.ai connectors that show up in this project;
- enabled plugins and their skills, agents and hooks;
- custom agents and skills whose descriptions are listed every turn, and how often each
was used (subagent types in transcripts, Skill tool calls);
- Codex MCP servers in <Codex home>/config.toml, and how often Codex sessions used them.
2. Propose, each with the token or turn saving where you can estimate it. Check every
setting name against the current Claude Code settings docs first:
- use `Unused tools and MCP servers` in the audit to propose `permissions.deny`
entries in `.claude/settings.local.json`. Check the current Claude Code settings
docs for exact built-in tool and MCP server/tool deny syntax before writing;
- never deny a tool named in the project's CLAUDE.md, agents, skills or hooks. Prefer
denying a whole unused MCP server over its tools. Deferred tools cost only their name
per turn, so prioritize servers loaded in full or carrying server instructions;
- apply each deny between sessions: a changed tool set invalidates a resumed conversation's
prompt cache. Each entry gets its own ledger row and `/agent-kaizen:undo` can reverse it;
- deny servers or connectors this project never uses (settings key deniedMcpServers;
disableClaudeAiConnectors to turn all claude.ai connectors off; for project .mcp.json
servers, disabledMcpjsonServers or enabledMcpjsonServers). Prefer project-level
settings when another project still needs the server;
- keep MCP tool search on (ENABLE_TOOL_SEARCH unset or true), so tool schemas load only
when needed;
- disable plugins this project doesn't use;
- mark user-triggered skills `disable-model-invocation: true`, so the model doesn't
carry their descriptions;
- shorten long agent and skill descriptions to one or two sentences that say when to
use them, and merge or delete agents unused in 30 days;
- in Codex, set enabled = false on MCP servers that most runs don't need, and enable
them per run (codex exec -c mcp_servers.NAME.enabled=true);
- prune stale [projects."..."] trust entries in <Codex home>/config.toml.
3. Note the trade-offs. Connecting or disconnecting MCP servers, switching models and
compacting all invalidate the prompt cache, so make these changes between sessions,
not in the middle of one.
Show each diff, wait for my OK, then ask me to run /context again so we can record the
before/after numbers in docs/kaizen/LEDGER.md.Done when
/context shows a smaller fixed overhead, and the ledger has the before/after numbers.
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.

