时间是伟大的导师。——伯克

GitNexus

⚠️ Important Notice:** GitNexus has NO official cryptocurrency, token, or coin. Any token/coin using the GitNexus name on Pump.fun or any other platform is not affiliated with, endorsed by, or created by this project or its maintainers. Do not purchase any cryptocurrency claiming association with GitNexus.

abhigyanpatwari%2FGitNexus | Trendshift

Join the official Discord to discuss ideas, issues etc!

Discord npm version License: PolyForm Noncommercial

GitNexus: The Zero-Server Code Intelligence Engine - GitNexus is a client-side knowledge graph creator that runs entirely in your browser. Drop in a GitHub repo or ZIP file, and get an interactive knowledge graph wit a built in Graph RAG Agent. Perfect for code exploration


GitNexus:给 AI 代理装上一套“神经系统”的小家伙

GitNexus 的 README 里,有一句话看似轻描淡写,却很像他给自己定下的使命宣言:

Building nervous system for agent context.

他不满足于让 AI “看见几段代码就开始改”,他更像一个严谨到有点强迫症的架构师:
“你要写代码?可以。但你得先知道你在动的是哪根神经——这根神经连着哪些肌肉、会牵动哪些动作、会不会一不小心把整条调用链扯断。”

于是 GitNexus 做了一件非常硬核、也非常拟人化的事情:
他把任何代码库“拆开、理顺、编织”,做成一张知识图谱——

Indexes any codebase into a knowledge graph — every dependency, call chain, cluster, and execution flow — then exposes it through smart tools so AI agents never miss code.

他像一个“关系控”:
不是只记住文件名和函数名,而是追踪每一条关系:依赖、调用链、聚类、执行流……把结构先算出来,再把答案一次性递给 AI。


“像 DeepWiki,但更深”:他想让你分析代码,而不是只理解代码

GitNexus 甚至主动递上一个对比:

Like DeepWiki, but deeper. DeepWiki helps you understand code. GitNexus lets you analyze it — because a knowledge graph tracks every relationship, not just descriptions.

他不满足于“解释”,他要的是“结构化洞察”。


TL;DR:他有两种形态,一个爱浏览器,一个爱终端

GitNexus 把自己拆成两条使用路径:
一个是“快速聊天与探索”的 Web UI;另一个是“让 AI 代理真可靠”的 CLI + MCP。

CLI + MCP Web UI
What Index repos locally, connect AI agents via MCP Visual graph explorer + AI chat in browser
For Daily development with Cursor, Claude Code, Windsurf, OpenCode, Codex Quick exploration, demos, one-off analysis
Scale Full repos, any size Limited by browser memory (~5k files), or unlimited via backend mode
Install npm install -g gitnexus No install —gitnexus.vercel.app
Storage LadybugDB native (fast, persistent) LadybugDB WASM (in-memory, per session)
Parsing Tree-sitter native bindings Tree-sitter WASM
Privacy Everything local, no network Everything in-browser, no server

他还留了一个“桥接人格”——Bridge mode:

Bridge mode: gitnexus serve connects the two — the web UI auto-detects the local server and can browse all your CLI-indexed repos without re-uploading or re-indexing.

像一个懂得在“轻便探索”和“重型索引”之间穿针引线的中间人。


CLI + MCP(recommended):他最骄傲的工作方式

GitNexus 说得很直白:
CLI 会给你的仓库建立索引,并启动 MCP server,让 AI 代理获得深度代码库认知。

Quick Start:一条命令把仓库“神经网络化”

1
2
# Index your repo (run from repo root)
npx gitnexus analyze

然后他像一个效率狂一样补一句:“就这样。”

That’s it. This indexes the codebase, installs agent skills, registers Claude Code hooks, and creates AGENTS.md / CLAUDE.md context files — all in one command.

他不只是建图谱,他还会顺手把“让代理更会用工具”的技能装好,把 Claude Code 的 hooks 注册上,把 AGENTS.md / CLAUDE.md 这类上下文文件直接准备出来——像一个把你工作台擦干净、工具摆齐的人。


MCP Setup:他会自己识别编辑器,然后把路铺好

gitnexus setup 会自动检测你用的编辑器并写入正确的全局 MCP 配置,你只需要跑一次。


Editor Support:他对 Claude Code 偏爱得很明显

Editor MCP Skills Hooks (auto-augment) Support
Claude Code Yes Yes Yes (PreToolUse + PostToolUse) Full
Cursor Yes Yes MCP + Skills
Windsurf Yes MCP
OpenCode Yes Yes MCP + Skills
Codex Yes MCP

他还亲口承认:

Claude Code gets the deepest integration: MCP tools + agent skills + PreToolUse hooks that enrich searches with graph context + PostToolUse hooks that auto-reindex after commits.

像一个会在你“搜索之前”就把上下文塞进结果里、在你“提交之后”自动重新索引的护法。


Community Integrations:他也愿意让别人给他做“外接义肢”

Agent Install Source
pi pi install npm:pi-gitnexus pi-gitnexus

如果你更喜欢手动配置:他把每条路都写得清清楚楚

Claude Code(full support — MCP + skills + hooks)

1
claude mcp add gitnexus -- npx -y gitnexus@latest mcp

Cursor(~/.cursor/mcp.json — global)

1
2
3
4
5
6
7
8
{
"mcpServers": {
"gitnexus": {
"command": "npx",
"args": ["-y", "gitnexus@latest", "mcp"]
}
}
}

OpenCode(~/.config/opencode/config.json

1
2
3
4
5
6
7
8
{
"mcp": {
"gitnexus": {
"command": "npx",
"args": ["-y", "gitnexus@latest", "mcp"]
}
}
}

Codex(~/.codex/config.toml.codex/config.toml

1
2
3
[mcp_servers.gitnexus]
command = "npx"
args = ["-y", "gitnexus@latest", "mcp"]

CLI Commands:他把所有按钮都放在命令行里

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
gitnexus setup                    # Configure MCP for your editors (one-time)
gitnexus analyze [path] # Index a repository (or update stale index)
gitnexus analyze --force # Force full re-index
gitnexus analyze --skills # Generate repo-specific skill files from detected communities
gitnexus analyze --skip-embeddings # Skip embedding generation (faster)
gitnexus analyze --embeddings # Enable embedding generation (slower, better search)
gitnexus analyze --verbose # Log skipped files when parsers are unavailable
gitnexus mcp # Start MCP server (stdio) — serves all indexed repos
gitnexus serve # Start local HTTP server (multi-repo) for web UI connection
gitnexus list # List all indexed repositories
gitnexus status # Show index status for current repo
gitnexus clean # Delete index for current repo
gitnexus clean --all --force # Delete all indexes
gitnexus wiki [path] # Generate repository wiki from knowledge graph
gitnexus wiki --model <model> # Wiki with custom LLM model (default: gpt-4o-mini)
gitnexus wiki --base-url <url> # Wiki with custom LLM API base URL

他像一个“索引管家 + 代理供血站 + 文档生成器”的混合体。


What Your AI Agent Gets:他给代理发了“七件武器、一些资源、两套流程、四种技能”

7 tools(via MCP)

Tool What It Does repo Param
list_repos Discover all indexed repositories
query Process-grouped hybrid search (BM25 + semantic + RRF) Optional
context 360-degree symbol view — categorized refs, process participation Optional
impact Blast radius analysis with depth grouping and confidence Optional
detect_changes Git-diff impact — maps changed lines to affected processes Optional
rename Multi-file coordinated rename with graph + text search Optional
cypher Raw Cypher graph queries Optional

当只有一个仓库时,repo 参数可以不写;仓库多了再指定:

query({query: "auth", repo: "my-app"})


Resources:随取随用的“即时上下文入口”

Resource Purpose
gitnexus://repos List all indexed repositories (read this first)
gitnexus://repo/{name}/context Codebase stats, staleness check, and available tools
gitnexus://repo/{name}/clusters All functional clusters with cohesion scores
gitnexus://repo/{name}/cluster/{name} Cluster members and details
gitnexus://repo/{name}/processes All execution flows
gitnexus://repo/{name}/process/{name} Full process trace with steps
gitnexus://repo/{name}/schema Graph schema for Cypher queries

2 MCP prompts:他连“引导工作流”都准备好了

Prompt What It Does
detect_impact Pre-commit change analysis — scope, affected processes, risk level
generate_map Architecture documentation from the knowledge graph with mermaid diagrams

4 agent skills:他会把“怎么用工具”教给代理

这些技能会自动装到 .claude/skills/

  • Exploring — Navigate unfamiliar code using the knowledge graph
  • Debugging — Trace bugs through call chains
  • Impact Analysis — Analyze blast radius before changes
  • Refactoring — Plan safe refactors using dependency mapping

还有“按仓库生成”的技能:
gitnexus analyze --skills,GitNexus 会通过 Leiden community detection 识别功能模块,并在 .claude/skills/generated/ 为每个模块生成 SKILL.md


Multi-Repo MCP Architecture:他想让你“一次配置,全局可用”

GitNexus 有一个全球注册表(global registry),让一个 MCP server 服务多个索引仓库:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
flowchart TD
subgraph CLI [CLI Commands]
Setup["gitnexus setup"]
Analyze["gitnexus analyze"]
Clean["gitnexus clean"]
List["gitnexus list"]
end

subgraph Registry ["~/.gitnexus/"]
RegFile["registry.json"]
end

subgraph Repos [Project Repos]
RepoA[".gitnexus/ in repo A"]
RepoB[".gitnexus/ in repo B"]
end

subgraph MCP [MCP Server]
Server["server.ts"]
Backend["LocalBackend"]
Pool["Connection Pool"]
ConnA["LadybugDB conn A"]
ConnB["LadybugDB conn B"]
end

Setup -->|"writes global MCP config"| CursorConfig["~/.cursor/mcp.json"]
Analyze -->|"registers repo"| RegFile
Analyze -->|"stores index"| RepoA
Clean -->|"unregisters repo"| RegFile
List -->|"reads"| RegFile
Server -->|"reads registry"| RegFile
Server --> Backend
Backend --> Pool
Pool -->|"lazy open"| ConnA
Pool -->|"lazy open"| ConnB
ConnA -->|"queries"| RepoA
ConnB -->|"queries"| RepoB

他的工作方式也很“像一个干练的管理员”:

  • 索引存在每个仓库自己的 .gitnexus/(可携带、gitignored)
  • 全局注册表在 ~/.gitnexus/registry.json(只记录路径与元数据)
  • MCP server 读取注册表即可服务所有仓库
  • LadybugDB 连接按需打开、空闲会回收(最多并发 5 个连接)

Web UI:他也有一面“可视化的脸”,而且零服务器

GitNexus 还有一张“在浏览器里就能跑”的脸:

A fully client-side graph explorer and AI chat. No server, no install — your code never leaves the browser.

入口在这里(他会邀请你拖 ZIP):
https://gitnexus.vercel.app

gitnexus_img

也可以本地跑:

1
2
3
4
git clone https://github.com/abhigyanpatwari/gitnexus.git
cd gitnexus/gitnexus-web
npm install
npm run dev

Web UI 用的是同一套索引管线,但全部跑在 WebAssembly 里(Tree-sitter WASM、LadybugDB WASM、浏览器 embeddings)。
它适合快速探索,但大仓库会受浏览器内存限制。

然后他又亮出“Local Backend Mode”:
gitnexus serve,Web UI 会自动探测到本地 server,直接浏览你 CLI 已经索引好的仓库,不用重新上传或重新索引。


The Problem GitNexus Solves:他讨厌“盲改”

GitNexus 看过太多这种事故:

  1. AI 改了 UserService.validate()
  2. 却不知道有 47 个函数依赖它的返回类型
  3. 结果:Breaking changes ship

所以他主张:预先把结构算出来,让工具返回“一次就够的上下文”。


How It Works:他不是一条链,他是一条流水线

GitNexus 的索引流程很像一个分工明确的工厂:

  1. Structure — 遍历文件树,建立目录/文件关系
  2. Parsing — 用 Tree-sitter AST 抽取函数/类/方法/接口
  3. Resolution — 跨文件解析 import、调用、继承、构造推断、self/this 接收者类型
  4. Clustering — 把符号聚成功能社区
  5. Processes — 从入口点追踪执行流与调用链
  6. Search — 建立混合搜索索引(BM25 + semantic + RRF)

Supported Languages:他是“多语言结构侦探”

Language Imports Named Bindings Exports Heritage Type Annotations Constructor Inference Config Frameworks Entry Points
TypeScript
JavaScript
Python
Java
Kotlin
C#
Go
Rust
PHP
Ruby
Swift
C
C++

他把每种语言在“导入、导出、继承、类型、构造推断、配置、框架检测、入口点识别”这些维度都对齐了——像一个不只会看语法、还会看工程结构的侦探。


Tool Examples:他会用“工具回声”告诉你结构长什么样

Impact Analysis(爆炸半径分析)

1
2
3
4
5
6
7
8
9
10
11
impact({target: "UserService", direction: "upstream", minConfidence: 0.8})

TARGET: Class UserService (src/services/user.ts)

UPSTREAM (what depends on this):
Depth 1 (WILL BREAK):
handleLogin [CALLS 90%] -> src/api/auth.ts:45
handleRegister [CALLS 90%] -> src/api/auth.ts:78
UserController [CALLS 85%] -> src/controllers/user.ts:12
Depth 2 (LIKELY AFFECTED):
authRouter [IMPORTS] -> src/routes/auth.ts

Process-Grouped Search(按执行流分组的搜索)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
query({query: "authentication middleware"})

processes:
- summary: "LoginFlow"
priority: 0.042
symbol_count: 4
process_type: cross_community
step_count: 7

process_symbols:
- name: validateUser
type: Function
filePath: src/auth/validate.ts
process_id: proc_login
step_index: 2

definitions:
- name: AuthConfig
type: Interface
filePath: src/types/auth.ts

Context(360° 符号视图)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
context({name: "validateUser"})

symbol:
uid: "Function:validateUser"
kind: Function
filePath: src/auth/validate.ts
startLine: 15

incoming:
calls: [handleLogin, handleRegister, UserController]
imports: [authRouter]

outgoing:
calls: [checkPassword, createSession]

processes:
- name: LoginFlow (step 2/7)
- name: RegistrationFlow (step 3/5)

Detect Changes(提交前风险感知)

1
2
3
4
5
6
7
8
9
10
detect_changes({scope: "all"})

summary:
changed_count: 12
affected_count: 3
changed_files: 4
risk_level: medium

changed_symbols: [validateUser, AuthService, ...]
affected_processes: [LoginFlow, RegistrationFlow, ...]

Rename(多文件协同重命名)

1
2
3
4
5
6
7
8
rename({symbol_name: "validateUser", new_name: "verifyUser", dry_run: true})

status: success
files_affected: 5
total_edits: 8
graph_edits: 6 (high confidence)
text_search_edits: 2 (review carefully)
changes: [...]

Cypher Queries(原生图查询)

1
2
3
4
5
6
-- Find what calls auth functions with high confidence
MATCH (c:Community {heuristicLabel: 'Authentication'})<-[:CodeRelation {type: 'MEMBER_OF'}]-(fn)
MATCH (caller)-[r:CodeRelation {type: 'CALLS'}]->(fn)
WHERE r.confidence > 0.8
RETURN caller.name, fn.name, r.confidence
ORDER BY r.confidence DESC

Wiki Generation:他还会把图谱变成文档

1
2
3
4
5
6
7
8
9
# Requires an LLM API key (OPENAI_API_KEY, etc.)
gitnexus wiki

# Use a custom model or provider
gitnexus wiki --model gpt-4o
gitnexus wiki --base-url https://api.anthropic.com/v1

# Force full regeneration
gitnexus wiki --force

他会读取索引后的图结构,用 LLM 把文件分模块,生成模块页面与总览页,并带上交叉引用——像把“神经系统”翻译成“说明书”。


Tech Stack:他一半在本地,一半在浏览器,但灵魂一致

Layer CLI Web
Runtime Node.js (native) Browser (WASM)
Parsing Tree-sitter native bindings Tree-sitter WASM
Database LadybugDB native LadybugDB WASM
Embeddings HuggingFace transformers.js (GPU/CPU) transformers.js (WebGPU/WASM)
Search BM25 + semantic + RRF BM25 + semantic + RRF
Agent Interface MCP (stdio) LangChain ReAct agent
Visualization Sigma.js + Graphology (WebGL)
Frontend React 18, TypeScript, Vite, Tailwind v4
Clustering Graphology Graphology
Concurrency Worker threads + async Web Workers + Comlink

Roadmap:他还在长肌肉

Actively Building

  • LLM Cluster Enrichment — Semantic cluster names via LLM API
  • AST Decorator Detection — Parse @Controller, @Get, etc.
  • Incremental Indexing — Only re-index changed files

Recently Completed

  • Constructor-Inferred Type Resolution, self/this Receiver Mapping
  • Wiki Generation, Multi-File Rename, Git-Diff Impact Analysis
  • Process-Grouped Search, 360-Degree Context, Claude Code Hooks
  • Multi-Repo MCP, Zero-Config Setup, 13 Language Support
  • Community Detection, Process Detection, Confidence Scoring
  • Hybrid Search, Vector Index

Security & Privacy:他把“别上传代码”当作底线

  • CLI:全本地运行、无网络调用;索引在 .gitnexus/;全局注册表在 ~/.gitnexus/(只存路径和元信息)
  • Web:全在浏览器里跑;不上传代码;API key 只存在 localStorage
  • 开源,可自行审计

Acknowledgments:他也知道自己站在很多巨人的肩膀上

  • Tree-sitter — AST parsing
  • LadybugDB — Embedded graph database with vector support (formerly KuzuDB)
  • Sigma.js — WebGL graph rendering
  • transformers.js — Browser ML
  • Graphology — Graph data structures
  • MCP — Model Context Protocol

结尾:GitNexus 的性格,是“先把结构讲清楚,再让你动手”

GitNexus 不想让 AI 成为“会写代码但不懂后果”的学徒。
他更像一个把依赖、调用、执行流、聚类、风险半径全部点亮的领航员:

  • 让代理不再漏掉依赖
  • 让调用链不再被无意切断
  • 让改动前就知道波及范围
  • 让小模型也能凭借结构工具获得架构级视野

他把自己说成“神经系统”,其实很准确:
没有神经系统的身体只会乱动;有了神经系统,动作才有意识、有反馈、有边界。

而 GitNexus,就是那个把“代码关系”变成“可用智能”的小家伙。