Installation
The extension ships withsmithers-orchestrator. Install PI and add it to your PATH, then register the extension:
http://127.0.0.1:7331. Start one with smithers serve before launching PI.
Setup and configuration
The extension registers two CLI flags you can pass when launching PI:| Flag | Short | Default | Description |
|---|---|---|---|
--smithers-url | -u | http://127.0.0.1:7331 | Smithers server base URL |
--smithers-key | -k | — | API key for authenticated servers |
SMITHERS_API_KEY in the environment. Setting the env var is preferred over passing the key on the command line.
MCP bridge
On session start, the extension spawnssmithers --mcp as a child process and connects to it over stdio using the Model Context Protocol. It then discovers all available Smithers tools and registers them as PI agent tools named smithers_<tool>. This means the agent can call Smithers operations directly as tool calls, with full TypeBox parameter schemas derived from the MCP server’s JSON Schema definitions.
The MCP connection is held open for the entire PI session and torn down cleanly on session_shutdown.
Dynamic tool registration
Tools are registered dynamically at session start based on whatever the live MCP server exposes. If the server has a newer or older tool surface, the agent gets exactly that set — no hardcoded list. Thetui tool is filtered out since the extension itself handles TUI interactions.
Tool call rendering in the PI chat history shows smithers <tool-name> key=value … for calls and a colored success/error indicator for results.
MCP tool reference
| PI tool name | Underlying MCP tool | Description |
|---|---|---|
smithers_run | run | Start a new workflow run |
smithers_status | status | Get run status and node summary |
smithers_approve | approve | Approve a node waiting for human sign-off |
smithers_deny | deny | Deny a node waiting for human sign-off |
smithers_cancel | cancel | Cancel a running workflow |
smithers_list | list | List runs for a workflow from the database |
smithers_frames | frames | List render frames (DAG snapshots) for a run |
smithers_graph | graph | Preview the execution graph without running |
smithers_resume | resume | Resume a paused or crashed run |
smithers_revert | revert | Revert the workspace to a previous task attempt |
smithers_list, run with smithers_run, monitor with smithers_status, approve with smithers_approve, and debug with smithers_frames or smithers_graph.
System prompt injection
On everybefore_agent_start event the extension augments the system prompt with two pieces of content.
Full Smithers documentation
The extension loadsdocs/llms-full.txt (~125k tokens) from the package. It tries several candidate paths and falls back to llms.txt if the full file is not found. This gives the LLM complete knowledge of the Smithers API, component reference, and usage patterns.
Resolution order for llms-full.txt:
<package-dir>/docs/llms-full.txt<package-dir>/../docs/llms-full.txt<cwd>/docs/llms-full.txt<cwd>/node_modules/smithers-orchestrator/docs/llms-full.txt
llms.txt fallback.
Active run context
If there is a currently active run being tracked by the extension, a short context block is appended:UI components
The following components are active whenever PI is in interactive (TUI) mode.Header
Displayssmithers · workflow orchestrator branding at the top of every PI session. Rendered via ctx.ui.setHeader.
Status bar
Shows a live count of active runs, pending approvals, completed runs, and failed runs in the formsmithers: 2 active · 1 awaiting approval · 3 done. Updates on every background poll cycle and after every event stream message. Disappears when no runs have been tracked.
A separate approval indicator status entry (smithers-approval) appears at the start of each conversation turn when one or more nodes are waiting for approval: ⏳ N node(s) awaiting approval.
Event ticker
When a run is being watched via the event stream, the 5 most recent events are rendered as a widget above the editor input. Each line shows a timestamp and the event message. Updates in real time as events arrive.Message renderer
A custom PI message renderer (smithers-event) formats workflow event messages in the chat history. It uses status color coding and status icons, and shows the run ID when the message is expanded.
Auto-polling
Active runs are polled every 10 seconds for status updates even when no event stream is attached. Each poll also fetches Prometheus metrics from the server’s/metrics endpoint. Polling starts on session_start and stops on session_shutdown.
Slash commands
All commands are available as/smithers-<name> inside the PI interactive session.
| Command | Argument | Description |
|---|---|---|
/smithers | — | Open the full-screen dashboard overlay |
/smithers-runs | — | List all tracked runs; select one to make it active |
/smithers-watch | [runId] | Attach a live SSE event stream to a run |
/smithers-run | [workflow] | Start a workflow and auto-attach the event stream |
/smithers-resume | [workflow] | Resume a paused or crashed run |
/smithers-approve | — | Interactive approve/deny flow for waiting nodes |
/smithers-cancel | [runId] | Cancel a running workflow with confirmation |
/smithers-status | [runId] | Show detailed status; defaults to active run |
/smithers-logs | [nodeId] | Scrollable log viewer for a node’s output |
/smithers-frames | [runId] | Browse render frames (DAG snapshots) for a run |
/smithers-graph | [workflow] | Preview the execution graph without running |
/smithers-revert | [workflow] | Revert workspace to a previous task attempt |
/smithers-list | [workflow] | List runs from the database for a workflow |
/smithers-metrics | — | Live Prometheus metrics overlay |
/smithers — Dashboard overlay
Full-screen TUI overlay with four tabs:- 1 Overview — all tracked runs with status icon, workflow name, run ID prefix, elapsed time, and a node state summary
- 2 Nodes — per-node breakdown for the selected run with state, duration, and the last two lines of captured output
- 3 Events — the 20 most recent events for the selected run, color-coded by type
- 4 Errors — all errors collected for the selected run
j/k to select runs, 1–4 to switch tabs, q or Esc to close.
/smithers-runs
Shows a selection list of all tracked runs. Selecting a run makes it the active run for the event ticker and status bar./smithers-watch
Attaches a live SSE stream to a run. Events update the ticker widget and the dashboard in real time. Accepts a run ID as an argument or prompts if omitted./smithers-run
Prompts for a workflow path and optional input JSON, callssmithers_run, and automatically attaches the event stream to the new run.
/smithers-resume
Prompts for a workflow path and run ID, callssmithers_resume, and auto-attaches the event stream to the resumed run.
/smithers-approve
Collects all nodes in thewaiting-approval state across all tracked runs and presents a selection list. After choosing a node the user picks Approve or Deny and can add an optional note. Posts directly to the Smithers server API.
/smithers-cancel
Presents a selection list of active runs or accepts a run ID argument. Requires confirmation before callingPOST /v1/runs/:runId/cancel.
/smithers-status
Callssmithers_status and pastes the result into the editor. Defaults to the active run when no ID is provided.
/smithers-logs
Opens a scrollable log viewer for a specific node’s captured output. Prompts for node selection if no argument is given. Keys:j/k to scroll, g/G for top/bottom, q/Esc to close.
/smithers-frames
Opens a split view: a frame list on top and frame detail below. The detail pane shows the task index, mounted task IDs, any note, and an XML snippet of the DAG snapshot. Navigate withj/k, close with q/Esc.
/smithers-graph
Callssmithers_graph and pastes the JSON execution graph into the editor. Accepts a workflow path as an argument or prompts if omitted.
/smithers-revert
Interactive revert flow: prompts for workflow path, run ID, node ID, and attempt number, then requires confirmation before callingsmithers_revert. Warns that this modifies the working directory.
/smithers-list
Callssmithers_list for the given workflow and pastes the JSON run list into the editor.
/smithers-metrics
Full-screen TUI overlay showing live Prometheus metrics fetched fromGET /metrics:
Counters and gauges — runs started/finished/failed/cancelled/resumed, active runs and nodes, node retries, token counts (input/output/cache read/cache write/reasoning), tool calls and errors, cache hits/misses, approvals requested/granted/denied/pending, hot reloads, HTTP requests, DB retries, scheduler queue depth, events emitted, process uptime and memory.
Histograms (p50 / p99 / avg / count) — run duration, node duration, attempt duration, tool duration, tokens per call, prompt and response size, approval wait time, scheduler wait time, DB query latency, HTTP request latency, hot reload duration, VCS duration.
Press r to toggle raw Prometheus text output. Close with q or Esc.
JSON Schema to TypeBox conversion
When the extension registers MCP tools as PI tools, it converts the MCP server’s JSON SchemainputSchema to TypeBox schemas on the fly. String, number/integer, boolean, and array properties are mapped to their TypeBox equivalents. Required properties become mandatory fields; optional properties are wrapped in Type.Optional. This allows PI’s parameter validation and UI to work without any hardcoded schema definitions.
Relationship to the PI plugin client
This extension and thesmithers-orchestrator/pi-plugin HTTP client are complementary, not overlapping. The extension is loaded by the PI CLI itself and adds agent tools, UI, and slash commands. The HTTP client (pi-plugin) is a lightweight module you import in your own code — a PI extension or any Node process — to drive the Smithers server API from TypeScript. Both are part of the same package.
See the PI Plugin Client page for the HTTP client API reference.