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
/resume in worktree containers is orphaned: Claude Code keys transcripts by raw CWD path, so worktree sessions are invisible from the main repo (and vice versa) #370
Related: #368 (same family — worktree topology breaking tooling that resolves identity through git).
Symptom
/resume inside a clawker worktree container cannot see past conversations from the repository. Worktree-session chats are likewise invisible from the main checkout. Worktree sessions end up orphaned and isolated from the root repository's history.
Mechanism (observed live from inside a worktree agent container, 2026-06-10)
Claude Code stores conversation transcripts under ~/.claude/projects/<flattened-cwd-path>/*.jsonl — keyed by the raw working directory path, not the git repository. In the agent's config volume right now:
22 separate sibling dirs of the form -Users-andrew-Code-clawker--clawkerlocal--local-share-clawker-worktrees-clawker-clawker-<id>/ — one per worktree container that ever ran, each holding that worktree's transcripts
The active session's transcript is being written to the worktree-keyed dir, not the main one. Since /resume lists sessions for the current project dir:
in a worktree container, it shows only that worktree path's sessions — no repo history;
in the main checkout, worktree sessions never appear;
worktree paths are unique per branch and deleted on worktree remove, so those transcript dirs become permanently unreachable garbage.
The split-brain that proves linkage is possible
Claude Code's file-based auto-memory for this same session resolves to the MAIN repo's project dir (~/.claude/projects/-Users-andrew-Code-clawker/memory/) even though CWD is the worktree — so some CC subsystem already maps worktree → main repo (presumably via git common-dir resolution; git rev-parse --git-common-dir from the worktree works in-container and returns the main .git). Transcript keying just doesn't use that mapping. Whether that's upstream CC behavior or something our mount/ownership layout degrades is the open question.
Discriminating tests (not yet run)
Host-side control: open CC in a plain git worktree on the host (no clawker) and run /resume — if main-repo sessions are also invisible there, this is upstream CC behavior, not clawker breakage → becomes a CC feature request + clawker-side mitigation.
Confirm whether /resume within the SAME worktree+agent across container restarts works (same path + persistent config volume ⇒ should), to scope the report precisely.
Candidate clawker-side mitigations (sketch)
At container init (or in the workspace/containerfs layer), pre-create ~/.claude/projects/<flattened-worktree-path> as a symlink to the main repo's project dir, so worktree sessions read/write the shared history. Needs care: the flattening scheme is CC-internal (path with / and . → -), so this couples to an undocumented convention — verify against the observed dirs and gate on it.
Alternatively keep per-worktree isolation but garbage-collect/migrate transcript dirs on clawker worktree remove so history isn't silently orphaned.
If host-side CC turns out to link worktrees correctly (test 1) and only our containers don't, diff what resolution input is missing in-container (ownership, mount set, env) and fix that instead.
Evidence commands
# inside a worktree agent container
ls ~/.claude/projects/ # main dir + one dir per worktree path
ls -lt ~/.claude/projects/*/*.jsonl | head # active transcript lands in the worktree-keyed dir
git rev-parse --git-common-dir # main .git — resolution input exists
Related: #368 (same family — worktree topology breaking tooling that resolves identity through git).
Symptom
/resumeinside a clawker worktree container cannot see past conversations from the repository. Worktree-session chats are likewise invisible from the main checkout. Worktree sessions end up orphaned and isolated from the root repository's history.Mechanism (observed live from inside a worktree agent container, 2026-06-10)
Claude Code stores conversation transcripts under
~/.claude/projects/<flattened-cwd-path>/*.jsonl— keyed by the raw working directory path, not the git repository. In the agent's config volume right now:~/.claude/projects/-Users-andrew-Code-clawker/— main-checkout sessions-Users-andrew-Code-clawker--clawkerlocal--local-share-clawker-worktrees-clawker-clawker-<id>/— one per worktree container that ever ran, each holding that worktree's transcriptsThe active session's transcript is being written to the worktree-keyed dir, not the main one. Since
/resumelists sessions for the current project dir:worktree remove, so those transcript dirs become permanently unreachable garbage.The split-brain that proves linkage is possible
Claude Code's file-based auto-memory for this same session resolves to the MAIN repo's project dir (
~/.claude/projects/-Users-andrew-Code-clawker/memory/) even though CWD is the worktree — so some CC subsystem already maps worktree → main repo (presumably via git common-dir resolution;git rev-parse --git-common-dirfrom the worktree works in-container and returns the main.git). Transcript keying just doesn't use that mapping. Whether that's upstream CC behavior or something our mount/ownership layout degrades is the open question.Discriminating tests (not yet run)
/resume— if main-repo sessions are also invisible there, this is upstream CC behavior, not clawker breakage → becomes a CC feature request + clawker-side mitigation.git rev-parse --git-common-dirworks in a production worktree container (worktrees in the XDG data dir; main repo top-level is root-owned scaffold — the Go -buildvcs cannot stamp linked worktrees: wrong-parent stamping, dubious-ownership failures, and the scope of the GOFLAGS mitigation #368 dubious-ownership guardrail might block discovery there even if the dev.clawkerlocallayout works)./resumewithin the SAME worktree+agent across container restarts works (same path + persistent config volume ⇒ should), to scope the report precisely.Candidate clawker-side mitigations (sketch)
~/.claude/projects/<flattened-worktree-path>as a symlink to the main repo's project dir, so worktree sessions read/write the shared history. Needs care: the flattening scheme is CC-internal (path with/and.→-), so this couples to an undocumented convention — verify against the observed dirs and gate on it.clawker worktree removeso history isn't silently orphaned.Evidence commands
🤖 Generated with Claude Code