pi-web: Instructions file for Codex

AGENTS.md

pi-web AGENTS.md is an instructions file for Codex, OpenCode from agegr/pi-web. It costs 9,067 tokens per session, scanned B, original, MIT.

Development instructions for Pi Web, a web application in a specific code repository. They explain how to start, check, troubleshoot, and restart its development server.

In plain words
What is it for?
Use them when running the app locally, checking types or lint, investigating browser-only errors, or deciding whether a development server really needs restarting.
Why use it?
They prevent common development problems such as competing server processes, stale browser refresh data, and conflicts in Next.js temporary files.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions subagents; mentions AGENTS.md.

This is agegr/pi-web's own configuration. It tells Codex and OpenCode how to work on pi-web itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything pi-web configures →

View source ↗ agegr/pi-web
About the project

Pi Web is a browser-based interface for the pi coding agent, allowing users to manage conversations, models, resources, project files, and Git worktrees through a local web application. It is for developers who want to browse and resume agent sessions, run new turns, configure providers, and inspect project files in a browser. The catalogue entry is an instruction for using Pi Web.

agegr/pi-web · 8,063 stars · on GitHub

Reuse

Borrowing it

Nothing to install: this file belongs to agegr/pi-web. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/agegr/pi-web/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/agegr/pi-web

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pi-web AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/agegr/pi-web/agents-md/github.svg)](https://agentmods.dev/instructions/agegr/pi-web/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/agegr/pi-web/agents-md"><img src="https://agentmods.dev/badge/instructions/agegr/pi-web/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pi-web AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/agegr/pi-web/agents-md"><img src="https://agentmods.dev/badge/instructions/agegr/pi-web/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9,067 This file is loaded in full into every session.
When invoked 9,067 The same file — it is already loaded in full.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.09067 $0.09067
Opus 5.5 $0.03627 $0.03627
Sonnet 5.5 $0.01813 $0.01813
Haiku 4.5 $0.00907 $0.00907

Measured 2d ago against content hash b7cee8343e39, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

pi-web AGENTS.md scanned grade B with 1 finding 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.

Reads MCP configurationmediumAgent snooping

mcp.json carries server URLs and auth tokens; reading it lets a mod discover and abuse other integrations.

mcp-undo.ts removed mcp.json entries kept 60 s for undo; only a token reaches the browser
AGENTS.md · 322 lines

How it starts

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

Pi Web - Development Notes

Quick Start

npm run dev   # port 30141

Typecheck: node_modules/.bin/tsc --noEmit · Lint: npm run lint

Never run next build during dev: it pollutes .next/ and breaks npm run dev.

Dev server troubleshooting

  • First run lsof -nP -iTCP:30141 -sTCP:LISTEN and reuse a healthy Pi Web process. A second next dev on another port is no workaround: both contend for .next/dev/lock.
  • A browser-only Module ... factory is not available overlay usually means that tab has a stale Turbopack/HMR graph, not a broken server or source. Use the browser's explicit reload, then compare the server log and a direct HTTP/API request.
  • Restart only when the failure reproduces from a fresh page and the server-side checks fail too: stop that exact dev process gracefully, move .next into a mktemp -d backup, restart with npm run dev.
  • Never fall back to next dev --webpack: the dev graph can fail on undici imports such as node:console. Development uses Turbopack.
  • next dev may append a generated BEGIN:nextjs-agent-rules block to AGENTS.md. It is tooling output: check git status and keep it out of unrelated commits.

Upgrading pi

pi's packages up to 1.2.0 depend on each other with ^ ranges (1.3.0 pins them exactly), and the published pi-web's dependencies resolve afresh on install (no lockfile ships). Install every @earendil-works/* package the tree holds, the SDK's own dependencies included (pi-codemode, pi-mcp, pi-telemetry, …), with npm install --save-exact, so npm reuses those exact versions for the SDK's ranges. lib/pi-packages.test.mjs fails on any pi package that is not pinned that way; pi-web 0.12.0 pinned four, and installs after pi 1.2.0 paired pi-coding-agent 1.1.0 with pi-codemode 1.2.0.


Architecture

  • Browsing (read-only, no AgentSession): GET /api/sessions lists ~/.pi/agent/sessions/; GET /api/sessions/[id] reads the .jsonl through SDK SessionManager helpers and lib/session-reader.ts, or an open wrapper's in-memory SessionManager. GET /api/agent/running snapshots the running ids.
  • Sending: POST /api/agent/[id] → startRpcSession() (lib/rpc-manager.ts) creates the AgentSession in-process (createAgentSessionFromServices()); session.send(cmd) → session.prompt().
  • Events: GET /api/agent/[id]/events streams SSE data: {...} from session.onEvent(), fed by session.subscribe().
  • Product scope: a light web wrapper around pi, not an IDE or a platform of its own. Before adding a feature, check the out-of-scope list in CONTRIBUTING.md.
  • Extension compatibility (principle): extensions written for the pi CLI must behave the same here. Fix display problems in the web client; never add pi-web-only options or fields to the extension API (ctx.ui.* options, extension_ui_request). pi's TUI (node_modules/@earendil-works/pi-tui) is the reference for what an extension asking for something means.

Read the full file on GitHub · 322 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 Changed · +1 lines · +71 tokens per session b7cee8343e39
  2. 3d ago Changed · +15 lines · +541 tokens per session e5e4f78fc248
  3. 7d ago Changed · +13 lines · +567 tokens per session a9769e8f5ffd
  4. 17d ago Changed · +4 lines · +212 tokens per session fa75b4b817f5
  5. 19d ago Changed · +31 tokens per session fe1e4ed27dcb
  6. 22d ago Changed · +11 lines · +485 tokens per session 5ff1bd041ea8
  7. 23d ago Changed · +1 lines · +49 tokens per session 8c5685a0bca6
  8. 24d ago Changed · +4 lines · +164 tokens per session 3d02bc030eae
  9. 26d ago Changed · +9 lines · +376 tokens per session 031abfec5e2c
  10. 27d ago First seen · 264 lines · 6,571 tokens per session scan B 0cf81d70023f

Subscribe to this mod's changes

pi-web AGENTS.md is an instructions file published in the GitHub repository agegr/pi-web (8,063 stars, last pushed 2d ago), licensed MIT. It adds 9,067 tokens to every session, about $0.0363 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads mcp configuration). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

pi-web AGENTS.md compared with instructions from other repositories

pi-web AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pi-web AGENTS.mdagegr/pi-webInstructions file8.1k2d agoMITB9,067Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode