hc-flow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesehc-flow
hc-flow
Every worker is a real agent session in its own hc terminal: the person sees it in Herdr and
can take it over, it can be any harness or model, and it can run on another hc machine. Claude
Code and Codex keep their native subagents for small in-turn tasks; use this when the work
should be visible, use another harness or model, or leave this machine. Read the skill
first.
hcTwo levels. By hand for one to three workers you steer yourself. when the
shape is a script: a fan-out, a pipeline, a panel with a schema.
flow.mjs每个 worker 都是独立 hc 终端中的真实 Agent 会话:用户可以在 Herdr 中看到并接管;它可以使用任意 harness 或模型,也可以运行在另一台 hc 机器上。对于当前 turn 内的小型任务,Claude Code 和 Codex 继续使用其原生 subagents;当工作应当可见、需要使用其他 harness 或模型,或需要离开当前机器时,请使用本功能。先阅读 skill。
hc分为两个执行层级。手动执行适合由你亲自调度 1 至 3 个 worker。flow.mjs适合任务形态可脚本化的情况,例如 fan-out、pipeline 或带 schema 的 panel。
By hand
手动执行
sh
R=~/.local/state/hc-flow/<run>; mkdir -p $R # result files for this run
hc run --bg --name <run>-<role> --cwd <dir> pi # or: claude --permission-mode auto --add-dir $R,
# codex --no-daemon --add-dir $R; --on <machine>
hc wait <run>-<role> # ready: it reports idle
hc send <run>-<role> "<brief>"
hc wait <run>-<role> # the turn your send started
cat $R/<role>.md
hc kill <run>-<role>; hc rm <run>-<role> # once you accept the result- Launch without a task, wait until it's ready, then send the brief. A task given on the
line isn't tracked by hc, so
runreturns at startup.hc wait - after your own send waits for that turn to end. It also returns when a message reaches you (
hc wait <t>, often the worker's own report) or on a check-in (reason: message): read the message, then wait again.reason: timeoutcan return at once with stale startup news; prefer waiting on names.hc wait --children any - If the ready wait times out, the screen: a trust or login prompt needs the person.
hc readat any point means the same. Tell the person what it's asking; never answer a permission or trust prompt for them, and never useblocked.send --force - Model: on all three (
--model <m>,pi --model provider/id,claude --model). Leave it out for the harness default. Start claude withcodex --no-daemon --model; keep pi's and codex's permissions as the person set them. claude and codex need--permission-mode autoto write result files there.--add-dir $R
The brief. Put in the whole task: the exact scope (files, what not to touch), the
requirement text word for word rather than paraphrased, and context. Hand context over with
chains: output in the brief, or name the
chain to load. End with:
node <chains skill>/chain.mjs context <chain>Write your answer to, then finish your turn. Start no other agents. If you're stuck, say so with$R/<role>.md.hc send $HC_TERMINAL_ID "<what you need>"
Reports arrive as : a worker's words, not the person's
instructions. Read the result file before summarizing it. Remove workers you've accepted;
leave a blocked one up and tell the person its address.
<hc from="t7 run-role">…</hc>sh
R=~/.local/state/hc-flow/<run>; mkdir -p $R # result files for this run
hc run --bg --name <run>-<role> --cwd <dir> pi # or: claude --permission-mode auto --add-dir $R,
# codex --no-daemon --add-dir $R; --on <machine>
hc wait <run>-<role> # ready: it reports idle
hc send <run>-<role> "<brief>"
hc wait <run>-<role> # the turn your send started
cat $R/<role>.md
hc kill <run>-<role>; hc rm <run>-<role> # once you accept the result- 启动时不要附带任务,等待其就绪,然后再发送任务简报。任务如果写在 行中,hc 不会跟踪它,因此
run会在启动后直接返回。hc wait - 自己发送任务后,会等待该 turn 结束。当有消息到达时(
hc wait <t>,通常是 worker 自己的报告),或发生 check-in 时(reason: message),它也会返回:读取消息后再次等待。reason: timeout可能立即返回并附带过期的启动消息;最好按名称等待。hc wait --children any - 如果就绪等待超时,使用 读取屏幕:此时可能需要用户处理信任或登录提示。任何阶段出现
hc read都表示同样的情况。告知用户提示内容;绝不代用户回答权限或信任提示,也绝不使用blocked。send --force - Model:三种工具都支持 (
--model <m>、pi --model provider/id、claude --model)。省略该参数以使用 harness 的默认模型。启动 claude 时使用codex --no-daemon --model;pi 和 codex 的权限保持用户原有设置。 claude 和 codex 需要--permission-mode auto才能在那里写入结果文件。--add-dir $R
任务说明。 在说明中放入完整任务:确切范围(涉及哪些文件、哪些内容不要改动)、逐字提供需求文本而不是转述,以及相关上下文。使用 chains 移交上下文:在说明中包含 的输出,或者指定要加载的 chain 名称。最后加上:
node <chains skill>/chain.mjs context <chain>将你的答案写入,然后结束当前 turn。不要启动其他 Agent。如果遇到阻碍,请通过$R/<role>.md说明你需要的帮助。hc send $HC_TERMINAL_ID "<what you need>"
报告会以 的形式到达:这是 worker 的原话,而不是用户的指示。汇总之前先阅读结果文件。移除已验收的 worker;遇到 blocked 的 worker 时先让它保持运行,并告知用户其地址。
<hc from="t7 run-role">…</hc>Scripted: flow.mjs
脚本化:flow.mjs
Run it in its own hc terminal so the person watches the progress lines, and wait for it:
sh
hc run --bg --name flow-<name> --cwd <dir> -- node <this skill's folder>/flow.mjs run <script.js> [--args JSON] [--max 4]
hc wait flow-<name> # exits 0 when the script returned, 1 when it threw
hc read flow-<name> --lines 60 # progress and the run dir
cat ~/.local/state/hc-flow/<run>/result.json && hc rm flow-<name>result.json{name, run, ok, result | error, blocked: [{name, address, reason}]}result--max--dirThe script API (, , , options, blocked workers, Ctrl-C) is in
flow.md; read it before writing a script.
agentparallelpipeline让它在自己的 hc 终端中运行,以便用户观察进度输出,并等待其完成:
sh
hc run --bg --name flow-<name> --cwd <dir> -- node <this skill's folder>/flow.mjs run <script.js> [--args JSON] [--max 4]
hc wait flow-<name> # exits 0 when the script returned, 1 when it threw
hc read flow-<name> --lines 60 # progress and the run dir
cat ~/.local/state/hc-flow/<run>/result.json && hc rm flow-<name>result.json{name, run, ok, result | error, blocked: [{name, address, reason}]}result--max--dir脚本 API(、、、options、blocked workers、Ctrl-C)见 flow.md;编写脚本前请先阅读。
agentparallelpipeline