Skip to content

Course · Pi · The core

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. Module 1 solved one specific problem: you couldn’t budget something you’d never watched run. Now you’ve watched it run - 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 paid off this time. You don’t want to be running on faith for the next one, and after this chapter, you won’t have to.

Here’s the whole reason Pi is worth learning specifically, not just filed under “a terminal agent”: the thing every other agent hides from you - how much of your context window its own machinery spends before you’ve typed a single word - is not hidden here. The fixed cost of running Pi at all is four tool descriptions and one short system prompt. That’s the entire bill. Read them, and you’ve read everything Pi charges you just for showing up.

This chapter is about doing exactly that. 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.