Skip to content

Commit f977f9c

Browse files
docs: add co-change analysis to README and mark backlog #9 done
Document the new git co-change analysis feature from PR #95: - Add co-change commands section, feature table row, comparison rows - Update MCP tool count 18 → 19 across all mentions - Mark BACKLOG item #9 as DONE with implementation details
1 parent 832fa49 commit f977f9c

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cd your-project
5555
codegraph build
5656
```
5757

58-
That's it. No config files, no Docker, no JVM, no API keys, no accounts. The graph is ready to query. Add `codegraph mcp` to your AI agent's config and it has full access to your dependency graph through 18 MCP tools.
58+
That's it. No config files, no Docker, no JVM, no API keys, no accounts. The graph is ready to query. Add `codegraph mcp` to your AI agent's config and it has full access to your dependency graph through 19 MCP tools.
5959

6060
### Why it matters
6161

@@ -78,6 +78,7 @@ That's it. No config files, no Docker, no JVM, no API keys, no accounts. The gra
7878
| Semantic search | **Yes** || **Yes** | **Yes** || **Yes** |||
7979
| MCP / AI agent support | **Yes** || **Yes** | **Yes** | **Yes** | **Yes** | **Yes** ||
8080
| Git diff impact | **Yes** ||||| **Yes** || **Yes** |
81+
| Git co-change analysis | **Yes** |||||| **Yes** | **Yes** |
8182
| Watch mode | **Yes** || **Yes** ||||||
8283
| Dead code / role classification | **Yes** || **Yes** ||||| **Yes** |
8384
| Cycle detection | **Yes** || **Yes** ||||| **Yes** |
@@ -96,9 +97,9 @@ That's it. No config files, no Docker, no JVM, no API keys, no accounts. The gra
9697
| **🔓** | **Zero-cost core, LLM-enhanced when you want** | Full graph analysis with no API keys, no accounts, no cost. Optionally bring your own LLM provider — your code only goes where you choose |
9798
| **🔬** | **Function-level, not just files** | Traces `handleAuth()``validateToken()``decryptJWT()` and shows 14 callers across 9 files break if `decryptJWT` changes |
9899
| **🏷️** | **Role classification** | Every symbol auto-tagged as `entry`/`core`/`utility`/`adapter`/`dead`/`leaf` — agents instantly know what they're looking at |
99-
| **🤖** | **Built for AI agents** | 18-tool [MCP server](https://modelcontextprotocol.io/) — AI assistants query your graph directly. Single-repo by default |
100+
| **🤖** | **Built for AI agents** | 19-tool [MCP server](https://modelcontextprotocol.io/) — AI assistants query your graph directly. Single-repo by default |
100101
| **🌐** | **Multi-language, one CLI** | JS/TS + Python + Go + Rust + Java + C# + PHP + Ruby + HCL in a single graph |
101-
| **💥** | **Git diff impact** | `codegraph diff-impact` shows changed functions, their callers, and full blast radius — ships with a GitHub Actions workflow |
102+
| **💥** | **Git diff impact** | `codegraph diff-impact` shows changed functions, their callers, and full blast radius — enriched with historically coupled files from git co-change analysis. Ships with a GitHub Actions workflow |
102103
| **🧠** | **Semantic search** | Local embeddings by default, LLM-powered when opted in — multi-query with RRF ranking via `"auth; token; JWT"` |
103104

104105
---
@@ -143,7 +144,7 @@ After modifying code:
143144
Or connect directly via MCP:
144145

145146
```bash
146-
codegraph mcp # 18-tool MCP server — AI queries the graph directly
147+
codegraph mcp # 19-tool MCP server — AI queries the graph directly
147148
```
148149

149150
Full agent setup: [AI Agent Guide](docs/guides/ai-agent-guide.md) · [CLAUDE.md template](docs/guides/ai-agent-guide.md#claudemd-template)
@@ -161,14 +162,15 @@ Full agent setup: [AI Agent Guide](docs/guides/ai-agent-guide.md) · [CLAU
161162
| 🎯 | **Deep context** | `context` gives AI agents source, deps, callers, signature, and tests for a function in one call; `explain` gives structural summaries of files or functions |
162163
| 📍 | **Fast lookup** | `where` shows exactly where a symbol is defined and used — minimal, fast |
163164
| 📊 | **Diff impact** | Parse `git diff`, find overlapping functions, trace their callers |
165+
| 🔗 | **Co-change analysis** | Analyze git history for files that always change together — surfaces hidden coupling the static graph can't see; enriches `diff-impact` with historically coupled files |
164166
| 🗺️ | **Module map** | Bird's-eye view of your most-connected files |
165167
| 🏗️ | **Structure & hotspots** | Directory cohesion scores, fan-in/fan-out hotspot detection, module boundaries |
166168
| 🏷️ | **Node role classification** | Every symbol auto-tagged as `entry`/`core`/`utility`/`adapter`/`dead`/`leaf` based on connectivity patterns — agents instantly know architectural role |
167169
| 🔄 | **Cycle detection** | Find circular dependencies at file or function level |
168170
| 📤 | **Export** | DOT (Graphviz), Mermaid, and JSON graph export |
169171
| 🧠 | **Semantic search** | Embeddings-powered natural language search with multi-query RRF ranking |
170172
| 👀 | **Watch mode** | Incrementally update the graph as files change |
171-
| 🤖 | **MCP server** | 18-tool MCP server for AI assistants; single-repo by default, opt-in multi-repo |
173+
| 🤖 | **MCP server** | 19-tool MCP server for AI assistants; single-repo by default, opt-in multi-repo |
172174
|| **Always fresh** | Three-tier incremental detection — sub-second rebuilds even on large codebases |
173175

174176
## 📦 Commands
@@ -219,6 +221,22 @@ codegraph diff-impact HEAD~3 # Impact vs a specific ref
219221
codegraph diff-impact main --format mermaid -T # Mermaid flowchart of blast radius
220222
```
221223

224+
### Co-Change Analysis
225+
226+
Analyze git history to find files that always change together — surfaces hidden coupling the static graph can't see. Requires a git repository.
227+
228+
```bash
229+
codegraph co-change --analyze # Scan git history and populate co-change data
230+
codegraph co-change src/queries.js # Show co-change partners for a file
231+
codegraph co-change # Show top co-changing file pairs globally
232+
codegraph co-change --since 6m # Limit to last 6 months of history
233+
codegraph co-change --min-jaccard 0.5 # Only show strong coupling (Jaccard >= 0.5)
234+
codegraph co-change --min-support 5 # Minimum co-commit count
235+
codegraph co-change --full # Include all details
236+
```
237+
238+
Co-change data also enriches `diff-impact` — historically coupled files appear in a `historicallyCoupled` section alongside the static dependency analysis.
239+
222240
### Structure & Hotspots
223241

224242
```bash
@@ -408,7 +426,7 @@ Optional: `@huggingface/transformers` (semantic search), `@modelcontextprotocol/
408426

409427
### MCP Server
410428

411-
Codegraph includes a built-in [Model Context Protocol](https://modelcontextprotocol.io/) server with 18 tools, so AI assistants can query your dependency graph directly:
429+
Codegraph includes a built-in [Model Context Protocol](https://modelcontextprotocol.io/) server with 19 tools, so AI assistants can query your dependency graph directly:
412430

413431
```bash
414432
codegraph mcp # Single-repo mode (default) — only local project
@@ -595,6 +613,7 @@ const { results: fused } = await multiSearchData(
595613
| Incremental rebuilds | **O(changed)** || O(n) Merkle ||||
596614
| MCP / AI agent support | **Yes** || **Yes** | **Yes** | **Yes** | **Yes** |
597615
| Git diff impact | **Yes** ||||| **Yes** |
616+
| Git co-change analysis | **Yes** ||||||
598617
| Dead code / role classification | **Yes** || **Yes** ||||
599618
| Semantic search | **Yes** || **Yes** | **Yes** || **Yes** |
600619
| Watch mode | **Yes** || **Yes** ||||

docs/roadmap/BACKLOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Non-breaking, ordered by problem-fit:
2727
| ID | Title | Description | Category | Benefit | Zero-dep | Foundation-aligned | Problem-fit (1-5) | Breaking |
2828
|----|-------|-------------|----------|---------|----------|-------------------|-------------------|----------|
2929
| 4 | ~~Node classification~~ | ~~Auto-tag symbols as Entry Point / Core / Utility / Adapter based on in-degree/out-degree patterns. High fan-in + low fan-out = Core. Zero fan-in + non-export = Dead. Inspired by arbor.~~ | Intelligence | ~~Agents immediately understand architectural role of any symbol without reading surrounding code — fewer orientation tokens~~ ||| 5 | No | **DONE**`classifyNodeRoles()` in `structure.js` auto-tags every symbol as `entry`/`core`/`utility`/`adapter`/`dead`/`leaf` using median-based fan-in/fan-out thresholds. Roles stored in DB (`role` column, migration v5), surfaced in `where`/`explain`/`context`/`stats`/`list-functions`, new `roles` CLI command, new `node_roles` MCP tool (18 tools total). Includes `--role` and `--file` filters. |
30-
| 9 | Git change coupling | Analyze git history for files/functions that always change together. Surfaces hidden dependencies that the static graph can't see. Enhances `diff-impact` with historical co-change data. Inspired by axon. | Analysis | `diff-impact` catches more breakage by including historically coupled files; agents get a more complete blast radius picture ||| 5 | No |
30+
| 9 | ~~Git change coupling~~ | ~~Analyze git history for files/functions that always change together. Surfaces hidden dependencies that the static graph can't see. Enhances `diff-impact` with historical co-change data. Inspired by axon.~~ | Analysis | ~~`diff-impact` catches more breakage by including historically coupled files; agents get a more complete blast radius picture~~ ||| 5 | No | **DONE**`src/cochange.js` module with scan, compute, analyze, and query functions. DB migration v5 adds `co_changes` + `co_change_meta` tables. CLI command `codegraph co-change [file]` with `--analyze`, `--since`, `--min-support`, `--min-jaccard`, `--full` options. Integrates into `diff-impact` output via `historicallyCoupled` section. New `co_changes` MCP tool (19 tools total). Uses Jaccard similarity on commit history. |
3131
| 1 | ~~Dead code detection~~ | ~~Find symbols with zero incoming edges (excluding entry points and exports). Agents constantly ask "is this used?" — the graph already has the data, we just need to surface it. Inspired by narsil-mcp, axon, codexray, CKB.~~ | Analysis | ~~Agents stop wasting tokens investigating dead code; developers get actionable cleanup lists without external tools~~ ||| 4 | No | **DONE** — Delivered as part of node classification (ID 4). `codegraph roles --role dead -T` lists all symbols with zero fan-in that aren't exported. |
3232
| 2 | Shortest path A→B | BFS/Dijkstra on the existing edges table to find how symbol A reaches symbol B. We have `fn` for single-node chains but no A→B pathfinding. Inspired by codexray, arbor. | Navigation | Agents can answer "how does this function reach that one?" in one call instead of manually tracing chains ||| 4 | No |
3333
| 12 | Execution flow tracing | Framework-aware entry point detection (Express routes, CLI commands, event handlers) + BFS flow tracing from entry to leaf. Inspired by axon, GitNexus, code-context-mcp. | Navigation | Agents can answer "what happens when a user hits POST /login?" by tracing the full execution path in one query ||| 4 | No |

0 commit comments

Comments
 (0)