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
}Install the plugin. Most of it runs automatically from that point:
| What | How | |
|---|---|---|
| Once | Run /token-optimizer after install |
Scans your setup, finds waste, fixes it for you |
| Automatic | Everything else | Smart Compaction (checkpoints before, restores after), active compression, quality scoring, loop detection, read deduplication, model routing nudges, and more. Runs in the background every session |
| Automatic | Dashboard | Updates after every session with tokens, dollars, quality grades, session history |
| When you want | /token-coach |
Analyzes 30 days of your session history. Shows where you're efficient and where you're not, helps plan new projects for minimal waste |
| When you want | /token-optimizer quick |
10-second health check: context fill, quality score, top issues |
Install, run the audit once, everything else just works.
Recommended on every platform (macOS, Linux, Windows):
/plugin marketplace add alexgreensh/token-optimizer
/plugin install token-optimizer@alexgreensh-token-optimizer
Then in Claude Code: /token-optimizer
Please enable auto-update after installing. Claude Code ships third-party marketplaces with auto-update off by default, and plugin authors cannot change that default. So you won't get bug fixes automatically unless you turn it on. In Claude Code:
/plugin→ Marketplaces tab → selectalexgreensh-token-optimizer→ Enable auto-update. One-time, 10 seconds, and you'll never miss a fix again. Token Optimizer also prints a one-time reminder on your first SessionStart so you don't forget.
The plugin install above is the only path you should use on Windows. Do not also run the install.sh script described below — that's a bash installer for macOS/Linux/WSL, and combining the two creates an EBUSY: resource busy or locked error because Git Bash holds Windows file handles open while the plugin system is trying to clone.
Repo size note: our repo is ~3 MB (218 files, ~2,700 git objects). If your /plugin marketplace add attempt seems to be downloading gigabytes, it's not us — cancel and check whether Claude Code is cloning a different URL or network state. You can verify by cloning manually: git clone --bare https://github.com/alexgreensh/token-optimizer.git should finish in under a second and produce a ~2.6 MB directory.
If you've already hit the EBUSY error:
git.exe processes.C:\Users\<you>\.claude\token-optimizerC:\Users\<you>\.claude\plugins\marketplaces\alexgreensh-token-optimizer/plugin commands above.Manual ZIP fallback (advanced, if plugin install repeatedly fails): download a versioned source ZIP from the latest GitHub Release, download that release's CHECKSUMS.sha256, verify the extracted scripts, then run python measure.py setup-quality-bar from C:\Users\<you>\.claude\token-optimizer\. Note: on Windows the command is python, not python3.
If you prefer a script-managed install on macOS or Linux, this works too and auto-updates daily by re-running the verified installer against the latest release tag. Do not run this on Windows, and do not run it alongside the plugin install above on any platform. Pick one method.
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")"
checksums="$(python3 -c 'import json,sys; data=json.load(sys.stdin); print(next(a["browser_download_url"] for a in data["assets"] if a["name"]=="CHECKSUMS.sha256"))' <<<"$release_json")"
git clone --branch "$tag" --depth 1 https://github.com/alexgreensh/token-optimizer.git ~/.claude/token-optimizer
curl -fsSL -o "$tmp/CHECKSUMS.sha256" "$checksums"
install_sum="$(grep ' install.sh$' "$tmp/CHECKSUMS.sha256")"
(cd ~/.claude/token-optimizer && (printf '%s\n' "$install_sum" | sha256sum -c - --quiet
token-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,405 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!