opencomputer
GitHub管理 OpenComputer 云沙盒环境,涵盖创建、命令执行及检查点管理。包含自动化的 CLI 安装、登录认证及余额不足等错误处理流程,确保用户能顺利使用远程计算资源。
Trigger Scenarios
Install
npx skills add diggerhq/opencomputer --skill opencomputer -g -y
SKILL.md
Frontmatter
{
"name": "opencomputer",
"description": "Manage OpenComputer cloud sandboxes. Use when the user wants to create, run commands in, checkpoint, or manage sandbox environments. Auto-invokes when sandboxes, remote environments, or the oc CLI are mentioned.",
"allowed-tools": "Bash(oc *), Bash(which oc), Bash(curl *), Bash(open *), Bash(xdg-open *), Bash(chmod *), Read, Grep, Glob"
}
You have access to the oc CLI for managing OpenComputer cloud sandboxes. Use it to create sandboxes, execute commands, manage checkpoints, and more.
First-time setup (run this BEFORE any other oc command)
Before running any sandbox command, make sure the user is set up. Do these checks in order, only fixing what's broken:
1. Is the oc CLI installed?
which oc
If it returns a path → installed, skip to step 2.
If it returns nothing / non-zero exit → install it with the official one-liner:
curl -fsSL https://raw.githubusercontent.com/diggerhq/opencomputer/main/scripts/install.sh | bash
This installs oc to ~/.local/bin/oc. If ~/.local/bin is not on the user's PATH, tell them to add export PATH="$HOME/.local/bin:$PATH" to their shell rc file, and use the full path ~/.local/bin/oc for the rest of this session.
2. Is the user logged in?
oc whoami
If it succeeds → logged in, you're done.
If it fails because no credential is configured, OR a sandbox command fails
with an auth error (401, "unauthorized", "missing API key"):
- Run:
oc login - Relay the complete browser URL and short confirmation code printed by the command to the user.
- Leave the command running while the user approves it in their browser. It resumes automatically after approval.
Do not ask for an API key in chat. For CI or service automation, the user
may instead configure OPENCOMPUTER_API_KEY themselves.
3. Out of credits (402, insufficient_credits)
If any command fails with HTTP 402, code: "insufficient_credits", or a
message mentioning "credits exhausted" / "out of prepaid credits", the
organization has no prepaid credits left and every further command will fail
the same way. Do not retry or work around it. Instead:
- Stop and tell the user they've used their OpenComputer credits.
- Relay the upgrade link from the error verbatim (it looks like
https://app.opencomputer.dev/billing?plan=max). Pro is $200/month. If the error links to plain/billinginstead, the org is already on Pro and its monthly credits renew next billing period. - Resume once they confirm they've upgraded.
When the error carries a haltReason (the trial ended, the month's minutes
and credits are used, a payment failed, or the plan ended), relay the hint
as is: it says why and links the Billing page, where the user picks a plan,
buys credits or updates their card.
A response that carries warning: "low_credits" or a billingWarning (or a
warning line after run) still succeeded — finish the task, then mention the balance and
the upgrade link to the user so they can act before sessions pause.
CLI Reference
Sandbox Lifecycle
# Create a sandbox (returns sandbox ID)
oc sandbox create --timeout 300 --cpu 1 --memory 512
oc sandbox create --env KEY=VALUE --env KEY2=VALUE2
oc sandbox create --secret-store my-secrets --metadata project=demo
oc create # shortcut
# List running sandboxes
oc sandbox list
oc ls # shortcut
# Get sandbox details
oc sandbox get <sandbox-id>
# Kill a sandbox
oc sandbox kill <sandbox-id>
# Hibernate (saves state to S3, can wake later)
oc sandbox hibernate <sandbox-id>
# Wake a hibernated sandbox
oc sandbox wake <sandbox-id> --timeout 300
# Update timeout
oc sandbox set-timeout <sandbox-id> <seconds>
Execute Commands
oc exec streams stdout/stderr live by default and exits with the remote process's exit code. Use --wait for buffered/synchronous execution (needed for --json), or --detach to fire-and-forget.
# Stream live (default)
oc exec <sandbox-id> -- echo hello
oc exec <sandbox-id> --cwd /app -- npm install
oc exec <sandbox-id> --timeout 120 -- make build
oc exec <sandbox-id> --env NODE_ENV=production -- node server.js
# Buffered + JSON envelope (exitCode, stdout, stderr) — required for scripting
oc exec <sandbox-id> --wait --json -- whoami
# Fire-and-forget; prints the session id so you can re-attach later
oc exec <sandbox-id> --detach -- long-running-job
# Manage exec sessions
oc exec list <sandbox-id>
oc exec attach <sandbox-id> <session-id>
oc exec kill <sandbox-id> <session-id>
Checkpoints
Checkpoints snapshot a running sandbox. You can restore to a checkpoint (in-place revert) or spawn new sandboxes from one (fork).
# Create a checkpoint
oc checkpoint create <sandbox-id> --name "after-setup"
# List checkpoints
oc checkpoint list <sandbox-id>
# Restore sandbox to a checkpoint (in-place revert)
oc checkpoint restore <sandbox-id> <checkpoint-id>
# Spawn a new sandbox from a checkpoint (fork)
oc checkpoint spawn <checkpoint-id> --timeout 300
# Delete a checkpoint
oc checkpoint delete <sandbox-id> <checkpoint-id>
Checkpoint Patches
Patches are scripts applied when sandboxes are spawned from a checkpoint. Use them to customize forked environments.
# Create a patch (reads script from file)
oc patch create <checkpoint-id> --script ./setup.sh --description "Install deps"
# Create a patch from stdin
echo "apt install -y curl" | oc patch create <checkpoint-id> --script -
# List patches
oc patch list <checkpoint-id>
# Delete a patch
oc patch delete <checkpoint-id> <patch-id>
Preview URLs
Expose a sandbox port via a public URL.
# Create a preview URL
oc preview create <sandbox-id> --port 3000
oc preview create <sandbox-id> --port 8080 --domain myapp.example.com
# List preview URLs
oc preview list <sandbox-id>
# Delete a preview URL
oc preview delete <sandbox-id> <port>
Interactive Shell
# Open an interactive terminal session
oc shell <sandbox-id>
oc shell <sandbox-id> --shell /bin/zsh
Report a bug or friction (feedback.now)
If OpenComputer itself misbehaves while you work — an API call returns an unexpected error, a flag doesn't match the docs, an SDK method is confusing — report it. Reports go through the open feedback.now protocol; no API key needed and it does not interrupt your task. Prefer one precise report over many vague ones.
# Full report: --surface, --category, --severity, --title are required
oc feedback submit \
--surface 'POST /api/sandboxes' --kind api_endpoint \
--category bug --severity high --reproducibility always \
--title 'create returns 500 when template is missing' \
--summary 'Expected 404 with a clear error' \
--evidence 'http_summary={"status":500}' --evidence stderr_excerpt=@/tmp/err.log \
--agent-vendor <your-vendor> --agent-product <your-product> --json
# Low-confidence or minor: an observation (only --surface required)
oc feedback observe --surface 'oc sandbox create' --category friction \
--summary '--template flag name differs from the docs'
# Later: was it accepted, folded into a known issue, or fixed?
oc feedback receipt <receipt-id> --json
- Categories:
bug,docs_mismatch,friction,feature_gap,quality_degradation,other. Severities:critical,high,medium,low. - Set
--agent-vendor/--agent-productto identify yourself (e.g.anthropic/claude-code). - Never put secrets, API keys, or customer data in
--summaryor--evidence. - Works against any feedback.now host:
oc feedback submit --target https://api.example.com ....
Global Flags
All commands support:
--json— output as JSON instead of tables--api-key <key>— override API key--api-url <url>— override API URL
Workflow Patterns
Create and use a sandbox
ID=$(oc create --json | jq -r '.sandboxID')
oc exec $ID --wait -- apt update
oc exec $ID --wait -- apt install -y nodejs
oc exec $ID -- node -e "console.log('hello')"
oc sandbox kill $ID
Checkpoint workflow (setup once, fork many)
# Create base environment
ID=$(oc create --json | jq -r '.sandboxID')
oc exec $ID --wait -- apt update
oc exec $ID --wait -- apt install -y python3 pip
oc exec $ID --wait -- pip install flask
# Checkpoint it
CP=$(oc checkpoint create $ID --name "python-flask" --json | jq -r '.id')
# Wait for checkpoint to be ready
oc checkpoint list $ID
# Spawn copies from the checkpoint
FORK1=$(oc checkpoint spawn $CP --json | jq -r '.sandboxID')
FORK2=$(oc checkpoint spawn $CP --json | jq -r '.sandboxID')
Add a patch to customize forks
oc patch create $CP --script ./inject-config.sh --description "Add app config"
# All future spawns from $CP will run inject-config.sh on boot
Important Notes
- Always use
--jsonand parse withjqwhen you need to extract IDs or fields programmatically. - Sandbox IDs look like
sb-xxxxxxxx. Checkpoint IDs are UUIDs. - Checkpoints take a few seconds to become
ready. Poll withoc checkpoint listif needed. - Use
oc sandbox killto clean up sandboxes when done. - The
oc execcommand exits with the remote process exit code.
Version History
-
010987c
Current 2026-11-02 13:41
新增针对 CLI 和 API 的支付墙处理逻辑,根据 haltReason 渲染具体的 402 错误信息,并在 CLI 运行时输出账单警告。
-
8840c6a
2026-10-18 21:14
移除旧版订阅提及,统一升级链接指向 Pro 计划;新增 agent-feedback 协议支持,集成反馈提交与观察功能。
-
6eb3b58
2026-09-27 15:07
新增积分不足(402)错误处理流程,指导代理转发升级链接而非重试;优化低积分警告提示。
-
1c3f441
2026-07-31 02:57
将首次设置中的认证方式从手动配置API Key改为通过浏览器辅助的CLI交互式登录流程。
- e50c55c 2026-07-05 12:02


