Skip to content

consolidation.ts (consolidateEpisodicToSemantic) still writes raw fragments to memory-worker, bypassing the wiki SoT #78

Description

@stackbilt-admin

Context

decisions/memory-unification (aegis#457, 2026-04-11) made the wiki at cms.stackbilt.dev the canonical store for durable AEGIS knowledge, with memory-worker (stackbilt-memory) reduced to an index-only role. Phases 3 and 5 of that epic shipped: wiki_* MCP tools are live, aegis_memory/aegis_record_memory/aegis_forget_memory are removed, and PRISM's dreaming-cycle synthesis (synthesis.ts) now writes to wiki pages (scope: dreams) instead of memory fragments.

The April decision doc explicitly flagged one piece as unresolved: "Consolidation logic needs a new shape under the unified model — wiki pages don't consolidate the same way fragments do. This is where Phase 5 will spend design time." That design work never happened.

The gap

consolidateEpisodicToSemantic (src/kernel/memory/consolidation.ts) still calls memoryBinding.store() directly against memory-worker's fragment store on every run. It does an LLM pass over recent episodes and ADD/UPDATE/DELETE's fragments — completely independent of the wiki. These fragments:

  • Get no sources[] provenance, no lint, no contradiction detection
  • Are invisible to wiki_search/wiki_read/wiki_list
  • Are NOT invisible to chat — recall.ts Stage 3 still queries memory-worker directly and RRF-fuses the results into grounding context, so this isn't silent data loss, but it is permanent fragmentation outside the documented canonical model

Important wrinkle: this function is not invoked anywhere in the aegis-daemon repo's src/index.ts. It runs via @stackbilt/aegis-core's own scheduled-task registration (src/kernel/scheduled/consolidation.ts in this repo calls consolidateEpisodicToSemantic(env.db, ..., env.memoryBinding) directly). The daemon repo has its own local copy of consolidation.ts that is not executed — a dead shadow fork of this file, same pattern as the drift incidents that motivated the memory-adapter re-export pattern (aegis#436/#437).

This means the fix has to ship as a core change, published as a new @stackbilt/aegis-core version and bumped in the daemon's package.json — editing the daemon's local consolidation.ts is a no-op.

Ask

Design the wiki-shaped equivalent of episodic→semantic consolidation. Options worth considering:

  1. Have consolidation call wiki_write against the relevant topic-scoped page (append/update body) instead of memoryBinding.store() — requires resolving how an LLM-driven append interacts with the wiki lint pass and sources[] requirements.
  2. Retarget consolidation through the same MindSpring-probe pattern PRISM's synthesis.ts now uses, if the two pipelines should converge.
  3. Explicitly decide consolidation stays fragment-based as a deliberate "fast/cheap episodic signal" layer distinct from the wiki's "curated knowledge" layer — if so, document that as an intentional two-tier design rather than leaving it as an unmigrated leftover, and update decisions/memory-unification + the aegis/memory-system wiki page to reflect the decision.

Either way, the current state (silently writing to a store the architecture says is index-only, via a file that isn't even the one actually running) should not persist undocumented.

References

  • decisions/memory-unification (wiki, cms.stackbilt.dev)
  • aegis/memory-system (wiki, cms.stackbilt.dev) — updated 2026-06-30 with this finding
  • aegis#457 (memory unification epic)
  • aegis-daemon/wiki-drafts/_infra/memory-consumers-audit.md (Phase 1 audit — now stale, see related issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions