garage44.eu/jeroen/pinnacle

logclone: git clone https://garage44.eu/jeroen/pinnacle.git

.. /docs/agent-workbench.md

raw

Code tasks: the agent at a workbench

A design, 2026-11-26 (session s855), for the question the person asked once the agent was built: can the agent do code work — on Pinnacle, or on another Pinnacle? It builds on agent-environment.md ("Developing on the device") and on what is built: verbs with effects, the sealed gatekeeper, the confirmation screen, the taint rule, p2p streams with a service tag.

The answer in one paragraph

Code is not built on Pinnacle: there is no compiler for it there (rustc is LLVM, which is C++) and there will be no shell. It is built on a workbench: a small program on a machine that has a toolchain — a midas node, a workstation — which is a contact of the person's devices and offers verbs over the p2p layer like any service. The agent never gets a shell. It gets the workbench's verbs — open a task, read, search, write, run a check, look at the diff, commit, propose — each with its effect, and the workbench does them in one git worktree per task, every command it runs in a sandbox with no network and no view outside that worktree. Inside the worktree nothing is asked, because nothing there is final: git is the undo. The one thing that leaves the machine, proposing the work as a branch for review, is confirmed on the person's screen each time, and never touches main. A Pinnacle reaches another Pinnacle's services the same way, so "another Pinnacle" and "a build machine" are one mechanism.

What can go wrong, and what holds

Assume the model is hijacked, as everywhere in the agent. Here the means are richer: a source file, a commit message, an issue text or a vendored crate can carry instructions, and the agent reads all of them.

What an attacker controlsWhat it could reachWhat holds
Any verb the gatekeeper lets through, any argumentsFiles outside the task; other tasksPaths are checked by the workbench: relative, no .., no .git, no symlink leading out; one worktree per task, chosen by the workbench
Any file in the worktree, so build.rs, proc macros, tests: code that runs at build timeThe machine's keys (~/.ssh, the Forgejo token), other worktrees, the networkEvery job runs sandboxed: the root read-only, writable only the worktree and its target directory, an empty home, no network, no other processes; the environment emptied. No sandbox on the machine: no jobs at all (it fails closed)
git itself (hooks, config in the repository)Code run by git outside the sandboxHooks off (core.hooksPath=/dev/null), the workbench's own git config, no include
A command lineAnything a shell canThere is none: a job is a name from the machine's own list (check, test, clippy, fmt) with an optional package and test filter, checked as identifiers; the argv is the machine owner's
The proposalmain, other people's branches, a public leak of private codeThe workbench pushes only agent/<task> to the remote its owner configured, with its own credential, outside the sandbox, after the person allowed it on their screen; it has no verb that pushes elsewhere
Time and spaceA machine kept busy, a disk filledPer job: wall-clock and CPU limits, output capped; per task: minutes of jobs; per machine: one job at a time, tasks cleaned after a week or on close

And what is not claimed: the sandbox is the operating system's (Linux namespaces through bwrap, macOS's sandbox-exec), so it is as strong as those; a proposal's content is the person's to review before it lands, as any branch is. The workbench is not a CI, and does not replace the gate.

The parts

1. Remote services over p2p

A contact's service is reached like a local one, through the p2p service:

2. The workbench

A program of its own (workbench/), Rust with std only, for Linux and macOS, which runs the p2p layer as a Pinnacle device does (the p2p crate is pure, so it runs on a host as it runs in Pinnacle) under an identity of its own, and serves one service, workbench. Its owner configures, in one file: the repositories it may work in (by name, a local clone each), the remote and credential a proposal goes to, the jobs and their argv, the limits, and the contact keys allowed to use it.

Its verbs, with their effects:

VerbEffectUndone by
reposreads
open repo, baseown: a worktree and branch agent/<task> from baseclose
files path, read path, from, lines, search pattern, pathreads; untrusted (the repository is many people's text)
write path, text; edit path, old, newown (the worktree)write with what was there, or remove
run job, package, filterown (the worktree's target directory); answers at once with a job
job id, waitreads; untrusted (a build's output is the repository's)
diffreads
commit messageown (the task's branch)uncommit
propose titleout: the branch pushed for review
closeown: the worktree removed, the branch kept

A task id is the gatekeeper's task, so asking twice is answered once.

3. Jobs, sandboxed

A job is cargo <job> --offline --locked with the package and filter the call named, in the worktree, with CARGO_TARGET_DIR a directory of the task's. On Linux it runs under bwrap: / read-only, the worktree and target read-write, a fresh /tmp and an empty $HOME with the toolchain and the crate registry bound read-only into it, every namespace unshared (so no network), --die-with-parent, --new-session, and rlimits on CPU time, memory and processes; on macOS under sandbox-exec with a profile that denies the network and writes outside the worktree, target and temp, and reads of the home's secrets. The environment is emptied but for PATH, HOME, CARGO_HOME and RUSTUP_HOME. Output beyond 1 MiB is cut, a job past its wall-clock limit is killed with its process group.

Dependencies are fetched by the machine's owner, not the agent: a job is offline, so a Cargo.lock the agent changes to a crate the machine does not have fails to build rather than downloading it.

4. Stability

5. What the person sees

agent +workbench@Bench Fix the warning in crates/geo and propose it runs in the terminal like any task: each verb a line, the jobs' progress, the diff at the end. One question comes, on the confirmation screen: "Bench: propose — agent/17 to jeroen/cartopolis, after reading text from workbench__read that is not yours to trust?" with the task's diff a tap away. The branch then waits for review as any other; landing it is the person's, through the hub as today.

What is given up

A shell on the workbench, for the agent: whatever a job list does not name, the agent cannot run, so a task that needs a new tool needs its owner to add a job. Downloading at build time. Pushing anywhere but agent/<task>. And the workbench is not Pinnacle software: it runs on Linux and macOS, with their git, cargo and sandbox, because that is where the toolchain is.

As built (2026-11-26, session s855)

Parts 1 to 3 are built; cargo xtask workbench-demo runs them end to end (a workbench on the host, the device its contact, the agent opening a task, writing the fix, running the tests sandboxed, committing, and proposing on the person's word; the branch is then in the remote).

Order

  1. Remote services over p2p, device to device, with the per-contact grant and the terminal's +service@contact.
  2. The workbench with repositories, worktrees and the file verbs, diff, commit and propose; its self-check from cargo xtask on the host.
  3. Jobs, sandboxed, and failing closed where no sandbox is.
  4. The demo with a real model. (Done 2026-11-26: cargo xtask workbench-demo real, the key in ANTHROPIC_API_KEY, run as a midas bot on a Mac so the hub's bot secret reaches it. Told the task in words, claude-sonnet-5 opened a task, read the test and the code, fixed the code with an edit, ran the tests in the sandbox and waited for them, committed, and proposed on the person's allow: 8 actions, 62 KB sent to the model.)