wison693-stack

TokenGuard β€” Data skill for Claude Code

Data community

πŸ›‘οΈ Safety middleware for Claude Code & autonomous AI agents: real-time budget limits, prompt-caching-aware cost tracking, streaming (SSE) abort, Redis-backed shared limits and sha256 agent loop detec.

How to install TokenGuard

This entry records only its repository, not the path inside it, so there is no exact command to give. Open wison693-stack/TokenGuard and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What TokenGuard does

πŸ›‘οΈ Safety middleware for Claude Code & autonomous AI agents: real-time budget limits, prompt-caching-aware cost tracking, streaming (SSE) abort, Redis-backed shared limits and sha256 agent loop detection.

Alternatives in Data

  • App Store Compliance β€” Avoid common App Store and Google Play rejections 3.6k β˜…
  • Azure Event Hub .net β€” High-throughput event streaming 1.8k β˜…
  • Wp Perf Review β€” WordPress performance code review - detects database anti-patterns, caching issues, hook problems, and scalabi 76 β˜…

README

TokenGuard πŸ›‘οΈ

**Safety middleware for Claude Code and autonomous AI agents.** TokenGuard sits between your agent and the LLM API and stops the two things that quietly burn money: **runaway API spend** and **infinite agent loops**. Zero required dependencies, pure Python 3.8+.

 agent ──► TokenGuard ──► LLM API
            β”‚  cache-aware cost tracking     β”‚  streaming abort
            β”‚  sha256 loop detection         β”‚  Redis-backed shared limits
            └─► AgentAlert: bell + banner + hooks (Slack / webhook / logs)

Table of contents

  1. The problem
  2. Features
  3. Installation
  4. Quick start
  5. Running the tests
  6. Usage guide
  7. API reference
  8. Project layout
  9. How it works
  10. Limitations & notes
  11. FAQ
  12. Contributing

🎯 The problem

When AI CLI agents (Claude Code and friends) run fully autonomously, three things go wrong:

  1. Infinite execution loops. The agent keeps re-running a failing command (pytest, npm test, a syntax fix) and re-sends nearly the same turn hundreds of times, burning thousands of tokens without progress.
  2. Uncontrolled API costs. High-context loops can burn $50+ in minutes before anyone notices.
  3. Blind spots in modern setups. Streamed (SSE) answers, prompt-cache discounts and multi-instance deployments make naive "tokens x price" accounting wrong or useless.

πŸš€ Features

Feature What it does
**Real-time cos