feat(claude): mirror host session transcripts into container#27
Merged
Conversation
setup-claude copied prefs, settings, and memory but not session transcripts, and the cwd-derived project key differs between host (-home-...) and container (-workspaces-src), so `claude --resume` could never find a host session inside the container. Add copy_sessions(): mirror every *.jsonl from the host project key into the container project key, rewriting the DEV_WORKSPACE -> DEV_CONTAINER_WORKSPACE cwd prefix so resume locates the session and historical file paths resolve. Host -> container only; existing container-side transcripts are skipped so continued work is not clobbered. Thread DEV_WORKSPACE through the setup-claude exec in host-bridge.sh (the project key is a lossy s|/|-|g and cannot be reversed). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017DVwgrgGj75dw1AwiZQnzr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
setup-claudecopies prefs, settings, and memory into the container's isolated~/.claude, but not session transcripts. Worse, Claude locates a resumable session by a project-dir key derived from the cwd — which differs between host (-home-dan-repos-...) and container (-workspaces-src). Soclaude --resume <id>could never find a host session from inside a devcontainer, even though the host~/.claudeis mounted read-only at~/.claude-host.Change
setup-claude.py— newcopy_sessions()step (run inmainaftersetup_project_settings): mirrors every*.jsonlfrom the host project key into the container project key, rewriting theDEV_WORKSPACE→DEV_CONTAINER_WORKSPACEcwd prefix so resume locates the session and historical file paths resolve to the container workspace. Host → container only; transcripts already present container-side are skipped so continued work isn't clobbered.lib/host-bridge.sh— threads-e DEV_WORKSPACEinto thesetup-claudeexec (the project key is a lossys|/|-|gand can't be reversed, so the host prefix must be passed explicitly).Notes
/usr/local/bin/setup-claude, so this takes effect on the next image rebuild.DEV_WORKSPACEis unset the copy still runs, just without the prefix rewrite.🤖 Generated with Claude Code