← 返回 Skills 市场
scsun1978

Hybrid Deep Search

作者 scsun1978 · GitHub ↗ · v1.0.1
cross-platform ⚠ suspicious
654
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install hybrid-deep-search
功能描述
Hybrid Deep Search - Intelligent routing between Brave API (free, fast) and OpenAI Codex (deep analysis, paid). Auto-selects optimal search strategy based on...
使用说明 (SKILL.md)

Hybrid Deep Search 🚀

Intelligent three-tier search system that automatically routes queries between Brave API and OpenAI Codex for optimal cost and quality.

Architecture

User Query
   ↓
Query Analyzer (router.py)
   ↓
   ├─→ Simple Questions → Brave API (web_search)     Fast, Free
   ├─→ Complex Questions → OpenAI Codex (gpt-5-codex)  Deep Analysis, Paid
   └─→ Manual Mode → User Specified

Quick Start

1. Install Dependencies

pip install openai python-dotenv requests

2. Configure API Keys

Brave API (Already Built-in)

No extra configuration needed. Uses OpenClaw's built-in web_search tool.

OpenAI Codex API (Optional for Deep Search)

# Get API Key from: https://platform.openai.com/api-keys

export OPENAI_API_KEY="sk-your-openai-api-key"
export OPENAI_BASE_URL="https://api.openai.com/v1"  # Optional

Usage

Auto Mode (Recommended)

python3 scripts/deep_search.py "your query"
# System automatically analyzes complexity and chooses:
# - Simple questions → Brave API
# - Complex questions → OpenAI Codex

Manual Mode

# Quick Search (Brave API)
python3 scripts/deep_search.py "what is OpenClaw?" --mode quick

# Deep Search (OpenAI Codex)
python3 scripts/deep_search.py "compare LangChain vs LlamaIndex" --mode codex

Focus Modes

# Academic Search
python3 scripts/deep_search.py "AI agent frameworks research" --mode codex --focus academic

# News Search
python3 scripts/deep_search.py "latest AI news" --mode quick --focus news

# General Web Search
python3 scripts/deep_search.py "OpenClaw documentation" --mode quick --focus web

Parameters

Parameter Description Options Default
query Search query Any text -
--mode Search mode quick, codex, auto auto
--focus Search focus web, academic, news, youtube web
--max-results Max results 1-20 10
--verbose Verbose output - false

Complexity Routing Rules

Auto mode routes based on query analysis:

→ Brave API (quick)

  • Simple factual queries (what/who/when/where)
  • Definition lookups
  • Quick fact-finding
  • Single-topic searches

Examples:

  • "what is OpenClaw?"
  • "who created Python?"
  • "latest AI news today"

→ OpenAI Codex (codex)

  • Comparison analysis
  • Deep reasoning
  • Multi-source synthesis
  • Complex questions
  • Requires inference/summarization

Examples:

  • "compare LangChain vs LlamaIndex in detail"
  • "analyze impact of AI on job market"
  • "explain quantum computing applications in healthcare"

Cost Optimization

Brave API

  • ✅ Completely free
  • ⚡ Fast response (\x3C2s)
  • 📊 Controllable result count

OpenAI Codex (gpt-5-codex)

  • 💰 Usage-based pricing
  • 🧠 Deep reasoning capabilities
  • ⏱️ Slower response (5-30s)
  • 💡 Free tier available for new users

Recommendation: Use auto mode to let the system optimize costs for you.

Technical Details

Query Analyzer (router.py)

Analyzes query complexity using NLP rules:

  • Keyword detection (compare/analyze/explain...)
  • Sentence length
  • Complexity scoring
  • Automatic routing decisions

Brave API Integration

Uses OpenClaw's built-in web_search tool:

  • Called via Bash tool
  • Handles requests automatically
  • No extra authentication needed

OpenAI Codex Integration

  • Uses gpt-5-codex model
  • Built-in web search tool
  • OpenAI Chat Completions API format

Example Use Cases

Case 1: Quick Fact Lookup

python3 scripts/deep_search.py "OpenClaw version 2026"
# → Auto-uses Brave API
# → Result: Fast return, free

Case 2: Deep Analysis

python3 scripts/deep_search.py "comprehensive analysis of AI agent architectures"
# → Auto-uses OpenAI Codex
# → Result: Deep analysis, multi-source synthesis

Case 3: Academic Research

python3 scripts/deep_search.py "recent papers on multi-agent systems" --mode codex --focus academic
# → Uses OpenAI Codex
# → Result: Focused on academic literature

Advanced Usage

Batch Search

# Create queries.txt
echo "query 1" >> queries.txt
echo "query 2" >> queries.txt

# Batch execute
for query in $(cat queries.txt); do
  python3 scripts/deep_search.py "$query" --mode auto
done

Format Output

# JSON output
python3 scripts/deep_search.py "query" --format json

# Markdown output (default)
python3 scripts/deep_search.py "query" --format markdown

# Plain text output
python3 scripts/deep_search.py "query" --format text

Troubleshooting

Brave API Not Responding

# Check OpenClaw web_search tool
# No extra configuration needed

OpenAI Codex Authentication Failed

# Check environment variable
echo $OPENAI_API_KEY

# Reset
export OPENAI_API_KEY="sk-..."

Python Dependencies

pip install --upgrade openai python-dotenv requests

Complexity Scoring System

Scoring Factors (0-10 total)

  1. Keyword Matching (+6)

    • compare/analyze/explain/why/how...
  2. Query Length (+2)

    • 15 words = +2

    • 8 words = +1

  3. Question Pattern (+1)

    • Complex wh-questions
  4. Technical Terms (+1)

    • API/framework/architecture...
  5. Simple Keyword Penalty (-2)

    • what is/who is/list of...

Decision Thresholds

  • 0-2 score: Brave API (quick)
  • 3+ score: OpenAI Codex (codex)

Configuration

Config File

cp config.json.example config.json
# Edit config.json with your settings

Example config.json:

{
  "search_settings": {
    "default_mode": "auto",
    "default_focus": "web",
    "max_results": 10,
    "router_threshold": 3,
    "verbose": false
  },

  "openai_codex": {
    "enabled": true,
    "api_key": "YOUR_OPENAI_API_KEY_HERE",
    "base_url": "https://api.openai.com/v1",
    "model": "gpt-5-codex",
    "max_tokens": 4096,
    "temperature": 0.7
  }
}

Credits

  • Built by Office_bot
  • Powered by OpenClaw

References

安全使用建议
This package is internally inconsistent rather than clearly malicious, but treat it cautiously. Before installing or supplying API keys: 1) Inspect scripts/deep_search.py and scripts/router.py (they currently simulate results and do not make network calls). 2) If you plan to enable codex mode, verify where and how OPENAI_API_KEY will be used (confirm calls go to the official OpenAI API endpoint and that you accept billing exposure). 3) Be aware SKILL.md asks you to pip install openai/python-dotenv/requests even though the bundled code doesn't use them — avoid installing unnecessary packages you don't trust. 4) Run the scripts in a sandbox environment first and search the code for any hard-coded or hidden network endpoints before providing secrets. 5) If you require the promised Brave/OpenAI integrations, ask the maintainer for a clear implementation plan or an update that actually performs authenticated API calls and updates the skill manifest to declare required env vars and dependencies. If you cannot verify these points, do not supply sensitive credentials (OPENAI_API_KEY) to this skill.
功能分析
Type: OpenClaw Skill Name: hybrid-deep-search Version: 1.0.1 The skill is classified as suspicious due to two main reasons: 1) The `SKILL_CN.md` explicitly grants broad `Bash(*:curl)` permissions, which is a powerful tool that could be leveraged for data exfiltration or downloading malicious payloads, even though the provided Python code (`deep_search.py`) currently only mocks the actual search calls and does not directly invoke `curl`. 2) The `deep_search.py` script embeds the user's raw `query` directly into the prompt for the OpenAI Codex model, creating a prompt injection vulnerability against the LLM itself, which could lead to unintended behavior or content generation from the AI model. While there's no evidence of intentional malicious activity by the skill developer, these capabilities and vulnerabilities present significant risks.
能力评估
Purpose & Capability
The skill advertises intelligent routing between a Brave API (via the platform's built-in web_search) and OpenAI Codex. The code implements routing logic and formats results, but does not actually call Brave or OpenAI APIs — it returns simulated results and only checks for OPENAI_API_KEY existence rather than performing real API calls. The SKILL metadata declares no required env vars, yet the runtime relies on OPENAI_API_KEY/OPENAI_BASE_URL if the codex mode is used. These inconsistencies mean the package is not fully implementing its claimed capabilities and the declared manifest doesn't match runtime needs.
Instruction Scope
SKILL.md instructs users to install openai, python-dotenv, and requests and to set OPENAI_API_KEY/OPENAI_BASE_URL, and it references using the platform's web_search tool. The code, however, simulates both Brave and OpenAI responses and does not perform network calls or read .env/config files. The instructions therefore over-promise (and instruct the user to provide credentials) while the code doesn't actually use them for API calls — a gap that grants the skill broad discretion in future changes and confuses what will happen at runtime.
Install Mechanism
There is no install spec (instruction-only at registry level) but SKILL.md asks the user to pip install openai, python-dotenv, and requests. Because installation is performed manually by the user, immediate supply-chain risk is low — but the requested packages are not evidenced in the code, which suggests the dependency list is disproportionate to the packaged implementation and could mislead users into installing unnecessary packages.
Credentials
The registry lists no required environment variables, yet the code looks for OPENAI_API_KEY and OPENAI_BASE_URL to enable codex mode. Requesting an OpenAI API key is proportionate to the stated purpose (calling Codex), but the skill's metadata failing to declare these required variables is an incoherence. Users should treat any provided OPENAI_API_KEY as sensitive (billing risk) and only provide it after verifying the code will only call the official OpenAI endpoint.
Persistence & Privilege
The skill does not request always:true, does not modify system-wide config, and has no install-time persistence mechanism in the registry. It's user-invocable and can be run interactively; there are no elevated privileges requested in the manifest.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install hybrid-deep-search
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /hybrid-deep-search 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Fix: Added proper output formatting for error cases in Codex mode. Improved error handling when OPENAI_API_KEY is not set.
v1.0.0
Initial release: Intelligent routing between Brave API (free, fast) and OpenAI Codex (deep analysis, paid). Auto-selects optimal search strategy based on query complexity with complexity scoring system.
元数据
Slug hybrid-deep-search
版本 1.0.1
许可证
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Hybrid Deep Search 是什么?

Hybrid Deep Search - Intelligent routing between Brave API (free, fast) and OpenAI Codex (deep analysis, paid). Auto-selects optimal search strategy based on... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 654 次。

如何安装 Hybrid Deep Search?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install hybrid-deep-search」即可一键安装,无需额外配置。

Hybrid Deep Search 是免费的吗?

是的,Hybrid Deep Search 完全免费(开源免费),可自由下载、安装和使用。

Hybrid Deep Search 支持哪些平台?

Hybrid Deep Search 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Hybrid Deep Search?

由 scsun1978(@scsun1978)开发并维护,当前版本 v1.0.1。

💬 留言讨论