<- back to cases
JavaScript/MIT

Codex ↔ ZCode Remote Relay

让多个 AI 协作听起来很美,做起来全是协调成本——谁负责什么、中间怎么交接、错了谁背锅、上下文怎么隔离,全是要自己造的轮子。这套本地中继让 Codex 和 ZCode 像一支有分工的团队:主代理分任务、子代理并行执行、每个任务有边界(不允许碰什么、最多跑多久、失败了怎么收尾),整个过程可审计、可中断、可恢复。整套系统不到 1000 行代码,单机就能跑,没有云依赖。适合需要把 AI 协作从「玩具演示」推进到「生产级流水线」的工程团队。

stars
0
commits
1
size
75 KB
lines of code
< 1k
Codex ↔ ZCode Remote Relay — generated poster
OG POSTERcase file
case study
problem

Multi-agent coding sounds simple until ownership, model selection, cost control, job recovery, and conflicting edits all become operational problems.

approach

I built a local relay protocol where Codex schedules bounded tasks, ZCode workers execute them, and Codex reviews results through explicit ledgers and validation gates.

outcome

The system turned ad hoc assistant handoffs into an auditable local worker loop with job ids, model routing, status collection, and acceptance decisions.

my role
  • 01Designed the commander/worker protocol and safety rules.
  • 02Built the Node.js relay scripts for dispatch, status, collection, and pool reporting.
  • 03Validated the workflow on real coding tasks with explicit acceptance gates.
why it matters

Expensive models should be quota-managed. The relay protocol lets a Codex orchestrator delegate bounded sub-tasks to a pool of ZCode workers — the orchestrator keeps the high-level plan, workers burn the tokens.

architecture

JSON-RPC over local WebSocket. The orchestrator posts a plan; workers claim tasks, run them, and stream results back. Safety gates (allowlist of action types, max token budget per task) are enforced on the relay, not the workers.

notes
  • 01Bounded delegation — workers can only execute actions in the safety allowlist; no arbitrary file system access.
  • 02Token budget per task — relay aborts and rolls back if a worker exceeds the budget.
  • 03Stateless workers — any worker can pick up any task; horizontal scaling is a config change.
stack
Node.js 24
Relay + worker runtime
JSON-RPC 2.0
Transport protocol
WebSocket
Streaming channel
headline
lines of code
< 1k
repo
75 KB