agentleFS
Lesile-YinLesile-Yin/agent-skills/skills/token-saviour/SKILL.md

token-saviour

Skill2 starsChanged 3 months agoMITView on GitHub

Route each sub-task to the cheapest adequate tool across a 4-layer routing table (serena / rtk / caveman / Ponytail), cutting overall token spend by ~70%. Use when an agent loop's context is ballooning, when choosing between heavy and light tooling for a sub-task, or when budgeting a long-running job.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. vagkaratzas/skills★ 4same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before spinning up an expensive coding agent for a small, well-scoped edit.

    line 18
  2. Distinctive:

    When a conversation history exceeds a token threshold and must be trimmed.

    line 19
  3. Distinctive:

    When deciding which model/agent should own a sub-task.

    line 20
  4. Distinctive:

    When a task can be done by a formatter, a linter, or a grep instead of a chat.

    line 21
  5. Distinctive:

    Run Layer 3 on everything that crosses into Layer 4.

    line 41
  6. Distinctive:

    After the sub-task, report the delta vs.

    line 46

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Token Saviour

Token discipline is a routing problem, not a willpower problem. token-saviour picks the lightest tool that can still do the job, then compresses what must be sent. It is the operational layer beneath token-warden's budget accounting.

When to use

  • Before spinning up an expensive coding agent for a small, well-scoped edit.
  • When a conversation history exceeds a token threshold and must be trimmed.
  • When deciding which model/agent should own a sub-task.
  • When a task can be done by a formatter, a linter, or a grep instead of a chat.

Workflow

Step 1 — Classify the sub-task

Tag it on two axes: token-cost sensitivity (how much context it drags) and adequacy floor (minimum capability needed). A rename is high-sensitivity, low-floor; an architecture decision is high-sensitivity, high-floor.

Step 2 — Consult the 4-layer routing table

See references/routing-table.md for the full matrix. In short:

  • Layer 1 — serena: structural/semantic code ops (symbol rename, find-usages) that a language server does cheaper than an LLM.
  • Layer 2 — rtk (regex/toolkit): deterministic text transforms, search, bulk edits a script handles without a model.
  • Layer 3 — caveman: compress any context before it reaches a model.
  • Layer 4 — Ponytail (heavy agent): only when lower layers cannot meet the adequacy floor.

Step 3 — Compress inputs, cap history

Run Layer 3 on everything that crosses into Layer 4. Cap rolled-up history to the last N meaningful turns; archive the rest to a retrievable note, not the live context.

Step 4 — Measure and report

After the sub-task, report the delta vs. the naive "send everything to the heavy agent" baseline. A good call shows savings; a bad call shows where the floor was missed.

Anti-patterns (never do these)

  • Routing everything to Layer 4 "just to be safe" — that is the bug it fixes.
  • Compressing load-bearing context to hit a number — adequacy first, thrift second.
  • Skipping the measurement — unseen savings aren't savings.
  • Treating the table as fixed — re-tune thresholds per project.

Output contract

Return a routing decision: chosen layer(s), the estimated token delta vs. baseline, and one line of rationale. If no layer meets the adequacy floor, say so explicitly and escalate rather than guessing.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.