Audits everything a Claude Code session starts with — CLAUDE.md files, rules, memory, skill descriptions, MCP tools — and proposes what to remove, scope, move into a skill, shorten or merge. Run on a new model release or when context-budget reports a budget overrun.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Context Audit?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/michaelp17-context-audit)
---
name: context-audit
description: Audits everything a Claude Code session starts with — CLAUDE.md files, rules, memory, skill descriptions, MCP tools — and proposes what to remove, scope, move into a skill, shorten or merge. Run on a new model release or when context-budget reports a budget overrun.
disable-model-invocation: true
argument-hint: "[--all]"
---
Every token loaded at session start is paid in every session and competes with the work for attention. This audit finds what no longer earns its place, proposes concrete changes and records each decision so the next audit does not argue the same point again.
The numbers come from the context-budget mod: at the start of every session it saves the engine's breakdown (what `/context` shows) to `~/.claude/context-budget/<project>.json`. The script reads that snapshot; where none exists it estimates at four characters per token and says so.
```bash
python3 <base>/scripts/audit.py inventory [--repo <path>]
python3 <base>/scripts/audit.py overview
python3 <base>/scripts/audit.py locations
python3 <base>/scripts/audit.py record --log global|repo --location <file#Heading> --decision <action> --reason <text>
python3 <base>/scripts/audit.py record-audit
python3 <base>/scripts/audit.py prune
```
`<base>` is this skill's base directory, named where the skill loads.
## With `--all`
Run `overview` and report the repo-level load of every repository under `~/Projects` against the repo budget, worst first. Judge nothing; offer to audit the repositories over budget one at a time, each in a session opened there.
## Audit
1. Run `inventory` from the repository the session works in. Run `prune` first if it lists decisions as `gone`.
2. Report the numbers in tables, one per level:
- **Fixed** — system prompt and system tools: one line with their sum, so it is clear how much room there is at all.
- **Global** — `~/.claude/CLAUDE.md`, its imports, global rules.
- **Repo** — the repository's CLAUDE.md files, unscoped rules, path-scoped rules (on demand, not counted against the budget).
- **Memory** — `MEMORY.md` of this project. Over budget, point to the `consolidate-memory` skill instead of pruning it here.
- **Tools and skills** — every skill description and MCP server with its tokens, grouped by where it comes from and where it is switched off: the desktop app (fixed), the claude.ai account (connectors and synced skills, switched off in claude.ai settings), plugins (uninstalled), local (`~/.claude/skills`, `settings.json`, `.mcp.json`). Your own tool list and skill list in this session's context are the cross-check for what the snapshot names.
- The lint findings.
3. Judge every section of every always-loaded instruction file — skip those whose logged decision is `keep` and `unchanged`. Per section, pick one action:
| Action | When |
| --- | --- |
| `remove` | Outdated, contradicted elsewhere, or behaviour the current model shows without being told |
| `scope` | Applies only to some files: a rule with `paths:` instead of always-loaded text |
| `move to skill` | Needed only for one kind of task: a skill whose description triggers it |
| `shorten` | Right, but says it in more words than it needs |
| `merge` | Says what another section or level already says |
| `keep` | Earns its place |
Give each a reason, a confidence (high, medium, low) and the tokens saved. "The model does this anyway" is the claim most often wrong: rate it high only for behaviour that is clearly default; otherwise say low and offer an A/B check — a subagent solves one typical task with and without the instruction, and the two results are compared. Run that check only when asked, and only for instructions large enough to be worth it.
4. Do the same for skill descriptions over budget (propose a shorter description, or disabling a skill that is never used) and for MCP servers whose loaded tools are rarely needed (propose deferring or disconnecting).
5. Present the proposals grouped by level and wait. Apply only what is confirmed. Commit nothing unless asked.
6. Record every decision, the confirmed changes and the rejected ones alike: `record --log global` for anything under `~/.claude`, `--log repo` for the repository's files. A rejected proposal is recorded as `keep` with the reason given for keeping it. Location strings are exactly as `locations` prints them; a removed section is recorded under its old location before the edit, then dropped by the next `prune`.
7. Finish with `record-audit`. It marks the session's model as audited, which clears context-budget's audit reminder for that model.
Keep the audit's own reading small: read a file in full only where the inventory shows it is large or a decision needs its wording.