oliverweissl/context-garden / skills/weeder
weeder
VerifiedMeasure 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.
| File | Kind | Size |
|---|---|---|
| .gitignore | other | 32 B |
| SKILL.md | skill md | 3.1 KB |
| agents/weeder.md | markdown | 1.2 KB |
| bin/weederexecutable | script | 292 B |
| references/classification.md | markdown | 4.9 KB |
| references/llm-assist.md | markdown | 2.1 KB |
| references/routing-heuristic.md | markdown | 4.1 KB |
| scripts/cg_mode.py | script | 5.4 KB |
| scripts/we_apply_suggestion.py | script | 5.7 KB |
| scripts/we_audit.py | script | 5.6 KB |
| scripts/we_config.py | script | 2.5 KB |
| scripts/we_constraints.py | script | 5.1 KB |
| scripts/we_dupes.py | script | 6.1 KB |
| scripts/we_filler.py | script | 4.9 KB |
| scripts/we_optimize.py | script | 4.3 KB |
| scripts/we_parse.py | script | 5.0 KB |
| scripts/we_routing.py | script | 4.5 KB |
| scripts/we_suggest.py | script | 3.8 KB |
| scripts/we_text.py | script | 2.1 KB |
| scripts/we_tokens.py | script | 4.1 KB |
| scripts/weeder.pyexecutable | script | 12.0 KB |
| tests/fixtures/answer_lot.json | config | 875 B |
| tests/fixtures/filler_sentences.json | config | 2.6 KB |
| tests/fixtures/routing_examples.json | config | 489 B |
| tests/smoke_test.shexecutable | script | 14.3 KB |
scripts/we_suggest.py
View on GitHub"""Shapes audit_skill() output into judgment requests for the invoking agent;
`--assist` controls how many are emitted, not their content. Schema:
references/llm-assist.md."""
from __future__ import annotations
from we_audit import audit_skill
def _description_shorten_request(report: dict) -> dict:
return {
"kind": "description_shorten",
"current_description": report["description"],
"current_tokens": report["description_tokens"],
"instructions": (
"Draft 2-3 candidate shorter descriptions for this skill's frontmatter. Cut "
'generic phrasing ("this skill helps you with...", "use this whenever you '
'need..."); keep concrete trigger nouns/verbs a real prompt would contain. Pick '
'one and answer with {"description_shorten": {"new_description": "..."}}.'
),
}
def _duplicate_consolidation_request(report: dict) -> dict:
groups = [
{
"group_index": i,
"max_similarity": g["max_similarity"],
"members": [{"member_index": j, **m} for j, m in enumerate(g["members"])],
}
for i, g in enumerate(report["duplicate_groups"])
]
return {
"kind": "duplicate_consolidation",
"groups": groups,
"instructions": (
"For each group worth consolidating: pick the clearest wording, pick which "
"member (by member_index -- two members can share the same `source`, e.g. two "
"sentences in the same section, so index rather than source identifies one) "
"should keep it, and state it once there -- delete the rest, don't repeat it "
"verbatim in every location (that would just turn a near-duplicate into an exact "
'one). Answer with {"duplicate_consolidation": [{"group_index": <int>, '
'"keep_member_index": <int>, "canonical_text": "..."}, ...]}. Omit groups '
"you'd rather leave as-is (e.g. legitimate parallel structure)."
),
}
def _unnecessary_removal_request(report: dict) -> dict:
items = [u for u in report["likely_unnecessary"] if "text" in u]
return {
"kind": "unnecessary_removal",
"items": items,
"instructions": (
"Only include items that are genuinely obvious to a capable agent -- don't cut "
'something just because it\'s short. Answer with {"unnecessary_removal": '
'[{"heading": "...", "text_to_remove": "..."}, ...]} for the ones actually '
"worth removing."
),
}
def build_suggestions(skill_dir, level: str, dup_threshold: float = 0.6) -> dict:
report = audit_skill(skill_dir, dup_threshold=dup_threshold)
requests = []
if level in ("slight", "lot"):
requests.append(_description_shorten_request(report))
if level == "lot":
requests.append(_duplicate_consolidation_request(report))
requests.append(_unnecessary_removal_request(report))
return {"skill_dir": str(skill_dir), "assist_level": level, "requests": requests}
def render_suggestions_human(result: dict) -> str:
if not result["requests"]:
return (
f"assist level: {result['assist_level']} -- no structured judgment request generated.\n"
"Do SKILL.md workflow step 3 freehand: read `weeder audit`'s duplicate_groups and "
"likely_unnecessary sections and edit the -optimized copy directly."
)
lines = [f"assist level: {result['assist_level']} -- {len(result['requests'])} request(s)", ""]
for r in result["requests"]:
lines.append(f"[{r['kind']}]")
lines.append(r["instructions"])
lines.append("")
lines.append(
"Write your answer(s) to a JSON file merging each kind's shape above, then run "
"`weeder apply-suggestion <skill_dir> --answer <file>`."
)
return "\n".join(lines)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |