# World folders

A world folder is one OnlyWorlds world stored as plain JSON files: one file for the world, one per element. A text editor opens it, a copy backs it up, and any tool reads it with no account, key or network. Under git, each commit is a point in the world's history and a branch is a what-if; element ids stay the same on every branch.

## Layout

```text
moppetopia/
  world.json                 the world
  elements/
    character/
      admiral-fluffington--295f8866.json
    location/
    ...                      one folder per element type present, lowercase singular
  media/                     optional; reserved for a world's media files, no shared format yet
  records/                   optional; world data that is not elements, one folder per producer
    RECORDS.json             the manifest: one entry per producer
  .atlas/                    a tool's private state; never needed to read the world
```

**One file per element.** A world folder is plain JSON: `world.json` and one file for each element, in a folder for its element type.

The example world, Hyperion:

```text
hyperion/
  world.json                       the world
  elements/
    ability/                       1 file
    character/                     3 files
      mr-steinway--678bd862.json
      rachmaninov--4c0d52b4.json
      the-consul--8b711e25.json
    collective/                    1 file
    construct/                     3 files
    creature/                      2 files
    event/                         2 files
    institution/                   1 file
    language/                      1 file
    location/                      1 file
    map/                           1 file
    marker/                        6 files
    narrative/                     4 files
    object/                        3 files
    phenomenon/                    1 file
    pin/                           1 file
    species/                       1 file
    title/                         1 file
    trait/                         1 file
    zone/                          1 file
```

How a file gets its name, three of its elements:

- **Mr. Steinway**, id `068e92dc-10ec-7225-8000-7efd678bd862`: `mr-steinway--678bd862.json`
- **The Consul’s Steinway**, id `068e2e56-d4b9-7c40-8000-173975bfd994`: `the-consul-s-steinway--75bfd994.json`
- **Pack of Bellowing Saurians**, id `068e92dd-ce97-79b4-8000-90a11218fc88`: `pack-of-bellowing-saurians--1218fc88.json`

The name with its accents removed, in lowercase ASCII, each run of other characters one hyphen and no hyphen at either end, cut to 40 characters with any hyphen left at the end removed; then `--`; then the id's last 8 code points. The id inside the file is the identity: rename a file and nothing breaks.

*Generated from Hyperion, the public example world in schema-dist (serial 150, `example/hyperion`), when the docs are built: 35 element files in 19 of the 22 element type folders, every file named by the rule from its element's name and id. An element type with no elements has no folder.*

A folder holds one world. All 22 element types, `map`, `pin`, `zone` and `marker` included, live under `elements/<type>/`. A missing element type folder means no elements of that element type.

The `id` inside a file is the element's identity, written in lowercase as onlyworlds.com serves it: inside a world two ids are the same id only when they are written the same ([the same id](/docs/schema/profiles/addresses#the-same-id)). The filename is for people: rename a file and nothing breaks. The recommended name is `<slug>--<tail>.json`. The slug is the name in Unicode's NFKD form with the combining marks U+0300 to U+036F dropped, and no other mark (José becomes jose), then lowercased, each run of characters outside `a` to `z` and `0` to `9` as one hyphen (an apostrophe included: The Consul’s Steinway becomes the-consul-s-steinway) and no hyphen at either end, cut to 40 characters with any hyphen left at the end removed. The tail is the id's last 8 code points, with two rules for short ids and dashes below. An element with no usable name gets `<id>.json`.

Counting code points, a character such as an emoji counts as one and is never cut in half. An id of eight code points or fewer is its own tail, dashes and all. When the last eight code points of a longer id begin with `-` or hold `--`, the tail is cut instead from the id with every `-` removed: the last eight code points of what is left, or all of it when eight or fewer are left. For an element named Bob:

| id | file |
|---|---|
| `a1234567😀` | `bob--1234567😀.json` |
| `a😀1234567` | `bob--😀1234567.json` |
| `ab-cd-ef-gh1` | `bob--d-ef-gh1.json` |
| `abcd-efghijk` | `bob--defghijk.json` |
| `abc--defghij` | `bob--cdefghij.json` |
| `a--b` | `bob--a--b.json` |
| `-a` | `bob---a.json` |
| `zzzza--bcdef` | `bob--zzabcdef.json` |
| `ab------cdef` | `bob--abcdef.json` |

## world.json

Two keys are required: `id` (a non-empty string) and `name` (a string, which may be empty here, though onlyworlds.com refuses an empty name on a write). The rest are optional.

| Key | Holds |
| :--- | :--- |
| `description`, `image_url`, timeline fields, `length_unit`, `mass_unit`, `distance_unit` | As on [Worlds](/docs/schema/worlds). The unit keys have the same spelling on disk and on the wire. The current time is `time_current` on disk, the standard's name; the API calls it `time_range_current`. |
| `format_version` | The version of this format the folder was written against, currently `"0.3.26"`. Written only when the folder is created. |
| `producer` | Which tool made the folder and from what: `{"tool", "version", "input"}`. `tool` is the name the tool publishes under (`@onlyworlds/sdk`, `onlyworlds`, `atlas`, `keel`, `ow-folder-store`, or a converter's repository name); `input` is one word from a closed list: `server` (an export from onlyworlds.com), `bare` (a world born empty in a tool), `azgaar-map`, `worldanvil-export`, `foundry-world`, `obsidian-vault`, `text` (a parse from prose or notes), `json` (loose JSON of unknown origin), `notion-export` (a Notion export, Markdown and CSV), `legendkeeper-export` (a LegendKeeper export file, `.json` or `.lk`), `legendkeeper-api` (a LegendKeeper project read through its API), `kanka-export` (a Kanka JSON export), `campfire-export` (a Campfire web export, the html; since v0.3.18). Written once, by the writer that makes the folder; a tool that copies, snapshots or rewrites a folder keeps the line as it found it and never invents one. Absent is the honest value for a hand-made folder or one made before this row. A reader never refuses a folder on an `input` word it does not know. Since v0.3.14 (2026-10-22). |
| `source` | Where the folder came from: `{"server", "world", "at"}`, the server's address, the world's id there and when it was exported. Written by a tool that exports from a server; absent on a folder made by hand. |
| `exported_as` | Which part of the world this is: `{"kind", "role", "character"}`, with `kind` `owner` (the whole world), `member` (a co-builder's or contributor's view), `character` (what one Character knows, with its `{id, name}`) or `public`. A tool that cannot tell writes none. A tool that pushes refuses to push a `character` or `public` folder as the whole world. |
| `origin` | Where the world first came from: `{"source", "producer"}`, the two lines above as the tool that first made the world from a folder gave them, kept by the server. A server's own export (the owner's download, the nightly file) writes it beside the export's own `source` and `producer`, which describe this export. Keep it as you would any world key; never derive one. Absent when the server knows none, or on a folder no server wrote (since v0.3.16; onlyworlds.com serves it since 2026-10-23). |
| `api` | The link to a world on onlyworlds.com (`world_id`, `api_key`). Present: the folder syncs with it. Absent: a local world. |
| `snapshot_*`, `writable` | Only on a [snapshot](#snapshots) |

```json
{
  "id": "0695db52-5433-7332-8000-db7fe10da375",
  "name": "Moppetopia",
  "time_basic_unit": "Year",
  "time_range_min": 0,
  "time_range_max": 500,
  "time_current": 453
}
```

## Element files

An element file must hold a non-empty string `id`. The rest are the element type's [fields](/docs/schema/fields), link fields under bare names holding an id or a list of ids, as in the API. A list names each element once: a reader served a list that names one element twice reads it once, in its first place, and a writer that builds a list builds it so. Trimmed:

```json
{
  "id": "0695db83-afd7-76ee-8000-00f4295f8866",
  "name": "Admiral Fluffington",
  "location": "0695db83-972a-74da-8000-262f1559a7f1",
  "rivals": ["0695db83-b69a-772b-8000-557e9ba0dcc3"]
}
```

A reader fills in `type` from the folder name unless the file declares one. A file declares its type with a `type` exactly equal to one of the 22 type slugs as the standard spells them (`location`); anything else there (another case such as `Location`, an unknown word, a number, `null`) declares nothing, and the folder name fills it. A file that declares one type and sits in another type's folder is read as it declares. A file without an `id` is skipped and left as it is. Tools may add their own fields under a prefix (`atlas_*`, `x_*`). An element file carries no `world` key: a writer adds none, and a reader gives one no meaning, since the folder is the world (a reader that keeps a file's bytes still writes an unedited file back as it found it). An element named in prose is `[Label](ow://<type>/<id>)`. Map coordinates run from the bottom left, y upward.

## Folders and onlyworlds.com

- **Linked**: a folder with an `api` block is that account world on disk. To find the server's world, read `api.world_id` first and fall back to `id` (older folders can differ).
- **Account to folder**: let [Atlas](/docs/tools/atlas) download the world (a linked folder), export it with the Python package's `export_world` or the Unity SDK's `OWFolderExport`, or by script read [changes](/docs/development/api/changes) from the start until `has_more` is false and write `world.json` from `GET /api/v2/world`, renaming `time_range_current` to `time_current`.
- **Folder to account**: Atlas can take a local folder online. Or send the files to an empty world through [`/bulk`](/docs/development/api/writes#bulk), stripping `local_updated_at`, `server_updated_at`, `image_media_id`, `created_at`, `updated_at`, `created_by`, `type` and `change_seq`, and renaming `map_id` to `map`, `zone_id` to `zone`. An element's `hidden: true` can go as it is: a `/bulk` item that creates takes it from the owner's or a co-builder's key and [creates the element hidden](/docs/development/api/hidden#creating-an-element-hidden).
- **A draft**: a world no account holds yet is a world folder, or a world file's content, kept wherever the tool keeps things, with no `api` block and no `source`. Each element keeps the id the tool gave it for good: going online sends every element with its id, and a host that cannot take an id refuses the whole hand-over rather than minting another. So an . A writer that cannot read the manifest leaves nothing out by guess: it refuses, or the caller asks. The set carries the case on both sides from serial 49 (85 archives then).
- **Hidden elements**: `hidden: true` in an element file means the source hid it, and it stays hidden. Every writer keeps the key as it is. A tool that opens your own folder shows the element with the word hidden; a reader that hands the world on (a pack, a context packet, a share) leaves it out unless asked, and says how many it left out. A push sends the mark with the create, so the element is never published bare; a mark added to a file later goes online as a hide from the owner's or a co-builder's key (a contributor's or guest's key cannot hide online, so its tool keeps the element local and says so), and a mark removed from a file never unhides the element online. A world file keeps the mark by default; a share made with `includeHidden: false` leaves those elements out whole and counts them.

## Snapshots

A snapshot is a frozen copy of a world at one moment, such as a chapter's end.

| Key | Holds |
| :--- | :--- |
| `snapshot_of` | The source world's id |
| `snapshot_label` | A label, such as `"ch05"` |
| `snapshot_at` | Capture time (ISO 8601) |
| `snapshot_change_seq` | The source's change cursor at capture |
| `snapshot_counts` | Optional: how many files were written per element type, a convenience count. If it and the files disagree, trust the files. |
| `snapshot_torn` | `true` only on a capture known to be inconsistent |
| `writable` | `false`. Advisory: a tool may still write. The Unity SDK opens such a folder read-only and refuses to sync into it; Atlas opens it view only (since 1.90.0). |

The writer mints a fresh world id and keeps every element id; a re-capture under the same label keeps the snapshot's id. It copies `name` exactly and every `world.json` key the source had, keeps `change_seq`, `created_at`, `updated_at` and `type` as received, and writes no `.<tool>/` folder. If the change cursor moved during the walk it fails, or on an explicit override sets `snapshot_torn: true`.

## Who reads and writes folders

| Tool | With folders |
| :--- | :--- |
| [Atlas](/docs/tools/atlas) | Reference implementation; stores every world as a folder. Folder mode needs a Chromium browser. Worlds sit inside `onlyworlds-atlas/<name>-<id-prefix>/`: point other tools at the world's own folder. |
| [Obsidian plugin](/docs/tools/obsidian-plugin) | Exports a world as a folder; imports a folder into notes |
| [Toolkit](/docs/development/toolkit) | Reads a folder in place of the API; import writes new ones; carry packs a folder into an `.owworld` file and back and converts other apps' exports into one |
| [Python package](/docs/development/python) | Reads and writes folders (`read_folder`, `write_folder`); `export_world` writes an account world as a folder; exports a folder to an OKF bundle |
| [Unity SDK](/docs/development/unity) | Reads a folder, or a whole folder zipped as one `.owworld` file, into a world cache; writes elements, and exports an account world as a folder |
| [Azgaar converter](https://github.com/OnlyWorlds/azgaar-converter) | Azgaar map in, as a folder |
| [Foundry converter](https://github.com/OnlyWorlds/foundry-converter) | Folder out, to Foundry VTT |

### Known-of elements

A guest's or player's export can hold elements its Character only [knows of](/docs/development/api/members#known-of): stubs marked `known_of: true`. A stub on disk keeps `known_of`, the keys a stub always keeps (`id`, `type`, `name`, `description`, `supertype`, `subtype`, `image_url`, `created_at`, `updated_at`, `change_seq`) and every other field it was served with a value, such as a Character's public fields; its unset fields are left out, never written as empty values. A reader treats such a file as known of, never whole: a missing field is unknown, not empty. A writer never pushes it. When the element later arrives whole, it is written whole and `known_of` goes. The other way round, a whole element arriving as a stub (the reader lost a grant) follows the reset that brought it: after a `view` reset the stub replaces the whole copy, since what the reader may see narrowed; after a `role` reset, or with no reset at all (a folder handed over, another server), a tool that merges into an existing folder keeps the whole copy as last known. keel's own feed always narrows a view with a `view` reset ([What a reset keeps](/docs/development/api/changes#what-a-reset-keeps)).

### A list trimmed for its reader

A body the server trimmed for a key that may not see every linked element carries `x_served_trimmed` where a lost id would change what the body means: on a message, naming `characters` or `narrator`, and on a lens, naming an anchor field. Any other link simply leaves the id out. A file keeps the mark exactly as served, beside the trimmed field, as it keeps `known_of`. A reader reads a field the mark names as trimmed, never as empty: a message's empty `characters` with the mark is to someone the reader cannot see, never to everyone. A writer never sends the mark up: a push strips it from what it sends, never from the file (since v0.3.19).

## Rules for tools

**Reading**

- MUST read every `*.json` in an element type folder and key on the inner `id`; MUST NOT parse filenames. SHOULD skip a dot-prefixed file there: it is a tool's litter, not an element.
- MUST treat a missing element type folder as empty, and MUST NOT require any `.<tool>/` folder.
- MUST leave out an element file in which an object or array sits more than 200 levels deep (the file's top object is level 1), name it with the reason `too_deep` where the reader names the files it left out, and read the rest of the world. Count the depth in the file's text as each object or array opens, so every value of a key written twice counts and an empty object or array counts too; a bracket inside a string opens nothing. A file at 200 is read whole. `world.json` is counted the same way, and one past 200 is a `world.json` the reader cannot read (since schema-dist serial 148).
- SHOULD also read `spatial/{map,pin,zone,marker}/` (older Atlas), those four as written and nothing else under `spatial/`. An id found in both layouts: serve the `elements/` copy, and SHOULD log the duplicate.
- Read the three fixed names, `world.json`, `elements/` and `spatial/`, as written. A folder that holds one of them only in another case (`Elements/` and no `elements/`, `World.JSON` and no `world.json`) MUST NOT be read as a world with no elements: refuse it, naming the folder as written and the name the format wants (in an archive, the cause `name_case`).
- Visit the files of a layout by name, compared by code point, the same on every platform. An id found twice within one layout keeps the first file in that order. Never use the system's own path sort: on Windows it ignores case, so two readers would keep different files.
- Accept both spellings: `map`/`map_id`, `zone`/`zone_id`, `time_current`/`time_range_current`.
- MUST NOT rewrite a file's key spellings as a side effect of opening it.
- A tool holding several worlds MUST key storage by source and world id, never world id alone.

**Writing**

- UTF-8 without BOM, LF endings, 2-space indent, one trailing newline, keys in received order (never sorted), `1` not `1.0`.
- Write new elements under `elements/<type>/`, never `spatial/`; an element read from a file is written back to that file, so one id never sits in both layouts. SHOULD omit empty element type folders.
- MUST NOT write an element whose `<id>.json` is not one file name the [archive](#folders-and-onlyworldscom)'s name check passes, whatever the element's name: a name that is not well-formed Unicode (one holding half of a surrogate pair, which no archive name can carry), a name holding `<`, `>`, `:`, `"`, `|`, `?`, `*` or a control character (U+0000 to U+001F, U+007F to U+009F), one that ends in a dot or a space, or one whose part before its first dot is, in any letter case, `CON`, `PRN`, `AUX`, `NUL`, `COM1` to `COM9` or `LPT1` to `LPT9`. The name checked ends in `.json`, so no id is refused for ending in a dot or a space. An element whose id is empty, holds `/` or a backslash, or is `.` or `..` is never written.
- Two elements of one type whose file names are one name once folded: the one whose id comes first in code point order keeps its name, and each later one uses the full id in place of the tail, `<slug>--<id>.json`. The fold is NFC as Unicode 15.1 has it, then simple case folding by the C and S rows of Unicode's `CaseFolding-15.1.0.txt`, never a runtime's own: the fold an archive's names are compared by. When two or more still fold alike after that renaming, none of them is written. The id check comes first, each element alone; names are made among the elements that pass it.
- A writer that meets an element it does not write either leaves it out and writes the rest, or writes nothing, and names the id it reports, or the ids of the pair (in a folder with several such elements, not every one need be named). [schema-dist](https://github.com/OnlyWorlds/schema-dist) holds the cases in `fixtures/folder-writer/`: a writer passes a written case when it writes exactly the paths the case gives, and a refused case when it writes no file for the ids the case names and names those ids, in words of its own (since schema-dist serial 150).
- An id, once minted, MUST be kept and MUST NOT be re-derived (from a new name, say).
- MUST NOT invent data it lacks, such as timestamps, nor drop data it has. A [known-of](#known-of-elements) stub is written with its kept keys and served values only, and never pushed.
- MUST preserve unknown fields and MUST NOT change another tool's prefixed field at any depth: copy it through byte for byte.
- `format_version` only when creating a folder. MUST NOT create or edit a `.gitignore` in a folder it did not create (in your own repo, `.*/` keeps every tool folder out).
- One writer per folder at a time; never write into another tool's `.<tool>/`.
- In a linked folder, every changed element file MUST get `local_updated_at` set to now (UTC, ISO 8601), `server_updated_at` left alone; otherwise Atlas never sends the edit. New files carry neither.

**Checking a folder**

[schema-dist](https://github.com/OnlyWorlds/schema-dist) has a checker: `python walk/lint_folder.py path/to/world`, with Python 3 and PyYAML. It runs from a copy of the whole repository, since it imports `schema_walk.py` and reads `schema/` beside it: make a fresh one in a scratch directory (`git clone --depth 1 https://github.com/OnlyWorlds/schema-dist`, about 6 MB, or the repository's zip without git), never a copy another project left on the disk, which can be an older serial. It names every key that is not a field of its type, every link that does not resolve or points at the wrong type, and every value of the wrong shape. Server keys, the folder's own keys and prefixed fields pass. Its last line is the count it checked, and it exits 1 when it finds a problem. An element file nested more than 200 levels deep is not read, reason `too_deep`, and a `world.json` that deep is a problem; the check counts the depth in the text itself, so the verdict is the same on every Python (since schema-dist serial 148). A file with a number longer than the Python running it converts is not read either, and a newer Python may read it. Each file not read gets one line saying so, and the check goes on; it exits 3 when nothing it read has a problem but a file was not read (since schema-dist serial 146). It names the folder format version it knows, and a `world.json` whose `format_version` is newer gets one warning line, never counted as a problem (since schema-dist serial 61): update the lint, or read the spec for what changed. Since serial 115 it reads the two [review marks](/docs/schema/profiles#review), `x_review_proposed` and `x_review_checked`, as warnings that never fail a folder: a mark that is not an object, and each key an object mark lacks. A link to an element the folder does not hold (a partial download, say) is reported, and is true. It also reports a `world.json` that carries an `api` block while git tracks it: a linked folder is never committed, so a world kept in a shared repository is the portable copy and the key stays outside it. The same checker comes inside the [Python package](/docs/development/python#check-a-world) since 0.51.0: `pip install onlyworlds`, then `python -m onlyworlds.lint path/to/world`, with no YAML library and no copy of the repository.