Codex Deep Search
Use Codex CLI's web search capability for research tasks needing more depth than Brave API snippets.
When to Prefer Over web_search
- - Complex/niche topics needing multi-source synthesis
- User explicitly asks for thorough/deep research
- Brave results are too shallow or missing context
Usage
Dispatch Mode (recommended — background + callback)
CODEBLOCK0
After dispatch: tell user search is running, results will arrive via Telegram. Do NOT poll.
Synchronous Mode (short queries only)
CODEBLOCK1
Then read the output file and summarize.
Parameters
| Flag | Required | Default | Description |
|---|
| INLINECODE0 | Yes | — | Research query |
| INLINECODE1 |
No |
data/codex-search-results/<task>.md | Output file path |
|
--task-name | No |
search-<timestamp> | Task identifier |
|
--telegram-group | No | — | Telegram chat ID for callback |
|
--model | No |
gpt-5.3-codex | Model override |
|
--timeout | No |
120 | Seconds before auto-stop |
Result Files
| File | Content |
|---|
| INLINECODE10 | Search report (incremental) |
| INLINECODE11 |
Task metadata + status |
|
data/codex-search-results/task-output.txt | Raw Codex output |
Key Design
- - Incremental writes — results saved after each search round, survives OOM/timeout
- Low reasoning effort — reduces memory, prevents OOM SIGKILL
- Timeout protection — auto-stops runaway searches
- Dispatch pattern — background execution with Telegram callback, no polling
Codex Deep Search
利用Codex CLI的网络搜索能力,完成需要比Brave API摘要更深入的研究任务。
何时优先使用(相较于web_search)
- - 需要多源综合的复杂/小众主题
- 用户明确要求进行彻底/深入研究
- Brave结果过于浅显或缺乏上下文
使用方法
调度模式(推荐——后台+回调)
bash
nohup bash /home/ubuntu/clawd/skills/codex-deep-search/scripts/search.sh \
--prompt 你的研究查询 \
--task-name notebooklm-research \
--telegram-group -5006066016 \
--timeout 120 > /tmp/codex-search.log 2>&1 &
调度后:告知用户搜索正在运行,结果将通过Telegram送达。请勿轮询。
同步模式(仅限短查询)
bash
bash /home/ubuntu/clawd/skills/codex-deep-search/scripts/search.sh \
--prompt 快速事实查询 \
--output /tmp/search-result.md \
--timeout 60
然后读取输出文件并进行总结。
参数
| 标志 | 必需 | 默认值 | 描述 |
|---|
| --prompt | 是 | — | 研究查询 |
| --output |
否 | data/codex-search-results/<任务名>.md | 输出文件路径 |
| --task-name | 否 | search-<时间戳> | 任务标识符 |
| --telegram-group | 否 | — | 用于回调的Telegram聊天ID |
| --model | 否 | gpt-5.3-codex | 模型覆盖 |
| --timeout | 否 | 120 | 自动停止前的秒数 |
结果文件
| 文件 | 内容 |
|---|
| data/codex-search-results/<任务名>.md | 搜索报告(增量式) |
| data/codex-search-results/latest-meta.json |
任务元数据+状态 |
| data/codex-search-results/task-output.txt | Codex原始输出 |
关键设计
- - 增量写入 — 每轮搜索后保存结果,可应对内存不足/超时
- 低推理开销 — 减少内存占用,防止因内存不足被SIGKILL终止
- 超时保护 — 自动停止失控搜索
- 调度模式 — 后台执行+Telegram回调,无需轮询