Expand description
Backend-agnostic graph kernel for Memstead.
Hosts the parts of the engine that do not assume a git-backed
storage: token-budget chunking, workspace-root utilities, the
entity types and markdown pipeline (parse / generate / write), the
in-memory store, graph queries and community detection, the mem
router, the operation request/response types (including the
gix-free read paths in ops::health / ops::search), the search
index, validators, and rendering.
Consumers that need only graph operations against directory or
archive storage depend on this crate alone — its dependency closure
does not include gix. Code that needs git-backed mems depends on
memstead-git-branch, which builds on memstead-base.
Re-exports§
pub use anchor::ANCHOR_SIDECAR_PATH;pub use anchor::Anchor;pub use anchor::AnchorGrain;pub use anchor::AnchorHashStability;pub use anchor::AnchorInput;pub use anchor::AnchorProvenanceClass;pub use anchor::AnchorSidecar;pub use anchor::AnchorState;pub use anchor::AnchorValidationError;pub use anchor::AnchorVersion;pub use anchor::ArtifactObservation;pub use anchor::EntityAnchorComposition;pub use anchor::INVALID_ANCHOR_CODE;pub use anchor::compose_entity_anchors;pub use anchor::resolve_anchor;pub use backend::BackendError;pub use backend::MemBackend;pub use engine::drift::EngineHandle;pub use engine::drift::OperationScope;pub use engine::BackendFactory;pub use engine::BootError;pub use engine::CreateEntityArgs;pub use engine::CreateEntityOutcome;pub use engine::DeleteEntityArgs;pub use engine::DeleteEntityOutcome;pub use engine::DeleteReferrers;pub use engine::DisjointMerge;pub use engine::Engine;pub use engine::EngineError;pub use engine::EntityHistoryReport;pub use engine::EntityTouch;pub use engine::ExpectedHash;pub use engine::FromArchiveBytesError;pub use engine::GitBranchBranchResetFn;pub use engine::GitBranchChangesSinceFn;pub use engine::GitBranchCreateBranchAtFn;pub use engine::GitBranchDiffFn;pub use engine::GitBranchExportFn;pub use engine::GitBranchExportToBytesFn;pub use engine::GitBranchFetchFn;pub use engine::GitBranchLsRemoteFn;pub use engine::GitBranchMergeDisjointFn;pub use engine::GitBranchOps;pub use engine::GitBranchPullFn;pub use engine::GitBranchPushFn;pub use engine::GitBranchReadConfigAtRefFn;pub use engine::GitBranchReadTreeFn;pub use engine::GitBranchResolveRefFn;pub use engine::HISTORY_PAGE_DEFAULT;pub use engine::HISTORY_PAGE_MAX;pub use engine::HashOverride;pub use engine::INLINE_LIST_CAP;pub use engine::MutationClock;pub use engine::ReferrerInfo;pub use engine::RelateAction;pub use engine::RelateEntityArgs;pub use engine::RelateEntityOutcome;pub use engine::RenameEntityArgs;pub use engine::RenameEntityOutcome;pub use engine::RetypeEdge;pub use engine::RetypeEdgeDirection;pub use engine::RetypeEntityArgs;pub use engine::RetypeEntityOutcome;pub use engine::RetypeProblem;pub use engine::ReviewMarkStatus;pub use engine::SchemaSourceDiagnostic;pub use engine::SchemaStaging;pub use engine::SetReviewMarkOutcome;pub use engine::StoryStart;pub use engine::UpdateEntityArgs;pub use engine::UpdateEntityOutcome;pub use engine::format_inline_list_overflow;pub use entity::id::ENTITY_ID_MAX_LEN;pub use entity::id::SlugError;pub use entity::id::TITLE_GRAMMAR_RULE;pub use entity::parser::Frontmatter;pub use entity::parser::body_after_frontmatter;pub use entity::parser::frontmatter_parts;pub use entity::parser::peek_type_from_frontmatter;pub use entity::parser::split_frontmatter_core;pub use entity::Entity;pub use entity::EntityId;pub use entity::MetadataValue;pub use entity::ParseResult;pub use entity::Relationship;pub use error::FullEngineError;pub use error::RecoveryAction;pub use graph::ClusterInfo;pub use graph::LouvainOutput;pub use mem::MemOrigin;pub use mem::MemRouterSnapshot;pub use mem_management::CreateRuleSet;pub use mem_management::DeleteRuleSet;pub use mem_management::MatcherSet;pub use mem_management::MatcherSetError;pub use ops::BackendChanges;pub use ops::BatchEntry;pub use ops::BatchError;pub use ops::BatchResult;pub use ops::ChangeEnvelope;pub use ops::ChangesReport;pub use ops::ContextResult;pub use ops::CreateArgs;pub use ops::CreateResult;pub use ops::DeleteResult;pub use ops::EMPTY_TREE_SHA;pub use ops::ExportResult;pub use ops::Facets;pub use ops::HealthReport;pub use ops::HealthSummary;pub use ops::ListResult;pub use ops::MemExportResult;pub use ops::ModifiedMetadata;pub use ops::ModifiedSections;pub use ops::Query;pub use ops::RENAME_SIMILARITY_DEFAULT;pub use ops::RENAME_SIMILARITY_MAX;pub use ops::RENAME_SIMILARITY_MIN;pub use ops::RelateArg;pub use ops::RelateResult;pub use ops::ReloadReport;pub use ops::ReloadResult;pub use ops::RenameResult;pub use ops::SearchHit;pub use ops::SearchResult;pub use ops::SearchScope;pub use ops::SetMemVersionOutcome;pub use ops::UpdateArgs;pub use ops::UpdateResult;pub use ops::WarningHint;pub use pipeline::IngestTrigger;pub use pipeline::MediumType;pub use pipeline::PatternEntry;pub use pipeline::PatternMode;pub use pipeline_edit::PipelineEditError;pub use pipeline_store::BindingConfigs;pub use pipeline_store::MemPipelineRecord;pub use pipeline_store::load_pipeline_configs;pub use provenance::Provenance;pub use provenance::ProvenanceKind;pub use store::Edge;pub use store::EdgeSource;pub use store::InEdge;pub use store::Store;pub use workspace::CreateRuleSetting;pub use workspace::DeleteRuleSetting;pub use workspace::MEMSTEAD_CHECKS_REF_BRANCH;pub use workspace::MEMSTEAD_REF_BRANCH;pub use workspace::Mount;pub use workspace::MountCapability;pub use workspace::MountLifecycle;pub use workspace::MountStorage;pub use workspace::SCHEMA_WILDCARD;pub use workspace::Workspace;pub use workspace::WorkspaceSettings;pub use workspace::branch_full_ref;pub use workspace::branch_short_name;pub use workspace::checks_ref_member_path;pub use workspace_store::FileWorkspaceStore;pub use workspace_store::InstantiateError;pub use workspace_store::Layout;pub use workspace_store::StoreError;pub use workspace_store::WORKSPACE_STORE_DIR;pub use workspace_store::WorkspaceStoreAdapter;pub use workspace_store::detect_layout;pub use workspace_store::instantiate_local_backend;pub use workspace_store::is_mem_repo_shaped;pub use workspace_store::is_workspace_root;pub use workspace_store::standalone_workspace;pub use workspace_store::workspace_shape_label;
Modules§
- anchor
- Anchors — engine-owned durable provenance records tying an entity to the source artifacts it describes.
- backend
MemBackend— uniform trait surface over folder, git-branch, and archive storage.- binding
- Binding format v2 — one record per pipeline.
- binding_
intent - Binding-intent check — the findings a binding’s intent text earns
against the destination schema (relationship-shaped tokens the schema
does not declare, and their kin). Kernel, not loop: the binding editor
validates an intent at write time, so the check lives beside the
binding store. Moved here from
ingest::intenton 2026-09-10; the loop and every consumer path reach it throughingest::intent. - binding_
run - Binding-run resolution — turning a declared binding into the resolved form a run works from (sources with their bases and change strategies, the process mem a binding writes into), with the typed refusals a malformed declaration earns.
- build_
info - Build identity of the running binary.
- check
- Check records — the engine-recorded act of verification.
- check_
path - Deny-path verdicts for tool-call candidates — the engine half of the plugin’s PreToolUse deny hook, and the one home of the deny dialect.
- chunking
- Token-budget chunking for large MCP responses.
- derivation
- Derivation baselines — “my source changed” computed, never stamped.
- domain_
authority_ wire - Domain-authority publishing — the pure wire protocol shared by the signer (CLI) and the verifier (registry).
- engine
- Unified engine.
- entity
- Entity types and the markdown pipeline (parse, generate, write, load).
- error
- Lifecycle error envelope.
- filesystem
- filesystem-mem surfaces — single-mem, history-free, filesystem-backed workspaces.
- friction
- Friction ledger — the engine’s record of its own surface’s learnability.
- graph
- Graph algorithms — BFS traversal, community detection, neighborhood queries.
- markdown
- The CommonMark referee — one definition of “code” for every content reader in the engine.
- mem
- Multi-mem routing, visibility filtering, mem config.
- mem_
management - Compiled lifecycle-policy rule sets — first-match-wins glob lookup
over the
[[mem_management.create]]/[[mem_management.delete]]arrays surfaced inworkspace.toml. - ops
- Operation request/response types and the gix-free read paths
(
health,search). - overview
- Shared overview composer used by both the
memstead_overviewMCP tool and the CLI overview command. - pipeline
- Pipeline primitives — the inline
Sourceof a binding and its parts. - pipeline_
edit - Edit operations over the v2 single-record pipeline store.
- pipeline_
store - File-adapter persistence for the binding store.
- preparation
- The engine-owned preparation registry — the one place that says which preparations exist, on which anchor grains, at which engine touchpoint, and what each grain’s PREPARED FORM is.
- provenance
- Backend-neutral provenance record.
- render
- Markdown rendering of Engine result types.
- runtime_
validator - Runtime CRUD validators consumed by the unified
crate::Engine— the single mutation engine, whatever storage backend (mem-repo git branch, plain folder, archive) sits behind a mount. - schema_
source SchemaSource— a storage backend’s schema-storage location.- search_
index - Per-mem tantivy search indexes.
- section_
format - Section-body reduction — the markdown half of the section-format vocabulary.
- source_
scope - Source scope enumeration — the declaration-layer walk that turns a
binding source’s scope patterns (allow / deny globs over a medium,
entity selectors over a graph) plus a binding’s ingest-level deny
paths into the set of artifacts the binding answers for,
S(D). - storage
- The storage backends this crate ships and the commit-id type they
share. The one write-side abstraction is
crate::backend::MemBackend(bytes-level list / read / write / delete / move / commit); every backend implements it, and every error it raises is acrate::backend::BackendError. Three backends live here: the folder backend (filesystem::FilesystemBackend, no gix, no commit history), the sealed archive (archive::ArchiveBackend, reads only) and the in-memory backend (in_memory::InMemoryBackend); the git-tree backend lives inmemstead_git_branch::storage::git_tree. - store
- In-memory graph store. Dumb data structure — no validation, no side effects. All mutations go through Engine methods.
- validator
- Strict ingress validator for sealed
.memarchives. - vcs
- Backend-agnostic VCS provenance types and trailer-block helpers.
- workspace
- Workspace concept — first-class in
memstead-baseafter the workspace-store rebuild. - workspace_
config_ edit toml_edit-backed writer for.memstead/workspace.toml.- workspace_
create - The refusals a command meets when it creates a workspace, a mem’s
folder or a schema package where one cannot go: inside another
workspace, over a workspace already there, over a
.memstead/that is not one, over a schema package already there, or into a folder with content. One type, soinit,quickstartandschema newreport each state with one code and one payload. - workspace_
root - Workspace-root utilities. Today’s only consumer is the
memstead_healthOUTER_REPO_NOT_IGNORING_MEM_REPOwarning surfaced by the MCP layer: when the workspace is embedded inside another git repository, the mem-repo-git directory must be excluded by the outer repo’s.gitignoreto avoid the gitlink trap. - workspace_
store - Persistence adapter — reads / writes the
Workspacefrom disk (or other backing stores) socrate::Engine::from_mountscan consume an in-memory mount list without owning the disk format.
Constants§
- ENGINE_
VERSION - The engine crate SEMVER of the running binary. Version-carrying
surfaces — the per-mem mutation stamp (
MemConfig.mutation_stamp), the boot-timeENGINE_VERSION_SKEWcomparison, the overview’s_engine_version, CLI--version, MCPserverInfo.version— usebuild_info::full_versioninstead (semver plus the git build sha when present), so dev builds between releases stay distinguishable; this constant is the bare semver component. - MEM_
META_ DIR - The per-mem engine-internal directory under a folder mem’s
root (
<mem_root>/.memstead/—config.json,changes.jsonl). Defined inmemstead-schema(mem-config loading lives there); re-exported here as the mem-level home for the concept. The per-mem engine-internal directory under a folder mem’s root —<mem_root>/.memstead/holdsconfig.jsonandchanges.jsonl. Defined here (rather than inmemstead-base) because mem-config loading lives in this crate andmemstead-basedepends on it;memstead-basere-exports the constant for downstream consumers. Distinct from the workspace store directory (memstead_base::WORKSPACE_STORE_DIR) and from the in-zip member paths inside sealed archives (ARCHIVE_META_DIR), which are a separate on-disk format and never use this constant.
Functions§
- engine_
fallback_ type - Engine-wide sentinel type. Used by ops that need a shared reference
type at the Engine level (search, health, list) — always resolves to
default@1.0.0::spec. Per-entity resolution still goes throughtype_by_name+ schema lookup. - hex_
lower - Lowercase hex encoding of a digest. Byte-identical to the
{:x}formatting thatsha2 < 0.11digests carried; hash strings persisted under the old encoding must keep matching.