Skip to content

Feature request: make graph queries context-aware across languages #572

@TheFedaikin

Description

@TheFedaikin

What we want

We want graphify queries to distinguish between edge kinds that are currently traversed together.

Examples:

  • calls vs type/declaration references
  • imports vs executable relationships
  • field references vs other symbol mentions

A query like who calls X? should prefer call-heavy results instead of mixing calls, imports, and declaration-style references.

Why

This improves query precision in larger or noisier graphs and makes edge disambiguation a graph-level, cross-language capability.

Model boundary:

  • relation = semantic edge type
  • context = syntactic disambiguation where needed

Proposal

Add a cross-language context layer for edges where it improves query quality, and use it during query traversal.

Initial contexts:

  • call
  • import
  • field

Queries should support:

  • explicit filtering
  • small heuristic inference when the query clearly implies a context

Examples:

  • graphify query "extract" --context call
  • who calls extract -> infer call when no explicit filter is provided

Scope

  • add/standardize edge context where supported
  • support context-aware filtering in:
    • CLI graphify query
    • MCP query_graph
  • show active context filtering in query output

Non-goals

  • do not move inherits / implements into context
  • do not replace relation with context
  • do not build broad NLP intent parsing
  • do not treat this as a fix for general explain / path disambiguation

References #569

This is related to #569, but narrower in scope.

  • #569 is mainly about resolving the right node or candidate set in large, noisy graphs
  • this issue is about traversing the right edge kinds once the node is found

In short:

  • #569 = node resolution / disambiguation
  • this issue = edge-context-aware traversal

Done when

  • queries can explicitly filter by context
  • obvious query phrasing can infer context when no filter is passed
  • output makes the active context visible
  • extraction/tests cover the touched languages

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions