Install
openclaw skills install lastxdaysResearch and summarize what happened in the last N days (or a date range) about a topic, optionally using Reddit API and X ingestion via x-cli/API/archive with graceful fallback to web.
openclaw skills install lastxdaysSummarize what happened in the last N days (or a specific YYYY-MM-DD → YYYY-MM-DD range) about a user-provided topic.
Default behavior is web-first (web_search + selective web_fetch). If optional credentials/data are available, you may ingest Reddit via API and X via x-cli (preferred), API, or local archive, falling back to web search if unavailable.
Activate when the user message contains any of:
lastXdays / lastxdayslast x daysDefault to sonnet (anthropic/claude-sonnet-4-6) when spawning as a subagent.
Use flash (openrouter/google/gemini-2.0-flash-001) only for simple single-source lookups (one topic, one platform, straightforward synthesis with no file reading required). Flash is unreliable for multi-step agentic work requiring tool chaining (search → fetch → read files → synthesize → report). When in doubt, use sonnet.
Parse from the user message:
If the user supplies a range like:
from 2026-01-10 to 2026-02-082026-01-10 → 2026-02-08Then:
start = YYYY-MM-DDend = YYYY-MM-DDN if both are present.Otherwise, infer N:
N associated with the request, e.g.:
lastxdays 7 <topic>7 lastxdays <topic>what happened in the last 14 days (about|re:) <topic>N = 30N = min(max(N, 1), 365)Supported: web|reddit|x|all.
Accept any of:
for web / sources webfor reddit / sources redditfor x / sources xfor all / sources allIf unspecified: sources = all.
Use an inclusive range in local time:
freshness = start + "to" + end (e.g., 2026-01-10to2026-02-08)Helper for “last N days”:
node scripts/lastxdays_range.js <N>Use this helper to ingest Reddit/X when possible:
node scripts/lastxdays_ingest.js --source=reddit|x --topic "..." --start YYYY-MM-DD --end YYYY-MM-DD --limit 40The script attempts:
fallback:truex-cli search first (if installed/configured), then Twitter API v2 recent search (if bearer token + range <= ~7 days), then local archive at ~/clawd/data/x-archive/, else returns fallback:trueRequired environment variables (if you want API mode):
Reddit:
REDDIT_CLIENT_IDREDDIT_CLIENT_SECRETREDDIT_REFRESH_TOKEN (recommended) or REDDIT_USERNAME + REDDIT_PASSWORDREDDIT_USER_AGENTX API (optional; only works for recent ranges on most tiers):
X_BEARER_TOKEN (also accepts TWITTER_BEARER_TOKEN)x-cli (optional, preferred for agent use):
uv tool install x-cli (or from source)~/.config/x-cli/.env (supports shared setup with x-mcp)lastxdays_ingest.js uses it before raw API/archive for X searchCredentials loader:
~/.config/last30days/.env if present (does not hard-fail if missing).env values (file only fills blanks)Compute start/end/freshness.
For each requested source:
<topic>web_search with freshness (count 5–8)web_fetch 2–6 best linksPreferred:
node scripts/lastxdays_ingest.js --source=reddit ...fallback:false, treat returned items[] as “Notable links” (each has a Reddit permalink URL).items[] is empty / too small to be useful (e.g., <3), you may also run the web fallback to broaden coverage.Fallback (if fallback:true):
web_search with query site:reddit.com/r <topic> and the same freshnessPreferred:
node scripts/lastxdays_ingest.js --source=x ...mode=x-cli, mode=api, or mode=archive, treat returned items[] as “Notable links” (each has a URL)
mode=x-cli, note that X results came from local x-cli executionmode=archive, note that links come from the local X archiveitems[] is empty / too small to be useful (e.g., <3), you may also run the web fallback to broaden coverage.Fallback (if fallback:true):
web_search with query site:x.com <topic> and the same freshnessweb_fetch to fail often on x.com; rely on snippets when neededTitle:
## lastXdays — <N> days — <topic>
<N> days with YYYY-MM-DD → YYYY-MM-DD.Then include sections in this order:
YYYY-MM-DD → YYYY-MM-DD (and optionally the freshness string)For each link/item:
Date range helper:
node scripts/lastxdays_range.js 7Reddit ingest (requires creds or it will return fallback=true):
node scripts/lastxdays_ingest.js --source=reddit --topic "OpenClaw security vulnerability CVE" --start 2026-02-07 --end 2026-02-08 --limit 20 --prettyX ingest (x-cli if installed; else API if bearer token + <=7 days; else local archive; else fallback=true):
node scripts/lastxdays_ingest.js --source=x --topic "OpenClaw" --start 2026-02-07 --end 2026-02-08 --limit 20 --prettyOptional x-cli direct smoke test:
x-cli -v -j tweet search "OpenClaw since:2026-02-07 until:2026-02-09" --max 20lastxdays AI agents for weblast x days 10 bitcoin ETF flowswhat happened in the last 7 days about OpenAI for reddit14 lastXdays Apple Vision Pro for weblastxdays 30 OpenAI sources alllastxdays from 2026-01-01 to 2026-01-15 about Anthropic sources reddit