Expand description
Changed-slice computation — the deterministic core of the ingest
source-cursor: given a source’s stored baseline and its current state,
classify the pass as reseed / unchanged / changed, and for a changed
pass compute the added / modified / deleted Slice.
This is the engine-side port of the plugin’s per-facet
computeSourceCursor return contract (inject.mjs). It covers the two
strategies whose slice computation is pure once the inputs are in hand:
- graph — map a source mem’s
ChangeEnvelopes into a slice of entity ids (graph_changes_to_slice/graph_slice_outcome). - mtime — classify against a stored digest token and diff the
stat maps (
mtime_slice_outcome, over thesuper::change_detectionprimitives).
The git strategy’s slice (parse git diff --name-status, build
facet-scope pathspecs) lands with its subprocess glue and the path
normalization it needs — kept together rather than split here.
Load-bearing invariant preserved from the plugin: the new baseline
token is only ever returned here, never written. It is recorded by the
engine’s set_mem_sync_state writer when projection advance completes a
full pass (D7), so an aborted pass leaves the baseline untouched and the next
run re-presents the identical slice.
Structs§
- Slice
- The classified set of changed source artifacts in one pass. For the git and mtime strategies the entries are workspace-relative paths; for the graph strategy they are entity ids. Each class is kept sorted.
Enums§
- NoSignal
Reason - Why a source produced no usable change signal — the classified reason a
SliceOutcome::NoSignalcarries so the brief can render it distinguishably from a genuinely-unchanged source (which stays silent). Every variant is a rendered state; none is dropped silently. - Slice
Outcome - The outcome of computing a source’s changed slice against its baseline —
the engine-side shape of the plugin’s per-facet
computeSourceCursorreturn. ThetokeninReseed/Unchanged/Changedis the new baseline the agent records only after a full pass (never written here).NoSignalcarries aNoSignalReasonand renders in the brief; it advances no baseline (a whole re-roam or a typed refusal, per reason).
Functions§
- graph_
changes_ to_ slice - Map a graph mem’s change envelopes into a
Sliceof entity ids:Removed→ deleted;Renamed→ the new id added and the old id deleted;Added→ added;Updated→ modified. - graph_
slice_ outcome - Classify a graph source against its baseline.
baselineis the token stored for this(ingest, facet);currentis the source mem’s current snapshot token;changesare the source mem’s changes sincebaseline(only consulted when the source actually moved). Mirrors the plugin’scomputeGraphSlice: - is_
git_ token - A git commit id / graph snapshot token: 7–64 hex characters. Mirrors the
plugin’s
isGitToken, distinguishing a usable baseline from a foreign token (an mtime digest JSON, an empty string, junk). - mtime_
slice_ outcome - Classify an mtime source against its baseline digest token.
baselineis the token stored for this(ingest, facet);current_mapis the freshly stat’d map;prev_mapis the memo of the baseline’s stat map, if the skill cache still holds it. Mirrors the plugin’s mtime branch ofcomputeSourceCursor: