Corrdex Reference
A local code intelligence engine for real codebases. Parses source files, builds a semantic dependency graph, classifies files and functions, detects architectural signals, and runs repository rules.
What is Corrdex
Corrdex is a local code intelligence engine built for structural code understanding, not just text search. It answers questions about architecture that grep and embeddings cannot — deterministically, from your actual source code.
What Corrdex Ships
This repository contains three user-facing surfaces.
The published npm package is the local CLI + MCP package. This repo also contains the VS Code extension source used during development.
What Corrdex Does
Corrdex performs local static analysis and semantic classification across a project. It is not a text search tool or an embeddings layer — it uses explicit AST structure for every result.
Core capabilities
- Parse TypeScript, JavaScript, Python, SQL, and JSON
- Build a file dependency graph
- Classify files into architectural and semantic types
- Classify individual functions
- Detect workflow paths and runtime entrypoints
- Estimate change impact for files and functions
- Find hotspots, orchestrators, and architectural roles
- Run built-in rules plus custom policy rules
- Expose results through CLI and MCP
Typical outputs include
How Corrdex Works
Corrdex is local-first. No remote inference, no embeddings for core understanding. Every result is derived from explicit structure in your source files.
High-level pipeline
What drives the analysis
- AST metadata extracted from source files
- Import resolution across the project
- Execution blocks and entry markers
- Call and member expressions
- File identities and naming heuristics
- Dependency categories
- Rule-based semantic inference
Supported Languages
Current built-in parsing support covers the most common TypeScript and JavaScript ecosystems, plus Python, SQL, and JSON.
Installation
Install the published CLI/MCP package
This gives you both the corrdex and corrdex-mcp binaries globally.
npm install -g corrdex
Run from this repository
npm install npm run build node dist/cli/index.js --help
Build the npm package output
npm run build:npm-package
The publishable package lives under packages/npm.
Quick Start
From zero to a fully indexed, scanned project running MCP in five commands.
corrdex init .
corrdex index .
corrdex scan .
corrdex classify file src/orders/orderService.ts --explain
corrdex classify function src/orders/orderService.ts createOrder --explain
corrdex impact src/orders/orderService.ts
corrdex mcp .
corrdex-mcp .
Use With Coding Agents
After installing Corrdex, connect it to any coding agent that supports stdio MCP. Add a server entry in your agent's MCP config.
Standard (global npm binary)
{
"mcpServers": {
"corrdex": {
"command": "corrdex-mcp",
"args": ["C:\\path\\to\\project"]
}
}
}If the agent cannot see global npm binaries (Windows)
{
"mcpServers": {
"corrdex": {
"command": "C:\\Users\\HRD\\AppData\\Roaming\\npm\\corrdex-mcp.cmd",
"args": ["C:\\path\\to\\project"]
}
}
}Testing from repo before npm publish
{
"mcpServers": {
"corrdex": {
"command": "node",
"args": [
"C:\\Users\\HRD\\code\\corrdex\\corrdex\\dist\\mcp\\server.js",
"C:\\path\\to\\project"
]
}
}
}- Corrdex MCP connects immediately — it does not wait for a full index before transport startup.
- Bootstraps from .corrdex-cache.json when available, then refreshes the project index in the background.
- If first-time indexing is still running, call getIndexStatus.
- For endpoint-style questions, start with findRoutes — it surfaces concrete route registrations including method, path, handler, and middleware.
CLI Reference
The Corrdex CLI covers project initialization, indexing, scanning, cache management, file and function classification, semantic search, impact inspection, architecture summaries, and MCP server launching.
Main commands
Global flags
Hosted login and remote index
Use this when you want the local CLI to authenticate with hosted Corrdex and push one specific codebase.
corrdex login --path .
- Corrdex starts the hosted CLI login flow.
- Your browser opens the Corrdex approval page.
- You approve access in the browser.
- Corrdex binds the hosted session to a codebase path.
- If you did not pass --path, Corrdex asks for the codebase path before login finishes.
- Corrdex resolves the repo root from that path and stores it with the hosted session.
- Login is not complete until the repo root is saved locally.
corrdex index . --remote
One saved hosted login is bound to one repo root. corrdex index --remote and corrdex scan --remote only work for that bound repo root. To push another repo, run corrdex login again.
MCP Server
Corrdex exposes its local intelligence through MCP over stdio. The MCP server indexes the target project, hydrates an in-memory semantic registry, and serves deterministic tool outputs from the local project graph.
Startup behavior
- MCP connects immediately and does not wait for a full index before transport startup.
- Bootstraps from .corrdex-cache.json when available, then refreshes the full project index in the background.
- If first-time indexing is still running, call getIndexStatus.
- File-level tools can start from cache-backed state earlier than function-level tools.
Available MCP tools
Tool usage guidance
findRoutesUse first for any question mentioning route, endpoint, GET, POST, PATCH, DELETE, login, logout, middleware, or handler.findEntrypointsUse after findRoutes when you want the broader runtime flow beyond a specific endpoint.getIndexStatusCall this if the MCP server was just connected for the first time and indexing may still be running.saveTaskMemoryUse at the end of a task to persist compact decisions, touched files, and next steps for the repo.listTaskMemoriesUse at the start of a follow-up task so the agent can recover prior context.getTaskMemoryRead a specific task memory to understand past decisions or context without replaying full chats.Prompts and resources
corrdex-agent-workflowcorrdex://agent-guidanceRecommended task memory shape
title: short task/topic name, preferably <area>: <outcome> summary: 1-2 sentence outcome details: compact sections like Decisions:, Constraints:, Verification:, Next steps: tags: 2-5 stable keywords files: only the touched or critical repo-relative paths
VS Code Extension
The VS Code extension runs a local language server, shows a Corrdex sidebar in the Explorer, provides a Corrdex AI view in the Secondary Sidebar, and refreshes on source and config saves.
Extension commands
Extension development
npm run build
The extension entrypoint is client/index.ts. The extension reads corrdex.config.json and corrdex.policies.json.
Configuration
corrdex.config.json
Controls rule severities for local analysis.
{
"rules": {
"no-external-api-in-controller": "warning"
}
}Corrdex also accepts the legacy filename mergelens.config.json.
corrdex.policies.json
Adds compiled policy rules on top of built-in rules. Built-in rules are always loaded first — policy rules are appended after reading this file.
{
"policies": []
}Local cache
Corrdex stores semantic cache data in .corrdex-cache.json. The cache improves repeated indexing and scanning by reusing prior AST and classification work where possible.
corrdex cache status corrdex cache clear
Optional remote upload
The local CLI works without any backend. If you want to push scan or index results to a backend, both commands support optional flags.
corrdex scan . --remote https://api.example.com --api-key key_xxx --project-id proj_123
Corrdex's local parsing, indexing, CLI, and MCP flow do not require remote infrastructure.
What Corrdex Classifies
Corrdex produces structural semantic output at both file and function level. Results are deterministic — same source, same output.
File-level types
- controller
- service
- repository
- config
- database-model
- queue-worker
- scheduler
- app-bootstrap
- validator
- dto
Behavior concepts
- database-read
- database-write
- outbound-http-call
- env-config
- filesystem-read
- filesystem-write
- audit-trail
- ai-inference
- queue-processing
- background-processing
Higher-order outputs
- architectural roles
- architectural findings
- hotspot score
- domain inference
- workflow paths
- function entrypoints
- function blast radius
Recommended Workflows
corrdex index .
corrdex architecture summary .
corrdex find role integration-boundary . --limit 20
corrdex scan --staged
corrdex classify file src/controllers/orderController.ts --explain
corrdex classify function src/orders/orderService.ts createOrder --explain
corrdex mcp .
Then call MCP tools: findRoutes · getFunctionContext · getFunctionImpact · findEntrypoints
Repository Layout
Key directories
coreParsers, classifiers, dependency graph, rules, intelligencecliCLI entrypoint and command handlingmcpMCP server, runtime, tools, adaptersclientVS Code extension client UIpackages/npmPublishable npm package layoutscriptsBuild and package helperstestTestsImportant files
Development
npm install
npm run build
npm run watch
npm test
node dist/cli/index.js --help
node dist/mcp/server.js .
npm run prepare:npm-package
npm run build:npm-package
Fastest path to value
npm install -g corrdex corrdex init . corrdex index . corrdex scan . corrdex mcp .
Corrdex gives you a local semantic graph of your codebase and makes it usable through CLI, MCP, and VS Code. It is built for structural code understanding — not generic code completion, not text-only grep replacement, not LLM-only repo understanding.