2026-06-19||Source

DiVo-Anamnesis: 5D Strategic Memory Engine for AI Agents

DiVo Gen²AI | Technical Report | 2026-06-19


Abstract

We present DiVo-Anamnesis, a 5-dimensional strategic memory engine. Building on the open-source Anamnesis (which provides 4D recall: semantic, temporal, relational, strategic), we introduce the 5th dimension — knowledge — via an OpenSearch-based federation layer that unifies local episodic memories with external knowledge bases under a single RRF scoring function. Key innovations include: (1) extending 4D RRF to 5D with a configurable knowledge dimension, (2) hybrid BM25+neural search via OpenSearch with automatic fallback, and (3) an IDE session bridge that decrypts and indexes encrypted agent conversation databases into the knowledge dimension.


1. 5D Scoring Model

1.1 Dimension Decomposition

The upstream Anamnesis provides 4D recall (semantic, temporal, relational, strategic). DiVo-Anamnesis introduces the 5th dimension — knowledge — extending the scoring function:

S5D(q,m)=dD4wdsd(q,m)upstream 4D+wksk(q,m)DiVo knowledge\mathcal{S}_{5D}(q, m) = \underbrace{\sum_{d \in \mathcal{D}_4} w_d \cdot s_d(q, m)}_{\text{upstream 4D}} + \underbrace{w_k \cdot s_k(q, m)}_{\text{DiVo knowledge}}

where D4={semantic,temporal,relational,strategic}\mathcal{D}_4 = \{\text{semantic}, \text{temporal}, \text{relational}, \text{strategic}\} and wd+wk=1\sum w_d + w_k = 1.

DimensionWeight (default)SourceOrigin
Semantic0.25pgvectorUpstream 4D
Temporal0.15PostgreSQLUpstream 4D
Relational0.15Entity graphUpstream 4D
Strategic0.25Weight fieldUpstream 4D
Knowledge0.20OpenSearchDiVo extension

1.2 Reciprocal Rank Fusion

Each dimension produces an independent ranked list. The final score uses Reciprocal Rank Fusion (RRF):

RRF(m)=dDwd1K+rankd(m)\text{RRF}(m) = \sum_{d \in \mathcal{D}} w_d \cdot \frac{1}{K + \text{rank}_d(m)}

where K=60K = 60 (standard RRF constant) and rankd(m)\text{rank}_d(m) is the rank of memory mm in dimension dd.

1.3 Strategic Weight Computation

The strategic dimension score combines multiple signals:

sstrat(m)=αauth(m)confidence(m)log(1+access_count(m))decay(m)s_{\text{strat}}(m) = \alpha_{\text{auth}}(m) \cdot \text{confidence}(m) \cdot \log(1 + \text{access\_count}(m)) \cdot \text{decay}(m)

Authority coefficients:

Authority Levelαauth\alpha_{\text{auth}}Source
Explicit8.0User/planner direct decision
System2.0Automated extraction
Inferred1.0AI-inferred pattern

Decay function:

decay(m)={1.0if Δt<Tgraceeλ(ΔtTgrace)otherwise\text{decay}(m) = \begin{cases} 1.0 & \text{if } \Delta t < T_{\text{grace}} \\ e^{-\lambda(\Delta t - T_{\text{grace}})} & \text{otherwise} \end{cases}

where Tgrace=90T_{\text{grace}} = 90 days and λ\lambda controls decay rate.


2. Knowledge Federation Layer

2.1 Hybrid Search Architecture

The knowledge dimension performs BM25 + neural vector search via OpenSearch:

Shybrid(q,d)=βSBM25(q,d)+(1β)Sneural(q,d)\mathcal{S}_{\text{hybrid}}(q, d) = \beta \cdot \mathcal{S}_{\text{BM25}}(q, d) + (1 - \beta) \cdot \mathcal{S}_{\text{neural}}(q, d)

where β=0.3\beta = 0.3 (keyword weight) by default, configurable per query.

2.2 Automatic Fallback Chain

Hybrid (BM25 + neural) ──failure──▶ Pure BM25 ──failure──▶ Empty result
         │                                │
    requires: neural plugin          requires: OpenSearch only
    + search_pipeline                + standard index

2.3 Multi-Index Federation

Knowledge search supports cross-index retrieval:

Sknowledge(q)=iIsearchi(q)\mathcal{S}_{\text{knowledge}}(q) = \bigcup_{i \in \mathcal{I}} \text{search}_i(q)

where I\mathcal{I} is the set of configured OpenSearch indices (filtered by prefix divo-*).


3. IDE Session Bridge

3.1 Encrypted Database Decryption

The IDE session bridge extracts agent conversation data from encrypted SQLCipher databases:

DBdecrypted=SQLCipher(DBencrypted,Kproc)\text{DB}_{\text{decrypted}} = \text{SQLCipher}(\text{DB}_{\text{encrypted}}, K_{\text{proc}})

where KprocK_{\text{proc}} is obtained by scanning the IDE agent process memory at runtime.

3.2 Dual-Layer Memory Representation

Extracted sessions are indexed in two layers:

LayerFormatContentUse Case
L1 (Core)MarkdownUser queries + AI summariesLightweight recall
L2 (Detail)JSONFull message historyOn-demand deep retrieval

3.3 Incremental Indexing with Deduplication

Sessions are indexed using session_id as document ID, ensuring idempotent re-indexing:

doc_id=hash(session_id)\text{doc\_id} = \text{hash}(\text{session\_id})

Only sessions with updated_at newer than the last indexed timestamp are re-processed.


4. Hook Architecture

4.1 Lifecycle Hooks

The system provides a hook registry for injecting custom logic at operation boundaries:

Hook PointTriggerUse Case
pre_retainBefore memory storageContent validation, enrichment
post_retainAfter memory storageAudit logging, notification
pre_recallBefore retrievalQuery rewriting, access control
post_recallAfter retrievalResult augmentation, audit
on_startupApplication startModule initialization
on_shutdownApplication stopCleanup, backup

4.2 Hook Execution Model

Hooks execute sequentially within a hook point. Context is passed as a mutable dict:

contexti+1=hi(contexti)\text{context}_{i+1} = h_i(\text{context}_i)

If hook hih_i raises an exception, it is logged and skipped — no cascade failure.


5. API Surface

5.1 Core 5D Recall Endpoint

POST /api/v1/divo/recall
ParameterTypeDefaultDescription
bankstringrequiredMemory bank name
querystringrequiredNatural language query
limitint10Max results
dimension_weightsobjectsee §1.1Override dimension weights
knowledge_indiceslist|nullnullOpenSearch indices to search
knowledge_onlyboolfalseSkip local memories

5.2 Response Structure

{
  "memories": [
    {
      "id": "uuid-or-docid",
      "content": "...",
      "content_type": "fact|event|knowledge",
      "score": 0.85,
      "dimension_scores": {
        "semantic": 0.12,
        "temporal": 0.05,
        "relational": 0.0,
        "strategic": 0.15,
        "knowledge": 0.53
      },
      "is_knowledge": false,
      "source_index": ""
    }
  ],
  "total_candidates": 25,
  "knowledge_hits": 3,
  "retrieval_time_ms": 120.5
}

5.3 Session Bridge Endpoints

EndpointMethodDescription
/divo/session/startPOSTRecall recent context + detect cold start
/divo/session/endPOSTRetain handoff summary for next session
/divo/knowledge/searchPOSTDirect OpenSearch hybrid search
/divo/knowledge/statusGETOpenSearch connection health
/divo/knowledge/indicesGETList available knowledge indices
/divo/ide/statusGETIDE scraper health check

6. Architecture Diagram

┌─────────────────────────────────────────────────────────────┐
│                    DiVo-Anamnesis 5D Engine                  │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐   │
│  │         Upstream Anamnesis 4D (unchanged)            │   │
│  │  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────┐ │   │
│  │  │Semantic  │  │Temporal  │  │Relational│  │Strat-│ │   │
│  │  │(pgvector)│  │(PG index)│  │(Entity   │  │egic  │ │   │
│  │  │          │  │          │  │ Graph)   │  │(Wt)  │ │   │
│  │  └────┬─────┘  └────┬─────┘  └────┬─────┘  └──┬───┘ │   │
│  │       └──────────────┴──────┬───────┴─────────┘      │   │
│  │                    RRF Fusion (K=60)                   │   │
│  └──────────────────────────┬────────────────────────────┘   │
│                             │                                  │
│  ┌──────────────────────────┼────────────────────────────┐   │
│  │     DiVo Extension: 5th Dimension (Knowledge)         │   │
│  │  ┌─────────────────┐  ┌──────────────────────┐       │   │
│  │  │  OpenSearch      │  │  IDE Session Bridge  │       │   │
│  │  │  ┌─────┐┌──────┐│  │  ┌─────┐  ┌───────┐  │       │   │
│  │  │  │BM25 ││Neural││  │  │SQL  │  │Indexer│  │       │   │
│  │  │  │     ││Vector││  │  │Cipher│  │       │  │       │   │
│  │  │  └──┬──┘└──┬───┘│  │  └──┬──┘  └───┬───┘  │       │   │
│  │  │     └──┬────┘    │  │     │         │      │       │   │
│  │  │   Hybrid Search  │  │  Decrypt + Dedup     │       │   │
│  │  └────────┬─────────┘  └─────────┬────────────┘       │   │
│  └───────────┼──────────────────────┼─────────────────────┘   │
│              │                      │                          │
│              └──────────┬───────────┘                          │
│               5D RRF Fusion (4D + Knowledge)                  │
│                         │                                      │
│                    Ranked Results                              │
└─────────────────────────────────────────────────────────────┘

7. Upstream Compatibility

DiVo-Anamnesis extends the open-source Anamnesis without modifying upstream code:

ComponentUpstream (4D)DiVo Extension (5D)
StoragePostgreSQL + pgvector+ OpenSearch indices
Retrieval4D RRF+ Knowledge dimension RRF
Embeddingsentence-transformersShared (same model)
API/api/v1/recall+ /api/v1/divo/recall
HooksNoneHookRegistry with 6 hook points
IDE IntegrationNoneSQLCipher decrypt + auto-index

Extension mechanism: Python import + FastAPI middleware injection via patch_app(). Upstream codebase remains a read-only git submodule.


DiVo Gen²AI | Agent Infrastructure June 2026