cortexm
Deterministic agent memory. μ=0. Free, local, forever. Same result every time.
cortexm remembers what you tell it. Forever. For free. On your machine. Same result every time.
Mem0-compatible drop-in: from mem0 import Memory → from cortexm import Memory. Zero LLM calls at ingest. Zero LLM calls at retrieval. Zero monthly cost. Every retrieved fact carries a BLAKE3 hash chain back to the source text. One .db file you own.
Quick start
pip install cortexm # works offline, no API keys, single command
from cortexm import Memory # Mem0-compatible surface
m = Memory()
m.add("I work at Google", user_id="alice")
m.search("Where does Alice work?", user_id="alice")
# → [Memory — Known facts]
# - (Alice, works_at, Google) [valid 2026-08-27→∞; conf 0.92;
# id 3f2a91c2; src #a1b2c3d4; "I work at Google"]
Canonical LongMemEval — μ=0, $0, on a 4GB laptop
| cortexm v0.6.4 | MemPalace (honest E2E) | |
|---|---|---|
| canonical LongMemEval (500-Q full corpus) | 97.4% (487/500) | ~96.6% (retrieval-only, no QA) |
| single_session | 100.0% | — |
| knowledge_update | 100.0% | — |
| multi_session | 94.74% | — |
| temporal_reasoning | 95.49% | — |
| LLM calls (ingest + retrieval + judge) | 0 | 0 |
| monthly cost | $0 | $0 |
| determinism | byte-exact across 3× runs | byte-exact |
| owns your data | ✓ single .db file |
✓ |
Full 500-question results (v0.6.2 baseline; v0.6.4 re-run lands the experimental graph-recall + coherence modules below):
| Subtask | Score | Notes |
|---|---|---|
| Overall | 0.974 (487/500) | Full corpus, not a proxy sample |
| single_session | 1.000 | Perfect retrieval across all sessions |
| knowledge_update | 1.000 | Supersession edges working correctly |
| temporal_reasoning | 0.9549 | 6 failures on long-distance relative refs (>2 weeks) |
| multi_session | 0.9474 | 7 failures; 4 retrieval misses, 2–3 arithmetic aggregation gaps |
| Strategy | Score |
|---|---|
| holiday_date, paren_abbreviation, list, sum_or_diff | 1.000 |
| nugget | 0.9691 |
| bool | 0.8571 |
Baseline beaten: v0.5.5 baseline was 0.948; this is a +2.6 pp improvement on the full 500-question corpus.
Known remaining gaps (diagnosed, not guessed):
- Temporal anchoring — degrades on multi-week relative references ("four weeks ago", "10 days ago"). These 6 failures connect to the
temporal_chain_notes/ supersession-history mechanism inreader.py. v0.6.4'scortexm/experimental/coherence.pyadds a deterministic temporal-coherence rerank signal aimed at exactly these. - Arithmetic aggregation — the generalized
sum_or_diffjudge (v0.6.2) fixes the 2–3 real computation gaps. The remaining multi_session failures are retrieval misses (wrong session pulled: poetry instead of podcasts, marketing facts instead of video views), not judge failures. v0.6.4 wires the previously-deadpercentage/numeric_aggjudges and addscortexm/experimental/graph_recall.py(entity-adjacency 2-hop walks) aimed at the wrong-session misses. - BOOL strategy at 85.7% is the weakest category — needs sign-of-evidence refinement for edge cases.
Run the full 500-Q benchmark via GitHub Actions: .github/workflows/longmemeval.yml (20 shards, ~30s/q with per-shard DB caching).
Known boundaries (the short list)
Full detail:
docs/FAILURE_MODES.md— every failure tied to a public benchmark question.
- The extractor is a 61-pattern lookup, not a language model. Phrasings outside the pattern library are silently dropped at ingest (e.g. "Anna has a cat named Whiskers") — they remain retrievable via verbatim/BM25 chunk recall, but never become structured facts. This is the price of μ=0: no generativity, no fabrication, no drift.
- ZK proofs are trusted-prover attestations. The v0.6.4 backend (Pedersen + Sigma protocols on secp256k1) is sound at the commitment layer — challenges are bound to announcements, both OR-proof branches verify, H has no known discrete log, thresholds are enforced — but the linkage between committed values and store rows is established at prove-time by the prover. Verify the integration layer before trusting it against a malicious host.
- Set membership reveals the leaf index. The value stays hidden (random-blinding Pedersen + equality proof); the position in the set does not. Position-hiding needs a ZK-friendly Merkle construction — documented future work.
- No cross-user inference, ever. Every fact is scoped by
user_id; the scope sandbox turns empty scopes into empty results (not unrestricted fallbacks). This is a feature, and it also means no "insight across users" stories. - Compression tiers are documented, not default. int8/binary quantization trade recall for space (see
docs/COMPRESSION.md); the default build keeps full-precision embeddings because the benchmark headroom doesn't justify the loss yet. - Judge coverage is rule-based. The deterministic judge answers via strategy dispatch (bool/list/nugget/sum_or_diff/percentage/numeric_agg/holiday/paren). Questions outside those strategies score 0 even when retrieval succeeded — the failure is honest, the number is real.
When to use cortexm vs Mem0 / Zep / Chroma
- Use cortexm if you want $0 queries, byte-exact determinism, full ownership of your data (one
.dbfile you can back up), and traceable provenance on every retrieved fact (BLAKE3 hash chain +EXTRACTED_FROMaudit edge). - Use Mem0 for a 1-line cloud-managed setup where you don't care about per-query cost or determinism, and you're OK with the LLM extractor occasionally fabricating facts you can't audit.
- Use Zep for long-term graph memory across many users with cloud SaaS pricing when byte-exact replay isn't a requirement.
- Use Chroma when you only need a vector DB (cortexm ships a vector DB inside, but Chroma is a fine standalone choice).
Drop-in plugins (already shipped)
- Mem0-compatible surface:
from cortexm import Memory— drop-in forfrom mem0 import Memory - LangChain:
plugins/langchain→context-m-langchainon PyPI - LlamaIndex:
plugins/llamaindex→ postprocessor - OpenAI Agents SDK:
plugins/openai_agents - Claude Code:
plugins/context-m-claude— session lifecycle hooks - MCP server:
cortexm serve(stdio JSON-RPC, zero extra dependencies) - REST server:
cortexm serve-rest— OpenAPI 3.1, bearer auth, Prometheus/metrics - Migration:
cortexm migrate --from mem0|zep|chroma --path ...
Documentation
The README is intentionally short. Everything else lives in docs/:
| Doc | What's in it |
|---|---|
docs/ARCHITECTURE.md |
Layer 1 Symbolic Trace + Layer 2 VSA Palace + μ=0 Bridge in detail |
docs/BENCHMARKS.md |
Full Tier 1-4 results: OOD, in-distribution, real-GitHub, canonical LongMemEval |
docs/METHODOLOGY.md |
How every headline number was measured + honest scope |
docs/FAILURE_MODES.md |
Where the μ=0 extractor breaks on real phrasing (read before citing any number) |
docs/RESEARCH.md |
Literature lineage: every paper we adopted, aligned, or rejected (with reasons) |
docs/SECURITY.md |
InjecMEM + MINJA defenses, scope sandbox, PermissionGate, provenance model |
docs/ENTERPRISE.md |
PII firewall, encryption at rest, RBAC, audit, GDPR, backup/DR, REST API |
docs/DEPLOYMENT.md |
SDK / MCP / REST / Docker / K8s / Helm runbooks |
docs/COMPRESSION.md |
Storage tiers (int8 / binary / rabitq / pq) + measured trade-offs |
docs/ROADMAP.md |
Phase status vs the strategic plan |
docs/GOVERNANCE.md |
Foundation governance + licensing commitments |
docs/PLAYBOOK_v2.md |
Migration playbook from Mem0 / Zep / Chroma |
Examples & tests
examples/— runnable scripts, offline, no API keys (01_quickstart → 20_agent_session)tests/— 698 tests: fabric + enterprise + PPR + concurrency + sandbox + enrichment + WAL crash-recovery + migration + CRDT federation + Rust parity + ZK soundness/forgery + public-API smokecortexm/experimental/— deterministic research borrows (graph recall, coherence) — μ=0 or it doesn't shipleaderboard/— self-hosted benchmark site (rebuild:python leaderboard/build.py; openleaderboard/index.html)AGENTS.md— how AI coding agents should interact with this repo (2026 standard)CONTRIBUTING.md— contribution guide
License
Apache 2.0 — open core done right: the memory fabric is and stays open; federated sync and the audit UI are the enterprise tier.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cortexm-0.6.4.tar.gz.
File metadata
- Download URL: cortexm-0.6.4.tar.gz
- Upload date:
- Size: 554.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cf8e4a30903eef4080fb5a8ce2f9ee13b3e5fc81ff81ca8e3985796ee51add8
|
|
| MD5 |
6170e9b588f30018f81322e464ee9657
|
|
| BLAKE2b-256 |
c56f0158fd4077ca8b1b3976348f0814a72f42b9ca3d26082ea47a50876bd940
|
Provenance
The following attestation bundles were made for cortexm-0.6.4.tar.gz:
Publisher:
release.yml on ssmurfgg04-gif/context-m
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexm-0.6.4.tar.gz -
Subject digest:
6cf8e4a30903eef4080fb5a8ce2f9ee13b3e5fc81ff81ca8e3985796ee51add8 - Sigstore transparency entry: 2661849375
- Sigstore integration time:
-
Permalink:
ssmurfgg04-gif/context-m@2382950c64f98eeebf013f151f9556427f07317c -
Branch / Tag:
refs/tags/v0.6.4 - Owner: https://github.com/ssmurfgg04-gif
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2382950c64f98eeebf013f151f9556427f07317c -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexm-0.6.4-py3-none-any.whl.
File metadata
- Download URL: cortexm-0.6.4-py3-none-any.whl
- Upload date:
- Size: 504.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1d01b529b6a4ac96ed276bb36e54f9630bf6e948f626fec0e6dc6fe8d04c134
|
|
| MD5 |
e346c09c8ad521572ccf6ee707d13b1c
|
|
| BLAKE2b-256 |
901bff8ddffe39769e27581a8534f8b703bbe68d2996fb2ab82758132378f289
|
Provenance
The following attestation bundles were made for cortexm-0.6.4-py3-none-any.whl:
Publisher:
release.yml on ssmurfgg04-gif/context-m
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexm-0.6.4-py3-none-any.whl -
Subject digest:
e1d01b529b6a4ac96ed276bb36e54f9630bf6e948f626fec0e6dc6fe8d04c134 - Sigstore transparency entry: 2661849423
- Sigstore integration time:
-
Permalink:
ssmurfgg04-gif/context-m@2382950c64f98eeebf013f151f9556427f07317c -
Branch / Tag:
refs/tags/v0.6.4 - Owner: https://github.com/ssmurfgg04-gif
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2382950c64f98eeebf013f151f9556427f07317c -
Trigger Event:
push
-
Statement type: