Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Use Claude in T3 Code with the default instance (
claudeAgent, nohomePath) for a while, so transcripts build up in~/.claude/projects. - Add Claude accounts: set the default
claudeAgentinstance'shomePathto a new directory (for example~/.claude-t3/a), and add a second Claude instance with its ownhomePath(~/.claude-t3/b). - Keep working with both accounts.
- Open Usage → Cost for a range that covers both periods (for example the last 90 days).
Expected behavior
The Claude total should include all Claude transcripts on the machine that fall inside the range, including history recorded in ~/.claude before step 2. If T3 Code leaves a directory out on purpose, the Usage page should say so.
Proposed behavior, most important first:
- Always scan the default Claude home. Add the driver's default transcript directory (
~/.claude, or the host'sCLAUDE_CONFIG_DIR) as a history source even when an instance with the idclaudeAgenthas a customhomePath. The existingprovider + realpath(dir)dedupe inresolveTranscriptDirsalready prevents double counting when an instance still points at it. Apply the same rule to other drivers with a default home (~/.codex, etc.). - Keep sources that were configured before. The scan cache already remembers past sources (
sourcesinusage-scan-cache-v11.json) and still holds their records. Keep counting a source after its instance is reconfigured or removed, until its records age out of retention. Label it in the per-instance breakdown (for example "Claude: previous home~/.claude") instead of dropping it. - Never drop history silently. If a directory with transcripts in range is excluded, show a notice on the Usage page (for example "Claude history in
~/.claude(134 sessions) is not included because no Claude account uses it") with an action to include it. A setting for extra history directories, or a per-source include/exclude toggle, would also cover people who deliberately keep personal CLI usage in~/.claudeout of the totals.
Actual behavior
Only directories of instances in the current settings are scanned. usageInstances adds the implicit default instance only when settings.providerInstances has no entry with the driver's id:
if (!Object.hasOwn(settings.providerInstances, driver.driverKind)) {
entries.push([ProviderInstanceId.make(driver.driverKind), {}, false]);
}After step 2, the claudeAgent entry exists and points elsewhere, so ~/.claude is never resolved as a transcript directory. All Claude history from before the switch disappears from Usage. The page shows no warning, only the usual "N malformed or inconsistent usage record(s) were skipped".
Measured from my scan cache (usage-scan-cache-v11.json) for the displayed 90-day range:
| Claude transcript dir | Sessions in range | Activity | Counted |
|---|---|---|---|
~/.claude-t3/a (instance claudeAgent) |
32 | Nov 6 → today | yes |
~/.claude-t3/b (second instance) |
19 | Nov 6 → today | yes |
~/.claude (former default home) |
134 | Aug 17 → Nov 6 | no |
The Usage page shows "Claude Code · 51 sessions" (32 + 19). The daily chart shows Claude at $0.00 on days with more than 1,000 usage records in ~/.claude (Aug 19: 1,363 records). The three directories share no dedupe keys, so dedupe does not explain the gap. Total Claude cost and its share of total cost are understated by everything before Nov 6.
The cache still lists claude ~/.claude/projects under sources, and its file records are still there, so the data was scanned at some point but is now filtered out.
Related, but not the same problem:
- [Bug]: Usage cost by provider does not sum multiple instances of the same provider #24039 (closed, not reproduced) reported that instances of the same provider are not summed. Here they are summed correctly: 32 + 19 = 51. What's missing is the default home once no instance points at it.
- [Bug]: Usage page ignores providerInstances — only the default Claude/Codex homes are scanned, second Claude-driver instances never appear #7514 (closed) made the page scan configured instances.
Impact
Minor bug or occasional failure
Version or commit
Desktop 0.1.7 (stable). Code path confirmed on main @ dafd053.
Environment
macOS 15 (arm64), desktop app 0.1.7, two Claude Code instances with separate homePaths, plus Codex.
Logs or stack traces
# usage-scan-cache-v11.json → "sources" (paths shortened)
claude ~/.claude-t3/b/projects
claude ~/.claude/projects # still cached, not counted
claude ~/.claude-t3/a/projects
codex ~/.codex/sessionsWorkaround
Add a third Claude instance with homePath set to ~/.claude. usageInstances does not filter on enabled, so the instance can stay disabled and its history is counted again.
Activity