Skip to content

query answers repeat each node's file path; a compact form gives the same answer in ~1.7x fewer tokens #4469

Open

Description

@devkancheti4-design

What happens

Every NODE line in a graphify query answer repeats the node's full source path. On a graph built without clustering, it also carries an empty community=. Measured on SWE-bench Lite answers (12 repos, AST-only graphs, default BFS and 2,000-token budget):

part of an answer share of its characters
NODE lines 87%
the repeated src= paths 36%
empty community= 12%
EDGE lines 3%

A file with five nodes in the answer pays for its path five times. Agents read these answers on every query, so the repetition is spent over and over.

Proposal

Add an opt-in compact form of the same answer. Write each file once, in the order of its first node, with its nodes beneath it in their original order. Leave out empty fields. Change nothing else: the budget cut, the notices and the order.

FILE django/db/models/query.py
  QuerySet L280
  filter() L1203
FILE django/db/models/sql/where.py
  WhereNode L14

On 600 answers (300 SWE-bench Lite issues x 2 queries), this gives the same files in the same order in 600 of 600, at 1.74x fewer tokens. A PR follows.

Activity

  1. github-actions commented on Oct 15, 2026

    @github-actions

    Thanks for opening this issue, @devkancheti4-design. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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