Skip to main content

Crate dbmd_core

Crate dbmd_core 

Source
Expand description

dbmd-core — the reference library for db.md, the open database in plain files.

db.md is one directory: raw evidence in sources/, atomic typed data plus curator-synthesized conclusions (meta-type: conclusion) in records/, and a single DB.md config file at the root. Records are markdown files with YAML frontmatter; relationships are wiki-links; the index is the derived, write-through index.md / index.jsonl catalog plus embedded ripgrep.

This crate owns all toolkit logic. The dbmd binary (dbmd-cli) is a thin wrapper that parses args, calls into here, and formats output. Any Rust tool wanting to be db.md-aware can cargo add dbmd-core and get the full library — the same shape as ripgrep, where the grep/ignore libs do the work and rg is a thin CLI.

§Hard invariants this crate is built to uphold

  • Zero AI/LLM dependencies. No provider SDKs, no API keys, no model calls, no embeddings, no vectors, no ANN — anywhere, ever. The agent driving dbmd is the semantic layer; dbmd is a deterministic tool.
  • The interactive loop is O(changed), never O(store). Loop ops (graph::backlinks, validate::validate_working_set, index::Index::on_write, …) never call store::Store::walk on a non-empty changed set. The one documented exception is validate::validate_working_set, which falls back to a full sweep only when handed an empty changed set (the vacuous-pass guard). Whole-store walks otherwise belong only to SWEEP ops (validate::validate_all, index::Index::rebuild_all, stats).
  • Wiki-links are full store-relative paths. A short-form wiki-link is a validation error (validate code WIKI_LINK_SHORT_FORM).
  • Embedded ripgrep. Free-text body search uses the grep + ignore crates in-process; the toolkit never bundles or shells out to rg. Structured loop reads (graph::backlinks, query::Query) ride the index.jsonl sidecars instead, never a frontmatter tree scan.

Re-exports§

pub use assets::AssetRecord;
pub use assets::Declaration;
pub use assets::ScanReport;
pub use assets::StatusReport;
pub use assets::VerifyReport;
pub use extract::ExtractError;
pub use extract::Extracted;
pub use extract::Format;
pub use extract::MetaValue;
pub use fsx::write_atomic;
pub use fsx::write_atomic_new;
pub use graph::ContextSlice;
pub use index::Index;
pub use index::IndexLevel;
pub use index::IndexRecord;
pub use log::Log;
pub use log::LogEntry;
pub use log::LogKind;
pub use parser::Config;
pub use parser::FieldSpec;
pub use parser::Frontmatter;
pub use parser::ParseError;
pub use parser::Schema;
pub use parser::Section;
pub use parser::Shape;
pub use query::Query;
pub use render::Outline;
pub use render::Tree;
pub use store::infer_type_from_path;
pub use store::layer_for_type;
pub use store::Layer;
pub use store::NotAStore;
pub use store::Store;
pub use store::StoreError;
pub use time::now;
pub use validate::Issue;
pub use validate::Severity;

Modules§

assets
assets — the db.md asset layer.
extract
Document text extraction — the dbmd extract engine.
fsx
fsx — the one atomic, durable file write for db.md’s primary data.
graph
graph — the wiki-link relationship layer.
index
index — the hierarchical content catalog.
log
log — the append-only, month-rotating chronological log.
parser
parser — read and write db.md markdown files.
query
query — Dataview-style filters, sidecar-backed.
render
render — data structures for the structural views, no output formatting.
stats
stats — store overview, computed on demand (a SWEEP, like du — never a maintained or precomputed cache).
store
store — walk, locate, and shard a db.md store.
summary
summary — the deterministic default-summary composer.
time
Canonical wall-clock for write-surface timestamp seeding.
validate
validate — the validation engine.

Enums§

Error
Top-level error for dbmd-core operations.

Type Aliases§

Result
Crate-wide result alias over Error.