Introduction¶
In DSH (DeepSeek Harness), lifecycle hooks are typically written in hooks.json: which event triggers, how to configure the matcher, what command to actually execute, and what the timeout is—all of which requires reading the file or consulting documentation to verify. Clients like Codex Desktop group and display hooks by event in a settings page; with a pure CLI or JSON-only setup, mistakes such as wrong matchers or missing event configurations often only surface at runtime.
Below we introduce the community plugin dsh-hook (maintainer mikazuhe13-ui, GitHub repository mikazuhe13-ui/dsh-hook). It adds a top-level “Hooks” entry in the settings sidebar of the DSH GUI, reads the locally configured hooks.json, and lists the seven lifecycle events in a fixed order along with each hook’s command, matcher, timeout, and status information. The plugin itself does not intercept tool calls; it only solves the “visible and matching the configuration” layer. To make hooks actually take effect, you still need the official DSH hook bridge package.
What Is This¶
dsh-hook is a lifecycle hooks settings panel plugin for DSH (category: workflow). Its positioning can be summarized as: listing hooks from hooks.json in the GUI, with a display style aligned with the Codex Desktop hooks page; it automatically detects common paths and also supports explicitly specifying the file location in the plugin configuration.
The current repository version is 0.3.2, license MIT; it requires DSH core @deepseek-ai/dsh >=0.2.0-rc.1 and Node ^22.19.0 || >=24.0.0.
Core Features¶
Full Coverage of Seven Events¶
The panel displays the following events in a fixed order; events that are not configured show a gray hint to avoid mistakenly assuming “there are no hooks of this type”:
- SessionStart (the README mentions example script scenarios including session context injection)
- PreToolUse
- PostToolUse
- UserPromptSubmit
- Stop
- SubagentStart
- SubagentStop
What Is Displayed for Each Hook¶
For entries already written to hooks.json, the interface displays the statusMessage, full command, matcher, timeout, and type fields, making it easy to compare item by item against the file content.
Where hooks.json Comes From¶
By default, it automatically detects in order:
$DSH_HOME/hooks.json~/.claude/hooks.json~/.codex/hooks.json
If your hooks file is not at the above paths, you can set hooksPath in the plugin’s cordis.patch.yml (see “Configuration” below).
Performance and Theming¶
- Zero background resident overhead: the host side reads files on demand (the README describes it as about 1 KB level); the client only polls and refreshes at a 15-second interval when the settings page is open.
- Theme adaptation: colors use
color-mix(in srgb, currentColor), adapting to light, dark, and transparent themes.
Settings Page Integration¶
Registered through the settings.section slot, a top-level “Hooks” section appears in the sidebar settings page; it can coexist with settings plugins like @linxin666/dsh-usage (this plugin’s order is 152, placed after usage).
Installation and Activation¶
The installation method follows the repository README: modify dependencies in the DSH profile directory (<dsh-home>/profiles/<name>/) and enable the bundle, rather than concatenating CLI commands from the plugin name.
Method 1: From GitHub (Recommended)¶
- Add the following to the
dependenciesin the profile’spackage.json(replace<your-username>with the actual fork or upstream username; if using the maintainer’s repository directly, it would begithub:mikazuhe13-ui/dsh-hook):
"dsh-hook": "github:<your-username>/dsh-hook"
-
Add
"dsh-hook"to thedsh.profile.bundlesarray. -
Execute in the profile directory:
pnpm install
- Restart DSH.
Method 2: Local Link Development¶
"dsh-hook": "link:D:/path/to/dsh-hook"
The README reminds: pnpm may report ERR_PNPM_INVALID_DEPENDENCY_NAME when combining scope names with link:; use the non-scoped package name dsh-hook.
Configuration¶
In the plugin’s cordis.patch.yml, you can insert hooksPath via patch to override auto-detection:
- insert:
- id: hooks-panel
name: 'dsh-hook'
config:
hooksPath: 'D:\my\dsh-home\hooks.json'
Without hooksPath, the behavior is the sequential detection of the three paths mentioned above.
Typical Usage and Supporting Components¶
The Panel Only Displays¶
The README clearly states: this plugin only displays. To actually intercept before tool calls (e.g., guard rules), you need to install the official DSH hook bridge and align it with the core version tag:
- npm package
@deepseek-ai/dsh-hooks-claude-code
The repository’s examples/hook-guard.ps1 provides a guard script example (the README gives examples such as intercepting recursive deletion, C drive writes, environment variable enumeration, etc.), which can be used with the command field in hooks.json; specific matchers and commands depend on your local configuration.
How It Works Architecturally (For Troubleshooting)¶
The host half lib/index.js reads hooks.json (explicit path or auto-detection) and registers GET /api/dsh-hook/overview. The client half lib/client.js fetches this API when the settings page is open and renders purely with DOM (React ref mounting, the plugin does not go through the TypeScript build chain). Understanding this helps distinguish between “the panel is blank due to a file path problem or an API/client problem.”
Use Cases and Cautions¶
Who It’s For
- Developers who already maintain
hooks.jsonin the Claude/Codex/DSH ecosystem and want to uniformly view the seven event types and the details of each rule in the DSH GUI. - Scenarios that require information density similar to the Codex Desktop hooks page but don’t want to manually open a JSON editor every time.
Important Notes
- Permissions and Security: The plugin reads the local
hooks.jsonand displays the shell commands within it using the current DSH process permissions; before installation, you should read the source code and the MIT license, and confirm that the source is the GitHub repository or a fork you trust. - Display ≠ Execution: Without installing
@deepseek-ai/dsh-hooks-claude-code(or an equivalent hook bridge), the panel may still list configurations, but runtime interception behavior depends on the hook chain actually loaded by DSH/the client. - Community Ecosystem: The DSH community plugin catalog is hosted on an independent site (such as the SkillHub catalog page), with no official affiliation with DeepSeek/Hunyuan; stars, downloads, etc. are based on the data from each site at that time (at the time of catalog scraping, GitHub stars were 0).
Conclusion¶
Following the steps above, you can enable dsh-hook in your profile and compare the seven events and each command, matcher, and timeout in the “Hooks” section of the settings page against hooks.json; when you need to actually guard tool calls, layer the official dsh-hooks-claude-code and the repository’s example scripts on top.
- Catalog page: https://www.skillhub.cn/plugins/mikazuhe13-ui/dsh-hook
- Source code and README: https://github.com/mikazuhe13-ui/dsh-hook