Guardians of the Token

Your context window, guarded.

One huge log, one long docs page, or one off-topic question in a long session can push Claude Code into early compaction. Guardians of the Token sees it coming, tells you what it would cost, and lets you pick a smaller move.

Free and MIT licensedRuns on your machineClaude Code · Codex · Claude app

Watch: what happens when Claude…

You don’t pay for a big file once. You pay for it every turn after.

Everything in context is sent back to the model with each new message. A log you read at turn 10 is still being paid for at turn 60.

Claude API list prices for input tokens, November 2026: Claude Opus 5.5 $4.00 per million, $0.20 per million when served from the prompt cache. Figures leave out output tokens and the cache-write premium. On a Pro or Max plan the same tokens count against your usage limits instead.

Price your own file

First read$0.48
Carried, cache hits$0.96
Carried, cache misses$19.20

GOT stops the read before it happens, so none of these get added.

How it works

Three moments where it steps in

Most tool calls pass straight through. GOT speaks up only when one move would cost a real share of the session.

Before a big read or fetch

Pick a smaller move

Anything over 20% of the window waits for your OK. Claude Code’s own Yes/No prompt shows GOT’s estimate. Yes loads it once. No, and Claude picks a smaller move: the start, the end, a search, or a summary.

🛡️ Guardians of the Token: large file
(~300,000 tokens, 30% of the window, ~$0.90).
Context 20% → 50%.
Yes loads it in full. No lets Claude
suggest a smaller read.

When a long session changes topic

Start fresh instead

Past 30% of the window, a prompt that looks unrelated to your work is held before Claude reads it. A small local model makes the call. Start a new session for the new topic, or send it anyway.

What you can do:
- New topic → run /clear, then send it again.
- Keep it here → send it again starting with GOT_UNBLOCK

Before the session compacts

Pick up where you left off

Near the limit, GOT saves your goal, the files you touched, and recent commands. Your next session in the project offers to resume. Nothing loads unless you say so.

/got-resume

Resuming: finish the plugin release.
Files: scripts/bootstrap.py, README.md
Next: run the fresh-install test.

Privacy

Your files, prompts, and commands never leave your machine.

  • Estimates are local. Token counts come from file sizes and a quick sample, not from sending anything anywhere.
  • The model is local. The topic check runs a 22 MB model on your CPU. No AI service is called.
  • Telemetry is off. If you opt in, it sends a single anonymous install event. That’s all.
  • Every network call is documented. Installing from PyPI, the one-time model download, and a size check on URLs Claude was about to fetch. See the details.

Where it works

In the tools you already code in

GOT runs on your machine, so it works wherever your coding agent runs locally.

Full guard

Claude Code

  • Terminal
  • VS Code
  • JetBrains
  • Claude app · Code tab

Large reads and fetches ask first, large output is flagged, off-topic prompts are held, and progress is saved before compaction.

Shell guard

Codex

  • Codex CLI
  • Codex app · size tools

In the CLI, shell commands that would dump a big file or URL are denied with smaller options, and oversized output is suppressed. The Codex app gets the MCP size tools only.

Size tools

Claude app chat

  • Claude Desktop

MCP tools Claude can call to size a file or URL and read just the head, tail, a search, or a summary. There are no hooks here, so nothing is stopped automatically.

Not covered: ChatGPT chats and cloud agent tasks. They run on remote servers where a local guard can’t see them.

Install

One install for every tool

Needs Python 3.10 or newer. guardians-install finds Claude Code, Codex, and the Claude app, and sets each one up the best way it can. Restart your tools afterwards.

Everything, in one go

Claude Code gets the full plugin (hooks, MCP size tools, /got-* skills), the Codex CLI gets its hooks, and the Codex app and Claude app chat get the size tools. Safe to run again.

pipx install guardians-of-the-token
guardians-install

Only Claude Code?

Skip the terminal and install the plugin from inside Claude Code. The first session sets itself up in the background, and the guards switch on in about a minute.

/plugin marketplace add tonylee2016/guardians_of_the_token
/plugin install guardians-of-the-token@guardians-of-the-token

Questions

Before you install

Will it slow Claude down?

No. Most checks read a file size or a few kilobytes of the transcript and finish in milliseconds. The topic check loads a small local model, so it takes a fraction of a second, and only runs once a session is past 30% of its window.

What if I really need the whole file?

Choose Yes in the permission prompt and that one read or fetch goes through. To go uninterrupted for a while, run /got-pause 1h. Pauses expire on their own.

Can I tune the thresholds?

Yes. Set them in ~/.guardians.json, or per project in .guardians.toml, where you can also always allow paths like README.md or docs/**.

Does it work with Codex?

Yes. In Codex it guards Bash commands that would print large files or URLs, and flags large command output. The topic check and resume snapshots are Claude Code only.

How do I see what it saved me?

Run guardians-report for a summary of tokens and estimated dollars saved, or guardians-dashboard for a local web view.