0006: Agent computers are persistent bubblewrap homes, one per agent
Status: proposed, 2026-10-22, revised the same day after security review
Implementation note, 2026-10-22: v1 computer homes, caches, write-run
serialization, systemd user slices, disk soft limit, credential-copy scan,
human-only reset API and Organization controls are built. The desk screen was
left out under the issue’s small-change allowance. Disk is measured when a
computer is listed and before a write run, not by a background periodic walk.
The second security check’s three points are in: GOCACHE stays per run,
login shell files in the home are covered by empty read-only files, and the
credential scan runs at run start as well as at run end. The slice and CLI
credential paths have not been exercised against a live signed-in systemd
user session. Status stays proposed until the remaining v1 display and
periodic measurement work is done and the live path is verified;
[computers] enabled is off by default.
Context
Section titled “Context”Every write run today builds a fresh bubblewrap sandbox (internal/sandbox,
internal/runner/sandbox.go): host /usr read-only, the worktree, the shared
git objects, the CLI’s settings read-only, its OAuth file writable for
refresh, and a per-run state directory under <run dir>/<run id>/sandbox
holding the Go, npm and XDG caches, the private Codex, Kimi, Agy and OpenCode
homes, and per-run copies of the git admin files and the CLI session index
files (copyGitAdminFile). The Director’s home is otherwise absent:
sandbox.Build never mounts it; HOME only names its path. The state
directory is discarded at run end, so an agent reinstalls its tools and
refills every cache each time, and nothing it started outlives the run.
Memory and task limits come from a transient systemd user scope; the .deb
ships an AppArmor profile that grants user namespaces to /usr/bin/bwrap
alone.
The roadmap (M4) promises a persistent sandbox per agent with its own home, tools, caches, long-running processes, limits, a port range and a reset button, with CLI logins staying on the Director’s machine. Hosted agent products are criticised for one machine shared by every agent with pooled logins. This record decides how to build the promise without repeating that. The security review of the first draft showed that a persistent home sits on the next run’s execution path; this revision answers it.
Decision
Section titled “Decision”- Isolation tool: bubblewrap, as today, plus a systemd user slice. A
computer is a directory
<data>/computers/<id>/withhome/andcaches/. A write run on that computer uses today’s mount plan with additions in a fixed order: first--bind <computer>/home <host home>, then every read-only bindsandbox.Buildmakes today (CLI settings viaauthPaths, toolchain roots, the host module cache,sandbox_read_only), then the private CLI homes and the writable OAuth files. bubblewrap applies binds in argument order and later binds cover earlier ones, so a host-owned path always wins over a same-named file in the computer’s home: a planted~/.local/bin/gitsits under the host’s read-only~/.local/binwhen that directory is on the Director’sPATH, and~/.claude/settings.jsonis always the host’s. The run is refused if the computer’s home contains.ssh,.config/gh,.git-credentialsor.netrc: git, ssh and gh trust those names at the host path. Nothing new to install; the AppArmor profile still applies. Read runs do not use computers. - Persisted data is never on the implicit execution path. The home keeps
tool installs, notes, editor settings and whatever the agent writes, but no
run reads configuration from it. For computer runs the runner pins
GIT_CONFIG_GLOBALto a per-run file holding onlycore.hooksPath=/dev/null(/etc/gitconfigis already the read-only host file),GOENV=off,NPM_CONFIG_USERCONFIGto an empty per-run file,SHELL=/bin/shwithENVandBASH_ENVunset (stripEnvpasses the hostSHELLthrough today, and a CLI’s shell tool sources that shell’s rc files),ZDOTDIRto an empty per-run directory, andPATHto the read-only toolchain roots plus/usr/local/bin,/usr/binand/bin. No directory of the home is onPATH: the agent runs its own installs by path, and the channel test command, which runs through/bin/sh -cin the same mounts, finds nothing the home planted. Login shell files in the home (.profile,.bash_profile,.bashrc,.zshenv,.zprofile,.zshrc,.zlogin) are covered by read-only empty files bound over them for every run, because a loginshreads~/.profileandzshalways reads.zshenv; either could undo the pins. - What persists. The home and the caches. What does not:
/tmp(tmpfs per run), CLI session state (per run, as today), the git admin and ref copies, the worktree. Worktrees stay outside and bind-mounted at their host path, where the host merge flow and the tamper checks ininternal/worktreeread them. - One run at a time. A computer runs one write run at a time; a second
write run for the persona waits in
queuedas it does behind a busy lane. Two writers in one home and one cache would replace files under each other, and reset needs a quiet computer. There is no live namespace to join in v1. - Caches.
NPM_CONFIG_CACHEandXDG_CACHE_HOMEmove from the run state directory to<computer>/caches/.GOCACHEstays per run: Go replaces action-cache entries, executables included, so a persistent build cache would let one run hand the next a binary it then executes.XDG_DATA_HOME,XDG_STATE_HOMEandXDG_CONFIG_HOMEstay per run: they hold CLI databases and configuration.GOMODCACHEstays the host’s, read-only (goModCache); a persistent writable module cache would be a new way to poison a build. - Logins. Unchanged: the CLI’s settings are bound read-only and its OAuth
file (for Kimi, its
credentials/andoauth/directories) writable from the host at run start, and unbound at run end. The computer never holds a login at rest. New risk: a run can copy a bound credential into its persistent home for a later run to read. Mitigation in v1: at run start and at run end (a run killed before its end scan is caught by the next start) faztudo walkshome/andcaches/throughos.Root, so a symlink never resolves outside the computer directory, deletes only regular files that hold a bound token value verbatim (checked withLstat, not inferred fromos.Root, which follows a symlink that stays inside), and posts a channel notice. It never touches a path outside the computer directory; a symlink to the host.claude/.credentials.jsonis skipped, not followed. Honest limit: encoded copies and planted code are not detected; the execution-path rules above are the guard against planted code. - Services and ports. v1 has no background processes: whatever a run
starts dies with it (
--die-with-parent). Write runs keep the host network namespace, so a process can bind0.0.0.0and dial127.0.0.1, including faztudo, as today. Each computer gets a block of 20 ports fromcomputers.port_base(default 7500), exported asFAZTUDO_PORT_BASEandPORT; in v1 it is a label: faztudo shows what the computer’s processes listen on (/proc/net/tcpfiltered by the slice’s pids) and says when one bound0.0.0.0. Services that outlive a run arrive only after the network namespace exists (see the staged plan). - Limits and accounting. All of a computer’s runs go into one slice
faztudo-computer-<id>.slicewithMemoryMax(defaultsandbox_memory_max),TasksMax(defaultsandbox_tasks_max) and optionalCPUQuota. Each run keeps its own scope inside the slice (systemd-run --scope --slice=...), so the scope report still readsmemory.peakandoom_killper run: cgroup v2 counts a kill in the victim’s cgroup and its ancestors, so the run whose process died is the one that reports it. The report adds the slice name; the spike confirms the attribution. Disk has no unprivileged quota, so it is measured by a periodic walk that does not follow symlinks (soft limitcomputers.disk_soft_max); a full computer refuses new runs until reset or raised. The persona entry and the desk screen show state, memory, disk and ports;GET /api/v1/computersandPOST .../resetare human-only. - Reset. Stops the slice (
systemctl --user stop), refuses while a run on the computer is recorded as running or the slice still has pids, then deleteshome/andcaches/. The id and port block stay. Reset cannot undo an OAuth file a run refreshed or replaced (writable bind, a riskSECURITY.mdalready names), objects written into the shared gitobjects/, or anything sent over the network; the confirmation says so. - Sharing. v1 is one computer per persona, id = persona handle, and
nothing else. A shared computer is one trust domain: one persona’s planted
file would run while another persona’s OAuth file is mounted. Team
computers (
[[computer]]withmembers) wait for a later revision, after the execution-path rules have shipped, and will be an explicit opt-in listed on the Organization page. - Security. Inside a computer an agent sees host
/usrread-only, its own home, its worktree and the git objects, the network the lane allows, nothing else of the Director’s home, no SSH agent, display or session bus. It reaches faztudo only through the per-run MCP config. The run bearer dies with the run (internal/mcp/tokens.go), approvals are resolved by humans only (resolveininternal/api/api.go; MCP has no such tool), and merge, keep and discard stay host-side withcore.hooksPath=/dev/null(internal/worktree/worktree.go). Accepted residual: a later run of the same persona trusts what an earlier run left in that home, as it already trusts the repository it checks out; a script it chooses to run gets that run’s token forpost_messageanddelegatein that run’s channel. A stuck or full computer stops only its own persona’s write runs.
Security review (2026-10-22)
Section titled “Security review (2026-10-22)”- Accepted: execution-path rules above. Correction:
/etc/gitconfigis already a read-only host bind (sandbox.go), soGIT_CONFIG_SYSTEMneeds no pin;SHELLand the shell rc files were missing from the finding and are pinned too. - Accepted: bind order fixed, refused names listed.
- Accepted:
os.Rootwalk, regular files only,caches/included. - Accepted: no team computers in v1.
- Accepted: slice stopped first, pid check, list of what reset cannot undo.
- Accepted: network namespace moved ahead of services.
- Accepted: variables named,
GOMODCACHEread-only, one write run per computer. Nits: the never-copied line now says credential files; session index and git admin files are per-run copies. Kimi directories named.MemoryMaxattribution argued above (per-run scope inside the slice), to be confirmed by the spike.
Alternatives considered
Section titled “Alternatives considered”- systemd-nspawn. Needs root to start containers; out on a desktop without it.
- Rootless podman. Real attach, a network namespace with port forwarding
and cgroups for free, but a
subuidentry (root, once), its own images instead of the host’s/usrand installed CLIs, and its own AppArmor answer on Ubuntu 24.04. A candidate backend for v3. - incus or LXD. Root to install, a daemon, full OS containers: more than a persistent home needs.
- A QEMU VM. The strongest wall, but a disk image, boot time, slow file sharing with worktrees, and logins would have to be copied in, which record 0003 forbids. Left to M7.
Review point
Section titled “Review point”bubblewrap stays unless the service lifecycle cannot be made reliable
without joining a live namespace. The spike before v3 measures whether
nsenter into a bwrap user namespace owned by the same uid works under the
AppArmor profile, and whether the per-run oom_kill attribution holds under a
slice limit. If attach fails, services run as separate bwrap instances that
share the home.
Staged plan
Section titled “Staged plan”- v1:
[computers] enabled, one computer per persona, persistent home and caches with the execution-path rules and bind order above, one write run at a time, the slice with memory, tasks and CPU limits, disk measured, the credential copy scan, reset from the API and the persona entry, the desk screen. No services, no team computers. - v2: a network namespace per computer (pasta) that forwards only the port
block to
127.0.0.1, which also makessandbox_network = falsecheaper; listening ports shown and reachable. - v3: Director-declared services under
services/with idle stop (computers.idle_stop_minutes, default 30), stopped on idle or reset; agent-requested services through an MCP tool behind an approval; podman as an optional backend; team computers revisited.
Out of scope: cloud computers and computers on another machine (M7, optional, never the default), desktop computers with a screen (M7), and one machine for every agent with pooled logins (never).
Consequences
Section titled “Consequences”- Tool installs and caches survive between runs, so repeat runs start faster and the agent keeps an environment it can inspect.
- Installed tools are not on
PATH; an agent calls them by path or the Director adds a read-only toolchain root. Slower for the agent, but a planted binary is never found by name. - A persistent home is a new place for a credential copy to live; the scan, the per-persona rule and reset limit it. Planted code is stopped by the execution-path rules, not by the scan.
- One write run per computer serialises a busy persona.
- Disk use grows until reset; the soft limit makes that visible.
- Whether
nsenterinto a bwrap namespace works under the Ubuntu 24.04 profile (needed for attach; not for v1). - Whether per-run
oom_killattribution holds under a slice limit. - Whether to offer
path_in_homeas an explicit per-computer opt-in that puts~/.local/binback onPATH, with the risk stated. - The scan misses encoded copies; the better answer is per-run short-lived tokens, which depends on each CLI.
- Whether CPU limits should default on; a quota slows builds on a laptop.