vtcode-indexer
August 5, 2026 · View on GitHub
Root AGENTS.md | Lightweight workspace file indexer with Markdown-backed persistence.
Key Types
SimpleIndexer main API | SimpleIndexerConfig configuration | FileIndex entry | SearchResult match | IndexStorage trait | TraversalFilter trait | MarkdownIndexStorage default backend | ConfigTraversalFilter default filter
Rules
IndexStoragetrait is the persistence extension point. Implement for custom backends.TraversalFiltertrait controls which files/dirs are indexed.ConfigTraversalFilteris default.- Always skips
.env,.git,.DS_Store— hardcoded inshould_index_file(). SimpleIndexerConfigexcludestarget/,node_modules/,.vtcode/index/by default.- Snapshot storage (
prefers_snapshot_persistence()) writes a singleindex.md— legacy per-file.mdentries are auto-cleaned.
Testing
cargo nextest run -p vtcode-indexer. Uses tempfile::tempdir() for isolation.
Gotchas
FileIndexCachebuilds traverse the workspace and use synchronous/Rayon work; keep them inspawn_blockingand preserve the single-build gate so Tokio workers remain responsive and concurrent misses do not stampede the filesystem.- Indexed searches read immutable
StringIdpath text through the shared snapshot; keep mutable interner access on incremental-update paths only. - Parallel uncached traversal and full index builds aggregate worker-local results once; preserve total counts and lexical tie ordering.
refresh_backgroundreturns the lock-free latest snapshot and schedules work only inside Tokio; publish cache and snapshot together after successful rebuilds or incremental updates.index_directory()respects.gitignoreviaignorecrate'sWalkBuilder.path_cacheis not used here — that'svtcode-bash-runner. Indexer usesindex_cache: HashMap.- Binary/unreadable files are silently skipped (
ErrorKind::InvalidData).