Request an invite
Docs menu

osmates code

Open a coding agent in a Linux machine of its own, on a copy of a folder.

Usage
osmates code [<options>] [<folder>] [-- <arguments> ...]

The first open of a folder makes a Debian machine named after it, with 4 CPUs, 4 GiB of memory and a 32 GiB disk. The folder goes in as a copy, never a share. The network reaches package registries, GitHub and AI model APIs, not this Mac or your local network.

Each open starts the machine, installs the harness if missing, takes a snapshot and opens the harness through osmates ssh. A credential whose variable is ANTHROPIC_API_KEY or OPENAI_API_KEY is granted for 24 hours, and the harness sees only its placeholder.

When the harness ends, osmates workspace diff <machine> takes its changes back as a git patch. The machine keeps running. With --json, nothing opens and the command prints the session. It exits with ssh's status.

Credentials, diffs and undo: https://osmates.com/docs/code

Examples

sh
osmates code .
osmates code ~/src/app --agent codex
osmates code . --undo

Arguments

<folder>

The folder the agent works on.

--agent <agent>

The harness: claude (Claude Code) or codex (Codex CLI). Default: the last session's, else claude.

Without a credential, the harness keeps your API key or sign-in inside the machine, and the command says how to add one.

One of claude, codex.

--vm <machine>

The machine to use or make. Default: the one holding the folder.

One that holds another folder's workspace is refused.

--undo

Return the machine to before its latest session instead of opening one.

What the session changed, in the workspace and outside it, is gone.

--json

Print machine-readable JSON.

<arguments>Repeatable

Arguments for the harness, after --.

JSON output

With --json, it prints an object with these fields.

JSON Schema: /schemas/0/cli/code.json

agentstringRequired

One of claude, codex.

credentialobject
credential.changedAtstring (date-time)Required
credential.createdAtstring (date-time)Required
credential.grantsarray of objectsRequired
credential.idstring (uuid)Required
credential.namestringRequired
credential.usesarray of objectsRequired
credential.variablestring
egressobjectRequired
egress.modestringRequired

One of open, allowlist, blocked.

egress.rulesarray of stringsRequired
folderstringRequired
guestPathstringRequired
machinestringRequired
madeMachinebooleanRequired
sharesarray of objectsRequired
shares[].eventsbooleanRequired
shares[].folderstring (uri)Required
shares[].namestringRequired
shares[].readOnlybooleanRequired
snapshotobjectRequired
snapshot.createdAtstring (date-time)Required
snapshot.discstring (uri)
snapshot.discControllerboolean
snapshot.firmwareobject
snapshot.frameworkSoundobject
snapshot.guestToolsboolean
snapshot.hardwareobjectRequired
snapshot.hostBuildstring
snapshot.idstring (uuid)Required
snapshot.includesMemorybooleanRequired
snapshot.isCrashConsistentbooleanRequired
snapshot.isKeptbooleanRequired
snapshot.namestringRequired
snapshot.networkPathstring

One of direct, detached, filtered.

snapshot.originstring or objectRequired

One of manual, or an object that holds one key: agentSession, agent, beforeRevert, schedule, beforeUpdate, beforeDrivers, guest, beforeGuestRevert, codeSession, beforeMacOSUpdate or beforeFirmwareUpdate.

snapshot.partitionGrowthobject
snapshot.rosettaboolean
snapshot.windowsDriversobject
snapshot.withoutNetworkbooleanRequired
terminalarray of stringsRequired

Fields nested deeper are in the schema.

With --undo

With --json and --undo, it prints an object with these fields.

JSON Schema: /schemas/0/cli/code.undo.json

notSavedBecausestring
savedBeforeobject
savedBefore.createdAtstring (date-time)Required
savedBefore.discstring (uri)
savedBefore.discControllerboolean
savedBefore.firmwareobject
savedBefore.frameworkSoundobject
savedBefore.guestToolsboolean
savedBefore.hardwareobjectRequired
savedBefore.hostBuildstring
savedBefore.idstring (uuid)Required
savedBefore.includesMemorybooleanRequired
savedBefore.isCrashConsistentbooleanRequired
savedBefore.isKeptbooleanRequired
savedBefore.namestringRequired
savedBefore.networkPathstring

One of direct, detached, filtered.

savedBefore.originstring or objectRequired

One of manual, or an object that holds one key: agentSession, agent, beforeRevert, schedule, beforeUpdate, beforeDrivers, guest, beforeGuestRevert, codeSession, beforeMacOSUpdate or beforeFirmwareUpdate.

savedBefore.partitionGrowthobject
savedBefore.rosettaboolean
savedBefore.windowsDriversobject
savedBefore.withoutNetworkbooleanRequired
statusobjectRequired
status.canSuspendbooleanRequired
status.controlobject
status.detailstring
status.displayobject
status.failureobject
status.idstring (uuid)Required
status.namestringRequired
status.pauseReasonstring or object

One of person, hostAsleep, or an object that holds one key: volumeFull, volumeLow or tpmStateUnsaved.

status.shutdownWaitobject
status.startWaitobject
status.statestringRequired

One of starting, running, paused, stopping, stopped, failed, suspended, offline.

status.suspensionobject
status.updatedAtstring (date-time)Required
status.workerBuildstring
status.workerProcessIdentifierinteger

Fields nested deeper are in the schema.

Exit statuses

Its exit status is one of these.

StatusMeaning
0The command did what it was asked.
1The command failed; with --json, standard error's last line is the error object.
64The command line is wrong, as ArgumentParser found before the command ran.
65What was given is wrong, found while the command ran; the same command fails until it changes.
75The same command can work later with nothing changed, as while an update finishes.
130Control-C cancelled what the command started.
0 to 255ssh's own status: the remote command's, or 255 when ssh failed.

Report a problem with this page