From 86422a74af97a367b8d3f8a0bbadd6f3355b8d0f Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sun, 25 Jan 2026 13:00:53 -0800 Subject: [PATCH] feat: Add honesty warning when results aren't from last 30 days MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds ⚠️ LIMITED RECENT DATA warning when: - Fewer than 5 items are confirmed from the date range - Tells Claude to be transparent with user about data freshness Example output for obscure topic (June Oven): "Only 4 item(s) confirmed from 2025-12-26 to 2026-01-25. Results below may include older/evergreen content." Popular topics (clawdbot, nano banana) don't show the warning. Co-Authored-By: Claude Opus 4.5 --- scripts/lib/render.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/scripts/lib/render.py b/scripts/lib/render.py index 611e199..c4bf83e 100644 --- a/scripts/lib/render.py +++ b/scripts/lib/render.py @@ -14,6 +14,26 @@ def ensure_output_dir(): OUTPUT_DIR.mkdir(parents=True, exist_ok=True) +def _assess_data_freshness(report: schema.Report) -> dict: + """Assess how much data is actually from the last 30 days.""" + reddit_recent = sum(1 for r in report.reddit if r.date and r.date >= report.range_from) + x_recent = sum(1 for x in report.x if x.date and x.date >= report.range_from) + web_recent = sum(1 for w in report.web if w.date and w.date >= report.range_from) + + total_recent = reddit_recent + x_recent + web_recent + total_items = len(report.reddit) + len(report.x) + len(report.web) + + return { + "reddit_recent": reddit_recent, + "x_recent": x_recent, + "web_recent": web_recent, + "total_recent": total_recent, + "total_items": total_items, + "is_sparse": total_recent < 5, + "mostly_evergreen": total_items > 0 and total_recent < total_items * 0.3, + } + + def render_compact(report: schema.Report, limit: int = 15, missing_keys: str = "none") -> str: """Render compact output for Claude to synthesize. @@ -31,6 +51,14 @@ def render_compact(report: schema.Report, limit: int = 15, missing_keys: str = " lines.append(f"## Research Results: {report.topic}") lines.append("") + # Assess data freshness and add honesty warning if needed + freshness = _assess_data_freshness(report) + if freshness["is_sparse"]: + lines.append("**⚠️ LIMITED RECENT DATA** - Few discussions from the last 30 days.") + lines.append(f"Only {freshness['total_recent']} item(s) confirmed from {report.range_from} to {report.range_to}.") + lines.append("Results below may include older/evergreen content. Be transparent with the user about this.") + lines.append("") + # Web-only mode banner (when no API keys) if report.mode == "web-only": lines.append("**🌐 WEB SEARCH MODE** - Claude will search blogs, docs & news")