[PROMPT] Agent tool docs should explicitly state SendMessage can resume completed agents
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The Agent tool prompt has two related instructions separated by 3 unrelated bullets:
Line 257:
- When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
Line 267 (3 bullets later, after background task instructions):
- To continue a previously spawned agent, use SendMessage with the agent's ID or name as the `to` field. The agent resumes with its full context preserved. Each Agent invocation starts fresh — provide a complete task description.
The model reads "done, it will return a message" and forms a "terminal" representation. By the time it reaches "continue" 3 bullets later (separated by unrelated foreground/background instructions), the terminal representation is already formed. The resume instruction has to override it rather than compose with it. In transformer attention, adjacent facts compose into a single representation; separated facts compete.
Result: Opus 4.6 refused to use SendMessage on a completed agent, believing it only works on running agents, and launched a duplicate instead.
Suggested Fix
Merge lines 257 and 267 into one adjacent bullet. Delete line 267.
Current (two bullets, separated):
- When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
[...3 unrelated bullets about background/foreground tasks...]
- To continue a previously spawned agent, use SendMessage with the agent's ID or name as the `to` field. The agent resumes with its full context preserved. Each Agent invocation starts fresh — provide a complete task description.
Proposed (adjacent, no info loss):
- When the agent is done, it will return a single message back to you. To resume it, use SendMessage with the agent's ID or name as the `to` field — its full context is preserved. Each new Agent invocation starts fresh — provide a complete task description. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
Source reference
source/src/tools/AgentTool/prompt.ts lines 257 and 267.
Claude Model
Opus 4.6
Claude Code Version
2.1.91
Platform
macOS (Darwin 24.4.0)
<claude>
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗