ShardMemo
Research implementation of a three-tier sharded memory service for LLM agents that applies scope predicates before routing retrieval.
At a Glance
Self-hosted official implementation of ShardMemo released under the MIT License; free to use, modify and distribute. LLM API costs are external (BYOK).
Engagement
Available On
Alternatives
Listed Oct 2026
About ShardMemo
ShardMemo is the official implementation of the paper "ShardMemo: Scope-Before-Routing for Agentic Memory Retrieval" (listed as Findings of EMNLP 2026). It is a Python memory service for LLM agents that stores evidence in shards and restricts which shards a request may access before any routing happens. The repository includes experiment scripts for LoCoMo, HotpotQA and ToolBench.
What It Is
ShardMemo is a three-tier agentic memory architecture. Tier A keeps a bounded active context. Tier B stores evidence in shards, each with a shard-local approximate nearest neighbor index. Tier C holds a versioned skill library with skill induction, retrieval and validated execution.
How Retrieval Works
In Tier B, metadata predicates first determine which shards a request is allowed to access. A learned masked router then probes a few of the admissible shards, so inadmissible shards never consume probe budget. A controller gates between tiers and manages the read path across all three. Ranking fuses BM25 with embedding-based evidence scores.
Running the Experiments
Setup requires Python 3.11 or newer, installing the pinned requirements and copying .env.example to .env. Answers are generated by any LLM behind an OpenAI-compatible API, configured through LLM_API_KEY, LLM_BASE_URL and LLM_MODEL. Scripts run_locomo.py, run_hotpotqa.py and run_toolbench.py cover ablations, probe-budget sweeps, shard-count scaling, label-noise robustness, long-context HotpotQA at several sizes, and Tier C skill retrieval. Each run writes a summary.json and a report.md, with embeddings and LLM responses cached locally. Settings live in shardmemo/config.py.
Community Discussions
Be the first to start a conversation about ShardMemo
Share your experience with ShardMemo, ask questions, or help others learn from your insights.
Pricing
Open Source (MIT)
Self-hosted official implementation of ShardMemo released under the MIT License; free to use, modify and distribute. LLM API costs are external (BYOK).
- MIT License
- Self-hosted Python 3.11+ implementation
- Three-tier memory service: active context, sharded evidence, skill library
- Works with any OpenAI-compatible LLM API configured by the user (external cost)
Capabilities
Key Features
- Three-tier memory: active context, sharded evidence, versioned skill library
- Metadata-predicate scoping before routing
- Learned masked router with Top-B probe and adaptive Top-P selection
- Shard-local HNSW/flat approximate nearest neighbor indexes
- BM25 and fused evidence ranking
- Skill induction, versioning and validated execution
- Experiment scripts for LoCoMo, HotpotQA and ToolBench
- Cached embeddings and LLM responses
- OpenAI-compatible LLM backend
