Recipes Overview
Recipes Overview
Section titled “Recipes Overview”Recipes are the primary output of ContextBrew. A Recipe is a self-contained work unit that bundles everything an AI coding agent needs to implement a feature correctly: domain context, failing tests, and a clear definition of done.
What Is a Recipe?
Section titled “What Is a Recipe?”A Recipe contains:
- Context – relevant domain knowledge drawn from DDD aggregates, USM stories, and CBRL requirements
- Failing tests – auto-generated from invariants, acceptance criteria, and constraints
- Work items – a checklist of implementation tasks
- Type stubs – TypeScript interfaces and types generated from the models
- Traceability links – connections back to the spec elements that generated each test
Think of a Recipe as a fully scoped, fully specified task. An AI agent receives the Recipe, implements code to make all tests pass, and the work is done.
Recipe Lifecycle
Section titled “Recipe Lifecycle”Recipes follow a defined lifecycle:
- Created – generated from one or more spec models (DDD aggregates, USM stories, CBRL requirements)
- Exported – packaged as a prompt for an AI coding agent, or sent to the Execution Engine
- In Progress – an AI agent (or human) is implementing against the recipe’s failing tests
- Review – all tests pass, code is ready for review
- Done – tests pass and implementation is approved
# Create a recipe (the aggregate is the required scope)ctx recipe create --aggregate Order
# Check statusctx recipe status recipe-001# Output: CREATED
# Export for an AI agentctx recipe export --recipe recipe-001
# After implementation, review the execution reportctx recipe report recipe-001Execution states — blocked, not warned
Section titled “Execution states — blocked, not warned”At runtime the recipe’s state machine is
pending → in_progress → blocked | done → verified (enforced in
packages/core/src/recipes/execution.ts — illegal moves are refused with
the allowed transitions named, never coerced). The state that matters most:
blocked is a state that stops the line, not a warning in the logs.
When a recipe’s suite fails, runRecipeTests flips it to blocked. Blocked
means blocked: an implementation claim against a blocked recipe is refused
(see the implemented loop and the MCP
mark_implemented tool), and only re-entering in_progress — after the
failing tests are addressed — reopens the path to done. Likewise, the
gate commands (ctxbrew lint --gate, ctxbrew check --gate) exit
non-zero on failure, and a gate with zero runnable signals refuses too: a
gate that cannot see must not silently pass.
Two honesty notes: these execution states live on the recipe’s state file
(recipes/reporter.ts), not inside the parsed spec ASTs — provenance stays
at the seam. And CBRL requirements currently carry no lifecycle
statuses at all: for requirements, “blocked” is what coverage gating does
(ctxbrew lint’s coverage findings + --gate); a requirement lifecycle
remains a designed, not shipped, seam (see the oracle-run design’s
provenance rule).
How Recipes Are Organized
Section titled “How Recipes Are Organized”A recipe is created per DDD aggregate — that is the only scope recipe create takes. The other models travel with the aggregate through the traceability links in your spec files:
- Aggregate – the DDD aggregate the recipe is scoped to
- Requirement – CBRL requirements that declare
INVOLVES_AGGREGATE <name> - Story – USM stories linked from those requirements
- Screen – SCM screens that reference the aggregate or those requirements
- Table – DSM tables whose
aggregatefield names the aggregate
# Create a recipe scoped to a specific aggregatectx recipe create --aggregate OrderThe multi-model recipe is authored in the model files (the links), not in the recipe command. Details: Creating Recipes.
Recipe Completeness
Section titled “Recipe Completeness”There is no per-recipe weighted score — that scoring is not implemented.
Completeness is measured at the project level: ctxbrew status reports
requirement, aggregate, and story coverage plus test density, and the CMBF
completeness ratio (ctxbrew cmbf score) rolls those into one deterministic
number. A recipe itself is done when its suite passes and the execution
state machine reaches verified — not when a dashboard says 100%.
Recipe vs. Traditional Prompts
Section titled “Recipe vs. Traditional Prompts”| Aspect | Traditional Prompt | ContextBrew Recipe |
|---|---|---|
| Context | Manually written | Auto-extracted from models |
| Tests | None or ad-hoc | Auto-generated from specs |
| Done criteria | Vague (“implement feature X”) | Precise (all tests pass) |
| Traceability | None | Full bidirectional links |
| Versioning | Copy-paste | Recipe Server with branching |
Next Steps
Section titled “Next Steps”- Creating Recipes to learn how to generate recipes from your specs
- Recipe Server for version control of your recipes
- Execution Engine for automated code generation from recipes
