Skip to main content

Reranking

Reranking re-scores search results using git metadata signals combined with task-specific weight profiles. Default semantic search returns results ranked by vector similarity only — but an agent investigating a production bug needs different results than an agent onboarding a new developer, even for the same query.

How It Works

  1. Vector search returns candidates ranked by embedding similarity
  2. Reranking re-scores each result using a weighted combination of trajectory signals
  3. Final ranking reflects both semantic relevance and code quality/history signals

Presets

For search_code (practical development)

PresetSignalsBest for
relevancesimilarity onlyGeneral code lookup (default)
recentsimilarity 0.7 + recency 0.3Sprint review, incident response
stablesimilarity 0.7 + stability 0.3Finding reliable implementations

For semantic_search / hybrid_search (analytics)

PresetKey signalsBest for
relevancesimilarity onlyGeneral lookup (default)
techDebtage + churn + bugFix + volatilityLegacy code assessment
hotspotschunkChurn + burstActivity + bugFix + volatilityBug-prone areas, risk assessment
codeReviewrecency + burstActivity + density + chunkChurnRecent changes review
onboardingdocumentation + stabilityNew developer entry points
securityAuditage + ownership + bugFix + pathRisk + volatilityOld critical code, security review
refactoringchunkChurn + chunkSize + volatility + bugFix + ageRefactor candidates
ownershipownership + knowledgeSiloKnowledge silos, bus factor
impactAnalysissimilarity + importsDependency chains, blast radius

Custom Weights

Any signal can be combined with arbitrary weights:

{
"rerank": {
"custom": {
"similarity": 0.4,
"burstActivity": 0.3,
"bugFix": 0.2,
"pathRisk": 0.1
}
}
}

Available Scoring Signals

19 signals are available for composition:

KeySignal SourceDescription
similarityVector searchEmbedding similarity score
recencygit (prefers chunk-level)Inverse of ageDays
stabilitygit (prefers chunk-level)Inverse of commitCount
churngit (prefers chunk-level)Direct commitCount
agegit (prefers chunk-level)Direct ageDays
ownershipgitAuthor concentration (dominantAuthorPct)
chunkSizechunk metadataLines of code in chunk
documentationchunk metadataIs documentation file
importsfile metadataImport/dependency count
bugFixgit (prefers chunk-level)bugFixRate
volatilitygitchurnVolatility (stddev of commit gaps)
densitygitchangeDensity (commits/month)
chunkChurngit chunk-levelchunkCommitCount
relativeChurnNormgitChurn relative to file size
burstActivitygitrecencyWeightedFreq — recent burst of changes
pathRiskfile metadataSecurity-sensitive path pattern (0 or 1)
knowledgeSilogitSingle-contributor flag (1 / 0.5 / 0)
chunkRelativeChurngit chunk-levelChunk's share of file churn

All presets automatically prefer chunk-level data when available (e.g., chunkCommitCount over commitCount for churn signals).

Combining Filters with Reranking

Filters (Qdrant conditions) narrow the candidate set. Reranking re-orders the filtered results. Use both for precise queries:

GoalFilterRerank
Recent bugs in authgit.ageDays <= 14 + pathPattern: **/auth/**hotspots
Old single-owner codegit.ageDays >= 90 + git.commitCount >= 5ownership
Recently active TypeScriptlanguage: typescript + git.ageDays <= 30codeReview
Large stable functionschunkType: function + git.commitCount <= 3onboarding

👉 Full agentic reranking workflows — how agents chain presets for bug investigation, code review, refactoring, and more.