Skip to content

[FEATURE] Custom temp file allocation. #29629

Description

@HAAIL-Universe

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions