shard

A command that runs the same test command concurrently across several copies of a code checkout and combines their JUnit test results into one outcome. JUnit is a standard format for automated test reports.

In plain words
What is it for?
Use it to run sharded tests with tools such as pnpm, Vitest, or Go's test command. It can limit the number of copies, stop on the first failure, and fail based on test failures.
Why use it?
It can shorten test runs by using several environments at once while still producing one overall result. The test runner, rather than the command, decides how tests are divided.

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/shard
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,795 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.01795
Opus 5 $0.00000 $0.00898
Sonnet 5 $0.00000 $0.00359
Haiku 4.5 $0.00000 $0.00179

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

Security

Grade A, and why

shard 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/shard.md · 144 lines

How it starts

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

shard

crabbox shard forks a checkpoint into --count leases concurrently, runs the command on every fork in parallel through the normal crabbox run pipeline, and merges the collected JUnit results into one suite verdict. It is the parallel counterpart of checkpoint fork --count: the same fork flow and {{index}}/{{total}}/{{lease}}/{{slug}} placeholders, but shards run at the same time and their test results fold into a single answer with one aggregate exit code.

crabbox shard --count 8 --from chk_abc123 --results-auto -- pnpm test -- --shard '{{index}}/{{total}}'
crabbox shard --count 4 --from chk_deps --junit junit.xml --fail-on-test-failures -- go test ./...
crabbox shard --count 3 --from chk_abc123 --fail-fast --quiet -- pnpm vitest --shard '{{index}}/{{total}}'

The command template owns the sharding: crabbox never splits tests itself. --count is always explicit, the plan is printed before any lease is provisioned, and a repo config cap (shard.maxCount) bounds what a checkout may request. Requires an SSH lease provider that supports checkpoint fork; delegated providers are rejected. Provider-native snapshot fan-out stays on checkpoint fork --snapshot.

Lease lifecycle

Every shard forks its own lease from the checkpoint and runs with an injected --id, so sync, history, logs, artifacts, and results behave exactly as for run. Forks exist only for the duration of their shard: each lease is released when its shard finishes, on failure, and on Ctrl-C, always with a fresh context so cleanup survives cancellation. A shard that fails to provision does not orphan its siblings; the others run to completion and release normally. Pass --keep to retain all forked leases instead.

For a coordinator-managed brokered native checkpoint, each shard acquires its own short-lived, generation-bound use claim before provisioning. Claims renew while provider readiness is pending, complete independently after successful lease creation, and abort on cancellation or failure. Active claims block checkpoint expiry/deletion; only successful completion advances its coordinator-owned last-use time. Shards can hydrate the checkpoint directly from the coordinator if the local metadata cache is absent.

Read the full file on GitHub · 144 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 · 144 lines · 0 tokens per session scan A 9c2eccde6bb0

Subscribe to this mod's changes

shard 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 1,795 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.