lastXdays Skill
Summarize 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.
Trigger Patterns
Activate when the user message contains any of:
- -
lastXdays / INLINECODE3 - INLINECODE4
- A question like: "what happened in the last N days" (optionally followed by a topic)
Default Model
Default 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.
Input Parsing
Parse from the user message:
1) Date range (preferred if explicit)
If the user supplies a range like:
- - INLINECODE9
- INLINECODE10
Then:
- - INLINECODE11
- INLINECODE12
- Ignore
N if both are present.
2) Days (N)
Otherwise, infer
N:
- - Look for an integer
N associated with the request, e.g.:
-
lastxdays 7 <topic>
-
7 lastxdays <topic>
-
what happened in the last 14 days (about|re:) <topic>
- - Default: INLINECODE19
- Clamp: INLINECODE20
3) Sources (optional)
Supported:
web|reddit|x|all.
Accept any of:
- -
for web / INLINECODE23 - INLINECODE24 / INLINECODE25
- INLINECODE26 / INLINECODE27
- INLINECODE28 / INLINECODE29
If unspecified: sources = all.
4) Topic
- - The remaining text (after removing trigger words, N/range, and source phrases) is the topic.
- If topic is empty/unclear, ask exactly one clarifying question and stop.
Date Range (freshness)
Use an inclusive range in local time:
- -
freshness = start + "to" + end (e.g., 2026-01-10to2026-02-08)
Helper for “last N days”:
Optional non-web ingestion (Reddit/X)
Use this helper to ingest Reddit/X when possible:
The script attempts:
- - Reddit: official API via OAuth (if credentials exist), else returns INLINECODE35
- X:
x-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 INLINECODE38
Required environment variables (if you want API mode):
-
REDDIT_CLIENT_ID
-
REDDIT_CLIENT_SECRET
- either
REDDIT_REFRESH_TOKEN (recommended)
or REDDIT_USERNAME +
REDDIT_PASSWORD
- optional: INLINECODE44
- - X 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):
- Install:
uv tool install x-cli (or from source)
- Configure credentials in
~/.config/x-cli/.env (supports shared setup with x-mcp)
- If present,
lastxdays_ingest.js uses it before raw API/archive for X search
Credentials loader:
- - Reads
~/.config/last30days/.env if present (does not hard-fail if missing) - Environment variables override
.env values (file only fills blanks)
Research Procedure
1) Compute start/end/freshness.
2) For each requested source:
Web
- - Query: INLINECODE53
- Run
web_search with freshness (count 5–8) - Optionally
web_fetch 2–6 best links
Reddit
Preferred:
- - Run INLINECODE57
- If it returns
fallback:false, treat returned items[] as “Notable links” (each has a Reddit permalink URL). - If
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):
- - Run
web_search with query site:reddit.com/r <topic> and the same INLINECODE64
X
Preferred:
- - Run INLINECODE65
- If
mode=x-cli, mode=api, or mode=archive, treat returned items[] as “Notable links” (each has a URL)
- If
mode=x-cli, note that X results came from local
x-cli execution
- If
mode=archive, note that links come from the local X archive
- - If
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):
- - Run
web_search with query site:x.com <topic> and the same INLINECODE77 - Expect
web_fetch to fail often on x.com; rely on snippets when needed
3) Select and deduplicate links/items:
- - Prefer authoritative sources for Web
- Prefer high-engagement or highly-informative posts for Reddit/X
- Keep total links/items shown to ~10–20 max
Output Format (Markdown)
Title:
- If an explicit range was used, you may replace
<N> days with
YYYY-MM-DD → YYYY-MM-DD.
Then include sections in this order:
1) Date range used
- -
YYYY-MM-DD → YYYY-MM-DD (and optionally the freshness string)
2) Top themes
- - 3–7 bullets summarizing the dominant storylines/trends
3) Notable links
Group by platform in this order, including only platforms actually searched:
For each link/item:
- - Markdown link
- One line: why it matters
- If snippet-only (fetch failed/unavailable), say so
4) What to follow up on
- - 3 copy/pasteable next searches
Smoke tests (local)
Date range helper:
Reddit ingest (requires creds or it will return fallback=true):
X ingest (x-cli if installed; else API if bearer token + <=7 days; else local archive; else fallback=true):
Optional x-cli direct smoke test:
Examples
- - INLINECODE88
- INLINECODE89
- INLINECODE90
- INLINECODE91
- INLINECODE92
- INLINECODE93
lastXdays 技能
总结用户提供的主题在最近N天(或特定YYYY-MM-DD → YYYY-MM-DD范围)内发生的事件。
默认行为是网络优先(websearch + 选择性 webfetch)。如果存在可选的凭证/数据,你可以通过API获取Reddit,以及通过x-cli(首选)、API或本地存档获取X,若不可用则回退到网络搜索。
触发模式
当用户消息包含以下任一内容时激活:
- - lastXdays / lastxdays
- last x days
- 类似问题:最近N天发生了什么(可选后接主题)
默认模型
作为子代理生成时,默认使用 sonnet(anthropic/claude-sonnet-4-6)。
仅在简单单源查询(一个主题、一个平台、无需读取文件的直接综合)时使用 flash(openrouter/google/gemini-2.0-flash-001)。Flash在需要工具链的多步骤代理工作中不可靠(搜索→获取→读取文件→综合→报告)。如有疑问,使用sonnet。
输入解析
从用户消息中解析:
1) 日期范围(若明确指定则优先)
如果用户提供了类似范围:
- - from 2026-01-10 to 2026-02-08
- 2026-01-10 → 2026-02-08
则:
- - start = YYYY-MM-DD
- end = YYYY-MM-DD
- 若两者都存在,忽略 N。
2) 天数(N)
否则,推断 N:
- lastxdays 7 <主题>
- 7 lastxdays <主题>
- what happened in the last 14 days (about|re:) <主题>
- - 默认值:N = 30
- 限制范围:N = min(max(N, 1), 365)
3) 来源(可选)
支持:web|reddit|x|all。
接受以下任一形式:
- - for web / sources web
- for reddit / sources reddit
- for x / sources x
- for all / sources all
若未指定:sources = all。
4) 主题
- - 剩余文本(去除触发词、N/范围和来源短语后)即为主题。
- 如果主题为空或不明确,仅提出一个澄清性问题并停止。
日期范围(新鲜度)
使用本地时间的包含性范围:
- - freshness = start + to + end(例如 2026-01-10to2026-02-08)
最近N天的辅助工具:
- - node scripts/lastxdays_range.js
可选的非网络数据获取(Reddit/X)
在可能时使用此辅助工具获取Reddit/X:
- - node scripts/lastxdays_ingest.js --source=reddit|x --topic ... --start YYYY-MM-DD --end YYYY-MM-DD --limit 40
脚本尝试:
- - Reddit: 通过OAuth的官方API(如果凭证存在),否则返回 fallback:true
- X: 首先使用 x-cli 搜索(如果已安装/配置),然后使用Twitter API v2 近期搜索(如果bearer token且范围<=约7天),然后使用本地存档 ~/clawd/data/x-archive/,否则返回 fallback:true
所需环境变量(如需API模式):
- REDDIT
CLIENTID
- REDDIT
CLIENTSECRET
- 要么 REDDIT
REFRESHTOKEN(推荐)
或 REDDIT
USERNAME + REDDITPASSWORD
- 可选:REDDIT
USERAGENT
- - X API(可选;大多数层级仅适用于近期范围):
- X
BEARERTOKEN(也接受 TWITTER
BEARERTOKEN)
- 安装:uv tool install x-cli(或从源码安装)
- 在 ~/.config/x-cli/.env 中配置凭证(支持与x-mcp共享设置)
- 如果存在,lastxdays_ingest.js 在进行X搜索时优先使用它,再使用原始API/存档
凭证加载器:
- - 如果存在,读取 ~/.config/last30days/.env(缺失时不会硬性失败)
- 环境变量覆盖 .env 值(文件仅填充空白)
研究流程
1) 计算 start/end/freshness。
2) 对每个请求的来源:
Web
- - 查询:<主题>
- 使用 freshness 运行 websearch(计数5–8)
- 可选地 webfetch 2–6个最佳链接
Reddit
首选:
- - 运行 node scripts/lastxdays_ingest.js --source=reddit ...
- 如果返回 fallback:false,将返回的 items[] 视为值得关注的链接(每个都有Reddit永久链接URL)。
- 如果 items[] 为空或太小而无用(例如<3),你也可以运行网络回退以扩大覆盖范围。
回退(如果 fallback:true):
- - 使用查询 site:reddit.com/r <主题> 和相同的 freshness 运行 web_search
X
首选:
- - 运行 node scripts/lastxdays_ingest.js --source=x ...
- 如果 mode=x-cli、mode=api 或 mode=archive,将返回的 items[] 视为值得关注的链接(每个都有URL)
- 如果 mode=x-cli,注意X结果来自本地 x-cli 执行
- 如果 mode=archive,注意链接来自本地X存档
- - 如果 items[] 为空或太小而无用(例如<3),你也可以运行网络回退以扩大覆盖范围。
回退(如果 fallback:true):
- - 使用查询 site:x.com <主题> 和相同的 freshness 运行 websearch
- 预期 webfetch 在 x.com 上经常失败;必要时依赖片段
3) 选择并去重链接/项目:
- - Web优先选择权威来源
- Reddit/X优先选择高互动或高信息量的帖子
- 保持显示的链接/项目总数在约10–20个以内
输出格式(Markdown)
标题:
- - ## lastXdays — 天 — <主题>
- 如果使用了明确范围,可将
天 替换为 YYYY-MM-DD → YYYY-MM-DD。
然后按以下顺序包含章节:
1) 使用的日期范围
- - YYYY-MM-DD → YYYY-MM-DD(以及可选的freshness字符串)
2) 主要主题
3) 值得关注的链接
按平台分组,按此顺序,仅包含实际搜索过的平台:
对于每个链接/项目:
- - Markdown链接
- 一行说明:为何重要
- 如果仅有片段(获取失败/不可用),请说明
4) 后续跟进事项
本地烟雾测试
日期范围辅助工具:
- - node scripts/lastxdays_range.js 7
Reddit数据获取(需要凭证,否则返回 fallback=true):
- - node scripts/lastxdays_ingest.js --source=reddit --topic OpenClaw security vulnerability CVE --start 2026-02-07 --end 2026-02-08 --limit 20 --pretty
X数据获取(如果安装了x-cli则使用;否则如果bearer token且<=7天则使用API;否则使用本地存档;否则 fallback=true):
- - node scripts/lastxdays_ingest.js --source=x --topic OpenClaw --start 2026-02-07 --end 2026-02-08 --limit 20 --pretty
可选的x-cli直接烟雾测试:
- - x-cli -v -j tweet search OpenClaw since:2026-02-07 until:2026-02-09 --max 20
示例
- - lastxdays AI agents for web
- last x days 10 bitcoin ETF flows
- what happened in the last 7 days about OpenAI for reddit
- 14 lastXdays Apple Vision Pro for web