# For AI coding agents

> How AI coding agents work with Envy - the AI handoff package, the event and data contract, the JSON Schema, the CLI, llms.txt and Markdown docs.

Source: https://envyui.com/docs/agents

Envy is built so a coding agent can wire a UI into a game without guessing. This page is for people who work with agents, and for the agents themselves.

## If you are an agent

1. Read `AGENTS.md` in the handoff package first. It lists the files, the rules, the integration steps for Godot and the web, and the acceptance checklist.
2. **Load the document with the runtime. Never rebuild screens by hand.** The `.envy.json` file is the UI.
3. Your job is the integration: set data with `set_data` / `setData`, and handle the events in `contract.json`.
4. Check your work against `screens/` (one render per screen, and per scenario).
5. If you edit the document, validate it: `node tools/envy.mjs validate <file>`. The JSON Schema is in `schema/envy.schema.json`.

## What agents get

| Source | Use it for |
|---|---|
| [AI handoff package](/docs/handoff) | Everything for one UI: instructions, contract, renders, typed code, runtime, schema, CLI |
| `contract.json` | Every event (and the layer that emits it) and every data path (type, sample, where it's used) |
| [CLI](/docs/cli) | `validate`, `describe`, `contract`, `prompt`, `handoff`, `schema` |
| [/llms.txt](/llms.txt) | An index of these docs for language models |
| [/llms-full.txt](/llms-full.txt) | All docs in one plain-text file |
| `/docs/<page>.md` | Each docs page as Markdown, for example [/docs/data.md](/docs/data.md) |

## Coming next

<span class="tag-planned">Planned</span> An **MCP server** so agents read and edit documents through tools (read an outline, get a node, patch it with validation, add a screen, list the contract, render a screen) instead of editing raw JSON. You review each change in Envy before it lands.
