Skip to main content

Module changes

Module changes 

Source
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§

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
Flat diff between since and HEAD for one mem. head echoes the resolved HEAD commit SHA so agents can remember it as the next polling cursor — saves a round-trip to memstead_health. warnings carries typed {code, message, details} envelopes (e.g. LIMIT_CLAMPED when the caller’s rename_similarity was out of range); omitted from the wire when empty.

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.

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§

changes_since
Compute ChangesReport for mem_name, whose gix repository lives at git_dir. since is any gix-resolvable commit spec (commit SHA, ref name, HEAD~1, …) plus the empty-tree sentinel.