dsh-agentmemory-hooks: Bridging Claude Code's Hooks Back to DSH

Introduction

After upgrading DeepSeek Harness (DSH) to 0.2.1-rc.2, the @deepseek-ai/dsh-hooks-claude-code package is no longer shipped with the launcher, causing dependent hooks configurations to fail silently. The package has been moved into devDependencies — without it, a hooks configuration is nothing more than a JSON file nobody reads.

Below we introduce a carrier bundle: dsh-agentmemory-hooks. It contains no business logic of its own and does exactly two things: it bundles the missing package into the profile and declares a single line of plugin configuration in that profile, pointing configPath to your hooks file.

What This Is

  • Role: Carrier bundle, not a standalone functional plugin
  • Maintainer: r56661828-cloud
  • Core value: Keeps your existing Claude Code hooks.json working inside DSH

Core Functionality

Once installed, the SessionStart, UserPromptSubmit, PreToolUse, Stop, and SubagentStop hooks fire on your original configuration as before: you can intercept prompts or tool calls (with model-visible reasons), inject context, or force another round.

Installation & Activation

Install from Gitee (requires DSH ≥ 0.2.2-rc.1):

dsh plugin --profile web add git+https://gitee.com/you-renjun/dsh-agentmemory-hooks-bundle.git

After installation, one mandatory step remains: change configPath in cordis.patch.yml to your own absolute path.

- insert:
    - id: agentmemory-hooks
      name: '@deepseek-ai/dsh-hooks-claude-code'
      config:
        configPath: "/home/you/.dsh/agentmemory.hooks.json"

A safer approach is to not modify the package’s internal file and instead override that line at the end of your local profile’s cordis.patch.yml (the profile layer is applied after the bundle layer, and a matching id replaces the entire config entry). This way, future plugin upgrades won’t wipe out your path:

- id: agentmemory-hooks
  config:
    configPath: "/home/you/.dsh/agentmemory.hooks.json"

configPath is passed verbatim to readFileSync: no ~ expansion, no environment variable interpolation — it must be an absolute path. A wrong path won’t crash anything, but you’ll get a startup warning:

hooks-claude-code: could not load hook config "…" — no hooks registered

and zero hooks will be registered. Seeing this log line means the path is wrong.

Configuration Format

It follows the Claude Code hooks.json shape:

{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          { "type": "command", "command": "node /path/to/session-start.mjs" }
        ]
      }
    ]
  }
}

The hook process and payload cwd use the session’s current working directory; CLAUDE_PROJECT_DIR follows it unless projectDir is configured. For the full list of events, blocking semantics, and limitations, see the upstream @deepseek-ai/dsh-hooks-claude-code README.

When You Need It and Caveats

You need it when:

  • You already have a set of hooks in Claude Code and want them to keep working in DSH.
  • You’re using a tool like agentmemory that relies on hooks to capture session observations, and hooks stopped firing after a DSH upgrade.

You don’t need it when: you’re on a DSH version prior to 0.2.1-rc.2 (the package is still bundled), or you only need what DSH’s native plugins already provide.

In Summary

This bundle is just “one dependency + one line of config.” Per the plugin registry’s inclusion rules, a pure aggregation bundle like this won’t be individually listed — it’s meant for your own use or your team’s. The version is pinned to @deepseek-ai/dsh-hooks-claude-code@0.2.2-rc.5, matching the verified host version.

  • Directory page: https://www.skillhub.cn/plugins/r56661828-cloud/dsh-agentmemory-hooks-bundle
  • GitHub: https://github.com/r56661828-cloud/dsh-agentmemory-hooks-bundle
  • Repository: https://gitee.com/you-renjun/dsh-agentmemory-hooks-bundle
  • License: MIT
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye