Background Task agent transcripts expire while parent conversation is still active
Summary
When using the Task tool to spawn background agents for parallel work, the subagent's JSONL transcript files can be cleaned up (expired/deleted) while the parent conversation is still actively running. This causes data loss — the parent receives truncated or empty results from agents that completed substantial work.
Reproduction
- Start a long-running Claude Code session (high token usage, multiple context compactions)
- Spawn 3+ background Task agents via
run_in_background: true - Continue working in the parent conversation for 30+ minutes
- Check on background agent results — some transcripts are gone or truncated
Expected behavior
Subagent transcripts should be retained at least as long as the parent conversation that spawned them is active. Transcript cleanup should respect the parent-child relationship.
Observed behavior
Transcript files in ~/.claude/projects/<project>/<session>/subagents/ are sometimes cleaned up before the parent reads their results. The parent then gets empty or error responses when checking TaskOutput.
Impact
This affects any workflow using multi-agent parallelism (Team tool, background Task agents). It makes long-running orchestration unreliable — you can't trust that a 60-second agent's work will survive if the parent session has been running for a while.
Environment
- Claude Code CLI (latest)
- Linux (Arch)
- Multi-agent workflows with 3-5 concurrent background agents
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗