Skip to content

Windows: same project shown under 3+ paths (case + slash variants), splitting cost/session counts #217

Closed

Description

@samshennan

Summary

On Windows, a single Claude Code project shows up as multiple separate "projects" in CodeBurn output because case differences and slash conventions are not normalised before grouping. This splits cost, call count, and session count across what should be one bucket.

Environment

  • Platform: Windows 11 Pro 26200
  • Node: v24.8.0
  • CodeBurn: 0.9.6 (npm i -g codeburn)
  • Shell: Git Bash (MSYS2) under VS Code

Repro

Run codeburn export --format json against a session corpus that contains Claude Code projects logged under ~/.claude/projects/ from a Windows host. The same project surfaces with three distinct keys.

Actual output (from my 30-day export)

A single repository at C:\AI_LAB\OPENCLAW produces three project rows:

323  "Project": "c//AI/LAB/OPENCLAW"
  6  "Project": "c:\AI_LAB\OPENCLAW"
  4  "Project": "C:\AI_LAB\OPENCLAW"

The same triple-split pattern appears for every project on the box (FLIPER, HEX, OKNO, JOB_HUNT, GeminiCLI/VSCodeExtension, …). Note also that _ is being collapsed to / in the slashed variant: AI_LAB becomes AI/LAB, and AI_Experiments becomes AI/Experiments.

Expected

All three should normalise to a single canonical project, e.g. C:\AI_LAB\OPENCLAW (or a forward-slash form, but consistent and case-folded for the drive letter).

Suggested fix

When ingesting a Claude Code session path on Windows:

  1. Lowercase the drive letter (C:\ and c:\ → c:\).
  2. Pick one separator convention and stick to it — don't both keep \ and rewrite as / depending on which session jsonl wrote the path.
  3. Don't replace _ with /. The ~/.claude/projects/ directory naming uses literal underscores and they're significant.
  4. Group/normalise keys before the per-project rollup, so cost/calls/sessions are summed not split.

Related

  • Antigravity sessions surface as opaque ID-paths (C//Users/sam/AppData/Roaming/Claude/local/agent/mode/sessions/378983c5/.../outputs) rather than a clean "Antigravity" label. Probably a related path-resolution gap rather than an explicit normalisation bug, but worth bundling.

Happy to test a patch on the same dataset if useful.

Activity

  1. samshennan commented on May 5, 2026

    @samshennan
    Author

    Quick diagnosis after walking the source — root cause is in src/parser.ts:

    // src/parser.ts:25-27
    function unsanitizePath(dirName: string): string {
      return dirName.replace(/-/g, '/')
    }

    Called from two places (lines 456 and 568) using the directory slug as the source of truth. That's how c--AI-LAB-OPENCLAW (Claude Code's slug for c:\AI_LAB\OPENCLAW) becomes c//AI/LAB/OPENCLAW. The slug is a lossy encoding — :, \, _ all collapse to -, so you can't recover the original from the directory name alone.

    The good news: the canonical path is already in the data. src/types.ts:52 defines cwd?: string on JournalEntry, and every Claude Code session jsonl includes "cwd":"C:\AI_LAB\OPENCLAW" on each entry. It just isn't currently propagated up through parseSessionFile to the project rollup.

    Suggested minimal fix:

    1. In parseSessionFile, capture entry.cwd from the first entry that has one, return it as canonicalCwd alongside the session.
    2. In the project rollup at parser.ts:454-460, prefer canonicalCwd when present; fall back to unsanitizePath(dirName) only when no jsonl entry had cwd (very old sessions).
    3. Group projectMap by canonicalCwd.toLowerCase() (or pick a canonical case) so c:\ and C:\ collapse to one bucket.

    Same shape of fix at the second call site (line 568).

    Happy to test a patch on my dataset (~520 sessions, 28 projects, hits the bug 25+ times) if you want a verifier before merging.

  2. added a commit that references this issue on May 6, 2026
    6151cf6
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