Arc Labs
BrainDocsPricing
GitHubSign inGet Started
LearnProduction

Top Mistakes Building Agent Memory

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

This guide covers 8 mistakes teams make when building agent memory: ignoring latency, poor schema design, semantic-only retrieval, no eviction policy, storing raw conversations, embedding drift, cold start latency, and inadequate monitoring. Avoiding these will save weeks of debugging.

1. Ignoring latency until it's too late

Mistake: Starting with a remote vector DB (Pinecone, Weaviate) and realizing too late that agent loop latency doubled.

Why it happens: Early prototypes feel fast because you're testing with small loops. At scale, 200ms retrieval × 10 loops per decision = 2s slowdown.

Fix:

  • Measure latency (P50, P99, P99.9) from day 1
  • Co-locate a self-hosted memory server and use a cache-first architecture for tight loops
  • Reserve remote DBs for non-latency-critical paths

Example:

// ❌ Wrong: latency adds up
const memory = await remoteVectorDB.query(query); // 200ms
const context = await llm.complete(prompt); // 1000ms
const action = await executeAction(context); // 200ms
// Total: 1.4s per turn

// ✅ Right: cache-first + co-located memory server
const cached = await redis.get(query); // 5ms hit
if (!cached) {
  const answer = await client.recall(new RecallBuilder(query).maxResults(5).build()); // 30ms
  redis.set(query, JSON.stringify(answer.memories)); // Cache
}

2. Poor schema design (too flexible, too rigid)

Mistake: Starting with a single content field and no metadata, or over-indexing every field.

Why it happens: Either "we'll figure it out later" (you won't) or "we might need to filter by anything" (you don't).

Fix:

  • Define schema upfront: what fields will you filter by?
  • Use JSON metadata for flexible key-value data
  • Index only what you query

Example:

// ❌ Wrong: vague, low-signal text
await client.encode(new EncodeBuilder("something").build());

// ✓ Right: a clear, atomic fact. Brain's write-path extractors turn well-formed
// text into typed entities and statements server-side (declare your types with
// SCHEMA_UPLOAD), so recall's graph retriever has structure to anchor on—no
// hand-maintained metadata object needed.
await client.encode(new EncodeBuilder("User u1 asked about enterprise pricing on turn 5.").build());

3. Using semantic retrieval only (no keyword filtering)

Mistake: Embedding everything and relying on semantic similarity. Often returns plausible but wrong results.

Why it happens: Semantic search feels magical at first. You assume it "just works."

Fix:

  • Always add keyword filtering (BM25, prefix matching)
  • Use hybrid retrieval: semantic score + keyword score + metadata filter
  • Validate recall on your actual queries

Example:

// Note: with Brain you don't choose "semantic only" vs "hybrid." Every recall
// fans out to all three retrievers (semantic, lexical/BM25, entity-graph) and
// fuses them with RRF, then reranks—hybrid is the default and only mode.
const answer = await client.recall(
  new RecallBuilder("What did the user ask?").maxResults(5).build()
);
// answer.answerKind is "Single", "Many" or "None"; the hits are answer.memories

4. No eviction policy (unbounded memory growth)

Mistake: Never removing old memories. Costs and retrieval quality degrade over time.

Why it happens: You assume more memory is always better. In practice, old memories become noise.

Fix:

  • Set TTLs: short-term (1 hour), mid-term (1 week), long-term (1 month)
  • Implement decay: recent memories weight higher
  • Monitor memory size and cost per agent

Example:

// Brain ages memories server-side via its per-shard decay + retention workers
// (configured at deploy time), so you don't attach a client-side TTL. Just
// encode the memory; recall already weights recent memories higher, and stale
// entries decay out on their own.
await client.encode(new EncodeBuilder(content).build());

// When you need a memory gone immediately, forget it by id:
await client.forget(new ForgetBuilder(memoryId).build());

5. Storing raw conversations (too verbose)

Mistake: Embedding every message as-is. Results in poor retrieval quality and high costs.

Why it happens: Easiest thing to do. Feels like you're capturing everything.

Fix:

  • Summarize conversations: extract intent, action, outcome
  • Compress: "User: Hello. Agent: Hi. User: What's the price?" → "User asked about pricing"
  • Lazy evaluation: summarize only on retrieval, not on storage

Example:

// ❌ Wrong: raw messages
await client.encode(
  new EncodeBuilder("User: What's the price? Agent: Our pricing is...").build()
);

// ✓ Right: summarized to one clean fact
const summary = await llm.summarize(conversation); // "User inquired about pricing for enterprise plan"
await client.encode(new EncodeBuilder(summary).build());

6. Embedding drift (changing models without migration)

Mistake: Upgrading your embedding model but not re-embedding old vectors. Queries fail silently.

Why it happens: You test with new embeddings, assume old ones work fine.

Fix (with Brain, this is mostly handled for you):

  • Brain owns the embedding model (BGE-small-en-v1.5, 384-dim) server-side—clients send text, never vectors—so there's no client-side embedding version to drift.
  • The operator pins the model at the server; a model change is an operator-side re-embed/migration, not something each client tracks.
  • Your job is just to send clean text and let the server embed it consistently.

Example:

// Clients send text; the server embeds it with its pinned model.
await client.encode(new EncodeBuilder(content).build());

7. Cold start latency (no initialization)

Mistake: Initializing embeddings/models on first agent request (adds 500ms–5s latency).

Why it happens: Lazy loading "simplifies" deployment.

Fix:

  • Warm up embedding model before agent starts
  • Pre-load common queries
  • Use managed Cloud to avoid cold starts

Example:

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

// Open the connection and issue a warmup recall before serving traffic
async function initializeAgent() {
  const auth = { kind: "token", token: new TextEncoder().encode(process.env.BRAIN_API_KEY!) };
  const client = await BrainClient.connect("127.0.0.1", 9090, { auth });
  await client.recall(new RecallBuilder("warmup").maxResults(1).build());
  // Now ready for traffic
  return client;
}

const client = await initializeAgent();
startAgent(client);

8. No monitoring (flying blind)

Mistake: Not measuring retrieval quality, latency, cost. Finding problems in production.

Why it happens: "Monitoring is for later." Later never comes.

Fix:

  • Measure latency percentiles (P50, P99, P99.9)
  • Track retrieval recall: Is the right memory being retrieved?
  • Monitor cost per agent and total
  • Set alerts for anomalies

Example:

async function recallWithMetrics(query: string, maxResults = 5) {
  const start = performance.now();
  const answer = await client.recall(new RecallBuilder(query).maxResults(maxResults).build());
  const latency = performance.now() - start;

  analytics.track("memory_recall", {
    latency,
    resultCount: answer.memories.length,
    query: query.substring(0, 50),
  });

  return answer.memories;
}

Bonus: Anti-patterns to avoid

Anti-patternWhy it failsFix
Global memory (no agent scope)Mixing agent contextsAlways scope to spaceId
No error handlingSilent failuresRetry logic + circuit breaker
Searching raw embeddingsSimilarity is noisyAdd metadata filtering
Storing all LLM outputsMost are irrelevantFilter by importance
No versioningChanging memory schema breaks queriesVersion your tuple types

Checklist: Before shipping agent memory

  • Latency is < 50ms P99 for agent loop
  • Schema is defined and documented
  • Hybrid retrieval (semantic + keyword) is implemented
  • TTL/eviction policy is set
  • Memory is summarized, not raw text
  • Embedding model version is pinned
  • Cold start is handled (pre-warmed or managed)
  • Monitoring is in place (latency, recall, cost)
  • You've tested on realistic agent loops (10+ turns)
  • You understand cost per agent at your target scale

Learning resources

  • Cheat Sheet — Quick reference for schema, retrieval, deployment
  • Memory Architectures — System design patterns
  • Hybrid Retrieval — Fusion techniques and tuning

Related reading

  • FoundationsAgent Memory Cheat Sheet
PreviousThe Background Worker: 7 Maintenance JobsNextSchema Design Patterns for 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