Install
ugk task install x-search
This task installs 8 files from the official manifest, including 3 script files.
Runtime input
keywordX/Twitter search keyword. Used verbatim in the X Latest query (do not add since:/until: or language filters unless explicitly included in the keyword).
timePhraseThe user's original time phrase, preserved verbatim. Any language. e.g. 3h, 上周, 俩月, last week, past 2 months. Just echo what the user said about time.
timeModeHow the time window is computed. One of: 'rolling' (X ago from now, e.g. 最近/过去/past/1month/俩月), 'calendar' (previous full natural period, e.g. 上周/last week/上个月/last month), 'calendar_to_now' (from start of current period to now, e.g. 今天/this week/本月).
timeAmountPositive number. The amount of the time unit. e.g. for '3h' → 3, for '俩月' → 2, for '上周' → 1. Use 2 for '俩/couple', 3 for 'few'.
timeUnitOne of: 'hour', 'day', 'week', 'month'. The unit of the time window.
startIsoISO 8601 start datetime of the window, INCLUSIVE. You are an LLM, so COMPUTE this from the time phrase using the current date. e.g. for '3h' and now=2026-06-28T06:00:00Z → '2026-06-28T03:00:00.000Z'. For '上周' (calendar week starting Monday) → the Monday 00:00 of last week.
endIsoISO 8601 end datetime of the window, EXCLUSIVE (= now). You are an LLM, so COMPUTE this. For rolling/calendar_to_now this is the current time. For calendar (上周/上个月) this is the start of the current period (e.g. this Monday 00:00 for 上周).
canonicalA short canonical label like '3hours' or '60days'. Use the smallest unit (e.g. '3hours' not '0.125days'). For rolling month use 30 days (e.g. '俩月' → '60days'). For calendar, use the actual span in days (e.g. '上周' → '7days').
maxStepsOptional. Maximum anchor-scroll iterations. Default 20. Raise to 40-80 for active day/month-range topics. Hard maximum 100.
Acceptance
check$TASK_OUTPUT_DIR/x_search_results.json 存在且可被 JSON.parse。
check输出 JSON 至少含 normalizedKeyword, rawQuery, timeWindow, cutoffIso, searchUrl, method, benchmark, results 字段;results 为数组。
checktimeWindow 是对象,含 raw, mode, amount, unit, startIso, endIso, canonical 字段;startIso/endIso 可解析且 startIso < endIso。
checktimeWindow.raw 等于 TASK_INPUT.timePhrase;cutoffIso 等于 timeWindow.startIso。
check每条 results[].postedAt 必须落在 [timeWindow.startIso, timeWindow.endIso) 内(允许极小运行时钟偏差)。
checkresults 非空时,每条至少含 postedAt, text, url,且含 author 或 handle 之一。
checktext 字段保留原文(不截断)。
checkbenchmark 是对象,含 stopReason, score, grade, cutoffReached, anchorScrolls, rowsInspected, validRate, filteredRows。
checksearchUrl 等于 https://x.com/search?q=<encodeURIComponent(normalizedKeyword)>&src=typed_query&f=live。
checkresults 条数与 benchmark.filteredRows 一致(全量落地,不丢)。