@daguava/pi-narration0.1.4
Summarizes agent thinking traces and live activity into one-line narration for Pi and PI WEB: reasoning summaries, subagent activity, timers, and retrospectives.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
Pi Narration
Pi Narration summarizes agent thinking traces and live activity into one-line narration for PI WEB. A Pi extension turns reasoning and tool activity into reasoning summaries with a dedicated small model, and a PI WEB browser plugin renders those thinking-trace summaries in a docked overlay above the chat composer. It also covers subagent activity, elapsed timers, and retrospectives.

Narration renders in PI WEB's chat view for local or configured remote machines. Terminal sessions load the extension but have no narration surface.
Subagent interaction
When a session spawns tracked Pi subsessions, the overlay reads each child's own
public session metadata and renders a named row beneath the parent. Children are
matched through parentSessionPath and agentSubsession, so forks do not appear
as subagents.
Each child keeps its own status, timer, summary, and completion mark. Children are ordered by start time. A child's retrospective stays in the child's own view; the parent keeps the child's frozen live line until the parent finishes. Children are listed from the selected session's machine, so cross-machine child sessions don't appear in the parent's overlay.

What it shows
- One row per agent: name, one narration line, elapsed timer, and completion mark (green check for success, muted cross for failure or cancellation).
- The main-session row sits above the composer; the overlay reserves that space and never covers the composer or the green activity indicator.
- Active rows shimmer; completed rows show their last summary. Reduced-motion preferences disable animation.
- Summaries may use inline bold, italic,
code, andstrikethrough. Links, images, raw HTML, headings, and block formatting remain literal text. - Rows remain visible in and out of quiet mode.
Install
pi install npm:@daguava/pi-narration
Enable Narration in Settings → PI WEB plugins, then reload the PI WEB tab
once. For a local checkout: pi install /path/to/pi-narration.
Configure
Run /narration in a PI WEB session. Bare /narration opens the configuration
menu.
/narration on//narration off— enable or disable globally./narration model— choose the dedicated summarization model./narration style—minimal,descriptive,insightful,conversational,custom;customopens the instruction prompt./narration custom— edit custom style instructions./narration interval— seconds between summaries (minimum 1)./narration budget— input activity budget in tokens./narration tokens— maximum live summary tokens./narration retrospective— toggle completion retrospectives./narration retro-tokens— maximum retrospective tokens./narration status— counters, latency, and last error.
Settings live in <pi-agent-dir>/narration/config.json and apply without
restarting a session. There is no PI WEB settings panel dependency; the command
writes the file directly. Narration stays off until a model is selected. The
narration model is separate from the session's primary model.
How it works
The Pi extension runs inside each session and builds a bounded digest of recent
reasoning, assistant text, tool activity, and user requests. It sends that digest
to the configured narration model, then publishes the result as public session
metadata (pi-web.session-ui-metadata, never LLM context). One request is in
flight per session, with a minimum interval, duplicate suppression, backoff, and
abort-raced timeouts. Long tool output keeps both its head and its outcome tail,
and the prompt tells the model that later failures or retries supersede earlier
successful starts. An unhandled failure triggers one latest-only retry if the
next summary still repeats the old success. Throttled tool-progress updates keep
long commands from looking idle.
The PI WEB plugin polls the host's same-origin session list, reads the selected session and its tracked children, and renders the rows. Polling backs off when rows are idle or the tab is hidden, keeps one request in flight with a timeout, and stops on session switches or plugin disposal. If PI WEB removes that API, the overlay stops updating until the plugin is adapted.
Privacy and limits
- The narration model receives a bounded digest that includes reasoning, tool arguments, tool results, and user requests. Known credential shapes (API keys, bearer tokens, private keys, URL passwords, JWTs, and secret assignments) are redacted before provider calls, but redaction is best-effort; prefer a local model and avoid sessions whose tool output contains secrets you would not share.
- Repeated metadata snapshots are deduplicated, oversized records are trimmed under PI WEB's 16 KiB cap, and error text contains provider body text with header lines removed.
- Retrospectives run asynchronously after a turn settles and never delay the final answer.
- There is no separate diagnostics panel;
/narration statusexposes counters, latency, and the last error.
Requirements
- PI WEB with browser plugin API v5 and public session metadata support.
- Pi with extension event APIs (current 1.x).
- A configured narration model with working provider credentials.
Development
npm ci
npm run build # TypeScript source -> dist/ (committed; CI verifies freshness)
npm run typecheck
npm run smoke # fake-host extension test + happy-dom overlay test
npm publish runs the same build, typecheck, and smoke gate through
prepublishOnly.