# Quests

> The quest standard: a quest pack adds quests to a branch of the game; every field, rule and version.

A quest pack adds quests to a branch of the game: each quest has steps, and each step is done by the player, chosen, or done by the game and proven by the machine. A whole game file has the same quests, grouped in branches.

| | |
|---|---|
| **Standard** | `alta.quests/0.3` (a pack) · `alta.game/0.3` (a whole game) |
| **File** | any `.json` file of a pack folder, e.g. `quests.json` |
| **Create it** | `alta new quest-pack my-pack` |
| **Check it** | `alta lint my-pack` |
| **JSON Schema** | [alta.quests.schema.json](https://github.com/altasystem-ai/alta/blob/main/docs/standards/schemas/alta.quests.schema.json) · [alta.game.schema.json](https://github.com/altasystem-ai/alta/blob/main/docs/standards/schemas/alta.game.schema.json) |

## Minimal example

The smallest pack that passes `alta lint`: one quest, one step, proven by the machine when Codex is installed.

```json [quests.json]
{
  "schema": "alta.quests/0.3",
  "branch": "core",
  "quests": [
    {
      "id": "minimal-codex",
      "uid": "core.minimal-codex",
      "act": 2,
      "giver": "operator",
      "title": { "en": "Install Codex", "fr": "Installe Codex" },
      "reward": { "xp": 20 },
      "steps": [
        {
          "id": "codex",
          "kind": "check",
          "title": {
            "en": "Codex is on your machine",
            "fr": "Codex est sur ta machine"
          },
          "check": { "type": "bin", "name": "codex" }
        }
      ]
    }
  ]
}
```

## Fields

### Quest pack

The file itself.

| Field | Type | Required | Description |
|---|---|---|---|
| `schema` | enum | yes | The standard: `alta.quests/0.3` (or `alta.quests/0.2`, still read). |
| `branch` | string | yes | The branch the quests join, e.g. `core`. |
| `acts` | act[] | no | Acts added to the branch. |
| `skills` | skill[] | no | Skills added to the branch. |
| `quests` | quest[] | yes | The quests added. |

### Quest

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | no | The quest's short id, unique in its branch. |
| `uid` | string | yes | The quest's unique id, `<branch>.<id>`, e.g. `core.first-steps`. Progress and links use it. |
| `act` | integer | no | The act it belongs to, by number. |
| `giver` | string | no | The agent who gives the quest, by role (daemon, architect, operator, reviewer, guardian). |
| `main` | boolean | no | `true`: a quest of the main story. |
| `title` | text | no | The quest's title. |
| `summary` | text | no | One or two sentences: what the player gets from it. |
| `quote` | text | no | A line the giver says when offering it. |
| `why` | text | no | Why it matters, shown in the quest's details. |
| `ask` | text | no | The question the giver asks when offering the quest. |
| `requires` | string[] | no | The uids of the quests that must be done first. |
| `level` | integer | no | The level the player must have reached. |
| `reward` | object | yes | What the player wins when the quest is done. |
| `reward.xp` | number | yes | The experience it gives. Capped by type: instant 10 to 30, repeatable 30, personal 5. |
| `reward.skills` | string[] | no | The skills it unlocks, by id. |
| `steps` | step[] | yes | The steps, in the order the player sees them. |
| `type` | enum | no | When it can be played: `campaign` (once, the default), `daily`, `repeatable`, `instant`, `repair`, `system` or `personal`. |
| `reset` | object | no | When a `daily` quest comes back. Required on daily quests, absent elsewhere. |
| `reset.every` | enum | yes | `day` or `week`. |
| `reset.at` | string | no | The local time it comes back, `HH:MM` (default 04:00). |
| `reset.weekday` | integer | no | For a weekly reset: the day, 1 (Monday) to 7 (Sunday). |
| `repeat` | object | no | The rhythm of a `repeatable` quest. Only on repeatable quests. |
| `repeat.cooldownS` | number | no | Seconds to wait between two rounds. |
| `repeat.max` | integer | no | How many rounds at most. |
| `origin` | object | no | What a `repair` or `personal` quest was born from. Required on those. |
| `origin.kind` | enum | yes | `item`, `entity`, `probe` or `task`. |
| `origin.ref` | string | yes | Its id. |
| `origin.since` | string | no | When it started, as an ISO date. |
| `target` | string | no | The entity the quest is about, by id. |
| `expires` | string | no | When the quest leaves the game, as an ISO date. |
| `support` | support | no | Where the quest can be played. Absent: as its branch says. |

### Step

`kind` says what the step is; the other fields depend on it. A step the game does has `run`, `inputs` and `check`; a manual step says why with `human`. The [closed lists](https://docs.altasystem.ai/reference/standards/closed-lists) give every kind, the [executors](https://docs.altasystem.ai/reference/standards/executors) every `run.do`, and the [check types](https://docs.altasystem.ai/reference/standards/checks) every `check.type`.

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The step's id, unique in its quest: lowercase letters, digits and dashes. The progress is saved under `<quest uid>/<step id>`. |
| `kind` | enum | yes | What the step is: `action` (the game does it), `check` (proven by the machine), `choice`, `manual` (the player does it), `command`, `link` or `mission`. See the closed lists. |
| `title` | text | no | The step's title, as the player reads it in the quest. |
| `hint` | text | no | One line under the title: what to do, or why. |
| `ask` | text | no | The question a `choice` step asks. |
| `os` | enum[] | no | The systems the step is shown on. Absent: all. Use it for a step that differs from one system to another. |
| `arch` | enum[] | no | The processors the step is shown on (`arm64`, `x64`). Absent: all. |
| `optional` | boolean | no | An optional step does not block the quest: it is done when the required steps are. |
| `check` | object | no | The proof: a read-only check that completes the step when it passes. Its `type` comes from the closed list of check types. |
| `check.type` | enum | yes | The check type, from the closed list (bin, permission, channel, entity, world, signin…). |
| `check.tool` | enum | yes | The sign-in tool whose sign-in the player has on this machine (`signin`: claude, codex, gh, practice), read only by the tool's own status command. |
| `check.mind` | enum | yes | The mind the player is signed in to (`signin`: claude, codex) or that the agents think with (`model`: claude, codex, local). |
| `check.key` | string | yes | What was seen: a scene id, or `trailer` for the trailer of any world. |
| `check.name` | string | enum | yes | The program that must be on the machine (`bin`), or the permission the system must grant (`permission`: microphone, accessibility…). |
| `check.id` | string | enum | yes | The chat channel, e.g. `telegram` or `whatsapp`. |
| `check.state` | enum | no | What the channel must have: `configured` (it has an account, the default) or `paired` (no pairing request waits). |
| `check.service` | enum | yes | The account's service, e.g. `google`. |
| `check.scope` | enum | no | What the account must allow, e.g. `gmail` or `calendar`. |
| `check.maxAgeHours` | number | no | How recent the last backup must be, in hours (at most a year). |
| `check.restoreTested` | true | no | `true`: a restore of the backup must also have been tested. |
| `check.mode` | enum | yes | Where the world runs: `local` (the player's machine) or `hosted`. |
| `choices` | object[] | no | The options of a `choice` step. The answer is kept under `saves`. |
| `choices.id` | string | yes | The option's id: the value saved when the player picks it. |
| `choices.label` | text | no | The option as the player reads it. |
| `choices.hint` | text | no | One sentence under the label: what this option promises. |
| `choices.recommended` | boolean | no | Shows a "Recommended" tag. One option at most, never one that can be greyed. |
| `choices.host` | enum | no | Shows the option only on this host: local, hosted, hosted-free or hosted-paid. |
| `choices.off` | object | no | Shows the option greyed on this host, with its reason: it cannot be picked there. |
| `choices.off.host` | enum | yes | The host where the option is greyed. |
| `choices.off.why` | text | yes | The reason the player reads under the greyed option. |
| `choices.resources` | resources | no | What the option needs of the machine (any of cpu, memory, disk, gpu, arch): greyed where the machine has less, with a line that names what is missing. A resource the game did not measure is never refused. |
| `saves` | string | no | Where the answer is kept, `answers.<key>`: a later step reads it (`when`, `from`, `{ answer }`). |
| `cmd` | string | no | A command the player copies and runs themselves (`command` step), or one per system. |
| `open` | string | no | An `https://` page the step opens (`link` step), or one per system. |
| `when` | object | no | Show the step only when an earlier answer has a value. |
| `when.answer` | string | yes | The answer to read, `answers.<key>`. |
| `when.equals` | string | yes | The value it must have. |
| `agent` | string | no | The agent who speaks on this step, by role. Default: the quest's giver. |
| `mission` | object | no | What a `mission` step sends to an agent, and to whom. Required on a `mission` step, absent elsewhere. |
| `mission.agent` | enum | no | The agent sent: daemon (the default), architect, operator, reviewer or guardian. |
| `mission.brief` | text | yes | The instructions the agent receives, in each language (up to 4000 characters). |
| `mission.editable` | boolean | no | `true`: the player can edit the brief before sending it. |
| `mission.target` | string | no | The entity the mission is about, by id. |
| `run` | object | no | What the game does on the player's machine, after the player agrees on the plan card: an executor of the closed list and its arguments, or one per system. |
| `run.do` | enum | yes | The executor, from the closed list (e.g. `setup.daemon-name`, `channel.connect`). The game knows its exact command. |
| `run.args` | map of argValue | no | The executor's arguments: only those it declares, each a literal, `{ "input": "<id>" }` or `{ "answer": "answers.<key>" }`. |
| `inputs` | input[] | no | The form of the plan card: what the step asks the player before it runs. |
| `resources` | resources | no | What the step needs of the machine (any of cpu, memory, disk, gpu, arch), with what its executor needs: where the machine has less, the step says what is missing instead of its "Do it". |
| `human` | enum | no | Why a `manual` step stays with the player: `speak`, `approve`, `device`, `external`, `judge` or `before`. Required on manual steps since `alta.quests/0.3`. |
| `provenBy` | string | no | The id of a step of the same quest whose check also proves this one, for a step that has no proof of its own. |

### Input

A field of the plan card, asked before the step runs. See [Make a step that does it](https://docs.altasystem.ai/guides/quests/do-it-step).

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The input's id, unique in its step; `run.args` reads it with `{ "input": "<id>" }`. |
| `kind` | enum | yes | What the field takes: `text`, `choice`, `email`, `path`, `number`, `boolean` or `secret`. |
| `label` | text | yes | The field's label, in each language. |
| `hint` | text | no | One line under the field. |
| `required` | boolean | no | `false`: the player may leave it empty. Default: required. |
| `default` | string | number | boolean | no | The value the field starts with. Never on a secret. |
| `from` | string | no | Prefill the field from an earlier answer, `answers.<key>`. Never on a secret. |
| `saves` | string | no | Keep the value as an answer, `answers.<key>`, for a later step. Never on a secret. |
| `choices` | object[] | no | The options of a `choice` field. |
| `choices.id` | string | yes | The option's id: the value the field takes. |
| `choices.label` | text | no | The option as the player reads it. |
| `max` | number | no | The largest number (`number`), or the most characters (`text`: 200 by default, at most 2000). |
| `min` | number | no | The smallest number (`number`). |
| `pattern` | string | no | A regular expression a `text` value must match, anchored with `^` and `$`. |
| `must` | enum | no | For a `path`: it must `exist`, or be a `dir` or a `file`. |
| `not` | object | no | For a `text`: values the field refuses although they fit (names kept for something else), compared without case, and the sentence it says then. |
| `not.values` | string[] | yes | The refused values, 1 to 64. |
| `not.why` | text | yes | What the field says when one of them is typed, in each language: why, and what to type instead. |

### Resources

What a step or a choice needs of the machine, written like Kubernetes resources. See [What a step needs of the machine](https://docs.altasystem.ai/guides/quests/resources).

| Field | Type | Required | Description |
|---|---|---|---|
| `cpu` | number | string | no | Cores: `4`, `"4"`, or `"500m"` for half a core. |
| `memory` | number | string | no | Total memory, a quantity like Kubernetes: `"16Gi"`, `"512Mi"`, or decimal `"16G"`. |
| `disk` | number | string | no | Free space on the volume of the player's home, a quantity like `"20Gi"`. |
| `gpu` | true | no | `true`: a GPU the models can use (Apple Silicon's unified memory counts). |
| `arch` | enum[] | no | The processor families it runs on: `arm64`, `x64`. |

### Argument value

| Field | Type | Required | Description |
|---|---|---|---|
| `input` | string | yes | The id of an input of this step. |
| `answer` | string | yes | An answer saved by an earlier step, `answers.<key>`. |

### Act

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | integer | yes | The act's number. |
| `title` | text | no | The act's title. |
| `sub` | text | no | A subtitle. |
| `level` | integer | no | The level the player must have reached to open it. |
| `optional` | boolean | no | `true`: the act does not block the story when its quests cannot be played here. |

### Skill

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The skill's id. |
| `title` | text | no | The skill's name. |
| `desc` | text | no | What it lets the player do. |
| `agent` | string | no | The agent it belongs to, by role. |
| `after` | string | no | The id of the skill that comes before it. |

### Branch

A whole branch, in a game file or a store item.

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The branch's id; quest uids start with it. Ids that start with `_` are reserved for the game. |
| `version` | string | no | The branch's version. |
| `title` | text | no | The branch's title. |
| `summary` | text | no | What the branch is about. |
| `why` | text | no | Why a player would take it. |
| `acts` | act[] | no | Its acts. |
| `skills` | skill[] | no | Its skills. |
| `quests` | quest[] | no | Its quests. |
| `item` | string | no | The chart that brought it, by id. |
| `generated` | boolean | no | `true`: made by the game, not written in a file. |
| `support` | support | no | Where the branch can be played; a quest may narrow it. |

### Game file

| Field | Type | Required | Description |
|---|---|---|---|
| `schema` | enum | yes | The standard: `alta.game/0.3` (0.2 and 0.1 are still read). |
| `langs` | enum[] | no | The languages of the texts: `en`, `fr`. |
| `branches` | branch[] | yes | The branches of the game. |

## Rules and errors

Each rule `alta lint` applies to quests, with its section on the [errors page](https://docs.altasystem.ai/reference/errors#standard-quests).

## Full example

<details class="alta-full-example">
<summary>A pack with a check step, a choice, a command and a daily quest</summary>

```json [quests.json]
{
  "schema": "alta.quests/0.2",
  "branch": "core",
  "skills": [
    {
      "id": "core.tidy",
      "title": { "en": "Tidy machine", "fr": "Machine rangée" },
      "agent": "guardian"
    }
  ],
  "quests": [
    {
      "id": "tidy-downloads",
      "uid": "core.tidy-downloads",
      "act": 2,
      "giver": "guardian",
      "title": {
        "en": "Tidy the downloads",
        "fr": "Range les téléchargements"
      },
      "summary": {
        "en": "Choose a rule for old downloads and let it run each week.",
        "fr": "Choisis une règle pour les vieux téléchargements et laisse-la tourner chaque semaine."
      },
      "requires": ["core.backup"],
      "reward": { "xp": 50, "skills": ["core.tidy"] },
      "support": {
        "platforms": [
          { "os": "macos", "min": "14" },
          { "os": "linux" }
        ],
        "hosted": "limited",
        "notes": {
          "linux": {
            "en": "In a hosted world there is no downloads folder to tidy.",
            "fr": "Dans un monde hébergé, il n'y a pas de dossier de téléchargements à ranger."
          }
        }
      },
      "steps": [
        {
          "id": "rule",
          "kind": "choice",
          "title": {
            "en": "What happens to downloads older than 30 days?",
            "fr": "Que deviennent les téléchargements de plus de 30 jours ?"
          },
          "choices": [
            {
              "id": "archive",
              "label": {
                "en": "Move them to an archive folder",
                "fr": "Les ranger dans un dossier d'archives"
              }
            },
            {
              "id": "ask",
              "label": {
                "en": "Ask me each week",
                "fr": "Me demander chaque semaine"
              }
            }
          ],
          "saves": "answers.tidy.rule"
        },
        {
          "id": "archive-folder",
          "kind": "check",
          "title": {
            "en": "The archive folder exists",
            "fr": "Le dossier d'archives existe"
          },
          "when": {
            "answer": "answers.tidy.rule",
            "equals": "archive"
          },
          "check": {
            "type": "file",
            "path": "~/Downloads/Archive"
          }
        },
        {
          "id": "read-more",
          "kind": "link",
          "title": {
            "en": "Read how the rule works",
            "fr": "Lis comment marche la règle"
          },
          "open": {
            "macos": "https://docs.example.org/tidy/macos",
            "linux": "https://docs.example.org/tidy/linux"
          },
          "optional": true
        },
        {
          "id": "weekly",
          "kind": "action",
          "title": {
            "en": "Turn on the weekly tidy",
            "fr": "Active le rangement hebdomadaire"
          },
          "run": {
            "macos": {
              "do": "automation.enable",
              "args": {
                "key": "tidy-downloads"
              }
            },
            "linux": {
              "do": "automation.enable",
              "args": {
                "key": "tidy-downloads"
              }
            }
          },
          "check": {
            "type": "automation",
            "key": "tidy-downloads",
            "enabled": true
          }
        }
      ]
    }
  ]
}
```

</details>

## Versions

| Version | What it adds | Read by the game |
|---|---|---|
| `alta.quests/0.3`, `alta.game/0.3` | Steps that do it: `inputs`, secrets, `human`, `provenBy`; a manual step must say why | current |
| `alta.quests/0.2`, `alta.game/0.2` | Quest types and cycles (`daily`, `repeatable`…), `run`, `support`, per-system steps | yes, as written |
| `alta.game/0.1` | Branches, acts, quests and steps | yes, as written |

A file declares its version in `schema`; a field of a later version in an earlier file is refused ([`game.v3-field`](https://docs.altasystem.ai/reference/errors#game-v3-field)).

## Guides that use it

- [Create a quest pack](https://docs.altasystem.ai/guides/quests/create-pack)
- [Prove a step with a check](https://docs.altasystem.ai/guides/quests/prove-with-checks)
- [Make a step that does it](https://docs.altasystem.ai/guides/quests/do-it-step)
- [Daily and repeatable quests](https://docs.altasystem.ai/guides/quests/daily-repeatable)
