Reeve
Features

Semantic Memory

Agent memory search with RRF scoring, temporal decay, and configurable merge strategies.

Semantic Memory

Semantic Memory gives agents long-term recall. Agents write observations, learnings, and facts to memory, then retrieve them using semantic search — finding relevant memories even when the exact words don't match.

How It Works

Agent writes: "Matt prefers concise responses with code examples"


            Semantic Chunking → Embedding → SQLite Vector Store

Later query: "What writing style does Matt like?"    │
                    │                                │
                    ▼                                ▼
            Query Embedding → Cosine Similarity → Ranked Results
                                    +
                              RRF Scoring + Temporal Decay


                        "Matt prefers concise responses..."

Scoring: RRF + Temporal Decay

Memory search uses Reciprocal Rank Fusion (RRF) with temporal decay to balance relevance and recency.

RRF Scoring

RRF combines multiple ranking signals into a single score, normalized to the range [0.4, 1.0]:

RRF_score = 1 / (k + rank)
Normalized to: 0.4 (least relevant) → 1.0 (most relevant)

This prevents any single signal from dominating. A memory that's semantically close but old can still outrank a recent but weakly related memory.

Temporal Decay

Recent memories are weighted higher than old ones:

decay = max(floor, e^(-age_days / halfLife))

Configuration (in reeve.json):

{
  "memorySearch": {
    "temporalDecay": {
      "halfLife": 30,    // Half-life in days (memories lose half weight per 30 days)
      "floor": 0.5      // Minimum weight (old memories never go below 50%)
    }
  }
}

A memory from yesterday has weight ~0.98. A memory from 30 days ago has weight ~0.50. A memory from 6 months ago also has weight ~0.50 (the floor prevents total decay).

Combined Score

final_score = rrf_score × temporal_weight

This means a highly relevant old memory (RRF: 0.95, decay: 0.5) scores 0.475, while a somewhat relevant recent memory (RRF: 0.6, decay: 0.98) scores 0.588 — the recency advantage tips the balance.

Merge Strategies

When the same topic comes up repeatedly, the mergeStrategy config controls how memories combine:

{
  "memorySearch": {
    "mergeStrategy": "latest"  // "latest" | "append" | "replace"
  }
}
StrategyBehavior
latestKeep the most recent memory on a topic
appendAccumulate memories (all versions kept)
replaceOverwrite with the newest version

Agent Tools

Writing Memories

Agents write to memory using the memory tool:

memory({
  action: "write",
  content: "User prefers dark mode and minimal UI",
  tags: ["preferences", "ui"]
})

Searching Memories

memory({
  action: "search",
  query: "What does the user prefer for UI design?",
  limit: 5
})

Returns:

{
  "results": [
    {
      "content": "User prefers dark mode and minimal UI",
      "score": 0.89,
      "created_at": "2026-02-20T10:00:00Z",
      "tags": ["preferences", "ui"]
    }
  ]
}

Storage

Semantic memory is stored in SQLite at ~/.reeve/memory/memory.db. The schema uses:

  • memories table — Content, embeddings, metadata, timestamps
  • FTS5 index — Full-text search for keyword fallback
  • Zod schemas — Validated input/output types

Semantic Memory was shipped as part of the semantic-memory merge (14 commits, Feb 2026). It shares infrastructure with the Knowledge Base but stores agent-generated content rather than uploaded documents.

On this page