# If you don't run Pi locally you're falling behind…
<!--
ref: @content/youtube/david-ondrej/2026-06-12-pi-agent-complete-course-run-locally
version: 3
updated_at: 2026-10-31T19:14:05.183Z
-->

David Ondrej (2026-06-12): Ondrej's framing is product versus harness. Claude Code and Codex are mass-market products — opinionated, heavy, wrapped in guardrails because they serve tens of millions of people.

*Synthesized from David Ondrej on David Ondrej, 2026-06-12.*

David Ondrej delivers a full course on Pi (pi.dev), the minimal open-source terminal agent he says he now uses more than Claude Code or Codex.

## Core Thesis

Ondrej's framing is product versus harness. Claude Code and Codex are mass-market products — opinionated, heavy, wrapped in guardrails because they serve tens of millions of people. Pi ships with four tools and a roughly 1,000-token system prompt, and everything past that is yours to build. The payoff is that Pi compounds: the operator who learns to extend it ends up with an agent that grows daily, and the one who doesn't abandons it in two days.

## Key Insights

- **Install and first run.** Copy the one-line curl installer from pi.dev, paste into any terminal, roughly 20 seconds to install globally. Launch by typing `pi`. `/login` opens provider selection — a subscription or an API key across 15-plus providers and thousands of models. Ondrej runs it through OpenRouter; $5–10 of credits is plenty to start, and he caps individual keys (his example: a $30 limit).
- **The system prompt is 10–15x smaller than other agents.** Roughly 1,000 tokens, and Ondrej points out those are tokens you pay for on every single message.
- **Four tools, and that is genuinely enough.** Read, write, edit, and bash. Bash is the powerful one: through the terminal, Pi installs packages, manages files, opens and closes applications, analyzes your network. Ondrej's position is that this is the disproof of needing dozens of MCPs and hundreds of pre-built skills. Web search is not included — you add it.
- **Three context files, and you should only touch two.** `system.md` overrides the entire system prompt (he advises leaving it alone). `append-system.md` is appended to the default prompt every session — this is where global preferences go. `agents.md`, global or per-folder, carries project-specific context. Pi also reads existing CLAUDE.md files, so a Claude Code project works immediately.
- **What's actually in his append-system file.** Concise, clear responses. Day-month-year date format. His location. No emojis. And the one worth stealing: a line stating he cannot see tool and bash output, so the agent must always relay results in text — a direct fix for the agent that says "here are the results" and shows nothing.
- **Four ways to extend Pi, in ascending power and cost.** (1) agents.md — always-on context, changed by telling Pi to change it. (2) Prompt templates — reusable slash commands, ~30 seconds to create. (3) Skills — autoloaded when relevant, like Claude skills, one to two minutes to write. (4) Extensions — real TypeScript that works as hooks, hardest to build, best borrowed from others. The web-access package is an extension.
- **Add web search first.** From pi.dev's packages page, search `pi web access` (~90,000 downloads/month) and copy the install command — or just tell Pi to check whether it's installed and install it globally. It searches through Exa, it's free, and it's fast enough to replace bouncing to ChatGPT or Perplexity for a lookup.
- **Use the agent to improve the agent.** Ondrej's repeated point: don't hand-edit config or memorize commands. Tell Pi to find its own global folder, edit its own append-system file, create a prompt template, install a package, or rewrite its theme. He frames the human as the bottleneck, not the model.
- **`/reload` after any config change.** New prompt templates, skills, extensions, keybinds, and themes do not take effect until you reload — a `/review` template he created did not exist as a slash command until he ran it.
- **His single most-used prompt template is `/short`.** It expands to an instruction to make the answer simpler and shorter. He was typing that 20–40 times a day before templating it. His rule: any prompt you repeat more than once a day becomes a template.
- **Skills as leverage.** He runs 50-plus, roughly 85% self-written, most created in the last 30 days. The one he singles out is a research-prompt skill that turns a casual question into an optimized prompt for a long-running deep-research tool.
- **Two ways to steer mid-run.** Press Enter right after a tool call finishes to redirect immediately when the agent is heading the wrong way. Press option/alt+Enter to queue a follow-up that fires automatically when the current turn completes — he stacks two or three ahead. Escape interrupts generation; ctrl+V (not cmd+V) attaches a screenshot; ctrl+C kills the process.
- **`/compact` takes two to three seconds.** Ondrej contrasts this with Claude Code's, which he puts around a minute and never uses. The status bar shows tokens, session spend, context percentage, auto-compaction state, model creator, model name, and reasoning effort — he compacts around 30–50% context, since every model degrades near the top of its window.
- **Pi is always in YOLO mode by design — it never asks permission.** Ondrej's mitigation is to run only frontier models: explicitly avoid Haiku, Gemini Flash, and anything cheap, because in YOLO mode a weak model's catastrophic mistake is far likelier. For anyone newer, or on a company machine, install the `pi permission system` package (~17,000 downloads/month) instead.
- **No subagents, on purpose.** Pi's creator Mario recommends spawning parallel Pi instances rather than nesting subagents. Ondrej runs this in a terminal multiplexer and calls it simpler, more transparent, and more controllable than Claude Code subagents, where he often can't tell what the subagent is doing or why.
- **The Pi + Codex orchestration pattern is the centerpiece.** Pi is the orchestrator — your personal agent holding your context and preferences — and Codex CLI instances are the workers. Pi reads the multiplexer panes, spawns and kills them, launches `codex --yolo` in each, dispatches prompts, and polls with `sleep 25`. In his demo, Pi caught that four Codex agents had all written the same index.html and re-prompted them into separate subfolders on its own after he pasted a screenshot.
- **Why the split saves money and time.** Nearly all tokens are generated by Codex on a ChatGPT subscription Ondrej is paying for anyway (he runs GPT-5.5 medium fast, higher effort only when needed, and calls the $100 ChatGPT plan the highest-value $100 in AI), while Pi spends almost nothing polling and relaying. And an LLM reads a 2,000-token agent transcript roughly 100x faster than you do.
- **Same pattern for remote debugging.** Rather than SSH-ing in yourself, have Pi open a new pane, SSH to the VPS, launch Codex there, and interrogate it — you get the diagnosis relayed in your own preferred register instead of raw output.
- **Sessions are a tree, not a linear chat.** Press escape twice to jump to any earlier point in history, edit that message, and the conversation branches — both versions persist, comparable to git worktrees. `/fork` splits a branch into its own session file. Sessions are portable JSONL, so you can cat them, run tools against them, and `/share` them as a gist plus a URL. `/resume` lists prior sessions, including forks, and is Pi's equivalent of chat history.
- **Debugging Pi with Pi.** When `/share` errored, Ondrej pasted the error back into Pi with instructions to web-search the cause and explain the fix *without making changes yet*. The diagnosis was a theme named in his settings that wasn't installed. He presents that no-changes-yet framing as the general procedure for any unexpected error.
- **Pi is deliberately anti-MCP.** The approach is to expose MCP servers as CLI tools that bash can call — `MCP border` wraps MCP calls as CLI commands, and a community `pi mcp adapter` extension proxies servers and loads their tools directly. Both exist, but Ondrej's default recommendation is to skip MCP and use plain terminal commands.

## Actionable Takeaways

1. Install from the pi.dev one-liner, run `pi`, then `/login` and point it at a provider — OpenRouter with a spend-capped key if you want access to every model.
2. Add the `pi web access` extension immediately; it's the one missing capability out of the box.
3. Put global preferences in `append-system.md`, not `system.md`. Include a line telling the agent you cannot see tool or bash output so it always relays results in text.
4. Create a `/short` prompt template on day one, and template any other prompt you type more than once a day.
5. Run `/reload` after every config change, or the change silently won't exist.
6. Cycle reasoning effort with shift+tab; queue follow-up prompts with option+Enter; steer immediately with Enter after a tool call.
7. Watch the context percentage in the status bar and `/compact` around 30–50% — it costs two to three seconds.
8. Because Pi never asks permission, either commit to frontier models only or install the `pi permission system` package before letting it loose.
9. Set up the orchestrator pattern: one Pi instance driving multiple Codex CLI instances in a multiplexer, with Pi polling and relaying, so the expensive coding tokens land on a subscription you already pay for.
10. Use escape-escape to rewind and branch when a conversation goes wrong, `/fork` to split a branch into its own session, `/share` to hand a teammate the full reasoning trail, and `/resume` to pick up after a crash.
11. To debug anything, screenshot it, paste with ctrl+V, and instruct the agent to research and explain the fix before changing anything.
12. If you need an MCP server, wrap it as a CLI tool rather than adding an MCP layer.

## Notable Quotes

> "You should adapt Pi to your workflows, not the other way around." — David Ondrej

> "The AI agents are super powerful. You, the human, are the limiting block." — David Ondrej

> "Pi agent is always in YOLO mode. It will never ask you for permissions." — David Ondrej

> "Tell Pi what you're trying to achieve, the desired end goal, and it will manage the Codex agents to get there." — David Ondrej

> "Stop being a watcher and start being a doer." — David Ondrej

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*