fix(agent): reduce unnecessary subagent dispatch - #388
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR updates in-repo agent guidance: it refines the explore agent description to warn when not to use it and formalizes a "retrieval budget" (quick, medium, very thorough), and tightens session prompt and tool docs to prefer agent only when a separate investigation clearly saves work versus direct tool calls. ChangesAgent Usage Guidance Refinement
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
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 docstrings
🧪 Generate unit tests (beta)
Review rate limit: 8/10 reviews remaining, refill in 8 minutes and 24 seconds. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/opencode/src/session/prompt/pawwork.txt`:
- Line 47: Phase 1 still instructs launching up to 3 "explore" subagents which
conflicts with the new global guidance to dispatch agents only when clearly
beneficial (line 47); update the Phase 1 prompt/instruction that spawns multiple
"explore" agents (the block that says "launch up to 3 explore agents" in the
Phase 1 prompt) to either (a) reduce to a single targeted "explore" subagent or
(b) add a strict gating condition so subagents are launched only when the task
cannot be solved by direct reads/grep in-thread, and explicitly preserve
judgment/synthesis in the main thread. Ensure the prompt text and any
variables/constants that reference "explore" or "Phase 1" are changed so both
prompt sources are aligned and do not suggest multi-agent over-dispatch.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b4c4f727-2b2a-4eaf-9c72-fd0e3bc47a24
📒 Files selected for processing (3)
packages/opencode/src/agent/agent.tspackages/opencode/src/session/prompt/pawwork.txtpackages/opencode/src/tool/agent.txt
There was a problem hiding this comment.
Code Review
This pull request updates the documentation and descriptions for subagent dispatching across several files, including agent.ts, pawwork.txt, and agent.txt. The changes provide more explicit guidance on when to use subagents—prioritizing broad, independent exploration and parallel research—while discouraging their use for narrow tasks or known file inspections that are more efficient in the main thread. A review comment suggested clarifying the term 'budget' in the agent description to ensure the model understands it refers to the thoroughness level rather than a separate parameter.
Summary
agenttool's when-to-use / when-not-to-use rules, including small known areas and ordinary bug-debugging steps.exploreagent description to broad unknown-entry codebase exploration and add an explicit direct-read/search preference for known files or symbols.Why
Recent session reviews showed the model over-dispatching explore subagents for narrow debugging and known-file lookups. These prompt changes add clearer retrieval budgets, stopping conditions, and negative examples so the model defaults to direct
read/glob/grepfor small or sequential work.Related Issue
No issue yet; this came from reviewing exported PawWork sessions that showed excessive subagent fan-out.
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
agenttool description, andexploreagent description.Risk Notes
Low. This is prompt/tool-description text only. It may make models less likely to delegate exploration; broad exploration remains allowed when clearly beneficial.
How To Verify
Screenshots or Recordings
Not applicable; no visible UI changes.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit