[FEATURE] Custom temp file allocation.

Resolved 💬 2 comments Opened Feb 28, 2026 by HAAIL-Universe Closed Feb 28, 2026

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

Claude Code currently stores all its data under C:\Users\<user>\.claude and uses the system temp directory (typically C:\Users\<user>\AppData\Local\Temp) for temporary files. There is no supported way to relocate these paths.

This creates a hard dependency on the system drive having sufficient free space — which isn't always the case.

Proposed Solution

Support a CLAUDE_HOME environment variable (and/or a --data-dir CLI flag) that controls where Claude Code stores:

  • Configuration and settings
  • Session data and conversation history
  • Credential/auth token storage
  • Cache files
  • Temporary working files (or respect a separate CLAUDE_TEMP_DIR)

Example usage:

# Environment variable
set CLAUDE_HOME=Z:\.claude

# Or CLI flag
claude --data-dir Z:\.claude

The default behavior would remain unchanged (fall back to %USERPROFILE%\.claude), so this is purely opt-in.

Alternative Solutions

What I've tried:

  • Directory junctions / symlinks — Creating a junction from C:\Users\<me>\.claude to Z:\.claude works initially, but breaks credential storage and authentication. Claude Code appears to resolve or validate real paths for its auth tokens, so after creating a junction I have to reinstall and re-authenticate, which puts everything back on C:.
  • Relocating %TEMP% — Moving the system-wide TEMP variable to Z: works for Claude's temp files but causes issues with other Windows applications that expect temp to be on the system drive.
  • Periodic cleanup — Currently my workaround is manually clearing temp files between sessions, which is disruptive and limits how much continuous work I can do.

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

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