Skip to content

Refactor scouts

Refactor scouts turn cleanup into an evidence workflow. The goal is not to rewrite broad areas of the repo. The goal is to identify a narrow target, attach why it matters, and make the cleanup reviewable.

StepCommand shapeWhat it answers
Statusfoxctl refactor status --workspace . --path ./internal --language goIs this scope indexed, fresh, and safe to scout?
Snapshotfoxctl refactor snapshot --path ./internal --language goWhat exact file and symbol surface are we about to reason over?
Hot pathsfoxctl refactor hot --path ./internal --language go --since HEAD~20Which files have recent churn or repeated edit pressure?
Dependenciesfoxctl refactor deps --path ./internal --language go --query Run --direction inWhat depends on this package or symbol?
Scoutfoxctl refactor scout --path ./internal --language go --focus slopWhich hotspots, boundary problems, or slop-shaped code should be cleaned first?
Advisorfoxctl refactor advisor --path ./internal --language go --focus slopHow should a short cleanup sequence be ranked?

Use scouts to find cleanup that makes future agent work cheaper and safer:

TargetSignal
Overgrown functionsHigh complexity, repeated guard blocks, or too many responsibilities
Repeated remappingThe same conversion, error wrapping, or envelope shaping copied across files
Boundary driftRuntime, retrieval, storage, and adapter code crossing package-family lines
Dead or stale pathsSymbols, docs, or command routes that no longer have real call sites
Review-hostile filesFiles that force broad diffs for narrow behavior changes

Good cleanup stays small. Each refactor should have:

  1. A scout finding or hotspot reason
  2. A bounded path or package scope
  3. A before/after behavior check
  4. No unrelated formatting churn
  5. Updated docs when the cleanup changes operator guidance

For the deeper source workflow, see docs/general/refactor-scout.md.