← ClaudeAtlas

optimize-ruleslisted

Audits all rules for token cost, detects cross-rule duplication, and suggests activation mode changes to keep the always-on budget at or below 6k tokens. Reports full budget vs target. <example> Context: Rules have grown after several sessions; time to trim token cost user: "/optimize-rules" assistant: "Audit complete — always-on budget 7.2k (target ≤6k). 2 duplication clusters found. 3 mode-change suggestions." </example>
reghis86/context-forge · ★ 0 · AI & Automation · score 73
Install: claude install-skill reghis86/context-forge
## What This Does Performs a full token audit of all rules in `core/rules/`. Specifically: 1. **Token cost estimation** — estimates token count per rule file using `wc -c` as a proxy (1 token ≈ 4 bytes). Sums total always-on budget. 2. **Duplication detection** — uses `rg` to find paragraphs or constraint phrases that appear in 2+ rule files. 3. **Activation mode suggestions** — identifies `mode: always` rules used in fewer than 80% of sessions and suggests downgrading to `mode: intelligent`. 4. **Budget report** — total always-on token budget vs ≤6k target. 5. **Quality score** — run `core/scripts/tools/quality-score.sh` (Tier 1) for a deterministic composite score per rule and skill. It uses the full-denominator model: every defined dimension counts toward the denominator, so a missing few-shot / validation-gate / `<example>` caps the score honestly (reported as `4/7`, never hidden by renormalization). Surface any file below 1.00 with its `missing` dimensions. ## Quality Score (Tier 1) ```bash bash core/scripts/tools/quality-score.sh # TSV: kind, file, score, passed, total, missing ``` Dimensions — rules (7): SYSTEM CONSTRAINTS section, hard-constraint density (≥5), no soft language in constraints, few-shot example, validation gate, YAML pair, within token budget. Skills (6): frontmatter `name`, `description`, purpose section, Constraints section, `<example>`, within budget. A run ends with an `average` line across all files. **Replicat