Skip to content

[Claude cost] Usage & Spend shows one claude-swap account because the cost scan reads a single home #2954

Description

@Newarr

Summary

The Usage & Spend pane prices Claude usage from one home directory only. I run two subscriptions through claude-swap, and sessions from the second slot never show up in the 30-day totals. The pane does not error, it just undercounts.

The menu bar tracks rate windows for every swap account, and #2713 extended that to the dashboard-v1 snapshot. Spend was left out of that work because claude-swap list carries no spend field. The Usage & Spend pane still has the gap.

Environment

  • CodexBar 0.49.6
  • claude-swap with 2 accounts, swap integration enabled
  • One CLAUDE_CONFIG_DIR home per swap slot

Reproduction

  1. Set up two accounts in claude-swap and enable the integration.
  2. Run Claude Code sessions under both.
  3. Open Settings > Usage & Spend, select 30d.

Observed behavior

  • Claude shows a single row built from ~/.claude sessions. The local cost cache (claude-v6.json) holds 6,978 scanned files. Every one sits under ~/.claude/projects. The second slot's home has zero.
  • cswap list reports both accounts and the menu bar shows windows for both, so the inventory is there.

Cause (source at f15f142)

SpendDashboardController builds one input per non-Codex provider from tokenSnapshotPublicationForCurrentProviderConfig(for:) (Sources/CodexBar/SpendDashboardController.swift:224-247). Codex gets per-account treatment: codexRequests walks every visible account with its own home path and cache identity (line 468). Claude has no counterpart, so every slot except the scanned home is invisible to spend.

Expected behavior

What Codex already does:

  • one spend source per claude-swap slot
  • each source scans that slot's CLAUDE_CONFIG_DIR
  • one slot failing does not take down the others

Open question

My configured Claude directory (a non-default home) also has zero files in the cost cache. I could not tell whether the cost scan honors claudeConfigDirectory at all, or only the default ~/.claude. Worth confirming while the scan scope is open.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions