Architecture and Context Budget Specification
Learn how to turn a production research assistant’s design into a testable architecture specification. You’ll allocate context budgets, measure fixed tool and prompt prefixes, position cache breakpoints, define trust boundaries, verify configuration in code, and establish benchmarks for tokens, retrieval, citations, and cache reuse.
We'll cover the following...
Over seven chapters, we built the on-call assistant one piece at a time. It has an altitude-tuned system prompt, strict tools with masking, hybrid retrieval with freshness and authority filters, compaction and notes, isolated workers over a shared state, a sandboxed runner, a memory with provenance gates and team namespaces, and an eval gate. Each piece was measured in its own lesson, on its own small example. Together, they apply all four moves from Chapter 1: Write, Select, Compress, and Isolate.
None of those measurements tells us what happens when every piece is in the same request. In this chapter, we’ll build the production version of the assistant as one multi-file project. Before we write any project file, we’ll write its specification: which file owns each piece, what the fixed part of every request costs, how the rest of the budget is split, where the cache breakpoint sits, and where trust changes. The next two lessons build from this specification, and the lesson after that benchmarks it.
What the assistant must do
The production assistant answers incident questions for the checkout and payments teams. To answer them, it reads three kinds of sources:
Documents: We search runbooks, postmortems, and guidelines, and cite each one.
Data: We analyze per-minute metrics exported as a table by running scripts on the sandboxed runner.
Tools: We read the deploy log, fetch metrics, page on-call engineers, and propose memory changes.
The running question stays the same: “Checkout latency spiked at 14:05. What changed, and what should we roll back?”
Map each piece to a file
The project has six files. Each one owns a group of pieces we’ve already built:
File | Owns | Built in |
| System prompt, tool schemas, cache breakpoint, tool masking | Chapter 3 |
| Hybrid search, freshness and authority filters, edge order, quote check | Chapter 4 |
|
and its sandbox limits | Chapters 6 and 7 |
| Shared state, planner, researcher, coder, validator, auditor | Chapter 6 |
| Provenance gate, team namespaces, versions and rollback, TTL | Chapters 5 and 7 |
| Trace capture, metrics, CI gate | Chapter 7 |
The file map is the easy half of the specification. The harder half is the numbers.
Measure the fixed prefix
The fixed prefix is the part of every request that never changes: the tool schemas and the system prompt. Chapter 3 ...