Skip to slide
Chapter 17 · Building the Full Mini-Harness
139 / 142

CHAPTER 17 · Building the Full Mini-Harness · 7 / 10

How the chapters show up at runtime

Trace one real turn through the assembled system to see the whole guide working at once:

  1. You type a request. The loop wraps it as a structured user_msg (Chapter 3).
  2. Compactor checks the token count and summarizes old turns if the history is too big (Chapters 4, 5).
  3. PromptBuilder assembles instructions (with AGENTS.md memory from Chapter 9 and skill descriptions from Chapter 10), the tool schemas (Chapter 6), and the structured history, stable content first for caching (Chapter 5).
  4. Budget.charge checks you have not blown the turn or cost cap (Chapters 4, 12).
  5. call_model runs inference (Chapter 2). It returns a tool call.
  6. The PreToolUse hook (Chapter 12) and the ApprovalPolicy (Chapter 7) both get a veto before the ToolRegistry (Chapter 6) executes anything. Multiple calls run through run_tools (Chapter 8).
  7. Results are appended with call_id linkage (Chapter 3) and the loop repeats.
  8. Eventually the model returns text; the turn ends. For a risky claim, you can call review() to spin up a verifier subagent (Chapters 11, 13).

That is the entire guide, running.

← → arrow keys work too