Bloat Detector
Systematically detect and eliminate codebase bloat through progressive analysis tiers.
Bloat Categories
| Category |
Examples |
| Code |
Dead code, God classes, Lava flow, duplication |
| AI-Generated |
Tab-completion bloat, vibe coding, hallucinated deps |
| Documentation |
Redundancy, verbosity, stale content, slop |
| Dependencies |
Unused imports, dependency bloat, phantom packages |
| Git History |
Stale files, low-churn code, massive single commits |
Quick Start
Tier 1: Quick Scan (2-5 min, no tools)
/bloat-scan
Detects: Large files, stale code, old TODOs, commented blocks, basic duplication
Tier 2: Targeted Analysis (10-20 min, optional tools)
/bloat-scan --level 2 --focus code # or docs, deps
Adds: Static analysis (Vulture/Knip), git churn hotspots, doc similarity
Tier 3: Deep Audit (30-60 min, full tooling)
/bloat-scan --level 3 --report audit.md
Adds: Cross-file redundancy, dependency graphs, readability metrics
When to Use
| Do |
Don't |
| Context usage > 30% |
Active feature development |
| Quarterly maintenance |
Time-sensitive bugs |
| Pre-release cleanup |
Codebase < 1000 lines |
| Before major refactoring |
Tools unavailable (Tier 2/3) |
Confidence Levels
| Level |
Confidence |
Action |
| HIGH |
90-100% |
Safe to remove |
| MEDIUM |
70-89% |
Review first |
| LOW |
50-69% |
Investigate |
Prioritization
Priority = (Token_Savings × 0.4) + (Maintenance × 0.3) + (Confidence × 0.2) + (Ease × 0.1)
Module Architecture
Tier 1 (always available):
@module:quick-scan - Heuristics, no tools
@module:git-history-analysis - Staleness, churn, vibe coding signatures
Tier 2 (optional tools):
@module:code-bloat-patterns - Anti-patterns (God class, Lava flow)
@module:ai-generated-bloat - AI-specific patterns (Tab bloat, hallucinations)
@module:documentation-bloat - Redundancy, readability, slop detection
@module:static-analysis-integration - Vulture, Knip
Shared:
@module:remediation-types - DELETE, REFACTOR, CONSOLIDATE, ARCHIVE
Auto-Exclusions
Always excludes: .venv, __pycache__, .git, node_modules, dist, build, vendor
Also respects: .gitignore, .bloat-ignore
Safety
- Never auto-delete - all changes require approval
- Dry-run support -
--dry-run for previews
- Backup branches - created before bulk changes
Related
bloat-auditor agent - Executes scans
unbloat-remediator agent - Safe remediation
context-optimization skill - MECW principles
1---2name: bloat-detector3description: Detect codebase bloat through progressive analysis: dead code, duplication, complexity, documentation bloat. Triggers: bloat detection, dead code, code cleanup, duplication, technical debt, unused code Use when: context usage high, quarterly maintenance, pre-release cleanup, before refactoring DO NOT use when: active feature development, time-sensitive bugs, codebase < 1000 lines4---5
6# Bloat Detector
7
8Systematically detect and eliminate codebase bloat through progressive analysis tiers.
9
10## Bloat Categories
11
12| Category | Examples |
13| ----------------- | ---------------------------------------------------- |
14| **Code** | Dead code, God classes, Lava flow, duplication |
15| **AI-Generated** | Tab-completion bloat, vibe coding, hallucinated deps |
16| **Documentation** | Redundancy, verbosity, stale content, slop |
17| **Dependencies** | Unused imports, dependency bloat, phantom packages |
18| **Git History** | Stale files, low-churn code, massive single commits |
19
20## Quick Start
21
22### Tier 1: Quick Scan (2-5 min, no tools)
23
24```bash
25/bloat-scan
26```
27
28Detects: Large files, stale code, old TODOs, commented blocks, basic duplication
29
30### Tier 2: Targeted Analysis (10-20 min, optional tools)
31
32```bash
33/bloat-scan --level 2 --focus code # or docs, deps
34```
35
36Adds: Static analysis (Vulture/Knip), git churn hotspots, doc similarity
37
38### Tier 3: Deep Audit (30-60 min, full tooling)
39
40```bash
41/bloat-scan --level 3 --report audit.md
42```
43
44Adds: Cross-file redundancy, dependency graphs, readability metrics
45
46## When to Use
47
48| Do | Don't |
49| ------------------------ | ---------------------------- |
50| Context usage > 30% | Active feature development |
51| Quarterly maintenance | Time-sensitive bugs |
52| Pre-release cleanup | Codebase < 1000 lines |
53| Before major refactoring | Tools unavailable (Tier 2/3) |
54
55## Confidence Levels
56
57| Level | Confidence | Action |
58| ------ | ---------- | -------------- |
59| HIGH | 90-100% | Safe to remove |
60| MEDIUM | 70-89% | Review first |
61| LOW | 50-69% | Investigate |
62
63## Prioritization
64
65```
66Priority = (Token_Savings × 0.4) + (Maintenance × 0.3) + (Confidence × 0.2) + (Ease × 0.1)
67```
68
69## Module Architecture
70
71**Tier 1** (always available):
72
73- `@module:quick-scan` - Heuristics, no tools
74- `@module:git-history-analysis` - Staleness, churn, vibe coding signatures
75
76**Tier 2** (optional tools):
77
78- `@module:code-bloat-patterns` - Anti-patterns (God class, Lava flow)
79- `@module:ai-generated-bloat` - AI-specific patterns (Tab bloat, hallucinations)
80- `@module:documentation-bloat` - Redundancy, readability, slop detection
81- `@module:static-analysis-integration` - Vulture, Knip
82
83**Shared**:
84
85- `@module:remediation-types` - DELETE, REFACTOR, CONSOLIDATE, ARCHIVE
86
87## Auto-Exclusions
88
89Always excludes: `.venv`, `__pycache__`, `.git`, `node_modules`, `dist`, `build`, `vendor`
90
91Also respects: `.gitignore`, `.bloat-ignore`
92
93## Safety
94
95- **Never auto-delete** - all changes require approval
96- **Dry-run support** - `--dry-run` for previews
97- **Backup branches** - created before bulk changes
98
99## Related
100
101- `bloat-auditor` agent - Executes scans
102- `unbloat-remediator` agent - Safe remediation
103- `context-optimization` skill - MECW principles