Environment
- Claude Code: v2.1.195 (latest stable)
- Platform: macOS (Darwin 27.0)
- Launch: background agents via Agent View (
claude agents / fleet roster)
Summary
When a background session that has been stopped or completed is reopened from Agent View, Claude Code spawns a new session-id and only injects the original launch intent/prompt. The prior conversation is not carried over, so the session appears empty and the initial prompt is re-sent — effectively restarting the task from scratch.
This happens at sub-compact context sizes (a few KB of transcript), so it is unrelated to auto-compaction.
Reproduction
- Launch a background agent (e.g. via
claude --bg or the agents view). Let it accumulate a real conversation.
- Stop / let the turn complete so the job leaves the
working state (stopped or done in ~/.claude/jobs/<id>/state.json).
- Reopen that session from Agent View.
- The reopened session has a different session-id from the original, shows only the first prompt, and the conversation history is gone.
Evidence
The original conversation is not actually deleted — it still exists at ~/.claude/projects/<project>/<original-session-id>.jsonl (large file). What gets created on reopen is a stub transcript under a new session-id containing only metadata (system, mode, ai-title, agent-name, agent-setting, permission-mode) with zero user/assistant message entries:
$ wc -l < .../<stub-id>.jsonl
8
$ # type breakdown: system / system / last-prompt / ai-title / agent-name / agent-setting / mode / permission-mode
Meanwhile the original (e.g. ~900 KB, dozens of messages) remains intact under the old id. ~/.claude/jobs/<id>/state.json records only linkScanPath pointing at the session's own transcript — there is no parentId / respawnOf field linking the stub back to the original conversation.
~/.claude/daemon/roster.json shows live workers correctly launched with launch.mode: "resume" and the right sessionId/transcriptPath, so attaching to a still-running background session works fine. The regression is specific to reopening a stopped/completed session.
Expected
Reopening a stopped/completed background session should resume the original transcript (same session-id, full history), not spawn an empty stub with a new id.
Workaround
claude --resume <original-session-id> restores the full conversation. Users must manually locate the original id from ~/.claude/projects/<project>/*.jsonl.
Related
Happy to provide sanitized copies of the stub vs. original transcripts if useful.
Environment
claude agents/ fleet roster)Summary
When a background session that has been stopped or completed is reopened from Agent View, Claude Code spawns a new session-id and only injects the original launch
intent/prompt. The prior conversation is not carried over, so the session appears empty and the initial prompt is re-sent — effectively restarting the task from scratch.This happens at sub-compact context sizes (a few KB of transcript), so it is unrelated to auto-compaction.
Reproduction
claude --bgor the agents view). Let it accumulate a real conversation.workingstate (stoppedordonein~/.claude/jobs/<id>/state.json).Evidence
The original conversation is not actually deleted — it still exists at
~/.claude/projects/<project>/<original-session-id>.jsonl(large file). What gets created on reopen is a stub transcript under a new session-id containing only metadata (system,mode,ai-title,agent-name,agent-setting,permission-mode) with zerouser/assistantmessage entries:Meanwhile the original (e.g. ~900 KB, dozens of messages) remains intact under the old id.
~/.claude/jobs/<id>/state.jsonrecords onlylinkScanPathpointing at the session's own transcript — there is noparentId/respawnOffield linking the stub back to the original conversation.~/.claude/daemon/roster.jsonshows live workers correctly launched withlaunch.mode: "resume"and the rightsessionId/transcriptPath, so attaching to a still-running background session works fine. The regression is specific to reopening a stopped/completed session.Expected
Reopening a stopped/completed background session should resume the original transcript (same session-id, full history), not spawn an empty stub with a new id.
Workaround
claude --resume <original-session-id>restores the full conversation. Users must manually locate the original id from~/.claude/projects/<project>/*.jsonl.Related
</> Codeconversation history silently lost on restart — and Claude doesn't detect the gap #71729 (history silently lost on restart — Claude doesn't detect the gap; Windows/Desktop variant of the same symptom)Happy to provide sanitized copies of the stub vs. original transcripts if useful.