The extra-context layer for AI agents — L1 eviction, sticky L2/L3 context pools, context paging, cold-tier compression.
A high-performance context hierarchy between an agent’s history and its model window.

Memex treats context as a hierarchy, not a notes store: when the native context window fills up, older spans are moved out verbatim into sticky L2 (10M, session-private) / L3 (100M, workspace-shared) context pools; capacity is managed through a lossless cold tier plus bounded batch digests; and selected context pages can be retrieved under per-model context budgets. Retrieval and excerpting do not guarantee every relevant fact is included.
git clone https://github.com/QiuXu-Tech/memex.git
cd memex
node scripts/build-bundle.mjs && node scripts/check-bundle.mjs
node --import ./test/register.mjs ./test/run.mjs # offline harness (165 tests)
Install the built bundle into a DSH profile: install guide.
| L1 eviction | Uses the shipped compaction/prune + surface-replace seam — no custom session events, no replacement of the compaction backend. |
| Sticky context pools | Session-private L2 vs workspace-shared L3; capture deepest enabled level; capacities 10M/100M. |
| Context paging | Shared query-term extractor, FTS + cold abstracts + exact numeric/identifier anchors + lexical rerank; pages are injected only when budget allows. A private archive previously reported recall@5 93%, cold recall 94%, hit@1 65% (68% with coldPartial: 0), and p50 ~2.9 ms. In the v0.30.0 synthetic Codex Sol A/B, control answered 3/60, treatment with pre-retrieved evidence 60/60, and evicted probes 0/57 → 57/57; all six calls exited zero and all three actual tails were checked in order. Earlier DeepSeek, Terra and Claude results have a tail-order caveat; Claude Sonnet/Opus/Fable/Haiku each reported 60/60 with ~39.7–40.7k gateway-reported tokens per model. Small historical anchor-free runs reported 0/3 → 3/3 for hot, cold and cold partial/synonym cases; a real Claude tool loop answered 3/3 against the live MCP server. |
| Capacity compression | Cold tier (lossless, zero LLM) and bounded map-reduce digests (2-way concurrency, retry/fallback, ids: enforcement, quota GC) — after the model asks the user. |
| Surfaces | Seven model tools, /memory command set, nine /api/memory.* routes, Web panel + context ring, sensitive-content policy, backup/verify/restore. |
MIT licensed © QiuXu-Tech. Not affiliated with or endorsed by DeepSeek.