CHAPTER 17 · Building the Full Mini-Harness · 2 / 10
File structure
minharness/
__init__.py
model.py # the ONE place you plug in a real model (Ch 2)
prompt.py # PromptBuilder + structured-item helpers (Ch 3)
context.py # estimate_tokens, CostModel, Compactor (Ch 4, 5)
tools.py # ToolRegistry, shell tool, truncation (Ch 6)
approvals.py # ApprovalPolicy, gated_call, Checkpointer (Ch 7)
parallel.py # run_tools (Ch 8)
memory.py # MemoryLoader (Ch 9)
skills.py # SkillLoader + mini MCP (Ch 10)
subagents.py # spawn_subagent, orchestrate (Ch 11)
control.py # HookManager, Budget (Ch 12)
agent.py # the loop that wires it all together (Ch 2 + everything)
main.py # CLI entry point
Each file is essentially the MVP from its chapter, lightly cleaned so the imports line up. Below is the integration layer, agent.py, which is the new code: the glue that turns eleven separate demos into one agent.