# Design decisions

> The choices behind Sypnia Cases that shape these pages, and why each one was made.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://cases.docs.sypnia.com/reference/decisions/

For agents: Design decisions of Sypnia Cases: server AGPL-3.0, @sypnia/cases (Sypnorm and the TypeScript runtime included) and the Rust crate sypnia-cases MIT (they run inside apps, like an SDK), the format open for anyone to implement; YAML is the canonical file, JSON accepted; reviewers sign in with a free Sypnia account; AI helps write cases in the editor through Sypnia AI, paid with credits, always as a draft a person approves; maps live only in Cases and Sypnia Data's console shows a summary with a link; Sypnorm is @sypnia/cases/sypnorm with /map and the cases command; commands cases tables, cases map, cases link --data <ref>; one Data project ↔ one Cases project both ways; maps uploaded to Data go on to the linked Cases map as a draft proposal; the same Sypnia organization across the suite; MCP at mcp.cases.sypnia.com, one endpoint per product, the token decides; npx @sypnia/data init asks about the ORM and Cases; plans: Cases alone or in the Sypnia subscription, extra capacity, prepaid. Plus: dotted place ids, typed starts, declared outcomes, versioned event names, public/internal outcomes per area, one service per area, transactional outbox delivery, bounded loops and LoopStopped.

These are the choices that shape Sypnia Cases. Each one is written on the page that uses it; this page puts them together with the reason behind them.

| Decision                                                 | What it is                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Why                                                                                               |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
| **Licenses**                                             | the server under AGPL-3.0; what runs inside apps under MIT, like every Sypnia SDK and CLI: `@sypnia/cases`, Sypnorm and the TypeScript runtime included, and the Rust crate `sypnia-cases` with its core; the format is open for anyone to implement                                                                                                                                                                                                                     | the package fits any project, open or closed; a hosted copy of the server shares its changes      |
| **The canonical file**                                   | YAML, with JSON accepted                                                                                                                                                                                                                                                                                                                                                                                                                                                 | people read and review YAML more easily; machines can write JSON                                  |
| **Reviewers have an account**                            | a free Sypnia account                                                                                                                                                                                                                                                                                                                                                                                                                                                    | an approval is tied to a person, and the account is the same for every product                    |
| **Writing cases with AI in the editor**                  | through Sypnia AI, paid with credits, always as a draft a person approves                                                                                                                                                                                                                                                                                                                                                                                                | it makes the map possible for people who do not program, without letting a model change the scope |
| **Where maps live**                                      | in Cases only; Sypnia Data's console shows a summary of the linked Cases project and links to it                                                                                                                                                                                                                                                                                                                                                                         | one owner for the map and its versions; Data stays about data                                     |
| **Sypnorm belongs to Cases**                             | `@sypnia/cases/sypnorm`, with `/map` and the `cases` command; Sypnia Data is the data layer and works with any ORM                                                                                                                                                                                                                                                                                                                                                       | the map Sypnorm derives is the code side of the Cases map                                         |
| **Sypnorm's commands**                                   | `cases tables` for typed tables (because `cases pull` already brings the map from Sypnia Cloud), `cases map` for the code side of the map, `cases link --data <ref>` to link with a Data project                                                                                                                                                                                                                                                                         | one command for the whole product, no clash between names                                         |
| **Linking**                                              | one Data project ↔ one Cases project, both ways ([Data](https://cases.docs.sypnia.com/links/data))                                                                                                                                                                                                                                                                                                                                                                       | simple to explain; enough for one app per project                                                 |
| **Maps uploaded to Data**                                | they are kept with the Data project and go on to its linked Cases map, as a draft proposal on behalf of the person who uploaded them                                                                                                                                                                                                                                                                                                                                     | one command serves both products, and a person still approves                                     |
| **The organization**                                     | the same Sypnia organization as in Data (no copy), added to Cases on first use                                                                                                                                                                                                                                                                                                                                                                                           | one organization per company across the suite                                                     |
| **MCP endpoint**                                         | its own, `mcp.cases.sypnia.com`: one endpoint per product, the token decides ([MCP](https://cases.docs.sypnia.com/tools/mcp))                                                                                                                                                                                                                                                                                                                                            | Cases works without Data; permissions, limits and outages stay separate                           |
| **`npx @sypnia/data init` asks about the ORM and Cases** | which ORM (SQL, Prisma, Drizzle or Sypnorm) and whether to use Cases; Sypnorm or Cases installs `@sypnia/cases` and creates and links the Cases project through MCP                                                                                                                                                                                                                                                                                                      | the agent sets up both in one step                                                                |
| **Place ids**                                            | kebab-case words joined by dots (`shop.order-for-tomorrow`), independent of the route and of the path; one parent per place, shortcuts for the rest; `data-sypnia-place` in the markup                                                                                                                                                                                                                                                                                   | the path is always known and unique; renaming or moving never breaks a case, a screen or a trace  |
| **Typed starts**                                         | `in_app`, `external`, `scheduled`, `event` instead of free-text triggers; whether a case is in the app comes from its start                                                                                                                                                                                                                                                                                                                                              | each start becomes real infrastructure, and nothing is left to guess                              |
| **Every case ends in a declared outcome**                | failures are outcomes; an undeclared error goes to Telemetry and, for event runs, to dead letters                                                                                                                                                                                                                                                                                                                                                                        | every ending has a name people read, the code types and Telemetry counts                          |
| **Event names**                                          | `<area>.<case>.<Outcome>.v<N>`; a breaking change needs a new version                                                                                                                                                                                                                                                                                                                                                                                                    | listeners never break by surprise                                                                 |
| **Public and internal outcomes**                         | per area, in `map.yaml`                                                                                                                                                                                                                                                                                                                                                                                                                                                  | areas stay apart; their public outcomes are their contract                                        |
| **One service per area**                                 | a case is a unit of meaning; Run splits one only when needed (`cases.split`)                                                                                                                                                                                                                                                                                                                                                                                             | fewer services, fewer cold starts, one place to look                                              |
| **Delivery**                                             | transactional outbox in the same Postgres transaction as the case's rows, written only by the area's service (a case someone listens to never runs from the browser: it is called at `POST /_cases/<id>`, with the person's Data session, under row-level security), fast path plus a sweep every minute, a queue and dead letters per listener, at least once with idempotent listeners, order only by `order_by`; EventBridge and SQS on AWS, Postgres alone otherwise | reliable by construction, the same guarantees everywhere                                          |
| **Loops**                                                | refused at design time unless bounded (`loop: { bounded: true, max, until }`), no case listens to itself, cut at run time at depth 10 (`LoopStopped`)                                                                                                                                                                                                                                                                                                                    | a chain never runs forever                                                                        |
| **Plans**                                                | Cases alone, or inside the Sypnia subscription, with extra capacity per item, always prepaid ([Sypnia Cloud](https://cases.docs.sypnia.com/cloud))                                                                                                                                                                                                                                                                                                                       | you pay for what you use, never after the fact                                                    |

When a decision changes, its page changes and the [changelog](https://cases.docs.sypnia.com/reference/changelog) says so.
