feat: remember_document() tool with chunking strategies #15
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
remember()is designed for storing short, focused facts — decisions, experiences, preferences. When callers need to index long-form content (conversation exports, documents, meeting transcripts), they have to implement their own chunking logic before callingremember()multiple times.This was discovered during the LongMemEval benchmark project, where storing whole conversation sessions (500-2000 words) as single memories resulted in 45% zero recall — Valkey's semantic search couldn't match short questions against large undifferentiated blobs. Switching to turn-pair chunking (one user+assistant exchange per memory) reduced zero recalls to 0% and improved answer quality dramatically.
Proposed solution
Add a
remember_document()MCP tool:Chunking strategies
turn_pairs— splits onUser:/Assistant:alternating turns. Each exchange stored as one memory. Best for conversation exports.sentences— splits on sentence boundaries. Good for articles, notes, documentation.paragraphs— splits on double newlines. Good for structured documents.fixed_tokens— splits into chunks ofchunk_sizetokens with overlap. General purpose fallback.Why this matters
remember()simple for its primary use case (short facts)Benchmark evidence
LongMemEval results comparing whole-session vs turn-pair chunking:
The improvement is entirely due to chunking granularity — same Valkey search, same recall pipeline, different input preparation.
Related
remember_document()returning keys makes cleanup trivialClosing — shipped in v5.0.0.
remember_document()is a registered MCP tool with the four chunking strategies (turn_pairsfor User:/Assistant: transcripts,sentences,paragraphs,fixed_tokenswith configurable size), storing each chunk as an individual memory linked by a shareddoc_idwithchunk_index/chunk_strategymetadata, plus per-chunk near-duplicate skipping. Driven by exactly the finding in this issue — whole-session storage produced 45% zero-recall on 500–2,000-word inputs while turn-pair chunking dropped that to 0%.Since then it also feeds the async enrichment queue (v5.2.0, #19) and the supplement-not-replace fact architecture (v5.3.1, #20).