Skip to main content

Module changes

Module changes 

Source
Expand description

Backend-neutral entity-level delta surface for memstead_changes_since callers.

ChangeEnvelope is the per-entity event shape (“this entity was added / updated / removed / renamed between cursor X and the current state”). crate::Engine::changes_since dispatches per mount: folder mounts synthesise from .memstead/changes.jsonl via folder_changes_since; git-branch mounts call the registered crate::GitBranchOps::changes_since dispatcher (real tree-diff with rename detection); archive mounts return an empty report.

The cursor format is backend-specific and opaque from the caller’s perspective: a commit SHA for git-branch, an RFC-3339 timestamp for folder, ignored for archive. The empty-tree-SHA sentinel (EMPTY_TREE_SHA) is a convention preserved across backends so “diff against nothing” works without each backend re-inventing the same first-poll shape.

title and entity_type on the envelope variants are populated by the engine wrapper from the in-memory store (best-effort — Removed envelopes always leave them None because the entity is gone). Backend dispatchers produce id-only envelopes; the crate::Engine::changes_since wrapper enriches.

Structs§

BackendChanges
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-facing mem: String field on top.
ChangesReport
Engine-wrapper-level “what changed” shape returned by crate::Engine::changes_since.
MemChangedNotice
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).
NoticeByChange
Per-change-kind counts in mode: "counts". Field names track the memstead_changes_since action vocabulary (updated, not modified) so the notice and the recovery surface speak one language.

Enums§

ChangeEnvelope
Single delta entry between two snapshots. Renamed collapses what would otherwise appear as a Removed + Added pair so agents see one semantic event per filesystem rename.
NoticeChanges
The size-graceful body of a MemChangedNotice. Internally tagged on mode so a caller decodes one stable shape and branches on the discriminator — no request-shape-dependent polymorphism.

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.
RENAME_SIMILARITY_DEFAULT
Default content-similarity threshold for rename detection (60%). Callers override per-call via changes_since’s rename_similarity parameter; the engine wrapper accepts [0.1, 1.0] and emits a LIMIT_CLAMPED warning 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§

folder_changes_since
Synthesise per-entity events for a folder-backed mem by reading <mem_root>/.memstead/changes.jsonl and bucketing events by entity.