Semantic memory search for AI agents
npm install @xfabric/memorySemantic memory search for AI agents. SQLite-backed with vector + FTS hybrid search.
``mermaid
graph TB
subgraph Input
MD[Markdown Files]
SESS[Session Transcripts]
end
subgraph Core
MM[MemoryManager]
CHUNK[Chunker]
EMB[Embedding Provider]
end
subgraph Providers
OAI[OpenAI]
GEM[Gemini]
LOC[Local/llama.cpp]
end
subgraph Storage
DB[(SQLite)]
FTS[FTS5]
VEC[sqlite-vec]
end
subgraph Search
VS[Vector Search]
KS[Keyword Search]
HYB[Hybrid Merge]
end
MD --> MM
SESS --> MM
MM --> CHUNK
CHUNK --> EMB
EMB --> OAI
EMB --> GEM
EMB --> LOC
EMB --> DB
DB --> FTS
DB --> VEC
FTS --> KS
VEC --> VS
VS --> HYB
KS --> HYB
HYB --> MM
`
`bash`
pnpm add @xfabric/memory
`typescript
import { MemoryManager } from "@xfabric/memory/full";
const memory = await MemoryManager.create({
agentId: "my-agent",
workspaceDir: "/path/to/workspace",
provider: "openai", // or "gemini", "local"
});
// Search
const results = await memory.search("authentication flow");
// Write memory
await memory.writeMemory("## Today\n- Fixed auth bug");
// Close
await memory.close();
``
- Hybrid search: Vector similarity + FTS5 keyword matching
- Multiple providers: OpenAI, Gemini, local (llama.cpp)
- Batch API: Async embedding for large workspaces
- Auto-sync: File watcher with debouncing
- Session indexing: Index conversation transcripts
- Memory flush: LLM-powered extraction from sessions
MIT