Logo GZOO Cortex

GZOO Cortex

Cộng đồng
gzoonet

Local-first knowledge graph for developers. Watches your files, builds a knowledge graph with LLMs, lets you query across projects.

Nhà phát hànhgzoonet
Kho mãcortex
Ngôn ngữTypeScript
Bản fork
3
Sao
21
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    GZOO Cortex cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    21 sao và 3 bản fork từ kho mã được liên kết.

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.

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

bash
npm install -g @gzoo/cortex

If global install fails with EACCES, use a user prefix instead:

bash
mkdir -p ~/.local
npm config set prefix ~/.local
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
npm install -g @gzoo/cortex

Or install from source:

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

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

2. Setup

Run the interactive wizard:

bash
cortex init
cortex doctor                              # verify config, providers, and DB

This walks you through:

  • LLM provider — Anthropic, Google Gemini, DeepSeek, Groq, OpenRouter, or Ollama (local)
  • API key — saved securely to ~/.cortex/.env
  • Routing 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

bash
cortex projects add my-app ~/projects/app
cortex projects add api ~/projects/api
cortex projects list                       # verify

4. Ingest, Watch & Query

Backfill existing files first — the watcher only picks up new changes:

bash
cortex ingest "~/projects/app/src/**/*.ts"   # one-shot backfill
cortex serve                                 # dashboard + API + file watcher (recommended)
CommandWhat it does
cortex serveWeb dashboard + API + file watcher (ignoreInitial — no re-ingest on start)
cortex watchCLI-only file watcher (no dashboard)
cortex ingestOne-shot ingestion; events do not appear in the Live Feed

Don't run watch and serve together — they compete for file changes. The Live Feed shows real-time events from cortex serve only (file saves while the server is running).

bash
cortex query "what caching strategies am I using?"
cortex query "what decisions have I made about authentication?"
cortex find "PostgreSQL" --expand 2
cortex contradictions

5. Web Dashboard

bash
cortex serve                               # open http://localhost:3710

Remote access:

bash
cortex serve --host 0.0.0.0

Auth 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:

bash
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 exclude

How It Works

Cortex runs a pipeline on every file change:

  1. Parse — file content is chunked by a language-aware parser (tree-sitter for code, remark for markdown)
  2. Extract — LLM identifies entities (decisions, components, patterns, etc.)
  3. Relate — LLM infers relationships between new and existing entities
  4. Detect — contradictions and duplicates are flagged automatically
  5. Store — entities, relationships, and vectors go into SQLite + LanceDB
  6. 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

ModeCloud CostQualityOllama Required
cloud-firstVaries by providerHighestNo
hybridReducedHighYes
local-firstMinimalGoodYes
local-only$0GoodYes

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, or local-only modes (install)

Configuration

Config is layered — later sources override earlier ones:

PriorityLocationScope
1Built-in defaultsGlobal
2~/.cortex/cortex.config.jsonGlobal (created by cortex init)
3./cortex.config.jsonProject overrides (optional)
4CORTEX_* env varsSession

API keys are stored separately in ~/.cortex/.env (never in config JSON).

bash
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 setup

Full 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):

bash
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/.env

The 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:

bash
cortex reindex                 # all projects
cortex reindex my-app          # a single project

Commands

CommandDescription
cortex initInteractive setup wizard
cortex doctorValidate config, providers, projects, secrets, and database
cortex projects add/list/remove/showManage registered projects
cortex serveWeb dashboard + API + file watcher (port 3710)
cortex watch [project]CLI-only file watcher
cortex ingest <file-or-glob>One-shot file ingestion (separate from Live Feed)
cortex reindex [project]Rebuild the semantic (embedding) search index for existing entities
cortex query <question>Natural language query with citations
cortex find <term>Find entities by name
cortex statusGraph stats, costs, provider status
cortex costsDetailed cost breakdown
cortex contradictionsList active contradictions
cortex resolve <id>Resolve a contradiction
cortex models list/pull/test/infoManage Ollama models
cortex mcpStart MCP server for Claude Code
cortex reportPost-ingestion summary
cortex privacy set/listSet directory privacy
cortex config list/get/set/validateRead/write configuration
cortex config exclude add/remove/listManage file/directory exclusions
cortex stop / cortex restartManage running watch/serve processes
cortex dbDatabase 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 serve only)
  • 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:

bash
cortex serve --host 0.0.0.0

Example nginx config — protect /api/ and /ws with basic auth; serve static assets without auth (the dashboard injects the bearer token into HTML):

nginx
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:

bash
claude mcp add cortex --scope user -- npx @gzoo/cortex mcp

This gives Claude Code 12 tools:

ToolDescription
cortex_askNatural language questions about your projects
get_statusSystem status and graph stats
list_projectsList registered projects
find_entityLook up entities by name
query_cortexStructured knowledge graph queries
get_contradictionsList detected contradictions
resolve_contradictionResolve a contradiction
search_entitiesSearch entities with filters
ingest_fileTrigger file ingestion
add_projectRegister a new project
remove_projectUnregister a project
session_briefContext 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 restricted are never sent to cloud LLMs
  • Sensitive 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
  • React + Vite — web dashboard
  • 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.

Dùng MCP GZOO Cortex với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối GZOO Cortex, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm GZOO Cortex làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của GZOO Cortex.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "cortex": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của GZOO Cortex, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của GZOO Cortex.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng GZOO Cortex giúp tôi làm việc này không?
GZOO Cortex
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng GZOO Cortex.

Câu hỏi thường gặp

Máy chủ MCP GZOO Cortex dùng để làm gì?

GZOO Cortex là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP GZOO Cortex với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng GZOO Cortex với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP GZOO Cortex với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối GZOO Cortex, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP GZOO Cortex với TypingMind?

GZOO Cortex hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP GZOO Cortex cung cấp những công cụ nào trong TypingMind?

GZOO Cortex cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP GZOO Cortex không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu GZOO Cortex yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇