Skip to content

Extraction leaves source_location null on most edges — query results can't cite an exact line, forcing agents into a second file-read pass #3307

Open

Description

@lamsoon-work

Context

Ran a controlled benchmark: two fresh coding-agent instances studied the same repo from zero context, answering 5 identical cross-file questions — one agent using graphify query against a pre-built graph, one using only Read/Grep/Glob (forbidden from touching graphify at all). Repeated on two repos of different size/legibility.

What happened

In both runs, the graphify-assisted agent's own self-report explained where its extra cost came from: it ran graphify query "<question>" first to locate the right file(s), then still had to Read those exact files afterward to pull verbatim detail — exact env var names, script line numbers, quoted wording — because the query results it got back didn't carry that detail at citable precision.

Checked this against the actual graph.json for both graphs used in the benchmark:

Repo edges w/ null source_location nodes w/ null source_location EXTRACTED-confidence edges w/ null source_location
small, self-describing repo (556 nodes / 757 edges) 625/757 (82%) 458/556 (82%) 573/705 (81%)
larger, less self-describing repo (1,059 nodes / 1,204 edges) 645/1204 (53%) 674/1059 (63%) 492/1002 (49%)

So even edges marked EXTRACTED (relationship explicit in source, per the extraction spec) mostly carry no line reference back to where that was extracted — half to over 80% of the time depending on the corpus.

Cost observed

Repo Nodes With graphify Without Delta
small, self-describing 556 79.6k tok / 71.9s 53.1k tok / 58.8s +50% tok / +22% time
larger, less self-describing 1,059 83.5k tok / 66.8s 62.1k tok / 61.8s +35% tok / +8% time

Both deltas track roughly with "go verify by reading the file anyway" as an extra pass on top of the query.

Ask

Populate source_location (exact line or line range) during extraction wherever the source file structurally supports it — code already gets this for free from AST (line numbers are known at parse time), so the gap is concentrated in doc/YAML/markdown extraction, where a header, table row, or comment block still has an unambiguous position in the file that the semantic-extraction pass could capture and isn't currently asked to.

Bonus motivation

This isn't only a cost problem. In the same benchmark, one graphify-assisted agent fabricated a specific line-number citation to support a claim — attributing a quote to a line that, when checked, was mid-paragraph of an unrelated principle that actually argued the opposite. Real source_location on EXTRACTED edges would let downstream tooling (or the querying agent itself) distinguish "this is a verified quote at line N" from "this is the graph's summarized rationale" before it gets asserted as a fact with an invented citation.

Environment

graphifyy 0.9.53, Claude Code / Claude Sonnet 5 as both the extracting agent (built both graphs) and the querying/baseline agents in the benchmark.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions