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 15 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.
  • 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, and AGC assembly.
  • Revision-aware: analyse a tag, branch, commit, or multiple revisions in one graph and query what changed.

Give your agent a code-review MCP server

cargo install codingest-mcp
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
kglite describe /path/to/repo/.kglite/code-review.kgl --connections

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 + codingest CLI + KGLite runtime
cargo install codingest-cli    # pure-Rust builder CLI
cargo install codingest-mcp    # MCP server for agents
codingest skill install        # code-review Agent Skill

The wheel bundles every grammar and the codingest command. KGLite ≥0.14.5 is installed automatically as the query/storage engine.

Rust crate

[dependencies]
codingest = "0.1"
kglite = "0.14.5"
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 -p codingest --test parity

The golden-digest oracle

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 with only the codingest builder, digests a canonical exhaustive graph rendering, and compares to the frozen golden. The multi-rev fixture is guarded instead by rev_self_consistency. Regenerate goldens only for deliberate builder-behavior changes: cargo test -p codingest --test parity -- --ignored capture_goldens (details in crates/codingest/tests/goldens/README.md).

Dependency policy

kglite and kglite-mcp-server use matching crates.io requirements with a 0.14.5 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codingest-0.1.2.tar.gz (262.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

codingest-0.1.2-cp310-abi3-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

codingest-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

codingest-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

codingest-0.1.2-cp310-abi3-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

codingest-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file codingest-0.1.2.tar.gz.

File metadata

  • Download URL: codingest-0.1.2.tar.gz
  • Upload date:
  • Size: 262.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for codingest-0.1.2.tar.gz
Algorithm Hash digest
SHA256 46bfda965e97350a5306cc733cdc17f23608abd3fdfeaa232b8e2940abbee2ee
MD5 6e01f6fb25a05e5466a4de1213562dd7
BLAKE2b-256 ea7d8ce5e36769d995a5cad0d76ca360b2665fbc1e0fecfdc6001298a3b64758

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.2.tar.gz:

Publisher: release.yml on kkollsga/codingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codingest-0.1.2-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: codingest-0.1.2-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for codingest-0.1.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 073fc39ddd8fedd562e7d6029d806c8d4d15d91bf442d707d7bc05e0deba0c9b
MD5 bec76b7fb13669af290991c3473585d7
BLAKE2b-256 1e752e3f2bff65456ec7403145933a3ef77a6a13799341d3560c0eac9478c296

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.2-cp310-abi3-win_amd64.whl:

Publisher: release.yml on kkollsga/codingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codingest-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for codingest-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 09612520fe91ffb379eadd8f5efdfae35e048d0290435cd8bf747f569db4bd4a
MD5 1a1fc201ff228adea140aec766cd8c2a
BLAKE2b-256 2964385b38171df7841c3309211306a10a1851e2a6fbbd376e43362ae1287df2

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on kkollsga/codingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codingest-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for codingest-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69b1e576716f178a0ab353cd306c9af0218c3429abcca0d0bf75cace47bd71a2
MD5 ba6aee45628359c1e64401451466319e
BLAKE2b-256 eacaeb463b45c8b2b0938e6f37958334352010d79a11dd2c4974e5fed77f491a

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on kkollsga/codingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codingest-0.1.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for codingest-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5bc79e56ff32238ad91a9453aba41afc51f5239d269f083dc7def54b2c2c76a1
MD5 314d3004cc4c50bb5cdf88c107387537
BLAKE2b-256 6028de1823394b2b6e4466fe80abc38376a8c737e7604f92b8ea81a8fedc4454

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.2-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on kkollsga/codingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codingest-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for codingest-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bc68249783759cbe3306e509065aa9b035db3b1e874da87bf5259c1cc9d0f4f9
MD5 b7364b157a4cdd6a1af76ecc60197666
BLAKE2b-256 cc45d4935b68e63a9f96c4f71508a1ad9e098448bf15a2545fae6ff3b126b2ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on kkollsga/codingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page