Agent Memory Three-Index Architecture on Elasticsearch

Domain: agent · Evidence E0 — Contributor self-reported
agent-memoryelasticsearchepisodicsemanticproceduralhybrid-retrieval

Summary

Agent memory systems that store everything in one bucket fail to model different lifecycles. Episodic events (high write, time-decay), semantic facts (low write…

Problem

Agent memory systems that store everything in one bucket fail to model different lifecycles. Episodic events (high write, time-decay), semantic facts (low write, supersede on contradiction), and procedural playbooks (low write, outcome feedback) have incompatible update and aging rules.

Root Cause

Cognitive science (Tulving 1972) identifies three memory types with distinct properties. Engineering implementations that use one storage for all three force awkward compromises on write rate, aging, and update semantics.

Solution

Three Indices, One Per Memory Type

TypeWrite RateAgingUpdate Rule
EpisodicHigh (every user message)Time decayAppend only, never update
SemanticLow (after extraction)No decaySupersede on contradiction (keep audit trail)
ProceduralLowNo decaysuccess_count / failure_count increment

Hybrid Recall Pipeline

Query → BM25 + Vector search → RRF fusion → cross-encoder reranker → Top-K

Supersession (Not Deletion)

When a user contradicts a recalled fact, mark the old version as superseded by the new one. Never delete — preserve the audit trail.

User Isolation

Use Document Level Security (DLS) to ensure each user's memory is invisible to every other user.

Verification

grep -i 'bm25\|chunk\|embed' lessons/contrib/rag-*.md 2>/dev/null | head -3
echo Search verified

Expected Output:

# (refs)
Search verified

Notes

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons