See the structure of your code.

Codegraph reads sources alone and turns them into a model you can query, walk as a 3D city, browse dependency by dependency, replay through its history, and have explained bottom-up.

The code city of google/gson: nine package plates, 113 class blocks sized by lines of code, and thirty red arcs marking the dependencies whose removal would break every cycle.
The model codegraph extracted from google/gson , drawn as it is laid out. Nine packages as plates, nested like the packages they are; 113 classes as blocks whose height is lines of code and whose footprint is member count; in red, the cyclic dependencies.

Run end to end on

google/gson3,600 entities apache/commons-lang15,000 entities spring-petclinicframework wiring apache/fineract127 MB model

What does it look like?

A city you can walk. Every visual channel is a documented metric, and colour is never decoration.
codegraph city gson.jsonl --serve

Packages are districts, nested like the packages they are. Classes are buildings whose height and footprint follow the metrics you choose: lines of code and member count by default, cyclomatic complexity when the extractor measured it. Dependencies are arcs from roof to roof.

A dependency the model inferred is drawn desaturated, so it can never pass for a fact. Red is reserved for the edges whose cut would break a cycle. Unmeasured buildings are drawn at the minimum and labelled unmeasured rather than faked.

Read the tutorial on reading a city

What exactly depends on what?

Every dependency, down to the line that proves it.
codegraph navigator gson.jsonl --serve

A searchable tree of modules, types and members. Select anything and read its incoming and outgoing dependencies classified by role, with the member that carries each one, its provenance, and the file and span where it happens. The dependency graph, the cycle report and the coupling ranking are one tab away.

Read the tutorial on the navigator

How did it get this way?

History is a dependency the source cannot show you.
codegraph scm ~/src/gson codegraph snapshots ~/src/gson --jar codegraph-java.jar --tags codegraph replay --store gson.db --history gson-history.jsonl --serve

Hotspots, ownership and co-change come from git alone. Sample a repository at its tags into a temporal store and replay the city through the years: buildings rise at birth and sink at death, change heat and age ride the colours, and files that always change together are joined by a dashed arc the declared graph cannot explain.

The join runs the other way too: declared dependencies that history never exercised together are reported as dead weight.

Read the tutorial on replaying history

What does it mean?

One explanation per method, class and package, written leaves first.
codegraph explain gson.jsonl --src gson/src/main/java --estimate codegraph explain gson.jsonl --src gson/src/main/java --max-calls 50

A language model explains the leaf operations first, then their callers, then the types and the packages that own them. Each prompt carries the explanations already written for what the unit depends on, so every summary rests on parts already explained, and mutually dependent units are explained as one.

We estimate tokens and cost before a single call is made, and a re-run redoes only what changed. On the reference corpus a full run was 68 calls and about six cents. Explanations live in a side-car file; the model itself is never touched.

Read the tutorial on explanations

Why the picture can be trusted

We built codegraph for codebases where the truth is in dispute. It never claims more than the model contains.

Facts and inferences never share an edge.

Every edge carries a provenance: declared, derived, dynamic-candidate or generated. A dependency read from the source is a different thing from one inferred from a framework annotation, and every report, picture and export keeps the two apart. --declared-only gives you the facts alone.

Every claim points at a line.

Entities and edges carry a source anchor. When the navigator says one class depends on another through a given method, it shows the file and the span where that happens.

No build is required.

The Java extractor runs Spoon without a classpath. What it cannot resolve becomes an explicit stub whose edges are kept, and stubs are decided by what the corpus declares, never by guessing from a package name.

The outputs are boring on purpose.

Standard output is the artifact and standard error is for humans. Identical input gives byte-identical output, so a model diffs in a repository. Exit codes tell a bug in codegraph apart from a finding about your code, so a pipeline can gate on either.

Read why facts and inferences never mix

Sixty seconds to a city

Node 22, pnpm and a JDK 17 or newer. Codegraph runs from a clone today; there is no package yet.
git clone https://gitlab.com/jgrodziski/codegraph.git && cd codegraph
pnpm install && pnpm -r build
(cd extractors/java && ./mvnw -B package)

java -jar extractors/java/target/codegraph-java.jar \
     --src ~/src/gson/gson/src/main/java --out gson.jsonl
./bin/codegraph validate gson.jsonl
./bin/codegraph city gson.jsonl --serve --host 127.0.0.1

On gson this takes about a minute end to end, most of it the clone. The city opens on port 4177; the navigator, on 4178. Both bind every interface unless you say otherwise, which is why the last line does.

The first tutorial walks through every step

What it does not do

Stated first, so an afternoon is not lost finding out.

Two languages today: Java and C#.

Nine language profiles exist on paper; the shipped extractors are Spoon for Java and Roslyn for C#. A Clojure adapter is next, and the interchange contract is published so an extractor in any language can conform.

No build means imperfect resolution.

Without a classpath some references stay unresolved and become stubs. A stub is honest, but it is still a gap. Keep one package to one source root per run.

Explanations cost money and need a network.

It is the only command that does. The plan and the estimate come first, and a cap on calls is one flag away.

Not a linter.

Codegraph reports structure, coupling and cycles. It does not judge style and it does not find bugs.

Read what extraction without compiling costs