pvisor command reference¶
pvisor run creates a container-profile Session in its own Linux VM on Unix.
Windows has a separate WHP profile. pvisor spawn creates a task Session; omitting the subcommand also selects spawn. Session lifecycle and
change-review commands operate directly on Sessions without a session subcommand, and
replay creates a Session from a trajectory. See the
execution model for how Session, Run and Execution
relate; existing Session IDs and on-disk records keep their run-*
and Run Bundle names.
Full command examples for Host, OCI VM and transparent host-rootfs VM
are in
Run workloads with pVisor.
Root help (pvisor or pvisor --help) groups commands under Commands
(Docker-compatible container commands), Agent Commands (spawn, status,
kill, review, apply, drop, inspect, checkpoint, suspend, resume, fork) and Tools
(installed daemon and replay companions, feature, help). It shows a short
run-review-apply example; use pvisor help COMMAND for detailed options.
Help, version and feature queries emit no startup logs. Execution commands emit
process.entry and cli.parsed only after command parsing. These markers do
not measure the complete process-entry or argument-parsing overhead.
Container commands¶
run, exec, ps, start, stop, restart, wait, cp, rm, logs,
build, pull, push, images, rmi, network, volume and builder
use a Docker-style option subset with one VM per container and no central daemon.
Use pvisor COMMAND --help for supported options. Session options such
as --safe, --stage and --executor belong to spawn, not container run.
pvisor pull alpine:3.20
pvisor run --rm alpine:3.20 echo hello
pvisor run -d --name redis redis:7
pvisor exec redis redis-cli ping
pvisor stop redis
pvisor rm redis
On Linux and Apple Silicon macOS, pvisor start -a CONTAINER starts one stopped
container, forwards signals, and streams the new execution's stdout and stderr.
It returns that execution's exit code and does not attach stdin. Default ps
and images output is aligned in a terminal; ps also shows creation age and
running time. Redirected output keeps the original tab-separated columns. Use
--format or -q to select script output explicitly.
pull --platform linux/amd64 or linux/arm64 selects the image architecture;
linux/arm64/v8 is an alias. Omission uses the native platform. Foreign-image
downloads are supported, but run and start require native images because CPU
emulation is unavailable. For private registries using a Bearer challenge, pass
--username with --password-stdin to authenticate to the token endpoint.
The CLI also accepts --password, which exposes the secret in process arguments.
Without --username, static auths entries from $DOCKER_CONFIG/config.json
or ~/.docker/config.json are used when present. Credential helpers and the
Docker Engine API are unsupported.
Unix containers and task Sessions use schema 4 records with separate stores and command capabilities. Container review/apply/drop select staged binds.
If container removal reports pending cleanup, run pvisor rm --retired FULL_ID
with the full ID from the error. The command refuses active container records.
An already-absent full ID succeeds, so the command can be repeated.
Run host-installed tools with @root¶
On Linux x86_64 with KVM, put @root where an image name normally goes. It is
not an OCI image: pVisor does not pull or list it. The VM reads the live host /
as a read-only base and retains writes for review, even after a nonzero exit.
Run from the project whose files you may want to accept:
pvisor run -v ../experiment:/:stage @root /bin/sh -c 'echo changed > example.txt'
pvisor review ../experiment --diff
pvisor apply ../experiment --path example.txt --dry-run --diff
pvisor apply ../experiment --path example.txt
pvisor drop ../experiment
With @root, -v PATH:/:stage selects one unused host directory for storing
changes, not a bind source. Omit it to use the default Session store and the path
printed at exit. With an ordinary image, -v HOST:GUEST:stage
still stages edits to an existing bind source. Ordinary apply accepts changes
only under the project recorded when @root was launched.
Guest networking is off unless you pass --network bridge. Readable host files,
including credentials, are still visible. @root is a foreground Session: it
does not appear in container ps and rejects -d, --rm, port forwarding and
additional mounts. macOS and Windows do not support it. The legacy pvisor stage
command still accepts --stage PATH and keeps its bridge default.
Compose projects (experimental)¶
On Linux x86_64 or Apple Silicon macOS, use pvisor compose to start services
from one Compose file without a Docker daemon. Complete VM setup, then save this as compose.yaml in an empty demo directory. Choose an unused project name if pvisor-demo already exists in your container store.
name: pvisor-demo
services:
web:
image: python:3.12-alpine
command: ["python", "-m", "http.server", "8000"]
depends_on: [cache]
cache:
image: redis:7
Validate the file, wait for startup, list the two services and remove the demo containers:
Expect web and cache to be running after up --wait. The example
needs registry access on first use. Each service runs in its own VM. Services can resolve each other by name on the
project's default network. Startup can wait for declared dependency conditions,
including health and successful completion. Place -f FILE and -p PROJECT
before the subcommand. down retains images and managed volumes by default.
Check the supported options and examples before moving an existing Compose
project. Compose command profile
Staged container binds (Linux only)¶
Use the pVisor extension -v HOST:GUEST:stage to review bind-mount changes before
writing them back to an existing host directory. The guest sees a copy-on-write
view; the host source remains unchanged until apply. Use an explicit bind source
such as ./project or an absolute directory path and an absolute guest target.
Existing :ro/:rw binds and named/anonymous volumes are unchanged. stage
does not apply to managed volumes, cannot be combined with ro/rw, and is not
a claim of complete Docker compatibility.
For an existing ./project, this foreground command exits before review. Preview
without writing, apply only src, then drop the remaining candidates:
pvisor run --name edit -v ./project:/workspace:stage alpine:3.20 \
sh -c 'mkdir -p /workspace/src; echo kept > /workspace/src/staged.txt; echo discarded > /workspace/scratch.txt'
pvisor review edit --diff
pvisor apply edit --path src --dry-run --diff
pvisor apply edit --path src
pvisor drop edit
pvisor rm edit
review, apply and drop accept the instance name or ID in the current
container store (PVISOR_DOCKER_HOME selects it). --mount GUEST must exactly
match a staged bind's absolute guest target; it is not a prefix or host path.
It is optional for exactly one staged bind and required with multiple staged
binds, even if only one still has changes. Ordinary binds and volumes cannot be
selected for these operations.
With existing, disjoint ./project and ./notes directories, select each mount
explicitly:
pvisor run --name edits \
-v ./project:/workspace:stage -v ./notes:/notes:stage alpine:3.20 \
sh -c 'echo kept > /workspace/result.txt; echo discarded > /notes/result.txt'
pvisor review edits --mount /workspace --diff
pvisor apply edits --mount /workspace --all --dry-run --diff
pvisor apply edits --mount /workspace --all
pvisor review edits --mount /notes --diff
pvisor drop edits --mount /notes
pvisor rm edits
Paths and globs select relative to the chosen host source: --path src targets
HOST/src, not the guest /workspace/src. Apply uses the recorded source scope
and directory identity, with preimage conflict checks; it cannot be redirected.
The image rootfs is separate and is never written back to host /.
apply --rootfs is refused for staged binds. The apply options
also govern preview, explicit selection and partial writeback.
Admission rejects these configurations before launch:
- Staged binds combined with
--rm; remove the instance explicitly after review. - Any staged bind combined with a direct-writable mount, including apparently disjoint writable binds or volumes. Disjoint read-only mounts are permitted.
- Overlapping guest targets or canonical host sources where a staged bind is involved, including equal or ancestor/descendant paths.
- Host
/as a staged source, including an alias with the same filesystem identity.
Review/apply/drop require a stopped instance with confirmed completion evidence;
live instances refuse all three, including preview. stop retains the stages
and neither applies nor drops them. Partial apply leaves unselected changes
staged; drop discards the remaining candidates without undoing already-applied
host files. Before start can restart an instance, every staged bind must have
its changes resolved by apply/drop (or have no changes). Restart creates a new
generation and fresh bind stages; old stages cannot authorize operations on it.
Pending apply ledgers or unknown completion/recovery state block cleanup,
including rm -f; force removal is not a recovery bypass. Preserve the stage,
ledger and completion evidence for explicit reconciliation. Missing evidence is
not proof that no changes occurred. Apply does not run tests automatically or
provide atomic multi-file writeback; validate accepted changes separately.
Remote API calls and other external side effects are outside apply/drop.
Same-host container networks¶
network create/ls/inspect/rm manages logical networks in the current PVISOR_DOCKER_HOME. The default bridge supports IP-based communication; user-defined networks also provide container-name DNS. --network none omits the NIC, and --ip requires a user-defined network.
pvisor network create --subnet 172.20.0.0/24 dev
pvisor run -d --name web --network dev python:3.12-alpine python -m http.server 8000
pvisor run --rm --network dev alpine:3.20 wget -qO- http://web:8000/
pvisor network inspect dev
pvisor stop web
pvisor rm web
pvisor network rm dev
Members support IPv4 TCP, UDP, ICMP and targeted ARP; external egress retains the TCP/DNS profile. Peer traffic needs no -p; publish ports for host access. Only IPv4 /24 networks in the allowed ranges and one network per container are supported. IPv6, host networking and connect/disconnect are unsupported. Stopped containers retain addresses and attachments, so remove containers before removing their network.
Image builds¶
pvisor build -t app:local --network=none .
pvisor run --rm app:local
pvisor build -f Dockerfile --build-arg VERSION=1 \
--output type=oci,dest=app.oci.tar -t app:local .
build accepts local contexts, -f, repeated -t/--build-arg, --target,
--platform (native only), --pull, --no-cache, -q, --iidfile,
-o type=oci,dest=PATH, --network default/none, --cpus, -m/--memory,
--timeout (seconds per RUN, default 600) and --progress auto/plain.
Every RUN uses a fresh VM with a private rootfs overlay. Context files are
captured privately and copied only by COPY; they are never mounted into RUN.
Timeout/failure reaps the VMM; frontend death closes its lifetime pipe. Guest
processes do not survive a RUN boundary. Network defaults to the existing public
IPv4 TCP/DNS policy; none omits the NIC. CPU/RAM flags size the VM.
Supported Dockerfile instructions are FROM/AS, RUN, local COPY, completed-stage
COPY --from, ARG, ENV, WORKDIR, USER, CMD, ENTRYPOINT, SHELL, LABEL, EXPOSE,
VOLUME metadata and STOPSIGNAL. COPY supports JSON/globs, numeric --chown and
octal --chmod; .dockerignore and Dockerfile-specific ignores are applied.
Simple $NAME/${NAME} substitutions are supported. --build-arg NAME forwards
only that variable; arguments are not secret storage. Images use a single flat
OCI layer, preserving merged deletes, guest ownership/mode, symlinks and hardlinks.
A successful build publishes local tags usable by run; ordinary failures clean
private staging and retain prior tags. Abrupt death can leave unpublished staging.
OCI output requires a new file. Successful RUN instructions publish local
filesystem/configuration checkpoints. Cache hits skip VM launch for that RUN.
--no-cache bypasses cache reads and refreshes successful checkpoints. Use
pvisor builder prune to remove eligible checkpoints.
This is a Docker build subset: remote/stdin contexts, ADD, ONBUILD, heredocs, RUN mounts, secrets/SSH/cache mounts, named COPY owners, external-image COPY, extended substitutions, foreign execution, device nodes and file capabilities are rejected. COPY sources cannot traverse symlinks. OCI registry push, Docker archive output and multi-platform builds are not implemented. Apple Silicon/HVF has native acceptance coverage; Linux/KVM needs separate runtime acceptance.
Publish lazy images¶
Use pvisor push IMAGE --to URI or pvisor image push to publish a local
image to S3 or an absolute file:/// directory. The JSON receipt contains a
pinned source. Import it with pvisor image pull IMAGE --from SOURCE using
S3 or HTTP(S). Use explicit --refresh to replace an existing local name.
Use --images-dir DIR to select prepared daemon templates. These commands
access the catalog directly. See the shared image cache guide
for an example.
Maintain the local image pool¶
pvisor image df --json reports the pool format, revisions, objects, bytes and
writable-projection usage. pvisor image prune reclaims unreferenced revisions,
content objects, abandoned imports and stale projections while protecting
catalog tags and container-pinned revisions; the default grace is 24 hours and
--all, --until, --keep-storage and --dry-run make the scope explicit.
pvisor image verify reads every reachable object and fails on corruption.
pvisor image stats --endpoint tcp://127.0.0.1:PORT reads process-local cache
server counters; without --endpoint it reports local store usage.
Session owners and durable operations¶
pvisor spawn starts a frontend and a private Session owner. Live status, kill, VM
controls and execution capture connect to the owner recorded in the Session;
ordinary commands need no socket arguments. Stopped status, review, apply, drop
and inspect run directly in the caller under session.lock. Apply/drop refuse a live
owner still holding stage. Interactive execution keeps the original terminal,
allows Ctrl-C to reach the workload, and restores foreground ownership at exit.
The instance protocol is pvisor-instance-control-3; same-UID private sockets use bounded newline
JSON and never accept terminal descriptors or Guest AgentCtl tokens. Lost replies,
timeouts and cancellation can follow effects and are never automatically retried.
For a newly started, filesystem-isolated Linux Host Session, use
pvisor exec --session -it SELECTOR /bin/sh to attach a shell. It inherits the
sandbox and ends when the main workload exits. Paused Sessions and the
Landlock-only Host path reject attachment. Use
pvisor status SELECTOR --lifecycle --json for lightweight lifecycle polling.
See Host and Guest AgentCtl for control ownership and the record matrix for persistent state.
Experimental features¶
Query runtime features in the caller without starting a Session or connecting to an owner:
pvisor feature
pvisor feature list --json
pvisor --feature workload-aware-memory-offloading feature --json
Each entry includes name, stage, default, enabled and description. default is the registered default; enabled reflects that default plus this query's --feature options. The query does not load a Run configuration or inspect a live Session. An enabled flag does not certify platform availability or runtime success.
Use the repeatable global --feature NAME option before or after spawn; comma-separated names are also accepted. Unknown names reject. Arguments after -- belong to the workload.
| Feature | Stage | Default | Scope |
|---|---|---|---|
workload-aware-memory-offloading |
experimental |
false |
EXP-001 M0 native VM vCPU observation; automatic offload is not implemented |
workload-aware-memory-offloading requires the final executor to be VM and a Linux x86_64/KVM or Apple Silicon macOS/HVF build. It does not replace an executor selection. HVF runtime validation remains outstanding. Observation is enabled through the native runner; no live Host observation query is exposed yet.
Feature enables apply to spawn and feature queries. Other lifecycle commands reject them; execution resume/fork retain the saved configuration. [features] in an explicit Run configuration can also enable features; CLI enables override false, omission preserves the configuration. There is no CLI disable option or persistent feature enable action. See feature configuration. Runtime features are separate from Cargo build features and do not change existing VM memory flags.
Daemon and cache commands¶
pvisor spawn and subsequent Session commands provide native execution and review; container commands such as pvisor run manage independent VMs. Invoke pvisor-daemon directly to prepare templates and serve partial OpenSandbox/E2B profiles, or enable cache/pool components independently.
Add --memory-pool to pvisor-daemon serve --sandbox to enable its default-off detached pool component. pvisor-daemon serve --cache runs the optional cache service. Use the Rust client for file queries. Node runtime protocols serve native callers, without a daemon acquire/release adapter. NativeRuntime embeds VM execution; checkpoint/fork and stage/apply APIs are absent. See the daemon guide for ownership, installation and deployment boundaries.
Other unknown names follow default execution rules. The ctrl name
is an explicit exception: pvisor ctrl, pvisor ctrl --help and
pvisor help ctrl reject with migration guidance before Session admission, rather
than default-running a program named ctrl. Use the live VM commands below.
pvisor spawn -- ctrl still expresses explicit workload intent; it does not
invoke a control API. Use pvisor -- COMMAND for explicit default
execution.
Find the command you need¶
- Run a command: start with
pvisor spawn, then usestatus --review,inspectandapplyto decide which changes reach the project. - Understand the execution boundary: use
statusandinspect, then read the executor guides. - Continue a trajectory: use
replayonly when you already have a supported trajectory, after reading the replay guide.
To get started, run and review a Session:
last resolves only Sessions that belong to the current workspace in default
storage. With --stage PATH, pass that path or the Session ID to later commands;
see Sessions and storage.
Staging and storage¶
The table below describes the default CLI behavior. Explicit commit settings, writable shares and application-compatibility policies can change where writes go.
| Mode or directory | Write destination | After exit |
|---|---|---|
| Ordinary host, no staging | Original workspace | Written to the host; drop cannot undo it |
--safe workspace |
Copy-on-write stage in Session storage | Retained for status --review, apply and drop |
Workspace with explicit --stage PATH |
The named stage | Retained; the option also enables staging |
| VM workspace | The named stage or default Session storage | Retained |
| Other writes to the VM root | Private temporary upper | Discarded when the VM exits |
--safe HOME / CODEX_HOME state |
Separate private stage | Discarded at exit; not part of the workspace Run Bundle |
Explicit --mount SOURCE:write |
Host SOURCE | Written directly and persistently; bypasses workspace apply/drop |
Session records and the Run Bundle are stored in run storage. --stage PATH chooses
the location; it is not a prerequisite for --safe to retain workspace
changes. File review does not undo remote side effects that already happened.
Filesystem parameters¶
A macFUSE temporary workspace on macOS uses the directory where pVisor was
launched as its default lower; /Volumes/pvisor-* is the merged-view mount
point and contains the files already present in that directory. An explicit
working directory or OverlayFS base takes precedence.
An ordinary host Session writes workspace changes through to the lower by default.
--safe retains workspace changes in Session storage by default, to be
handled later with status --review, apply or drop. --stage PATH only
chooses the storage location and is not a prerequisite for retaining
changes.
pvisor spawn --stage ../run-stage -- codex
pvisor spawn --safe --mount /opt/zcode:read --mount /var/lib/zcode:write -- zcode
pvisor spawn --access '**/.ssh:deny' -- zcode
pvisor spawn --access '.env:deny' -- codex
--mount SOURCE:read grants a host executor read-only access at the original
absolute path and requires --safe; SOURCE:write modifies host
storage directly. Neither rewrites TARGET, and neither may overlap the
workspace, Session storage or writable runtime paths; a read-only share cannot live
under Linux's private /tmp. Do not share directories containing secrets.
--mount SOURCE[:TARGET]:stage instead adds SOURCE as a lower layer of the
workspace copy-on-write view; it is not an independent directory mount.
--access PATH-GLOB:deny|warn accumulates configuration, preset and CLI
rules by default: deny refuses, and warn allows with a warning.
Clearing configuration and default file protection requires an explicit
--clear-access before adding CLI rules. deny > warn.
The :read access action is rejected; use :warn, or
--mount PATH:read for true read-only access.
Configure static file and network boundaries before launch. Review staged files after execution
with review, accept selected paths with apply, and discard the rest with drop.
Proxy networking is a cooperative boundary: direct connections can bypass it.
Commands:
run Create and run a container in its own VM
pull Download an OCI image
images List local images
rmi Remove image references
prune-staging Reclaim interrupted local imports
prune Reclaim unreferenced local pool data
df Report local image pool usage
verify Verify local image content objects
stats Report local usage or cache server counters
exec Execute a command in a container VM
ps List containers
start Start stopped containers
stop Stop containers
rm Remove containers
logs Fetch container output
Agent Commands:
spawn Start a Session
status Show Session status
kill Terminate a Session
review Review staged changes and execution evidence
apply Accept selected staged changes
drop Discard staged changes
inspect Open a read-only Session filesystem view
checkpoint create, list, show, delete, verify, import-base, verify-base, gc
suspend Save execution state and suspend a Session
resume Continue a suspended Session
fork Branch from staged files or VM execution state
Tools:
cache Build, publish and query caches
replay Replay an Agent trajectory (when installed)
feature List runtime experiments
help Show command details
Safe first run¶
Host execution preserves the host filesystem view by default; only
--filesystem sandbox enables pVisor's synthetic-root/Landlock or Seatbelt
filesystem access policy. --safe stages the workspace and gives HOME
(including Codex launched from a shell) a separate copy-on-write view. Without
--stage, the changeset and Run Bundle are retained in Session storage by default
and can be reviewed, applied or dropped after exit. An explicit
--stage <PATH> retains the Session and a writable stage, keeps the changes
available for human review, and writes run-bundle.json with mode 0600.
--strict requires non-bypassable enforcement evidence for every requested
capability dimension, and otherwise fails closed before the Agent starts. Today
host, container and VM all request Network and Subprocess, and none claims
Subprocess, so --strict exits with UnsupportedPolicy on those paths. Use the
flag to verify fail-closed behavior, not to mean "a stronger sandbox is ready".
On Linux, --filesystem sandbox uses pVisor's rootless launcher with
user/mount/PID namespaces, a minimal bind-projected root, chroot and a
kernel-negotiated Landlock policy. --overlaynet-deny-all independently adds a
private network namespace; public/allowlist proxy modes remain cooperative. On
macOS, the host executor installs a generated Seatbelt policy only when
filesystem sandbox or network isolation is requested; filesystem policy and
network policy are independent. For a deny-all Run it blocks IP and ambient host
Unix sockets while retaining the exact AgentCtl and Run-local IPC. Reads and
selective network policy remain ambient/cooperative and are labeled separately
in the Bundle. Native OCI and pVisor VM executors retain the same outer Run,
OverlayFS and AgentCtl state observation.
After completion:
pvisor status --review last
pvisor fork last -- codex
pvisor apply last --all # or: pvisor drop last
fork snapshots the stopped Session's staged filesystem before launching the child.
Pass --checkpoint ID to reuse an existing logical checkpoint. Embedded hosts
can call RunHandle::checkpoint: pVisor publishes an AgentCtl quiesce
directive, requires every Session frozen into the checkpoint to report the
matching quiesced state, snapshots the raw upper, then publishes continue.
Logical checkpoints preserve filesystem and cooperative client safe-point
boundaries, not process memory.
To stop a running Session, use pvisor kill SESSION_ID. It requests graceful termination
from the Session supervisor; check pvisor status SESSION_ID for the final state. A
stopped Session can still be reviewed and applied or dropped.
Apply staged project changes¶
pvisor apply SOURCE [OPTIONS]
pvisor apply last
pvisor apply last --path src --dry-run --diff
pvisor apply last --path src
pvisor apply last --all --exclude 'build/**'
pvisor apply last --include 'src/**' --dry-run --json
SOURCE is required: a Session ID, stage directory, workspace selector such as
last, or a staged-bind instance name/ID (with
--mount when needed). Upper directories and internal stage paths, including paths inside the
upper, are refused as apply sources. Shared status/inspect upper selectors are
unchanged. Apply requires a stopped Session, valid completion evidence and an
apply-capable stage. The default scope is the recorded project; paths and globs
are relative to that scope. Outside-project changes remain staged.
Breaking change: apply --target is removed; writeback cannot be redirected
to an arbitrary directory. Apply also rejects -o and --output-dir; use only
--store for Session lookup. No hidden aliases or compatibility adapter are provided.
The runtime uses SessionService::apply_command with ApplyCommandRequest
and a schema-1 result; the old ApplyRequest and SessionService::apply
entry point are removed.
Selection and output¶
| Argument | Contract |
|---|---|
--path RELATIVE_PATH |
Select this path and descendants; repeatable. |
--include GLOB |
Select paths using git-style globs; repeatable. Quote globs against shell expansion. |
--exclude GLOB |
Exclude matching paths; repeatable. Exclusions take precedence. Alone, requires --interactive. |
--all |
Select every change in the current scope. Allows --exclude; conflicts with --path and --include. |
-i, --interactive |
Open the terminal picker; explicit positive selections preselect matching paths. Conflicts with --dry-run and --json. |
--dry-run |
Read-only preflight: selected changes, required dependencies, blockers and remaining counts. Does not consume staged changes. |
--diff |
Bounded text diffs, skipping binary content. Requires --dry-run; conflicts with --json. |
--json |
One schema-version-1 result object on stdout; requires --path, --include or --all, and never opens a picker. Diagnostics go to stderr. |
--store DIR |
Session lookup storage, default .pvisor/capture. |
--mount GUEST |
Select the exact staged-bind guest target for a container name/ID; optional for one staged bind, required for multiple. |
--rootfs |
Advanced, privileged writeback to the recorded / target; refused for container staged binds. |
Without a selection, the picker opens automatically only when both stdin and
stdout are terminals. It starts with nothing checked. Non-interactive use must
supply a positive selection (--path, --include or --all); exclusions alone
are rejected, even on a terminal unless --interactive is explicit. Positive
selection executes without prompting unless you add --interactive or choose
--dry-run. Empty, absolute and ..-containing selection paths are rejected.
The planner displays explicitly selected changes separately from required
dependencies such as new parent directories or hard-link peers. A dependency
cannot silently cross the project boundary or override an exclusion; such a
selection is blocked. Stop concurrent editors and other target writers before
applying: preimage checks do not provide a multi-file transaction.
Terminal review and read-only preview¶
In the picker, ↑/↓ moves, Space toggles, a selects all eligible paths, n
clears selection, d shows a diff, Enter opens preview, and q cancels.
Excluded paths cannot be checked. In preview, a applies, b returns to the
picker, d shows a diff, and q quits. Execution pins the source and checks the
preview's expected-plan token. If the plan changes, it shows a fresh preview
and requires confirmation again.
--dry-run writes neither the target nor journals, apply ledger or recovery
state. It performs no implicit recovery and creates no target directory or
missing lock files. Preview uses strict read-only observation locks and leases;
preview requires session.lock and the applicable lease files.
The stage command creates them during startup.
Project authority and recorded targets¶
Linux root-filesystem stages record ProjectApplyScope version 1 at launch:
a canonical project root other than /, plus device and inode identity.
The RunRecord and Run Bundle carry this scope, bound by the completion receipt.
Apply revalidates that binding and directory identity; replacing the project
directory, changing the contract, or omitting the binding blocks writeback.
Project apply requires the recorded scope. Ordinary workspace stages use only
their owning overlay's recorded target.
Neither that target nor a rootstage's bound project root can be overridden;
apply never guesses a replacement scope.
This restricted rootstage project path supports regular file additions,
modifications and deletions, plus required new directories. Symlinks, special
files, opaque changes, directory deletion/replacement, existing-directory
metadata changes and project-root changes are unsupported. Non-root apply also
rejects logical file modes without owner-read permission, including write-only
0200, because recovery must reread postimages without first changing target
permissions. New directories must be caller-owned and owner-readable/searchable.
Private backing permissions do not bypass logical metadata validation. These
restrictions do not redefine ordinary workspace apply.
Advanced --rootfs retains its effective-UID-0, same-UID Session-lock and storage
requirements: a root-created stage in canonical root-owned storage with
root-owned, non-group/world-writable ancestors. It does not elevate/import a
user-created stage; /tmp storage is ineligible. Paths then are relative to /.
Non-root project apply on a new contracted rootstage does not authorize rootfs
apply. System writeback is not an atomic OS upgrade or rollback; separately
validate package consistency, services and boot behavior.
Results and failure handling¶
The JSON result has schema_version: 1, operation: "apply", mode
(preview or execute), status, source, scope, selected, required,
blockers, remaining, execution, candidates and plan. Source identifies
the pinned Session/stage/Execution/generation; scope identifies project or rootfs and
the target. plan is an opaque confirmation token, not a CLI option.
remaining.in_scope and remaining.outside_scope are null when unknown, never
invented zeroes. Execution evidence reports apply_id, applied,
ledger_confirmed, recovery_required and error; applied is known only from
confirmed committed intent. Errors before source resolution may have null
source, scope and execution. Parser-level argument errors use CLI diagnostics.
| Exit code | Meaning |
|---|---|
0 |
Ready preview, successful apply, or no matching changes. |
2 |
Invalid arguments or selection/terminal requirements. |
3 |
Blocked preflight, including conflicts, missing authority/locks, unsupported changes or pending apply. |
1 |
Execution or service error. |
130 |
Interactive cancellation. |
An execution with no matching changes prints No matching staged changes and
succeeds without broadening the selection. An empty dry-run is a ready result
with no selected changes. A blocked preflight makes no target changes. A pending
apply is blocked without implicit recovery: preserve the stage, its existing
apply-ledger.json and recovery evidence for inspection and explicit
reconciliation. No new recovery CLI or automatic repair on retry is provided.
An execution error may leave partial target writes; inspect the execution
evidence and reconcile before retrying or dropping the stage. Successful apply
does not run tests automatically; validate your project separately.
Session checkpoint management¶
spawn retains its existing options and defaults. These interfaces support workspace checkpoints for stopped Sessions:
pvisor checkpoint create ./stage/task --request-id before-refactor --json
pvisor checkpoint list ./stage/task --json
pvisor checkpoint show ./stage/task CHECKPOINT_ID --json
pvisor review ./stage/task --checkpoint CHECKPOINT_ID --diff
pvisor inspect ./stage/task --checkpoint CHECKPOINT_ID -- ls
pvisor fork ./stage/task --state workspace --checkpoint CHECKPOINT_ID --stage ./stage/branch -- codex
pvisor checkpoint delete ./stage/task CHECKPOINT_ID --json
pvisor checkpoint gc ./stage/task --json
Checkpoints belong to the selected Session. The default kind is workspace, preserving
the staged upper, preimages, policy and source Execution. Lower layers remain external
path references; this does not save process memory or guarantee that external
lowers remain unchanged. Unique ID prefixes resolve; ambiguous prefixes fail.
Creation requests can be retried with --request-id; a deleted result cannot be
captured again by reusing the same key. Forks retain hard-link references to the
source manifest, requiring parent and child stages on the same filesystem;
deletion is refused while references exist. drop SESSION preserves the Session,
checkpoints and branch references. apply/drop require an explicit Session and records
confirming it has stopped. review JSON distinguishes recorded execution
evidence from the currently selected file view; successful apply/drop advances
the workspace generation.
Reading or forking saved workspace checkpoints requires the source Session lease and refuses a running source.
Full VM execution checkpoints¶
For VMs with native capture support, these commands seal CPU, RAM, devices and filesystem state:
pvisor spawn --executor vm --rootfs /path/to/rootfs --overlaynet off --stage ./stage/task -- /bin/agent
pvisor checkpoint create ./stage/task --kind execution --ram-storage compressed --request-id save-1 --json
pvisor suspend ./stage/task --ram-storage raw --request-id pause-1 --timeout 2m --json
pvisor resume ./stage/task --request-id resume-1
pvisor fork ./stage/task --state execution --checkpoint CHECKPOINT_ID --stage ./stage/branch --request-id branch-1
pvisor checkpoint verify ./stage/task CHECKPOINT_ID --json
pvisor checkpoint gc ./stage/task --kind execution --json
create --kind execution captures and continues the source. suspend succeeds only after publication and confirmed native VM termination; timeout only ends the client's wait and is not termination evidence. Retrying the same --request-id does not repeat capture. resume restores only the current suspended head, retaining the Session ID and creating a new Execution while preserving previous records and Bundles. The original stage remains a selector for the current Execution. Restoration retains the captured guest environment instead of inheriting the shell issuing resume.
Execution forks reject replacement commands. Selecting a historical checkpoint can leave the parent running; without one, a running parent is captured and continued, while a suspended parent supplies its head. The child owns private RAM and filesystem upper layers. --ram-storage raw|compressed applies only to new capture and defaults to compressed. resume and execution fork accept --eager-ram to read all RAM before startup; omission keeps lazy loading.
The current native profile supports Linux x86_64 and macOS ARM64 with no network devices and private RAM. Host root /, networking devices, shared memory pools, writable RAM backing and cold-page compression are outside this restore contract. spawn does not disable networking or DAX or change rootfs to enable capture; status SESSION --json reports capability and blockers. Restore requires the same host boot, pVisor binary and firmware.
When the stage is inside the workspace, capture storage is placed outside guest backing roots and recorded as Session-owned. When necessary, restored file copies also use an independent directory, with their paths retained in the Execution record for review/apply. Capture retains the guest-visible projection, excluding stage management directories already hidden from the guest. Visible content, metadata and hard-link audits remain complete.
Suspended Sessions refuse apply/drop and workspace capture. kill SESSION withdraws continuation rights while retaining checkpoint history, allowing subsequent workspace decisions. Execution checkpoints share list/show/delete entries with workspace checkpoints; deletion checks the suspended head, branch references and storage leases. Branch references are retained conservatively; Session deletion/archiving has no release interface yet. GC collects unpublished transactions, tombstones and unreferenced RAM content in this Session's stores, never published checkpoints. It is not cross-Session store-wide collection and does not clean daemon sandbox state.
Immutable base management uses checkpoint import-base SESSION ROOTFS --json and checkpoint verify-base SESSION BASE_ID --json. Import returns an owned rootfs path usable by subsequent ordinary spawn --rootfs. See Session checkpoint design for implementation and acceptance.
--safe parameter preset¶
pvisor spawn --safe -- claude
pvisor spawn --safe --vm --rootfs image=my-agent-image:latest -- codex
pvisor spawn --safe -- zcode
pvisor spawn --safe --overlaynet-allow inference.example.com:443 -- zcode
--safe generates a command-line argument patch, applies it through the same
CLI parser, and then applies explicit user arguments. The preset matches agents
by executable name and automatically grants the corresponding API's HTTPS
destinations. --safe requires the selected executor to enforce isolation; it
never selects an executor. Precedence is explicit CLI > safe preset >
configuration file > ordinary defaults. It supports ordinary commands and
TOML --config; a prepared JSON --spec rejects the preset.
--safe requires sandbox admission and refuses an ordinary unsandboxed
Host fallback. Linux Host selective egress can remain cooperative, as described below.
It adds no separate sandbox command-line option or configuration setting.
--strict remains a check over all requested capabilities, including resource
limits, and is distinct from this isolation requirement.
- macOS host: Seatbelt installs the requested filesystem controls and limits sockets to the assigned proxy and allowed local IPC. The agent uses a private HOME. Inspect the actual read/write/network observations and validate any paths the task must protect. Executor boundaries
- Linux host:
--saferequires rootless namespaces, a synthetic root, chroot, Landlock and a copy-on-write HOME view. Selective egress and Gateway traffic are forwarded cooperatively through the supervisor loopback proxy, and direct sockets may still bypass it; use a VM or deny-all when a non-bypassable network boundary is required. The launcher projects the host HOME through a private stage; overlay deny rules do not hide secret files at their original paths outside the workspace view. - VM: requires the existing
autonetwork boundary; safe does not select a VM automatically. - container: currently lacks a complete enforcement boundary, so
--saferefuses to start.
Isolation setup failure stops the run. --safe cannot be combined with
--overlaynet off.
The preset grants only the HTTPS destinations (port 443) in the table below; other destinations are denied by default.
| Command | Default destinations |
|---|---|
codex, bash, sh, zsh, fish |
api.openai.com, chatgpt.com, ab.chatgpt.com |
claude |
api.anthropic.com |
gemini |
generativelanguage.googleapis.com |
zcode |
api.z.ai, open.bigmodel.cn |
Unknown commands deny ordinary egress. Set grants explicitly with
--overlaynet-allow HOST:PORT (which replaces the preset list); existing deny
rules and rate limits remain in force, and Gateway capture uses explicitly
configured routes.
Without --safe, Codex state and project writes reach the host lower. With
--safe, the workspace uses the reviewable Run stage and HOME (and an explicitly
set CODEX_HOME) uses a separate private stage. HOME state changes are discarded
when the Run ends and are not part of the workspace Run Bundle.
Independently of --safe, running zcode directly on a Linux rootless host
applies a compatibility policy: it inherits the host environment and allows
direct persistent writes to existing ~/.zcode, $XDG_CONFIG_HOME (or
~/.config) and ~/.local/share/applications. When a bundled Chromium setuid
helper is found, pVisor hides it and adds --no-sandbox; it also adds
--disable-gpu. This path disables Chromium's own sandbox while retaining
pVisor's outer rootless boundary. These application-state writes bypass the
workspace stage, even with --safe. The policy matches the direct executable
name, so shell wrappers do not trigger it. The zcode-bigmodel Gateway profile
is a separate routing adapter.
The typed preset clears configured run.pass_env internally;
--clear-pass-env also works on its own, and an explicit --pass-env NAME
afterward still applies. Direct Codex commands keep host environment inheritance
to preserve account and routing configuration; other commands disable
inheritance by default and receive credentials through an explicit
--pass-env NAME. Explicit CLI options can re-grant or override this. --safe
stages the workspace by default; existing container mounts and filesystem lower
layers are retained, and the project base, rootfs and executor are unchanged.
Deliver credentials to the Agent with an explicit --pass-env, or let a
configured Gateway hold the upstream key on the trusted side.
Startup prints the effective policy and override notices:
- Without
--safe, host/container selective proxies remain bypassable. - Hostname rules cannot distinguish inference, telemetry and upload APIs under the same hostname, or prevent content smuggled inside model requests.
- Wildcard rules cover the OverlayFS view; on Linux the projected HOME may still expose sensitive files at their original paths, and explicitly granted extra paths need their own protection. Filename rules cannot recognize renamed copies, secrets in source code or content in Git history, and there is no bulk-read or tool-call attribution monitoring.
- Expanding the share scope or choosing
--rootfs hostincreases the accessible data;--safecannot be combined with disabling OverlayNet.
File access rules¶
pvisor spawn --safe --mount /opt/tool:read --access '**/.ssh:deny' --access '**/.env*:warn' -- my-agent
--mount SOURCE:read|write is a host executor's explicit share, granting
read-only or persistent write access respectively; a read-only share requires
--safe. --mount SOURCE[:TARGET]:stage composes a lower layer of
the workspace view.
--access PATH-GLOB:deny|warn appends file rules and does not replace the
default protections; only --clear-access clears them explicitly.
warn only warns and is not read-only; file rules cover inspection,
reading, modification and deletion within the view.
Rules match relative to the mount root: * does not cross directories, ** may
cross directories, and matching a directory covers all of its descendants.
To prevent alias bypasses on case-insensitive filesystems, matching is
case-insensitive; absolute paths, empty rules and ./.. path components are
invalid. deny takes precedence over warn. A path that matches deny is hidden
from directory enumeration, and access, creation and modification are refused;
warn allows access and prints the path to the supervisor's stderr without
printing file contents. A warning indicates a filesystem access execution
(including metadata access), not an exact count of content reads; kernel caching
may coalesce accesses.
The default --safe deny covers .ssh and .gnupg directories at any level
and the files id_rsa, id_dsa, id_ecdsa, id_ecdsa_sk, id_ed25519 and
id_ed25519_sk. The default warn covers .env, .env.*, *.pem, *.key,
*.pub, *.p12, *.pfx, .aws/credentials, .netrc and .npmrc. Public
keys inside .ssh are hidden with the directory; public keys outside only warn.
This does not identify every private key; add rules for custom file names.
In TOML:
[overlayfs]
stage = "../stage-001"
mount = [{ source = "/opt/tool", access = "stage" }]
access = [
{ path = "**/.ssh", level = "deny" },
{ path = "**/.env", level = "warn" },
]
Explicit CLI access rules are appended after configuration and safe presets; deny takes precedence over warn. Rules are stored with the Run and overlay records.
FUSE and VM virtio-fs share the rule checks. With deny enabled, this version conservatively refuses all multiply-linked regular files and new hard links to prevent alias reads; ordinary directory renames, exchanges and deletions check the affected subtree and refuse the operation when it includes a protected file. Symlinks are resolved by the mount namespace, and file opens do not follow a final symlink to the raw backing file. The VM applies rules to the root view as well and protects the workspace's original paths and the overlay backing directories. This does not replace executor isolation: host environment reads, extra container shares and credentials outside this view still require separate controls. Backing directories should be managed by a trusted supervisor; the rules do not promise to resist races from other host processes concurrently rewriting backing files.
Replay an Agent trajectory¶
pvisor replay assumes the caller has normally created a fresh sandbox. It
replays complete tool batches through after_step, rebuilds the selected
Agent native context with fresh observations, then starts the live Agent:
pvisor replay \
--agent claude-code \
--trajectory /input/session.jsonl \
--after-step 30 \
--agent-entrypoint /usr/bin/claude \
--boundary-user-prompt 'Review the fresh observation before continuing.'
OpenHands, mini-swe-agent, Pi agent, OpenCode, Codex and SWE-agent use the model
endpoint and credentials already present in their environment. Pi requires the
exact 0.83.0 runtime and accepts native RPC event JSONL containing the core
read, bash, edit and write tools. Claude Code uses a temporary bridge
owned by SandboxReplay because its native resume transport inserts wake-up
messages. The bridge validates and removes that exact Resume Transport envelope
before forwarding the model request. It does not enable pVisor Gateway, capture
model traffic or persist a bridge audit. Continuation requires Claude Code
2.1.119, 2.1.154 or newer 2.1.x; older builds, other version lines, or
builds that do not emit the expected resume nonce envelope fail closed before
the first upstream request. Repository tests cover the legacy attachment set
(skill_listing without names, string and object todo/task reminders) and both
native resume envelopes with and without the continue event; the version gate
covers 2.1.119, 2.1.154, 2.1.201, 2.1.220 and 2.1.299. Additional real-binary
spot checks covered 2.1.170, 2.1.190, 2.1.198, 2.1.210 and 2.1.267. Other 2.1.x builds are accepted but can still fail closed during
continuation-session cleanup after prefix tools have run if they introduce an
unknown envelope event or attachment. Claude converts accepted native
attachments into <system-reminder> text before the bridge sees the request;
pVisor removes the structured attachment events during native cleanup. A nonce
message may only carry <system-reminder> text beside the nonce; a build that
merges an attachment as bare text or a non-text block fails closed before the
first upstream request.
OpenCode requires the exact 1.17.7 runtime and its native
opencode run --format=json event JSONL; Codex requires the exact 0.149.0
runtime and Codex rollout response_item JSONL. Both rebuild the native prefix
in the fresh sandbox and invoke their native resume command for continuation.
Codex derives its native session ID from the trajectory's session_meta; the
request session_id is only a model-router/Run key and cannot override the
native session. When the native session is missing, continuation fails closed.
The equivalent strict replay TOML is:
[replay]
agent = "claude-code"
trajectory = "/input/session.jsonl"
after_step = 30
agent_entrypoint = "/usr/bin/claude"
max_steps = 200
session_id = "task-291-execution-1"
replay_only = false
disable_thinking = true
boundary_user_prompt = "Review the fresh observation before continuing."
Pi uses the same CLI/TOML surface. When the runtime is installed at
/opt/pi-agent, for example:
pvisor replay --agent pi-agent \
--trajectory /input/pi-agent.events.jsonl \
--after-step 30 \
--agent-entrypoint /opt/pi-agent/bin/pi
Replay has three modes. The default replays the prefix and continues;
--replay-only executes the prefix and stops before a model request; and
--prepare-only constructs the prefix without executing tools or requiring a
runtime. --max-steps is the total action budget, including replayed actions:
--after-step 30 --max-steps 50 leaves at most 20 continuation actions;
replay-only's budget must cover the prefix, and continuation must also leave at
least one live action.
--allow-stale-observations is an explicit Claude-only escape hatch. The
recorded prefix may contain Agent, TaskCreate, TaskGet, TaskList,
TaskOutput, TaskStop, TaskUpdate, TodoWrite, WebFetch and WebSearch.
Those calls reuse the source observation without execution; each reused
observation is recorded as stale in observation-comparison.json and
replay-events.jsonl, and the v3 result becomes degraded. The reason is
stale_source_observation for read-only/absent operations, stale_task_state
for task/todo state mutations (TaskCreate, TaskStop, TaskUpdate,
TodoWrite), and stale_agent_side_effects for non-Explore Agent calls,
whose side effects are not reproduced. Fresh tools (Bash, Edit, Glob, Grep, MultiEdit,
Read, Write) are re-executed. Every other tool name and Bash with
run_in_background remain rejected before execution. prepare_only accepts
the stale set without executing any tool.
--boundary-user-prompt TEXT appends one user message after the boundary
observation and before live model inference. The TOML spelling is
replay.boundary_user_prompt. pVisor writes the prompt into the native session
used for Claude resume as a boundary user event, and the bridge re-inserts it
after the boundary observation in every model request so the continuation keeps
a continuous model history. Structured results record one logical injection;
native/reconstructed-prefix.jsonl remains boundary-only, while
native/continued-session.jsonl contains the prompt event. A boundary prompt
marker on the replay prefix (active chain) cannot be reused as a new source
prefix in any mode, including prepare-only and replay-only; use the original
trajectory or select a boundary before the marker. Without a configured prompt
the replay boundary is used unchanged. Structured results and replay journals store only injection state,
length and a digest; Agent-native prepared or continued trajectories may
contain the user message. With a prompt configured, the input condition in
next-action-comparison.json is boundary_user_prompt_appended; text
similarity and tool agreement are then observational only and cannot be read
as replay fidelity under identical input.
The result schema is sandbox-playback.result/v3: phase is prepared,
replayed or continued; quality is verified or degraded;
agent_status distinguishes not_started, completed, max_steps and
failed, plus state/output locations, artifacts and an optional structured
failure. For Claude, agent.version reports the detected executable version
when a runtime is resolved; prepare-only records the profile version. The native
format is claude-code/native-jsonl-2.1.220 and the profile identifier is
claude-code/2.1.220/native-resume-v1. Failed results keep the logs and native
trajectory already produced;
even when the OpenHands process exits 0, the result is still a failure if the
controller reports a fatal status. Non-Claude callers use prepare_only = true
to construct a prefix without executing replay.
disable_thinking belongs to [replay] and is also exposed as
--disable-thinking. Claude Code's protocol bridge applies it to the upstream
request; OpenCode omits its --thinking flag when it is set. It does not turn
on Gateway capture. Optional [run], [overlayfs] and [overlaynet] sections
create an outer managed pvisor spawn; they do not change the inner replay model
path. Replay's filesystem parameters are governed by pvisor replay --help;
do not copy spawn's --stage/--mount grammar directly.
By default, replay's internal state, WAL, manifest, fresh-observation
comparisons and native working files remain under
/tmp/pvisor-sandbox-replay and disappear with the sandbox. Replay does not
enable pVisor Gateway, a model-traffic capture store or a Claude Resume
Transport audit. A caller that explicitly selects --state-dir or
--output-dir owns those files. Use --replay-only to execute the prefix and
stop before live inference, or --prepare-only to construct it without
execution.
One configuration model¶
pvisor spawn has one canonical RunConfig. The CLI covers its common fields,
but run.inherit_env currently has no direct CLI switch. Moreover,
apply_safe_defaults currently clears environment inheritance for non-Codex
CLI commands even without --safe; the ZCode host adapter re-enables it for
direct zcode. Treat TOML inherit_env as ineffective on those CLI paths.
--config reads an explicit TOML RunConfig; --spec requires a prepared
JSON RunSpec for delegated execution and cannot be combined with other Run
overrides. pVisor does not discover a hidden project configuration file.
pvisor spawn \
--name my-agent \
--stage ../stage-001 \
--mount /opt/tool:stage \
--access '**/.ssh:deny' \
--overlaynet-allow api.openai.com:443 \
--overlaynet-deny 169.254.0.0/16 \
--overlaynet-limit 10mbps \
--gateway-mode capture \
--gateway-level dialogue \
--gateway-route \
'name="openai", provider="openai", upstream="https://api.openai.com/v1", api_key_env="OPENAI_API_KEY"' \
--record-destination ./capture \
-- my-agent
--record-destination writes a local pvisor_core::event::Event Journal to
events.trace.jsonl. Journal positions define
append order and caused_by defines causal links; observed_at_unix_ms is
observation metadata, not an ordering source of truth.
The equivalent TOML is:
# host(默认)或 sandbox;与 OverlayNet 和 OverlayFS 暂存相互独立
filesystem = "host"
[run]
agent = "my-agent"
executor = "host"
command = ["my-agent"]
[overlayfs]
stage = "../stage-001"
mount = [{ source = "/opt/tool", access = "stage" }]
access = [{ path = "**/.ssh", level = "deny" }]
[overlaynet]
mode = "proxy"
policy = "allowlist"
[[overlaynet.rules]]
host = "api.openai.com"
ports = [443]
[[overlaynet.deny]]
host = "169.254.0.0/16"
[[overlaynet.limits]]
bytes_per_second = 1250000
[gateway]
mode = "capture"
level = "dialogue"
[[gateway.routes]]
name = "openai"
provider = "openai"
upstream = "https://api.openai.com/v1"
api_key_env = "OPENAI_API_KEY"
[record]
destination = "./capture"
Run it with pvisor spawn --config run.toml. Explicit CLI scalars replace TOML
scalars. Network and Gateway list options replace their complete configured
lists; filesystem --mount and --access entries are appended to configured
entries. The serialized [overlayfs] fields stage, mount, access and
max_size map to --stage, --mount, --access and
--overlayfs-max-size. The command after -- replaces run.command.
The size limit is checked after execution, so it does not bound peak space used
while the Agent is running.
--container-image IMAGE selects the native OCI container executor
automatically; --executor container makes the choice explicit. pVisor
prepares an OCI bundle whose process.args runs the workload directly.
The host Session owns the result and provides the OverlayFS workspace and
Gateway configuration without running pVisor inside the container.
--container-rootfs PATH supplies an existing rootfs directly; otherwise pVisor
prepares --container-image from its bundled OCI image store. The runtime
defaults to runc; --container-runtime can select crun. User mounts are
repeatable TOML inline tables, for example:
pvisor spawn \
--container-image example/codex-agent:latest \
--container-platform linux/amd64 \
--container-network none \
--container-mount \
'source="/host/cache", target="/cache", read_only=false' \
-- codex
The example above assumes Linux x86_64. --container-platform linux/amd64
or linux/arm64 asserts the native host architecture; a matching value is
accepted and a cross-architecture value is rejected, even with a prepared
--container-rootfs. Host and VM configurations reject this option. It does
not select emulation. The legacy --container-pvisor-binary is accepted but ignored.
See container setup and
configuration values.
The in-process Gateway and explicit OverlayNet proxy currently require
container.network = "host", because their injected addresses are host loopback
endpoints. none mode is valid when these drivers are off; bridge requires
external CNI configuration and is currently rejected. The executor records
container isolation but does not claim complete capability enforcement.
--executor vm uses statically linked pvisor-vm and its embedded init to boot a
minimal Linux guest. --vm-ram-backing FILE ([vm].ram_backing) creates a new
private file backing live RAM. In ordinary file-backed mode, omitting it creates
an execution-local file in the user cache, deleted on normal exit; the cold pager
below instead uses anonymous RAM without a live backing file. --vm-ram-compression
([vm].ram_compression = true) selects the PVZRAM v2 manifest and immutable
Zstd Seekable base/delta sidecar files
at startup, requiring Linux FUSE or the macFUSE kernel backend.
Use the live VM options below or Rust RunHandle::pause/resume/offload to control
the live VM. A new offload destination must be on the backing's existing filesystem.
Reclaim reports sampled residency, not guaranteed zero RAM. The file is not a
complete VM snapshot. Existing storage/control tests and compressed artifacts
establish limited implementation evidence, not end-to-end guest correctness or
production memory savings. Compressed exit still does not commit a new generation:
writes after the last resume may be discarded, leaving only the last committed head.
VM memory and control options¶
| Run option | TOML field under [vm] |
Default / purpose |
|---|---|---|
--vm-control-socket PATH |
control_socket |
Unset: owner uses /tmp/pvisor-host-<effective-UID>/sessions/<session-id>/<execution-id>/control.sock (canonical /tmp) |
--vm-ram-backing FILE |
ram_backing |
Unset: execution-local backing in ordinary file-backed mode; new files only |
--vm-ram-compression[=BOOL] |
ram_compression |
false; FUSE/macFUSE Seekable backing |
--vm-cold-ram-compression[=BOOL] |
cold_ram_compression |
false; Linux x86_64 local live cold pager |
--vm-ram-dedup[=BOOL] |
ram_dedup |
false; best-effort host dedup advice |
--vm-memory-pool SOCKET |
memory_pool |
Unset: external pool; Linux physical sharing or sealed compression (the latter requires userfaultfd) |
--vm-node-socket SOCKET |
node_socket |
Unset: same-host node resource service for immutable images/restored RAM |
--vm-snapshot-filesystem-pool DIR |
snapshot_filesystem_pool |
Unset: owned copies; optional host-owned immutable lower pool for Linux x86_64 no-network native checkpoints |
The three boolean options accept a bare flag (meaning true), =true or
=false; a separate false argument is not the boolean grammar. Omission
preserves the configured value, including true. For example, override dedup
without clearing other settings:
A true boolean or one of these explicit path options selects VM execution when
--executor is omitted; =false alone does not select VM. An explicit executor
is not silently replaced. Non-VM execution does not support live VM controls;
a configured control socket with an explicit host/container executor is rejected.
Path options replace only their matching field and leave omitted paths intact.
The local cold pager combines reclaim and instance-local compression in one
option; there are no separate cold-reclaim and local-compression toggles. It
conflicts with backing/FUSE compression, dedup, external pools, snapshot
capture/restore, the snapshot filesystem pool and whole-VM offload. Dedup
conflicts with either compression mode and external pools. These conflicts are
checked after config/CLI merging, so use explicit =false overrides as needed.
The filesystem pool must be host-owned, outside VM-writable roots and snapshot
stores, and on the Session's volume; setting a node socket does not grant transparent
recovery if the service fails.
Live VM Execution controls¶
Normal controls read the canonical private owner address from the Session record:
pvisor status last --json
pvisor suspend last --vm-pause
pvisor resume last
pvisor suspend last --vm-offload --vm-ram-file /private/vm-ram/offloaded.ram
pvisor resume last --vm-load
status reports Session state. suspend --vm-pause pauses vCPUs;
--vm-offload uses stronger CPU/device quiescence and optionally writes a
host-only RAM file on the same filesystem. Pause and offload conflict;
--vm-ram-file requires offload. Live resume, including --vm-load, continues
the same Execution without restoring a snapshot. Ordinary suspend captures an
execution checkpoint and stops the Execution. Stopped resume restores that sealed
checkpoint. Live transition replies contain JSON status and value.
--vm-socket PATH is a debug override, requiring --vm-session-id ID and
--vm-execution-id ID; any positional selector must match the explicit Session ID.
These flags are command-local on status/suspend/resume. --vm-control-socket
chooses the path at VM creation. Both CLI and embedded custom endpoints must be
inside canonical /tmp/pvisor-host-<UID> (usually /private/tmp on macOS), with
same-UID non-symlink 0700 ancestors and a 0600 socket. Existing sockets are
never overwritten. Default paths use sessions/<session-id>/<execution-id>/control.sock;
the terminal owner removes discovery when the Execution ends. Executors exclude
the whole authority root from Guest access. These are host records, not guest
discovery files. For the debug override's cancellation behavior, see
owner control limits and the owner protocol for framing.
VM local live cold compression¶
--vm-cold-ram-compression sets [vm].cold_ram_compression = true and selects
VM execution on Linux x86_64. The default is false; omitting the flag preserves
a configured value. The runner automatically starts an experimental userfaultfd
pager over private anonymous RAM with bounded instance-local LocalColdRamStore.
It needs neither FUSE nor a pool and is not --vm-ram-compression.
Kernel-fault userfaultfd syscall or /dev/userfaultfd permission is required;
compiled support is not authorization. Missing permission fails startup without
fallback, and pVisor changes no global sysctl. See local compression
for a user-specific ACL grant/revoke example and restricted mappings/build features.
It rejects vm.ram_backing, vm.ram_compression, vm.ram_dedup,
vm.snapshot_filesystem_pool, snapshot capture/restore and whole-VM offload.
Linux external vm.memory_pool negotiates physical sharing (private COW mappings,
no userfaultfd) or sealed compressed objects (local decode, kernel-fault userfaultfd). It requires private anonymous RAM and is mutually
exclusive with instance-local compression. Guest execution continues between short capture/recheck windows
without application participation: this is eviction/refault probing, not ordinary
pause or a true read-access heat detector. No production-density gain is promised.
VM RAM dedup advice¶
--vm-ram-dedup sets [vm].ram_dedup = true and selects the VM executor. The default is false; omitting the flag preserves a configured value. This is an explicit opt-in to cross-workload content-sharing risks, not a promise of savings. It cannot be combined with --vm-memory-pool / vm.memory_pool, --vm-ram-compression / vm.ram_compression, --vm-cold-ram-compression / vm.cold_ram_compression, or PVISOR_EXPERIMENTAL_MEMORY_POOL.
On Linux, a fresh VM with dedup enabled and no explicit vm.ram_backing uses private anonymous RAM eligible for KSM. This path does not support whole-VM offload. Explicit writable RAM backing keeps shared mappings and skips dedup advice.
The runner calls handle.advise_ram_dedup() explicitly and writes a best-effort installation report to stderr; advice failure does not stop execution. Linux advice covers ordinary private anonymous RAM and restored private COW mappings. Live MAP_SHARED RAM is skipped without mapping conversion; macOS reports unsupported for otherwise eligible mappings. accepted_bytes means advice was accepted for those ranges, not merged bytes, savings or an enabled KSM scanner. No global KSM settings change and no new service is required. See current integration and evidence for eligibility, snapshot ownership and validation limits.
VM availability preflight¶
This source-build command returns schema version 1 with operation: "vm-check",
platform, architecture, backend, can_create_vm, reason, firmware,
boot_verified and scope. Linux opens /dev/kvm, requires KVM API 12 and
creates/closes an empty VM. Apple Silicon attempts HVF VM creation/destruction.
It never changes device permissions or boots a guest.
Firmware is embedded, bundled_unloaded, missing or unsupported.
Discovery does not load bundled firmware; boot_verified is always false.
Rootfs, guest tools, staging and lifecycle capabilities require separate checks.
Reporting unavailable virtualization is a successful query (exit 0); inspect
the JSON fields rather than the exit code alone. Plugin default/fallback
authorization is defined in the plugin policy.
VM rootfs and executor boundaries¶
--rootfs image=IMAGE selects this executor and pulls an
OCI/Docker image directly, without invoking Docker, Podman or Buildah. When no
explicit rootfs or image is supplied, Linux uses the host / through virtiofs
and OverlayFS by default, preserving the host runtime, PATH and HOME without
pulling an image. On macOS, supply a Linux rootfs or image explicitly.
Manifests and layer digests are verified, the host architecture selects
linux/arm64 or linux/amd64, and the unpacked rootfs becomes the shared
lower layer of a pVisor OverlayFS. --image-store overrides the platform cache
directory. OCI cache targets are marked immutable, and this protection survives
logical checkpoint/fork, so pvisor apply cannot mutate a rootfs shared by
other Runs.
On Linux, --rootfs host selects the host / as the VM rootfs lower and
selects the VM executor when --executor is omitted. --rootfs <PATH> uses a
prepared directory and --rootfs image=<PATH> uses an OCI image or image path;
the three are mutually exclusive, and host rootfs is rejected on macOS. This is
the unified rootfs syntax; --mount SOURCE[:TARGET]:stage composes extra lower
layers for the guest workspace, and the current workspace is the implicit bottom
layer. Read/write explicit host shares are currently supported only by the host
executor. Workspace changes enter the named stage or default Session storage and are
retained after exit; other writes to the VM root use a temporary upper and are
discarded when the VM exits.
The merged rootfs is guest /, and /workspace becomes the guest cwd. On both
Linux and macOS, pvisor-vm serves pVisor's rootfs and workspace
copy-on-write unions directly over virtio-fs. The VMM never re-exports a host
FUSE mount and does not materialize or reconcile either tree. Linux uses KVM and
Apple Silicon macOS uses HVF through the same executor. Linux static musl and
macOS ARM64 product builds embed the compressed guest kernel, require no firmware
shared library at runtime. Linux static builds reject --vm-library-dir;
macOS product builds use the embedded kernel regardless of that directory. Source builds prepare the repository-maintained firmware through
mise run build or mise run fw -- build. Runtime resolution only uses local
firmware and fails when it is missing; it neither downloads nor compiles it.
For standalone macOS Cargo builds without a build-time kernel input, --vm-library-dir selects an existing firmware directory. OverlayNet auto uses the non-bypassable VM smoltcp IPv4
TCP/DNS driver, while Gateway capture uses an internal route through the guest
virtual router. Linux additionally confines the VMM with namespaces and
Landlock. The macOS VMM still has the invoking user's host permissions, so
despite the guest-kernel isolation the first OCI-image version must not be
treated as a hostile multi-tenant boundary.
On host/container execution, the four visible OverlayNet policy flags and
Gateway capture automatically enable the proxy driver. --safe stages the
workspace by default and --mount adds explicit lower layers; see
Staging and storage for write destinations. When a stage is nested
inside a base or compose layer, pVisor hides that subtree from the merged view
and rejects guest tries to recreate it. VM Runs create no live host
mountpoint, preventing host indexers from recursively entering <stage>/merged.
The reverse topology, where a stage contains a lower layer, is rejected. Until
pVisor can safely materialize a complete merged-vs-base diff, a composed Run
rejects a subsequent pvisor apply. Selective host/container network rules
apply to traffic through the explicit proxy. Host deny-all uses a namespace or
Seatbelt to block direct egress; containers can use --container-network none
for offline execution. On a pVisor VM, auto uses smoltcp IPv4 TCP/DNS and
off leaves the guest offline; deny-all still permits configured internal
Gateway routes. See network boundaries for the
scope of each path.
Use a sealed rootfs¶
Prepare a quiescent, independent Linux rootfs in a private store using the
Rust SDK's SnapshotStore::prepare_rootfs. Set BASE_ID to the returned
base's reference().id. Keep the store outside the workspace,
stage, every guest-visible path and writable VM backing/control paths.
Initial preparation copies and verifies contents and metadata, then commits a persistent pin. Later ordinary CLI runs have the Session owner authenticate the object, acquire a lifetime lease and attach the Immutable physical lower without sealing it again. The workspace remains live by default; an explicit sealed workspace can select a fixed generation.
--rootfs-base-store and --rootfs-base must be supplied together. They conflict
with --rootfs and OCI image sources; explicit host/container executors and JSON
--spec reject them. TOML uses vm.prepared_rootfs.store and
vm.prepared_rootfs.base.id with explicit [run] executor = "vm". A recorded
vm.rootfs must match the authenticated result. The store pin survives process
exit and GC; there is currently no prepared-entry removal API. External store
edits are unsupported. This source currently rejects execution checkpoint
capture/restore; workspace logical checkpoints remain independent.
Apply protection on ordinary directories, OCI or lazy projections does not
grant this physical ownership.
On Linux x86_64, a fresh native launch with an authenticated prepared rootfs
automatically requests read-only FLUSH elimination for that native child when
the host environment omits PVISOR_VM_FS_READONLY_FLUSH_ELISION; an explicit
0 preserves the original behavior. The guest must negotiate support, and only
eligible local Immutable read-only fds skip backend FLUSH. Older guests and
ineligible fds retain the original FLUSH. SDK calls without a selected and
authenticated prepared rootfs (including calls supplying only a with_rootfs_base
owner), and macOS retain their previous behavior when the variable is absent. This
FLUSH default does not enable negative caching, WB or DAX.
Use a sealed workspace¶
Prepare a quiescent project in a separate private store using the Rust SDK's
SnapshotStore::prepare_workspace, then run from the live project directory.
Set WORKSPACE_ID to the returned base's reference().id and ROOTFS_ID to
the prepared rootfs ID.
cd /srv/project
pvisor spawn --vm --rootfs-base-store /srv/pvisor-bases --rootfs-base ROOTFS_ID \
--workspace-base-store /srv/pvisor-workspace-bases --workspace-base WORKSPACE_ID \
--stage /srv/pvisor-stages/review-1 -- /bin/sh
Initial preparation copies and verifies contents and metadata. A persistent pin survives process exit and GC; later Session owners authenticate the workspace catalog again and acquire a lifetime lease without sealing the source again.
Reads use the selected fixed generation; subsequent host project edits do not
enter the current Run's snapshot read view. Writes enter a fresh stage. Ordinary
pvisor apply still targets the original live project, checking the snapshot
baseline for selected written paths and retaining conflicts. This does not
provide serializable transaction checks over every read path. apply --target
is removed globally, including for prepared workspaces; writeback uses the
recorded target.
Supply both workspace arguments together. They require prepared rootfs, a
native VM, a fresh stage and one workspace lower. TOML uses
overlayfs.prepared_workspace.store and overlayfs.prepared_workspace.base.id.
Explicit host/container executors, JSON --spec, compose, logical workspace
checkpoint fork/restore and execution checkpoint capture/restore are rejected.
Creating and reading workspace checkpoints remain independently available.
Keep the two stores independent of each other
and outside the project, stage, guest-visible paths and writable VM
backing/control paths. External store edits are unsupported. This entry inherits
the scoped prepared-rootfs read-only FLUSH default.
Linux-hosted Rust native guests reuse eligible immutable lower file data even
without sealing the whole workspace. This does not enable negative caching, WB or DAX. Set
PVISOR_VM_FS_READONLY_FLUSH_ELISION=0 to preserve the original FLUSH.
Run project discovery¶
The current directory is the default project association. --mount identifies
additional host lower layers and, optionally, their Agent-visible paths. Each
Run receives an independent directory under pVisor's default records root. If
that root would fall inside the selected OverlayFS base or a compose layer,
pVisor instead uses the system temporary Run root to keep the writable stage
disjoint:
project/ # reusable workspace / default base
~/.pvisor/runs/
└── run-<uuid>/ # one generated Run and default stage
├── run.json
├── run-bundle.json # mode 0600; outcome + safety + changes + effects
├── overlay.json # when OverlayFS is enabled
├── upper/
├── merged/
├── checkpoints/
├── lease.lock
├── control.sock # while a live OverlayFS Run is available
├── .capture/ # when OverlayNet/Gateway is enabled
└── events.trace.jsonl # when --record-destination is set
Shared lifecycle selectors used by status and inspect accept a Run id,
Run directory, project workspace, run.json, upper, or merged path. apply
accepts only a Session ID, stage directory or workspace selector (including last),
not upper or internal stage paths. A project workspace selects its latest Run;
apply writes to that Run's recorded target or bound project scope, never an
override. --store selects lookup storage, not the writeback destination:
pvisor status /path/to/project
pvisor inspect /path/to/project -- rg TODO .
pvisor apply /path/to/project --all
pvisor apply /path/to/project --path src --path tests/unit
pvisor apply /path/to/project --include 'docs/**' --exclude 'docs/generated/**'
pvisor apply /path/to/project --store /path/to/run-store --all --exclude 'build/**'
pvisor drop /path/to/project
inspect creates a separate kernel-read-only view. apply and drop refuse
to mutate a live Run. A filtered apply is dependency-closed and repeatable:
unselected paths remain staged, while opaque directories and hard-link groups
remain atomic. Each successful batch is persisted in apply-ledger.json.
The overlay records a durable first-touch fingerprint for every mutated target
path. apply fails closed if a selected target path changed after staging;
prepared batches recover forward, and individual non-directory replacements
commit with a same-directory atomic rename. The host filesystem still provides
no single atomic commit point for an arbitrary multi-file batch.
Applying all remaining changes or dropping the stage is terminal; drop cannot
undo already applied batches, and apply cannot recover discarded changes.
Terminal cleanup removes upper, work and other disposable staging data but
retains compact Run/Overlay metadata, the apply ledger and capture artifacts.
Shared image file cache¶
pvisor-daemon serve --cache serves OCI image files on a Unix socket at
pvisor/cache.sock in the user cache directory by default. Use
--cache-image-store DIR for an existing OCI store. The Rust cache client uses
PVISOR_CACHE_SERVER and verifies bounded reads with SHA-256. Publish portable
images with pvisor push --to.
Sandbox serving automatically reclaims its prepared image store at startup and
every six hours. --images-max-bytes N sets a soft target; prepared templates
are always roots. GET /v1/image-metrics with the lifecycle API key returns
pool, GC and optional cache-worker counters for controllers.
VM image runs automatically probe the default socket; when the service is
available they attach the remote image directly to the virtio-fs service as a
read-only lower without an intermediate host FUSE mount, fetch 1 MiB blocks on
demand, and cache them persistently. A missing or stale default socket
falls back to local OCI preparation. An explicitly configured server must work;
PVISOR_CACHE_SERVER=off forces local preparation. Explicit rootfs directories
and the native container executor keep their current behavior. See the
shared image cache protocol for the full protocol,
limits and SSH remote access.
Enable the daemon-owned experimental pool with pvisor-daemon serve --sandbox --memory-pool; its detached memory-pool --directory DIR component uses daemon-provisioned private configuration. Native pvisor spawn --vm-memory-pool SOCKET remains an explicit runtime option with platform/protocol limits, not a service launcher.
Physical/legacy pool loss fails dependent VMs; Linux sealed-compressed clients retain local recovery and stop new publication. Select it with daemon --memory-pool-mode compressed. See daemon pool activation and budgets; historical macOS compressed-pool results retain their version scope.