--- 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:20:43.812285+00:00" relations: - target: 9e502d2b-bf95-4161-8190-ba153b9961d0 type: RELATED_TO direction: outgoing strength: 0.71 edge_id: f53abf0b-9d21-46ca-a19d-7c2de1f839b7 - target: f1c846d2-ddab-4968-b789-d0aa1b703c1b type: RELATED_TO direction: outgoing strength: 0.74 edge_id: a5981a58-8f2e-493a-ad5c-2218ebbc391a - target: 73646e80-a640-4316-b7c6-54a4330f1b28 type: RELATED_TO direction: outgoing strength: 0.73 edge_id: a266c8b2-cf4f-404d-b93a-db4faa3bde73 - target: 1b71b163-b56f-4226-9731-a76ef245e532 type: FOLLOWS direction: outgoing strength: 0.8 edge_id: 7d49db13-70e0-46d9-8707-fc0ddfe2df85 - target: 346c5a34-3fed-44ff-832a-b0c9eb42ca88 type: FOLLOWS direction: outgoing strength: 0.8 edge_id: ec429a7a-f8ec-452e-a8ab-0defc5d5ca9f - target: 1b71b163-b56f-4226-9731-a76ef245e532 type: CAUSES direction: outgoing strength: 0.9 edge_id: 090ec7e1-c8fc-40f5-8d60-4b2aef56bcbd --- # 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.