[FEATURE] Support local persistence of .claude/CLAUDE.md when working on remote SSH servers
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
When working on ephemeral remote servers via SSH (common in cloud development environments, CI/CD systems, or containerized workflows), the .claude/ directory and CLAUDE.md memory file must be recreated on each new server instance. This creates friction as users lose their accumulated context and instructions every time they spin up a new environment.
Currently, Claude Code requires .claude/CLAUDE.md to exist on the remote filesystem where it's running. For ephemeral infrastructure, this means:
- Users must manually recreate their memory files on each new server
- Context and instructions are lost between sessions
- No straightforward way to maintain persistent configuration across temporary environments
Proposed Solution
Add configuration options to specify a local fallback location for .claude/CLAUDE.md when working on remote servers:
- Option 1: Local Mirror Directory
- Allow users to configure a local path in settings (e.g., ~/.claude/remote-mirrors/)
- Claude Code automatically syncs CLAUDE.md from local to remote on connection
- Changes made remotely can optionally sync back to local
- Option 2: Settings-based Fallback
- Add claudeMemory.localPath setting in user settings
- Claude Code reads from local path when remote .claude/CLAUDE.md doesn't exist
- Example: "claudeMemory.localPath": "~/.claude/CLAUDE.md"
- Option 3: Auto-sync on SSH Connection
- Detect SSH remote connections
- Automatically copy local .claude/CLAUDE.md to remote project on initialization
- Offer to sync changes back on disconnect
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
Configuration and settings
Use Case Example
Developer workflow:
- Works on ephemeral AWS Cloud9 / Gitpod / GitHub Codespaces environment
- Accumulates important context in .claude/CLAUDE.md over several days
- Environment times out or is deleted (ephemeral by design)
- Spins up new environment for next session
- Currently: Must recreate CLAUDE.md manually or commit to git
- Desired: Claude Code automatically syncs from ~/.claude/CLAUDE.md on local machine
Additional Context
- This is particularly relevant for:
- Cloud-based development environments (AWS Cloud9, Gitpod, GitHub Codespaces)
- Container-based development with ephemeral volumes
- CI/CD environments where Claude Code might assist with debugging
- Development teams using rotating infrastructure for security/cost reasons
- Committing CLAUDE.md to git isn't always ideal because:
- Memory files often contain developer-specific preferences
- May include sensitive project context that shouldn't be shared
- Creates unnecessary git noise with frequent updates
- Similar functionality exists in other tools (e.g., VS Code Remote SSH extension syncing certain settings
from local to remote)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗