Skip to content

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

fix(trustpilot): auto-activate source when domain is explicitly pinned

Trevin Chowbfe1453c668d
diff --git a/CONFIGURATION.md b/CONFIGURATION.md
index 4cdc8168..3d9e7788 100644
--- a/CONFIGURATION.md
+++ b/CONFIGURATION.md
@@ -144,7 +144,7 @@ python3 skills/last30days/scripts/last30days.py "MCP servers" \
| Digg | `digg-pp-cli` on PATH (auto-installed during first-run setup via `npx -y @mvanhorn/[email protected] install digg --cli-only`; binary defaults to `$HOME/.local/bin` — Hermes/OpenClaw agent subprocesses must inherit that dir on PATH for Digg to activate; prior pp-digg installs use the same path) | always on if `digg-pp-cli` on PATH | yes (free, keyless, read-only) |
| arXiv | `arxiv-pp-cli` on PATH (auto-installed during first-run setup via `npx -y @mvanhorn/[email protected] install arxiv --cli-only`) | always on if `arxiv-pp-cli` on PATH; fires on research/technical topics and stays quiet otherwise (relevance + 365-day recency gating) | yes (free, keyless) |
| Techmeme | `techmeme-pp-cli` on PATH (auto-installed via `... install techmeme --cli-only`) | always on if `techmeme-pp-cli` on PATH; searches Techmeme's live archive and keeps only headlines dated within the research window (undated headlines flow through as low-confidence) | yes (free, keyless) |
-| Trustpilot | `trustpilot-pp-cli` on PATH (NOT auto-installed; install on demand via `npx -y @mvanhorn/[email protected] install trustpilot --cli-only`) + `INCLUDE_SOURCES` contains `trustpilot` | **opt-in, off by default**; when enabled, activates only on company/brand topics — or on any topic when `--trustpilot-domain=<domain>` pins the review page explicitly (bypasses the brand-shape gate; also the per-entity `trustpilot_domain` key in `--competitors-plan`). Bare company names auto-resolve to the review-page domain via the CLI's search. The session warms once before the search fan-out; a stale session does a ~10s headless-Chrome WAF-cookie harvest (set `LAST30DAYS_TRUSTPILOT_NO_BROWSER=1` to disable in cron/CI) | yes (no API key; cookie-replay after the one-time harvest) |
+| Trustpilot | `trustpilot-pp-cli` on PATH (NOT auto-installed; install on demand via `npx -y @mvanhorn/[email protected] install trustpilot --cli-only`) + (`INCLUDE_SOURCES` contains `trustpilot` **or** an explicit `--trustpilot-domain` / plan-level `trustpilot_domain`) | **opt-in, off by default**; `--trustpilot-domain=<domain>` (and per-entity `trustpilot_domain` in `--competitors-plan`) auto-activates the source for that run and bypasses the brand-shape gate. Persist with `INCLUDE_SOURCES=trustpilot` to skip per-run auto-enable. `EXCLUDE_SOURCES=trustpilot` still wins. Bare company names auto-resolve to the review-page domain via the CLI's search only when the source is already active. The session warms once before the search fan-out; a stale session does a ~10s headless-Chrome WAF-cookie harvest (set `LAST30DAYS_TRUSTPILOT_NO_BROWSER=1` to disable in cron/CI) | yes (no API key; cookie-replay after the one-time harvest) |
| X / Twitter | one of: `AUTH_TOKEN` + `CT0` (browser cookies, Bird CLI), `XAI_API_KEY`, `XQUIK_API_KEY`, `SCRAPECREATORS_API_KEY`, or `FROM_BROWSER` (cookie-jar auth) | X items in results | cookie-jar / Bird = free; Xquik / xAI / ScrapeCreators = key-based |
| TikTok | `SCRAPECREATORS_API_KEY` + `INCLUDE_SOURCES` contains `tiktok` | TikTok items | 10K free calls |
| Instagram | `SCRAPECREATORS_API_KEY` + `INCLUDE_SOURCES` contains `instagram` | Instagram Reels | 10K free calls; raise `LAST30DAYS_TRANSCRIPT_TIMEOUT` (default 30s) if SC is slow on your network |
diff --git a/changelog.d/873.fixed.md b/changelog.d/873.fixed.md
new file mode 100644
index 00000000..4fd01d6f
--- /dev/null
+++ b/changelog.d/873.fixed.md
@@ -0,0 +1 @@
+`--trustpilot-domain` (and plan-level `trustpilot_domain`) now auto-activates the opt-in Trustpilot source for the run instead of silently no-oping when `INCLUDE_SOURCES` / `--search` omit it.
diff --git a/skills/last30days/SKILL.md b/skills/last30days/SKILL.md
index 0b58ecec..869c5e6c 100644
--- a/skills/last30days/SKILL.md
+++ b/skills/last30days/SKILL.md
@@ -857,7 +857,7 @@ Before running the engine, determine which flags apply to this topic and resolve
| `--x-related={h1,h2,...}` | Step 0.5 (Section A below) | Topic has associated entities (founders, commentators, spouse, collaborators, media handles) |
| `--github-user={user}` | Step 0.5b | Topic is a person who ships code (developer, engineer, CEO-who-codes, researcher) |
| `--github-repo={owner/repo}` | Step 0.5c | Topic is a product / project / open-source tool |
-| `--trustpilot-domain={domain}` | Step 0.5d | Topic is a company / brand / service with a Trustpilot presence AND the run includes the Trustpilot source |
+| `--trustpilot-domain={domain}` | Step 0.5d | Topic is a company / brand / service with a Trustpilot presence (passing the flag also auto-activates the opt-in Trustpilot source for this run) |
| `--subreddits={sub1,sub2,...}` | Step 0.55 | Always — almost every topic has active Reddit communities |
| `--tiktok-hashtags={h1,h2,...}` | Step 0.55 | Always — inferred from topic |
| `--tiktok-creators={c1,c2,...}` | Step 0.55 | Creator / influencer / brand topics |
@@ -992,9 +992,9 @@ Project-mode GitHub fetches live star counts, README snippets, latest releases,
Store: `RESOLVED_GITHUB_REPOS = {comma-separated owner/repo or empty}`
-### Step 0.5d: Resolve Trustpilot Domain (if topic is a company/brand and Trustpilot is active)
+### Step 0.5d: Resolve Trustpilot Domain (if topic is a company/brand)
-If the run includes the Trustpilot source (`INCLUDE_SOURCES=trustpilot` or an explicit `--search` list) and TOPIC is a company, brand, or service, resolve its Trustpilot review-page domain. Trustpilot pages are keyed by domain (`www.thriftbooks.com`), not company name — a bare name 404s.
+When TOPIC is a company, brand, or service and you want Trustpilot review evidence, resolve its Trustpilot review-page domain. Trustpilot pages are keyed by domain (`www.thriftbooks.com`), not company name — a bare name 404s. Passing `--trustpilot-domain` (or a per-entity `trustpilot_domain` in `--competitors-plan`) auto-activates the opt-in Trustpilot source for that run — you do not also need `INCLUDE_SOURCES=trustpilot`.
**You usually already have it.** Step 0.55 item 6 (first-party positioning) fetches the official site — capture the bare hostname while you're there. When positioning wasn't fetched, one lookup covers it:
@@ -1004,13 +1004,13 @@ WebSearch("{TOPIC} official site")
Pass to the CLI: `--trustpilot-domain={domain}` (e.g., `--trustpilot-domain=www.thriftbooks.com`)
-The flag is used verbatim and bypasses the engine's brand-shape gate, so it also unlocks Trustpilot for multi-word company names ("Stanley Steemer carpet cleaning"). For comparisons, put a per-entity `trustpilot_domain` in each PEER entity's `--competitors-plan` entry; the MAIN topic's domain must ride the outer `--trustpilot-domain` flag (the engine does not read a main-topic entry out of the plan).
+The flag is used verbatim, bypasses the engine's brand-shape gate, and auto-activates Trustpilot for the run, so it also unlocks Trustpilot for multi-word company names ("Stanley Steemer carpet cleaning"). For comparisons, put a per-entity `trustpilot_domain` in each PEER entity's `--competitors-plan` entry; the MAIN topic's domain must ride the outer `--trustpilot-domain` flag (the engine does not read a main-topic entry out of the plan).
-**A miss is not fatal.** When the flag is absent, the engine resolves name → domain itself via the CLI's search (and headless `--auto-resolve` runs fill a hint the engine verifies). Resolve the flag when the domain is already in hand or the company name is ambiguous (lookalike or same-named companies) — an explicit domain is the only way to guarantee the right company.
+**A miss is not fatal.** When the flag is absent, the engine resolves name → domain itself via the CLI's search **only when Trustpilot is already active** (`INCLUDE_SOURCES=trustpilot` or `--search` includes it); headless `--auto-resolve` fills a hint the engine verifies, but that hint alone does not activate the source. Resolve the flag when the domain is already in hand or the company name is ambiguous (lookalike or same-named companies) — an explicit domain is the only way to guarantee the right company *and* turn the source on.
**Skip this step if:**
-- The Trustpilot source is not active for this run
- TOPIC is a person, event, or abstract concept (no company reviews to fetch)
+- You intentionally want Trustpilot off for this run (`EXCLUDE_SOURCES=trustpilot`)
Store: `RESOLVED_TRUSTPILOT_DOMAIN = {domain or empty}`
@@ -1264,7 +1264,7 @@ Per-entity lookup types to resolve:
2. **Project GitHub repo** - `owner/repo` format (e.g., `openai/openai-python`)
3. **Founder/maintainer X handle** - the person or team behind the project
4. **Relevant subreddits** - project-specific subreddits (e.g., `r/openclaw`) AND general-category subreddits (e.g., `r/LocalLLaMA`)
-5. **Trustpilot domain** (only when the Trustpilot source is active and the entity is a company/brand/service) - the entity's Trustpilot review-page domain per Step 0.5d; peers carry it as `trustpilot_domain` in their `--competitors-plan` entry, the main topic via the outer `--trustpilot-domain` flag
+5. **Trustpilot domain** (when the entity is a company/brand/service and you want review evidence) - the entity's Trustpilot review-page domain per Step 0.5d; peers carry it as `trustpilot_domain` in their `--competitors-plan` entry, the main topic via the outer `--trustpilot-domain` flag (either pin auto-activates Trustpilot for the run)
Example batching for "OpenClaw vs Hermes vs Paperclip":
@@ -1461,7 +1461,7 @@ Then add to the engine command:
- `--ig-creators={RESOLVED_IG_CREATORS}` (from Step 0.55)
- `--github-user={RESOLVED_GITHUB_USER}` (from Step 0.5b, person topics only)
- `--github-repo={RESOLVED_GITHUB_REPOS}` (from Step 0.5c, product/project topics only)
-- `--trustpilot-domain={RESOLVED_TRUSTPILOT_DOMAIN}` (from Step 0.5d, company/brand topics when the Trustpilot source is active)
+- `--trustpilot-domain={RESOLVED_TRUSTPILOT_DOMAIN}` (from Step 0.5d, company/brand topics; the flag also auto-activates Trustpilot)
- Omit any flag where the value was not resolved (empty).
**If you skipped Steps 0.55 and 0.75 (no WebSearch -- OpenClaw, Codex, etc.), add:**
diff --git a/skills/last30days/scripts/last30days.py b/skills/last30days/scripts/last30days.py
index 4a2b4dc8..528c3c84 100644
--- a/skills/last30days/scripts/last30days.py
+++ b/skills/last30days/scripts/last30days.py
@@ -117,6 +117,61 @@ def resolve_requested_sources(args_search: str | None, config: dict) -> list[str
return None
+def plan_has_explicit_trustpilot_domain(comp_plan: dict | None) -> bool:
+ """True when any --competitors-plan entry pins a trustpilot_domain."""
+ if not comp_plan:
+ return False
+ for entry in comp_plan.values():
+ if not isinstance(entry, dict):
+ continue
+ domain = entry.get("trustpilot_domain")
+ if isinstance(domain, str) and domain.strip():
+ return True
+ return False
+
+
+def activate_trustpilot_for_explicit_domain(
+ config: dict,
+ requested_sources: list[str] | None,
+ *,
+ reason: str,
+) -> list[str] | None:
+ """Activate the opt-in Trustpilot source when the user pinned a domain.
+
+ Passing ``--trustpilot-domain`` (or a plan-level ``trustpilot_domain``) is
+ unambiguous intent — silently ignoring it when Trustpilot is not in
+ ``INCLUDE_SOURCES`` / ``--search`` is the #873 failure mode. Auto-resolve
+ hints must not call this helper.
+
+ ``EXCLUDE_SOURCES=trustpilot`` still wins. Mutates ``config`` in place and
+ returns the (possibly extended) ``requested_sources`` list.
+ """
+ excluded = {
+ token.strip().lower()
+ for token in str(config.get("EXCLUDE_SOURCES") or "").split(",")
+ if token.strip()
+ }
+ if "trustpilot" in excluded:
+ sys.stderr.write(
+ f"[Trustpilot] {reason} ignored: trustpilot is in EXCLUDE_SOURCES\n"
+ )
+ return requested_sources
+
+ include = str(config.get("INCLUDE_SOURCES") or "")
+ tokens = [token.strip() for token in include.split(",") if token.strip()]
+ if "trustpilot" not in {token.lower() for token in tokens}:
+ tokens.append("trustpilot")
+ config["INCLUDE_SOURCES"] = ",".join(tokens)
+ sys.stderr.write(
+ f"[Trustpilot] {reason} activated trustpilot source "
+ "(add to INCLUDE_SOURCES permanently to skip this auto-enable)\n"
+ )
+
+ if requested_sources is not None and "trustpilot" not in requested_sources:
+ requested_sources = [*requested_sources, "trustpilot"]
+ return requested_sources
+
+
def slugify(value: str, max_length: int = 180) -> str:
slug = re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")
if len(slug) > max_length:
@@ -651,7 +706,15 @@ def build_parser() -> argparse.ArgumentParser:
help="Use web search to discover subreddits/handles before planning (for platforms without WebSearch)")
parser.add_argument("--github-user", help="GitHub username for person-mode search (e.g., steipete)")
parser.add_argument("--github-repo", help="Comma-separated owner/repo for project-mode search (e.g., openclaw/openclaw,paperclipai/paperclip)")
- parser.add_argument("--trustpilot-domain", help="Trustpilot review-page domain for the topic (e.g., www.thriftbooks.com). Used verbatim and bypasses the brand-shape gate; find it with `trustpilot-pp-cli search '<name>'`.")
+ parser.add_argument(
+ "--trustpilot-domain",
+ help=(
+ "Trustpilot review-page domain for the topic (e.g., www.thriftbooks.com). "
+ "Used verbatim, bypasses the brand-shape gate, and auto-activates the "
+ "opt-in Trustpilot source for this run (unless EXCLUDE_SOURCES=trustpilot). "
+ "Find the domain with `trustpilot-pp-cli search '<name>'`."
+ ),
+ )
parser.add_argument(
"--competitors",
nargs="?",
@@ -2987,6 +3050,18 @@ def _main(
return hosted.run_hosted(topic, depth, **hosted_kwargs)
requested_sources = resolve_requested_sources(args.search, config)
+ # Explicit --trustpilot-domain is user intent: activate the opt-in source
+ # before diagnose/run so the flag cannot silently no-op (#873). Auto-resolve
+ # hints are applied later and must not call this path.
+ cli_trustpilot_domain = (
+ args.trustpilot_domain.strip() if args.trustpilot_domain else ""
+ )
+ if cli_trustpilot_domain:
+ requested_sources = activate_trustpilot_for_explicit_domain(
+ config,
+ requested_sources,
+ reason=f"--trustpilot-domain={cli_trustpilot_domain}",
+ )
diag = pipeline.diagnose(config, requested_sources, safe=args.diagnose)
if args.diagnose:
@@ -3127,6 +3202,18 @@ def _main(
github_repos = [r.strip() for r in args.github_repo.split(",") if r.strip() and "/" in r.strip()] if args.github_repo else None
trustpilot_domain = args.trustpilot_domain.strip() if args.trustpilot_domain else None
+ comp_enabled, comp_count, comp_explicit = resolve_competitors_args(args)
+ comp_plan = parse_competitors_plan(args.competitors_plan)
+
+ # Plan-level trustpilot_domain pins are the same user intent as the CLI
+ # flag (already activated above). Auto-resolve hints must not activate.
+ if plan_has_explicit_trustpilot_domain(comp_plan):
+ requested_sources = activate_trustpilot_for_explicit_domain(
+ config,
+ requested_sources,
+ reason="competitors-plan trustpilot_domain",
+ )
+
# Only canonicalize when repos came from a user-supplied --github-repo flag.
# When repos_from_auto_resolve is True, auto_resolve already ran
# canonicalize_github_repos(cap=5) and ranked by relevance; re-running here
@@ -3152,9 +3239,6 @@ def _main(
if "perplexity" not in include.lower():
config["INCLUDE_SOURCES"] = f"{include},perplexity" if include else "perplexity"
- comp_enabled, comp_count, comp_explicit = resolve_competitors_args(args)
- comp_plan = parse_competitors_plan(args.competitors_plan)
-
# Polymarket disambiguation: if user passed --polymarket-keywords,
# store on config so the polymarket adapter can filter matches.
if args.polymarket_keywords:
diff --git a/tests/test_cli_v3.py b/tests/test_cli_v3.py
index b6e780f0..43ccd19f 100644
--- a/tests/test_cli_v3.py
+++ b/tests/test_cli_v3.py
@@ -636,6 +636,107 @@ class CliV3Tests(unittest.TestCase):
)
self.assertFalse(main_call.kwargs.get("trustpilot_domain_is_hint"))
+ def test_trustpilot_domain_auto_activates_include_sources(self):
+ """Explicit --trustpilot-domain must activate Trustpilot even when
+ INCLUDE_SOURCES omits it (#873) — otherwise the flag silently no-ops."""
+ report = self.make_report(topic="Weber grills")
+ diag = {
+ "available_sources": ["tiktok", "instagram"],
+ "providers": {"google": True, "openai": False, "xai": False},
+ "x_backend": None,
+ "bird_installed": True,
+ "bird_authenticated": False,
+ "bird_username": None,
+ "native_web_backend": "brave",
+ }
+ config = {"INCLUDE_SOURCES": "tiktok,instagram"}
+ with mock.patch.object(cli.env, "get_config", return_value=config), \
+ mock.patch.object(cli.pipeline, "diagnose", return_value=diag), \
+ mock.patch.object(cli.pipeline, "run", return_value=report) as run_mock, \
+ mock.patch.object(cli, "emit_output", return_value="# rendered"), \
+ mock.patch.object(sys, "argv", [
+ "last30days.py",
+ "Weber grills",
+ "--trustpilot-domain",
+ "weber.co.uk",
+ ]):
+ stdout = io.StringIO()
+ stderr = io.StringIO()
+ with redirect_stdout(stdout), redirect_stderr(stderr):
+ rc = cli.main()
+ self.assertEqual(0, rc)
+ self.assertIn("trustpilot", config["INCLUDE_SOURCES"].lower())
+ self.assertIn("[Trustpilot] --trustpilot-domain=weber.co.uk activated", stderr.getvalue())
+ main_call = run_mock.call_args_list[0]
+ self.assertEqual(main_call.kwargs.get("trustpilot_domain"), "weber.co.uk")
+
+ def test_trustpilot_domain_auto_activates_with_search_filter(self):
+ """When --search omits trustpilot, the explicit domain flag must still
+ append it to requested_sources so the intersection filter cannot drop it."""
+ report = self.make_report(topic="Weber grills")
+ diag = {
+ "available_sources": ["tiktok", "instagram", "trustpilot"],
+ "providers": {"google": True, "openai": False, "xai": False},
+ "x_backend": None,
+ "bird_installed": True,
+ "bird_authenticated": False,
+ "bird_username": None,
+ "native_web_backend": "brave",
+ }
+ config = {"INCLUDE_SOURCES": "tiktok,instagram"}
+ with mock.patch.object(cli.env, "get_config", return_value=config), \
+ mock.patch.object(cli.pipeline, "diagnose", return_value=diag), \
+ mock.patch.object(cli.pipeline, "run", return_value=report) as run_mock, \
+ mock.patch.object(cli, "emit_output", return_value="# rendered"), \
+ mock.patch.object(sys, "argv", [
+ "last30days.py",
+ "Weber grills",
+ "--search",
+ "tiktok,instagram",
+ "--trustpilot-domain",
+ "weber.co.uk",
+ ]):
+ with redirect_stdout(io.StringIO()), redirect_stderr(io.StringIO()):
+ rc = cli.main()
+ self.assertEqual(0, rc)
+ requested = run_mock.call_args_list[0].kwargs.get("requested_sources") or []
+ self.assertIn("trustpilot", requested)
+
+ def test_trustpilot_domain_respects_exclude_sources(self):
+ config = {"INCLUDE_SOURCES": "tiktok", "EXCLUDE_SOURCES": "trustpilot"}
+ requested = cli.activate_trustpilot_for_explicit_domain(
+ config, ["tiktok"], reason="--trustpilot-domain=weber.co.uk",
+ )
+ self.assertEqual(requested, ["tiktok"])
+ self.assertNotIn("trustpilot", config["INCLUDE_SOURCES"].lower())
+
+
+class ActivateTrustpilotHelperTests(unittest.TestCase):
+ def test_plan_has_explicit_trustpilot_domain(self):
+ self.assertTrue(cli.plan_has_explicit_trustpilot_domain({
+ "traeger": {"trustpilot_domain": "traeger.com"},
+ }))
+ self.assertFalse(cli.plan_has_explicit_trustpilot_domain({
+ "traeger": {"x_handle": "Traeger"},
+ }))
+ self.assertFalse(cli.plan_has_explicit_trustpilot_domain(None))
+
+ def test_activate_adds_include_and_requested(self):
+ config = {"INCLUDE_SOURCES": "tiktok,instagram"}
+ requested = cli.activate_trustpilot_for_explicit_domain(
+ config, ["tiktok", "instagram"], reason="--trustpilot-domain=x.com",
+ )
+ self.assertIn("trustpilot", config["INCLUDE_SOURCES"].lower())
+ self.assertEqual(requested, ["tiktok", "instagram", "trustpilot"])
+
+ def test_activate_noop_when_already_present(self):
+ config = {"INCLUDE_SOURCES": "tiktok,trustpilot"}
+ requested = cli.activate_trustpilot_for_explicit_domain(
+ config, ["trustpilot"], reason="--trustpilot-domain=x.com",
+ )
+ self.assertEqual(config["INCLUDE_SOURCES"], "tiktok,trustpilot")
+ self.assertEqual(requested, ["trustpilot"])
+
if __name__ == "__main__":
unittest.main()