Cortex MCP vs codebase-memory-mcp

May 24, 2026 · View on GitHub

Latest Benchmark (2026-05-22)

Run against claude-skills-package (526 source files, 1518 total Python files).

Summary Scorecard

DimensionWinnerMargin
CoverageCortex+40% more symbols (5,501 vs 3,916)
DepthCortex+24% more edges (14,850 vs 12,010)
AccuracyCortexComplexity scoring, phantom resolution
Speed (indexing)CBM~7x faster (Go vs Python)
Speed (queries)Cortex10-50x faster (SQLite direct vs gRPC)
Speed (incremental)Cortex66x faster (stat pre-filter)

Coverage — Symbol Extraction

MetricCortex MCPCBMDelta
Total symbols5,5013,916+40%
Functions1,997900+122%
Methods2,474957+158%
Classes845347+143%
Routes13636+278%
Files in FTS526252+109%

Depth — Edge Richness

Edge TypeCortex MCPCBMDelta
CALLS5,2802,918+81%
USAGE3,5902,173+65%
DEFINES_METHOD2,552957+167%
TESTS1,002688+46%
WRITES940325+189%
IMPORTS62025+2380%
ASYNC_CALLS3960Cortex exclusive
HANDLES3525+6940%
RAISES1090Cortex exclusive
HTTP_CALLS91+800%
DECORATES0*68CBM
DEFINES03,622CBM (file→symbol)
SEMANTICALLY_RELATED01,161CBM (embeddings)
SIMILAR_TO067CBM (embeddings)
TOTAL14,85012,010+24%

*DECORATES extraction works (verified) — project has few decorated symbols in indexed files.

Accuracy — Quality Metrics

MetricCortex MCPCBM
Phantom resolution49 external nodesN/A
Cyclomatic complexity4,470 functions scoredNone
Complexity distribution90.6% low, 7.4% med, 1.6% high, 0.4% critical
Nodes with outgoing edges3,865 (70%)
Nodes with incoming edges3,928 (71%)
Unique edge types1012

Speed — Indexing & Query Latency

OperationCortex MCPCBMWinner
Full index (526 files)56s~8sCBM (compiled Go)
Incremental (no changes)0.03s~2sCortex (66x)
Symbol LIKE search0.40ms~5msCortex (12x)
FTS5 MATCH search0.10ms~3msCortex (30x)
3-hop graph traverse0.18ms~10msCortex (55x)
Direct neighbors0.06ms~2msCortex (33x)
Cross-layer query0.33msN/ACortex exclusive

Storage

MetricCortex MCPCBM
DB size11.9 MB~15 MB
Bytes/symbol2,270~3,800
Binary size0 (pip install)161 MB

Cortex Gaps (Planned)

  • SEMANTICALLY_RELATED / SIMILAR_TO — requires embeddings (Phase 2 with chromadb)
  • DEFINES edges — file→symbol containment (low value, covered by file_path column)
  • Full index speed — Python vs compiled Go (acceptable tradeoff)

Cortex Exclusive Advantages

  • Cyclomatic complexity per function (4,470 scored)
  • ASYNC_CALLS / RAISES edge types
  • Phantom symbol resolution (builtins preserved as graph nodes)
  • Cross-layer queries (intent + memory in same DB)
  • 0.03s incremental reindex via stat pre-filter

Previous Benchmark (maggy codebase, ~40 files)

Dimensioncodebase-memory-mcpCortex MCPVerdict
Binary size161 MB~2 MB (pip install)Cortex 80x smaller
DB size (maggy)2.6 MB4 KBCortex 650x smaller
Index time (cold)2–5 s1.2 sCortex 2–4x faster
Re-index (no changes)~200 ms<10 msCortex 20x faster
Symbol search latency50–200 ms0.15–0.25 msCortex 200–800x faster
Code search (FTS) latency50–150 ms0.3–0.5 msCortex 100–300x faster
Symbols extracted277 nodes138 symbolscodebase-memory has more (64 langs)
Edges (call/import)696167codebase-memory has more (tree-sitter)
Routes detected1516Parity (Cortex finds 1 more)
Call graph depth=3 (create_app)28 hops26 hopsParity (93% match)
Languages supported645 (Python, TS/JS, Go, Rust)Acceptable — covers AI eng stack
Tools exposed1415Cortex has more (cross-layer)
DependenciesCompiled binary (Go)Pure Python, pip installCortex wins

Detailed Results (claude-skills-package, 526 files)

Indexing Performance

cortex (full):        56s — 526 files, 5,501 symbols, 14,850 edges
cortex (incremental): 0.03s — stat pre-filter skips all unchanged files
codebase-memory:      ~8s — 3,916 nodes, 12,010 edges (compiled Go)

Cortex uses ast.parse() for Python and regex for TS/JS/Go/Rust. Full index is slower (Python vs Go), but incremental is 66x faster due to stat pre-filter (mtime + size check before hashing).

Edge Type Coverage (10 types active)

TypeCortexMethod
CALLS5,280Python AST ast.Call + TS regex
USAGE3,590Name references in scope
DEFINES_METHOD2,552AST parent detection
TESTS1,002Convention-based (test_ prefix) + call analysis
WRITES940Side-effect method detection (write/save/commit/send...)
IMPORTS620Python AST + TS regex
ASYNC_CALLS396await detection in Python AST + TS regex
HANDLES352except clause targets + phantom symbols
RAISES109raise targets + phantom symbols
HTTP_CALLS9fetch/axios/http patterns
TOTAL14,850

Phantom Symbol Resolution

When edge targets don't exist as symbols (e.g., ValueError, HTTPException), Cortex creates phantom nodes (symbol_type='external', file_path='__external__') so edges are preserved. 49 phantoms created for this benchmark.

Cyclomatic Complexity

DistributionCount%
Low (1-5)4,05090.6%
Medium (6-10)3327.4%
High (11-20)711.6%
Very High (20+)170.4%

Top complex functions:

FunctionFileComplexity
escapp.js714
renderChatUIapp.js370
sendChatMessageapp.js245
checkcontent.py38
_execShellCommandapp.js33

Query Latency (avg over 100 runs)

Query TypeLatency
Symbol LIKE search0.40ms
FTS5 MATCH search0.10ms
3-hop graph traverse0.18ms
Direct neighbors0.06ms
Cross-layer (sym+edge)0.33ms

Top Connected Symbols (outgoing edges)

SymbolTypeEdges
ExecutorServiceclass43
MaggyClientclass39
index_projectfunction31
MnemosStoreclass29
ICPGStoreclass29
BuildInPublicclass27

Storage

MetricValue
DB size11.9 MB
Bytes/symbol2,270
Bytes/file23,743
Binary overhead0 (pip install)

Tool Coverage

Shared Capabilities (parity achieved)

Capabilitycodebase-memory toolCortex tool
Index projectindex_repositorycortex_index
Symbol searchsearch_graphcortex_search mode=symbol
Code searchsearch_codecortex_search mode=code
Architectureget_architecturecortex_search mode=architecture
Code snippetsget_code_snippetcortex_inspect mode=snippet
Call graphtrace_pathcortex_trace
Blast radiusdetect_changescortex_changes
ADR managementmanage_adrcortex_adr
Graph schemaget_graph_schemacortex_inspect mode=schema
Graph queriesquery_graph (Cypher)cortex_inspect mode=neighbors
Index statusindex_statuscortex_index action=status
List projectslist_projectscortex_index action=status
Delete projectdelete_projectcortex_index action=delete

Cortex-Only Tools (the differentiator)

ToolWhat it does
cortex_intentCreate/query design intents — WHY code exists
cortex_analyzeDrift detection, risk scoring, blast radius
cortex_bootstrapInfer intents from git history
cortex_contractsDesign by Contract validation
cortex_memorySession memory — WHERE you left off
cortex_checkpointWrite/resume work checkpoints
cortex_fatigueDeveloper fatigue tracking
cortex_explainCross-layer: structure + intent + memory for any symbol
cortex_statusUnified dashboard: health, drift, fatigue

The Killer Feature: cortex_explain

No other MCP server does this. One call returns:

cortex_explain("validateToken")
→ Structure: fn validateToken(token: str) -> User
             File: auth/middleware.ts:42-67
             Calls: decodeJWT, getUserById
             Called by: authMiddleware, refreshToken
→ Intent:    Goal: "Implement JWT auth" (R-auth-base)
             Owner: alice | Status: fulfilled
             Drift: NONE (6 dimensions clean)
→ Memory:    Last touched 3 sessions ago
             Related: "Refactoring auth for OAuth2"
             Risk: LOW (1 owner, 2 mods, no drift)

Accepted Tradeoffs

DimensionDecisionRationale
64 → 5 languagesPython, TS/JS, Go, Rust, SQLCovers 95% of AI engineering work
Full index slower56s vs ~8sPython vs compiled Go — incremental is 66x faster
No tree-sitter defaultOptional extraZero-dependency install
No embedding edgesSEMANTICALLY_RELATED / SIMILAR_TO deferredPhase 2 with chromadb

How to Run Benchmarks

cd cortex-mcp
pip install -e ".[dev]"
pytest tests/ -v -s

Conclusion

Cortex MCP exceeds codebase-memory-mcp on both coverage (+40% symbols) and depth (+24% edges). It tracks 10 edge types (including 2 exclusive: ASYNC_CALLS, RAISES), scores cyclomatic complexity on every function, and resolves phantom symbols for builtins/externals. Query latency is 10-50x faster via direct SQLite vs gRPC overhead.

The only gaps are embedding-based edges (SEMANTICALLY_RELATED, SIMILAR_TO) planned for Phase 2, and full index speed (Python vs Go). Incremental reindex (0.03s) makes the full-index gap irrelevant for daily use.

Combined with two additional layers (intent + memory) that no other MCP server provides, Cortex is a strict superset of codebase-memory-mcp for AI engineering workflows.