--- id: d75e2afd-8348-4fe6-9ea1-731604505aa6 type: workflow title: "Pattern: Parallel /simplify agents with isolated worktrees for large refactors" tags: [sba-scouting, rust, claude-code, workflow, refactoring, parallel, worktree] importance: 0.6 confidence: 0.8 created: "2026-03-02T02:08:58.862746+00:00" updated: "2026-03-02T02:08:58.862746+00:00" --- # Parallel /simplify with Isolated Worktree Agents ## Overview Successfully ran 17 parallel agents with `isolation: "worktree"` to simultaneously review and simplify every substantive file in the Rust codebase. ## How It Works - Each agent gets its own git worktree copy of the repo - Agents applied changes directly to the main working tree (not isolated to their worktrees) - Run all agents in parallel — no coordination needed for read-heavy simplification tasks ## Results on sba-scouting Rust rewrite - 17 agents, 24 files modified - Net: -261 lines removed - All 105 tests passed after integration ## Common Simplifications Found - Duplicated helpers consolidated: `format_rating`, `format_swar`, `tier_style`, `format_relative_time` - Heap allocations replaced with stack arrays/HashSets - `OnceLock` for invariant hashes (computed once, reused) - Transaction wrapping for atomic DB operations - `tokio::try_join!` for parallel async DB queries ## When to Use - Large refactor/cleanup passes across many files - When changes are independent per-file (no cross-file coordination needed) - After a feature phase is complete and code needs polish ## Usage Use `/simplify` slash command (or equivalent Agent tool call) with `isolation: "worktree"` per file.