Skip to content

Are Claude Code /btw (aside_question) sidechain costs real or over-counted? #913

Closed

Description

@yichao-figma

Question

Claude Code's /btw feature creates aside_question sidechain log files under subagents/ that appear to re-log the entire conversation history with full usage metadata. ccusage reports these as significant costs, but I'm not sure if these represent real API calls or just duplicate log entries of the same conversation.

Has anyone else noticed this? Are the reported costs for /btw accurate, or is ccusage overcounting?

What I'm seeing

In a session with ~135k context, a single /btw question created a sidechain log with 60 "turns" and ccusage reported ~$6-7 for it — even though /btw is supposed to be a single one-shot question/answer.

In a longer session (~700k context), multiple /btw uses created sidechain logs with 1,000+ "turns" each. ccusage reported very high costs for the subagents pool, which seems disproportionate for simple side questions.

Observations

  • /btw creates files like agent-aside_question-*.jsonl in the subagents/ directory
  • These files have "isSidechain": true in their metadata
  • They share the same sessionId and timestamps as the parent conversation
  • Every prior assistant message from the main conversation appears re-logged in these files with cache_read_input_tokens
  • ccusage sums up all these entries, which may be double-counting tokens already reported in the main session

Possible issue

If these sidechain logs are just mirroring the parent conversation's history (not separate API calls), then ccusage may need to either:

  • Filter out / deduplicate isSidechain: true entries
  • Detect that aside_question logs share the same session and timestamps as the parent

Or if these are real separate API calls, that would be good to know too — it would mean /btw is much more expensive than expected.

Environment

  • Claude Code CLI
  • /btw is a recently added feature

Additional evidence from statusline

Claude Code's statusline tracks session cost in real-time via cost.total_cost_usd from the API response, independent of JSONL log parsing. After a /btw call, the statusline cost increased by ~$0.08, while ccusage reported ~$10.28 for the same call. Across three /btw tests in the same session, ccusage reported $6.67, $9.66, and $10.28 (growing linearly with conversation length), while the statusline showed a consistent ~$0.08 increase each time. This confirms the overcounting — ccusage is re-summing the entire conversation history logged in each sidechain file rather than counting only the incremental API cost.

Activity

  1. changed the title [-]Are Claude Code /btw (aside_question) sidechain costs real or double-counted?[/-] [+]Are Claude Code /btw (aside_question) sidechain costs real or over-counted?[/+] on Mar 29, 2026
  2. Astro-Han commented on Mar 31, 2026

    @Astro-Han

    Your analysis is correct. The sidechain files (agent-aside_question-*.jsonl) log the full conversation history because /btw runs in isolation and needs the entire context to answer, so each file includes cache_read_input_tokens for every prior turn. ccusage sums all of those entries, which means each /btw call effectively re-counts "total session cost so far" rather than just the incremental API cost.

    cost.total_cost_usd from the statusline is ground truth: it's the incremental cost returned directly from each API response. Your $0.08 vs $10.28 numbers are consistent with that hypothesis.

    The fix on ccusage's side would be deduplication: either filter isSidechain: true entries entirely, or detect that sidechain session IDs overlap with the parent and only count the delta.

  3. added a commit that references this issue on May 25, 2026
    cb26b5c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions