Skip to content

@agent tagging creates synthetic injection that breaks agent swarm #17202

@vicary

Description

@vicary

Description

" 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

  1. Create an agent
  2. Allow that agent to spawn itself via task tool
  3. Observe the fireworks

Screenshot and/or share link

No response

Operating System

macOS

Terminal

Terminal.app, Ghostty

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions