Expand description
§prov
A self-describing plaintext workspace: a set of documents whose structure lives in the documents’ own embedded metadata (frontmatter), not in the filesystem layout or an app-private sidecar folder.
The name is the point. A prov is the note in which a book describes its own making — the type, the paper, the press. A prov workspace is one you can hand to any tool and it explains itself: follow the links in the metadata and the whole structure unfolds, with a distinguished root that describes the whole.
§The shape of the abstraction
- Documents are plaintext files with an embedded metadata block
(
document::Document). - Relations are named links declared in that metadata
(
relation::RelationSet). Which fields are links is configurable (contents/part_of,links, or your own vocabulary); the mechanism is not. Exactly one relation may be marked spanning — the single-parent tree that gives the workspace its self-describing discovery spine. Every other relation may be many-to-many, so the tree is a backbone, never a ceiling. - Identity is a strictly-additive layer (
identity,index). The graph, traversal, and (eventually) mutation operate on paths and never require an ID. Turn identity off and it compiles out; turn it on and IDs are minted only when something durably refers to a document.
§Status
Early extraction from diaryx_core. The pure layers — embedded-metadata
parsing (meta), document splitting, and relation extraction — are real
and tested. The filesystem-driven scan/traversal/mutation engine ports next;
its seams (workspace::Workspace, identity::IdentityPolicy,
index::IndexStore) are staked out here so nothing diaryx-specific leaks
into the eventual public API.
Re-exports§
pub use about::AboutContext;pub use discovery::Discovered;pub use discovery::Discovery;pub use discovery::discover;pub use intake::Adoption;pub use intake::PlanOutcome;pub use intake::StructurePlan;pub use intake::SynthNode;pub use manifest::ManifestStatus;pub use manifest::ManifestUpdate;pub use mutate::ContentState;pub use mutate::Created;pub use mutate::Diagnosis;pub use mutate::Reparented;pub use remedy::Fix;pub use remedy::Remedy;pub use remedy::RemedyKind;pub use remedy::Warrant;pub use route::Layout;pub use route::RoutePlan;pub use validate::CheckDiff;pub use validate::Finding;pub use workspace::Settings;pub use workspace::Workspace;pub use workspace::WorkspaceBuilder;pub use prov_config as config;pub use prov_fixity as fixity;pub use prov_graph;
Modules§
- about
- The
about.mdgenerator — a workspace’s own reading instructions, written for a person who has the directory and nothing else. - attach
- Attachments — giving an arbitrary file its own workspace-linked metadata.
- change
- Transaction primitives, retained at their original paths for compatibility.
- content
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. Body-prose parsing viatwig— prov’s answer to thecontent_formatknob deferred indocs/next-steps.md, and the ingredient that makes body-link findings code-aware (DESIGN §8’s principle: a[[…]]that is really code, e.g.[[inf] * n for _ in range(m)]]inside backticks, must never be treated as a link). - discovery
- Root discovery — finding the workspace a directory belongs to.
- document
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. Documents — a plaintext file with an embedded metadata block and a body, or a config file whose entire content is the metadata. - edit
- Metadata editing, at the path it had before the write surface moved out of
the read core into
prov-store. Format-preserving edits to a document’s metadata, whatever carries it. - error
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. Error and result types. - exec
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. A dependency-free executor for backends whose futures are already ready. - exports
- Named, closed-by-default document sets that may leave the workspace — the
exports:config axis, and the plan that composes a gate with a view. - fs
- The filesystem port — both halves.
- graph
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. Plain text → walkable graph — the crate’s read core. - history
- History — what prov contributes to a workspace recorded by historica.
- identity
- Compatibility re-exports for the extracted
prov-identitycrate. - index
- The ID index — both halves, split across two crates for the same reason
fsis. - intake
- Directory-tree import — folding a folder hierarchy into the containment tree.
- journal
- Journal recovery, retained at its original path for compatibility.
- link
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. Link text — the raw strings a relation field holds, the wikilinks embedded in body prose, and the path arithmetic around them. - manifest
- Manifests — one node standing for a directory of files, instead of one sidecar per file.
- memo
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. A read memo with the lifetime of one operation — the cheap half of not reading the same file twice. - meta
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. Embedded-metadata values — a dynamic, order-preserving value tree overfig. - mutate
- Mutation with link maintenance — the crate’s hard, valuable half.
- peer
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. prov’s peer port — where the other workspaces are. - relation
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. Relations — the configurable vocabulary of links declared in metadata. - remedy
- Remedies — what prov offers to do about a
Finding. - route
- Routes — addressing a node by its path through the containment tree, and materializing the segments that do not exist yet.
- title
- The read core’s modules, re-exported at their original paths so
prov’s public API is exactly what it was before the split. Title index — the derivedname → documentmap that resolves nominal (“alias”) references like[[My File]]. - validate
- Validation — integrity findings over the workspace graph, from a root.
- views
- Declarative views over the workspace — the
views:config axis, the traversal that selects the documents one covers, and the pure grouping over what it selected. - vocabulary
- Controlled vocabularies — the term sets that make
fieldsreferences (tags, audiences, statuses) resolvable and therefore consistent. - workspace
- The workspace handle — where the filesystem, relation vocabulary, identity policy, and index store are composed.
Structs§
- Backlink
- An inbound reference to a document, as discovered by the census: which
document links here (
source), where in it (site), and whether the link is by stable id (survives moves) or by path (rewritten on a move). The inverse of a forwardCensusEntry— the marquee payoff of the identity layer (DESIGN §6). - Body
Link - One link found in body prose: the parsed
Link(target, label, and whether it was an Obsidian[[…]]wikilink or a markdown/djot[label](target)link) together with the bytespanof the whole construct — exactly what a rewrite replaces. The unifying body-link currency: census,check, and the rename machinery all consume this, blind to which syntax the link was written in. - Capabilities
- The durability guarantees a
Storagebackend can make — declared by the backend throughStorage::capabilities, honored by prov’s crash-safety machinery. - Census
Entry - One forward link as found in a document: where it is written and how it
resolves. The unit of the
census. - Change
Set - A set of writes staged as one unit, applied all-or-nothing by
apply. - Config
Issue - A key in a config surface that
WorkspaceConfig::applywould silently ignore — surfaced so a setting that never takes effect becomes visible rather than staying invisible.applykeeps the current value whenever a key is unrecognized or its value fails to parse; that robustness is what makes a typo (notaton) or a bad value (fixity: alll) vanish without a word. - DirEntry
- One entry returned by
ReadStorage::read_dir. - Document
- A parsed document: its path, its embedded metadata, and its body text.
- Edge
- A resolved link found in a document’s metadata: which relation declared it and the raw (unresolved) target string.
- Export
Spec - One export a workspace declares for itself: a gate that bounds what leaves, optionally arranged by a view.
- Field
Spec - A field declaration — an entry in the
fieldsblock. It promotes a frontmatter field (tags,audience,created) that prov would otherwise merely carry (DESIGN §2, tier 3) into something prov and its frontends know the shape of. Two independent things can be declared, and a field needs at least one of them to be worth an entry: - File
Index - The persistent registry: a snapshot with tombstones, living under the
registrykey of a workspace document — the document the root’s registry-pointer relation targets. - File
Type - The type of a filesystem entry.
- Graph
- A readable workspace: a root, a filesystem to read it through, an id index
to resolve
id:references against, and theReadSettingsthat say how its links are spelled. - Id
- A stable, opaque document identifier.
- InMemory
Fs - An in-memory, clone-shared
Storagebackend. - InMemory
Index - A simple in-memory registry — for tests and ephemeral workspaces. No tombstones: an unregistered ID is forgotten entirely.
- Link
- A parsed link string: an optional human label and the target it points at.
- Manifest
- A parsed manifest document: the directory it claims, and the files it says are in it.
- Manifest
Entry - One row: a covered file and, when the manifest carries a fixity baseline, the digest of its bytes.
- Metadata
- Metadata about a filesystem entry — the subset prov needs.
- Minter
- The bundled minting policy: NOID xdigit + check IDs from a seeded PRNG.
- NoIdentity
- Identity disabled — the default. Paths only; no ID is ever minted or written.
- NoIndex
- No index — identity-off workspaces. Registers nothing, resolves nothing.
- NoPeers
- No peers — every workspace is somewhere this host cannot see.
- Node
- One node of the materialized spanning tree.
- Read
Scope - An open read scope. Hold it for the operation; dropping it leaves the scope, and dropping the outermost one drops everything the operation remembered.
- Read
Settings - The settings a read of a workspace depends on — the whole of what traversal needs to be told about the workspace it is traversing.
- Reference
Style - How a durable reference is spelled: a
Wrapper, anAddressing, whether anidlink carries a title label, and the path rendering used when addressing by path. This is the per-workspace default and the per-relation override (seecrate::relation::Relation::style). - Registration
- Which events cause a document to be assigned (registered) an ID.
- Relation
- A single named relation: the frontmatter key it reads, its inverse (if the pair is maintained bidirectionally), and its cardinality.
- Relation
Def - A relation definition declared in a config’s
relationsblock — the structural half of an entry, parallel to the reference-style half (RelationStyleConfig). This is what makes a workspace’s vocabulary self-describing (DESIGN §1, theprov/1spec): a foreign reader learns the graph — which fields are relations, their inverse, their cardinality — from the document itself rather than assuming prov’scontents/part_ofpreset. Each field is optional; arelationsentry may carry only style, only definition, or both. - Relation
Set - The configured set of relations for a workspace, and which one is spanning.
- Relation
Style Config - A per-relation reference-style override, as declared in a config’s
relationsblock. Each axis is optional and inherits the workspace default (WorkspaceConfig::reference_style) when absent — so a block need only name the axes it changes. This is the config form ofRelation::style, and what lets links going “down” (contents) differ from links going “up” (part_of). - Skip
- One rule the skiplist asks for, and why.
- Skiplist
- What the generated region should say, and how that differs from what stands.
- StdFs
ReadStorageover the process filesystem (std::fs).- Term
- A single term in a vocabulary. prov reads only the three fields here; any other keys on the term entry are carried, not interpreted.
- Title
Index - A
name → document(s)index built by scanning a workspace. Names are the documents’titlefields and their file stems; a document is registered under both so[[My File]](by title) and[[my-file]](by stem) both find it. - Tree
Options - Options controlling how
Graph::tree_withmaterializes a spanning target that does not resolve on disk. - View
Spec - One view a workspace declares for itself.
- Vocabulary
- A parsed controlled vocabulary — the term set for one field.
- Walk
- The result of one spanning-tree
walk: the forward-link census, the structural facts observed from traversal state, and the prose body files reached through separated nodes’contentpointers (tracked for the orphan check, deliberately absent from the census). - Wikilink
- A wikilink embedded in a document’s body:
[[target]]or, with an Obsidian pipe label,[[target|label]]. - Workspace
Config - The workspace-wide policy a config declares.
Enums§
- About
- Whether the workspace generates
about.md— a short prose page, specialized against this workspace’s own configuration, that tells a reader with no prior knowledge how to read this directory. - Addressing
- What a reference addresses its target by — the second style axis.
- Cardinality
- How many targets a relation field may hold.
- Collision
- A registration that would displace one the index already holds.
- Config
Issue Kind - The two ways a config key goes unread. See
ConfigIssue. - Content
Format - Which body-prose grammar a document is written in. Maps to a
twigtwig::Formatone-to-one; kept as prov’s own type so callers can name a format without depending ontwigdirectly, e.g. for thecontent_formatconfig knob. - Durability
- What a caller needs from one
Storage::synccall — the weakest guarantee that is still correct at that point, so that a backend able to serve it cheaply is free to. - Embed
Style - The archetype family a workspace authors embedded metadata in — the
“embed type” the CLI’s
initprompts for, one level above the concreteEmbedType. A family plus a metadatafig::Formatresolves to a carrier throughembed_carrier: e.g. (CodeBlock, YAML) is a```yamlblock, (Delimited, TOML) is a+++block, and (Separate, JSON) is a whole-file.jsonsidecar. It is what the config document records (viaprov’sWorkspaceConfig) so a workspace stays self-describing about how its metadata is embedded, not just which format it is written in. - Embed
Type - Which embedded config to open — the flat mirror of fig’s parametric
Embed.Type. The three parametric families (markdown---<lang>frontmatter,```<lang>fenced blocks,<script type>HTML data islands) are enumerated once per format. The first four names are historical (FrontmatterJsonis the;;;block,FrontmatterFigis the```figfenced block); the rest are grouped by container. - Error
- Errors produced by prov.
- ExtKind
- The kind of a format-specific
Value::Extendedscalar. Mirrors the core’sExtKindand the C ABI’sFigExtKind; the discriminants match that ABI. - Field
Type - The field-type vocabulary a
fields.<name>.typedeclaration is spelled in, re-exported so a consumer can name types without depending onfig-schema(or, forExtKind, onfig) directly — and so neither can drift to a different version than the one prov resolves against. The type a field expects. Drives type-directed parsing and widget choice. - FileOp
- One staged filesystem operation. Paths are workspace-relative — the root
is joined on at
applytime, so a set is portable between workspaces and prints readably in a dry run. - Fixity
- How far content checksums cover a workspace.
- Format
- A config format. Every variant parses, edits, and serializes.
- History
- Whether the workspace maintains a historica store’s skiplist — the
generated region of
history/skipped.txtthat scopes whathistorica recordtakes to the workspace’s reachable graph. - IdStorage
- Where a document’s stable ID is persisted — the identity-storage axis
(DESIGN §5). Orthogonal to when an ID is minted (
prov’sRegistration) and to how references are spelled; this is purely the ID’s home. - Link
Site - Where in a document a forward link is written — a frontmatter relation
field or a body wikilink. Carried by every link-resolution finding
(
prov’sFinding, derived invalidate— seeStructuralFact) and everyCensusEntryso a report can point at the exact site. - Link
Style - The write style for links a workspace authors — prov’s analogue of
diaryx’s
LinkFormat, and read from the same place: thelink_formatkey in the root document’s frontmatter (a fact declared in the workspace, not an app-private config). Every link prov writes (autofix today; create/rename in time) uses this, so a repair never introduces a foreign style. - Meta
Carrier - Where a document’s metadata physically lives — recorded at parse time so a
write can preserve the original carrier exactly (a
```figblock is never rewritten as---YAML; a bare.yamlfile never grows fences). - Node
Kind - Why a node appears in the tree the way it does.
- Notation
- The syntactic form a reference is written in — the config-facing notation
axis (
references.notation), orthogonal toPathStyle. This is the clean split of what the internalWrapper+plain_/markdown_LinkStyleprefix fused:Bareis a path with no brackets,Markdownis[Title](…),Wikilinkis[[…]]. - Open
Closed - Whether a controlled
fieldsvocabulary is open (folksonomy — unknown values are allowed, only near-misses warn) or closed (every value must be a known term; an unknown value is an error). See thefieldsblock andcrate::vocabulary. - Path
Style - The path-resolution a reference uses for a path target — the config-facing
references.path_styleaxis, orthogonal toNotation. Applies to path targets only (id/alias ignore it). - Peer
Location - An address a resolver answers with: somewhere on this device, or somewhere on the network.
- Peer
Lookup - What a host knows about where one workspace is — and how sure it is.
- Reason
- Why a rule is in the skiplist.
- Recovered
- The outcome of a
recoverpass. - Resolution
- How a forward link resolves against the workspace. Path and id forms stay distinct on purpose: the registry owns id resolution (location-independent, stable across moves), while a path is checked against the on-disk name — so a caller can tell which links a rename must rewrite (paths) from which it must leave alone (ids).
- Structural
Fact - A structural observation the walk makes as it traverses — not a verdict,
just what it saw: a document that would not load, a self-stored id
disagreeing with (or absent from) the registry, a spanning edge that
revisits an already-reached node, a spanning child whose inverse field
does not point back, or a
contentpointer that failed to resolve. - Sync
Guarantee - How strong a backend’s
Storage::syncactually is — the standing answer to aDurabilityrequest, declared once inCapabilitiesrather than discovered per call. - Target
- The resolution of one link target against a workspace: a path, an ID the registry does not currently resolve, or an off-workspace reference.
- Title
Match - The outcome of resolving a name against a
TitleIndex. - Trigger
- The registration event a caller is asking about (for example, a
workspace’s
registeroperation). - Unconfirmed
- Why a location on record could not be confirmed to be the workspace that was asked for.
- Value
- A dynamic metadata value. Integers and floats are kept distinct, and mappings preserve key order (frontmatter is order-significant to humans).
- Wrapper
- The syntactic wrapper a reference is written in — the first of the two style
axes (see
docs/reference-styles.md).
Constants§
- FIELD_
TYPES - The config spellings of
FieldType, in the order a diagnostic offers them. - WORKSPACE_
NAME_ LEN - Total length of a minted workspace name:
WORKSPACE_NAME_RANDOM_LENplus the check character everymoidblade ends with.
Traits§
- IdIndex
- The query half of an ID index: the three lookups link resolution needs, and no way to change what is stored.
- Identity
Policy - A policy deciding when to register documents and how their IDs are minted.
- Index
Store - Somewhere IDs (and eventually derived graph data) are persisted and queried —
IdIndex’s lookups plus everything that changes what is stored. - Peer
Resolver - A host’s map from a workspace name to where that workspace is.
- Read
Storage - The read half of an async filesystem backend: everything the traversal core needs, and nothing that can change a byte on disk.
- Rebase
- What a pending change set can tell a store about its own persisted home.
- Storage
- An async filesystem backend prov can drive —
ReadStorageplus everything that changes bytes on disk.
Functions§
- block_
on - Drive
futureto completion on the current thread by polling in a loop with a no-op waker. - code_
spans - The byte ranges in
bodythattwigparses as code (inline code spans, fenced code blocks, raw inline/block escapes) — everything a link scan should treat as opaque; seecrate::link::scan_wikilinks. Spans are returned sorted by start offset, and cover code inside a footnote definition as well as code in the document body (seespans_where). - diagnose
- Diagnose a config surface (a root’s
prov:block or a config document’s top-level mapping): oneConfigIssueper keyapplywould silently ignore. Recognized keys are checked for a value prov can parse; unrecognized keys are reported only when they closely resemble a real axis at their level (a likely typo). Returns empty for a clean config. - embed_
carrier - Resolve an
EmbedStyle+ metadataformatto the carrier a new document should get.Separatemaps to a whole-file sidecar informat; every other style maps to the concreteEmbedTypefor that(style, format)pair.Nonefor a combination that has no archetype — notablyDelimited+ fig (the dialect has no----style delimiter) and any fenced style paired with a format fig cannot fence (Zon). - embed_
style_ of - The
EmbedStylefamily a concreteEmbedTypebelongs to — the inverse (on the style axis) ofembed_carrier, which resolves a(style, format)pair back to a carrier. Pairing it with a new metadata format is how a format conversion keeps a document’s embedding shape while changing only its frontmatter language: classify the current archetype, thenembed_carrierthe same style with the target format. - escapes_
root - Whether
path, resolved against a workspace root, would land outside it. - field_
type_ as_ config_ str - The
fields.<name>.typespelling of aFieldType, orNonefor a type with no config spelling (seeFIELD_TYPES) — such a type is dropped on serialization rather than written as something that would not read back. - field_
type_ from_ config_ str - Parse a
fields.<name>.typespelling into aFieldType; unknown →None. - format_
link - Format a link to
target(a workspace-relative canonical path) as written in the document atfrom, instyle, withtitle(used only by the Markdown styles). This is what keeps an authored link native to the workspace. - is_
opaque_ payload - Whether prov can read
pathas text — a recognized body format (Markdown/Djot/HTML) or a whole-file metadata format (YAML/JSON/…). Its negation is an opaque payload: a file prov treats as bytes (an image, a PDF, a font, any binary) and never parses. An attachment is exactly a whole-file metadata sidecar whosecontentpoints at such a payload, which is how an arbitrary file gains workspace-linked metadata without being able to carry frontmatter itself. - is_
valid_ workspace_ id - Whether
nameis a usable workspace self-name. - metadata_
format_ from_ str - Parse a
metadata.formatconfig value (yaml/json/toml/fig) into a metadatafig::Format, honoring the compiled-in formats — the public form of [format_from_str], for callers that name a frontmatter language from outside the config parser (the CLI’sconvert … metadata.format …). - metadata_
format_ str - The
metadata.formatconfig spelling for a metadatafig::Format— the public form of [format_str], and the inverse ofmetadata_format_from_str. - mint_
workspace_ id - Mint an opaque global name for a workspace, randomizing from
seed. - path_
to_ title - A human title generated from a path’s file stem:
_/-become spaces and each word is capitalized (utility_index.md→Utility Index). The fallback when a target document declares notitle. - reachable_
set - The set of workspace-relative paths a walk from
startreaches:startitself, every path a census link resolves to (any relation, a body wikilink, or an id through the registry), and everycontenttarget. - recover
- Finish any change set a crash left journaled at
root, rolling the workspace forward to the fully-applied state, then remove the journal. - render_
html - Parse
bodyasformatand render it to HTML, viatwig’s FFI. - require_
whole_ file - Enforce that a record store at
path(the id registry, the recycle-bin index, a flat vocabulary) is a whole-file config document, returning its format. AMetaCarrier::Fencedcarrier — markdown frontmatter — is rejected withError::MarkdownStore: prov re-lays-out these stores as a sorted record list (DESIGN §5), so human prose has no stable home in them and unambiguous extension→format sniffing depends on the carrier being whole-file. The single choke point every store loader passes through, so the rule cannot be enforced in one place and forgotten in another. - spec_
ahead - If
metadeclares aspecnewer thanSPEC_VERSION— the version this build understands — the declared version. The signal that prov may be silently ignoring settings a newer prov wrote.Nonewhenspecis absent, not an integer, or within range. Shared bycheck(aFinding::ConfigSpecAhead) and the CLI’s proactive config warning, so the version comparison lives in one place.