[FEATURE] ~/.claude.json should be stored in ~/.claude

Status Fixed / completed
Maintainer reply None cached
Activity 9 comments · opened Feb 9, 2026 · closed Aug 17, 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 spams my home directory with _six_ ~/.claude.json!

.claude.json
.claude.json.backup.1770406785596
.claude.json.backup.1770416750158
.claude.json.backup.1770416750168
.claude.json.backup.1770658516793
.claude.json.backup.1770658710224

This seems a bit silly since there is a ~/.claude directory, too. It clutters up the home directory.

Proposed Solution

Claude should store ~/.claude.json in the ~/.claude directory, or even better, it should adhere to the XDG specification and store it in a subdirectory of XDG_CONFIG_HOME (default: ~/.config/claude).

Alternative Solutions

_No response_

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

7 Comments

github-actions[bot] · 6 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/21429
  2. https://github.com/anthropics/claude-code/issues/1455
  3. https://github.com/anthropics/claude-code/issues/24005

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

mdippery · 6 months ago

I guess this is like #1455, although maybe a bit different since this issue could be solved by moving the multitude of ~/.claude.json files to ~/.claude.

vaclavpavek · 6 months ago

I agree, it is necessary to enable the use of multiple separate/isolated profiles using CLAUDE_CONFIG_DIR.

pierres · 6 months ago

This also has a concrete security impact: the lock and temp files created next to ~/.claude.json in ~/ make it impossible to run Claude Code inside filesystem sandboxes like Landlock (Linux).

The problem: saveConfigWithLock creates ~/.claude.json.lock and safeWriteFileAtomically creates ~/.claude.json.tmp.<pid>.<timestamp> — both in ~/. Sandboxes like Landlock can grant write access to a specific file (~/.claude.json) but cannot grant permission to create new files in ~/ without opening the entire home directory for writes. This defeats the sandbox.

Impact: Any Claude Code session longer than a few minutes crashes with EACCES when config save is first triggered. Short operations like claude -v work because they exit before a save.

Moving ~/.claude.json into ~/.claude/ (or $XDG_CONFIG_HOME/claude/) would resolve this naturally — lock and temp files would land in a directory the application already owns.

Filed originally as #30372, closing in favor of this issue.

florinungur · 4 months ago

macOS data point on the symlink workaround: I have ~/.claude.json -> ~/.config/claude/claude.json and it works most of the time, but it's fragile by design. safeWriteFileAtomically writes to a temp file (~/.claude.json.tmp.<pid>.<timestamp>) then renames over the target. On macOS, rename(2) currently follows the symlink, so the target file gets replaced and the symlink survives. But lock files (~/.claude.json.lock) still land in $HOME root, not at the symlink target — same Landlock issue pierres flagged in #30372, just on a different OS.

The real fix is what this issue asks for: move ~/.claude.json inside ~/.claude/ so lock files, temp files, and backups all land in a directory the application already owns.

AirAgentSDE · 4 months ago

Are there any updates on this feature? I really appreciate it and hope for some progress, as it's quite annoying to see this mess.

davidgrilli · 4 months ago

I added this to my ~/.zshenv:

export CLAUDE_CONFIG_DIR=~/.claude

and now Claude uses ~/.claude/.claude.json 🚀

Showing cached comments. Read the full discussion on GitHub ↗