fix(l3): raise repo-map similarity floor 0.5→0.6 (stopgap) (#305)

L3 semantic retrieval does a bad job on the repo map: docs embed a terse symbol-list
descriptor while queries embed prose intent, an asymmetric comparison that collapses all
scores into a ~0.5 noise band (session 459: junk hits at 0.53/0.54, real relevance never
reached). At 0.5 the noise-winners cleared the bar and suppressed the deterministic
repo-map floor. 0.6 sits above the noise ceiling (~0.55) and below the real-signal floor
(0.68) so noise → empty → fall back to the repo map.

Band-aid, not a fix — the real remedy is a prose-shaped repo-file descriptor so query and
document share a representation space. Calibration knob, retune if the embedder changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HMbPmZZjcXhR2crU82zZ8S
This commit is contained in:
2026-07-21 18:42:56 +04:00
parent 12775d56da
commit f5aaa255ef
@@ -24,7 +24,15 @@ private const val RETRIEVAL_OVERSAMPLE_FACTOR = 4
// live grounding); below this floor a hit is just the nearest thing in a small corpus, not
// actually related to the query — rendering it as "relevant" is the same poisoning failure
// mode as the markdown-in-L3 bug, just via low-signal cosine similarity instead of topic drift.
private const val MIN_SIMILARITY_SCORE = 0.5f
//
// ponytail: 0.5 was too low. Docs embed a terse *symbol-list* descriptor ("path: module X;
// symbols: a,b") while queries embed *prose* intent — an asymmetric prose↔symbols comparison
// that collapses ALL scores into a ~0.5 noise band (2026-07-21 session 459: top junk hits at
// 0.54/0.53, real relevance never reached). At 0.5 those noise-winners cleared the bar and
// SUPPRESSED the deterministic repo-map floor (repoEntriesOrMapFloor). 0.6 sits above the
// observed noise ceiling (~0.55) and below the real-signal floor (0.68): noise → empty →
// fall back to the repo map. Calibration knob — retune if the embedder model changes.
private const val MIN_SIMILARITY_SCORE = 0.6f
class L3RepoKnowledgeRetriever(
private val embedder: Embedder,