context-audit
Skill10 starsChanged 5 months agoMITView on GitHub
Use when the user wants to cut Claude Code token cost or asks "why is this session so expensive / what's eating my tokens / trim my CLAUDE.md / reduce context". Audits the always-on context a project re-sends every turn (CLAUDE.md, memory, MCP servers, skills, agents), ranks it by per-turn token cost, and proposes concrete trims — including a leaner CLAUDE.md rewrite. Pairs with the Gander dashboard's per-session cache-hit / context-fill gauges.
19 other projects use a version of this.
Adopted by
Most recently taken up by
- nordz0r/skillstheir own version, first seen Nov 1, 2026
- adamlinscott/claude-skillstheir own version, first seen Oct 30, 2026
- CharlesLadera/claude-custom-skillstheir own version, first seen Oct 25, 2026
- garrytan/gbraintheir own version, first seen Oct 17, 2026
- greglas75/zuvotheir own version, first seen Oct 16, 2026
- edenbuilds/agentlooptheir own version, first seen Oct 13, 2026
Used with
Projects with it also use skillify, refactor and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MicrosoftSkillskillify
Capture a repeatable process from the current session into a reusable Amplifier SKILL.md skill file. Use when the user wants to create a skill, save a workflow as a skill, turn a process into a reusable skill, or mentions "skillify", "create skill", "make a skill", "save as skill", "capture workflow", "turn this into a skill", "new skill", or wants to automate a repeatable process they just performed.
Also in 3 projects that use this
GitHubSkillrefactor
Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.
Also in 3 projects that use this
MicrosoftSkillhandoff
Compact the current conversation into a handoff document for another agent to pick up.
Also in 4 projects that use this
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- garrytan/gbrain★ 32ksame name
- Neeeophytee/finding-unknowns-skills★ 339same name
- jiahao-shao1/sjh-skills★ 43same name
- Vesely/skills★ 28same name
- Sapere-IA/sdd-onboarding-kit★ 19same name
- WalletConnect/skills★ 14same name
- nordz0r/skills★ 8same name
- tstapler/dotfiles★ 8same name
- greglas75/zuvo★ 7same name
- adamlinscott/claude-skills★ 3same name
9 more not listed
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 repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- agent-opsSkill
- autopilotSkill
- component-builderSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 19 edited versions we read keep these.
2
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
- Distinctive: line 27
If the bridge isn't up, skip to Step 2 — the file audit stands on its own.
- Very specific: line 66
After the next session runs, re-check cacheHit / ctxPct / costUSD in /api/usage (or the Gander modal) to confirm the drop.
- Distinctive: line 70
Don't over-trim: cutting a real constraint makes Claude guess wrong, then you pay for the redo.
“Common” is measured: kept by at least 6 in 10 of the 19 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.
Files
Context Audit
Find what a project pays for on every single turn and cut it. The expensive thing in a long Claude Code session is rarely the user's prompt — it's the always-on context (system prompt + CLAUDE.md + loaded tools/skills + conversation) that gets re-sent each turn and billed as cache-read. Shave 5k tokens off something that loads every turn and you save it across the whole session.
The model (read first)
- Output costs ~5× input — but it's usually a small share of a long session's spend.
- Cache-read is cheap per token (~1/10th input) but you pay it on the whole context, every turn — so a 50-turn session re-reads its context ~50×. That multiplier is where the money goes.
- Therefore: the highest-leverage cut is anything fixed and re-sent every turn. In order of typical size: the conversation itself (→
/compact), CLAUDE.md files, enabled MCP servers (their tool schemas), available skills (name + description listed each turn), memory, agents, hooks.
Step 1 — Get the live signal (if Gander is running)
Ground the audit in real spend before guessing. The bridge runs on http://localhost:3131:
curl -s http://localhost:3131/api/usageIn bySession, find this project's sessions and read: cacheHit, outShare, ctxPct, costUSD.
- High
cacheHit(>90%) + lowoutShare(<15%) → the lever is context size, not verbosity. Focus on CLAUDE.md / MCP //compact. - High
outShare(>25%) → answers are verbose; a terse-output style helps more than trimming context. - High
ctxPct(>70%) → recommend/compactnow (also surfaced as a button in the Gander agent modal).
If the bridge isn't up, skip to Step 2 — the file audit stands on its own.
Step 2 — Inventory the always-on context
Measure each item's size. Rough token estimate: tokens ≈ characters ÷ 4 (use ÷3.5 for dense code/markdown). Count chars:
# bash / macOS / Linux
wc -c CLAUDE.md ~/.claude/CLAUDE.md 2>/dev/null
find . -name CLAUDE.md -not -path '*/node_modules/*' -exec wc -c {} +# Windows PowerShell
(Get-Content .\CLAUDE.md -Raw -ErrorAction SilentlyContinue).Length
(Get-Content $env:USERPROFILE\.claude\CLAUDE.md -Raw -ErrorAction SilentlyContinue).LengthInventory, each as ~tokens/turn:
- CLAUDE.md — global (
~/.claude/CLAUDE.md) + project + any nested ones in the working tree. All in-scope ones load every turn. - MCP servers — list enabled ones (
.mcp.jsonin the project,enabledMcpjsonServers/enableAllProjectMcpServersin.claude/settings.json, and~/.claude.json). Each enabled server injects all its tool schemas into every turn — often the biggest hidden cost. Note which ones the session actually used (check the transcript / Gander activity); unused = pure waste. - Skills — every available skill's
name+descriptionis listed each turn (progressive disclosure). Count them and total the description lengths (~/.claude/skills/*/SKILL.md+ project.claude/skills). Long descriptions on rarely-used skills add up. - Memory —
~/.claude/CLAUDE.mdmemory blocks /MEMORY.md+ any auto-loaded memory files. - Agents & hooks — agent front matter and hook output that lands in context.
Step 3 — Rank and decide
Sort the inventory by tokens/turn, largest first. For each, ask one question: is this needed on every turn?
- Needed every turn → compress it (Step 4), don't remove.
- Needed sometimes → move the detail into an on-demand skill or a file the agent Reads when relevant, leaving a one-line pointer in CLAUDE.md. (This is the core move: progressive disclosure beats always-on.)
- Not needed here → disable it for this project (esp. MCP servers — use
disabledMcpjsonServers, or the Gander Config panel).
Quantify: tokens_saved/turn × typical_turns × cache-read_price (Opus cache-read ≈ $1.50/M, Sonnet ≈ $0.30/M). Show the per-session dollar estimate so the trim is justified.
Step 4 — Deliverables
Produce, concretely:
- A ranked table — item · ~tokens/turn · used? · verdict (keep / compress / defer / disable).
- A leaner CLAUDE.md rewrite — same meaning, fewer tokens. Cut: restated defaults, narrative prose, duplicated history, anything the code/README already says. Keep: non-obvious constraints, commands, conventions. Show the before/after char (≈token) count.
- An MCP/skill trim list — exactly which servers to disable for this project and which skill descriptions to tighten, with the per-turn savings each.
Step 5 — Re-measure (and the cache caveat)
- Editing CLAUDE.md mid-session busts the prompt cache (forces a full cache-write at ~1.25× input that turn). So savings show up on the next session, not the one you're in — don't be alarmed by a one-turn cost bump.
- After the next session runs, re-check
cacheHit/ctxPct/costUSDin/api/usage(or the Gander modal) to confirm the drop.
Safety
- Read-only by default. Audit and propose; let the user apply CLAUDE.md edits and MCP changes. Never delete a memory or disable a server without showing what it is and confirming.
- Don't over-trim: cutting a real constraint makes Claude guess wrong, then you pay for the redo. Compress wording, preserve meaning.
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.

