# Agent Memory -- Cross-Comparison Review

**Last updated:** 2026-05-10

This directory contains comparisons of @coda/search against agent memory systems. While these systems solve a different problem than search (knowledge accumulation vs ranked retrieval), they expose a critical gap in our agent architecture: cross-session learning.

---

## Compared Systems

| Project                                                  | Stars | Type                                    | Our Verdict                                                  |
| -------------------------------------------------------- | ----- | --------------------------------------- | ------------------------------------------------------------ |
| [Stash](stash-comparison.md)                             | 675   | 8-stage consolidation pipeline (Go/MCP) | No techniques for search; high-value patterns for agent loop |
| [Memori](memori-comparison.md)                           | —     | Memory system comparison                | Analysis of memory architecture patterns                     |
| [Memos](memos-comparison.md)                             | —     | Memory system comparison                | Analysis of memo-style knowledge persistence                 |
| [LLM Wiki (memory layer)](llm-wiki-memory-comparison.md) | —     | Wiki-style knowledge compilation        | Memory-focused analysis of Karpathy's LLM Wiki pattern       |

---

## Cross-Cutting Findings

### 1. Agent memory is a real gap -- but in the agent loop, not the search layer

Stash's core patterns (episodes -> facts -> relationships -> patterns -> hypotheses) are compelling for the agent loop (`apps/server`), not the search engine (`packages/search`). The search layer indexes authoritative schema metadata; confidence decay and knowledge consolidation don't apply.

### 2. The memory market has consolidated

| Project                     | Stars  | Status                                   |
| --------------------------- | ------ | ---------------------------------------- |
| **Mem0**                    | 55,253 | Active (daily) -- dominant market leader |
| **Letta** (formerly MemGPT) | 22,577 | Quiet since Apr 12                       |
| **MemOS**                   | 8,996  | Active -- self-evolving memory OS        |
| **engram**                  | 3,374  | Active -- SQLite + FTS5 keyword search   |
| **Stash**                   | 675    | Stalled since May 1                      |

If we pursue agent memory, **Mem0** (55K stars, active daily) and **engram** (3.4K stars, keyword search, Go+MCP stack) are stronger candidates than Stash.

### 3. Stash's development has stalled

- 675 stars, flat growth
- No commits since May 1
- All 4 open issues unchanged (including SQL injection #5)
- Zero test files
- Solo maintainer

Stash is an interesting design document, not a production tool.

---

## What We Could Adopt for the Agent Loop

These patterns are relevant to `apps/server` (the agent), not `packages/search` (the search engine):

| Pattern                   | Gap in Agent                                           | Stash Analog                                     | Better Candidate |
| ------------------------- | ------------------------------------------------------ | ------------------------------------------------ | ---------------- |
| Cross-session user memory | Agent forgets user domain, preferences, common queries | Episodes -> Facts consolidation per tenant       | Mem0             |
| Failure pattern tracking  | Same tool failures repeat across sessions              | `Failure` model with `reason` + `lesson`         | Custom (simple)  |
| Goal continuity           | Multi-session tasks rediscover context from scratch    | `Goal` model with status, priority, parent/child | Custom or Letta  |
| Namespace-scoped memory   | No tenant isolation for memory                         | Slash-delimited hierarchy with cascading reads   | Mem0             |

---

## What We Do Better

1. **Retrieval precision**: 8-signal RRF fusion with NDCG=0.887 vs vector-only cosine similarity
2. **Latency**: 10-15ms vs ~50-200ms (PostgreSQL round-trip)
3. **Cost**: $0 always vs LLM calls per consolidation run
4. **Composability**: 12 pluggable interfaces vs monolithic `Brain` class
5. **Test coverage**: 1,386 tests vs zero test files
6. **Security posture**: No known injection vectors vs open SQL injection issue (#5)

---

## Recommendations

### For Search (@coda/search)

No action needed. Agent memory patterns don't transfer to schema retrieval.

### For the Agent (apps/server) -- Future Work

1. **Evaluate Mem0** as the foundation for cross-session agent memory (COD project: agent quality work)
2. **Implement simple failure tracking** in the agent loop -- no external dependency needed
3. **Consider engram** if we want Go+MCP stack alignment
