-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Description
Description
opencode/packages/opencode/src/session/prompt.ts
Line 1287 in 776e7a9
| " Use the above message and context to generate a prompt and call the task tool with subagent: " + |
This injected synthetic line create a strong bias for nesting agents into runaway nesting, or maximum allowed nesting levels before anything can happen.
This is because nesting routers are named by itself, such that every prompt will be appended by this statement at the bottom:
Use the above message and context to generate a prompt and call the task tool with subagent: router
Prompt engineering can only do so much to counteract that.
I can understand the original intend of the @agent tagging logic in the parent session is to bias the LLM to delegate via task tool, but there is absolutely no reason to also inject that inside the initial prompt of subagents.
The subagent's initial prompt is decided by the LLM in use, simple ralph-like prompts such as Keep running @review and @coder until all issues are fixed almost always carry the @agent feature into the agents themselves.
It doesn't have to happen, and honestly, makes little sense.
Agent swarms are very useful and general purpose if bias can be tuned correctly. Is it possible to remove, make it configurable, or replace that sentance with an alternative?
Plugins
No response
OpenCode version
v1.2.24
Steps to reproduce
- Create an agent
- Allow that agent to spawn itself via task tool
- Observe the fireworks
Screenshot and/or share link
No response
Operating System
macOS
Terminal
Terminal.app, Ghostty