npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-keyword-context

v0.1.0

Published

DeepSeek Harness (DSH) plugin — inject context when user input or model output hits configured keywords, with toggleable/configurable rules and model-editable memory.

Readme

dsh-keyword-context

当用户输入或模型输出命中配置的关键词时,向模型注入上下文。可开关、可配置,并可选择允许模型读写记忆。

功能

  • 命中注入:监听用户输入(agent/inbox/inserted)与模型输出(session/event 的 assistant/message),命中任一触发词即激活对应规则,把配置的上下文注入到后续模型上下文。
  • 可开关:设置页「启用上下文注入」总开关,关闭后立即停止注入并清空命中状态。
  • 可配置:触发规则(关键词 ↔ 注入文本)、记忆条目(key/value)均可在设置页增删改,持久化到 config.json。
  • 模型可读写记忆:开启「允许模型读写」后,注册 memory_get / memory_set 两个工具,并在注入上下文中附上工具用法说明。

安装

dsh plugin --profile web add dsh-keyword-context

然后确认 ~/.dsh/profiles/web/cordis.patch.yml 里挂载了 host 半区:

- insert:
    - id: keyword-context
      name: dsh-keyword-context

重启 dsh web,浏览器 Ctrl+F5 强刷。

结构

dsh-keyword-context/
├── package.json        # dsh.client.platform: "web" + exports ./client
├── config.json         # 持久化配置(enabled / allowModelWrite / triggers / memories)
└── lib/
    ├── index.js        # 宿主半区:注入上下文 + 检测 + memory_get/memory_set 工具 + HTTP 接口
    └── client.js       # 浏览器半区:设置页「上下文注入」

配置(config.json)

{
  "enabled": true,
  "allowModelWrite": false,
  "triggers": [
    { "id": "t1", "keywords": ["记忆", "memory"], "context": "用户提到了「记忆」相关话题,请结合上方【记忆】中的内容作答。" }
  ],
  "memories": [
    { "key": "用户偏好", "value": "使用简体中文回答" }
  ]
}

原理

  • host 半区通过 ctx.systemPrompt.context() 注册动态上下文(每次组装时求值),命中触发规则后返回注入文本,否则返回空串(不贡献内容)。
  • 记忆条目始终注入(开关开启时);模型读写开关打开后,注入文本追加工具用法说明,并动态注册 memory_get / memory_set 工具。
  • 配置读写走 webServer 的 /keyword-context/* JSON 接口,客户端设置页用 fetch 读写。