Using .em.hcl with coding agents
A coding agent can draft .em.hcl, run the validator, fix diagnostics, and render the result.
This creates a useful feedback loop.
Works today
1. Draft
Describe the events, actors, ownership, and workflow.
2. Validate
Run emhcl validate.
3. Fix
Use the source position and EMxxx diagnostic.
4. Diagram
Render the model and review its causal shape.
5. Review
A person checks whether it describes the business.
Validation catches language and model-structure errors. The default valid profile permits modeling warnings. Even strict validation does not prove that a model follows the method or describes the business correctly.
Give the agent Specification v0.4.0 for syntax and the methodology guide for human review. The methodology is conceptual, not another grammar. Do not invent query, storyline, or linked_copy blocks. Field mapping records metadata, not executable lineage checks.
For a folder model, validate the folder, not each file in isolation. Use the diagnostic's file, line, column, and code to fix the source. Keep whole blocks intact, keep chapters in one file, and format each member file separately.
Workflow status records progress: created, planned, assigned, in_progress, review, blocked, done, or informational. A status is not a validator verdict. Do not mark a workflow done only because validation passes.
Possible next step
Feed one validated workflow to a coding agent as structured context for implementing that slice.
The CLI does not generate an application. Engineering decisions, tests, and review are still needed.
Prompt examples
-
Draft a model
Here are the business Events for {domain}: {list}. Draft a .em.hcl model using Specification v0.4.0. Choose a workflow pattern for each slice and add native scenarios. Run emhcl validate on the whole model. Report warnings, assumptions, and open business questions for human review. -
Fix a validator error
emhcl validate produced this diagnostic: {diagnostic}. Fix the model without changing the intended business behavior. -
Implement one workflow
Here is one validated .em.hcl workflow: {workflow}. Implement its {command handler / projection / endpoint} in {language}. State any assumptions.