[
    {
        "role": "user",
        "content": "when%20i%20want%20to%20chat%20with%20claude%20on%20a%20new%20topic%2C%20such%20as%20birds%2C%20I%20run%20claude%20--name%20birds.%20I%20can%20return%20to%20this%20session%20later%20with%20claude%20--resume%20birds.%20claude%20seems%20to%20store%20session%20history%20in%20%7E%2F.claude%2Fprojects%20%2B%20-%20%2B%20cwd%20where%20claude%20started.%20this%20works%20ok%20but%20is%20a%20little%20obscure.%20can%20I%20override%20where%20this%20is%20stored%2C%20perhaps%20when%20I%20run%20claude%20--name%20birds%20or%20some%20other%20way%3F"
    },
    {
        "role": "assistant",
        "content": "Yes \u2014 you *can* override where Claude Code stores its configuration, session history, plugins, etc., using an environment variable. But it's not quite the same as changing everything cleanly; some data still ends up in local workspace directories. Here's a breakdown of how Claude Code handles session/config storage + what you *can* and *cannot* change.\n\n---\n\n## \ud83e\udde0 How Claude Code stores sessions & state\n\n- Session transcripts, memory, settings, and other persistent data are stored under your configuration directory, by default `~/.claude` on Unix-like systems (or equivalent on Windows). ([diljitpr.net](https://www.diljitpr.net/blog-post-2026-02-24-inside-dot-claude-filesystem-architecture.html?utm_source=openai))  \n- Within `~/.claude/projects/`, Claude organizes session history by project. Each project directory name is derived from the *absolute path* of your current working directory (CWD), typically sanitized and hashed or \u201cslugified.\u201d That\u2019s how sessions are tied to a project \u201cbirds\u201d when your CWD is `~/some/path/to/birds`. ([mintlify.com](https://www.mintlify.com/sanbuphy/claude-code-source-code/architecture/session-persistence?utm_source=openai))  \n- BUT: there *also* exists a `.claude` folder in your project itself. That project-local `.claude/` holds project-level configuration files (settings, CLAUDE.md, etc.)\u2014stuff you might want to share in a git repo. Some aspects of settings/preferences also live in `.claude/settings.local.json` etc. ([docs.anthropic.com](https://docs.anthropic.com/en/docs/claude-code/settings?utm_source=openai))\n\n---\n\n## \ud83d\udd27 How to override the storage location\n\n- Claude Code supports an environment variable called `CLAUDE_CONFIG_DIR` which *overrides* the configuration directory (defaults to `~/.claude`). That means all or most of the session history, settings, plugins, etc., will be stored under whatever directory you set `CLAUDE_CONFIG_DIR` to. ([code.claude.com](https://code.claude.com/docs/en/env-vars?utm_source=openai))  \n- Example usage in shell:\n\n  ```bash\n  export CLAUDE_CONFIG_DIR=\"/path/to/my/claude-data\"\n  claude --name birds\n  ```\n\n  This makes Claude use `/path/to/my/claude-data` instead of `~/.claude` for everything it would normally store globally. ([code.claude.com](https://code.claude.com/docs/en/env-vars?utm_source=openai))\n\n---\n\n## \u26a0\ufe0f What `CLAUDE_CONFIG_DIR` **doesn\u2019t** override (or only partially overrides)\n\n- Even with `CLAUDE_CONFIG_DIR` set, Claude Code may still create *local* `.claude/` directories in project workspaces for things like project-specific settings (`settings.local.json`) or hooks that are defined per-project. These are by design meant to be project-local. ([github.com](https://github.com/anthropics/claude-code/issues/3833?utm_source=openai))  \n- Also, the mechanism by which the project directory\u2019s session storage is named uses the *absolute path* of where you ran Claude. If you move or rename the project directory (or run from a different path), Claude treats it as a different project. So storing sessions under a custom name like `claude --name birds` doesn\u2019t change how the project-hash directory is named. ([diljitpr.net](https://www.diljitpr.net/blog-post-2026-02-24-inside-dot-claude-filesystem-architecture.html?utm_source=openai))\n\n---\n\n## \u2705 Practical recommendations\n\nIf you want a cleaner setup where everything \u2014 session history, settings, etc. \u2014 go to a directory you control, here\u2019s what you should do:\n\n1. Set `CLAUDE_CONFIG_DIR` in your environment before launching Claude:\n\n   ```bash\n   export CLAUDE_CONFIG_DIR=\"/my/custom/claude-config\"\n   ```\n\n   You can add that line to your shell\u2019s config (`~/.bashrc`, `~/.zshrc`, etc.).\n\n2. Confirm that `~/.claude` is no longer being used for global state. Check that new content appears in `/my/custom/claude-config`.\n\n3. Still expect `.claude/` in your project folder (this is for project-local settings). If you don\u2019t want it, you\u2019d have to minimize project-specific config or accept it being created.\n\n4. Use `claude --resume name-of-session` (if named) or list sessions via `claude --list` (or whatever the UI is) to resume. Named sessions don\u2019t change project hashing, but help identifier visibility. ([github.com](https://github.com/anthropics/claude-code/issues/2112?utm_source=openai))\n\n---\n\n## \ud83d\udd0d Conclusion\n\n- **Yes**, you *can* override Claude\u2019s storage directory using the environment variable `CLAUDE_CONFIG_DIR`.\n- This will relocate most of your global/session/config data away from `~/.claude`.\n- But some workspace-level config still lives in `.claude/` inside each project directory.\n- Session names do help with visibility, but don\u2019t affect how Claude associates sessions with your project directory.\n\nIf you\u2019d like, I can walk you through setting this up with your \u201cbirds\u201d sessions (or whatever custom setup you have), to ensure it behaves exactly the way you want. Do you want me to help configure that for your system?"
    },
    {
        "role": "user",
        "content": "can%20I%20change%20the%20projects%20directory%3F"
    },
    {
        "role": "assistant",
        "content": "As of the latest information, **you cannot** change where Claude Code stores its *projects directory* (i.e. where it stores session transcripts etc.) \u2014 that location is *not configurable*. The location is hard-coded to use your config directory (by default `~/.claude/` \u2014 or the newer default `~/.config/claude/`) under a `projects/` subfolder. ([ccusage.com](https://ccusage.com/guide/directory-detection?utm_source=openai))\n\nHere are some key details to clarify what *is* possible and what *isn\u2019t*:\n\n---\n\n## \ud83d\udd0d What *is* possible\n\n1. **Override the config directory**  \n   You *can* set the environment variable `CLAUDE_CONFIG_DIR` to change the *global* configuration directory. This moves all of the global data (like session transcripts, settings, etc.) from its default location (`~/.claude/` or `~/.config/claude/`) into wherever you point `CLAUDE_CONFIG_DIR`. So in effect, that changes where `projects/` is located (because it will be inside that config directory). ([ccusage.com](https://ccusage.com/guide/directory-detection?utm_source=openai))\n\n2. **Renaming or moving a project directory**  \n   Since Claude Code identifies projects based on the *absolute path* of your current working directory when starting a session, renaming or moving a project folder will break that link (i.e., Claude will treat it as a new project, losing access to its session history under the old path). But there is a community tool called **claudepath** that helps remap/repair project path references so Claude Code can find your old sessions after a move/rename. ([pypi.org](https://pypi.org/project/claudepath/?utm_source=openai))\n\n---\n\n## \ud83d\udeab What *isn\u2019t* possible / what hasn't been found\n\n- You *cannot* pick an arbitrary directory for *just* the `projects/` folder independently of the global config directory. It is not currently configurable as a separate path.  \n- There is no setting in `~/.claude/settings.json` or project settings that lets you reassign where project sessions go outside of the `projects/` subdirectory of your global config directory. ([code.claude.com](https://code.claude.com/docs/en/claude-directory?utm_source=openai))\n\n---\n\nIf you like, I can help you set up an environment variable or script to relocate your `projects/` directory into a folder of your choice (through `CLAUDE_CONFIG_DIR`) or use `claudepath` to remap an existing project you\u2019ve moved. Do you want me to walk you through that?"
    }
]