SEA™ DSL Cheat Sheet

Quick reference for SEA™ DSL syntax and patterns.


File Structure

@namespace "domain.name"
@version "1.0.0"

import * as Std from "std:core"

Entity "Name" in domain
Resource "Name" units in domain
Flow "Name" @cqrs { "kind": "command" } from "A" to "B"
Policy name as: (expression)

Declarations

Type Syntax
Entity Entity "Name" [v X] [in domain]
Resource Resource "Name" [Unit] [in domain]
Flow Flow "Name" @cqrs {...} from "A" to "B" [quantity N]
Policy Policy name [per Kind Modality priority N] as: expr
Metric Metric "Name" as: expr @threshold N
Relation Relation "Name" subject/predicate/object
Instance instance id of "Entity" { field: value }

Flow Annotations (REQUIRED)

// Command
@cqrs { "kind": "command" }
@tx { "transactional": true }
@idempotency { "enabled": true, "key": "fieldName" }

// Event
@cqrs { "kind": "event" }
@outbox { "mode": "required" }

// Query
@cqrs { "kind": "query" }
@read_model { "name": "ProjectionName" }

Expressions

Type Syntax
forall forall x in collection: (expr)
exists exists x in collection: (expr)
count count(x in coll where cond: expr)
sum sum(x in coll: x.field)

Quick Commands

1
2
3
4
just sea-validate <file.sea>       # Validate syntax
just sea-parse <file.sea>          # Parse to AST
python tools/flow_lint.py --strict # Lint flows
just spec-guard                    # Validate all

Common Patterns

// Entity in domain
Entity "Customer" in sales

// Resource with unit
Resource "Money" USD in finance

// Command flow
Flow "CreateOrder"
  @cqrs { "kind": "command" }
  @tx { "transactional": true }
from "Customer" to "Order"

// Policy with quantifier
Policy positive_amounts as:
  forall f in flows: (f.quantity > 0)

Last Updated: January 2026