dsh-session-title-format
Verifieddsh-session-title-format · v1.0.0 · MIT
DSH plugin: set_session_title tool renaming the calling agent's session to「MMDD|类型|主题」— Shanghai-timezone creation date, fixed type vocabulary, concise topic
Install
dsh plugin add dsh-session-title-format Confirm the layer applied with dsh --profile default --dump-config — see the install guide.
Source
Published to npm without a public repository. Inspect the package contents before installing.
Tags
Creators
Readme
dsh-session-title-format
DeepSeek Harness 插件:为每个 Agent 注册 set_session_title 工具,把会话标题统一为「MMDD|类型|主题」。
规则
- MMDD:会话实际创建日期(
session.header.createdAt),按上海时区(Asia/Shanghai)计算,由工具自动生成,模型无需也不能提供。 - 类型:功能 / 设计 / 开发 / 修复 / 优化 / 发布 / 探索 / 文档 / 研究(工具参数枚举强制)。
- 主题:由模型根据对话实际内容简洁概括;工具拒绝空主题、超长主题、重复项目(工作区)名的主题。
- 无法确定时模型不应调用工具(保留原标题);用户手动命名过的会话,工具直接跳过,不覆盖。
- 只写
session/title日志事件(标题投影),不触碰项目名称、内容、归属、排序、置顶、归档状态。
已在 dsh 0.1.2-alpha.3(Windows)与 0.1.5-alpha.1(Linux)上验证:headless 独立进程与运行中的 web 服务器(RPC 建会话)两条路径,模型均于首轮主动命名(示例:0910|研究|闭包概念解释、0910|开发|统计log文件总行数)。
行为说明:纯寒暄类对话(如「你好」)无法确定类型/主题,模型会按规则保留原标题——这是设计行为,不是插件失效。有实际内容的对话才会被命名。
无需手动配置 AGENTS.md:插件在会话首个 step 通过
agent/pre-step钩子自动注入命名规则(与dsh-agent-instructions注入全局指令同一机制、<system-reminder>同一格式,作为 plugin 来源的持久 user 消息落盘、resume 不重复注入)。不想要注入可配injectInstruction: false(见「配置」)。
安装
方式一:官方 CLI(推荐)
dsh plugin --profile web add dsh-session-title-format # 从 npm(发布后)
dsh plugin --profile web add github:<owner>/dsh-session-title-format # 从 GitHub
dsh plugin --profile web add https://.../dsh-session-title-format-1.0.0.tgz # 从 tarball
dsh plugin --profile web add /path/to/dsh-session-title-format # 从本地目录(未发布前的等效方式)
一条命令完成:pnpm 安装到 profile(自动写入 dependencies)→ 依据包内 dsh.bundle 声明自动登记进 dsh.profile.bundles(reconcile 是 dsh plugin 自动做的,无需手动编辑 profile 的 package.json)。
安装后重启该 profile 的 dsh 进程生效(bundle 列表在启动时组合;运行中的进程只监视补丁文件,不监视 package.json)。
从 GitHub 安装带构建脚本的插件时,pnpm 会要求在 profile 的
pnpm-workspace.yaml加allowBuilds;本插件是纯 JS 无构建,无此问题。
方式二:市场 GUI
安装任一市场插件(如 dshmarket)后,在 Web 设置里搜索安装。市场数据来自社区注册表(见「发布 → 社区收录」)。
方式三:手动挂载(无需 npm/pnpm,已在 Linux 实测)
不装任何包,直接放置插件文件并写两个用户级配置文件。第 1 步:放置插件文件
~/.dsh/plugins/dsh-session-title-format/
├── index.js # 插件本体
├── package.json
├── cordis.patch.yml
└── README.md
第 2 步:建立依赖解析链接(让插件能解析宿主的 @deepseek-ai/dsh-tools、@deepseek-ai/schemastery)
mkdir -p ~/.dsh/plugins/node_modules
ln -s ~/.dsh/profiles/node_modules/@deepseek-ai ~/.dsh/plugins/node_modules/@deepseek-ai
⚠️
@deepseek-ai链接的父目录node_modules先建好,但@deepseek-ai本身必须不存在(ln -s直接在目标位置创建链接;若先mkdir了它,链接会被错误地嵌套创建在里面)。Windows 用 junction(管理员 PowerShell):
New-Item -ItemType Directory -Force "$HOME\.dsh\plugins\node_modules" | Out-Null New-Item -ItemType Junction -Path "$HOME\.dsh\plugins\node_modules\@deepseek-ai" -Target "$HOME\.dsh\profiles\node_modules\@deepseek-ai"
第 3 步:写家级补丁 ~/.dsh/cordis.patch.yml(对所有 profile 生效)
- insert:
- id: session-title-format
name: file:///home/<user>/.dsh/plugins/dsh-session-title-format/index.js
name必须是绝对路径的 file:// URL(<user>换成实际用户名;root 用户为file:///root/...,Windows 形如file:///C:/Users/<user>/.dsh/...)。
第 4 步:重启 dsh 进程(家级补丁热重载在不同版本上行为不一致,重启是最可靠的生效方式)
systemctl restart dsh-web.service # systemd 部署示例
# 手动前台运行的:重启 dsh web(或 dsh --profile <name>)
命名规则由插件自动注入,不需要再手动配置
~/.dsh/AGENTS.md。若此前已配置过,可以删除该条目(保留也不冲突,只是模型会看到两份相同规则)。
验证安装
模块自检(应输出四个导出与插件名):
node --input-type=module -e "import('file://$HOME/.dsh/plugins/dsh-session-title-format/index.js').then(m => console.log(Object.keys(m), m.name))"功能验证:在 GUI(或 RPC)发一条有实际内容的新消息(如「用一句话说明 git rebase 和 git merge 的区别」),等待回复完成后查看会话标题——应变为
MMDD|类型|主题格式(如0910|研究|git rebase 与 merge 区别)。日志级核验(可选,最严谨):解压会话日志(
~/.dsh/sessions/<workspace>/<session-id>/session*.jsonl.zstd),确认成对出现:tool/call name=set_session_title args={"type":"...","topic":"..."} session/title title="MMDD|类型|主题" source={"kind":"user"} tool/result isError=false「你好」类寒暄不会被命名(模型按规则保留原标题),属正常现象——若怀疑未生效,请用有实际内容的对话测试。
配置(可选)
安装条目可加 config(均有默认值):
- insert:
- id: session-title-format
name: 'dsh-session-title-format' # 方式一安装时
# name: file:///home/<user>/.dsh/plugins/dsh-session-title-format/index.js # 方式三挂载时
config:
timezone: Asia/Shanghai # MMDD 计算所用 IANA 时区
maxTopicBytes: 48 # 主题 UTF-8 字节上限(约 16 个汉字)
injectInstruction: true # 首轮自动注入命名指令(默认 true;改 false 后需自行在 AGENTS.md 配置)
卸载
dsh plugin --profile web remove dsh-session-title-format # 方式一:pnpm 移除 + bundles 自动剔除,然后重启进程
方式三则删除 ~/.dsh/cordis.patch.yml 的对应条目及 ~/.dsh/plugins/dsh-session-title-format/ 目录,再重启 dsh 进程。已注入过指令的历史会话日志不受影响(指令只对新会话生效)。
版本兼容性说明
- dsh 0.1.2-alpha.3 / 0.1.5-alpha.1 实测通过(headless + 运行中 web 服务器 RPC 两条路径)
- 家级补丁热重载在两版本上行为不一致(0.1.2 上条目变更触发重载实证有效;0.1.5 上新建/touch 未触发,需重启)——因此两种安装方式的最后一步都建议重启进程