token-audit

Measure fixed-context token overhead in Claude Code configurations and generate a prioritized action plan.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/Alamator/code-ultimate --skill token-audit-alamator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: token-audit
Source: https://github.com/Alamator/code-ultimate/tree/main/examples/skills/token-audit
Command: npx skills add https://github.com/Alamator/code-ultimate --skill token-audit-alamator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill measures fixed-context token consumption in Claude Code configurations, identifies the largest sources of overhead such as global and project CLAUDE.md, .claude/rules, MEMORY.md, and noisy hooks, and produces a prioritized action plan to reduce token usage and improve session capacity.

Core Features & Use Cases

  • Quantify fixed context: Calculate byte and token estimates for ~/.claude files, project CLAUDE.md, all files in .claude/rules, and MEMORY.md to produce a total fixed-context budget.
  • Classify rules: Produce a size-sorted classification (ALWAYS / SOMETIMES / RARELY / NEVER) for .claude/rules files with short reasoning to guide lazy-loading or removal.
  • Audit hooks: Detect PreToolUse/PostToolUse hooks, estimate stdout size per call, and surface hooks that inject excessive context.
  • Use Case: Run after a configuration surge or when sessions compress early to reclaim session tokens and prioritize low-effort savings.

Quick Start

Run the token-audit procedure to measure fixed-context token usage and generate a prioritized savings action plan for this project.

Frequently Asked Questions about token-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce fixed-context token overhead in my Claude Code configuration?

You can reduce fixed-context token overhead by auditing your Claude Code configuration files, such as ~/.claude and project CLAUDE.md, to measure token usage and generate a prioritized action plan for reclaiming session capacity.

Why does my Claude Code session compress context early or hit rate limits?

Early context compression and rate-limit issues often occur because large fixed-context files like MEMORY.md, .claude/rules, and noisy hooks consume excessive tokens, leaving minimal session capacity for active tasks.

How do I audit Claude Code hooks for excessive token usage?

You can audit Claude Code hooks by detecting PreToolUse and PostToolUse hooks, estimating the stdout size generated per call, and identifying which hooks inject excessive context into your session.

What is the best way to classify .claude/rules files to optimize token usage?

The best way to classify .claude/rules files is by producing a size-sorted classification ranging from ALWAYS to NEVER, which guides lazy-loading or removal of rules to optimize token usage.

Do I need shell access to measure fixed-context token consumption in Claude Code?

Yes, you need shell access to inspect configuration files and run standard Unix utilities like wc and find, with optional Python available for deeper hook analysis to estimate token savings.

What files contribute to the fixed-context token budget in a Claude Code project?

The fixed-context token budget in a Claude Code project is primarily consumed by global and project CLAUDE.md files, all files within .claude/rules, MEMORY.md, and hook stdout outputs.