Expand description
Re-export shim over memstead_base::ops (request/response types,
WarningHint, plus the gix-free health and search submodules)
plus the git-touching operation submodules that stay in this crate.
Modules§
- agent_
notes agent_notes_since— walk a mem’s branch from a caller-provided cursor to the current tip and return oneCommitNoteper commit along the way, with the body parsed into structured fields.- branch_
reset Engine::branch_resetimplementation for git-branch mounts.- changes
memstead_changes_since— two-tree diff between a caller-provided commit SHA and the mem’s current HEAD, with rename detection tunable viarename_similarity(default 60%).- commit_
envelope - Per-commit wire envelope and entity-change variants.
- diff
Engine::diff(ref_a, ref_b)implementation for git-branch mounts.- export
- Markdown and mem-archive export.
- health
- Health checks — missing required fields, staleness, scoring.
- integrity
- Integrity linter — read-time conformance findings.
- search
- Full-text search across entities with BM25 scoring via tantivy.
- transport
memstead_fetch/memstead_pull/memstead_pushimplementations.
Structs§
- Agent
Notes Report - Walked output of
agent_notes_since.headechoes the resolved branch tip so callers record it as the next polling cursor without a follow-upmemstead_healthround-trip.memstead_refcarries the workspace-level__MEMSTEADref tip (unified schemas + per-mem configs) so commit-mirroring consumers — e.g. an outer-repo cursor block — anchor it alongside the per-mem head without a second round-trip.Nonewhen the workspace has not been migrated to the unified layout yet. - Backend
Changes - Backend-neutral “what changed” report. The engine wrapper
(
crate::Engine::changes_since, landing in a follow-up session) adds rename-similarity clamping warnings, optional agent-notes piggyback (git-branch only), and the operator-facingmem: Stringfield on top. - Batch
Entry - Batch
Error - Per-item error envelope on a batch result. The shape matches the
MCP wire envelope for single-entry failures:
codeis the stableUPPER_SNAKE_CASEtoken fromcrate::EngineError::code();detailscarries the variant-specific recovery payload (e.g. declared list, allowed enum values, hash-mismatch current) when available, or an empty object for variants without a structured payload. - Batch
Result - Result of an atomic batch update — all-or-nothing.
- Branch
Reset Outcome - Successful outcome of
Engine::branch_reset. Carries enough context for callers (CLI, replay skills, audit UIs) to surface what happened without a follow-upmemstead_changes_sincepoll. - Changes
Report - Engine-wrapper-level “what changed” shape returned by
crate::Engine::changes_since. - Commit
Envelope - One commit’s wire envelope. JSON example from the spec:
- Commit
Note - One commit’s worth of structured agent-note state. Fields are
populated best-effort: a body that doesn’t match the
memstead: <verb> <id>subject shape leavestool_verb/entity_idNone; absent trailers leave the corresponding fieldsNone. Callers branch onactorfor agent-vs-external classification. - Context
Result - Context around an entity — neighbors, community, related entities.
- Create
Args - Arguments for creating an entity.
- Create
Result - Result of a create operation.
- Dangling
Link - One dangling wiki-link finding surfaced by
memstead_health include=["dangling_links"]. A link is dangling when its resolved target is a stub (i.e. the markdown file does not exist on disk). This is the post-delete / renamed-without-rewrite / typo signal. - Delete
Result - Result of a delete operation.
- Diff
- Top-level diff response. Echoes the two refs the caller passed in (verbatim), reports the SHAs they resolved to, surfaces the configuration the operation used, and lists every per-entity entry.
- Diff
Config - Caller-supplied diff configuration. Defaults yield a useful diff without requiring callers to opt in to every feature.
- Expansion
Info - Metadata attached to hits reached via graph expansion. The
primary hit that seeded the expansion is identified by
of;via_edgeis the exactrel_typestring;depthcounts hops from the seed. - Export
Result - Export result.
- Facets
- Fixed set of facet dimensions computed over the unpaginated hit set. Tier 1 freezes the dimensions; extend later only if empirical use demands it. Zero-count entries are excluded to keep the payload small.
- Fetch
Outcome - Outcome of
Engine::fetch. Updates remote-tracking refs without moving the local branch pointer. - Folded
Tag - Case-drift audit entry. Surfaces when two or more casings of the same
canonical (lowercased) tag appear in the authored graph — the agent-hostile
bug where
decisionandDecisionlook like two healthy low-count tags in the case-sensitive primary surface. - Full
Refresh Report - What
Engine::full_refreshchanged — and, just as deliberately, what it SKIPPED. The refresh is additive-only: removals never take effect warm, and this report is how the caller learns whether its next call will succeed instead of guessing. - Health
Issue - Health
Report - Health check result for one entity.
- Health
Summary - Aggregated health report for the whole graph.
- Incoming
Ref - Serialisable projection of
store::InEdgeforCreateResult.incoming.sourceis the lowercaseEdgeSourcevariant:"explicit" | "hierarchy" | "body_link". - Incoming
Ripple - One entry in an entity’s incoming-wikilink ripple list. The
referrer entity is on either
ref_aorref_b(sidediscriminates); consumers building a “what would break” preview consult both sides. - List
Result - List result with token totals.
- MemChanged
Notice - Non-blocking “the mem moved under you” notice, attached to a response only when a reload happened during the operation. The operation’s own result/error rides alongside — this is purely the objective “what else changed” delta, scaled by size, for the agent to judge relevance against (the engine does not filter to a per-agent interest model).
- MemExport
Bytes - Byte-shaped output of
export_mem_to_bytes. Bundles the produced archive bytes with the same metadataMemExportResultreports for path-based exports. - MemExport
Result - Result of a
.memmem-archive export. - Missing
Required Outgoing Block - Wire-shape entry inside
MissingRequiredOutgoing.missing. Lists the relationship-name alternatives and the rendered cardinality literal for one unsatisfiedRequiredOutgoingblock. Custom struct so the JSON output is{ "relationships": [...], "cardinality": "at_least_one" }— identical to the schema YAML shape, so an agent can copy the envelope’sdetails.missingentry directly into amemstead_relateplan without renaming fields. - Modified
Metadata - Metadata-level mutations applied by a single
memstead_updatecall. Same empty-vec-omit convention asModifiedSections; auto-timestamp metadata fields written by the engine are NOT surfaced here (they are engine-driven, not user-driven — the caller has nothing to react to). - Modified
Sections - Section-level mutations applied by a single
memstead_updatecall. Each vec lists the section keys that landed in that mutation mode. Empty inner vecs are serde-omitted so the wire stays quiet; the struct itself always serialises so the outermodified_sectionskey is a stable shape regardless of what the call actually touched. - Neighbor
Info - Notice
ByChange - Per-change-kind counts in
mode: "counts". Field names track thememstead_changes_sinceaction vocabulary (updated, notmodified) so the notice and the recovery surface speak one language. - Parse
Recovery Entry - Per-entry result of an
apply_parse_recoverycall. One entry perPARSED_RELATION_INVALIDwarning the engine observed at the call site: the bulk-fix dispatches the writable-origin recoveries and reports the read-only-origin warnings as skipped. Wire-equivalent across MCP, CLI, and UniFFI surfaces; the renderer chooses the shape it prefers. - Parse
Recovery Report - Outcome of
Engine::apply_parse_recovery. Carries oneParseRecoveryEntryper parse-time-dropped relation observed at the call site plus the last successful commit sha for callers that want to pollmemstead_changes_sincefor the per-entity diff. An emptyentrieslist means the workspace was already clean. - Parsed
Relation Recovery - Abstract recovery action attached to a
PARSED_RELATION_INVALIDwarning when the source mem is writable. The shape is tool- agnostic: it names what to do, not which tool to call. A consumer (agent, bulk-fix orchestrator, app surface) mapskindto the concrete call on whichever MCP / CLI / UniFFI path it uses; the warning’s payload itself does not drift when the mutation surface evolves. - Patch
Arg - Arguments for a patch (substring replacement).
- Pull
Outcome - Outcome of
Engine::pull. Fast-forwards the local branch when possible; refuses withLOCAL_DIVERGENCEon a diverged local branch. - Push
Outcome - Outcome of
Engine::push. The remote’s view of the mem’s branch has moved tonew_shaafter the operation. - Quarantined
MemReport - One quarantine-roster entry on
HealthSummary: the mem, the typed reason code, and the full reason message (repair command included — plan-01 material). - Query
- Flat query shape for full-text search. Four optional fields, all combined with implicit AND across fields.
- Refresh
Failure - One failed refresh item —
itemisschema-source:<which>,mount:<mem>,mount-manifest, orworkspace. - Relate
Arg - Arguments for a relate/unrelate operation.
- Relate
Result - Result of a relate operation.
- Relation
Unset Arg - One repair-shaped relation removal on
memstead_update—relations_unset: [{ rel_type, target }]. Symmetric withmetadata_unset: an absent(rel_type, target)pair is a silent no-op. Only accepted when the target entity currently fails the conformance check (REPAIR_NOT_NEEDEDotherwise) — the everyday detach path staysmemstead_relate(remove). - Reload
Report - Per-mem reload outcome — produced by [
Engine::reload_one_mem] and surfaced verbatim in thememstead_reloadMCP tool’s response when an explicit operator-triggered reload runs against a single mem. Auto-reloads on the read path consume this internally and emit aWarningHint::MemReloaded(which carriesmem,old_head,new_head,entities_loaded— the diff list is intentionally omitted from the lean warning payload; agents that need it callmemstead_changes_sincethemselves with the suppliedold_head). - Reload
Result - Remote
AddOutcome - Outcome of
Engine::remote_add. Configures a named remote on the workspace’s mem-repo sofetch/pull/pushhave somewhere to go — upsert semantics (re-pointing an existing remote is not an error;updatedsays which happened). - Rename
Result - Result of a rename operation.
- Schema
Heading Violation - Wire-shape entry inside
SchemaHeadingRoundtripViolation.violations— one section whose declared heading does not derive back to its declared key. Mirrorsmemstead_schema::HeadingKeyViolation, kept as a local struct so the warning’s JSON shape is owned here. - Score
Breakdown - Per-hit score components surfaced so agents can understand ranking.
- Search
Hit - A search result hit.
- Search
Result - Search result with metadata.
- Search
Scope - Scope filters for search and list operations.
- SetMem
Description Outcome - Result of
Engine::set_mem_description. Carries the (mem, old_description, new_description) triple so callers can surface the change without an extra read. - SetMem
Subject Outcome - Result of
Engine::set_mem_subject. The block sets/clears as a unit; old/new carry the whole block. - SetMem
Sync State Outcome - Result of
Engine::set_mem_sync_state. Carries the (mem, key, previous-token) triple so callers (CLI, MCP) can surface the change without an extra read. The token values are opaque to the engine — seeMemConfig::sync_state. - SetMem
Title Outcome - Result of
Engine::set_mem_title. Same shape discipline asSetMemDescriptionOutcome. - SetMem
Version Outcome - Result of
Engine::set_mem_version. Carries the (mem, old_version, new_version) triple so callers (CLI, MCP) can surface the change without an extra read. - Skipped
Mount - One mount declined by
export_markdownbecause the active backend doesn’t support in-place markdown regeneration. - Stale
Entity - Status
- Graph status — node / edge counts and schema distribution. Renamed from
the former
Statswhen thestatscommand becamestatus(bundle plan03-projection-promotion, D11); the fields are unchanged so every caller’s payload stays byte-compatible. - Stranded
Cross MemRef - One inbound cross-mem reference that a branch reset would strand: an
edge from an entity in another mem pointing at an entity that exists
at the current head but would not exist at the reset target (it was
created — or renamed to its current id — after the target commit).
Computed engine-side by
Engine::branch_reset_stranded_refs; the human surface warns with these before confirming a reset. - Subsection
Facet - One sub-section-level facet entry.
pathis ordered outermost → innermost, prefixed with the H2 section key (e.g.["specifies", "Response Shapes", "Markdown Output"]). Structured vector (not a delimiter-joined string) so headings containing punctuation don’t break the key. - Summary
Pair - Lead-section
(heading, value)for a search/list hit, resolved against the hit’s own mem schema at search time. Carried in-memory from the search op to the renderers; seeSearchHit::summary. - TagDistribution
- One entry in the tag distribution surface: an authored tag string, the
number of non-stub entities carrying it, and the per-entity-type breakdown
of those hits. Comparison is case-sensitive —
decisionandDecisioncount as distinct entries here (seetag_distribution_foldedfor the drift-aware sidecar). - TagVariant
- Term
Match - One snippet-level match recorded per (term, field).
heading_pathisSomewhen the match falls under an H3–H6 sub-heading; elements are ordered outermost → innermost. - Untagged
Stats - Aggregate count of non-stub entities with zero effective tags, broken
down by
entity_type. “Untagged” collapses three states: missingtagsmetadata, empty string value, and comma-only value (e.g.","). - Update
Args - Arguments for updating an entity.
- Update
Result - Result of an update operation.
- Updated
Ref - One ref’s transition recorded by a successful fetch / pull.
Enums§
- Change
Envelope - Single delta entry between two snapshots.
Renamedcollapses what would otherwise appear as aRemoved+Addedpair so agents see one semantic event per filesystem rename. - Direction
- Entity
Change - One entity-level change carried by a
CommitEnvelope. Tagged via theopdiscriminator so the wire shape matches the spec’s{ "op": "...", ... }envelope. - Entity
Diff - Per-entity diff entry. Variants mirror the change kinds an
entity-level diff can produce;
InvalidEntityis the soft-failure path for entities that fail to parse on either side (consumers decide how to handle each case —memstead_diffdoes not refuse the whole call just because one entity is malformed). - Health
Issue Code - Machine-readable condition discriminator for a
HealthIssue— the enumeration lives here, with the issue type, and is never re-derived per projection. A projection that lists issues carries the code; the code is NEVER only a message-string prefix (a projection that drops messages would silently collapse distinct conditions — the exact misdirectionSECTION_HEADING_MISMATCHexists to prevent). - MemExport
Error - Notice
Changes - The size-graceful body of a
MemChangedNotice. Internally tagged onmodeso a caller decodes one stable shape and branches on the discriminator — no request-shape-dependent polymorphism. - Warning
Hint - Typed non-fatal issue surfaced from engine operations. Serialises as the
uniform
{ code, message, details }envelope so a generic warning handler (log sink, UI, alerting) can readcode+messagewithout branching on variant.Displayrenders the agent-facing text, reachable viaWarningHint::message; per-variant structured fields land underdetails, their shape keyed bycode.
Constants§
- EMPTY_
TREE_ SHA - Canonical git empty-tree hash. Callers without a prior cursor pass
this to get “every entity in the current state as added”. Both
the git-branch backend (special-cased to bypass
rev_parse) and any future folder-backend implementation honour the same sentinel. - OVERVIEW_
INCLUDE_ KEYS - Allowed
includekeys formemstead_overview— single source of truth shared across the lean MCP server, full MCP server, and the lean CLI’soverviewcommand. MirrorsHEALTH_INCLUDE_KEYSfor thehealthsurface. The CLI--includeflag validates against this list and surfacesUNKNOWN_INCLUDE_KEYwarnings, matching the MCP tool’s behaviour. - RENAME_
SIMILARITY_ DEFAULT - Default content-similarity threshold for rename detection (60%).
Callers override per-call via
changes_since’srename_similarityparameter; the engine wrapper accepts[0.1, 1.0]and emits aLIMIT_CLAMPEDwarning for out-of-range values. Higher values miss edited renames; lower values risk false-positive rename pairing. - RENAME_
SIMILARITY_ MAX - Upper bound for
rename_similarity— 1.0 means “only paired up on a byte-identical match”; above that there is no semantic meaning. - RENAME_
SIMILARITY_ MIN - Lower bound for
rename_similarity— anything below 0.1 produces nearly-random rewrite pairing on a modest diff.
Functions§
- envelope
- Build the uniform
{ code, message, details }envelope used on both the warning wire (WarningHint’s customSerialize) and the MCP error wire (tool_error_with_payloadpayloads inengine_err_with_suggestions). Agents and other decoders branch oncode(UPPER_SNAKE_CASE, stable) and parsedetailsbycodewhen they need structured fields. - folder_
changes_ since - Synthesise per-entity events for a folder-backed mem by reading
<mem_root>/.memstead/changes.jsonland bucketing events by entity. - project_
incoming - Project
&[store::InEdge]into a sortedVec<IncomingRef>. Ordering by (rel_type, from) ascending — deterministic output despite the underlying HashMap iteration order.