A shared runtime means one operating system and one set of already-started applications serve many attempts at once. Each attempt sees its own files, its own clipboard, its own screen and its own input. The code, the kernel and the warmed caches are shared. This note describes the model and, more importantly, the list of things that break it.
The parts
| Part | What it is | Shared or private |
|---|---|---|
| Base runtime | The booted kernel, system services, installed applications, warmed code pages | shared, read-only |
| Private mutable state | The attempt's documents, profile, preferences, clipboard, window state, temp files | private per attempt |
| Generation | A counter per attempt that increases on every reset or branch; every mutating call carries it | private per attempt |
| Verifier | Code that reads the final state and returns a result; runs outside the attempt | shared service, per-attempt rows |
Copy-on-write, in plain words
Copy-on-write means two copies of something share the same bytes until one of them writes. Only the changed part is duplicated. It exists at several layers, and they are not interchangeable:
- Files: APFS
clonefileon macOS,cp --reflinkon XFS and Btrfs, overlay filesystems, qcow2 overlay disks. - Databases: a Postgres template database, a MySQL data directory cloned by reflink (CUA-Sandbox uses both).
- Live memory: a forked process, or a VM memory snapshot mapped write-protected (VenusRL and similar microVM fleets).
Reset, replay, restore, branch
- Reset. Kill the attempt's applications, clear the clipboard, swap in a pre-cloned work tree, verify it against a manifest, relaunch, check readiness, then publish generation g+1. On macOS this is a rename-swap of an APFS clone; on Linux the same with reflink or an overlay. Not reset: anything outside the manifest.
- Restore. Bring back a saved state. Files only (macOS, Prime-style sandboxes), or files plus processes (Linux with CRIU). Restore fidelity is a correctness gate before any performance comparison: see checkpoint and restore.
- Branch. Two or more continuations from one intermediate state, for example after an agent has opened a document and reached step k. This is the differentiating experiment; see the rollout loop.
- Replay. Re-apply a recorded action list after a reset and compare the final state hash. Used to check that reset and restore are faithful.
The generation counter
Every attempt has an integer generation. Every mutating call (click, type, launch, clipboard write, reset) carries the generation it was issued for. The check and the effect are one atomic step, so a reset cannot land between them. A call with an old generation is refused with an error (HTTP 409 in our implementation), does nothing, and the action log must show it was never applied. CUA-Sandbox published the same protocol with a measured check: 0 of 100 mixed-generation events with the protocol on, 100 of 100 with it off (author-reported). Our isolation test 10 repeats that check with 100 resets fired mid-step.
What must be scoped
This is the list that decides whether sharing is correct for training. Each item is a place where one attempt's state can reach another's. If any one of them is shared, a reward can be wrong and the training data is poisoned without anyone noticing.
| State | Why it matters | How it is scoped (design) |
|---|---|---|
| Files and home directory | documents, profiles, autosave, recent-files lists | private tree per attempt, manifest-checked after reset |
| Clipboard | copy in one attempt, paste in another | per-session pasteboard on macOS; per-display clipboard on Linux; cleared on reset |
| Display and screenshots | one attempt's pixels in another's observation | own window-server session on macOS; own virtual display on Linux |
| Input events and modifier keys | a held Shift in one attempt capitalises text in another | own event tap per session; modifier leak is an explicit test |
| Focus and dialogs | a Save As dialog in one attempt steals keys from another | per-session frontmost app; dialog steal is an explicit test |
| IPC and message buses | D-Bus names, X connections, listening sockets | per-attempt bus and display; a forked process duplicating a bus name was one of five measured breakages (EXP-004) |
| Caches and indexes | derived state that is cheap to rebuild and wrong to share | private prefix per attempt, rebuilt not copied |
| Preferences daemons | a preference written by one attempt read by another | per-user daemon; restarted on reset |
| Asynchronous jobs | autosave timers, background sync, crash reporters | killed at reset; a reset that cannot kill them fails rather than proceeding |
| Open handles and locks | a POSIX lock lost across restore makes a database think it is unlocked | lock census before resume; the open failure in EXP-009 |
| Network identity | ports, hostnames, cookies | own port per attempt; a restored Linux container with a broken loopback was the finding in EXP-010 |
| Randomness | restored clones sharing RNG state produce identical "random" behaviour | reseed after restore (hygiene) |
Not a security boundary
Scoping the list above is enough for training correctness if, and only if, the checks confirm it. It is not a security boundary. On macOS every session shares one kernel, one WindowServer and one root; a process in one session is one user account away from another, not one machine away. On Linux every namespace shares the host kernel. An agent that runs arbitrary code can cross any of these on purpose. Published VM-based systems name kernel isolation as a security requirement for exactly that reason (EvoCUA, author-stated). Drums measures accidental cross-talk over stated environment-hours; it does not defend against a hostile agent.
The variants we are building or comparing
| Variant | Unit of an environment | Shared | Private | Restore of processes | Status |
|---|---|---|---|---|---|
| macOS sessions | one macOS user logged in to its own GUI session | kernel, WindowServer, root, network, system privacy database | pasteboard, preferences daemon, privacy daemon state, home, event stream, Dock and Finder | none (no process checkpoint on macOS); APFS clone swap of the work tree | harness tests pass on the target Mac (EXP-001); no density or isolation number yet |
| Linux OCI container plus CRIU (reference arm) | one runc container over the same desktop image | host kernel | namespaces, overlay rootfs, cgroup limits | yes, CRIU 4.3 through runc 1.5.2 | restore reached with a broken network namespace; cause found and a holder fix shown on a minimal container (EXP-010) |
| Linux custom rootfs slot (candidate arm) | one private-namespace tree over a read-only mount of the same desktop image | host kernel, read-only image | overlay, pid and mount namespaces, cgroup | yes, CRIU 4.3 with a --root contract | dump reached; restore loses a POSIX lock on a mapped file, unresolved (EXP-008, EXP-009) |
| Linux VM with N virtual displays (comparison arm on the same Mac) | one user and one Xvfb display inside one Ubuntu VM | the VM's kernel and userland | display, clipboard, home, input per display | none (files via reflink) | source only (EXP-017) |