Skip to content

created: 2026-04-24 updated: 2026-04-24 tags: [source, video, youtube, pi, coding-agent, tutorial] type: source url: https://www.youtube.com/watch?v=BZ0w0JhPQ9o author: "AI Engineer" (Owain Lewis) published: 2026-04-18


Pi Coding Agent (Free Course)

Summary

Owain Lewis provides a complete guide to Pi — an open-source coding agent by Block with 4 tools, sub-1000 token system prompt, TypeScript extension system, and support for any model provider.

Key Takeaways

What Is Pi?

  • Open-source coding agent by Block (github.com/block/pi-mono)
  • 4 tools: Read, Bash, Edit, Write (that's all)
  • Sub-1000 token system prompt (vs Claude Code's ~14,000 tokens)
  • Works with any model — OpenAI, Anthropic, Google, OpenRouter, Ollama
  • TypeScript extension system — customize everything

Philosophy: Minimalism

  • Agents are reinforcement-trained to know what a coding agent is — don't need 10,000 tokens to explain it
  • Most coding tasks can be done via bash — agents are well-trained on bash through RL
  • No permission prompts by default — "YOLO" security; most people mindlessly click accept anyway
  • You can build your own permission gate as an extension

Provider and Model Flexibility

Provider Notes
OpenAI ChatGPT subscription works
Anthropic Cannot use subscription (Anthropic banned this); API keys only
OpenRouter Access to every model from one API; requires credits
Ollama Local models, fully offline

Session Management

  • Export — current session as HTML file
  • Tree — shows session tree (conversation branching history)
  • Fork — jump back to any point in conversation and branch from there

Configuration

Everything stored in ~/.pi/: - agent/agents.md — global instructions (like CLAUDE.md but global) - agent/extensions/ — TypeScript extension files - agent/skills/ — skill folders - agent/sessions/ — session history - settings.json — agent settings

Custom System Prompt

  • append-system file — add extra instructions to the system prompt
  • system.md file — completely replace the system prompt
  • Enables using Pi for non-coding tasks (specialize the agent)

Extensions (Pi's Killer Feature)

Extensions are TypeScript files in ~/.pi/agent/extensions/ that can: - Customize the UI (git status display, funny messages) - Register custom tools - Intercept tool calls - Listen to events and react - Save state in the session - Custom compaction, custom providers - Hot reload — see changes immediately during development

Extension Examples Demonstrated

  1. Git Status UI — shows branch and unstaged/untracked changes in the agent UI
  2. Context Workflow Extension — encodes a multi-step development pipeline:
  3. Read specification → Write code → Review code → Fix issues → Run tests → Final verification
  4. Each step uses a fresh context window for code review
  5. Agent manages its own state through workflow.next built-in tool
  6. Fully deterministic — not prompt-based

Skills

  • On-demand capabilities (prompts with optional code/scripts)
  • Standard operating procedures for specific tasks
  • Invoked via /skill <name>
  • Can reference an external repo for skills (cleaner than scattered dot-files)

Pi vs Claude Code

Feature Claude Code Pi
System prompt ~14,000 tokens <1,000 tokens (customizable)
Model choice Anthropic only Any provider
Permissions Modes (always ask, yolo, etc.) None by default (YOLO)
MCP Supported Not built-in (can add via extension)
Hooks Limited (spawns new processes) Full TypeScript extensions
Sub-agents Supported Not built-in
Customization CLAUDE.md agents.md + system.md + extensions
Session branching No Yes (tree + fork)

Verdict

"I would use it in addition to Claude Code, but I wouldn't use it as a full replacement. The biggest blocker is I can't bring my Anthropic subscription. But if I wasn't using Anthropic models, this is probably the coding agent I would use day-to-day."