Skip to content

The core

The feed-date fix from last chapter works. You watched Pi read the extractor, propose an edit, and ship it, and stash now parses a saved article’s date the same way regardless of which format the site that published it happened to use. But sit with what actually happened for a second: you trusted a change to code you didn’t write, made by a process you only watched from the outside. It read some files - which ones, exactly, and how much of them? It edited something - did it replace the whole function, or one line? That trust worked out this time. You don’t want to be running on faith for the next one.

Here’s the thing that makes Pi worth learning specifically, not just “a terminal agent”: almost nothing about how it works is hidden from you. Four tools, not forty. A system prompt short enough to read over coffee. A loop with no invisible step limit and no black-box orchestration underneath it. Where most agents ask you to trust the wiring, Pi hands you the wiring.

This chapter is about picking it up. Four moves, each one removing a layer of “just trust me”:

  • The four tools, exactly - read, write, edit, and bash do precisely what their names say and nothing more, and the exact rules matter more than they sound like they should. Learn the four tools
  • The loop, one level deeper - there’s no step limit, and you have two different ways to talk to a run that’s already underway. Go inside the loop
  • See the context - the thing every other agent asks you to take on faith: what’s actually sitting in the model’s window right now, and what the system prompt actually says. See the context
  • The tiny prompt, and why - compact by design, and the argument for why that’s not a corner cut. Read the tiny prompt

By the end you won’t just trust that Pi got the date fix right - you’ll be able to point at exactly what it read, what it changed, and what it was told before it did either. That’s the habit the rest of this course is built on.