More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Token Diet Guardian

    1

    Keep your AI coding assistant sharp and token-efficient. Audit oversized instructions, neutralize unmonitored git hooks, and convert monolithic prompts into on-demand LUT Routers.

    Free

    Security scanned
    Token Diet Guardian

    Token Diet Guardian

    Example session with this skill installed

    Audit my .cursorrules file for bloat and optimize it using the LUT pattern. It's getting too big and the AI is losing track of my tech stack.

    • Read your context and instructions
    • Compiled the token diet guardian

    [Engine: token-diet-cli (Python CLI v0.3.2) | Skill: Token Diet Guardian v1.0]

    I audited your workspace directives and pre-commit hooks:

    Baseline Footprint Audit

    Directive / FileBytesTokensCLI Engine StatusSkill Target (3 KB)
    .cursorrules5,432 B~1,358[WARN]Exceeds Target
    .git/hooks/pre-commit58 B-🚨 HOOK ALERTAction Required

    Proposed Refactor Preview (Diff against .cursorrules.bak)

    --- a/.cursorrules
    +++ b/.cursorrules
    @@ -1,80 +1,13 @@
    -# Phoenix Storefront Directives (Monolithic Instructions)
    +# Phoenix Storefront Directives (Core Router)
     Project: Phoenix E-Commerce
     Core Stack: Next.js 14, TypeScript, Tailwind CSS, Prisma ORM.
    -Test Runner: npm run test:unit
    -Linter: npm run lint
    +Test Command: npm run test:unit
    +Lint Command: npm run lint
    +
    +## On-Demand Instructions (LUT Router)
    +Load specialized procedure files only when active task requires them:
    +- Database Migrations & Schemas: Read skills/database/SKILL.md
    +- Styling & Tailwind Design System: Read skills/styling/SKILL.md
    +- API Security & Zod Validation: Read skills/security/SKILL.md
    +- Production Deployment Checklist: Read skills/deployment/SKILL.md
    +- Domain Business Rules (Orders, Billing): Read docs/business-rules.md
    

    Proposed Hook Remediation (--dry-run preview)

    --- a/pre-commit
    +++ b/pre-commit
    @@ -2,4 +2,4 @@
     set -e
     
     npm run test:unit
    -claude review --all
    +# [token-diet disabled]: claude review --all
    

    Would you like me to apply these changes? (Safety backups will be created as .bak).


    [User approves: "Yes, proceed"]

    [Engine: token-diet-cli (Python CLI v0.3.2) | Verification Re-Audit]

    Post-Remediation Verification

    MetricBaselinePost-RefactorDeltaStatus
    Root File (.cursorrules)5,432 B (~1,358 tok)634 B (~158 tok)-88.3%[OK] Lean Router
    Hook StatusUnmonitored LLM activeNeutralized with .bakNeutralizedNeutralized, backup created
    • [Engine: token-diet-cli v0.3.2 | Re-audit] Sizes and hook status confirmed deterministically.
    • [Agent check, not CLI] Rule coverage: 100% of original domain rules, database schemas, and style constraints placed in on-demand skill files; 0 lines unplaced.
    • Backups Created: .cursorrules.bak, .git/hooks/pre-commit.bak.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    "Your AI agent doesn't need more context. It needs the right context."

    As projects grow, developer instructions naturally accumulate: database schemas, framework constraints, styling rules, deployment checklists, and testing patterns. Before long, files like .cursorrules, CLAUDE.md, or .windsurfrules swell into 15–30 KB instruction monoliths.

    This creates friction in every development session:

    • Static Overhead: Your agent re-reads thousands of instruction tokens on every message, even when fixing a 2-line typo.
    • Instruction Clutter: Forcing dozens of pages of guidelines into working memory clutters prompt space with rules unrelated to your immediate task.
    • Unexpected Background Leaks: Background scripts or pre-commit hooks can silently invoke cloud LLMs on local commits, unexpectedly consuming API quota.

    Token Diet Guardian brings Context Engineering to your workspace. It restructures monolithic prompt files into lean Look-Up Table (LUT) Routers with on-demand pointers.

    What it does

    • Dual-Mode Context Auditing: Runs in Native Heuristic Mode (zero dependencies) or via the optional official CLI engine (token-diet-cli==0.3.2) for byte-exact metrics, optional MCP schema auditing (--mcp), and global directive inspection (--global).
    • Look-Up Table (LUT) Routing: Reorganizes monolithic directives into a lean central router under 3 KB with on-demand pointers.
    • On-Demand Knowledge Extraction: Offloads specialized workflows (like deployment runbooks or database protocols) into modular reference files (skills/<name>/SKILL.md).
    • Safe Pre-Commit Hook Neutralization: Inspects .git/hooks/pre-commit for unmonitored cloud LLM calls, previews remediation with --dry-run, and neutralizes them only after explicit confirmation.
    • Measured Impact Reporting: Re-measures after refactoring to show before-and-after byte counts and estimated token savings.

    How it works

    1. Engine Discovery & Consent: Runs non-mutating discovery queries (command -v token-diet, python3 --version). If missing, asks if you want to install it via pipx/venv or proceed with native heuristic file inspection (zero installs).
    2. Baseline Audit: Generates an initial report labeled [Engine: token-diet-cli (Python CLI v<version>)] or [Engine: Native Heuristic Inspection].
    3. In-Memory Preview & Confirmation: Drafts the new router and extracted modules entirely in memory first, checks rule coverage, and shows you the proposed diff before creating any files. Only after your explicit approval does it create safety backups (<file>.bak, timestamped if one exists) and write to disk.
    4. Post-Refactor Verification: Re-measures sizes (CLI or native) and runs a rule-coverage check. Lines without a destination are listed for your review.

    Supported Environments

    Designed for coding assistants and environments with project-level instruction files and filesystem access:

    EnvironmentInstruction FileEngine Support
    Claude CodeCLAUDE.md, ~/.claude/CLAUDE.md*CLI + native
    Cursor.cursorrulesCLI + native
    Cursor (project rules).cursor/rules/*.mdc, .mdCLI + native
    Windsurf.windsurfrulesCLI + native
    Codex / multi-agentAGENTS.md, ~/.codex/AGENTS.md*CLI + native
    Gemini CLIGEMINI.md, ~/.gemini/GEMINI.md*CLI + native
    OpenCodeAGENTS.md (refactor), opencode.json (audit-only)CLI + native
    Roo Code / Cline.clinerulesCLI + native

    *Note on Global Files: Directives in home directories (~/.claude/CLAUDE.md, ~/.codex/AGENTS.md, ~/.gemini/GEMINI.md) are audited on request only. The skill will never refactor global user directives without explicit, separate approval.

    Why this beats prompting it yourself

    Manual prompt optimization is tedious and prone to accidental rule loss. Token Diet Guardian enforces a rigorous safety protocol: in-memory preview before writes, safety backups (<file>.bak, timestamped if one exists), user diff confirmation before writing, post-refactor re-audit, and transparent engine labeling. Application code is never modified (the skill only modifies prompt governance files and optionally .git/hooks/pre-commit with explicit confirmation).

    Known Limitations & Transparency

    • Byte vs. Token Counts: Byte counts are exact in CLI mode. Token counts are estimates in both modes (~4 characters per token).
    • Pointer Adherence: The router reduces context only if the assistant follows its pointers and loads the referenced files on demand; this depends on the agent and cannot be guaranteed. Use plain-text pointers ("Read X when..."), not @path imports, which some tools load at session start regardless.
    • Hook Inspection Scope: Only .git/hooks/pre-commit is inspected (husky, lefthook, or pre-push hooks are not covered).
    • Application Code Untouched: Focuses strictly on prompt architecture and pre-commit hooks; application code is never modified.
    • Network & Privacy: The skill itself makes no network calls; your assistant processes your files as it normally does with its LLM provider.
    • Terminal Execution: Command execution is optional and used solely when the user approves using the CLI engine (token-diet-cli) or running --fix-hooks. In Native Heuristic Mode, only file read/write tools are used; non-mutating discovery queries check tool availability.
    • Workflow Variations: Actual API invoice savings depend on session length, agent implementation, and provider caching dynamics.
    • Requires workspace filesystem tools to inspect files and create backups.

    Versioning Note

    The Agensi Skill package is versioned at v1.0 (the instruction bundle). The underlying optional open-source Python engine on PyPI (token-diet-cli==0.3.2) follows its own independent library semantic versioning.

    Open Source Engine Companion

    Token Diet Guardian is the official skill companion to the open-source token-diet engine:

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Prompt & Skill Engineering.

    Byte counts are exact in CLI mode; token counts are estimates (approx. 4 chars/token). Router reduces context only if assistant follows on-demand pointers. Only .git/hooks/pre-commit is inspected. Global user directives (~/.claude, ~/.codex, ~/.gemini) are audited on request only and never refactored without separate explicit consent. Application code is never modified. The skill itself makes no network calls.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 4 days ago

    • Free with an Agensi account

    Software
    Git
    Optional
    Python 3.10+
    pipx
    orvenv
    Terminal / Shell Execution

    Works out of the box with native file tools. Python 3.10+ and terminal execution are required only for the optional deterministic CLI engine. Non-mutating read-only discovery queries check engine availability.

    Permissions

    Read Files
    Write Files

    Zero network calls made by the skill itself; your assistant processes files as it normally does with its LLM provider. Network is used solely if the user explicitly approves installing the optional token-diet-cli engine from PyPI.

    Listed4 days ago
    Updated3 days ago

    What's inside

    Frequently Asked Questions

    By restructuring monolithic instruction files into a Look-Up Table (LUT) Router, the assistant is designed to load only core project invariants on every turn, keeping specialized guides in on-demand files. This reduces static context overhead; actual token and cost savings depend on session length, agent caching behavior, and model provider pricing.

    Token Diet Guardian supports coding environments that read local Markdown-based governance files, including Cursor (.cursorrules), Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / multi-agent workspaces (AGENTS.md), Gemini CLI (GEMINI.md), OpenCode, and Roo Code / Cline (.clinerules).

    It is designed to be. Before any change, the skill creates safety backups (<filename>.bak), shows you a diff, and waits for your explicit approval. After refactoring it re-measures file sizes and runs a rule-coverage check: every line of the original is checked to appear in the new router or in an extracted file, and any line without a destination is listed for your review. This check is performed by the agent, not by the CLI, and it cannot detect meaning lost through rewording, so review the diff before approving. Application code is never modified.

    3 KB (~750 tokens) is the skill's target budget for root router files. Separately, the diagnostic engine labels individual files by exact byte thresholds (calibrated at 1 KB = 1,000 bytes to align with ~4 chars/token): [OK] for files up to 4,000 B (~1,000 tokens), [WARN] from 4,001 to 16,000 B (~1,000 to 4,000 tokens), and [ALERT] above 16,000 B (> 4,000 tokens). Native Heuristic Mode applies the same thresholds so reports from both modes are directly comparable. The skill proposes a refactor for files marked [WARN] or [ALERT], or whenever you ask; files marked [OK] are left alone.

    No. Token Diet Guardian runs out of the box using native file tools (zero installs required). Python 3.10+ and pipx or venv are required only for the optional deterministic CLI engine (token-diet-cli==0.3.2); native mode needs none of it. The assistant will always ask for your explicit consent before running any installation.

    If .git/hooks/pre-commit contains calls to cloud LLMs (for example an unexpected AI CLI or tool invocation), the skill previews the change with --dry-run and asks for your approval before commenting out or neutralizing only that call. Test runners and linters such as pytest or npm test are preserved. In CLI mode the tool keeps a .bak backup and the file's executable permission. In Native Heuristic Mode the agent edits the file itself: it creates a .bak, then checks that the hook is still executable and valid, and shows you the result. Only .git/hooks/pre-commit is inspected; other hooks (pre-push, husky, lefthook) are not covered.

    The package contains the SKILL.md definition with the LUT Router behavioral contract, bilingual ready-to-use prompt templates (English and Spanish), safety backup protocols, and integration guides for the optional open-source token-diet-cli engine.

    New in Prompt & Skill Engineering

    Free