io.github.DanielBlomma/cortex

编码与调试

by danielblomma

为 coding assistants 提供本地 repo 上下文,支持 semantic search 与图谱关系分析,提升代码理解。

什么是 io.github.DanielBlomma/cortex

为 coding assistants 提供本地 repo 上下文,支持 semantic search 与图谱关系分析,提升代码理解。

README

<p align="center"> <img src="docs/logo.png" alt="Cortex" width="600" /> </p>

Cortex

Give AI coding agents the right context from your repository.

npm version license

Cortex builds a local map of your code, symbols, relationships, and project rules. Coding agents query that map through the CLI instead of guessing or reading the whole repository.

Your code stays on your machine. MCP is not required.

Start

Requires Node.js 20.9+ and Git.

bash
npm install --global @danielblomma/cortex-mcp
cd your-project
cortex init --bootstrap

This indexes the repository, adds Cortex instructions to AGENTS.md, installs Git hooks, and starts the background watcher.

Check the setup:

bash
cortex doctor

Use

bash
# Find relevant code.
cortex search "where is authentication handled?" --json

# Follow relationships from a search result.
cortex related <entity-id> --json

# See what a change may affect.
cortex impact "authentication" --json

# Read repository rules.
cortex rules --json

# Compare a changed file with nearby patterns.
cortex pattern-evidence src/auth.ts --json

# Inspect deterministic active conventions for a file or indexed entity.
cortex conventions src/payments/retry.ts --json

# Get cited, deterministic context before implementing a code task.
cortex guidance src/payments/retry.ts --task "add bounded retry handling" --json

# Review the staged, unstaged, and non-ignored untracked candidate against HEAD.
cortex review --diff --json

# Refresh context after significant changes.
cortex update

Agents can run these commands directly. cortex init adds instructions that tell them to search before answering and check impact before refactoring. They do not need an MCP connection.

What Cortex adds

Without Cortex, an agent often searches by filename and reads many unrelated files. Cortex gives it structured repository context:

  • semantic search across code, rules, and architecture decisions;
  • symbol definitions and file relationships;
  • caller and dependency traversal;
  • impact analysis before refactoring;
  • active rules, deprecations, and source-of-truth signals;
  • deterministic, subsystem-scoped convention profiles with cited reusable symbols;
  • incremental updates after Git and filesystem changes.

The pipeline is local and straightforward:

text
repository -> local index -> Cortex CLI -> coding agent

Commands you will use

CommandPurpose
cortex search "..." --jsonFind relevant code and context
cortex related <entity-id> --jsonFollow relationships from a result
cortex impact "..." --jsonEstimate the blast radius of a change
cortex rules --jsonShow active repository rules
cortex pattern-evidence <file> --jsonFind nearby implementation patterns
cortex conventions <file-or-entity> --jsonInspect bounded repository convention profiles
cortex guidance <file-or-entity> --task <text> --jsonGet bounded cited pre-coding guidance
cortex review --diff --jsonReview the current Git candidate with cited local evidence
cortex updateRefresh changed context
cortex statusShow index status
cortex doctorDiagnose the local setup
cortex watch statusCheck background synchronization
cortex dashboardOpen the local status dashboard

Run cortex help for the complete command list.

cortex conventions uses only the local index. It returns bounded, live-backed version-1 profiles and does not call a model, planner, provider, or network service. See Repository convention profiles for the exact eligibility, limit, hashing, persistence, and safety contract.

Before implementing a code task, use cortex guidance as cited additive context—not policy authority. Continue to use normal search, related, and impact when needed, and never skip explicit active rules or conflicts. The command is local-only and inspection-only; see the exact versioned contract in Pre-coding guidance.

After coding and before finalization, use cortex review --diff. It separates exact source-of-truth violations from heuristic local-pattern warnings and is inspection-only. See Deterministic diff review.

Keep the index fresh

Git hooks and the watcher normally update Cortex automatically.

bash
cortex status
cortex watch status
cortex update

Run cortex update manually after a large change or when results look stale.

Large repositories

Make lexical and graph search available first while semantic indexing continues in the background:

bash
cortex bootstrap --background --profile interactive
cortex indexing status --json

This mode supports macOS, Linux, and WSL. Native Windows should use normal foreground bootstrap.

Upgrade

bash
npm install --global @danielblomma/cortex-mcp@latest
cortex init --force
cortex bootstrap
cortex update

Project configuration and rules are preserved. See CHANGELOG.md for version-specific notes.

Optional MCP compatibility

The normal Cortex workflow uses the CLI. If a client explicitly requires MCP, run cortex connect.

DeepSeek Harness integration

Cortex supports DeepSeek Harness through the V1 explicit tools and skills integration. Cortex 2.6.0 contains and validates the integration source against the pinned Harness 0.1.1-rc.2 release. Separate npm bundle distribution is deferred and currently unavailable.

The bundle provides four agent-scoped tools (cortex_search, cortex_related, cortex_impact, and cortex_rules) and five Cortex behavior skills (change-impact, context-review, pattern-review, repo-research, and using-cortex). Retrieval is local, repository-scoped, explicit, and user-controlled. The integration does not automatically initialize, update, or watch a repository.

V2 proactive/assistive retrieval remains planned and experimental; it is not included in Cortex 2.6.0. See the V1-to-V2 integration plan for details.

Links

License

MIT

常见问题

io.github.DanielBlomma/cortex 是什么?

为 coding assistants 提供本地 repo 上下文,支持 semantic search 与图谱关系分析,提升代码理解。

相关 Skills

网页构建器

by anthropics

Universal
热门

面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。

在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。

编码与调试
未扫描176.4k

网页应用测试

by anthropics

Universal
热门

用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。

借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。

编码与调试
未扫描176.4k

前端设计

by anthropics

Universal
热门

面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。

想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。

编码与调试
未扫描176.4k

相关 MCP Server

GitHub

编辑精选

by GitHub

热门

GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。

这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。

编码与调试
89.7k

by Context7

热门

Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。

它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。

编码与调试
60.2k

by tldraw

热门

tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。

这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。

编码与调试
49.9k

评论