Claude-hook-comms hcom-workflow-scripts
install
source · Clone the upstream repo
git clone https://github.com/aannoo/hcom
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/aannoo/hcom "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/hcom-workflow-scripts" ~/.claude/skills/aannoo-claude-hook-comms-hcom-workflow-scripts && rm -rf "$T"
manifest:
skills/hcom-workflow-scripts/SKILL.mdsource content
hcom workflow scripts
build custom multi-agent workflow scripts that launch, coordinate, and manage AI coding agents via hcom.
decision tree
- write a new script → use the script template below + read
references/script-template.md - choose a multi-agent pattern → read
references/patterns.md - need hcom architecture details → read
references/architecture.md - cross-tool scripting (claude + codex) → read
references/cross-tool-scripting.md - debug a script → read
references/debugging.md - want pre-built scripts → check
directoryreferences/scripts/
script template
every hcom workflow script follows this structure:
#!/usr/bin/env bash # description shown in `hcom run` listing. set -euo pipefail LAUNCHED_NAMES=() track_launch() { local names=$(echo "$1" | grep '^Names: ' | sed 's/^Names: //') for n in $names; do LAUNCHED_NAMES+=("$n"); done } cleanup() { for name in "${LAUNCHED_NAMES[@]}"; do hcom kill "$name" --go 2>/dev/null || true done } trap cleanup ERR name_flag="" task="" while [[ $# -gt 0 ]]; do case "$1" in --name) name_flag="$2"; shift 2 ;; -*) shift ;; *) task="$1"; shift ;; esac done name_arg="" [[ -n "$name_flag" ]] && name_arg="--name $name_flag" thread="workflow-$(date +%s)" # --- your workflow logic --- # launch agent launch_out=$(hcom 1 claude --tag worker --go --headless \ --hcom-prompt "task: ${task}. when done: hcom send \"@reviewer-\" --thread ${thread} --intent inform -- \"DONE: <result>\". then: hcom stop" 2>&1) track_launch "$launch_out" worker=$(echo "$launch_out" | grep '^Names: ' | sed 's/^Names: //' | tr -d ' ') # wait for signal hcom events --wait 120 --sql "type='message' AND msg_thread='${thread}' AND msg_text LIKE '%DONE%'" $name_arg >/dev/null 2>&1 # cleanup trap - ERR for name in "${LAUNCHED_NAMES[@]}"; do hcom kill "$name" --go 2>/dev/null || true; done
place scripts in
~/.hcom/scripts/ as .sh or .py. run with hcom run <name> "task".
agent topologies
| topology | agents | hcom primitives |
|---|---|---|
| worker-reviewer | 2 | worker sends result, reviewer reads transcript, sends APPROVED/FIX |
| pipeline | N sequential | each stage reads previous via , signals via thread |
| ensemble | N+1 (judge) | N agents answer independently, judge reads all via |
| hub-spoke | 1+N | coordinator broadcasts to , workers report back |
| reactive | N | triggers agent actions on file edits/status changes |
communication primitives
| what | how | latency |
|---|---|---|
| send message | | under 1s (claude), 1-3s (codex) |
| wait for signal | | under 1s after match |
| read agent's work | | under 1s |
| react to file changes | | under 2s |
| react to agent idle | | under 2s |
| cross-device | | 1-5s |
| structured handoff | | under 1s |
required flags for script launches
| flag | why it's required |
|---|---|
| skips confirmation prompt — without it, script hangs forever |
| runs agent as detached background process |
| groups agents for routing (essential for scripts) |
| sets the agent's initial task |
key rules
- never use
— usesleep
orhcom events --waithcom listen - never hardcode agent names — parse from
in launch outputgrep '^Names: ' - always use
— without it, messages leak across workflows--thread - always use
— orphan headless agents run indefinitelytrap cleanup ERR - always use
for cleanup (nothcom kill
) — kill also closes the terminal panestop - always forward
— hcom injects it, scripts must propagate it--name - wait for codex before messaging —
hcom events --wait 30 --idle "$codex_name"
timing reference (measured)
| operation | claude | codex |
|---|---|---|
| launch to ready | 3-5s | 5-10s |
| message delivery | under 1s | 1-3s |
| transcript read | under 1s | under 1s |
| full 2-agent round-trip | 15-25s | 25-40s |
| full 4-agent ensemble | 25-35s | n/a |
integration with external systems
hcom scripts are bash — they can call any CLI tool:
# ci/cd trigger hcom send @worker- --from "github-actions" -- "PR merged, deploy" # webhook notification curl -X POST $WEBHOOK -d "$(hcom events --sql "msg_thread='${thread}'" --last 5)" # pipe output echo "complex task description" | hcom send @worker-
reference files
| file | when to read |
|---|---|
| writing a new script from scratch — full template with commentary |
| choosing and implementing multi-agent patterns — 6 tested examples |
| understanding hcom internals — db schema, hooks, delivery pipeline, events |
| claude + codex mixed scripts — per-tool quirks, timing, session binding |
| fixing broken scripts — common failures, stale agents, message delivery |
| tested: two agents exchange messages |
| tested: worker-reviewer feedback loop |
| tested: claude architect + codex engineer |
| tested: 3 independent agents + judge |
| tested: sequential plan then execute pipeline |
| tested: codex codes, claude reviews transcript |