docs(subagents): reuse context-warm agents before spawning new ones#28
docs(subagents): reuse context-warm agents before spawning new ones#28cristim wants to merge 1 commit into
Conversation
- add a "reuse before spawning" check to CLAUDE.md tenet 4 and the §2 subagent strategy: continue an existing agent via SendMessage when the follow-up touches the same files, diff, or investigation thread, instead of paying a cold start that re-reads everything - make §1c keep the same implementer and reviewer agents alive across review rounds, clarifying that independence is between the two roles, not between rounds of the same role - add a full "Reuse agents before spawning new ones" section to subagent-strategy.md: reuse signals, when NOT to reuse (adversarial independence, tier mismatch, polluted context, unrelated task), a tie-breaker, and structural equivalents for Workflow scripts where agent() calls always start cold (partition by file/module, pass conclusions between stages instead of re-reading) Cuts repeated file re-reads across multi-round loops, which is the bulk of subagent token spend on iterative work.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR updates guidance documentation in ChangesAgent Context Reuse Strategy
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Why
Multi-round loops (the §1c review loop, CR-fix rounds, research follow-ups) currently spawn a fresh subagent per round. Every fresh spawn starts cold and re-reads the same files, docs, and diff the previous agent already had loaded, so the bulk of the token spend on iterative work is repeated re-reading rather than new work. Continuing the existing agent via
SendMessagemakes round N+1 cost only the delta.What
SendMessagebefore any freshAgentspawn, plus a rule forWorkflowscripts to batch all same-file steps into oneagent()call since those always start cold.Workflowscripts (partition by file/module rather than by step; pass conclusions between stages instead of re-reading).Docs-only change; no behavior outside the workflow rules themselves.
Summary by CodeRabbit