Phase 8: file-type-aware embedding model routing, dual-model search, and incremental indexing#4
Conversation
Agent-Logs-Url: https://github.com/jsilvanus/gitsema/sessions/752fcb60-2360-4515-941e-46be607ff46c Co-authored-by: jsilvanus <22452468+jsilvanus@users.noreply.github.com>
|
@copilot implement phase 8. |
…ases Agent-Logs-Url: https://github.com/jsilvanus/gitsema/sessions/72ab82e8-4a82-43d5-b207-1ed45b13c1dd Co-authored-by: jsilvanus <22452468+jsilvanus@users.noreply.github.com>
Phase 8 is fully implemented (cf39221). Here's what was built: New modules
Core wiring
CLI # Dual-model indexing
GITSEMA_TEXT_MODEL=nomic-embed-text \
GITSEMA_CODE_MODEL=nomic-embed-code \
gitsema index
# gitsema status reports both models when they differ
# scripts/embed.ts <text> <filePath> shows which model was selectedSingle-model ( |
|
@copilot search queries should use both models and search with both! Fix merge conflicts. If we added time based constraints, it should so support tag and commit in addition to time. |
…support Agent-Logs-Url: https://github.com/jsilvanus/gitsema/sessions/43e9dd5e-2f68-4d84-956b-ede8e01d3a4d Co-authored-by: jsilvanus <22452468+jsilvanus@users.noreply.github.com>
Done in 3a55300. Three things addressed: Search uses both models (when configured) search.ts was inconsistent — it still used
gitsema index --since 2024-01-01 # date → git rev-list --after=
gitsema index --since v1.2.0 # tag → v1.2.0..HEAD range
gitsema index --since HEAD~100 # symbolic ref → HEAD~100..HEAD
gitsema index --since abc1234 # commit hash → abc1234..HEAD |
|
@copilot merge conflicts! Fix! |
…implement-models # Conflicts: # src/cli/commands/search.ts # src/core/indexing/blobStore.ts # src/core/indexing/indexer.ts # src/core/search/vectorSearch.ts Co-authored-by: jsilvanus <22452468+jsilvanus@users.noreply.github.com>
Fixed in 1f6e5bf. Merged
|
…x MCP version - Issue #4: Remove redundant core/ subdirectory in search/ (re-export shims pointing to analysis/). Update internal imports to reference analysis/ directly. Delete empty core/ directory. - Issue #8 (Low): Delete phase41plus.ts placeholder file - Issue #9 (Low): Fix MCP server version from hardcoded '0.0.1' to dynamically read from package.json Agent-Logs-Url: https://github.com/jsilvanus/gitsema/sessions/727a3fda-8cf6-4606-9e8f-134ee622a27f Co-authored-by: jsilvanus <22452468+jsilvanus@users.noreply.github.com>
Codex review correctly flagged that ModelProfile.level is persisted and displayed but never read by indexStartCommand or searchCommand — verified against src/cli/commands/index.ts and search.ts. Goal #4 was overstated as fully done; documented it as a deviation (stored but inert) instead.
gitsema models add <name> --level <level> saved the value but nothing consumed it. index start now falls back to a model's saved level via resolveModelLevelChunker() (skipping the fallback, not guessing, when --text-model/--code-model have genuinely conflicting saved levels), and search falls back via mapModelLevelToSearchLevel() using the text model only (queries always embed via the text model, so no conflict there), applied ahead of the existing embed_config auto-recall. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QC6rh1w375EogFiwncv5uD
CLAUDE.md's "search always uses the text provider" design note was stale: searchCommand's dualModel branch already embeds the query with both the text and code providers and merges results whenever --text-model and --code-model differ. The Phase 77 Goal #4 fallback only consulted the text model's saved level, silently ignoring the code model's — corrected to mirror index start's conflict-safe agreement logic via a new resolveAgreedLevel() helper (skip the fallback, don't guess, when the two models' saved levels disagree). Updated CLAUDE.md's stale design note and added test coverage for the dual-model conflict cases. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QC6rh1w375EogFiwncv5uD
Different content types benefit from different embedding models — code-aware models (e.g.
nomic-embed-code) capture syntax-rich vocabulary better than general text models. This adds a routing layer that selects the optimal model per blob based on file extension, dual-model search that queries both embedding spaces and merges results, and an incremental--sinceflag for the indexer.New modules
src/core/embedding/fileType.ts— classifies paths as'code'|'text'|'other'viaCODE_EXTENSIONS/TEXT_EXTENSIONSsets; exportsgetFileCategory(path)src/core/embedding/router.ts—RoutingProviderwraps two providers;providerForFile(path)picks the active one for indexingCore changes
IndexerOptionsgains optionalcodeProvider; when set,RoutingProvideris used per blob; single-provider path unchangedIndexerOptionsgains optionalsince; restricts which commits are indexed (see CLI section)embeddingsschema gains nullablefile_typecolumn recording which category produced the embeddingStoreBlobArgsaccepts optionalfileTypeand persists it in the transactionvectorSearchgains optionalmodelfilter and a newmergeSearchResultsexport for combining results from different embedding spacesCLI / config
Two new env vars; default behaviour (single model) is unaffected:
When
GITSEMA_CODE_MODELdiffers fromGITSEMA_TEXT_MODEL,gitsema searchembeds the query with both models, runs two vector searches (each filtered to embeddings produced by the matching model), and merges results keeping the best score per blob.Plan
docs/PLAN.mdgains a new Phase 8 section with the full design rationale; former Phase 8 (Performance) → 9, Smarter semantics → 10, Advanced + MCP → 11.Original prompt