WorkLensDocs
    Studio
    reference

    Recipe schema

    The 13 top-level keys of a recipe, the minimal example, and what the engine supports and does not — from the schema it serves to agents.

    Last updated 2026-09-13 · Generated from get_recipe_schema (contract v3) · Markdown

    Summary

    A recipe is one JSON file with 13 top-level keys. Entities hold fields, fields have a type, relationships and scenarios sit at the top. This page is generated from the same schema the MCP server hands an agent (contract v3), so it cannot describe an engine that no longer exists.

    The top-level keys

    • $schema — https://theworklens.com/schema/recipe/v1.json
    • version — 1
    • project — string (required) — kebab-case project name
    • region — string (optional), e.g. 'GB', 'IN', 'AU'. Needed for names, companies, emails or addresses, which come from that region's locale pack.
    • manifest — { name, version, requires, pack, assumptions } (optional)
    • run_date — 'YYYY-MM-DD' (optional), for pack expiry
    • categories — [] (optional), studio legend
    • seed — number | "today" | "now" (optional). A number pins the bytes (same recipe, seed, engine). "today" changes daily, "now" every run; the receipt records the number used. Left out: one fixed internal seed (not 42).
    • discovery — object (expected when you read a repository): what you found in the code. { sealed: [ids, written BEFORE drafting], observed: [{ evidence, where, note }], considered_and_skipped: [{ evidence, why }] }; ids from task_discovery.evidence[].id. validate_recipe checks each observation is modelled and each…
    • entities — [{"name":"string (required, unique) — PascalCase entity/table name","rows":"number (optional, default 50). No cap; above 10,000 is slow in a browser and is warned","fields":[{"name":"string (required, unique within entity) — snake_case","type":"string — one of engine_field_types below","type_def":"object,…
    • relationships — [{"from":"'ChildEntity.fk_field' — the scalar FK column on the many side","to":"'ParentEntity.id_field' — the referenced id on the one side","kind":"'fk'; also 'after', 'aggregate', 'polymorphic', 'unique'"}]
    • scenarios — [] — optional named variations (may be empty). Each: { name, rows? (EVERY table's rows in this run), null_rate?, chaos rates (shares of rows, 0 to 1; named in reference.keys.scenario), defects? }. defects = PLANTED defects: [{ row, field, kind, entity? }] — exact rows made wrong EVERY run (row 1 = first…
    • output — {"format":"REQUIRED. 'csv' writes one file per table and needs nothing else. 'fixed' writes a byte layout: fetch sections ['fixed_width'] for skeleton_def, overlay and totals."}

    Supported features

    • relationships, constraints, conditional_weights, aggregates, rollups, hierarchies, graphs, flows
    • scenarios, chaos, distribution_shapes, month_weights, patterns, fixed_width_output, packs, proof_reports
    • determinism, range_conditions, multi_condition_branches, conditional_presence, planted_defects, numeric_conditional_distributions, cross_entity_scope, temporal_ordering
    • polymorphic_references, correlated_row_draw, same_row_derivation, logical_conditions, date_arithmetic, joint_uniqueness, fanout_control, exact_cardinality
    • role_binding, interval_non_overlap

    Not supported

    • cross_entity_conditioning — For cross-entity AGREEMENT use scope — it filters the parent candidate set before the pick, so the data is coherent by construction. after orders dates across a link. Only if you need a parent attribute inside a weights_when CONDITION, FK-copy it onto the child.
    • per_step_history — flows set the END state + ordered timestamps; a history TABLE per step is not generated
    • time_series — none — flag to the user

    The smallest useful recipe

    {
      "$schema": "https://theworklens.com/schema/recipe/v1.json",
      "version": 1,
      "project": "bookstore",
      "region": "AU",
      "seed": 42,
      "entities": [
        {
          "name": "Customer",
          "rows": 100,
          "fields": [
            {
              "name": "customer_id",
              "type": "id",
              "unique": true
            },
            {
              "name": "full_name",
              "type": "person.fullName"
            },
            {
              "name": "email",
              "type": "internet.email"
            },
            {
              "name": "joined",
              "type": "date"
            },
            {
              "name": "lifetime_value",
              "aggregate": "sum(Order.total)"
            }
          ]
        },
        {
          "name": "Order",
          "rows": 300,
          "fields": [
            {
              "name": "order_id",
              "type": "id",
              "unique": true
            },
            {
              "name": "customer_id",
              "type": "id",
              "ref": "Customer.customer_id"
            },
            {
              "name": "total",
              "type": "finance.amount",
              "min": 1,
              "max": 500,
              "shape": "long_tail"
            },
            {
              "name": "status",
              "type": "enum",
              "values": [
                "placed",
                "shipped",
                "delivered",
                "cancelled"
              ]
            },
            {
              "name": "placed_at",
              "type": "date"
            },
            {
              "name": "delivered_at",
              "type": "date"
            }
          ],
          "constraints": [
            "delivered_at >= placed_at"
          ],
          "flow": {
            "field": "status",
            "transitions": {
              "placed": [
                "shipped",
                "cancelled"
              ],
              "shipped": [
                "delivered"
              ]
            },
            "weights": {
              "shipped": 8,
              "cancelled": 1
            },
            "timestamps": {
              "placed": "placed_at",
              "delivered": "delivered_at"
            }
          }
        }
      ],
      "relationships": [
        {
          "from": "Order.customer_id",
          "to": "Customer.customer_id",
          "kind": "fk"
        }
      ],
      "scenarios": [],
      "output": {
        "format": "csv"
      }
    }

    From the schema payload’s own minimal example.

    Common questions

    What is the smallest recipe that works?

    A project, a seed, an output format and one entity with one field. The minimal example below is the one the schema payload itself carries; validate it with validate_recipe or worklens check before generating.