DEV Community

Himanshu Sharma
Himanshu Sharma

Posted on

I built Governor to reduce Claude Code token and context waste

I built Governor, a Claude Code plugin for people who hit Max-plan limits during long coding sessions.

Most token-saving tools focus on making the assistant’s replies shorter. That helps, but in real Claude Code sessions the bigger waste often comes from somewhere else:

  • huge CLAUDE.md and project memory files
  • noisy test/build logs flooding context
  • vague prompts that trigger broad repo scans
  • repeated failed fixes
  • scope drift during long tasks

Governor tries to solve those problems directly.

What it does

Governor adds:

  • compact professional response mode
  • safe CLAUDE.md compression
  • protected-span validation for code, paths, commands, warnings, URLs, and env vars
  • Bash/test/log output filtering
  • local usage telemetry
  • optional planning and drift guardrails
  • rule snippets for Codex, Cursor, Gemini, Windsurf, and Cline

The goal is not to make Claude talk in a meme style. The goal is serious context hygiene: keep the agent useful, but stop it from burning quota on avoidable noise.

Why I built it

Long-context coding agents are powerful, but they make it easy to waste context.

A single noisy test command can dump thousands of useless tokens into the session. A bloated memory file gets loaded again and again. A vague prompt like “fix everything” can turn into broad scanning, over-editing, and retry loops.

Governor acts more like a usage governor than a style plugin. It helps measure where quota is going, reduce recurring context, and keep broad tasks from drifting.

Benchmarks

Small local smoke benchmarks:

Area Result
Output tokens vs control ~55% saved
Memory compression ~55% saved
Synthetic noisy pytest output filtered ~96% blocked

These are not universal claims. Governor reports measured local savings instead of fixed magic percentages.

Try it

GitHub:

https://github.com/0xhimanshu/governor

If you use Claude Code heavily and hit usage limits, I’d love feedback from real long-session users.

Top comments (0)