Persistent memory for coding agents.
Stale facts expire automatically.
Cortex-MCP pairs a local-first bi-temporal knowledge graph with an Okapi BM25 + 2-hop graph context compiler, semantic contradiction auditor, and TruthGate citation exporter.
Why Bi-Temporal Memory Matters
Vector stores stuff contradictions into your prompt. Cortex retires them.
When an engineering team migrates token formats or database isolation levels, append-only RAG surfaces both old and new notes simultaneously.
Architecture & Capabilities
Everything inside the MCP server
Zero runtime cloud dependencies. Standard JSON-RPC 2.0 over stdio, HTTP/SSE, and serverless FastAPI.
7 MCP Tools
memory_record_episode
Immutable ADRs, invariants, migrations, and bug root causes
memory_upsert_fact
Singular predicates auto-close prior conflicting edges
memory_compile_context
Okapi BM25 + 2-hop activation within strict max_tokens
cortex_audit_contradictions
Polarity, antonym, alias & multi-value drift auditor
Deterministic Safety
valid_from / valid_until / superseded_by
Full point-in-time travel via memory_time_travel(as_of)
SHA-256 Merkle Root
Tamper-evident canonical hashing over every fact & episode
4 Conflict Detectors
Negation polarity, technical antonyms, aliases & drift
Code-Aware Tokenizer
Splits snake_case, CamelCase & paths for exact symbol boost
Transports & Grounding
stdio · HTTP/SSE · Streamable HTTP
Local JSON persistence or hosted Vercel stateless gateway
TruthGate SourceDocument Export
Emit citation-verifiable JSON bundles via export-sources
3 Resources & 2 Prompt Templates
cortex://graph/summary, integrity, architecture-briefing
7 CLI Subcommands
demo, benchmark, serve-stdio, serve-http, audit, export
How It Works
Three deterministic stages from session amnesia to verified prompts
Record & Supersede
Upsert structured facts with transaction and valid timestamps. Writing a new singular predicate atomically closes the prior claim's validity window.
Audit Contradictions
Detect negation polarity inversions, opposing technical antonyms, predicate alias collisions, and unsuperseded concurrent drift.
Compile Token Budget
Rank active subgraphs with Okapi BM25 and 2-hop spreading activation, pack within max_tokens, and export TruthGate citation bundles.
Live Contradiction & Supersession Preview
Switch engineering scenarios to inspect how Cortex-MCP flags drift before compilation.
Reproducible Evidence (500 Facts · 150 Supersessions · 100 Episodes)
Sub-millisecond graph operations without cloud latency
Measured via cortex-mcp benchmark across 60 entities and 50 context compilation queries.
Engineering FAQ
Design decisions & operational guarantees
Why bi-temporal tracking instead of a flat vector store?
Vector similarity treats deprecated config (like JWT_HS256) and its replacement (PASETO_v4_public) as equally true neighbors. Bi-temporal bounds (valid_from, valid_until, superseded_by) exclude superseded facts while preserving historical time travel via memory_time_travel.
What is the difference between the hosted Vercel endpoint and local stdio?
The hosted Vercel endpoint (https://cortex-mcp-steel.vercel.app/mcp) runs statelessly in memory per serverless instance for instant zero-install testing. For private, persistent project memory saved atomically to disk, run cortex-mcp serve-stdio --storage .cortex/memory.json.
How does Cortex-MCP integrate with TruthGate?
cortex-mcp export-sources (and export_truthgate_sources()) emit verified GroundedSourceDocument payloads carrying temporal provenance and the graph SHA-256 Merkle root so downstream verification gates can prove zero stale-fact citation.
How is tampering detected in local graph storage?
Every recorded episode and temporal fact participates in a canonical SHA-256 hash and deterministic Merkle root digest checked by memory_verify_integrity and exposed on cortex://graph/integrity.