Work and ownership
When a model asks to edit a file, the daemon records the request before running it. The request has its own authorization decision and its own result. Approving that edit changes the pending request; it does not give the model permission to run everything else in the turn.
A model reply follows a different path. The daemon creates a record for the request and attaches a handler that talks to the model service. That handler writes the outcome when the request ends. Tool execution and model requests belong to the same conversation, but they are not the same kind of work.
From action to execution
Section titled “From action to execution”The terminal UI and the unattended eval client send named actions over JSON-RPC on the session socket. Either is a Client. The daemon creates the work records in response. There is no separate queue service between them: the session document holds the queue.
For an interactive approval, the client writes approved and, when supplied, approvalComment on the pending request. The eval client submits source and policy, observes results, and requests cancellation. It never grants approval. Neither client runs the policy program, creates Job or expectation bodies, or orchestrates model handlers.
The daemon records each model tool_call as a ToolCallJob. This is an ApprovableJob, so it passes through the host authorization pipeline. Permission belongs to that leaf, not the surrounding turn. The executor runs the tool body only after the registerExecutor guard returns true: orchestrationResult === true.
For MCP and web requests, the body obtains the connection and calls callTool, webSearch, or webExtract. The executor seals the result in ToolCallJob.outcomeJson. A tool that requires human input in unattended execution fails through its operation outcome.
The concrete tool jobs include SystemToolJob, FileMutateToolJob, MCPToolJob, WebSearchToolJob, WebExtractToolJob, and AgentCallJob. File tools are Jobs too; they are not a model driver or a special kind of model request.
Approval defines the authorization pipeline. Client shell defines what a client may write.
Model requests and their outcomes
Section titled “Model requests and their outcomes”Model completions and judges are requests with a durable outcome. The source calls this PEW, or Plexus Expectation Workflow. Each PEW/Expectation is one document entity for one obligation. A completion uses CompletionExpectation; its tape, usage, and live thought remain with PEW.
The executor matches the expectation to a driver and a connection, then attaches an independent handler called an Actor. The Actor handles that expectation under the connection. It does not decide permission or run the client’s interface.
A completion and its emitted tool jobs are siblings on the turn’s work lists. A tool call is not nested under a sealed completion, and a completion is never the session’s head.
Two places hold the state of a PEW request:
- The shared CRDT document holds the obligation and its sealed
successfulorfailedoutcome. - Awareness holds progress while the Actor works. This is temporary presence, not a second durable record.
The Actor settles the expectation itself. It does not read a transcript or a separate journal to decide the outcome. A process-local write-ahead log is an executor detail, not another source of session truth. The transcript renders the document; it is not the store.
This is why the source describes the design as inverted event sourcing: the entity is durable, while the stream is temporary. The system uses entities, references, and reactions rather than a separate service and journal for each component.
What the daemon owns
Section titled “What the daemon owns”One daemon process holds the kernel, the sessions, and the executor.
The kernel holds configuration, the whitelist, and registries. KernelReflector projects config.json and kv.json into KernelRoot. The session is one conversation, stored in its own SessionRoot. It holds the expectations tree, head, key/value state, application behavior, and work awareness. These entities are Plexus models.
A session is not an additional execution region. The daemon executes its work; clients observe it and submit actions. Files, processes, and the network remain outside the document. The source calls them the World. Tools reach that world through an authorized leaf Job.
The daemon also hosts programs and cross-session application storage. It does not become the conversation’s current turn or the client’s interface. Clients can run sandboxed command Scheme and render results, but cannot take ownership of the daemon’s work.
Connections and the tool catalog
Section titled “Connections and the tool catalog”A driver describes which expectation kinds it can handle. Before loading, it is a DriverSpec; its can field lists expectation model names, not tool names. After it is ensured, the runtime has a PEWDriver. A driver is not an account or an installed npm package.
A connection is one configured link to that driver. Configuration supplies a ConnectionSpec with a reference to its DriverSpec; ensuring it creates the runtime PEWConnection. Multiple accounts mean multiple connection specs. The connection includes the transport link, but it is neither a network socket nor the entire provider.
The daemon ensures connections through the whitelist and import path. They can become ready on demand or eagerly. Their live data is on spec.live. Models are invocation IDs there: (:models (:live c)) in Scheme. The session selects a model through its model key. The shell’s model and tool lists are projections of this state, not additional harness types.
The catalog is one process-local table, combining registered tools with tools exposed by connections:
catalog = registered ∪ expand(connection)Registered tools include the always-on host plugins for files, shell, web, metadata, Scheme, and agent communication, plus user packs. They use one InhumanPlugin path. Reloading projects these sources back into the same table and applies the session filter; admission and execution do not keep separate competing catalogs.
Routing follows the catalog source: a pack handler, or a connection spec and the server’s tool name. The name shown to a model is a wire projection, not durable identity. Routing must not reconstruct the source by parsing mcp__….
MCP connections are not completion connections. MCPToolJob obtains one through ensure() and executes the call in its Job body. Server settings and secrets.json describe how to reach the server. listTools supplies live catalog rows; those tools are not configuration fields.
A session cannot own a kernel ConnectionSpec as a child. Work can refer to that connection through a lawful cross-document pointer. Its string name and ID must not become two independent product identities.
Drivers and connections defines the registered provider roster. Standard toolkit defines the built-in tools and their model-facing forms.
Turns and programs
Section titled “Turns and programs”Each conversational turn is a SessionTurn with tail, doneWork, and queue. The next turn points directly to the preceding one through .tail, and SessionRoot.head advances to the new tip. Following those references reaches the initial SessionSystemPrompt, which holds the snapshotted prompt packets. The reference is context, not another piece of work or a nested expectation.
The queue also holds control work: TurnPromptChunk, CompactJob, ReACTChunk, and ProgrammaticJob. These are turn orchestration, not PEW expectations.
scheme_repl appears in the catalog, but its row only exposes the interface. Admitting a model call creates a bare ProgrammaticJob, not an approvable ToolCallJob wrapper. CLI eval creates the same work bag directly on the turn queue. Tool requests made inside the program are nested ToolCallJobs and receive their own authorization.
General bots use Scheme agent/send and agent/ask, rather than one catalog row per recipe. shell is an ordinary catalog tool, not a workspace-mutator category. Other tools remain ordinary catalog rows.
Harness programs can adjust Actor inputs and outputs, perform parallel world effects, and hold interim command or UI storage. They return data; the interpreter handles waiting, fan-out, and re-invocation. They do not control the client application directly. Control effects defines this execution model.
Compaction
Section titled “Compaction”The turn loop runs a CompactJob when it shifts that job from the queue. It uses the config-addressed compact.scm fold to project everything strictly before the job as cards, squeezed lines, or verbatim content.
The job marks a cutoff, not a cursor that makes the fold result the new starting point. A fold failure stays on the job as a notice for the user and does not enter the next model prompt.
Approval, cancellation, and commands
Section titled “Approval, cancellation, and commands”Approval remains a write on the pending tool leaf. It does not create a nested approval expectation. Cancellation is also host-owned: admitTermination() when a worker is live, or fail("cancel", …) when no worker is handling the expectation. The Actor observes the ending rather than receiving a cancellation proposal in an awareness mailbox.
Questions and confirmation belong to the shell’s input interface. Steering remains attached to prompt-specific chunks. Cancellation and questions covers these crossings.
An application command has two halves. Sandboxed Client Scheme handles local UI and pickers. Its effects use session or kernel JSON-RPC records shaped as {type, args}, with actions such as turn, turn/rewind, compact, eval, kv/set, kv/clear, policy/set, connect/adopt, connect/drop, connect/always-allow, connect/exclude-tool, and config/auto-allow.
Commands run on the client. They do not become the conversational tip or another core execution region, and a slash command is not PEW work. Headless introspection is a client without TUI chrome: it creates and awaits real expectations rather than introducing a separate test-only work model.
Implementation boundaries
Section titled “Implementation boundaries”The sections above describe the running system. The following constraints keep extensions and implementation changes within that model.
Providers, plugins, and packages
Section titled “Providers, plugins, and packages”A driver provider is a runtime package supplying drivers, connections, Actors, authentication, discovery, and account projections. Product composition registers the provider roster; plugin manifests do not load it.
An extension plugin uses @inhuman.tools/plugin-sdk to add tools, actions, bots, behavior, state, and other supported extensions. It cannot supply drivers. New capability arrives through connections on existing drivers, pack tools, or .scm commands. Hermes is an OAuth client of Nous Portal, not a driver ID.
An npm package is a dependency, exports, build, and test boundary. It is not a process or an independently released product. An assembly composes real lower-layer packages, not mock services. Changes preserve driver IDs such as nous, chatgpt, grok, and openrouter, along with connection IDs, PEW kinds, and synchronization tags. The package ownership rules define the allowed graph.
Hooks and modes are programmable edges on expectation phases, not parallel work kinds. A Scheme environment capability is named envCapability; documentation does not shorten this to bare ‘capability’ or confuse it with a driver’s or connection’s capabilities. Configuration rows are not open work, and drivers and connections are not environment capabilities. The catalog is not a global work registry.
These execution regions are responsibilities, not numbered privilege rings. Say that a machine hosts the harness daemon; avoid using “host” as another architectural component. Do not turn the process PATH into document state or introduce a spawn-policy entity.
Compatibility and planned topology
Section titled “Compatibility and planned topology”MCPToolJob.dispatched is the marker used to park dispatched work. The honor path still settles leftover connection-interning PEW for one compatibility release; new MCP and web calls execute as Job bodies.
Legacy TurnCompactChunk records, including their representation, still read through the old path. They do not make CompactJob an executor.
The server’s kernel, project, and session services share one daemon process. The TUI is a separate client process; see Runtime and session state. A planned split names a hypervisor for topology and process lifetime, a Yjs-server for public synchronization, replicas, and durable document images, and a runtime-server connecting the runtime assembly to document storage and supervision. That split does not ship and does not change the order of work described here.
Source terminology
Section titled “Source terminology”The source uses PEW/Work and PEW/Expectation for an obligation and its outcome; documentation keeps the prefix outside the PEW package. Each obligation is a model entity, not a chat-ledger row. Neither MCP nor shell execution introduces a second special PEW kind.
The source’s comparison to Datomic, React, and an OS kernel is a metaphor, not an additional mechanism. The architecture has no separate session queue, parallel chat journal, or awareness lane for proposals that an Actor considers.
Source
Section titled “Source”Based on docs/canon/grain.md in the Harness repository. If this page and that file disagree, the source file wins. The PEW package contract is packages/plexus-expectations/README.md.