cleanup

A Crabbox command that finds and removes direct-provider machines and local provider state that Crabbox created but no longer tracks. Direct-provider mode means Crabbox manages resources itself instead of through a coordinator.

In plain words
What is it for?
Use it to preview or perform cleanup for supported direct providers, optionally limiting the operation to one provider. It does not clean broker-managed fleets, whose coordinator controls expiry.
Why use it?
It helps clear abandoned resources and local records that could otherwise remain after they are no longer needed. A dry-run option lets you inspect proposed cleanup first.

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/cleanup
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 1,820 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.01820
Opus 5 $0.00000 $0.00910
Sonnet 5 $0.00000 $0.00364
Haiku 4.5 $0.00000 $0.00182

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

Security

Grade A, and why

cleanup 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 2d 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/cleanup.md · 178 lines

How it starts

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

cleanup

crabbox cleanup sweeps direct-provider machines and local provider state that Crabbox created but no longer tracks. It is a safety net for direct (non-brokered) mode only; brokered fleets manage expiry through the coordinator instead.

crabbox cleanup --dry-run
crabbox cleanup
crabbox cleanup --provider namespace-devbox --dry-run
crabbox cleanup --provider namespace-devbox
crabbox cleanup --provider hostinger --dry-run
crabbox cleanup --provider coder --dry-run

crabbox machine cleanup is preserved as a compatibility alias and behaves identically.

Behavior

Cleanup refuses to run when a coordinator is configured:

machine cleanup is disabled when a coordinator is configured; coordinator TTL alarms own brokered cleanup

Sweeping provider resources behind a coordinator can race live brokered leases, so brokered expiry is owned entirely by the coordinator's TTL alarm. See Lifecycle cleanup.

What cleanup does depends on the selected provider:

  • Direct cloud/VM and delegated providers with cleanup (for example hetzner, aws, azure, gcp, proxmox, xcp-ng, hostinger, parallels, cloudflare, blaxel, local-container, multipass) enumerate the machines they own and decide, per machine, whether to delete it.
  • hostinger is stop-only: cleanup skips VPSs that are not positively identified as Crabbox-owned and stops matching VPSs; it does not delete VPSs or cancel Hostinger subscriptions.
  • blaxel starts from local Blaxel claims scoped to the configured API URL and workspace, verifies remote ownership labels before deleting, and keeps missing claims unless --blaxel-forget-missing is explicitly set.
  • namespace-devbox removes only Crabbox-owned local Namespace SSH files; it does not delete remote Devboxes.
  • namespace-instance destroys only Namespace Compute instances carrying Crabbox ownership labels and an exact local claim for the same instance, tenant, and configured scope; labeled but unclaimed instances are skipped. Claims for instances already gone are removed.
  • xcp-ng deletes eligible VMs only when an exact local claim matches the normalized pool endpoint, account, lease, slug, and immutable VM UUID. Labeled but unclaimed or wrong-pool VMs are skipped, and failed deletion preserves the claim for a safe retry.
  • vercel-sandbox sweeps only local vsbx_... claims in the configured project/team/scope. It deletes idle-expired Crabbox-owned Vercel Sandboxes and keeps missing-or-inaccessible claims unless --vercel-sandbox-forget-missing is explicit.
  • cloudflare-dynamic-workers checks local Dynamic Workers claims against the loader and removes only stale local claims whose loader metadata is missing or terminal. It does not enumerate or delete every Dynamic Worker in the Cloudflare account.
  • cloudflare-sandbox sweeps only local cfsbx_... claims in the active provider scope. It deletes idle-expired Crabbox-owned sandboxes and keeps missing-or-inaccessible claims unless --cloudflare-sandbox-forget-missing is explicit.
  • nomad sweeps only local cbx_... claims in the active Nomad namespace, region, and task scope. It deregisters idle-expired or TTL-expired Crabbox-owned jobs, removes stale local claims for missing jobs, and skips active claims.
  • coder lists workspaces with Crabbox ownership evidence, such as the configured workspace prefix or Crabbox labels in Coder JSON, but mutates only workspaces that also have a local Crabbox claim with cleanup metadata. It uses the release action persisted in each local claim: new delete-on-release claims delete, stop-on-release claims stop, and older claims without that metadata default to stop.
  • Providers that have nothing to sweep return an error rather than acting. For example provider=ssh (static / bring-your-own hosts) reports:

Read the full file on GitHub · 178 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. 2d ago First seen · 178 lines · 0 tokens per session scan A 4eb644216521

Subscribe to this mod's changes

cleanup is a command published in the GitHub repository openclaw/crabbox (1,343 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,820 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.