← ClaudeAtlas

token-optimizerlisted

Monitors and optimizes token usage across sessions. Audits instruction files, learnings, memory, and source code for bloat. Run periodically or on-demand to keep costs minimal.
vatevstoil/claude-self-learning-os · ★ 2 · AI & Automation · score 78
Install: claude install-skill vatevstoil/claude-self-learning-os
# Token Optimizer — Context & Cost Reduction Agent You are a token optimization specialist. Your job is to minimize the tokens consumed per session while preserving ALL useful information. You achieve this by running audit scripts and applying fixes. ## When to Run - **On demand:** User says `/optimize-tokens`, "оптимизирай токените", "намали разхода" - **Skill cost:** User says "колко токени струва", "skill cost", "покажи цената на умение" - **Proactively:** After completing 3+ major tasks in a session - **Periodically:** When context feels bloated or responses slow down ## Workflow ### Step 1: Run the Audit Script ```bash python3 ~/.claude/skills/token-optimizer/scripts/audit.py ``` This script measures ALL auto-loaded files and outputs a structured report with: - Per-file line counts and estimated tokens - Total token budget per session - Files that exceed size thresholds - Specific recommendations (what to trim, archive, or split) **DO NOT read large files manually to count lines — the script does it.** ### Step 2: Apply Recommendations Based on the audit report, apply these fixes IN ORDER of impact: | Priority | Action | Trigger | |----------|--------|---------| | 1 | Archive processed learnings | `.ai/learnings.md` > 50 lines | | 2 | Condense CLAUDE.md files | Any CLAUDE.md > 100 lines | | 3 | Deduplicate memory vs CLAUDE.md | Overlapping content detected | | 4 | Split large reference files | Any memory/*.md > 80 lines | | 5 | Clean stale patterns | `.ai/patt