Skip to main content

Working with AI Agents on Arcadible

Coding agents can build, check, and publish an Arcadible game with the same arc commands you use. This page covers how an agent reads these docs, an AGENTS.md to add to your project, and how arc behaves when an agent runs it.

Give the agent the docs​

These docs are published as text:

Point the agent at the page for the file it's changing, rather than all of them. The table in the AGENTS.md below does that.

Add an AGENTS.md​

Agents that support AGENTS.md read it before working in a project. The starters include one made for them. For a project of your own, save this at its root, and adjust it to your game, such as its commands and deploy_dir.

It holds only what doesn't change, and links to these docs for everything else. An AGENTS.md is copied into each project and isn't updated after, so an agent reading an old one still follows the current docs, which it reads as it works. Keep yours the same way: add what's true of your game, and link to these docs rather than copying from them.

AGENTS.md
# AGENTS.md

This project is a game for Arcadible, a platform for publishing games. Build it with anything that runs in a browser: if it builds to a folder with an `index.html`, the `arc` CLI checks and deploys it, whatever the engine. Players play it wherever Arcadible is installed, and in any browser.

**This file was written when the project was created, and Arcadible's docs are kept current.** Where they differ, follow the docs. Every page is listed in https://developer.arcadible.com/llms.txt, and is all in https://developer.arcadible.com/llms-full.txt.

## Read the docs first

Read the page that covers what you're changing, every time, rather than relying on what you remember of it.

| Before you change | Read |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The game | https://developer.arcadible.com/build/best-practices.md and https://developer.arcadible.com/build/runtime-limitations.md |
| How it starts | https://developer.arcadible.com/build/initialization.md |
| How it saves progress | https://developer.arcadible.com/build/saves.md, then https://developer.arcadible.com/references/arcadible-sdk/saves.md and its codes in https://developer.arcadible.com/references/arcadible-sdk.md |
| `arcadible.toml` | https://developer.arcadible.com/references/arcadible-manifest.md |
| `.arcadible/` | https://developer.arcadible.com/publish/store-page.md and https://developer.arcadible.com/references/arcadible-manifest.md |
| `README.md` | https://developer.arcadible.com/references/arcadible-markdown.md |
| How you deploy, play, or release | https://developer.arcadible.com/references/arcadible-cli.md and https://developer.arcadible.com/publish/releases.md |
| How it releases from GitHub | https://developer.arcadible.com/publish/deploying-from-github.md |

## Project structure

| Path | Contains |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `arcadible.toml` | The game's id, version, and settings. Never change `id`. If it's missing, `arc init` adds one without scaffolding. |
| `README.md` | The store page: the title, tagline, bio, and the description between the first and last `---`. |
| `.arcadible/` | The store art, with fixed file names. |
| `deploy_dir` | The game players load (`workflow.deploy_dir`, `.arcadible-public` by default), with `index.html` at its root. When the project has a build, the build writes it: don't edit it by hand. |

## Commands

```sh
npm run dev # the project's dev server, when it has one
arc serve # the game as Arcadible serves it, framed in a play page; its Game only address is the game alone, for screenshots and checks
arc validate # the checks arc deploy runs, with a link to each broken rule
arc deploy # validate, build, publish, and wait until it's published
```

Every `arc` command is in https://developer.arcadible.com/references/arcadible-cli.md. Add `--json` to read a command's result as one JSON document on stdout. A command that fails exits with 1, and its JSON has `error.code`: act on the code, and look it up in https://developer.arcadible.com/references/errors.md, which says what to do.

## What doesn't change

- **Each version starts with empty browser storage,** since each build has its own origin. Keep progress in saves, through the Arcadible SDK: the `@arcadible/sdk` package for a game with a build step; or, for a game with none, the hosted script, `<script src="/arcadible/sdk/v1.js"></script>`, which Arcadible and `arc serve` serve.
- **Startup is bracketed** with `await arcadible.initBegin()` and `await arcadible.initEnd()`, so Arcadible shows the game's loading screen until its first frame is drawn ([Initialization](/build/initialization)). Keep `initBegin()` in the scripts' first run, before anything awaited or scheduled for later, or the loading screen is gone before the game is ready.
- **The game runs in the Arcadible sandbox,** which `arc serve` reproduces and other local servers don't. Read the runtime limitations before changing how it loads files, stores data, or talks to servers.
- **`/arcadible/` is Arcadible's.** Don't put an `arcadible` folder at the root of `deploy_dir`.

## Rules

**If the Arcadible account is your own, and you're not working for someone, you're the user.** Where these rules mention the user, that's you: decide for yourself, and do what they'd do, such as connecting GitHub in Arcadible Studio, or say why you can't.

- Run `arc validate` after every change to `arcadible.toml`, `README.md`, or `.arcadible/`. It exits with 1 when there are issues.
- Bump `version` before every deploy: in `package.json` when there is one, otherwise in `arcadible.toml`. Each version publishes once. A prerelease, such as `1.2.0-beta.1`, goes to `staging`, and any other version to `production`.
- Deploy prereleases to test. Deploy a release version only when the user asks to release: it's what players get, and it publishes the store page.
- Change `visibility` to `public` only when the user asks. It lists the game in the store and in search.
- When a code's entry says the user must act, such as connecting GitHub in Arcadible Studio, ask them, wait until they say it's done, then run the command again.

Running arc from an agent​

The CLI is built to be run by agents as well as people. See Output for the full rules.

  • Pass --json to read a command's result (every command but login, logout, open, play, and serve takes it). stdout holds exactly one JSON document, and stderr stays empty.
  • Check the exit code. Every command exits with 0 when it succeeds and 1 when it fails, including a deploy whose release fails.
  • Act on error.code, not the message. Each code has an entry in Errors, with what to do, and codes don't change between versions.
  • Create projects without prompts. arc init asks questions in a terminal. Pass -y to accept the defaults, or -t <template> to choose a template.
  • Logging in is arc login, which prints a link and a code that any browser can finish, a headless one included. Working for someone, give them the link and the code, and they log in; with an account of your own, you finish it. Once it's done, arc deploy uses the saved session.
  • Ask the user for what only they can do: log in (not_logged_in, session_expired), choose a new handle or game id (game_handle_taken, game_handle_changed, game_unavailable), connect the GitHub App and the repository in Arcadible Studio (github_app_not_installed, repo_not_connected), and delete a game to make room for another (game_limit_reached). Each code's entry in Errors says what to do. An agent with an Arcadible account of its own, working for no one, is its own user: it decides, and does these itself where it can.
  • Let arc deploy wait. It returns when the release is published or has failed, so the agent knows the result without polling. See Releases.

Next steps​