claude

token-guard

Token consumption guards: large-read warning (100KB+), per-session read budget, subagent cap, and a token budget that asks for /compact.

10 on GitHubby yurukusav1.1.0MITupdated 1 month agooptimization
/

Plugin token-guard from marketplace cc-safe-setup in yurukusa/cc-safe-setup. Commands read from the repo's manifest — 1 month ago.

This plugin runs code on your machine — its hooks fire automatically on events like tool use. The exact commands are listed below; read them before installing.

What it installs

Hooks (4)

  • PreToolUse

    INPUT=$(cat); FP=$(printf %s "$INPUT" | { if command -v jq >/dev/null 2>&1; then jq -r '.tool_input.file_path // empty' 2>/dev/null; elif command -v python3 >/dev/null 2>&1; then python3 -c 'import sy

  • PreToolUse

    BUDGET=${CC_READ_BUDGET:-100}; WARN=${CC_READ_WARN:-50}; T=/tmp/cc-read-budget-$PPID; INPUT=$(cat); FP=$(printf %s "$INPUT" | { if command -v jq >/dev/null 2>&1; then jq -r '.tool_input.file_path // e

  • PreToolUse

    MAX=${CC_MAX_AGENTS:-3}; T=/tmp/cc-agents-$PPID; C=0; [ -f "$T" ] && C=$(cat "$T"); C=$((C+1)); echo $C > "$T"; [ $C -gt $MAX ] && { echo "[BLOCK token-guard] Subagent limit (${MAX}). Complete existin

  • PostToolUse

    WARN=${CC_TOKEN_BUDGET:-50000}; BLOCK=${CC_TOKEN_BLOCK:-100000}; T=/tmp/cc-tokens-$PPID; INPUT=$(cat); SZ=${#INPUT}; TK=$((SZ/4)); TOTAL=0; [ -f "$T" ] && TOTAL=$(cat "$T"); TOTAL=$((TOTAL+TK)); echo

View source on GitHub yurukusa.github.io

More from yurukusa/cc-safe-setup

All 4 plugins →

Protect secrets and credentials: block writes to .env files, detect API keys in commands, prevent hardcoded tokens, guard service account files.

hooks

10

Git safety hooks: block force-push, protect main/master, prevent hard reset, guard interactive rebase, and block git clean -fd.

hooks

10

5 essential safety hooks: block rm -rf, force-push, hard-reset, env overwrites, and package publish. The minimum viable safety net.

hooks

10

Similar plugins

nextjs

claude

Official Next.js skills: adopt and optimize Cache Components, adopt Partial Prefetching, and verify runtime behavior against a running dev server.

6 skills

vercel/next.js 143,495

Token usage tracking, model cost attribution per agent, budget alerts, and optimization recommendations

24 skills · 1 command · 1 agent · hooks

ruvnet/ruflo 81,589

Skill: add headroom-ai compress() to a Python or TypeScript app to cut LLM input tokens (tool outputs, logs, JSON, chat history). No API key.

1 skill

headroomlabs-ai/headroom 79,508

mem0

claudecodex

Cross-session memory and token savings for coding agents.

6 skills · 1 agent · 1 MCP server · hooks

mem0ai/mem0 68,893

azure

claude

Transform Claude into an Azure expert. This plugin integrates the Azure MCP server and specialized Azure skills to move beyond generic advice. It enables Claude to perform real-world tasks: listing resources, validating deployments, diagnosing infrastructure issues, and optimizing costs across 50+ Azure services.

44 skills · 1 MCP server

anthropics/claude-plugins-official 47,076

ifixai

claudecodex

Independent auditing for AI agents, open source. Claude discovers your setup, confirms the cost, and audits your agent against the one question other tools skip: is it doing the job it's supposed to do, given your business rules and org structure? Test any model (Anthropic, OpenAI, Gemini, Azure, Bedrock, …) graded by self, one independent judge, or a cross-vendor panel; each provider is billed to its own account via a key in your settings, never the command line. Results render as an interactive artifact (with a static-report fallback).

1 skill · hooks

ifixai-ai/iFixAi 45,158

Maintain token-guard?

This page updates itself from your repo. Add the badge to your README, or get it Featured to pin it above the organic results with a followed link to your site.

claude & codex plugins4 plugins