--- part_of: '[prov](/README.md)' --- # prov/1 — the workspace spec > How a prov workspace describes itself, precisely enough that a tool knowing > only this page can unfold it. Complements DESIGN §1 (self-description), §2 > (mechanism vs vocabulary), §3 (spanning tree), §5 (stores), §6 (reachability). A prov workspace is *self-describing*: its structure lives in the documents' own frontmatter, not in the filesystem layout or an app-private sidecar. "Self- describing" has an irreducible floor, though — a reader must share *some* convention to bootstrap. This page is that floor, kept as small as it can be. Status: pre-1.0. The `spec` marker is fixed at **1** and not yet enforced; at 1.0 the kernel below freezes and the marker becomes a compatibility contract. ## 1. The bootstrap kernel (frozen at 1.0) Given a directory, a reader that knows only these five rules can traverse any prov workspace: 1. **Find the root.** The directory's **workspace node** is a whole-file metadata document stemmed `prov` — sought at the top level, then in `config/`, then in `.config/`, the first found winning. If it carries a `root`, that names the root document and the search is over. A node is not required, and most workspaces have none. Otherwise the root is the directory's sole **root candidate** — a document that carries a metadata block (rule 2), declares no spanning-parent, and does not carry a `generated_by: prov` byline. A candidate stemmed `index` wins, then one stemmed `readme`, then a lone candidate; two or more with neither conventional stem is an error, not a guess. A candidate is a content document (Markdown, Djot, HTML), or — under the `index`/`readme` stem only — a whole-file metadata document, so that a stray `config.json` beside the root cannot pass for one. *(Invariant: the root is the reachable document with no spanning-parent **in this workspace**, and the one that declares or points at the workspace's policy (rule 3); the conventions only find it. A named root is taken at its word, because the candidate test is there to guess which document is the root and a workspace that names one has already answered — so such a root may declare a spanning parent in *another* workspace (an `id:/` reference, see [Reference styles](/docs/reference-styles.md#a-workspace-inside-a-workspace)), which is how a workspace says what contains it without ceasing to be one. The candidate test asks the coarser question and stays that way: a document carrying such a parent that no node names is not a candidate. The byline clause is what keeps generated prose (§5) out of the running: it has a root's exact shape — metadata, no spanning-parent, no id — but is derived from the root, so it can never be the root.)* 2. **Read its metadata block.** Split frontmatter from body by fence — `---` (YAML), `+++` (TOML), or `---` (`---json`, `---figl`; `---fig` still reads as figl). The block is a key→value map. 3. **Read the policy, from both homes.** Workspace policy is one vocabulary with two homes: the root's `prov:` key, and the **config document** — where the same keys sit at *top level* because the whole document is policy. The config document is reached two ways: the root names it through a top-level `config` pointer (`config: prov.yaml`), or it is the workspace node rule 1 found by convention. In the ordinary case these are the same file. Resolve per key, `named config document > workspace node > root prov: block > default`. A workspace may use either home or both, so a reader that consults only one will miss policy that is really there. Only the node is readable *before* the root is known, which is what lets rule 1's `root` exist: a directory whose root cannot be chosen can still be told which document it is. `spec` is an integer naming which version of these rules applies. A higher number than you know means you may still traverse structure (rules 4–5 are stable) but should treat unknown policy keys as opaque. **`spec` stays `1` until after prov 1.0.0.** Before then the vocabulary is still being shaped, and an incompatible change to it is recorded where prov's other breaking changes are — a `!` commit and the changelog — not in this number, so `spec: 1` on a pre-1.0 workspace names the vocabulary of the prov that wrote it rather than one fixed set of rules. From 1.0.0 on, the number is the promise: an incompatible reshape of the vocabulary bumps it, and nothing else does. 4. **Read `relations` + `spanning`** — resolved across both homes as in rule 3. These declare the graph vocabulary (§2). The default vocabulary — `contents`/`part_of` containment, spanning `contents`, and the three overlay pairs of §2 — is always the base, and each declared entry overlays it: a new name is added, a name the default has is redefined, and an entry that is the scalar `off` says the name is not a relation here. Absent ⇒ the default vocabulary unchanged. 5. **Unfold.** From the root, follow the field named by `spanning` to reach every node; each node's own block repeats the process. Non-spanning relations are the overlay graph. Everything past rule 3 is *learned from the workspace*, not known in advance — which is what lets the vocabulary vary per workspace without a foreign reader needing to know it beforehand. ## 2. Self-describing the vocabulary The relation vocabulary is declared in **either policy home** (rule 3) — shown here in the root's `prov:` block, where it nests under `prov:`; in a config document the identical keys sit at top level, with no `prov:` wrapper. Each `relations.` entry may carry structural definition keys, and one relation is named spanning: ```yaml prov: spec: 1 spanning: contents # the single-parent discovery spine (§3) relations: see_also: cardinality: many # many | one inverse: see_also # a symmetric overlay relation contents: means: "documents contained by this one" # human gloss — carried, never read cardinality: many inverse: part_of # the reciprocal field link_of: off # not a relation here — an ordinary carried field ``` **The default vocabulary is four pairs.** `contents`/`part_of` is containment and the spine. The other three are overlays, every one `many` in both directions: `links`/`link_of` is arbitrary cross-reference; `replaces`/ `replaced_by` is succession — this document supersedes that one; and `derived_from`/`derivations` is origin — this document was made from that one. Succession and derivation are claims the keeper makes, on the footing of `author` and `generated`, never a fact a reader fills in from a version-control record: a rewrite from scratch that supersedes has no byte lineage, and an edit that keeps most of the text may be a different document. They are the words Dublin Core and PROV-O already have — `replaces` is `dcterms:replaces` and `prov:wasRevisionOf`, `derived_from` is `dcterms:source` and `prov:wasDerivedFrom` — so an exporter maps them without the workspace glossing them first. A reader checks each the way it checks `links`: the target resolves or it is broken, and what the claim *means* is not the reader's to judge. **Declarations overlay the default vocabulary; they do not replace it.** The default is always the base, so `see_also` above *adds* a relation and leaves `contents`/`part_of`/`links`/`link_of` and the other two pairs where they were, `contents` *redefines* one — per field, so what the entry leaves unsaid the default's own definition answers, and glossing `contents` with a `means:` alone does not strip its inverse or reset its cardinality — and `link_of: off` retracts a name, after which a document key called `link_of` is an ordinary user field, carried and never followed. (A name the default lacks has nothing to inherit from, so its unsaid fields take the bare defaults: `many`, no inverse.) Wholesale replacement is still expressible: declare your own vocabulary and turn off the default relations you do not use. The point of the base is that extending the vocabulary by one pair costs one pair, rather than a restatement of everything you were already happy with. The five **pointer** names (`config`, `registry`, `deletions`, `history`, `about`) are read from the root regardless. Turning one off takes it out of the vocabulary a reader walks, but the root's key by that name is still how the workspace's own machinery is found (§6) — that pointer is not the vocabulary's to revoke. The same vocabulary in a config document drops the wrapper — `spec: 1`, `spanning:`, `relations:` at top level, which is where this repository's own `prov.yaml` would put them if it had any to declare. Neither form is preferred; `prov config --home ` moves policy between them without changing what it means. See [Config vocabulary](/docs/config-vocab.md) for the full key list and the precedence chain. This is a faithful serialization of the in-memory `RelationSet` (`prov/src/relation.rs`): prov reads `cardinality`, `inverse`, and `spanning`; `means` is a tier-3 gloss it carries so a *person* reading the frontmatter learns the vocabulary too. A `relations` entry may also carry reference-style keys (`notation`/`path_style`/`target`/`label`) — the two halves share one block. **The single-parent invariant (§3).** The relation named by `spanning` must have an inverse declared with `cardinality: one` — that is what makes the spine a single-parent tree with a unique root. `check` flags a spanning relation whose inverse is `cardinality: many` (`ConfigIssueKind::SpanningNotSingleParent`); multi-parent membership belongs on a *non-spanning* overlay relation, which may be many-to-many. **Graceful degradation.** A workspace that declares no `relations` uses the built-in diaryx vocabulary unchanged (`WorkspaceConfig::relation_set`), so a minimal hand-authored vault spells out nothing — and, because that vocabulary is prov's own, a reader is told what its four relations mean rather than being handed four blanks. The declaration is what a workspace adds to be legible to a foreign reader when it is *not* the default one. ## 3. Controlled vocabularies (`fields`) A frontmatter field prov merely *carries* (a bare `tags:` string) becomes a *resolvable, checked reference* the moment a `fields` entry points it at a vocabulary. This is DESIGN §2's rule — consistency is a property of resolvability — applied to file-to-term references (tags, audiences, statuses). ```yaml prov: fields: tags: values: open # folksonomy: unknown values allowed, near-misses warn vocabulary: '[Tags](/vocab/tags.yaml)' audience: values: closed # every value must be a known term (privacy-critical) vocabulary: '[Audiences](/vocab/audiences.md)' # an index whose children are the terms ``` `check` then verifies every value of that field over the reachable document set (§8): a **closed** field emits `UnknownTerm` for any value not a known term; an **open** field emits `TermNearMiss` only when an unknown value closely resembles a known one (casing/spelling drift). Both offer a repair to choose from rather than one to apply: respell the value, or widen the vocabulary to admit it. A *retired* term is never offered the second — writing a bare `term:` over it would un-retire it and destroy the `id` and `means` it carries. A field declared `type: date` is held the same way, to a parse rather than a vocabulary: a value that is neither a calendar date, an RFC 3339 instant, nor EDTF (ISO 8601-2 — `1943-05`, `1913~`, `192X`, `1918/1922`, `XXXX` for a date not known) is a `MalformedDate`, offered its EDTF spelling where the prose has one. The other declared types are carried uninterpreted. A declaration names a top-level key, a **dotted path** into a mapping — `generated.how` is the act recorded inside a `generated` mapping (see [Provenance](provenance.md) §1) — or a path through **every item of a list**: `confirmed[].by` is the actor of each confirmation, `sources[].resource` the target of each source. The steps compose, and a declaration governs every value its path reaches; a document with nothing there is held to nothing. A dot is always a separator, as it is for `prov get`. A finding names the **concrete** path — `sources[2].resource`, the declared path with the list position filled in — because that is the value it is about and the address a repair edits; the path grammar is its own address grammar. A `default:` is written at a key path and never at a list path, which has no list to fill. ### A field that holds links `fields` promotes a carried string two ways, and `values:` is only one of them. A declaration's **`type:`** says what the value *is*, and one type prov reads rather than carries: **`ref`**, a link to another document. ```yaml prov: fields: sources[].resource: type: ref ``` A field declared `ref` is a **link site**. Each value it reaches is read exactly as a relation entry is — a bare path, `[label](path)`, `[[Title]]`, `id:…`, a URL, a `#locator` — and resolved the same way (§4): censused, so the target is reached and is not an orphan; checked, so a target that is missing is `BrokenLink` at its concrete address; rewritten when the target moves, label and wrapper kept; relabelled on a retitle; reported by a delete that leaves it dangling; offered the same repairs. What it is not is a relation: it has **no inverse**, nothing is written on the target, and it is **never spanning**. The rule for choosing: *a link that stands alone is a relation; a link that sits beside other facts about itself is a path-valued field* — a citation carries its page and the date consulted, a person their role, and a relation's entry is a link and nothing else. Whether a key holds links is a fact about the vocabulary and holds workspace-wide, as a relation's name does; a `ref` declaration that also says `under:` is a config issue (`ScopedReference`), and the field is read as a link everywhere regardless. See [path-valued fields](/docs/proposals/path-valued-fields/proposal-path-valued-fields-v1.md). A declaration governs the whole workspace unless it names an index with `under:` — a link resolved by path, `id:`, or title, as a filing entry's is — and then it governs that index's spanning subtree and nothing else. A field may be declared several times, as a list, each entry scoped: `status` is one closed set of terms under `Tasks` and another under `Proposals`, and a document under neither has no `status` declaration. The index is not in its own scope. Every reader asks *where* before *what*; where scopes nest the deeper wins, and an unscoped entry in the same list is the fallback. A scope whose anchor resolves to nothing governs nothing, and `check` reports it (`FieldScopeUnresolved`). See the config vocabulary, "Scoping a declaration". ### The vocabulary file A flat vocabulary is a **whole-file config document** (§5) — a self-describing node (a `title`) declaring a `vocabulary` marker and a `terms:` mapping. Like the registry it is *machinery*, reached one-way through the field's `vocabulary` pointer, so it carries no `part_of` back-link (see §4): ```yaml # vocab/audiences.yaml title: Audiences vocabulary: field: audience values: closed terms: public: id: aud_7x2q # stable identity — the label can change, id-refs survive means: "Anyone; safe to publish" friends: id: aud_k9fp means: "People I know personally" gate: circle:friends # ← arbitrary payload: carried, never read (tier 3) archived_2024: retired: true # known but no longer valid; never silently reissued embargoed: holds: true # an export holding on this field keeps its documents home ``` prov reasons about the term *keys*, each term's `id`, `retired`, and `holds` (read only by an export whose `hold` names this field); every other key (`means`, `gate`) is tier-3 payload it transports untouched — which is how a diaryx audience hangs gate/theme config off a term prov still validates membership in. A **reified** vocabulary is instead an index node whose `contents` are term nodes — ordinary *content* containment, so each term is a real node (with `part_of`, a prose body, and backlinks); only the *flat* form is a whole-file machinery store. Which of the two a pointer names is read off the target, never declared: a document carrying the `vocabulary:` marker is a flat store, and any other document is a reified index. The declaration used to say it too (`reify: true`), and a declaration that disagreed with its store loaded no terms at all; the key is no longer read. ## 4. Link target kinds prov's graph is **homogeneous**: every node is a plaintext document with an embedded metadata block. Heterogeneity — binaries, machinery, external resources, controlled terms — never enters the graph as a node; it is *referenced* through a typed field on a real node, and the field's kind is the contract. There is no such thing as "linking a non-content file directly." The kinds: | Target | Declared as | Contract | | --- | --- | --- | | **Content node** | a relation (`contents`/`part_of`/`links`/your vocabulary) | in the graph; two-way (inverse maintained); ID-able; rewritten on move; orphan-checked | | **Machinery** | a one-way pointer relation (`registry`, `config`, `deletions`, `history`, a *flat* `fields` `vocabulary`) | plaintext, reached *from the root only*; **no inverse, no `part_of` back-link, not ID'd as content, not orphan-checked, not in the spanning tree** | | **Opaque payload** | the `content` field | *not a node* — the bytes are the body of a sidecar node (an attachment); hashed for fixity, never parsed. A body reference to the payload (`![…](photo.jpg)`) is censused **by path** — a missing picture is a broken link, and the picture is reached — and **rewritten on move** as a reference to the sidecar: the payload travels with its node, and every reference to where it was is respelled for where it is. Never nominal: a bare name in an image is a file, not a title | | **Owned payload** | a `fields` value under `type: payload` | *not a node* — an opaque file a document carries in its own metadata, one row per file, where an attachment otherwise gets a sidecar of its own. A `ref` in every respect (censused, checked, rewritten on move), and also: **moved** with its owner when the owner changes folders (a file under the owner's folder keeps its place relative to it), **deleted** with its owner, **hashed** by a `content_hash` beside the value, and **owned once** — two owners of one file is a finding. No id, no inverse, not in the spanning tree, no row in a view | | **A directory of opaque payloads** | the `manifest` field (exclusive with `content`) | *not nodes* — one node stands for the whole set through a manifest store listing every opaque file under a directory it claims completely, each row optionally hashed; the node hashes the manifest. Not in the graph, not orphan-checked, never parsed. See [Manifests](/docs/manifests.md) | | **Controlled term** | a `fields` value | resolved by term *key* against the field's vocabulary, checked (§3) — not traversed, and no more traversed when the terms are nodes (below) than when they are rows | | **Path-valued field** | a `fields` value under `type: ref` | *not a new kind* — whichever of the kinds above or below the value spells (a content node, an external URL, a locator), reached through a field prov was told holds one (§3). One-way: censused, checked, rewritten on move, orphan-checked as a target; **no inverse, never spanning** | | **Reified vocabulary** | a `fields` `vocabulary` pointer at a document with no `vocabulary:` marker — the index node, and its spanning children as terms | *ordinary content*: in the graph; two-way (inverse maintained); ID-able, and the term node's own id **is** the term's; rewritten on move; orphan-checked. Reached twice over — down the spanning tree like any node, and through the `fields` pointer, which is configuration naming content rather than a pointer to machinery | | **Generated prose** | a one-way pointer relation (`about`) | plaintext in the workspace's *content* format; reached from the root only; **no inverse, no `part_of`, no id, not in the spanning tree, not orphan-checked**; rewritten **whole** by prov and never merged; a pure function of configuration, therefore **discardable** — deleting it loses nothing | | **External** | a URL | recognized by syntax, never resolved or validated | | **A place inside a document** | a `#locator` suffix on any target | *not a target of its own* — the document part resolves normally; the locator is carried, never resolved or validated, and preserved across moves | The consequences worth stating outright: - **A non-plaintext file is wrapped, not linked.** To bring an image or PDF into the workspace, `attach` mints a sidecar (`photo.jpg.yaml`) — an ordinary content node whose `content` field names the opaque payload. The graph stays all-plaintext; the binary rides along as a node's body. A reference to the sidecar names the node; a reader *drawing* that reference — an embed, a download link — draws the payload its `content` names. - **A file that is part of a document's text needs no wrapper of its own.** A photograph dropped into a journal entry is not a record beside the entry but part of it, so the entry owns it: a `type: payload` field names the file in a row of the entry's own metadata, beside what is known about it. The rule for choosing: *a file that is part of a document's text is owned by it; a file that is a record of its own gets a sidecar.* It is §5's placement rule applied to attachments — inline until it wants its own cadence. - **At scale, the wrapper is shared.** One sidecar per file is the right shape for the file you thought about and the wrong one for the archive you dumped: ten thousand photographs would mean ten thousand documents, which no editor can browse and no sync transport carries cheaply. A `manifest` node stands for the directory instead, and the difference from a sidecar is a *claim of completeness* — the manifest names every opaque file under its root, so a file that appears or vanishes is drift prov reports. Nothing else can report it: covered files are not documents, so the orphan walk cannot see them, and not links, so the census cannot either. Files prov *can* read are deliberately not claimed, which is what keeps a manifest from ever shadowing a document. - **Opacity is declared, not inferred.** A payload is normally opaque because its extension is not one prov reads, but a sidecar may also say so outright with `attachment: true`, and that marker wins. It is how a *specimen* is carried — an example document, a fixture, a captured export, whose metadata block is an exhibit rather than a claim about this workspace (`attach --opaque`). A reader must not interpret a declared payload as a document: its links are not edges, its `title` does not answer a nominal reference, its `id` does not enter the registry. Contrast a *separated* node, whose `content` names a prose body that **is** a document in its own right: the marker is what distinguishes the two when the extension no longer can. - **A locator is not a node.** Verse 1 of a chapter is not a document, so it is not in the graph — it is a *place* named on an edge that lands on the chapter. This is what lets the reading unit and the addressing unit differ: one document per chapter, one address per verse, without minting a node for every address. The edge is real (inverse maintained, rewritten on move, orphan-checked); only the sub-document part is opaque. See [Reference styles](/docs/reference-styles.md#locators--pointing-inside-a-document). - **Machinery is reached one-way.** The root points *down* at a machine file through its typed pointer (`config: prov.yaml`); the machine file declares no back-link. It is not content — not in the containment tree, not ID'd, not orphan-checked — so a `part_of` back to the root would assert a tree membership it does not have. Its only self-description is a human `title`. - **Generated prose has machinery's shape but not its carrier.** `about.md` is reached one-way from the root, carries no `part_of` and no id, and stays out of the spanning tree — machinery in every structural respect. It is a separate kind because §5's MUST does not fit it: record stores are whole-file config documents precisely because prov re-lays-out their sorted records and prose has no stable home there, whereas this file is *entirely* prose, written in the workspace's content format. What makes that safe is the other half of the contract — prov rewrites it whole from configuration, so it is derived rather than authoritative, and a conflicted copy is regenerated rather than merged. ## 5. Where things live — placement rules Because reachability makes an inline block and a linked file *semantically identical* (both unfold from the root), where a thing lives is an ergonomic choice, never an architectural one. Two rules: - **MUST — record stores are whole-file config documents.** The id registry, the deletion log, and *flat* vocabularies are files prov re-lays-out as sorted records (DESIGN §5). Prose has no stable home there, so these must be `.yaml`/`.json`/`.figl` documents, never markdown-with-frontmatter. prov refuses a markdown carrier at load (`require_whole_file`) and `check` reports it (`MalformedStore`). The format is the file's own (its extension) — never declared beside the link. - **SHOULD — inline until it grows, churns, or wants its own cadence.** Keep small, stable, human-curated policy in the root's `prov:` block. Split a thing into its own linked file when it (1) grows unboundedly, (2) is rewritten by prov on ordinary mutations (a merge/contention hotspot), or (3) wants a different edit cadence than the root's content. A 3-term audience set with no payload stays inline; a curated vocabulary with per-term config earns a file. For *workspace policy* specifically, the choice is reversible at any time: `prov config --home root` inlines all policy into the root block and drops the sidecar; `prov config --home sidecar` moves it into `prov.yaml` and clears the block. Both homes read identically, so this only relocates bytes. ## 6. Versioning `spec` is an integer. New keys are added *additively* under the same spec until a breaking reshape bumps it. A reader may always traverse structure across a spec gap (rules 1–2, 4–5 are stable); only policy interpretation is spec-gated. `check` warns when a surface declares a `spec` newer than the build understands (`ConfigSpecAhead`). Pre-1.0 the number is fixed at 1 and unenforced; at 1.0 the kernel freezes and the contract takes effect.