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:
- You type a request. The loop wraps it as a structured
user_msg(Chapter 3). Compactorchecks the token count and summarizes old turns if the history is too big (Chapters 4, 5).PromptBuilderassembles instructions (withAGENTS.mdmemory 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).Budget.chargechecks you have not blown the turn or cost cap (Chapters 4, 12).call_modelruns inference (Chapter 2). It returns a tool call.- The
PreToolUsehook (Chapter 12) and theApprovalPolicy(Chapter 7) both get a veto before theToolRegistry(Chapter 6) executes anything. Multiple calls run throughrun_tools(Chapter 8). - Results are appended with
call_idlinkage (Chapter 3) and the loop repeats. - 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.