Full code listings
The Contextual Agentic Enterprise prints fourteen longer code listings in abridged form. This page gives the full text of each as a plain text file.
The book prints each of these listings abridged, under the note “Listing abridged. Full text: contextualagentic.com/listings/” followed by the file name. Each file below is the fuller text of that listing, served as a plain text file. Every line the book prints appears in it unchanged and in the same order; the ellipsis that closes the printed version is replaced by the lines that follow.
Read this first
- These listings are illustrative teaching examples. They have not been executed in production, and they are not a supported product.
- A listing shows one contract or one idea from its section. Some are fragments of a larger design rather than complete programs, so they may omit imports and surrounding code.
- Licence: see Terms of use.
- Last reviewed 3 October 2026.
The fourteen listings
| File | Book section | What it shows, from the section |
|---|---|---|
ch05-01.yaml |
5.3 The Context Contract | A simple representation of a Context Contract, so that the context policy is declared and testable. |
ch08-01.py |
8.4 Tool contracts | A typed tool contract: the model may construct the request, but it should not be able to redefine the schema at runtime. |
ch08-02.py |
8.10 Loop Engineering as a runtime discipline | A loop guard: a runtime budget that ends repeated reasoning when cost or time is exhausted or when several iterations produce no material progress. |
ch12-01.json |
12.6 The canonical agentic event log | A useful event contract for Agentic Flow Mining: closer to an audit-capable domain event than a log line, carrying references rather than raw content. |
ch15-01.yaml |
15.4 The Sovereignty Envelope | The Sovereignty Envelope: a versioned contract that translates legal, business and security requirements into machine-enforceable placement constraints. |
ch15-02.py |
15.7 The sovereignty router and policy enforcement point | The sovereignty router’s model selection, in which sovereignty admission comes before cost or performance optimisation. |
ch15-03.txt |
15.10 Telemetry, evidence and AFM sovereignty | The sovereignty attributes the canonical AFM event model should carry, so that telemetry and evidence are governed as well as inference. |
ch15-04.yaml |
15.14 MCP and A2A across sovereignty boundaries | A sovereignty-aware capability contract for an MCP capability, declaring its placement and data-handling properties. |
ch17-01.yaml |
17.3 Build evaluation datasets like products | A case schema for an evaluation dataset built like a product, where the expected result is an acceptance envelope rather than one exact sentence. |
ch21-01.json |
21.4 Memory is a write problem before it is a read problem | A useful memory record: it carries enough context to be challenged later. |
ch21-02.py |
21.23 Memory consistency, authority and organisational truth | A memory assertion that represents explicitly the difference in authority between memories. |
ch25-01.yaml |
25.4 Context Contract implementation | Example feature configuration for the context builder, turning behaviour tuning into versioned configuration. |
ch25-02.py |
25.18 Model catalogue, router and benchmark harness | The model capability record behind the companion model catalogue and router, which uses deterministic mock providers and makes no live calls by default. |
ch25-03.py |
25.19 Memory service and write governance | A memory candidate in the companion memory module, which separates candidate observations from promoted memory. |
Open a file to read it, or save it to keep a copy. The reasoning each one supports is in the section of the book named beside it.
Last updated 3 October 2026.