Background sidechain agents consuming tokens without returning results

Resolved 💬 5 comments Opened Dec 7, 2025 by uptownhr 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

  1. Start a new Claude Code session in any project
  2. Monitor the ~/.claude/projects/{project}/*.jsonl files for new agent-*.jsonl files
  3. 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 consumed
  • agent-9845a4a3.jsonl: 3,831 input tokens consumed

These agents:

  1. Are marked as isSidechain: true - NOT part of main conversation thread
  2. Have stop_reason: null and only 1 output token - never completed
  3. Generate responses mentioning tool calls, but these aren't actual tool_use blocks
  4. Results are NEVER fed back to the main conversation

Expected Behavior

Either:

  1. Background agents should have their results retrieved via AgentOutputTool and integrated into the main conversation
  2. 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.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗