Cortex indexes a repository into a local semantic graph so agents can resolve ownership, inspect callers, trace dependencies, and estimate blast radius before they edit code.
Resolve who owns a symbol, where it is used, what calls it, and what sits in its immediate dependency neighborhood without walking raw grep output.
Cortex builds and queries a persistent graph on your machine. No hosted indexing service, background sync, or remote vendor dependency is required.
Use the CLI for one-off orientation or keep the daemon warm for editors, automations, and coding agents that need repeated graph lookups.
The repository ships a reproducible benchmark harness and published artifacts comparing Cortex against a raw text-search baseline on real open-source repositories.
Use the one-line installer for a release binary, or build from source if you want to work on the monorepo.
curl -fsSL https://raw.githubusercontent.com/Blu3Ph4ntom/cortex/main/scripts/install.sh | shirm https://raw.githubusercontent.com/Blu3Ph4ntom/cortex/main/scripts/install.ps1 | iexgit clone https://github.com/Blu3Ph4ntom/cortex.git
cd cortex
cargo install --path crates/cortex-cli
cargo install --path crates/cortex-daemonThe release installers place binaries in a common local path: ~/.local/bin on Unix and $HOME\.cortex\bin on Windows.
Use the MSVC Rust toolchain if your GNU installation does not include gcc.exe and dlltool.exe.
The practical loop is simple: build the graph, resolve the owner, inspect callers, then check likely blast radius.
cortex index --repo /path/to/repocortex query --repo /path/to/repo find-symbol --name RepositorySessioncortex query --repo /path/to/repo callers --target open_sessioncortex query --repo /path/to/repo dependencies --target RepositorySession --direction both --depth 1
cortex query --repo /path/to/repo impact --target open_session --depth 1Cortex is strongest before edits, during refactors, and when review context needs real structure instead of filename heuristics.
Resolve the canonical owner of a symbol before an agent starts patching an unfamiliar codebase.
Inspect callers and dependencies before changing a signature or behavior that might ripple across the repository.
Attach structural neighbors and likely blast radius to a patch review so the summary is grounded in code relationships.
Keep a daemon warm for repeated lookups from editor tooling, local automations, and agent loops.
Repository orientation, targeted edits, change review, bounded impact checks, and machine-readable architecture discovery.
Compiler-grade proof, runtime data-flow certainty, or heavy framework indirection that only resolves through execution.
Cortex keeps the query model narrow so agents can learn it quickly and reuse it across repositories.
find-symbolResolve the canonical owner candidate for a symbol and get back a file path plus span.
callers / calleesWalk the call chain before you change behavior or when you are tracing outward from a function.
dependenciesInspect the local inbound and outbound structural neighborhood around a symbol or file.
references / impact / explainGet conservative reference sets, likely blast radius, and a summary of why a symbol matters in the current graph.
cortex query --repo /path/to/repo find-symbol --name PaymentServicecortex query --repo /path/to/repo callers --target update_statuscortex query --repo /path/to/repo explain --target PaymentServiceThe website renders the human-facing guide here. The repository root keeps the agent-facing `SKILL.md` that coding agents can install and use directly.
npx skills add https://github.com/Blu3Ph4ntom/cortex --skill cortexhttps://raw.githubusercontent.com/Blu3Ph4ntom/cortex/main/SKILL.mdUse the Cortex skill before editing this repository. Index the repo, resolve the owner of the target symbol, inspect callers or dependencies, then run impact before you patch code.SKILL.md teachesWhen to use Cortex, which queries to sequence first, how to quote structural results, and how to report uncertainty honestly when runtime behavior exceeds syntax.
Humans can review the workflow here on the website, while coding agents can consume the real source file directly from the repository.
Use the local daemon when another process needs repeated structural access without shelling out for each query.
cortexd --repo /path/to/repo --bind 127.0.0.1:8787curl "http://127.0.0.1:8787/graph/find_symbol?name=RepositorySession"curl "http://127.0.0.1:8787/graph/callers?target=open_session"The codebase is split so the core graph engine stays reusable while the CLI and daemon stay thin.
cortex-coreGraph model, parser extractors, indexer, storage layer, and typed query engine.
cortex-cliIndex, doctor, export, watch, and query commands for local use and scripting.
cortex-daemonLocal HTTP surface for tools that want a long-lived process instead of spawning the CLI for each lookup.
Repositories, files, symbols, and edges such as defines, contains, imports, references, calls, depends_on, and owned_by.
Cortex is intentionally conservative and syntax-driven. That makes it useful for navigation and pre-edit context, but not compiler-grade proof.
Contributor ergonomics, repeatable tests, and benchmark artifacts matter because Cortex is meant to support real engineering workflows.
cargo fmt
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-targets
powershell -ExecutionPolicy Bypass -File .\scripts\self-test.ps1Repository-specific contributor instructions for working on Cortex itself.
Agent-facing instructions for using Cortex on arbitrary codebases.
Reproducible benchmark artifacts and the PowerShell harness that generated them.
Cortex is already useful for local structural awareness and agent workflows. It is still OSS beta software, not yet a compiler-accurate or fleet-scale autonomous editing platform.
The benchmark harness in this repository compares Cortex warm-query results against `git grep -n -w` on the same structural tasks.
Cold indexing on a fresh local store, warm structural queries on a prepared store, and a raw grep baseline over the same repositories and targets.
Grep is often faster to start, but Cortex wins by collapsing the search surface into a much smaller set of structural answers that an agent can actually use.
343 files, 4749 symbols, and 42690 indexed edges across the benchmark set.
349 grep hits across 78 files dropped to 10 structural answers.
Cold index median: 324.01 ms
Cold index median: 147.67 ms
Cold index median: 286.48 ms
Cold index median: 277.88 ms
Cold index median: 777.7 ms
| Scenario | Cortex median | Baseline median | Cortex results | Grep hits | Grep files | Reduction |
|---|---|---|---|---|---|---|
| Resolve RepositorySession owner Cortex / Rust | 59.83 ms | 43.55 ms | 1 | 49 | 14 | 49x |
| Trace open_session callers Cortex / Rust | 45.41 ms | 42.5 ms | 4 | 28 | 10 | 7x |
| Resolve requests.Session owner requests / Python | 68.5 ms | 45.63 ms | 1 | 140 | 10 | 140x |
| Trace read_frame callers mini-redis / Rust | 46.82 ms | 43.68 ms | 2 | 7 | 4 | 3.5x |
| Resolve chi.NewRouter owner chi / Go | 81.59 ms | 47.2 ms | 1 | 120 | 37 | 120x |
| Resolve axios.dispatchRequest owner axios / JavaScript | 180.34 ms | 42.2 ms | 1 | 5 | 3 | 5x |
RepositorySession resolves to crates\cortex-core\src\indexer.rs:38.
open_session resolves to main, run_index, run_query, run_watch.
Session resolves to src\requests\sessions.py:357.
read_frame resolves to next_message, read_response.
NewRouter resolves to chi.go:60.
dispatchRequest resolves to lib\core\dispatchRequest.js:34.