ports

A command for viewing, publishing, or removing network ports on a Crabbox sandbox lease. A port is a numbered connection through which a running service can be reached.

In plain words
What is it for?
Use it to list open ports, publish a service such as one running on port 3000, remove a published mapping, or request the result as JSON.
Why use it?
It handles lease lookup and provider-specific port operations, so you do not need to manage Docker Sandbox or CodeSandbox details directly.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/openclaw/crabbox/ports
Clone the repo
git clone --depth 1 https://github.com/openclaw/crabbox
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 724 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00724
Opus 5 $0.00000 $0.00362
Sonnet 5 $0.00000 $0.00145
Haiku 4.5 $0.00000 $0.00072

Measured 3d ago against content hash f42c0e6b4b25, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ports scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/commands/ports.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ports

crabbox ports bridges provider-native port publishing for an existing Crabbox lease. It resolves a Crabbox-owned lease id or slug first, then asks the active provider to list, publish, or unpublish ports.

crabbox ports --provider docker-sandbox --id blue-box
crabbox ports --provider docker-sandbox --id blue-box --publish 3000
crabbox ports --provider docker-sandbox --id blue-box --unpublish 41000:3000
crabbox ports --provider docker-sandbox --id blue-box --json
crabbox ports --provider codesandbox --id web-box --publish 3000 --json

Lease Resolution

--id is required. It accepts a Crabbox lease id or active slug. Providers only act on Crabbox-owned leases; raw user-created sandboxes are rejected.

For provider=docker-sandbox, Crabbox resolves the local dsbx_... claim and then calls sbx ports <sandbox-name> ....

For provider=codesandbox, Crabbox resolves the local csbx_... claim, verifies the remote CodeSandbox ownership tag, then asks the CodeSandbox SDK bridge for open ports or provider-owned host URLs.

Flags

--id <lease-id-or-slug>
--provider <name>
--publish <spec>      publish a port mapping; repeatable
--unpublish <spec>    unpublish a port mapping; repeatable
--json                print provider-native listing output as JSON

--publish and --unpublish cannot be combined in the same call.

For Docker Sandbox, the spec format mirrors sbx ports:

[[HOST_IP:]HOST_PORT:]SANDBOX_PORT[/PROTOCOL]

Examples:

  • 3000 lets Docker Sandbox allocate an ephemeral host port for sandbox port 3000.
  • 41000:3000 binds host port 41000 to sandbox port 3000.
  • 127.0.0.1:41000:3000/tcp4 restricts the published port to IPv4 loopback.

For CodeSandbox, the spec is only the sandbox port number:

SANDBOX_PORT

--publish 3000 waits for port 3000 in the sandbox and prints the CodeSandbox SDK host URL. With --json, CodeSandbox returns objects with port, host, and url fields. --unpublish is not supported for CodeSandbox because the SDK observes ports owned by running processes rather than exposing a close-port operation; stop the process inside the sandbox.

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 80 lines · 0 tokens per session scan A f42c0e6b4b25

Subscribe to this mod's changes

ports is a command published in the GitHub repository openclaw/crabbox (1,343 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 724 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.