index_codebase
Index a codebase directory for semantic search. Extract AST code chunks, embed them locally, and store in a vector index, with incremental updates skipping unchanged files.
Instructions
Index a codebase directory for semantic search.
Walks the directory, extracts semantic code chunks using AST analysis,
embeds them locally with sentence-transformers, and stores in a vector index.
Subsequent calls skip unchanged files (incremental updates).
Args:
path: Absolute path to the codebase root directory.
force: If True, re-index all files even if unchanged.
watch: If True, start a background watcher for live sync on file changes.
Not supported with cloud providers (openai, voyage, gemini).
provider: Embedding provider to use. One of: 'local' (default), 'openai',
'voyage', 'gemini'. Cloud providers require the corresponding
env var (VECGREP_OPENAI_KEY, VECGREP_VOYAGE_KEY, VECGREP_GEMINI_KEY)
and optional dependency (pip install 'vecgrep[openai]' etc.).
Once set, switching providers requires force=True to rebuild the index.
Returns:
Summary: files indexed, chunks added, files skipped.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| force | No | ||
| watch | No | ||
| provider | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |