# Mission

> Missions: a quest step that sends one of the player's agents away with written instructions; every field and rule.

A mission sends one of the player's agents away with written instructions, and the step is done when the agent comes back with an answer. A mission is a step of a quest (`kind: "mission"`), so it lives in a quest pack and follows the [quest standard](https://docs.altasystem.ai/reference/standards/quests).

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

## Minimal example

One quest, one step: the operator lists the three oldest unread emails.

```json [my-mission/mission.json]
{
  "schema": "alta.quests/0.3",
  "branch": "core",
  "quests": [
    {
      "id": "minimal-errand",
      "uid": "core.minimal-errand",
      "act": 2,
      "giver": "operator",
      "title": {
        "en": "A first errand",
        "fr": "Une première course"
      },
      "reward": { "xp": 30 },
      "steps": [
        {
          "id": "send",
          "kind": "mission",
          "title": {
            "en": "Send the operator",
            "fr": "Envoie l'opérateur"
          },
          "mission": {
            "agent": "operator",
            "brief": {
              "en": "List my three oldest unread emails.",
              "fr": "Liste mes trois plus vieux mails non lus."
            }
          }
        }
      ]
    }
  ]
}
```

## Fields

### Mission

The `mission` field of a step. It is required on a `mission` step and refused on any other.

| Field | Type | Required | Description |
|---|---|---|---|
| `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. |

The agents are the five of the [closed list](https://docs.altasystem.ai/reference/standards/closed-lists#mission-agents). The instructions are sent to the agent as they are written (after the player edits them, when `editable` is true), and its answer comes back in the game. The other fields of the step (`id`, `kind`, `title`…) are those of a [step](https://docs.altasystem.ai/reference/standards/quests#step).

## Rules and errors

Each rule `alta lint` applies to a mission, with its section on the [errors page](https://docs.altasystem.ai/reference/errors#standard-mission). A mission step is also checked as a step: [`step.mission-brief`](https://docs.altasystem.ai/reference/errors#step-mission-brief), [`step.mission-kind`](https://docs.altasystem.ai/reference/errors#step-mission-kind).

## Full example

<details class="alta-full-example">
<summary>A quest whose mission is proven when the agent comes back</summary>

```json [mission.json]
{
  "schema": "alta.quests/0.2",
  "branch": "core",
  "quests": [
    {
      "id": "first-errand",
      "uid": "core.first-errand",
      "act": 1,
      "giver": "operator",
      "title": {
        "en": "Send the operator on a first errand",
        "fr": "Envoie l'opérateur en première course"
      },
      "summary": {
        "en": "Write what you want, send an agent, watch it go and come back with the answer.",
        "fr": "Écris ce que tu veux, envoie un agent, regarde-le partir et revenir avec la réponse."
      },
      "requires": ["core.mail"],
      "reward": { "xp": 40 },
      "steps": [
        {
          "id": "errand",
          "kind": "mission",
          "title": {
            "en": "Ask for today's three most important mails",
            "fr": "Demande les trois mails les plus importants du jour"
          },
          "mission": {
            "agent": "operator",
            "brief": {
              "en": "Read today's mail and tell me the three that matter most, one line each.",
              "fr": "Lis le courrier du jour et dis-moi les trois qui comptent le plus, une ligne chacun."
            },
            "editable": true,
            "target": "module:google"
          }
        },
        {
          "id": "second-opinion",
          "kind": "mission",
          "optional": true,
          "title": {
            "en": "Ask the reviewer to double-check",
            "fr": "Demande au vérificateur de revérifier"
          },
          "mission": {
            "agent": "reviewer",
            "brief": {
              "en": "Check the operator's list of important mails: did it miss anything?",
              "fr": "Vérifie la liste de mails importants de l'opérateur : a-t-il oublié quelque chose ?"
            },
            "editable": false
          }
        }
      ]
    }
  ]
}
```

</details>

## Versions

| Version | What it adds | Read by the game |
|---|---|---|
| `alta.quests/0.2` | The `mission` step | yes, and in 0.3 |

## Guides that use it

- [Send an agent on a mission](https://docs.altasystem.ai/guides/missions/send-agent)
