Feature Request: XDG Base Directory Specification Support for Config Files
Resolved 💬 3 comments Opened Nov 10, 2025 by stefmf Closed Nov 14, 2025
Summary
Claude Code currently stores its configuration files (.claude.json and .claude.json.backup) directly in the user's home directory (~/), which is not compliant with the XDG Base Directory Specification.
Current Behavior
- Config files are stored at:
~/.claude.jsonand~/.claude.json.backup - These files contain metadata like startup count, tips history, install method, and auto-update preferences
Requested Behavior
Support XDG Base Directory Specification by storing config files in:
$XDG_CONFIG_HOME/claude/config.json(typically~/.config/claude/config.json)- Or
$XDG_DATA_HOME/claude/for state/data files (typically~/.local/share/claude/)
Fall back to ~/.claude.json if XDG environment variables are not set for backward compatibility.
Why This Matters
- Home Directory Cleanliness: Users following XDG conventions prefer keeping their home directories clean with only standard directories
- Cross-Platform Consistency: XDG is a widely adopted standard on Linux/Unix systems
- Better Organization: Separates config, cache, and data files into appropriate directories
- User Expectations: Many modern CLI tools support XDG (e.g., ripgrep, fd, bat, starship, etc.)
Environment
- OS: macOS (but affects all Unix-like systems)
- Claude Code Version: 2.0.36
Example Implementation
Many CLI tools check for XDG variables first:
const configHome = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config');
const configPath = path.join(configHome, 'claude', 'config.json');
Related
This is especially important for users who track their dotfiles in version control and want to maintain a clean home directory structure.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗