Cut my always-loaded Claude Code context by 57.5% (7,337 -> 3,121 tokens) and built a model-compatibility lint + skill factory (tq-forge, MIT) - DEV Community

DEV Community

Tanishq Agarwal
Tanishq Agarwal

Posted on Edited on

Cut my always-loaded Claude Code context by 57.5% (7,337 -> 3,121 tokens) and built a model-compatibility lint + skill factory (tq-forge, MIT)

After building dozens of custom skills and subagents in Claude Code, two problems kept biting me:

  1. Always-loaded skill definitions were burning 7,300+ tokens before I even typed a prompt.
  2. A skill that worked great on Opus would quietly degrade on Sonnet or Haiku—and pinned model IDs in templates kept going stale.

So I built tq-forge (MIT) — an open-source CLI and Claude Code plugin that scaffolds, learns, scores, compresses, and promotes skills and 5-file subagents.

What it actually does under the hood

  • Lossless Context Optimizer (/savings): Compresses always-loaded skill context without losing MCP server availability. On our test-suite benchmark fixture, it cut always-loaded tokens from 7,337 down to 3,121 (-57.5%), and is 100% reversible with restore.
  • 0–100 Structural Rubric + Model-Compatibility Lint: Runs 320 deterministic scorer assertions and checks model compatibility before promoting any artifact from sandbox to production (/tq-forge-test, /tq-forge-promote).
  • Forge from Intent or Auto-Learn (/tq-forge-skill, /tq-forge-agent, /tq-forge-learn): Generate a SKILL.md or 5-file subagent from a one-line prompt—or point /tq-forge-learn at a doc page, browser workflow, or technical thread to deduplicate links (linkdedupe) and distill repeatable steps into a scored skill.
  • Weekly Model Sync: Automated GitHub workflow that detects new Claude model IDs, updates templates, runs 165 unit tests, and opens a PR so agents don't drift onto retired models.

Install & Try

Happy to share the scoring rubric or optimizer diff if anyone wants to inspect how the token compression works!


If tq-forge saves tokens or catches model drift in your Claude Code setup, drop a star on GitHub (https://github.com/tanishq286/tq-forge) — it helps other Claude Code builders discover the project and directly supports our open-source cross-model eval roadmap!

Top comments (1)

Collapse
 
halfcycle profile image
Halfcycle •

Nice result. One thing to watch when compressing: the description line is also what the agent reads to decide whether a skill applies, so a shorter one can quietly stop matching requests it used to catch. Does the rubric test that a compressed skill still triggers on the same prompts as before? We wrote up how loading and picking work in Claude Code and Codex, if useful: halfcycle.ai/writing/agent-skills