a2a-bridge
CLAUDE.md9 starsChanged 8 months agoMITView on GitHub
a2a-bridge is a bidirectional bridge between Claude Code and other AI coding agents (Codex, OpenClaw, Hermes, ...) built on the Claude Code Channels protocol. Modelled after raysonmeng/agent-bridge but designed from day one for: Everything stored in this git repo MUST be in English: English-language documentation targeted at readers of the repo lives under docs/ and is committed (cookbook, runbooks, subsystem guides). Chinese-language scratchpads — local design notes, meeting memos, translation drafts — live under docs-cn/, which is git-ignored (see .gitignore)…
- Reads credentials
- Commits and pushes
In this repository3 other files it gives its agents.
- context-protectSkill
- parallelSkill
- verifySkill
The file
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 57
Import tsconfig aliases — prefer these over relative paths when crossing directory boundaries:
- Distinctive: line 91
When adding a file, ask: which runtime does this run inside?
- Very specific: line 96
All changes land on dev, never directly on main
- Very specific: line 99
Never commit secrets (tokens, private keys, .env files)
- Very specific: line 107
Before publishing, the maintainer must confirm: a2a-bridge --version shows the new version, a2a-bridge daemon start starts the daemon, and …
- Distinctive: line 126
If the loop encounters a task that appears to require changing any of these, it must stop, commit current progress, and notify the user via …
- Very specific: line 150
Run bun run check:ci. On failure, debug the task or stop.
- Distinctive: line 151
Commit with a descriptive message and the Co-Authored-By footer.
- Distinctive: line 155
If the phase is complete, stop and wait for human ack before starting the next phase.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md — a2a-bridge
Project
a2a-bridge is a bidirectional bridge between Claude Code and other AI coding agents (Codex, OpenClaw, Hermes, ...) built on the Claude Code Channels protocol. Modelled after raysonmeng/agent-bridge but designed from day one for:
- Pluggable peer adapters (one adapter per target agent)
- Multi-machine deployment (daemon on one host, CC on another)
- Multi-room / concurrent CC sessions
Language policy — strict
Everything stored in this git repo MUST be in English:
- Source code, including variable names and string literals
- All code comments
- Commit messages (subject and body)
- Pull request titles and descriptions
- Issue titles and bodies
- File and directory names
- README, ARCHITECTURE, ROADMAP, and any other top-level docs
English-language documentation targeted at readers of the repo lives under docs/ and is committed (cookbook, runbooks, subsystem guides). Chinese-language scratchpads — local design notes, meeting memos, translation drafts — live under docs-cn/, which is git-ignored (see .gitignore) and must never be committed.
Rationale: this is an open-source project targeting a global audience. Mixed-language repos fragment the reader base and confuse grep, so the committed tree stays English-only; docs-cn/ exists to keep the local workflow useful without polluting the repo.
Stack
- TypeScript, Bun runtime (matches upstream
agent-bridge) - MIT license
- Two-process topology: foreground MCP plugin + persistent daemon
- Peer adapters implement a common
IPeerAdapterinterface
Architecture constraints — enforced
The src/ tree is organized by runtime + domain, not by abstract
"layer number":
src/
shared/ zero-dep utilities (state-dir, daemon-lifecycle, config-service, logger)
messages/ shared value objects (BridgeMessage, ...)
transport/ plugin <-> daemon control plane
runtime-plugin/ code that runs inside the Claude Code MCP plugin
claude-channel/ MCP channel adapter
daemon-client/ client side of the control plane
bridge.ts plugin process entrypoint
runtime-daemon/ code that runs inside the persistent daemon
peers/ outbound peer adapters (codex, openclaw, hermes)
inbound/ A2A server exposing Claude Code to external clients
rooms/ RoomRouter
tasks/ Task lifecycle + storage
daemon.ts daemon process entrypoint
cli/ user-facing CLI; composition root for integration testsImport tsconfig aliases — prefer these over relative paths when crossing directory boundaries:
| Alias | Maps to |
@shared/* | src/shared/* |
@messages/* | src/messages/* |
@transport/* | src/transport/* |
@plugin/* | src/runtime-plugin/* |
@daemon/* | src/runtime-daemon/* |
Dependency rules (checked by bun run lint:deps, enforced in CI):
shared/andmessages/stay pure — they cannot import from any other layer.transport/cannot reach intoruntime-plugin/,runtime-daemon/, orcli/.runtime-plugin/andruntime-daemon/cannot import each other. They communicate only throughtransport/andmessages/.- Peer adapters (
runtime-daemon/peers/codex/,.../openclaw/,.../hermes/) cannot import each other. inbound/andpeers/cannot reach into each other's concrete implementations — the meeting point isrooms/.- Production code cannot import from
*.test.ts. - Unreferenced ("orphan") modules trigger a warning so we clean them up.
Why these rules exist: the plugin and daemon run in separate processes, possibly on separate machines. Code that forgets that distinction creates runtime crashes, not just type errors. Similarly, peer adapters must be independently swappable — cross-adapter imports make it impossible to split them into plugins later.
When adding a file, ask: which runtime does this run inside? That answer determines the directory; the rules enforce the rest.
Git workflow
- All changes land on
dev, never directly onmain git push origin dev, then open a PR to merge intomain- Never force-push
main - Never commit secrets (tokens, private keys,
.envfiles)
Publishing rules — iron law
- Never
npm publishwithout explicit human confirmation. Fix → verify locally → ask the maintainer to confirm on their machine → only then publish. Rushing a patch version costs more credibility than a slow fix. - Before publishing, the maintainer must confirm:
a2a-bridge --versionshows the new version,a2a-bridge daemon startstarts the daemon, anda2a-bridge claudeloads the plugin. - This rule overrides any urgency from the autonomous loop or Telegram requests. "发版" / "publish" is always a human gate.
Autonomous-mode rules
Some work on this repo runs under /loop or a scheduled agent with
no human in the driver's seat for hours at a time. When operating in
that mode, the following files are read-only and must not be
edited by the loop:
CLAUDE.mddocs/design/architecture.mddocs/design/positioning.mddocs/design/roadmap.md.dependency-cruiser.cjs
If the loop encounters a task that appears to require changing any of these, it must stop, commit current progress, and notify the user via Telegram rather than modify them. Constraint changes are design discussions, not autonomous edits.
The loop must also stop and notify when:
bun run check:cifails (typecheck, lint:deps, unit tests, or build) and the failure is not cleanly attributable to the task in hand.- A dependency-cruiser rule would need to be relaxed to land the task.
- The task as described in
TASKS.mdis ambiguous or contradicts something indocs/design/architecture.md/docs/design/positioning.md. - Any change would touch external accounts, secrets, infrastructure,
or the
mainbranch.
Per-iteration checklist the loop follows, top of file:
git pull origin dev.- Re-read
docs/design/architecture.md,docs/design/positioning.md,CLAUDE.md,docs/design/roadmap.md,TASKS.md. - Pick the next unchecked atomic task from
TASKS.md. - Implement it with the minimum diff.
- Run
bun run check:ci. On failure, debug the task or stop. - Commit with a descriptive message and the Co-Authored-By footer.
- Push
dev. - Mark the task as done in
TASKS.md; commit and push. - Send a one-line Telegram update.
- If the phase is complete, stop and wait for human ack before starting the next phase.
References (read-only)
Upstream repos cloned under the parent workspace's references/ directory:
references/agent-bridge— the CC↔Codex prototype we are generalizingreferences/claude-plugins-official— Anthropic's official channel plugin examples (telegram, fakechat are the best references)references/gemini-cli— Gemini CLI source (A2A client consumer)references/openclaw— OpenClaw source (peer adapter target)references/hermes-agent— Hermes ACP source (peer adapter target)
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
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.

