Skip to content

Add devc sync to copy devcontainer sessions to host#27

Merged
DarkaMaul merged 4 commits intomainfrom
dm/add-sync
Mar 9, 2026
Merged

Add devc sync to copy devcontainer sessions to host#27
DarkaMaul merged 4 commits intomainfrom
dm/add-sync

Conversation

@DarkaMaul
Copy link
Copy Markdown
Contributor

Summary

  • Adds devc sync [project] command that copies Claude Code session logs from devcontainer volumes to ~/.claude/projects/ on the host, so /insights can analyze them
  • Auto-discovers devcontainers (running + stopped) via the devcontainer.local_folder Docker label — no need to know container names or IDs
  • Reads CLAUDE_CONFIG_DIR from container env vars to handle non-standard paths (e.g. .claude_data)
  • Uses docker cp only, so it works on stopped containers without docker exec
  • Incremental sync — only copies new/updated files, safe to run repeatedly

Usage

devc sync              # Sync sessions from all devcontainers
devc sync crypto       # Filter by project name (case-insensitive substring)

Test plan

  • shellcheck install.sh passes clean
  • devc sync discovers both running and stopped devcontainers
  • Sessions from stopped container with non-standard CLAUDE_CONFIG_DIR are synced correctly
  • Second run shows 0 files synced (incremental check works)
  • Project name filter works (devc sync ziz only syncs zizmor)

🤖 Generated with Claude Code

DarkaMaul and others added 2 commits February 27, 2026 14:33
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>
@disconnect3d
Copy link
Copy Markdown
Member

Wouldn't it be better to run /insights within the container and copy the resulting filepath? I'd be in favor of that instead of a sync command

The devc cp from #30 could be used to copy the insights rendered file 😅

@disconnect3d
Copy link
Copy Markdown
Member

After re-reading this I think the idea here is to get the chat logs to get /insights from all Claude sessions globally, even those created within the container...

Is that really any important/useful? I just hope this wouldn't create any case where this could blow up/hijack host etc.

@DarkaMaul
Copy link
Copy Markdown
Contributor Author

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?

@disconnect3d
Copy link
Copy Markdown
Member

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?

@disconnect3d
Copy link
Copy Markdown
Member

Anyway: I think we can add it but we could somehow point out that it may not be safe/secure or something?

DarkaMaul and others added 2 commits March 6, 2026 16:40
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>
@DarkaMaul DarkaMaul merged commit 8256ebb into main Mar 9, 2026
3 checks passed
@DarkaMaul DarkaMaul deleted the dm/add-sync branch March 9, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants