mk:context-audit
Read-only audit of how much of the context window the always-on .claude setup uses, with a ranked list of what to trim.
| Source | .claude/skills/context-audit/SKILL.md |
| Owner | docs |
| Runtime | claude-code |
| Risk | medium |
| Phase | on-demand |
mk:context-audit walks .claude/ and reports how much of the model context window your always-on setup takes. It prints a ranked "remove X, save Y tokens" report to the terminal and changes no files. It measures only what is loaded statically into every session, not conversation history, tool output or active edits.
When to use it
| Moment | Why |
|---|---|
| Before adding an agent, skill or rule | Check that structural overhead is under 25 percent |
| Sessions feel slow, off-topic or over-compacted | Check whether overhead has passed 10 percent |
| Quarterly or after a model upgrade | Check the always-on bundle still earns its place, alongside the dead-weight audit (.claude/skills/cook/references/harness-rules.md Rule 7) |
When not to use it
| Concern | Use |
|---|---|
| Runtime decisions about this session (what to read, when to compact) | mk:context-engineering |
| Cost in USD | mewkit budget |
mewkit validate --substrate shows the same artifacts grouped by the responsibility they serve, which helps check a trim before removing something.
Usage
/mk:context-audit
/mk:context-audit <scan-root><scan-root> defaults to the current directory.
What it does
scripts/inventory-context.shcounts bytes and lines per category (CLAUDE.md chain, agents, skills, rules, commands, MCP) and emits JSON.scripts/estimate-tokens.shadds token estimates (characters divided by 4) and computesstructural_overhead_pctagainst a fixed 200K window.scripts/format-audit-report.shprints a markdown report.- The report banner is Healthy below 10 percent, Watch from 10 to 25 percent, and Action at 25 percent or more.
The thresholds are defined in references/token-cost-model.md. They are not tied to the budget.* config keys, which are USD amounts.
Output
# Context Audit: <scan_root>
Scanned at <timestamp>, model window 200K tokens, banner: <Healthy|Watch|Action>
## Summary Category, components, bytes, tokens, percent of window
## Top Consumers Top 10 components with path and tokens
## Recommendations Findings sorted by token impact, each with tokens saved
## How to Act Cost: mewkit budget. An agent file costs tokens only when that agent is spawned, so archive agents you never useNotes
- The window size is fixed at 200K and there are no environment variables.
- The skill reads
.claude/,.mcp.jsonand.meowkit/telemetry/cost-log.jsonand writes nothing. SCAN_ROOTis untrusted input. Paths are canonicalised withrealpathand never executed.