Creating Recipes
Creating Recipes
Section titled “Creating Recipes”Recipes are created by selecting spec elements from your models and bundling them into a self-contained work unit. This page covers how to create, configure, and refine recipes.
Creating a Basic Recipe
Section titled “Creating a Basic Recipe”The simplest recipe pulls context from a single DDD aggregate:
ctxbrew recipe create --aggregate BookThis writes .contextbrew/recipes/recipe-001.{json,md} containing:
- The
Bookaggregate definition with all properties and invariants - Generated unit tests for each invariant
- A work item list derived from the aggregate’s properties and associations
Where the Context Comes From
Section titled “Where the Context Comes From”A recipe is created per aggregate, but it is rarely aggregate-only. Everything you linked in your spec files travels with it through traceability:
- DDD – the aggregate, its properties, invariants, and associations
- CBRL – requirements that declare
INVOLVES_AGGREGATE Book - USM – stories linked from those requirements
- SCM – screens that reference the aggregate or those requirements
- DSM – tables whose
aggregatefield names the aggregate
In other words: the multi-model recipe is authored in the model files (the links), not in the recipe command. If a requirement should be part of the Book recipe, link it in CBRL with INVOLVES_AGGREGATE Book.
Work Items
Section titled “Work Items”Work items are auto-derived when the recipe is created – there is no separate work-item command. They live inside the recipe file itself:
ctxbrew recipe list # what recipes existcat .contextbrew/recipes/recipe-001.json # manifest + state + work itemsNeed a custom work item? Edit the recipe file – it is plain JSON/markdown you own, and it is the artifact your agent reads.
Scoping Generation
Section titled “Scoping Generation”Control what gets generated from the spec with generator targets:
ctxbrew generate --target vitest # failing-first unit tests onlyctxbrew generate --target all # everything (default)ctxbrew generate --aggregate Book # scope to one aggregateAvailable targets:
| Target | Output |
|---|---|
vitest |
Failing-first unit tests from invariants and test cases (scaffold stubs fail by design) |
gherkin |
Gherkin scenarios from acceptance criteria |
openapi |
OpenAPI spec fragments from SCM/DSM |
prompts |
Agent-ready prompt packs |
semgrep |
Security rules |
eslint |
Quality rules |
ci |
CI pipeline artifacts |
all |
Everything (default) |
Output lands under .contextbrew/generated/<target>/.
Token Budget
Section titled “Token Budget”For large recipes, the export step manages the token budget so the prompt fits within model limits:
ctxbrew recipe export --recipe recipe-001 --token-budget 80000The default budget is 200000 tokens.
Delta Workflows
Section titled “Delta Workflows”When your specs change, you do not need to regenerate everything blind. Diff first, then regenerate what the diff touched:
# Edit .contextbrew/ddd/book.domain (e.g. add a subtitle property), then:ctxbrew ddd diff .contextbrew/ddd/book.domain.bak .contextbrew/ddd/book.domain
# Regenerate the tests that cover the changed aggregatectxbrew generate --target vitest --aggregate BookRecipe exports are always assembled fresh from the current spec, so exporting again after a spec change produces an up-to-date prompt without a flag.
Recipe Export Formats
Section titled “Recipe Export Formats”# Export as a pasteable markdown prompt (default)ctxbrew recipe export --recipe recipe-001
# Export as a JSON filectxbrew recipe export --recipe recipe-001 --format json --output recipe-001.json
# Agent-specific formatsctxbrew recipe export --recipe recipe-001 --format claude-mdcctxbrew recipe export --recipe recipe-001 --format cursorrulectxbrew recipe export --recipe recipe-001 --format copilot
# Copy to a file and hand to any agentctxbrew recipe export --recipe recipe-001 --format skill-md --output SKILL.mdAll formats: markdown, json, claude-mdc, cursorrule, copilot, plain-text, signed-json, ctxbrew, skill-md, skill-md-bundle. Signed exports (signed-json) are verified with ctxbrew verify.
Assigning and Executing
Section titled “Assigning and Executing”# Assign a recipe to an agent typectxbrew recipe assign recipe-001 --agent claude-code
# Prepare and dispatch (optionally spawning the agent and streaming output)ctxbrew recipe execute recipe-001 --agent claude-code --run
# Check on itctxbrew recipe status recipe-001ctxbrew recipe report recipe-001 --output report.mdNext Steps
Section titled “Next Steps”- Recipes Overview to understand the recipe lifecycle
- Recipe Repos for version control
- Execution Engine for automated code generation
