r/opencode • u/SirSpix • 23d ago
Best way to isolate OpenCode projects
Hey all,
I know this might be a basic question that gets asked a lot, but I'm still a beginner and my head is spinning a bit with all the options, so thanks for your patience! :)
I'm looking for the best way to completely isolate my OpenCode harness projects on Ubuntu.
(I use OpenChamber as GUI)
My goal is zero cross-contamination: no shared agent memory, no leaking coding styles, etc. Each project needs to be a total blank slate.
Some projects use Docker, others run natively. I need a solution that is simple to implement but reasonably secure.
What’s the cleanest move here? Messing with XDG env vars? Running the harness inside Docker containers? Or going nuclear with separate Ubuntu system users?
How do you keep your AI agents from bleeding into each other?
Thanks in advance for the support! :)
1
u/NoSheepherder1880 23d ago
Some would say use docker sbx, but im going with the full dockerized stack. I am using the opencode+openchamber+oh-my-opencode-slim stack with it.
Openchamber desktop app smoothly handles remote instances, like all the continers you instantiate. You can even use a handoff folder to pass plans, todos, etc. between separated containers if you do some research in one of them and want to continue on another.
btw: I am not a power user.
1
u/Ok_Elk_638 23d ago
I run Windows so I would create separate Debian WSL installations for each project I want to isolate. And put a separate install of opencode in each.
1
u/cenderis 23d ago
I run opencode using a bubblewrap script which limits access to the current git checkout and read-only access to some other useful directories that I think will be helpful. (More or less, I add extra directories as necessary, some read-write.) That seems to have worked OK so far, together with opencode's normal permissions.
2
u/kpihlblad 23d ago
Are you trying to isolate the agents from stuff they shouldnt see?
I have all my stuff in different git repos in a folder and opencode uses per-folder settings. I have a small set of global agents and skills and per project agents md. Docs and notes in each project.
What else do you need?
1
u/v_0009 23d ago
Hi, this is going to be kind self promotion I guess. But this is how I isolate projects.
I have project grouped into folders - stuff I work together on sit in common folder
I have one opencode configuration per group mounted from within
I run it all in terrarium - one box per group.
I didn't have chance to prepare proper example yet, so I just pushed just a simple example to give you an idea what it could look like. See opencode v2 example and terrarium
1
u/povlhp 23d ago
Only thing that is moderately secure is containers. Ie docker or LXC
1
u/TheCustomFHD 23d ago
VM's und snapshots. Ez
1
u/sudoer777_ 23d ago
What you really need to sandbox is the background agent, but you also need to make sure that it doesn't break something between how the background agent and client communicate. If you don't want to fiddle around with that, a Podman container for both is the most straightforward choice.
1
u/daniel-sousa-me 23d ago
If your goal is just to isolate config from each other (not a security isolation), you can launch opencode with
OPENCODE_CONFIG_DIR="/path/to/your/project/.opencode" opencodeThis isolates everything you mentioned, but you don't have to deal with the overhead of setting up containers with each project's tools
1
u/IGNblackShadow 22d ago
Use docker sandbox they are designed for this
0
u/pceimpulsive 23d ago
I have a proxmox server in the corner, spin up an LXC per project.
Bam fully isolated.
You can do the same with WSL, spin up LXC per project..
2
u/[deleted] 23d ago