Skip to content
Development
Hook

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.

Install
$ npx -y skills add egorfedorov/claude-context-optimizer --agent claude-code

Ships 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.
Read hooks/hooks.json
Ships withclaude-context-optimizer

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.

Get the whole plugin, auto-invoked
Stats
86
Stars
0
Views
10
Forks
Active
Maintenance
JavaScript
Language
MIT
License
22d ago
Last commit
4mo ago
Created

Repo: egorfedorov/claude-context-optimizer