OmniScout Docs

与 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 start

3. 全程使用 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 循环

可靠的循环如下:

  1. daemon start(幂等 — 每个会话都可安全运行)。
  2. export OMNISCOUT_JSON=1。
  3. 执行:navigate → snapshot --refs-only → click/fill → 重新 snapshot。
  4. 观察:screenshot、get text、network tail、console tail。
  5. 清理: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 查找元素,再按 @eN ref 点击。
  • 每次 navigate 后重新 snapshot — ref 会失效。
  • 优先用 wait text/networkidle 而非固定 sleep。
  • 用 record/macro run 录制可重复流程,而不是每次重新即兴操作。
  • 结束时用 omniscout browser close --all 关闭会话。

On this page