Project Format
The on-disk layout of a Mode 8 project, mode8.toml keys, asset files, sidecar keys, layers and journal.
A Mode 8 project is a plain directory you can commit to git: a config file, one folder per asset, and a hidden journal that makes every edit undoable for humans and agents alike. This page is the exact format; the ideas behind it are in Projects.
Note
This page is generated from mode8 schema --section project and a scratch project by docs/manual/_tools/gen_reference.py. To change it, change Mode 8 (or the prose in the generator) and run the generator with --write; a test fails when this page is out of date.
Layout#
my-game/
mode8.toml project config
palettes/ project palettes (<name>.gpl)
assets/<name>/ one directory per asset
exports/<name>/ Studio exports (created on first export)
.mode8/ journal, snapshots, local-only candidatesCreate one with mode8 init:
mode8 init my-gamemode8.toml#
Project format version: 1. A fresh mode8 init my-game writes:
name = "my-game"
version = 1
default_palette = "nes_crimson_hero"
default_size = [64, 72]
comfy_url = "http://127.0.0.1:8188"| Key | Meaning |
|---|---|
name | Project name (default: the directory name). |
version | Project format version; a version newer than this Mode 8's format_version is refused (ProjectVersionError). |
default_palette | Palette new assets use: a bundled palette name, a palette file path or a project palettes/<name>.gpl name (default: nes_crimson_hero). |
default_size | Default new-asset size [width, height] (default: [64, 72]). |
comfy_url | ComfyUI server URL. Used when neither --comfy-url (the comfy_url argument) nor the COMFY_URL environment variable is set (default: http://127.0.0.1:8188). |
comfy_start | Opt-in command that (re)starts ComfyUI when a generation finds it dead or unreachable (run once per generation, then the render is retried). MODE8_COMFY_START overrides it; unset (the default), Mode 8 never starts a server. |
Important
A mode8.toml whose version is newer than format_version (or not a positive integer) raises ProjectVersionError; a missing version means the current format. Never raise or lower version by hand to get past this error: upgrade Mode 8 instead.
Asset files#
Each asset lives in assets/<name>/:
| File | Meaning |
|---|---|
master.png | Canonical RGBA sprite (always equals the flattened layer stack). |
master.m8.json | Provenance sidecar (see sidecar.keys). |
draft.png | Optional 1x pose draft. |
parts.png | Optional indexed part map. |
pins.png | Optional pin mask (alpha >= 128 = hand-painted, pinned). |
rig.json | Optional custom rig spec. |
layers/layers.json | Optional layer stack {"version": 1, "layers": [...]} plus layers/<file>.png. |
frames/<frame>.png | Derived rig output (overrides composed in). |
overrides/<frame>.png | Sparse per-frame hand edits (alpha 0 inherit, 1 erase, >= 2 paint). |
boxes.json | Optional hand-edited gameplay boxes {"schema": "mode8.boxes/1", "body"?, "frames": {frame: {"hurtbox"?, "hitbox"?}}} (absent = computed, null = none) that mode8 export ASSET and Studio exports apply over the computed boxes. |
The sidecar#
assets/<name>/master.m8.json records where the master came from. Its schema key is mode8.asset/1. Keys are core (always written), optional (written when they apply) or bookkeeping (maintained by Mode 8):
| Key | Kind | Meaning |
|---|---|---|
schema | core | Sidecar schema id ('mode8.asset/1'). |
name | core | Asset name (the assets/<name>/ directory). |
size | core | Master size [width, height] in pixels. |
palette | core | Palette name or path the asset is locked to (or null). |
prompt | core | Generation prompt of the accepted master (or null). |
preset | core | Generation preset of the accepted master (or null). |
seed | core | Generation seed of the accepted master (or null). |
draft | core | Draft file name relative to the asset ('draft.png') or null. |
lint | core | Last recorded lint report (or null). |
input_hashes | core | SHA-256 of the inputs the master was derived from. |
created_at | core | ISO-8601 UTC creation time. |
sha256 | bookkeeping | SHA-256 of master.png when the sidecar was written. |
updated_at | bookkeeping | ISO-8601 UTC time of the last sidecar write. |
art_type | optional | Art-type profile (sprite, portrait, icon, ...). |
archetype | optional | Draft archetype the asset was started from. |
facing | optional | Sprite facing, 'left' or 'right'. |
parts_legend | optional | Legend of the indexed parts.png part map. |
frames | optional | Derived rig frames record {rig, generated_at, generated_by, input_hashes, files} plus, when written by an animate (Studio / starters), {animations, facing, parts_rig, rig_sha256} and custom (frames made in Studio that a re-rig keeps); animations {anim: {frames, fps, loop, durations?}} (durations: per-frame ticks of fps, stored when one is not 1) is what Studio and mode8 export export with. |
overrides | optional | Per-frame sparse override records {frame: {base_sha256, sha256, pixels, ...}}. |
ui | optional | UI-kit piece {kind, style, state, margins, content, min_size}. |
source | optional | Origin of the asset, e.g. 'import'. |
import | optional | Import record {source_type, source_file, frame_count, master_frame, fps, ...}. |
starter | optional | Starter template that scaffolded the asset. |
tile_kind | optional | Tile generator kind the master was made from (starters). |
tile_size | optional | Size [w, h] the tile generator drew the master at (starters). |
tile_variant | optional | Variant index the tile generator drew the master with (starters). |
starter_art | optional | Id of the curated generated master (mode8/starter_art manifest) a starter asset was made from, e.g. 'platformer_hero'. |
contour | optional | Material ramp a terrain tile's contour was recolored from, instead of #000000 (starters). |
job | optional | Studio generation job of the accepted master {job_id, kind, index}. |
The frames record has the keys rig, generated_at, generated_by, input_hashes, files, animations, facing, parts_rig, rig_sha256, custom.
Layer stack#
A layered asset keeps assets/<name>/layers/layers.json (format version 1, at most 32 layers) plus one PNG per layer next to it. Layers are listed bottom to top. After create_asset and one add_layer, it looks like this:
{
"layers": [
{
"file": "base.png",
"id": "base",
"name": "Base",
"opacity": 255,
"visible": true
},
{
"file": "layer-1.png",
"id": "layer-1",
"name": "Shading",
"opacity": 255,
"visible": true
}
],
"version": 1
}master.png always equals the flattened visible layers, so tools that only understand flat sprites keep working. Layers are covered in Layers and History.
Journal and snapshots#
.mode8/history.jsonl: one JSON line per operation (who, what, which files, before and after SHA-256). Undo and redo work from it and the snapshots..mode8/snapshots/<sha256>.<ext>: content-addressed copies of every file version the journal refers to.- Actors recorded in the journal:
human,agent,cli. .mode8/.gitignorekeeps local-only state out of git:
# retained generation candidates are local-only
candidates/
lockThe easiest way to read the journal is a history report: mode8_project_history (MCP), GET /api/assets/{name}/history (Studio) or Mode8Project.history_report (Python). Write to a project only through Mode 8, so every change stays journaled and undoable.
See also#
- Projects for how the pieces fit together.
- Layers and History for undo, redo and conflict detection.
- Python API for
Mode8Project.