Skip to content

Dev Guide — Nyia Mesh (cross-assistant orchestration)

Status (Plan 372). Autoreview (--reviewer) ships in the runtime build, and the plan-sentinel image it needs is built and published by CI with every release (ghcr.io/kaizendofr/nyiakeeper-sentinel), then pulled automatically the first time you start a --reviewer session. This guide is both the user-facing description and the design record; passages that name plans (313a, 369b …) point at the maintainers' plan files. The injection sentinel's hook consumers (313b) and the autonomous orchestrator (313e) are not built.

How assistants hand work to each other — without a daemon, without a broker, and without ever sharing the Docker socket. The mesh is a file mailbox (a "spool") on the project's disk plus an opt-in headless worker mode. This guide covers how it is built, layered, and — above all — trusted.

The one rule: the human is the only launcher

Nothing in the mesh starts a container. A task envelope is inert data on disk. A worker only exists because a human typed nyia-<assistant> --mesh-worker in a terminal. There is no host process watching the spool, no auto-spawn, no privilege that outlives the human's command. Every other security property below follows from this: an attacker who writes a malicious envelope still cannot cause code to run — they can only leave a message that a human-launched, sandboxed, output-only worker may later read (after screening).

Status — walking skeleton (Plan 313a)

313a delivers the data plane + one worker shape, enough to automate the Claude plan → Codex review → Claude respond round-trip with the human as the only launcher.

Piece Plan State
Spool + envelope + atomic claim 313a built
nyia mesh status \| log host views (post retired by 369) 313a, 369 built
--mesh-worker headless loop (Shape A) 313a built
Output-only plan-review artifact (R5/R7) 313a built
Injection sentinel — worker content gate (Slice A) 313d built (lib/mesh-sentinel.sh)
Injection sentinel — hook / MCP consumers (Slice B) 313d not built (needs 313b/313c)
Interactive Stop-hook pickup (Shape B) 313b not built
Mesh MCP surface: mesh_ask / mesh_result / mesh_status (claude, codex sessions) 313c, 369c built (docker/shared/mesh_mcp.py)
Per-session attach of the mesh MCP (args/env, never a config file) 369c, 393 built (docker/shared/mesh-mcp-config.sh on the shared helper docker/shared/session-config.sh; session words in the fixed order mesh, RAG, staging, then the user's)
Autonomous orchestrator 313e not built
--reviewer one-command host launcher 313f built (lib/reviewer-launcher.sh)
Plan sentinel (Shieldstral): watches the split spool, the ONLY writer of the reviewers' inboxes 315, 369b built (docker/sentinel/sentinel-watch.sh)
Split spool: per-role directories and mount modes, outside the project 369a built (lib/reviewer-spool.sh, lib/mesh-inbox.sh)
/nyia-implement-plan refusal hook (Claude and Codex sessions) 369d built (docker/shared/mesh-implement-hook.sh; Claude: docker/claude/managed-settings.json; Codex: docker/codex/requirements.toml + nyia-implement-gate.sh)

The screening gate (mesh_sentinel_screen, lib/mesh-sentinel.sh) is a separate, tool-less invocation of the worker's own CLI that classifies the payload bytes and emits only a fixed-schema verdict; trusted shell reads the verdict and spawns the privileged (serving) CLI only on allow. It is fail-closed: a block/suspicious verdict, a malformed verdict, a timeout, a non-zero exit, a missing CLI, an empty or over-cap payload — each quarantines the task with a cause the audit log names (nyia mesh log). Unit tests use a stubbed CLI test double; there is deliberately no --no-sentinel bypass anywhere in the parser, help, completions, or runtime, and no env var can loosen the gate (only tighten its timeout). The bytes reach the classifier between two marker lines carrying a fresh random nonce, and it judges only what lies between them: claude -p appends its own context after the prompt (an environment description, and account details with a login), which the classifier once took for part of a harmless plan and quarantined it.

Platforms (2026-10-17): autoreview is tested on Linux only. macOS ships as is: never tested, no guarantee. Windows (Docker Desktop) is untested and unsupported for now.

Reading this guide after Plan 369. The sections "Spool layout", "The plan sentinel", "Running it", the claim/stranding paragraphs and "Bounds on the spool itself" describe the CURRENT design. Passages elsewhere that mention mesh/tasks/, mesh/screened/, mesh/quarantine/, inbox stubs or nyia mesh post describe the pre-369 internals (removed in dd0953d); the protections they explain were ported to lib/mesh-inbox.sh and docker/sentinel/sentinel-watch.sh, see .nyiakeeper/plans/369a-mesh-spool-split-mounts/old-spool-test-mapping.md.

Spool layout (Plan 369: split by role, outside the project)

The spool lives in the Nyia home, one directory per project, never under the project: <nyia home>/mesh/<project key>/ (default ~/.config/nyiakeeper/mesh/<12 hex>/, the same key as the project's data/ dir). The launcher (--reviewer) creates it before any container exists: every directory a real directory, not a symlink, owned by you, mode 0700. Each container mounts only the directories of its role, at the mirrored path under /nyia/mesh/, with the mode of its role:

Directory Session Plan sentinel Reviewer <r>
requests/ rw ro —
inbox/<r>/ — rw ro (its own only)
acks/<r>/ — ro rw (its own only)
verdicts/ (+ verdicts/requests/, heartbeat) ro rw ro
reviews/<r>/ (status lines, results, worker.status) ro — rw (its own only)
log/<role>/decisions.log rw own rw own rw own

Why mounts and not code. A stdio MCP server, the model's shell and any script in the session's container run as the same user with the same mounts; nothing can tell them apart. So the guarantee comes from what each container can REACH: the session can write a request and read verdicts and reviews, nothing else; only the sentinel can write a reviewer's inbox; a reviewer can read only its own inbox. Launching nyia with the project in your home directory, or in any directory that contains or lies inside the Nyia home, is refused (that project mount would expose the spool and every login folder), and a final check over every -v/--mount source refuses any other path into the spool.

The flow. The session's MCP (mesh_ask) writes requests/<id>.plan (the plan bytes, read once) then requests/<id>.json (the commit point). The sentinel reads both (bounded, under a timeout, no symlink, no FIFO, one link), scores the bytes, records verdicts/<sha>.json (stricter-only: a block is never turned into an allow) and, only when the verdict on record is allow, writes ONE file inbox/<r>/<id>.json carrying those exact bytes, then the request record verdicts/requests/<id>.json. The reviewer takes an entry it has not acked, acks it by exclusive create (at most once), checks the bytes' sha and the sentinel's verdict again, screens them with the content sentinel, reviews them and files the review under the project's plans/N/reviews/; its status line tells the session where. The sentinel removes acked entries. mesh_result reads the records and status lines (fixed words).

Envelope (schema v1)

schema_version, id, from, to, kind, payload_ref, title (≤200 chars), rounds (1–4), status (pending|claimed|running|done|failed|quarantined), timestamps, result_ref. Size cap 16 KB, checked before jq parses.

  • kind is an enum — plan-review | review-respond | ask, nothing else in V1 — and maps to a fixed launch template in code. The envelope carries no command lines, no flags, no free-form instructions. This is the core of R4: envelope content never becomes an argv.
  • payload_ref MUST resolve to a regular file under $PROJECT/.nyiakeeper/ with no .. and no symlink escape — realpath-confined at post time and re-confined at screen time.

Trust model

The mesh assumes an envelope (and the payload it points at) may be hostile — written by a compromised or prompt-injected peer. The design keeps that hostility inert:

  • No socket, no broker, no host execution. Envelopes never reach a host shell. The host conveniences (nyia mesh status|log) are human-typed and never read envelope content into any exec/launch path (R4, BATS-asserted).
  • Fail-closed sentinel gate (R6, 313d Slice A). The worker refuses to serve unless its own tool-less sentinel clears the payload. The sentinel is launched from an inline argv built from constants in the image-owned library — nothing is resolved by name from a peer-writable path: Claude runs -p --restricted --strict-mcp-config --tools "" --json-schema … (project settings, agents, hooks and .mcp.json on the mount are all ignored); Codex runs exec --ephemeral --ignore-user-config --ignore-rules --sandbox read-only --output-schema …. The payload crosses on stdin as bytes, never as a path. A sentinel-side cap (MESH_SENTINEL_MAX_BYTES, 256KB) is independent of the spool's 1MB ingest cap: the peer picks the payload size, so the cap had to be the sentinel's own. Honest limits: the sentinel runs in the worker's network namespace (there is no "no network" guarantee — see Plan 313d Round 2 R2-H5); Codex's read-only sandbox can still read files, so tool-denial there is defence in depth, not the load-bearing property. What is load-bearing: constrained output (only the enum gates anything), separate process (no shared LLM context), and fail-closed on every anomaly.
  • What the sentinel judges is the ADDRESSEE, not the presence of instructions. A plan is a list of instructions for whoever implements it — steps, commands, file edits, even destructive ones — and that is never, by itself, an attack. The sentinel flags text aimed at the AI reading the document: overriding its rules, impersonating a system message, dictating the review or the verdict, telling the reader to use tools or reveal secrets while reading, hidden or encoded text meant for a model. The first prompt flagged "requests to run commands or edit files" and blocked a legitimate Gradle plan on its first live run (2026-10-08). The prompt is evaluated against a small corpus with a real model (.nyiakeeper/dev-tools/testing/sentinel-corpus-run.sh, maintainer tool, not a CI gate): benign plans must be allowed, attacks refused. It is a filter, not a proof.
  • Screen a frozen copy, not the live file (R8). Before the gate, the worker snapshots the payload to screened/<sha256>: it refuses a symlink, realpath-re-confines the source under .nyiakeeper/plans, copies it, then re-checks that the copied bytes still hash to the source digest — so a symlink or a mid-copy swap is detected and refused, never snapshotted. The snapshot is content-addressed; a pre-planted name whose content mismatches its hash is rejected. 0444 is defense-in-depth against accidental edits only — not immutability (a rename over it still works; root ignores it). The load-bearing guarantee is content-addressing plus verify-at-read: the privileged serve re-verifies the hash immediately before reading, closing the screen-then-swap TOCTOU.
  • Output-only worker (R7). A worker produces a review artifact (the existing plan-review-*.md file) and never edits the plan or takes the interactive confirmation path. Mutating a plan stays a human act through the plan-review confirmation gate. The autonomous orchestrator (313e) reconciles under its own policy later.
  • Verdicts never cross the trust boundary. The sentinel runs in-process; a consumer never trusts a verdict file written by a peer. Any allow is process-local only — there is no shared verdict cache.
  • Secrecy floor (Plan 314, done). A restricted reviewer worker relies on the creds/env mount-stub: project secrets are not present to a review-phase container.

The front door: --reviewer (Plan 313f)

nyia-claude --reviewer nyia-codex       # your session + one headless codex reviewer peer
nyia-claude --reviewer nyia-codex --reviewer-image nyiakeeper/codex:latest
nyia-claude --reviewer nyia-codex --reviewer-flavor python-custom --mesh-max-minutes 30
The reviewer is named like the command that would launch it (nyia-codex); the bare assistant name (codex) is accepted too.

One command launches the principal's interactive session plus one --mesh-worker peer per --reviewer, all on the same project and spool, and tears the peers down when the session ends (Ctrl-C included — the launch trap chains the teardown). What the launcher is, and is not: - Host-only, flag-only. Every peer comes from a flag the human typed; nothing in the spool, an envelope or the project mount can add, rename or retarget a peer (R7, mutation-tested). nyia never mounts into a container; the launcher lives in lib/reviewer-launcher.sh on the host. - Each peer is the sibling wrapper (bin/nyia-<reviewer> --mesh-worker …) run as a background child, so it gets the same credential gate, mounts, scrubbed view and its own per-launch signing key (one key per (run, reviewer) — 313g R1-V1) as a hand-launched worker. The launcher pins each peer's container name through a host-only override and tears down exactly those names; its registry is process memory plus per-peer logs under ${XDG_RUNTIME_DIR:-/tmp}/nyia-mesh-run.*/, never a file on the mount a peer could edit into a kill list. - An attached reviewer lives as long as the session (Plan 381). Each worker run keeps its bounds (20 tasks, 120 minutes, 1 hour without a request), but when a run ends on one of them, the worker starts a new run in the same container: same run key, same branch, same mounts, and worker.status stays up across the restart, so the session never sees a gap. A healthy reviewer is ended by the launcher's teardown only. A worker that FAILS (audit sink broken, ack error, key refused) is not restarted and the session sees reviewer-gone-<cause>; three runs in a row shorter than 60 s end it with restart-loop (so REVIEWER_PEER_IDLE_SECONDS, tighten-only, is floored at 60). With --reviewer, --mesh-max-minutes bounds one run, not the reviewer's life. A hand-launched --mesh-worker keeps one run, as before. - No per-session limit on reviews or scorings (D-20261031-no-session-limits). A session can last two weeks; cost limits belong to the provider account. A claude reviewer's serve carries --max-budget-usd ($2 by default) plus its content screen ($0.25) per review; codex has no spend flag, so a codex review's cost is bounded only by the provider account. The number of scorings is not bounded either: scoring runs one plan at a time on local CPU. Rebuild the sentinel image after upgrading: a sentinel image built before this change still applies the old limits (12 scorings, 40 deliveries) and reports error / budget-exhausted or delivery-cap, and its heartbeat ends in cap=40. The launcher and the session accept the heartbeat with or without cap=, and mesh_result relays those two causes like any other. A launcher older than this change refuses a heartbeat without cap=: upgrade both. - V1 reviewers are claude and codex — the two CLIs the sentinel can run. A reviewer must differ from the principal; duplicates collapse to one worker per assistant type. - The reviewer's image, most explicit first: --reviewer-image <ref> (the peer's own --image, verbatim: a tag, repo:tag, a registry ref, a custom image) → --reviewer-flavor <name> (the peer's own --flavor, custom pseudo-flavors included) → the session's --image with the reviewer substituted (nyiakeeper/claude:X → nyiakeeper/codex:X) → the reviewer's own default. Each of the two flags binds to the --reviewer that precedes it; give one of them, once, per reviewer. - Asking for a review from inside the session: /nyia-plan-review request N. The skill calls the session's nyia-mesh MCP tools (mesh_ask, mesh_result; shipped in the image, attached for the run only — not nyia, which stays host-only) to send ONE plan-review request to an attached reviewer, waits for the outcome, then continues in the normal respond mode: the principal presents the reviewer's points and the human still confirms every plan change. It is a hand-off, not autonomy — no convergence loop, no manifest, no implementation. The helper may address only a reviewer the launcher reports as started (NYIA_MESH_REVIEWERS, host-set on the container), and refuses with relaunch guidance when none is attached. Outcomes it reports: done + the review file; blocked (the plan sentinel refused the plan, which never reached the reviewer); quarantined + cause (the reviewer's content sentinel refused the plan or could not run); rejected, error, failed, refused + cause; sentinel-down (+ cause: why the sentinel's model stopped), reviewer-gone; pending/queued/reviewing while it waits. This is the only way to send a request: nyia mesh post is retired (Plan 369c) and says so. Every request is scored by the plan sentinel (Shieldstral), a single human-gated round included: the session can only write a request, and only the sentinel can deliver it to a reviewer (Plan 369). The reviewer's content sentinel then screens the delivered plan again. - Automatic review loop: /nyia-plan-autoreview N [reviewer] (Plan 378). The same door as request mode, run in rounds with no human between them: one reviewer per run; each round goes through the plan sentinel; the author decides every finding itself, writes its answers into the plan (## Autoreview — Round <n>, n = the round file's number; the reviewer sees only the plan) and sends it again. It ends at Status: Ready when a round from round 2 on carries MUST-FIX: 0 (the reviewer prompt asks for that last line) on bytes the author did not edit afterwards, checked against that round's plan_sha256. It stops at Status: Review after 4 rounds (round 4 logs its open must-fix items and edits nothing), on any non-done outcome (a blocked plan is never reworded or resent), when the author refuses to send the plan, or when a finding needs the owner (scope, security, network, credentials). The review text it acts on is not screened by any sentinel: the owner queue, the final diff and Ready ≠ implemented are the mitigations. /nyia-plan-review keeps its gate. - Startup policy (R3): one reviewer requested → strict (it must come up, else the launch aborts with rc 3 and nothing starts); several → continue with those that came up, unless --reviewer-strict. The audit log records launcher: reviewers requested=[…] started=[…], so nyia mesh log always shows who actually reviewed. - Enablement (R8): --reviewer sets NYIA_MESH_ENABLED=1 on the principal and every peer, resolved host-side. It is the only V1 enablement path. - Spool first (R12): the launcher creates the whole mesh/ tree, refusing any symlink component, BEFORE any peer exists — so no peer can pre-plant screened/ or the audit log. - Build identity: before anything starts, the host hashes its own mesh libraries and asks the session's image for the hashes of the copies it carries (docker run --rm --network none --entrypoint sha256sum <image> …); each reviewer's wrapper does the same for its own image. A different or missing file refuses the launch (rc 3) and names the file. It compares content, not tags: an image built two days before the checkout, or on another branch's dev-<branch> tag, used to start and then fail in the middle of a review. Compared: mesh.sh, mesh-provenance.sh, mesh-commands.sh, mesh-plan-gate.sh, mesh-sentinel.sh, mesh-inbox.sh, and in a source checkout also mesh-worker.sh, mesh_mcp.py and mesh-mcp-config.sh. Not compared: skills (the host seeds its own copy into the session) and the assistant CLI. There is no flag to skip it. - An attached reviewer signs or does not start. The launcher sets NYIA_MESH_REQUIRE_PROVENANCE=1 for every peer: if the peer's wrapper cannot generate the run key or record it for verification, the peer is refused (and reported as "did not come up"), and inside the container the worker refuses to publish a round it could not sign. A worker launched by hand with --mesh-worker keeps the older behaviour: it warns and runs. - Building from a checkout: nyia-<assistant> --build builds the checkout the launcher lives in, from any directory, and prints Source tree: <path>. A --dev tag is named after the branch of the directory the build is typed in, and the build summary says so. - Exit status: the principal's rc wins; peer failures are a stderr summary with each peer's log path.

The plan sentinel (Plan 315, 369b): the only way to a reviewer

The content sentinel above screens what a reviewer READS. The plan sentinel asks a different question of the plan as written: does it contain a dangerous, malicious or out-of-scope action? It is answered by a small local classifier, Mistral's Shieldstral-1.0-3B (Apache-2.0), which outputs one probability and cannot act. Nothing leaves the machine.

Getting the image (Plan 372). On an installed nyia, the first --reviewer session (or nyia mesh gate) pulls ghcr.io/kaizendofr/nyiakeeper-sentinel:v<your nyia version> — the image built by the same release — and shows docker's progress; later sessions use the local copy and need no network. If that exact version was pruned from the registry, it falls back to your channel's image (:beta) with a warning; a network or authentication error is reported as itself and nothing is switched. nyia update brings the matching image with the next session. NYIA_SENTINEL_IMAGE names another image, which is used as is and never pulled. In a source checkout the image stays nyiakeeper/sentinel:latest, built locally (bin/nyia sentinel build), never pulled. The image is published from v0.1.0-beta.18 on (Plan 422). Before it starts, the launcher checks the image's org.nyia.sentinel-contract label (Plan 420): a published image that is older than your nyia is fetched once more, and if it is still older the session stops with "run nyia update"; an older NYIA_SENTINEL_IMAGE or checkout build is refused, never pulled. Requirements: x86-64 with AVX2 (the launcher refuses a non-amd64 Docker host; a CPU without AVX2 makes the model server die with SIGILL, reported as "this CPU lacks AVX2"), a ~2.3 GB image, about 4.5 GB of free disk while the pull unpacks, about 4-5 GB of RAM while the session runs.

How it is confined. Its own image (docker/sentinel/), --network none, read-only root, all capabilities dropped, your uid, no project mount. With every --reviewer session it runs in WATCH mode (sentinel-watch.sh) with only its role mounts: requests read-only, the reviewers' inboxes and the verdicts read-write. The launcher waits for its heartbeat (written after the launch, naming the policy and model this host pins) and aborts the launch if it does not come; there is no flag and no way to skip it. If its image is missing and cannot be pulled (or, in a checkout, is not built), --reviewer stops before launching anything. The image is started by its image ID, the one the launcher checked before the session, so a retag in between changes nothing.

What it guarantees, and what it does not. A plan it blocks, or a plan it never scored, cannot reach a reviewer: nothing in the session can write an inbox. It does not stop the session's own model from acting on a hostile plan outside the review hand-off. Running the implement skill itself is refused unless the sentinel allowed plan N as it is now (369d): in Claude, /nyia-implement-plan N (a hook in Claude Code's root-owned managed settings, onFailure: "block"); in Codex, $nyia-implement-plan N anywhere in the prompt, since Codex honours a skill mention anywhere (a managed hook in the root-owned /etc/codex/requirements.toml, which also pins [features] hooks = true so a user config cannot switch hooks off; Codex lets a prompt through when a hook fails, so nyia-implement-gate.sh turns every failure into a refusal; a hook timeout, 10 s, still lets it through). The session can add variables to its CLI's environment, which both CLIs hand to their hooks (Claude: env in user or project settings; Codex: its .env, loaded over the entrypoint's environment, and Codex runs hooks through bash -c). So the guard takes nothing from the environment (fixed paths, the project path read from the entrypoint's own environment, started under env -i), Claude's managed settings blank the variables that could run code before it (CLAUDE_CODE_SHELL_PREFIX, which wraps every hook command, the loader's LD_*, BASH_ENV, ENV and a few glibc start-up variables; the list follows Claude Code 2.1.30x), and a Codex autoreview session does not start while ~/.codex/.env sets anything but credential variables (*_API_KEY, *_TOKEN, *_KEY). The guard compares a canonical hash that ignores the Status: line and ticked checkboxes, so resuming works and any other edit needs a new review. It acts only in the session (the one role that mounts requests/), so a reviewer reading a plan that names the skill is not refused. Not stopped: a model that implements a plan without the skill (e.g. "implement plan 80" in plain words); in Codex, a second codex started inside the session with bash start-up state that runs code before the guard: BASH_ENV, SHELLOPTS=xtrace with a PS4 that runs code, SSH_CLIENT with SHLVL=0 (Debian bash then reads ~/.bashrc), and others (its environment or a ~/.codex/.env written mid-session). Codex runs a hook command through the user's passwd shell, /bin/bash -c (codex-cli 0.166.0), and that bash runs the file, or the PS4 code, before the guard: the hook ends "Completed", or "Failed" when the code kills it, and Codex fails open on both. Plan 377 found no way to close it from the registration: a hook has no argv form and no setting picks its shell. Making /bin/sh (dash, which ignores those variables) node's login shell would close it, but it would also become the shell of every model command in every Codex session. So it stays a residual: the guard is defence-in-depth against a casual skip, not a boundary (the sentinel is). The next launch still refuses such a .env, and the post-build smoke (tests/e2e/cli-contract-smoke.sh) fails when Codex changes the hook shell. codex exec shows "Blocked" without the reason; the TUI shows it. And a compromised sentinel could write arbitrary inbox entries (it holds those mounts); the reviewer re-checks the sha against the sentinel's verdict, which narrows but does not close that.

Memory, and what happens when its model dies (Plan 420). Each --reviewer session runs its OWN sentinel, so two sessions open at once (two projects) use twice the memory. The container's limit is 3g (SPOOL_SENTINEL_MEMORY / MPG_SENTINEL_MEMORY, the same for nyia mesh gate), measured on the test VM: the model needs about 1.96 GiB of private memory plus some of its 2 GiB model file in the page cache; under 1.5g it cannot load, from 2g up it scores the corpus identically with no OOM kill, so the limit is that 2g plus 1 GiB of headroom (no swap counted: Docker's default lets a container use as much swap again on a host that has swap). Over 19 corpus documents its memory stayed flat (+77 MiB). After 5 minutes idle the model sleeps (--sleep-idle-seconds 300): about 80 MiB, and the next request wakes it in about a second (up to ~19 s from a cold disk). The model's host-side prompt cache is off (-cram 0): it was on by default with an 8 GiB cap, stored every past prompt although no request uses it, and on 2026-11-03 it grew the model server to ~10 GB until it was OOM-killed. Two sentinels on an 8 GB machine next to two assistant sessions: computed, not measured: two awake sentinels hold about 4 GiB of private memory between them (the model file pages are the same image file, so they are likely shared), two sleeping ones about 0.2 GiB. It fits when they are idle; two scoring at once next to two sessions is tight. The sentinel checks its model at every pass (2 s) and after every failed scoring. The first death in a session restarts the model (the start-up check, up to 170 s, heartbeat starting); a request it interrupted is scored again from its first window, once, and recorded once. A second death, or a restart that fails, writes down cause=<word> (model-oom when the container's cgroup counted an OOM kill, else model-killed or model-exited, or model-restart-failed) and the sentinel stops. mesh_status then says "sentinel": "down" with sentinel_cause, mesh_result answers sentinel-down with the cause for every request still waiting, and the host prints one line at session end (also when the model was restarted and reviews kept being scored). Relaunch the session to get a new sentinel. No plan gets through without a complete score.

Trust model of the image (Plan 372, MF-3). The sentinel image is trusted the way every Nyia image is: by its GHCR tag, at the moment it is first pulled. The READY <model sha256> <policy> line and the heartbeat are checked against the values this host pins, but they detect a stale image (another model, another policy, an old protocol), not a hostile one: an image built to lie can print the right line. Whoever can push to the kaizendofr packages could replace the sentinel with one that allows everything, and because the watch-mode sentinel holds verdicts/ read-write, that would be a silent bypass of the gate. The confinement (no network, read-only root, no capabilities, your uid, no project mount) limits such an image to that and to denial of service. This is the same trust root as the assistant images, which are more powerful (they mount your project read-write), so it is not a new class of risk, but it is a real one: the release credential protects every image. Every input of the image is pinned (both Debian bases by digest, the Python packages by hash, llama.cpp by tag and commit, the weights by revision and sha256) and the model digest is checked when the model is built and again in the runtime image; that makes a build reproducible, not the registry trustworthy. Pinning the images by digest on the client is a separate follow-up for all images together.

What the gate does not cover (313 A4, closed by the owner 2026-10-18). The plan sentinel scores the PLAN. The REVIEW a reviewer writes back is not screened before the session reads it: measured, the local model cannot judge reviews, and the owner closed A4 without review screening. A hostile review that gets the plan edited meets the sentinel again, because /nyia-implement-plan is refused unless the plan's current bytes have an allow.

Host commands. nyia mesh gate <plan> scores a plan by hand (a one-shot container, same image, stdin protocol) and records it in the same store; nyia mesh gate-verify <plan> checks the plan's current bytes against the record (exit 0 allow, 10 block, 20 no verdict). nyia mesh status shows the sentinel, the reviewers and the decisions of this project. The session's skill no longer has a gate mode: every review request is scored.

The serve flow (trusted shell, not the LLM)

Per task, mesh_worker_loop (in docker/shared/mesh-worker.sh → lib/mesh.sh) runs trusted shell code — the model is never in this control path:

poll inbox/<me> → claim (atomic rename) → snapshot payload (R8) → SCREEN (fail-closed gate)
   ├─ deny/unavailable → quarantine + log + skip           (cause named in decisions.log)
   └─ allow            → SERVE: privileged read-only <cli>, verified bytes on stdin
                         → write result → write plan-review artifact (R5/R7) → next
  • Take (Plan 369): the reviewer's inbox is read-only to it. It acks an entry by EXCLUSIVE create of acks/<r>/<id> BEFORE serving, so two workers never double-serve and a crashed worker never serves an entry twice; the sentinel removes acked entries. It reviews only the bytes inside the entry, after re-checking their sha against the sentinel's verdict.
  • Serve spawns the CLI only on an allow verdict, delivering the verified snapshot bytes on stdin — never a payload path. Claude is granted no file tools (claude -p --tools "", the kill-switch; --allowedTools "" only withheld permission); Codex runs in a read-only sandbox (codex exec --json --sandbox read-only). Because the model is handed no re-openable path to the payload, there is no post-verification swap window the model can reach.
  • Bounds: --mesh-max-tasks (default 5), --mesh-max-minutes (default 60), idle-drain exit after 10 min; per-serve budget $2. A hand-launched worker is a bounded, self-terminating server-in-a-terminal; an attached one (--reviewer) runs at the ceilings (20 tasks, 120 min, 1 h idle) and starts a new run whenever one ends cleanly, until the session's teardown.

Running it

On an installed nyia there is nothing to build: the session, reviewer and sentinel images of your version are pulled on first use.

# One terminal, from the project directory (never from your home directory):
nyia-claude --reviewer codex
#   the first time: "Fetching the plan sentinel image ghcr.io/kaizendofr/nyiakeeper-sentinel:v<version> ..."
#   inside the session:  /nyia-plan-review request 313

From a source checkout, build the images first (the session refuses an image whose mesh code differs from the checkout's):

# Once:
nyia-claude --build ; nyia-codex --build
bin/nyia sentinel build      # or: docker build -f docker/sentinel/Dockerfile -t nyiakeeper/sentinel:latest docker/

# One terminal, from the project directory (never from your home directory):
nyia-claude --reviewer codex
#   inside the session:  /nyia-plan-review request 313
#   the assistant calls mesh_ask / mesh_result; a blocked plan is reported and never sent

# On the host, any time:
nyia mesh status        # sentinel, reviewers, what the sentinel decided per request
nyia mesh log           # each writer's decision log

A reviewed plan lands a byte-compatible plan-review-codex-for-claude-plan-313-*.md that the author resolves with /nyia-plan-review respond 313, with the human in the confirmation gate. Review requests can be sent from claude, codex, vibe and opencode sessions. Claude gets the server as --mcp-config=<tmp file>, Codex as -c mcp_servers.nyia-mesh.* overrides, OpenCode through OPENCODE_CONFIG_CONTENT and Vibe through VIBE_MCP_SERVERS (both merged with your own configured servers, an existing value of those variables is extended); nothing is written to any config file. nyia mesh post and the hand-launched --mesh-worker of the old spool are retired.

Where each requirement is enforced

Req Guarantee Enforced in
R1 versioned, literal-parse-only envelope mesh_validate_envelope (lib/mesh.sh)
R2 atomic claim, no double-serve mesh_claim_task (rename(2))
R4 host conveniences never exec envelope content mesh_cmd_post/status/log
R5 byte-compatible plan-review artifact mesh_write_review_artifact
R6 fail-closed sentinel gate (313d Slice A) mesh_sentinel_screen (lib/mesh-sentinel.sh) / mesh_screen_task
R7 output-only worker, no plan mutation mesh_serve_task / worker loop
R8 content-addressed snapshot + verify-at-read (TOCTOU closure) mesh_snapshot_payload / mesh_verify_snapshot

Tests: tests/bats/test_mesh_*.bats (envelope, claim, commands, cli, screen, serve, worker, worker_entry, flags, artifact) + test_dist_parity.bats.

What the mesh does and does not protect (Plan 313a R11, 2026-10-04)

The mesh moves untrusted text between containers that share a UID and a mount. Everything below is a property the code actually enforces, or a gap stated plainly — nothing here is aspirational.

Enforced

The bytes that were screened are the bytes that get served. A payload is snapshotted to mesh/screened/<sha256>, so its name is its digest. At serve time the worker copies that file once into an unlinked descriptor, and then both the digest check and the model's read go to that nameless copy. One read of the shared-mount inode ever happens; the object that is verified is the object that is read, and it has no name any peer can resolve.

⚠️ THE HISTORY IS KEPT, because the wrong version of this claim is instructive. This section once asserted the same sentence on the strength of the descriptor alone, and that was not enough: /proc/self/fd/<n> used as a path is a fresh open() of the inode, not a second reference to the descriptor's read offset. The descriptor pinned the snapshot against rename and nothing more — so a peer that still owned the file could chmod u+w and truncate-rewrite the same inode between the digest check and the model's read. Measured, not theorised: the digest passed on HONEST SCREENED BYTES, the inode was unchanged, and the read returned ATTACKER UNSCREENED BYTES. chmod 0444 was no barrier, because the worker's own UID owns the file. The fix was to move the bytes out of reach rather than re-check them against a mutable inode, which is why the claim above is now earned rather than asserted. Renaming over the snapshot was always closed; in-place mutation is what the capture closes.

Why this shape and not a staging copy: the first implementation copied the verified bytes to a mktemp path, hashed that path, then re-opened it to feed the model. Verify-then-reopen leaves a window, and content-addressing did not cover the staged file because its name was not its digest — six characters of mktemp entropy in a directory any peer can list is not a control.

The spool's own directories are confined. mkdir -p follows a symlink planted at its target, so mesh/screened is checked for being a symlink before and after creation, and its resolved path must equal the expected path. A planted symlink is refused, not merely unfollowed. (The earlier [[ "$snap" == */screened/* ]] was a string test, which passes straight through such a symlink.)

Snapshot permissions are hardened on every path. The dedup path — taken when a snapshot with the same digest already exists — used to return early and skip the chmod 0444 the create path applies. The content was always verified, so a wrong-content plant was caught; but a right-content file pre-created mode 0666 stayed writable, which is exactly the surface a serve-time race needs.

Resource bounds can only be tightened. MESH_MAX_TASKS, MESH_MAX_MINUTES, MESH_IDLE_SECONDS, MESH_POLL_SECONDS and MESH_BUDGET_USD are clamped in trusted code against hard ceilings. Setting MESH_MAX_TASKS=100000 yields the ceiling, not 100000; a lower value is honoured; nonsense falls back to the default. This is the project-wide rule — configuration may ratchet toward more restriction only, and there is no loosening setting anywhere.

The screening gate cannot be swapped out from the environment. The gate is a bash function, and bash imports functions from the environment (export -f / BASH_FUNC_*). Pre-setting the library's load guard used to make sourcing a no-op, leaving an attacker's permissive function in place as the gate — with no flag, no config key, and nothing visible in any dispatcher. Two independent defences now: the library refuses a load guard that arrived via the environment, and the worker entrypoint drops every inherited function before loading anything. Either alone is insufficient.

Envelope and payload content is never executed. The host-side commands (post, status, log) create envelopes, list tasks and tail the audit log. Nothing derived from envelope or payload content reaches an exec or launch path, and the worker serves content to the model on stdin with no file-reading tool in its argv.

Stated gaps — read these before relying on the mesh

The spend cap covers one provider. The Claude path passes --max-budget-usd; codex exec has no equivalent flag to pass, so on that path a run's task-count and wall-clock ceilings bound one run, and an attached reviewer starts a new run when one ends: the provider account is the bound. This is named in the code rather than papered over.

restrict-local is not an exfiltration control. It blocks the LAN and the host and leaves outbound traffic to any public address open — a reviewer has to reach its provider's API to produce a review at all. The confidentiality boundary for a reviewer is the mount scrub, not the network.

Git history is not covered by the mount scrub — but it is not uncovered either. Secret files are stubbed in the working tree; .git/objects cannot be stubbed without breaking every git operation the project depends on, so a secret that was ever committed stays readable through git to anyone who can run git cat-file in the container — the reviewer included.

The control for that is a separate, opt-in feature, not the scrub: set git_history_cutoff and nyia mounts a protected, object-isolated shallow .git (no alternates, no remotes, verified fail-closed — see docs/GIT_HISTORY_CUTOFF.md). It applies to a mesh worker too: the cutoff is applied in run_docker_container, the same function that marks the container as a worker, so the worker is not a bypass. Two limits, both of which decide whether you need to act:

  • It is off by default. With no cutoff configured, a reviewer peer sees your full history.
  • It only hides pre-cutoff objects. A secret committed after the cutoff is still readable, and a cutoff set earlier than the commit that removed a secret still exposes it (both are asserted in tests/bats/test_git_history_cutoff.bats).

So the honest summary is: rotate committed secrets, and if un-rotated ones exist in history, set a cutoff before letting a reviewer peer run — the mount scrub alone will not save you.

A worker killed mid-serve STRANDS its request, deliberately. The ack is written before serving (at most once), so an entry whose reviewer died after the ack is never served again; there is no reaper and no clock on the mount to decide one. The session sees the request as reviewer-gone (from worker.status) and the human sends it again from a relaunched session, which makes a new request id. Liveness of the containers themselves comes from Docker, in the launcher.

Fail-closed is also a denial of service. A user whose worker cannot run its sentinel cannot use auto-review, by design (313g R10 cl.4): a missing CLI, a timeout, an over-cap payload or a model outage each quarantine every task. The refusal names its cause in decisions.log — not installed, timed out after Ns, payload exceeds the sentinel cap, verdict=block … — so an attack is distinguishable from a misconfiguration. Two shapes measured on the VM (2026-10-07) that look alarming and are not: codex with a bad or missing credential ends as CLI exited 1: ERROR: unexpected status 401 Unauthorized … (log in with nyia-codex --login; an OPENAI_API_KEY in the environment was not picked up under --ignore-user-config); claude with a bad credential ends as timed out after 180s with an empty stderr excerpt, because claude retries a 401 with backoff for minutes and prints nothing — fix the login, the gate is doing its job.

Linux only. The descriptor hand-off depends on /proc/self/fd. If /proc is unavailable the serve path refuses rather than falling back to a path-based read — the fallback is precisely the hole.

Review provenance (mechanism #7, as implemented — mac format v2)

Each review round is written as its own immutable file under the plan's reviews/rounds/ and signed before it becomes visible. The bytes are written and MAC'd in a private directory OUTSIDE the shared mount, then the signed pair is copied into rounds/ and renamed into place. Nothing is ever appended to a signed file.

Why off-mount: staging the round inside rounds/ and signing it there leaves a window. 0600 hides nothing from a peer at the same UID and mktemp's name is enumerable with one readdir, so a peer that won that window did not forge a MAC — it substituted the content and got the honest reviewer's key to sign its text. A plain mv from off-mount would cross filesystems and lose atomicity, so the publish is a same-directory copy + rename.

The MAC binds reviewer ‖ run ‖ task ‖ plan-IDENTITY ‖ plan-snapshot-digest ‖ sha256(round bytes) ‖ round:

  • the round bytes stop a valid MAC being lifted onto a substituted review;
  • the plan identity (the plan's directory name) stops a signed round being cp'd into another plan's rounds/ — one copy, no key, no race. It is passed in at signing and derived from the round's own location at verification, deliberately asymmetric: the bytes are signed off-mount where no identity exists in the path, and the verifier is the side that must not be fooled;
  • the round number stops two validly signed rounds being swapped, and is checked against the filename, not merely carried;
  • the plan snapshot digest distinguishes a round that reviewed an earlier revision of the same plan — reported as STALE while still verifying — from a replay, which is refused. Refusing the stale case would delete the review document's own history every time an author edits a plan in response to a review. nyia mesh verify prints such a round as STALE, never as OK, and says that the plan as it is now has not been reviewed by it.
  • one read of everything a peer can rewrite. The worker copies the claimed envelope once, off the mount, and screens, serves and files the review from that copy; it refuses an envelope addressed to another assistant. The writer copies the model's result once, checks its digest on the copy and extracts the review from the copy. Re-opening either path on the mount is how a peer got its own text signed, and a review filed under a plan that was never screened (2026-10-10 review).

The review the worker signs is digest-bound to the bytes the model produced: the serve step captures the CLI's output in an unlinked descriptor, digests it there, and publishes a copy, and the writer refuses a result file that no longer matches. A peer can corrupt the published copy and cause a refusal; it cannot get its own text signed. And an empty or unreadable review is refused, never signed — a fabricated "(no review content)" placeholder carrying a real signature would be a false attestation that nyia mesh verify reports as authentic.

The human-facing review document keeps the name the nyia-plan-review skill resolves, and is assembled from verified rounds each time a round lands. The round set is read by one enumerator that treats a gap, a stray file, an orphaned .mac or a round past the ceiling as a failure — a deleted round is a reported failure, never a silently shorter set.

The key is read once from a file descriptor into a non-exported shell variable, and reaches the HMAC process on a descriptor, never in argv — the code is in the command line, the key is not.

⚠️ That last sentence was in this document before it was true. The implementation ran openssl dgst -sha256 -hmac "$key", putting the key in a child's /proc/<pid>/cmdline — which this threat model explicitly grants the peer. The spec's own assertion passed throughout because it inspected the loop's cmdline and the exposure was in the child's. Documentation is not verification, and a green assertion over the wrong process is worse than none.

A key value inherited from the environment is discarded — honouring one would let an attacker choose the signing key and forge reviews under that reviewer's name. That drop is the real control; the environment detector beside it reads /proc/$$/environ (the shell's, frozen at exec) rather than /proc/self/environ, which resolved to grep's own environment and could never fire.

What this does and does not prove. It establishes that a review came from the reviewer it claims, against another peer — no peer holds another's key. It does not bind the orchestrator, which holds every verification key; that is what asymmetric per-worker signing addresses later. So read "provably from this reviewer" as "not forgeable by another reviewer", not as "not forgeable by anyone".

Until the launcher supplies a key, reviews are written unsigned and labelled UNSIGNED — not silently unattributed. Setting NYIA_MESH_REQUIRE_PROVENANCE=1 makes a missing key fatal instead: no key, no artifact.

The worker stops rather than working untraced. If the audit sink fails mid-run the loop halts and mesh_worker_loop returns non-zero, and the quarantine transition writes its record before it acts — so no transition completes unrecorded. A headless worker's stderr is read by nobody, so "loud" was not a control.

What reaches your terminal (metadata screening)

nyia mesh status walks every file under mesh/tasks/, and that directory is writable by any peer. So each file is re-validated as an envelope before anything from it is printed: the task id, the two party slugs, the kind and the status must each match their pattern or closed set. A file that fails contributes a count and nothing else —

⚠️  2 file(s) under tasks/ are not valid envelopes and were IGNORED.
    Their contents are deliberately not shown (they are attacker-controlled text).

— so you learn junk is present without any attacker-chosen bytes being rendered. Previously such a file had its fields byte-sanitized and printed, which let a peer drop tasks/anything.json and forge a row in your table. Byte-sanitizing a field you never validated is not screening it.

Fields that do pass are printed through a strict printable-ASCII allowlist. The project's shared terminal sanitizer deliberately preserves multibyte UTF-8 so legitimate names survive, which is right for its other callers and wrong here: it cannot touch U+202E RIGHT-TO-LEFT OVERRIDE or the invisible direction marks, which reorder what you read without containing a single escape byte. Mesh display therefore uses an allowlist of its own, and the shared function is left exactly as it was.

Review rounds are signed OFF the shared mount. The bytes of a round are written and MAC'd in a private directory outside .nyiakeeper/, then published into rounds/ by a same-directory rename. This is called out because the obvious implementation is wrong in a way that is easy to miss: staging the round inside rounds/ and signing it there leaves a window — 0600 hides nothing from a peer at the same UID, and mktemp's random name is enumerable with one readdir. A peer that wins that window does not forge a MAC; it substitutes the content and gets the honest reviewer's key to sign its text, which then verifies clean. Measured before the fix: a plain-bash peer loop observed the staging file on the mount.

What a peer with mount write can still do, stated plainly: delete a round, or corrupt one after it is published. Neither becomes a forgery — the MAC covers the off-mount bytes, so altered bytes simply stop matching it — and the writer re-verifies immediately after publishing so corruption is a loud failure rather than a surprise discovered later by the orchestrator. Deletion is caught as a gap by the round enumerator. Availability is not defended against a peer that can write the mount; integrity and attribution are.

nyia mesh log renders the audit trail through the same allowlist, and the reason is terminal control rather than text. decisions.log lives on the shared mount, so a peer appends to it freely. The payload that matters is not a rude string — it is \033[2K\r, which erases the line above: a peer appends that plus a plausible "worker: SERVED and APPROVED" entry, and the operator's own quarantine line vanishes from the screen. This command was a bare tail while mesh status beside it re-validated every envelope, which is why it is called out rather than assumed.

Sanitising is not authenticating — the audit log is UNAUTHENTICATED. A peer can still append a plausible, printable entry, and nothing in the renderer can distinguish it from a real one. What the allowlist prevents is a peer rewriting or erasing what the worker recorded. Making the log itself trustworthy would require MAC'ing each entry the way review rounds are signed. Until then: treat decisions.log as "what the worker said, plus anything a peer chose to add", and trust the signed review rounds rather than the log for attribution.

The same allowlist guards the review document, not just the status table. This is called out separately because it was initially wrong in a way worth remembering: the allowlist was introduced and the status table switched to it, while the writer of the plan-review-*.md artifact — the file you actually open — kept using the shared byte-denylist. The helper was hardened and tested; the more important caller was not. An attacker-chosen plan title could therefore still carry a bidi override into the document header. Both sinks now use the allowlist, and the artifact header is additionally asserted to hold exactly one **Reviewer**: line, so a title can neither reorder what you read nor forge an attribution line beneath it.

A title is still displayed — that is what the field is for. What it cannot do is change the document's structure or your reading order.

Bounds on the spool itself

Three collections used to grow without limit, and none of them is caught by a size cap — each entry is tiny, so it is the count that hurts (inodes and directory name-space, long before disk space).

  • Requests (Plan 369): the sentinel looks at 50 unprocessed requests per pass, does not score a plan again under the same policy and model, keeps the newest 200 rejection records (all sessions together: an older one is removed, and if its request file is still there that id is ignored until the sentinel restarts, so mesh_result keeps answering pending for it), and holds at most 100 entries per reviewer inbox. Other records (delivered, blocked, error) are not rotated. requests/ itself is written only by the session, which can only flood itself.
  • No snapshot store on a shared mount any more: a reviewer decodes the entry's bytes into a private stage directory in its own container and removes it after the serve.
  • log/<role>/decisions.log (one per writer since Plan 369) is the audit sink, and a failure to append to it is now reported in the mesh's own voice — not as a bare Permission denied from a shell redirection attributable to nothing. More importantly, a worker checks the sink before it claims anything and refuses to start when it is not appendable:
ERROR: mesh audit preflight: …/decisions.log is not appendable — refusing to serve unauditable work

That refusal exists because the append already returned an error and no caller checked it — so a worker whose log had become unwritable kept serving tasks while its audit trail quietly stopped growing. An audit sink failing unnoticed is the one failure that hides all the others.

How a review becomes trustworthy input

There is exactly one function that enumerates review artifacts, and it verifies as it goes.

⚠️ This sentence was in the document while three enumerators existed — a sequential walk here, a glob in nyia mesh verify, and a third in the artifact assembly — with two of them stopping at the first GAP. Deleting round 1 of a signed 1-3 set therefore returned "every round present verified, here are none", rendered an empty document still headed "each round signed", and left nyia mesh verify reporting rounds 2-3 as OK: the human and the orchestrator disagreeing about what exists. It is one enumerator now, and a structurally broken set — a gap, a stray file, an orphaned .mac, or a round past the ceiling — is a FAILURE, never a silently shorter set.

That single entry point is the point: convergence is recomputed from the artifacts, the artifact path is fully predictable from fields the requester chose, and the directory is writable by any peer — so a peer that writes "no must-fix, approved" into the expected place gets counted unless the input set was verified first. A second enumerator anywhere would reopen that hole.

It answers in three distinct ways, because "no verified set" and "an empty verified set" are different facts and treating them alike is how a forged convergence would slip through:

Outcome Meaning
success, with paths every round present verified — these are the ones that may count
failure, naming rounds at least one round failed verification and was excluded
unavailable there is no run key, so no verified set can exist at all

An unsigned artifact is not a verified one, and the third case says so rather than quietly returning an empty list that a caller might read as "nothing to worry about".

The AGE column in nyia mesh status is a hint, not a record. It comes from each file's mtime on the shared mount, which any peer can rewrite with touch, and the table says so beneath itself. The durable fix is an observation recorded by the orchestrator when it first saw the file; that component does not exist yet, so the column is labelled rather than presented as history.

mesh/decisions.log sits on the shared mount, so a peer can replace it with a symlink at any moment, including between a check and a write. An append therefore opens the log first, proves that the open descriptor is the regular file the name still refers to (not a symlink, same device and inode), and writes through that descriptor only. What is left: opening for append creates a missing file, so a swap to a dangling symlink in that window can make the writer create an empty file where the link points. Nothing is written into it.

The read side follows the same rule: nyia mesh log refuses a symlinked log instead of printing the tail of what it points to, and prints at most 1000 lines; nyia mesh status stops at 200 rows and says how many tasks it left out. The plan-gate relay confines mesh/gate/requests again on every pass, because it removes whatever is not shaped like a request: a directory swapped in after start-up is not listed, read or cleaned, and the relay serves again once the real directory is back.

The audit log rotates, and says so

mesh/decisions.log is append-only on a shared mount, so it cannot keep unbounded history safely. Both choices are losses, and it is worth being plain about which one was taken:

  • Without rotation, a peer fills the log until the sink breaks. Since a worker now refuses to run on an unappendable sink, that is a clean denial of service.
  • With rotation, a flood instead evicts old entries — an attacker can push history out of retention.

Rotation is what ships, past a size ceiling and keeping a bounded number of generations. The eviction is made visible: the first line of the fresh log records that a rotation happened, at what size, and that older entries are gone. A gap in the trail therefore reads as "rotated here" rather than "nothing happened here" — which is the only property that matters when someone is reading the log to find out what went wrong.

The inbox flood, honestly

Inbox stubs are zero-byte files that any peer creates with a plain touch. They never pass through Nyia's code, so unlike tasks/ there is nothing to refuse — a cardinality cap here would be theatre.

What changed is that the worker no longer lets the flood size decide its own cost: picking the next stub stops at the first match instead of expanding and sorting the whole directory. Measured, because the tempting claim is wrong: this is not constant-time. Both forms must read the directory, so both still grow with the flood — at 60,000 planted stubs, ten polls took ~0.43s before and ~0.37s after. That makes a flood survivable, not free. The real bound on what a flood can cost you is the worker's task-count and wall-clock ceilings, which are clamped in trusted code.

How the signing key reaches a reviewer

A reviewer runs in its own container, and the key that signs its reviews must get there without becoming readable by the model doing the reviewing. That turns out to rule out almost everything, so the mechanism was settled by measurement rather than argument:

Channel Result
the container's stdin (docker run -i) key arrives; environ clean; cmdline clean; a child cannot recover it from /proc/$PPID/environ; fd 0 is a pipe, so it never touches a filesystem
an environment variable leaks — present in /proc/self/environ and recoverable by any child via /proc/$PPID/environ
a bind-mounted key file ruled out by design: any peer sharing the mount reads it
a pre-populated tmpfs impossible — a fresh tmpfs mount is empty
a docker secret unavailable: a Swarm feature, and Nyia never shares the docker socket

So the key is written to the container's stdin, and the entrypoint reads that first line before starting anything else. It is passed onward only as a descriptor number, which is not itself secret. The reviewer's stdin is otherwise unused — the review payload reaches the model on a child's stdin, from the verified snapshot — so this costs nothing.

Why the detail matters: the environment-variable route is the obvious choice and it is the one that fails, because /proc/<pid>/environ records a process's environment at exec time and keeps it readable by that process's children even after the variable is unset. On the Codex path that is decisive, since its read-only sandbox grants full disk read — /proc included.

The key channel, as built

When a worker is launched, the host generates a fresh 64-hex key from a CSPRNG and writes it as the first line of that container's stdin. Only a flag travels in the environment — never the key. The worker's entrypoint reads that line before starting anything else, hands it onward as a descriptor number (which is not secret), and drops its own copy. If the flag is set and no key arrives, the worker refuses to start: no key, no provenance, and no quietly-unsigned run.

The key is produced by printf inside a process substitution — a shell builtin, so that subshell never execs and leaves no command line for anyone to read. Verified by scanning every readable /proc/*/cmdline and /proc/*/environ while the descriptor was open: no occurrence.

⚠️ That scan covered DELIVERY, not USE, and the difference mattered. It proves the key does not appear while it is being handed to the worker. It says nothing about what the worker later does with it — and for a long time the worker ran openssl dgst -sha256 -hmac "$key", putting the key in a child's /proc/<pid>/cmdline on every sign and every verify. Both statements were true at once: the channel was clean and the use was not. Evidence is scoped to the moment it was gathered, so a custody claim has to name which processes and when.

Checked across a real container boundary, not just locally: the key loads inside the container, signing and verification work there, and it appears in none of /proc/self/environ, /proc/self/cmdline, a child's /proc/$PPID/environ, or docker inspect's Config.Env and Config.Cmd. That last one matters — it means the key is not recoverable from container metadata even by someone who can talk to the Docker daemon.

Ordering is deliberate: the entrypoint sanitizes its environment first, dropping every inherited shell function, and only then reads the key. Reading it while an attacker-supplied function could still be in scope would undo the point.

Checking a review yourself: nyia mesh verify <plan>

A signature nobody can check is decoration. The first version of this had exactly that problem: the host generated the key, handed it to the container, and dropped its own copy — so the only process able to verify a review was the container that produced it, and you had no way to confirm provenance at all.

So the launcher now records the verification key when it starts a reviewer, in a 0600 file inside a 0700 directory under $XDG_RUNTIME_DIR (or TMPDIR) — deliberately not on the project mount, which is the surface every peer shares; a key there would be a key for everyone.

$ nyia mesh verify 313a
ROUND      RESULT    DETAIL
round-1    OK        signed by codex (run 20261005T121500Z-4821)
round-2    FAILED    no recorded key verifies this round

2 round(s): 1 verified, 1 failed, 0 unsigned

Read the three outcomes precisely:

  • OK — the bytes on disk are the bytes that reviewer signed.
  • FAILED — they are not, or the key that signed them is not on this host. Keys live only for the session that created them, so a review from last week's run reads as FAILED on a fresh boot. That is a limit of per-run keys, not evidence of tampering, and the command says so rather than implying the worse reading.
  • UNSIGNED — no signature beside the round at all. Carries no provenance; do not read it as attributed to anyone.

The command exits non-zero when any round fails, so it can gate something. And it needs no key in your environment — it finds what it needs in the keystore, which is the whole point.

Payload size, and reading the audit log

There is a cap on the payload, not just the envelope. The envelope — the small JSON task — has always been capped at 16KB. The payload it points at is the plan file that actually gets copied into screened/ and then sent to a model, and nothing capped that: a 2MB plan was accepted and copied. Two problems at once, since it fills the shared mount and is billed to a provider. The cap is 1MB (~250K tokens of markdown, far past any real plan) and it is checked before the copy, not merely before the model call — a cap that only spares the model call has already filled the mount.

The log says which step refused, and the worker no longer guesses. A refusal records its own cause:

screen refused: payload rejected at ingest (size cap, symlink, or digest mismatch)
worker: quarantined (see the screen-refused reason above)

Previously both an oversized payload and a missing sentinel logged quarantined (sentinel denied/unavailable) — two situations needing opposite responses (shrink the plan vs install the component), recorded identically. The worker cannot know which screening step refused, so it no longer names one.

And the exit line counts three different things, because one number called "served" was a lie:

worker(codex): exit processed=1 reviewed=0 quarantined=1

processed is what the task bound limits — a quarantined task consumed a slot. reviewed is reviews actually produced. The old line reported the first number as "served", so a run that reviewed nothing logged served=1 directly beneath the quarantine it contradicted.