You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/plans/mount-claude-config.md
+29-11Lines changed: 29 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,12 @@
2
2
3
3
## Context
4
4
5
-
Clave sessions lose Claude Code state (auto-memory, history, slash commands, skills, agents, rules) because `SetupClaudeCode` only copies a curated subset of config files. This makes features like long-term memory, `--continue`/`--resume`, and personal commands unavailable in VM sessions. The fix is to mount the host's `~/.claude/` directory directly into the VM via VirtioFS, sync `~/.claude.json` round-trip, and handle the macOS-vs-Ubuntu instruction mismatch with an injectable preamble.
5
+
Clave sessions lose Claude Code state (auto-memory, history, slash commands, skills, agents, rules) because `SetupClaudeCode` only copies a curated subset of config files. This makes features like
6
+
long-term memory, `--continue`/`--resume`, and personal commands unavailable in VM sessions. The fix is to mount the host's `~/.claude/` directory directly into the VM via VirtioFS, sync
7
+
`~/.claude.json` round-trip, and handle the macOS-vs-Ubuntu instruction mismatch with an injectable preamble.
6
8
7
-
**Why paths match:** Clave already bind-mounts the project at its original absolute macOS path inside the VM (e.g., `/Users/inxilpro/Development/laravel-zero/clave`). Claude Code's `~/.claude/projects/` directories encode that path (e.g., `-Users-inxilpro-Development-laravel-zero-clave`), so project memory resolves correctly. The `~/.claude.json` projects map keys also match.
9
+
**Why paths match:** Clave already bind-mounts the project at its original absolute macOS path inside the VM (e.g., `/Users/inxilpro/Development/laravel-zero/clave`). Claude Code's
10
+
`~/.claude/projects/` directories encode that path (e.g., `-Users-inxilpro-Development-laravel-zero-clave`), so project memory resolves correctly. The `~/.claude.json` projects map keys also match.
8
11
9
12
**What doesn't match:** Global `~/.claude/CLAUDE.md` may contain macOS-specific instructions (e.g., Herd PHP paths). Solution: inject a default preamble, with override support via `.clave.json`.
10
13
@@ -17,6 +20,7 @@ Clave sessions lose Claude Code state (auto-memory, history, slash commands, ski
17
20
**`app/Support/TartManager.php`** — Update `runBackground()` to support named directory mounts:
18
21
19
22
Currently passes `--dir={path}` for each dir. Change to support `--dir=name:path` syntax. Pass two mounts:
23
+
20
24
-`--dir=project:{project_path}`
21
25
-`--dir=claude-home:{home}/.claude`
22
26
@@ -25,6 +29,7 @@ The `dirs` parameter should change from `array $dirs` (list of paths) to `array
-`~/.claude/CLAUDE.md` (now mounted, with preamble — see step 4)
50
57
51
58
**Keep writing:**
59
+
52
60
-`~/.claude.json` — still a file (not a directory), can't be VirtioFS mounted. Continue writing curated version at session start.
53
61
-`~/.claude/.credentials.json` — needs VM-specific auth values. Write OVER the mounted file (VirtioFS is read-write).
54
62
-`~/.claude/ide/{port}.lock` — needs VM-specific IDE integration values.
55
63
56
64
### 3. Round-trip sync `~/.claude.json`
57
65
58
-
**At session start** (`SetupClaudeCode`): Write curated `~/.claude.json` into VM as today, but include more fields from the host version (the full `projects` map, `githubRepoPaths`, etc.) since we now want transparency.
66
+
**At session start** (`SetupClaudeCode`): Write curated `~/.claude.json` into VM as today, but include more fields from the host version (the full `projects` map, `githubRepoPaths`, etc.) since we now
67
+
want transparency.
59
68
60
69
**At session end** (`SessionTeardown`): Read `~/.claude.json` from the VM via SSH, diff relevant fields, and merge changes back to the host file. Relevant fields to sync back:
70
+
61
71
-`projects.{current_project}.allowedTools` — user may have approved new tools
@@ -83,6 +94,7 @@ Since `~/.claude/` is mounted read-write via VirtioFS, we **cannot** modify `~/.
83
94
This shadows the VirtioFS file without modifying the host. Automatically cleaned up when the VM stops.
84
95
85
96
**Default preamble:**
97
+
86
98
```
87
99
# Clave VM Environment
88
100
You are running inside an Ubuntu VM managed by Clave. Ignore any macOS-specific
@@ -91,6 +103,7 @@ PHP is available as `php`. Node.js is available as `node`/`npm`.
91
103
```
92
104
93
105
**`.clave.json` config for custom preamble:**
106
+
94
107
```json
95
108
{
96
109
"claude_md_preamble": "Use php83 instead of php. Redis is on port 6380."
@@ -101,19 +114,20 @@ If set, replaces the default preamble. If set to `false` or empty string, no pre
101
114
102
115
### 5. Concurrent sessions
103
116
104
-
Since `~/.claude/` is mounted from the host into potentially multiple VMs, concurrent sessions share the same memory and history files. This is the same as running multiple Claude Code sessions locally — Claude Code already handles this. No special handling needed.
117
+
Since `~/.claude/` is mounted from the host into potentially multiple VMs, concurrent sessions share the same memory and history files. This is the same as running multiple Claude Code sessions
118
+
locally — Claude Code already handles this. No special handling needed.
105
119
106
120
---
107
121
108
122
## Files to modify
109
123
110
-
| File | Changes |
111
-
|------|---------|
112
-
|`app/Support/TartManager.php`|`runBackground()`: change `$dirs` from indexed to associative, generate `--dir=name:path` flags |
113
-
|`app/Pipelines/Steps/BootVm.php`|`handle()`: pass both project and claude-home dirs. `mountSharedDirectories()`: mount both VirtioFS shares + bind-mount CLAUDE.md override. `cleanupResumedVm()`: handle claude mount cleanup |
|`app/Support/TartManager.php`|`runBackground()`: change `$dirs` from indexed to associative, generate `--dir=name:path` flags|
127
+
|`app/Pipelines/Steps/BootVm.php`|`handle()`: pass both project and claude-home dirs. `mountSharedDirectories()`: mount both VirtioFS shares + bind-mount CLAUDE.md override. `cleanupResumedVm()`: handle claude mount cleanup |
0 commit comments