GZOO Cortex
Supports using Google Gemini models via an OpenAI-compatible API for knowledge extraction and reasoning across registered projects.
Enables local-first or local-only LLM inference through Ollama for privacy-focused entity extraction and ranking.
Provides connectivity with OpenAI-compatible API endpoints for analyzing codebase structure and performing natural language queries.
GZOO Cortex
Local-first knowledge graph for developers. Watches your project files, extracts entities and relationships using LLMs, and lets you query across all your projects in natural language.
“What architecture decisions have I made across projects?”
Cortex finds decisions from your READMEs, TypeScript files, config files, and conversation exports — then synthesizes an answer with source citations.
Why
You work on multiple projects. Decisions, patterns, and context are scattered across hundreds of files. You forget what you decided three months ago. You re-solve problems you already solved in another repo.
Cortex watches your project directories, extracts knowledge automatically, and gives it back to you when you need it.
Related MCP server: better-code-review-graph
What It Does
Watches your project files (md, ts, js, py, json, yaml) for changes
Extracts entities: decisions, patterns, components, dependencies, constraints, action items
Infers relationships between entities across projects
Detects contradictions when decisions conflict
Queries in natural language with source citations
Searches semantically — blends keyword and vector (embedding) similarity so queries match by meaning, not just keywords (optional; see Semantic Search)
Routes intelligently between cloud and local LLMs
Respects privacy — restricted projects never leave your machine
Web dashboard with knowledge graph visualization, live feed, and query explorer
MCP server for direct integration with Claude Code
Quick Start
1. Install
npm install -g @gzoo/cortexIf global install fails with EACCES, use a user prefix instead:
mkdir -p ~/.local
npm config set prefix ~/.local
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
npm install -g @gzoo/cortexOr install from source:
git clone https://github.com/gzoonet/cortex.git
cd cortex
npm install && npm run build && npm linkVerify: cortex --version (current release: 0.8.1)
2. Setup
Run the interactive wizard:
cortex init
cortex doctor # verify config, providers, and DBThis walks you through:
LLM provider — Anthropic, Google Gemini, DeepSeek, Groq, OpenRouter, or Ollama (local)
API key — saved securely to
~/.cortex/.envRouting mode — cloud-first, hybrid, local-first, or local-only
Watch directories — which directories Cortex should monitor
Budget limit — monthly LLM spend cap
cortex init writes global config to ~/.cortex/cortex.config.json. API keys go in ~/.cortex/.env.
3. Register Projects
cortex projects add my-app ~/projects/app
cortex projects add api ~/projects/api
cortex projects list # verify4. Ingest, Watch & Query
Backfill existing files first — the watcher only picks up new changes:
cortex ingest "~/projects/app/src/**/*.ts" # one-shot backfill
cortex serve # dashboard + API + file watcher (recommended)Command | What it does |
| Web dashboard + API + file watcher ( |
| CLI-only file watcher (no dashboard) |
| One-shot ingestion; events do not appear in the Live Feed |
Don't run
watchandservetogether — they compete for file changes. The Live Feed shows real-time events fromcortex serveonly (file saves while the server is running).
cortex query "what caching strategies am I using?"
cortex query "what decisions have I made about authentication?"
cortex find "PostgreSQL" --expand 2
cortex contradictions5. Web Dashboard
cortex serve # open http://localhost:3710Remote access:
cortex serve --host 0.0.0.0Auth is enforced automatically on non-localhost hosts. A bearer token is auto-generated and saved to ~/.cortex/.env (read it with grep CORTEX_SERVER_AUTH_TOKEN ~/.cortex/.env). Open the dashboard once with http://<host>:3710/?token=<token> — the token is embedded only for requests that already prove possession of it and is then kept for the browser tab (so anonymous visitors never receive it). API/WebSocket calls behind a reverse proxy use Authorization: Bearer <token>.
Excluding Files & Directories
Cortex ignores node_modules, dist, .git, and other common directories by default. To add more:
cortex config exclude add docs # exclude a directory
cortex config exclude add "*.log" # exclude by pattern
cortex config exclude list # see all excludes
cortex config exclude remove docs # remove an excludeHow It Works
Cortex runs a pipeline on every file change:
Parse — file content is chunked by a language-aware parser (tree-sitter for code, remark for markdown)
Extract — LLM identifies entities (decisions, components, patterns, etc.)
Relate — LLM infers relationships between new and existing entities
Detect — contradictions and duplicates are flagged automatically
Store — entities, relationships, and vectors go into SQLite + LanceDB
Query — natural language queries search the graph and synthesize answers
All data stays local in ~/.cortex/. Only LLM API calls leave your machine
(and never for restricted projects).
LLM Providers
Cortex is provider-agnostic. It supports:
Anthropic Claude (Sonnet, Haiku) — via native Anthropic API
Google Gemini — via OpenAI-compatible API
DeepSeek (Reasoner, Chat) — strong reasoning, very affordable
Groq — fast inference with free tier
Any OpenAI-compatible API — OpenRouter, local proxies, etc.
Ollama (Mistral, Llama, etc.) — fully local, no cloud required
Cost tracking uses provider-aware rates for DeepSeek, Gemini, Groq, and OpenRouter models — not a blanket Anthropic fallback.
Embeddings (for semantic search) are configured as a separate provider — independent of your chat model — so you can run chat on DeepSeek and embeddings on OpenAI. See Semantic Search.
Routing Modes
Mode | Cloud Cost | Quality | Ollama Required |
| Varies by provider | Highest | No |
| Reduced | High | Yes |
| Minimal | Good | Yes |
| $0 | Good | Yes |
In cloud-first mode, all tasks route to your cloud provider. Ollama is not required and is only used if budget fallback is enabled. Hybrid mode routes high-volume tasks (entity extraction, ranking) to Ollama and reasoning-heavy tasks (relationship inference, queries) to your cloud provider.
Requirements
Node.js 20+
LLM API key for cloud modes — Anthropic, Google Gemini, DeepSeek, Groq, or any OpenAI-compatible provider
Ollama — only for
hybrid,local-first, orlocal-onlymodes (install)
Configuration
Config is layered — later sources override earlier ones:
Priority | Location | Scope |
1 | Built-in defaults | Global |
2 |
| Global (created by |
3 |
| Project overrides (optional) |
4 |
| Session |
API keys are stored separately in ~/.cortex/.env (never in config JSON).
cortex config list # see all non-default settings
cortex config set llm.mode hybrid # switch routing mode
cortex config set llm.budget.monthlyLimitUsd 10 # set budget
cortex config exclude add vendor # exclude a directory from watching
cortex privacy set ~/clients restricted # mark directory as restricted
cortex doctor # validate setupFull configuration reference: docs/configuration.md
Semantic Search (Embeddings)
Cortex blends keyword (full-text) search with vector similarity, so queries match by meaning rather than exact words. Embeddings are optional and off by default — enable them with a cloud embeddings provider (no local GPU or Ollama required):
cortex config set llm.embeddings.enabled true
cortex config set llm.embeddings.baseUrl https://api.openai.com/v1
cortex config set llm.embeddings.model text-embedding-3-small
cortex config set llm.embeddings.apiKeySource env:OPENAI_API_KEY
cortex config set llm.embeddings.dimensions 1536
# then add the key to ~/.cortex/.env:
echo 'OPENAI_API_KEY=sk-...' >> ~/.cortex/.envThe embeddings provider is independent of your chat provider — run chat on DeepSeek (or Anthropic, Groq, …) and embeddings on OpenAI. Any OpenAI-compatible embeddings endpoint works.
New files are embedded automatically as they're ingested. To build the index for a graph you already ingested, run a one-time reindex:
cortex reindex # all projects
cortex reindex my-app # a single projectCommands
Command | Description |
| Interactive setup wizard |
| Validate config, providers, projects, secrets, and database |
| Manage registered projects |
| Web dashboard + API + file watcher (port 3710) |
| CLI-only file watcher |
| One-shot file ingestion (separate from Live Feed) |
| Rebuild the semantic (embedding) search index for existing entities |
| Natural language query with citations |
| Find entities by name |
| Graph stats, costs, provider status |
| Detailed cost breakdown |
| List active contradictions |
| Resolve a contradiction |
| Manage Ollama models |
| Start MCP server for Claude Code |
| Post-ingestion summary |
| Set directory privacy |
| Read/write configuration |
| Manage file/directory exclusions |
| Manage running watch/serve processes |
| Database operations |
Full CLI reference: docs/cli-reference.md
Web Dashboard
Run cortex serve to open a full web dashboard at http://localhost:3710 with:
Dashboard Home — graph stats, recent activity, entity type breakdown
Knowledge Graph — interactive D3-force graph with clustering, click to explore
Live Feed — real-time file change and entity extraction events via WebSocket (from
cortex serveonly)Query Explorer — natural language queries with streaming responses
Contradiction Resolver — review and resolve conflicting decisions
Remote Deployment
For access beyond localhost, bind to all interfaces and put Cortex behind a reverse proxy:
cortex serve --host 0.0.0.0Example nginx config — protect /api/ and /ws with basic auth; serve static assets without auth (the dashboard injects the bearer token into HTML):
location /api/ {
auth_basic "Cortex";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://127.0.0.1:3710;
proxy_set_header Authorization "Bearer $CORTEX_TOKEN";
}
location /ws {
auth_basic "Cortex";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://127.0.0.1:3710;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
auth_basic off;
proxy_pass http://127.0.0.1:3710;
}Set CORTEX_SERVER_AUTH_TOKEN or server.auth.token in config. When auth is enabled, Cortex injects the token into the dashboard HTML so API and WebSocket calls authenticate automatically.
MCP Server (Claude Code Integration)
Cortex includes an MCP server so Claude Code can query your knowledge graph directly:
claude mcp add cortex --scope user -- npx @gzoo/cortex mcpThis gives Claude Code 12 tools:
Tool | Description |
| Natural language questions about your projects |
| System status and graph stats |
| List registered projects |
| Look up entities by name |
| Structured knowledge graph queries |
| List detected contradictions |
| Resolve a contradiction |
| Search entities with filters |
| Trigger file ingestion |
| Register a new project |
| Unregister a project |
| Context summary for current session |
Architecture
Monorepo with eight packages:
@cortex/core — types, EventBus, config loader, error classes
@cortex/ingest — file parsers (tree-sitter + remark), chunker, watcher, pipeline
@cortex/graph — SQLite store, LanceDB vectors, query engine
@cortex/llm — Anthropic/Gemini/OpenAI-compatible/Ollama providers, router, prompts, cache
@cortex/cli — Commander.js CLI
@cortex/mcp — Model Context Protocol server (stdio transport, 12 tools)
@cortex/server — Express REST API + WebSocket relay
@cortex/web — React + Vite + D3 web dashboard
Architecture docs: docs/
Privacy & Security
Files classified as
restrictedare never sent to cloud LLMsSensitive files (.env, .pem, .key) are auto-detected and blocked
API key secrets are scanned and redacted before any cloud transmission
All data stored locally in
~/.cortex/— nothing phones home
Full security architecture: docs/security.md
Built With
SQLite via better-sqlite3 — entity and relationship storage
LanceDB — vector embeddings for semantic search
Anthropic Claude — cloud LLM provider
Google Gemini — cloud LLM provider (via OpenAI-compatible API)
DeepSeek — cloud LLM provider (reasoning + chat)
Groq — fast cloud inference
Ollama — local LLM inference
tree-sitter — language-aware file parsing
Chokidar — cross-platform file watching
Commander.js — CLI framework
D3 — knowledge graph visualization
Contributing
See CONTRIBUTING.md for guidelines.
License
MIT — see LICENSE
About
Built by GZOO — an AI-powered business automation platform.
Cortex started as an internal tool to maintain context across multiple client projects. We open-sourced it because every developer who works on more than one thing loses context, and we think this approach — automatic file watching + knowledge graph + natural language queries — is the right way to solve it.
This server cannot be installed
Maintenance
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/gzoonet/cortex'
If you have feedback or need assistance with the MCP directory API, please join our Discord server