kit-optimize-context
Skill6 starsChanged 27 days agoMITView on GitHub
Analyze always-on agent context across coding hosts (Cursor, Claude Code, Codex, Gemini CLI, etc.) and suggest token reductions. Use when sessions feel heavy before you type anything.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rules/AGENTS.mdAGENTS.md
- kit-audit-metricsSkill
- kit-audit-skillsSkill
- kit-capture-lessonSkill
- kit-challenge-designSkill
- kit-check-blastSkill
- kit-create-prSkill
- kit-debate-decision-treeSkill
- kit-debug-prodSkill
- kit-decisionsSkill
- kit-evolveSkill
- kit-explainSkill
- kit-learn-repoSkill
- kit-minimizeSkill
- kit-planSkill
- kit-proveSkill
- kit-reviewSkill
- kit-strip-diffSkill
- kit-triage-commentsSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
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
- Distinctive: line 13
Not a rewrite of skills/rules content (edit those files directly)
- Very specific: line 14
Not cutting extras inside a finished diff (kit-strip-diff)
- Distinctive: line 15
Not installing/uninstalling tools — read-only audit
- Distinctive: line 19
Ask once if unclear: which host to audit — Cursor, Claude Code, Codex, Gemini CLI, OpenCode / other, or all present.
- Distinctive: line 21
Default: audit every host that has a detectable config/skills dir on this machine, plus the current repo’s agent folders.
- Distinctive: line 41
always-on vs on-demand (how this host decides)
- Distinctive: line 73
After explicit permission to run git (or skip if withheld):
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
Optimize Context
Map what loads into an agent session before the user types, then recommend cuts. Host-agnostic: detect or ask which host(s) to audit.
What this is NOT
- Not a rewrite of skills/rules content (edit those files directly)
- Not cutting extras inside a finished diff (
kit-strip-diff) - Not installing/uninstalling tools — read-only audit
0. Scope the host(s)
Ask once if unclear: which host to audit — Cursor, Claude Code, Codex, Gemini CLI, OpenCode / other, or all present.
Default: audit every host that has a detectable config/skills dir on this machine, plus the current repo’s agent folders.
Token heuristic: chars ÷ 4 unless you can tokenize accurately. Mark estimates.
1. Always-on instructions (per host)
For each in-scope host, find always-on instruction surfaces that exist:
| Host | Typical paths / surfaces |
| Cursor | <repo>/.cursor/rules/ (alwaysApply / requestable), user rules in Cursor settings |
| Claude Code | CLAUDE.md, <repo>/.claude/, ~/.claude/ settings / memory |
| Codex | AGENTS.md, <repo>/.codex/, ~/.codex/ |
| Gemini CLI | GEMINI.md / .gemini/ if present |
| Shared / other | AGENTS.md, .agents/, host docs the user names |
For each always-on file/rule:
- filename/path
- ~chars / ~tokens
- always-on vs on-demand (how this host decides)
- heaviest items
- recommendation: keep always-on, split, or move to a skill / on-demand rule
Skip missing paths; say what you checked.
2. Skills / commands metadata
Count discrete skills (SKILL.md roots or declared entries) and metadata size visible before a skill body is opened:
| Source | Notes |
<repo>/.agents/skills/, <repo>/.cursor/skills/, <repo>/skills/ | repo-local |
~/.agents/skills/, ~/.cursor/skills/, ~/.claude/skills/, ~/.codex/skills/, ~/.gemini/skills/ | user-global |
| Host-bundled / plugin skill roots | only if discoverable on disk |
Also note slash-command / prompt folders if the host keeps them separate (e.g. legacy commands/).
Per existing source: count, combined metadata ~tokens, whether disable-model-invocation (or host equivalent) keeps bodies out of default context.
3. Plugins / MCP / bridges
Where present and readable without secrets:
- Enabled plugins / marketplaces (Claude
settings.json, Cursor extensions, etc.) - MCP servers advertised into context (titles/descriptions only — redact URLs/tokens)
- Flag plugins unlikely to matter for this repo’s domain
State limits when metadata is opaque.
4. Index / VCS noise
After explicit permission to run git (or skip if withheld):
git status --shortline count- Untracked large dirs escaping ignore
- Host ignore files if present (
.cursorignore,.claudeignore, etc.) and what large paths they hide
5. Summary table
| Component | Host | ~Chars | ~Tokens | Reducible? | Recommended action |
One row per major bucket (always-on packs, heavy files, skill metadata by source, plugins/MCP, ignore/git noise).
6. Top 3 quick wins
Highest impact for fresh sessions, ordered by estimated tokens saved. Each: savings bracket, how to do it, trade-off.
Constraints
- Read-only — do not edit settings, ignores, rules, or plugins in this run
- Redact secrets, tokens, private hostnames, employer-private plugin names (describe by category)
- State methodology: hosts checked, paths missing, chars/4 vs tokenizer
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.

