Quick Start

Get mem20 running in 60 seconds:

git clone https://github.com/JaysonAIOnline/mem20.git
cd mem20
python -m venv .venv && .venv/bin/pip install -r requirements.txt
MEM20_STORE_PATH=~/.mem20/store .venv/bin/python mcp/mcp_server.py

Then point your MCP host at the server stdio. That's it — 97 tools, 13 domains, zero config beyond the store path.

Requirements

Python 3.11+, pip, and an OpenAI-compatible LLM endpoint (NVIDIA NIM by default). Optional: Blender, Unity for 3D integrations.

Architecture Overview

mem20 has four layers that all enforce a single invariant: simulated content never reaches grounded indexes.

LayerComponentPurpose
Transportmcp/mcp_server.pyJSON-RPC 2.0 over stdio, tool dispatch
Cognitioncog/cognitive_engine.pyPlan, chain, reason, reflect
Memorymemory_engine/memory.pyGrounded vs simulated store, indexes
GovernanceStore-level guardsContamination firewall, epistemic veto

Memory Partitions

mem20 keeps two logical partitions:

The Contamination Firewall

Five hard invariants keep the partition real:

  1. Vector + BM25 indexes call _assert_grounded() at the lowest write path
  2. remember() is grounded-only by default
  3. Append-only ledger with validated origin/store tags
  4. Promotion requires evidence (prediction resolution or external verifier)
  5. Epistemic status stamped directly on the record

Configuration

VariableDefaultPurpose
MEM20_STORE_PATH~/.mem20/storeMemory engine location
MEM20_LLM_BASE_URLNVIDIA NIMLLM chat endpoint
MEM20_LLM_MODEL(project default)Model name
NVAPI_KEYLLM bearer token (required)
MEM20_ENV_FILEOptional .env to load keys from

Deployment

For production, mem20 runs as a systemd user service:

sudo ./install.sh --user <user> --dir /opt/mem20

Then verify health:

curl http://localhost:8080/health   # → {"status":"ok", ...}
curl http://localhost:8080/metrics  # → tool counters + contamination_rate

Tool Domains (13)

PrefixDomain
memory_*Core memory, epistemic, ingest, pins, namespaces
self_model_*Agent self-model
cog_*Cognitive processing
imagination_*Counterfactual simulation
theory_of_mind_*Perspective simulation
corrigibility_*Shutdown / capability tiers
roadmap_*Roadmap registry
world_model_*Variables, rules, prediction ledger
affective_*Values, emotions, goals
procedural_*Skill library
fs_*Sandboxed filesystem
blender_*Blender automation — OPTIONAL
unity_*Unity automation — OPTIONAL

Governance

Safety is structural, not advisory. The audit command checks both grounded store and BM25 corpus for simulated records:

{ memory_audit_contamination() }

On a clean system this returns contamination_rate: 0.0.

Epistemic Veto

Records below a trust threshold are quarantined. A plan built on simulated or low-trust premises cannot execute — the cognitive engine enforces this on every plan()/aplan() call.

Adding a Tool

  1. Pick the domain module for your tool
  2. Add self.tools["name"] = mt.Tool(...) to register_<domain>_tools()
  3. Add dispatch branch + _name(self, args) handler in the same mixin
  4. Keep engine-side invariants intact
  5. Run verification/verify_refactor.py

License

MIT. See LICENSE on GitHub.