The agent as system software
A study, 2026-11-26, for the question: how should Pinnacle build the environment an agent works in, and the agent itself, so that it is part of the system rather than a program like Claude Code that happens to run on it? It works out the agent section of terminal-and-agent.md against what exists in the tree today, what the operating-system vendors shipped in 2025–2026, what the standalone agents are made of, and what a model on the device can do. The roadmap has the steps; this has the reasons.
The answer in one paragraph
A standalone agent is mostly a work-around. Every part of Claude Code that is
not the model loop exists because the OS under it lacks something: permission
rules on command text because a shell command is untyped bytes; a sandbox around
bash because a process starts with every right its user has; hooks because
there is no event the system raises; CLAUDE.md because programs do not say
what they do; MCP servers as separate processes because apps have no way to be
asked; a transcript file because the terminal keeps nothing; a 97 % "approve"
rate because the dialog asks about a string, not an effect. Pinnacle has, or is
building, the thing each of these stands in for: channels and handles with no
ambient authority, confined apps, typed records instead of a byte stream,
services that describe their verbs, a display server nothing can fake, a vault,
and contacts with keys. So the agent environment is the environment Pinnacle
is already building for people, and the agent is its second user. What is
left to build for the agent is small and deterministic: a model service that
owns the connection, a gatekeeper that turns the model's requests into messages
it may send, a log, a budget, a mark on input the agent synthesises, and the
taint rule. None of it needs the model, and none of it goes in the kernel.
What the standalone agents are made of
The harness around a model, as Claude Code (TypeScript, ~5 MB of its own code on a 95 MB Bun runtime), Codex CLI (Rust) and goose (Rust) build it, and what each part leans on:
| Part | Today | Leans on | In Pinnacle |
|---|---|---|---|
| Model client | HTTPS to one vendor, key in an environment variable or a file | TLS, env, keychain | The model service: the only program with the network, the key in the vault, every prompt logged |
| Context | System prompt + CLAUDE.md hierarchy + tool schemas + transcript | Filesystem walk, git | The session document (records in the vault), the describe answers of the services the task may reach |
| Tools | Built-ins + MCP servers as child processes or HTTP | Spawn, pipes, network | Services' verbs. A tool is a verb of a service the task holds a handle to; there is no second registry |
| Permissions | deny → ask → allow on parsed command text; a model classifier in auto mode. The docs say the rules "aren't a security boundary" | Nothing: string matching | Handles. What was not given does not exist in the prompt. The question to the person is about an effect class, not a string |
| Sandbox | Bash only (bubblewrap + socat, Seatbelt); Read/Edit/Write, MCP servers, hooks run unconfined; ~/.ssh readable | Namespaces, seccomp, Landlock | The process model: a task is a program with the handles it was given and no path to anything else. There is no unconfined part |
| Hooks | 34 events, shell scripts, exit code 2 blocks | Shell | The gatekeeper's policy and the audit log; no user scripts at first |
| Memory | CLAUDE.md, ~/.claude/projects/…/memory/ | Filesystem | Notes in the vault, per app folder, readable by the person in Notes |
| Session | JSONL transcripts, swept after 30 days | $HOME | The terminal's session document; a record is what is kept, copied, shared |
| Compaction | The model summarises; a boundary marker | The API | Stays with the model. Its summary is a record |
| Subagents | Same binary, own context, optional worktree, shared budget | Spawn, git | A task spawned by the gatekeeper with a subset of the handles and of the budget |
| UI | A TUI in a PTY; editors over ACP (JSON-RPC: prompt, update, request_permission, the editor owns fs and terminal) | PTY, escape codes | The terminal, Messages (the agent as a contact), the display server's act protocol. ACP's shape is right: the host owns the files and the terminal, the agent asks |
| Remote | Outbound polling to the vendor; the transcript on their servers | TLS egress | The p2p layer: a stream to the agent on another of the person's devices, the contact's key as the host key |
Two conclusions from this table. First, the parts worth moving into the
system are identity and boundary, the tool registry, the host protocol and the
audit log; every 2025–2026 incident below was one of those implemented as
application code. Second, the loop, context assembly and compaction stay with
the model: they need it, and a system that tried to own them would bind
itself to one vendor's API, which changed shape twice in 2026 (MCP's July
revision dropped sessions, the initialize handshake, sampling and roots).
Pinnacle should not speak MCP to its own services; describe is smaller and
ours. An MCP bridge for outside tools can come later, as a program.
The incidents, and which part failed
- A public GitHub issue made an agent on the official GitHub MCP server copy a private repository into a public pull request (Invariant Labs, 2025-05). Untrusted text, private data and a way out met in one context: no taint.
- Replit deleted a production database (2025-07); Claude Code ran
rm -rfover a home directory (2025-12); a Cursor agent wiped a database and its backups in nine seconds (2026-04). A string rule is not a boundary, and nothing could be undone. - Nx's "s1ngularity" (2025-08) ran the locally installed Claude Code, Gemini CLI and Amazon Q with their non-interactive flags to collect SSH keys and tokens: 2 349 secrets. The agent had every right of its user.
postmark-mcpshipped fifteen clean versions and then one line adding a BCC (2025-09);mcp-remotegave remote code execution to any hostile server it connected to (CVE-2025-6514). Tool definitions were code from outside, unsigned and unpinned.- Anthropic measured people approving 97 % of prompts and catching 13.6 % of planted dangerous commands; its classifier ("auto mode", default since 2026-08) caught 89 %, and was bypassed at 60–80 % within weeks (Rehberger, 2026-08). Anthropic's answer: auto mode is "a best-effort convenience feature, not a security boundary". A confirmation about a string, asked often, is not a confirmation.
What the vendors converged on, 2025–2026
Apple (App Intents 2.0 and App Schemas, Siri AI on iOS 27), Google (Android 17's AppFunctions, "the on-device equivalent of MCP"), and Microsoft (Windows agent connectors, an MCP proxy, an Agent Workspace with its own account) agree on five things, and Pinnacle's design already has each:
- Structured actions, not pixels. Apps declare typed verbs the system
indexes and calls in the background; screen automation survives only as
Google's fallback and in Microsoft's separate desktop. Rabbit's R1, whose
"large action model" was Playwright scripts, is the cautionary tale.
Pinnacle:
describe, and the act protocol on the UI tree only for what has no verb. - The OS owns the connection and the identity. Windows proxies every MCP
call; Android grants
EXECUTE_APP_FUNCTIONSto the system assistant only; Apple's orchestrator decides what goes to Private Cloud Compute. Pinnacle: themodelservice. - Risk-tiered confirmation. Apple derives a tier from an intent's schema (delete or send out = high, change shared content = medium), ties the high tier to an unlocked device, and lets an app make its policy stricter but never looser, enforced by the compiler. Pinnacle has no tiers yet; see below.
- Honest about injection. Apple's WWDC26 security session, Microsoft's documentation, OpenAI ("unlikely to ever be fully solved") and Anthropic all say in writing that indirect prompt injection is open and that model-side defences are a second layer. Containment is the baseline.
- Off by default, a visible indicator while acting, a stop at any time. Pinnacle: no host set means no agent; the status bar; the Process handle.
Four things are contested, and Pinnacle's design takes a side on each:
- Where the model runs. Apple keeps it on the device or in attested cloud; Google and Microsoft are cloud-first with small models on the device. Pinnacle: one interface, the host a setting, from a provider over TLS to the person's own machine over the DHT to the device itself; see "The model".
- Taint. No shipped OS tracks where data came from; they gate actions. DeepMind's CaMeL (2025) is the one principled design against the "lethal trifecta" (private data + untrusted content + a way out): a privileged model writes a plan, a quarantined model reads untrusted text with no tools, and an interpreter carries a provenance label on every value and checks it at each tool call. Pinnacle's taint rule is CaMeL at the channel level, enforceable because every byte a task reads arrives on a channel the gatekeeper gave it.
- Undo. Nobody ships it; they rely on confirming first. The research moved
(Kairos, 2026-10: run the agent speculatively, hold its effects, release them
after review; "irreversibility budget", 2026-08: meter irreversible actions
as a resource). Pinnacle's per-task snapshot is the same idea;
pfslacks one mechanism for it, below. - Fatigue against autonomy. CaMeL's authors, Meta's "Rule of Two" and Anthropic all say per-action prompts train people to say yes. The answer that holds is fewer, better questions: about a plan or an effect class, not a call. Frits makes that possible; see "The plan as a program".
Where the agent lives
Three programs and one rule, as agreed in terminal-and-agent.md, with what the tree needs for each. The principle stands: assume the model is hijacked, and make that not matter. Everything it says is a request.
The model service
Owns one connection to the host the person chose, is the only program with the network, logs every prompt, and is off until Settings → Agent names a host. It offers one interface to everything above it: a conversation in, text and tool-call records out, whoever answers. The host is a setting: a provider's API over TLS first; the person's own machine found through the DHT, through NATs by hole punching (the midas hub's machines, for one); a model on the device behind the same interface one day.
What rt lacks for it: http_get is GET only, HTTP/1.0, no headers, no
chunked encoding, no streaming (rt/src/lib.rs); a provider needs POST, an
authorisation header, chunked replies and server-sent events. And there is no
JSON reader anywhere in the tree; the person's rule means an own one, which
describe will want too. The TLS client (tls::Client) is enough as it is.
The agent gatekeeper
A small deterministic program started per task with that task's handles and no
network. It is the only thing that talks to the model service and the only
thing that sends messages for the model: it turns a tool-call record into a
message on a service's channel, checks it against the verbs the service
described and the tier of the effect, writes every action to an append-only log
in the vault, counts it against a budget, and asks the person through the
display server where the tier says so. Model output never holds a handle; a
handle the task was not given has no name in the prompt.
Why a program per task and not one daemon: a task's rights are its handles, and a process is the unit the kernel gives handles to. Two tasks cannot see each other's folders or channels because there is no call by which they could. A subagent is the same thing again with fewer handles and a share of the budget. Confined apps cannot spawn, so the gatekeeper is a system program, as the terminal is.
What the tree lacks: an append-only log (there is no audit facility; println!
reaches the serial console and nothing else), a budget, and a way for a service
to know a message came from an agent task rather than the person. The last
needs no kernel change: the gatekeeper is the one connecting, so the service
knows by the channel. But a verb a service runs for the agent should be the
same code it runs for the person; an "agent flag" in the message would be two
paths, and the Cartopolis simulator's rule holds here: an authorisation
decision must not share a path with an ordinary request, and must not be a bit
the requester sets.
The display server as the trusted path
It draws the agent's confirmation, as it draws the lock screen: no app or agent
can see or fake it, and it says which app the agent is acting in. Input the
agent synthesises carries a mark physical input does not, so an app can refuse
it for what cannot be undone. InputEvent has no source field today
(abi/src/lib.rs); one bit, set only by the display server, is the whole
change. The act protocol on the UI tree is for what has no verb; a tree does
not exist yet (apps push pixels), but every app's layout is already a pure
function of its window's size (layout/), which is how xtask taps them.
A tree is that function's result with names on it.
The taint rule
A task that read untrusted text, from the network, a message from a non-contact, or a file another program wrote, may send nothing out of the device without the person confirming. This is Meta's Rule of Two ("untrusted input, sensitive access, a way out: at most two without supervision") made mechanical, and Pinnacle can enforce it where Linux cannot because all IO is channels the gatekeeper handed out: it knows which handle leads to the network or to a contact and which carried untrusted bytes in. It is a label on the task, not on values (CaMeL labels values), which is coarser and always safe: a task that wants to send after reading asks once.
Verbs, tiers and the question to the person
Terminal step 3 gives every service a describe: its verbs and their
parameters' types, so the terminal can complete, check and draw a form. The
agent's tool schema is the same answer; nothing is written twice. Two things
belong beside each verb from the start, because Apple showed they can be
derived and enforced rather than left to the model:
- An effect class: reads; changes the app's own data; changes something
shared (a message others see, a file another app reads); sends out of the
device; cannot be undone (a payment, a deletion past the snapshot, a send).
The gatekeeper asks nothing for the first two, confirms the third once per
task, and the last two per action, on the trusted path, with the device
unlocked. A package names the class in its manifest beside
network=yesandgpu=yes; the Store shows it before install, which it does not show the rights it has today. - Undo, or its absence. A verb that can be undone names the verb that undoes it; the gatekeeper logs the inverse with the action. A verb that cannot is in the last class by definition.
The question the person then sees is "Messages: send to Anna what this task
read from a web page?", with the task's log a tap away, rather than
"Allow curl … | sh?" eighty times. That is the whole defence against
fatigue that the evidence supports: fewer questions, each about an effect.
The plan as a program
The person asks a question in the terminal; the model answers with steps. In Claude Code each step is a tool call the model issues after seeing the last result, so the person can only approve one at a time or none. CaMeL's alternative, which the research behind it rates highest, is that the model writes the plan as a program in a restricted language, the interpreter runs it with capabilities on every value, and the quarantined reading of untrusted text can never choose an action.
Pinnacle is about to have that language: Frits (jeroen/frits), designed
2026-11-26 as the system's scripting language, with effects as capabilities in
a function's type (fn f() / Net), unforgeable capability values, Secret<T>
and untrusted-origin labels, processes preemptible by fuel, one canonical value
encoding. A Frits script the model writes for a task is a plan the type checker
reads before anything runs: a script whose type says it sends out after reading
untrusted input is refused or shown to the person once, as one question, with
the script. Fuel is the budget. The script's effects are the handles it needs,
so the gatekeeper gives exactly those. This folds three of the agent's parts
(tool checking, taint, budget) into one mechanism that is also how the person
scripts the device, and it is why the terminal's command language stays small
(pipelines, no loops): control belongs in programs, and Frits is the program.
Until Frits runs, the gatekeeper does the same checks per tool call; the records protocol does not change when the plan becomes a script, because a script's output is records too.
Undo
The design wants a pfs snapshot at a task's start so that undoing the task is
one act. pfs never overwrites content or table blocks in place and journals
every change (pfs/src/lib.rs), which is most of a snapshot, but it has no
block reference counts, shared extents or generations, so two trees cannot
share a block yet. Two ways in, in order:
- An inverse log first. For every verb with an inverse, the gatekeeper
logs the inverse; for a file written under a size limit, the pre-image.
Undo replays the log backwards. This covers what the agent does through
services, costs nothing in
pfs, and is what the records session shows the person as "what this task did". - Reference-counted blocks in
pfslater, when the Files app wants versions too: a snapshot is then a second root sharing every block, and a task's writes diverge from it. This is the Kairos shape, holding effects until released, done in the file system rather than a monitor.
The model
Three hosts behind one interface, in the order they become possible:
| Host | Needs | When |
|---|---|---|
| A provider's API over TLS | POST, headers, SSE, JSON in rt; the key in the vault | First |
| The person's own machine over the DHT (a midas node, a workstation) | NAT hole punching or a relay; a service tag on p2p streams, which have none today (the p2p service treats every incoming stream as an exec request) | After the p2p roadmap's hole punching |
| On the device | A pure-Rust inference engine; see below | Later, and small |
What a model on the device can do, as of late 2026: a 0.6–2 B model at 4-bit
weights (0.5–1.5 GB) classifies intent, picks one tool from a handful, fills a
form, summarises or rewrites a paragraph, and extracts JSON, reliably enough
(single-turn tool choice ~85–95 % on the function-calling benchmarks for the
best 3–4 B models); it fails at multi-step planning, nested calls and anything
needing knowledge. Decode speed is memory bandwidth over weight bytes: ~5
tokens/s for a 0.8 GB model on a 4 GB RK3399, ~20–30 on a current phone. The
KV cache is not small for a small model (~112 KiB a token for Qwen3-0.6B: 0.9
GB at 8 K context), so a 4 GB device budgets 1 GB of weights and half a GB of
cache. The PinePhone Pro's Mali-T860 has no Vulkan at all (panvk dropped
Midgard in 2022), so there the path is CPU only, and the Cortex-A72 lacks the
sdot instruction the fast int8 kernels want. On a laptop or under QEMU with
Venus, a WGSL compute path on wgpu is possible, and mobile Mali needs
mobile-tuned shaders before it beats the CPU (llama.cpp's Vulkan path does 3.6
tokens/s against the CPU's 13 on an RK3588).
Pure-Rust engines exist but none is finished: candle's CPU backend is
production code and portable (its wgpu backend is a fork and a pending PR);
Burn's CubeCL compiles kernels to WGSL but Burn-LM is an alpha; Airframe
(2026) is wgpu-only and young; ratchet and wonnx are dormant. The person's rule
means an own engine anyway: GGUF in, Q4_K and Q8_0 kernels, NEON and AVX2 on
the CPU, a WGSL path second, taking what those show. The useful first
milestone is small: the model service maps one Qwen3-class 0.6 B file once
(page-aligned tensors, one resident copy for every task), runs it on the CPU,
and answers "which verb, with what arguments, or escalate" for a short prompt
in under two seconds on an RK3399. That gives the terminal an offline command
router and a privacy filter that redacts before anything leaves the device,
and keeps the frontier model where it belongs: over the network, for the plan.
NPUs: only the RK3588's has an open, register-level interface (the rocket
driver, mainline since Linux 6.18), and it does int8 convolutions at 200 MHz,
no transformers. Watch; do not build.
Developing on the device
The agent people compare this to is a coding agent, and Pinnacle cannot be one
for its own code: rustc is LLVM, which is C++, and the rule is no C anywhere.
So there are two faces, and the design serves both:
- For the person's tasks on the device: services' verbs, Frits scripts and apps, files in the vault. The agent writes Frits, which is what a person scripting Pinnacle writes too, and the Store installs it compiled at install (Frits's design: source → typed bytecode → AOT on Pinnacle).
- For developing Pinnacle and Cartopolis: the code is built on a machine
with a toolchain, as it is today on midas's nodes. The Pinnacle agent reaches
that machine as the remote terminal already reaches another Pinnacle: a
stream over the p2p layer to an
execthere, the contact's key as the host key. What midas does with ssh, the hub and a WireGuard network, Pinnacle does with the DHT and contacts; the hub's nodes become contacts of the person's devices. This is the same remote-terminal protocol with a service tag, not a second mechanism, and it is how the person works now (one maintainer, several sessions, each on a node), carried onto their own OS.
What is given up, and what is not reinvented
Given up: a shell for development on the device; text as the universal
interface (a tool from outside expects bytes and gets records); MCP servers as
code (a service's describe is its schema, and a tool is a package the Store
signed and the person installed, never a process the model started); per-action
prompts as the safety story; and running every tool call the moment the model
asks (a plan is checked first).
Not reinvented: the model's API, context compaction, the system prompt with
the tool schemas, the models themselves. The model service speaks the
provider's protocol and nothing above it knows which provider.
Order
The roadmap's steps 3–6, with what this study adds:
- What the tree needs first, each useful on its own: a kernel file handle
(terminal step 3 wants it too);
rt::netwith POST, headers, chunked replies and server-sent events; an own JSON reader; an effect class and an inverse per verb indescribeand the manifest, shown by the Store; one source bit inInputEvent; a service tag on p2p streams; an append-only log file format in the vault. describein the services (terminal step 3), with effect classes.- The
modelservice and Settings → Agent: the host, the key in the vault, what was sent, the off switch. - The gatekeeper in the terminal: a task per command line, handles from the person (a file picked is a file handle), the log with inverses, a budget, Stop; confirmations through the display server by effect class; undo from the log.
- The taint rule, as a label on the task's handles.
- The UI tree and the act protocol with the synthetic-input mark, from the layout functions, for apps without a verb; the status bar's indicator.
- Frits as the plan: the model writes a script, the checker reads its effects, the person confirms once.
pfssnapshots by reference-counted blocks, when Files wants versions.- A model on the device, CPU first, as the router and the filter.
As built (2026-11-26, session s855)
Steps 0 to 4 are built and in the self-check (handles, verbs, model,
agent). Where the building found something the design did not say, or
said otherwise:
- The gatekeeper is sealed by the kernel, not only kept off the
network.
SPAWN_SEALEDstarts a program that reaches what its handles reach and nothing else: no network, no service by name, no file by path, no programs of its own. So its log is a file handle too (read and add only), and the confirmation a channel: the display server registerssystem-confirm, and the terminal connects to it, and to the model service and the services named, before it starts the task. "A task's rights are its handles" is then the kernel's rule, not the gatekeeper's good behaviour. - The person grants on the command line:
agent +p2p @notes.txt Tell Anna what is on my list.+namehands over a service,@patha file (read and write), the rest is the task. A service not given has no tool in the prompt; the self-check has the model call one anyway, and the call is refused as a tool that does not exist. - The undo is carried by the answer, not derived by the gatekeeper. A
verb names its inverse in
describe, and its result carries the concrete call that undoes this one (forget id=3for akeepthat made note 3), because only the service knows the state it changed. The gatekeeper logs that call;agent undoreplays the last task's calls newest first and marks the log, so a second undo is refused. A file the agent writes keeps its old content in the log, up to 256 KiB. - "Once per task" is per verb, not per effect class: allowing one shared change does not allow another of the same class.
- A file handle names its file by path, not inode. pfs hands inode numbers out again with no generation, so a held number could reach another file after a removal; the path was checked against the opener's confinement once, which is what the handle carries.
- The model service starts with the system, beside p2p and Bluetooth, and refuses every request while the agent is off; Settings → Agent turns it on. Its key lives only in the vault, so a system without one has no agent.
- The taint rule is a label on the task, set by what it read, not by
which handle carried the bytes: a verb says in its description that its
answer is untrusted (
untrusted: a page from the web, someone who is not a contact), and a file the person handed over counts as untrusted, since another program may have written it. From then on every action that reaches others (shared, out of the device, final) asks each time, and a shared verb allowed for the task before is asked again; the question names the tool whose answer tainted the task. The label is by tool and not by handle because a service's handle carries trusted and untrusted answers alike: the p2p service's history is a contact's, its future "fetch" would not be. - A p2p stream says its service in its first bytes. Old peers do not understand new ones; there are no old peers outside the self-check yet.
Sources
Harness anatomy: Claude Code docs on permissions, sandboxing, hooks, memory and
the agent loop (code.claude.com/docs); Anthropic, "Claude Code sandboxing"
(2025-10-20); OpenAI, "Unlocking the Codex harness" (2026-02-04); Willison,
"Codex sandbox investigation" (2025-11-09); agentclientprotocol.com; MCP
changelogs 2025-11-25 and 2026-07-28. Incidents: Invariant Labs on the GitHub
MCP server (2025-05-26); Socket and The Hacker News on Nx s1ngularity
(2025-08-26); ReversingLabs on postmark-mcp (2025-09); CSA on Claude Code auto
mode (2026-08). Vendors: Apple WWDC26 sessions 240, 343 and 347 ("Secure your
app: mitigate risks to agentic features"); Android Developers Blog, "Android 17
is here" (2026-06-16) and AppFunctions 1.0 (2026-11-18); Windows Developer
Blog, Build 2025 and Ignite 2025 posts; Microsoft Support, "Experimental
agentic features". Research: Debenedetti et al., CaMeL (arXiv 2503.18813);
Willison, "The lethal trifecta" (2025-06-16); Meta, "Agents Rule of Two"
(2025-10-31); Kairos (arXiv 2610.18457); "Irreversibility budget" (arXiv
2609.00275); Odersky et al., "Tracking capabilities for safer agents" (arXiv
2603.00991); AIOS (arXiv 2403.16971). Models on the device: Google, Gemma 3n
and Gemma 4 developer posts; Apple Foundation Models 3 (arXiv 2507.13575);
BFCL studies arXiv 2608.22472 and 2610.35981; llama.cpp issues #9853 and
#17783 (RK3399 sdot, Mali Vulkan); Mesa's panfrost docs; Linux rocket
driver docs; candle PR #3379, FerrisMind/candle, tracel-ai/burn, Navegos/airframe.