bot-jail (bj): FreeBSD jail supervision for coding agents - state-machine run lifecycle, zfs templates/runs/archive, git broker, hostd reconciliation
  • Scheme 90.6%
  • Python 7.1%
  • Shell 1.1%
  • Makefile 0.6%
  • Common Lisp 0.4%
  • Other 0.1%
Find a file
2026-09-20 14:00:04 -04:00
.githooks Make Android job workflows usable and add model and issue browsing 2026-09-14 15:40:32 -06:00
android Add issue handoff planning workflow 2026-09-19 21:26:03 -06:00
api Add service evidence readers and managed launcher 2026-09-13 16:16:43 -06:00
data Run APK jobs in managed jails with verified harness output 2026-09-14 19:22:21 -06:00
docs Document verified Codex Linuxulator deployment 2026-09-19 14:48:25 -06:00
etc Add issue handoff planning workflow 2026-09-19 21:26:03 -06:00
jerboa-jail/src/jerboa-jail feat: enable production OpenCode jail runs 2026-09-12 22:59:31 -06:00
jerboa-zfs/src/jerboa-zfs Capture ZFS output and exit status together 2026-09-13 22:47:08 -06:00
runtime/opencode Run APK jobs in managed jails with verified harness output 2026-09-14 19:22:21 -06:00
skills/write-issue-handoff Add issue handoff planning workflow 2026-09-19 21:26:03 -06:00
src Add issue handoff planning workflow 2026-09-19 21:26:03 -06:00
tests Add issue handoff planning workflow 2026-09-19 21:26:03 -06:00
tools Run APK jobs in managed jails with verified harness output 2026-09-14 19:22:21 -06:00
.gitignore Make Android job workflows usable and add model and issue browsing 2026-09-14 15:40:32 -06:00
AGENTS.md bj: full system snapshot — all compatibility tiers green 2026-09-12 18:42:17 -06:00
bj-service-apk.md docs: specify BJ service and Android management handoff 2026-09-13 14:39:42 -06:00
bj.md bj: full system snapshot — all compatibility tiers green 2026-09-12 18:42:17 -06:00
jpkg.sexp Add issue handoff planning workflow 2026-09-19 21:26:03 -06:00
Makefile Run APK jobs in managed jails with verified harness output 2026-09-14 19:22:21 -06:00
README.md Document verified Codex Linuxulator deployment 2026-09-19 14:48:25 -06:00
VERSION Add issue handoff planning workflow 2026-09-19 21:26:03 -06:00

bot-jail — bj

bj gives coding agents (Codex, OpenCode, jcode) an isolated writable repository and prepared toolchain inside a FreeBSD jail, using ZFS snapshots/clones to share unchanged blocks. Git pull/push works through a narrowly scoped host-side broker. On agent exit the jail is stopped, all session-history artifacts are durably archived (content-addressed, hash verified), temporary datasets are destroyed, and the history is queued for import into jerboa-llm-search.

bj codex ~/mine/jerboa
bj opencode ~/mine/jerboa
bj jcode ~/mine/jerboa

Implemented in Jerboa (.ss). Management logic never builds shell strings: every privileged operation is an argv list executed through (std os aproc) aproc-spawn*. Two reusable libraries are included:

  • jerboa-zfs/ — typed, argv-based ZFS wrapper (zfs-get, zfs-clone!, zfs-destroy-exact!, ...). No recursive destroy, no silent success.
  • jerboa-jail/ — typed FreeBSD jail wrapper (jail-create!, jail-exec!, jail-stop!, strict jail-config serialization).

Status

See docs/compatibility.md. FreeBSD jail/ZFS execution evidence must be recorded there before any agent support is considered complete. Unit tests run anywhere Jerboa builds; make test-freebsd requires a FreeBSD host with root and a test-owned ZFS pool subtree.

The production batch launcher is verified for OpenCode and Codex under FreeBSD's Linux ABI using Ubuntu Jammy templates. Codex uses OpenAI's complete Linux standalone package inside the template; it is not a native FreeBSD port. The package layout, including codex-code-mode-host and its resources, must be preserved because copying only the codex executable leaves provider requests working while shell tools fail. jcode retains the same batch lifecycle but remains unsupported until its compatibility row carries real provider and tool-use evidence.

Two meanings of saved

  • archived — complete native history artifacts are durably stored outside all temporary datasets and their hashes were verified. This permits destruction of run storage.
  • indexed — llm-search imported the archive successfully. Parser downtime never requires retaining a whole disposable jail.

Layout

src/entry*.ss            binary entries (bj, bj-hostd, bj-gitbroker,
                         bj-git-transport, bj-jail-entry)
src/bj/*.ss              manager modules (run lifecycle, repo baselines,
                         templates, credentials, network, terminal,
                         git broker/transport, collector, cleanup,
                         history, hostd, CLI)
jerboa-zfs/ jerboa-jail/ reusable libraries
etc/                     config example + FreeBSD rc.d script
tests/unit/              host-agnostic unit tests (run everywhere)
tests/run-freebsd        real zfs+jail lifecycle tier (FreeBSD + root)
tests/run-agents         fixture-agent tier: static agent executes
                         inside a real jail; orphan-stop proof
docs/                    compatibility + acceptance evidence

Build

make binary        # builds bin/bj, bin/bj-hostd, bin/bj-gitbroker,
                   # bin/bj-git-transport and bin/bj-jail-entry
make test-unit     # unit tests (host-agnostic)
make test-freebsd  # FreeBSD real zfs + jail lifecycle (root required)
make test-agents   # fixture agent executes inside a real jail (root)
make smoke         # --version / --help for every binary

Quick host setup (FreeBSD)

  1. sudo bj init --dataset tank/bj — creates only the approved manager subtree and root-owned config under /var/db/bj.
  2. sudo make install (or copy etc/rc.d/bj to /usr/local/etc/rc.d) and service bj start — runs bj-hostd.
  3. bj repo add ~/mine/jerboa — registers the repository.
  4. bj template build codex — builds/version the agent template.
  5. bj codex ~/mine/jerboa — run the agent in a jail.

Unpushed code and uncommitted edits inside a run are disposable: push during the run, or use bj export-work RUN DEST while a run is live. History archival preserves conversation artifacts, not your code.