← ClaudeAtlas

context-budgetlisted

Report estimated context window utilization and flag when approaching the compaction threshold
manastalukdar/ai-devstudio · ★ 1 · AI & Automation · score 77
Install: claude install-skill manastalukdar/ai-devstudio
# Context Budget Report how much of the current context window is estimated to be consumed, identify the largest contributors, and recommend actions when approaching the compaction threshold. Run this before starting a long task or when responses feel slow or truncated. ## Usage ``` /context-budget # Current utilization snapshot /context-budget --verbose # Show per-contributor breakdown /context-budget --compact # Recommend what to compact or save ``` ## Behavior ### Phase 1: Measure loaded content Collect byte sizes of all content that contributes to context: ```bash # CLAUDE.md files (auto-loaded) find . -name "CLAUDE.md" -not -path "*/node_modules/*" | xargs wc -c 2>/dev/null | tail -1 # Active session file [ -f ".claude/sessions/.current-session" ] && \ wc -c < "$(cat .claude/sessions/.current-session)" 2>/dev/null || echo 0 # Auto-loaded rules find .claude/rules -name "*.md" 2>/dev/null | xargs wc -c 2>/dev/null | tail -1 # Agent memory files loaded this session find .claude/agent-memory -name "MEMORY.md" 2>/dev/null | xargs wc -c 2>/dev/null | tail -1 # This project's memory index [ -f ".claude/memory/MEMORY.md" ] && wc -c < ".claude/memory/MEMORY.md" || echo 0 ``` ### Phase 2: Estimate token counts Convert bytes to tokens using the ~4 chars/token heuristic for English prose: ```bash TOTAL_BYTES=$(( CLAUDE_MD_BYTES + SESSION_BYTES + RULES_BYTES + MEMORY_BYTES )) ESTIMATED_TOKENS=$(( TOTAL_BYTES / 4 )) ``` Add an overhead estimate for