hcom-agent-messaging
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesehcom — multi-agent communication for AI coding tools
hcom — 面向 AI 编程工具的多 Agent 通信
AI agents running in separate terminals are isolated. hcom connects them via hooks and a shared database so they can message, watch, and spawn each other in real-time.
If the user wants a quick operating pattern from the current session, one headed hub with mostly headless workers, or practical thread and handoff defaults, use the separate skill instead of this one.
using-hcombash
curl -fsSL https://github.com/aannoo/hcom/releases/latest/download/hcom-installer.sh | sh
hcom claude # or: hcom gemini, hcom codex, hcom opencode
hcom # TUI dashboard运行在不同终端中的 AI Agent 彼此隔离。hcom 通过 hooks 和共享数据库将它们连接起来,使它们能够实时地互相发送消息、观察并 spawn 彼此。
如果用户希望快速获取当前会话的操作模式、使用一个 headed hub 搭配大多数 headless workers,或了解实用的 thread 和 handoff 默认设置,请改用单独的 skill。
using-hcombash
curl -fsSL https://github.com/aannoo/hcom/releases/latest/download/hcom-installer.sh | sh
hcom claude # or: hcom gemini, hcom codex, hcom opencode
hcom # TUI dashboardwhat humans can do
人类可以做什么
tell any agent:
send a message to claude
when codex goes idle send it the next task
watch gemini's file edits, review each and send feedback if any bugs
fork yourself to investigate the bug and report back
find which agent worked on terminal_id code, resume them and ask why it sucks
告诉任意 Agent:
向 claude 发送消息
当 codex 空闲时,给它发送下一个任务
监听 gemini 的文件编辑,逐一审查并发送反馈(如果发现 bug)
fork 你自己,以调查该 bug 并汇报结果
找出哪个 Agent 处理过 terminal_id 对应的代码,恢复它并询问它为什么写得一塌糊涂
what agents can do
Agent 可以做什么
Message each other in real-time, bundle context for handoffs.
Observe each other: transcripts, file edits, terminal screens, command history.
Subscribe to each other: notify on status changes, file edits, specific events. React automatically.
Spawn, fork, resume, kill each other, in any terminal emulator.
run for full command syntax and flags.
hcom --helpMessage:实时地互相发送消息,为 handoff 汇总上下文。
Observe:观察彼此的 transcripts、文件编辑、终端屏幕和命令历史。
Subscribe:订阅彼此;在状态变化、文件编辑或特定事件发生时收到通知,并自动作出反应。
Spawn、Fork、Resume、Kill:在任何 terminal emulator 中互相执行这些操作。
运行 查看完整的命令语法和 flags。
hcom --helptool support
工具支持
| tool | delivery | connect |
|---|---|---|
| claude code (incl. subagents) | automatic | |
| gemini cli (>= 0.26.0) | automatic | |
| codex | automatic | |
| opencode | automatic | |
| any other ai tool | manual via | |
session binding (hcom transcript, hcom r/f by session id) happens on first message or first prompt for all hcom-launched tools.
| 工具 | 消息投递 | 连接方式 |
|---|---|---|
| claude code(包括 subagents) | 自动 | |
| gemini cli(>= 0.26.0) | 自动 | |
| codex | 自动 | |
| opencode | 自动 | |
| 任何其他 AI 工具 | 通过 | |
对于所有通过 hcom 启动的工具,session binding(hcom transcript、按 session id 执行的 hcom r/f)会在首次收到消息或首次收到提示时完成。
setup
设置
if the user invokes this skill without arguments:
- run — if "command not found", install first:
hcom statusbashcurl -fsSL https://github.com/aannoo/hcom/releases/latest/download/hcom-installer.sh | sh - run to install hooks for all detected tools
hcom hooks add - restart the AI tool for hooks to activate
| status output | meaning | action |
|---|---|---|
| command not found | not installed | install via |
| tool exists, hooks not installed | |
| hooks installed | ready |
| tool not found | install the AI tool first |
如果用户调用此 skill 时未提供参数:
- 运行 — 如果显示“command not found”,请先安装:
hcom status
bash
curl -fsSL https://github.com/aannoo/hcom/releases/latest/download/hcom-installer.sh | sh- 运行 ,为所有检测到的工具安装 hooks
hcom hooks add - 重启 AI 工具以激活 hooks
| 状态输出 | 含义 | 操作 |
|---|---|---|
| command not found | 未安装 | 通过 |
| 工具存在,但未安装 hooks | 执行 |
| 已安装 hooks | 已就绪 |
| 找不到该工具 | 请先安装 AI 工具 |
troubleshooting
故障排查
"hcom not working"
“hcom 无法工作”
bash
hcom status # check installation
hcom hooks status # check hooks specifically
hcom relay status # check cross-device relayhooks missing? then restart tool.
hcom hooks addstill broken?
bash
hcom reset all && hcom hooks addbash
hcom status # check installation
hcom hooks status # check hooks specifically
hcom relay status # check cross-device relay缺少 hooks?执行 ,然后重启工具。
hcom hooks add仍然有问题?
bash
hcom reset all && hcom hooks addclose all ai tool windows
close all ai tool windows
hcom claude # fresh start
undefinedhcom claude # fresh start
undefined"messages not arriving"
“消息未送达”
| symptom | diagnosis | fix |
|---|---|---|
agent not in | agent stopped or never bound | relaunch or wait for binding |
| message sent but not delivered | check | verify @mention matches agent name/tag |
| wrong agent receives message | @mention ambiguity | use |
| messages leaking between workflows | no thread isolation | always use |
| 症状 | 诊断 | 修复 |
|---|---|---|
Agent 不在 | Agent 已停止或从未绑定 | 重新启动,或等待绑定完成 |
| 消息已发送但未送达 | 检查 | 确认 @mention 与 Agent 名称/tag 完全匹配 |
| 错误的 Agent 收到了消息 | @mention 存在歧义 | 使用 |
| 消息在不同工作流之间泄漏 | 没有 thread 隔离 | 始终使用 |
intent system
intent 系统
agents follow these rules from their bootstrap:
- -> agent always responds
--intent request - -> agent responds only if useful
--intent inform - -> agent does not respond
--intent ack
Agent 会遵循其 bootstrap 中的以下规则:
- -> Agent 始终响应
--intent request - -> Agent 仅在有帮助时响应
--intent inform - -> Agent 不响应
--intent ack
thread mechanics
thread 机制
- a thread is a conversation namespace, not a fixed membership group
- @mentions on each individual message determine that message's delivery — the seed does not lock membership
- as broadcast (no @mentions) reuses the last-seed member list, but this is unreliable for hub routing
hcom send --thread X - the sender is never included in — if a hub creates a thread by sending
delivered_to, the hub is NOT a thread member@eng- @review- - to make the hub a thread member, include (the hub's CVCV name from the hcom system context) in the @mentions of the seed message
@<hub-name> - for important replies and final outcomes, workers should also explicitly — do not rely on broadcast routing to reach the hub
@<hub-name> - the hub discovers its CVCV name from the hcom system context () or via
Your name: <name>hcom list
- thread 是一个 conversation namespace,而不是固定的成员组
- 每条单独消息中的 @mentions 决定该消息的投递对象;seed 不会锁定成员资格
- 将 作为 broadcast(不带 @mentions)发送时,会复用最近一次 seed 的成员列表,但这种方式对 hub routing 不可靠
hcom send --thread X - 发送者绝不包含在 中——如果 hub 通过发送
delivered_to创建 thread,hub 并不是该 thread 的成员@eng- @review- - 要让 hub 成为 thread 成员,请在 seed 消息的 @mentions 中包含 (hub 在 hcom system context 中的 CVCV name)
@<hub-name> - 对于重要回复和最终结果,worker 也应明确 ——不要依赖 broadcast routing 将结果送达 hub
@<hub-name> - hub 可从 hcom system context()或
Your name: <name>中发现自己的 CVCV namehcom list
sandbox / permission issues
沙箱 / 权限问题
bash
export HCOM_DIR="$PWD/.hcom" # project-local mode
hcom hooks add # installs to project dirbash
export HCOM_DIR="$PWD/.hcom" # project-local mode
hcom hooks add # installs to project dir设置 后,将改用该路径,而不是 。
HCOM_DIR~/.hcomworkflow scripting
工作流脚本
place scripts in as or . run with . see for the full annotated template, or run inside an agent.
~/.hcom/scripts/.sh.pyhcom run <name> "task"references/script-template.mdhcom run docs --scripts将脚本放在 中,扩展名为 或 。使用 运行。有关完整的注释模板,请参阅 ;也可以在 Agent 内运行 。
~/.hcom/scripts/.sh.pyhcom run <name> "task"references/script-template.mdhcom run docs --scriptskey rules
关键规则
- never use — use
sleeporhcom events --waithcom listen - never hardcode agent names — parse from in launch output
grep '^Names: ' - always use — without it, messages leak across workflows
--thread - always use — orphan headless agents run indefinitely
trap cleanup ERR INT TERM - always use for cleanup (not
hcom kill) — kill also closes the terminal panestop - always forward — hcom injects it, scripts must propagate it
--name - always use on launch/kill — without it, scripts hang on confirmation prompt
--go
- 绝不要使用 ——改用
sleep或hcom events --waithcom listen - 绝不要硬编码 Agent 名称——从启动输出中的 解析
grep '^Names: ' - 始终使用 ——否则消息会在不同工作流之间泄漏
--thread - 始终使用 ——否则孤立的 headless Agent 会无限期运行
trap cleanup ERR INT TERM - 清理时始终使用 (不要使用
hcom kill)——stop还会关闭 terminal panehcom kill - 始终转发 ——hcom 会注入该参数,脚本必须继续传递它
--name - 启动或终止时始终使用 ——否则脚本会卡在确认提示上
--go
agent topologies
Agent 拓扑结构
| topology | agents | pattern |
|---|---|---|
| worker-reviewer | 2 | worker sends result, reviewer reads transcript, sends APPROVED/FIX |
| pipeline | N sequential | each stage reads previous via |
| ensemble | N+1 (judge) | N agents answer independently, judge reads all via |
| hub-spoke | 1+N | coordinator broadcasts to |
| reactive | N | |
| 拓扑 | Agent 数量 | 模式 |
|---|---|---|
| worker-reviewer | 2 | worker 发送结果,reviewer 读取 transcript,并发送 APPROVED/FIX |
| pipeline | N 个,按顺序执行 | 每个阶段通过 |
| ensemble | N+1(judge) | N 个 Agent 独立作答,judge 通过 |
| hub-spoke | 1+N | coordinator 向 |
| reactive | N | |
files
文件
| what | location |
|---|---|
| database | |
| config | |
| logs | |
| user scripts | |
with set, uses that path instead of .
HCOM_DIR~/.hcom| 内容 | 位置 |
|---|---|
| 数据库 | |
| 配置 | |
| 日志 | |
| 用户脚本 | |
设置 后,将改用该路径,而不是 。
HCOM_DIR~/.hcomreference files
参考文件
| file | when to read |
|---|---|
| writing multi-agent scripts — 6 tested patterns with full code and real event JSON |
| claude + codex + gemini + opencode collaboration details and per-tool quirks |
| debugging scripts — timing, message delivery, intent system, cleanup |
| writing a new script from scratch — full template with commentary |
| 6 tested, working example scripts |
| 文件 | 何时阅读 |
|---|---|
| 编写多 Agent 脚本——6 种经过测试的模式,包含完整代码和真实事件 JSON |
| claude + codex + gemini + opencode 的协作细节及各工具的疑难问题 |
| 调试脚本——时序、消息投递、intent 系统和清理问题 |
| 从头编写新脚本——带注释的完整模板 |
| 6 个经过测试且可正常运行的示例脚本 |
more info
更多信息
bash
hcom --help # all commands
hcom <command> --help # command detailsgithub: https://github.com/aannoo/hcom
bash
hcom --help # all commands
hcom <command> --help # command detailsgithub: https://github.com/aannoo/hcom