ai-bridge: Instructions file for Codex

AGENTS.md

ai-bridge AGENTS.md is an instructions file for Codex, OpenCode from SoulChildTc/ai-bridge. It costs 1,611 tokens per session, scanned A, original, MIT.

Project instructions for a bridge that lets a terminal coding assistant use browser-based AI chat services such as ChatGPT and Doubao through a Chrome extension.

In plain words
What is it for?
Starting new browser AI sessions, continuing conversations, checking the connection, routing messages, and installing the bridge configuration for OpenCode.
Why use it?
It connects tools that normally cannot communicate directly, and waits for the browser extension to reconnect when needed.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions OpenCode.

This is SoulChildTc/ai-bridge's own configuration. It tells Codex and OpenCode how to work on ai-bridge itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ai-bridge configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/SoulChildTc/ai-bridge/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/SoulChildTc/ai-bridge

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for ai-bridge AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/soulchildtc/ai-bridge/agents-md.svg)](https://agentmods.dev/instructions/soulchildtc/ai-bridge/agents-md)
Your own site
<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>
Per session 1,611 This file is loaded in full into every session.
When invoked 1,611 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 7d ago against content hash bf1f3cdae4ee, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

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.

AGENTS.md · 126 lines

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,返回 sessionUrl
    • ask_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 秒重连

Read the full file on GitHub · 126 lines

Changes

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.

  1. 7d ago First seen · 126 lines · 1,611 tokens per session scan A bf1f3cdae4ee

Subscribe to this mod's changes

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.

Related

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.

vercel/next.js · 7,296 tokens

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.

openai/codex · 5,153 tokens

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).

microsoft/vscode · 6,785 tokens

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).

microsoft/vscode · 5,001 tokens

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.

langchain-ai/langchain · 4,469 tokens

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.

github/spec-kit · 7,104 tokens