与 AI agent 配合使用 OmniScout
Claude Code、Cursor、Codex 与 Kimi 驱动 OmniScout 的即用提示词与技能文件。
OmniScout 专为 AI agent 驱动而构建:每个命令都会说 JSON,元素 ref 稳定,完整操作历史可查看。配置方法如下。
1. 安装
pip install omniscout
omniscout install --skill--skill 会将指令复制到 agent 的技能目录:
| Agent | 位置 |
|---|---|
| Claude Code | ~/.claude/skills/scout/SKILL.md |
| Cursor | ~/.cursor/skills-cursor/scout/SKILL.md |
| Codex CLI | ~/.codex/skills/scout/SKILL.md |
| Gemini CLI / Antigravity | ~/.gemini/config/skills/scout/SKILL.md |
agent 在下个会话自动生效。其他 agent(Pi、OpenCode、Windsurf、Cline、Copilot Agent Mode、任何能执行 shell 的助手)可将 bundled SKILL.md 粘贴进 system prompt。
2. 启动 daemon
omniscout daemon start3. 全程使用 JSON
在循环开始时设置 OMNISCOUT_JSON=1(或按次传 --json)。stdout 变为结构化载荷;日志走 stderr:
export OMNISCOUT_JSON=1
omniscout search "robotics simulators"
omniscout browser snapshot | jq '.refs[] | select(.role == "button")'结构是 Pydantic 约定(models.py) — 解析器可依赖的稳定字段。每个响应都携带足够上下文(ref、url、id)供下一次调用使用。
4. 直接用提示词
研究一个问题
Use OmniScout to research "state of open-source browser agents in 2026" and summarize the top 5 passages with their source URLs.导航并点击
Open https://news.ycombinator.com using OmniScout, snapshot interactive elements, click the top story, and screenshot the result to /tmp/hn-top.png.登录一次并复用
Run `omniscout browser login https://github.com --profile work`, pause for me to authenticate, then screenshot my notifications page with that profile.构建知识图谱
Build a knowledge graph for "Cursor" with OmniScout. Run `omniscout graph "Cursor" --json --data`, show the tree, and cite sources.填写表单
Use OmniScout to open https://duckduckgo.com, fill the search box with "local-first AI agents", press Enter, wait for results, and list the top 5 results.捕获网络流量
Open the Vercel pricing page with OmniScout, capture network traffic while scrolling, then list requests matching stripe|payment|checkout.agent 循环
可靠的循环如下:
daemon start(幂等 — 每个会话都可安全运行)。export OMNISCOUT_JSON=1。- 执行:
navigate→snapshot --refs-only→click/fill→ 重新 snapshot。 - 观察:
screenshot、get text、network tail、console tail。 - 清理:
browser close --all。
用 --session <name> 隔离并行任务,避免标签页与 ref 冲突。
调试 agent 运行
omniscout daemon trace— 查看最近 10k 个操作的 JSONL 历史(agent 到底做了什么?)。omniscout daemon replay/omniscout replay …— 重跑已记录的流程以复现失败。omniscout daemon watch— 在 agent 工作时跟随实时事件流。omniscout context— 查看当前工作流连续状态;omniscout reset重新开始。
错误类型
需要预期并处理这些失败:
| 失败 | 信号 | 修复 |
|---|---|---|
过期 @eN ref | "ref not found" | 重新 snapshot,使用新 ref |
| 页面未加载 | 空白截图 / 缺失文本 | 先 browser wait text/networkidle |
| 登录过期 | 重定向到登录页 | 重新运行 browser login --profile … |
| 验证码 | 检测到验证挑战 | 有界面求解或 --solver 2captcha |
| daemon 未运行 | 连接被拒绝 | daemon start(或检查 --port) |
| 无结果 | 空 hits | 收窄查询,更换 --source |
完整列表:故障排查。
agent 技巧
- 开始时设置
OMNISCOUT_JSON=1以获得结构化输出。 - 用
omniscout browser snapshot --refs-only查找元素,再按@eNref 点击。 - 每次
navigate后重新 snapshot — ref 会失效。 - 优先用
wait text/networkidle而非固定 sleep。 - 用
record/macro run录制可重复流程,而不是每次重新即兴操作。 - 结束时用
omniscout browser close --all关闭会话。