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, projects etc. (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 .claude directory writeable in container is:
  • not secure (as malicious code can rewrite prompts)
  • prone to errors (e.g. #4014
  • Mounting .claude as read-only is not possible because claude attempts 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.json mounting, 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 ~/.claude directory from the container host (readonly)
  • add that mount into claude-code devcontainer feature, so that devcontainers experience is more straightforward out of the box

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗