Feature request: separate portable configuration from machine-local state under ~/.claude (or ship a recommended .gitignore)
Problem
~/.claude mixes durable, portable configuration with ephemeral
machine-local state in a single flat directory:
- Portable / worth versioning:
settings.json,CLAUDE.md,rules/,
skills/, agents/, commands/, auto memory.
- Machine-local / ephemeral:
cache/,sessions/,shell-snapshots/,
file-history/, history.jsonl, stats-cache.json, paste-cache/,
daemon.log, ide/, session-env/, ...
Anyone who versions ~/.claude as dotfiles (a common practice, and today
the only way to carry a Claude Code profile across machines) has to build a.gitignore by trial and error, and it silently breaks whenever a release
adds a new state directory.
Proposal
Either of these would solve it, in order of preference:
- XDG-style split: configuration under a config root, ephemeral state
under a state/cache root (e.g. XDG_CONFIG_HOME / XDG_STATE_HOME /
XDG_CACHE_HOME on Linux, with sensible macOS equivalents). The config
root becomes trivially versionable as a whole.
- Minimal alternative: an officially maintained, documented
.gitignore for ~/.claude, updated as part of the release process
when new state directories appear.
Secondary: secret hygiene warning
Related, learned the hard way: with ~/.claude under git it is easy to
accidentally commit secrets (e.g. an MCP server token in a config file
before switching to the supported ${VAR} expansion). A warning when
Claude Code detects that a git-tracked file under ~/.claude contains a
string that looks like a credential would prevent a whole class of leaks.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗