# Golden Codex 1.2.0: the rules a schema file cannot hold

This text and the three files in `schemas/` form the standard together. `build.py` and `image_soulmark.py` are reference implementations of every rule here. The vectors in `tests/` let a second implementation check itself against the same results.

**The schema is the mark and the message in the bottle.** The mark is the Soulmark: the fingerprint that identifies this record and this image. The message is the Soul whisper: what the maker wanted to say.

## 1. One record, three tiers

- **Full record** (`full.schema.json`): the canon. This is the only tier written directly; every smaller tier is generated from it.
- **Label** (`label.schema.json`): what a reader can take from a file without making a second request.
- **Pointer** (`pointer.schema.json`): for thumbnails and anything small. It points to a Golden Codex record and carries the work's title. It may carry the Soulmark of the image it travels with and a hint of where to fetch the record, and for an AI-made work it carries the disclosure. It says nothing else about the work.

A label or pointer is issued only from an existing full record. A smaller tier carries fewer statements than the full record, never stronger statements and never unsourced ones.

## 2. Rights

Establishing rights is the main purpose of a record. A record states the rights its author chooses to state, and none if the author states none.

- **The author's own rights.** The author of a work may declare their rights in it, in their own name and their own words: a copyright notice, a rights status, a licence they grant.
- **Rights reported by others.** Rights stated by anyone else, such as a museum or a rights holder, are carried as that named source reports them.
- **Who holds which right.** `rights.grants` lists rights one at a time: which right (ownership, copyright, trade, curation, custody, control, display, reproduction, commercial use, modification, AI training, AI inference, data mining), in what (the work, the image file, or the record itself), held by whom, granted by whom, on what basis, from when and until when, and on what conditions. Rights are separate. An owner and a curator can both exist for the same record: one party may hold the right to trade while a museum holds the right to curate.
- **A predetermined fee.** A grant may state a fee for exercising the right and where it is paid: an amount, a currency, per use or per period, and a payment address. A grant that states a fee names who grants the right. This is how a maker states the terms on which their work may be used to train a model. A payment address is only as good as the record's source: confirm who issued the record before paying.
- **Someone always stands behind it.** Every rights statement and every grant names its basis. One with nobody behind it is refused.
- **An indication, not a proof.** A record shows what was declared, by whom and when. Like a title deed, it is strong evidence and can still be wrong or false; it does not by itself prove that the declarer holds the right.
- **The issuer gains nothing by issuing.** Writing, keeping or inscribing a record gives its issuer no right in the image. Any right an issuer holds is stated as a grant, like anyone else's.

## 3. Canonical bytes and the record's Soulmark

- **Canonical bytes** of a record: its JSON in UTF-8, with object keys sorted at every level by their UTF-16 code units (the order RFC 8785 requires; it differs from code-point order only for characters above U+FFFF), no insignificant whitespace, characters outside ASCII written as themselves, and every number written as a whole number without fraction or exponent. A number with a zero fraction, such as 1.0, is the whole number 1 and is written `1`. Minus zero is written `0`. A number with a non-zero fraction has no canonical form, and a record holding one is refused. For these records, this is the same as RFC 8785.
- **The record's Soulmark**: `sha256-` followed by the SHA-256 of the canonical bytes in base64url without padding (43 characters). It is computed from the record and never stored inside the record it fingerprints. A pointer or label carries this value as `record`.
- `tests/vectors.json` gives the canonical bytes and Soulmark of every example.

## 4. The image's Soulmark

The image's Soulmark is SHA-256, written in the same form, over everything in the file that determines how the picture is drawn and nothing that is descriptive metadata. Embedding or removing a record, caption or content credential in the places such things are written (listed below) does not change it; changing the picture, or how it is rendered, does.

- **JPEG.** Two parts, in order. (a) Before the first scan: each segment after the start-of-image marker, in order, leaving out only the descriptive ones: comment segments (FFFE), APP1 (FFE1: Exif and XMP), APP11 (FFEB: content credentials) and APP13 (FFED: IPTC and Photoshop data). Every other segment is covered, including APP0 (pixel aspect ratio), APP2 (colour profile) and APP14 (colour transform). Fill bytes between these segments are skipped. (b) From the first start-of-scan marker to the end-of-image marker inclusive: every byte exactly as it stands in the file. Quantisation and Huffman tables, the frame header, restart intervals, scan headers and entropy-coded data are therefore all covered.
- **PNG.** In file order: the type and data of every chunk except the descriptive ones (tEXt, zTXt, iTXt, eXIf, tIME, and caBX for content credentials) and IEND, with the data of all IDAT chunks joined as one stream, preceded once by the four bytes `IDAT` (the IDAT chunks must be consecutive, as PNG requires; a file where they are not is refused). Chunk lengths and CRCs are not covered. Colour chunks, animation chunks and chunks an implementation does not recognise are all covered.
- **Not covered:** the orientation flag and any thumbnail (both live in Exif, which is metadata) and all text metadata. A reader that rotates an image by its orientation flag is showing something the Soulmark does not vouch for.
- **Malformed files.** A file with no image data, or one that cannot be read as a strict sequence of segments (JPEG) or chunks (PNG), including a JPEG in which a marker other than a restart marker appears inside scan data without a well-formed segment after it, that is cut off, whose declared lengths run past its end, or (PNG) whose chunk fails its checksum has no Soulmark: an implementation refuses it. Bytes after the end-of-image marker (JPEG) or the IEND chunk (PNG) are not part of the picture and are not covered.
- **Other formats** (WebP, AVIF, TIFF, HEIF): not defined in 1.2.0. A record for such a file carries the Soulmark of a JPEG or PNG rendition, or waits for the rule.
- `image_soulmark.py` is the reference implementation. `tests/images/` holds four test images, their values and the checks that were run.

The full record's `binding.image` is the Soulmark of the image the record describes. `binding.renditions` lists the Soulmarks of other files of the same picture that the record vouches for: a thumbnail, a web copy, another format.

## 5. Generating and resolving the small tiers

- **Generate.** `project()` in `build.py` is the rule. "How it was made" uses the IPTC Digital Source Type terms in force on 2026-11-23 (retired terms are refused), the two further terms C2PA defines (`empty`, `trainedAlgorithmicData`), or `not_determined`. A label carries one maker credit, including its qualifier (such as "attributed to" or "workshop of"). A maker's credit is a credit for the original work whose role, lower-cased, is one of: artist, creator, author, maker, painter, photographer, sculptor, illustrator, designer, printmaker, draughtsman, prompt author. With more than one such maker, or none, the label carries no credit. A maker held as a private reference is not shown. The rights status carried is for the thing in hand: first the file, then the reproduction, then the work. If the record holds statements about that thing that disagree, the label carries no status and the reader goes to the full record. A qualifier is one of a fixed list of cataloguers' terms, never free text. For an AI-made work, every tier carries the disclosure; no tier carries one for a work the record does not say is AI-made.
- **Resolve.** A small tier is never taken on its own word. Given a small tier and a full record, a reader:
  1. refuses the record if it does not hash to `record`;
  2. refuses the small tier if it names an image the record does not vouch for (`binding.image` or one of `binding.renditions`);
  3. fingerprints the image actually in hand, and refuses the small tier if it names a different image;
  4. regenerates the small tier and reports every field that differs, whether changed, missing or newly present.
- **The one word a reader shows.** "Refused" if any step above fails. "Matches" only when the record itself vouches for the image in hand. Otherwise "referenced": a record exists and this file points at it, and nothing more is known. A pointer on an image the record does not list is a lead, not proof. A pointer or label read on its own, without the record, cannot show whether something was removed from it, including an AI disclosure: only resolving shows that.
- **`at` is a hint, not a statement.** It is not derived from the record and is not trusted. Whatever is fetched from it is used only if it hashes to `record`.
- **Embedding.** The canonical bytes, base64-encoded; they may be gzip-compressed first when that is smaller. Compressed output is not required to be identical between writers, because compressors differ. What must be identical is the canonical bytes a reader gets back after decoding. Nothing in this standard fingerprints the embedded form.

## 6. Soul whisper

The Soul whisper is the free, unstructured, poetic or personal addition to an otherwise structured record. A human artist or artist persona may write it, and the record says which (`voice`) and who (`by`). It is either public text or a keyed commitment to text held privately elsewhere, never both. No sender, recipient or private text is written to a record.

The structured sections are open to artists as well as to scholars, curators and machines. Every interpretive section says who wrote it, in what mode and with what degree of certainty.

## 7. Rules across fields

- A record that replaces another names it by its Soulmark, keeps every earlier identifier, states when the work was first inscribed, and carries the supersession event with who acted, what it replaced and what changed. The earlier record is never edited.
- A creator's statement is by someone the record credits.
- A living person is represented by a reference that can be erased, unless they ask to be named. Only the person themself may ask; the record carries when they asked and that they were told an inscribed name cannot be removed. Nobody names another living person. A name from the historical public record may be used. A schema cannot tell whether a name belongs to a living person: this is a rule on whoever issues the record, and an issuer who writes a living person's name as if it were historical, or as an organization, has broken it.
- A record is never edited. A changed mind, a correction or a transfer is a new record that supersedes the old one, issued by whoever holds control of the record. The earlier record remains as evidence of what was said then.
- The full record always says who made the work and how it was made. "Unknown" and "not determined" are honest answers and are written.

## 8. Extensions

Anything outside the standard goes under `extensions`, keyed by an https address its author controls. The standard does not police what an extension contains. Fields that belong to one product, and house vocabulary, go here and not into the standard's fields. A model, a tool or a persona that made or wrote something is credited by its name, as any agent is. A small tier carries no extension, no grant and no fee: those are read from the full record.
