API reference

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

Module

What it is for

Exports

agent

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

Asking the user a question - the one place a workflow may block on a human.

6

board/agreement

When a board has agreed: who voted for what, and whether they all say one thing.

3

board/board

A place several subagents can leave messages for each other.

9

board/claims

One owner per thing, decided here rather than agreed between members.

6

board/lines

The board as a member reads it: one line per post, and what answers the reader first.

1

board/tool

How a member reaches the board.

2

delegate

Letting a subagent have subagents of its own.

4

events

The event stream: one core, many reporters.

6

flow/bounds

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

What a flow is checked against, and where it is found on disk.

5

flow/check-run

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

The flow stage of validation: a flow read against the catalogue it runs in, before the first spawn.

2

flow/checked

A checked flow: what validation hands the runner, the renderings and the dry run once it found no fault.

13

flow/condition/compile

A condition checked whole against the types of what it may read, before the first spawn.

1

flow/fault

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

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

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

A checked flow as a Mermaid flowchart: the structure and nothing else.

1

flow/render/plan

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

The one line a flow run collapses to: how it stands, and counts that hide nothing.

1

flow/render/text

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

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

dryRunFlow: runFlow itself, with every agent turn, every check, every commit and every question answered by a script.

3

flow/run/flow

runFlow: a checked run walked from its first node to its last.

3

flow/run/journal

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.

3

flow/run/resume-point

resumePoint: where a run picks up from its journal, or why it may not.

2

flow/run/resume

resumeFlow: a run carried on from its run directory, as deep as its journal goes.

5

flow/run/snapshot

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

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

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

The values a flow’s keys hold, each read to one type or refused.

1

git/git

The git a run is allowed to do - and nothing else.

8

git/land

Putting the work of several copies back into one tree.

3

git/port

The git port of a flow run: what a flow’s nodes may ask of git, and nothing more.

2

git/scratch

A working copy with a lifetime: made for one piece of work, and released when that work is done.

2

git/worktree

Working copies, so two agents can write at once without writing over each other.

6

language

The language a subagent answers in: the one it was asked in.

1

measure/experiment

Running the same work across several models, several times.

3

measure/export

Exporting a run: runs/<timestamp>/ with one HTML and one JSONL per subagent, plus a usage.json.

8

measure/measured

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

What an experiment leaves behind: one JSON document, one comparison table.

5

mirror

The mirror: a live subagent’s session, on a unix socket.

4

reporters/console

A plain console reporter: one line per event that matters.

2

reporters/herdr-client

Detection and transport for herdr’s socket API. Nothing else lives here.

4

reporters/herdr-probe

Asking herdr whether it would open a pane, without opening one.

1

reporters/herdr

The herdr reporter: one split per subagent, showing it work.

3

reporters/index

Choosing a reporter, so the caller does not have to.

3

reporters/picture

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

The event stream, on disk: one JSON object per line, in the order it happened.

1

reporters/silent

The no-op reporter.

1

reporters/tree

A run as a tree: a delegated subagent drawn under the one that asked for it.

1

reporters/tui

Formatting for the pi TUI, with no pi-tui in sight.

11

result

Result: the single contract shared by everything else.

6

review/ledger

What is left to do, as a list nobody can lose track of.

2

run

run(): the disposable form. Spawn, ask, close.

2

session

The whole pi API lives here, and nowhere else.

10

skills

The skills an agent may load, and where they are looked up.

2

stop

The stop switch of a live run: everything at once, or one subagent of it.

3

subagent

A subagent: a live session, a memory, a state.

5

text

Reading what a model wrote, and cutting what it is handed: shortening text, and finding the structure in it.

5

tool

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

Measurements: time and tokens, per subagent.

6

verify

Running the code, rather than asking two agents whether they like it.

4

workflows/chain

chain: 1 → 1 → 1. The output of step n is the input of step n+1.

2

workflows/concurrent

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

fanOut: 1 → N. N subtasks in parallel, with bounded concurrency.

4

workflows/interview

interview: a conversation with the user, ending in a brief.

5

workflows/loop

loop: 1 → 1, repeated until a criterion is met.

4

workflows/options

What every combinator shares: the same options, under the same names, with the same defaults.

4

workflows/orchestrate

orchestrate: 1 → ?. An agent decides the split, then the split runs.

3

workflows/plan

Reading a plan an agent wrote: the prompt, the parser, the validation.

5

workflows/pool

The pool: where a workflow’s turns are played.

3

workflows/reduce

reduce: N → 1. One agent synthesises the results of a fan-out.

3

workflows/route

route: 1 → 1. A classifier agent picks who should do the work.

5

workflows/swarm-task

What a swarm tells one member at the top of each turn.

1

workflows/swarm

Several members on one job, for as many rounds as you allow.

8

workflows/trail

The trail: every result a workflow produced so far, over its own clock.

1