[Feature Request] Add projectsDirectory setting to relocate per-project state from ~/.claude/projects/
Summary
autoMemoryDirectory already lets me relocate memories into the repo itself
(e.g. ./.claude/memory/). But the rest of per-project state — session
transcripts (.jsonl), file-history snapshots, tool-results, shell-snapshots,
session-env — is still hardcoded under ~/.claude/projects/<cwd-slug>/.
Please add an equivalent setting to relocate this state to a project-local
path.
Use case
I share ~/.claude with a teammate (dotfiles repo). Per-project state
accumulating in the globally-shared dir is:
- Cross-contaminating between our individual work
- Bloating the global config we sync
- Invisible to teammates who would benefit from parts of it (e.g. context
Claude has built up about a shared repo)
- Hard to clean up per-repo — the
<slug>encoding is ambiguous (a hyphen in
a real dir name is indistinguishable from a path separator), so there's no
reliable way to map a slug back to a repo without filesystem guessing
Moving per-project state _into_ the project solves all of these. Memory
already can; sessions can't.
Current workaround
Per-repo symlink before first launch:
mkdir -p /path/to/repo/.claude/state
ln -s /path/to/repo/.claude/state ~/.claude/projects/<slug-for-that-repo>
Problems:
- Must be set up before Claude is ever launched in that repo, or the real dir
gets created first
- Requires knowing the slug encoding
- Breaks if the repo is renamed/moved
cleanupPeriodDaysdeletions happen inside the repo, which is surprising
Proposed
Add a setting analogous to autoMemoryDirectory:
{
"projectsDirectory": "./.claude/state"
}
- Allowed in user settings (
~/.claude/settings.json) and local settings
(~/.claude/settings.local.json or .claude/settings.local.json in a repo)
- Not allowed in project settings (
.claude/settings.json), same safety
reasoning as autoMemoryDirectory — a shared repo shouldn't be able to
redirect your writes
- Relative paths resolve against cwd at launch time
- When unset, default stays at
~/.claude/projects/<slug>/
Nice-to-have: per-component toggles
Not everyone wants everything in the repo. Expose individual overrides so
users can mix:
sessionsDirectory—.jsonltranscriptsfileHistoryDirectory— pre-edit snapshots (checkpoint restore)toolResultsDirectory— large tool output spillovershellSnapshotsDirectory— session shell statedebugDirectory— per-session debug logs
Typical split I'd want: memory + debug in the repo (shareable), transcripts
- file-history global or gitignored (personal history).
Why it matters
With autoMemoryDirectory alone, my ~/.claude/ still accumulates opaque
per-project state that nobody can untangle without a migration script. AprojectsDirectory setting would close the gap and let teams actually
commit useful Claude context to their repos.
Environment Info
- Platform: linux
- Terminal: tmux
- Version: 2.1.104
- Feedback ID: a675128c-70ee-4105-8b3b-7cfa78a71656
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗