Command Code CLI
Run the genuine Command Code v1 CLI inside an agentOS VM.
Quick start
import commandCode from "@agentos-software/command-code";
import { agentOS, setup } from "@rivet-dev/agentos";
const vm = agentOS({ software: [commandCode] });
export const registry = setup({ use: { vm } });
registry.start();
import { createClient } from "@rivet-dev/agentos/client";
import type { registry } from "./server";
const client = createClient<typeof registry>({
endpoint: "http://localhost:6420",
});
const agent = client.vm.getOrCreate("my-agent");
const apiKey = process.env.COMMAND_CODE_API_KEY;
if (!apiKey) throw new Error("COMMAND_CODE_API_KEY is required");
await agent.mkdir("/workspace", { recursive: true });
const result = await agent.execArgv(
"cmd",
[
"-p",
"What files are in the current directory?",
"--output-format",
"json",
"--trust",
"--yolo",
"--skip-onboarding",
"--no-auto-update",
],
{
cwd: "/workspace",
env: { COMMAND_CODE_API_KEY: apiKey },
},
);
if (result.exitCode !== 0) throw new Error(result.stderr || result.stdout);
console.log(result.stdout);
The registry package projects command-code@1.1.0 as cmd, cmdc, command-code, and commandcode. It uses the genuine upstream CLI, rebundled for the VM with compatibility patches recorded in the package’s agentos-build.json. It is a command package, not an ACP agent. Invoke it with execArgv or attach a terminal for interactive use.
The CLI is sourced from the npm release, whose package metadata is UNLICENSED; the public Command Code GitHub repository does not contain the CLI implementation. Review the upstream terms before publishing or redistributing the packed artifact.
Credentials
Create a Command Code API key and pass it to the command as COMMAND_CODE_API_KEY, sourced from your server’s environment. The credential stays inside the VM process environment and is read by the packaged Command Code CLI.
See Command Code’s documentation for account and model details.
Verified command surface
The agentOS end-to-end test runs the packaged command in a real VM and verifies:
- version and help output;
- unauthenticated status JSON and the documented headless authentication exit code;
.agents/skills/discovery withcmd skills list --debug;- local TypeScript mod installation and discovery with
cmd mods add/list; - project-scoped HTTP MCP add/get configuration and the resulting
.mcp.json; - all four projected command aliases.
The opt-in network test installs the pinned cmd-mod-hi@0.1.1 npm mod in a standard VM. npm-backed mods require the default common software bundle’s sh; a minimal VM created with defaultSoftware: false must add @agentos-software/coreutils. The opt-in live test also verifies API-key authentication and reaches Command Code’s hosted model endpoint. The available test key reached the billing boundary but had insufficient credits, so a complete generated model response has not been validated. Interactive help was also exercised through an agentOS terminal, but a complete interactive login and model turn has not been validated.
Runtime support matrix
Legend: 🟢 Supported means the platform provides the required behavior; notes identify any Command Code path that has not yet been exercised end to end. 🟡 Partial identifies a concrete platform limitation, not merely missing test coverage. 🔴 Not implemented / unsupported means the current implementation does not provide the behavior; it does not necessarily mean the behavior is impossible to add.
| Command Code surface | Native Linux | agentOS VM | Direct Cloudflare Worker isolate |
|---|---|---|---|
CLI startup, --version, --help, aliases | 🟢 Supported | 🟢 Supported — tested end to end | 🔴 Unsupported — no standalone Node CLI/process entrypoint |
| API-key authentication | 🟢 Supported | 🟢 Supported — tested against the hosted service | 🔴 Unsupported as a full CLI |
| Browser login / MCP OAuth browser flow | 🟢 Supported | 🟡 Partial — a VM cannot launch the host browser; use an API key or terminal URL/code flow | 🔴 Unsupported as a local CLI |
| Interactive TUI and TTY input | 🟢 Supported | 🟢 Supported — terminal startup/help tested; a funded interactive model turn is untested | 🔴 Unsupported — node:tty, readline, and REPL are non-functional stubs |
Headless -p, JSON/NDJSON, piped stdin, exit codes | 🟢 Supported | 🟢 Supported — authentication and the hosted billing boundary tested; completed generation and streaming remain untested | 🔴 Unsupported as a full CLI |
| Filesystem read/write and JS glob | 🟢 Supported | 🟢 Supported — backed by the VM VFS and Node fs/fs.promises.glob; VM policy still applies | 🔴 Unsupported for this CLI — no normal durable project tree |
| Text search / ripgrep | 🟢 Supported | 🟢 Supported — install @agentos-software/ripgrep; a Command Code model-driven search is untested | 🔴 Unsupported for this CLI — Worker VFS has no glob APIs or normal project tree |
| Shell commands and hooks | 🟢 Supported (permission gated) | 🟢 Supported with the default common software bundle; VM process policy still applies | 🔴 Unsupported — node:child_process is a non-functional stub |
| Git and managed worktrees | 🟢 Supported | 🟢 Supported — install @agentos-software/git; Command Code’s managed-worktree flow is untested | 🔴 Unsupported — no child processes or durable project filesystem |
| Persisted sessions, resume, fork, rewind | 🟢 Supported | 🟢 Supported — session files live on the VM filesystem; durability follows the configured filesystem | 🔴 Unsupported — request-local VFS is not persistent |
Skills and .agents/skills/ | 🟢 Supported | 🟢 Supported — project discovery/listing tested end to end | 🔴 Unsupported as a CLI |
| MCP configuration | 🟢 Supported | 🟢 Supported — project-scoped HTTP add/get tested end to end | 🔴 Unsupported as a full CLI |
| MCP HTTP/SSE tool use | 🟢 Supported | 🟢 Supported — backed by VM HTTP/SSE networking; a live Command Code MCP tool round trip is untested | 🔴 Unsupported as a full CLI, even though Workers can make HTTP requests |
| MCP stdio servers | 🟢 Supported | 🟢 Supported — backed by VM process and stdio support; a Command Code MCP round trip is untested | 🔴 Unsupported — no child processes |
Local TypeScript mods (--mod, local mods add) | 🟢 Supported | 🟢 Supported — install, compile, and discovery tested end to end | 🔴 Unsupported — no CLI process or persistent mod directory |
| npm TypeScript mods | 🟢 Supported | 🟢 Supported — pinned registry install tested with the default common bundle | 🔴 Unsupported — no package manager or child processes |
| Git-sourced mods | 🟢 Supported | 🟢 Supported — install @agentos-software/git; this Command Code install path is untested | 🔴 Unsupported |
| Mods with native Node add-ons | 🟡 Partial — only prebuilt add-ons can work because Command Code installs with --ignore-scripts | 🔴 Unsupported — VM Node execution does not load native Node add-ons | 🔴 Unsupported |
| Clipboard copy and image paste | 🟢 Supported when a host clipboard is available | 🔴 Unsupported — the VM has no host clipboard or native N-API clipboard binding | 🔴 Unsupported — no host terminal clipboard |
Update checks (cmd update --check-only) | 🟢 Supported | 🟡 Partial — the upstream five-second npm version-query timeout can expire in a VM | 🔴 Unsupported as a CLI |
| In-place auto/self-update | 🟢 Supported | 🔴 Not implemented — Command Code cannot replace the projected package in the current runtime | 🔴 Unsupported |
This Cloudflare column evaluates running the npm CLI directly in a standard Worker isolate with nodejs_compat. It does not describe an official Command Code Worker implementation—none was found—and it does not cover Cloudflare Sandbox, which is a separate container product with a real filesystem and shell.
agentOS does not currently implement registry-mediated self-update. cmd update replaces a globally installed npm package, but it cannot replace the content-addressed, read-only package projected at /opt/agentos. A future host-mediated updater could select a newer registry package without mutating that projection; for now, run with --no-auto-update and upgrade the registry package from the host. Mods install into writable user/project storage instead, which is why local and pure TypeScript npm mods work; npm-backed installation needs sh, while Git sources need Git and native Node add-ons cannot load in the VM.
Sources: Command Code CLI reference, headless mode, MCP, skills, mods, hooks, Cloudflare Node.js compatibility, and Cloudflare Worker filesystem.
Permissions and updates
--yolo lets Command Code edit files and run shell commands without its own prompts. Those operations remain subject to the VM’s filesystem, process, network, and resource policies. Only use it with trusted prompts and least-privilege VM configuration.
The registry package is immutable at /opt/agentos, so use --no-auto-update (or COMMANDCODE_SKIP_UPDATES=1) and update through a newer registry package instead.