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_config.py
View on GitHub"""Resolves the LLM-assist level (none/slight/lot).
Precedence: --assist flag > CONTEXT_GARDEN_LLM_ASSIST env var >
`llm_assist.level` in the nearest .context-garden/config.yaml walking up >
"none". See references/llm-assist.md.
"""
from __future__ import annotations
import os
from pathlib import Path
LEVELS = ("none", "slight", "lot")
DEFAULT_LEVEL = "none"
ENV_VAR = "CONTEXT_GARDEN_LLM_ASSIST"
CONFIG_RELPATH = Path(".context-garden") / "config.yaml"
def _parse_minimal_yaml(text: str) -> dict:
"""Only flat `key: value` lines plus one level of indented nesting; not a
general YAML parser, to avoid a PyYAML dependency."""
root: dict = {}
stack: list[tuple[int, dict]] = [(-1, root)]
for raw_line in text.splitlines():
line = raw_line.split("#", 1)[0].rstrip()
if not line.strip():
continue
indent = len(line) - len(line.lstrip(" "))
key, sep, value = line.strip().partition(":")
if not sep:
continue
value = value.strip()
while len(stack) > 1 and indent <= stack[-1][0]:
stack.pop()
parent = stack[-1][1]
if value:
parent[key] = value
else:
child: dict = {}
parent[key] = child
stack.append((indent, child))
return root
def find_config_file(start_dir) -> Path | None:
d = Path(start_dir).resolve()
for candidate in (d, *d.parents):
p = candidate / CONFIG_RELPATH
if p.is_file():
return p
return None
def resolve_assist_level(explicit: str | None = None, start_dir=None) -> str:
if explicit:
if explicit not in LEVELS:
raise ValueError(f"invalid assist level {explicit!r}, expected one of {LEVELS}")
return explicit
env_value = os.environ.get(ENV_VAR)
if env_value:
if env_value not in LEVELS:
raise ValueError(f"invalid {ENV_VAR}={env_value!r}, expected one of {LEVELS}")
return env_value
config_path = find_config_file(start_dir if start_dir is not None else Path.cwd())
if config_path is not None:
config = _parse_minimal_yaml(config_path.read_text())
assist = config.get("llm_assist", {})
level = assist.get("level") if isinstance(assist, dict) else None
if level:
if level not in LEVELS:
raise ValueError(
f"invalid llm_assist.level={level!r} in {config_path}, expected one of {LEVELS}"
)
return level
return DEFAULT_LEVEL
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 |