@mono-agent/memory-search
v0.3.0
Published
Local semantic search over memory: Ollama/OpenAI embeddings and a brute-force cosine vector index.
Readme
@mono-agent/memory-search
Category
Category: context
Responsibility
Local semantic search over memory. It embeds text with a pluggable
provider (Ollama nomic-embed-text by default, OpenAI as a fallback) and stores
vectors in a dependency-free JSON Lines index searched by brute-force cosine
similarity — fast and simple well under ~50k chunks, with no external vector
database or native build. It also gathers indexable chunks from the journal
archive and an entity snapshot.
Install / Usage
pnpm --filter @mono-agent/memory-search run buildimport { createEmbeddingProvider, createVectorMemoryIndex, gatherMemoryChunks } from "@mono-agent/memory-search";
const embeddings = createEmbeddingProvider({ provider: "ollama", model: "nomic-embed-text" });
const index = createVectorMemoryIndex({ path: "./.mono-agent/memory/index/embeddings.jsonl", embeddings });
await index.rebuild(await gatherMemoryChunks("./.mono-agent/memory", entities));
const hits = await index.search("what did we decide about pricing?");Public API
createEmbeddingProvider,OllamaEmbeddingProvider,OpenAIEmbeddingProvidercreateVectorMemoryIndex,VectorMemoryIndexgatherMemoryChunksMemorySearchErrorEmbeddingProvider,EmbeddingProviderConfig,MemoryChunk,SearchHit,VectorMemoryIndexOptions,EntityLike,MemorySearchErrorCode
Dependency Boundary
This package depends only on the local filesystem and the Fetch API (for the embedding service). It has no other runtime dependencies and no native build. The caller decides when to rebuild the index (typically the nightly consolidation job).
What This Package Does Not Own
It does not own the journal or graph storage, does not extract entities, does not
schedule consolidation, and does not expose MCP tools. It only embeds, indexes, and
ranks. Hybrid recall (FTS + vector) is orchestrated by @mono-agent/memory-store.
Verification
pnpm --filter @mono-agent/memory-search run build
pnpm --filter @mono-agent/memory-search run typecheck
pnpm --filter @mono-agent/memory-search run test