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 skills add KYinCode/dsh-hooks-plugin --skill dsh-hooks-authoringgit clone --depth 1 https://github.com/KYinCode/dsh-hooks-pluginWrote 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/skills/kyincode/dsh-hooks-plugin/dsh-hooks-authoring)<a href="https://agentmods.dev/skills/kyincode/dsh-hooks-plugin/dsh-hooks-authoring"><img src="https://agentmods.dev/badge/skills/kyincode/dsh-hooks-plugin/dsh-hooks-authoring.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.1 | $0.00112 | $0.01444 |
| Opus 5 | $0.00056 | $0.00722 |
| Sonnet 5 | $0.00022 | $0.00289 |
| Haiku 4.5 | $0.00011 | $0.00144 |
Grade A, and why
dsh-hooks-authoring 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 6d 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 — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.
编写 dsh-hooks hook 脚本
这个部署里装了 dsh-hooks-plugin:它把 Claude Code 风格的 hooks 接到 DSH 的工具/会话生命周期上,配置从 <项目根>/.dsh/hooks.json 读取(另有 ~/.dsh/hooks.json 全局层等,可缺省、按序合并)。本技能的职责是让你写得对:把一条 hook 配好、让它能跑、让它的决策真正生效。
完整规范 / 边界表在安装包内的
docs/CONFIGURATION.md(本包自带,随发布版本同步)。深度问题以它为准;这里是常踩的硬事实摘要,先读这份就够了。
四条钉死的事实
- 输入顶层没有
command。要检的命令在tool_input.command(bash/pwsh这类 shell 工具的入参)。读顶层input.command永远是空的 → 校验直接废掉。 - 退出码不 gate。
exit 2不会拦工具;决策只能靠 stdout JSON。没输出决策 JSON = 默认放行。 hookEventName回填。hookSpecificOutput.hookEventName用 stdin 的hook_event_name原样填,别手写死。- 决策放脚本文件,配置只写一行
"command": "<一行>"(别把长逻辑塞进 JSON 的command,Windows 内联引号必炸)。
怎么配
<项目根>/.dsh/hooks.json(项目层,热重载,保存即生效):
{
"PreToolUse": [
{
"matcher": "bash|pwsh",
"hooks": [
{ "type": "command", "command": "& 'F:/项目目录/guard.ps1'", "timeout": 10 }
]
}
]
}
- 事件 key 只认 8 个:
PreToolUse/PostToolUse/PostToolUseFailure/UserPromptSubmit/SessionStart/SessionEnd/Stop/SubagentEnd。{"hooks":{...}}信封会被静默跳过。 - Windows 的 shell 工具名是
pwsh,Unix 是bash;matcher 管道精确匹配bash|pwsh。if用权限规则语法(如Read(*.md))。
决策 JSON(只在 PreToolUse 有拦截效果)
deny(工具被挡,模型看到 Error: <reason>):
{ "hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "deny",
"permissionDecisionReason": "请改用单个文件删除或先归档"
} }
permissionDecision:deny(拦截,官方失败卡)/ask(走审批通道)/allow(显式放行)。permissionDecisionReason是写给模型看的——拼成Error: <reason>引导它换正当做法。- deny/ask 只在 PreToolUse 消费;PostToolUse/SessionStart 等只消费
additionalContext。
Windows / 沙箱的现实(最容易翻车)
- 本机(Windows)的
command由 Windows PowerShell 解释,不是 bash。按 PowerShell 语法写:& '脚本.ps1'(调用算子)、单引号包路径。 - Workspace Write 等受限沙箱会拒拉工作区外的外部 exe(例如 Git Bash,实测报
Win32 error 5)→ 决策 hook 命令失败 = 该 hook 静默失效(fail-open,最危险)。 - 稳妥做法:脚本放工作区内、进程内执行——PowerShell
& '工作区/guard.ps1'(读 stdin:[Console]::In.ReadToEnd(),写 stdout:[Console]::Out.WriteLine(...),记得设 UTF-8)。或node。 - 写完先确认它真的被调用:让会话跑一条无害命令,去
GET /dsh-hooks/recent看该 hook 记录status=0;否则它根本没在跑。
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.
- 6d ago First seen · 79 lines · 112 tokens per session scan A ba545e634fe2
dsh-hooks-authoring is a skill published in the GitHub repository KYinCode/dsh-hooks-plugin (4 stars, last pushed 18d ago), licensed MIT. It adds 112 tokens to every session and 1,444 once invoked, about $0.0006 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 skills, from other repositories
playlet-wechat-feed
A daily report of popular short-drama articles from WeChat public accounts, a Chinese publishing platform, grouped by story themes and accompanied by writing insights.
xiaohongshu-search
A tool for searching and ranking popular Xiaohongshu posts, a Chinese social content platform. It uses keywords, engagement, relevance, and recency to recommend content and related search directions.
playlet-bili-feed
A daily tracker for popular short-drama content on Bilibili, a Chinese video-sharing website. It groups popular videos by topic and produces an HTML report, a web page that can display the results visually.
playlet-xhs-feed
A daily tracker for popular short-drama posts on Xiaohongshu, a Chinese social-media platform. It groups posts by story themes and creates an HTML report with covers, interaction data, links, and writing insights.
wechat-search
A search tool for popular articles on WeChat public accounts. It ranks results using relevance, popularity, and freshness, and can expand the search period when too few results are found.
douyin-prohibited-word
A Chinese-language checker for Douyin, a short-video platform, that finds prohibited or sensitive words in copy, files, images, and web pages and suggests replacements.