Add devc sync to copy devcontainer sessions to host#27
Conversation
Claude Code's /insights reads sessions from ~/.claude/projects/ on the host, but devcontainer sessions live inside container volumes. This adds a `devc sync [project]` command that copies them over so /insights can analyze devcontainer work alongside local sessions. - Auto-discovers devcontainers via devcontainer.local_folder label - Works on both running and stopped containers (docker cp only) - Reads CLAUDE_CONFIG_DIR from container env for non-standard paths - Incremental: only copies new/updated files - Optional project name filter (case-insensitive substring) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Wouldn't it be better to run The |
|
After re-reading this I think the idea here is to get the chat logs to get Is that really any important/useful? I just hope this wouldn't create any case where this could blow up/hijack host etc. |
|
Yes - my idea was to have an easy way to sync one way the sessions from the container to the host, so my /insights command could also get info from what I'm doing inside devcontainers. I'm unsure of the threat model here - we're only copying JSON files, but maybe Claude Code does something more with the files it's loading during the analysis? |
|
Yea I have no idea either; I bet it could lead to some prompt injection at some point, or, if the file is a symlink then maybe it can make claude read some other file from the filesystem on the host? |
|
Anyway: I think we can add it but we could somehow point out that it may not be safe/secure or something? |
# Conflicts: # install.sh
Warns users that sync copies files from devcontainers to the host filesystem. Adds --trusted flag to skip the prompt for automation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
devc sync [project]command that copies Claude Code session logs from devcontainer volumes to~/.claude/projects/on the host, so/insightscan analyze themdevcontainer.local_folderDocker label — no need to know container names or IDsCLAUDE_CONFIG_DIRfrom container env vars to handle non-standard paths (e.g..claude_data)docker cponly, so it works on stopped containers withoutdocker execUsage
Test plan
shellcheck install.shpasses cleandevc syncdiscovers both running and stopped devcontainersCLAUDE_CONFIG_DIRare synced correctlydevc sync zizonly syncs zizmor)🤖 Generated with Claude Code