MATIH Platform is in active MVP development. Documentation reflects current implementation status.
22. Agent Memory & Live Context
Architecture Overview

Agent Memory & Live Context

The Agent Memory system enables Matih agents to persistently learn from interactions, accumulate tenant-specific knowledge, and assemble rich live context for every request.

Two-Service Architecture

ServiceStackPortPurpose
memory-serviceJava Spring Boot8216Memory CRUD, lifecycle FSM, RBAC, Qdrant integration
memory-intelligence-servicePython FastAPI8217LLM extraction, hybrid search, temporal graph, context assembly

Design Principles

  • Cherry-picked algorithms: Mem0 single-call extraction, Graphiti temporal edges, Hindsight RRF fusion, LangMem procedural memory
  • Built on existing infra: Qdrant, Neo4j, Kafka, GrowthBook, asset-service
  • Tenant isolation: All operations scoped by tenant_id, enforced at API gateway and service level
  • Experimentation-first: Every tunable parameter exposed as a GrowthBook feature flag
  • Feedback-driven: Closed-loop system where user feedback directly improves memory quality

Data Flow

User Interaction → Extraction (LLM) → Memory CRUD → Qdrant Vectors

Agent Request → Context Assembly ← Hybrid Search (BM25 + Vector + Graph → RRF)

           MCP Servers + Decision Traces + Procedural Memory

Key Capabilities

  1. 4 Memory Types: Factual, Procedural, Correction, Preference
  2. 4 Memory Scopes: User, Session, Agent, Organization
  3. Lifecycle FSM: CANDIDATE → ACTIVE → DECAYED/CONSOLIDATED → ARCHIVED
  4. Hybrid Search: BM25 + vector + graph with Reciprocal Rank Fusion
  5. Temporal Graph: Neo4j with bi-temporal edges ("what was known at time T")
  6. Live Context: Real-time assembly from 28+ MCP servers + memory + traces
  7. Feedback Loop: Importance adjustment, procedural compilation, drift detection