Multiple Claude Code instance isolation without multiple file copies or git worktrees
If you use a Mac, APFS let's you do `cp -c` which lets you create a "copy-on-write" file, meaning if you don't write to it, you don't copy it.
I’m building out a full container isolation system, but before it’s done I found a way better approach to preventing Claude Code from clobbering other instances… it turns out classic ol `cp` has a -c flag you can use (on apfs formatted mac disks, ie 10.13 or later) which does “copy on write.”
That means it won’t actually copy any files until they’re written to… which saves the time (and storage) of copying actual data unless you actually write to it.
So seriously you can do
cp -c original.txt clone.txt
and if you never write to either file, they’ll stay the same. If you write to either, they’ll split into their own files.
Networking and other isolation concerns still exist, but this can solve basic collisions. Containers will solve this, more coming on this soon.