Commit 4a8de68
fix: Clamp waypoint weights to [0, 1] range to prevent score corruption
Database may contain waypoint records with corrupted weights (e.g., 1.4 trillion instead of expected 0-1 range). These corrupted weights cause irrelevant memories to dominate search results due to massive score inflation in the hybrid scoring formula.
This fix adds defensive clamping in two locations:
1. expand_via_waypoints() - when calculating expansion weights from neighbors
2. hsg_query() scoring loop - when using waypoint weights in final score calculation
The clamping ensures that even if database contains invalid values, they won't corrupt query results.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 8862e3c commit 4a8de68
1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
524 | 526 | | |
525 | 527 | | |
526 | 528 | | |
| |||
772 | 774 | | |
773 | 775 | | |
774 | 776 | | |
775 | | - | |
| 777 | + | |
| 778 | + | |
776 | 779 | | |
777 | 780 | | |
778 | 781 | | |
| |||
0 commit comments