This document describes the runtime architecture that matters for the minimal branch.
The supported MCP runtime is intentionally small:
cortex-mcpis the only IDE-facing binary.cortex-astprovides read-only code intelligence.cortex-actprovides edits, searches, filesystem actions, and bounded shell execution.cortex-dbprovides local storage used by checkpoint features.
Other folders may exist in the monorepo, but they are not part of the active minimal MCP surface unless a task explicitly targets them.
- keep the public tool surface compact and predictable
- make multi-root workspaces first-class instead of a compatibility layer
- minimize token waste by supporting discovery, mapping, and slicing as separate stages
- make edits precise by operating on symbols or structures instead of line numbers
IDE / MCP Client
|
v
cortex-mcp
|
+-------------------+
| |
v v
cortex-ast cortex-act
| |
+---------+---------+
|
v
cortex-db
- owns the MCP transport over STDIO
- exposes the 13 active tools in
tools/list - dispatches read-only AST requests to
ServerState - dispatches ACT requests through synchronous handlers and passes workspace root context downstream
- captures workspace roots from MCP
initialize - powers
workspace_topology,map_overview,deep_slice, symbol reads, usages, and Chronos checkpoints - resolves
[FolderName]/...paths for read-only tool flows - provides the authoritative workspace-root state used by
cortex-mcp
- performs AST-backed source edits and structural data/markup/SQL changes
- runs bounded shell commands and exact search helpers
- now resolves
[FolderName]/...paths for edit, search, filesystem, and shellcwdparameters using the workspace roots passed down fromcortex-mcp - shell commands execute via
sh -con Unix andcmd /Con Windows; PATH is augmented on Unix to include~/.cargo/bin,~/.local/bin,/usr/local/bin - timeout kill uses
kill -9on Unix andtaskkill /Fon Windows cortex_act_edit_data_graphsupports full upsert (insert new keys) for JSON; YAML only supports updating existing keys
- stores semantic-search data and local project metadata
- stores checkpoint data used by Chronos and related flows
- remains an implementation detail behind MCP tools
Multi-root support in the minimal branch is a two-part contract:
cortex-astcaptures all workspace folders from MCPinitialize.cortex-mcpforwards those roots to ACT handlers so both subsystems resolve the same prefixed paths.
Path rules:
- absolute paths are accepted as-is
[FolderName]/path/to/fileresolves against the matching workspace root name- bare relative paths resolve against the primary workspace root
This means the same prefix convention works across both the “Eyes” and the “Hands” sides of the stack.
The minimal branch is designed around layered inspection rather than whole-repo dumps:
workspace_topology: discover roots and manifests cheaplymap_overviewandskeleton: inspect selected roots withtarget_dirs=[...]deep_sliceorread_source: read exact files or symbols only when needed
This staged approach keeps tool output smaller and makes multi-root sessions practical for LLMs.
cortex_code_explorercortex_symbol_analyzercortex_chronoscortex_manage_ast_languages
cortex_act_edit_astcortex_act_edit_data_graphcortex_act_edit_markupcortex_act_sql_surgerycortex_fs_manage
cortex_act_shell_execcortex_act_batch_executecortex_search_exactcortex_mcp_hot_reload
Tool schemas live in dedicated modules — never inline in server.rs:
| File | Owns schema for |
|---|---|
crates/cortex-ast/src/tool_schemas.rs |
cortex_code_explorer, cortex_symbol_analyzer, cortex_chronos |
crates/cortex-ast/src/grammar_manager.rs |
cortex_manage_ast_languages (+ action constants + runtime handler) |
crates/cortex-mcp/src/tools/act.rs |
all 9 ACT-side tools |
crates/cortex-ast/src/server.rs |
dispatch only — no schema text |
Action name constants in grammar_manager.rs (ACTION_STATUS, ACTION_ADD) are shared by both
the JSON schema enum and the runtime match arm, preventing schema-vs-dispatch drift.
The production build target for this branch is:
cargo build --release -p cortex-mcpRecommended validation is documented in docs/DEVELOPING.md.