5-layer token defense without breaking your KV cache.
Token Guard (token-guard) equips Antigravity, Claude Code,
Cursor, Codex, and Gemini CLI with deterministic read deduplication, noisy command
output compression, a cache-safe <350-token skill, and a JSONL transcript auditor.
npx skills add jaxels1/token-guard
python3 scripts/audit_transcript.py --scan-all
5 Defense Layers
Compaction-Aware read_guard
Resets on PreCompact, auto-trims overlapping ranges, provides a 2nd-try escape hatch, and returns automatic AST/regex symbol outlines on >500-line files.
Allowlist-Friendly cmd_filter
Preserves command prefixes (<cmd> 2>&1 | python3 cmd_filter.py --pipe), delegates to rtk when installed, and spills raw logs to %TEMP%.
search_guard & Sub-2ms Daemon
Caps monorepo rg / Grep explosions at 80 matches (excluding node_modules & lockfiles) and serves hooks from a persistent worker (p50 = 1.95 ms).
Live A/B + --scan-all Scorecard
Ships a live GPT-6.1 Terra CLI A/B runner (live_codex_ab.py), a 24-task deterministic A/B harness (ab_benchmark.py), and a zero-config machine scanner (audit_transcript.py --scan-all).
Live GPT-6.1 Terra A/B + 24-Task Harness + 63-Session Replay
Live GPT-6.1 Terra A/B
On gpt-6.1-terra (live_codex_ab.py): -78.3% tool output bytes (31.6 KB → 6.9 KB), -36.4% input tokens on noisy test diagnosis (-24,845 tok), -20% tool calls, and 100% pass rate.
24/24 Pass · p50 1.95 ms
Across 24 deterministic tasks in ab_benchmark.py (including 6 rebound slice reads): 100% pass rate, 443k → 22k fresh tokens (-95%), and 1.95 ms median daemon latency.
-55.5% Replay Recoverable Burn
Offline replay across 63 ChatGPT / Codex sessions (15,024 calls) identified 14.75M recoverable tokens (59.0 MB) out of 26.56M fresh uncached input tokens.
2,951 Dup Reads & -80.7% Output
Flagged 2,951 duplicate file reads and compressed oversized tool outputs from 47.61 MB to 9.17 MB while preserving a 97.8% KV cache hit rate.