agentleFS
ythx-101ythx-101/grok-bridge/SKILL.md

SKILL.md

Skill163 starsChanged 3 days agoMITView on GitHub

在 macOS 上把已登录 Safari 的 Grok(grok.com)变成本地 REST API / CLI,供脚本和 AI agent 调用,无需 API key。非官方项目,仅支持 macOS + Safari。 v3.1.1 是当前可发布版本:保留本机 loopback + 后台专用 tab 的稳定边界,并包含 grok.com 中文提交按钮支持。 稳定入口是 Mac 本机 127.0.0.1:19998。这是有意收窄:bridge 会驱动本机已登录的 Safari/Grok 会话,不应直接暴露到 LAN、Tailscale 或公网地址。 远端 Claw/agent 通过 SSH tunnel 或受控 proxy 访问: 只有在明确完成网络 ACL / 防火墙隔离时,才显式使用 --bind <trusted-interface-ip>;不要把 0.0.0.0 当作 stable/release 默认策略。 先做只读检查,再决定是否需要真实发问: 注意: - bash scripts/grok_chat.sh --help 只打印用法,不会触发 Safari 自动化。 - --doctor 不发送 prompt,只检查平台、osascript、Safari 可达性、bridge tab/current tab 的 Grok URL 和输入框可用性。 - Address already in use 应先归类为环境端口冲突,不要直接判成…

  • Sends data out

200 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use estate-guard and docs.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Arcanea-LabsSkill

    estate-guard

    Security gate for agentic repos. Use before opening a PR that touches .github/workflows, .claude (hooks, settings, agents, commands, skills), .mcp.json, install scripts, or Next.js API routes; when asked to "security review", "scan for prompt injection", "harden this repo", "check the agentic surface", or when a fetched page, issue, comment, or tool result reads like instructions. Runs the estate-guard scanner, triages by severity, and applies the fix patterns.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    docs

    Also in 3 projects that use this

  • Other versions200 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 200

    1. xtekky/gpt4free★ 67ksame name
    2. stas00/ml-engineering★ 20ksame name
    3. wanghongenpin/proxypin★ 14ksame name
    4. Ataraxy-Labs/sem★ 3.4ksame name
    5. op7418/NanoBanana-PPT-Skills★ 3.3ksame name
    6. charmbracelet/pop★ 2.9ksame name
    7. duty1g/x64dbg-mcp-server★ 2.8ksame name
    8. RevylAI/greenlight★ 2.4ksame name
    9. kevinho/clawfeed★ 2.4ksame name
    10. Autumn-27/ScopeSentry★ 1.9ksame name

    190 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

Files
SKILL.md

grok-bridge v3.1.1

在 macOS 上把已登录 Safari 的 Grok(grok.com)变成本地 REST API / CLI,供脚本和 AI agent 调用,无需 API key。非官方项目,仅支持 macOS + Safari。

v3.1.1 是当前可发布版本:保留本机 loopback + 后台专用 tab 的稳定边界,并包含 grok.com 中文提交按钮支持。

架构

  • Safari AppleScript do JavaScript = CDP Runtime.evaluate
  • document.execCommand('insertText') = 输入(绕过 React 受控组件)
  • JS button.click() = 提交(支持 Send / Submit / 发送 / 提交,不依赖 System Events 权限)
  • 默认使用 window.name="grok-bridge-agent" 标记的 Safari 后台专用 tab;--shared-tab 仅用于手动调试当前 tab。
  • 默认不需要辅助功能权限;只有显式 --foreground-fallback 才允许激活 Safari 并用 System Events Enter。

用法

REST API 模式(推荐)

# 先检查本机 Safari / Grok 环境
python3 scripts/grok_bridge.py --doctor

# 在 Mac 上启动服务
python3 scripts/grok_bridge.py --bind 127.0.0.1 --port 19998

# 默认后台专用 tab;需要手动驱动当前 Safari tab 时再加 --shared-tab

# 本机调用
curl -X POST http://127.0.0.1:19998/chat \
  -d '{"prompt":"你好","timeout":120}'

# 其他端点
GET  /health   — 健康检查
GET  /history  — 读取当前页面对话
POST /new      — 新建对话
POST /chat     — 发送问题

部署边界

稳定入口是 Mac 本机 127.0.0.1:19998。这是有意收窄:bridge 会驱动本机已登录的 Safari/Grok 会话,不应直接暴露到 LAN、Tailscale 或公网地址。

远端 Claw/agent 通过 SSH tunnel 或受控 proxy 访问:

# 在远端 agent host 上建立 tunnel
ssh -N -L 19998:127.0.0.1:19998 user@mac

# 远端随后访问自己的 loopback
curl -X POST http://127.0.0.1:19998/chat \
  -d '{"prompt":"你好","timeout":120}'

只有在明确完成网络 ACL / 防火墙隔离时,才显式使用 --bind <trusted-interface-ip>;不要把 0.0.0.0 当作 stable/release 默认策略。

CLI 模式(旧版 bash,备用)

MAC_SSH="ssh user@mac" bash scripts/grok_chat.sh "your question"

Reviewer smoke / review gate

先做只读检查,再决定是否需要真实发问:

python3 scripts/grok_bridge.py --help
python3 scripts/grok_bridge.py --doctor
curl -s http://127.0.0.1:19998/health
curl -s http://127.0.0.1:19998/history
lsof -nP -iTCP:19998 -sTCP:LISTEN
# if a listener exists, capture its PID provenance before trusting the output
ps -p <PID> -o pid=,ppid=,lstart=,command=

注意:

  • bash scripts/grok_chat.sh --help 只打印用法,不会触发 Safari 自动化。
  • --doctor 不发送 prompt,只检查平台、osascript、Safari 可达性、bridge tab/current tab 的 Grok URL 和输入框可用性。
  • Address already in use 应先归类为环境端口冲突,不要直接判成 bridge 逻辑故障。
  • 如果 19998 上已经有 listener,补抓 ps -p <PID> -o pid=,ppid=,lstart=,command=,否则 reviewer 无法判断 /health / /history 是当前 checkout 还是旧进程返回的证据。
  • 统一证据格式 / 错误分类 / owner 划分见 docs/review-playbook.md。

前置条件

  1. Safari > 设置 > 高级 > 显示"网页开发者"功能 ✓
  2. Safari > 开发 > 允许来自 Apple Events 的 JavaScript ✓
  3. Safari 已登录 grok.com(SuperGrok 推荐)

文件

  • scripts/grok_bridge.py — REST API 服务(v3.1.1, stdlib only)
  • scripts/grok_chat.sh — 旧版 CLI(bash + pbcopy + Swift CGEvent,备用)

设计决策(AG Opus 的判断)

Safari 不支持标准 Chrome DevTools Protocol。macOS 上控制 Safari 最可靠的方式是 AppleScript + JavaScript 注入。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.