on this page ▾
[ SPECIFICATIONS ] OBJECT MODEL

Object model (format version 1)#

Source of truth: packages/core/src/rvc_core/canonical.py and objects.py.

Identity#

Kind Stored bytes Object id
Blob (file content, logs, record indexes) the raw bytes sha256(raw bytes) — equal to sha256sum file
Structured object canonical JSON envelope {"payload": {...}, "schema_version": N, "type": "<type>"} sha256(envelope bytes)

Ids are 64 lowercase hex characters. A structured object and a blob can never collide unless their bytes are identical, in which case they are the same object.

Canonical JSON#

  1. UTF-8; object keys sorted by code point; separators , and :; no insignificant whitespace.
  2. Non-ASCII characters are written literally; all strings and keys are NFC-normalized.
  3. Integers in decimal; floats in shortest round-trip form (Python repr); -0.0 → 0.0.
  4. NaN / ±Infinity are rejected. Allowed types: object, array, string, number, boolean, null.
  5. Readers re-serialize and compare: bytes that are not canonical are rejected (CorruptObject). This guarantees one logical object ↔ one id across implementations.

Object types and payloads#

All timestamps are UTC YYYY-MM-DDTHH:MM:SSZ. Unknown keys are rejected (strict schemas).

manifest#

{"entries": [
  {"path": "data/test.jsonl", "kind": "file", "blob": "<id>", "size": 1234, "mode": "f"},
  {"path": "ckpt/model.bin", "kind": "external", "uri": "s3://…", "digest": "sha256:…", "size": 9}
]}
Entries are strictly sorted by path; paths are normalized POSIX, relative, never contain .., never start inside .rvc/ or .git/. mode is f or x (executable). External entries reference bytes that are not stored; digest must be <algo>:<value>.

commit#

parents (ordered, 0 = root, ≥2 = merge), manifest, graph_snapshot, author{name,email}, created_at, message, code_refs (Git commits of the working tree at commit time), artifact_versions and experiment_refs (entity versions introduced by this commit relative to its first parent; derivable, recorded for convenience). Branch names never appear in a commit.

entity (one immutable version of a research entity)#

entity_id (<type>:<slug>, stable across versions), entity_type, version (1-based), previous (id of the prior version or null), created_at, author, data (type-specific JSON). Any key in data named blob or ending in _blob references a stored object and is followed by reachability (gc/fsck/sync).

edge#

type (see graph spec), source{entity,version}, target{entity,version} (versions pin the exact entity versions the relationship was declared against), created_at, origin (declared | inferred | system), created_by, evidence[], review_status (accepted | proposed | rejected), confidence, model, prompt_version, note. Inferred edges must name the model or heuristic that produced them.

graph (snapshot)#

{"nodes": {entity_id: entity_version_id}, "edges": {edge_key: edge_id}} where edge_key = "<TYPE>|<source entity>|<target entity>".

tag, release, annotation#

Annotated tag: name, target, target_type, message, created_at, author. Release: name, kind, commit, created_at, author, message, manuscripts[{entity,version,root,files}], runs, datasets, figures, tables, code_refs, graph_snapshot, reproducibility. Annotation (AI output, never part of history unless a researcher commits it): subject, kind, content, generator, model, prompt_version, input_hash, created_at.

Reachability#

references() in objects.py defines the edges of the object DAG used by fsck, gc, push and fetch: commit → parents, manifest, graph, introduced versions; manifest → blobs; graph → entity versions, edges; entity → previous version + *_blob fields; edge → pinned versions; tag/release → target commit (+ graph).

Versioning#

schema_version is per object; core.format_version in .rvc/config.toml is per repository. A reader refuses repositories with a newer format version. Changing any canonical rule or schema requires a new schema version and an explicit migration (see CLAUDE.md invariants).

docs/protocol/object-model.md