Skip to content

Commit bad02f6

Browse files
docs: add Titan Paradigm use case, update docs with roles/co-change/path
- Create docs/use-cases/titan-paradigm.md — maps Johannes R.'s multi-agent codebase cleanup architecture (RECON, GAUNTLET, GLOBAL SYNC, STATE MACHINE) to codegraph commands, roadmap items, and post-LLM-integration recommendations - Update roadmap/BACKLOG.md: mark #4 (node classification), #9 (git change coupling), #1 (dead code), #2 (shortest path), #12 (execution flow) as DONE; add 6 new Titan Paradigm-inspired items (#21-#26): composite audit, batch querying, triage priority queue, change validation predicates, graph snapshots, MCP orchestration tools - Update README.md: add roles + co-change to features table, differentiators, commands section, agent template, common flags, comparison table; update MCP tool count 18 → 19 - Update docs/recommended-practices.md: update MCP tool count and tool list, add roles/co-change/path to CLAUDE.md template and developer workflow, add "Understand architectural roles" and "Surface hidden coupling" sections, add co-change step to setup checklist - Add full examples with real output for roles, co-change, and path to docs/examples/CLI.md and docs/examples/MCP.md - Update GitHub repo description with new capabilities
1 parent 360bdcc commit bad02f6

6 files changed

Lines changed: 676 additions & 10 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ codegraph registry remove <name> # Unregister
319319
| Flag | Description |
320320
|---|---|
321321
| `-d, --db <path>` | Custom path to `graph.db` |
322-
| `-T, --no-tests` | Exclude `.test.`, `.spec.`, `__test__` files (available on `fn`, `fn-impact`, `path`, `context`, `explain`, `where`, `diff-impact`, `search`, `map`, `hotspots`, `deps`, `impact`) |
322+
| `-T, --no-tests` | Exclude `.test.`, `.spec.`, `__test__` files (available on `fn`, `fn-impact`, `path`, `context`, `explain`, `where`, `diff-impact`, `search`, `map`, `hotspots`, `roles`, `co-change`, `deps`, `impact`) |
323323
| `--depth <n>` | Transitive trace depth (default varies by command) |
324324
| `-j, --json` | Output as JSON |
325325
| `-v, --verbose` | Enable debug output |
@@ -467,6 +467,9 @@ This project uses codegraph. The database is at `.codegraph/graph.db`.
467467
- `codegraph fn <name> -T` — function call chain
468468
- `codegraph path <from> <to> -T` — shortest call path between two symbols
469469
- `codegraph deps <file>` — file-level dependencies
470+
- `codegraph roles --role dead -T` — find dead code (unreferenced symbols)
471+
- `codegraph roles --role core -T` — find core symbols (high fan-in)
472+
- `codegraph co-change <file>` — files that historically change together
470473
- `codegraph search "<query>"` — semantic search (requires `codegraph embed`)
471474
- `codegraph cycles` — check for circular dependencies
472475

docs/examples/CLI.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,192 @@ Codegraph Diagnostics
620620

621621
---
622622

623+
## roles — Node role classification
624+
625+
```bash
626+
codegraph roles -T
627+
```
628+
629+
```
630+
Node roles (639 symbols):
631+
632+
core: 168 utility: 285 entry: 29 dead: 137 leaf: 20
633+
634+
## core (168)
635+
f safePath src/queries.js:14
636+
f isTestFile src/queries.js:21
637+
f getClassHierarchy src/queries.js:76
638+
f findMatchingNodes src/queries.js:127
639+
f kindIcon src/queries.js:175
640+
...
641+
```
642+
643+
Filter by role and file:
644+
645+
```bash
646+
codegraph roles --role dead -T
647+
```
648+
649+
```
650+
Node roles (137 symbols):
651+
652+
dead: 137
653+
654+
## dead (137)
655+
f main crates/codegraph-core/build.rs:3
656+
- TarjanState crates/codegraph-core/src/cycles.rs:38
657+
- CSharpExtractor crates/codegraph-core/src/extractors/csharp.rs:6
658+
o CSharpExtractor.extract crates/codegraph-core/src/extractors/csharp.rs:9
659+
...
660+
```
661+
662+
```bash
663+
codegraph roles --role entry -T
664+
```
665+
666+
```
667+
Node roles (29 symbols):
668+
669+
entry: 29
670+
671+
## entry (29)
672+
f command:build src/cli.js:89
673+
f command:query src/cli.js:102
674+
f command:impact src/cli.js:113
675+
f command:map src/cli.js:125
676+
f command:stats src/cli.js:139
677+
...
678+
```
679+
680+
```bash
681+
codegraph roles --role core --file src/queries.js
682+
```
683+
684+
```
685+
Node roles (16 symbols):
686+
687+
core: 16
688+
689+
## core (16)
690+
f safePath src/queries.js:14
691+
f isTestFile src/queries.js:21
692+
f getClassHierarchy src/queries.js:76
693+
f resolveMethodViaHierarchy src/queries.js:97
694+
f findMatchingNodes src/queries.js:127
695+
f kindIcon src/queries.js:175
696+
f moduleMapData src/queries.js:310
697+
f diffImpactMermaid src/queries.js:766
698+
...
699+
```
700+
701+
---
702+
703+
## co-change — Git co-change analysis
704+
705+
First, scan git history:
706+
707+
```bash
708+
codegraph co-change --analyze
709+
```
710+
711+
```
712+
Co-change analysis complete: 173 pairs from 289 commits (since: 1 year ago)
713+
```
714+
715+
Then query globally or per file:
716+
717+
```bash
718+
codegraph co-change
719+
```
720+
721+
```
722+
Top co-change pairs:
723+
724+
100% 3 commits src/extractors/csharp.js <-> src/extractors/go.js
725+
100% 3 commits src/extractors/csharp.js <-> src/extractors/java.js
726+
100% 3 commits src/extractors/csharp.js <-> src/extractors/php.js
727+
100% 3 commits src/extractors/csharp.js <-> src/extractors/ruby.js
728+
100% 3 commits src/extractors/go.js <-> src/extractors/java.js
729+
...
730+
731+
Analyzed: 2026-02-26 | Window: 1 year ago
732+
```
733+
734+
```bash
735+
codegraph co-change src/queries.js
736+
```
737+
738+
```
739+
Co-change partners for src/queries.js:
740+
741+
43% 12 commits src/mcp.js
742+
743+
Analyzed: 2026-02-26 | Window: 1 year ago
744+
```
745+
746+
```bash
747+
codegraph co-change --min-jaccard 0.5 --min-support 5
748+
```
749+
750+
```
751+
Top co-change pairs:
752+
753+
100% 5 commits src/parser.js <-> src/constants.js
754+
78% 7 commits src/builder.js <-> src/resolve.js
755+
756+
Analyzed: 2026-02-26 | Window: 1 year ago
757+
```
758+
759+
---
760+
761+
## path — Shortest path between two symbols
762+
763+
```bash
764+
codegraph path buildGraph resolveImports -T
765+
```
766+
767+
```
768+
Path: buildGraph → resolveImports (1 hop)
769+
770+
buildGraph src/builder.js:335 →(calls)→ resolveImports src/resolve.js:42
771+
772+
Hops: 1 | Alternate paths: 0
773+
```
774+
775+
```bash
776+
codegraph path buildGraph isTestFile -T
777+
```
778+
779+
```
780+
Path: buildGraph → isTestFile (2 hops)
781+
782+
buildGraph src/builder.js:335
783+
→(calls)→ collectFiles src/builder.js:45
784+
→(calls)→ isTestFile src/queries.js:21
785+
786+
Hops: 2 | Alternate paths: 1
787+
```
788+
789+
```bash
790+
codegraph path buildGraph isTestFile -T --json
791+
```
792+
793+
```json
794+
{
795+
"from": "buildGraph",
796+
"to": "isTestFile",
797+
"hops": 2,
798+
"path": [
799+
{ "name": "buildGraph", "file": "src/builder.js", "line": 335 },
800+
{ "name": "collectFiles", "file": "src/builder.js", "line": 45, "edgeKind": "calls" },
801+
{ "name": "isTestFile", "file": "src/queries.js", "line": 21, "edgeKind": "calls" }
802+
],
803+
"alternatePaths": 1
804+
}
805+
```
806+
807+
---
808+
623809
## registry — Multi-repo management
624810

625811
```bash

docs/examples/MCP.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,155 @@ graph LR
583583

584584
---
585585

586+
## node_roles — Node role classification
587+
588+
```json
589+
{
590+
"tool": "node_roles",
591+
"arguments": { "no_tests": true }
592+
}
593+
```
594+
595+
```
596+
Node roles (639 symbols):
597+
598+
core: 168 utility: 285 entry: 29 dead: 137 leaf: 20
599+
600+
## core (168)
601+
f safePath src/queries.js:14
602+
f isTestFile src/queries.js:21
603+
f getClassHierarchy src/queries.js:76
604+
...
605+
606+
## entry (29)
607+
f command:build src/cli.js:89
608+
f command:query src/cli.js:102
609+
...
610+
```
611+
612+
Filter by role:
613+
614+
```json
615+
{
616+
"tool": "node_roles",
617+
"arguments": { "role": "dead", "no_tests": true }
618+
}
619+
```
620+
621+
```
622+
Node roles (137 symbols):
623+
624+
dead: 137
625+
626+
## dead (137)
627+
f main crates/codegraph-core/build.rs:3
628+
- TarjanState crates/codegraph-core/src/cycles.rs:38
629+
- CSharpExtractor crates/codegraph-core/src/extractors/csharp.rs:6
630+
...
631+
```
632+
633+
Filter by role and file:
634+
635+
```json
636+
{
637+
"tool": "node_roles",
638+
"arguments": { "role": "core", "file": "src/queries.js" }
639+
}
640+
```
641+
642+
```
643+
Node roles (16 symbols):
644+
645+
core: 16
646+
647+
## core (16)
648+
f safePath src/queries.js:14
649+
f isTestFile src/queries.js:21
650+
f getClassHierarchy src/queries.js:76
651+
f resolveMethodViaHierarchy src/queries.js:97
652+
f findMatchingNodes src/queries.js:127
653+
...
654+
```
655+
656+
---
657+
658+
## co_changes — Git co-change analysis
659+
660+
Query top co-changing file pairs:
661+
662+
```json
663+
{
664+
"tool": "co_changes",
665+
"arguments": { "no_tests": true }
666+
}
667+
```
668+
669+
```
670+
Top co-change pairs:
671+
672+
100% 3 commits src/extractors/csharp.js <-> src/extractors/go.js
673+
100% 3 commits src/extractors/csharp.js <-> src/extractors/java.js
674+
100% 3 commits src/extractors/go.js <-> src/extractors/java.js
675+
...
676+
677+
Analyzed: 2026-02-26 | Window: 1 year ago
678+
```
679+
680+
Query co-change partners for a specific file:
681+
682+
```json
683+
{
684+
"tool": "co_changes",
685+
"arguments": { "file": "src/queries.js" }
686+
}
687+
```
688+
689+
```
690+
Co-change partners for src/queries.js:
691+
692+
43% 12 commits src/mcp.js
693+
694+
Analyzed: 2026-02-26 | Window: 1 year ago
695+
```
696+
697+
---
698+
699+
## symbol_path — Shortest path between two symbols
700+
701+
```json
702+
{
703+
"tool": "symbol_path",
704+
"arguments": { "from": "buildGraph", "to": "resolveImports", "no_tests": true }
705+
}
706+
```
707+
708+
```
709+
Path: buildGraph → resolveImports (1 hop)
710+
711+
buildGraph src/builder.js:335 →(calls)→ resolveImports src/resolve.js:42
712+
713+
Hops: 1 | Alternate paths: 0
714+
```
715+
716+
```json
717+
{
718+
"tool": "symbol_path",
719+
"arguments": { "from": "buildGraph", "to": "isTestFile", "no_tests": true }
720+
}
721+
```
722+
723+
```
724+
Path: buildGraph → isTestFile (2 hops)
725+
726+
buildGraph src/builder.js:335
727+
→(calls)→ collectFiles src/builder.js:45
728+
→(calls)→ isTestFile src/queries.js:21
729+
730+
Hops: 2 | Alternate paths: 1
731+
```
732+
733+
---
734+
586735
## list_repos — Multi-repo registry (multi-repo mode only)
587736

588737
Only available when the MCP server is started with `--multi-repo`.

0 commit comments

Comments
 (0)