workflow

workflow is a command for coding agents from alvis-HaoH/gkd. It costs 50 tokens per session (1,287 once invoked), scanned A, original, MIT.

A command that turns a list of similar tasks into a workflow, giving each item its own separate model process to handle in parallel.

In plain words
What is it for?
Use it to process batches such as converting many files, reviewing modules, or handling paths from a folder, file pattern, Git changes, or an explicit list.
Why use it?
It keeps the main conversation from having to load and manage every file or module at once. This can reduce context use when many items need the same treatment.

Command

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the gkd plugin — 7 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/alvis-haoh/gkd/workflow
Clone the repo
git clone --depth 1 https://github.com/alvis-HaoH/gkd

Or install gkd, the plugin that ships this one along with the rest of its 7 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for workflow

README.md
[![agentmods](https://agentmods.dev/badge/commands/alvis-haoh/gkd/workflow.svg)](https://agentmods.dev/commands/alvis-haoh/gkd/workflow)
Your own site
<a href="https://agentmods.dev/commands/alvis-haoh/gkd/workflow"><img src="https://agentmods.dev/badge/commands/alvis-haoh/gkd/workflow.svg" alt="Measured on agentmods" height="20"></a>
Per session 50 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,287 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00050 $0.01287
Opus 5 $0.00025 $0.00643
Sonnet 5 $0.00010 $0.00257
Haiku 4.5 $0.00005 $0.00129

Measured 3d ago against content hash d131e013c889, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

workflow scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/workflow.md · 48 lines

How it starts

The opening of the file, as written. The whole thing — 48 lines — stays where its author put it; the contents beside it link to each section on GitHub.

把用户的批量委派需求编排成 dynamic workflow,每个 item 一个换脑子进程并行处理。 批量委派的意义就是别让主上下文承担 N 个文件的开销:你拿到要处理的路径列表、编排好,读写实活交给子进程自己。

原始参数:$ARGUMENTS

怎么做

  1. 识别 items 来源 + 任务模板:从用户描述里找出 items(glob、目录、git diff 列表、明确列表)和"对每个 item 做什么"。描述含糊就用 AskUserQuestion 问清。用 Glob/Bash(git:*) 拿路径列表(item 数 ≤ 200 通常 OK,过多问用户是否分批)。

  2. 选模型(默认从简):

    • 用户显式传 --<modelKey> → 全批锁定该模型。
    • 同构批量(N 个文件相同改动)→ 默认统一一个便宜的能胜任模型最简单稳妥,不必逐 item 折腾。
    • item 明显异构(部分含图片、部分高难、部分普通改写)才按 item 分模型,别在脚本里写死模型名。含图片的 item 只能派给支持视觉的模型:!node "${CLAUDE_PLUGIN_ROOT}/scripts/gkd-runtime.mjs" --list-vision
    • worker/verifier 角色分工:若任务是"改 + 验"两步,让 worker(便宜模型干活)和 verifier(另一模型把关/换视角)走不同模型是有价值的。
  3. 写 workflow 脚本。注意 Workflow 脚本运行时没有 bash() hook,也不能直接跑 shell;agent() 的 model 参数又只认 Claude 系标识符,换不了第三方模型脑。所以换脑只能这样链接:agent() 起一个轻量启动器子代理(用便宜的 haiku,活只是跑一条命令拿回 JSON),让它用 Bash 工具调 gkd-runtime.mjs——真正换脑发生在 runtime spawn 的子进程那层(三方模型在那里干活、token 隔离)。

    核心 stage 形如(pickModel 按上面策略算 runtime 的 --<modelKey>,不是写死;--write 用户传了才加):

    const results = await pipeline(
      items,
      item => agent(
        `用 Bash 工具执行这条命令,把它的 stdout 原样作为你的最终输出返回,不要加任何解释:\n` +
        `node "${CLAUDE_PLUGIN_ROOT}/scripts/gkd-runtime.mjs" ${pickModel(item)} --json "<任务模板里的 {{item}} 替换成实际路径>"`,
        { model: 'haiku', label: `gkd:${item}` }
      ).then(out => JSON.parse(out))
    )
    

    启动器用 haiku或sonnet 是因为它只是中转(spawn + 回传),不该烧贵模型;干实活的模型在 runtime 子进程里。并发度用 Workflow tool 默认,不用手设。

    长任务超时:runtime 对每个委派子进程有默认 30 分钟超时兜底,到点杀掉归一成失败。批量里单个 item 预计会超 30 分钟(逐文件长生成、重活改动)时,把环境变量拼在命令最前面提高/关闭上限,否则该 item 会在 30 分钟被杀、记失败:GKD_TIMEOUT_MS=3600000 node "${CLAUDE_PLUGIN_ROOT}/scripts/gkd-runtime.mjs" ...(1 小时),或 GKD_TIMEOUT_MS=0(禁用)。注意这是单个子进程的时限,不是整个 workflow 的;常规同构小批量用默认即可。

    思考强度 --effort(none/low/medium/high/xhigh/max,claude/codex 通用):直接拼在 runtime 命令里即可,支持三种粒度——① 整批统一:每条命令都带同一个 --effort xhigh;② 按 item:pickModel 那样另写个 pickEffort(item) 按难度返回不同档(难 item 用 max、普通用默认不带);③ 按角色:worker stage 不带(省钱)、verifier stage 带 --effort high(把关更严)。用户说"都仔细想""难的那批深想""验证环节用 high"之类就据此拼。

  4. 汇报:总数/成功/失败,失败 item 连错误原文列出。成功产出已落盘(--write)或在 result 里,不必全贴。

Read the full file on GitHub · 48 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 48 lines · 50 tokens per session scan A d131e013c889

Subscribe to this mod's changes

workflow is a command published in the GitHub repository alvis-HaoH/gkd (10 stars, last pushed 1mo ago), licensed MIT. It adds 50 tokens to every session and 1,287 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.