Core Concepts
This page is the human-language version of the architecture. If you’ve read the Introduction, this is the “what do those words actually mean” page. If you haven’t, start there.
The big picture
Section titled “The big picture”ContextBrew is a compiler for AI context. You write structured specifications; ContextBrew compiles them into everything an AI coding agent needs — tests, type definitions, navigation flows, recipes — plus the prompt that ties it all together.
That’s it. Everything else is a refinement of that one idea.
The twelve specification models
Section titled “The twelve specification models”A “model” in ContextBrew is a structured description of one slice of your system. Five are first-class. The other seven are optional and you add them when you need them.
| Model | What it describes | Plain-language example |
|---|---|---|
| DDD | Domain rules | “An Order has a total and a status. Status can’t go from COMPLETED back to CANCELLED.” |
| USM | What users want | “A Traveler persona wants to search flights. The story has two acceptance criteria.” |
| CBRL | Formal requirements | “REQ-001: Booking confirmation must render in under 2 seconds.” |
| SCM | Screens and navigation | “There’s a search screen at /search. From it, the user can navigate to flight-detail.” |
| DSM | Persistence | “There’s a bookings table with a UNIQUE constraint on (customer_id, flight_id).” |
And the optional ones, when you need them:
| Model | What it describes |
|---|---|
| SIM | Multi-service topology — contexts, edges, contracts between services |
| C4 | Architecture (persons, systems, containers, components) |
| Context Map | Strategic DDD — bounded contexts and how they integrate |
| ESDM | Event-sourced DDD (commands, events, read models, policies) |
| Decision | Architecture Decision Records (ADRs) |
| ABSL | AI agent behavior (personality, guardrails, trust tier) |
| ACM | Access connectivity — who can see what, and the matrix |
A decision guide lives at Which model do I need? if you want the longer version.
The trace
Section titled “The trace”Traceability is ContextBrew’s superpower. Every model element is linked to the model elements that touch it — and the links are bidirectional and computed.
Examples of what traceability lets you do:
- “Where does this requirement get tested?” → click the requirement, see every test and every recipe it touches.
- “What changes if I rename this aggregate?” → see every story, screen, requirement, and recipe that references it.
- “Is this rule enforced anywhere?” → the rule is in CBRL; the test is generated; the test is in a recipe; the recipe is what an agent implements against.
You don’t have to maintain these links manually — ContextBrew computes them when you wire two elements together. When one changes, the trace tells you what else needs updating.
Recipes — the actual output
Section titled “Recipes — the actual output”A recipe is the unit of work you hand to an AI agent. It’s a self-contained package:
- Context — every model element that matters for this work, with the parts that don’t matter filtered out.
- Tests — generated from your specs. The agent’s job is to make them pass.
- Type stubs — TypeScript interfaces for everything the recipe will touch, generated from DDD/SCM/DSM.
- Work items — a checklist of the changes to make, in dependency order.
- The prompt — the prose that ties it all together. You can export it as pasteable text or hand it to the Execution Engine.
The agent receives the recipe and implements until the tests pass. That’s the contract.
Generations — what came back
Section titled “Generations — what came back”A generation is the result of running an AI model against a recipe. ContextBrew supports multiple providers (Anthropic, OpenAI, Google, local models via Ollama) and remembers:
- The prompt that was sent
- The model and provider
- The code that came back
- The cost (tokens × price)
- The test results after applying the code
- A diff between the candidate and your last accepted state
You can compare generations from different providers side by side, which is how teams figure out which model is best for their domain (not in general — for their domain).
The Execution Engine
Section titled “The Execution Engine”The Execution Engine is the part that actually talks to AI providers. You give it a recipe id, it picks a provider and a model, assembles the prompt, sends it, captures the response, runs the generated tests, stores everything as a generation.
You can run it:
- Locally (with Ollama or your own model endpoint) for free, private, no API key needed.
- Cloud (Anthropic, OpenAI, Google) for the strongest models, with cost tracking.
Both modes produce the same generation artifact — same shape, same traceability, same diff tooling.
DeltaEngine — incremental changes
Section titled “DeltaEngine — incremental changes”When you change a spec, ContextBrew doesn’t regenerate everything from scratch. The DeltaEngine computes what changed and only regenerates the affected artifacts.
Example: you add an invariant to the Order aggregate. The
DeltaEngine:
- Sees the new invariant.
- Traces it back to every USM story and CBRL requirement that
references
Order. - Traces forward to every SCM screen and DSM table.
- Marks every affected test as “needs regeneration”.
- Marks every affected recipe as “may need updating”.
What you actually see: a list of recipes that may have broken, with the specific tests they need to pass again. This is how iterative development stays fast.
The Recipe Server
Section titled “The Recipe Server”The Recipe Server is version control for your specifications. It provides:
- Branching — experiment with a spec change without breaking main
- Tagging — mark a known-good state
- Semantic diffing — compare specs the way humans read them, not line-by-line
- 3-way merging — resolve spec conflicts
- Commit history — full audit trail of what changed and why
If you’ve used Git, you already know how to use the Recipe Server.
The Five Phases (the IDE workflow)
Section titled “The Five Phases (the IDE workflow)”Context Studio (the IDE) organizes work into five phases. Most of the time you spend here moves left-to-right, but you can jump anywhere:
| Phase | What’s there | What you do |
|---|---|---|
| Models | Your five (or twelve) model files | Edit specs |
| Plan | Poker sessions, release planning | Scope the work into recipes |
| Build | The Execution Engine, generations, recipe archive | Run the AI, compare outputs, accept |
| Observe | Diff, replay, audit log | Look back at what happened |
| Settings | Keys, theme, keybindings, agents | Tweak the tool |
The Methodology page goes deeper on this — it describes the discipline, not just the labels.
The two guarantees
Section titled “The two guarantees”Two things are true everywhere in ContextBrew:
- A file is judged against the schema version it declares. A
file with
schemaVersion: "0.1.0"is validated against the0.1.0schema, not the newest one. This is how addd.jsonwritten today stays valid against addd.jsonwritten last year. - The tooling refuses rather than warns. If a check can fail open, that’s a defect. Drift fails the build. Lost work fails the commit. There’s no “we’ll fix it later” mode.
These are not marketing promises; they’re enforced by the build pipeline. The Schemas Overview explains how.
Next steps
Section titled “Next steps”| You want to… | Go to |
|---|---|
| See all the terms in one place | Glossary |
| Pick the right model for the work | Which model do I need? |
| Try it end-to-end | Quick Start |
| See common questions answered | FAQ |
| Understand the system end-to-end | Architecture |
| See what each model looks like | File Schemas |
