Skip to content

fix(claude): support Windows Desktop sessions via APPDATA#615

Open
ozymandiashh wants to merge 1 commit into
mainfrom
fix/windows-claude-desktop-sessions
Open

fix(claude): support Windows Desktop sessions via APPDATA#615
ozymandiashh wants to merge 1 commit into
mainfrom
fix/windows-claude-desktop-sessions

Conversation

@ozymandiashh

@ozymandiashh ozymandiashh commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #611.

Claude Desktop / Cowork stores local agent mode sessions under a platform-specific application data directory. CodeBurn already supports the macOS Desktop sessions path, but the Windows branch was assuming that the roaming profile is always located at homedir()/AppData/Roaming.

That assumption misses valid Windows installs where the roaming profile is redirected, customized, or managed by the OS. In that case npx codeburn can report zero Claude Desktop / Cowork usage even when sessions exist at the real Windows path:

%APPDATA%\Claude\local-agent-mode-sessions

This PR resolves the Windows Desktop sessions root from %APPDATA% first, while preserving the previous homedir()/AppData/Roaming path as a fallback.

Root cause

The Claude provider has two separate discovery paths:

  1. Standard Claude CLI projects, discovered from ~/.claude/projects or CLAUDE_CONFIG_DIR(S).
  2. Claude Desktop / Cowork local agent mode sessions, discovered from local-agent-mode-sessions.

The workaround suggested in the issue, setting CLAUDE_CONFIG_DIR=%APPDATA%\Claude, does not fix Cowork discovery because the config-dir flow expects a projects/ directory structure. Cowork sessions use a different layout under local-agent-mode-sessions, so the Desktop sessions root itself needs to be discovered correctly.

Before this PR, Windows Desktop discovery used:

join(homedir(), 'AppData', 'Roaming', 'Claude', 'local-agent-mode-sessions')

That is only an approximation of %APPDATA%. It is not guaranteed to match the real Windows roaming profile location.

What changed

  • Windows now resolves Claude Desktop / Cowork sessions from:

    %APPDATA%\Claude\local-agent-mode-sessions
    
  • CODEBURN_DESKTOP_SESSIONS_DIR remains the highest-priority override for tests and manual debugging.

  • If APPDATA is unset or blank, the provider falls back to the old path:

    homedir()/AppData/Roaming/Claude/local-agent-mode-sessions
    
  • macOS and Linux behavior is unchanged.

  • Regression tests cover the Windows APPDATA path, fallback behavior, and override precedence.

Behavior matrix

Case Result
CODEBURN_DESKTOP_SESSIONS_DIR is set Use it first on every platform
Windows with APPDATA set Use %APPDATA%\Claude\local-agent-mode-sessions
Windows with APPDATA missing or blank Fall back to homedir()/AppData/Roaming/Claude/local-agent-mode-sessions
macOS Keep ~/Library/Application Support/Claude/local-agent-mode-sessions
Linux Keep ~/.config/Claude/local-agent-mode-sessions

Why this is safe

  • The change is limited to the Desktop sessions directory resolver.
  • Existing override behavior is preserved.
  • The previous Windows path remains as a fallback.
  • No parser behavior changes were made.
  • No macOS or Linux path behavior changes were made.

Testing

Focused validation:

npm test -- --run tests/providers/claude-config-dirs.test.ts tests/parser-claude-cwd.test.ts

Result:

2 passed
38 tests passed

Build validation:

npm run build

Result:

passed

Full suite note:

npm test -- --run

Local result:

1494 passed, 4 failed

The failures are unrelated to this Claude provider change:

  • tests/cli-status-menubar.test.ts has 2 local data-dependent failures.
  • tests/cli-proxy-path.test.ts has 1 local data-dependent failure.
  • tests/cli-provider-validation.test.ts had 1 timeout under full-suite load, and did not reproduce on focused rerun.

I reran the affected menubar/proxy files on origin/main; those failures reproduce there as well, so they are not introduced by this PR.

GitHub Actions on this PR:

  • check passed
  • assess passed
  • semgrep passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support Claude Desktop / Cowork sessions on Windows

1 participant