Dsh Plugin Hooks — AI skill for Claude Code
DeepSeek Harness plugin: Claude-Code-style lifecycle hooks for DSH.
How to install Dsh Plugin Hooks
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open truelove-dreamer/dsh-plugin-hooks and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Dsh Plugin Hooks does
DeepSeek Harness plugin: Claude-Code-style lifecycle hooks for DSH. Configure shell commands that run automatically before/after model tool calls (pre-tool / post-tool) with a JSON payload on stdin; pre-tool non-zero exits block the call.
Alternatives in AI
- Model Update — 增量更新财务模型 — 用新财报/新指引/修正假设重算 DCF 内在价值、Comps 隐含价、投资逻辑与目标价,输出 before→after delta 6.6k ★
- ARIS Agent Guide — For AI agents reading this repo 6.2k ★
- Welcome — AI Research Skills — You now have access to 86 production-ready skills covering the entire AI research lifecycle: literature survey 5.4k ★
README
dsh-plugin-hooks
DeepSeek Harness 插件:把 **Claude Code 风格的 lifecycle hooks** 带到 DSH —— 配置驱动的 shell 命令,在模型工具调用前后自动执行。
背景
DSH 0.1.0-rc.6 没有 hooks 能力,但架构已经预留了接缝:`tools/pre-execute` / `tools/post-execute` 两个有序 waterfall,以及 shell 服务"通过 stdin 给命令喂 JSON payload"的词汇表(见 `@deepseek-ai/dsh-shell`)。这个插件以**纯外部插件**形式补上这块空白,设计对齐官方预留接口:
pre-toolhook:匹配的工具执行前运行;命令非零退出 → 阻止该工具调用(等价 Claude Code PreToolUse 返回 error);post-toolhook:工具结果落地后运行;退出码只记录,不改变工具结果。
配置
JSON 配置,来源二选一或叠加:
- 文件(默认
$DSH_HOME/hooks.json):
{
"hooks": [
{
"id": "lint-after-edit",
"event": "post-tool",
"tools": ["edit", "write"],
"command": "npm run lint -- --quiet",
"timeoutMs": 30000
},
{
"id": "guard-prod",
"event": "pre-tool",
"tools": ["bash", "pwsh"],
"command": "node guard.js"
}
]
}
- 内联(挂载 config,追加在文件 hooks 之后):
- id: hooks
name: dsh-plugin-hooks
config:
configFile: C:/path/to/hooks.json # 可选
hooks:
- id: always-deny-db
event: pre-tool
tools: [bash]
command: "node deny-db.js"
字段:`id`(必填、唯一)、`event`(`pre-tool` | `post-tool`)、`tools`(可选,默认全部)、`command`(必填)、`timeoutMs`(可选)、`enabled`(默认 true)。
安装
dsh plugin --profile web add dsh-plugin-hooks
挂载:
- insert:
- id: hooks
name: dsh-plugin-hooks
Hook 命令收到的数据
命令通过 **stdin** 收到一行 JSON payload:
{ "event": "PostToolUse", "hookId": "lint-after-edit", "toolName": "edit",
"args": { "path": "a.js" }, "sessionId": "s_xxx", "cwd": "C:/repo",
"result": { "isError": false, "exitCode": 0, "error": null }, "durationMs": 123 }
环境变量:`CLAUDE_PROJECT_DIR`(会话 cwd)、`DSH_HOOK_EVENT`、`DSH_HOOK_ID`、`DSH_SESSION_ID`。`pre-tool` payload 无 `result`/`durationMs` 字段。
命令
/hooks— 列出已配置 hooks + 最近 20 次运行记录(含退出码/错误摘要)/hooks-reload— 重新读配置文件,热加载,无需重启
设计说明
- 通过
ctx.on("tools/pre-execute"|"tools/post-execute")接入 Cordis waterfall;`pre-tool
Related Skills
Dsh Output Styles
Claude Code outputStyles for DeepSeek Harness - session-scoped, durable, runtime-switchable model output style
Mem Compress
rtk-style pre-storage compression — collapses 3+ adjacent identical lines + merges adjacent key: value runs sh
Hardstop Command
Hardstop is a pre-execution safety layer that blocks dangerous shell commands using pattern matching + LLM ana
Drifter
A pip install defense layer that constrains AI coding agents through enforced protocols; not prompts. Pre-flig
Dsh Plugin Subscriptions
Use ChatGPT (Codex), Claude, and Grok (X Premium) subscriptions as DeepSeek Harness LLM providers — OAuth logi
Dsh Auto Review
Second-model AI auto-review for DeepSeek Harness approval requests: a read-only reviewer subagent returns stru
Related Agents
Ds Flash
DSH (DeepSeek Harness) worker on the flash tier - fast and cheap. Delegate simple, well-scoped subtasks: mecha
Plugin Contract Reviewer
Verifies the otel-as-code repo conforms to Claude Code plugin runtime contracts — hook stdin payload keys and
Cookiecutter Template Author
Scaffolds or refactors a Cookiecutter template (its pre_prompt/pre_gen/post_gen hooks and a pytest-cookies har