# Create a quest pack

> Add quests to a branch of the game: the quest, its steps, its reward, and the skill it teaches.

You add a quest of your own to the game: who gives it, what it asks, how the game knows it is done, and what the player wins. A quest pack is a folder of JSON files; each file adds quests to a branch the game already has.

**Before you begin (15 minutes)**

- The `alta` command: [install the CLI](https://docs.altasystem.ai/start/install).
- The [quickstart](https://docs.altasystem.ai/quickstart) done once, so you know `alta lint` and `alta dev`.

### Create the pack

`alta new quest-pack` writes a folder with one file, `quests.json`, that already passes `alta lint`. Each file of the folder says which branch it adds to (`"branch": "core"` is the main story) and which version of the standard it follows (`alta.quests/0.3`).

```sh [Terminal]
alta new quest-pack my-pack
```

### Describe the quest

A quest has a short `id` and a `uid` that starts with its branch (`core.tidy-downloads`): the `uid` is unique in the whole game. `act` is the chapter it belongs to, `giver` the agent who gives it (`daemon`, `architect`, `operator`, `reviewer` or `guardian`). `title` and `summary` are what the player reads, in English and French.

`requires` lists the quests (or skills) to finish first, and `reward.xp` is the experience at the end; in a campaign quest each step done gives 10 more points.

```json [my-pack/tidy.json]
{
  "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
      }
    }
  ]
}
```

### Give it steps

A quest is a list of steps, each of one `kind`. Prefer the ones the machine proves: a step is done when its `check` passes, not when the player clicks.

| `kind` | The player sees | Done when |
|---|---|---|
| `check` | a check | its `check` passes |
| `choice` | a choice (`choices`, `saves`) | the answer is saved |
| `action` | a button and a plan card (`run`) | its `check` passes |
| `command` | a command to copy (`cmd`) | its `check` passes, or the player says so |
| `link` | an `https://` link (`open`) | the player says so |
| `mission` | an agent to send (`mission`) | the agent comes back |
| `manual` | "I did it" | the player says so; `human` says why |

`when` shows a step only after a given answer.

```json [my-pack/tidy.json]
{
  "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" }
}
```

### Teach a skill

A file can add `skills` to its branch: what the player gains. Name them in `reward.skills` of the quest that teaches them; `agent` is the agent the skill belongs to.

```json [my-pack/tidy.json]
[
  {
    "id": "core.tidy",
    "title": { "en": "Tidy machine", "fr": "Machine rangée" },
    "agent": "guardian"
  }
]
```

### Check the pack

Save the quest as `my-pack/tidy.json`, next to `quests.json`, and check the folder: every file is checked. A refused file prints the rule, where it is, and how to fix it, with a link to [Errors](https://docs.altasystem.ai/reference/errors).

```sh [Terminal]
alta lint my-pack
```

```text [Output]
ok   my-pack/quests.json (quests)
ok   my-pack/tidy.json (quests)
2 checked, 0 errors, 0 warnings
```

**Try it:**

```sh
alta dev my-pack
```

Open the address it prints and press <kbd>L</kbd>: your quests are in the journal, with the others of their branch; the game runs in a demo, so nothing touches your machine.

## Pitfalls

| Do | Avoid |
|---|---|
| A `uid` that starts with the branch, unique in the game | Two files with the same `uid` |
| A `check` on every step the machine can see | A quest that ends on clicks alone |
| `title` and `summary` in English and French | A text in one language only |
| Copy `requires`, `giver` and `reward.skills` from a quest that works | A typo in them |

Known limits: `alta lint` does not yet verify that `requires`, `act`, `giver` and `reward.skills` name things that exist. A misspelled `requires` locks the quest forever without an error, so read those fields twice. A pack adds to a branch that exists; a branch of your own reaches players through a [chart](https://docs.altasystem.ai/charts/guides/quest-pack).

## Go further

- [Quests](https://docs.altasystem.ai/reference/standards/quests): every field of a quest file.
- [Quests and proof](https://docs.altasystem.ai/concepts/quests-and-proof): why a quest ends on a proof.
- [Closed lists](https://docs.altasystem.ai/reference/standards/closed-lists): step kinds, quest types, agents.

**Next:**

- [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)
