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: gate auxiliary evidence by visible clusters
terry-li-hmdbc7621fc805
diff --git a/skills/last30days/scripts/lib/render.py b/skills/last30days/scripts/lib/render.pyindex 08fb94db..e66365a2 100644--- a/skills/last30days/scripts/lib/render.py+++ b/skills/last30days/scripts/lib/render.py@@ -423,6 +423,23 @@ def _clusters_clearing_relevance_floor(return solid+def _candidates_in_clusters(+ report: schema.Report,+ clusters: list[schema.Cluster],+) -> list[schema.Candidate]:+ """Return ranked candidates belonging to the supplied visible clusters."""+ candidate_ids = {+ candidate_id+ for cluster in clusters+ for candidate_id in cluster.candidate_ids+ }+ return [+ candidate+ for candidate in report.ranked_candidates+ if candidate.candidate_id in candidate_ids+ ]++def _visible_clusters_fail_relevance_floor(report: schema.Report,clusters: list[schema.Cluster],@@ -559,7 +576,10 @@ def _render_registered_sections(top_comments: list[str] = []else:best_takes = _render_best_takes(- report.ranked_candidates,+ _candidates_in_clusters(+ report,+ _clusters_clearing_relevance_floor(report, visible_clusters),+ ),limit=audience.budget_for("best_takes", int(fun_params["limit"])),threshold=float(fun_params["threshold"]),vote_weight=float(fun_params.get("vote_weight", 18.0)),@@ -689,7 +709,13 @@ def render_compact(if not no_solid_evidence:best_takes = _render_best_takes(- evidence_report.ranked_candidates,+ _candidates_in_clusters(+ evidence_report,+ _clusters_clearing_relevance_floor(+ evidence_report,+ visible_clusters,+ ),+ ),limit=fun_params["limit"],threshold=fun_params["threshold"],vote_weight=fun_params.get("vote_weight", 18.0),@@ -1374,7 +1400,7 @@ def _render_entity_evidence_block(out.append("")best_takes = _render_best_takes(- evidence_report.ranked_candidates,+ _candidates_in_clusters(evidence_report, visible_clusters),limit=fun_params["limit"],threshold=fun_params["threshold"],vote_weight=fun_params.get("vote_weight", 18.0),@@ -1475,7 +1501,13 @@ def render_full(report: schema.Report) -> str:fun_params = _FUN_LEVELS["medium"]best_takes = _render_best_takes(- evidence_report.ranked_candidates,+ _candidates_in_clusters(+ evidence_report,+ _clusters_clearing_relevance_floor(+ evidence_report,+ evidence_report.clusters,+ ),+ ),limit=fun_params["limit"],threshold=fun_params["threshold"],vote_weight=fun_params["vote_weight"],@@ -1680,11 +1712,15 @@ def render_brief(report: schema.Report, cluster_limit: int = 8) -> str:evidence_report,requested_clusters,)- qualifying_candidates = [- candidate- for candidate in evidence_report.ranked_candidates- if _best_take_relevance_ok(candidate)- ]+ qualifying_candidates = (+ []+ if requested_clusters and not visible_clusters+ else [+ candidate+ for candidate in evidence_report.ranked_candidates+ if _best_take_relevance_ok(candidate)+ ]+ )if requested_clusters and not visible_clusters:lines.extend(["**Nothing solid this window.**", ""])for i, cluster in enumerate(visible_clusters, start=1):diff --git a/tests/test_render_v3.py b/tests/test_render_v3.pyindex ced532dc..b593eaa7 100644--- a/tests/test_render_v3.py+++ b/tests/test_render_v3.py@@ -209,6 +209,35 @@ class RenderV3Tests(unittest.TestCase):text = renderer(report)self.assertIn("Second qualifying representative", text)+ def test_no_solid_cluster_suppresses_auxiliary_candidate_sections(self):+ report = sample_report()+ report.clusters[0].score = 0+ report.ranked_candidates[0].title = "Could this rejected take leak?"+ report.ranked_candidates[0].fun_score = 90+ second_candidate = copy.deepcopy(report.ranked_candidates[0])+ second_candidate.candidate_id = "c2"+ second_candidate.title = "Another rejected but funny take?"+ second_candidate.fun_score = 80+ report.ranked_candidates.append(second_candidate)+ report.clusters[0].candidate_ids.append("c2")+ report.clusters[0].representative_ids.append("c2")++ renderers = {+ "compact": render.render_compact,+ "comparison": lambda value: render.render_comparison_multi(+ [("Example", value)]+ ),+ "full": render.render_full,+ "brief": render.render_brief,+ }+ for name, renderer in renderers.items():+ with self.subTest(mode=name):+ text = renderer(report)+ self.assertIn("Nothing solid this window.", text)+ self.assertNotIn("## Best Takes", text)+ self.assertNotIn("## Narrative Hooks", text)+ self.assertNotIn("## Audience Questions", text)+def test_all_report_modes_promote_qualifying_nonrepresentative(self):renderers = {"comparison": lambda report: render.render_comparison_multi(