Skip to content

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.

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.

Recipes follow a defined lifecycle:

  1. Created – generated from one or more spec models (DDD aggregates, USM stories, CBRL requirements)
  2. Exported – packaged as a prompt for an AI coding agent, or sent to the Execution Engine
  3. In Progress – an AI agent (or human) is implementing against the recipe’s failing tests
  4. Review – all tests pass, code is ready for review
  5. Done – tests pass and implementation is approved
Terminal window
# Create a recipe (the aggregate is the required scope)
ctx recipe create --aggregate Order
# Check status
ctx recipe status recipe-001
# Output: CREATED
# Export for an AI agent
ctx recipe export --recipe recipe-001
# After implementation, review the execution report
ctx recipe report recipe-001

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

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 aggregate field names the aggregate
Terminal window
# Create a recipe scoped to a specific aggregate
ctx recipe create --aggregate Order

The multi-model recipe is authored in the model files (the links), not in the recipe command. Details: Creating Recipes.

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

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