Skip to content

Make a step that does it ​

You write a step with a Do it button: the game asks the player what it needs, shows what will run, runs it once they agree, and checks on its own that it worked. "I did it" stays only on what the player alone can do.

Before you begin 15 minutes

  1. Ask for what the step needs

    inputs is the form of the plan card. Each input has an id, a kind (text, choice, email, path, number, boolean, secret) and a label in each language. saves keeps the answer, so a later step can prefill it with from.

    The game checks every value twice, in the page and on the player's own server, with the same rules as alta lint.

    my-pack/do-it.json
    json
    [
      {
        "id": "name",
        "kind": "text",
        "max": 40,
        "label": { "en": "Its name", "fr": "Son nom" },
        "saves": "answers.do-it.name"
      }
    ]

    examples/quest-pack/do-it.fragment.json#/quests/0/steps/0/inputs

  2. Hand it to an executor

    run.do names an executor of the closed list: each one is a fixed command the game knows, never a command written in your file. run.args gives its arguments: a literal, { "input": "<id>" } for a value of the form, or { "answer": "answers.<key>" } for an answer already given.

    The player sees the plan card (what runs, what it changes, how to undo it) and says yes. Nothing runs before that.

    my-pack/do-it.json
    json
    { "do": "setup.daemon-name", "args": { "name": { "input": "name" } } }

    examples/quest-pack/do-it.fragment.json#/quests/0/steps/0/run

  3. Prove it with a check

    The step is done when its check passes, never when the run ends. A check only reads the machine: here, that the main agent has a name. Pick one in the check types.

    my-pack/do-it.json
    json
    {
      "id": "name",
      "kind": "action",
      "title": {
        "en": "Give your helper a name",
        "fr": "Donne un nom à ton assistant"
      },
      "inputs": [
        {
          "id": "name",
          "kind": "text",
          "max": 40,
          "label": { "en": "Its name", "fr": "Son nom" },
          "saves": "answers.do-it.name"
        }
      ],
      "run": {
        "do": "setup.daemon-name",
        "args": { "name": { "input": "name" } }
      },
      "check": { "type": "identity" }
    }

    examples/quest-pack/do-it.fragment.json#/quests/0/steps/0

  4. Ask for a secret, safely

    A token, a key or a one-time code is a secret input: a password field, sent once to the player's own machine, then straight to the program. It has no default, from, saves or pattern, and it only feeds an argument the executor declares secret, such as token of channel.connect. Never write a key in your file: alta lint refuses it.

    my-pack/do-it.json
    json
    {
      "id": "connect",
      "kind": "action",
      "title": { "en": "Connect Telegram", "fr": "Branche Telegram" },
      "inputs": [
        {
          "id": "token",
          "kind": "secret",
          "label": { "en": "The bot's token", "fr": "Le jeton du bot" },
          "hint": {
            "en": "Pasted once, sent to your machine only, never kept by the game.",
            "fr": "Collé une fois, envoyé à ta machine seulement, jamais gardé par le jeu."
          }
        }
      ],
      "run": {
        "do": "channel.connect",
        "args": { "channel": "telegram", "token": { "input": "token" } }
      },
      "check": { "type": "channel", "id": "telegram" }
    }

    examples/quest-pack/do-it.fragment.json#/quests/0/steps/2

  5. Leave the player only what is theirs

    Some steps need the player: speaking, approving a system window, another device, another site. Such a step is manual and says why, with human. The game still helps: a run that changes nothing opens the right pane, and a check proves the result, so "I did it" disappears. With no proof of its own, provenBy names the step whose proof covers it.

    my-pack/do-it.json
    json
    {
      "id": "microphone",
      "kind": "manual",
      "human": "approve",
      "os": ["macos"],
      "title": { "en": "Allow the microphone", "fr": "Autorise le micro" },
      "run": { "do": "mac.open-pane", "args": { "pane": "microphone" } },
      "check": { "type": "permission", "name": "microphone" }
    }

    examples/quest-pack/do-it.fragment.json#/quests/1/steps/0

    my-pack/do-it.json
    json
    {
      "id": "bot",
      "kind": "manual",
      "human": "external",
      "title": {
        "en": "Create a bot with BotFather",
        "fr": "Crée un bot avec BotFather"
      },
      "hint": {
        "en": "In Telegram, write /newbot to @BotFather. It answers with a token.",
        "fr": "Dans Telegram, écris /newbot à @BotFather. Il répond avec un jeton."
      },
      "provenBy": "connect"
    }

    examples/quest-pack/do-it.fragment.json#/quests/0/steps/1

  6. Put it in your pack and check it

    Save the complete example as my-pack/do-it.json, next to quests.json, and check the folder. Every file of the folder is checked.

    my-pack/do-it.json
    json
    {
      "schema": "alta.quests/0.3",
      "branch": "core",
      "quests": [
        {
          "id": "do-it-chat",
          "uid": "core.do-it.chat",
          "act": 2,
          "giver": "operator",
          "title": {
            "en": "Talk from your phone",
            "fr": "Parle-lui depuis ton téléphone"
          },
          "summary": {
            "en": "The game names your helper, connects Telegram and approves the pairing. You only do what is yours.",
            "fr": "Le jeu nomme ton assistant, branche Telegram et accepte l'appairage. Tu ne fais que ce qui est à toi."
          },
          "reward": { "xp": 60 },
          "steps": [
            {
              "id": "name",
              "kind": "action",
              "title": {
                "en": "Give your helper a name",
                "fr": "Donne un nom à ton assistant"
              },
              "inputs": [
                {
                  "id": "name",
                  "kind": "text",
                  "max": 40,
                  "label": {
                    "en": "Its name",
                    "fr": "Son nom"
                  },
                  "saves": "answers.do-it.name"
                }
              ],
              "run": {
                "do": "setup.daemon-name",
                "args": { "name": { "input": "name" } }
              },
              "check": { "type": "identity" }
            },
            {
              "id": "bot",
              "kind": "manual",
              "human": "external",
              "title": {
                "en": "Create a bot with BotFather",
                "fr": "Crée un bot avec BotFather"
              },
              "hint": {
                "en": "In Telegram, write /newbot to @BotFather. It answers with a token.",
                "fr": "Dans Telegram, écris /newbot à @BotFather. Il répond avec un jeton."
              },
              "provenBy": "connect"
            },
            {
              "id": "connect",
              "kind": "action",
              "title": {
                "en": "Connect Telegram",
                "fr": "Branche Telegram"
              },
              "inputs": [
                {
                  "id": "token",
                  "kind": "secret",
                  "label": {
                    "en": "The bot's token",
                    "fr": "Le jeton du bot"
                  },
                  "hint": {
                    "en": "Pasted once, sent to your machine only, never kept by the game.",
                    "fr": "Collé une fois, envoyé à ta machine seulement, jamais gardé par le jeu."
                  }
                }
              ],
              "run": {
                "do": "channel.connect",
                "args": {
                  "channel": "telegram",
                  "token": { "input": "token" }
                }
              },
              "check": { "type": "channel", "id": "telegram" }
            },
            {
              "id": "pair",
              "kind": "action",
              "title": {
                "en": "Approve your phone",
                "fr": "Accepte ton téléphone"
              },
              "inputs": [
                {
                  "id": "code",
                  "kind": "text",
                  "max": 16,
                  "pattern": "^[A-Za-z0-9-]{1,16}$",
                  "label": {
                    "en": "The code the bot sent you",
                    "fr": "Le code que le bot t'a envoyé"
                  }
                }
              ],
              "run": {
                "do": "channel.pair-approve",
                "args": {
                  "channel": "telegram",
                  "code": { "input": "code" }
                }
              },
              "check": {
                "type": "channel",
                "id": "telegram",
                "state": "paired"
              }
            },
            {
              "id": "hello",
              "kind": "manual",
              "human": "device",
              "title": {
                "en": "Say hello from your phone",
                "fr": "Dis bonjour depuis ton téléphone"
              },
              "provenBy": "pair"
            }
          ]
        },
        {
          "id": "do-it-voice",
          "uid": "core.do-it.voice",
          "act": 2,
          "giver": "daemon",
          "title": {
            "en": "Let it hear you",
            "fr": "Laisse-le t'entendre"
          },
          "summary": {
            "en": "The microphone is yours to allow; the language is set by the game.",
            "fr": "Le micro, c'est à toi de l'autoriser ; la langue, le jeu la règle."
          },
          "requires": ["core.do-it.chat"],
          "reward": { "xp": 40 },
          "steps": [
            {
              "id": "microphone",
              "kind": "manual",
              "human": "approve",
              "os": ["macos"],
              "title": {
                "en": "Allow the microphone",
                "fr": "Autorise le micro"
              },
              "run": {
                "do": "mac.open-pane",
                "args": { "pane": "microphone" }
              },
              "check": {
                "type": "permission",
                "name": "microphone"
              }
            },
            {
              "id": "language",
              "kind": "action",
              "title": {
                "en": "Choose the language it listens for",
                "fr": "Choisis la langue qu'il écoute"
              },
              "inputs": [
                {
                  "id": "locale",
                  "kind": "choice",
                  "label": {
                    "en": "Language",
                    "fr": "Langue"
                  },
                  "default": "en-US",
                  "choices": [
                    {
                      "id": "en-US",
                      "label": {
                        "en": "English",
                        "fr": "Anglais"
                      }
                    },
                    {
                      "id": "fr-FR",
                      "label": {
                        "en": "French",
                        "fr": "Français"
                      }
                    }
                  ]
                }
              ],
              "run": {
                "do": "openclaw.config-set",
                "args": {
                  "path": "talk.speechLocale",
                  "value": { "input": "locale" }
                }
              },
              "check": {
                "type": "config",
                "path": "talk.speechLocale"
              }
            }
          ]
        }
      ]
    }

    examples/quest-pack/do-it.fragment.json

    Terminal
    sh
    alta lint my-pack
    Output
    text
    ok   my-pack/do-it.json (quests)
    ok   my-pack/quests.json (quests)
    2 checked, 0 errors, 0 warnings
  7. Read what alta lint says

    Add "saves": "answers.do-it.token" to the secret input and check again. Under the rule, step.input-secret, alta lint says which case it is (detail), where (in), and what this file can write instead (hint).

    Terminal
    sh
    alta lint my-pack
    Output
    text
    FAIL my-pack/do-it.json (quests)
         error: quests[0].steps[2].inputs[0]: A secret stays between the player and their machine: never prefilled, kept, shown or written in a file, and it only feeds an argument the executor declares secret. [step.input-secret]
           in: quest core.do-it.chat, step connect
           detail: input token: a secret has no saves (it is never prefilled, kept or shown)
           hint: remove "saves" from this input: the player types a secret each time, and the program keeps it in its own store
           fix: Remove default, from, saves and pattern from a secret input, bind it to the executor's secret argument, and never write a key or a token in the file.
           docs: https://docs.os.altasystem.ai/reference/errors#step-input-secret
    ok   my-pack/quests.json (quests)
    2 checked, 1 error, 0 warnings

Try it

alta dev my-pack

Open the address it prints, then the quest Talk from your phone: each step that does it shows Do it. In the demo, the card shows what would run; nothing runs on your machine.

Demo: nothing is written on your machine.

Pitfalls ​

DoAvoid
One executor per step, and a check that proves its resultA step that is done when the run ends
human on every manual step, with a helper and a proof when there is one"I did it" on something the machine could do
A secret input for every key, token or codeA key in run.args, or a secret saved for later
os on a step whose executor runs on one systemA macOS-only helper offered on Linux

An executor runs only if the owner started the game with its capability (for example --allow-setup), and some do not run in a hosted world: the card then says why, in words.

Go further ​

What's next

Alta OS is open source (MIT).