Skip to main content

codingest

CI crates.io PyPI Docs License: MIT

Give AI agents a live, queryable map of any codebase — locally, privately, and without running the code you are analysing.

codingest turns polyglot source into a KGLite knowledge graph of functions, types, calls, imports, inheritance, routes, documentation, and git revisions. Use it from Python, the command line, or as an MCP server for coding agents.

pip install codingest
import codingest

graph = codingest.build(".")
graph.cypher("MATCH (f:Function) RETURN f.name LIMIT 10")

No language servers, databases, or repository-specific build steps are required. The native Rust builder bundles parsers for 17 languages and returns a real kglite.KnowledgeGraph, ready for Cypher queries.

Built for agents and code analysis

  • Agent-ready MCP: give an MCP client graph_overview, cypher_query, read_code_source, repository switching, and automatic graph refresh. opencode is set up and verified end to end — including a config that needs no absolute paths — and codingest skill install packages the review skill for Claude Code and Codex, which opencode also discovers with no extra step.
  • Fast local review: map definitions, callers, dependencies, routes, inheritance, and affected tests without uploading or executing the project.
  • Open-source intelligence: clone and analyse a GitHub repository with one Python call, or let an agent manage cached public repositories through MCP.
  • Polyglot by default: one graph across Python, Rust, TypeScript, JavaScript, Java, Go, C/C++, C#, Swift, PHP, HTML, CSS, Dart, Julia, R, and AGC assembly — capabilities per language in docs/languages.md.
  • Revision-aware: analyse a tag, branch, commit, or multiple revisions in one graph and query what changed.

AGC assembly receives architecture-aware control and data relationships rather than a generic text-level call graph; see the AGC graph model.

Give your agent a code-review MCP server

pip install codingest
codingest-mcp --watch /absolute/path/to/repo

Point an MCP client at the same command:

{
  "mcpServers": {
    "code-review": {
      "command": "codingest-mcp",
      "args": ["--watch", "/absolute/path/to/repo"]
    }
  }
}

The server builds the graph at startup, refreshes it when source files change, and gives the agent schema discovery, Cypher, and source-reading tools over stdio. For a multi-repository agent sandbox with runtime set_root_dir, use the local-workspace manifest described in the MCP guide.

For a zero-configuration CLI workflow, install the packaged code-review Agent Skill instead:

pip install codingest
codingest skill install

The skill teaches compatible agents to build a fresh graph, discover its schema before querying, combine Cypher with the git diff, and verify findings against source lines. See the MCP guide and CLI guide.

Analyse a local codebase

import codingest

graph = codingest.build(
    ".",
    include_docs=True,
)

rows = graph.cypher("""
MATCH (caller:Function)-[:CALLS]->(target:Function)
RETURN target.qualified_name, count(caller) AS callers
ORDER BY callers DESC
LIMIT 10
""")

codingest.build(".", save_to="code-review.kgl")

The bundled terminal command offers the same workflow:

codingest build /path/to/repo
codingest status --output /path/to/repo/.kglite/code-review.kgl
codingest query -g /path/to/repo/.kglite/code-review.kgl \
  "MATCH (f:Function)-[:CALLS]->(g:Function) RETURN f.name, g.name LIMIT 20"
kglite describe /path/to/repo/.kglite/code-review.kgl --connections

codingest query prints unbounded TSV to stdout (use --format csv|json, or Cypher LIMIT to bound rows), warns on stderr when the graph has gone stale, and with --require-fresh refuses a stale graph with exit code 3 — see docs/cli.md.

Analyse an open-source repository

import codingest

graph = codingest.repo_tree("pallets/flask")
graph.cypher("""
MATCH (route:Function)-[:CALLS]->(dependency:Function)
RETURN route.qualified_name, dependency.qualified_name
LIMIT 25
""")

repo_tree() shallow-clones the requested repository into a temporary directory, builds the graph, and cleans up afterward. Pass branch=, clone_to=, or token= for a specific revision, a reusable cache, or a private repository.

Compare revisions

graph = codingest.build(".", revs=["v1.0", "v2.0"])
graph.cypher("""
MATCH (f:Function)
WHERE 'v2.0' IN f.revs AND NOT 'v1.0' IN f.revs
RETURN f.qualified_name
""")

Revision builds use tracked git content without changing the working tree. Multi-revision graphs store shared entities once and expose revision membership for direct Cypher analysis.

Install options

pip install codingest          # Python API + CLI + MCP server + KGLite runtime
codingest skill install        # code-review Agent Skill

The wheel bundles every grammar plus the codingest and codingest-mcp commands. KGLite ≥0.17.6 is installed automatically as the query/storage engine; its MCP server and the transitive mcp-methods framework power the builder-aware Codingest server. Nothing else needs to be installed.

Rust-only environments can instead use cargo install codingest-cli codingest-mcp; these are alternative distributions of the same commands, not Python prerequisites.

Rust crate

[dependencies]
codingest = "0.2"
kglite = "0.17.6"
use codingest::build_code_tree;

let graph = build_code_tree(
    dir,
    false, // verbose
    true,  // include tests
    None,  // save path
    None,  // max lines per file
    false, // include docs
)?;

How it fits together

codingest owns code-graph construction, the Python/CLI interfaces, the builder-backed MCP executable, and the code-review Agent Skill. KGLite provides the graph engine, Cypher, persistence, and reusable query/read tools. Keeping that boundary explicit lets codingest focus on accurate code understanding while reusing a dedicated graph engine.

Documentation: codingest.readthedocs.io

Workspace layout

Crate What it is
crates/codingest The component library (codingest): builder, parsers, manifest reader, docs pass, multi-rev merge, cross-language edges. Extracted from the former KGLite/crates/kglite/src/code_tree/ (removed upstream 2026-07-16) and re-targeted at the public kglite::api facade. Ships the codingest_stats + codingest_bench binaries.
crates/codingest-cli codingest binary — build a checkout or git revision(s) into a .kgl graph, status to check staleness, and skill to install Codingest's code-review Agent Skill.
crates/codingest-mcp codingest-mcp binary — the full MCP tool surface imported from the kglite-mcp-server library, with the codingest builder injected.
crates/codingest-py PyO3 wrapper built by maturin into the codingest wheel (pip install codingest). Python package source is codingest/; pyproject.toml drives the maturin build. Not published to crates.io (publish = false).

CI-equivalent local gate

cargo build --workspace
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo test --workspace --test parity

The golden-digest oracle (also the determinism gate)

KGLite deleted its in-tree code_tree builder on 2026-07-16, so the old two-builder parity sweep is gone. The authority it enforced was frozen while the builders were still verified identical, into per-corpus SHA-256 digests under crates/codingest/tests/goldens/ (committed fixtures — no network). The golden_parity test builds each corpus three times with only the codingest builder, digests a canonical exhaustive graph rendering, and requires every build to match every other build and the frozen golden. Repeating the build is what makes this the determinism gate: hash iteration order is randomized per HashMap, so an order-dependent builder fails it (the tests/corpus/dup_minified_assets fixture reproduces the original DEFINES-edge nondeterminism bug). Disagreement between builds is reported as NONDETERMINISM; agreement between builds but not with the golden is reported as a behaviour change. The multi-rev fixture is guarded instead by rev_self_consistency. Regenerate goldens only for deliberate builder-behavior changes: cargo test --workspace --test parity -- --ignored capture_goldens (details in crates/codingest/tests/goldens/README.md).

Everything the gate needs is committed to this repository, so it is hermetic and runs in CI. It replaced a local-only make step that asserted an exact edge count against a sibling checkout — a verdict this project did not control. make determinism-soak REPO=… keeps the large-repo reproducer available as a diagnostic.

Dependency policy

kglite and kglite-mcp-server use matching crates.io requirements with a 0.17.6 minimum and a shared lockfile. This keeps the builder, persistence handoff, and embedded MCP server on one compatible engine patch line.

Parity with the (now-removed) in-tree component

codingest was extracted to be feature- and performance-identical to kglite's in-tree code_tree. KGLite removed that module on 2026-07-16, so parity is now enforced against a frozen record of its last-known-good output rather than live cross-comparison. See PARITY.md (stats-diff + timing), BENCHMARKS.md (build-time + Cypher benchmarks), crates/codingest/tests/parity.rs (the golden oracle), and docs/mcp-parity.md (the MCP↔builder coupling and the hook).

tests/python-legacy/ preserves KGLite's full 47-file kglite.code_tree behavioral suite verbatim as the dormant behavioral spec — the source of truth for what the Python builder guaranteed (see its README).

License

MIT © Kristian dF Kollsgård. codingest is an independent project; it depends on kglite at runtime but is not otherwise affiliated with it.

Release files for codingest 0.2.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codingest 0.2.22
File Size Uploaded
codingest-0.2.22.tar.gz 491.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for codingest 0.2.22
File
codingest-0.2.22-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
codingest-0.2.22-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details
codingest-0.2.22-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
codingest-0.2.22-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
codingest-0.2.22-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 66.4 MB

Release files / codingest-0.2.22.tar.gz

Download URL codingest-0.2.22.tar.gz
Size 491.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1feccdf6d6436b9642202b592089c581cf2fb9f8c6c4346d380b3660ad3e8ca5
BLAKE2b-256 checksum
How to use checksums
ce8b463a212e5423b5b513bba1a740b1b3269bf4b8511a9c87d027ae51cdae2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release files / codingest-0.2.22-cp310-abi3-win_amd64.whl

Download URL codingest-0.2.22-cp310-abi3-win_amd64.whl
Size 13.9 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2eebe332c02378c4769eef5deef29b07a1c9173fe47dee17f0124b048ddd3d6b
BLAKE2b-256 checksum
How to use checksums
af447279ccffcf31d9d26637f64c8bfc423d9bf4961fe6261deddf99271823c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release files / codingest-0.2.22-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL codingest-0.2.22-cp310-abi3-manylinux_2_28_aarch64.whl
Size 12.7 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
85ef04e8da397d8714e316fe04e5ed73c1b783d73b3631e63798548c57b3630a
BLAKE2b-256 checksum
How to use checksums
e64604be927d9f657d034bf57787d96bfbbaedb463ec5e0076b46756d9b5bb3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release files / codingest-0.2.22-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL codingest-0.2.22-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 13.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
84e5c0bf12c5d0277d67e497eba0e6192413a7ec625bf88e24d611f780d05941
BLAKE2b-256 checksum
How to use checksums
05ba4016ca779ee954de72b1ed62add87e6027f17566fdd2a846acaad0413a0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release files / codingest-0.2.22-cp310-abi3-macosx_11_0_arm64.whl

Download URL codingest-0.2.22-cp310-abi3-macosx_11_0_arm64.whl
Size 12.5 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
57f57d8e3bf0973032996200d8dc4ee0b129a4af3d518e2bbe43e14c2016ad2d
BLAKE2b-256 checksum
How to use checksums
c9900bcce170868e921e318f0f40f672df8d657b91beb07404af4931de444057
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release files / codingest-0.2.22-cp310-abi3-macosx_10_12_x86_64.whl

Download URL codingest-0.2.22-cp310-abi3-macosx_10_12_x86_64.whl
Size 13.2 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
cdeada0e4ab0188ecc8ad9488fc7536a0d632f3a41881a7745f9b659564df43c
BLAKE2b-256 checksum
How to use checksums
a66cdcc66dafc8b2212b5c39e4de62ac9cfb5a088ae6a7b1f69ddc6b4ccd2f28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.26

6 release files

0.2.25

6 release files

0.2.24

6 release files

0.2.23

6 release files

This release

0.2.22 This release

6 release files

0.2.21

6 release files

0.2.20

6 release files

0.2.19

6 release files

0.2.18

6 release files

0.2.13

6 release files

0.2.12

6 release files

0.2.11

6 release files

0.2.10

6 release files

0.2.9

6 release files

0.2.8

6 release files

0.2.7

6 release files

0.2.6

6 release files

0.2.5

6 release files

0.2.4

6 release files

0.2.3

6 release files

0.2.2

6 release files

0.2.1

6 release files

0.2.0

6 release files

0.1.7

6 release files

0.1.6

6 release files

0.1.5

6 release files

0.1.4

6 release files

0.1.3

6 release files

0.1.2

6 release files

0.1.1

6 release files

0.1.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page