Progressive bloat detection: identify dead code, duplication, and documentation bloat. Triggers: bloat scan, dead code detection, codebase cleanup Use when: preparing for refactoring or high context usage
Detects codebase bloat like dead code, duplication, and stale docs through progressive scanning (quick to deep audits). Use before refactoring or when context usage is high to identify cleanup opportunities and reduce token costs.
/plugin marketplace add athola/claude-night-market/plugin install conserve@claude-night-marketExecute progressive bloat detection across code, documentation, and dependencies.
# Quick scan (Tier 1, default)
/bloat-scan
# Targeted analysis (Tier 2)
/bloat-scan --level 2
/bloat-scan --level 2 --focus code
/bloat-scan --level 2 --focus docs
# Deep audit (Tier 3)
/bloat-scan --level 3 --report audit-report.md
# Dry run (no changes)
/bloat-scan --dry-run
| Option | Description | Default |
|---|---|---|
| `--level <1 | 2 | 3>` |
--focus <type> | Focus area: code, docs, deps, or all | all |
--report <file> | Save report to file | stdout |
--dry-run | Preview findings without taking action | false |
--exclude <pattern> | Additional exclude patterns beyond defaults | .bloat-ignore |
Note: Cache directories (.venv/, node_modules/, .pytest_cache/, etc.) are automatically excluded from all scans.
Detects:
Requirements: None (heuristics + git)
Detects:
Requirements: Optional static analysis tools (Vulture, Knip)
Detects:
Requirements: Full tooling suite
Invoke Command
/bloat-scan --level 2 --focus code
Agent Executes Scan
bloat-auditor agentbloat-detector skill modulesGenerate Report
=== Bloat Detection Report ===
Scan Level: 2
Files Scanned: 847
Findings: 24
HIGH PRIORITY (5):
- src/deprecated/old_api.py (95/100)
- docs/archive/old-guide.md (88/100)
...
MEDIUM PRIORITY (11):
...
STATS:
Estimated bloat: 14%
Token savings: ~31,500
Context reduction: ~12%
Review & Approve Actions
š Running Bloat Scan (Tier 1)...
[āāāāāāāāāāāāāāāāāāāā] 847 files scanned (5.2s)
ā
Scan complete!
HIGH PRIORITY (Immediate Action):
ā src/deprecated/old_handler.py
Score: 95/100 | Confidence: HIGH
Signals: Stale (22mo), Unused (0 refs), Large (847 lines)
Impact: ~3,200 tokens
Action: DELETE
MEDIUM PRIORITY (Review Soon):
ā ļø src/utils/helpers.py
Score: 76/100 | Confidence: MEDIUM
Signals: God class (634 lines), Low cohesion
Impact: ~2,800 tokens
Action: REFACTOR
SUMMARY:
⢠Total findings: 24
⢠High priority: 5
⢠Token savings: ~31,500 (12% reduction)
NEXT STEPS:
1. Review HIGH priority items (5 findings)
2. Run: git checkout -b cleanup/bloat-reduction
3. Process findings sequentially
# Bloat Detection Report
**Scan Date:** 2025-12-31
**Level:** 2 (Targeted Analysis)
**Duration:** 12m 34s
**Files Scanned:** 847
## Summary
- **Total Findings:** 24
- **High Priority:** 5
- **Medium Priority:** 11
- **Low Priority:** 8
- **Estimated Token Savings:** ~31,500 tokens
- **Context Reduction:** ~12%
## High Priority Findings
### [1] src/deprecated/old_handler.py
**Bloat Score:** 95/100
**Confidence:** HIGH (92%)
**Signals:**
- Stale: 22 months unchanged
- Unused: 0 references found
- Large: 847 lines
- Dead code: 100% (Vulture)
**Token Impact:** ~3,200 tokens
**Recommendation:** DELETE
**Rationale:** Multiple high-confidence signals confirm complete abandonment. No active usage detected.
**Action Plan:**
```bash
# Create backup
git checkout -b backup/old-handler
git add src/deprecated/old_handler.py
git commit -m "Backup before deletion"
# Delete on main branch
git checkout main
git rm src/deprecated/old_handler.py
git commit -m "Remove deprecated handler (bloat scan #1)"
[... more findings ...]
## Integration
### With Context Optimization
```bash
# If context usage is high, bloat scan can help
/context-status # Shows 45% utilization
/bloat-scan --level 2
# "Found 12% bloat, can reduce context to 33%"
# Clean up before PR
/bloat-scan --dry-run
# Review findings
git checkout -b cleanup/pre-release
/bloat-scan --level 2
# Execute approved changes
/pr "Reduce codebase bloat by 14%"
# Correlate bloat with performance
/bloat-scan --level 3
/performance-report
# Identify bloat causing slowdowns
CRITICAL: No automatic deletions
--execute to apply)$ /bloat-scan
š Running Bloat Scan (Tier 1)...
ā
Scan complete! Found 5 high-priority items.
Estimated token savings: ~8,400 tokens
$ /bloat-scan --level 2 --focus docs
š Scanning documentation for bloat...
Found 3 duplicate docs (>85% similar)
Found 2 overly verbose guides (>5,000 words)
Estimated token savings: ~12,000 tokens
$ /bloat-scan --level 3 --report Q1-2025-audit.md
š Running deep bloat audit...
This will take 30-60 minutes. Continue? (y/n) y
[āāāāāāāāāāāāāāāāāāāā] Deep analysis complete!
Report saved to: Q1-2025-audit.md
Found 24 bloat items across code, docs, and deps.
Estimated context reduction: 18%
bloat-detector skill - Detection modules and patternsbloat-auditor agent - Scan orchestrationcontext-optimization skill - MECW principles/context-status - Current context utilization