CogniRepo gives AI agents persistent semantic memory, a knowledge graph, AST indexing, BM25 retrieval, and 34 MCP tools — so they stop forgetting everything between sessions. No API required. Fully offline.
# ~50 MB install — no PyTorch, no CUDA required pip install cognirepo # One-command setup: init + index + MCP config cognirepo setup # Start the MCP server — Claude, Cursor, VS Code, Gemini cognirepo prime # Or use uvx (no install needed) uvx cognirepo prime
Every AI session starts cold. CogniRepo fixes that by building a cognitive layer between your codebase and your AI agents — memory that survives process restarts.
AST parser (tree-sitter) extracts symbols, call graphs, and docstrings across Python, JS, TS, Go, Rust, Java. Stored in a FAISS vector index + NetworkX knowledge graph + BM25 full-text index. Atomic writes — crash-safe at any size.
cognirepo setup
The MCP server exposes 34 tools. Agents call get_agent_bootstrap() for a single-call session start (~300 tokens vs ~900 for 4 calls), then context_pack() for packed, token-efficient context.
get_agent_bootstrap() → resume in one call
Decisions, errors, episode logs, and user preferences survive session boundaries. Encrypted at rest with Fernet. Cross-process FAISS freshness — multiple agents share the same memory without stale snapshots.
get_last_context() → resume instantly
FAISS-powered vector store with ONNX embeddings (~50 MB — no PyTorch, no CUDA). Similarity search across codebase symbols, docs, and episodic logs. Cross-process freshness via mtime checks.
NetworkX DiGraph tracks IMPORTS / CALLS / INHERITS / CALLS_API / DEFINED_IN / QUERIED_WITH edges across repos. Multi-repo org graph with cross-service traversal. AI agents add DISCOVERED edges dynamically.
Tree-sitter parses Python, JS, TS, Go, Rust, Java. Extracts functions, classes, symbols, decorators, base classes, arrow functions, and call relationships. Atomic writes (tmp + os.replace + fsync) — never corrupts on crash.
FastMCP stdio transport exposes 34 tools. Works with Claude Code, Cursor, VS Code Copilot, Gemini — any agent that speaks Model Context Protocol. get_agent_bootstrap() cuts session start from 4 calls to 1.
Timestamped log of decisions, errors, and milestones — searchable by BM25 + time range. record_decision() writes architectural choices that survive forever. supersede_learning() replaces stale knowledge in one call.
Blends vector score (0.5) + graph score (0.3) + behaviour score (0.2). BM25 as episodic side-channel and embedding-failure fallback. Confidence gate — code hits must score ≥0.25 or retrieval returns a structured failure, never README noise.
Fernet AES-128-CBC encryption at rest, secrets in OS keychain. Circuit breaker monitors RSS and degrades gracefully before OOM. Idle resource eviction frees ~400 MB after configurable TTL. OOM-safe at any repo size.
org_wide_search() spans all registered repos in one query. Cross-service call graph maps how microservices call each other. cognirepo org rewire repairs CALLS_API edges missed by indexing order.
Opt-in query recording across context_pack, lookup_symbol, who_calls, and more. Feedback scores propagate to vector store with temporal decay. Auto-summarizes interaction style every 10 queries.
Tools are the single entry point. All retrieval goes through hybrid.py.
All storage lives under .cognirepo/. No surprises.
.cognirepo/ · Fernet encrypted
All tools accept repo_path — one server process can serve multiple repos without cross-repo data leaks.
One pip install. One cognirepo setup. Works with Claude Code, Cursor, VS Code, and Gemini out of the box. No API key. No cloud. Fully local.