Arc Labs
BrainDocsPricing
GitHubSign inGet Started
LearnFoundations

Agent Memory Cheat Sheet

By Arc Labs Research·May 12, 2026·5 min read
TL;DR

One-page reference for agent memory systems. Memory types, retrieval modes, retrieval fusion, schema design, and deployment options. Bookmark this page for quick lookups while building agents.

Memory Types

TypeDataRetrievalUse case
ConversationMessages, turnsTemporal, semanticMulti-turn dialogue, context
DecisionActions, outcomesSemantic, causalLearned policies, reasoning
EpisodicEvents, factsTemporal, spatialTimeline reconstruction
SemanticConcepts, rulesSemantic, similarityKnowledge base, reasoning
ProceduralSteps, methodsKeyword, sequenceWorkflows, task chains

Retrieval Modes

ModeInputOutputLatencyUse
KeywordQuery stringExact/substring matches< 1msFast filters
SemanticQuery embeddingTop-K similarity< 50msMeaning-based
HybridQuery + embeddingRanked fusion< 100msBest of both
TemporalTime rangeRecent-first< 10msRecency bias
CausalPrevious eventConsequence links< 50msEffect chains

Retrieval Fusion Methods

Lexical (BM25) score: sr
Semantic (embedding distance) score: se
Metadata filter score: sm

Combined score = w1*sr + w2*se + w3*sm
where w1 + w2 + w3 = 1

Typical: w1=0.3, w2=0.6, w3=0.1

Schema Fields

FieldTypeExampleIndex
space_idUUID"space-123"Primary
namespaceString"conversation"Index
contentText"User asked about pricing"FTS + Semantic
embeddingVector[0.1, 0.2, ...]HNSW
metadataJSON{"turn": 5, "user": "u1"}Partial
timestampDateTime"2026-05-12T14:30:00Z"Index
ttlDateTimeExpiry timeIndex

Embedding Models

ModelDimsSpeedCostUse
text-embedding-3-small (OpenAI)512Fast$General-purpose
text-embedding-3-large (OpenAI)3072Slower$$High quality
nomic-embed-text (Nomic AI)768FastFree (OSS)Production OSS
all-MiniLM-L6-v2 (Sentence)384Very fastFree (OSS)Lightweight

Deployment Patterns

Self-Hosted (low latency, high cost per instance)

Agent → Brain SDK → Local/Docker server
Latency: < 10ms
Scaling: Horizontal per agent

Managed Cloud (balanced)

Agent → Brain Cloud API → Managed storage
Latency: < 50ms P99
Scaling: Auto-scaling, multi-region

Hybrid (cache + persistent)

Agent → Redis (cache) → Brain Cloud (persistent)
Latency: < 5ms (cache hit), < 50ms (miss)
Scaling: Redis cluster + managed backend

Configuration Quick Start

Local development

import { BrainClient } from "@brain-db/sdk";

// Brain runs as a server (arena + WAL + redb); the client speaks the wire protocol.
// The embedding model is server-owned (BGE-small-en-v1.5, 384-dim) — clients send text.
const auth = { kind: "token", token: new TextEncoder().encode(process.env.BRAIN_API_KEY!) };
const client = await BrainClient.connect("127.0.0.1", 9090, { auth });

Production (remote server)

import { BrainClient } from "@brain-db/sdk";

// Point at your production Brain host; the brain_ API token carries identity (namespace + space).
const auth = { kind: "token", token: new TextEncoder().encode(process.env.BRAIN_API_KEY!) };
const client = await BrainClient.connect(process.env.BRAIN_HOST!, 9090, { auth });

API Patterns

Encode (store a memory)

import { EncodeBuilder } from "@brain-db/sdk";

const stored = await client.encode(
  new EncodeBuilder("User prefers async communication").build(),
);

Recall

import { RecallBuilder } from "@brain-db/sdk";

const answer = await client.recall(
  new RecallBuilder("User communication preferences").maxResults(5).build(),
);
// answer.answerKind: "Single" | "Many" | "None" — the hits are in answer.memories

Concurrent operations

// Brain has no batch verb; issue encode/recall calls concurrently.
const [stored, answer] = await Promise.all([
  client.encode(new EncodeBuilder("User prefers dark mode").build()),
  client.recall(new RecallBuilder("ui preferences").maxResults(5).build()),
]);

Performance Targets

OperationP50P99P99.9
Store5ms50ms200ms
Retrieve10ms50ms200ms
Search (1M vectors)15ms100ms500ms
Batch (100 ops)50ms500ms2s

Troubleshooting

ProblemCauseFix
High latencyNetwork round-tripCo-locate a self-hosted server or add a cache layer
Low recallPoor embedding modelUpgrade to larger model
High costsToo many vectorsImplement TTL/eviction
Data lossNo persistenceUse managed Cloud, not cache
Semantic driftUnstable embeddingsUse fixed embedding model version

Common mistakes

  1. Using only semantic retrieval — Add keyword filtering for precision
  2. No temporal indexing — Always include timestamp for recency bias
  3. Storing raw conversations — Summarize/compress to reduce vectors
  4. Ignoring metadata — Use JSON metadata for filtering and aggregation
  5. No monitoring — Track retrieval quality and latency percentiles

Further reading

  • Memory Architectures — System design patterns
  • Hybrid Retrieval — Fusion techniques
  • Long-Term Memory — Persistence strategies

Related reading

  • FoundationsWhat is Agent Memory?
  • FoundationsBest Agent Memory Frameworks 2026
  • FoundationsWhy Your Agent Forgets (and How to Fix It)
NextWhat is Agent Memory?

Updates from the lab.

Engineering notes, research drops, occasional product updates. Roughly monthly.

Arc Labs

Cognitive infrastructure for AI agents. Open core in Rust. Composable primitives you own.

GitHubX / TwitterDiscussions

Brain

  • Memory Layer
  • Documentation
  • Pricing
  • Changelog
  • Status

Developers

  • Start here
  • TypeScript SDK
  • Python SDK
  • Rust SDK
  • MCP Server

Company

  • About
  • Careers
  • Blog
  • Security
  • Contact
Encode"Priya lives in Berlin."mem_7f3a · storedRecall"where does Priya live?"→ BerlinSupersede"Priya moved to Lisbon."mem_9c21 ⊃ mem_7f3aBerlin→ LisbonARC LABSARC LABSARC LABS
© 2026 ARC LABS · BANGALOREPrivacyTermsDPAApache 2.0