Ardig24/dsh-trajectory-ablation

Plugin插件 ⭐ 2 MIT Sessions & Context会话与上下文

Finds the actual cause of an agent failure by reconstructing, diffing, and ablating its context - a DeepSeek Harness plugin.

Project Overview项目介绍

dsh-trajectory-ablation is a trajectory-attribution debugging plugin built for the DeepSeek Harness (DSH) agent runtime, designed to locate the actual cause of a failure rather than accept the agent's self-explanation. It reconstructs the complete context the model saw before a chosen step, diffs that view against another step without making any model calls, and then proves causality by removing one block of context at a time and replaying the real model call k times; if the decision flips, that block is a cause, otherwise it is bystander context. Installation is performed by mounting it into the user's DSH profile through the cordis.patch.yml file at $DSH_HOME/cordis.patch.yml, adding an insert entry with id trajectory-ablation and name dsh-trajectory-ablation, followed by pnpm install inside the profile directory and a restart. Programmatic use is also supported, importing reconstructContext, diffContext, ablateStep, and screenForInteractions, where the first two need only a session event log and the latter two additionally need a live ctx.llm.

The typical workflow proceeds through four phases — reconstruct, diff, ablate, and screen for interactions — invoked from any DSH session as the slash commands /context-reconstruct, /context-diff, /ablate, and /ablate-interactions. The intended audience is DSH agent developers, prompt and context-debugging engineers, and teams maintaining multi-step toolchains who need verified causal evidence instead of plausible model self-narration. When /ablate reports that no single block is responsible, the developer should run /ablate-interactions to test whether two individually inert pieces jointly caused the decision; this step samples random subsets and applies delta-debugging to narrow down to the minimal responsible group, keeping cost linear rather than quadratic without guaranteeing every pair is found.

The plugin is released under the MIT license and depends on a Node.js plus pnpm environment; the npm run demo command runs the full pipeline against a scripted stale-README failure case without requiring an API key. Its main limitation is that every ablation replay is a real, billable model request, so /ablate and /ablate-interactions both refuse to proceed past an estimated 50 model calls unless the developer raises maxCalls or passes inf to disable the cap entirely. First-run caveats include completing pnpm install in the profile directory, following the cordis.patch.yml.example walkthrough, and restarting DeepSeek Harness so that the four slash commands become available inside sessions; build, type-check, and test commands are also exposed via npm run build, npm run typecheck, and npm test.

dsh-trajectory-ablation 是 DeepSeek Harness(DSH)的轨迹归因调试插件,专为定位智能体失败根因而设计。它通过重建模型在某步骤前看到的完整上下文、对两个步骤做无模型调用的差异比对,并对单块上下文逐项移除后真实回放模型调用 k 次来验证因果,还提供交互筛查步骤以处理两段上下文联合致因的组合情形。安装方式是在 DSH 配置目录的 $DSH_HOME/cordis.patch.yml 中挂载 id 为 trajectory-ablation、name 为 dsh-trajectory-ablation 的插件条目,然后在 profile 目录执行 pnpm install 并重启即可;亦支持程序化引入 reconstructContext、diffContext、ablateStep、screenForInteractions 等 API。

典型工作流分四步——重建、对比、归因、交互筛查——由用户在任意 DSH 会话中调用 /context-reconstruct、/context-diff、/ablate、/ablate-interactions 四条命令完成,目标用户为需要可验证因果证据而非模型自述的 DSH 智能体开发者、提示与上下文调试工程师,以及维护多步工具链团队。当 /ablate 未发现任何单块致因时,建议运行 /ablate-interactions 来排查组合作用。该插件以 MIT 协议开源,依赖 Node 与 pnpm 环境,npm run demo 脚本可在不接入真实模型与 API 密钥的前提下演示完整流水线。

主要限制在于:每次归因都是真实且计费的模型请求,因此 /ablate 与 /ablate-interactions 默认拒绝超过 50 次模型调用的估算,并在需要时通过 maxCalls 或 inf 参数放宽上限以避免意外开销;交互筛查采用随机子集采样而非穷举两两组合,因此保持线性成本但不一定能找出全部成对致因。使用前需在 profile 目录先完成 pnpm install,并按 cordis.patch.yml.example 的完整流程完成挂载,再重启 DSH 以使四条斜杠命令在会话中可用。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
  • No DSH plugin manifest detected - it may only carry the dsh-plugin topic, so the install method must be confirmed on the spot未检测到 DSH 插件清单:可能只是打了 dsh-plugin 话题,安装方式要现场确认
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 --profile web add github:Ardig24/dsh-trajectory-ablation

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

READMEREADME

dsh-trajectory-ablation

A debugger that finds the actual cause of an agent failure, instead of guessing.

A plugin for DeepSeek Harness that reconstructs exactly what your agent saw before a given step, diffs that against another step, and — most importantly — proves which piece of context actually caused a decision by removing it and replaying the same model call for real.

See trajectory-ablation.md for the full design rationale.

Why

When an agent does something wrong, most tools show you a transcript and let you guess, or ask the agent to explain itself — which is just the same model generating a plausible-sounding story about its own past decision, not a verified fact. This plugin replaces both with something checkable:

  1. Reconstruct — the exact, complete list of everything the model saw before a step, grouped by source. No model calls, just reading the log.
  2. Diff — what changed between two steps: added, removed, compressed, or reordered. No model calls.
  3. Ablate — remove one piece of context at a time and replay the model call for real, k times per piece. If removing something changes the decision, it's a cause. If it doesn't, it's bystander context.
  4. Interaction screen — for the case single-block ablation can't see: two pieces that are each individually inert but jointly cause the decision. Testing every pair is quadratic, so this instead samples a few random subsets, and when one flips the decision, narrows it down (delta-debugging) to the minimal responsible group. Won't find every such pair, but stays linear in cost instead of quadratic.

Install

Mount it in your DeepSeek Harness profile ($DSH_HOME/cordis.patch.yml):

- insert:
    - id: trajectory-ablation
      name: 'dsh-trajectory-ablation'

Then pnpm install in your profile directory and restart. See cordis.patch.yml.example for a fuller walkthrough.

Usage

Once mounted, four commands are available in any session:

/context-reconstruct <turn> <step>                          — what did the model see before this step?
/context-diff <turnA> <stepA> <turnB> <stepB>               — what changed between two steps?
/ablate <turn> <step> [k] [maxCalls|inf]                     — which block actually caused this decision?
/ablate-interactions <turn> <step> [trials] [maxCalls|inf]  — run this when /ablate finds nothing: is it a pair?

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-tui 下一个 Next dsh-stock-lookup →