Manual Reference

On this page
  1. Layout
  2. mode8.toml
  3. Asset files
  4. The sidecar
  5. Layer stack
  6. Journal and snapshots
  7. See also

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#

text
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 candidates

Create one with mode8 init:

bash
mode8 init my-game

mode8.toml#

Project format version: 1. A fresh mode8 init my-game writes:

toml
name = "my-game"
version = 1
default_palette = "nes_crimson_hero"
default_size = [64, 72]
comfy_url = "http://127.0.0.1:8188"
KeyMeaning
nameProject name (default: the directory name).
versionProject format version; a version newer than this Mode 8's format_version is refused (ProjectVersionError).
default_palettePalette new assets use: a bundled palette name, a palette file path or a project palettes/<name>.gpl name (default: nes_crimson_hero).
default_sizeDefault new-asset size [width, height] (default: [64, 72]).
comfy_urlComfyUI 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_startOpt-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>/:

FileMeaning
master.pngCanonical RGBA sprite (always equals the flattened layer stack).
master.m8.jsonProvenance sidecar (see sidecar.keys).
draft.pngOptional 1x pose draft.
parts.pngOptional indexed part map.
pins.pngOptional pin mask (alpha >= 128 = hand-painted, pinned).
rig.jsonOptional custom rig spec.
layers/layers.jsonOptional layer stack {"version": 1, "layers": [...]} plus layers/<file>.png.
frames/<frame>.pngDerived rig output (overrides composed in).
overrides/<frame>.pngSparse per-frame hand edits (alpha 0 inherit, 1 erase, >= 2 paint).
boxes.jsonOptional 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):

KeyKindMeaning
schemacoreSidecar schema id ('mode8.asset/1').
namecoreAsset name (the assets/<name>/ directory).
sizecoreMaster size [width, height] in pixels.
palettecorePalette name or path the asset is locked to (or null).
promptcoreGeneration prompt of the accepted master (or null).
presetcoreGeneration preset of the accepted master (or null).
seedcoreGeneration seed of the accepted master (or null).
draftcoreDraft file name relative to the asset ('draft.png') or null.
lintcoreLast recorded lint report (or null).
input_hashescoreSHA-256 of the inputs the master was derived from.
created_atcoreISO-8601 UTC creation time.
sha256bookkeepingSHA-256 of master.png when the sidecar was written.
updated_atbookkeepingISO-8601 UTC time of the last sidecar write.
art_typeoptionalArt-type profile (sprite, portrait, icon, ...).
archetypeoptionalDraft archetype the asset was started from.
facingoptionalSprite facing, 'left' or 'right'.
parts_legendoptionalLegend of the indexed parts.png part map.
framesoptionalDerived 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.
overridesoptionalPer-frame sparse override records {frame: {base_sha256, sha256, pixels, ...}}.
uioptionalUI-kit piece {kind, style, state, margins, content, min_size}.
sourceoptionalOrigin of the asset, e.g. 'import'.
importoptionalImport record {source_type, source_file, frame_count, master_frame, fps, ...}.
starteroptionalStarter template that scaffolded the asset.
tile_kindoptionalTile generator kind the master was made from (starters).
tile_sizeoptionalSize [w, h] the tile generator drew the master at (starters).
tile_variantoptionalVariant index the tile generator drew the master with (starters).
starter_artoptionalId of the curated generated master (mode8/starter_art manifest) a starter asset was made from, e.g. 'platformer_hero'.
contouroptionalMaterial ramp a terrain tile's contour was recolored from, instead of #000000 (starters).
joboptionalStudio 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:

json
{
  "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/.gitignore keeps local-only state out of git:
text
# retained generation candidates are local-only
candidates/
lock

The 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#