mcpField
C
context-audit

context-audit

github.com/hjewkesAgent workflows445 installsUpdated 35w ago
Repository

About context-audit

context-audit is a skill for Claude users who want to understand and reduce context-window consumption. It combines a static inventory, session token analysis, and a weighted score with recommendations.

Key features

  1. 01Inventory context sources
  2. 02Analyze session token changes
  3. 03Score context health
  4. 04Recommend optimizations

Use cases

  1. 01Find oversized skills and CLAUDE.md files
  2. 02Identify turns with large token increases
  3. 03Review plugin and MCP tool counts

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/hjewkes/agent-skills --skill context-audit

After installing, type/context-auditin Claude Code to confirm it loaded.

Bundled filesreferences/audit-procedures.mdscripts/audit-context

Details

From the project README

Context Audit

Analyzes what's consuming your context window and recommends optimizations. Three audit modes can run independently or together.

Quick Start

  • /context-audit or "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 /context themselves for live token data — it complements the static inventory
  • If the user shares /context output, incorporate it into the scoring (Session Efficiency component)
3. Session Token Analysis

Parse the current session's JSONL to track context growth:

  1. Find the active session JSONL in ~/.claude/projects/
  2. Extract usage.input_tokens and usage.cache_read_input_tokens per turn
  3. Identify the 5 largest token jumps between consecutive turns
  4. Correlate jumps with tool calls from preceding turns
  5. 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:

ComponentWeight
Skills health30%
CLAUDE.md health25%
Plugin/MCP health25%
Session efficiency20%

Output Format

Produce a single report with sections:

  1. Static Inventory table (from audit-context script output)
  2. /context note — remind the user to run /context for live token breakdown
  3. Session Analysis (if JSONL available)
  4. Top Recommendations
  5. Score

Read references/audit-procedures.md for detailed procedures, scoring rubric, and recommendation rules.

Comments

Markdown supported