Skip to main content

hippmem_engine/
runtime.rs

1//! Engine background runtime: enrich worker (09 §3).
2//!
3//! Current implementation is synchronous: enrich is executed immediately after
4//! write to complete strong semantic dimensions.
5//! Can later be upgraded to a tokio async background worker.
6
7use hippmem_core::model::unit::{MemoryStage, MemoryUnit};
8use hippmem_write::enrich::{enrich_unit, EnrichInput};
9
10/// Synchronously run enrich on a memory at the Indexed stage:
11/// completes goals/preferences/emotions/decisions (deterministic rules).
12pub fn run_enrich_sync(unit: &mut MemoryUnit) {
13    if unit.stage != MemoryStage::Indexed {
14        return;
15    }
16
17    let input = EnrichInput { unit: unit.clone() };
18    let output = enrich_unit(input);
19    *unit = output.unit;
20    unit.stage = MemoryStage::Enriched;
21}