Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

refactor: route 4 stderr-bypass modules through log.source_log (#439)

Ilia Alshanetskyfa0f840a894e
diff --git a/skills/last30days/scripts/lib/competitors.py b/skills/last30days/scripts/lib/competitors.py
index ac4a393c..b45c6100 100644
--- a/skills/last30days/scripts/lib/competitors.py
+++ b/skills/last30days/scripts/lib/competitors.py
@@ -13,11 +13,10 @@ the caller's requested count.
from __future__ import annotations
import re
-import sys
from collections import Counter
from concurrent.futures import ThreadPoolExecutor, as_completed
-from . import dates, grounding
+from . import dates, grounding, log
from .resolve import _has_backend
# A "brand-shaped" token starts with uppercase OR is camelCase with an
@@ -62,7 +61,7 @@ _STOPWORD_TOKENS: frozenset[str] = frozenset(
def _log(msg: str) -> None:
- print(f"[Competitors] {msg}", file=sys.stderr)
+ log.source_log("Competitors", msg, tty_only=False)
def _topic_tokens(topic: str) -> set[str]:
diff --git a/skills/last30days/scripts/lib/fanout.py b/skills/last30days/scripts/lib/fanout.py
index d594391d..945ed8ab 100644
--- a/skills/last30days/scripts/lib/fanout.py
+++ b/skills/last30days/scripts/lib/fanout.py
@@ -13,11 +13,10 @@ config, depth, and overrides for each entity.
from __future__ import annotations
-import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from typing import Callable
-from . import schema
+from . import log, schema
# Sub-runs hit the same upstream APIs as the main topic. Cap parallelism so a
# 6-way fan-out does not stampede a single backend's rate limit.
@@ -25,7 +24,7 @@ MAX_PARALLEL_SUBRUNS = 6
def _log(msg: str) -> None:
- print(f"[Fanout] {msg}", file=sys.stderr)
+ log.source_log("Fanout", msg, tty_only=False)
def run_competitor_fanout(
diff --git a/skills/last30days/scripts/lib/resolve.py b/skills/last30days/scripts/lib/resolve.py
index 4eef6fd2..e536d233 100644
--- a/skills/last30days/scripts/lib/resolve.py
+++ b/skills/last30days/scripts/lib/resolve.py
@@ -8,18 +8,17 @@ before the planner runs. This is the engine-side equivalent of SKILL.md Steps
from __future__ import annotations
import re
-import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime, timezone
from typing import Optional
-from . import categories, dates, grounding
+from . import categories, dates, grounding, log
MAX_SUBS = 10
def _log(msg: str) -> None:
- print(f"[Resolve] {msg}", file=sys.stderr)
+ log.source_log("Resolve", msg, tty_only=False)
def _merge_category_peers(topic: str, subreddits: list[str]) -> tuple[list[str], Optional[str]]:
diff --git a/skills/last30days/scripts/lib/xurl_x.py b/skills/last30days/scripts/lib/xurl_x.py
index c2a60ef8..e5f1f283 100644
--- a/skills/last30days/scripts/lib/xurl_x.py
+++ b/skills/last30days/scripts/lib/xurl_x.py
@@ -13,15 +13,14 @@ Priority: xAI API > Bird/GraphQL > xurl > web-only fallback
import json
import re
import subprocess
-import sys
from typing import Any, Dict, List, Optional
+from . import log
from .relevance import token_overlap_relevance as _compute_relevance
def _log(msg: str) -> None:
- sys.stderr.write(f"[xurl] {msg}\n")
- sys.stderr.flush()
+ log.source_log("xurl", msg, tty_only=False)
# Depth configurations: number of results to request