Expand description
memstead_changes_since — two-tree diff between a caller-provided commit
SHA and the mem’s current HEAD, with rename detection tunable via
rename_similarity (default 60%).
Agents remember the commit_sha returned by every mutation and feed it
back through this op to pick up incremental deltas without re-scanning
the whole mem. The response is a flat list of ChangeEnvelopes —
one per touched entity — with renames surfaced as a single event rather
than a removed + added pair (at the selected similarity threshold).
“Diff against nothing” sentinel: callers with no prior SHA pass the
canonical git empty-tree hash (4b825dc642cb6eb9a060e54bf8d69288fbee4904).
The diff then treats HEAD as entirely new content.
Non-entity paths (e.g. .memstead/config.json, schema files) are
filtered out: the surface is entity-level. Only .md files outside
.memstead/ ever produce envelopes.
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 - Flat diff between
sinceand HEAD for one mem.headechoes the resolved HEAD commit SHA so agents can remember it as the next polling cursor — saves a round-trip tomemstead_health.warningscarries typed{code, message, details}envelopes (e.g.LIMIT_CLAMPEDwhen the caller’srename_similaritywas out of range); omitted from the wire when empty.
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.
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§
- changes_
since - Compute
ChangesReportformem_name, whose gix repository lives atgit_dir.sinceis any gix-resolvable commit spec (commit SHA, ref name,HEAD~1, …) plus the empty-tree sentinel.