Background sidechain agents consuming tokens without returning results
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 5 comments · opened Dec 7, 2025 · closed Feb 9, 2026
Bug Description
When starting a new Claude Code session, background \"sidechain\" agents are spawned that consume input tokens but their results are never returned to the main conversation.
Environment
- Claude Code Version: 2.0.61
- OS: Linux (Ubuntu)
- Model: Claude Opus 4.5
Steps to Reproduce
- Start a new Claude Code session in any project
- Monitor the
~/.claude/projects/{project}/*.jsonlfiles for newagent-*.jsonlfiles - Observe that multiple agent files are created immediately on session start
Observed Behavior
When starting a session, multiple agent-*.jsonl files are created with the following characteristics:
{
"isSidechain": true,
"sessionId": "96e08ed5...", // Same as main session
"output_tokens": 1,
"stop_reason": null
}
Example from actual session:
agent-cb4ad2c6.jsonl: 3,703 input tokens consumedagent-9845a4a3.jsonl: 3,831 input tokens consumed
These agents:
- Are marked as
isSidechain: true- NOT part of main conversation thread - Have
stop_reason: nulland only 1 output token - never completed - Generate responses mentioning tool calls, but these aren't actual
tool_useblocks - Results are NEVER fed back to the main conversation
Expected Behavior
Either:
- Background agents should have their results retrieved via
AgentOutputTooland integrated into the main conversation - OR these agents should not be spawned if their results won't be used
Impact
- Token waste: ~7,500+ input tokens per session start with zero value
- Cost: Unnecessary API costs for users
- Confusion: Activity appears in JSONL logs but not in the UI
Evidence
Agent content shows responses like:
"I'll start by getting recent context from my memory system..."
"I'm in READ-ONLY mode, so I can..."
But these are just text responses - no actual tool execution occurs, and the "context" gathered is discarded.
Additional Context
Discovered while building a JSONL file watcher to monitor Claude Code activity. The watcher showed multiple NEW SESSION [agent-*] entries being created on every session start, with responses that never appeared in the main conversation UI.
5 Comments
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Still experiencing this issue on Claude Code 2.1.2 (native install, Linux).
Every user message spawns a new
agent-*.jsonlsidechain file. On a typical session, this creates 50+ files in minutes. Each file consumes ~3-4K input tokens that produce no useful output (stop_reason: null, 1 output token).Current workaround: cron job to delete
agent-*.jsonlfiles periodically.Request: Please add a configuration option to disable sidechain spawning, or fix the excessive spawning behavior. The
isSidechain: truemarker is helpful for filtering in third-party UIs, but the root cause (spawning on every message) should be addressed.This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
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.