by alexgreensh
Find the ghost tokens. Fix them. Survive compaction. Avoid context quality decay.
# Add to your Claude Code skills
git clone https://github.com/alexgreensh/token-optimizerGuides for using ai agents skills like token-optimizer.
Last scanned: 5/4/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-05-04T06:42:27.506Z",
"semgrepRan": false,
"npmAuditRan": true,
"pipAuditRan": true
}Token Optimizer cuts the tokens your AI coding assistant wastes, keeps your work alive across sessions and compactions, and shows you where every dollar went on a live dashboard. Most of it runs automatically. You install it, run the audit once, and the hooks do the rest.
Why not just use Headroom or RTK? They compress command output, which covers 15-25% of your context. Token Optimizer covers that plus the other 75%: bloated configs, unused skills, stale memory, compaction loss, model misrouting, behavioral waste. Every saving is cache-safe and measured. The dashboard updates after every session, automatically.
Works on Claude Code (CLI and VS Code), OpenCode, OpenClaw, Codex, Hermes, and GitHub Copilot (beta). Windsurf and Cursor are next on the roadmap.
Claude Code (recommended):
/plugin marketplace add alexgreensh/token-optimizer
/plugin install token-optimizer@alexgreensh-token-optimizer
Then in Claude Code: /token-optimizer
Enable auto-update after installing. Claude Code ships third-party marketplaces with auto-update off by default.
/plugin→ Marketplaces tab → selectalexgreensh-token-optimizer→ Enable auto-update. One-time, 10 seconds.After install, run
/token-optimizeronce to set up hooks. From there, everything runs automatically: compression, checkpoints, quality scoring, dashboard updates. You don't need to run any command again unless you want an audit.
Codex:
codex plugin marketplace add alexgreensh/token-optimizer
Then in the Codex TUI: /plugins and install Token Optimizer. See docs/codex.md.
OpenCode: add token-optimizer-opencode to the plugin array in your opencode.json:
{ "$schema": "https://opencode.ai/config.json", "plugin": ["token-optimizer-opencode"] }
See opencode/README.md.
OpenClaw:
openclaw plugins install github:alexgreensh/token-optimizer
See openclaw/README.md.
Hermes:
git clone https://github.com/alexgreensh/token-optimizer.git
token-optimizer/install.sh --hermes
See hermes/README.md.
GitHub Copilot (beta):
git clone --depth 1 https://github.com/alexgreensh/token-optimizer.git
cd token-optimizer
bash install.sh --copilot
See docs/copilot.md.
macOS/Linux script install (alternative to plugin):
tmp="$(mktemp -d)"
release_json="$(curl -fsSL https://api.github.com/repos/alexgreensh/token-optimizer/releases/latest)"
tag="$(python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"])' <<<"$release_json")"
git clone --branch "$tag" --depth 1 https://github.com/alexgreensh/token-optimizer.git ~/.claude/token-optimizer
bash ~/.claude/token-optimizer/install.sh
rm -rf "$tmp"
Windows users: Use the plugin install only. Do not run install.sh on Windows. If you hit EBUSY errors, close all Claude Code and Git Bash windows, kill lingering git.exe processes, delete C:\Users\<you>\.claude\token-optimizer and C:\Users\<you>\.claude\plugins\marketplaces\alexgreensh-token-optimizer, then retry.
If install.sh fails with $'\r': command not found (a clone made before LF line endings were enforced converted the script to CRLF), strip the carriage returns once and re-run — the repo now ships a .gitattributes that prevents this on fresh clones:
sed -i 's/\r$//' ~/.claude/token-optimizer/install.sh
# already have the repo? re-normalize line endings in place:
git -C ~/.claude/token-optimizer add --renormalize . && git -C ~/.claude/token-optimizer checkout -- .
Token Optimizer is additive and reversible. Every runtime has a clean uninstall that removes only what we installed, leaving your own hooks, config, and session data intact. Full per-runtime steps live in docs/uninstall.md.
Quickest path (Claude Code plugin install):
/plugin uninstall token-optimizer@alexgreensh-token-optimizer
Runs automatically, every session, you do nothing:
When you ask for it:
/token-optimizer: full audit with guided fixes/token-coach: 30-day trend analysis with specific fixesquick: 10-second health checkdoctor: installation checksavings: dollar savings reportreport: per-component token breakdowntoken-optimizer is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by alexgreensh. Find the ghost tokens. Fix them. Survive compaction. Avoid context quality decay. It has 1,656 GitHub stars.
Yes. token-optimizer passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/alexgreensh/token-optimizer" and add it to your Claude Code skills directory (see the Installation section above).
token-optimizer is primarily written in Python. It is open-source under alexgreensh on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh token-optimizer against similar tools.
No comments yet. Be the first to share your thoughts!