Commands — app program invocation
Reading of harness/docs/plugins/commands.md. If this page and that file disagree, the source file wins.
Commands — app program invocation
Section titled “Commands — app program invocation”Commands are not PEW. Commands are not Work. They are app-managed programs. One half is a Client Scheme (Arrival) program for pickers and projections. The other half commits name and args as a JSON-RPC action on the session socket.
Grain is ../canon/grain.md. There, Command means an app program. The surfaces ladder is plugins/tldr.md. Inventory grounding is ../runtime/drivers.md. drivers[] is still projected. It is not the behavior surface.
The Client Scheme does not implement a mini-app UI framework. It declares session-hub projections. The projections are catalog, faces, and commands. They land in one choice / action surface. The Client owns navigation. The Client owns search. The Client owns chrome. The Client owns rebuild.
Registration is extensions.tools.inhuman.commands. The record is { description, importPath } to a Scheme file. It is file-driven so require works. See polish.md.
1. Split
Section titled “1. Split”| Half | Where | Role |
|---|---|---|
| Sandbox | Client | Scheme file (Arrival); read session-hub projections; fast local UX |
| Commit | Session socket | name+args as a JSON-RPC action |
Commit holds { type, args }. Programs never await (../runtime/control-effects.md).
2. Law (sandbox half)
Section titled “2. Law (sandbox half)”| Command declares | Client owns | |
|---|---|---|
| Content | Choice rows over DriverSpecs + ConnectionSpecs + faces | Fuzzy, arrows, focus, multi-rep (TUI / remote / voice) |
| Primary | action (commit) or nested choice (drill) |
Enter / default activate |
| Additional | actions list (manage ops on the same subject) |
Bind chrome; optional hotkeys |
| Hotkeys | Optional triggers on action/choice — never the behavior itself | Keymap |
| Navigation | — | Esc / back / stack / cleanup |
| Inventory | Read driver + connection faces only | Re-interpret whole surface when atoms change (v0 all-or-nothing) |
| Product knowledge | Never invent package-form import paths, whitelist entries, badges, doors, Back rows | Chrome, empty states, session-attached gate |
| World | Current is immutable (reads / provenance) | Next via commit of kv/set / named actions |
One verb owns one concern.
| Verb | Owns | Must not |
|---|---|---|
/connect |
ConnectionSpec registry: list wires, adopt/drop, set current wire (+ last-used model on that wire) | Model catalog / free model pick as primary product |
/model |
Models from connection faces; free model id; set session model | Adopt/drop drivers/connections |
/mcp |
ConnectionSpecs whose can includes mcp: health, tool count, session disable, authenticate, add/drop |
Completion wires / model catalog |
Selecting a connection writes kv/set connection. It then writes the last-used model on that wire. That is not a special “use pipeline.” Selecting a model writes kv/set connection, then model, then last-used on that wire. Reactivity does the rest. Adopted offers are omitted. Unused add-by-default drivers adopt from the driver row. OpenRouter opens a PKCE key-exchange URL. ChatGPT parks an OIDC browser sign-in and stores a refreshable session. Grok does the same. /model lists faces with fewer than 20 ids first. Catalogs of 20 or more sit below.
Packs may register extra operator verbs through extensions.tools.inhuman.commands. Those commands are absent from the model tool catalog.
3. Surface grammar
Section titled “3. Surface grammar”choice = { kind: "choice", rows }row = title, description?, state? primary: InhumanAction.ref(args) | choice | input actions: list of { label, hotkeys?, action }action = name + args → { type, args } issued as JSON-RPC hotkeys?: optional triggers onlyThe same grammar can be lensed to a TUI, a remote UI, or voice. The command does not care.
{ title: "…", description: "…", state: "warning", primary: selectConnection.ref({ id: c.id }), actions: [ { label: "disconnect", hotkeys: ["control-x"], action: dropConnection.ref({ id: c.id }) }, ],}Missing adopt settings (base URL) are a harness/input callback form from connect/adopt. They are not a nested input dict in the command program. openai-compat’s OpenAI-compatible door is an adoptable offer with empty settings. Enter parks Base URL, then an optional secret API key. An empty key skips. The written wire is named by a well-known catalog when the host matches (Groq, Fireworks, OpenRouter, …). Otherwise the name is the URL’s eTLD+1. Many custom endpoints coexist. The door is never hidden after adopt.
/mcp uses the same grammar over can: ["mcp"]. Rows have no primary select. A row is not a completion wire. Add is mcp-server/adopt, not connect/adopt. Remainder on the root action is the dropped URL or stdio command (:input). Enter on the Add MCP row parks. An HTTP remainder that 401s with Protected Resource Metadata parks the same PKCE harness/open-url as connect/login. Otherwise the row parks an optional token. Session disable is kv/set mcp-disabled:{id}. It is not config.json. Row tool counts are live.tools (what the server listed). The durable catalog cut is tools on the connection. toolSeverity overlays auto-class. See ../client/operate.md § /mcp.
There is no kind: "pick" ceremony when the host treats every row as choosable context. A free model id is remainder-as-:input on kv/set.
/goal and /plan are pack command files (plugins/inhuman-plugin-goal/tools/inhuman/commands/goal.scm, plugins/inhuman-plugin-fusion/tools/inhuman/commands/plan.scm). They call call/method and harness/action-with-choices. The client Arrival interpreter does not evaluate those forms. The behavior capability does not evaluate them either.
4. Projections (connect example)
Section titled “4. Projections (connect example)”The subject of each define must match the name (connections vs drivers):
| Projection | Meaning |
|---|---|
prompt-drivers |
DriverSpecs whose pre-load can includes completion |
used-connections |
ConnectionSpecs whose DriverSpec is prompt-capable. Titles prefer live.catalogName over the config.json name. Dim annotation (user · $balance / displayName) and tertiary hint (key mask / plan caption) are client-composed from live.account / live.identity / live.keyMask. Adopted rows do not show the URL |
offers |
class-bootstrap offers on those drivers, minus already-adopted. openai-compat names loopback catalogs by port (Ollama, LM Studio, …) and seeds remote catalogs on load |
unused-drivers |
prompt DriverSpecs with no ConnectionSpec and no offers |
Rebuild runs the whole connect-surface again when Spec inventory or faces change. It is not per-define fine-grained computeds (v0).
5. Registration
Section titled “5. Registration”"commands": { "connect": { "description": "Manage provider connections", "importPath": "./commands/connect.scm" }}The record sits on extensions.tools.inhuman.commands. The Scheme file loads file-driven. Arrival require uses that path. The plugin JS module does not load on the Client. Dual ambient (manifest vs Client eval) is lifecycle.md.
6. Session-hub ambient + entities
Section titled “6. Session-hub ambient + entities”(harness/kernel/…) reads KernelRoot.drivers and KernelRoot.connections. Those are live entities, not view dicts. (harness/action 'kv/set :params …) is a named RPC. It is not a Scheme mutate of the kernel. The operation is the first positional argument. A branded host instance is opaque identity. (:id c) opens that door. Field reads are (:field entity).
(harness/kernel/drivers :can 'completion) ; DriverSpec list(harness/kernel/connections) ; ConnectionSpec list(harness/kernel/offers d) ; class-bootstrap connection construction(:models (:live c)) ; openai-compat invocation ids on spec.live(harness/session/get-current key) ; immutable current(harness/action 'kv/set :params (dict :key "connection" :value (:id c) :remember "1"))(harness/action 'connect/adopt :params (dict :driver (:name d) :name n :settings s))(harness/action 'connect/drop :name "Remove connection" :hotkey "control-x" :params (dict :id (:id c)))(harness/action 'mcp-server/adopt :name "Add MCP" :params (dict :input ""))| Entity | Field reads ((:field entity)) |
|---|---|
| connection (ConnectionSpec) | id, name, driver, issue, error, configuration, live |
| driver (DriverSpec) | name, description, can (Expectation model names), multiplicity |
| offer | name, description, adoptable, settings |
connect/adopt takes a driver name, an offer name, and settings. can is readable before ensure. Broken connections surface sticky failure messages, not silent absence. add-by-default unused drivers adopt from the driver row. Secrets stay in process-local secrets.json. They never go in config.json.
7. Host obligations
Section titled “7. Host obligations”- Session attached (session-hub catalog present).
- Interpret surface → choice/action tree; fuzzy + arrows.
- Primary activate / additional actions / hotkeys as triggers.
- Esc / back / dismiss — never command rows.
- Re-interpret on reactive projection change.
- Commit
InhumanAction.ref(args)/ host{ type, args }.
8. Observation vs work
Section titled “8. Observation vs work”| Surface | System |
|---|---|
| Slash command picker | declarative choice/action + DriverSpec / ConnectionSpec faces |
| Behavior guards and hooks | critical path and parallel notes (lifecycle.md) |
| Chat completion | PEW + ensure → PEWConnection.resolve → ExpectationActor |
Listing connections or models is observation. Running a completion is work.