Bug summary
The generate-mdl skill template (core/wren/src/wren/skills_content/generate-mdl/SKILL.md) instructs agents to write relationships.yml as a bare YAML list:
# relationships.yml (what the skill template shows)
- name: orders_customers
models:
- orders
- customers
join_type: many_to_one
condition: "orders.customer_id = customers.customer_id"
But load_relationships() in context.py expects a dict with a top-level relationships: key:
# context.py — load_relationships()
data = yaml.safe_load(rel_file.read_text(encoding="utf-8")) or {}
rels = data.get("relationships") if isinstance(data, dict) else None
if not isinstance(rels, list):
return []
A bare YAML list parses as a Python list, so isinstance(data, dict) is False, and the function returns []. The relationships are silently dropped.
The CLI's own writer (_convert_mdl_to_project_files) correctly uses the wrapper format:
yaml.dump({"relationships": rels_snake}, ...)
Expected format
# relationships.yml (what the loader expects)
relationships:
- name: orders_customers
models:
- orders
- customers
join_type: many_to_one
condition: "orders.customer_id = customers.customer_id"
Steps to reproduce
- Follow the quickstart guide to generate an MDL project using Claude Code with the
/wren skill
- The skill generates
relationships.yml as a bare list (following the SKILL.md example)
- Run
wren context validate — reports 0 relationships
- Run
wren context build — target/mdl.json has "relationships": []
Impact
- Any project generated via the
generate-mdl skill will have relationships silently ignored
wren context validate reports 0 relationships without any warning
- Queries still work because agents can write explicit
JOIN ... ON clauses, so the bug is hidden
- AI agents lose relationship context from
wren memory fetch, reducing their ability to generate correct JOINs automatically
Suggested fix
Update the YAML example in core/wren/src/wren/skills_content/generate-mdl/SKILL.md (Phase 4, Step 3) to include the relationships: top-level key, matching the format that load_relationships() expects.
Environment
- wren CLI installed via
pip install wrenai
- Discovered while debugging a DuckDB-backed project where relationships were defined but missing from the compiled MDL
Bug summary
The
generate-mdlskill template (core/wren/src/wren/skills_content/generate-mdl/SKILL.md) instructs agents to writerelationships.ymlas a bare YAML list:But
load_relationships()incontext.pyexpects a dict with a top-levelrelationships:key:A bare YAML list parses as a Python
list, soisinstance(data, dict)isFalse, and the function returns[]. The relationships are silently dropped.The CLI's own writer (
_convert_mdl_to_project_files) correctly uses the wrapper format:Expected format
Steps to reproduce
/wrenskillrelationships.ymlas a bare list (following the SKILL.md example)wren context validate— reports0 relationshipswren context build—target/mdl.jsonhas"relationships": []Impact
generate-mdlskill will have relationships silently ignoredwren context validatereports 0 relationships without any warningJOIN ... ONclauses, so the bug is hiddenwren memory fetch, reducing their ability to generate correct JOINs automaticallySuggested fix
Update the YAML example in
core/wren/src/wren/skills_content/generate-mdl/SKILL.md(Phase 4, Step 3) to include therelationships:top-level key, matching the format thatload_relationships()expects.Environment
pip install wrenai