# AGENTS.md - OpenClaw Workspace Rules ## 1) Core Behavior - Execute first, explain later. Do not throw generic blockers to the user. - Before asking user for help, try at least 2 autonomous recoveries. - If still blocked, only ask for concrete missing items (OTP/CAPTCHA/2FA/session expired). - Do not fabricate data. Every conclusion must come from tool results. ## 2) Routing Priority (Highest to Lowest) ### A. Xiaohongshu Tasks (override all market routes) Trigger keywords: 小红书 / 红书 / xhs / 笔记 / 种草 / 舆情 Required sequence: 1. `exec: xhs-api health` 2. `exec: xhs-api login-status` 3. If not logged in: `exec: xhs-api login-qrcode /root/.openclaw/workspace/outputs/xhs-login-qrcode.png` 4. Then use: - `xhs-api search ""` - `xhs-api detail true` ### B. Sales / Aftersale / Refund / Performance Tasks (SQL only) Trigger keywords: 销售 / 业绩 / 售后 / 退款 / 费比 / 店铺周报 / SKU结构 / 发货 / 工单 / 客诉 / 客服体验 / 用户反馈 / 话术分析 / 产品信息 / 商品ID / SKU编码 / 成本 / 材质 / 预览图 Hard rules: - Must route to `company-sales-db-analysis`. - Do not use yuce website for sales/aftersale tasks. - Do not use web_search/web_fetch for these tasks. - Must run at least one `exec` data query before final response. - Do not call `tts` unless user explicitly asks voice output. Mandatory first checks (once per turn): 1. `exec: company-db health` 2. Query by SQL templates in `/root/.openclaw/workspace/sqlserver/` Template mapping: - 店铺周报 -> `shop_weekly_report.sql` - SKU结构 -> `sku_structure_report.sql` - 产品信息(SKU/成本/材质/预览图) -> `exec: product-info "" --days 30 --limit 20` - 商品ID查SKU清单 -> `exec: product-skus-by-id "<商品id>" --limit 1000` Product info output minimum fields: - SKU编码, SKU名称, 成本价, 材质, 预览图地址 - 推荐补充:SPU/货号/分类/供应商/尺寸/重量/SKU状态 - 若存在物流数据,追加 一区/二区/三区 运费汇总(近30天) - 若存在售后数据,追加 售后总览 + 售后类型矩阵 + 售后原因TOP(近30天) - 退款原因/售后 -> `after_sale_360_report.sql` - 费比异常 -> `fee_ratio_alert.sql` - 物流时效 -> `logistics_sla_report.sql` - 运费效率 -> `freight_efficiency_report.sql` - 客服热点 -> `customer_service_hotspot_report.sql` - 客服体验/话术分析(可指定时间段) -> `exec: customer-service-analysis --start --end [--shop "店铺关键词"] --limit 20` - 输出需包含:客服能力总分与等级(S/A/B/C/D) - 安装服务 -> `install_service_quality_report.sql` - 链接目标覆盖 -> `link_target_coverage_report.sql` Aftersale special rule: - Do not analyze only one table. - Must prioritize reason dimensions from: 1) `jst_goods_profit_kpi_items_afs` (undefined57/58/56) 2) `pc_kfChatLog` (mainReason/secondReason/thirdReason) 3) `fys_Ticketing_install` (工单维度) - If reason fields are empty, explicitly mark as "源字段为空" and continue with available dimensions. Metric priority rule (very important): - Prefer piece/order counts first: `发货件数`, `订单数`, `售后件数`, `工单量`. - Amount metrics are secondary and optional. - Unless user explicitly asks for 金额/费用/利润, never rank conclusions by amount first. Output format for sales/aftersale: 1. 件数与订单核心结论 2. 原因结构(一级/二级/三级) 3. 趋势与异常 4. 金额补充(可选) 5. 可执行建议 6. 若为客服体验/话术任务,必须补充“对话案例 + 推荐回复话术” 7. 若为客服体验/话术任务,必须补充“客服能力评分(按客服名字输出四维度+总分+等级)” ### C. Market Analysis Tasks (non-sales) Trigger keywords: 市场分析 / 行业分析 / 类目分析 / 竞品分析 / 趋势分析 Hard rules: - Only allow domain `hq.yucekj.com` / `yucekj.com`. - Use `exec` with `yuce-browser` only. - Never use browser `search` action. - Never use web_search/web_fetch for this route. - If login/CAPTCHA blocks, ask user for that exact step only. ### D. General Online Search Tasks Trigger keywords: 在线搜索 / 搜一下 / 查资料 / 最新消息 / 新闻 / 政策更新 Preferred execution: 1. First use `exec: web-search "" --count 8` (stable path; includes Brave+Bing fallback). 2. Optional: if user explicitly asks for Brave-only, use `web_search`. 3. Summarize with source links, and mark date/time context when content is time-sensitive. ## 3) Security and Privacy - Do not expose raw data source endpoints in user-facing replies. - Mask domain/IP/api endpoints in final messages when possible. - Never leak secrets from env files. ## 4) Reply Quality Rules - Send concise final answer; no long tool transcript dump. - If task may take time, send one short processing hint first. - Do not repeat the same result twice in one turn. - If a request fails, include: what was attempted, what failed, and next actionable fix. ## 5) Workspace Paths - SQL templates: `/root/.openclaw/workspace/sqlserver/` - SQL catalog: `/root/.openclaw/workspace/outputs/company-sales-db-catalog.md` - Router skill: `/root/.openclaw/skills/web-task-router/SKILL.md` - Tool guide: `/root/.openclaw/workspace/TOOLS.md` - Site config: `/root/.openclaw/workspace/websites.yaml`