Cortex
Automatically syncs codebase changes to the vector database on each commit via a Git hook.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Cortexfind how we handle payment processing"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ง Cortex: Open-Source AI Memory for your Codebase. Works with Claude CLI and others
Never Explain Your Codebase Twice.
๐ฏ What is Cortex ยท ๐ฅ Who Needs It ยท โก How It Works ยท ๐ Quick Start ยท ๐ Docs ยท โ FAQ
๐ฏ What is Cortex?
Cortex is a semantic memory layer for AI coding assistants. It indexes your codebase into a vector database, so AI can find relevant code by meaning โ not just keywords.
โ Without Cortex
You: "Add payment processing"
Claude Code:
โ Reads CLAUDE.md (if exists)
โ Reads README.md
โ Maybe searches some files
โ Picks random agents (unpredictable)
โ Misses your PaymentService
โ Creates duplicate from scratchโ With Cortex
You: "Add payment processing"
Claude Code:
โ Reads CLAUDE.md (finds Cortex instructions)
โ Loads Cortex memory agent
โ Queries MCP: "payment processing"
โ Gets: PaymentService, StripeClient, docs
โ Extends YOUR existing codeRelated MCP server: ContextAtlas
๐ฅ Who Needs Cortex?
You should use Cortex if... | Why it helps |
๐ข Your codebase has 20+ files | AI can't hold everything in context |
๐ You've had AI rewrite existing code | Cortex finds it first |
๐ You have docs AI keeps ignoring | Semantic search surfaces them |
๐ค Your team has established patterns | AI learns and follows them |
๐ธ You want free, local, private | No cloud, no API costs |
โก How It Works
flowchart TB
subgraph INPUT["๐ Your Codebase"]
A1[src/services/payment.ts]
A2[src/utils/logger.ts]
A3[docs/API.md]
A4[README.md]
end
subgraph CORTEX["๐ง Cortex Processing"]
B1[๐ Chunk Files]
B2[๐ข Generate Embeddings]
B3[(๐๏ธ Vector Database)]
end
subgraph QUERY["๐ค AI Assistant"]
C1["User: Add email notifications"]
C2[๐ cortex_query]
C3[๐ Results]
C4[โ
Writes Code]
end
A1 & A2 & A3 & A4 --> B1
B1 --> B2
B2 --> B3
C1 --> C2
C2 -->|"search: notification"| B3
B3 -->|"Found: NotificationService, EmailClient, logging patterns"| C3
C3 --> C4Step | What Happens |
1๏ธโฃ Index | Cortex chunks your code into ~1024 char pieces and creates semantic embeddings |
2๏ธโฃ Query | AI asks natural language questions: "how do we handle notifications?" |
3๏ธโฃ Build | AI receives relevant files and patterns, writes consistent code |
๐ Quick Start
Step 1 ยท Add Cortex
cd your-project
git submodule add https://github.com/Remskill/Cortex.git cortex
cd cortex && cp .env.example .env && npm installStep 2 ยท Configure Ignore Patterns
โ ๏ธ Do this BEFORE syncing! Skips junk to be added to your memory.
cp docs/.cortexignore.default ../.cortexignoreStep 3 ยท Start Services
docker-compose up -dWait for model to be ready

โฑ๏ธ First run downloads the embedding model (~274MB, 2-5 min)
Step 4 ยท Initialize
npm run setupStep 5 ยท Configure MCP
Create .mcp.json in your project root:
{
"mcpServers": {
"cortex": {
"command": "npx",
"args": ["tsx", "cortex/src/server.ts"],
"env": {
"DATABASE_URL": "postgres://cortex:cortex-dev-pass-123@localhost:5433/cortex",
"OLLAMA_URL": "http://localhost:11434"
}
}
}
}Step 6 ยท Restart Claude Code
Run /exit and reopen. Verify with /mcp โ should see cortex: connected

Step 7 ยท Install Git Hook
๐ด Required โ keeps AI memory in sync with your code
npm run hook:installStep 8 ยท Create Cortex Memory Agent (Recommended)
๐ก Why? Agents ensure Claude Code automatically queries Cortex before implementing features.
Option A: Using Claude Code CLI (recommended)
/agents
# โ Select "Create new agent"
# โ Follow prompts to create an agent for searching codebase patterns
# โ Name it something like "cortex-memory-agent"Option B: Copy example agent
# Copy the pre-built agent definition
cp cortex/docs/cortex-memory-agent.md .claude/agents/cortex-memory-agent.mdSee docs/cortex-memory-agent.md for a complete agent example.
Step 9 ยท Add to CLAUDE.md
Tell Claude cli to always use your Cortex agent:
## Cortex Memory
**ALWAYS use the cortex-memory-agent before implementing ANY feature.**
This agent will query Cortex to find existing patterns and prevent code duplication.
Manual query example:
cortex_query("what you're building")โ Done!
cortex_query("how we handle API errors")
cortex_query("existing notification system")
cortex_query("database connection patterns")๐ Git Auto-Sync
After installing the hook, Cortex syncs automatically on every commit:
git commit -m "Add new feature"
# ๐ Syncing changed files...
# โ
src/feature.ts (12 chunks)
# โ
docs/FEATURE.md (5 chunks)Benefit | Description |
๐ค Zero effort | Happens automatically |
โก Incremental | Only changed files |
๐ฏ Always fresh | AI never sees stale code |
๐ ๏ธ MCP Tools Reference
Tool | Purpose |
| Search by meaning |
| Manual file sync |
| Database stats |
| Health check |
| List indexed files |
| Remove from index |
Query Examples
// Find existing implementations
cortex_query("payment processing")
cortex_query("user session management")
// Find patterns
cortex_query("how we handle errors in API routes")
cortex_query("state management approach")
// Find documentation
cortex_query("deployment process")
cortex_query("environment configuration")๐ก Tip: Be specific.
"how we validate user input in forms"beats"validation".
๐ Configuration
.cortexignore
Controls what gets indexed. Copy the default:
cp cortex/docs/.cortexignore.default .cortexignoreAuto-excluded: node_modules, dist, build, .git, binary files
.cortexconfig.json (Optional)
{
"maxFileSize": 52428800
}52428800 = 50MB. Also accepts
"50MB"string format.
๐ป System Requirements
Component | Minimum |
Docker | Docker Desktop or Engine |
RAM | 4GB (8GB recommended) |
Disk | ~2GB for models |
Node.js | v18+ |
๐ง Troubleshooting
docker ps # Is Docker running?
docker-compose logs # Check errors
docker-compose down && docker-compose up -dcortex_stats() // Check if data exists
cortex_list_files() // List what's indexedIf empty, run npm run db:sync
docker-compose down -v # Delete all data
docker-compose up -d # Fresh start
npm run setup # Reinitializeโ FAQ
Yes. MIT licensed, no API costs, no subscriptions. Embeddings run locally via Ollama.
No. Everything runs in local Docker containers. Your code never leaves localhost.
All of them. Cortex indexes text content โ TypeScript, Python, Go, Rust, Java, C++, Markdown, everything.
Grep finds exact text matches. Cortex finds meaning:
Search
"user authentication"โ finds login handlers, JWT code, session managementEven if none of those files contain the words "user authentication"
๐ค Contributing
All contributions welcome:
๐ Bug reports
๐ก Feature ideas & suggestions
๐ Documentation improvements
๐ง Code contributions
Have an idea? Open a GitHub Issue โ we discuss everything!
Fork โ Branch โ PR โ We'll review and merge together.
๐ Similar Projects
If Cortex isn't the right fit, check out Zep โ they solve a similar problem (agent context/memory) with a different approach. We discovered them after building Cortex and found the ideas surprisingly similar. Worth exploring if you need alternatives!
๐ Support
๐ Links
Made with โค๏ธ by Denys Medvediev
โญ Star this repo if it helps you! โญ
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Remskill/Cortex'
If you have feedback or need assistance with the MCP directory API, please join our Discord server