Expand description
The control plane (spec 3.2 §7.11).
One API, three transports: a Unix domain socket at the kernel home (macOS, Linux) or a
named pipe named after it (Windows, §10 W2), each of which trusts the OS user, and HTTP on
loopback or, with authentication, on the network. Surfaces hold no state (K-I17); every
control action carries an authenticated subject and is audited as kernel.control
(K-I16).
router is the API. adk-rust up merges it into ServerBuilder with
add_api_routes, so the server’s auth middleware and RequestContextExtractor apply and
the routes are served under /api; ControlPlane serves the same router, under the
same /api prefix, on the socket and on ControlPlaneConfig::http when set.
Route (paths, under /api) | Purpose |
|---|---|
GET /kernel/health | KernelHealth |
GET /kernel/processes | the process table, each process with its ProcessView (api::ProcessesQuery) |
POST /kernel/processes | start a process of a registered target as the caller (api::SpawnRequest): a turn a surface sends, or a sleeper with a wake set |
POST /kernel/processes/{pid}/{kill,nice,suspend,resume} | ProcessTable actions |
POST /kernel/processes/{pid}/run-now, POST /kernel/triggers/{name}/run-now | run a cron sleeper or a standing cron trigger now, outside its schedule (api::RunNowRequest, Kernel::run_now); refused while frozen |
GET /kernel/events | the event bus as server-sent events, from a cursor (api::EventsQuery) |
POST /kernel/attach/{session} | a surface attaches to a session: transcript cursor, pending holds, process |
POST /kernel/sessions/{session}/steer | send a message to the running turn of the caller’s session (api::SteerRequest, Kernel::steer): accepted by the turn this replica runs, or handed back to send as the next message |
POST /kernel/freeze, POST /kernel/unfreeze | Kernel::freeze and Kernel::unfreeze; unfreeze only on the socket or pipe, a paired local terminal (RESUME_NOT_HERE_CODE over HTTP, spec 3.3 S-I10) |
GET /kernel/agenda | the agenda (api::AgendaQuery) |
POST /kernel/agenda/{id}/{approve,reject,schedule} | Agenda actions as the caller (api::RejectRequest, api::ScheduleRequest) |
GET /kernel/drivers, POST /kernel/drivers/{id}/{mount,unmount,restart,reapprove} (feature drivers) | the mounted drivers; a mount shown, then approved with confirm (api::MountDriverRequest, spec 3.2 §7.7) |
GET /kernel/proc/ledger (feature proc) | the content-free ledger, paged by seq, as JSON or as the JSONL cargo adk eval --ledger reads |
GET /kernel/proc/baselines, GET /kernel/proc/observations (feature proc) | each partition’s last baseline pass, and the observations it offered |
POST /kernel/pairing, POST /kernel/pairing/claim, GET /kernel/devices, POST /kernel/devices/{id}/revoke | device pairing (spec 3.3 §10 K2), when ControlPlaneConfig::with_pairing sets it; see pairing |
POST /kernel/channels/pair, GET /kernel/channels, POST /kernel/channels/{id}/revoke (feature channels) | chat accounts’ pairings (spec 3.3 §10 K1) |
GET /kernel/partitions | the partition table (api::PartitionsResponse, spec 3.2 §7.8) |
POST /kernel/partitions, POST /kernel/partitions/{id}/mode | create or replace a partition; set its mode (api::PartitionModeRequest) |
GET /kernel/settings[/{partition}], POST /kernel/settings/{partition}/{quiet-time,spending-limit,mode} | quiet time, the daily spending limit and the mode while the kernel runs (spec 3.3 §10 K3); see the routes the surfaces need |
GET /kernel/away, POST /kernel/away/seen, GET /kernel/away/lines/{seq} (feature proc) | “While you were away” over the /proc ledger with a cursor per device (spec 3.3 §10 K4) |
GET /kernel/memory, POST /kernel/memory/facts/{id}/{confirm,fix,forget}, POST /kernel/memory/undo | what the agents remember, with provenance, and its corrections (spec 3.3 §10 K5) |
GET /kernel/record, GET /kernel/record/check | the latest actions on record, and the check that the record is complete (spec 3.3 §10 K5) |
GET /kernel/commands, POST /kernel/commands/run, GET /kernel/rules/always-allow/{id}, POST /kernel/rules/always-allow/{id}/{prepare,grant}, GET /kernel/sessions/{session}/mode | the REPL’s slash commands, “Always allow” and a session’s mode, when ControlPlaneConfig::with_commands sets a host (spec 3.3 §5.2); see CommandHost |
POST /kernel/surface/records | the records of a surface engine attached to the kernel, on its signed log (spec 3.3 §11); see SurfaceRecord |
The approvals inbox, /api/runs, /api/cron, /api/admin/freeze and /hooks/{name}
are the existing server routes, unchanged; POST /api/admin/freeze delegates to
Kernel::freeze through the kernel’s FreezeDelegate (§10 S4). The socket serves the
approvals inbox beside the kernel routes when the kernel has an approval service, so a
held call is decided over the socket as over HTTP; decide_guard answers each decision
under spec 3.3 §7.2 for the surface the transport is.
§Authentication and audit
Every route needs an authenticated caller: the Option<RequestContext> the server’s auth
middleware puts in the request extensions must be Some, or the route answers 401.
| Transport | Caller |
|---|---|
| Socket | The OS user, with the operator scope, when the peer’s uid is the socket owner’s; any other peer is refused |
| Named pipe (Windows) | The OS user, with the operator scope, when the token the client opened the pipe with is the kernel’s user; the pipe’s DACL admits that user alone, and any other client is refused |
HTTP merged into ServerBuilder | Whatever the server’s RequestContextExtractor admits: LoopbackOperatorExtractor, BearerTokenExtractor or an SSO extractor |
ControlPlaneConfig::http with an extractor | The extractor’s subject |
ControlPlaneConfig::http on loopback without one | Loopback peers as the OS user with the operator scope |
ControlPlaneConfig::http beyond loopback without one | Refused at start (K-I18) |
The routes that change the kernel — spawn, steer, kill, nice, suspend, resume,
freeze, unfreeze, the agenda’s approve, reject and schedule, the driver actions
and the partition writes — and the /proc routes, which describe the user’s activity,
need the operator scope (403 otherwise), which the socket, the pipe and a loopback
bind grant. attach reads only the caller’s own sessions. A ledger read is recorded as
kernel.control with action proc.ledger: the ledger leaves the host only through it, and
“While you were away” (spec 3.3 §10 K4) serves only the rows of its lines.
A paired device’s token (spec 3.3 §10 K2, S-I7) admits it over HTTP as the person who
paired it, only to the routes its scopes open (read, decide, stop; never
unfreeze), whatever HTTP admits otherwise: on a loopback HTTP bind a request carrying a
device token is the device, not the operator. The socket and the named pipe admit only
the kernel’s own OS user, as the operator, and read no Authorization header, so a
device token there changes nothing. Pairing never widens the bind.
Every action that changes the kernel or reads a session writes a kernel.control record
with subject, transport, action and target to the kernel’s audit trail before it
acts (K-I16; spawn records the new pid once it exists and cancels the process when
the record fails), and is refused when the record cannot be written under
AuditFailureMode::Block, except freeze, which takes effect regardless. Reads of the
process table, the partition table, the health and the event stream are authenticated
and not recorded.
§The routes the surfaces need
Spec 3.3 §10 K3–K5 adds the routes behind the home’s Today and “Agent Memory and Rules”
screens. Reading them needs the operator scope, which a paired device with read
has; changing a setting or a memory needs the operator scope and no device token: the
person at the kernel’s socket, pipe or loopback, or signed in to the home. A chat
channel reaches no kernel route.
| Route | Read | Change | Recorded as kernel.control |
|---|---|---|---|
| Settings (K3) | operator or device read | the person, no device | settings.quiet_time, settings.spending_limit, settings.mode, with from and to |
| While you were away (K4) | operator or device read | its own cursor: operator or device read | no |
| Memory (K5) | operator or device read | the person, no device | memory.confirm, memory.fix, memory.forget, memory.undo |
| Record (K5) | operator or device read | — | no |
The settings and cursors live in the ControlStore of
ControlPlaneConfig::control_store; the memory and the record are what a
MemoryBook and a RecordBook give the kernel, which adk-rust up builds over the
harness’s facts and the kernel’s signed audit log.
Re-exports§
pub use crate::error::DECIDE_NOT_HERE_CODE;pub use crate::error::RESUME_NOT_HERE_CODE;
Modules§
- api
- Wire types of the control plane (spec 3.2 §7.11). Every payload is
camelCase. - paths
- The control plane’s route paths, relative to the
/apiprefix they are served under (spec 3.2 §7.11).
Structs§
- Always
Allow Response - The answer of the “Always allow” routes: the words of the rule (spec 3.3 §8.2).
- Area
Settings - The settings a person changed for one area while the kernel ran (spec 3.3 §8.1 “Areas”,
§10 K3). Each one set replaces, for the area, the value the kernel and the area’s
partition record started with, while the area still starts with that value
(
start); one never set leaves the start value in force. - Area
Start - What an area started with when its settings were last changed (spec 3.3 §10 K3): the values the changes replace.
- Away
Cursor - How far one viewer of one person has read “While you were away” (spec 3.3 §10 K4): the
last
/procledger row it marked seen. - Change
- One setting a person changed while the kernel ran (spec 3.3 §10 K3): the value, and when and by whom it was set.
- Command
Call - One run of a command, as the host gets it (spec 3.3 §5.2).
- Command
Info - A slash command the kernel’s host offers (spec 3.3 §5.2).
- Command
Reach - How the caller of a command reached the kernel (spec 3.3 §5.2): the transport, the paired device whose token admitted it, and the calling process where the transport says. A command reads it to decide what it allows; the run’s record names it.
- Commands
Response GET /kernel/commandsanswer (spec 3.3 §5.2).- Control
Client - A client of a running kernel’s control plane (spec 3.2 §7.11), over its Unix socket, its named pipe on Windows (§10 W2) or HTTP. Surfaces hold no state (K-I17): every call reads the kernel.
- Control
Plane - The running listeners of a kernel’s control plane (spec 3.2 §7.11): the Unix socket, or
on Windows the named pipe
ControlPlaneConfig::pipe_namenames (§10 W2), and, whenControlPlaneConfig::httpis set, an HTTP bind, all servingrouterunder/api, with the approvals inbox beside it when the kernel has an approval service. - Control
Plane Config - Where the control plane listens and how it authenticates HTTP callers (spec 3.2 §7.11).
- InMemory
Control Store - A
ControlStorein process memory (spec 3.3 §10 K3, K4): changed settings and cursors end with the process, so a restart brings back the start settings. - Postgres
Control Store - A
ControlStorein PostgreSQL, shared by every replica (spec 3.3 §10 K3, K4; featurepostgres). - Record
Check - The answer of the record check (spec 3.3 §5.1 “Every action is on record”): whether the log verifies against its signed checkpoints, how many entries it holds, and the verifier’s own report.
- Record
Line - One action on record, as structured fields a surface words as a sentence (“You let Finance send one email, from Telegram”, spec 3.3 §5.1, §11).
- Redis
Control Store - A
ControlStorein Redis, shared by every replica (spec 3.3 §10 K3, K4; featureredis). - Remembered
Fact - One fact the agents remember (spec 3.3 §5.1 “What your agents remember”).
- RunCommand
Request POST /kernel/commands/runbody (spec 3.3 §5.2).- RunCommand
Response POST /kernel/commands/runanswer (spec 3.3 §5.2).- Session
Mode Response GET /kernel/sessions/{session}/modeanswer: the mode of the caller’s session, so a terminal attached to the kernel shows the mode in force and knows whether a change loosens it (spec 3.3 §5.2, §8.1).- Sqlite
Control Store - A
ControlStorein SQLite (spec 3.3 §10 K3, K4; featuresqlite). - Surface
Record POST /kernel/surface/recordsbody: one record of a surface engine attached to the kernel — an answer with the surface and how it was given, Stop all, Resume all, a mode change, a message sent — for the kernel’s signed log (spec 3.3 §11).- TidyUp
- One overnight tidy-up of the memory: a consolidation tick (spec 3.2 §7.5, spec 3.3 §8.2 “Undo”).
- Tidy
UpUndo - What undoing a tidy-up did (spec 3.3 §8.2 “Undo”).
Enums§
- Control
Transport - The transport a control action arrived on, as the
kernel.controlaudit record names it (spec 3.2 §9.3). - Fact
Origin - Where a remembered fact came from, in the home’s words (spec 3.3 §8.1): a known fact reads “You said this”, whether the person said it or confirmed or corrected a guess, and an assumed one “A guess”.
Traits§
- Command
Host - What the harness gives the kernel so a surface attached to it runs the REPL’s commands
and answers “Always allow” (spec 3.3 §5.2, §7.2). A run’s
CommandCallnames the caller; the host runs a command in that person’s session only. - Control
Store - Where the control plane keeps
AreaSettingsandAwayCursors (spec 3.3 §10 K3, K4). - Memory
Book - What the harness gives the kernel so the control plane can show and correct the agents’
memory (spec 3.3 §10 K5).
useris the caller; a book answers only that person’s facts, asfact_not_foundfor anyone else’s. - Record
Book - What the host of the kernel’s audit log gives the control plane to read and check it (spec 3.3 §10 K5).
Functions§
- claim_
router - The claim route of
kernel’s device pairing (spec 3.3 §10 K2) at/api/kernel/pairing/claim, which needs no caller since the code is the credential: merge it withServerBuilder::add_root_routes, outside the auth middleware and inside the host and origin checks. Empty when the kernel pairs no devices. - decide_
guard kernel’s check of every decision onPOST /api/approvals/{id}/decide(spec 3.3 §7.2, §11 S-I11, S-I13): the answer is checked under §7.2 for the surface the server established — the kernel’s socket or pipe as a paired local terminal, a paired device by its kind, an operator credential over HTTP asapi— and refused withDECIDE_NOT_HERE_CODEwhere that surface may not give it; never by a surface a client declares. An admitted decision is recorded before it reaches the inbox, and a suggested agent it answers is added or ended at once as that surface. The kernel’s own control plane installs it; a server that serves the kernel’s inbox installs it withApprovalEndpoints::with_decide_guard.- guard_
devices appwith every request that carries a device token checked againstkernel’s pairing first (spec 3.3 §10 K2, S-I7):401for an unknown, expired or revoked token,403for a route its scopes do not open, a decision it answers onPOST /approvals/{id}/decidelimited to low and medium risk and recorded. The server’s own routes are those ofPairing::with_device_routes; a decision on one of them is admitted for the server’s engine, which applies what each surface may decide. Layer it on the whole app that serves the kernel’s routes, so no route outside them admits a device either; requests without a device token pass untouched.- router
- The control plane’s routes over
kernel(spec 3.2 §7.11), relative to the/apiprefix: merge them withServerBuilder::add_api_routes, whose auth middleware puts the caller’sRequestContextin the request extensions. Building them setsKernel::serves_routes, which tells a web home served beside them to read them.