# Handoff and export

> Export an Envy game UI as a Godot package, playable HTML, the raw document or an AI handoff package with AGENTS.md, a contract, screenshots and typed code.

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

Press **Ctrl E** to export. Export checks the document first and tells you what's wrong before you send anything.

| Export | What you get |
|---|---|
| Godot package | A zip with the `envy_ui` addon, your document and a demo scene. Open it in Godot and press F6 |
| Playable HTML | One HTML file with the runtime and your document. Anyone can click through it in a browser |
| AI handoff | Everything a programmer or a coding agent needs to wire the UI into a game (below) |
| Document | The `.envy.json` file itself |
| PNG | A layer or a screen as an image |

## The AI handoff package

`<name>_handoff.zip` contains:

| File | Purpose |
|---|---|
| `AGENTS.md`, `CLAUDE.md` | Instructions for coding agents: rules, files, integration steps for Godot and the web, the full event and data contract, and an acceptance checklist |
| `PROMPT.md` | Ready-to-paste prompts for Godot and for the web |
| `SCREENS.md`, `screens/` | A layer outline of every screen (text, bindings, actions, notes) and reference renders, also one folder per scenario |
| `contract.json` | Events (with the layers that emit them), data paths (type, sample, where they're used), screens, animations and scenarios |
| `godot/<name>_ui.gd`, `godot/addons/envy_ui/` | A generated controller with typed setters and an event `match`, and the runtime |
| `web/<name>-ui.ts`, `web/envy-runtime.js` | A typed wrapper (unions of events, screens and paths) and the runtime |
| `schema/envy.schema.json`, `tools/envy.mjs` | So agents can edit the document safely and validate it |

The rule the package teaches: load the document with the runtime and never rebuild screens by hand. Game code only connects data and events.

## What the generated code looks like

For The Last Hunt, the controller has a setter per data path and a case per event:

```gdscript
## boss.hp — shown in 09 HUD · Boss fight › Boss › bar › Boss health
func set_boss_hp(value: float) -> void:
	ui.set_data("boss.hp", value)

func _on_ui_event(event: String, payload: String) -> void:
	ui_action.emit(event, payload)
	match event:
		"new_hunt":
			# From: 02 Main menu › Main menu › Items › New hunt
			pass  # TODO
```

The TypeScript wrapper turns the same contract into types, so a typo in an event name is a compile error.

## Without the editor

The [CLI](/docs/cli) writes the same text files from a document: `node tools/envy.mjs handoff ui.envy.json out/`.

## Notes for implementers

Any layer can carry **notes**: what it's for, how it should behave, edge cases. They're included in SCREENS.md and AGENTS.md, so intent travels with the design.
