Skip to main content

Overview

Walks a project directory, extracts semantic code chunks using AST analysis, embeds them locally, and stores them in a vector index. Subsequent calls skip unchanged files (incremental updates).

Parameters

Example

Force a full rebuild:
Use a cloud embedding provider:

Provider lock

Once a project is indexed with a provider, re-indexing with a different provider requires force=True. This rebuilds the vector table with the correct embedding dimensions for the new provider.

Live watch

watch=True starts a background watcher that detects file saves and re-indexes only changed files automatically. Only supported with the local provider — using watch=True with a cloud provider returns an error to prevent unbounded API costs.
Use stop_watching to stop the watcher.

Notes

  • Only re-indexes files whose mtime or size has changed since the last run
  • Index is stored under ~/.vecgrep/<sha256-of-project-path>/lancedb/ with a merkle.json fingerprint file
  • To also build the knowledge graph (for search_graph, graph_neighbors, hybrid_search), run index_graph after indexing