pi

A reference guide for the Pi coding agent’s terminal interface, including how it renders screens, stores settings, and saves sessions.

In plain words
What is it for?
Use it when inspecting Pi sessions, detecting the agent in a terminal, or working with its configuration and session files.
Why use it?
It records details that help identify Pi correctly, even though the running process may appear as the Node interpreter instead of Pi.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/sstraus/tuicommander/pi
Clone the repo
git clone --depth 1 https://github.com/sstraus/tuicommander
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,224 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01224
Opus 5 $0.00000 $0.00612
Sonnet 5 $0.00000 $0.00245
Haiku 4.5 $0.00000 $0.00122

Measured 2d ago against content hash 0a775c7b4640, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pi scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/architecture/agents/pi.md · 96 lines

How it starts

The opening of the file, as written. The whole thing — 96 lines — stays where its author put it; the contents beside it link to each section on GitHub.

pi — UI layout and detection

Agent: pi (@earendil-works/pi-coding-agent). Version audited: 0.83.0 · Date: 2026-08-02 · Theme: rose-pine-moon.

All values below were captured live from a real PTY session (raw ANSI), not inferred.

Identity & rendering

Property Value
Binary pi (npm global; the executable on disk is the node interpreter)
Rendering engine @earendil-works/pi-tui (own TUI lib — not Ink, not Bubble Tea)
Repaint style Full-frame, wrapped in synchronized updates (\033[?2026h\033[?2026l)
Screen clear \033[2J\033[H\033[3J on startup repaint
Cursor positioning Relative — \033[3A up / \033[3B down, then \033[1G, cursor hidden (\033[?25l)
Config dir ~/.pi/agent/
Sessions ~/.pi/agent/sessions/<encoded-cwd>/<ISO-ts>_<uuid7>.jsonl

Process identity gotcha. proc_pidpath() (macOS) and /proc/<pid>/comm (Linux) both return the node interpreter for a pi session, not pi. Foreground-process classification therefore falls back to argv[0] for known interpreters — see is_script_interpreter in pty.rs and read_process_argv0 in process_env.rs. Without that fallback pi is invisible as an agent.

Bottom zone

Four rows, in this order, present in every state:

────────────────────────────────────────────  separator, RGB(196,167,231)
<composer>                                    reverse-video cursor block + blanks
────────────────────────────────────────────  separator
~/Gits/personal/tuicommander (main)           cwd + branch, RGB(110,106,134)
↑1.3k ↓1.8k R15k W6.0k CH88.5% $0.104 3.4%/272k (auto)    (openai) gpt-5.6-sol • medium
  • No prompt glyph. The composer is a bare reverse-video cell (\033[7m \033[0m) followed by blanks. is_prompt_line matches nothing here — readiness cannot be prompt-based.
  • Status row is the reliable "this is a pi screen" marker: the context gauge N%/Nk plus the model separator. See is_pi_status_row in pty.rs.

Read the full file on GitHub · 96 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 96 lines · 0 tokens per session scan A 0a775c7b4640

Subscribe to this mod's changes

pi is an agent published in the GitHub repository sstraus/tuicommander (125 stars, last pushed 5d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,224 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.