· EN

The Life of a User Message Inside Pi Agent — 26 Stations from Enter to JSONL

This is a long-form immersive article — read the full version on the dedicated page → Enter full version

Tenth in the Field Note series. Sister pieces: The Life of One LLM Inference (one prompt through 28 llama.cpp stations) and From Bytecode to Pixel (Chromium render pipeline). This one switches the «OS» to coding agent harness — same method: one through-line prompt, real source, station by station.

Through-line: read README.md and tell me what this project does in one sentence

The immersive article walks 26 chapters from harness philosophy through CLI boot, AgentSession orchestration, the twin-loop agent core, pi-ai streaming, differential TUI render, TypeScript extensions, JSONL session trees, compaction, and a comparison with Claude Code / Cursor.

What this edition goes deep on

  • Line-by-line real source: all 26 chapters map to concrete files in earendil-works/piagent-loop.ts · agent-session.ts · session-manager.ts · event-stream.ts · ExtensionRunner · TUI diff render.
  • One through-line prompt: same as pi-textbook prologue — seven-milestone table in early chapters.
  • Two-layer message model: AgentMessage (canonical transcript) vs Message[] (LLM projection) vs TUI render.
  • runLoop twin loops: outer follow-up · inner tool batch + steering.
  • JSONL session tree: parentId · leafId · fork — diagram in C22.
  • Compaction: history preserved · context rebuilt — C23.
  • vs Claude Code / Cursor: sealed product vs composable harness trade-offs in C24.

“A user message looks like one line in the terminal. What it really does: pass through 26 stations across six npm packages, leave a forkable node on the JSONL session tree, then get differential-rendered into the token stream you see via CSI 2026.”

Full read: The Life of a User Message Inside Pi Agent — 26-station source panorama

Comments

0 comments