AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
fix(rerank): make entity grounding case-insensitive
Trevin Chow6c6876dc63ed
diff --git a/skills/last30days/scripts/lib/reddit_keyless.py b/skills/last30days/scripts/lib/reddit_keyless.pyindex e8daa866..e6185c10 100644--- a/skills/last30days/scripts/lib/reddit_keyless.py+++ b/skills/last30days/scripts/lib/reddit_keyless.py@@ -174,8 +174,8 @@ def _slot_priority(topic: str, posts: List[Dict[str, Any]]) -> List[Dict[str, Ancheck (head token of the topic's stripped primary entity present in thepost text) so slots go to posts likely to survive final ranking — keyingon the same head token keeps the two paths from diverging. Falls back to- token-overlap relevance when the- topic yields no usable primary entity. Within each tier the incoming+ token-overlap relevance when the topic yields no usable primary entity.+ Within each tier the incoming(score-first) order is preserved. Never raises; on any failure theincoming order is returned unchanged."""@@ -188,7 +188,7 @@ def _slot_priority(topic: str, posts: List[Dict[str, Any]]) -> List[Dict[str, Anentity = rerank._primary_entity(topic).lower()if entity:def _matches(post: Dict[str, Any]) -> bool:- return rerank._entity_grounded(_post_text(post).lower(), entity)+ return rerank._entity_grounded(_post_text(post), entity)else:prepared = relevance.PreparedQuery(topic)diff --git a/skills/last30days/scripts/lib/rerank.py b/skills/last30days/scripts/lib/rerank.pyindex 2a39c71c..a30c9645 100644--- a/skills/last30days/scripts/lib/rerank.py+++ b/skills/last30days/scripts/lib/rerank.py@@ -264,6 +264,7 @@ def _entity_grounded(haystack: str, primary_entity: str) -> bool:compounds ("stripes"), and vacuous matches from very short heads ("X","Go") merely disable the penalty rather than burying good items."""+ haystack = haystack.lower()tokens = primary_entity.lower().split()if not tokens:return Truediff --git a/tests/test_rerank_v3.py b/tests/test_rerank_v3.pyindex 8a020323..c7efdc20 100644--- a/tests/test_rerank_v3.py+++ b/tests/test_rerank_v3.py@@ -248,6 +248,9 @@ class EntityGroundingTests(unittest.TestCase):rerank._apply_fallback_scores([on_topic], primary_entity="Hermes Agent")self.assertEqual("fallback-local-score", on_topic.explanation)+ def test_entity_grounded_is_case_insensitive_without_caller_preprocessing(self):+ self.assertTrue(rerank._entity_grounded("HERMES agent rocks", "Hermes Agent"))+def test_fallback_skips_demotion_for_empty_text_candidates(self):empty = self._candidate("", "")rerank._apply_fallback_scores([empty], primary_entity="Hermes Agent")