Three tightly-linked upgrades that plug the most obvious gaps in v0.2:
1. Priority-weighted context rules
Every rule file can now declare its urgency in YAML frontmatter:
```yaml
name: Firewall Practima
description: Klauzula §9.4 — wabienie klientów Zamawiającego
priority: critical
```
BM25 final score gets multiplied by:
| priority | multiplier |
|---|---|
| critical | ×10 |
| high | ×3 |
| medium | ×1 (default) |
| low | ×0.3 |
Effect: safety rules (contracts, pricing, irreversible actions) practically never fall out of the top 3, even when a prompt matches something else more densely.
2. rules/*.md joined the corpus
Work-mode rules (`core.md`, `tools.md`, `research.md`, `content.md`, `kwiga.md`) were previously only read at session start. Now they compete for context slots alongside `feedback_*.md` — bumped to `priority: critical` so their longer prose doesn't lose to shorter feedback files via BM25 length normalization.
3. scripts/gen-skill-rules.py — auto-map from SKILL.md
One script inflates skill coverage from ~20% to ~94% without manually curating keyword lists:
```bash
python3 scripts/gen-skill-rules.py
```
- Walks `~/.claude/skills/*/SKILL.md`
- Extracts quoted trigger phrases from each skill's `description:` frontmatter (`"napisz post"`, `"zrób karuzelę"`)
- Adds the skill name itself as a fallback keyword
- Preserves existing manual `priority` values across regenerations
- Writes a timestamped `.bak-YYYYMMDD-HHMMSS` backup before overwriting
Run it once after installing a new skill or tweaking a description.
Upgrade path
```bash
curl -fsSL https://raw.githubusercontent.com/studiogo/skill-router/main/install.sh | bash
```
Idempotent — safe to rerun. Existing `skill-rules.json` is preserved (won't be overwritten), so your manual priorities stay.
What's next (v0.4 ideas)
- Deprecation support: `deprecated: true` in frontmatter, skip those during ranking
- Corpus caching (avoid re-tokenizing on every prompt — matters at > 200 rule files)
- Usage telemetry: track which rules Claude actually applied, surface dead/unused rules
Inspired by the public diet103/claude-code-infrastructure-showcase (MIT).