Video Searching Skill
Use this skill when the user asks to find, compare, or analyze social videos (YouTube, TikTok, Instagram, Twitter/X), or explicitly invokes /video_search.
This skill calls the Memories.ai Video Searching API — a managed, token-authenticated endpoint that searches across platforms and returns structured results via SSE.
Triggering
Run this workflow when either condition is true:
- 1. Message starts with
/video_search. - The user asks for video sourcing/trend/creator/brand analysis and wants concrete video links.
If /video_search is used with no query body, ask for the missing query.
Execution contract
- 1. Resolve query text:
-
/video_search ... → strip
/video_search and use remaining text.
- Free-form → use user message as query.
- 2. Build the API request JSON body:
-
query (required): the user's search query
-
platforms (optional): array of
youtube,
tiktok,
instagram,
twitter — only set if user specifies platforms
-
max_results (optional, default 10): number of video results
-
time_frame (optional):
past_24h,
past_week,
past_month,
past_year — only set if user specifies recency
-
max_steps (optional, default 10): max agent iterations
-
enable_clarification (optional, default false): set to true if user query is vague
- 3. Call the runner script:
CODEBLOCK0
- 4. Start with
exec using background: true. - Poll with
process using action: "poll" every 2–4 seconds until process exits. - Parse NDJSON output and render only these events:
-
started → send:
🔍 Starting video search...
-
progress → send concise progress update from
message field (throttle: skip if last update was < 3s ago)
-
complete → send final formatted response (see below)
-
clarification → ask the clarification question directly; treat as final response
-
error → send concise failure reason with one actionable next step
- 7. Do not forward raw
tool_call or tool_result events to the user.
Final response format
When terminal event is complete:
- 1. One short paragraph conclusion (from
answer field). - Top video references (up to 5 by default):
-
title
-
url
-
platform badge (e.g. 🎬 YouTube, 🎵 TikTok, 📸 Instagram, 🐦 X)
- one-line
relevance_note
- key metrics: views, likes, engagement rate (if available)
- 3. Footer: INLINECODE38
If fewer videos exist, show all available references.
When terminal event is clarification:
- 1. Ask the clarification question directly.
- Present options if provided.
- Treat as final response for the current run.
When terminal event is error:
- 1. Send concise failure reason.
- Include one actionable next step.
Safety and fallback
- 1. If
MEMORIES_API_KEY is not set, tell the user:
> ⚠️ Missing
MEMORIES_API_KEY. Set it in your OpenClaw environment variables to use this skill.
> Get your API key at https://api-tools.memories.ai
- 2. If the API returns a non-SSE error (HTTP 4xx/5xx), display the error message.
- Never fabricate video URLs or metrics.
- If the API is unreachable, suggest checking network connectivity and API status.
视频搜索技能
当用户要求查找、比较或分析社交视频(YouTube、TikTok、Instagram、Twitter/X),或明确调用 /video_search 时,使用此技能。
该技能调用 Memories.ai 视频搜索 API——一个受管理的、基于令牌认证的端点,可跨平台搜索并通过 SSE 返回结构化结果。
触发条件
满足以下任一条件时运行此工作流:
- 1. 消息以 /video_search 开头。
- 用户要求进行视频来源/趋势/创作者/品牌分析,并希望获取具体的视频链接。
如果使用 /video_search 但未附带查询内容,则询问缺失的查询。
执行约定
- 1. 解析查询文本:
- /video
search ... → 去除 /videosearch 并使用剩余文本。
- 自由格式 → 将用户消息作为查询使用。
- 2. 构建 API 请求 JSON 主体:
- query(必需):用户的搜索查询
- platforms(可选):数组,包含 youtube、tiktok、instagram、twitter——仅在用户指定平台时设置
- max_results(可选,默认 10):视频结果数量
- time
frame(可选):past24h、past
week、pastmonth、past_year——仅在用户指定时间范围时设置
- max_steps(可选,默认 10):最大代理迭代次数
- enable_clarification(可选,默认 false):如果用户查询模糊,设置为 true
- 3. 调用运行脚本:
dir>/scripts/runvideo_query.sh \
--query \
[--platforms youtube,tiktok] \
[--max-results 10] \
[--time-frame past_week] \
[--enable-clarification]
- 4. 使用 background: true 的 exec 启动。
- 每 2-4 秒使用 action: poll 的 process 轮询,直到进程退出。
- 解析 NDJSON 输出,仅渲染以下事件:
- started → 发送:🔍 正在开始视频搜索...
- progress → 从 message 字段发送简洁的进度更新(限流:如果上次更新在 3 秒内则跳过)
- complete → 发送最终格式化响应(见下文)
- clarification → 直接询问澄清问题;视为最终响应
- error → 发送简洁的失败原因及一个可操作的下一个步骤
- 7. 不要将原始的 toolcall 或 toolresult 事件转发给用户。
最终响应格式
当终端事件为 complete 时:
- 1. 一段简短的结论(来自 answer 字段)。
- 顶部视频引用(默认最多 5 个):
- title
- url
- platform 徽章(例如 🎬 YouTube、🎵 TikTok、📸 Instagram、🐦 X)
- 一行 relevance_note
- 关键指标:观看次数、点赞数、互动率(如有)
- 3. 页脚:⏱ {executiontimeseconds}秒 · {stepstaken}步 · {toolsused}
如果视频数量较少,则显示所有可用的引用。
当终端事件为 clarification 时:
- 1. 直接询问澄清问题。
- 如果提供选项,则展示选项。
- 视为当前运行的最终响应。
当终端事件为 error 时:
- 1. 发送简洁的失败原因。
- 包含一个可操作的下一个步骤。
安全与回退
- 1. 如果未设置 MEMORIESAPIKEY,告知用户:
> ⚠️ 缺少 MEMORIES
APIKEY。请在 OpenClaw 环境变量中设置以使用此技能。
> 在 https://api-tools.memories.ai 获取您的 API 密钥。
- 2. 如果 API 返回非 SSE 错误(HTTP 4xx/5xx),显示错误消息。
- 切勿伪造视频 URL 或指标。
- 如果 API 无法访问,建议检查网络连接和 API 状态。