agentleFS
saitarrunsaitarrun/Devforge-ai/skills/token-efficiency/SKILL.md

token-efficiency

Skill4 starsChanged 5 months agoApache-2.0View on GitHub

Token conservation economics, bounded context-window pruning, AST structural query optimization, and high-precision prompt budget discipline.

12 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 6

    Distinctive

    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:

    When analyzing large codebases or executing multi-agent pipelines, follow the Token Conservation Hierarchy:

    line 15
  2. Distinctive:

    Never re-read files already present in memory or referenced by previous steps.

    line 36
  3. Distinctive:

    Prefer targeted inspection: fetch only the exact 30–50 lines of an implementation seam rather than the entire 2,000-line module.

    line 37
  4. Distinctive:

    Do not run unconstrained recursive text searches that dump thousands of matched lines into the context window.

    line 44
  5. Distinctive:

    When modifying code, use targeted line replacements rather than rewriting entire files.

    line 48
  6. Distinctive:

    If an error persists after 3 focused attempts, trip the circuit breaker and request targeted user guidance rather than burning tokens in …

    line 53

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “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 Efficiency & Precision Engineering Skill

This skill enforces strict token conservation, prevents context-window bloat, and optimizes model invocation costs while maximizing code generation and diagnostic accuracy.


1. Token Conservation Hierarchy

When analyzing large codebases or executing multi-agent pipelines, follow the Token Conservation Hierarchy:

[Level 1: Semantic AST Query (Lowest Token Cost: ~50-200 Tokens)]
  ↳ Query code-review-graph or symbol definitions; avoid loading full files.
          ↓
[Level 2: Targeted Line-Range Slice (Minimal Cost: ~200-500 Tokens)]
  ↳ Read only the specific target function / interface lines (StartLine to EndLine).
          ↓
[Level 3: Compact Handoff Artifacts (Bounded Cost: ~500-1,500 Tokens)]
  ↳ Never pass entire conversation logs forward; distill decisions into clean markdown handoffs.
          ↓
[Level 4: Full File Reads (Cautious / Restricted: >2,000 Tokens)]
  ↳ Read entire files only when strictly required for syntax validation. Never read binary or vendor files.

2. The 5 Rules of High-Precision Token Economy

Rule 1: Zero Redundant File Dumps

  • Never re-read files already present in memory or referenced by previous steps.
  • Prefer targeted inspection: fetch only the exact 30–50 lines of an implementation seam rather than the entire 2,000-line module.

Rule 2: Handoff State Compaction

  • At every phase boundary (Plan -> Build -> Verify -> Ship -> Operate), write a structured summary to handoffs/<phase>-handoff.md.
  • Downstream agents only read the handoff file, resetting conversation token depth back to zero and avoiding exponential context degradation.

Rule 3: Structural Search Over Greedy Grep

  • Do not run unconstrained recursive text searches that dump thousands of matched lines into the context window.
  • Filter queries with file extensions and directory boundaries (e.g. apps/claims-engine/src/**/*.ts).

Rule 4: Compact Diff Chunks on Edits

  • When modifying code, use targeted line replacements rather than rewriting entire files.

Rule 5: Token-Aware Ralph Loop Circuit Breaker

  • In the self-correction build loop, if a test fails:
    1. Extract only the specific failure stack trace (not the full 10,000-line test log).
    2. If an error persists after 3 focused attempts, trip the circuit breaker and request targeted user guidance rather than burning tokens in endless loops.

3. Token Efficiency Metric Checklist

  • Context window initialized using distilled handoff.md instead of full chat transcript
  • Codebase explored via AST call-graphs instead of bulk file reads
  • Test failure outputs pruned to relevant assertion diffs
  • Edits applied via surgical replacement chunks

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.