[BUG] Subagent Resume Missing All User Prompts
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 subagent resume functionality is broken because agent transcript files do not store the user prompts that initiated or resumed the agent. This causes resumed agents to lack critical context, making the resume feature unusable for its intended purpose.
This manifests in three symptoms.
Symptom 1: Agent IDs Not Displayed
When an agent completes, the agent ID is not displayed to the user in either:
- The CLI output/UI
- The tool result returned to the main agent
Evidence:
- Dispatched multiple test agents
- Agents completed successfully
- No agent ID was shown in UI or
<function_results>blocks - Agent IDs only discoverable by manually inspecting transcript files in
~/.claude/projects/
Symptom 2: Transcripts Missing ALL User Prompts
Agent transcript files (agent-{agentId}.jsonl) contain:
- ✅ Assistant responses (text and tool calls)
- ✅ Tool results (as "user" role messages)
- ❌ NO user prompts (both initial dispatch and all resume prompts)
Critical Finding: This affects EVERY user prompt, not just the first one. No user instructions are ever saved to the transcript.
Evidence:
Extended test case with multiple resumes:
1. Dispatch agent: "Remember BANANA-123, read bug_report.md, standby"
Agent responds: "I'll remember BANANA-123" + reads file + "standing by"
Agent ID: 32203431
2. Resume agent 32203431: "What was the code and first word of the file?"
Agent responds: "BANANA-123" and "Bug" ✅ (inferred from its previous response + tool result)
3. Resume agent 32203431: "Also remember PEAR-666, standby"
Agent responds: "I'll remember PEAR-666, standing by" ✅
4. Resume agent 32203431: "Tell me both codes"
Agent responds: "APPLE-123 and PEAR-666" ❌ (BANANA hallucinated as APPLE)
Transcript inspection of agent-32203431.jsonl:
- 6 assistant messages (responses, tool calls)
- 1 user message (tool_result from Read)
- 0 user messages containing ANY of the 4 prompts sent
-
input_tokensfield shows only 3-6 tokens per message (impossible to include prompts)
Symptom 3: Context Reconstruction Causes Hallucination
Resume DOES partially work, but agents must reconstruct context by reading their own previous responses rather than seeing the actual prompts. This leads to:
Lossy context reconstruction:
- ✅ Agent can infer some context from its own assertions ("I'll remember BANANA-123" → knows about BANANA-123)
- ✅ Tool results are preserved (file contents from Read tool were remembered)
- ❌ Agent lacks the original framing/instructions from user prompts
- ❌ Multiple inference steps cause drift and hallucination (BANANA-123 → APPLE-123)
Why this happens:
The agent sees: "I'll remember the code **BANANA-123**" and "I'll remember the second code: **PEAR-666**" but doesn't see WHY it said those things. When asked to recall both codes, it must infer what the user originally asked for, leading to hallucinated "corrections" like changing BANANA to APPLE.
What Should Happen?
According to the documentation at https://code.claude.com/docs/en/sub-agents:
- "Each subagent execution is assigned a unique
agentId" - "Claude Code displays the agent ID when a subagent completes its work"
- "You can resume a previous agent by providing its
agentIdvia theresumeparameter" - Resumed agents should have full context from their previous conversation
Example from docs:
> Use the code-analyzer agent to start reviewing the authentication module
[Agent completes initial analysis and returns agentId: "abc123"]
> Resume agent abc123 and now analyze the authorization logic as well
[Agent continues with full context from previous conversation]
Error Messages/Logs
Steps to Reproduce
- Dispatch a test agent with multiple tasks:
claude
> Use the general-purpose agent to remember the code ORANGE-456, read /etc/hostname, then standby
- Find the agent ID:
ls -lt ~/.claude/projects/-xxx/agent-*.jsonl | head -1
grep -o '"agentId":"[^"]*"' [most recent file]
# Returns something like: "agentId":"abc12345"
- Resume once (will work):
> Resume agent abc12345 and tell me the code and hostname
# Agent responds correctly (infers from its previous response + tool result)
- Resume again with new info:
> Resume agent abc12345, also remember GRAPE-789, standby
- Resume third time:
> Resume agent abc12345 and tell me both codes
# Agent will hallucinate one or both codes, or claim confusion
- Inspect transcript:
cat ~/.claude/projects/-xxx/agent-abc12345.jsonl | jq -r '.message.role'
# Shows only "assistant" and occasional "user" (tool results), never user prompts
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.0.42
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
Priority: High - Core feature severely degraded Component: Agent/Subagent system, Transcript storage Reproducibility: 100% consistent across all agent invocations Affects: All workflows using agent resume (subagents practically broken after 2-3 resumes)
Additional Finding: Main Sessions Store Prompts Correctly, Subagents Don't
Claude Code already has working code to store user prompts in transcripts** - but this functionality is **only active for main agent sessions, not for subagents.
Evidence
Main Agent Session Transcripts (Working Correctly)
$ cat 7569b584-e6e9-4e44-9e2d-xxxx.jsonl | jq -r '.message.role' | sort | uniq -c
195 assistant
137 user # ← Contains actual user prompts!
3 null
Sample user messages stored correctly:
{"message": {"role": "user", "content": "Yes. definitely."}}
{"message": {"role": "user", "content": "One more thing, check this: history.jsonl"}}
Subagent Transcripts (Broken)
Subagent transcript: agent-32203431.jsonl
$ cat agent-32203431.jsonl | jq -r '.message.role' | sort | uniq -c
6 assistant
1 user # ← Only tool_result, NO prompts
All user messages are tool results only:
{"message": {"role": "user", "content": [{"type": "tool_result", "tool_use_id": "...", "content": "..."}]}}
Zero user messages contain the actual prompts sent to the subagent.
What This Means
- ✅ The infrastructure to store user prompts in transcripts already exists
- ✅ It works correctly for main agent sessions
- ❌ It's just not being called for subagent sessions
- 🔧 The fix should be straightforward - apply the same transcript writing logic used for main sessions to subagent sessions
Comparison
| Feature | Main Session | Subagent Session |
|---|---|---|
| User prompts stored | ✅ Yes (as strings) | ❌ No |
| Assistant responses stored | ✅ Yes | ✅ Yes |
| Tool results stored | ✅ Yes | ✅ Yes |
| Resume works reliably | ✅ Yes | ❌ No (context drift) |
Technical Details
Main session user prompts are stored as:
{"message": {"role": "user", "content": "prompt text here"}}
Subagent transcripts need the same format for dispatch/resume prompts:
{"message": {"role": "user", "content": "Remember BANANA-123, read file, standby"}}
{"message": {"role": "assistant", "content": [...]}}
{"message": {"role": "user", "content": "What was the code?"}}
{"message": {"role": "assistant", "content": [...]}}
Currently subagent transcripts skip writing the user prompt lines entirely.
Suggested Investigation
The bug is likely in the code path that writes subagent transcript entries. Compare:
- How main session messages are written to
{sessionId}.jsonl - How subagent messages are written to
agent-{agentId}.jsonl
The subagent writer is probably only capturing assistant responses and tool results, while skipping the user prompt that initiated/resumed the agent.
While we wait for the official fix, I made this workaround.
+1 on Windows 11:
- Was trying to reuse subagent for better context management, and ran into Symptom 1: Agent IDs Not Displayed.
- Ended up doing the same hack with additionnal context in postToolHook, with python script
was not aware of symptom 2 and 3 unfortunately!
Yeah, seems same issue. Im building two rounds roundtable slash command and tried to use resume to continue agent's reasining with cross-pollination and answers from round 1, but resuming by ID doesn't work.
● Task(Training Designer Round 2) resuming 58cd1a3f-06c5-4d77-a2c3-0a91cae4c6f2
⎿ Initializing…
⎿ Error: No transcript found for agent ID: 58cd1a3f-06c5-4d77-a2c3-0a91cae4c6f2
I'm also wonder why it's not possible to run Task without tools use.
For easy reproduction of the issue, prompt Claude Code with:
Run this 3-step test to verify subagent resume accumulates context:
Step 1: Launch a subagent in background mode with prompt:
"Say only this: 'APPLE'. Nothing else."
→ Note the agentId from the response
Step 2: Resume that agentId with prompt:
"Say only this: 'BANANA'. Nothing else."
Step 3: Resume that agentId with prompt:
"What words did you say in order? List them."
Expected: "APPLE, BANANA"
Please fix
Working on a fix! Should be ready by Tuesday's release.
@timgu0 Thanks a lot! Can you tell us in which version this will be rolled out? My test from above still fails in 2.0.62.
@timgu0 Ah, you probably meant Tuesday evening in the US, when you said "Tuesday's release". In Europe 2.0.62 was released Tuesday morning.
Yeah should be in 2.0.63
@timgu0 Thanks a lot. I works now!
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.