How to build a retrieval system for agents
Memelord is a fully local memory system for coding agents that keeps a per-project SQLite database (via Turso) of corrections, insights and user-requested memories, embedded with all-MiniLM-L6-v2 and retrieved by cosine vector search at task start. Each memory carries a weight updated by exponential moving average from the agent's 0-3 usefulness ratings, plus time decay for unused memories, and memories flagged as wrong are deleted immediately. Integration with Claude Code uses an MCP server and lifecycle hooks, and a TypeScript SDK accepts a bring-your-own embedding function for custom agents. The argument is that retrieval beats dumping lessons into .md system prompts, which wastes the finite context window.
Related posts
- Giving OpenClaw a memory that actually works
Turso mediumAdeptMemelord, a per-project agent memory system built on Turso, plugs into OpenClaw through mcporter. It replaces OpenClaw's flat Markdown-chunk memory with weighted memories that are reinforced when useful, decay when ignored or unused, and are deleted when contradicted. Setup takes three commands, and the agent gets five MCP tools covering the task lifecycle. Retrieval is a single SQL query in a local SQLite file that ranks results by cosine similarity times an exponential recency decay, with embeddings generated locally by all-MiniLM-L6-v2.
- Give Your Coding Agents a Memory You Own
Hugging Face mediumAdeptfunes is an open-source, single-binary memory layer that indexes the session traces of coding agents (Claude Code, Codex, pi, Hermes) so any agent can recall past decisions and rationale with exact provenance. A deterministic pipeline parses traces into a common turn-and-block shape, chunks and embeds them locally into an append-only Lance dataset, and answers queries with hybrid vector+BM25 search, rank fusion, cross-encoder reranking, recency reweighting and neighbor-chunk expansion. Memories can be published to a private Hugging Face dataset with secret redaction, letting them follow you across machines, agents and teammates. On a handoff-vs-recall benchmark, recall was 4-8x cheaper than a written handoff, while compaction failed on one task because its summary flattened key findings.
- Introducing Loom: agent memory that keeps up with your code
ClickHouse mediumAdept
Loom is an open-source agent memory system that stores memories alongside a code index (functions, classes, call graph) in a single ClickHouse database, so facts about code are linked to definitions and flagged when that code is renamed or rewritten. Facts are versioned rather than overwritten, conflicts are flagged, and namespaces support one-way, N-way and personal-to-shared promotion sharing between agents like Claude Code and Codex. Retrieval fuses vector search, BM25, verbatim chunks and an entity graph scoped by permissions inside the query, and reports when the best match is too weak to answer from. On ClickHouse code questions, mean answer score rose from 0.78 to 0.84 with cost per question falling from $0.212 to $0.17, and memory.ask scored 96.6% on LongMemEval.
- Building AI Agents That Remember with Mastra and Turso Vector
Turso mediumAdeptMastra, a TypeScript AI agent framework, can use Turso's libSQL (a SQLite fork with native vector search) as a single database for agent memory, telemetry and vector embeddings. The walkthrough configures LibSQLStore and LibSQLVector, enables Mastra's semanticRecall with OpenAI embeddings, registers multiple named vector stores, and builds a RAG ingestion workflow (recursive chunking at 512 tokens with 50 overlap, embedMany, upsert) plus a vector query tool for a weather agent. Turso's vector support covers six types from FLOAT32 down to 1-bit, giving up to 32x compression, and vectors of up to 65,536 dimensions, with no extensions required.
- Building a Retrieval Pipeline with Turso and Voyage AI
Turso mediumAdeptTurso's SQLite-compatible engine with native vector columns, paired with Voyage AI embedding and reranking models, replaces a multi-service RAG stack with a single embeddable database for agent retrieval and memory. Documents are indexed with voyage-4-large and queried with voyage-4-lite in a shared embedding space. Candidates are retrieved via a DiskANN index (vector_top_k) or an exact vector_distance_cos scan, then reranked with instruction-following rerank-2.5. Matryoshka dimensions and int8/binary quantization map onto Turso's F32/F16/1-bit blob columns to cut storage and scan cost 4–32x. The main caveat: Turso's MVCC concurrent-write mode doesn't yet support the DiskANN index, so write-heavy agent memory should use exact scan under MVCC.