Vault model and structural transforms
Status: open/planned · Kind: subsystem · Audience: system
Summary
Section titled “Summary”- A vault kernel — file set, walk policy, reference graph, link identity — plus plan/execute structural transforms that keep link integrity across renames, moves, and restructures.
- Transforms are planned dry-run first, then executed; links resolve through a path map, never by string guessing; no silent overwrites.
- Rewrites ride the splice discipline of C-N6RH-lossless-roundtrip-io: only the changed span of a link changes.
Statement
Section titled “Statement”A vault is a set of related markdown files with identity (wikilinks, anchors,
transclusions) spanning them. Today the fleet walks vaults with duplicated, policy-
hardcoded code and has no transform engine at all — the rust-markdown PR #43 dossier
designed one (scan→select→expand→map→transform→rewrite→emit, plan/execute split,
link-integrity invariants) but built nothing. The headline operation is vault reshape
(TM-0025-vault-reshape):
project source vault(s) into a target vault of a different shape via declarative map
rules and pluggable per-note transforms, with in-place rename/move/restructure as
degenerate reshapes. This capability lands that design on the CST core: the reference
graph is derived from parsed trees, transforms are validated plans over the graph, and
execution produces minimal splice edits plus file operations. Contract pairs make
reshapes checked migrations: sources validate against the source contract, output
against the target contract.
What it provides
Section titled “What it provides”- Vault kernel: policy-parameterized walk (generalizing
determined-vault::walk), path-escape guards, file identity; storage backend behind a VFS/host trait so the plane compiles to WASM. - Reference graph: wikilinks, embeds, anchors, frontmatter references — resolved through a path map with per-source link identity.
- Vault reshape:
sources[]→ target projection through globmap.rules[]and a collision-resolvedPathMap; pluggable per-note transforms (filter/transform/link mappers,drop_fields-class built-ins as ordinary plugins). - Transform operations: rename/move with backlink rewrite, merge/split, bulk restructure — each a degenerate reshape, each as plan (inspectable, dry-run) then execute.
- Contract-pair acceptance: a reshape declares source and target contracts; the migration is checked on both ends (C-K3TQ-markdown-contract-and-validation).
- Invariants enforced: read-only sources, link integrity, fail-closed selection, no silent overwrite, dry-run parity (execute re-verifies source hashes).
Underlying implementation
Section titled “Underlying implementation”New build (M-J9TB-vault-kernel-and-transforms) over the CST core. Inputs: the
PR #43 design dossier (pipeline, invariants, link-resolution algorithm — migrated
verbatim beside D-7VMX-markdown-ecosystem-strategy; its scanner code rejected),
determined-vault walk/guard primitives, platform-core/src/vaultwalk.rs as the
named duplication to delete, and packages/ts/intersect
(D-4FRD-intersect-api) as prior art for map-rule overlap/collision analysis.