Back to directory

dsh-trajectory-governor

In a curated listMaintenance: Maintained

chunsi-w/dsh-trajectory-governor

Closed-loop trajectory policy plane for DeepSeek Harness

View on GitHub
$ dsh plugin --profile web add @chunsi-m/dsh-trajectory-governor

13

stars

0

forks

TypeScript

Language

MIT

License

2026-08-16

Created

2026-08-18

Last push

MIT DeepSeek Harness bundle that governs an agent's trajectory — task episodes, verification debt, benchmark gates and a no-evidence finish block — with a local decision ledger and a `shadow` mode for calibration.

DSH integration

Native runtime

Author-claimed

Safety audit

Unaudited

Last verified

2026-11-25

License

MIT

01What can it help you accomplish?

  • Keep a long DSH session's trajectory coherent across corrections and extensions

    A task episode with a deterministic relation — new-objective, continuation, extension, correction, clarification, review or conversation — plus the current phase

    People running long DSH sessions on code, where a task gets corrected and extended instead of finishing in one shot

  • Stop a turn from ending without evidence

    Verification debt bound to the workspace revision, a `finish` guard and a turn-stopping gate, plus a bounded number of automatic verification steps

    Reviewers and maintainers who need a claimed fix to be actually verified

  • Make performance experiments comparable instead of noisy

    A benchmark gate that accepts only a full, parseable current-revision run and compares QPS against same-spec records within a tolerance

    Engineers running throughput or query-engine experiments inside a DSH session

02How to install into DeepSeek Harness

Prerequisites

  • Node.js `^22.19.0 || >=24.0.0`
  • DeepSeek Harness `0.1.0-rc.7` as the development and integration-test baseline; the peer range accepts `0.1.0-rc.5` up to `<0.2.0`
  • A DSH profile to install into (`web` in every README example) and the `dsh` CLI

Installation steps

  1. 01

    From npm (recommended): `dsh plugin --profile web add @chunsi-m/dsh-trajectory-governor`

    $ dsh plugin --profile web add @chunsi-m/dsh-trajectory-governor

  2. 02

    Pin a version with `dsh plugin --profile web add @chunsi-m/dsh-trajectory-governor@0.2.0`

    $ dsh plugin --profile web add @chunsi-m/dsh-trajectory-governor@0.2.0

  3. 03

    From a local checkout: `npm run build`, then `dsh plugin --profile web add .`

    $ npm run build

  4. 04

    Or from a packed tarball: `npm run pack:release`, then `dsh plugin --profile web add ./chunsi-m-dsh-trajectory-governor-0.2.0.tgz`

    $ npm run pack:release

Verify the integration

  • Run `dsh --profile web --dump-config` — the package declares `cordis.patch.yml` as its bundle patch, so the plugin should land in the profile's bundle layer rather than as a plain dependency
  • For a source build, `npm run check` runs the pure-logic and AgentLoop integration tests

03DSH integration and capability boundaries

DSH integrationNative runtime

Native DSH bundle: the package declares a bundle patch pointing at `cordis.patch.yml`, so `dsh plugin --profile web add …` puts it in the profile's bundle layer. It hooks the harness runtime — `agent/pre-step`, tool call/result events and `agent/turn-stopping` — and registers the read-only `trajectory_policy_status` tool.

  • Task episode and phase tracking

    The human message stream — pronouns and continuity words, artifact and filename overlap, similarity to the previous objective, fix/build/review wording→A deterministic relation (new-objective, continuation, extension, correction, clarification, review, conversation) plus the current phase

    a first message like “hello” does not switch the plugin off; the next real task starts a new objective
  • Revision-aware verification debt

    A successful `write` / `edit` / `str_replace_editor` mutation, or a risky shell write such as `apply_patch`, redirection, `sed -i`, `git apply` or a package install→Debt bound to the workspace revision that created it; later edits invalidate the old readback and test evidence

    source changes need readback plus a test/build/checkdocs need readbackunknown artifacts need an executable verification
  • Scoped tool surface

    `restrictBeforeEvidence` (default true) and the tools a task actually needs→`agent.ctx.tools.restrict()` hides dedicated write tools before observation and releases them afterwards

    `str_replace_editor` is only hidden while an independent `read` remains, so the Minimal preset keeps observationin Code Mode the restriction changes the generated TypeScript SDK instead of removing `run_code`
  • Benchmark-aware stop controller

    `benchmarkRequired: true` plus a benchmark tool that returns named metrics such as `total_queries`, `recall`, `qps`, `concurrency` and `warmup`→A pass only for a full, parseable current-revision run; QPS is compared only against same-spec records within the configured tolerance

    every recognised mutation invalidates the previous benchmarkan unparseable result becomes a blocker, never a pass
  • Status tool and local decision ledger

    The read-only `trajectory_policy_status` tool, or the append-only JSONL ledger→Episode, relation, phase, restrictions, open debt, benchmark state, ledger status and the final assembly hash — for the calling agent only

    the ledger stores the message SHA-256 instead of its text and rotates before `maxLedgerBytes`it never enters the model history

04Who is it for? When not to use it?

Good for

  • People running long DSH sessions on code, where a task gets corrected and extended instead of finishing in one shot
  • Reviewers and maintainers who need a claimed fix to be actually verified
  • Engineers running throughput or query-engine experiments inside a DSH session

Not for

  • The governor is a trajectory policy, not a security boundary: real permissions still come from DSH's own sandbox and approval, and shell command semantics are only recognised conservatively.
  • It never rolls back your workspace. Without an official workspace checkpoint API it keeps only the benchmark best record and state, so automatic restore has to come from an external evaluator that provides checkpoint/restore.
  • Needs Node `^22.19.0 || >=24.0.0` and DSH from `0.1.0-rc.5` up to `<0.2.0` (`0.1.0-rc.7` is the tested baseline); `mode` defaults to `active`, and the README recommends starting in `shadow` to calibrate relation and phase decisions first.

05Compatibility, maintenance and safety notes

  • The governor is a trajectory policy, not a security boundary: real permissions still come from DSH's own sandbox and approval, and shell command semantics are only recognised conservatively.
  • It never rolls back your workspace. Without an official workspace checkpoint API it keeps only the benchmark best record and state, so automatic restore has to come from an external evaluator that provides checkpoint/restore.
  • The decision ledger is written locally to `$DSH_HOME/trajectory-governor/decisions.jsonl` by default, keeps the message SHA-256 instead of the text, and rotates before `maxLedgerBytes`; a write failure logs once, is surfaced in the status tool, then retries stop.
  • Needs Node `^22.19.0 || >=24.0.0` and DSH from `0.1.0-rc.5` up to `<0.2.0` (`0.1.0-rc.7` is the tested baseline); `mode` defaults to `active`, and the README recommends starting in `shadow` to calibrate relation and phase decisions first.
2026-08-162026-08-18Not specified by the author

MIT · last push 2026-08-18, no releases published; the README lists its limits openly, including that it is not a security boundary and does no automatic rollback

06Frequently asked questions

How do I install dsh-trajectory-governor into DeepSeek Harness?

From npm: `dsh plugin --profile web add @chunsi-m/dsh-trajectory-governor` (pin `@0.2.0` for a fixed version). From a checkout, run `npm run build` and add the directory instead. The package declares `dsh.bundle.patch: ./cordis.patch.yml`, so the plugin lands in the profile's bundle layer instead of staying an inert dependency; `dsh --profile web --dump-config` shows the result.

What does it actually block?

When a write or a risky shell write lands, the governor opens verification debt bound to that workspace revision: source changes need readback plus a test/build/check, docs need readback, unknown artifacts need an executable verification. Open debt becomes a completion blocker, and both an explicit `finish` tool and natural turn-stopping go through the same gate. After the configured number of automatic continuations the model has to report the blocker instead of looping.

Should I start in shadow mode?

Yes, that is what the README recommends. `mode` defaults to `active`; `shadow` only decides and writes the ledger without touching the request. Once relation and phase decisions match real sessions, switch to `active`. `adaptiveReasoning` stays off by default because changing reasoning effort changes request headers and cache shape.

Is it a sandbox or an automatic rollback tool?

Neither. It is a trajectory policy — real permissions still come from DSH's sandbox and approval — and it does not restore your workspace: without an official workspace checkpoint API it keeps only the benchmark best record and state, so automatic recovery has to come from an external evaluator with its own checkpoint/restore.

What does the decision ledger record?

A local, append-only JSONL file at `$DSH_HOME/trajectory-governor/decisions.jsonl` by default, holding the original message's SHA-256 rather than its text, plus relation, phase, risk, restrictions, tool effects and the request assembly hash. It never enters the model history; a write failure prints one `console.error`, shows up in `trajectory_policy_status`, then retries stop, and the active file rotates before `maxLedgerBytes`.

08Data and sources

  • Author-claimedgithub.comce53de0e420d…

    面向 DeepSeek Harness 的**闭环 Agent 轨迹控制平面**。它不是继续增强一句 persona,也不是把会话永久分成 spec/react,而是围绕真实事件流维护:

  • Author-claimedgithub.comce53de0e420d…

    所以 `dsh plugin --profile web add ...` 会把它加入 `web` profile 的 bundle 层,而不是只安装成无效普通依赖。

  • Author-claimedgithub.comce53de0e420d…

    -> agent/pre-step 在同一个请求内追加可重建的近场 policy message

This page is generated from the project’s public documentation, repository metadata and a structured parse of DSH Plugins; last verified on 2026-11-25. Found an error? Submit a correction.

🏆

Best DeepSeek Harness Plugins

Twelve plugins worth installing first — picked from the whole catalog, across every category.

DSH Plugins is an independent community directory of DeepSeek Harness plugins. Not affiliated with or endorsed by DeepSeek. Third-party plugins are not security-audited — review the source before installing.

New DeepSeek Harness plugins, weekly. No spam.