Skip to content
Back to skills

Skill

BSecurity

Run builds, test suites, benchmarks and other heavy compute on a boxd build server instead of this machine. Use when a build or test run would load the owner's machine, when a task needs a tool that is not installed anywhere (any Linux package, inside a podman container), or when the build server's disk is full and its build area needs a reset.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 20, 2026
developmenttypescriptrustgojavashellnodedockergitapi

Works with

  • cli
  • api

Security analysis

B75/100
  • criticalAccesses sensitive system or user directories

Pro shows the line behind each finding and how to fix it

Scanned December 4, 2026

npx -y skills add gsalucci/boxd --skill skill --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Skill?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Skill
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/gsalucci-skill/badge)](https://www.skillsdirectory.com/skills/gsalucci-skill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: box
description: Run builds, test suites, benchmarks and other heavy compute on a boxd build server instead of this machine. Use when a build or test run would load the owner's machine, when a task needs a tool that is not installed anywhere (any Linux package, inside a podman container), or when the build server's disk is full and its build area needs a reset.
---

# box: build server for heavy compute

`box` runs a command on a headless build host. Every git worktree gets its own box: a podman container (or, with
`--vm`, a small virtual machine) holding your files in `/job/src`. A host that sleeps when idle is woken by `box`
itself (about 15 seconds). `box setup <host>` was run once per host; `box --host <name>` or `BOXD_HOST` names one.
`box --help` lists every option and `box --version` prints the client's version.

## Run a command

- `box <command...>` from inside your git worktree: it syncs the worktree, runs the command in your box, prints the
  output and exits with the command's exit code. Same box on every call. Example: `box cargo test -p mycrate`.
  Gate on the exit code, never on a pipe. The last line on standard error is `box: exit <code> on <host>` once the
  command was handed to a host (not with `--detach`, `--shards`, or a call refused before a host was chosen).
- No shell: the command is an argument list. For pipes, `&&`, redirects, globs: `box sh -c 'make && make test'`.
- Options go before the command. `box --no-sync sh -c '...' --pull x` hands `--pull x` to the command (box warns once);
  write `--` before the command to say it is meant.
- These words must come FIRST: `setup`, `runs`, `hosts`, `list`, `image`, `ps`, `log`, `forward`, `vnc`, `serve`,
  `pull`, `drop`, `stop`, `gc`. Right: `box drop --host tower`. Wrong: `box --host tower drop` (refused, exit 2,
  nothing contacted). To run a program of that name in the box: `box --host tower -- drop`.
- Edit sources on your machine, never in `/job/src`: the next sync puts your file back. A file whose size changed gets
  the time of that sync, so cargo or make rebuild it; a box-side edit that kept the size keeps your older local time,
  so `touch` the local file (or sync with `--commit`) before trusting the next build.
- Two calls of one worktree at once share one box: their syncs take turns, their builds write the same folders. For
  real parallel work give each its own box with `--pod <name>`. `box --shards <n> -- <command>` does it for you (below).
- Do not build your own lock or queue around `box`. It never starts a second command for you. A non-zero exit code
  does NOT mean nothing ran: a foreground call ends with the command's own code, after the command did part or all of
  its work. Nothing ran when `box` or the server says why it did not: `...; nothing was started`, a usage error with
  the help, or a refusal (the `boxd-pod: <reason>` line with exit 75 or 125, or `box: no build server has room ...`).
  Otherwise, before you run a command with side effects again, read its output and look at `box ps` and `box runs`.
  A `--detach` call started the run when it exits 0 and prints `run <id>`. Never relaunch on a message alone: a second
  launch runs beside the first in the same box. `box: sync complete; ... stays on the server` is a note.

## Exit codes of `box`

A command can end with any of these numbers itself; the meaning below holds when `box` or `boxd-pod` printed its own
message.

| code | meaning | what to do |
|---|---|---|
| 0 | the command (or `--detach` start) succeeded | nothing |
| the command's own code | foreground call: that is the command's result; it ran and may have done part of its work | read the output before running it again |
| 1 | `box runs --follow`: a followed run ended with a code other than 0; `box drop` or `box stop`: refused (a command or run is going; or the host sleeps and drop will not wake it) | read the message; `box log <id> --follow --tail 20`, or end the run first |
| 2 | wrong usage, nothing contacted or started (bad option, unknown `--commit` revision, option before a subcommand word) | fix the call |
| 3 | `box log <id> --events`: the record does not cover the whole run | do not read it as "nothing happened" |
| 4 | `box log <id> --follow --quiet-limit <seconds>`: the run wrote nothing for that long; the run still runs | check `box log <id> --state`, `box ps`; `box stop --run <id>` if hung |
| 75 | no room on any host (or a placed worktree must move by hand); nothing started | add `--wait`, start fewer builds, or run the `box --host <name> ...` command the message prints |
| 125 | with a `boxd-pod: <reason>` line, the server refused: registry not allowed, image build failed (the old box stays), size never fits, `--user` or `--vm` unsupported, `--gpu` on a host with no card | read the reason on standard error; nothing ran |
| 129 | the call's starter was gone, so the command in the box was ended too, perhaps half done; for `box log --follow`: the run ended with no exit code (box or host went down, nothing restarts it) | check what it did, then start again; use `--detach` for work that must outlive you |
| 255 | ssh failed. With `...; nothing was started`: the host is unreachable and nothing ran. Without those words the connection may have been lost after the command started: it may have run in part or whole | nothing ran: retry, or use another host (the message names those with room). Otherwise check `box ps`, `box runs` and the command's effects before running it again |

With `--pull`, a command that ended with 0 whose copy back failed gives `rsync`'s code, after `box: pull <path> failed`
or `nothing pulled`: the command succeeded, so fetch with `box pull <path>` and do not run it again.

A program that reads exit 75 sets `BOXD_REFUSAL_JSON=1`: standard error then ends with one line, `box-refusal: ` and
a JSON object (`exit`, `waitable`, per host `host`, `state`, `reason` and the figures it reported, and `text`).

## Choose the host, and room

- With several hosts, the first call of a worktree picks one with room: the calmest (most spare processors, then
  most free memory; a host with load above its processors comes after the calm ones; a machine for `--vm` goes to
  the host with the smallest memory limit that has room). The worktree then stays there; `box list` names the host.
  A script that must choose a host for a NEW box asks `box hosts --pick [--vm] [--gpu]` and places nothing.
- Never pin a placed worktree with `--host` on every call: `--host` moves it (and pins it), says so in one line
  (`box: --host moves this worktree from <old> to <new> ...`), builds the box again there and the old box keeps its
  memory until that host's time limit. To only look on another host use `box pull <path> --host <name> --to
  <folder>`, `box log <run> --host <name>` or `box ps --host <name>`: they run nothing and move nothing.
- A plain call moves the worktree by itself in two cases and says so: its host has no room (not when the box still
  holds a machine, a container or a run there, or the call named a host: then exit 75 and the exact command to run),
  or its container host has been overloaded for minutes and an idle host has room (the next build there starts
  cold; once moved, it stays an hour; never while a run of the box runs, never when pinned by `--host`). A script
  whose calls must stay together sets `BOXD_STAY=1`.
- No room: `--wait` asks again every 30 seconds and goes on when room appears (`box: room on <host> after waiting
  <time>; starting`); waiting calls are served in order and the waiting line tells your place. The refusal lists what
  fits now (`fits now: --size <size> on <host>`; add `--recreate` if the box exists with another size). A call into a
  box that is already busy is never refused. A refusal waiting cannot fix (missing image) still ends at once.

## Images, machines, credentials

- Image: `--image rust:1.83` (default debian:stable-slim); allowed registries only (docker.io and ghcr.io by
  default). A box keeps its image: to change it add `--recreate` (files stay). Install extra tools inside
  (`apt-get install -y ...`). When the host's shared image (`localhost/<name>`) was rebuilt after the box was made,
  the first call into the box after that rebuild prints `boxd-pod: box <box> runs an older copy of localhost/<name>`:
  a missing tool may only be missing from the old copy, and `--recreate` gives the new one.
- Your own image: a Containerfile in the worktree and `box --image-file <path> <command...>` (path relative to the
  worktree top, no `..`, not with `--image`). The server builds it on every call and replaces the box when the image
  changed; files under `/job` stay. A failed build exits 125 with its output on standard error.
- Image from a private registry: the server holds no login. On your machine run `box image push [--vm] <ref>`, then
  `box --image <ref> ...`.
- `--vm` only when the work needs docker or podman inside, its own kernel, root, isolation for untrusted code (but see
  the cache warning below), or a sandbox that mounts its own `/proc` (a container box refuses `bwrap --unshare-all
  --proc /proc`; probe with the options the sandbox really takes). Containers are lighter and reach the host's network;
  a machine reaches the public internet only. Example: `box --vm --image localhost/toolbox docker run --rm hello-world`
  (the host has that image only after `boxd-setup --images`). Cache warning: a machine box too mounts the host's shared
  package cache (`/cache`) read and write, so untrusted code in it can change a package that other boxes then build
  with; do not run it on a host whose other boxes rely on that cache. A box keeps its engine only while its files stay, and
  cleanup or a reset can remove them between two calls: a call without `--vm` then makes a container. So pass `--vm` and
  every other box option the work depends on in every call that runs a command (`--image` or `--image-file`, `--size`,
  `--user`, `--kvm`, `--gpu`); repeating what the box already has needs no `--recreate`. The exception to `--vm`:
  `box log`, `box ps` and `box pull` refuse it (exit 2). Smallest size that fits:
  `--size small|medium|large|xlarge` (2, 4, 8 or 12 gigabytes; 2, 4, 4 or 8 processors).
  A new box with no `--size` is large. A running or stopped machine that is not remade keeps its
  size; naming another size needs `--recreate` (which with no `--size` keeps the recorded one). A machine made again
  without `--recreate` and with no `--size` (it was removed when idle or for room, or its `--image-file` image changed,
  running or not) is sized from its recorded memory peak: the smallest of small, medium and large that holds the peak
  with a quarter to spare, even if it was bigger before. With no recorded peak, or one too big for large to hold with
  that margin, it keeps the recorded size (xlarge stays xlarge). So pass `--size` on every call when the size matters.
  The toolbox image's `tsc` is version 7; tools that load TypeScript as a library find version 6 at
  `/opt/typescript-api/node_modules/typescript`.
- `--user`: commands run as an unprivileged user (number 1000 in a machine, may use docker) that owns the synced
  files, `HOME=/job/home`; for tools that refuse root. Without it commands run as root (the first call that makes a
  box prints which). Kept once made; adding it needs `--recreate`. A hosted build service's setup: `box --vm --user --git ...`.
- `--kvm` (container only) gives the box `/dev/kvm` for QEMU. `--gpu` (container only) gives it the host's NVIDIA
  card (`box hosts` shows `gpus=<n>`). A host without one refuses with exit 125 (`--gpu: this host has no graphics
  card for boxes`); only when `box` is choosing among several hosts and none has a card: exit 75, `no graphics card`.
  Waiting helps in neither case. Drivers and `nvidia-smi` come from the host,
  the CUDA toolkit, Vulkan loader or Mesa utilities belong in the image; headless only (Vulkan, EGL surfaceless;
  no display server); every `--gpu` box shares the whole card. Both are kept once made; adding needs `--recreate`.
- Credential for the command: `box --env NAME <command...>` (repeatable, names ending in `_TOKEN`, `_KEY`, `_SECRET` or
  `_PASSWORD`) hands the variable from your environment to the command, foreground and `--detach`. Never put a credential
  in the command text or the worktree: the server's call log keeps the first 200 characters of every command.

## What is synced, and git inside the box

- The sync sends what git counts as the worktree: tracked and untracked files minus ignored ones, and the files of
  checked-out submodules (by their own ignore rules). A submodule not checked out arrives as an empty folder: run
  `git submodule update --init` first. `.git` is not sent. An ignored file you need in the box: `--include <path>`
  (repeatable). Ignored files a run made in the box stay between calls; `--clean` deletes them first (for measurements).
  Every call except `--no-sync` makes `/job/src` match your worktree and deletes any other file there.
- Needs git data: `--git` makes `/job/src` a repository at your commit (same hash, one commit, detached; uncommitted
  work shows as changes; a file new and uncommitted is untracked there, so a test that reads the tracked file list can
  differ from the committed result). `--history` with it adds every commit and tag (for `git describe`, `git log`).
  `--snapshot` commits the files as a new commit named snapshot. `--commit <rev>` runs on exactly what a fresh clone at
  that commit holds (no uncommitted or ignored files, old outputs gone): for a release check; use `--git` for daily work.
- `--no-sync` skips the sync; where no box exists it makes a new one with no source and the default options
  (`/job/src is empty`), so `box drop` it before the real start that needs `--kvm`, `--vm` or `--user`.
- The clock in the box is coordinated universal time, and so is `ended=` of `box log <run> --state` (it ends in `Z`).
  Run ids carry your machine's local time; dates and times in the host's messages are the host's local time.

## Get results back

- `--pull <path>` (repeatable) copies a file or folder from the box into your worktree after a foreground run. Nothing
  else comes back, and `box` does not tell you: a command that rewrites a tracked file changes only the box's copy and
  the next sync puts your version back. Pull what such a command writes: `Cargo.lock` (a later `--locked` build fails
  with `cannot update the lock file`), formatter output, updated test snapshots, generated code.
- `box pull <path>... [--to <folder>]` copies later, after a detached run, or a file git ignores or a key made only in
  the box; it runs nothing, so a stopped box stays stopped. `--pull` does nothing with `--detach`.

## Long runs: `--detach`

- `box --detach <command...>` prints a run id (`run <id>`) and returns at once; it also prints the `box log` command to
  read it. Use it for anything longer than you will wait in one call, and for work that must outlive you (a foreground
  call ends with the process that started it; `BOXD_KEEP_ORPHAN=1` is only for a wrapper that exits on purpose).
  The host stays awake until the run ends. A box takes one detached run at a time unless the runs share no files.
- Results of a detached run must be under `/job/src` at a path git ignores (such as `target/`): the next call syncs
  `/job/src` and deletes files git does not ignore, and files elsewhere (`/tmp`) go when the idle box is removed.
- Wait without a sleep loop: `box log <id> --follow` reads until the run ended and exits with its code (the log ends
  with `EXIT <code>`; standard error ends with `box: run <id> exit <code> on <host>`); add `--tail 20` to see only the
  end, or `box log <id> | tail -n 50` to keep a long log out of your context. `--follow --quiet-limit <seconds>` gives
  up (exit 4) on a run that wrote nothing that long. `box log <id> --state` answers in one line (`state=running|ended`,
  `exit=`, `ended=`, `seconds=`, `age=`, `quiet=`). `box log` never starts a stopped box (unlike `box cat
  /job/runs/<id>.log`). `box runs` lists your runs in flight (host, box, run id, age, worktree, last line); `box runs
  --follow` blocks until all of them ended and prints `exit=<code>` for each (exit 0 only if every one ended with 0;
  ends with exit 129 when its starter is gone); `--pod '<pattern>'` keeps your own boxes (`*`, `?`), `--tail <n>` adds
  each log's end.
- A run silent for an hour gets a warning from `box runs`. A program that writes progress only to files: start it
  with `--alive <path>` (a file or folder of the worktree, relative); its newest change counts as output.
- `box log <id> --events` after a run ended (for a measurement): the host's record of what could have disturbed it,
  one `key=value` per line (memory stalls and kills, network card stalls, `others` busy meanwhile, `siblings`,
  `guest_kills`, `job_disk_pct`, `disk_full=yes`). Void the run by a rule fixed beforehand. Exit 3: it does not cover the run.
- `box stop --run <id>` ends one detached run and nothing else (a run that ended: exit 0). Read a stuck call with
  `box ps` (processes of your box, oldest first; it changes nothing; `box sh -c 'kill <pid>'` ends one). A foreground
  call silent for 15 minutes gets the `box ps` table on standard error, each line prefixed `[box ps] ` (`--ps-after <minutes>`
  or `BOXD_PS_AFTER`; `0` turns it off for callers that parse standard error strictly).
- `box --shards <n> -- <command with {shard} and {shards}>` (2 to 32) runs the command in `<n>` boxes of this worktree
  (`-s1` to `-s<n>`), for example `box --shards 5 -- npx vitest --shard={shard}/{shards}`. It waits for all, prints one
  line per shard and the last 20 log lines of each failing one (`--tail <n>`), stops the boxes and exits 0 only when
  all ended with 0. Each shard is an ordinary box: its dependencies must be installed there, and the room rules apply
  to each start (`--wait` queues; a refused start leaves the runs already started running). Not with `--detach`,
  `--pull`, `--no-sync`, `--snapshot`.

## Reach a server in the box

- `box forward <local-port> <box-port>` (0 picks a free local port and prints it) listens on `127.0.0.1` here for a
  server that only listens on loopback in the box (a dev server, x11vnc on 5900, noVNC on 6080); it runs until Ctrl+C or
  until its starter is gone. Container boxes only; the box must be running (a forward never starts one); each
  open connection holds the box busy, so `box stop` and `box drop` refuse until it ends. `box vnc` forwards 5900 and opens `vnc://`.
- Many short commands to an ssh server in the box: forward its port once, then `ssh -p <local-port>` with
  `-o ControlMaster=auto -o ControlPath=~/.ssh/cm-%C -o ControlPersist=10m` (0.05 seconds a command, against 0.70
  for one `box` call each).
- A server that must not keep the host awake (a model server on the card): `box serve <local-port> <box-port> --idle
  <seconds> -- <box arguments>`, where `<box arguments>` is what you would write after `box` to run it in the
  foreground (for example `--gpu --no-sync llama-server --port 8080`). It starts the server on the first connection
  and the host stops it after the idle time (default 300). `--start-wait <seconds>` (default 180) bounds the first
  start; a server that answers 503 while loading needs `--ready-path /health`. Keep the data the server needs
  (model files) under `/job` outside `/job/src`. One `box serve` per server, kept running on your machine.

## Free memory, clean up

- `box stop` frees the box's memory and keeps its files (build outputs too): the next call makes it again on the
  same files. Use it between runs while the worktree lives. `box drop` removes the box, its files and its record:
  only when the worktree is going away (run it from inside, before deleting it); the next call starts cold. Both
  refuse while a command or run is going and name the run to end; neither wakes a sleeping host.
- `box drop` prints `it needed <n> MB of its <m> MB at most`: what the machine really used (file cache not
  counted); the smaller size it names would have held it and leaves room for others.
- `box gc` (`--dry-run` to look) removes boxes of deleted worktrees (found missing by two passes 15 minutes apart),
  lists boxes nobody here owns and reports commands over 6 hours; it also runs after ordinary calls (`BOXD_GC=0`
  stops that). Do not stop boxes by hand. `box list` prints every box this machine recorded (`here`, `moved`, `gone`,
  `unseen`: no server asked). "no box <name>" for a box you expect: it may have another name (`--pod <name>`, or
  another worktree); a `moved` box is the copy a worktree left on its old host.
- Boxes vanish after 30 idle minutes (a detached run keeps its box); `/job/src` and your outputs stay.
- `/job` is not an archive: the server removes whole box folders when the worktree was deleted, after the host's keep
  time without a call (`keep_days=` in `box hosts`; 14 days by default, fewer on a host that shares its disk with
  its owner), or least recently used first when its disk is 70 percent full (unused images go too: `box image
  push` again). The next call says `boxd-pod: the folder of this box was removed on <date> (<reason>); it starts empty`.
  Pull what must last. Files of a box in use are never touched; keeping a project's own caches small is its job.

## Caches and tools in the box

- `/cache` holds the package caches of the host (cargo, go, npm, pnpm, pip, Maven, Gradle), shared by all boxes: a
  package is downloaded once per host. The hosts leave through one public address and package sources limit requests
  per address (Maven Central answered 429 for a day in November 2026): a 429 or "too many requests" is that limit,
  not a broken build. Where `echo $MAVEN_ARGS` shows `-s /cache/maven-settings.xml`, Java packages come from the
  caching repository on your own network ("no route to host" for it: its server is off).
- The box points the language tools at those caches through the environment (`CARGO_HOME`, `GOMODCACHE`, `GOCACHE`,
  `npm_config_cache`, `npm_config_store_dir`, `XDG_CACHE_HOME`, `MAVEN_ARGS`, `GRADLE_USER_HOME`;
  the toolbox image also sets `GOPATH`, `PIP_CACHE_DIR` and `MAVEN_OPTS`). A test that brings its own cache is overruled and
  can fail in a way that looks unrelated: `env -u GOMODCACHE -u GOPATH <command>`. A nested container does not
  inherit them: mount `/cache` (`-v /cache:/cache -e MAVEN_ARGS=-Dmaven.repo.local=/cache/m2`,
  `GRADLE_USER_HOME=/cache/gradle`, `npm_config_cache=/cache/npm`) and pass the same `MAVEN_ARGS`.
- Without `--user`, `/cache` belongs to the box's root: an account made in the box (`su builder`) gets "Permission
  denied" there. Make the box with `--user`, or point that account's tools at its own home (`CARGO_HOME=/home/builder/.cargo`).
- `/cache` keeps what a tool downloaded, not what it installed with the system package manager: a Playwright
  browser under `/cache/xdg/ms-playwright` may still need `playwright install-deps chromium` in each new box.
- Memory kills inside a machine box: `box --no-sync -- sh -c 'free -m; dmesg | grep "Out of memory"'` (after a detached
  run: `guest_kills` in `box log <run> --events`); a count above 0 means the kernel there ended a process for lack of memory.

## Never

- Never ssh to the host to build, never build as the build account; the box writes only under `/job` and `/cache`.
- Never relaunch on a message alone, never gate on a pipe, never keep results where git does not ignore them, never put
  a credential in a command or a file, never pin a placed worktree with `--host` on every call.

## Disk full: reset

The whole build area is replaced by a clean copy in seconds (btrfs subvolume swap). It needs an administrator account
on the host; ask the owner which one and how it signs in, then run on the host:

```sh
sudo boxd-reset        # build area, caches kept
sudo boxd-reset all    # also caches
```

`boxd-reset` refuses (exit 1) while the build account has an ssh session or someone holds the keep-awake lock:
another session may be building. A reset removes every box, with or without `--force`; `--force` only overrides that
refusal, so do not add it unless the owner said so. With the power module on, the host also resets the build area by
itself before sleeping when its root file system is 85 percent full.

Source and design: the boxd repository (README).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.