Sandbox images
On this page
With the Apple container and Docker drivers, each session runs in a container made from an image. This page describes the default image and how hosts get it, how a project uses an image of its own (built on the default one, or on another base such as Ubuntu) or builds one from its repository, which images a host runs, and what an image needs.
The default image
ghcr.io/hyperstructure/sandbox is built from
hyperstructure/sandbox, a
public repository whose README lists the versions: Debian 13 (trixie)
with git, the GitHub CLI, build tools, Python and uv, Rust, Node.js,
TypeScript, Bun, Playwright with its browsers, Claude Code and fctl. It is
published for arm64 (Apple silicon) and amd64.
| Tag | Image |
|---|---|
0.5.0 |
fctl 0.5.0's. Hosts of that version use it. |
0.5 |
The newest 0.5 release's. |
latest |
The newest release's. |
The sandbox repository's Image workflow builds every tag from its main
branch, with that release of fctl and the newest Claude Code. fctl's
Release workflow starts it for each release, so a release's image follows
minutes after the release is published.
fctl turns off Claude Code's auto-updater, so an image's Claude Code is as
old as the image: every day, the workflow rebuilds the latest release's
image when Claude Code has a newer release, and once the image is a week
old, for Debian's updates. A change to the image rebuilds it too. A rebuild
moves the tags; to pin one build, add its digest:
ghcr.io/hyperstructure/sandbox:0.5.0@sha256:….
Its labels say what is inside:
| Label | Value |
|---|---|
org.opencontainers.image.version, sh.fctl.version |
fctl's version |
sh.fctl.claude-code.version |
Claude Code's version |
org.opencontainers.image.revision |
the commit of hyperstructure/sandbox it was built from; images built elsewhere have none |
org.opencontainers.image.created |
when it was built |
docker image inspect ghcr.io/hyperstructure/sandbox:0.5.0 \
--format '{{ index .Config.Labels "sh.fctl.claude-code.version" }}'How hosts get it
A host whose host.toml sets no image uses the default image of its own
version, so a host that updates, by itself or with fctl self update,
moves its new sessions to the new version's image. The host pulls the image in the background when
it starts, and a session that starts before it has the image waits for that
pull, or pulls it itself when none is under way: one pull of an image at a
time. A session's log says every 30 seconds how far along the pull is
(with Apple's container, its percentage and speed; with Docker, its
layers), and how long it took. A pull whose connection to the registry
breaks off partway is tried again, three times in all, as is one that
fctl host image pull shows; sessions that waited for a pull that failed
fail with it. When the image can't be pulled, as in the
minutes after a release before its image is published, the host pulls
latest instead, and sessions start from it and say so in their log; not
when the image's download broke off, as latest's, of mostly the same
layers, would too, unless latest is already on the runner. The first
session after the version's image is published pulls it.
The host pulls its tag again when it starts and every 6 hours, so new
sessions start from the newest build of it, with the newest Claude Code.
Sessions don't wait for that: they start from the build that is there, and
a tag that hasn't changed costs one request to ghcr.io. fctl host image pull pulls it now. While the version's image can't be pulled, it pulls
latest instead, and says so: not when the image's download broke off or
the runtime didn't answer, as latest's pull would fail the same way.
- Another image.
imageinhost.toml(orfctl host install --image …) sets the image for sessions whose project sets none, and a project can choose one for its own sessions (Your own image).fctl-agent:latest, the name the default image had when hosts built it themselves, means the default. On another image, the host pulls it when it isn't there, onlyfctl host image pullpulls it again, and the host leaves the default image's tags alone. - Building it.
fctl host image buildbuilds the default image on the host with its driver, from themainbranch of hyperstructure/sandbox, under the same name, so sessions use the build: for a host that can't reach ghcr.io, for instance.--source DIRbuilds from a checkout of the repository instead, to try changes to the image with fctl. The host never replaces a build with the published image, which it tells apart by itsorg.opencontainers.image.revisionlabel;fctl host image pulldoes. - Lima sessions clone the
fctl-baseVM instead, whichfctl host image buildprepares with the image's provisioning script, on Lima's Debian 13 (Debian 12 with Lima older than 2.0, which lacks it). fctl-agent runs as root there throughsudo, which Lima lets the VM's user run without a password; wheresudoasks for one, it runs as that user, and the host's log says the agent's commands can stop it. The process driver uses no image. - Firecracker hosts pull the same images without Docker, and unpack
each in a short-lived microVM, as its layers download, into a
filesystem that the sandboxes made from it share, read only; they boot
a kernel that hyperstructure/sandbox publishes too,
ghcr.io/hyperstructure/sandbox-kernel:<version>. They build projects' images with BuildKit in a VM of each project's own, from BuildKit's image, which they pull from Docker Hub (docker.io/moby/buildkit) for a project's first build (Architecture). - Disk. The host removes the default images that sessions no longer
start from: builds that a newer one replaced, other versions' images, and
latestonce the version's image is there. It does that when it starts, after each pull and after the sweep removes stopped sandboxes, and leaves images built on the host and tags it doesn't pull, like0.4, alone. It removes them without force: with Docker, an image that a sandbox uses, stopped ones too, stays until the sweep removes the sandbox (keep_stopped_hours, or sooner on a low disk), and a build that a newer one replaced keeps the name<tag>-replaced-<the start of its ID>until then. Apple'scontainergives each sandbox its own copy of the image's filesystem, so the host removes them right away, and stopped sandboxes still start. Firecracker keeps them as Docker does.
Its layout
Images built FROM the default image can rely on its layout, which stays
the same from version to version. The sandbox repository's check.sh
checks every build for it:
The user is
agent, uid 1000, with the home directory/home/agentand sudo without a password: the sandbox is the boundary. Sessions run asagent, in~/workspace: Claude and everything it runs, the setup script, git andgh. fctl-agent, which supervises them, runs as root (What fctl writes into a sandbox).The PATH starts with
~/.local/bin, where Claude Code (the native build) and uv's tools are,~/.cargo/binand~/.bun/bin, then/opt/fctl/bin, where fctl copies its supervisor, fctl-agent, at session start. The image sets it, and/etc/profile.d/fctl.shsets it for login shells, which setup scripts run in. fctl itself is in/usr/local/bin.The tools: git, gh, Python 3 (
python3andpython) with uv, Rust through rustup with rustfmt and Clippy, Node.js 26 with npm and corepack, TypeScript (tsc), Bun, build-essential, cmake, pkg-config, OpenSSL's headers, ripgrep, fd, jq, ShellCheck, sqlite3, curl, wget, rsync, zip, tree, ffmpeg, ImageMagick (convert,identify,compare,montage), pngquant and Xvfb (xvfb-run).Browsers: Playwright (
playwright), with its headless Chromium and its WebKit, and the system libraries and fonts that its Chromium, Firefox and WebKit need. A script gets Playwright from anode_modulesof its own; installing the image's version there finds its browsers in place:npm install "playwright@$(playwright --version | cut -d' ' -f2)"Other versions, and the browsers the image leaves out, download with
npx playwright install, without sudo or--with-deps.Rust, Bun and Playwright's browsers are
agent's, in~/.rustup,~/.cargo,~/.bunand~/.cache/ms-playwright: runcargo,rustup,bunandplaywright installasagent. Python is marked externally managed, so packages go into a virtual environment (uv venv,python3 -m venv).
In projects that share package caches, the Docker, Apple container and
Firecracker drivers mount the project's caches at /var/cache/fctl, over
whatever an image has there (Firecracker's VMs over 9P, as the image's
user's files), and fctl-agent points the package managers there, for the
setup script and for Claude: npm_config_cache, pnpm_config_store_dir
and pnpm_config_cache_dir (pnpm 11; pnpm 9 and 10 get theirs in
~/.config/pnpm/rc), COREPACK_HOME, YARN_CACHE_FOLDER and
YARN_GLOBAL_FOLDER, BUN_INSTALL_CACHE_DIR, UV_CACHE_DIR,
PIP_CACHE_DIR, GOMODCACHE and PLAYWRIGHT_BROWSERS_PATH, with
FCTL_CACHE_DIR for the directory itself. Cargo keeps its downloads
beside its tools, so ~/.cargo/registry, ~/.cargo/git and their lock
files become links into the caches. What an image sets stays: its own
variables, a ~/.cargo/registry it comes with, and browsers in
~/.cache/ms-playwright, which the default image comes with: Playwright
keeps other versions' browsers there too, so they download in each
sandbox rather than once into the caches. With Docker, the host gives the
caches to the image's user, agent or another; a host that runs nothing
as root in its sandboxes (agent_as_root = false) leaves that to Docker,
which gives a new volume the owner of the image's /var/cache/fctl
(agent's in the default image). fctl-agent checks it can write to them,
and without that, the session's package managers keep their own.
An image that installs something as root switches back to agent at the
end:
FROM ghcr.io/hyperstructure/sandbox:0.14
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends postgresql-client \
&& rm -rf /var/lib/apt/lists/*
USER agentYour own image
When sessions need tools the default image lacks, such as .NET or a
company's CLIs, give the project an image that has them. A setup script
would install them in every session instead. An image you already have,
on Ubuntu say, works too once fctl and Claude Code are in it (An image
from another base). This example adds the
.NET 8 SDK. .NET needs ICU, which Debian has, and the SDK goes into
agent's home, like Rust. The PATH is set twice: ENV for Claude and the commands
it runs, and /etc/profile.d for login shells, which setup scripts run in:
FROM ghcr.io/hyperstructure/sandbox:0.14
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends libicu76 \
&& rm -rf /var/lib/apt/lists/* \
&& printf '%s\n' 'export DOTNET_ROOT="$HOME/.dotnet"' \
'PATH="$HOME/.dotnet:$HOME/.dotnet/tools:$PATH"' > /etc/profile.d/dotnet.sh
USER agent
RUN curl -fsSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh \
&& bash /tmp/dotnet-install.sh --channel 8.0 --install-dir /home/agent/.dotnet \
&& rm /tmp/dotnet-install.sh
ENV DOTNET_ROOT=/home/agent/.dotnet \
DOTNET_CLI_TELEMETRY_OPTOUT=1 \
PATH=/home/agent/.dotnet:/home/agent/.dotnet/tools:$PATHOf the image's variables, Claude gets the PATH and the locale but not the
others (An image from another base):
dotnet finds its SDK beside itself, and for Claude's commands,
DOTNET_ROOT and DOTNET_CLI_TELEMETRY_OPTOUT go in the project's
variables too.
Build it for both architectures and push it to a registry: Apple silicon runners run arm64 images, most others amd64.
docker buildx build --platform linux/arm64,linux/amd64 \ -t ghcr.io/acme/dotnet-agent:1 --push .Choose it for the project. In Settings → Sandbox → Image, pick "An image from a registry" and enter
ghcr.io/acme/dotnet-agent:1. From the CLI:fctl projects set -p my-app --image ghcr.io/acme/dotnet-agent:1 fctl projects set -p my-app --image "" # back to each runner's ownMaintainers and owners can change it. Sessions that start or resume afterwards in a new sandbox use it; a sandbox that exists keeps the image it was made from.
Hosts run it if their owners allow it. A host that lists
allowed_imagesruns only the images on its list (Which images a host runs); one that lists none runs any.Private registries. Hosts pull images with their own login to the registry: run
docker login ghcr.io(with Apple container,container registry login ghcr.io) on each runner, as the user its host service runs as. fctl sends no registry credentials. For GHCR, a token withread:packagesis enough. Firecracker hosts read the credentialsdocker loginkeeps in~/.docker/config.json(but not those of a credential helper), sodocker loginthere needs Docker's CLI only.
Lima runners don't use images: their sessions run in a clone of the VM
fctl host image build prepared. The process driver uses none either.
An image from another base
An image doesn't have to start from the default one. One your company already has, on Ubuntu with its own toolchains say, runs sessions once it has what fctl needs (What an image needs): fctl, Claude Code, git, gh, bash and a user other than root. fctl-agent, the supervisor, isn't one of them: the host copies its own into each sandbox when it starts a session there, of the host's version, so an image has none to install or update.
This Dockerfile makes Ubuntu 24.04 into a sandbox image: add your packages
and steps to it, or its steps to your Dockerfile. The sandbox repository
keeps it, as
examples/ubuntu/Dockerfile,
and builds and checks it for both architectures.
FROM ubuntu:24.04
# A download piped into a shell fails the step when it fails.
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
# What fctl needs: bash, git, curl and CA certificates (for the installers,
# and git over HTTPS), and the GitHub CLI from GitHub's repository. sudo lets
# the agent install what a task needs: the sandbox is the boundary. Add your
# own packages to the list.
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl git sudo \
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
-o /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
> /etc/apt/sources.list.d/github-cli.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends gh \
&& rm -rf /var/lib/apt/lists/*
# fctl, for every user: a static build, which runs on any Linux. An empty
# FCTL_VERSION installs the latest release. The host puts its own fctl-agent
# into the sandbox each time a session starts, so the archive's goes.
ARG FCTL_VERSION=
RUN curl -fsSL https://fctl.sh/install \
| env FCTL_VERSION="$FCTL_VERSION" FCTL_INSTALL_DIR=/usr/local/bin FCTL_NO_COMPLETIONS=1 sh \
&& rm -f /usr/local/bin/fctl-agent-*-linux
# The user sessions run as, with sudo and the package caches' directory.
# Ubuntu's images come with the user ubuntu at uid 1000: agent takes its
# place.
RUN if id ubuntu >/dev/null 2>&1; then userdel --remove ubuntu; fi \
&& useradd --create-home --shell /bin/bash --uid 1000 agent \
&& echo 'agent ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/agent \
&& chmod 0440 /etc/sudoers.d/agent \
&& install -d -o agent -g agent /var/cache/fctl
# Claude Code, the native build, in ~/.local/bin, as the user. Claude and its
# commands find their tools through the image's PATH, and so do setup
# scripts: Ubuntu's login shells keep it.
USER agent
WORKDIR /home/agent
RUN curl -fsSL https://claude.ai/install.sh | bash
ENV PATH=/home/agent/.local/bin:$PATH- fctl comes from its installer, into
/usr/local/binfor every user: with it, agents name their sessions, ask people, publish screenshots and keep their project's memory. Its Linux builds are static, so they run on any distribution, on arm64 and amd64.--build-arg FCTL_VERSION=0.37.0pins a release; without it, the latest. The archive has the Linux fctl-agent beside fctl, which the image doesn't need. - Claude Code installs as the user sessions run as, into
~/.local/bin, which the image'sPATHnames. - The user. Sessions run as the image's
USER, in~/workspace: a user with a line in/etc/passwd, where fctl-agent finds its home, and a home it can write to. Ubuntu's images from 24.04 come with the userubuntu, uid 1000, which sessions could run as too (USER ubuntu); the example gives the imageagent, as the default image has. sudo without a password lets the agent install what a task needs./var/cache/fctlis the user's, as in the default image: projects that share package caches mount them there (Its layout). - The environment. Claude and its commands get the image's
PATH,LANG,LC_ALL,TZandTMPDIR, and none of its other variables: put tools on the PATH, and set the variables they need in the project's Settings → Sandbox → Environment (fctl projects set -p my-app --env JAVA_HOME=/opt/java). The setup script gets the image's whole environment, in a login shell (bash -lc). Ubuntu's login shells keep the image's PATH, but Debian's and Alpine's/etc/profileset one of their own, so an image on those names its directories in/etc/profile.dtoo, as the default image does:echo 'PATH="$HOME/.local/bin:$PATH"' > /etc/profile.d/fctl.sh, as root. - What the image starts doesn't run. fctl gives each sandbox a main
process of its own (
tail -f /dev/nullin a container, fctl-agent in a Firecracker VM) in place of the image'sENTRYPOINTandCMD: a database or another service the image would start, the project's setup script starts instead. - Keep it current. fctl turns off Claude Code's auto-updater, so the
image's Claude Code is as old as the image, and agents reach fctl's new
features through the image's fctl. fctl tells agents only of the
commands it has: the session's log says when it lacks those that rename
the session, keep the project's memory, reach its tickets or run an
autopilot or a review agent, and others, like asking people or
publishing screenshots, the agent goes without. Build the image again
for fctl's releases, with
--no-cacheor a newFCTL_VERSION, since Docker would otherwise reuse the steps that installed them; the default image is also rebuilt on each day Claude Code has a new release. - Other distributions take the same steps with their own packages. On
Alpine:
apk add bash ca-certificates curl git github-cli sudo shadow(Claude Code needs bash, andshadowhasuseradd), and the PATH in/etc/profile.d.
The sandbox repository's
examples/check.sh
checks an image for what fctl needs: it runs in the image as its user, in
place of the image's ENTRYPOINT as in a session, and says what's
missing.
curl -fsSL https://raw.githubusercontent.com/hyperstructure/sandbox/main/examples/check.sh -o check.sh
docker run --rm -i --entrypoint sh my-sandbox -s < check.shThen build the image for both architectures, push it and choose it for the project, as Your own image describes.
Building it from the repository
A project can build its image from a Dockerfile or a dev container configuration in its repository instead, so that the environment lives next to the code and changes with it. In Settings → Sandbox → Image, pick "Built from the repository" and name the file, or from the CLI:
fctl projects set -p my-app --build Dockerfile
fctl projects set -p my-app --build docker/agent.Dockerfile --build-context app
fctl projects set -p my-app --build .devcontainer/devcontainer.json
fctl projects set -p my-app --build "" # stop buildingThe project needs a repository, and its build replaces any image it chose.
Only hosts whose owners allow builds from the repository take its sessions
(allowed_builds, below), and only those with
the Apple container, Docker or Firecracker driver.
When a session starts in a new sandbox, the host:
- Reads the file at the tip of the project's default branch, with the session's GitHub token, and works out what the build reads: the Dockerfile, and the directory it builds in (the repository's root unless the setting or the dev container configuration names another).
- Uses its last build when none of that changed since. Changes outside
the directory don't count, but with the repository's root as the
directory, every change does. In a busy repository, give the image a
directory of its own (
--build-context docker, say, or the.devcontainerdirectory a dev container configuration builds in by default); the builder's cache keeps the builds that follow short anyway. - Otherwise downloads the repository at that commit (up to 2 GiB), keeps
only the directory, and builds the image with
docker build,container buildor, with Firecracker, BuildKit in a VM of the project's own (whose image,docker.io/moby/buildkit, the host pulls from Docker Hub for the first), from the Dockerfile's text as GitHub sent it. The session's log shows each step. Sessions that need the same build wait for the one that builds it. Builds pass no secrets: a Dockerfile that needs a token should leave that step to the setup script. - Tags the image
fctl-build-<project id>:<hash>, and removes the project's earlier build, unless the runtime keeps it for a sandbox made from it (Docker does).
When GitHub can't be reached, sessions start from the last build of the
same setting and say so; any other problem, like a file that isn't there,
fails the session with the reason. A dev container configuration's
image, with no build, is used as it is, from its registry.
Limits. A host builds one image at a time, and reads no Dockerfile or
configuration larger than 1 MiB. A build that takes longer
than build_timeout_minutes (60) is stopped, and an image larger than
max_build_mb (20 GiB) is removed, where the runtime reports image sizes
(Docker and Firecracker do); the session fails and says why. A build runs
in the runtime's builder, not in a sandbox, so the project's CPU and memory
settings don't apply: with Docker it gets what the Docker daemon has (on
macOS, its VM), with Apple container what its builder VM has (container builder start --cpus 8 --memory 16g sizes it), and with Firecracker the
host's default sandbox size (cpus and memory_mb in host.toml).
What fctl reads from a dev container configuration. image, or
build.dockerfile, build.context, build.args and build.target
(dockerFile and context at the top level in older ones), with paths
relative to the configuration's directory. It leaves out features,
lifecycle commands like postCreateCommand, containerEnv, mounts and
runArgs, and says so in the session's log: put what they install into
the Dockerfile, and what they run into the project's setup script.
Sessions run as the image's user rather than remoteUser, so end the
Dockerfile with USER vscode, say, to run as that user. Docker Compose
configurations aren't built.
The image still needs what every image needs (below):
most dev container images lack Claude Code and fctl. Start the Dockerfile
FROM ghcr.io/hyperstructure/sandbox:0.14, or install them in it as An
image from another base does: fctl for every
user, and Claude Code as the user sessions run as.
Which images a host runs
A project's image and its build run on machines that belong to other
people, with the session starter's Claude token and the session's GitHub
tokens inside them (Security). So each host's
owner decides, in its host.toml:
# Images projects may choose; the host's own `image` always runs. Unset: any.
allowed_images = [
"ghcr.io/hyperstructure/sandbox", # any tag of it
"ghcr.io/acme/*", # anything under ghcr.io/acme/
"ghcr.io/partner/agent@sha256:4f1c…", # this build only
]
# Repositories whose Dockerfile or devcontainer.json it builds. Unset: none.
allowed_builds = ["acme/*", "partner/app"]
build_timeout_minutes = 60
max_build_mb = 20480The same lists from the CLI, each flag repeated for more entries
(--allow-image '*' allows any image, --allow-build "" none):
fctl host install --allow-image 'ghcr.io/acme/*' --allow-image ghcr.io/hyperstructure/sandbox \
--allow-build 'acme/*'- An entry of
allowed_imagesis a reference without a tag, which allows any tag or digest of that repository; with a tag, which allows that tag but not a reference that pins a digest to it, since a pull by digest ignores the tag; or pinned to a digest (@sha256:…), which allows only that build, and only when the project's reference names the digest too, since a tag can move. An entry that ends in/*allows everything under that registry path, and*alone allows any image. Docker Hub's names count as Docker does:ubuntuisdocker.io/library/ubuntu. - An entry of
allowed_buildsisowner/nameorowner/*on GitHub. Whoever can push to a project's default branch decides what its builds contain, including the images they startFROM. - Without the lists, a host runs any image a project chooses, as hosts did before them, and builds none. Hosts of older versions do the same.
The host sends the lists to the control plane when it connects, so run
fctl host restart after editing host.toml. The control plane gives a
session only to a runner that runs its project's image or builds it, and
the runner checks again. A session that no runner online allows stays
queued and says why: "No runner allows this project's image,
ghcr.io/acme/agent:1", or "No runner builds this project's image from
acme/app". Admin → Runners, fctl admin runners and fctl host status
show each runner's image and lists.
What an image needs
An image that doesn't start from the default one needs what follows
(An image from another base builds one on
Ubuntu, and the sandbox repository's examples/check.sh checks an image
for it). It needs no fctl-agent: the host copies its own in (What fctl
writes into a sandbox).
/bin/sh,tail,id,cat,mkdir,chown,chmod,mv,rmandstatin/usr/binor/bin, where the host runs them in the sandbox. A container's main process istail -f /dev/null, in place of the image'sENTRYPOINTandCMD, andid -utells fctl who the image's user is.- git, with CA certificates for HTTPS, on the PATH: fctl-agent clones the project's repositories with it.
- bash, which runs the project's setup script, in a login shell.
- Claude Code 2.1.101 or later, as
claudeon the PATH. fctl relies on requests that Claude Code sends and answers in its stream-json mode: it asks fctl for a fresh OAuth access token (oauth_token_refresh, from 2.1.101), and fctl turns Remote Control on (remote_control, from 2.1.63). fctl-agent runsclaude --versionbefore it starts Claude, and the session fails with a message that says so when Claude Code is missing or older. gh, which fctl-agent asks for the pull request of the session's branch. Without it, sessions show no pull request.- fctl on the PATH, for agents to name their sessions, publish
screenshots, keep their project's memory and record retrospectives
(
fctl memoryandfctl retroneed an fctl that has them; agents update their retrospectives where it hasfctl retro update, and record one for each follow-up where it doesn't). Without it, sessions keep the title they start with, and their agents keep no memory. - A non-root user with a writable home, and a line in
/etc/passwd, where fctl-agent finds its home (without one, its home is/). fctl copies its supervisor into/opt/fctl/binas root at session start, gives the directory to root, and runs the supervisor as root, and Claude and its commands as the image's user (itsUSER), in~/workspace. An image that runs as root runs Claude as root, whose commands can stop fctl-agent. - arm64 builds for Apple silicon runners, and amd64 for most others.
What fctl writes into a sandbox
At session start, fctl copies fctl-agent into /opt/fctl/bin, which it
gives to root, and starts it as root (docker exec -u 0, sudo in Lima,
root in a Firecracker VM). It keeps root as its real user, so that the
image's user, whom Claude and its commands run as, can't signal it: a
kill or pkill that matches it by accident fails with "Operation not
permitted". Otherwise it works as that user, so what it writes in the
user's home is the user's. Where the sandbox gives root the capability
(CAP_SYS_RESOURCE: Lima's and Firecracker's VMs do, Docker's containers
don't), it keeps itself from the OOM killer, so that a build that fills
the sandbox's memory takes the build rather than fctl-agent. Root can
still stop it, and agent has sudo: this guards against accidents, not
against an agent set on it. A host whose owner turns this off
(agent_as_root = false in host.toml) runs nothing as root in Docker,
Apple container and Lima sandboxes: the image's user puts fctl-agent in
its own ~/.fctl/bin and runs it, with its files in ~/.fctl, where the
agent's commands can stop it. A sandbox where it already ran as root
keeps it so. It writes:
/var/lib/fctl-agent/, which only root may enter: fctl-agent's socket for the host, its log, and the session's journal and state. A sandbox from before fctl-agent ran as root has them in~/.fctl, which fctl-agent moves here once the one that ran there has stopped.~/.fctl/: the session socket the sandbox's fctl reaches fctl-agent on, the session's GitHub tokens (mode 0600) and the git credential helper that hands them out.- git's global configuration: the GitHub App's bot as the author, the
credential helper for github.com,
push.autoSetupRemote,init.defaultBranchand a few quiet defaults.~/.config/gh/hosts.ymlgivesghthe token that can write. ~/.claude.json: Claude Code's onboarding and the bypass-permissions prompt marked done, the auto-updater off, the working directory trusted, and the Claude account of the person who started the session. The rest of the file stays.~/.claude/settings.json: the image's own settings, with fctl's over them. fctl decides the permission mode (bypass),attribution(the trailers the project's settings ask for),disableClaudeAiConnectorsand the auto-updater, and removesapiKeyHelper,ANTHROPIC_*and provider variables fromenv, andpermissions.disableBypassPermissionsMode. Plugins, marketplaces, hooks, permission rules and other variables stay, and so do skills in~/.claude/skills.~/.claude/CLAUDE.md: a line that imports~/AGENTS.md, fctl's instructions for agents, after whatever the image has there.~/workspace, the project's repository, on the session's branch;~/repos/<owner>/<name>for its other repositories; and~/attachments/for files people attach.
Claude's environment has the project's variables and secrets,
CLAUDE_CODE_OAUTH_TOKEN and its scopes, IS_SANDBOX=1,
DISABLE_AUTOUPDATER=1, GIT_TERMINAL_PROMPT=0, FCTL_SESSION_ID,
FCTL_SESSION_URL, FCTL_SESSION_SOCKET, the sandbox's size in
FCTL_SANDBOX_CPUS and FCTL_SANDBOX_MEMORY_MB, and in projects that keep
a memory CLAUDE_CODE_DISABLE_AUTO_MEMORY=1. ANTHROPIC_* variables and
the Bedrock, Vertex and Foundry switches never reach it. The setup script
has the image's environment, the project's variables and secrets, the
clouds' variables, the sandbox's size and, on hosts after fctl 0.38.1,
FCTL_SESSION_ID, FCTL_SESSION_URL and FCTL_SESSION_SOCKET, so that
fctl id-token works there as it does for the agent.