context-audit
Context Audit
Analyzes what's consuming your context window and recommends optimizations. Three audit modes can run independently or together.
Quick Start
/context-auditor "audit my context" — runs all three audits- "static audit" or "context inventory" — file inventory only
- "session analysis" — JSONL token parsing only
- "context score" — scoring and recommendations only
Audit Modes
1. Static Inventory
Run scripts/audit-context to automate the static inventory. Supports --json for structured output, --flagged for problems only, --top N for largest items.
The script scans all context-contributing sources:
- Skills (SKILL.md, rules/, references/)
- CLAUDE.md files (global + project + subdirectories)
- Auto-memory files (
~/.claude/projects/*/memory/*.md) - Plugins with per-plugin tool count estimates
- MCP servers
Thresholds: Flag SKILL.md > 500 words, any rules/ directory, CLAUDE.md > 2KB, 5+ MCP servers, plugins with 10+ tools.
2. Live Context Window (/context)
After running the static inventory, tell the user about the built-in /context command:
- It shows real-time token usage: current tokens, max capacity, and percentage used
- It breaks down what's in the context window right now (system prompt, conversation, tool results)
- Recommend the user run
/contextthemselves for live token data — it complements the static inventory - If the user shares
/contextoutput, incorporate it into the scoring (Session Efficiency component)
3. Session Token Analysis
Parse the current session's JSONL to track context growth:
- Find the active session JSONL in
~/.claude/projects/ - Extract
usage.input_tokensandusage.cache_read_input_tokensper turn - Identify the 5 largest token jumps between consecutive turns
- Correlate jumps with tool calls from preceding turns
- Report what triggered each spike
Read references/audit-procedures.md for the full JSONL parsing procedure.
4. Recommendations & Scoring
Generate actionable recommendations and a letter grade (A-F, 0-100).
Scoring weights:
| Component | Weight |
|---|---|
| Skills health | 30% |
| CLAUDE.md health | 25% |
| Plugin/MCP health | 25% |
| Session efficiency | 20% |
Output Format
Produce a single report with sections:
- Static Inventory table (from
audit-contextscript output) /contextnote — remind the user to run/contextfor live token breakdown- Session Analysis (if JSONL available)
- Top Recommendations
- Score
Read references/audit-procedures.md for detailed procedures, scoring rubric, and recommendation rules.
More from hjewkes/agent-skills
self-improve
Use when a session produced reusable insights, when the user says "learn from this", "remember this", or "improve yourself", or after completing a complex task where patterns were discovered
63md-render
Use when asked to render, preview, or view a markdown file in the browser. Triggers on "render markdown", "preview this", "show me this document", "open in browser".
21code-review
Unified code review system — dispatches the right review agents for the situation. Use when reviewing code for quality, bugs, compliance, or before merging.
17skills-management
Use when creating, finding, installing, reviewing, or managing Claude Code skills — covers skill authoring, discovery, conventions, and lifecycle management
14github-pr
GitHub PR workflow — creating PRs, posting automated review comments, managing PR feedback cycles. Use when code is reviewed and ready for GitHub.
14buildkite
Buildkite CI/CD integration. Use when the user needs to check build status, trigger builds, read build logs, debug failures, manage pipelines, or any Buildkite workflow. Triggers include "buildkite", "build", "pipeline", "CI", "deploy", "build log", "build failed".
14