dsh-plugin-cursor-plan:在 DSH 中读取 Cursor 的 Plan 模式文件

前言

DeepSeek Harness(DSH)的插件体系允许用户扩展工具能力。Cursor 的 Plan 模式会生成 .plan.md 文件,但 DSH 原生不提供读取这些文件的接口。如果要在 DSH 中利用这些计划文件,需要额外实现一个工具。dsh-plugin-cursor-plan 插件注册了一个只读的 cursor_plan 工具,让模型可以列出和读取 Cursor Plan 模式产生的计划文件。

插件定位与维护者

这是一个 DeepSeek Harness 插件,由维护者 eppen 发布。它通过注册一个只读工具,解决“在 DSH 中访问 Cursor 的 Plan 文件”的问题。插件不依赖外部库,纯 ESM 实现,只使用 Node.js 内置模块。

核心功能

插件提供 cursor_plan 工具,支持两种操作:

  1. list:列出当前可访问的计划文件
  2. read:读取指定计划文件的内容

list 操作参数

参数 类型 必填 说明
action "list" | "read" 是 操作类型
match string 否 子串过滤,匹配文件名、overview 或文件路径(不区分大小写)
limit integer 否 最大返回行数,默认 20,上限 100(超过被截断;<=0 回退到 20)

read 操作参数

参数 类型 必填 说明
action "list" | "read" 是 操作类型
file string 否 绝对计划路径,必须在允许的目录内
basename string 否 文件名(如 Plan-642d0fd6.plan.md),或 list 返回的 name 字段

read 必须提供 file 或 basename 之一,两者都提供时 file 优先。工具返回 name、overview、todos 以及文件正文(Markdown)。

只读限制

插件严格为只读:不写入、不编辑、不删除文件。DSH 中唯一的写操作来自 harness session log,与插件无关。

允许访问的目录

插件只扫描以下两个目录(去重后展示):

  1. ~/.cursor/plans(home 范围)
  2. 当前会话工作目录下的 .cursor/plans(workspace 范围)

会话工作目录来自 DSH 的 workingDirectory 服务;若服务不可用,则回退到进程启动目录 process.cwd()。

路径校验与解析规则

  • read 时先 path.resolve(file),再通过 path.relative 检查是否在允许目录内,不在则返回 error: "path-not-allowed"
  • 不允许 .. 路径遍历或目录外的访问
  • 前置规则:文件头部可能包含 HTML 注释(<!-- uuid -->)和空行;frontmatter 未闭合 --- 时,剩余内容视作正文
  • todos 支持 [] 或缩进的 - id/content/status 列表
  • overview 支持 | 或 > 块标量
  • 单文件读取上限 200KB,超过返回 error: "too-big";list 时只读取每个文件前 32KB

错误代码

工具返回以下错误代码(均为规范值,不抛出异常):

  • bad-action:不支持的 action
  • path-not-allowed:路径不在允许目录内
  • not-found:文件不存在
  • ambiguous:匹配到多个文件(仅 list)
  • not-file:路径指向目录
  • too-big:文件超过 200KB
  • read-failed:读取失败

安装与启用

插件通过 dsh plugin 命令安装到指定的 profile(这里使用 web profile)。

  1. Bundle 安装(推荐)
dsh plugin --profile web add "github:eppen/dsh-plugin-cursor-plan#main"

dsh plugin 会在 profile 中执行 pnpm add,然后将该包挂载到 bundle 层。安装后需要重启 dsh web(dsh-web-app patch 禁用了 HMR,插件变更不会热重载)。

  1. 本地开发(直接挂载)

若不希望安装到 profile 的 node_modules,可将源码直接挂载到用户层:

在 ~/.dsh/profiles/web/cordis.patch.yml 中添加:

- insert:
    - id: cursor-plan
      name: 'file:///D:/Tools/dsh-plugin-cursor-plan/index.mjs'

注意 file:/// 前缀:cordis 的加载器对不以 . 开头的名称调用 import(name),裸路径会被当作包名而失败。挂载后同样需要重启 dsh web。

验证安装

dsh --profile web --dump-config | grep -A3 cursor-plan

期望看到 id: cursor-plan 以及 name 为 dsh-plugin-cursor-plan(bundle 安装)或 file:///...(直接挂载),同时保留 id: tools 和 id: plan-mode 等节点。

卸载

  • Bundle 安装:dsh plugin --profile web remove dsh-plugin-cursor-plan,然后重启 dsh web
  • 直接挂载:从 cordis.patch.yml 删除该 insert 条目(空数组 [] 也可),然后重启 dsh web

典型用法

以 list 为例,列出当前 workspace 下最多 10 个计划文件(按 name 排序):

action: list
match: ""
limit: 10

返回示例:

Cursor plans: 10/1082 (limit 10)
roots: C:\Users\<you>\.cursor\plans | D:\work\proj\.cursor\plans
1. [home] Plan name — overview summary (file.plan.md, 2026-11-18 11:33)
   file: C:\Users\<you>\.cursor\plans\file.plan.md
… 1072 more not shown; narrow with match or raise limit (max 100)

以 read 为例,读取文件:

action: read
file: D:\work\proj\.cursor\plans\Plan-642d0fd6.plan.md

返回包含 name、overview、todos 和正文 Markdown。

适用场景与注意

  • 适合在 DSH 中使用 Cursor 的 Plan 文件作为上下文或参考资料,让模型基于已有计划继续开发或审查
  • 插件以当前 dsh 进程的权限运行,安装前应检查源码与许可证(MIT)
  • 插件不提供市场,仅通过 GitHub topic 或自定义 index 发现

结尾

dsh-plugin-cursor-plan 提供了一个只读接口,让 DSH 能够访问 Cursor Plan 模式生成的计划文件。它在两个固定目录内扫描计划文件,并通过 list 与 read 工具暴露给模型。如需更多插件,可访问目录页或 GitHub 仓库。

  • 目录页:https://www.skillhub.cn/plugins/eppen/dsh-plugin-cursor-plan
  • GitHub:https://github.com/eppen/dsh-plugin-cursor-plan
羽毛球分组比赛记分
小程序二维码

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

小夜