The Brew Path
Every ContextBrew project walks the same seven stages, in the same order, whether you author models by hand or import them from existing code. We call it the Brew Path. The stages are not ceremony — each one produces a typed artifact the next stage consumes, and the last three keep that artifact true over time.
1. INIT ──▶ 2. MODEL ──▶ 3. SPECIFY ──▶ 4. BREW │7. SERVE ◀── 6. LEDGER ◀── 5. GATE ◀─────────┘ │ │ └──────────── agents consume ──────────────┘The stages
Section titled “The stages”1. Init — scaffold the project
Section titled “1. Init — scaffold the project”ctxbrew init --name my-project # greenfield: folders per model familyctxbrew init --from-code . # brownfield: hypothesis specs from sourceinit --from-code reverse-engineers hypothesis DDD and DSM specs from an
existing TypeScript codebase — explicitly marked unverified until you
promote them. Proposals are never merged in silently.
2. Model — author the typed models
Section titled “2. Model — author the typed models”One plain-text file per model family under .contextbrew/, each with a
deterministic parser and a normative JSON Schema:
| File | What it pins |
|---|---|
.domain |
aggregates, invariants, domain events |
.usm.json |
personas, stories, acceptance criteria |
.scm.json |
screens, navigation, flows |
.dsm.json |
tables, constraints, indexes |
.sim.json |
service contexts, contracts, cross-cutting invariants |
Validate as you write — every format has the same five-command toolkit:
ctxbrew ddd validate .contextbrew/ddd/booking.domain # exit 1 on any error3. Specify — turn stories into requirements
Section titled “3. Specify — turn stories into requirements”CBRL is where intent becomes falsifiable: every requirement carries acceptance criteria and test cases, cross-linked to the aggregates and stories it touches:
ctxbrew cbrl validate .contextbrew/cbrl/booking.requirements# CI gate — exit 1 on new error findings vs the baselinectxbrew cbrl check .contextbrew/cbrl/booking.requirements --ddd .contextbrew/ddd/booking.domain4. Brew — compile the context
Section titled “4. Brew — compile the context”ctxbrew generate # tests, Gherkin, OpenAPI, prompt packsctxbrew recipe create --aggregate BookingGeneration is deterministic — no AI judgment involved. The outputs are failing-first: tests pass only when an implementation honors the spec.
5. Gate — make drift expensive
Section titled “5. Gate — make drift expensive”The gate is a program, not a person:
ctxbrew check --gate # CI drift gate — exit 1 on new findingsctxbrew validate-consistency # cross-model rule packsctxbrew gate # the full gate chainA spec that has stopped matching the code fails here, before an agent ever consumes it.
6. Ledger — remember why
Section titled “6. Ledger — remember why”Every decision lands in a hash-chained ledger against the models it changed:
ctxbrew log "Chose seat holds over reservations" --rationale "..."ctxbrew timeline # one-line decision memoryctxbrew evidence verify <bundle> # receipts for auditors7. Serve — hand the context to agents
Section titled “7. Serve — hand the context to agents”ctxbrew mcp setup --agent claude-code # also: cursor, windsurf, codex, orcactxbrew pour # emit context packs for a recipeThe agent receives compiled, provenance-carrying context — not a prompt that hopes for the best.
The canonical example
Section titled “The canonical example”One worked example crosses all seven stages end-to-end: the
Travel Booking tutorial builds it, and
samples/travel-booking/ in the repo holds the finished six-model
specification with a .ctxbrew checkpoint after every stage (downloadable
from the learning path).
Where this sits
Section titled “Where this sits”The Brew Path is the product lifecycle — the path a specification
walks. It is not the ContextBrew SDLC, which is how
this repository itself is engineered (worktrees, ratchets, and the
gate-that-refuses). Where your team stands on adopting the Brew Path is
measured by the Brew Maturity ladder —
locate your rung by the table’s signals (ctxbrew doctor does not yet
report a maturity row).
