How pre-action checks catch runaway token consumption before it costs you money. With working code, benchmarks, and a free local tool you can install in 60 seconds.
The problem no one is fixing
If you use Claude Code on a Max plan, you've probably seen it: your session usage jumps 20% from a single git commit, or 40% from submitting a Plan. Your 5-hour window evaporates in 45 minutes. You check your API calls — nothing. You check your actual usage — a fraction of what was consumed.
You're not alone. I've spent the last month reading through thousands of comments on the Claude Code usage drain threads (#41930, #42052, #16157). The pattern is consistent:
- A developer loses 20-40% of their session budget from a single operation
- Cache-busting patterns trigger 175:1 input/output token ratios
- Idle drain consumes entire 5-hour windows in under 5 minutes with zero interaction
- Support tickets go unanswered for 15+ hours
The community has done incredible debugging work — root cause analysis, preload interceptors, cache TTL discovery. But every workaround patches the symptom after the damage is done. No one built a gate that fires before the burn.
So I did.
The idea: a pre-action gate, not a postmortem
Most AI safety tools fit into one of three categories:
| Category | What it does | Example | Problem for token burn |
|---|---|---|---|
| Observability | Traces what happened after the fact | Langfuse, LangSmith | Shows the burn, doesn't stop it |
| Gateway/Proxy | Routes and caches requests | Portkey, Helicone | Optimizes spend, doesn't enforce actions |
| Runtime security | Blocks risky actions | AgentGuard | Security-focused, not cost-focused |
What's missing: a local pre-action gate that checks the agent's proposed tool call before execution and blocks patterns that match known burn signatures.
That's what ThumbGate does.
How it works
ThumbGate sits between your AI agent (Claude Code, Cursor, Codex, Gemini CLI, etc.) and the tool execution layer. Every tool call passes through a PreToolUse hook:
Agent proposes action → ThumbGate checks against known-bad patterns → ALLOW / WARN / DENY → Tool executes (or doesn't)
The "known-bad patterns" aren't hardcoded rules from a vendor. They come from your feedback:
- Capture: You give a 👍 or 👎 on an agent action with context
- Remember: The feedback becomes a reviewable local lesson in SQLite
- Rank: Relevant lessons are re-ranked using Thompson Sampling (a Bayesian bandit algorithm)
- Gate: The next similar action is checked against promoted lessons before execution
This means the gate gets smarter with use. The first time you lose tokens to a cache-busting pattern, you give it a 👎. The next time the agent tries something similar, the gate catches it.
The 60-second install
npx thumbgate init
That's it. The free local evaluate:
- Installs the gateway
- Wires PreToolUse hooks for your agent
- Gives you a local dashboard at
/thumbgate-dashboard - Starts capturing feedback immediately
No account required. No credit card. No cloud dependency. Everything runs locally.
What ThumbGate catches by default
Based on the failure patterns from the Claude Code drain threads:
Hard-blocked by default (DENY):
- Secret exfiltration (literal secrets, credential file paths in uploads/pipes)
- Attempts to disable ThumbGate's own guardrails
-
scp/rsync/cloud CLI uploads of credential files - Common interpreter one-liners that exfiltrate data
Warned by default (escalates to DENY with strict mode):
- Destructive filesystem commands (
rm -rfclass) - Force-push to protected branches
-
--no-verifycommits (bypassing CI) - Security/supply-chain risks
- Repeated token-burn patterns you've downvoted
Enable strict enforcement for everything:
THUMBGATE_STRICT_ENFORCEMENT=1
A real example
Here's what happens when Claude Code tries to force-push to main after seeing test failures:
Without ThumbGate:
Agent: "The tests are failing, but I can use --no-verify to skip them"
→ git commit --no-verify
→ git push --force origin main
→ Teammate's commit is overwritten
With ThumbGate:
Agent: "I'll use --no-verify to skip the failing tests"
→ ThumbGate: WARN — bypassing CI verification is a known failure pattern
→ Agent pauses, asks for confirmation
→ You say no
→ Agent fixes the tests instead
That 👎 feedback becomes a lesson. The next time any agent on your machine tries --no-verify, it gets blocked.
Why this is different from CLAUDE.md or .cursorrules
Prompt-based rules are suggestions the agent can ignore. ThumbGate operates at the tool-call level — once an action is routed through the gate, the agent cannot reason its way around it. The enforcement is deterministic, not probabilistic.
| Approach | Enforcement | Survives context reset | Learns from feedback |
|---|---|---|---|
| CLAUDE.md / .cursorrules | Suggestion (agent can ignore) | ❌ No | ❌ No |
| ThumbGate local gate | Hard allow/deny at tool-call boundary | ✅ Yes (SQLite) | ✅ Yes |
Market context: where ThumbGate fits
I researched the current AI agent safety/reliability market. Here's the landscape:
| Tool | Price | What it does | Where it acts |
|---|---|---|---|
| ThumbGate | $19/mo or $499 Diagnostic | Pre-action gate, local enforcement, self-improving | Before tool execution |
| AgentGuard | $15-$499/mo | Runtime security, code scanning, monitoring | Before action + scanning |
| Langfuse | $29-$2,499/mo | Tracing, evaluations, analytics | After the fact |
| LangSmith | $0-$39/seat | Tracing, debugging, deployment | After the fact |
| Portkey | Custom | Gateway, routing, cost control | Request-level |
| Helicone | $79-$799/mo | LLM monitoring, cost visibility | Request-level |
ThumbGate is the only product that combines local enforcement + learning from feedback + pre-action timing. The trade-off is narrower scope — it's not a full enterprise security platform. But for individual developers and small teams losing money to agent mistakes, it's the fastest path from "I just lost $20 to a cache bug" to "that won't happen again."
Pricing (no dark patterns)
-
Free local evaluate:
npx thumbgate init— first hard gate usually minutes after install - Pro: $19/month or $149/year — personal dashboard, recall, proof-ready exports, adapter coverage
- Diagnostic: $499 one-time — bring your failure, leave with one hard gate and proof in two business days
The $499 Diagnostic is a working session, not a strategy deck. You bring the failure pattern (a token burn incident, a force-push, a deleted config), and I map it, configure a gate, write a regression test, and deliver rollout/rollback proof.
What I learned building this
Observability without enforcement is a postmortem factory. Knowing what went wrong doesn't prevent the next occurrence. You need a gate that fires before execution.
Feedback must become infrastructure. A 👎 in a chat window disappears. A 👎 that becomes a ranked lesson in SQLite survives context resets and compounds across sessions.
Local-first removes adoption friction. Developers don't want to route their agent through a vendor's cloud to get safety. They want it local, inspectable, and private.
The market is fragmented on purpose. Observability teams, security teams, and FinOps teams all need different things. ThumbGate serves the developer who needs prevention, not just visibility.
Try it
npx thumbgate init
If you've been losing tokens to Claude Code drain, force-pushes, or destructive agent actions — this is the gate. It's free locally, installs in 60 seconds, and your feedback makes it smarter.
thumbgate.ai | GitHub | npm
I'm Igor Ganapolsky, builder of ThumbGate. I spent a decade shipping mobile infrastructure at Capital One and Booking.com before building AI agent safety tooling. If you want a configured gate for your specific failure pattern, the $499 Diagnostic maps it and installs proof in two business days.
Top comments (0)