dalongxia/remote_sync/web-task-router.SKILL.md
2026-03-04 13:25:48 +08:00

132 lines
6.2 KiB
Markdown

---
name: web-task-router
description: Route website tasks by intent using a preset site registry, then decide whether to access public pages or login with saved credentials. Use when user asks to fetch/process data from websites, with or without login, especially market analysis tasks.
metadata:
{ "openclaw": { "emoji": "🌐", "os": ["linux", "darwin"] } }
---
# web-task-router Skill (OpenClaw)
Use this skill to choose the right website automatically and run login/public web tasks with human-in-the-loop verification.
## Registry file
- Read: `/root/.openclaw/workspace/websites.yaml`
- Use `routing_rules.hard_route_rules` first, then `sites[].purposes` + `sites[].keywords`.
## Decision flow
1. Parse user intent (what data/action is needed).
2. Check `routing_rules.hard_route_rules` first.
3. If user text matches any `when_keywords`, force `force_site_id`.
4. If no hard rule matched, choose one best site from `purposes/keywords`.
5. If no reliable match, ask one short clarification question.
6. If matched site has `login_required: false`, open target directly and proceed.
7. If `login_required: true`, resolve credentials, login, then execute task.
## Hard rule for market analysis
- If user request mentions market-analysis intent (for example: "市场分析", "行业分析", "类目分析", "竞品分析", "趋势分析"), always route to `ecommerce-market-analysis`.
- In this case, never use `web_search` or `web_fetch`.
- `browser` tool is disabled for market analysis.
- Preferred execution path: use `exec` with `yuce-browser open https://hq.yucekj.com` and `yuce-browser snapshot 60`.
- Page-level extraction and button-expansion SOP:
- `/root/.openclaw/workspace/outputs/market-analysis-page-sop.md`
- Do not output market-analysis metrics unless collected from yucekj pages in this run.
- If collection fails, ask the user for OTP/CAPTCHA/manual assist and pause.
## Hard rule for company sales / aftersale analysis
- If user request mentions company sales intent (for example: "销售数据", "业绩", "店铺业绩", "售后", "退款", "费比"), always route to `company-sales-db-analysis`.
- This route must use SQLServer queries only. Do not open the old web dashboard for these tasks.
- Preferred execution path:
1) `exec`: `company-db health`
2) `exec`: `company-db tables`
3) `exec`: `company-db run-file /root/.openclaw/workspace/sqlserver/last_week_afs_report.sql` (or targeted SQL query)
- Before writing analysis, first read field catalog:
- `/root/.openclaw/workspace/outputs/company-sales-db-catalog.md`
- If a metric cannot be mapped to known tables/fields, return missing field list and ask one precise follow-up.
## Hard rule for install drawing/video lookup
- If user request mentions install media intent (for example: "安装图纸", "安装视频", "安装说明书", "图纸地址", "视频地址", "订单号查图纸"), always route to `install-media-db-analysis`.
- Preferred execution path:
1) `exec`: `install-media-lookup --order-id "<订单号>"`
2) if user gives product number directly: `exec`: `install-media-lookup --product-no "<货号>"`
- Keep two fields in final answer:
- `raw_path`
- `media_url` (browser URL after path conversion)
- URL conversion must follow:
- `D:\\JianSunTuZhiFile\\...` -> `https://img.jiansuntuzhi.cn/...`
- If no data or MySQL connection fails, return explicit failure reason and the next actionable check. Do not fabricate links.
## Credential resolution order
1. If `credentials.source = env`, read `credentials.username_env` and `credentials.password_env` from environment variables.
2. If env is missing and `fallback_source = 1password`, use `username_ref/password_ref`.
3. If still unresolved, ask user for manual input.
## Login/verification policy
- Do not print raw password in chat.
- If OTP/CAPTCHA appears, pause and ask user for input.
- After user replies with code (or says challenge is done), resume from paused step.
## Safety rules
- Operate only inside `allowed_domains`.
- If redirected outside allowed domains, stop and ask user.
- Keep actions non-destructive unless user explicitly requests changes.
- Summarize final result briefly with data outcome and status.
## Autonomous module selection (yuce market-analysis)
Use this deterministic map before clicking pages:
- market size / growth / trend -> 市场洞察
- category share / fine-grained opportunities -> 叶子类目分析
- brand/shop/product competition -> 品牌店铺商品热榜, 竞店布局分析
- consumer demand / keyword changes -> 产品需求分析, 需求趋势分析, 关键词布局分析
- price strategy / price band -> 价格段布局, 品牌布局分析
Execution requirements:
1. Build a mini plan: requested metrics -> target modules (inside yuce only).
2. Open/login yuce, navigate by module names, capture snapshots as evidence.
3. If any metric lacks visible data, return "not available in current view" instead of guessing.
4. Never use `cron` for market-analysis tasks.
5. Never output final numbers before evidence capture.
### Strict module whitelist
Only use these exact module names in planning or reporting:
市场洞察 / 叶子类目分析 / 品牌店铺商品热榜 / 飙升品榜单 / 品牌布局分析 / 竞店布局分析 / 价格段布局 / 产品需求分析 / 需求趋势分析 / 关键词布局分析
If model generates non-whitelist names, discard and regenerate with whitelist names only.
## Analysis brief workflow (mandatory for market tasks)
When user asks for market analysis report/brief:
1. Route to yuce modules by requested metrics.
2. Collect evidence first:
- `yuce-browser open https://hq.yucekj.com`
- `yuce-browser snapshot <limit>` on at least 2 relevant views
- `yuce-browser requests --filter yucekj.com`
- If any filter/date changed, click `查询` first (mandatory in SOP)
3. Build brief with fixed sections:
- 已抓取证据
- 核心结论
- 可执行建议
- 风险与缺口
- 下一步
4. Mark inferred statements as `推断`, never present as hard fact.
5. If evidence is incomplete, stop at gap list and ask user one precise follow-up.
### Deterministic brief command
For requests like "分析简报/结论+建议", run:
- `market-brief-report <keyword>`
Use command output as primary evidence text. Do not rewrite numeric values.