This page covers building abx from a checkout, the checks a change must pass, and how to work on the documentation site. For a map of the code, read Architecture first. Report suspected security vulnerabilities privately; see Security.
Set up
You need an Apple Silicon Mac with Node.js 24 or later (CI tests Node 24 and 26), pnpm 12 (the packageManager field in package.json pins it) and the Xcode Command Line Tools. smolvm 1.38.2 is needed only to run the real-VM e2e tests and to try the CLI.
Linux development targets x86_64 and arm64 on glibc. musl is out of scope. You need:
- Node.js 26 (
engines.nodeis>=24, and Linux CI uses Node 26) and pnpm 12. clang,build-essentialand GNUmake. On Linux the Makefile setsSCRIPTC_LINKER=clang, andgccdoes not work withscriptc.- Host tools the tests call:
/usr/bin/sqlite3, Git 2.39 or later at/usr/bin/git, coreutils (timeout,mkfifo,sleep,rm,sha256sum) andpython3for the native FFI test drivers. - For the real-VM e2e tests: read and write access to
/dev/kvmfor your unprivileged account, localext4for state, and a verified smolvm 1.38.2 install.
Then, from the repository root:
pnpm install --frozen-lockfile
makepnpm install runs the native install of scriptc (allowBuilds in pnpm-workspace.yaml). make bundles the embedded guest and helper scripts, compiles the C files in apps/cli/native into build/<os>-<arch>/, links build/<os>-<arch>/abx with scriptc, and publishes build/abx. scriptc is the real compiler for this code, so passing the type check does not mean make passes: run both. The build is described in the apps/cli README.
All packages are private and have no per-package scripts. Run everything from the repository root.
Run the checks
| Command | Does |
|---|---|
pnpm run build |
Same as make. |
pnpm run build:scripts |
Rebuilds the generated embedded script modules. |
pnpm run check |
node scripts/build-embedded.mjs --check and tsc --noEmit. |
pnpm run test |
Unit tests of the CLI, all packages and scripts/. |
pnpm run test:e2e:novm |
Runs make, then the compiled-binary e2e tests that need no VM. |
pnpm run test:e2e:kvm-smoke |
Runs make, then checks a real Linux KVM box with an image that has no third-party agents. |
pnpm run test:e2e |
Runs make, then every test in apps/cli/e2e except the KVM smoke test: the non-VM tests plus the real-VM tests with the pinned agents. |
make test-native |
Compiles and runs the C FFI host test suite. |
make test-native-pty |
Compiles and runs the native PTY and terminal probe suite. |
pnpm run format |
Formats the sources. pnpm run format:check only checks. |
pnpm run lint |
Lints apps, packages and scripts. |
Before you open a pull request, pnpm run check, pnpm run lint, pnpm run test, pnpm run format:check and pnpm run test:e2e:novm should pass. The pull request template lists the same five.
Test tiers
- Unit tests sit beside the source as
*.test.ts. They fake smolvm and build temporary Git repositories, so they need no VM. To run one package, usepnpm exec vp test run packages/git. - Native C and FFI tests run through
make test-native,make test-native-ptyandpython3 apps/cli/e2e/native/installed-host.py. - Compiled-binary tests without a VM run through
pnpm run test:e2e:novm. They cover help, auth status, the wizard, launch preflight, diagnostics and the TUI. - Linux KVM smoke runs through
pnpm run test:e2e:kvm-smoke. It builds the pinned base image and exercises a real offline box with the compiled CLI. It needs network access. - Full real-VM suite runs through
pnpm run test:e2e. It builds an image with the pinned agents, creates machines and runs the Git round trip. It needs smolvm 1.38.2, virtualization (/dev/kvmand localext4on Linux) and network access.
When you run the binary by hand, set ABX_HOME (and ABX_SMOLVM_STATE_DIR when testing smolvm state) to a scratch directory, so you do not touch ~/.abx or your default smolvm machines. On Linux that directory must be on local ext4.
Continuous integration
.github/workflows/ci.yml runs on pushes and pull requests to main, in three job groups:
check: macOS (macos-26runners) with Node 24 and 26. Both run the unit tests andtest:e2e:novm. Node 26 also runs the native drivers, the installed-host probe, the formatter, the linter and the type check.linux: Ubuntu 24.04 onx86_64(ubuntu-24.04) andarm64(ubuntu-24.04-arm) with Node 26. Unit tests, native drivers, a verified smolvm 1.38.2 install,test:e2e:novm, format, lint, type check, and ash -nand ShellCheck pass over the installer.linux-kvm: Ubuntu 24.04x86_64with/dev/kvmand a verified smolvm 1.38.2 install, runningpnpm run test:e2e:kvm-smokeand thenpnpm run test:e2e.
A final job, CI required, passes only when all three groups succeed. Releases depend on a successful CI run for the tagged commit; see Releases. The release workflow builds the macOS binary on macos-15, not on the macos-26 runners CI uses.
Embedded scripts
abx compiles to one standalone native binary, which cannot read loose script files at runtime. Scripts therefore live as real, linted source files and are bundled into *.gen.ts modules at build time by scripts/build-embedded.mjs. The rules, in brief (the full policy is in AGENTS.md):
- Do not write inline shell, Node.js or awk scripts as strings or template literals in
.tsfiles, and do not interpolate TypeScript variables into generated script source. - Code that runs inside a VM belongs in
packages/guest. Add the payload type, implement the command with a unit test, wire it into the dispatcher, and call it from host code only through the typedguestCommand(...)builder. - Host Node.js helpers keep their logic in a normal module with a thin
*.script.tsentrypoint registered inscripts/build-embedded.mjs. - Use POSIX
sh(*.sh) only where a shell genuinely beats Node. Start with#!/bin/shandset -eu, pass structured inputs throughABX_*environment variables, and check syntax withsh -n. - Never edit
*.gen.tsfiles by hand. After changing guest, image, git or Codex helper sources, runnode scripts/build-embedded.mjs.node scripts/build-embedded.mjs --checkfails when a generated file is stale, andpnpm run checkincludes it. - Changes to
packages/guestchangeartifactDigest, which invalidates older templates. The tests that pin the expected digest values must be updated with the bundles.
Add a command
-
Create
apps/cli/src/commands/<name>.tsthat exports aCommand: name, summary, usage, arguments, flags (built withflag()fromflags.ts), notes, examples andrun. ThrowUsageErrorfor bad input, so the exit status is 2.rm.tsis a small example. -
Add it to
COMMANDSincommands/registry.ts. Help,abx help --jsonand dispatch all come from that list. -
Put the logic in
apps/cli/src/boxesor a package, not in the command file.commandsmay importboxes, butboxesmust not importcommands. -
Add tests beside the command, and update
apps/cli/e2e/help.test.tsif the help output changes. -
Document the command on this site under CLI reference, and check it against
abx help --json.
Add an agent
Follow the steps in the agent-api README. In short: create packages/agent-<name> that exports one AgentAdapter, add the name to AgentName, register the adapter in apps/cli/src/agents.ts, add a wizard label, and run the checks and make. Then add a page for the agent under Agents, and a README beside the adapter.
Pull requests
- Keep a change focused, and explain the reason for it in the description.
- Run the five checks above before you push. CI runs them again on macOS and Linux.
- Every
abxcommand in the documentation must exist in the current binary with that syntax. Check it withabx help <command>. - Packages must not name
abxcommands in their errors.apps/cli/src/output/errors.tsadds those. - Update the documentation when behavior changes, and the CLI reference when commands or options change.
Working on this documentation site
The documentation site lives on the orphan branch docs-site of the same repository. It shares no history with main and never merges into it. Work on it in a separate worktree:
git worktree add ../agent-box-docs docs-site # from an agent-box checkout
cd ../agent-box-docs
npm ci
npm run dev # http://localhost:4321/agent-box/The site is built with Nimbus (Astro) and uses npm with its own lockfile, separate from the pnpm workspace on main. Pages are .mdx files in src/content/docs/. The folder tree is the URL structure and the sidebar, and sidebar.order in the frontmatter orders pages within a group. Components such as Steps, Tabs and Aside are available in every page without an import. Content shared by several pages goes in src/content/partials/ and is included with <Render file="..." />.
Rules for page content:
- The source of truth is the code on
main, not these pages. Before you write or change a claim about a command, option, default, path, environment variable, error code, exit code or version, find it in the TypeScript onmainand inabx help --jsonfrom a build ofmain. If you cannot confirm it, leave it out. - Write internal links from the site root with a trailing slash (
/get-started/quickstart/), never with/agent-box. Link source files athttps://github.com/sandrinodm/agent-box/blob/main/<path>. - Examples pin the current release and smolvm: abx 0.3.0 and smolvm 1.38.2.
- Give every code block a language, and do not repeat the page title as a heading.
Before you push, check, build, then check again, because link checking needs the build:
npx @cloudflare/nimbus-docs check
npm run build
npx @cloudflare/nimbus-docs checkCommit only to docs-site. The .github/workflows/pages.yml workflow on that branch builds every push and pull request and deploys pushes to GitHub Pages. Nothing rebuilds the site when main changes, so when behavior changes on main, update the pages here and push to docs-site. The AGENT.md file on the branch has the full instructions, including those for coding agents.