Indexing pipeline
This guide describes what happens when you call CodebaseIndexer.index().
Overview
The indexer performs a full scan of a repository commit and writes files, chunks, and relations into PostgreSQL. It does not generate embeddings; embeddings are handled by the separate embed() step.
Steps
- Repository registration
-
PostgresGraphStorage.ensure_repository()creates or updates the repository row. -
Git sync and snapshot creation
GitVolumeManagerupdates a bare mirror of the repository.create_snapshot()inserts a snapshot with statusindexing.-
If the same commit is already indexed, the existing snapshot is reused.
-
File scan
- The worktree is scanned with
os.walk. - Ignored directories:
.git,node_modules,__pycache__,.venv,dist,build,target,vendor. -
Extensions indexed:
.py,.js,.jsx,.ts,.tsx,.java,.go,.rs,.c,.cpp,.php,.html,.css
-
Parallel parsing
- A
ProcessPoolExecutorprocesses file chunks (50 files per task, 5 workers). -
Each worker uses
TreeSitterRepoParserto:- Skip large files (
>1 MB), binaries, and minified/generated content. - Emit
FileRecord,ChunkNode,ChunkContent, andchild_ofrelations. - Build FTS documents from chunk metadata and content.
- Skip large files (
-
Snapshot activation
- Indexing stats and a file manifest are generated.
- The snapshot is marked
completedand becomes the active snapshot.
Notes
- If a repository is already being indexed,
index()returns"queued". - Semantic tags from Tree-sitter queries are currently available for Python, JavaScript, and TypeScript.
- Parsing and indexing always run on the full file set for the target commit.