Skip to content

Search code with the code graph

This guide shows you how to use the code graph to search and navigate your codebase.

The code graph is a symbol/edge database built by indexing your repos with tree-sitter. It contains:

  • Symbols: functions, classes, methods, fields, enums, etc.
  • Edges: directed relationships (calls, imports, extends, implements, references)

The graph is scoped by (workspaceId, repoId) — each workspace+repo combination has its own graph.

Control Center indexes repos automatically when:

  • A repo is linked to a workspace (RepoAdded event triggers indexing)
  • Files change (the indexer processes changed files in worker isolates)

You can also trigger indexing manually from the workspace detail view.

The indexer:

  1. Parses files with tree-sitter
  2. Extracts symbols (functions, classes, methods, etc.)
  3. Extracts edges (calls, imports, extends, etc.)
  4. Prunes deleted symbols
  5. Resolves cross-file references
  6. Embeds symbol signatures for vector search

It degrades gracefully if tree-sitter natives are missing.

Use the search_code MCP tool or the code graph UI:

search_code(workspace_id: "...", query: "authentication middleware")

Search combines:

  • FTS — keyword matching on symbol names, signatures, and docstrings
  • Vector — semantic similarity on embedded content
  • Hybrid (RRF) — combines both

Results include the symbol’s name, qualified name, file path, line range, and signature.

code_symbol(workspace_id: "...", symbol_id: "...")

Returns the symbol’s full metadata: kind, signature, docstring, parent name.

code_callers(workspace_id: "...", symbol_id: "...")

Returns all symbols that call this function/method.

code_callees(workspace_id: "...", symbol_id: "...")

Returns all symbols that this function/method calls.

code_impact(workspace_id: "...", symbol_id: "...")

Runs a BFS traversal from the symbol, returning:

  • All reachable symbols
  • Edges between them
  • Depth of each symbol from the root

Use this before refactoring to understand what will be affected.

function, method, class, field, enum, constructor, getter, setter, typedef, extension, mixin, variable

calls, imports, extends, implements, mixesIn, references