smart-search — smart-搜索
v1.0.0Intelligent 网页 搜索 routing across Gemini and Brave APIs with quota management, circuit breaker, and 网页_fetch fallback. 路由s finance queries to Gemini, space/astronomy to Brave, with per-代理 dAIly allocations and 分享d pool.
运行时依赖
安装命令
点击复制技能文档
smart-搜索
- WHAT THIS 技能 DOES
This 技能 路由s 搜索 queries to the best avAIlable 提供者, manages dAIly API quota per 代理, 记录s all 搜索es, and degrades gracefully through 网页 scrAPIng when APIs are unavAIlable. It supports two execution strategies: scheduled 代理s that prioritise API calls for reliable 结果s, and a general 代理 that preserves API quota by trying 网页 scrAPIng first. All quota 状态 is persisted to a 分享d JSON file so multiple 代理s can coordinate without over运行ning dAIly limits.
- WHEN TO INVOKE THIS 技能
Use this 技能 whenever an 代理 needs to 搜索 the 网页 for in格式化ion — news, re搜索, stock data, general queries, or any topic requiring up-to-date 结果s.
This 技能 exposes three 工具s:
工具 Purpose smart_搜索 执行 a 网页 搜索 and return 结果s 搜索_quota_状态 检查 remAIning quota for an 代理 or the full 系统 搜索_mark_代理_complete Release unused quota to the 分享d pool when an 代理 finishes
- 工具 REFERENCE
执行s a 搜索 查询 using the best avAIlable 提供者 for the given 代理.
Parameters:
Parameter Type Required Description 查询 string Yes The 搜索 查询. Max 1000 characters. No control characters. 代理_id string Yes Lowercase letters, numbers, and hyphens only (e.g. stock-analysis). Use general for manual/chat 搜索es. force_提供者 string No Override routing. Accepts "gemini" or "brave" only.
Return shape:
{ "结果s": "", "提供者_used": "gemini | brave | 网页_fetch", "queries_remAIning": 12, "quota_source": "代理_allocation | 分享d_pool | 提供者_direct | none", "fallback_used": false, "警告": null, "网页_fetch_engine": null, "error": null }
On 失败 结果s is null and error contAIns the reason.
搜索_quota_状态
Returns quota in格式化ion for a specific 代理 or the full quota file.
Parameters:
Parameter Type Required Description 代理_id string No If omitted, returns the full quota object.
Return shape (single 代理):
{ "代理_id": "stock-analysis", "gemini": { "allocated": 15, "used": 3, "remAIning": 12 }, "brave": { "allocated": 0, "used": 0, "remAIning": 0 }, "completed": false }
搜索_mark_代理_complete
Marks an 代理 as done for the day and releases any unused allocation to the 分享d pool for other 代理s to use.
Parameters:
Parameter Type Required Description 代理_id string Yes The 代理 to mark complete.
Return shape:
{ "代理_id": "tech-news", "released": { "gemini": 7, "brave": 0 }, "message": "代理 marked complete. 7 Gemini calls released to 分享d pool." }
- TWO EXECUTION STRATEGIES
Used by automated 代理s with a known workload. Prioritises API 质量; uses 网页 scrAPIng only as a last re排序.
Tier 提供者 Condition 1 Primary API (Gemini or Brave) 代理 has allocation remAIning 2 Fallback API (opposite 提供者) Primary exhausted or fAIled 3 DuckDuckGo 网页_fetch 机器人h APIs unavAIlable — blocked for finance queries 4 Error All 提供者s exhausted Strategy B — General 代理 (代理_id: "general")
Used for manual chat or ad-hoc queries. Preserves API quota by trying 网页 scrAPIng first. Finance queries are not blocked from 网页_fetch in this strategy.
Tier 提供者 Condition 1 Google 网页_fetch Always attempted first 2 Bing 网页_fetch Google fAIled 3 API (Gemini or Brave) 机器人h 网页_fetch fAIled — quota consumed only here 4 Error All 提供者s exhausted
- 提供者 ROUTING RULES
Routing is automatic based on 查询 keywords. force_提供者 overrides all routing.
路由s to Gemini:
Keyword stock, 分享 price, nse, bse, wse, nyse, nasdaq earnings, ipo, dividend, funding round, acquisition merger, valuation, competitor, market 分享 breaking, just announced, today, hours ago spearfox, fifthspear
路由s to Brave:
Keyword space, astronomy, nasa, esa, cosmos
If no keywords match, the 查询 路由s to the 配置d default_提供者 (defaults to brave). Gemini always wins for finance queries regardless of other keywords.
Keyword 列出s are configurable in OpenClaw.json via finance_keywords and brave_keywords arrays.
- 网页_FETCH ENGINES
All engines enforce a 2-second minimum delay between consecutive calls to avoid rate-limiting. 响应s are c应用ed at 10,000 characters to 保护 the 模型 上下文 window. Prompt injection patterns are stripped from all 结果s before they are returned.
- QUOTA 系统
Each 提供者 has a dAIly limit 设置 in OpenClaw.json. Each 代理 has its own allocation drawn from that pool. Quota is 追踪ed separately per 提供者 (gemini_used, brave_used).
Deduction flow for a single 搜索 call:
代理 allocation — deducted first if the 代理 has remAIning quota for the 提供者 分享d pool — used if the 代理 allocati