Bitware Labs/Monograph TR-02 · @bitwarelabs/bwmem
TypeScript Agent Memory SDK · v0.13.0 · 93.2% LongMemEval
bwmem, memory that survives the session
The former memory layer from our long-running agent, published as a standalone SDK. No longer actively maintained following Luna's transition to HippoRAG-based OS-style virtual memory paging. Preserved here as an open AGPL-3.0 reference implementation and benchmark baseline.
Notice (October 2026): Following the major architectural overhaul of
Luna Chat—specifically the transition from monolithic context assembly to
HippoRAG (Personalized PageRank) OS-style virtual memory paging,
sandboxed subagent execution, and procedural micro-tool distillation—@bitwarelabs/bwmem
has concluded its active lifecycle and is no longer maintained.
The package remains accessible on npm (final release v0.13.0)
and GitHub under AGPL-3.0 as a permanent reference implementation of bi-temporal fact indexing,
rejected-value tombstones, and LongMemEval benchmark methodology. Active memory engineering continues directly within the Luna research build.
The problem it solves
§ 01 · RationaleBolting a vector store onto a chatbot gives you something that looks like memory for about a month. Then the corpus fills with near-duplicates, retrieval quality falls as storage grows, nothing ever becomes false, and cost scales with history rather than relevance.
bwmem treats memory as a pipeline rather than a bucket. Messages go in; structured facts, summaries, embeddings and a knowledge graph come out, and a background consolidation pass keeps the whole thing from silting up. The longer argument is here.
What it scores, and why that is a weaker claim than it looks
§ 02 · EvidenceMemory systems are easy to describe and hard to verify, so the system bwmem was extracted from is measured against LongMemEval, the standard long-term-memory benchmark.
| System | Reader model | Retrieval | Score |
|---|---|---|---|
| bwmem (v0.13.0 + Jev) | deepseek-v4.1-flash | adaptive / Jev (250q) | 93.2% (233/250) |
| bwmem (v0.11 engine) | qwen3.8-max | adaptive | 85.0% |
| bwmem (v0.11 engine) | glm-5.3 | adaptive | 81.7% |
| bwmem (v0.11 engine) | gemini-3.7-flash | adaptive | 81.7% |
| bwmem (v0.11 engine) | muse-spark-1.2 | adaptive | 80.0% |
| bwmem (v0.11 engine) | solar-pro4 | adaptive | 80.0% |
| bwmem (v0.11 engine) | qwen3.7-flash | adaptive | 78.3% |
| bwmem (v0.11 engine) | glm-5.3-flash | adaptive | 78.3% |
| bwmem (v0.11 engine) | gpt-5.6-sol-pro | adaptive | 75.0% |
| bwmem (v0.11 engine) | qwen3.8-flash | adaptive | 75.0% |
| bwmem (v0.11 engine) | ling-3.0-flash | adaptive | 71.7% |
| bwmem (v0.11 engine) | deepseek-v4-pro | adaptive | 70.0% |
| bwmem (v0.11 engine) | deepseek-v4-flash-0731 | adaptive | 63.3% |
| bwmem's parent stack (MemoryCore) | solar-pro4 | 25 | 78.3% |
| bwmem (0.10.x release) | deepseek-v4-pro | 25 | 77.5% |
| bwmem (0.10.x release) | deepseek-v4-flash-0731 | 25 | 69.0% |
| ceiling: perfect retrieval | deepseek-v4-pro | · | 88.3% |
| bwmem's parent stack | deepseek-v4-pro | 25 | 81.7% |
| bwmem's parent stack | gpt-4o | 25 | 78.3% |
| Zep (self-reported) | · | · | 63.8–71.2% |
| mem0 (self-reported) | · | · | ~49% |
How the architecture works
§ 03 · Designbwmem operates across five cooperating layers of epistemic protection:
- 1. Episodic logging & turn windowing: Every interaction and event is logged with full temporal context, session lineage, and lateral turn windows (±1) that preserve conversational continuity without dragging in full-session distractor noise.
- 2. Bi-temporal fact extraction: Facts are stored across two timelines: system recording time and validity time in the real world. Strict subject boundaries and anti-meta filters guarantee assistant persona details, tool errors, and search diagnostics never pollute user memory.
- 3. Fast merge gates & contradiction lifecycle: Incoming claims are evaluated in ~250ms via TypeSafe AI structured decision models rather than slow generative calls, distinguishing temporary situational instructions from standing policies while managing open, held, and resolved contradictions.
- 4. Rejected-value tombstones (v0.13): Memory is as much about permanent excision as learning. When a claim is excised or rejected, a durable tombstone record (keyed on SHA-256 value hashes and token similarity) guarantees retroactive extraction sweeps across conversation transcripts cannot silently resurrect the discarded belief.
- 5. Pre-reply curation & consolidation routines: A fast candidate curator audits recall relevance before prompt assembly, maintaining an auditable dropped-memory ledger. Nightly background jobs distill dialogue, prune duplicates, and optimize the knowledge graph.
Archive & reference usage
§ 04 · Status & SDKPackage status: This package is archived and no longer under active development.
Install from npm for historical reference, audit, or research:
npm install @bitwarelabs/bwmem
The SDK includes native drivers for PostgreSQL (pgvector), Redis, optional Neo4j graph, OpenRouter, OpenAI, Ollama, and a standalone Fastify REST API with API key authentication and usage tracking.
Complete documentation, TypeScript definitions, and code examples remain available on npm and GitHub under AGPL-3.0. For the active next-generation memory paging architecture, see Luna's research architecture (§ 03).