Skip to main content

Search Strategies for Agentic Flows

How AI agents (Claude, GPT, Gemini, custom LLM agents) can leverage tea-rags reranking presets and custom weights to get task-appropriate code search results instead of generic similarity matches.

The Problem

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. Reranking solves this by re-scoring results using git metadata signals (churn, age, ownership, etc.) combined with task-specific weight profiles.

Available Tools and Their Presets

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

semantic_search / hybrid_search (analytics)

PresetKey signalsBest for
relevancesimilarity onlyGeneral lookup (default)
techDebtage + churn + bugFix + volatilityLegacy code assessment
hotspotschunkChurn + chunkRelativeChurn + 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 + relativeChurnNorm + 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 weight keys: similarity, recency, stability, churn, age, ownership, chunkSize, documentation, imports, bugFix, volatility, density, chunkChurn, relativeChurnNorm, burstActivity, pathRisk, knowledgeSilo, chunkRelativeChurn.