Skip to content

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 ──────────────┘
Terminal window
ctxbrew init --name my-project # greenfield: folders per model family
ctxbrew init --from-code . # brownfield: hypothesis specs from source

init --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.

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:

Terminal window
ctxbrew ddd validate .contextbrew/ddd/booking.domain # exit 1 on any error

3. 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:

Terminal window
ctxbrew cbrl validate .contextbrew/cbrl/booking.requirements
# CI gate — exit 1 on new error findings vs the baseline
ctxbrew cbrl check .contextbrew/cbrl/booking.requirements --ddd .contextbrew/ddd/booking.domain
Terminal window
ctxbrew generate # tests, Gherkin, OpenAPI, prompt packs
ctxbrew recipe create --aggregate Booking

Generation is deterministic — no AI judgment involved. The outputs are failing-first: tests pass only when an implementation honors the spec.

The gate is a program, not a person:

Terminal window
ctxbrew check --gate # CI drift gate — exit 1 on new findings
ctxbrew validate-consistency # cross-model rule packs
ctxbrew gate # the full gate chain

A spec that has stopped matching the code fails here, before an agent ever consumes it.

Every decision lands in a hash-chained ledger against the models it changed:

Terminal window
ctxbrew log "Chose seat holds over reservations" --rationale "..."
ctxbrew timeline # one-line decision memory
ctxbrew evidence verify <bundle> # receipts for auditors
Terminal window
ctxbrew mcp setup --agent claude-code # also: cursor, windsurf, codex, orca
ctxbrew pour # emit context packs for a recipe

The agent receives compiled, provenance-carrying context — not a prompt that hopes for the best.

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).

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).