weeder
Skill4 starsChanged 16 days agoMITView on GitHub
Measure and reduce a Skill's token footprint (always-loaded description + on-trigger SKILL.md body) without regressing routing accuracy or losing instructions. Use when a SKILL.md feels oversized, repeats rules, or has a vague description that might mis-route.
In this repository5 other files it gives its agents.
- compostSkill
- greenhouseSkill
- myceliumSkill
- prunerSkill
- seedbankSkill
The file
Files
weeder
!"${CLAUDE_SKILL_DIR}/bin/weeder" mode --banner
Agents that do not expand the line above (e.g. Codex): run
<this-skill-dir>/bin/weeder mode --banner first and follow it.
The description loads every session; the SKILL.md body loads on every
trigger. Never optimize on token count alone: a shorter SKILL.md that
routes worse or drops an instruction is a regression. Every step below
produces before/after evidence. Run all commands as
python3 <this-skill-dir>/scripts/weeder.py <cmd>.
- Audit:
audit <skill_dir>. Token counts per section (description vs. body, chars/4 estimates unless calibrated), duplicate rules, filler, movable background/examples. Read all of it;optimizeacts on only part. - Mechanical pass:
optimize <skill_dir> --out <skill_dir>-optimized. Moves background/examples sections intoreferences/with a pointer. Lossless and reversible, so it's safe to always apply; it does not touch the description or duplicates. - Judgment pass, in the
-optimizedcopy: shorten the description (keep concrete trigger nouns/verbs), state each duplicated rule once where the workflow needs it, cut only instructions that are genuinely obvious to a capable agent; don't cut something just because it's short. Optional structured help:suggest <skill_dir> --assist slight --json, thenapply-suggestion <skill_dir> --answer <answer.json> --out <skill_dir>-optimized(seereferences/llm-assist.md; an assisted answer gets no free pass). - Routing:
test-routing <skill_dir> --examples <examples.json> [--competing <other_skill_dir> ...]on both original and copy.examples.json={"positive": [...], "negative": [...], "ambiguous": [{"prompt":, "expected": "trigger"|"no_trigger"|"either"}]}; if none exists, write 5-10 real triggers, a few unrelated prompts and borderline cases. Always pass sibling skills as--competing. Limits of this lexical proxy:references/routing-heuristic.md. - Function:
test-function <skill_dir> <skill_dir>-optimizedchecks every never/must/do-not sentence survives (in SKILL.md or a reference). A MISSING constraint is a hard blocker, not a warning. - Report:
diff <skill_dir> <skill_dir>-optimized --examples <examples.json> --competing .... - Accept only if routing accuracy after >= before (minus a small tolerance: a couple of points of a lexical proxy is noise) AND constraint preservation is 100%. Otherwise do another pass in step 3; don't lower the bar to make a bad result pass.
With the plugin, prefer delegating the whole workflow to the weeder
agent (it preloads this skill and returns only the report) so the audit
output stays out of your context.
Classification rules and why step 3 isn't automated:
references/classification.md.
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
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.

