Ralph a refactor, module by module
Break a large refactor into a JSON backlog of modules and let fresh-context iterations convert one module per pass, with guardrails capturing every pattern decision so the result stays consistent.
Implementation note
The guardrails file is what keeps module 27 stylistically identical to module 2 despite each iteration knowing nothing about the last. Review it after the first few passes and correct any convention you dislike early.
Source: Geoffrey Huntley (Ralph technique) ↗
More refactoring loops
Migrate an API import by import
Sweep a codebase from a legacy API to its v2 replacement with tests and typecheck as the safety net, capped at 30 turns.
Dead code elimination
Hunt down unreferenced exports, unused files, and unreachable branches, deleting them in small verified steps until the analyzer reports clean.
Tidy code, one safe change at a time
Prove one small cleanup is safe, make the smallest useful change, and keep it only after existing checks pass.