Skip to main content

Overview

Walks a project directory and extracts a knowledge graph using tree-sitter AST analysis — no LLM required. Nodes represent structural units (files, functions, classes, methods); edges represent relationships (contains, calls, imports, inherits). The graph is persisted as graph.json alongside the vector index and is used by search_graph and graph_neighbors. It is also blended into results by hybrid_search when present.

Parameters

Example

Rebuild after a major refactor:

Node kinds

Edge kinds

Notes

  • Graph is stored at ~/.vecgrep/<project_hash>/graph.json
  • Independent of the vector index — can be run before or after index_codebase
  • Runs entirely locally — no network calls, no LLM
  • hybrid_search degrades gracefully to pure vector search if no graph index exists
  • Use force=True after significant refactors to rebuild from scratch