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.
git clone --depth 1 https://github.com/ooples/token-optimizer-mcpWrote 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.
[](https://agentmods.dev/rules/ooples/token-optimizer-mcp/token-optimizer)<a href="https://agentmods.dev/rules/ooples/token-optimizer-mcp/token-optimizer"><img src="https://agentmods.dev/badge/rules/ooples/token-optimizer-mcp/token-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/ooples/token-optimizer-mcp/token-optimizer"><img src="https://agentmods.dev/badge/rules/ooples/token-optimizer-mcp/token-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00619 | $0.00619 |
| Opus 5.5 | $0.00248 | $0.00248 |
| Sonnet 5.5 | $0.00124 | $0.00124 |
| Haiku 4.5 | $0.00062 | $0.00062 |
Grade A, and why
token-optimizer 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 1mo 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.
What it actually says
Use a token-optimizer MCP tool only when that exact tool is visible in the current CLI's registered tool inventory. A config file or installed plugin is not proof that the server started successfully. If a named optimizer tool is absent, keep the native tool available and use a bounded native operation; never retry or redirect to an unregistered schema.
When registered, you MUST use the token-optimizer MCP tools for every route listed below instead of the corresponding built-in file, search, or shell tool. This is mandatory routing policy, not a preference: the optimized tools cache, diff, and bound output. Cursor's packaged native hook enforces the pre-tool routes below and injects graph findings when its lifecycle permits.
ALWAYS:
- Reading a file over ~25 KB, or ANY file already read this session -> smart_read (on a repeat it returns only what changed, not the file)
- Searching file contents -> smart_grep
- Finding files by name or pattern -> smart_glob
- Editing a file over ~25 KB -> smart_edit (returns a diff, not the whole file)
- Printing a large file via cat/head/tail/type/Get-Content -> smart_read
- Recursive shell searches (grep -r, rg) -> smart_grep
WHEN CONTEXT IS TIGHT: call optimize_session to move prior file operations out of context. Call get_optimization_report to show the user what was saved.
STASHING BULKY OUTPUT: optimize_text stores it under a key, out of context. Do NOT use compress_text for that -- its base64 output has MORE tokens than the input; it is for at-rest storage only.
LIVE GRAPH — THE ACTIVE MODEL DOES THE SEMANTIC HARVEST:
- When wiki_write is visible in the current tool inventory, call it as soon as you establish a durable, non-obvious conclusion: a failed approach and why, a decision and its rejected alternative, or the command that finally worked.
- Anchor every claim to a real file path or path#symbol. Never invent a claim merely to populate the graph, and do not delegate harvesting to another model.
- Include the concrete evidence, when it applies, confidenceLabel (verified/probable/speculative), scope (project/organization/global), and any condition that would invalidate it. Use project scope unless transfer is genuinely justified.
- Before finishing substantive work, reflect once and write any still-unrecorded conclusion while you hold the reasoning. This is what makes the lesson available across sessions and projects instead of losing it to compaction.
- If wiki_write is absent, do not claim the conclusion was harvested. Continue the work with native tools; lifecycle hooks may still capture structural facts.
NOT WORTH IT: small one-off reads, tiny edits. The built-ins are fine there -- the overhead would exceed the saving.
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.
- 1mo ago First seen · 52 lines · 619 tokens per session scan A 4b09a30ba0e0
token-optimizer is a cursor rule published in the GitHub repository ooples/token-optimizer-mcp (548 stars, last pushed yesterday), licensed MIT. It adds 619 tokens to every session, about $0.0025 per session on Opus 5.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-30.
Other cursor rules, from other repositories
compendium
Prefer the Compendium MCP gateway to shrink noisy/large context before pasting it into the conversation.
shadcn-tailwind-guide
A guide to building new components with shadcn/ui and Tailwind CSS, a utility-based system for styling interfaces.
dreamd-recall
Recall lessons, decisions, and prior context from the .agent/ memory daemon. Use when starting work in a project that has a .agent/ folder, when the user references a past decision, or when you are about to make a choice that has a documented prior.
testing
Guide for writing pytest unit and integration tests.
development-phase
A development rule that favors clear, well-structured new code and considers compatibility only when it costs nothing.
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.