Skip to content

Feature: literal/identifier usage index for string-coupling navigation #1220

Open

Description

@Studioscale

Problem — For codebases where change-coupling lives in string literals (raw SQL, column/value filters, template/route names, config keys) rather than function calls, the AST graph is structurally blind to the dominant coupling. A value duplicated across N queries (e.g. a status filter repeated across ~15 SQL statements) is invisible to the call graph, so a heavy user falls back to grep for exactly the edits most likely to break something. Observed on a single-file Flask + raw-SQL + Jinja app: function blast-radius and {% extends %} edges worked great, but most day-to-day coupling lived in string literals the graph couldn't represent.
Proposal — Index notable string literals + identifiers as first-class searchable nodes, with edges to the enclosing function/file of each occurrence, so "where is X used / which queries filter on Y" becomes a graph query. If a full index is too heavy, a lighter graphify grep that maps regex hits to enclosing nodes would bridge most of the gap.
Secondary — A Flask-aware pass emitting deterministic render_template('X.html') route→template edges would complement the already-solid {% extends %} edges.

Activity

  1. royashbrook commented on Jun 11, 2026

    @royashbrook

    I just created a skill called sql-spider to solve the sql part of this problem. The skill will output a graph that you can use if you want, but the entire goal was to output a graph that can be consumed by graphify and it does that. For me, validating some of my prior sql claims from the agent, it cost about 1% of the tokens I used when analyzing sql directly. That benefit is totally from graphify, but since there wasn't a way to pipe sql into graphify (that I could find at the time) I made this.

    Your issue is a bit broader than just the sql part, but just in case it helps. I'm not a big python guy, but once I get claude to convert it to python, I'll probably submit it as a PR so we can get sql support.

  2. rilkerfc commented on Jul 21, 2026

    @rilkerfc

    Second real-world corroboration (graphify v0.9.22, 4,699-node TS/Next.js monorepo). Same pattern you describe: AST call-graph + community detection are strong, but feature/string-location queries fell back to grep.

    Concrete case — a WhatsApp deep-link builder waMeLink() whose coupling lives in the literal wa.me/https:// template string. The literal is unsearchable because code nodes carry no literal field: schema is label / source_file / source_location / file_type / community / norm_label, and metadata is only {kind, language}. So "where is the wa.me link built / which code touches this URL" has nothing to match against.

    The lighter graphify grep <pattern> → enclosing node option you propose would cover the bulk of it without inflating the graph. One addition: the same gap exists on the MCP server surface — there's no query_graph-side way to match a literal either, so agents using --mcp hit it too. Worth having the grep/literal path reachable from MCP, not just the CLI.

  3. durmazoguzhan commented on Aug 24, 2026

    @durmazoguzhan
    Contributor

    A data point on how far you get without the literal index, from a case that looked like it needed one.

    I was tracing MassTransit publish and consume chains in a C# codebase, where the queue name only exists as a string inside new Uri("queue:prepare-elastic-data-event"). Message types turned out to carry most of it: the consumer implements IConsumer<T> and the producer references T, so both ends land on the same node without the string ever being indexed. Two of the three hops in one chain resolved that way.

    The third hop failed, but for an unrelated reason: it publishes with Send(new T { ... }), and new produced no edge at all in C#. That is #2997.

    Where the type route genuinely runs out is queue names that are not the kebab-case of a message class. In that codebase 27 of 36 receive endpoints followed the convention and 9 did not, and those 9 are only reachable through the literal. So the index would still buy something, just less than I expected going in.

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