Skip to content

Query Commands

Fresh

Overview

Once a graph exists at graphify-out/graph.json, you can query it without rebuilding. All query commands work as slash commands and direct terminal commands.

Query Types

bash
/graphify query "what handles authentication"
/graphify query "how is data validated"
/graphify query "database connection setup"

Returns nodes and edges relevant to the question. The graph uses the community structure from Leiden clustering to contextualize results.

DFS Path Tracing

bash
/graphify query "authentication flow" --dfs

Uses depth-first search to trace a specific path through the graph rather than returning a ranked list.

Shortest Path Between Nodes

bash
/graphify path "UserController" "Database"
/graphify path "AuthMiddleware" "SessionStore"
/graphify path "NodeA" "NodeB"

Returns the shortest connection path between two named nodes. Useful for understanding how two seemingly unrelated components interact.

Node Names

Node names are case-sensitive and must match exactly as they appear in GRAPH_REPORT.md or the graph.html visualization.

Node Explanation

bash
/graphify explain "SwinTransformer"
/graphify explain "AuthMiddleware"
/graphify explain "ConceptName"

Returns everything Graphify knows about a specific node: its relationships, community membership, confidence scores, and source files.

Understanding Query Results

flowchart LR
    Q[Query String] --> S[Semantic Match]
    S --> N1[Node: AuthService]
    S --> N2[Node: JWTMiddleware]
    S --> N3[Node: SessionStore]
    N1 --> E1[EXTRACTED edge to Database]
    N2 --> E2[INFERRED edge to AuthService]
    N3 --> E3[AMBIGUOUS edge to RedisCache]

Edge Confidence

Every result includes edge confidence:

Edge TypeMeaningTrust Level
EXTRACTEDDirectly found in sourceHigh
INFERREDReasonable inference from contextMedium
AMBIGUOUSFound but low confidenceVerify before acting

Querying Without an Assistant

All query commands work directly from the terminal:

bash
graphify query "authentication flow"
graphify path "UserController" "Database"
graphify explain "AuthMiddleware"

This lets you explore the graph without opening your AI assistant.

Practical Query Patterns

Onboarding a New Codebase

bash
/graphify explain "main"          # Entry point
/graphify query "data flow"       # How data moves
/graphify query "external deps"   # Third-party integrations

Debugging

bash
/graphify path "ErrorSource" "ErrorHandler"
/graphify query "error handling"
/graphify explain "the failing component"

Architecture Review

bash
/graphify query "database layer"
/graphify query "API boundaries"
/graphify query "authentication"

Token Efficiency

Using /graphify query before asking your AI assistant a complex architecture question can reduce the tokens needed by 71x — the graph gives the assistant a precise subgraph instead of requiring it to read dozens of files.