token-guard

token-guard is a skill for Claude Code, Codex from Davidcreador/codex-token-guard. It costs 40 tokens per session (685 once invoked), scanned A, original, MIT.

A Codex skill that reduces unnecessary command and tool output while keeping errors, file paths, line numbers, test names, instructions, recent edits, and key design decisions.

In plain words
What is it for?
It is for focused file searches and reads, less noisy test output, token-usage checks, and saving important session details before context is shortened.
Why use it?
It cuts down noisy information that wastes the agent’s context space. It helps preserve the details needed to debug and continue work safely.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/davidcreador/codex-token-guard/token-guard
Any agent
npx skills add Davidcreador/codex-token-guard --skill token-guard
Clone the repo
git clone --depth 1 https://github.com/Davidcreador/codex-token-guard

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for token-guard

README.md
[![agentmods](https://agentmods.dev/badge/skills/davidcreador/codex-token-guard/token-guard.svg)](https://agentmods.dev/skills/davidcreador/codex-token-guard/token-guard)
Your own site
<a href="https://agentmods.dev/skills/davidcreador/codex-token-guard/token-guard"><img src="https://agentmods.dev/badge/skills/davidcreador/codex-token-guard/token-guard.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 685 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00040 $0.00685
Opus 5 $0.00020 $0.00342
Sonnet 5 $0.00008 $0.00137
Haiku 4.5 $0.00004 $0.00068

Measured 4d ago against content hash 841cdf8f8368, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

token-guard scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/token-guard/SKILL.md · 74 lines

How it starts

The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codex Token Guard

Use this skill when a Codex session needs lower token waste without lower output quality.

Operating Rule

Default to quality over savings. If uncertain, preserve content.

Workflow

  1. Prefer focused search and reads:
    • rg --files | sed -n '1,200p' instead of find .
    • rg "pattern" path/ instead of grep -r
    • sed -n '1,160p' file.ts instead of cat on large files
  2. Keep full error context:
    • actual error message
    • file path
    • line and column
    • failing test name
    • stack frame where useful
  3. Use CLI checks:
    • codex-token-guard stats
    • codex-token-guard stats --session
    • codex-token-guard snapshot
    • codex-token-guard benchmark
    • codex-token-guard notifications status
    • codex-token-guard digest status
  4. Before compaction, preserve:
    • goal
    • current status
    • key decisions
    • files touched
    • bugs/errors
    • next steps

Modes

  • safe: only blocks obvious waste.
  • balanced: default; blocks high-noise reads, warns on broad tests, compresses noisy output.
  • aggressive: strict budgets and fail-closed hook errors.

Quality Protection

Never remove user instructions, recent edits, architecture decisions, actual error messages, file paths, line numbers, API names, function names, or test names.

Notifications

Notifications are on by default. They show Token Guard estimated avoided, raw, and sent-token totals for blocked commands, output compression above the configured threshold, benchmark results, and Stop summaries. They are not Codex context-window UI readings.

Runtime metrics and session state live under .codex-token-guard/runtime/ so hooks do not edit tracked starter templates.

In-thread notices are enabled by default and stay one line at milestone scale: [token-guard] est. avoided 30k tokens (25%); guard sent 90k of 120k raw.

Context Digest is enabled by default. It injects a small session digest only on resume-style prompts, large prompts, or long sessions after enough hook activity since the last digest. It should not run every turn.

Read the full file on GitHub · 74 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 74 lines · 40 tokens per session scan A 841cdf8f8368

Subscribe to this mod's changes

token-guard is a skill published in the GitHub repository Davidcreador/codex-token-guard (2 stars, last pushed 2mo ago), licensed MIT. It adds 40 tokens to every session and 685 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.