token-optimizer

by alexgreensh · ★ 2,496 · updated today

BandsReskinsGuardsPrompt

0

Audit, fix, and monitor Claude Code context window usage. Find the ghost tokens.

install token-optimizer

Install

/plugin marketplace add alexgreensh/token-optimizer
/plugin install token-optimizer@alexgreensh-token-optimizer

Then run /reload-plugins or start a new session. Requires Claude Code 2.1.287+.

View source on GitHub

What it hooks into

From an automated scan with claude plugin validate, not a security review. Mods run with your permissions; read the code before installing.

Events
session.startclassic.SessionStartprompt.submitclassic.UserPromptSubmitclassic.Stopturn.startturn.steptool.callagent.spawnclassic.PermissionRequestsession.compactturn.completeui.render
API calls
$.clock.after$.clock.every$.clock.now$.command.run$.env.get$.fs.list$.fs.read$.fs.stat$.model.fork$.process.run$.session.cwd$.session.id$.session.usage$.store.delete$.store.get$.store.set$.ui.log$.ui.resolve$.ui.toast

Origin

How it got here
Found through a post on X by @alexgreensh, then checked on GitHub: the repo has a plugin manifest and function hooks. Listed .
Repository
github.com/alexgreensh/token-optimizer
Path in repo
repository root
Source commit
247edce the exact code the scan read
Author
@alexgreensh
License
A license file GitHub could not identify — read it in the repository before reusing code.
First published
Last pushed
First listed here
On X
Mentioned in 1 post on X

Name and description come from the mod's own manifest. We link to the code; we don't host it, and it stays under its author's license.

Posts about this repo

Alex@alexgreensh

Clawd can help you save tokens now! I just added a Claude mod for Token Optimizer with a cute animated Clawd that works alongside you and helps: > Keep your cache warm > Track your usage > Maintain your session's context quality > Track tools, session time, compacts, etc > See your token savings > Track checkpoints (TO automatically ensures important context is never lost and allows full session continuity between new sessions, clears & compacts) Many more cool stuff coming soon. Feel free to drop feedback! https://github.com/alexgreensh/token-optimizer