Cortex Works Minimal
A hyper-optimized MCP server that supercharges AI coding agents. Outperforms built-in IDE tools with AST-based precision editing and native OS control, drastically reducing LLM token consumption.
Ask AI about Cortex Works Minimal
Powered by Claude Β· Grounded in docs
I know everything about Cortex Works Minimal. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
cortex-works (minimal)
One binary. 13 tools. Built to make AI agents faster, cheaper, and more precise.
cortex-works-minimal is a lean MCP server for AI-powered IDEs. It replaces slow, token-hungry IDE tooling with a disciplined surface of 13 surgical tools β covering repo mapping, symbol analysis, structural editing, filesystem work, and bounded shell execution.
β Cross-platform tested: macOS, Windows, and Ubuntu (other Linux distros may work too).
Setup
Before building on macOS, make sure the Rust toolchain, Apple command line tools, and CMake are installed:
rustup update
xcode-select --install
brew install cmake
If you already have the Apple command line tools, you can skip the install step. This repository now uses the default macOS linker, so you do not need a Homebrew-specific lld path to build the release binary.
cargo build --release -p cortex-mcp
./target/release/cortex-mcp # wire to your IDE via MCP stdio
Why Agents Perform Better Here
Standard IDE tools expose the filesystem as a flat text surface. Agents waste tokens reading full files to find the three lines they need, burning context on boilerplate and build artifacts that should never appear in a prompt.
cortex-works is designed around the opposite principle: return exactly what the agent needs, nothing more.
Token Efficiency by Design
The stack enforces a layered, progressive-disclosure model:
| Stage | Tool | What the agent learns |
|---|---|---|
| L1 β Discover | workspace_topology | Roots, manifests, language hints β <500 tokens |
| L2 β Map | map_overview / skeleton | File tree + symbol list for selected dirs only |
| L3 β Read | read_source / deep_slice | Exact symbol body or focused file slice |
An agent that follows this pattern typically spends 5β10Γ fewer tokens on codebase orientation than one using raw file reads.
Structure-Aware Edits, Not Line Patches
Line-number-based edits break as soon as another tool touches the same file. cortex-works edits by name:
cortex_act_edit_astβ replace a Rust/TS/Python function or struct by symbol namecortex_act_edit_data_graphβ update a JSON or YAML key by JSONPath targetcortex_act_edit_markupβ rewrite a Markdown section by heading or HTML node by tag/idcortex_act_sql_surgeryβ swap a DDL statement by type and object name
The agent supplies the new content; the tool handles byte offsets, bottom-up ordering, and post-edit validation automatically.
Fail-Safe AST Editing
cortex_act_edit_ast validates syntax after edits and aborts safely if the output is invalid. This avoids writing broken code to disk.
Multi-Root Path Routing, Built-In
VS Code multi-root workspaces, Zed multi-project, and JetBrains polyrepo sessions all work transparently via prefixed path convention: [FolderName]/path/to/file. No manual path juggling required.
One Round-Trip for Sequential Workflows
cortex_act_batch_execute collapses multi-step workflows β explore β checkpoint β edit β verify β into a single MCP call, cutting back-and-forth latency by up to an order of magnitude.
The 13 Active Tools
Intelligence (read-only)
| Tool | Use when |
|---|---|
cortex_code_explorer | First look at an unfamiliar repo; topology, maps, deep slices |
cortex_symbol_analyzer | You already know the symbol; read source, find usages, blast radius |
cortex_chronos | Save a rollback point before risky refactors; compare before/after |
cortex_manage_ast_languages | A non-core parser is missing (Go, PHP, Ruby, Java, C, C++, C#, Dart) |
Structural Mutations
| Tool | Use when |
|---|---|
cortex_act_edit_ast | Editing a Rust, TypeScript, or Python symbol by name |
cortex_act_edit_data_graph | Updating JSON or YAML keys structurally |
cortex_act_edit_markup | Rewriting Markdown sections, HTML/XML nodes by heading/tag/id |
cortex_act_sql_surgery | Replacing a DDL statement (CREATE TABLE, CREATE INDEX, β¦) |
cortex_fs_manage | Creating, copying, moving, deleting files and dirs; patching .env/.ini |
Search, Execution, and Runtime
| Tool | Use when |
|---|---|
cortex_search_exact | A literal string, regex, or identifier you know exactly |
cortex_act_shell_exec | Short diagnostic commands; manifest-aware run_diagnostics mode |
cortex_act_batch_execute | Collapsing a sequential workflow (explore β edit β verify) into one call |
cortex_mcp_hot_reload | After rebuilding, reload the worker on the same stdio channel without restarting the IDE |
Quick Start
# 1. Clone and build
git clone https://github.com/cortex-works/cortex-works-minimal
cd cortex-works-minimal
cargo build --release -p cortex-mcp
# 2. Wire to VS Code (add to mcp.json)
{
"cortex-works": {
"type": "stdio",
"command": "/absolute/path/to/target/release/cortex-mcp"
}
}
VS Code Extension Wrapper
The repository now also includes a VS Code workspace extension wrapper in extensions/cortex-works-vscode.
It now does one job cleanly: expose the same 13 Cortex tools through an extension-native bridge instead of a user-configured MCP server entry.
- no extension-only tool names are added
- the user-facing tool surface stays aligned with
cortex-mcp - the extension runs
cortex-extension-bridge, which reuses the existing Cortex dispatch directly for lower overhead than the MCP path
See docs/EXTENSION_ARCH.md for the architecture and packaging model.
Recommended Agent Workflow
1. cortex_code_explorer(workspace_topology, repoPath="/abs/path")
β discover workspace roots cheaply (always pass repoPath)
2. cortex_code_explorer(map_overview, target_dirs=["crates/my-crate/src"])
β inspect only the dirs that matter
3. cortex_symbol_analyzer(read_source, path="crates/my-crate/src/lib.rs", symbol_name="MyStruct")
β read exact code before editing (use `path`, not `file`)
4. cortex_chronos(save_checkpoint, path="...", symbol_name="...", semantic_tag="pre-refactor")
β rollback point before risky changes
5. cortex_act_edit_ast / edit_data_graph / edit_markup / β¦
β narrowest structural edit matching the file type
6. cortex_act_shell_exec(run_diagnostics=true, cwd=".")
β verify the change compiled
Common Pitfalls
| Wrong | Correct |
|---|---|
cortex_symbol_analyzer(read_source, file="...") | path="..." (not file) |
cortex_symbol_analyzer(find_usages, path="...") | target_dir="." (not path) |
cortex_chronos(compare_checkpoint, semantic_tag="...") | tag_a="before" + tag_b="after" (or tag_b="__live__") |
cortex_fs_manage(action=read, ...) | No read action β use cortex_symbol_analyzer or deep_slice |
cortex_fs_manage(action=delete, paths=["/tmp/..."]) | Delete is workspace-guarded; use workspace-relative paths |
cortex_act_edit_data_graph(edits=[..., value=..., code=...]) | Field is value, not code |
cortex_code_explorer(workspace_topology) without repoPath | Always pass repoPath (absolute) β omitting it triggers a safety block |
Runtime Layout
cortex-mcp (IDE gateway β MCP stdio transport)
β
βββ cortex-ast (intelligence: topology, slices, symbols, checkpoints, grammar loading)
β
βββ cortex-act (mutations: AST edits, data/markup/SQL edits, search, shell exec, batching)
β
βββ cortex-db (persistence: local checkpoint storage)
All four crates compile into one binary (cortex-mcp). The IDE talks only to that binary.
Documentation
| Doc | Content |
|---|---|
| docs/ARCH.md | Architecture, component roles, multi-root routing, progressive disclosure model |
| docs/USAGE.md | Workflow patterns, path conventions, batch examples, JSON vs YAML rules |
| docs/DEVELOPING.md | Build commands, test suite, schema source-of-truth, dependency management |
| docs/EXTENSION_ARCH.md | Extension-native 13-tool bridge architecture, parity testing flow, cross-platform sidecar packaging |
