skills/hcom-workflow-scripts/SKILL.md
Build multi-agent workflow scripts using hcom. Use this skill when the user wants to create custom hcom scripts, design multi-agent pipelines, write automation that coordinates Claude and Codex agents, or build applications that use hcom as the communication backbone. Covers script patterns, agent topologies, hcom internals, and tested examples.
npx skillsauth add aannoo/hcom hcom-workflow-scriptsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
build custom multi-agent workflow scripts that launch, coordinate, and manage AI coding agents via hcom.
references/script-template.mdreferences/patterns.mdreferences/architecture.mdreferences/cross-tool-scripting.mdreferences/debugging.mdreferences/scripts/ directoryevery 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".
| topology | agents | hcom primitives |
|----------|--------|-----------------|
| worker-reviewer | 2 | worker sends result, reviewer reads transcript, sends APPROVED/FIX |
| pipeline | N sequential | each stage reads previous via hcom transcript, signals via thread |
| ensemble | N+1 (judge) | N agents answer independently, judge reads all via hcom events --sql |
| hub-spoke | 1+N | coordinator broadcasts to @tag-, workers report back |
| reactive | N | hcom events sub triggers agent actions on file edits/status changes |
| what | how | latency |
|------|-----|---------|
| send message | hcom send @name --thread T --intent X -- "msg" | under 1s (claude), 1-3s (codex) |
| wait for signal | hcom events --wait N --sql "..." | under 1s after match |
| read agent's work | hcom transcript @name --full --detailed | under 1s |
| react to file changes | hcom events sub --file "*.py" | under 2s |
| react to agent idle | hcom events sub --idle name | under 2s |
| cross-device | hcom send @name:DEVICE -- "msg" | 1-5s |
| structured handoff | hcom send --title X --transcript N-M:full --files a.py | under 1s |
| flag | why it's required |
|------|-------------------|
| --go | skips confirmation prompt — without it, script hangs forever |
| --headless | runs agent as detached background process |
| --tag X | groups agents for @X- routing (essential for scripts) |
| --hcom-prompt "..." | sets the agent's initial task |
sleep — use hcom events --wait or hcom listengrep '^Names: ' in launch output--thread — without it, messages leak across workflowstrap cleanup ERR — orphan headless agents run indefinitelyhcom kill for cleanup (not stop) — kill also closes the terminal pane--name — hcom injects it, scripts must propagate ithcom events --wait 30 --idle "$codex_name"| 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 |
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-
| file | when to read |
|------|-------------|
| references/script-template.md | writing a new script from scratch — full template with commentary |
| references/patterns.md | choosing and implementing multi-agent patterns — 6 tested examples |
| references/architecture.md | understanding hcom internals — db schema, hooks, delivery pipeline, events |
| references/cross-tool-scripting.md | claude + codex mixed scripts — per-tool quirks, timing, session binding |
| references/debugging.md | fixing broken scripts — common failures, stale agents, message delivery |
| references/scripts/basic-messaging.sh | tested: two agents exchange messages |
| references/scripts/review-loop.sh | tested: worker-reviewer feedback loop |
| references/scripts/cross-tool-duo.sh | tested: claude architect + codex engineer |
| references/scripts/ensemble-consensus.sh | tested: 3 independent agents + judge |
| references/scripts/cascade-pipeline.sh | tested: sequential plan then execute pipeline |
| references/scripts/codex-worker.sh | tested: codex codes, claude reviews transcript |
tools
Multi-agent communication for AI coding tools. Agents message, watch, and spawn each other across terminals. Use when setting up hcom, troubleshooting delivery, or writing multi-agent scripts.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------