A tiny, dependency-free memory layer for LLM agents — self-editing core blocks + an append-only archive, with pluggable smart recall.
Give your agent a memory that survives every session without a vector database, an embedder, or a server. Memory keeps two things on disk: self-editing core blocks that are always in context (persona, the human, working notes), and an append-only archival log you can recall from. Recall runs a fast keyword/recency prefilter and — if you plug one in — hands the candidates to any LLM to rerank and answer. No reranker? It degrades to keyword recall and never throws. Node and Python twins share the exact same files.
coreSet / coreAppend maintain a small set of always-in-context blocks — persona, the human you serve, rolling working notes. memoryPrompt() renders them straight into your system prompt. Atomic writes; safe on synced drives.
remember(text, meta) appends to a plain JSONL log — no vector DB, no embedder, no server. It's grep-able, diff-able, and trivially backed up. The store is the source of truth, shared byte-for-byte by the Node and Python twins.
recall(query) runs a keyword/recency prefilter that's useful on its own. Set MEMORY_RERANKER to any LLM adapter and it reranks the candidates and answers the query. No reranker configured? It returns the keyword hits and never throws.
Every value comes from .env. Nothing here is tied to any account — bring your own.
# 1. no install needed — pure Node builtins (Python twin is stdlib-only) node lib/memory.cjs health # 2. write some memory, then recall it node lib/memory.cjs remember "the launch shipped on the 14th, all green" node lib/memory.cjs remember "the retro is next Tuesday" node lib/memory.cjs recall "when did we launch" # 3. edit the always-in-context core blocks node lib/memory.cjs core-set human "Ada — founder, ships fast" node lib/memory.cjs prompt # renders the blocks for your system prompt # 4. (optional) smart recall — point at any LLM adapter MEMORY_RERANKER=./examples/reranker-echo.cjs node lib/memory.cjs recall "when did we launch"