@agentskit/memory — for agents
Chat + vector memory backends, plus hierarchical, encrypted, graph, and personalization stores.
#Install
npm install @agentskit/memory#Primary exports
#Chat memory (ordered history)
fileChatMemory({ path })— JSON file.sqliteChatMemory— SQLite-backed.redisChatMemory— Redis-backed.tursoChatMemory— Turso / libSQL.createWebStorageMemoryfrom@agentskit/memory/web-storage— injected, SSR-safelocalStorage/sessionStoragewith runtime validation, byte/message bounds, cancellation, and host-owned legacy migration.
#Vector memory
fileVectorMemory({ path })— JSON file.redisVectorMemory— Redis Vector.pgvector,pinecone,qdrant,chroma,upstashVector— BYO-client / HTTP vector adapters. See Vector adapters.supabaseVectorStore,weaviateVectorStore,milvusVectorStore,mongoAtlasVectorStore— managed / cluster backends.matchesFilter(record, filter)— utility for evaluating vector-store filter predicates outside an adapter.
#Higher-order memory
createVirtualizedMemory(from@agentskit/core) — hot window + cold retriever.createHierarchicalMemory— MemGPT tiers (working / recall / archival).createAutoSummarizingMemory(from@agentskit/core/auto-summarize) — fold oldest into a summary.createEncryptedMemory— AES-GCM over anyChatMemory. See Encrypted memory.createInMemoryGraph— knowledge graph (nodes + edges + BFS). See Graph memory.createInMemoryPersonalization+renderProfileContext— per-subject profile. See Personalization.wrapChatMemoryWithRedaction(mem, { rules, mode?, vault?, allowedRoles? })— redact (or tokenize) PII at save() time on anyChatMemory. Pairs with@agentskit/core/securitytokenize/revealfor role-gated read.wrapVectorMemoryWithRedaction(mem, { rules, mode?, vault?, allowedRoles? })— same forVectorMemory.store(). Embeddings pass through verbatim; redact the input to your embedder separately if it is a hosted provider.forgetSubject(memory, subjectId)/makeForgettable(memory)— GDPR-style right-to-erasure helpers that purge all records for a subject acrossChatMemoryandVectorMemory.
#Key-value store (AgentskitMemoryStore)
A generic get(key)/set(key,value) store with TTL + max-key eviction, complementing the conversation ChatMemory model — for agent scratchpad, pipeline state, and arbitrary JSON keyed by string.
createInMemoryStore(config)/createFileStore(config)/createLocalStorageStore({ config, storage? })— zero-dependency backends.createSqliteStore({ config, open })—openis a better-sqlite3-style opener;tryDefaultSqliteOpener()lazy-importsbetter-sqlite3.createRedisStore({ config, client })—clientis aRedisLike;adaptIoredis(io)bridges ioredis,tryDefaultRedisClient(url)lazy-imports node-redis.createVectorStore({ config, vectorStore, embedder })— exact-keyget/setplus arecall(query, k)similarity search.createKvMemoryFromConfig({ config, sqlite?, redis?, vectorStore?, embedder? })/createKvMemoryFromConfigAuto(config)— dispatch over aKvMemoryConfig(in-memory/file/sqlite/localstorage/redis/vector); the auto form lazy-loads optional drivers.MEMORY_BACKEND_SUPPORT/isMemoryBackendSupported/MemoryBackendNotImplementedErrordescribe coverage.
#Minimal example
import { createInMemoryMemory, createVirtualizedMemory } from '@agentskit/core'
const memory = createVirtualizedMemory(createInMemoryMemory(), { maxActive: 50 })#Related
- @agentskit/rag — embedders + retrievers on top of vector memory.
- @agentskit/core — the
ChatMemory/VectorMemorycontracts.
#Source
- npm: https://www.npmjs.com/package/@agentskit/memory
- repo: https://github.com/AgentsKit-io/agentskit/tree/main/packages/memory
Explore nearby
- PeerFor agents — overview
Dense, LLM-friendly reference for every AgentsKit package. Designed to paste into an agent's context window.
- Peer@agentskit/core — for agents
Zero-dependency foundation. Contracts, chat controller, primitives, and a dozen feature subpaths.
- Peer@agentskit/adapters — for agents
Provider adapters (OpenAI-compatible + native) + router + ensemble + fallback + generic factory.