Saurabh Kumar

#pi-agent

Pi, the coding agent harness: extensions, subagents, setups

TIL notes

  • Oct 9, 2026

    Pi Pocket’s subagent implementation gives each worker a retained conversation and uses durable tasks to deliver messages and report answers. Request IDs and recorded answer IDs prevent duplicate delivery and reporting after restart. The idea worth stealing: make the handoff durable, not just the worker.

  • Oct 9, 2026

    Arnav Gupta’s pi-subagent-manager makes context inheritance explicit. Nested threads receive their parent’s snapshot; independent roots start without its history. Threads stay around for steering and resume. I want synchronous coordination by default, forks for continuity and fresh context for independent review.

  • Oct 9, 2026

    Armin Ronacher’s subagent extension runs one observable Pi child at a time in tmux. The parent waits for the result, while I can attach to inspect or intervene. Worth preserving when adding hierarchy: synchronous coordination must not mean invisible execution.

  • Oct 7, 2026

    Pi Durable is Earendil’s experimental agent harness, shipped alongside Pi 1.0. TannerMidd/pi-pocket is a mobile-first, multiplayer web app for Pi built on it.

    • Every model call and tool call is a task that checkpoints to storage (SQLite, JSONL, or memory) before moving on. Kill the process and a new one opens the same file and resumes.
    • Recovery is per step: a cut-off model request is resent with the partial answer kept and marked aborted. A cut-off tool call reruns only if it is replay-safe; otherwise the model is told it was interrupted.
    • A requestId makes a submission exactly-once, so a client retrying after a crash gets the original back.
    • Forks see the parent transcript up to the fork point without copying it.
    • ~15k lines total, small enough for an agent to read end to end.
    • pi-pocket: restart the server mid-run and the work continues. Several people can watch, steer, or queue messages on the same session.
    • npm start -- --access tailscale binds only to the tailnet address, so my phone gets it with no tunnel.
    • The shift: the session lives in a SQLite file, not a terminal process, so the phone is just another client. Could replace my Moshi + tmux setup.
    • Caveat: anyone who can steer runs shell commands as you.
  • Sep 5, 2026

    Every coding agent (Claude Code, Codex, pi) compacts long sessions the same way: ask an LLM to prose-summarize, then summarize that summary, until load-bearing details erode (why a decision was made, which approaches got rejected). pi-blackhole swaps that for deterministic compaction: a zero-token compile() that extracts structured sections (goal, files touched, commits, preferences, brief transcript). No LLM, no drift, no cost. The compile is only lossy in the window, not on disk: blackhole also ships a recall tool (BM25 + regex over the raw session JSONL and the memory ledger) that re-fetches any dropped turn on demand, so compile + recall together is lossless where an LLM summary-of-a-summary destroys the original. It also adds observational memory: background observer/reflector workers append durable facts to per-session ledgers that survive every compaction, and /blackhole-export walks every past-session JSONL under a git-root into a ranked context file. The clever part is what export trusts. A fact’s rank is driven by cross-session recurrence, damped as log(1 + distinctSessions) with a burst penalty, not raw counts, so one chatty session can’t inflate it. Recurrence-as-reinforcement is basically Hebbian: facts that keep firing across sessions get stronger. Dedup is a 3-pass funnel, exact then Levenshtein then Sørensen-Dice token-set, with a Levenshtein floor so keyword overlap alone can’t merge two distinct facts. Bonus: the OM workers run on their own model and billing, so I point them at openai-codex/gpt-5.6-luna while the main thread stays on Claude.