Skip to content

Move .claude.json config and backups into .claude/ directory #25998

Description

@HYPERLYNQ

Feature Request

Currently, ~/.claude.json and its auto-generated backup/corrupted files (.claude.json.backup.*, .claude.json.corrupted.*) are stored directly in the user's home directory. Over time, the backup files accumulate and clutter the home folder.

Current Behavior

  • ~/.claude.json — main config file
  • ~/.claude.json.backup.<timestamp> — created on every config write
  • ~/.claude.json.corrupted.<timestamp> — created on crash recovery

These pile up in ~/ with no automatic cleanup.

Proposed Solution

One or more of the following:

  1. Move ~/.claude.json into ~/.claude/config.json — the .claude/ directory already exists for plugins, projects, and todos. The main config file fits naturally there.
  2. Store backups inside ~/.claude/backups/ instead of alongside the config in the home directory.
  3. Add an environment variable (e.g., CLAUDE_CONFIG_PATH) to let users customize the config location.
  4. Auto-clean old backups — keep only the most recent 1-2 backups and delete older ones automatically.

Workaround

Currently using a Stop hook to delete backup files at session end:

{
  "type": "command",
  "command": "powershell -NoProfile -Command \"Remove-Item '$env:USERPROFILE\\.claude.json.backup.*','$env:USERPROFILE\\.claude.json.corrupted.*' -ErrorAction SilentlyContinue\"",
  "timeout": 5000
}

This works but shouldn't be necessary.

Environment

  • Windows 11
  • Claude Code CLI + VS Code extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions