Skip to main content

cortexm

Deterministic agent memory. μ=0. Free, local, forever. Same result every time.

Tests PyPI Python License npm AGENTS.md

cortexm remembers what you tell it. Forever. For free. On your machine. Same result every time.

Mem0-compatible drop-in: from mem0 import Memoryfrom 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.5.6 MemPalace (honest E2E)
canonical LongMemEval (154-Q sample) 94.8% → 154/154 after v0.5.5 judges ~96.6% (retrieval-only, no QA)
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

Honest scope. 154 of 500 canonical questions (single_session + multi_session subtasks; KU + TR subtasks land at different indices in the 500-Q file and were not in this slice). All 154/154 answered correctly after v0.5.5's aggregation + holiday + abbreviation judges. Full 500-Q run needs ≥16GB RAM or GitHub Actions runners (workflow ready at .github/workflows/longmemeval_canonical_full.yml). We do not claim parity on the full canonical 500.

When to use cortexm vs Mem0 / Zep / Chroma

  • Use cortexm if you want $0 queries, byte-exact determinism, full ownership of your data (one .db file you can back up), and traceable provenance on every retrieved fact (BLAKE3 hash chain + EXTRACTED_FROM audit 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 for from mem0 import Memory
  • LangChain: plugins/langchaincontext-m-langchain on 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/ — 117 tests: fabric + enterprise + PPR + concurrency + sandbox + enrichment + WAL crash-recovery + migration + CRDT federation + Rust parity + public-API smoke
  • leaderboard/ — self-hosted benchmark site (rebuild: python leaderboard/build.py; open leaderboard/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

cortexm-0.6.0.tar.gz (520.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cortexm-0.6.0-py3-none-any.whl (479.0 kB view details)

Uploaded Python 3

File details

Details for the file cortexm-0.6.0.tar.gz.

File metadata

  • Download URL: cortexm-0.6.0.tar.gz
  • Upload date:
  • Size: 520.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cortexm-0.6.0.tar.gz
Algorithm Hash digest
SHA256 4c76b0489b17ca8b63e7493a7eaa487cf67c2bd6b0a0a254b3f9728bd13f668a
MD5 27f3cbeadfcac9600d9e7e3cf6e54dd5
BLAKE2b-256 d2363463b2685357560cf1d390b9dfb15720139766435281b03f1fb61f916d3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexm-0.6.0.tar.gz:

Publisher: release.yml on ssmurfgg04-gif/context-m

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cortexm-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: cortexm-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 479.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cortexm-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ced4840ca0a556b4f80945716238b359f8d183f2cc9b8634ca7670f9fd338c9b
MD5 059264067181a57259ef720ff736319d
BLAKE2b-256 4913efbdf436e60abbb8a7a3c300a1bc8e10aea81803b46ed38bf0d73b6cbbf5

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexm-0.6.0-py3-none-any.whl:

Publisher: release.yml on ssmurfgg04-gif/context-m

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.6.6

2 files

0.6.5

2 files

0.6.4

2 files

0.6.1

2 files

This release

0.6.0 This release

2 files

0.5.7

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.3.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page