cyberneticlibrary

Refactor code modules in parallel with behavior preservation

sdlc-refactor-by-moduleworkflowsetup L30
carlos-sobral/ai-squad
What it does

Refactor N independent modules in parallel, isolated worktrees, NO behavior change

Best for

Refactor multiple modules in parallel when each has an isolated scope and a test suite.

Inputs
  • · repo path (absolute)
  • · baseSha (cache-stale guard)
  • · modules array: {slug, scope, specRef?}
Outputs
  • · per-module refactor result: {slug, changed, summary, behaviorChangeRisk, testsRun}
Requires
  • · git (worktree isolation)
  • · test runner (module-specific)
Preconditions
  • · git repo
  • · worktree support
  • · per-module test suite
  • · no cross-module file edits
Failure modes
  • · changed behavior despite intent (flagged behaviorChangeRisk=needs-review)
  • · tests not runnable (testsRun=false)
  • · refactor bleeds into adjacent module
Trust signals
  • · worktree isolation (no concurrent file conflicts)
  • · test suite runs green
  • · baseSha cache guard