Kernel
The kernel is the workspace backend that Hangar, the reaktor command line and coding agents share. It runs
without a window. Each host composes the same kernel for a different operator: Hangar draws it, the CLI prints it, and
an MCP server named reaktor serves it to Claude Code, Codex and the other harnesses. Every call names one operation,
each operation declares what it can change, and the kernel checks that against what the caller's seat may do before
anything runs.
External execution belongs in reusable tooling, workspace decisions belong in the kernel, and presentation belongs in the host. This page describes the local implementation. Distributed sessions, authenticated remote control and general graph mutations are not part of it.
Overview#
The arrows describe dependency and ownership. The installed CLI and MCP attach to the supervised workspace owner.
| Layer | Owns | Does not own |
|---|---|---|
reaktor-mcp, with reaktor-gate, reaktor-devices, reaktor-databases, reaktor-cloud and reaktor-code — open source | Workspace discovery, task/plan/receipt contracts, supervised process execution, cancellation, bounded output, device/database/IDE adapters and loopback MCP transport | Product recipes, environment selection, approvals on behalf of an operator, or UI state |
reaktor-graph-runtime — open source | The existing graph/node implementation, typed ports, wiring, actors, lifecycle, dependency scopes, navigation and graph serialization | Compose, graph rendering or BestBuds policy |
reaktor-mcp — open source | Transport-independent JSON-RPC and read-tool/resource contracts | Workspace authority, product tool selection or a desktop window |
../hangar/host — closed workspace backend | Workspace catalog, environment context, planning and approval rules, run receipts, persistence, database/auth sessions and MCP read policy | Pane composition, native windows or graph layout |
../hangar/core and ../hangar/desktop | Workbench panes, navigation, editors, selection, rendering and registration of the graph mounted by the window | A second backend execution path |
../hangar/cli | Arguments, terminal output, exit codes and process lifetime | A second task catalog or policy engine |
The graph runtime and kernel currently require Java 25. The standalone JVM tooling adapters target Java 21. The dependency checks reject Compose, Skiko and frontend modules in the headless runtime/kernel.
Try it#
Which build answers, and what it lacks:
{"operation": "kernel.status", "arguments": {}}
{"type": "completed", "result": {
"owner": "03e1d85f….jar in ~/.reaktor/agents/81fe…/runtime, built 1 Nov 03:42; this process started 1 Nov 03:42",
"operations": 337, "behind": [],
"unavailable": ["retained telemetry: no span of production is retained for the last 60 minutes", …], …}}
Find operations by words, then read one's arguments:
{"operation": "operation.catalog", "arguments": {"query": "approval"}}
{"operation": "operation.describe", "arguments": {"operation": "agent.service.drain"}}
{"type": "completed", "result": {"id": "agent.service.drain",
"summary": "Pause admission of new tasks, queued turns and recovery while a service upgrade waits for current work. …",
"effect": "LocalArtifactWrite", "provider": "ToolNode",
"input": {"type": "object", "properties": {"enabled": {"type": "boolean"}}, "required": ["enabled"], …}}}
What “kernel” means here#
ReaktorKernel is the workspace backend. Its KernelGraph connects services through typed provider/consumer ports:
- Workspace operations: the shared
OperationalControlPlane, which holds context, catalog and receipts. - Data documents: independent database sessions, bounded schema/query operations and private pinned results through the reviewed execution path.
- Auth: directory inspection plus an explicit operator authority handle; directory visibility does not grant execution authority.
- External connection checks: reviewed reads that produce connection evidence through ordinary operation receipts.
This in-memory service graph is distinct from the remote Memgraph database. It also does not claim to implement every proposed immutable graph-IR or distributed-protocol feature. An edge proves local wiring; a successful, dated remote read is separate evidence that an external connection worked.
Graph composition does not replace conventional APIs. Callers can use kernel.operations, database sessions, connection checks and plain reaktor-gate contracts directly. Graph ports make ownership and dependencies inspectable. Reusable tooling remains usable without adopting a graph.
One operation path#
The kernel decides what a task means in the selected workspace and environment. Tooling carries out the prepared execution:
previewPlan(taskId) does not run the task. A required approval binds to the exact plan fingerprint; changed source definitions, environment, native operation or arguments require a fresh plan. Native operations carry typed provider requests. The process adapter uses argument vectors. Both have bounded capture, cancellation and timeouts. The kernel retains the product policy and records the result.
The desktop and CLI enter this same path. MCP operations pass through the kernel gate with the same typed outcomes and authority checks.
The door#
Coding agents reach the kernel through one door: an MCP server named reaktor, answered by a background process for
the repository, the workspace owner. People in Hangar and at a terminal meet the same gate, so every caller follows
the same rules and leaves the same record.
- One server, six tools.
kernelruns any operation;atlas_queryandatlas_readanswer code questions;change_plan,change_applyandcheck_runchange code and check it. - Operations declare effects. An effect says how far a call reaches, from reading local files to destroying data. Operations no one classified count as unknown and are never assumed harmless.
- Seats carry policy. A seat names the harness, such as
claude-codeorcodex. Its policy decides which effects run at once, which wait for a person, and which are refused. - Every call is logged with who made it, how long it took and how it ended, but never its arguments.
The server and its tools#
Each harness connects to the workspace owner's HTTP door on the loopback interface, with its own seat:
http://127.0.0.1:9318/mcp/<workspace>?seat=<harness>
reaktor --dir <repository> mcp install writes that entry for Claude Code in the repository's .mcp.json and for
Codex in .codex/config.toml; Codex reads a project's file only when it trusts the project.
reaktor-agent workspace install also writes Antigravity's ~/.gemini/config/mcp_config.json. For a harness that can
only launch a command, ~/.reaktor/bin/reaktor --dir <repository> mcp --stdio --seat <harness> relays to the same
door.
The same reaktor command runs any operation from a terminal, grouped by domain, such as
reaktor --dir <repository> operation catalog or reaktor plan list. A terminal caller has no agent identity, so
operations that need one, such as message.send or plan.next, fail with "A named agent session is required".
| Tool | Use |
|---|---|
kernel | Any workspace operation, as {operation, arguments} |
atlas_query, atlas_read | Declarations, uses, text and graph questions across the repository and the builds it includes |
change_plan, change_apply | A planned edit, rename or rewrite with every line it changes, then writing it |
check_run | The checks a change affects, run on the build worker, with the phase and cause of a failure |
The server holds no state of its own. It forwards every call to the workspace owner, a background service that
macOS keeps running for each repository and that owns the agent home. While Hangar runs, its reads join the owner's
catalog as hangar.* operations. Third-party servers named in .reaktor/mcp-providers.json are reached with
provider.call, but only after a person accepts the file's exact contents with workspace trust at a terminal;
any edit needs that acceptance again. Credentials stay where the provider list says they live and are fetched per
call, never returned.
Operations and effects#
On 1 November 2026 the owner served 337 operations, and a new kernel build can add more. operation.catalog alone lists their ids by domain;
{query} or {domain} adds each one's summary and effect, and {all: true} lists every entry in full.
operation.describe {operation} returns one operation's input and output schemas.
Every operation declares one effect from this ladder. The marked ones change something that matters outside the agent home, and they are the ones a narrowed policy holds back for a person:
| Effect | Reaches | Held back when narrowed |
|---|---|---|
ReadOnly | Reads only | |
LocalEphemeral | Temporary local state | |
LocalArtifactWrite | Files in the agent home, such as plans and profiles | |
SourceWrite | Source files | Yes |
DeviceWrite | A connected device | Yes |
LiveRead | Reads from a live service | |
NonProductionWrite | A test or staging service | Yes |
ProductionReversibleWrite | Production, in a way that can be undone | Yes |
CredentialWrite | Secrets and credentials | Yes |
DataMigration | Stored data, moved or reshaped | Yes |
Destructive | Data that cannot come back | Yes |
A result has one of these types:
| Type | Meaning |
|---|---|
completed | The operation ran; result holds its answer |
failed | It ran and failed, or its arguments were wrong; the text says why and often names the call that shows what it takes |
refused | The policy will not run it: the seat may never cause this effect, or a rule forbids the call |
denied | A person denied this exact call |
approval-required | The seat's policy needs a person first; the result carries an approval id |
paged | The answer was too large for one result; read it in parts from the answer:// address it gives |
Seats and policy#
Since 17 October 2026 every seat runs every effect without asking, by the owner's rule to speed development up first and secure it later. A policy file brings approvals back:
~/.reaktor/mcp-policy.jsonis the machine's policy..reaktor/mcp-policy.jsonin the repository can only narrow it: for each seat, the stricter of the two applies, and a workspace file cannot make a seat a superadmin on its own.
Each seat's entry, or * for every seat without one, has four fields:
| Field | Meaning |
|---|---|
allow | The highest effect that runs without asking anyone |
ask | Above allow and up to here, a person is asked first; above it, the call is refused |
plans | The seat may apply its own reviewed change plans, up to SourceWrite, without asking |
superadmin | Machine policy only. Operations that ask for a typed confirmation phrase, such as production applies, run without asking |
An effect that no one classified is never refused outright and never assumed harmless short of full access: a person
decides. access.map, and Hangar's Agent pane under MCP → Access, show every operation's decision for every seat,
including each seat's effective superadmin field.
A machine owner gives local Claude Code and Codex standing superadmin authority in ~/.reaktor/mcp-policy.json:
{"seats":{"claude-code":{"superadmin":true},"codex":{"superadmin":true}}}
An admitted superadmin call runs a reviewed shipping plan without a per-call approval prompt, and the gate records the seat and the standing policy in its call log and execution receipt. The exact plan, the environment, effect ceilings, enforced access-model denials and operations that need two distinct people still apply. Reload the workspace owner after changing a policy file.
Each harness calls through a seat, such as claude, codex, agy, a spawned task, the terminal or Hangar, and the
kernel records the seat as the author of what the call changes. In the access model
a seat is the principal agent:<seat>. The caller names its own seat and nothing verifies it, so the model can only
narrow what a seat may do. Every seat starts with full access in shadow mode, and the door's policy and approvals
still run after the model allows a call.
Approvals#
When a seat's policy stops short of a call, the result is approval-required with an id. A person then decides:
- In Hangar: Agent → MCP → Calls lists what waits, with the seat, provider, call, effect and minutes left. Type the id, and the confirmation phrase when the call asks for one, then choose Allow once or Deny. Hangar also shows a toast when calls wait.
- At a terminal:
reaktor-agent workspace approvals --dir <repository>lists what waits, andworkspace approve --dir <repository> --id <id>orworkspace denydecides one.
The agent then repeats the identical call, and it runs once. An approval covers that call and nothing near it: the
same seat, provider, operation and every argument, from the same caller. It expires 15 minutes after it was asked
for, approved or not, unless the policy's approvalMinutes says otherwise. Approvals are files in the agent home
under door/approvals/.
A reply in the conversation is not an approval. An agent asks the person and waits for the decision in Hangar or at a terminal; an agent's own shell is not a person.
The call log#
The door appends one line per call to door/calls.jsonl in the agent home:
| Field | Meaning |
|---|---|
at | When the call ended, in epoch milliseconds |
seat, principal, runId | Who called, and the run it belongs to |
provider, call | The provider and the operation or tool |
arguments | The first 16 hex digits of the arguments' SHA-256, never the arguments themselves |
millis, outcome | How long it took and how it ended |
detail, access | Up to 300 characters of explanation, and the run and plan a kernel run belongs to |
Arguments can carry source, queries and paths, so the log keeps only a digest: a log that is safe to read is worth more
than one that is complete. When the file passes 5 MB it becomes calls.1.jsonl, replacing the previous one.
Hangar's Calls view lists the calls newest first under the approvals that wait.
The call log says which calls a session made. To read what the session did, use session.log {session}: it returns that
session's turns from its agent's own transcript.
Long calls#
A call can outlive the client that made it, and the operation keeps running when the client stops waiting.
- The door waits up to 15 minutes for a
kernelcall. For the other tools it waits 35 seconds, or the call's owntimeoutSecondsplus 10 seconds. - Services have deadlines of their own. Past one, the answer is "No answer for reaktor.plan/write within the deadline": the outcome is unknown, and the write may still land.
- Clients have limits too. Codex ends any MCP tool call after 60 seconds unless its
reaktorentry setstool_timeout_sec, so keep eachrun.waitattimeoutSeconds45 or less and repeat it. - The owner answers on a small, fixed pool of request threads. A call whose client gave up still holds its thread until it finishes, so retries of a slow call stack up behind it.
Before retrying a call that timed out, read the state it would have changed: the plan's revision and last change, the message list, or the run.
Upgrading the owner#
- Build the agent distribution:
./gradlew :kernel:agentDist. - Install it:
rsync -a --delete ../hangar/host/build/agent-dist/ ~/.reaktor/dist/conductor/. Owners run from their own copy of the jars, so replacing the distribution does not disturb them. - Upgrade the owner:
java -cp "$HOME/.reaktor/dist/conductor/lib/*" ai.bestbuds.reaktor.kernel.KernelAgentServiceKt --upgrade <repository>.
The upgrade first drains the owner: it refuses new work ("Workspace is draining") until no run is active, for up to
five minutes, and agents are blocked meanwhile. Upgrade when the owner is idle, and afterwards read kernel.status
through a fresh door: its owner line names the jar and when the process started. Never install a distribution
without upgrading the owner, because a new server cannot use an owner from an older build.
Lifetime and host boundaries#
Opening a kernel creates the operations service, graph-owned sessions and dependency scope. Closing it stops its MCP listener, closes graph sessions and both native and process executors, and cancels outstanding work. Additional database/auth sessions created through the kernel are registered in the graph and may be closed earlier by their consumers.
The desktop bootstrap owns its kernel. DesktopWorkbenchGraph mounts that same KernelGraph in a container and borrows its database/auth sessions. Closing or remounting a pane must not close the backend. Closing the window disposes the bootstrap-owned kernel. A standalone desktop graph can own a fallback kernel when there is no bootstrap owner.
The CLI joins the supervised owner. The older per-host state files and discovery paths stay until one store and a matching desktop attachment are proven.
reaktor-graph re-exports the runtime and adds Compose integration. Existing UI imports continue to work. Headless code depends on reaktor-graph-runtime directly, so importing the graph does not pull a renderer into the kernel.
MCP reads over loopback#
reaktor-mcp defines the protocol and tool contracts, and its JVM side provides the loopback HTTP server/client, request bounds and Host/Origin checks. KernelMcp chooses the product reads and redacts their results. Desktop MCP adds the app registry and mounted graph/architecture reads.
| Read | Meaning |
|---|---|
control_plane_snapshot | Redacted workspace catalog, resources and execution receipts |
operation_plan | The task's plan requirements; no execution or approval |
kernel_graph | The actual graph owned by this kernel instance |
connection_status | Recorded connection evidence for the selected environment; does not contact providers |
Desktop graph_snapshot | The selected app graph, with provenance identifying an active window, headless registration or factory fallback |
Desktop architecture_snapshot | The architecture projection of that resolved graph plus the operational overlay |
The loopback endpoint is local and unauthenticated. It is not an authenticated remote control service. A kernel_graph result is not proof that a GUI is mounted, and a factory graph is not reported as an active UI session.
External connections and credentials#
Connection checks cover native JVM database adapters, remote D1 reads, Worker health, and authenticated Worker bindings for PostgreSQL/Hyperdrive, Memgraph, ClickHouse, D1, Durable Objects, service bindings, R2 and KV. The provider remains the system of record. A graph edge or configured binding is not a health check.
The kernel records the task, environment, run identity, time and result. A malformed body or application error does not count as healthy merely because HTTP or the process succeeded. Sensitive output is not retained across restarts; an old successful receipt is labeled RecordedSuccess until a new check supplies current evidence. A bounded read proves only that path and operation, at that time; product workflows and write permissions need checks of their own.
Credentials are materialized at the execution/session boundary and excluded from graph serialization, MCP output and persisted workspace models. PostgreSQL inspection is scoped to an explicitly selected environment. Native database credentials and a Worker's Hyperdrive credential are different access paths; success on one does not attest the other. Database Studio additionally enforces its inspector-role policy.
Infrastructure execution on the JVM#
The workbench's Kubernetes inventory, events and logs, PostgreSQL inspection and credential loading, Memgraph inspection, and ClickHouse inspection execute through JVM libraries. Desktop and CLI use the same kernel path. These operations have empty process argv and cannot fall back to a shell.
| Provider | Execution and transport | Implemented workbench operations |
|---|---|---|
| Kubernetes | Official io.kubernetes:client-java:27.0.0; existing certificate/token kubeconfig | Namespace inventory, object events, bounded pod logs, exact named credential read and API port forwards |
| PostgreSQL | PostgreSQL JDBC over TLS; host maps its credentials into standard PG* fields | Connection/catalog health; sealed SQL, typed results, JSON plans and statistics; explicit operator or strict-inspector profile |
| Memgraph | Neo4j Java Bolt driver over a JVM-owned Kubernetes service tunnel | Six registered catalog/graph inspections, bounded paging, graph results, EXPLAIN and query timing |
| ClickHouse | JDK HTTP client over a JVM-owned Kubernetes service tunnel | Sealed SQL with server read-only settings; JSONCompact retains duplicate column names, query IDs, statistics and EXPLAIN |
| Worker | JDK HTTPS client with short-lived service token | Capability discovery, eight binding checks and six concrete D1/R2/KV/Durable Object store inspectors |
Google Pub/Sub uses the JVM with Google's authentication library and bounded calls to the Pub/Sub and Cloud Monitoring APIs. Its topic/subscription pages retain server continuation tokens. Reading application delivery observations uses a separate Reaktor service token; Google credentials are never sent to an application receiver.
The generic contracts and clients live in reaktor-cloud; they can be used as ordinary library APIs without a graph. KernelOperationExecutor chooses native or process execution from the catalog. Environment mapping, allowed targets, classification and private session admission remain in the product kernel. Native requests bind the typed operation, selected credentials, definition digests and limits into their plan fingerprint. Serialized plans and MCP projections omit credentials and private execution bindings.
A native execution owns a resource session: clients, statements, responses and tunnels close with completion, cancellation, timeout or kernel shutdown. Queries and results use owner-only files outside the workspace. Query text never becomes command-line arguments or persisted run output. The extra lookahead row is retained internally so the UI can report truncation correctly.
This migration covers the workbench's inspection paths. Existing deployment, database import/dump, CLI tunnel and maintenance scripts still exist as explicit process recipes. D1 management recipes still use Wrangler; interactive SQL and catalog inspection use the authenticated owning Worker. Application Workers continue using their runtime bindings, including Hyperdrive and VPC; this is a separate path from a desktop database connection. A new native administration operation must be introduced as a typed contract and pass the kernel's authority/approval rules before replacing its process recipe.
Kubernetes configurations using executable credential plugins are currently rejected by this native path. The configured cluster uses certificate credentials. No sidecar or new always-running local proxy was added: the kernel owns short-lived API tunnels. The existing server-side Memgraph gateway remains the Worker's bridge to Bolt.
Service tunnels resolve the service selector to a ready pod, resolve numeric or named target ports, and bind an ephemeral listener on 127.0.0.1. The official client's WebSocket stream primitives carry the traffic. The kernel owns the stream before the handshake starts, so cancellation also closes a stalled handshake. API clients are scoped to the operation; no global Kubernetes client is installed. Tests exercise traffic in both directions, cancellation, service selection, secret decoding, pagination refusal and log limits.
Worker as an execution host#
The data Worker now exposes the shared reaktor.worker.operations.v1 contract:
GET /_reaktor/operationsreturns worker identity, environment and operation descriptors, including provider, effect and deadline.GET /_reaktor/operations/<id>?requestId=<id>executes one advertised read and returns an operation receipt with matching request, worker, environment, status and duration.postgres.inspect,memgraph.inspect,clickhouse.inspect,d1.inspect,durable-object.inspect,worker-service.inspect,r2.inspectandkv.inspectexercise the Worker's actual bindings.
Routes use the Worker's existing service-request authentication. The JVM client mints a short-lived service token, discovers the catalog, admits only bounded reads and validates the response identity before recording success. Redirects, oversized responses, unadvertised operations and mismatched environments/receipts fail. Provider failures and timeouts produce structured failure responses without provider secrets.
The Worker owns edge-local access: D1, Durable Object instances, KV, R2 and service bindings. A Durable Object's owning Worker performs its storage operation; the JVM cannot connect to that storage as a remote SQLite server. Memgraph uses the existing JVM gateway over VPC. ClickHouse uses VPC HTTP and PostgreSQL uses Hyperdrive. The new ClickHouse inspection performs a read; the separate legacy write probe is not used by this catalog.
This is the first implemented operation-host contract. Tenant-aware operator login, per-operation authorization, administrative writes, asynchronous job/stream protocols and shared cross-host audit storage remain planned. The deployed service token is not a tenant-superadmin session.
Where a new capability belongs#
Put a reusable external adapter in the module of the plane it acts on (reaktor-devices, reaktor-databases, reaktor-cloud or reaktor-code) and its execution contracts in reaktor-gate. Put a product task recipe, environment mapping, authority rule or redaction rule in the workspace kernel. Register a graph node only when it contributes useful service wiring or lifetime ownership. Add CLI arguments, MCP read projection and desktop presentation as thin adapters over those contracts.
Verification follows those boundaries: tooling tests exercise process supervision and adapters; runtime/kernel checks guard dependencies and lifecycle; kernel tests cover policy, receipt sharing and response validation; desktop tests verify that its panes and MCP reads borrow the correct graph. Remote checks supply dated evidence separately from those local tests.
What it improves#
| The usual approach | What goes wrong | What the kernel does |
|---|---|---|
| The desktop app, the command line and the agent tools each have their own backend | Their behaviour and permissions drift apart, and a fix reaches one of them | One kernel with one operation path; the hosts are thin adapters over it |
| Each harness configures its own servers | Agents see different tools, and fixes reach one harness only | One server and one catalog for every harness |
| Credentials copied into each agent's config | Secrets spread into files, logs and prompts | Fetched per call from where the provider list says they live, never returned |
| Trusting a tool's own description of what it does | A tool that claims to read can still write | Every operation declares its effect, and unclassified ones go to a person |
| Approving "the deploy" in a chat | The approval covers whatever the agent does next | An approval covers one exact call, once, for 15 minutes |
| Logging every request in full | The log holds source and secrets, so no one may read it | One line per call with an argument digest |
Limitations#
- Full access by default. Until a policy file narrows a seat, every seat may run every effect.
- Seats name harnesses. Two sessions of the same harness share a seat; the four-part name on each change tells them apart.
- Timeouts are uneven. The door, the services and the clients each have their own, so a slow call can fail for its caller and still succeed.
- The call log is local and short. It keeps the current file and one previous file of about 5 MB each.
- Local only. The loopback MCP endpoint is local and unauthenticated. Distributed sessions, authenticated remote control and general graph mutations are not built. Matching desktop ownership and the remaining graph-protocol acceptance still need their recorded qualification.
- The Worker host reads only. Tenant-aware operator login, per-operation authorization, administrative writes, asynchronous job and stream protocols, and shared cross-host audit storage are planned. The deployed service token is not a tenant superadmin session.
- Kubernetes credential plugins. A kubeconfig that uses an executable credential plugin is refused by the native path; the configured cluster uses certificate credentials.
Reference#
- The layers:
reaktor/reaktor-gate,reaktor/reaktor-cloud(the JVM provider clients),reaktor/reaktor-graph-runtime,reaktor/reaktor-mcp, BestBuds../hangar/host,../hangar/corewith../hangar/desktop, and../hangar/cli. - The door: BestBuds
../hangar/host/src/main/kotlin/ai/bestbuds/reaktor/kernel/:KernelAgentMcpHost.kt(the server),KernelOperations.kt(the catalog, effects and the gate),KernelDoor.kt(the door's files). - Policy and the call log:
reaktor/reaktor-mcp/src/jvmMain/kotlin/dev/shibasis/reaktor/tooling/mcp/door/:DoorAuthority.kt(policy, decisions and approvals),DoorFiles.kt(the call log),McpDoor.kt(third-party servers);reaktor/reaktor-gate/src/commonMain/kotlin/dev/shibasis/reaktor/tooling/ToolingModels.ktfor the effect ladder. - How long the door waits:
reaktor/reaktor-conductor/src/jvmMain/kotlin/dev/shibasis/reaktor/conductor/workspace/AgentWorkspaceConnection.kt. - Related pages: CLI for the terminal host, Agents for the agents that call the door, The Agent pane for the door in Hangar, Data pane for data inspection authority, strict SQL and provider projections, and Auth for the Auth pane.