init
crabbox init onboards the current repository: it writes the minimal config that crabbox run needs, plus an optional GitHub Actions hydration workflow and an agent skill file. Run it once from the repo root.
crabbox init
crabbox init --detect
crabbox init --force
crabbox init --workflow .github/workflows/crabbox-test.yml
#Files it writes
init generates three files, all relative to the repository root:
.crabbox.yaml repo defaults (profile, class, capacity, sync, env, ssh)
.github/workflows/crabbox.yml Actions hydration workflow (optional)
.agents/skills/crabbox/SKILL.md agent-facing skill instructions
Each path is configurable with the --config, --workflow, and --skill flags. By default init refuses to overwrite an existing file: if any target path already exists it stops with an error and writes nothing further. Pass --force to regenerate and overwrite the files in place.
#.crabbox.yaml
The generated config is a starting template that includes:
profile: <repo-name>-checkandclass: beast;- a
capacityblock requestingspotwith amost-availablestrategy and - an
actionsblock wired to the generated workflow (job: hydrate, - a
syncblock with sane defaults:delete,gitSeed, andfingerprint env.allowwith conservative defaults (CI,NODE_OPTIONS);- an
sshblock (user: crabbox,port: "2222",fallbackPorts: ["22"]).
on-demand-after-120s fallback;
runnerLabels: [crabbox], runnerVersion: latest, ephemeral: true);
enabled, a 15m timeout, warn/fail thresholds on file count and bytes, and an exclude list covering .cache, .turbo, dist, and node_modules;
Open the file after init and adjust it to match the repo:
- pick the right
classfor the workload; - add repo-specific
sync.excludepatterns; - expand
env.allowfor project-specific tunables; - set
sync.baseRefif the project's default branch is not the rsync base.
See Configuration for the full schema.
#Detection (--detect)
With --detect, init scans common project markers and, when it can infer a broad check, writes a jobs.detected entry (a shell job with stop: auto) plus matching run.preflightTools. Detection is intentionally conservative:
go.modaddsgo test ./..., including nested modules (each in its ownpackage.jsonuses the first present script amongtest:ci,test,Cargo.tomladdscargo testand excludestarget;- a root
Makefile(ormakefile) with atesttarget addsmake test.
subshell);
check, or build (skipping the npm placeholder "no test specified"), with an install + run command picked from the lockfile or packageManager field for npm, pnpm, Yarn, or Bun. Nested packages without their own lockfile are skipped;
The generated job is plain repo-local YAML. Edit it when the real project check needs services, secrets, sharding, or a narrower command. If nothing matches, init prints a note and leaves the jobs section out — define jobs by hand.
#.github/workflows/crabbox.yml
The generated workflow is a conservative starting point for repo-specific hydration, not a full replacement for CI. Edit it to install dependencies, start service containers, and warm caches before agents begin repeated crabbox run calls.
The workflow follows the contract used by crabbox actions hydrate:
- it is
workflow_dispatch-triggered and accepts the Crabbox lease ID - the
hydratejob runs on[self-hosted, <runner label>]; - it writes a ready marker and env snapshot under
$HOME/.crabbox/actions; - a final step keeps the job alive until the deadline or a stop marker appears
(crabbox_id), a dynamic runner label (crabbox_runner_label), the hydration job identifier (crabbox_job, default hydrate), and a keep-alive window (crabbox_keep_alive_minutes, default 90);
(used for the self-hosted GitHub-runner fallback).
If the repo has no Actions hydration plans, delete the workflow. crabbox run works fine without it; hydration is optional.
#.agents/skills/crabbox/SKILL.md
Repo-local agent instructions. The generated skill explains how an agent should operate Crabbox in this repo: warm a box early, reuse the returned slug for interactive checks while keeping the cbx_ id in scripts/logs, run checks with crabbox run --id <slug> -- <command>, inspect with crabbox ssh, and stop with crabbox stop <slug> when finished. When --detect finds a check, the skill also points agents at crabbox job run detected.
Edit this file to match how you want agents to operate in the repo. The skill is read by OpenClaw and similar agent runtimes that auto-discover .agents/skills/.
#Flags
--force overwrite generated files
--detect detect repo test commands and write a jobs.detected entry
--config <path> repo config path (default .crabbox.yaml)
--workflow <path> Actions workflow path (default .github/workflows/crabbox.yml)
--skill <path> agent skill path (default .agents/skills/crabbox/SKILL.md)
#Re-running
Without --force, init will not touch existing files: it stops at the first target that already exists and reports it, so an established repo is never silently overwritten. With --force, it regenerates all three files.
#After init
crabbox doctor # validate the config
crabbox sync-plan # preview what would sync
crabbox warmup # acquire a lease
crabbox run -- pnpm test # run a command
crabbox job run detected # run the detected job, when generated
Related docs: