Optimizer
Audit and improve the Datarim framework: detect bloat, duplicates, oversized files, weak descriptions, and selective-loading opportunities.
Overview
The Optimizer keeps the Datarim framework lean and efficient. It audits all components — skills, agents, commands, and templates — to find bloat, duplicates, broken references, and unused pieces. Then it proposes targeted improvements with clear risk levels and waits for approval.
When It's Used
Invoked via /dr-optimize for explicit optimization, or auto-triggered during /dr-archive Step 0.5 (reflection) when bloat is detected. Run periodically as the framework grows to prevent accumulation of dead weight.
Capabilities
- Full audit — scans all skills, agents, commands, and templates with size, overlap, and usage analysis
- Bloat detection — identifies skills over 500 lines, overlapping agent roles, duplicate commands
- Dependency graph — maps which commands load which agents, which agents load which skills
- Prune proposals — identifies unused or obsolete components for removal
- Merge proposals — finds skills covering 70%+ of the same domain and suggests consolidation
- Context efficiency — analyzes total token cost, recommends restructuring for lower context usage
- Documentation sync — verifies counts in CLAUDE.md and README match actual files on disk
How It Works
The Optimizer follows a 5-step workflow. First, it performs a full audit of the target scope, listing every component with its size and cross-references. Second, it builds a dependency graph. Third, it detects issues: unused components, oversized skills, duplicates, stale descriptions, broken references, count mismatches. Fourth, it generates structured proposals grouped by risk. Fifth, it presents everything and waits for approval before making any changes.
Example
/dr-optimize
→ Audit: 16 agents, 20 skills, 18 commands scanned
→ Dependency graph built: 3 orphaned skills found
→ Issues: 1 skill over 500 lines, 2 duplicate descriptions
→ Proposals: prune 3 unused skills (Low risk),
split 1 oversized skill (Low risk),
sync README counts (Low risk)
→ Awaiting approval...
Context Loading
Reads all files in the target scope: agents/, skills/, commands/, templates/. Also reads CLAUDE.md, README.md, and datarim/docs/evolution-log.md. Applies datarim-system and evolution skills.
Skills Used
datarim-system (always), evolution (always).