claude-context-optimizer is a Claude Code plugin aimed at the token waste that builds up in agent sessions -- files that are read but never used, redundant re-reads, and weak prompts that send the agent exploring dozens of files. It hooks into the tool-call lifecycle: a PreToolUse Read Cache blocks re-reads of files that haven't changed since they entered context, a ContextShield warns before loading files that went unused in past sessions, and a silent PostToolUse tracker records every read, edit, and search to build a per-file usefulness profile over time.
Beyond blocking waste, it monitors budget and cost. Token counts are taken from the session transcript's real API usage where possible (with estimation as fallback), pricing is cache-aware and follows the model the session actually runs on via auto-detection, and threshold warnings escalate to auto-compact recommendations at 80-90% of budget. A .contextignore file (gitignore-style, project or global) permanently blocks reads of lockfiles, build output, and other known-waste paths, and recurring waste can be turned into ignore rules with one command.
A set of slash commands rounds it out: a one-screen Context Control Center dashboard (/cco), per-task token/cost tracking, session replay summaries, a codebase-anatomy map, a CLAUDE.md bloat analyzer, a deterministic local prompt-quality coach, and a smart context-pack builder that ranks the files a task needs against a token budget. Everything runs locally with no telemetry; only file paths and line counts are tracked, never file contents.
