Introduction
Using LLMs
Give your coding agent the docs and the rules it needs to write DomainRuntime code correctly.
The docs, as Markdown
| URL | Contains |
|---|---|
/llms.txt | an index of every page, with its status |
/llms-full.txt | every page, in one file |
<any page>.md | one page, e.g. /docs/data/actions.md |
Start with the rules below, and add single pages when your agent works on something specific.
Rules for your agent
Save this as AGENTS.md (Codex, Cursor and others) or CLAUDE.md (Claude Code) at the root of your project:
# DomainRuntime project
- The backend is src/domain.ts, one chain: domain("x").withSchema({ entities, links, rooms }).withActions({...}).
- Writes happen only inside actions: defineAction({ input, output, execute({ input, runtime }) }).
Never write from the browser; there is no client transaction.
- Zod input/output are the contract. Do not declare duplicate TypeScript types.
- One transaction per runtime.tx (today: db.transact). An action is not a transaction:
put writes that must happen together in one tx.
- Never check-then-create for uniqueness: declare the attribute .unique() and write with lookup().
- Let the caller choose the id of anything an action creates, so a retry is harmless.
- Today every action is callable by any signed-in user (action scopes are in development): check the caller at the top of execute.
- Permission rules: data.ref('link.attr') returns a list, compare with `in`. On create, use data, not newData.
- Long-running work is an action whose execute is marked "use workflow"; every side effect goes in a "use step" function.
- Entities are prefixed with their domain (orders_order); action ids are <domain>.<action>.
- Pages are marked Verified, Guide or Planned. Do not use a Planned API; check
https://docs.domainruntime.dev/docs/reference/status.mdCheck that it worked
Ask your agent: "How do I change data in DomainRuntime from a React page?" A correct answer calls an action and does not mention a client-side transaction.
Describe your business in DOMAIN.md
Put a DOMAIN.md next to your code that says, in plain words, what the entities mean, which operations exist and who performs them. An agent that reads it names actions after business operations (orders.place) instead of generic ones (orders.update).