context-audit
npx skills add https://github.com/hjewkes/agent-skills --skill context-audit
Agent 安装分布
Skill 文档
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.