Hooks
What claude-context-optimizer runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.
$ npx -y skills add egorfedorov/claude-context-optimizer --agent claude-codeShips with claude-context-optimizer. Installing the plugin gets these hooks.
What fires, and when
PreToolUse
- Runs read-cache.js".
UserPromptSubmit
Fires before Claude sees each prompt you send. A plugin can use it to inject context, so the same instruction reaches the model every turn instead of only at session start.
- Runs prompt-coach.js".
PostToolUse
- Runs read-cache.js".
PreCompact
- Runs read-cache.js".
SessionStart
Fires once when a session begins, and again after a context compaction. It is where a plugin sets up its environment, or restores state the compaction dropped.
- Runs tracker.js".
SessionEnd
- Runs 0.
Claude Code plugin that tracks token usage, identifies wasted context, and saves 30-50% on API costs. Heatmaps, ROI reports, budget alerts, efficiency scores, git-aware suggestions — all local, zero config.
Repo: egorfedorov/claude-context-optimizer

