Sarthak-madan334

Tokguard — Development skill for Claude Code

Development community

Token-saving toolkit for Codex, Claude Code, Antigravity, and other MCP-compatible coding agents.

How to install Tokguard

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

What Tokguard does

Token-saving toolkit for Codex, Claude Code, Antigravity, and other MCP-compatible coding agents. TokGuard helps reduce unnecessary context and command output with compact repo maps, targeted reads, output filtering, and budget tracking. Install with npx -y tokguard setup to configure supported assistants.

Alternatives in Development

  • Magic Compact — Lossless context compression plugin for Claude Code & OpenCode 144 ★
  • Xc MCP — XCode CLI MCP: Convenience wrapper for Xcode CLI tools & iOS Simulator 82 ★
  • Fya — PTY-backed Claude Code wrapper that provides claude -p compatible output 69 ★

README

tokguard (tg)

A lightweight token-saving toolkit for Codex, Claude Code, Antigravity, and other MCP-compatible coding agents.


One-command setup for Codex, Claude Code, and Antigravity

In PowerShell, run either:

npx -y tokguard setup

Or install the command once, then configure the assistants:

npm install -g tokguard
tokguard setup

`setup` registers TokGuard's MCP server in each assistant's user-level settings and adds a small managed instruction block so the assistants know when to use it. Existing settings are preserved. Restart the assistants after setup. The setup works across projects on that machine; use `tg init` below when you also want project-local TokGuard guidance and settings.

Project-local setup

`tg init` adds repository-specific instructions, `.tgignore`, and `.tokguard/config.json` without replacing existing files.

Optional Codex command with an external budget hard-stop:

python -m scripts.codex_guarded "Refactor user authentication service"

How Each Saving Works

1. Input Token Reduction (What enters the context)

  • tg map: Generates a compact AST/regex repo outline (~300 tokens vs 2,500+ for broad directory crawls).
  • tg find : Fast grep returning up to 20 hits with exactly 1 line of context.
  • tg read -: Reads only requested line ranges with line numbers.
  • Unchanged File Detection: Automatically hashes read files in .tokguard/session.json. Repeated reads output [unchanged since last read: lines X-Y] instead of re-injecting hundreds of lines.
  • tg slim : Safely removes comments, docstrings, and blank lines for read-only references.
  • Default .tgignore: Excludes build artifacts, locks, bundles, minified assets, and binary files.

2. Output Token Reduction (What commands and agent emit)

  • tg run -- : Executes shell commands and strips ANSI escapes, progress spinners, repea