SuperAPIAI Directory

cortex

github.com · AI coding

Local-first developer knowledge graph: watches project files, extracts entities and relationships with LLMs, and offers queries, a web dashboard and a CLI.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

Purpose

Cortex is a local-first knowledge graph tool for developers, released via the GitHub repository gzoonet/cortex. The problem it solves is: developers often maintain multiple projects at the same time, with decisions, patterns, and context scattered across hundreds or thousands of files, making it easy to forget decisions made months ago or to re-solve problems in another repository that have already been solved. Cortex addresses this problem by automatically watching project files, extracting knowledge, and returning it to the user in natural language when needed.

Main capabilities

  • Watch for changes in project files (md, ts, js, py, json, yaml).
  • Extract entities: decisions, patterns, components, dependencies, constraints, action items.
  • Infer relationships between entities across projects.
  • Detect contradictions when decisions conflict.
  • Query using natural language, with source citations.
  • Semantic search: fuses keyword and vector (embedding) similarity so that queries match by meaning rather than only by keywords (optional, see Semantic Search).
  • Intelligently route between cloud and local LLMs.
  • Respect privacy: data from restricted projects never leaves the local machine.
  • Provide a Web dashboard, including knowledge graph visualization, a Live Feed, and a query browser.
  • Provide an MCP server that can be directly integrated by Claude Code, offering 12 tools.

Usage

Install:

npm install -g @cortex/cli

If a global install encounters an EACCES error, you can use the user prefix:

npm config set prefix ~/.npm-global
export PATH=~/.npm-global/bin:$PATH
npm install -g @cortex/cli

Or install from source:

git clone https://github.com/gzoonet/cortex.git
cd cortex
npm install && npm run build
npm link

Verify:cortex --version(current version 0.8.1).

Initialize: run the interactive wizard cortex init, which guides the user through setting up the LLM provider (Anthropic, Google Gemini, DeepSeek, Groq, OpenRouter, or local Ollama), API key (securely saved to ~/.cortex/.env), routing mode (cloud-first, hybrid, local-first, local-only), directories to watch, and the monthly LLM spending budget cap.cortex init writes the global configuration to ~/.cortex/cortex.config.json, and stores the API key in ~/.cortex/.env.

Registering projects and usage: after registering a project, first backfill existing files, because the watcher only captures new changes; then run watching and querying. Be careful not to run watch and serve at the same time, as they will compete for file changes; Live Feed only shows real-time events while cortex serve is running.

Web dashboard: run cortex serve, open at http://localhost:3710 . It includes Dashboard Home (graph statistics, recent activity, entity type distribution), Knowledge Graph (D3-force interactive graph, supporting clustering and click-to-explore), Live Feed (real-time file changes and entity extraction events over WebSocket), Query Explorer (natural language queries with streaming responses), Contradiction Resolver (review and resolve conflicting decisions). On non-localhost hosts, authentication is automatically enforced: a bearer token is generated and saved to ~/.cortex/.env, and can be read with grep CORTEX_SERVER_AUTH_TOKEN ~/.cortex/.env .

Remote deployment: bind all interfaces and place Cortex behind a reverse proxy; API/WebSocket calls behind the reverse proxy use Authorization: Bearer <token>. This can be done by setting CORTEX_SERVER_AUTH_TOKEN or in the configuration server.auth.token to specify the token.

MCP server (Claude Code integration): Cortex has a built-in MCP server that enables Claude Code to query the knowledge graph directly, providing 12 tools.

Configuration: Configuration is layered, and later-loaded sources override earlier sources. API keys are stored separately in ~/.cortex/.env (not written to the configuration JSON). For the full configuration reference, see docs/configuration.md.

Semantic search (Embeddings): Disabled by default, can be enabled through a cloud embeddings provider, with no need for a local GPU or Ollama. The embeddings provider is independent of the chat provider (for example, DeepSeek for chat and OpenAI for embeddings). Any OpenAI-compatible embeddings endpoint works. New files automatically generate embeddings during ingestion; for already-ingested graphs, a one-time reindex can be run. For the full CLI reference, see docs/cli-reference.md.

Excluding files and directories: Cortex ignores common directories such as node_modules, dist, and .git by default, and you can add more exclusions yourself.

Processing pipeline: Executed on every file change — Parse (chunked by language-aware parsers, tree-sitter for code and remark for markdown), Extract (LLM identifies entities), Relate (LLM infers relationships between new and old entities), Detect (automatically flags contradictions and duplicates), Store (entities, relationships, and vectors are stored in SQLite + LanceDB), Query (natural language queries search the graph and synthesize answers). All data is stored locally in ~/.cortex/; only LLM API calls leave the machine (and restricted projects are never sent externally).

Provider support: Cortex is provider-agnostic and supports Anthropic Claude (Sonnet, Haiku, native Anthropic API), Google Gemini (OpenAI-compatible API), DeepSeek (Reasoner, Chat), Groq (fast inference, with a free tier), any OpenAI-compatible API (OpenRouter, local proxies, etc.), Ollama (Mistral, Llama, etc., fully local). Cost tracking uses provider-specific rates for DeepSeek, Gemini, Groq, and OpenRouter models, rather than a uniform fallback to Anthropic.

Routing modes: in cloud-first mode, all tasks go through cloud providers, and Ollama is not needed (it is only used when budget fallback is enabled); hybrid mode assigns high-throughput tasks (entity extraction, ranking) to Ollama and reasoning-heavy tasks (relationship inference, querying) to cloud providers.

Privacy and security: files marked as restricted are never sent to cloud LLMs; sensitive files (.env, .pem, .key) are automatically detected and blocked; API key secrets are scanned and redacted before transmission; all data is stored locally in ~/.cortex/ and is never sent back. For the full security architecture, see docs/security.md.

Use cases

  • Developers who maintain multiple projects at the same time and need to retrieve historical decisions and patterns across projects.
  • Those who want to use natural language to ask "what architectural decisions have I made across various projects" and get answers with source citations.
  • Those who need to automatically detect contradictions in decisions across projects and avoid solving the same problem repeatedly.
  • Teams that are privacy-sensitive, require local data storage, and allow only some LLM calls to be sent externally.

Limitations and prerequisites

  • Using cloud mode requires an LLM API key from Anthropic, Google Gemini, DeepSeek, Groq, or any OpenAI-compatible provider.
  • hybrid, local-first, or local-only modes require Ollama.
  • Semantic search (embeddings) is disabled by default and requires separately configuring an embeddings provider.
  • The watcher only captures new changes; existing files must first be backfilled.
  • watch and serve cannot run at the same time.
  • Non-localhost access requires configuring an authentication token and a reverse proxy.

Tech stack and license

This is a monorepo containing eight packages: @cortex/core, @cortex/ingest, @cortex/graph, @cortex/llm, @cortex/cli, @cortex/mcp, @cortex/server, @cortex/web. The main dependencies include better-sqlite3 (SQLite), LanceDB (vector), tree-sitter (language-aware parsing), Chokidar (cross-platform file watching), Commander.js (CLI), React + Vite (web dashboard), D3 (graph visualization). Licensed under MIT. Built by GZOO.

Specific information about fees and pricing is not yet provided.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools