Borrowing it
Nothing to install: this file belongs to SoulChildTc/ai-bridge. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/SoulChildTc/ai-bridge/main/AGENTS.mdgit clone --depth 1 https://github.com/SoulChildTc/ai-bridgeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/soulchildtc/ai-bridge/agents-md)<a href="https://agentmods.dev/instructions/soulchildtc/ai-bridge/agents-md"><img src="https://agentmods.dev/badge/instructions/soulchildtc/ai-bridge/agents-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01611 | $0.01611 |
| Opus 5 | $0.00805 | $0.00805 |
| Sonnet 5 | $0.00322 | $0.00322 |
| Haiku 4.5 | $0.00161 | $0.00161 |
Grade A, and why
ai-bridge AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AI Bridge 项目交接文档
项目概述
AI Bridge 是一个让终端 AI 编程助手(如 OpenCode 中的 DeepSeek)通过浏览器使用 Web AI 对话服务(豆包、ChatGPT)的工具。由 MCP Server(Node.js)和 Chrome 插件两部分组成,通过 WebSocket 通信。
架构
DeepSeek (OpenCode) ←→ MCP Server (stdio) ←→ WebSocket (9527) ←→ Chrome 插件 (Service Worker) ←→ Content Script ←→ AI 聊天页面 DOM
文件说明
mcp-server/index.js
单文件,包含所有服务端逻辑:
- 日志系统:写入
/tmp/ai-bridge.log,同时输出到 stderr - WebSocket 服务端/客户端:
- 主实例监听 9527 端口
- 副实例(端口被占时)自动切换为客户端连接主实例
- 主实例负责在插件和副实例之间路由消息(通过 requestId 匹配)
- MCP 工具:
check_connection:检查插件连接状态new_session:新建对话,参数 message + platform,返回 sessionUrlask_ai:继续对话,参数 message + sessionUrl + platform
- install 命令:
node index.js install [token],自动配置 OpenCode 的 opencode.jsonc - 系统提示词:
SYSTEM_PROMPT常量,在new_session时拼接到用户消息前面 - waitForConnection:发送前检查插件连接,断了会等最多 30 秒让插件重连
chrome-extension/
| 文件 | 职责 |
|---|---|
manifest.json |
Manifest V3 配置,声明权限(storage, activeTab, alarms, tabs)、host_permissions、content_scripts 加载顺序 |
default-configs.js |
豆包和 ChatGPT 的内置默认配置,全局变量 AI_BRIDGE_DEFAULT_CONFIGS,content.js 和 debug-panel.js 共享 |
background.js |
Service Worker,管理 WebSocket 连接到 MCP Server、消息路由(MCP Server ↔ Content Script)、自动打开/刷新页面、keepalive alarm(10秒)、连接状态存 storage |
content.js |
注入到 AI 聊天页面,DOM 操作(输入、发送、等待回复、提取回复)、请求队列(串行)、Markdown 提取、配置从 storage 读取 |
debug-panel.js |
浮动调试面板 UI,可视化配置选择器和操作方式、高亮元素、逐项测试、保存到 storage |
popup.html + popup.js |
插件设置弹窗,Token/URL 配置、连接开关、状态显示(含倒计时) |
关键设计决策
为什么用浏览器自动化而不是 API
用户没有经济能力购买 API 额度。
为什么用 WebSocket 而不是 Native Messaging
参考了 WechatSync 插件的架构。WebSocket 方案更简单,不需要额外的 native host manifest 配置。
为什么不用 HTTP 轮询替代 WebSocket
讨论过但未实施。HTTP 轮询能彻底解决 Service Worker 生命周期问题,但重构工作量大。当前用 chrome.alarms 保活缓解。
配置存储架构
- 选择器和操作方式存在
chrome.storage.local,key 为config_${hostname} - 每个域名独立存储,互不干扰
- 内置默认配置(
default-configs.js)作为 fallback - 用户通过调试面板保存的配置优先于内置默认
多实例架构
- 第一个 MCP Server 启动 WebSocket 服务端(主实例)
- 后续 MCP Server 检测到端口被占,切换为 WebSocket 客户端(副实例)
- 主实例通过 requestId 路由:自己的请求直接处理,不匹配的转发给所有副实例
- 副实例断线后 10 秒重连
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 7d ago First seen · 126 lines · 1,611 tokens per session scan A bf1f3cdae4ee
ai-bridge AGENTS.md is an instructions file published in the GitHub repository SoulChildTc/ai-bridge (0 stars, last pushed 2mo ago), licensed MIT. It adds 1,611 tokens to every session, about $0.0081 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.