A new tool shouldn’t need a new image

How a viff task gets a tool its image doesn’t carry, while it runs: the pkg system.

Written in November 2026, and true as of then; the published docs (systems) are kept true as the tree moves.

A viff task works in a sandbox. It can use the tools its runner implements (git, github, slack, linear-issue, viff) and the programs the runner’s image carries. It still can’t use a package the image doesn’t carry, such as a toolchain, a CLI or a library.

This article covers that. The answer is one more system in viff’s systems model: a spawn’s environment says which packages a task gets, the runner’s ceiling bounds it, and the autonomy decides each install.

This is one of three articles on what a task lacks, and how the runner gives it:


The rule it follows

A task never holds a credential, and never chooses which credential goes where.

The runner acts for the task. Before each act it checks three things again, from its own copy of each: the environment, which whoever spawned the task wrote, and which says what this task is given; the autonomy, also the spawner’s, which says allow, deny or ask a person for each act; and the ceiling, which the runner’s operator wrote, and which is the most any task of this doer may be given. The first article has the rule in full, and the secret store the runner reads its credentials from.


Debian packages, installed while the task runs

Today a task gets the programs the runner’s image carries, and nothing else: every repository that needs another toolchain or CLI has meant a new image. The pkg system lets the runner install Debian packages into a prefix of the task’s own, while the task runs, each install decided like any other act.

The whole mechanism is one read-only bind. When a task starts, the runner makes it an empty install root and binds it read-only at /inst, with /inst/bin first on the task’s PATH. Installing afterwards is the runner writing files into that root on its own side, which the task sees appear through the bind. No new mount, no capability, no daemon; which is why an install can happen mid-run, the thing the nix plan had to leave open.

tony
# the runner's configuration
pkg:
  cellar: /state/cellar                   # installed prefixes, shared by the tasks, on a volume
  manager: apt
  repos: ["deb http://deb.debian.org/debian bookworm main"]
  collect-above: 50Gi                     # evict the oldest unused prefixes past this size
agents:
  claude:
    systems:
      pkg:
        ceiling: {install: {pkg: !glob "*", as: null}} # what a spawn may give: any install, under any name
        base: [jq]                        # what every claude task starts with

# a spawn's environment
environment:
  systems:
    pkg: {install: [{pkg: ripgrep}, {pkg: jq, version: "1.7.1-1", as: jq-v2}]}
    # as: the command's name on PATH — pkg's own `as`, explained below; not secret's variable

install is the system’s one verb, and pkg, version and as are its fields, so a ceiling admits installs by pattern ({install: {pkg: !glob "*"}}) the way it pins a channel or a ref. The shapes then sort themselves into two kinds:

  • A pinned shape — every field a single literal, the package named — is installed before the process starts, with no row asked: the spawner already said exactly what lands, as with a checkout. A failure refuses the launch, naming the package. The operator’s base is installed the same way, under the packages’ own command names.
  • A shape with a pattern anywhere admits installs the task asks for as it runs, each one a step (pkg.install), decided by the autonomy like any other act.

What as means. In every system that has one, as answers “under what name does the task see this”: secret-exec’s names the variable a command gets the value in, and pkg’s names a command on PATH. An install puts the package’s commands on the task’s PATH, and as is the one knob over their names:

  • No as: every command the package ships lands under its own name. ripgrep lands rg; a package shipping several commands lands them all.
  • as: <name>: exactly one command is landed, renamed. Which one is never guessed: it is the command named like the package itself (jq’s jq), or the only command the package ships; a package shipping several commands, none named like it, refuses the as, naming the commands so the spawn can be rewritten without it.
  • The point of as is versions side by side: {pkg: jq, version: "1.6-2.1", as: jq-v1} beside {pkg: jq, version: "1.7.1-1", as: jq-v2} is two installs, two names, one task.
  • A package the image already provides is answered “on PATH already”, and an as on it is refused: the runner won’t pretend to rename a command it didn’t install.
  • A shape that says nothing of as renames nothing, an environment’s and a ceiling’s alike: {pkg: !glob "*"} is any package under its own commands’ names. A rename is admitted by a shape that names it (as: jq-v2, a pattern, or null for any), because a name is how a program is found, by a person reading a step and by a command run with a secret.

The step carries what the call asked: a call naming no version means the newest the index names, resolution happens in the act, and the reply says what landed, name and version.

sequenceDiagram
  autonumber
  participant A as agent (sandbox)
  participant R as runner
  participant X as apt (resolve only)
  participant D as deb.debian.org
  participant C as cellar
  A->>R: pkg-install {pkg: ripgrep}
  R->>R: step pkg.install pkg=ripgrep<br/>environment, autonomy, ceiling
  R->>X: resolve against the signed index<br/>(refreshed when stale, verified by the image's keyrings)
  X-->>R: ripgrep 14.1.0-1 and its closure:<br/>each package's name, version, URL and SHA256
  R->>D: fetch each .deb, plain HTTP
  R->>R: verify each against the index's SHA256
  R->>R: extract with dpkg-deb, no maintainer script run,<br/>assemble a prefix, runpaths set with patchelf
  R->>C: the prefix, immutable, kept for later tasks
  C-->>R: hardlinked into this task's /inst
  R-->>A: installed ripgrep 14.1.0-1: rg, on PATH

How it holds:

  • No credential, anywhere. The trust is the archive’s signed index, verified by gpgv and the keyrings the Debian base image already carries: the same trust the image itself was built on. pkg is the one system of the three with nothing in the store, and the fetch being plain HTTP costs nothing, since every byte is checked against the index’s SHA256.
  • apt resolves; it never installs. The runner runs apt-get as itself, non-root, against a state directory of its own under the cellar, only to read the index and compute the closure. It reads each package’s SHA256 from the verified index, fetches and checks each .deb itself, and unpacks with dpkg-deb.
  • Maintainer scripts never run. A Debian package can carry install-time scripts; the runner executes none of them. The one stanza nearly every library ships, the stock ldconfig call, is recognised and ignored, since runpaths make it moot; a package whose scripts do anything more is refused, by name.
  • Runpaths instead of ldconfig. A prefix is self-contained: its commands in bin, the closure’s libraries flat in lib, and every ELF given $ORIGIN runpaths with patchelf. So nothing touches the system’s linker configuration, and two tasks’ versions of a library never meet.
  • The cellar is immutable and shared. An install lands at <cellar>/<name>/<version>, staged and renamed into place, then hardlinked into each task’s install root: a second task’s install of the same version is a link, not a download. Past collect-above the oldest prefixes are evicted, and a running task keeps what it holds, since its links keep the inodes alive. A prefix holds only what the image lacked, so it keeps the closure it was built from, and one a new image no longer fits is built again rather than reused.
  • The task can write none of it. /inst is one --ro-bind, and the cellar lies outside every sandbox. Under -sandbox none, or in an image without the toolchain (apt-get, apt-cache, dpkg-deb, patchelf), the runner closes pkg and says so at start.
  • A command with a secret starts from it too. secret.exec’s sandbox binds the task’s install root as the task’s own sandbox does, and holds argv[0] to a system directory, a readOnly path or that root. The root is the runner’s writing, from the same signed index the image’s own /usr was built from, and the task cannot write it. It is how a CLI the image doesn’t carry gets to run with a key, instead of waiting for a new image. What the task does have is the choice of what is installed: /inst/bin is first on its PATH, so an installed name wins over the image’s where both have it. So beside a secret, the pkg shapes bound which program a name is: a pinned package and version is that program; a pattern on the package is any of the index’s that ships the name; and a name of the task’s own choosing (as) is admitted only by a shape that says so, which is what keeps make from being installed as npm under a shape written for npm view.

Why apt, and not nix. The nix plan (2b5art3x) got packages in at the start, and its limitations table was long: a separate single-user store to defend, flake code evaluated on the runner’s side, about 2,900 store paths at most under bwrap’s argument limit, a bwrap no Debian ships, and installing during a run still open at the end of it. The stone-age model spends all of that: the manager is the image’s own apt, the trust is the keyring the image already carries, the bind is one, and installing during the run — the point of the system — is just the runner writing files. What it gives up is nix’s reach: one distribution’s index, one libc family, and nothing built from source. Those are the limitations below, and they are the cheaper set.

Limitations, as built:

Limitation Why What lifts it
The index is the catalog a version names one today’s index names; Debian’s archive moves, and a version the index dropped can’t be fetched a frozen-manifest resolve mode, open
One libc family prefixes are built against the image’s glibc; musl is another world an apk wrapper, if a musl image earns one (2k5art3x, open question 4)
Binaries and libraries, not services nothing is started, no user is made, no system path is written; a package that only works installed as root doesn’t work here
No list verb what’s installed is what the environment and the replies already say 2k5art3x’s open question 2, if it earns its keep
Edit on GitHub · viff is a shared runtime for a team's software delivery work.