DistilCodeAll techniques

Technique 13 / 14

Codebase graphing and traversal

Answer how code connects without repeatedly searching files and reconstructing dependencies by hand.

Interactive model

See the change.

Illustrative task: “How does checkout reach the payment provider, and what could break if I change chargePayment?”

CodeGraph-assisted discoveryflow + change impact

Source and relationships together

codegraph_explore
Query: "How does checkout reach chargePayment,
        and what depends on chargePayment?"

Relevant source: handleCheckout, createOrder, chargePayment
Call path: handleCheckout → createOrder → chargePayment
Other caller: retryPayment → chargePayment
Change impact: checkout and payment retries

Use the returned source to explain both flows.

Conceptual demonstration. Counts illustrate the flow, not measured production savings.

How it works

Less context. Same thread of work.

A text match tells you where a name appears. CodeGraph also records how functions call each other, which files import them, and how classes relate. Its codegraph_explore MCP tool returns relevant symbols’ source grouped by file, the call paths between them, and a blast-radius summary showing what a change could affect.

DistilCode provisions CodeGraph locally, initialises a missing .codegraph index, and connects the MCP server in the background. The codebase-memory specialist uses it for structural questions and carries useful findings into repository memory. Source returned by the graph is already available to reason about; config, docs, and unindexed files still use Glob, Grep, and Read.

CodeGraph builds and queries the index locally; retrieved source becomes part of the specialist’s context. Only the codebase-memory specialist is authorized to invoke CodeGraph; the regular explore agent uses source-search tools. This keeps relationship-heavy investigation in the specialist that maintains repository knowledge.

In practice

The operating loop

  1. 01

    Build the local graph

    Index symbols and call, import, and inheritance relationships in the repository’s .codegraph directory.

  2. 02

    Ask about a flow

    codegraph_explore returns the source and connected call paths for questions such as “How does checkout reach the payment provider?”

  3. 03

    See what could break

    Use callers and the blast-radius summary to identify affected code before changing a shared function.