Skip to content

blackrion/claude_code_bridge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code Bridge (ccb) v2.1

🌍 Cross-Platform Multi-AI Collaboration: Claude + Codex + Gemini

Windows | macOS | Linux — One Tool, All Platforms

Version License: MIT Python 3.10+ Platform

English | 中文

Dual-pane demo (animated)

Full demo video (GitHub Release)


🎉 What's New in v2.1

🪟 Full Windows Support via WezTerm WezTerm is now the recommended terminal for all platforms. It's a powerful, cross-platform terminal with native split-pane support. Linux/macOS users: give it a try! tmux remains supported.

  • ⚡ Faster Response — Optimized send/receive latency, significantly faster than MCP
  • 🐛 macOS Fixes — Fixed session resume and various login issues
  • 🔄 Easy Updates — Run ccb update instead of re-cloning

Found a bug? Run claude in the project directory to debug, then share your git diff with the maintainer!


English

Why This Project?

Traditional MCP calls treat Codex as a stateless executor—Claude must feed full context every time.

ccb (Claude Code Bridge) establishes a persistent, lightweight channel for sending/receiving small messages while each AI maintains its own context.

Division of Labor

Role Responsibilities
Claude Code Requirements analysis, architecture planning, code refactoring
Codex Algorithm implementation, bug hunting, code review
Gemini Research, alternative perspectives, verification
ccb Session management, context isolation, communication bridge

Official MCP vs Persistent Dual-Pane

Aspect MCP (Official) Persistent Dual-Pane
Codex State Stateless Persistent session
Context Passed from Claude Self-maintained
Token Cost 5k-20k/call 50-200/call (much faster)
Work Mode Master-slave Parallel
Recovery Not possible Supported (-r)
Multi-AI Single target Multiple backends

Prefer MCP? Check out CodexMCP — a more powerful MCP implementation with session context and multi-turn support.

Token Savings Explained
MCP approach:
  Claude → [full code + history + instructions] → Codex
  Cost: 5,000-20,000 tokens/call

Dual-pane approach (only sends/receives small messages):
  Claude → "optimize utils.py" → Codex
  Cost: 50-200 tokens/call
  (Codex reads the file itself)

Install

git clone https://github.com/bfly123/claude_code_bridge.git
cd claude_code_bridge
./install.sh install

Windows

  • WSL2 (recommended): run the same commands inside WSL.
  • Native Windows (PowerShell/CMD): use the wrappers:
    • install.cmd install
    • or powershell -ExecutionPolicy Bypass -File .\\install.ps1 install (you will be prompted for BackendEnv)
  • WezTerm-only (no tmux): run ccb inside WezTerm, or set CCB_TERMINAL=wezterm (and if needed CODEX_WEZTERM_BIN to wezterm.exe).

BackendEnv (Important for Windows/WSL)

ccb and codex/gemini must run in the same environment. Otherwise you may see:

  • exit code 127 (command not found)
  • cpend/gpend cannot find replies (different session directories)

Install-time selection is persisted to ccb_config.json (or override with CCB_BACKEND_ENV):

  • BackendEnv=wsl: codex/gemini runs in WSL (recommended if you type codex inside a WSL shell).
  • BackendEnv=windows: codex/gemini runs as native Windows CLI.

Start

ccb up codex            # Start with Codex
ccb up gemini           # Start with Gemini
ccb up codex gemini     # Start both
ccb up codex -r         # Resume previous session
ccb up codex -a         # Full permissions mode

Session Management

ccb status              # Check backend status
ccb kill codex          # Terminate session
ccb restore codex       # Attach to running session
ccb update              # Update to latest version

-a enables --dangerously-skip-permissions for Claude and --full-auto for Codex.
-r resumes based on local dotfiles in the current directory (.claude-session, .codex-session, .gemini-session); delete them to reset.

Usage Examples

Practical Workflows

  • "Have Codex review my code changes"
  • "Ask Gemini for alternative approaches"
  • "Codex plans the refactoring, supervises while I implement"
  • "Codex writes backend API, I handle frontend"

Fun & Creative

🎴 Featured: AI Poker Night!

"Let Claude, Codex and Gemini play Dou Di Zhu (斗地主)!
 You deal the cards, everyone plays open hand!"

 🃏 Claude (Landlord)  vs  🎯 Codex + 💎 Gemini (Farmers)
  • "Play Gomoku with Codex"
  • "Debate: tabs vs spaces"
  • "Codex writes a function, Claude finds the bugs"

Advanced

  • "Codex designs architecture, Claude implements modules"
  • "Parallel code review from different angles"
  • "Codex implements, Gemini reviews, Claude coordinates"

Commands (For Developers)

Most users don't need these—Claude auto-detects collaboration intent.

Codex:

Command Description
cask-w <msg> Sync: wait for reply
cask <msg> Async: fire-and-forget
cpend Show latest reply
cping Connectivity check

Gemini:

Command Description
gask-w <msg> Sync: wait for reply
gask <msg> Async: fire-and-forget
gpend Show latest reply
gping Connectivity check

Requirements

  • Python 3.10+
  • tmux or WezTerm (at least one; WezTerm recommended)

⚠️ Windows Users: Always install WezTerm using the native Windows .exe installer from wezfurlong.org/wezterm, even if you use WSL. Do NOT install WezTerm inside WSL. After installation, configure WezTerm to connect to WSL via wsl.exe as the default shell. This ensures proper split-pane functionality.

Uninstall

./install.sh uninstall

中文

🎉 v2.1 新特性

🪟 全面支持 Windows — 通过 WezTerm WezTerm 现已成为所有平台的推荐终端。它是一个强大的跨平台终端,原生支持分屏。Linux/macOS 用户也推荐使用!当然短期tmux仍然支持。

  • ⚡ 响应更快 — 优化了发送/接收延迟,显著快于 MCP
  • 🐛 macOS 修复 — 修复了会话恢复和各种登录问题
  • 🔄 一键更新 — 运行 ccb update 即可更新,无需重新拉取安装

发现 bug?在项目目录运行 claude 调试,然后将 git diff 发给作者更新到主分支!


界面截图

双窗口协作界面
动图预览

为什么需要这个项目?

传统 MCP 调用把 Codex 当作无状态执行器——Claude 每次都要传递完整上下文。

ccb (Claude Code Bridge) 建立持久通道 轻量级发送和抓取信息, AI间各自维护独立上下文。

分工协作

角色 职责
Claude Code 需求分析、架构规划、代码重构
Codex 算法实现、bug 定位、代码审查
Gemini 研究、多角度分析、验证
ccb 会话管理、上下文隔离、通信桥接

官方 MCP vs 持久双窗口

维度 MCP(官方方案) 持久双窗口
Codex 状态 无记忆 持久会话
上下文 Claude 传递 各自维护
Token 消耗 5k-20k/次 50-200/次(速度显著提升)
工作模式 主从 并行协作
会话恢复 不支持 支持 (-r)
多AI 单目标 多后端

偏好 MCP? 推荐 CodexMCP — 更强大的 MCP 实现,支持会话上下文和多轮对话。

Token 节省原理
MCP 方式:
  Claude → [完整代码 + 历史 + 指令] → Codex
  消耗:5,000-20,000 tokens/次

双窗口方式(每次仅发送和抓取少量信息):
  Claude → "优化 utils.py" → Codex
  消耗:50-200 tokens/次
  (Codex 自己读取文件)

安装

git clone https://github.com/bfly123/claude_code_bridge.git
cd claude_code_bridge
./install.sh install

Windows

  • 推荐 WSL2: 在 WSL 内执行上面的命令即可。
  • 原生 Windows(PowerShell/CMD): 使用包装脚本:
    • install.cmd install
    • powershell -ExecutionPolicy Bypass -File .\\install.ps1 install(会提示选择 BackendEnv
  • 仅 WezTerm(无 tmux): 建议在 WezTerm 中运行 ccb,或设置 CCB_TERMINAL=wezterm(必要时设置 CODEX_WEZTERM_BIN=wezterm.exe)。

BackendEnv(Windows/WSL 必看)

ccb/cask-w 必须和 codex/gemini 在同一环境运行,否则可能出现:

  • exit code 127(找不到命令)
  • cpend/gpend 读不到回复(会话目录不同)

安装时的选择会写入 ccb_config.json(也可用环境变量 CCB_BACKEND_ENV 覆盖):

  • BackendEnv=wsl:codex/gemini 安装并运行在 WSL(如果你是在 WSL 里直接输入 codex 的场景,推荐选这个)
  • BackendEnv=windows:codex/gemini 为 Windows 原生 CLI

启动

ccb up codex            # 启动 Codex
ccb up gemini           # 启动 Gemini
ccb up codex gemini     # 同时启动
ccb up codex -r         # 恢复上次会话
ccb up codex -a         # 最高权限模式

会话管理

ccb status              # 检查后端状态
ccb kill codex          # 终止会话
ccb restore codex       # 连接到运行中的会话
ccb update              # 更新到最新版本

-a 为 Claude 启用 --dangerously-skip-permissions,Codex 启用 --full-auto
-r 基于当前目录下的本地文件恢复(.claude-session/.codex-session/.gemini-session);删除这些文件即可重置。

使用示例

实用场景

  • "让 Codex 审查我的代码修改"
  • "问问 Gemini 有没有其他方案"
  • "Codex 规划重构方案,我来实现它监督"
  • "Codex 写后端 API,我写前端"

趣味玩法

🎴 特色玩法:AI 棋牌之夜!

"让 Claude、Codex 和 Gemini 来一局斗地主!
 你来发牌,大家明牌玩!"

 🃏 Claude (地主)  vs  🎯 Codex + 💎 Gemini (农民)
  • "和 Codex 下五子棋"
  • "辩论:Tab vs 空格"
  • "Codex 写函数,Claude 找 bug"

进阶工作流

  • "Codex 设计架构,Claude 实现各模块"
  • "两个 AI 从不同角度并行 Code Review"
  • "Codex 实现,Gemini 审查,Claude 协调"

命令(开发者使用)

普通用户无需使用这些命令——Claude 会自动检测协作意图。

Codex:

命令 说明
cask-w <消息> 同步:等待回复
cask <消息> 异步:发送即返回
cpend 查看最新回复
cping 测试连通性

Gemini:

命令 说明
gask-w <消息> 同步:等待回复
gask <消息> 异步:发送即返回
gpend 查看最新回复
gping 测试连通性

依赖

  • Python 3.10+
  • tmux 或 WezTerm(至少安装一个),强烈推荐 WezTerm

⚠️ Windows 用户注意: 必须使用 Windows 原生 .exe 安装包 安装 WezTerm(下载地址),即使你使用 WSL 也是如此。不要在 WSL 内部安装 WezTerm。安装完成后,可在 WezTerm 设置中将默认 shell 配置为 wsl.exe,即可无缝接入 WSL 环境,同时保证分屏功能正常工作。

卸载

./install.sh uninstall

WSL2 supported | WSL1 not supported (FIFO limitation)


测试用户群,欢迎大佬们

WeChat Group

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 80.1%
  • Shell 13.9%
  • PowerShell 5.9%
  • Batchfile 0.1%