FEAT: separate transient state from persistent state/config
Resolved 💬 2 comments Opened Jul 26, 2025 by DarkWanderer Closed Aug 9, 2025
Context
Currently, ~/.claude directory contains a mix of:
- Configuration:
CLAUDE.md,agents,commands,settings.json - Persistent state:
.credentials.json - Transient state:
todos,shell-snapshots,projectsetc. (everything which would not cause an issue if deleted)
Problem
This presents an issue when one wants to share the configuration and persistent state between Claude Code instances running in devcontainers. Particularly:
- Claude configuration (agents, allowed tools, commands, default prompt) is not propagated to container by default
- A first-line workaround to mount
.claudedirectory writeable in container is: - not secure (as malicious code can rewrite prompts)
- prone to errors (e.g. #4014
- Mounting
.claudeas read-only is not possible becauseclaudeattempts to write it for every operation - Solutions like dotfiles customization work but are heavyweight and require multiple steps every time a configuration value is adjusted
- In absence of
.credentials.jsonmounting, reauthentication is required for every new devcontainer or devcontainer rebuild
Proposed solution
Store Claude transient state in ~/.claude-state to separate it from state/settings which are required to be persistent
This will allow to:
- mount
~/.claudedirectory from the container host (readonly) - add that mount into
claude-codedevcontainer feature, so that devcontainers experience is more straightforward out of the box
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗