[FEATURE] CLAUDE_DATA_DIR env var or config key to relocate %APPDATA%\Claude\ on Windows

Open 💬 10 comments Opened May 11, 2026 by AiRE-Geo

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

On Windows, the Claude Code desktop app (Store/MSIX package) stores all user data in %APPDATA%\Claude\. There is no setting, env var, or CLI flag to relocate this to another drive.

The app is installed with the unvirtualizedResources capability, so data writes to real %APPDATA% — not a Store VFS sandbox. This means reinstalling to another drive only moves the 518 MB Electron binary; the 15+ GB of user data stays on C: regardless.

Measured sizes on an active install:

| Path | Size | Growth |
|---|---|---|
| vm_bundles\rootfs.vhdx | 10 GB | ~1 GB per active session day |
| vm_bundles\rootfs.vhdx.zst | 2.2 GB | Static |
| vm_bundles\sessiondata.vhdx | 1.3 GB | Grows with sessions |
| local-agent-mode-sessions\ | 472 MB | Grows with sessions |
| %APPDATA%\Claude\ total | ~15.4 GB | Growing |

rootfs.vhdx is a dynamically-expanding VHDX. On an active development machine it can fill a typical system SSD within weeks.

Proposed Solution

A CLAUDE_DATA_DIR environment variable (or equivalent config key in claude_desktop_config.json) that relocates the entire user data directory:

// claude_desktop_config.json
{
  "dataDir": "D:\\ClaudeData\\Claude"
}

or via environment variable:

CLAUDE_DATA_DIR=D:\ClaudeData\Claude

All subdirectories (vm_bundles\, local-agent-mode-sessions\, claude-code\, etc.) resolve relative to this root. On first launch with the new setting, Claude Code should either migrate data automatically or print clear instructions to move the directory manually.

Alternative Solutions

Exhaustively checked — none work:

  1. CLAUDE_* env vars — none control data location
  2. %APPDATA%\Claude\config.json — UI preferences only (scale, theme, window position)
  3. claude_desktop_config.json — behaviour preferences only
  4. ~/.claude/settings.json — hooks and permissions only
  5. App manifest — no userData path override declared
  6. Move-AppxPackage to D: — only moves the 518 MB Electron binary, data stays on C:
  7. Registry keys (like Outlook's ForceOSTPath) — none exist for Claude Code

Current workaround: NTFS directory junction (C:\Users\...\AppData\Roaming\ClaudeD:\ClaudeData\Claude). Works but is unsupported, fragile across Windows Updates, and inaccessible to non-technical users.

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

Scenario: Active developer on a 512 GB system SSD (Alienware M15 / similar), running Claude Code daily for geospatial AI development.

  1. Fresh install: %APPDATA%\Claude\ = ~13 GB
  2. After two weeks of active use: rootfs.vhdx grows ~1 GB per session day as the Linux VM accumulates pip/npm packages
  3. With a secondary 521 GB SSD sitting 80% empty, there is no way to redirect this growth without an unsupported NTFS junction hack
  4. With CLAUDE_DATA_DIR=D:\ClaudeData\Claude in config: all VM data, sessions, and cache land on the secondary SSD automatically — C: stays healthy indefinitely

Additional Context

Prior art for this pattern:

  • VS Code: --user-data-dir CLI flag + code-portable-data/ support
  • Chromium: --user-data-dir flag
  • XDG Base Directory spec: XDG_DATA_HOME / XDG_CONFIG_HOME
  • Microsoft Outlook: ForceOSTPath registry value (REG_EXPAND_SZ) — exact analogue

Related issues:

  • #25762 — env var for ~/.claude/ config dir (same theme, different path)

Platform: Windows 11, Claude Code desktop (Store/MSIX) v1.6608.2.0, Alienware M15, 410 GB C: SSD

View original on GitHub ↗

This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗