Expand description
Reflection pass — Auto-Dream-compatible semantic housekeeping.
run_reflection_pass walks a single agent’s memories and applies four
normalising sweeps in order:
- Date absolutization (Task 10) — rewrite relative temporal phrases
(
"yesterday","last week","N days ago","tomorrow") into ISO-8601 dates anchored on each record’screated_at. - Semantic dedup — any two memories whose embeddings have cosine
similarity ≥ 0.92 collapse into a single record that unions their
tags and sums their
access_count. The older record is moved to theConsolidatedstate and aconsolidated_fromrelation is inserted. - Low-importance conflict resolution — run
detect_conflictsand, for any conflict where both sides haveimportance < 0.3, applyResolutionStrategy::KeepNewest. - Stale archival — mark records
Archivedwhen theireffective_importance < 0.2, theiraccess_count == 0, and their age exceeds the configured threshold (default 7 days).
The pass is exposed as MnemoEngine::run_reflection_pass and is safe to
schedule on a periodic tick (default cadence 24h, driven from the CLI).
Structs§
- Dream
Report - Auto Dream organization-report trailer. Parser is permissive — matches
whichever of these three keys appears:
consolidated,removed,reindexed(case-insensitive, values are base-10 integers after a colon or equals sign). Missing keys default to zero. - Reflection
Report - Result of a single reflection pass.
Enums§
- Reflection
Mode - Controls when the reflection pass runs its expensive phases.
- Skip
Reason - Why a
Coordinatedpass decided to skip, when it did.
Constants§
- MIN_
HOURS_ BETWEEN_ COORDINATED_ RUNS - Minimum interval (in hours) between
Coordinatedpasses for one agent. Matches Auto Dream’s 24h cadence. - MIN_
NEW_ RECORDS_ FOR_ COORDINATED_ RUN - Minimum number of newly-written records (since
last_reflection_at) that must exist before aCoordinatedpass runs. Matches Auto Dream’s floor.
Functions§
- absolutize_
dates - Absolutize relative temporal expressions in
content. ReturnsSomewhen the content was modified. - parse_
organization_ report - Parse an Auto Dream organization-report trailer from free text. Returns
Nonewhen no## Organization Reportheader is present. - run_
reflection_ pass - Back-compat entry point — runs the reflection pass unconditionally
(equivalent to
run_reflection_pass_with_mode(_, _, Always, true)). - run_
reflection_ pass_ with_ mode - Run a reflection pass honouring
mode.