为 DSH 智能体增加经验记忆库与任务规划能力:调用前自动检索相似过往方案,由 LLM 评估是否复用并动态拆解步骤。
- 语言
- JavaScript
- License
- MIT
- 分支
- main
安装
$ dsh plugin --profile web add github:ztl34245881-commits/dsh-task-planner在终端中运行以上命令,通过 dsh CLI 安装此插件。可在右上角切换 Profile。 第一次用 dsh?看这篇新手教程
对话式安装
帮我安装 DeepSeek Harness 插件 ztl34245881-commits/dsh-task-planner:先查看仓库 https://github.com/ztl34245881-commits/dsh-task-planner 确认安全性,然后执行安装命令并验证插件加载成功。
把这段指令粘贴给 DSH Web GUI 里的助手,由它代你完成安装与验证。
一句话定位
给 DSH 智能体加一个"经验肌肉记忆":每次接到任务先翻过往经验库、让大模型评估能否复用,再动态拆步骤;任务结束自动沉淀新经验,越用越聪明。
核心能力
- 自动回忆相似任务的历史方案,无需人工检索
- 让大模型判断历史方案是否可用,可用则改进复用,不可用则说明理由并生成新计划
- 把任务拆成 3-8 步,每一步匹配最合适的能力/工具,避免硬编码固定组合
- 任务规划时自动起草经验条目存入经验库,任务收尾时由智能体更新执行结果
- 提供独立的经验查询工具,支持保存、检索、列出全部经验
- 用纯 Markdown 文件保存经验,便于编辑器修改、grep 搜索、Git 版本管理
技术实现
- 语言: JavaScript (Node.js ES Module)
- 关键依赖: 宿主内置
shell、llm、tools三个服务(无外部 npm 依赖) - 架构模式: 声明依赖注入(inject:
['shell','llm','tools']),通过ctx.tools.register注册两个工具plan_task/task_memory - 入口文件:
index.mjs(cordis bundle patch 通过cordis.patch.yml注入宿主)
适用场景
在做跨工具、跨步骤、需要写文档或脚本的复杂任务前调用 plan_task,让智能体先回忆做过什么、再决定怎么干。如果你经常处理同类任务(比如周报、数据报表、批量改稿),经验库能逐渐形成稳定套路,让后续规划越来越快。
前置依赖与兼容性
| 依赖 | 最低版本 | 说明 |
|---|---|---|
| DSH Harness | 未声明 | 需宿主提供 shell / llm / tools 三个内置服务 |
| Node.js | 未声明 | 代码使用 node:os、node:path 模块与 ESM 语法,建议使用 DSH 当前支持的 Node 版本 |
| 平台 | 跨平台 | 无平台限制,纯 Node.js 实现 |
| 原生模块 | 无 | 不依赖任何原生模块 |
安装方式
dsh plugin --profile web add github:ztl34245881-commits/dsh-task-planner
配置项
| 配置 | 类型 | 说明 | 默认值 |
|---|---|---|---|
| lessonsDir | 字符串路径 | 经验库存储目录,每个经验是一个 .md 文件 | ~/.dsh/planner-lessons |
| capabilityFile | 字符串路径 | 可选,指向一份能力清单(Markdown),规划时让大模型匹配每一步用得上哪个能力 | 空(不启用能力匹配) |
常见问题
Q: 必须配合哪些宿主服务?
A: 插件启动时声明依赖 shell、llm、tools 三项服务,必须是官方 DSH Harness 标准环境才具备。如果宿主没有这些服务,插件将无法初始化。
Q: 经验库默认存在哪里?能否换位置?
A: 默认写到 ~/.dsh/planner-lessons 目录,每个经验是一个 Markdown 文件;可在 cordis 配置中用 lessonsDir 改成任意路径。
Q: capabilityFile 是干什么的?
A: 指向一份你自定义的能力清单(比如 awesome list 风格的插件目录),plan_task 会把每一步与该清单做匹配,生成能力映射表。不填则跳过能力匹配步骤。
Q: plan_task 用的是什么模型?
A: 复用宿主默认模型(通过 agentDefaultModel.currentSelection 读取),规划阶段把 maxTokens 提高到 8000 以容纳长链推理。无法解析默认模型时会返回错误提示。
Q: 经验能直接用编辑器修改吗?
A: 可以。经验是带 YAML frontmatter 的 Markdown 文件,纯文本,可 grep、可手改、可 Git 版本化。手动修改后下次检索也能识别。
Q: 经验什么时候会被升级为正式 skill?
A: 插件本身不做自动升级。README 约定的规则是:经验被成功复用 3 次可晋升为 skill,被否决 2 次则标记作废;这些动作由调用方按需触发 task_memory save 手动维护。
Q: 如何彻底卸载?
A: 通过 dsh plugin remove 移除插件即可。如果想清空历史经验,删除 lessonsDir 目录下所有 .md 文件;只卸载插件不删文件的话,下次重新安装还能继续用。
上手难度
入门 — 只需一条命令安装,复杂任务前调用 plan_task 即可;可选的配置项仅在需要自定义能力清单或经验库路径时才需调整。
已知问题与限制
- 经验检索使用 2-3 字滑动窗口关键词匹配,是字符串匹配而非语义匹配,"周报"和"月报"能命中但不会判断语义接近度
- 经验评分直接累加关键词命中次数,未考虑关键词权重,长经验文件天然占优
- 中文停用词表(STOPWORDS)硬编码在源码中,扩展新停用词需改代码重新发布
- 经验文件名 slug 仅取任务前 40 字,不同任务的 slug 可能冲突或重复
- 经验保存时 outcome 字段截断到 100 字符,长复盘内容会丢失
- 工具注册失败时返回错误字符串而非抛出异常,可能被调用方忽略
- 经验库读取通过 shell 命令串联实现,宿主 shell 服务不可用时整个插件失效
Task planning with experience muscle-memory for DeepSeek Harness (dsh).
Give a task → the agent recalls past similar solutions (condition reflex), evaluates whether they fit, and produces a dynamic plan matched against its capabilities — never hard-coded combos. Every plan auto-drafts a lesson into the experience library; when the task closes, the agent updates the outcome. The more you work, the smarter the reflex.
Features
- 🧠 Experience library (
task_memory save/recall/list): persistent lessons as plain Markdown with signature keywords. Recall uses a 2–3-char sliding-window tokenizer, so "weekly report" still hits a "daily report" lesson. - ⚡ Condition-reflex planning (
plan_task): recall → LLM evaluates fit (reuse & improve, or explain why not and plan fresh) → decomposed steps with capability matching → risks → next actions. - 🤖 LLM-driven, not rule-driven: the model decides what to use per task; the plugin only supplies context (past experiences + optional capability catalog).
- ✍️ De-AI deliverable standard: any textual output step (docs/sheets/slides/copy/scripts) must include a humanize-then-review pass before delivery.
- 🗂️ Auto-persist:
plan_taskdrafts the lesson automatically (status:draft); the agent marks itverifiedwith the outcome at loop close. - 🔒 Zero keys, zero absolute paths: everything is configurable; the experience library lives in
~/.dsh/planner-lessonsby default.
Install
dsh plugin --profile web add github:<your-user>/dsh-task-planner
or copy the repo and add it as a local bundle:
dsh plugin --profile web add /path/to/dsh-task-planner
Config (optional, in your profile's cordis.patch.yml)
- id: dsh-task-planner
name: dsh-task-planner
config:
lessonsDir: /path/to/your/lessons # default: ~/.dsh/planner-lessons
capabilityFile: /path/to/capability-map.md # optional catalog fed to the LLM
Point capabilityFile at a markdown catalog of your skills/plugins (e.g. an awesome list) and plan_task will match each step against it.
Usage
plan_task { task, goal?, constraints? }— plan before starting complex work.task_memory save { task, plan, outcome }— persist a lesson (auto-called by plan_task for the draft).task_memory recall { task }— condition-reflex lookup.task_memory list— show all lessons.
Lesson lifecycle
plan_taskwrites a draft lesson (status: draft) automatically.- When the task closes, the agent updates it with the outcome (
status: verified). - A lesson reused successfully 3× → promote to a formal skill. A lesson rejected 2× → mark obsolete.
Notes
- Requires the
llm,shell,toolsservices (all present in the standard harness). - The model call uses the harness default model (
agentDefaultModel); reasoning models need a generousmaxTokens(8k is used internally). - Lessons are plain Markdown — human-editable, greppable, portable.
License
MIT
查看使用指南 →
该插件的安装步骤、关键要点、FAQ 与兼容性说明(基于已收录字段派生)。
收录徽章
[](https://deepseek-plugin.org/plugins/ztl34245881-commits/dsh-task-planner)把这段 markdown 粘贴到你的 GitHub README,链接回本插件详情页。徽章只声明已被本站收录,不代表安全认证。