AI — Concept
Causet treats AI as declarative infrastructure, not ad-hoc API calls in application code — and not as the center of the product.
AI is additive. Causet is useful for any multi-step workflow; agents are the sharpest version of the same state problem. Memory becomes state, decisions become events, tool calls become inspectable side effects, and approvals become explicit events on the same timeline as a payment or access-request flow.
You declare providers, prompts, decisions, and memories in the Product DSL. The compiler validates schemas and produces causet.decisions.json; the runtime executes LLM calls when rules invoke op: decision in side_effects.
AI is a rule operation — same execution model as emits and submits, but external I/O that runs after core rules commit and is not replayed from ledger history the way core rules are.
The four DSL pieces
| Piece | Role |
|---|---|
| Providers | Logical LLM backends (reasoning, embeddings) — executor, model, temperature |
| Prompts | Reusable templates with {{ variable }} bindings |
| Decisions | Named operations: provider + prompt + input/output schema + event to emit |
| Memories | Event-driven embedding ingestion + retrieval at decision time |
Decisions reference providers and prompts by key. Memories feed context into prompts via {{ memories.<name> }}.
Where AI runs in the intent lifecycle
| Phase | AI allowed? |
|---|---|
| Preflight | No — validation only |
| Core | No — must stay deterministic and replayable |
| Side effects | Yes — op: decision runs here |
Keep entity mutations and the primary domain event in core. Run LLM calls in side_effects after core commits.
Two kinds of memory
| Application memory | Vector memory | |
|---|---|---|
| Storage | Entity state fields | Embedded text from ledger events |
| Updated by | Core rules (set, push, add) | Async ingestion worker |
| Retrieved via | Entity snapshot / projections | Similarity search at decision time |
| Replay | Deterministic from ledger | Re-ingested from source events |
Use entity state for structured counters and history. Use vector memory when you need semantic search over unstructured text in prompts.
Compiler artifact
When your app defines any of providers, prompts, decisions, or memories, compile produces:
build/out/causet.decisions.jsonDeploy it with your release. The runtime loads the AI IR per fork when rules invoke op: decision.
When to use AI in Causet
| Good fit | Poor fit |
|---|---|
| Classification, triage, moderation | Simple field validation (use preflight) |
| Structured extraction from text | Deterministic transforms (use core rules) |
| Summarization with typed output | Long-running human-in-the-loop (use workflows) |
| RAG over customer history | High-frequency hot-path logic without LLM need |
Next steps
- Defining Decisions —
decisions:block andop: decision - Providers & Prompts — logical providers and templates
- Secrets & Keys — BYOK setup in Causet Cloud
- Vector Memory — ingestion and retrieval
- Examples — moderation and triage patterns