Tokguard — Development skill for Claude Code
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
Related Skills
Straitjacket
A context sidecar for coding agents (Claude Code, Codex, Antigravity, and more). Cut wasteful token spend, red
Via Claude Code
Keep Claude Code as the lead and hand the work to Codex, Gemini (Antigravity), OpenCode or pi as native subage
Prodex
Prodex is a multi-account, multi-provider Codex wrapper with auto-rotation, Super mode, Smart Context, and tok
Askai Status
Which token-saving tools are installed and wired (RTK, Context Mode, Serena, markitdown, Caveman, path rules),
Tokenwise
TokenWise: Make Every Token Count for Your Agent. Compact tool output, compaction that loses nothing, and filt
Context Budget
Analyze context window usage across agents, skills, MCP servers, and rules to find optimization opportunities.
Related Agents
Token Tracker
Logs token usage estimates for each agent run to .claude/token-stats.json. Call this after any agent completes
Lean Coder
Token-efficient coding agent for any project. Use for edits, refactors and bug fixes (multi-file or unfamiliar
Tokless Coder
Lightweight coding execution agent with MCP servers stripped (inheritMcp: false) and core file/command tools o