Y2 Elite workspaces are rolling out for teams
Y2Y2Docs
Ontology & Fusion

Ledger Record Format

Fields, identifiers, seals, and validation rules for ledger format version 0.

A ledger contains one canonical JSON record per line. Keys are sorted by UTF-16 code unit. Numbers are integers, and insignificant whitespace is omitted. Every field is present. Unknown times and numbers use null. Empty string fields use "". The portable implementation is @y2/ontology.

Common fields

FieldTypeMeaning
v0Format version
seqintegerPosition in the log, starting at 1, contiguous
idstringRecord ID, with a prefix for its kind
kindsubject, designator, observation, assertionRecord kind
recorded_attimeRecord time, strictly increasing along the log
prevhex or nullPrevious line hash, or null on the first line
hashhexSHA-256 of the canonical line without hash

Times are ISO 8601 in UTC with milliseconds, exactly as Date.prototype.toISOString prints them.

Records

Subject

FieldMeaning
classperson, organization, or system. A subject never changes class.

A subject has no name. Names and identifiers arrive as designators and claims.

Designator

FieldMeaning
designator_kindSee Vocabulary
valueThe canonical string
namespacePlatform, algorithm, registry, or exchange MIC. Empty for kinds without one.
normalizedCase-folded for names and handles. Otherwise equal to value.

A ledger permits one designator per (kind, namespace, normalized). A second record with that key is rejected. The existing ID must be reused.

Observation

FieldMeaning
methodOne passive method, or analyst-note
source_gradeprimary, secondary, or analytic (only for a note)
source_urlPage URL. Required for a retrieval, optional for a note.
archive_urlA preserved copy, or null
retrieved_atRetrieval time, or null on a note
content_hashSHA-256 of excerpt, or of an archived blob when archive_url is set
excerptA quote of 1–500 characters, or null when an archive holds the content
collectorRecording label, 1–80 characters
citesObservations cited by a note. Empty on a retrieval.

Assertion

FieldMeaning
opassert or retract
predicate, from, toThe claim. See predicates
qualifierPublic role on member-of. Otherwise "".
supersedesThe current head of the claim key, or null on the key's first line
confidenceInteger 0–100, or null on a retraction
verificationA verification state, or null on a retraction
valid_from, valid_toValid-time interval with an exclusive end. null means unknown.
evidence_refs1–20 earlier observations
noteUp to 1,000 characters of caveat

The claim key is predicate|from|to|qualifier. Each key has exactly one chain of lines.

Identifiers

Record IDs contain a kind prefix and 24 hexadecimal digest characters. The SHA-256 input combines the record type and workspace ledger position.

KindPrefixExample
Subjectsbj_sbj_0123456789abcdef01234567
Designatordsg_dsg_0123456789abcdef01234567
Observationobv_obv_0123456789abcdef01234567
Assertionclm_clm_0123456789abcdef01234567

The offline format accepts any lowercase ID with the right prefix, such as sbj_ada in the fictional fixtures.

Rules

Each rule has a code. The API returns codes in detail. The offline checker prints them per line.

CodeRule
shape.*Exact field set and field types for the kind
format.json, format.canonicalThe line is JSON in canonical form
chain.seq, chain.prev, chain.hashContiguous seq, prev links the previous hash, hash matches
chain.time, time.formatRecord time strictly increases. Times use the required format.
id.format, id.duplicatePrefix matches the kind. IDs are unique.
designator.*Canonical value, correct normalization, and one record per designator key
observation.method, observation.gradeSupported passive method. Only a note is analytic.
observation.url, observation.timeHTTP(S) URL without userinfo. Retrieval time must not exceed record time.
observation.note, observation.citesNotes cite earlier observations and have no retrieval time. Retrievals cite nothing.
observation.excerpt, observation.hash, observation.preservationExcerpt of 1–500 characters or an archive. The hash matches the excerpt unless archived.
assertion.endpointDistinct endpoints of permitted kinds. same-as and distinct-from require matching subject classes.
assertion.qualifierOnly member-of carries a lowercase role
assertion.chainFirst claim supersedes nothing. Later claims supersede the head. Consecutive retractions are rejected.
assertion.evidence1–20 distinct earlier observations
assertion.confidence, assertion.intervalInteger confidence of 0–100. valid_from precedes valid_to.
assertion.verificationThe state is one the evidence supports (see the ladder)
assertion.retractA retraction clears confidence, verification, and the interval
assertion.labelpreferred-label needs a live designated-by for the same pair

Examples

The repository supplies two valid fixtures in packages/ontology/v0/examples:

  • fictional.ndjson demonstrates corrections, retractions, and disputed identity.
  • fictional-cyber-market.ndjson demonstrates company identifiers and supplier relationships.

The local tutorial checks the company fixture and shows its expected output.