Home/Docs/Corrdex Reference
Reference

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.

CLIMCP ServerVS Code ExtensionTypeScript · JS · Python · SQL
01

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 kind of file is this?
Classifies every file into a semantic architectural type.
Is this controller doing direct database work?
Detects layer violations and responsibility mixing.
Which functions are real entrypoints?
Identifies runtime and workflow entrypoints across the graph.
What breaks if I change this function?
Computes blast radius across the dependency graph.
Which files are orchestrators or hotspots?
Surfaces architectural roles and structural risk signals.
Which files are architectural boundaries?
Maps integration boundaries and domain partitions.
02

What Corrdex Ships

This repository contains three user-facing surfaces.

corrdex CLI
Project initialization, indexing, scanning, classification, and impact analysis from the terminal.
corrdex-mcp
MCP server launcher. Exposes the full local intelligence graph to any stdio MCP–capable coding agent.
VS Code Extension
Sidebar intelligence panel and AI view backed by the local language server.
Important distinction

The published npm package is the local CLI + MCP package. This repo also contains the VS Code extension source used during development.

03

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

primary file typebehaviorsdependency categoriesarchitectural findingsarchitectural rolessemantic partitionsdomain hintsworkflow pathsfunction call relationships
04

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

01
Discover. Find project files and resolve the project root.
02
Parse. Parse source files into language-specific AST metadata.
03
Graph. Build a project dependency graph from resolved imports.
04
Classify. Run primary file classification across all files.
05
Enrich. Propagate behaviors, architectural roles, findings, workflow paths, and function graph data.
06
Rules. Run built-in and custom policy rule checks to produce diagnostics.
07
Serve. Expose results through CLI, MCP, or the VS Code extension.

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
05

Supported Languages

Current built-in parsing support covers the most common TypeScript and JavaScript ecosystems, plus Python, SQL, and JSON.

TypeScript
JavaScript
TSX
JSX
Python
SQL
JSON
06

Installation

Install the published CLI/MCP package

This gives you both the corrdex and corrdex-mcp binaries globally.

bash
npm install -g corrdex

Run from this repository

bash
npm install
npm run build
node dist/cli/index.js --help

Build the npm package output

bash
npm run build:npm-package

The publishable package lives under packages/npm.

07

Quick Start

From zero to a fully indexed, scanned project running MCP in five commands.

Initialize a repo
corrdex init .
Index the full project
corrdex index .
Scan for rule violations
corrdex scan .
Inspect one file
corrdex classify file src/orders/orderService.ts --explain
Inspect one function
corrdex classify function src/orders/orderService.ts createOrder --explain
Estimate file impact
corrdex impact src/orders/orderService.ts
Start MCP server
corrdex mcp .
Or use the dedicated binary
corrdex-mcp .
08

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)

json
{
  "mcpServers": {
    "corrdex": {
      "command": "corrdex-mcp",
      "args": ["C:\\path\\to\\project"]
    }
  }
}

If the agent cannot see global npm binaries (Windows)

json
{
  "mcpServers": {
    "corrdex": {
      "command": "C:\\Users\\HRD\\AppData\\Roaming\\npm\\corrdex-mcp.cmd",
      "args": ["C:\\path\\to\\project"]
    }
  }
}

Testing from repo before npm publish

json
{
  "mcpServers": {
    "corrdex": {
      "command": "node",
      "args": [
        "C:\\Users\\HRD\\code\\corrdex\\corrdex\\dist\\mcp\\server.js",
        "C:\\path\\to\\project"
      ]
    }
  }
}
Startup behavior
  • 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.
09

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

corrdex init [path] [--json]
corrdex login [--server <url>] [--client-name <name>] [--path <codebase>] [--json]
corrdex logout [--json]
corrdex whoami [--json]
corrdex scan [path] [--staged] [--branch <name>] [--remote [url]] [--api-key <token>] [--project-id <id>] [--json] [--debug] [--no-cache]
corrdex index [path] [--rebuild] [--remote [url]] [--api-key <token>] [--project-id <id>] [--json]
corrdex check <path> [--json] [--debug] [--explain]
corrdex cache <status|clear> [path] [--json]
corrdex classify file <path> [--json] [--debug] [--explain]
corrdex classify function <path> <functionNameOrId> [--json] [--debug] [--explain]
corrdex find type <primaryType> [path] [--limit <n>] [--all] [--json]
corrdex find behavior <behavior> [path] [--limit <n>] [--all] [--json]
corrdex find role <architecturalRole> [path] [--limit <n>] [--all] [--json]
corrdex impact <path> [--json]
corrdex memory save --title <title> --summary <summary> [path] [--details <text>] [--tag <tag>]... [--file <path>]... [--json]
corrdex memory list [path] [--query <text>] [--tag <tag>] [--file <path>] [--limit <n>] [--json]
corrdex memory show <id> [path] [--json]
corrdex architecture summary [path] [--json]
corrdex architecture compare <leftPath> <rightPath> [--json]
corrdex architecture diff <baseSnapshot> <headSnapshot> [--json]
corrdex mcp [path]

Global flags

--json--debug--explain--quiet--no-cache

Hosted login and remote index

Use this when you want the local CLI to authenticate with hosted Corrdex and push one specific codebase.

Login
bash
corrdex login --path .
What to expect during login
  • 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.
Index to hosted Corrdex
bash
corrdex index . --remote
Current limitation

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.

10

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

listBehaviors
getIndexStatus
saveTaskMemory
listTaskMemories
getTaskMemory
listPrimaryTypes
listArchitecturalRoles
findFiles
findFunctions
getFunctionContext
getFunctionImpact
findRoutes
findEntrypoints
findArchitecturalRoles
findOrchestrators
listArchitecturalFindings
findHotspots
analyzeFile
analyzeImpact
getSemanticContext
getRawClassification
explainArchitecture
summarizeArchitecture
compareModules
compareSnapshots
reindexProject

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

Current MCP Prompt
corrdex-agent-workflow
Current MCP Resource
corrdex://agent-guidance

Recommended task memory shape

yaml
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
11

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

Corrdex: Refresh Sidebar
Corrdex: Open AI
Corrdex: Focus AI
Corrdex: Open AI Settings
Corrdex: Set AI API Key
Corrdex: Clear AI API Key
Corrdex: Open Config

Extension development

bash
npm run build

The extension entrypoint is client/index.ts. The extension reads corrdex.config.json and corrdex.policies.json.

12

Configuration

corrdex.config.json

Controls rule severities for local analysis.

json
{
  "rules": {
    "no-external-api-in-controller": "warning"
  }
}
offwarningerrorinfo

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.

json
{
  "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.

bash
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.

bash
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.

13

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
14

Recommended Workflows

Understand an unfamiliar repo
corrdex index .
corrdex architecture summary .
corrdex find role integration-boundary . --limit 20
Audit changed files before commit
corrdex scan --staged
Inspect a suspicious controller
corrdex classify file src/controllers/orderController.ts --explain
Trace a risky function
corrdex classify function src/orders/orderService.ts createOrder --explain
corrdex mcp .

Then call MCP tools: findRoutes · getFunctionContext · getFunctionImpact · findEntrypoints

15

Repository Layout

Key directories

coreParsers, classifiers, dependency graph, rules, intelligence
cliCLI entrypoint and command handling
mcpMCP server, runtime, tools, adapters
clientVS Code extension client UI
packages/npmPublishable npm package layout
scriptsBuild and package helpers
testTests

Important files

core/engine.tscore/buildDependencyGraph.tscore/classify/classifyFile.tscore/classify/classifyFunction.tsmcp/server.tscli/index.ts
16

Development

Install dependencies
bash
npm install
Build
bash
npm run build
Watch
bash
npm run watch
Run tests
bash
npm test
Run CLI from built output
bash
node dist/cli/index.js --help
Run MCP server from built output
bash
node dist/mcp/server.js .
Prepare npm package
bash
npm run prepare:npm-package
Build and prepare npm package
bash
npm run build:npm-package
Summary

Fastest path to value

bash
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.