reporters/record¶
Source: src/reporters/record.ts
The event stream, on disk: one JSON object per line, in the order it happened.
pi’s own JSONL already holds each subagent’s transcript, one file each. What this adds is the two things that live between them: the interleaving - who was working while who else was reading - and our timestamps, since pi has no notion of the wall clock a workflow runs on.
Written with appendFileSync, deliberately. It is one syscall per event and a
streamed reply produces a great many of them, but the run worth reading
afterwards is the one that was interrupted, and a buffered stream loses its
tail exactly then. Durability over throughput, the same trade the export made.
recordReporter¶
function
export function recordReporter(file: string): EventListener { /* … */ }
Appends every event to file as {"ts": <ISO 8601>, …event}.
The events are recorded verbatim - no filtering, no summarising. A recorder that edits its own record is worse than a large file, and the analysis this exists for is the one nobody planned in advance.
Every failure is swallowed, including the one that creates the directory: a reporter is an observer, and an observer that takes the workflow down with it is a bug.