| name | openshell-cli |
|---|---|
| description | Guide agents through using the OpenShell CLI (openshell) for sandbox management, provider configuration, policy iteration, BYOC workflows, and inference routing. Covers basic through advanced multi-step workflows. Trigger keywords - openshell, sandbox create, sandbox connect, logs, provider create, policy set, policy get, image push, forward, port forward, BYOC, bring your own container, use openshell, run openshell, CLI usage, manage sandbox, manage provider, gateway start, gateway select. |
Guide agents through using the openshell CLI for sandbox and platform management -- from basic operations to advanced multi-step workflows.
The OpenShell CLI (openshell) is the primary interface for managing sandboxes, providers, policies, inference routes, and gateways. This skill teaches agents how to orchestrate CLI commands for common and complex workflows.
Companion skill: For creating or modifying sandbox policy YAML content (network rules, L7 inspection, access presets), use the generate-sandbox-policy skill. This skill covers the CLI commands for the policy lifecycle; generate-sandbox-policy covers policy content authoring.
Self-teaching: The CLI has comprehensive built-in help. When you encounter a command or option not covered in this skill, walk the help tree:
openshell --help # Top-level commands
openshell <group> --help # Subcommands in a group
openshell <group> <cmd> --help # Flags for a specific commandThis is your primary fallback. Use it freely -- the CLI's help output is authoritative and always up-to-date.
openshellis on the PATH (install viacargo install --path crates/openshell-cli)- Docker is running (required for gateway operations and BYOC)
- For remote clusters: SSH access to the target host
See cli-reference.md for the full command tree with all flags and options. Use it as a quick-reference to avoid round-tripping through --help for common commands.
Use this workflow when no cluster exists yet and the user wants to get a sandbox running for the first time.
openshell gateway startThis provisions a local k3s cluster in Docker. The CLI will prompt interactively if a cluster already exists. The cluster is automatically set as the active gateway.
For remote deployment:
openshell gateway start --remote user@host --ssh-key ~/.ssh/id_rsaopenshell statusConfirm the cluster is reachable and shows a version.
The simplest way to get a sandbox running:
openshell sandbox createThis creates a sandbox with defaults and drops you into an interactive shell. The CLI auto-bootstraps a cluster if none exists.
Shortcut for known tools: When the trailing command is a recognized tool, the CLI auto-creates the required provider from local credentials:
openshell sandbox create -- claude # Auto-creates claude provider
openshell sandbox create -- codex # Auto-creates codex providerThe agent will be prompted interactively if credentials are missing.
Exit the sandbox shell (exit or Ctrl-D), then:
openshell sandbox delete <name>Providers supply credentials to sandboxes (API keys, tokens, etc.). Manage them before creating sandboxes that need them.
Supported types: claude, opencode, codex, generic, nvidia, gitlab, github, outlook.
openshell provider create --name my-github --type github --from-existingThe --from-existing flag discovers credentials from local state (e.g., gh auth tokens, Claude config files).
openshell provider create --name my-api --type generic \
--credential API_KEY=sk-abc123 \
--config base_url=https://api.example.comBare KEY (without =VALUE) reads the value from the environment variable of that name:
openshell provider create --name my-api --type generic --credential API_KEYopenshell provider list
openshell provider get my-github
openshell provider update my-github --type github --from-existing
openshell provider delete my-githubopenshell sandbox create \
--name my-sandbox \
--provider my-github \
--provider my-claude \
--policy ./my-policy.yaml \
--upload .:/sandbox \
-- claudeKey flags:
--provider: Attach one or more providers (repeatable)--policy: Custom policy YAML (otherwise uses built-in default orOPENSHELL_SANDBOX_POLICYenv var)--upload <PATH>[:<DEST>]: Upload local files into the sandbox (default dest:/sandbox)--no-keep: Delete the sandbox after the initial command or shell exits--forward <PORT>: Forward a local port and keep the sandbox alive
openshell sandbox list
openshell sandbox get my-sandboxopenshell sandbox connect my-sandboxOpens an interactive SSH shell. To configure VS Code Remote-SSH:
openshell sandbox ssh-config my-sandbox >> ~/.ssh/config# Upload local files to sandbox
openshell sandbox upload my-sandbox ./src /sandbox/src
# Download files from sandbox
openshell sandbox download my-sandbox /sandbox/output ./local-output# Recent logs
openshell logs my-sandbox
# Stream live logs
openshell logs my-sandbox --tail
# Filter by source and level
openshell logs my-sandbox --tail --source sandbox --level warn
# Logs from the last 5 minutes
openshell logs my-sandbox --since 5mopenshell sandbox delete my-sandbox
openshell sandbox delete sandbox-1 sandbox-2 sandbox-3 # Multiple at onceThis is the most important multi-step workflow. It enables a tight feedback cycle where sandbox policy is refined based on observed activity.
Key concept: Policies have static fields (immutable after creation: filesystem_policy, landlock, process) and one dynamic field (network_policies). Only network_policies can be updated without recreating the sandbox.
Create sandbox with initial policy
│
▼
Monitor logs ◄──────────────────┐
│ │
▼ │
Observe denied actions │
│ │
▼ │
Pull current policy │
│ │
▼ │
Modify policy YAML │
(use generate-sandbox-policy) │
│ │
▼ │
Push updated policy │
│ │
▼ │
Verify reload succeeded ─────────┘
openshell sandbox create --name dev --policy ./initial-policy.yaml -- claudeSandboxes stay alive by default for iteration. Add --no-keep only when the sandbox should be deleted automatically after the initial session.
In a separate terminal or as the agent:
openshell logs dev --tail --source sandboxLook for log lines with action: deny -- these indicate blocked network requests. The logs include:
- Destination host and port (what was blocked)
- Binary path (which process attempted the connection)
- Deny reason (why it was blocked)
openshell policy get dev --full > current-policy.yamlThe --full flag outputs valid YAML that can be directly re-submitted. This is the round-trip format.
Edit current-policy.yaml to allow the blocked actions. For policy content authoring, delegate to the generate-sandbox-policy skill. That skill handles:
- Network endpoint rule structure
- L4 vs L7 policy decisions
- Access presets (
read-only,read-write,full) - TLS termination configuration
- Enforcement modes (
auditvsenforce) - Binary matching patterns
Only network_policies can be modified at runtime. If filesystem_policy, landlock, or process need changes, the sandbox must be recreated.
openshell policy set dev --policy current-policy.yaml --waitThe --wait flag blocks until the sandbox confirms the policy is loaded (polls every second). Exit codes:
- 0: Policy loaded successfully
- 1: Policy load failed
- 124: Timeout (default 60 seconds)
openshell policy list devCheck that the latest revision shows status loaded. If failed, check the error column for details.
Return to Step 2. Continue monitoring logs and refining the policy until all required actions are allowed and no unnecessary permissions exist.
View all revisions to understand how the policy evolved:
openshell policy list dev --limit 50Fetch a specific historical revision:
openshell policy get dev --rev 3 --fullBuild a custom container image and run it as a sandbox.
openshell sandbox create --from ./Dockerfile --name my-appThe --from flag accepts a Dockerfile path, a directory containing a Dockerfile, a full image reference (e.g. myregistry.com/img:tag), or a community sandbox name (e.g. openclaw).
When given a Dockerfile or directory, the image is built locally via Docker and imported directly into the cluster's containerd runtime. No external registry needed.
When --from is specified, the CLI:
- Clears default
run_as_user/run_as_group(custom images may not have thesandboxuser) - Uses a supervisor bootstrap pattern (init container copies the sandbox supervisor into a shared volume)
# Foreground (blocks)
openshell forward start 8080 my-app
# Background (returns immediately)
openshell forward start 8080 my-app -dThe service is now reachable at localhost:8080.
# List active forwards
openshell forward list
# Stop a forward
openshell forward stop 8080 my-appTo update the container:
openshell sandbox delete my-app
openshell sandbox create --from ./Dockerfile --name my-app --forward 8080openshell sandbox create --from ./Dockerfile --forward 8080 -- ./start-server.shThe --forward flag starts a background port forward before the command runs, so the service is reachable immediately.
- Distroless /
FROM scratchimages are not supported (the supervisor needs glibc,/proc, and a shell) - Missing
iproute2or required capabilities blocks startup in proxy mode
This workflow supports a human working in a sandbox while an agent monitors activity and refines the policy in parallel.
openshell sandbox create \
--name work-session \
--provider github \
--provider claude \
--policy ./dev-policy.yaml \
# sandbox create keeps the sandbox alive by defaultTell the user to run:
openshell sandbox connect work-sessionOr for VS Code:
openshell sandbox ssh-config work-session >> ~/.ssh/config
# Then connect via VS Code Remote-SSH to the host "work-session"While the user works, monitor the sandbox logs:
openshell logs work-session --tail --source sandbox --level warnWatch for deny actions that indicate the user's work is being blocked by policy.
When denied actions are observed:
- Prefer incremental updates for additive network changes:
openshell policy update work-session --add-endpoint api.github.com:443:read-only:rest:enforce --binary /usr/bin/gh --waitopenshell policy update work-session --add-allow api.github.com:443:POST:/repos/*/issues --wait - Use full YAML replacement when the change is broad or touches non-network fields:
openshell policy get work-session --full > policy.yamlModify the policy to allow the blocked actions (usegenerate-sandbox-policyskill for content)openshell policy set work-session --policy policy.yaml --wait - Verify:
openshell policy list work-session
The user does not need to disconnect -- policy updates are hot-reloaded within ~30 seconds (or immediately when using --wait, which polls for confirmation).
openshell sandbox delete work-sessionConfigure the gateway's managed inference route for inference.local.
First ensure the provider record exists:
openshell provider listThen point gateway inference at that provider and model:
openshell inference set \
--provider nvidia \
--model nvidia/nemotron-3-nano-30b-a3bThis updates the gateway-managed inference.local route. There is no per-route create/list/update/delete workflow for sandbox inference.
openshell inference get- Agents send HTTPS requests to
inference.local. - The sandbox intercepts those requests locally and routes them through the cluster inference config.
- Sandbox policy is separate from cluster inference configuration.
openshell gateway select # See all gateways (no args shows list)
openshell gateway select my-cluster # Switch active gateway
openshell status # Verify connectivityopenshell gateway start # Start local cluster
openshell gateway stop # Stop (preserves state)
openshell gateway start # Restart (reuses state)
openshell gateway destroy # Destroy permanently# Deploy to remote host
openshell gateway start --remote user@host --ssh-key ~/.ssh/id_rsa --name remote-cluster
# View gateway container logs
openshell doctor logs --name remote-cluster
# Run kubectl inside the remote gateway container
openshell doctor exec --name remote-cluster -- kubectl get pods -A
# Get cluster info
openshell gateway info --name remote-clusterWhen you encounter a command or option not covered in this skill:
- Start broad:
openshell --helpto see all command groups. - Narrow down:
openshell <group> --helpto see subcommands (e.g.,openshell sandbox --help). - Get specific:
openshell <group> <cmd> --helpfor flags and usage (e.g.,openshell sandbox create --help).
The CLI help is always authoritative. If the help output contradicts this skill, follow the help output -- the CLI may have been updated since this skill was written.
$ openshell sandbox --help
# Shows: create, get, list, delete, connect, upload, download, ssh-config, image
$ openshell sandbox upload --help
# Shows: positional arguments (name, path, dest), usage examples| Task | Command |
|---|---|
| Deploy local cluster | openshell gateway start |
| Check cluster health | openshell status |
| List/switch gateways | openshell gateway select [name] |
| Create sandbox (interactive) | openshell sandbox create |
| Create sandbox with tool | openshell sandbox create -- claude |
| Create with custom policy | openshell sandbox create --policy ./p.yaml |
| Connect to sandbox | openshell sandbox connect <name> |
| Stream live logs | openshell logs <name> --tail |
| Incremental policy update | openshell policy update <name> --add-endpoint host:443:read-only:rest:enforce --binary /usr/bin/curl --wait |
| Pull current policy | openshell policy get <name> --full > p.yaml |
| Push updated policy | openshell policy set <name> --policy p.yaml --wait |
| Policy revision history | openshell policy list <name> |
| Create sandbox from Dockerfile | openshell sandbox create --from ./Dockerfile |
| Forward a port | openshell forward start <port> <name> -d |
| Upload files to sandbox | openshell sandbox upload <name> <path> |
| Download files from sandbox | openshell sandbox download <name> <path> |
| Create provider | openshell provider create --name N --type T --from-existing |
| List providers | openshell provider list |
| Configure gateway inference | openshell inference set --provider P --model M |
| View gateway inference | openshell inference get |
| Delete sandbox | openshell sandbox delete <name> |
| Destroy cluster | openshell gateway destroy |
| Self-teach any command | openshell <group> <cmd> --help |
| Skill | When to use |
|---|---|
generate-sandbox-policy |
Creating or modifying policy YAML content (network rules, L7 inspection, access presets, endpoint configuration) |
debug-openshell-cluster |
Diagnosing cluster startup or health failures |
debug-inference |
Diagnosing inference.local, host-backed local inference, and provider base URL issues |
tui-development |
Developing features for the OpenShell TUI (openshell term) |