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 ependencies.

Run end to end on

What does it look like?

A visual representation of your code: packages are districts, classes are buildings, dependencies are arcs between roofs.

Packages are districts, nested to reflect their hierarchy. Classes are buildings whose height and footprint follow the metrics you choose: lines of code and member count by default, cyclomatic complexity. Dependencies are arcs from roof to roof.

A dependency the model inferred is drawn desaturated. Red is reserved for the edges that represent cyclic dependencies. Unmeasured buildings are drawn at the minimum.

Read the tutorial on reading a city

What exactly depends on what?

Every dependency of every code elements.
codegraph serve gson.jsonl

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 city, the dependency graph, the cycle report and the coupling ranking are one tab away — and a building clicked in the city lands here, on its own dependencies.

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

One Homebrew tap. The app and the command are one install; each language’s extractor is its own. Nothing else to install: no JDK.
brew install --cask defsquare/tap/codegraph
brew install defsquare/tap/codegraph-java

codegraph-java --src ~/src/gson/gson/src/main/java --out gson.jsonl
codegraph validate gson.jsonl
codegraph serve gson.jsonl --host 127.0.0.1

On gson this takes about a minute end to end, most of it the download. One page opens on port 4177: the navigator, with the city as a tab. It binds every interface unless you say otherwise, which is why the last line does. Linux and Windows get the same binaries without the cask; the install guide has the lines.

The first tutorial walks through every step