1337Xcode/cortex
GitHub: 1337Xcode/cortex
Stars: 3 | Forks: 1
# Cortex
[](https://github.com/1337Xcode/cortex/releases)
[](https://github.com/1337Xcode/cortex/actions)
[](LICENSE)
[](https://www.rust-lang.org/)
[](docs/tools.md)
[](docs/architecture.md)
[]()
[](https://www.npmjs.com/package/@1337xcode/cortex)
[](https://1337xcode.github.io/cortex)
One binary. Zero dependencies. 29 languages. 32 MCP tools. Local code intelligence for AI coding agents.
**[Documentation](https://1337xcode.github.io/cortex)** · **[npm](https://www.npmjs.com/package/@1337xcode/cortex)** · **[Issues](https://github.com/1337Xcode/cortex/issues)**
## Works with
## Why Cortex
An agent asking "what calls processOrder" gets a 200-token graph result instead of burning 20,000 tokens reading files. That's 100x fewer tokens on a single structural question.
Cortex indexes your repository into a SQLite call graph and exposes it over the Model Context Protocol. 127 files indexed in 535ms. Incremental re-index in 13ms. Handles 100K to 1M+ line repositories.
## Install
npx @1337xcode/cortex@latest install
## Quick start
cortex index # parse your repo, build the graph
cortex install # detect Claude Code / Cursor, write MCP config
cortex serve # start the MCP server
Your agent queries the graph instead of reading raw files.
## Demo commands
cortex impact UserService.getUser # blast radius: what breaks if I change this?
cortex explain DatabasePool.acquire # offline function explanation, zero LLM calls
cortex security report # taint flows, OWASP patterns, dependency vulns
cortex diff main feature-branch # call graph diff between branches
cortex viz --export graph.html # interactive 3D graph in a standalone HTML file
cortex ci --fail-on-taint # CI quality gate with exit codes
cortex hotspots --months 6 # high-churn risky code ranked by risk score
cortex coverage --lcov coverage.lcov # populate coverage field, rank untested functions
cortex modules # Leiden community detection module boundaries
cortex federate add ../auth-service # query across repos with unified graph
## What you get
- **29 languages** parsed via tree-sitter
- **32 MCP tools** exposed over stdio, or 5 in smart mode (the `ask` meta-tool routes internally)
- **Sub-second incremental re-indexing** via native OS file watcher (inotify, FSEvents, ReadDirectoryChangesW)
- **Configurable model pricing** via `~/.cortex/pricing.toml` with longest-prefix matching
- **Ego-graph capping** at 500 nodes with priority ordering (depth first, then caller count)
- **Unified tabbed UI** with Graph and Dashboard views served at `cortex serve` (localhost:9749)
- **Coverage field on graph nodes** populated from LCOV data, surfaced in MCP tool responses
- **Method vs Function classification** verified across Python, TypeScript, Rust, Go, and Java
- **Agent steering generation** with module boundaries, complexity hotspots, and active ADRs
- **IDE install hardening** across 25 platforms with config validation and error reporting
- **Taint flow analysis, OWASP Top 10 detection, SBOM generation** all running locally, no cloud
- **Cross-session memory** that marks observations stale when linked code changes
- **Multi-repo federation** for querying across repositories with a unified graph
- **Hybrid search** combining FTS5 BM25 with optional local ONNX vector search
- **CI quality gates** with configurable thresholds and exit codes
- **3D interactive graph visualization** exportable to standalone HTML
- **Portable JSON bundle** (cortex.json) for team sharing via git. `cortex bundle export` serializes the full graph as a portable JSON file. Commit it to git so your team skips the index step entirely.
- **Works offline.** No cloud, no API keys, no Docker, no language runtimes.
## Architecture
graph TD
A[Repository Files] --> B[File Watcher
notify crate] B --> C[Indexer Pipeline
Rayon + tree-sitter] C --> D[SQLite Graph Store
WAL + FTS5 + sqlite-vec] D --> E[MCP Server
Tokio + JSON-RPC 2.0] E --> F[AI Coding Agent] C --> G[Security Pass
Taint + OWASP + SBOM] G --> D D --> H[Bundle Exporter
cortex.json] H --> I[Git Repository
Team Sharing] D --> J[Memory Layer
Staleness-aware observations] ## Comparison | Feature | Cortex | codebase-memory-mcp | Srclight | Serena | mcp-codebase-index | |---------|--------|---------------------|----------|--------|-------------------| | Architecture | Rust binary, SQLite | C binary, SQLite | Python, SQLite | Python, LSP | Python, SQLite | | Languages | 29 (tree-sitter) | 66 (tree-sitter) | 10 (tree-sitter) | 40+ (LSP) | 4 | | MCP tools | 32 (or 5 smart mode) | 14 | 42 | ~20 | 17 | | Smart tool routing | Yes (ask meta-tool) | No | No | No | No | | Call graph | Function-level | Full chains | Callers/callees | LSP-precise | Cross-file | | Hybrid search | FTS5 + sqlite-vec | Graph only | RRF fusion | Keyword | Structural | | Token reduction | 100x on structural queries | 121x avg | Not measured | Not measured | 87% | | Incremental update | 13ms (no changes) | Milliseconds | Git hooks | LSP live | Hash-based | | Security (taint/OWASP/SBOM) | Yes | No | No | No | No | | Cross-session memory | Staleness-aware | No | No | No | No | | Multi-repo federation | Yes | No | SQLite ATTACH | Partial | No | | Document ingestion | Yes | No | No | No | No | | Build system awareness | Cargo, npm, Go, Gradle, Maven | No | Yes | No | No | | Git intelligence | Hotspots, churn | Commit-aware delta | git blame | No | No | | Community detection | Leiden algorithm | No | Leiden | No | No | | Coverage gap analysis | Yes (LCOV cross-ref) | No | No | No | No | | Configurable pricing | Yes (TOML) | No | No | No | No | | Ego-graph capping | Yes (500 nodes) | No | No | No | No | | Unified tabbed UI | Yes (Graph/Dashboard) | No | No | No | No | | Agent steering generation | Yes (boundaries, hotspots, ADRs) | No | No | No | No | | CI quality gates | Yes (exit codes) | No | No | No | No | | Single binary, zero deps | Yes | Yes | No (Python) | No (Python+LSP) | No (Python) | | Auto IDE config | 25 agents | No | No | No | No | | 3D visualization | Yes | Yes | No | No | No | | Air-gap compatible | Yes | Yes | Yes | Yes | Yes | | License | MIT | MIT | MIT | MIT | MIT | ## Documentation - [Getting started](docs/getting-started.md) - [IDE setup](docs/ide-setup.md) - [CLI reference](docs/cli-reference.md) - [MCP tools](docs/tools.md) - [Configuration](docs/configuration.md) - [Architecture](docs/architecture.md) Full docs site: [1337xcode.github.io/cortex](https://1337xcode.github.io/cortex) ## License [MIT](LICENSE)
All 25 supported platforms
| Platform | Install command | |---|---| | Claude Code (Linux/Mac) | `cortex install` | | Claude Code (Windows) | `cortex install --platform claude-code` | | Codex | `cortex install --platform codex` | | OpenCode | `cortex install --platform opencode` | | GitHub Copilot CLI | `cortex install --platform copilot` | | VS Code Copilot Chat | `cortex vscode install` | | Aider | `cortex install --platform aider` | | OpenClaw | `cortex install --platform openclaw` | | Factory Droid | `cortex install --platform droid` | | Trae | `cortex install --platform trae` | | Trae CN | `cortex install --platform trae-cn` | | Gemini CLI | `cortex install --platform gemini` | | Hermes | `cortex install --platform hermes` | | Kimi Code | `cortex install --platform kimi` | | Kiro IDE/CLI | `cortex kiro install` | | Pi coding agent | `cortex install --platform pi` | | Cursor | `cortex cursor install` | | Google Antigravity | `cortex antigravity install` | | Windsurf | `cortex install --platform windsurf` | | Zed | `cortex install --platform zed` | | JetBrains | `cortex install --platform jetbrains` | | Cline/Roo | `cortex install --platform cline` | | Continue.dev | `cortex install --platform continue` | | Supermaven | `cortex install --platform supermaven` | | Tabnine | `cortex install --platform tabnine` |Other methods
**Shell script** curl -fsSL https://raw.githubusercontent.com/1337Xcode/cortex/main/install.sh | sh **Build from source** git clone https://github.com/1337Xcode/cortex.git && cd cortex cargo build --release cp target/release/cortex ~/.local/bin/All 29 supported languages
| Language | Language | Language | |----------|----------|----------| | Python | TypeScript | JavaScript | | Rust | Go | Java | | C | C++ | C# | | Ruby | PHP | Swift | | Kotlin | Scala | Lua | | Zig | Haskell | Elixir | | Dart | R | Julia | | OCaml | Bash | HCL/Terraform | | Perl | Objective-C | SQL | | YAML | TOML | |notify crate] B --> C[Indexer Pipeline
Rayon + tree-sitter] C --> D[SQLite Graph Store
WAL + FTS5 + sqlite-vec] D --> E[MCP Server
Tokio + JSON-RPC 2.0] E --> F[AI Coding Agent] C --> G[Security Pass
Taint + OWASP + SBOM] G --> D D --> H[Bundle Exporter
cortex.json] H --> I[Git Repository
Team Sharing] D --> J[Memory Layer
Staleness-aware observations] ## Comparison | Feature | Cortex | codebase-memory-mcp | Srclight | Serena | mcp-codebase-index | |---------|--------|---------------------|----------|--------|-------------------| | Architecture | Rust binary, SQLite | C binary, SQLite | Python, SQLite | Python, LSP | Python, SQLite | | Languages | 29 (tree-sitter) | 66 (tree-sitter) | 10 (tree-sitter) | 40+ (LSP) | 4 | | MCP tools | 32 (or 5 smart mode) | 14 | 42 | ~20 | 17 | | Smart tool routing | Yes (ask meta-tool) | No | No | No | No | | Call graph | Function-level | Full chains | Callers/callees | LSP-precise | Cross-file | | Hybrid search | FTS5 + sqlite-vec | Graph only | RRF fusion | Keyword | Structural | | Token reduction | 100x on structural queries | 121x avg | Not measured | Not measured | 87% | | Incremental update | 13ms (no changes) | Milliseconds | Git hooks | LSP live | Hash-based | | Security (taint/OWASP/SBOM) | Yes | No | No | No | No | | Cross-session memory | Staleness-aware | No | No | No | No | | Multi-repo federation | Yes | No | SQLite ATTACH | Partial | No | | Document ingestion | Yes | No | No | No | No | | Build system awareness | Cargo, npm, Go, Gradle, Maven | No | Yes | No | No | | Git intelligence | Hotspots, churn | Commit-aware delta | git blame | No | No | | Community detection | Leiden algorithm | No | Leiden | No | No | | Coverage gap analysis | Yes (LCOV cross-ref) | No | No | No | No | | Configurable pricing | Yes (TOML) | No | No | No | No | | Ego-graph capping | Yes (500 nodes) | No | No | No | No | | Unified tabbed UI | Yes (Graph/Dashboard) | No | No | No | No | | Agent steering generation | Yes (boundaries, hotspots, ADRs) | No | No | No | No | | CI quality gates | Yes (exit codes) | No | No | No | No | | Single binary, zero deps | Yes | Yes | No (Python) | No (Python+LSP) | No (Python) | | Auto IDE config | 25 agents | No | No | No | No | | 3D visualization | Yes | Yes | No | No | No | | Air-gap compatible | Yes | Yes | Yes | Yes | Yes | | License | MIT | MIT | MIT | MIT | MIT | ## Documentation - [Getting started](docs/getting-started.md) - [IDE setup](docs/ide-setup.md) - [CLI reference](docs/cli-reference.md) - [MCP tools](docs/tools.md) - [Configuration](docs/configuration.md) - [Architecture](docs/architecture.md) Full docs site: [1337xcode.github.io/cortex](https://1337xcode.github.io/cortex) ## License [MIT](LICENSE)
标签:通知系统