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.
npx agentmods add commands/alvis-haoh/gkd/dogit clone --depth 1 https://github.com/alvis-HaoH/gkdWrote 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.
[](https://agentmods.dev/commands/alvis-haoh/gkd/do)<a href="https://agentmods.dev/commands/alvis-haoh/gkd/do"><img src="https://agentmods.dev/badge/commands/alvis-haoh/gkd/do.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00042 | $0.01310 |
| Opus 5 | $0.00021 | $0.00655 |
| Sonnet 5 | $0.00008 | $0.00262 |
| Haiku 4.5 | $0.00004 | $0.00131 |
Grade A, and why
do 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 51 lines — stays where its author put it; the contents beside it link to each section on GitHub.
把任务委派给指定模型,写模式——子进程获得 Read/Grep/Glob/Edit/Write/Bash 全权,可改文件、可执行命令。 委派的目的是把重活的 token 留在子进程,别搬回主上下文——给方向和路径,读写实活交给子进程。
原始参数(可能多行,含特殊字符):
$ARGUMENTS
怎么做
-
拣 flags:识别
--<modelKey>(见${CLAUDE_PLUGIN_ROOT}/config/models.json)、--with-context、--resume、--effort <档>、--json、--quiet。--write由命令自动加,不用让用户重复传。--effort(none/low/medium/high/xhigh/max)调思考强度,claude/codex 模型通用;用户说"深想一点/xhigh""快速点/别想太多"之类就补上。不传则各 harness 用自己的默认档。- 续历史会话并写:
/gkd:do --resume [<sessionId>] <补充>可续上次(或点名续某次)委派并给写权限(即使原会话是只读)。续接语义、sessionId 检索 SOP、UUID 误拣防范、--with-context互斥等规则,统一见commands/resume.md——此处不复述,避免两处漂移。
- 续历史会话并写:
-
选模型:
- 用户显式指定或自然语言提名("用 GPT 改")就用之;没说就自己判断挑一个合适的,拿不准就不传、让 runtime 用默认
- 视觉约束(须自觉遵守):任务涉及图片时,只能从这些支持视觉的模型里选:!
node "${CLAUDE_PLUGIN_ROOT}/scripts/gkd-runtime.mjs" --list-vision。 - 本机装了 codex CLI 时
--codex可用(走 codex harness、GPT 原生工具循环,不是又一个便宜模型;要 harness 差异 / 独立第二意见 / GPT-image生成时选它)。codex 也支持--with-context,首次会把当前对话导入成 codex thread(约 1-2s)。codex 写模式的两点差异务必知悉:① 写边界由 codex 自己的 sandbox(workspace-write)定义,不是 gkd 的 allowed-tools 粒度;② codex 写模式默认关闭网络——装库/联网命令(npm install、git fetch 等)会失败,这类任务别派给 codex。
-
--with-context自己判断:任务若回指了主对话里才有、任务文本没写清的信息,就加--with-context把主对话 fork 给子进程;任务完全自洽就不加;拿不准就用AskUserQuestion问用户(选项:带上对话历史 / 干净委派)。 -
跑(任务文本第一个非 flag token 起,保留所有换行):
node "${CLAUDE_PLUGIN_ROOT}/scripts/gkd-runtime.mjs" \
--write \
<拣出+补的 flags> \
"$(cat <<'__GKD_TASK_EOF__'
<把任务原文逐字粘进来,保留换行,不重排/总结/翻译>
__GKD_TASK_EOF__
)"
单引号 heredoc 终止符 + 外层 "$(...)" 让多行任务成为单个 argv 参数(裸用 $ARGUMENTS 会被 shell 拆成多条命令,别这么写)。
-
运行模式:默认
run_in_background: true。Bash 前台默认 2 分钟超时会杀子进程丢进度,而装库/批量改/多次 LLM 调用常超时。只有确信 < 30 秒(改单文件一两行)才前台,且必须传timeout: 600000,绝不用默认。不确定就后台。runtime 内部对委派子进程有默认 30 分钟超时兜底(防子进程僵死),到点 SIGTERM→SIGKILL 并归一成失败。若这次是预计会超 30 分钟的大任务(超大批量改、逐文件长生成),在 runtime 命令前加环境变量提高上限或关闭:
GKD_TIMEOUT_MS=3600000(1 小时)或GKD_TIMEOUT_MS=0(禁用),否则任务会在 30 分钟被杀、白烧 token。常规任务不用管,用默认即可。
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.
- 5d ago First seen · 51 lines · 42 tokens per session scan A f54104d8b24d
do is a command published in the GitHub repository alvis-HaoH/gkd (10 stars, last pushed 1mo ago), licensed MIT. It adds 42 tokens to every session and 1,310 once invoked, about $0.0002 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.
Other commands, from other repositories
OPSX: Fast Forward
Create a change and generate all artifacts needed for implementation in one go.
OPSX: Propose
Propose a new change - create it and generate all artifacts in one step.
OPSX: Sync
Sync delta specs from a change to main specs.
OPSX: Onboard
Guided onboarding - walk through a complete OpenSpec workflow cycle with narration.
OPSX: Apply
Implement tasks from an OpenSpec change (Experimental).
OPSX: Archive
Archive a completed change in the experimental workflow.