devvm agent save refused a VM whose ~/.config/opencode held a bun.lock (which opencode's plugins' installs write), a package-lock.json, a .gitignore or a .DS_Store: the save's script sent every entry of that folder but node_modules and FolderOwn, while the host's listedPath refuses those files (fileSetting), so it saved nothing. notSettings is now their one list, as patterns path.Match and the shell's case read alike: fileSetting leaves them out and the script sends a file of those names no more, only a folder that isn't a link, which is a setting. TestAgentSaveScriptRuns plants them and a folder named old.lock, and failed with agent_save_unsafe before the fix. opencode's HistoryOwn names its native client's plugin approvals, in its state folder (cli-rs's plugin/src/loader/approval.rs and tui/src/plugins/host.rs, opencode v2.4.1): plugin-approvals.json, its .lock and the .plugin-approvals.json.<pid>.<n>.tmp it's written through, and plugin-staged, the approved trees' copies, which it reuses by their hash's name without hashing them again, so a hostile VM's export could approve a project plugin for the VM that imports it. That client doesn't ship in 2.4.1. TestHistoryExportRuns and TestHistoryImportRuns plant them, with plugin-notes.json as the control, and failed on fedora without the entries. The history scripts' framing (onInputCmd) now says why on its stderr, which goes to the VM's log, when its input was cut short: TestOnInputCutShort checks it for every cut, an empty input included, and none for a whole one, and failed before. TestHistoryScriptsOnInput holds each script under 128 KiB, Linux's limit on one argument, which bash -c "$s" passes it as. The CLI scripts match the framing's new start. Docs: the save's and the store's table say which files stay in the VM; the import's and How it works' lists name the plugin approvals; the release page gets opencode's lock files in a save and the approvals; the changelog's opencode block gets the save's fix, and the hardening line names approved plugins. The review's optional wording: the design note's `*` matches every resource, and the plain-password steps set this machine's password first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
56 KiB
title, explainer, weight
| title | explainer | weight |
|---|---|---|
| Coding agents | How agents' settings, logins and history reach a VM | 11 |
This page explains how devvm gives the coding agents in a VM their settings, logins and history, and what it checks on the way, for the tasks that Coding agents shows. How the proxy holds the agents' secrets is in agents' logins and settings.
The guide in every VM
Each launch installs the guide again whenever it differs from devvm's, and it belongs to root and is read-only, so nothing that the VM's user runs without sudo can change what the agents read, and a change made with sudo lasts only until the next launch.
Pasting
How devvm paste reads the clipboard, names a copied file, refuses links and finds Linux's clipboard programs is in the design note on pasting images.
Each agent's variables
Every VM sets OPENCODE_DISABLE_AUTOUPDATE=1, as it sets DISABLE_AUTOUPDATER=1 for Claude Code, because the agents are read-only shared tools that can't update themselves, and devvm keeps their versions. For the same reason every VM sets PI_SKIP_VERSION_CHECK=1, so pi doesn't ask you to run pi update, and PI_TELEMETRY=0, which turns off pi's report of its install and the attribution headers it adds to some providers' requests. Claude Code's telemetry and error reports are off with DISABLE_TELEMETRY=1 and DISABLE_ERROR_REPORTING=1, and CLAUDE_CODE_PLUGIN_CACHE_DIR and CLAUDE_CODE_PLUGIN_SEED_DIR name its plugins folder and its seed (Claude Code's plugins). devvm writes every agent's variables into each VM at every launch, whichever agents the VM has, and every shell in the VM gets them, login or not, so an agent that an editor's terminal or ssh runs gets them too. pi would download fd and rg into ~/.pi/agent/bin whenever they're missing, so base has both, from Ubuntu's or the container image's own packages, and pi finds Ubuntu's and Debian's fd by its name there, fdfind.
Importing
The import copies only the paths in the store's table, from ~/.claude, ~/.claude.json, ~/.codex, ~/.config/opencode, ~/.local/share/opencode and ~/.pi/agent, so it never copies your history, such as ~/.claude/projects, ~/.codex's sessions or ~/.pi/agent/sessions, and never ~/.claude/.credentials.json. Of ~/.claude/plugins it copies only what a seed has, known_marketplaces.json, marketplaces and cache, whether the folder is in ~/.claude or a link you allowed leads to it, so this machine's own entries, such as each plugin's data in data, its MCP bundles in mcpb, the plugins that claude.ai synced, its trash and its record of the plugins it installed, never reach the store (Claude Code's plugins). Claude Code's plugin records name the plugins' folders by their paths, so the store's copies of the JSON files in ~/.claude/plugins name the plugins' folders in the store, where the VMs mount them.
A link inside an agent's folder that leads to a file inside it is copied as that file only when the file is one of the settings that the import copies of the folder itself, by the name that the link resolves to, one link at a time. So a link never copies what the import leaves out, such as ~/.claude/projects, ~/.claude/.credentials.json or a plugin's data in ~/.claude/plugins/data, and the import also leaves out a name that differs from a setting's only in case, which a Mac's file system would still find. The import reads each file it listed, and a link's file by the path that the link resolved to. It reads through the agent's folder opened one folder at a time, each from its parent, without following a link in any part of the path, and it fails unless the file it opened is the one it listed. A VM whose project folder is inside an agent's folder, such as a skill you work on in ~/.claude/skills, can change a link or a folder there between the listing and the read, so such a change fails the import rather than copy what the new link leads to, and devvm warns, before it reads anything, of each VM whose project folder is inside an agent's folder or holds it. A VM whose state devvm can't read gets a warning of its own, naming its state file, because devvm can't tell where its project folder is, and while any state can't be read, devvm leaves out, with a warning naming the state, every path it would read through a link: an agent's folder or login whose path passes through one, and every link out of an agent's folder. That also counts the links on the way to your home folder, because a VM made with --unsafe-folder on a folder that holds your home folder holds them. It doesn't count a link that only root can change, such as macOS's /var or the /home of Fedora Silverblue, whose folders up to / are root's alone, by their modes and by what the system says you may write, an ACL included. A VM changes this machine's files only as you, so no VM can change where such a link leads. devvm opens an agent's folder twice, as a root to list it and one folder at a time to read it, and fails the import, naming the folder, unless both are the same folder, so a VM can't swap the folder between the two. A project folder that holds an agent's folder, such as ~/.pi for pi's ~/.pi/agent, lets its VM put a link in the agent folder's place, so devvm resolves the folder's path one link at a time and leaves the folder out, with a warning, when a link in a VM's project folder leads it out of that folder, which would let the VM choose any folder of this machine's, such as your home folder. A login file in a folder left out so, such as pi's auth.json, is left out with it. Otherwise devvm reads the folder where the path led when it resolved it. It reads an agent's login file, other than Claude Code's ~/.claude.json, in the same way: devvm resolves its path one link at a time, leaves it out in the same way, and reads it where the path led, through its folder opened one folder at a time without following a link and never resolved again. It opens the file itself without following a link and reads it only as a regular file of at most 128 MiB, so a link, a FIFO or an endless file that a VM put in its place fails the import. It copies at most 20,000 files, folders and links, 128 MiB, and 16 MiB in one file, of each agent's folder, the bounds of saving a VM's settings, so such a VM can't fill the store that every VM with the agent mounts. It reads each folder 256 entries at a time and counts every entry as it reads it, a link, a socket or a FIFO as much as a file, stopping at 20,000, so a folder of millions of entries never costs it more than that and one batch, and a folder that holds more fails the import before anything is written, naming the folder. It goes at most 128 folders deep, in paths of at most 4,096 bytes, because it opens each folder from the agent's folder down, one name at a time, through the folder above it, which it opened in the same way. So a chain of folders nested deeper fails the import in the same way, and a link or a FIFO that a VM swaps in for a folder during the walk fails the import instead of leading it elsewhere or holding it. A file that grows past 16 MiB, or past what's left of the 128 MiB, between the listing and the read fails the import too, naming the file. The copy of a Claude Code plugin record names the store's longer paths, so it can be larger than the file, and what it grows counts against the same bounds, so a copy that would pass them fails the import, naming the folder.
The import reads and writes every agent's settings into a staging folder of the agent's store first, .devvm-import- and a random name, beside the agent's folder there, so no VM mounts it. When a file fails to read, has changed since it was listed or passes the bounds, the import fails, leaving the store as it was and taking out the staging folder. An interrupt before every agent's settings are staged does the same, and the run's cleanups take out its staging folders. Once every agent's settings are staged, the import moves each file into place and moves what your home folder no longer has aside, into a folder of the staging folder, where a file it replaces is kept too, as a second hard link, so each file is still replaced in one rename. Then it saves the logins, all or none, reading each login file it replaces first. A failure from then on, such as a rename that fails or a login that can't be saved, puts back every agent's store and every login as they were, the last change first, and an interrupt waits for that, or for the import to finish, before the run's cleanups take the staging folder out. It puts back every agent's store that it changed, even after putting one back fails. Only then, if one did fail, does it say so, naming each store it couldn't put back and its staging folder. It keeps that staging folder, which holds what devvm couldn't put back, until the next import or save. A run that's killed while it puts the settings in place can leave the store partly replaced, so run the import again. The staging folders go once the import is done. The import holds the store's lock, agents.lock in devvm's data folder, from its staging to its logins, as the save does while it writes, and a start does while it cleans Claude Code's plugins or opencode's service settings, once it finds something to take out, so no two of them change the store at once, and the second waits under a status line until the first is done. A staging folder that a killed import or save left counts as nothing of the agent's, so the import doesn't ask before it replaces a store that holds only that, and the next import or save of that agent takes it out first. A replacement keeps the store's folders, so a running VM's mounts still show them. The import and the save read names as the volume that holds the store reads them, so on a volume that ignores case, as a Mac's does by default, a file named foo.md replaces the store's Foo.md in place, under the store's name. What they keep when they move aside what a folder no longer has is each file and folder they wrote or keep, found by what it is on the volume rather than by how its name is spelled, so the store's Foo.md stays. Their staging folder is on the same volume and holds only what they wrote, so a name that's already there before they write it, under no name they wrote, is one the volume reads as another of theirs, such as a.md after A.md, and then they fail before the store changes and name both. The save also counts the names that it leaves out in this check. The staging folder reads names by its own folder's rules, which are the store's wherever a volume's rules hold for every folder, as on macOS, but Linux's ext4 can ignore case in some folders alone, so a store whose agent folder alone ignores case gets no such check. A file with a second name, a hard link, which only a hand-made store has, is kept only by the name it's written or kept under, and the save's diff shows its other names as removed. Where the store has a folder and the home folder now has a file, or the other way round, as when a link that led to a folder now leads to a file, the import replaces it. Before they write anything, both the import and the save check the path of every folder and file they'll write, and each part of the path below devvm's config folder must be a folder, never a link. A link there, which only a hand-made store has and which could lead to your home folder, fails the command before the store changes, for any of the agents that the command handles, and the command names it. A link in the store in place of a settings file is replaced, never followed. They then write only through the agent's store, or its folder there, opened from devvm's config folder as a root, every part of its path a folder, so a link put in the store after the check can't lead a write out of it. They also reach a folder of the store that they empty from devvm's config folder in the same way, as the start does for Claude Code's plugins, and devvm's config folder itself may be a link, as a dotfiles repo's is.
opencode 2 keeps its logins in its own database rather than in ~/.local/share/opencode/auth.json, so when this machine's opencode is version 2 or later, devvm reads its logins with opencode auth export and saves them in the store in the format of auth.json, the file that devvm copies for opencode 1. When opencode auth export fails, the import fails too, and the store keeps the login it had.
Links out of an agent's folder
The import reads each agent's folder through a handle that's rooted at that folder, so no link inside it leads out of it (the packages). A link that leads out is resolved, every link on the way, and only then followed, as links out of an agent's folder says, and the design note explains why:
- How it resolves. devvm resolves a link one name at a time, as the system does, and keeps where each link on the way is, so it sees a link that a VM put in its project folder even in the middle of a chain. It compares a target with the refused places and the VMs' folders by name and by identity, so another spelling of a folder, such as
~/.SSHon a Mac, where case doesn't count, is still that folder. - Where it reads. devvm opens the folder it reads the link's target through, a
follow-linksfolder, the linked folder or the linked file's own folder, one folder at a time from/, each opened from its parent and never through a link, so a link that a VM swaps into that path fails the import rather than lead elsewhere. It lists what the link leads to through that folder as a root, and reads each file without blocking, refusing a FIFO, a device or a file that changed into a link as it opened it. - What it lists. A linked folder's folders and files are listed under the link's own path, and a link inside it is listed as a file when the root resolves it to a regular file. Anything else is left out with a warning.
- The bounds. It counts every entry it reads, a folder's read 256 at a time, and the size of every file, across all the links of one import, and leaves out a link that would pass 20,000 entries, 128 MiB or a file of 16 MiB, the bounds of saving a VM's settings. The walks of all the links read at most 80,000 entries, those of links left out included, and once they have, each link left is left out unread, with the same warning. A file that grows past them between the listing and the read fails the import.
- A VM's folder. It reads the state of every VM devvm has, and warns once for each link and VM when the link's target is in that VM's project folder or holds it, or when a link inside a linked folder resolves into it. While a VM's state can't be read, it follows no link out of an agent's folder, as importing says.
Saving a VM's settings
The save reads only the settings in the store's table from the VM's home, and never the logins, so it never reads your history, ~/.claude/.credentials.json, ~/.codex/auth.json, opencode's auth.json or pi's. From the VM's ~/.claude.json it keeps only the settings, account state and MCP servers, as the import does, and the VM leaves out its per-project entries before it sends anything. devvm puts that part in the store's logins folder, where the import keeps it too. A folder that the store already has is mounted read-only in the VM, so the agent there can't change it, and the save leaves it as it is. The exception is Claude Code's plugins folder, which is the VM's own, with the store's as its seed (Claude Code's plugins). A folder that the store doesn't have yet is the VM's own until you save it, and once the VM next starts with the store's new folder mounted, its setup links that folder in place of its own (mounts).
devvm treats everything the VM sends as untrusted, because the agent in the VM could have changed any of it. It reads at most 128 MiB from the VM, in at most 20,000 files, folders and links, none of the files larger than 16 MiB, at most 128 folders deep and in paths of at most 4,096 bytes, the import's bounds, because the save opens each folder one name at a time from the store down. When the VM sends more, or sends a path outside the agents' settings or a name with a character that a terminal wouldn't show, devvm saves nothing. Each file it saves is yours alone (mode 600), or mode 700 when it was executable in the VM, so it never keeps a set-user-ID or set-group-ID bit. A link in a settings folder that leads to a file in the same folder becomes a copy of that file. devvm leaves out any other link, any other kind of file, such as a socket, and a settings file that it can't parse whole, such as a settings.json that isn't JSON, and it warns you about each. When it leaves out a file in a folder, the store keeps its own copy of that file. A settings file that the VM doesn't have stays in the store. A folder that the VM sends, other than Claude Code's plugins folder, replaces the store's folder whole, so devvm writes each of its files again and takes out the files that the VM's folder doesn't have, but it keeps the store's folder itself, so a running VM's mounts still show it. It compares each of the VM's names with the store's file that the store's volume reads it as, found by what the file is, so where the volume ignores case, the diff shows the VM's foo.md as a change to the store's Foo.md rather than a file added and another removed. The save writes holding the store's lock, as the import does, and once it holds the lock, it plans again from the store as it is then. When that differs from what it showed you, as when an import wrote the store while you read the diff, it saves nothing and says so, rather than write over that change. Where the store has a folder and the VM has a file, or the other way round, the save saves nothing and names the store's path, because putting one in the other's place would take out what the store has there, which the diff doesn't show. It then saves all or nothing, as the import does, so it first writes every agent's files into a staging folder of the agent's store first, with the import's name, .devvm-import- and a random name, and takes out any that a killed import or save left there. Then it moves each file into place and moves aside what a folder the VM sent no longer has, and it saves the part of ~/.claude.json last, holding the lock of the folder of Claude Code's logins, which a VM's proxy holds while it saves a Claude Code login made in that VM, so the two take turns. A failure from then on, such as a rename that fails or the login that can't be saved, puts back every agent's store and the login as they were, the last change first, and when putting a store back fails too, devvm says so, naming each store it couldn't put back and its staging folder, which it keeps until the next import or save. A run that's killed while it puts the settings in place can leave the store partly saved, so run the save again. A Ctrl-C while the save waits for the store's lock or the login's ends the wait, and the save leaves the store as it was.
The VM's copies of the settings files and of ~/.claude.json hold placeholders, such as devvm-redacted, where the store has your secrets. devvm puts the store's secret back in place of each placeholder, as long as the VM's copy had that placeholder in that place and nothing around it changed, such as the URL of the MCP server that a header is for. When something around a placeholder changed, devvm leaves the whole file out and warns you, so a VM can't send a secret it never saw to another host, and you can make that change in the store's file yourself. devvm also leaves out any other file that holds a placeholder, such as a skill. No VM gets opencode's files in ~/.config/opencode that are neither settings nor Markdown, such as a .env, so devvm leaves out the VM's own file of that name and keeps the store's.
Mounts
Absolute paths in the mounted folders, such as Claude Code's plugin paths, still work, because each is mounted at the same path as in the store on this machine. The VM follows a symlink in these folders among its own files, so a link to a file outside the folder, by a relative or an absolute path, doesn't reach that file on this machine, on macOS's virtiofs mounts and on Linux's 9p mounts alike. devvm doesn't mount a folder whose path has a comma, on any backend, and it warns you. Lima can't mount such a path (Lima's limits).
The VM reads every file in these folders, a Claude Code marketplace's git clone included, so when devvm agent import or devvm agent save copies a marketplace, it checks the clone for a credential and warns of each one. It reads, with git itself and without its includes, every git config below the clone's .git, a submodule's included, and each file a config includes from inside the clone, which the copy holds too, and it looks for an http.extraHeader and a URL with a password or an access token in its user info: a remote's or a submodule's URL, a push URL, a proxy, or the base of an insteadOf. It judges a URL as --clone judges a remote, so an scp-like git@host:path is a name, not a credential. It also checks each marketplace's source in known_marketplaces.json. A warning names the keys, never the credential, and a URL in a key's name that holds one shows as <url>. When git can't read such a config, devvm warns that it couldn't check it, with git's reason, as the VM reads the file whatever git makes of it.
Claude Code's plugins
Claude Code keeps everything of its plugins in one folder, ~/.claude/plugins unless CLAUDE_CODE_PLUGIN_CACHE_DIR names another, and writes there as it runs: each plugin's data in data/<plugin>, which a plugin reaches as ${CLAUDE_PLUGIN_DATA}, the plugins it installs in cache, its marketplaces' copies in marketplaces and their updates, its MCP bundles in mcpb, the plugins claude.ai synced in synced, its trash in .trash, and its records, such as installed_plugins.json. The store's plugins folder is mounted read-only in every VM with Claude Code, because a VM that could write it could change what Claude Code runs in every other VM (the design note). So each VM's ~/.claude/plugins is its own folder, on its own disk, and the store's folder is the VM's seed, Claude Code's own support for a plugins folder it only reads. Every shell in the VM sets CLAUDE_CODE_PLUGIN_CACHE_DIR to ~/.claude/plugins and CLAUDE_CODE_PLUGIN_SEED_DIR to ~/.claude/plugins-seed, where the VM links the store's folder. A seed is laid out as a plugins folder, with the marketplaces' records in known_marketplaces.json, their copies in marketplaces and the plugins in cache. As Claude Code starts, it registers the seed's marketplaces in the VM's own folder, turns off their updates, and loads each plugin that enabledPlugins turns on from the seed's cache, without copying it, and it never writes into the seed. It registers a marketplace from the seed only when the seed has its copy in marketplaces, so a marketplace from a folder on this machine, which Claude Code reads in place and never copies, isn't one, and Claude Code in the VM adds it from extraKnownMarketplaces in settings.json only when that folder is in the VM too. In claude -p, Claude Code registers the seed's marketplaces during the first session that the VM's folder doesn't have them yet, so a plugin's hooks for the start of a session run from the next session on.
At every launch, the VM's setup makes ~/.claude/plugins a folder of the VM's own when it isn't one, replacing a link there, and it links ~/.claude/plugins-seed to the store's folder. A VM made again with other layers keeps its own plugins folder, as it keeps the rest of its home.
A store that devvm 0.1.0's devvm agent import wrote can hold the whole of ~/.claude/plugins, each plugin's data included, and every VM with Claude Code mounts the store's folder whole. So every start, before the VM runs, takes out of the store's plugins folder each entry that a seed doesn't have and warns once, naming them. It leaves the folder itself, so no VM's mounts change and its Lima config needs no edit. A VM that's already running stops seeing the entries through its mount at once on macOS, while on a Linux host, whose 9p mounts cache what the VM has read, it can keep seeing what it read until its next start. devvm reaches the folder from its config folder, every part of the path below it a folder, never a link, which only a hand-made store has and which the VM's mount would follow, perhaps to your own ~/.claude/plugins. It takes a link among the entries out without following it, and it leaves the temporary files that a devvm agent import or devvm agent save running at the same time writes known_marketplaces.json through. When it can't take an entry out, or finds a link on the path, the start of a VM with Claude Code fails, naming the folder and what it should hold, rather than give the VM what it would read, and the start of any other VM warns.
devvm agent import and devvm agent save copy only what a seed has, so neither copies what each machine keeps of its own. The save's script in the VM excludes, by name, every other entry of the VM's ~/.claude/plugins when it's a folder and not a link, and devvm saves nothing when the VM sends any other entry of it, as for any path outside the agents' settings. The VM's folder holds only what the VM added to its seed, so the save adds the files that the VM's folder has and changes those that differ, but it never takes a file out of the store's folder. The save merges the VM's known_marketplaces.json into the store's. It renames each path in the VM's records that leads to the VM's own plugins folder to the store's folder, where every VM mounts it, and then each marketplace whose copy is in the store's marketplaces, by a path without . or .. parts, replaces the store's of the same name. The others stay as the store has them, because a seed can't use them. They are the ones that Claude Code registered from the seed, whose copies are at the seed's link, which are the store's own, and those that Claude Code reads where they are, such as a folder in the VM. So a save that changes no marketplace leaves the file as it is. devvm leaves the file out with a warning when it isn't a JSON object. The save's script sends an entry whose name has a wildcard's character, such as *, rather than exclude it by a pattern that could match other names, so devvm then saves nothing, naming it.
An export of a VM's history leaves out the VM's ~/.claude/plugins, and an import of one leaves out both it and ~/.claude/plugins-seed. The VM's plugins folder holds settings, not history. The plugins it installed reach another VM only through devvm agent save, after you read its diff, and each plugin's data can hold the plugin's own logins and large caches, which an export on this machine would keep. A new VM gets the store's plugins from its seed again.
Copies
devvm merges the settings and MCP servers from the store's .claude.json into the VM's own ~/.claude.json, so servers added in the VM stay (MCP servers). Your API key, your answers about API keys and your per-project entries never reach the VM. devvm also replaces the secrets in the agents' settings files with devvm-redacted, and names what it replaced. Those are the values under keys that look like secrets, every env value and header, and the secrets in URLs and in arguments. In other text, such as a hook's command, devvm replaces the secrets in its URLs, the keys that start like a known key, such as sk- or ghp_, and the credential after Bearer or Basic, and keeps the words around them (keys in settings files). pi's settings files that can hold a key are settings.json, models.json and mcp.json, so a provider's apiKey in models.json reaches the VM as devvm-redacted, and pi's keybindings.json and Markdown files reach it as they are. From the env of Claude Code's settings.json, the VM gets only Claude Code's own settings, such as ANTHROPIC_MODEL, the CLAUDE_CODE_*, DISABLE_* and MAX_* variables and those ending in _TIMEOUT_MS, but none whose name marks it as a credential, such as ANTHROPIC_AUTH_TOKEN. It also gets the values that only name where a secret is, base URLs without their passwords, true, false and short numbers. Every other env value, and every env value of an MCP server, becomes devvm-redacted. When devvm can't parse a settings file to take its secrets out, the VM doesn't get a copy of it, and neither does it get opencode's files in ~/.config/opencode that are neither settings nor Markdown, such as a .env. devvm names each file it doesn't copy, and when it can't make the copy of a login, it says why.
opencode's service
opencode keeps its background service's settings in ~/.config/opencode/service.json, or in service-<channel>.json for a channel other than latest, dev, beta or next (an earlier build named it service-<hash>.json), and it writes each one through a temporary file beside it, <file>.<pid>.tmp. They hold the service's password, 32 random bytes that the service makes when it starts and the file has none, and with remote access on, the route that the service is served on, a random name that keeps its address unguessable. So opencode service get with no key hides both, and only opencode service get password shows the password. They also hold the service's port, host name, CORS origins and environment. That makes them each machine's own rather than settings, so the import and the save leave out every entry of ~/.config/opencode with one of these names, what's in a folder of that name included, and the save's script in the VM never sends them, so the VM's own file never makes a save fail. The VM's file stays in the VM, so a VM made again keeps it, and no export of the VM's history holds it, because ~/.config/opencode isn't history.
A store that an earlier import filled can hold them, so every start looks for them in the store's ~/.config/opencode, which it opens as it opens Claude Code's plugins folder, and once it finds any, it takes them out holding the store's lock and warns once, naming them. No VM gets them from the store meanwhile, because a VM's setup copies only the files that the import would copy, so a start whose clean-up fails only warns, naming the folder. devvm writes devvm-redacted in place of a secret in every copy of a settings file that it makes, so a file with one of these names that holds it is a copy that devvm made, whose password every VM with such a copy shares. Each launch's setup takes out each such regular file in the VM's ~/.config/opencode and leaves the VM's own files, links and folders, so the VM's opencode makes its own password when its service next starts. A service that's running keeps the password it started with until it stops, as when the VM restarts.
Claude Code's login
devvm agent login claude runs Claude Code's own login in the VM, and the VM's proxy saves the login as it reaches Claude's token endpoint, and Claude Code in the VM gets only placeholders. devvm then sets the VM up again, so it uses the login at once, and every other VM with Claude Code gets it from its next launch.
A VM gets either ~/.claude/.credentials.json or CLAUDE_CODE_OAUTH_TOKEN from devvm, never both, because Claude Code would use the token in its environment over the login in its file. A VM that started with the login devvm replaced keeps working, because its proxy puts the login devvm keeps now in place of either placeholder. The VM gets placeholders whatever its network tier.
The VM's setup merges devvm's copy of the login into the VM's own ~/.claude/.credentials.json, because Claude Code keeps more than its Claude login in that file, such as its logins to MCP servers under mcpOAuth, which hold an MCP server's tokens and, while a login is under way, its PKCE verifier. devvm sends its copy beside the setup as claude-credentials.json, and the setup's merge_claude_credentials replaces the VM's claudeAiOauth with the copy's, or takes it out when the copy has none, and keeps every other key of the VM's file. It reads the file with jq and writes the result whole, mode 600, to a temp file in ~/.cache, which neither an export of the VM's history nor a VM made again carries, and then moves it over the file. When the VM's file is a link, isn't JSON or isn't one JSON object, the copy replaces it and the setup says so, and a link is taken away first, so the move never writes through it. When it's a folder, the setup leaves it as it is and says so. When the move fails, the setup removes the temp file and fails. A write that Claude Code makes to the file between the setup's read and its move, such as a login to an MCP server that finishes in those milliseconds, is lost, and you make that login again. With a Claude Code token, devvm sends no copy, so the VM's file stays as it is. Claude Code uses the token in its environment over any login left in the file, and that login's placeholder gets the token at api.anthropic.com and nothing at mcp-proxy.anthropic.com (logins made in a VM).
The MCP servers' logins stay in the VM. devvm agent save reads only the settings, an export of the VM's history leaves ~/.claude/.credentials.json out and an import never writes it, and a VM made again doesn't get it, so nothing of the VM's file reaches devvm's store, this machine or another VM. Only the store's copy goes into the file, and it holds the placeholders alone.
Codex's and opencode's logins
The proxy reads the real API keys and logins from the login files in devvm's store as it needs them and refreshes ChatGPT logins there. The proxy puts in opencode's API keys for the providers that API keys the proxy puts in lists, and its OpenAI and GitHub Copilot logins. The VM's entry for such an API key holds only its type and the placeholder, so the entry's other fields, such as its metadata, stay on this machine.
The VM's copy of Codex's auth.json holds only what Codex needs for its API key and its ChatGPT login: the placeholders, how it logs in, when it last refreshed, and the IDs of the account and the login. devvm keeps every other field on this machine, because the VM's proxy can't put it in, and it names those fields at every launch. That includes Codex's other ways to log in, such as a personal access token or an Amazon Bedrock key, so Codex in a VM can't use them. devvm treats Claude Code's account state in ~/.claude.json the same way, so the VM gets only the account fields that Claude Code writes there today, and devvm names any other field at every launch.
devvm keeps every other entry of opencode's auth.json on this machine too, because devvm doesn't know which hosts it's for, so the VM gets that entry without its key or its tokens, and devvm warns you about each at every launch. That's an API key for any other provider, such as Azure's or a local model server's, a well-known login, which an organization's own opencode config sets up, and any other OAuth login, such as Copilot Enterprise's. The VM keeps only the fields of a withheld entry that name the account or how it logs in, such as its type, its enterpriseUrl and its expiry, so opencode in the VM doesn't use that provider.
Logging in
When you approve a browser login, the browser comes back to localhost:1455, where the agent's own server in the VM waits, so devvm forwards this machine's localhost:1455, and localhost:1457, which Codex uses when 1455 is taken in the VM, to the same ports in the VM. The forward lasts only while the login runs, and it ends when the login ends, fails or you press Ctrl+C, which ends the agent's login in the VM too.
Codex in a VM keeps its login in ~/.codex/auth.json, never in a keyring, because devvm sets cli_auth_credentials_store = "file" in the VM's ~/.codex/config.toml on every launch.
With --api-key, devvm gives the running VM its copy of the login, with a placeholder in place of the key, and the VM's proxy puts the key in at once. opencode keeps its logins in its own database in the VM, and it reads its auth.json only when it first makes that database, so when opencode has already run in the VM, devvm also gives it the key's placeholder with opencode auth import. devvm reads at most 1 MiB of what that import prints in the VM, and when it prints more, devvm stops it and fails, so running devvm in the VM's folder tries again. Every other VM with opencode gets the key's placeholder at its next launch, the same way, and any credentials that you added to opencode in a VM yourself stay in its database.
Logins made in a VM
When Codex or opencode in a VM logs in to OpenAI, whether devvm agent login runs it or you run it yourself, the VM's proxy saves the login in devvm's store, in the agent's own auth.json, and the agent in the VM gets only placeholders, so on every tier but open the VM never holds the login's tokens. The VM you logged in from uses the login at once, and every VM with that agent gets it from its next launch. opencode reads its auth.json only when it first makes its database, so in a VM where opencode has already run, devvm adds the store's logins to opencode's database at each launch when they changed since the VM last got them, and makes them the ones opencode uses. Credentials that you added to opencode in the VM yourself stay in its database, labeled with your names rather than devvm, and opencode auth switch changes back to one of them. A login that shows a code to type into a browser on any machine works in a VM as it is, such as codex login --device-auth and opencode's Codex device code login. opencode's Sign in with ChatGPT doesn't work in a VM, because it gets its tokens from another endpoint, whose replies the VM's proxy refuses so that they never reach the VM, so choose one of opencode's Codex logins instead, as devvm agent login opencode does. A new login replaces the one in the store, together with Codex's API key, so every VM with the agent uses the account you logged in to last. A VM saves a login only for an agent that it has, so a VM without Codex can't replace the store's Codex login, and a VM without opencode can't replace opencode's. When a VM sends a login for an agent it doesn't have, such as one that a program installed in the VM itself, its proxy refuses the login, devvm saves nothing, and the proxy's own log says so. In a VM with both Codex and opencode, devvm tells their logins apart by the program that sends them. devvm network log shows a login line for each login it saved. On the open tier, a program that goes around the VM's proxy gets the login's tokens itself, and devvm saves nothing (logins made in a VM). Claude Code's logins in a VM are saved in the same way (Claude Code login).
pi's logins
devvm agent login pi --api-key --provider PROVIDER saves the key in the store's ~/.local/share/devvm/logins/pi/.pi/agent/auth.json, in pi's own format, beside pi's other providers, as opencode's --api-key does (logging in with devvm agent login). The VM's ~/.pi/agent/auth.json holds a placeholder in place of each of those keys, and the VM's proxy puts the key into pi's requests to that provider's hosts, on every network tier, and allows those hosts, as the table in API keys the proxy puts in describes. The VM's entry for such a provider holds only its type and the placeholder, so it gets none of the entry's other fields, such as its env, whose values pi uses before the environment's, and the store keeps them on this machine.
devvm keeps every other entry of pi's auth.json on this machine too, and the VM gets that entry without its key, its env or its tokens, and devvm warns you about each. That's an API key for any other provider, such as a local model server's, a key that's a command for pi to run, such as !security find-generic-password, and a key that pi fills in from a variable, such as $KEY or ${KEY}, even for a provider whose key the proxy puts in, because devvm can't tell what pi would send. The VM keeps only the fields of a withheld entry that name the account or how it logs in, such as its type, its accountId and its expiry.
pi's Claude and ChatGPT logins use the same token endpoints as Claude Code's, Codex's and opencode's logins, whose replies the VM's proxy captures for those agents, and devvm never keeps such a login as pi's. In a VM that also has the matching agent, Claude Code for a Claude login and Codex or opencode for a ChatGPT login, the proxy saves pi's login as that agent's own, in place of the one devvm keeps for every VM with that agent. In a VM with none of them, the proxy refuses pi's login and devvm saves nothing (logins made in a VM).
Cursor's CLI
The VM's proxy puts the real login only into the requests for the methods that devvm found the CLI calling in its package, on Cursor's API, its agent's hosts and its codebase indexing, and into no other. It refuses every other request below /auth/ on those hosts, the methods that make or show a key, a token, a secret or a sign-in, the methods that change your account, and any path it can't read as Cursor's hosts do. Those are the real control. As a defence in depth, the proxy also reads every reply from those hosts as it passes, its headers and the agent's streams included, and cuts one off where a token starts. devvm checked this against one release of the CLI, by reading its code, and against Cursor's own answers to a login that isn't there, so a method that Cursor adds that hands out a token in a shape devvm doesn't know would reach the VM. Such a token would work without the proxy, so if you suspect that one reached a VM, log in again with devvm agent login cursor (logins made in a VM). Neither does devvm guard Cursor's hosts that the CLI doesn't use: if one of them also answered /auth/poll, a VM could finish a login there and keep its tokens, though none is known to.
Your Cursor agents on every machine and in the cloud share Cursor's agent store, your cloud agents follow the skills in it, and your team shares a store of its own, so a VM that could write there could leave instructions for them. So no VM gets the store (why).
API keys
The proxy puts in opencode's and pi's API keys for the providers that API keys the proxy puts in lists, in the headers it names. OpenRouter's key goes in either of its two headers, because pi sends it in x-api-key for OpenRouter's Anthropic models, as Anthropic's own API takes a key, and in Authorization for every other model. The proxy swaps the placeholder only when the header holds the placeholder and nothing else, or for Authorization, Bearer, one space and the placeholder, which is how opencode and pi send each of these keys. A header that holds anything else beside the placeholder, or a second header of the same name, keeps the placeholder, so code in the VM can't surround your key with text of its own, which a provider that quotes part of a key it refuses could show back to it.
The placeholder for an OpenAI key starts with sk-, as an OpenAI API key does, because pi takes an OpenAI key that starts any other way for a Sign in with ChatGPT login and then leaves settings such as the longest reply it wants out of its requests.
The placeholder keeps a key out of the VM only from the launch that first gives the VM the placeholder. A VM that was given one of these keys as it was before then, such as through [pass-keys] when the proxy didn't put that provider's key in, may still hold copies of it. They can be in opencode's database, its write-ahead log and its freed pages, in the disk's free space and anywhere that the VM's own code copied the key. While opencode in the VM fails to import the placeholder, devvm's record of opencode's last import, ~/.local/state/devvm/opencode-import.json, holds the key too.
With some of these keys, code in the VM can make a credential of its own that works without the proxy. Google Gemini's key gets an ephemeral token for Gemini's Live API, which lasts up to about 20 hours and allows as many uses as the VM asks for. xAI's key gets a realtime client secret that lasts as long as the VM chooses, and OpenAI's key gets one that lasts up to 2 hours. opencode's experimental voice mode asks for these itself, so the proxy allows those requests (attack vectors). Some of these providers' own tools also fetch the URLs that a request names, such as Google Gemini's URL context and Search grounding, xAI's live search, Groq's compound models and Mistral's agents with web search, so code in the VM can reach hosts that the allowlist doesn't have through them, as it can through Anthropic's and OpenAI's.
History exports
The agents' logins aren't in the export, which leaves out ~/.claude/.credentials.json, ~/.codex/auth.json, and opencode's auth.json, account.json, mcp-auth.json and bin, and holds nothing of ~/.pi/agent but its sessions, so pi's auth.json stays out too. It leaves out the VM's ~/.claude/plugins, which holds settings and each plugin's data rather than history (Claude Code's plugins). It also leaves out what of ~/.local/state/opencode is the VM's own as a machine:
- its
machinefolder, whosehome-keyis the private key that every machine opencode pairs withopencode machine addtrusts - its
service.json, orservice-<channel>.jsonfor another channel's opencode, which holds the password of opencode's background service, and the handoff tickets and temporary files that opencode writes beside it - its
ptyfolder, which holds the sockets of its terminals' daemons and their access tokens - its
plugin-approvals.json, with its lock and the temporary files it's written through, which holds the project plugins you approved in opencode's native client, which doesn't ship in opencode 2.4.1 - its
plugin-stagedfolder, the approved plugins' copies, which that client runs without checking their hash again, so an export would otherwise approve a plugin for another VM
The copy of opencode's database leaves out its machine table too, which holds the public keys that the machines it paired log in to it with. An import never writes them either, so the new VM's opencode makes its own, and a VM made again keeps the VM's own, because it's the same machine (what a VM made again keeps).
opencode keeps its sessions and its logins together in one database, ~/.local/share/opencode/opencode.db, so the export holds a copy of that database without its logins. The VM makes the copy with sqlite3, which every base image has, and the copy has no logins, API keys or opencode account in any part of the file, not even a key you typed into opencode in the VM, while the VM's own database keeps them (how). The copy also leaves out what opencode 2.4 would act on without asking in the VM that imports it:
- its
automationtable, because opencode runs each automation's shell command on its schedule or event without asking again - its
permissiontable, the requests you said always to allow - its
jobtable, the subagents' jobs, and itssession_inboxtable, the messages queued for a session's next turn, because opencode's service starts those jobs and turns when it starts - each session's allow rules, as the session keeps only the deny and ask rules of its permission rules
- each suspended session's mark, so no session resumes its turn on its own
- each project's commands, whose start command opencode runs for each worktree it makes
The export also leaves out opencode's git repositories in ~/.local/share/opencode, which are snapshot, repos and worktree, because a repository's config can name a command that git runs, and opencode's own git commands would run it in the VM that imports it. So the export doesn't hold opencode's worktrees, and the work in them stays in the VM, which a VM made again keeps and devvm rm deletes, after it checks them (opencode's worktrees). Their commits are in the project's own repository. A view or a generated column in the database could hide rows from these steps, so the copy drops every view, and it fails its check when a table has a generated column. The export never holds the database's -wal, -shm or -journal files, which can hold logins that opencode saved last. When the VM has no sqlite3, such as a VM made from an image built without it, the export leaves the database out, so opencode's sessions aren't in it, and the run log says so. It does the same when the VM's sqlite3 can't read JSON, which the sessions' rules are. devvm starts a stopped VM for the export as a launch does, so it locks the folder's .git again and checks the VM's confinement first, and the VM stays running. devvm writes the file only once the export is complete, so a failed export leaves no file and leaves an existing FILE as it was. An export holds at most 2 GiB, because a VM could otherwise write until this machine's disk is full. When the VM sends more, devvm stops the export and keeps nothing of it, so devvm history export fails, while devvm rm and the commands that make a VM again warn that they kept no export and go on without one. Only you can read the file, and devvm makes the exports folder yours alone each time it writes one there, whatever its mode was before. When FILE is in a folder of your own, that folder keeps its mode. If the export fails, devvm rm keeps the VM, and devvm rm --no-export deletes it without exporting. devvm rm VM, for a VM whose folder is gone, exports in the same way, but only from a running VM or a --clone VM, because starting any other would make its folder again (a VM whose folder is gone).
opencode's worktrees
opencode 2.4 makes each worktree with git worktree add, in ~/.local/share/opencode/worktree/<project>/<name>, where <project> is the first six characters of the project's ID in opencode. Because an export leaves that folder out, devvm rm, and a command that makes the VM again with --clean-home, read the worktrees there before the VM's disk goes. devvm runs one command in the running VM, in its home folder, which finds each folder at that depth with a .git in it, those whose names start with a dot too, and prints, for each one, its path, its git status --porcelain, and the commit its HEAD is detached at when no branch, tag or remote-tracking branch in the VM has that commit. A worktree whose git status fails counts as one with changes, because the VM still has its files. The command looks at 100 worktrees at most and says when there are more. devvm reads at most 8 MiB of its answer and stops the command once it sends more, and it waits at most 2 minutes for the answer, so a VM that answers without end, or never, can't keep devvm rm waiting.
The answer comes from the VM, so devvm checks it before it shows any of it. Each record must be whole, each path must be a clean path below the home folder that opencode's pattern matches, each worktree must appear once and be followed by its status, and there can be no more than 100 of them. An answer that breaks any of these, a command that fails, an answer over the limit or one that doesn't come in time keeps the VM, because the VM may hold work devvm can't see, and devvm names --no-worktree-check. A path or a change devvm shows goes through the same filter as every message, which drops the characters that would move the cursor or hide text. The VM can still leave a worktree out of its answer, which hides only its own work. For a --clone VM, the same question covers the clone check's findings, so devvm asks once.
devvm checks only that folder. A worktree that opencode's worktree.directory setting puts elsewhere in the VM's home folder isn't checked, and it goes with the VM as any other file there does. One that the setting puts in the project folder is on this machine for a VM that mounts it, and in the clone for a --clone VM, whose check covers the worktrees inside its folder (deleting the VM).
Importing history
The import works on every VM, whether its base is Ubuntu's image or a Debian-, Ubuntu- or Alpine-based container image (starting from a container image), because it unpacks the export with GNU tar, which Debian and Ubuntu always have and which devvm installs in every base made --from alpine.
An export holds what a VM wrote, so devvm treats it as untrusted. Its transcripts can hold what the old VM's agents read, and a VM on a less strict tier reaches more, such as your local network on the open tier. So when the export comes from a VM on a less strict tier than the VM you import it into, going from open to internet, allowlist and none, devvm warns you before it imports. devvm knows an export's tier only from the .folder file beside it in ~/.local/share/devvm/exports, so it warns about an export with no tier recorded, or any FILE elsewhere, such as in the project folder that a VM can write, as if it came from an open VM. devvm never unpacks an export on this machine. It streams the file into the VM as it is, and the VM's own tar unpacks it there as the VM's user, so it can only write what that user can write. Before unpacking anything, the VM lists the paths in the export, and when one of them is outside ~/.claude, ~/.claude.json, ~/.codex, ~/.local/share/opencode, ~/.local/state/opencode, ~/.pi/agent/sessions and ~/.cursor/chats, starts with / or has a ., .. or empty part, such as .claude/./plugins or .claude//plugins, devvm imports nothing and says so, because tar matches the paths it leaves out against each name as the export writes it. Once it has unpacked the export, it also deletes each of those paths by its path, whatever name put a file there. It leaves out of that check, and never unpacks, the AppleDouble files whose names start with ._, which macOS's tar puts beside each file that has extended attributes, so an export you packed yourself on a Mac imports. The import keeps no owner or mode from the export, so the VM user's umask applies and no file is set-user-ID. It also takes out every symbolic link that points outside the folder it's in, which is any link to an absolute path or one with a .. part, so an agent writing to a session file can't follow a link out of its history. An export that devvm didn't write, such as a .tar.gz you made yourself, can hold opencode's database with its logins, so the import takes out the database's -wal, -shm and -journal files and puts in a copy of the database without its logins or what opencode would act on without asking, as the export makes it (history exports), or leaves the database out when the VM has no sqlite3. It never writes opencode's git repositories either. opencode in the new VM then reads the logins that devvm gave the VM, as it does when it first makes its database. When the VM already has an opencode database, it keeps its own, and opencode's sessions from the export aren't imported.