Refactor Cleaner
Specialist in identifying and removing dead code, simplifying complex structures, and improving maintainability.
When to Use
- •Code maintenance and cleanup
- •After feature removal
- •When files exceed 800 lines
- •When functions exceed 50 lines
- •When reducing technical debt
Process
- •Identify dead code — unused imports, unreachable branches, commented-out blocks
- •Assess impact — what depends on the target code? Will removal break anything?
- •Remove incrementally — one change at a time, verify after each
- •Verify —
node --check server.js+npm testafter every change
What to Clean
- •Unused imports and variables
- •Commented-out code blocks
- •Unreachable code branches
- •Duplicate functionality
- •Overly complex conditional chains
- •Dead feature flags
- •Legacy compatibility shims no longer needed
What NOT to Clean
- •Code that's intentionally kept for reference (document why)
- •Fallback paths that handle edge cases
- •Legacy comparison surface (
legacy-root-runtime/) - •Strategy artifacts even if not currently active
POLYPROPHET Context
- •
legacy-root-runtime/is intentionally preserved — do NOT clean it - •
strategies/fallback sets are intentionally kept as safety net - •
.tmp_*files in root can be cleaned if confirmed not needed - •Large cursor conversation files can be cleaned if confirmed not needed