XiaoMoDern/dsh-trajectory-teacher

/trajectory-teacher:DSH插件,可将代理的执行轨迹转化为结构化的复盘报告(决策/陷阱/可复用模式)

Project Overview项目介绍

dsh-trajectory-teacher is a native plugin built exclusively for DeepSeek Harness (DSH) that converts an AI Agent’s execution trajectory into a structured, human-readable retrospective report. To install the plugin, you just need to run the command dsh plugin add dsh-trajectory-teacher in your DSH environment, then restart DSH to complete the automatic mounting. It processes DSH’s natively recorded trajectory event stream, extracts key events, calls the configured LLM to analyze the content, and outputs a finished markdown report. It ships with a native DSH bundle manifest recognized by DSH’s plugin manager, so no extra manual steps are needed after installation.

After installation, you do not need to do anything extra to set up the plugin. When you finish running a task with DSH’s AI Agent, simply type the command /trajectory-teacher in the chat window to trigger the retrospective analysis. The plugin will process the full trajectory of your current session, and return a complete structured markdown report in just a few seconds. The finished report includes basic metadata plus sections for summary, key decision points, pitfalls encountered, and reusable practices. This plugin is intended for any DSH user that wants to reflect on how their AI Agent completed a task, to help extract actionable insights.

By default, the plugin reuses the LLM that your current DSH session is already using to generate the retrospective, but you can override the model provider and model ID in your DSH profile configuration file. It automatically filters out noise from the trajectory, discarding hundreds of low-level token chunks from streaming responses and only keeping high-level key events like tool calls, assistant messages, and approvals. It also automatically scrubs any API keys that may appear in the trajectory, replacing them with redacted text to prevent credential leaks. The plugin is released under the permissive MIT open source license, and designed to keep token costs low by only running when triggered manually, turning off deep reasoning by default.

dsh-trajectory-teacher 是一款专为 DeepSeek Harness (DSH) 开发的原生插件,核心功能是将 DSH 中 AI Agent 的一次执行轨迹自动转换为一份结构化、可读性强的复盘报告。它支持读取当前会话自动记录的 Trajectory 事件流,经过提取关键事件、调用 LLM 分析后输出 markdown 格式的报告。它通过 DSH 的官方插件命令即可安装,输入 dsh plugin add dsh-trajectory-teacher 后重启 DSH 就能自动完成挂载。

完成安装后,用户只需在 DSH 对话中跑完一轮任务,再输入命令 /trajectory-teacher 即可触发插件复盘当前会话的完整轨迹。整个流程仅需数秒,就能生成包含工作目录、回合数、工具调用统计,以及总结、决策点、踩坑记录、可复用做法的结构化报告。这款插件适合所有需要对 DSH Agent 执行过程做复盘总结的开发者和使用者,帮助沉淀 Agent 协作经验。

该插件默认复用当前会话使用的 LLM 生成复盘,也支持在配置文件中手动指定模型服务商和模型 ID。它自带噪音过滤功能,会自动丢弃流式回复产生的大量 token 级分块,仅保留关键事件,还会自动对轨迹中可能存在的 API 密钥做脱敏打码处理。它采用 MIT 许可开源,为控制 token 成本采用手动触发方式,默认关闭深度推理来加快生成速度、降低消耗。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin add dsh-trajectory-teacher

把 XiaoMoDern/dsh-trajectory-teacher 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-trajectory-teacher

把 DeepSeek Harness (DSH) 里 AI Agent 的一次执行轨迹,自动转成一份可读的复盘报告。

  • 输入:DSH 的 Trajectory 事件流(Agent 每次运行自动记录)
  • 处理:提取关键事件 → 调 LLM 分析
  • 输出:markdown 复盘文档(决策点 / 踩的坑 / 可复用做法)

效果示例

对话里输入 /trajectory-teacher,几秒后得到一份结构化复盘:

# Agent 执行复盘报告

> | 工作目录 | `/path/to/your-project` |
> | 回合数 | 11 | 工具调用 | 50 次 |

## 总结
会话围绕一个项目的下一步展开……

## 决策点
1. **面对「项目下一步」提问时,先读 README/CHANGELOG/git log 再回答** ✅ 走对
   - 为什么:用户提供的是过时交接文档,必须用仓库实际状态校正上下文

## 踩的坑
1. **沙箱环境 TLS 凭证缺失,导致无法实测后端**
   - 教训:遇到环境类故障要快速识别「沙箱限制」而非「服务故障」

## 可复用做法
1. **用「漏斗缺口」而不是「功能清单」定位项目下一步**
   - 适用场景:产品能跑、但增长停滞时

安装

dsh plugin add dsh-trajectory-teacher

安装后重启 DSH,插件自动挂载。

用法

在对话里跑完一轮任务后,输入:

/trajectory-teacher

插件会复盘当前会话的完整轨迹,返回一份 markdown 复盘报告。

可选配置

默认复用当前会话正在用的模型来生成复盘。若要指定,在 profile 的 cordis.patch.yml 里覆盖:

- id: trajectory-teacher
  config:
    provider: deepseek-official
    model: deepseek-v4-flash

复盘分析已默认关掉 thinking(reasoningEffort: 'off')——提取+总结不需要深度推理,更快更便宜、输出更稳定。

How it works

session.events(内存事件流)
    ↓ extract   过滤噪音(token 级 chunk 等),提取关键事件并摘要化 + 脱敏
    ↓ analyze   调 LLM,产出结构化 JSON(决策点 / 坑 / 可复用做法)
    ↓ render    套模板生成 markdown
复盘报告
  • 噪音过滤:一次流式回复会产生几百个 token 级 chunk,全部丢弃,只留 tool/call、assistant/message、turn/*、approval/* 等关键事件。
  • 脱敏:轨迹里可能混入 API key 明文,报告输出前自动打码(sk-***)。
  • 成本控制:手动触发(不自动跑)、只喂关键事件摘要(有长度上限)、关 thinking、用便宜模型。

为什么是「手动命令」而非「自动跑」

复盘要烧 LLM token,所以不自动触发——用 /trajectory-teacher 命令,你想复盘时才跑。

Project structure

trajectory-teacher/
├── index.ts            # apply(ctx) 插件入口,注册 /trajectory-teacher 命令
├── cordis.patch.yml    # bundle 的 patch 层(dsh plugin add 安装时用)
├── lib/
│   ├── parse.ts        # zstd 解压 + 事件流解析(历史轨迹文件)
│   ├── extract.ts      # 过滤噪音 + 提取关键事件 + 摘要 + 脱敏
│   ├── analyze.ts      # 调 LLM 产出结构化复盘
│   └── render.ts       # JSON → markdown
├── scripts/
│   ├── build.mjs       # esbuild 打包成 dist/index.js
│   └── link-deps.mjs   # 软链 DSH 的 @deepseek-ai 包(开发用)
└── tests/              # node:test 单测

Development

本地调试(从源码挂载到 DSH):

cd <deepseek-harness 源码根目录>
pnpm dsh web --patch <本仓库>/dev/cordis.patch.yml --port 0

运行测试与构建:

npm test        # node:test 单测
npm run build   # esbuild 打包成 dist/index.js

License

MIT

← 上一个 Prev dsh-archived-sessions 下一个 Next dsh-showreel →