npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-trajectory-teacher

v0.1.0

Published

DSH plugin: turn an agent's execution trajectory into a readable post-mortem report.

Readme

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/callassistant/messageturn/*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