claude-code - 💡(How to fix) Fix [DOCS] Subagent resume docs omit `cwd` continuity for `SendMessage` resumes [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52207Fetched 2026-04-23 07:33:43
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3
RAW_BUFFERClick to expand / collapse

Documentation Type

Unclear/confusing documentation

Documentation Location

https://code.claude.com/docs/en/sub-agents

Section/Topic

Resume subagents (and related SendMessage / Agent SDK resume guidance)

Current Documentation

The docs currently say:

Resumed subagents retain their full conversation history, including all previous tool calls, results, and reasoning. The subagent picks up exactly where it stopped rather than starting fresh.

When a subagent completes, Claude receives its agent ID. Claude uses the SendMessage tool with the agent's ID as the to field to resume it.

If a stopped subagent receives a SendMessage, it auto-resumes in the background without requiring a new Agent invocation.

The Agent SDK page currently says:

To resume a subagent programmatically:

  1. Capture the session ID: Extract session_id from messages during the first query
  2. Extract the agent ID: Parse agentId from the message content
  3. Resume the session: Pass resume: sessionId in the second query's options, and include the agent ID in your prompt

Separate session docs mention the cwd requirement more generally:

If a resume call returns a fresh session instead of the expected history, the most common cause is a mismatched cwd.

What's Wrong or Missing?

The subagent resume docs explain history continuity, but they do not explain working-directory continuity.

Changelog v2.1.118 includes: Fixed subagents resumed via SendMessage not restoring the explicit cwd they were spawned with.

That fix implies a user-visible contract that resumed subagents should continue in the same working directory/worktree they originally started with, including an explicit cwd when one was used. The current docs do not say that anywhere in the Resume subagents section or the SendMessage tool description.

For SDK users, the subagent resume page also omits the practical requirement that resume calls must keep the original cwd, even though the separate session docs already note that mismatched cwd can make resume behave like a fresh session.

Suggested Improvement

Add one short note anywhere subagent resume is documented:

Resumed subagents continue in the working directory (or isolated worktree) they were originally spawned with. SendMessage resumes the existing subagent context; it does not switch the subagent to the caller's current directory.

Then add an SDK-specific note in the Agent SDK subagents page that links to the session resume docs, for example:

When resuming programmatically, use the same session and the same cwd as the original query. If the cwd changes, resume may not find the existing transcript and can behave like a fresh session.

It would also help to add a short clause to the SendMessage row in Tools reference noting that resumed subagents keep their original working directory/worktree.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

PageContext
https://code.claude.com/docs/en/sub-agentsResume subagents explains SendMessage resume flow but not working-directory continuity
https://code.claude.com/docs/en/tools-referenceSendMessage says it resumes subagents, but not that the original cwd/worktree is restored
https://code.claude.com/docs/en/agent-sdk/subagentsProgrammatic subagent resume steps omit the need to keep the original cwd
https://code.claude.com/docs/en/agent-sdk/sessionsAlready documents the general cwd requirement and is the natural cross-reference target

Total scope: 4 pages affected

Source: Changelog v2.1.118

Exact changelog entry: Fixed subagents resumed via SendMessage not restoring the explicit cwd they were spawned with

extent analysis

TL;DR

Update the documentation for subagent resume to include information about working directory continuity, ensuring that users understand resumed subagents retain their original working directory.

Guidance

  • Review the affected pages (sub-agents, tools-reference, agent-sdk/subagents, agent-sdk/sessions) to ensure consistency in documenting the cwd requirement for subagent resume.
  • Add a note to the Resume subagents section explaining that resumed subagents continue in their original working directory.
  • Update the Agent SDK subagents page to emphasize the importance of using the same cwd when resuming programmatically.
  • Consider adding a cross-reference to the session resume docs from the Agent SDK subagents page for further information on cwd requirements.

Example

No code snippet is necessary for this documentation update, but an example of the added note could be:

Resumed subagents continue in the working directory (or isolated worktree) they were originally spawned with. SendMessage resumes the existing subagent context; it does not switch the subagent to the caller's current directory.

Notes

The suggested improvements aim to clarify the documentation, but it's essential to ensure that the updates are consistent across all affected pages and accurately reflect the current behavior of the system.

Recommendation

Apply the suggested documentation updates to improve clarity and consistency, as the current documentation lacks critical information about working directory continuity for subagent resume.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [DOCS] Subagent resume docs omit `cwd` continuity for `SendMessage` resumes [1 participants]