<!-- Generated by scripts/gen-docs.ts from the TSDoc in src/. Do not edit by hand. -->

# API reference

Generated from the TSDoc of everything `src/index.ts` exports. The intent
behind the design lives in [Design decisions](../../decisions.md); how to use the
library, in [the guide](../../index.md); this is the exhaustive surface.

| Module | What it is for | Exports |
| --- | --- | --- |
| [`agent`](agent.md) | An agent is *content*: a system prompt, a model, a set of tools. It is declared as Markdown + frontmatter, following the pi convention. | 9 |
| [`ask`](ask.md) | Asking the *user* a question - the one place a workflow may block on a human. | 6 |
| [`board/agreement`](board/agreement.md) | When a board has agreed: who voted for what, and whether they all say one thing. | 3 |
| [`board/board`](board/board.md) | A place several subagents can leave messages for each other. | 9 |
| [`board/claims`](board/claims.md) | One owner per thing, decided here rather than agreed between members. | 6 |
| [`board/lines`](board/lines.md) | The board as a member reads it: one line per post, and what answers the reader first. | 1 |
| [`board/tool`](board/tool.md) | How a member reaches the board. | 2 |
| [`delegate`](delegate.md) | Letting a subagent have subagents of its own. | 4 |
| [`events`](events.md) | The event stream: one core, many reporters. | 6 |
| [`flow/bounds`](flow/bounds.md) | The worst case of a checked flow, computed before the first spawn: how many agent turns each node can ask for, and how long it can take when every bounded wait runs to its bound. | 3 |
| [`flow/catalogue`](flow/catalogue.md) | What a flow is checked against, and where it is found on disk. | 5 |
| [`flow/check-run`](flow/check-run.md) | The run stage of validation: a checked flow held to the project it is about to run in, still before the first spawn. | 5 |
| [`flow/check`](flow/check.md) | The flow stage of validation: a flow read against the catalogue it runs in, before the first spawn. | 2 |
| [`flow/checked`](flow/checked.md) | A checked flow: what validation hands the runner, the renderings and the dry run once it found no fault. | 13 |
| [`flow/condition/compile`](flow/condition/compile.md) | A condition checked whole against the types of what it may read, before the first spawn. | 1 |
| [`flow/fault`](flow/fault.md) | Why a flow is refused before its first spawn: a stable code, the file, where in it, and one sentence. | 2 |
| [`flow/render/live-text`](flow/render/live-text.md) | The live view as text: the summary line, then one line per live line, indented under the line that holds it, each cut to the width the caller draws in. | 4 |
| [`flow/render/live`](flow/render/live.md) | The live view of a flow run: its plan, filled from the journal and the event stream, folded by the state of each visit. | 4 |
| [`flow/render/mermaid`](flow/render/mermaid.md) | A checked flow as a Mermaid `flowchart`: the structure and nothing else. | 1 |
| [`flow/render/plan`](flow/render/plan.md) | The plan of a checked flow: one line per node, in the tree the file writes, each saying everything the check resolved about it. | 3 |
| [`flow/render/summary`](flow/render/summary.md) | The one line a flow run collapses to: how it stands, and counts that hide nothing. | 1 |
| [`flow/render/text`](flow/render/text.md) | A plan as text: the head line of the flow, then one line per plan line, indented under the line that holds it. | 1 |
| [`flow/run/answers`](flow/run/answers.md) | A dry run's script: the answers that stand in for each agent turn, each check's script run, each commit and each question, checked against the flow before the first one is taken. | 2 |
| [`flow/run/dry-run`](flow/run/dry-run.md) | `dryRunFlow`: `runFlow` itself, with every agent turn, every check, every commit and every question answered by a script. | 3 |
| [`flow/run/flow`](flow/run/flow.md) | `runFlow`: a checked run walked from its first node to its last. | 3 |
| [`flow/run/journal`](flow/run/journal.md) | The journal of a run: one JSON line per fact, appended when it happens and never rewritten, which is what a resume and the live view read back. | 4 |
| [`flow/run/resume-point`](flow/run/resume-point.md) | `resumePoint`: where a run picks up from its journal, or why it may not. | 2 |
| [`flow/run/resume`](flow/run/resume.md) | `resumeFlow`: a run carried on from its run directory, as deep as its journal goes. | 5 |
| [`flow/run/snapshot`](flow/run/snapshot.md) | The snapshot of a run: what its validation read, kept in its run directory at the first start with the input and the settings, so that a resume runs the flow the run started with, whatever the disk says by then. | 3 |
| [`flow/sources`](flow/sources.md) | What the flow stage read to check a flow: its file and the file of every flow it reaches, and each agent it names with the skills that agent's `skills:` resolved to. | 2 |
| [`flow/type`](flow/type.md) | The type of a value a flow passes around: what a schema declares, what a condition is checked against, and what a node's typed output must match. | 2 |
| [`flow/value`](flow/value.md) | The values a flow's keys hold, each read to one type or refused. | 1 |
| [`git/git`](git/git.md) | The git a run is allowed to do - and nothing else. | 8 |
| [`git/land`](git/land.md) | Putting the work of several copies back into one tree. | 3 |
| [`git/port`](git/port.md) | The `git` port of a flow run: what a flow's nodes may ask of git, and nothing more. | 2 |
| [`git/scratch`](git/scratch.md) | A working copy with a lifetime: made for one piece of work, and released when that work is done. | 2 |
| [`git/worktree`](git/worktree.md) | Working copies, so two agents can write at once without writing over each other. | 6 |
| [`language`](language.md) | The language a subagent answers in: the one it was asked in. | 1 |
| [`measure/experiment`](measure/experiment.md) | Running the same work across several models, several times. | 3 |
| [`measure/export`](measure/export.md) | Exporting a run: `runs/<timestamp>/` with one HTML and one JSONL per subagent, plus a `usage.json`. | 8 |
| [`measure/measured`](measure/measured.md) | A run that measures itself: the picture it is drawn from, the stream it may keep, and the `usage.json` it leaves behind. | 3 |
| [`measure/report`](measure/report.md) | What an experiment leaves behind: one JSON document, one comparison table. | 5 |
| [`mirror`](mirror.md) | The mirror: a live subagent's session, on a unix socket. | 4 |
| [`reporters/console`](reporters/console.md) | A plain console reporter: one line per event that matters. | 2 |
| [`reporters/herdr-client`](reporters/herdr-client.md) | Detection and transport for herdr's socket API. Nothing else lives here. | 4 |
| [`reporters/herdr-probe`](reporters/herdr-probe.md) | Asking herdr whether it would open a pane, without opening one. | 1 |
| [`reporters/herdr`](reporters/herdr.md) | The herdr reporter: one split per subagent, showing it work. | 3 |
| [`reporters/index`](reporters/index.md) | Choosing a reporter, so the caller does not have to. | 3 |
| [`reporters/picture`](reporters/picture.md) | The picture of a run: the event stream folded, once, into what every reader wants to know - who is alive, under whom, doing what, at what cost. | 6 |
| [`reporters/record`](reporters/record.md) | The event stream, on disk: one JSON object per line, in the order it happened. | 1 |
| [`reporters/silent`](reporters/silent.md) | The no-op reporter. | 1 |
| [`reporters/tree`](reporters/tree.md) | A run as a tree: a delegated subagent drawn under the one that asked for it. | 1 |
| [`reporters/tui`](reporters/tui.md) | Formatting for the pi TUI, with no pi-tui in sight. | 12 |
| [`result`](result.md) | `Result`: the single contract shared by everything else. | 6 |
| [`review/ledger`](review/ledger.md) | What is left to do, as a list nobody can lose track of. | 2 |
| [`run`](run.md) | `run()`: the disposable form. Spawn, ask, close. | 2 |
| [`session`](session.md) | The whole pi API lives here, and nowhere else. | 16 |
| [`skills`](skills.md) | The skills an agent may load, and where they are looked up. | 2 |
| [`stop`](stop.md) | The stop switch of a live run: everything at once, or one subagent of it. | 3 |
| [`subagent`](subagent.md) | A subagent: a live session, a memory, a state. | 5 |
| [`text`](text.md) | Reading what a model wrote, and cutting what it is handed: shortening text, and finding the structure in it. | 5 |
| [`tool`](tool.md) | The constant parts of a tool combo defines: whether an agent asked for it, and the two shapes of answer a model reads. | 3 |
| [`usage`](usage.md) | Measurements: time and tokens, per subagent. | 7 |
| [`verify`](verify.md) | Running the code, rather than asking two agents whether they like it. | 4 |
| [`workflows/chain`](workflows/chain.md) | `chain`: 1 → 1 → 1. The output of step *n* is the input of step *n+1*. | 2 |
| [`workflows/concurrent`](workflows/concurrent.md) | Running several things at once, but not all of them: a subtask is a session, and N sessions opening together is the bill nobody meant to pay. | 1 |
| [`workflows/fan-out`](workflows/fan-out.md) | `fanOut`: 1 → N. N subtasks in parallel, with bounded concurrency. | 4 |
| [`workflows/interview`](workflows/interview.md) | `interview`: a conversation with the *user*, ending in a brief. | 5 |
| [`workflows/loop`](workflows/loop.md) | `loop`: 1 → 1, repeated until a criterion is met. | 4 |
| [`workflows/options`](workflows/options.md) | What every combinator shares: the same options, under the same names, with the same defaults. | 4 |
| [`workflows/orchestrate`](workflows/orchestrate.md) | `orchestrate`: 1 → ?. An agent *decides* the split, then the split runs. | 3 |
| [`workflows/plan`](workflows/plan.md) | Reading a plan an agent wrote: the prompt, the parser, the validation. | 5 |
| [`workflows/pool`](workflows/pool.md) | The pool: where a workflow's turns are played. | 3 |
| [`workflows/reduce`](workflows/reduce.md) | `reduce`: N → 1. One agent synthesises the results of a fan-out. | 3 |
| [`workflows/route`](workflows/route.md) | `route`: 1 → 1. A classifier agent picks who should do the work. | 5 |
| [`workflows/swarm-task`](workflows/swarm-task.md) | What a swarm tells one member at the top of each turn. | 1 |
| [`workflows/swarm`](workflows/swarm.md) | Several members on one job, for as many rounds as you allow. | 8 |
| [`workflows/trail`](workflows/trail.md) | The trail: every result a workflow produced so far, over its own clock. | 1 |

```{toctree}
:hidden:

agent
ask
board/agreement
board/board
board/claims
board/lines
board/tool
delegate
events
flow/bounds
flow/catalogue
flow/check-run
flow/check
flow/checked
flow/condition/compile
flow/fault
flow/render/live-text
flow/render/live
flow/render/mermaid
flow/render/plan
flow/render/summary
flow/render/text
flow/run/answers
flow/run/dry-run
flow/run/flow
flow/run/journal
flow/run/resume-point
flow/run/resume
flow/run/snapshot
flow/sources
flow/type
flow/value
git/git
git/land
git/port
git/scratch
git/worktree
language
measure/experiment
measure/export
measure/measured
measure/report
mirror
reporters/console
reporters/herdr-client
reporters/herdr-probe
reporters/herdr
reporters/index
reporters/picture
reporters/record
reporters/silent
reporters/tree
reporters/tui
result
review/ledger
run
session
skills
stop
subagent
text
tool
usage
verify
workflows/chain
workflows/concurrent
workflows/fan-out
workflows/interview
workflows/loop
workflows/options
workflows/orchestrate
workflows/plan
workflows/pool
workflows/reduce
workflows/route
workflows/swarm-task
workflows/swarm
workflows/trail
```
