dsh-catgirl-plugin:为 DeepSeek Harness 打造的 token 高效人格运行时

前言

在 DSH 插件场景里,人格、工具与显示层可以拆到不同模块中处理。dsh-catgirl-plugin 是一个为 DeepSeek Harness 打造的 token 高效人格运行时,由 Freakz2z 维护,许可证为 MIT。

它不直接把长 persona 塞进模型上下文,而是让模型输出正常文本,由本地渲染层添加猫娘风味;同时通过工具白名单控制模型可见工具。

这是什么

一句话:dsh-catgirl-plugin 是一个为 DeepSeek Harness 打造的 token 高效人格运行时。

它围绕三类目标:

  • 保持模型上下文干净:会话日志保存原文,模型上下文零污染。
  • 降低猫娘风味的 LLM token 成本:猫娘风味本地渲染,0 LLM token 成本。
  • 减少工具 schema 占用:工具 schema 裁剪,25 个工具减少到 8 个。

核心功能

Persona Virtualization

Persona Virtualization 的思路是:模型输出正常文本,本地渲染层添加猫娘风味。

这样会话日志保存原文,模型上下文零污染;猫娘风味由本地渲染完成,0 LLM token 成本。

工具裁剪与按需解锁

catgirl-economy 通过 ctx.tools.restrict() 在 agent 作用域裁剪工具,把 25 个工具减少到 8 个。

当任务需要被裁剪的工具时,可通过 enable_tool 按需解锁。enable_tool 的渐进式披露用于恢复能力。

如果请求解锁的工具未安装在当前 profile,enable_tool 会返回不可用提示并保留原白名单。

插件模块

  • catgirl-lite:极短 persona。
  • neko-renderer:headless 显示层。
  • catgirl-economy:工具裁剪与按需解锁。
  • client:Web UI 渲染。
  • usage-meter:usage 记录。

人设文案为中文单语;INTENSITY_TEXT 位于 index.js,可自行修改或通过 traits 扩展。

安装与启用

安装命令中指定了 demo profile:

dsh plugin --profile demo add dsh-catgirl-plugin

然后加入 profile patch,插入 catgirl-liteneko-renderercatgirl-economy。下面配置使用已核实事实中的字段:

- insert:
    - name: dsh-catgirl-plugin/catgirl-lite
      config:
        persona: 'Be concise, friendly, and natural.'
    - name: dsh-catgirl-plugin/neko-renderer
    - name: dsh-catgirl-plugin/catgirl-economy
      config:
        allow: [bash, read, write, edit, glob, grep, str_replace_editor, todo_write]

Web UI 渲染可选。安装 dsh-catgirl-plugin-client 并加入 profile patch,插入 neko-renderer-client

- insert:
    - name: dsh-catgirl-plugin-client

典型用法

基础启用

先安装插件,再在 profile patch 中启用三个模块:

  1. 安装 dsh-catgirl-plugin
  2. 插入 dsh-catgirl-plugin/catgirl-lite,并设置 config.personaBe concise, friendly, and natural.
  3. 插入 dsh-catgirl-plugin/neko-renderer
  4. 插入 dsh-catgirl-plugin/catgirl-economy,并在 config.allow 中配置允许保留的工具。

示例白名单为:

allow: [bash, read, write, edit, glob, grep, str_replace_editor, todo_write]

需要更多工具时

如果当前任务需要被裁剪掉的工具,调用 enable_tool 解锁对应工具。

需要注意:

  • 如果请求解锁的工具未安装在当前 profile,enable_tool 会返回不可用提示并保留原白名单。
  • 需要专用工具的任务存在退化边界,例如 subagent 并行、skill 调用,模型会改变策略;enable_tool 渐进式披露用于恢复能力。

开发与构建

开发环境要求来自 package.json

"engines": {
  "node": "^22.19.0 || >=24.0.0"
}

依赖:

"@deepseek-ai/schemastery": "^3.18.1"

常用命令:

npm install
npm test
npm run test:composition
npm run pack:check

构建客户端插件需要进入 client 目录安装依赖,并从 harness checkout 链接 @deepseek-ai 相关包。已知 dsh-client-runtime 依赖未发布的 dsh-compact,所以构建客户端包需从 harness checkout 链接依赖。

适用场景与注意

适合在 DSH 中使用本地人格渲染和工具白名单控制的场景。它适合希望减少 persona 对模型上下文占用、同时保留猫娘显示效果的开发者。

注意:

  • 插件以当前 dsh 进程权限运行,安装前应检查源码与许可证。
  • headless 一次性进程不等待后台 subagent:run_in_background: true 的子代理在父进程退出时被终止;同步模式完整可用,Web UI 无此问题。
  • npm registry 的 rc 包依赖链损坏:dsh-client-runtime 依赖未发布的 dsh-compact,构建客户端包需从 harness checkout 链接依赖。
  • nya 工具输出随机,使用 Math.random(),不适合快照测试。
  • 人设文案为中文单语;INTENSITY_TEXT 位于 index.js,可自行修改或通过 traits 扩展。
  • dsh bundle patch./cordis.patch.yml

结尾

dsh-catgirl-plugin 的价值在于把人格表现放到本地渲染层,把工具面控制在白名单内,并用 enable_tool 在需要时恢复工具能力。

仓库地址:

  • GitHub:https://github.com/Freakz2z/dsh-catgirl-plugin
羽毛球分组比赛记分
小程序二维码

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

小夜