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.ymlinit 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. Repeat --skill to write identical skills for multiple client discovery
paths. By default init preflights every destination and writes nothing when
any target already exists. Pass --force to regenerate and overwrite files in
place.
The generated config is a starting template that includes:
profile: <repo-name>-checkandclass: beast;- a
capacityblock requestingspotwith amost-availablestrategy andon-demand-after-120sfallback; - an
actionsblock wired to the generated workflow (job: hydrate,runnerLabels: [crabbox],runnerVersion: latest,ephemeral: true); - a
syncblock with sane defaults:delete,gitSeed, andfingerprintenabled, a 15m timeout, warn/fail thresholds on file count and bytes, and anexcludelist covering.cache,.turbo,dist, andnode_modules; env.allowwith conservative defaults (CI,NODE_OPTIONS);- an
sshblock (user: crabbox,port: "2222",fallbackPorts: ["22"]).
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.
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 own subshell);package.jsonuses the first present script amongtest:ci,test,check, orbuild(skipping the npm placeholder "no test specified"), with an install + run command picked from the lockfile orpackageManagerfield for npm, pnpm, Yarn, or Bun. Nested packages without their own lockfile are skipped;Cargo.tomladdscargo testand excludestarget;- a root
Makefile(ormakefile) with atesttarget addsmake test.
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.
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 (crabbox_id), a dynamic runner label (crabbox_runner_label), the hydration job identifier (crabbox_job, defaulthydrate), and a keep-alive window (crabbox_keep_alive_minutes, default 90); - 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 (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.
Repo-local agent instructions in the open
Agent Skills format. The generated
SKILL.md includes the required name and description frontmatter, then
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
available to clients that discover .agents/skills/. Skill content is
portable, but discovery directories are client-owned. Repeat --skill <path>
when a repository needs the shared path plus a client-specific location; for
example:
crabbox init --detect \
--skill .agents/skills/crabbox/SKILL.md \
--skill .claude/skills/crabbox/SKILL.mdSupplying any --skill replaces the implicit default. Every destination must
be repository-relative and end in crabbox/SKILL.md; Crabbox rejects other
paths because the declared skill name must match its parent directory.
See AI Agents and Harnesses for the boundary between a local agent skill and a one-shot repo harness.
--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; repeatable (default .agents/skills/crabbox/SKILL.md)
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.
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 generatedRelated docs: