# Files

> Every field of map.yaml and of a case file, in version 1 of the format.

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

For agents: map.yaml fields: format (1), app {name, description, landing, repository, telemetry}, actors[] {id,name,kind,description}, areas[] {id,title,cases[],public[] (<case>.<Outcome>)}, journeys[] {id,title,actor,cases[]}, promises[] {text,cases[]}, waivers[] {kind,target,reason,until}. navigation.yaml: roots[] {id,title,actors[],route}, places[] {id,title,kind,parent,opened_by{label,kind},route?,permission?}, shortcuts[] {from,to,label}. Case file fields: id, title, actor, goal, starts, where, preconditions, steps, input, outcomes, failures, data, allowed, ai, files, mail, loop, retries, status, owner, notes (splitting a case into its own service is a deploy setting: cases.split in the [run] table of sypnia.toml). Ids: ^[a-z][a-z0-9-]{1,62}$; place ids: dot-joined ids; outcome and failure names PascalCase; event names <area>.<case>.<Outcome>.v<N>. Unknown fields are kept and reported as warnings (x- prefix for extensions).

## `cases/map.yaml`

| Field      | Type   | What it is                                                                                                            |
| ---------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| `format`   | `1`    | the format version; tools refuse a version they do not know                                                           |
| `app`      | object | `name`, `description`, `landing` (its URL), `repository`, `telemetry` (the linked Telemetry project)                  |
| `actors`   | list   | `id`, `name`, `kind` (`person` or `system`), `description`                                                            |
| `areas`    | list   | `id`, `title`, `cases` (case ids, in order), `public` (the outcomes other areas may listen to, as `<case>.<Outcome>`) |
| `journeys` | list   | `id`, `title`, `actor`, `cases` (ids, or `{ either: [...] }` for a branch)                                            |
| `promises` | list   | `text` (as on the landing) and the `cases` behind it                                                                  |
| `waivers`  | list   | `kind`, `target`, `reason`, `until` (a date)                                                                          |

## `cases/navigation.yaml`

| Field       | Type | What it is                                                                                                                                                               |
| ----------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `roots`     | list | `id`, `title`, `actors` (who comes in there), `route`                                                                                                                    |
| `places`    | list | `id`, `title`, `kind` (`screen`, `tab`, `modal`, `menu`, `panel`), `parent` (one), `opened_by` (`label`, `kind`: `button`, `link`, `item`, `tab`), `route`, `permission` |
| `shortcuts` | list | `from`, `to`, `label`                                                                                                                                                    |

Described in [The navigation map](https://cases.docs.sypnia.com/map/navigation).

## A case file: `cases/<area>/<id>.case.yaml`

The area is the folder; a case belongs to exactly one area.

| Field                          | Type                                                                                                                                                                                                 | Described in                                                                          |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| `id`, `title`, `actor`, `goal` | text                                                                                                                                                                                                 | [Use cases](https://cases.docs.sypnia.com/map/use-cases)                              |
| `starts`                       | `in_app`, or an object with `external`, `scheduled` or `event`                                                                                                                                       | [How a case starts](https://cases.docs.sypnia.com/map/starts)                         |
| `where`                        | a place id                                                                                                                                                                                           | [The navigation map](https://cases.docs.sypnia.com/map/navigation)                    |
| `preconditions`, `steps`       | lists of text                                                                                                                                                                                        | [Use cases](https://cases.docs.sypnia.com/map/use-cases)                              |
| `input`                        | typed fields                                                                                                                                                                                         | [Use cases](https://cases.docs.sypnia.com/map/use-cases#types)                        |
| `outcomes`, `failures`         | named, with typed payloads; an outcome's long form is `payload`, `says`, `version`, `since`, a failure's `when`, `tell`, `payload`, `version`, `since` (`since`, a date, is required from version 2) | [Outcomes and events](https://cases.docs.sypnia.com/map/outcomes-and-events#versions) |
| `data`                         | `reads`, `writes`: table names                                                                                                                                                                       | [Use cases](https://cases.docs.sypnia.com/map/use-cases)                              |
| `allowed`                      | actor ids                                                                                                                                                                                            | [Use cases](https://cases.docs.sypnia.com/map/use-cases)                              |
| `ai`                           | `tasks`                                                                                                                                                                                              | [Use cases](https://cases.docs.sypnia.com/map/use-cases)                              |
| `files`                        | `reads`, `writes`: bucket names                                                                                                                                                                      | [Use cases](https://cases.docs.sypnia.com/map/use-cases)                              |
| `mail`                         | `sends`: template names                                                                                                                                                                              | [Use cases](https://cases.docs.sypnia.com/map/use-cases)                              |
| `loop`                         | `bounded` (`true`), `max`, `until`                                                                                                                                                                   | [Loops](https://cases.docs.sypnia.com/runtime/loops)                                  |
| `retries`                      | `max` (1 to 20, default 5), `backoff`                                                                                                                                                                | [Delivery](https://cases.docs.sypnia.com/runtime/delivery#retries)                    |
| `status`, `owner`, `notes`     | text                                                                                                                                                                                                 | [Use cases](https://cases.docs.sypnia.com/map/use-cases)                              |

## Rules

- **Ids** of cases, actors, areas and journeys match `^[a-z][a-z0-9-]{1,62}$` and are unique in the map. Place ids are such ids joined by dots (`shop.order-for-tomorrow`). Outcome and failure names are `PascalCase` and unique within their case.
- **Event names** are `<area>.<case>.<Outcome>.v<N>`, where `N` is a whole number from 1.
- **References** (an actor in a case, a case in an area or journey, a place in `where`, a parent, an event in `starts`, an outcome in `public`) must exist.
- **Unknown fields** are kept as they are and reported as warnings. Your own fields start with `x-` and are never reported.
- **JSON** is accepted wherever YAML is: `place-order.case.json`.
- **Text** is UTF-8; write in any language. A map may carry translations: `title: { en: Order for today, es: Pedir para hoy }`.
