--- 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`. - 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: "销售数据", "业绩", "店铺业绩", "售后", "退款", "费比", "客服体验", "用户反馈", "话术分析", "产品信息", "SKU编码", "材质", "预览图"), 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) Product info query (`SKU/成本/材质/预览图`): `exec`: `product-info "" --days 30 --limit 20` 3) Product-ID SKU list query: `exec`: `product-skus-by-id "<商品id>" --limit 1000` 4) Sales/aftersale analysis: `exec`: `company-db run-file /root/.openclaw/workspace/sqlserver/last_week_afs_report.sql` (or targeted SQL query) 5) Customer-service experience/writing analysis: `exec`: `customer-service-analysis --start --end [--shop "店铺关键词"] --limit 20` - For customer-service analysis outputs, include at least 2 dialogue snippets and recommended reply wording. - For customer-service analysis outputs, include capability scoring by agent name (4 dimensions + overall grade). - 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. ## 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 ` on at least 2 relevant views - `yuce-browser requests --filter yucekj.com` 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 ` Use command output as primary evidence text. Do not rewrite numeric values.