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§
- 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. - Changes
Report - Engine-wrapper-level “what changed” shape returned by
crate::Engine::changes_since. - 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).
- 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.
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. - 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.
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’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§
- folder_
changes_ since - Synthesise per-entity events for a folder-backed mem by reading
<mem_root>/.memstead/changes.jsonland bucketing events by entity.