dsh-continual-harness

DSH PLUGIN记忆与知识

仓库 jasen215/dsh-continual-harness · npm dsh-continual-harness

记忆与知识 L5 · 运行验证通过 安全审查:低风险 可信度:金 可安装插件
安装这个插件

DSH plugin 为 AI 智能体提供持续学习能力:持久记忆、跨会话知识共享、定期审查与自动优化,失败时自动回滚,形成自我改进闭环。

验证等级 L5 L5 · 运行验证通过
GitHub 星标 9 复刻 2 · 未关闭 issue 0
最近更新 2026-10-08 创建于 2026-08-17
README 19.2 KB 正文体量,越大说明说明书写得越细

安装

可安装插件
在 DSH 里执行,装完用 dsh plugin list 确认已挂上;标了 L4 / L5 的命令已在沙盒里真实跑通
dsh plugin --profile web add [email protected]
兼容 DSH 版本0.2.0-rc.2 等 10 个版本版本不匹配时安装会报错
Node.js 要求未标注来自仓库 package.json 的 engines 字段
前置依赖@deepseek-ai/cordis@^4.0.1、@deepseek-ai/dsh-agent@>=0.1.5-rc.1 <0.2.1 等 7 个需要同时安装的同级依赖
npm 包名dsh-continual-harness可用 npm view 查看包信息

能做什么

5 项功能
字段来自项目仓库与公开索引,中文说明由本站标注

dsh-continual-harness:DeepSeek Harness 的自我改进代理插件,支持持续学习与自动回滚

  • 持久记忆存储
  • 跨会话知识共享
  • 自动审查优化
  • 失败自动回滚
  • 手动精炼工具

适用场景

记忆文件读写代码评审

上游标签

agent-memoryai-agentcontinual-learningdeepseekdeepseek-harnessdshdsh-pluginrsiself-evolutionself-improvingself-improving-agents

验证等级与安全审查

L5 · 运行验证通过
自动化流程结论,不是人工审核
验证等级L5 · 运行验证通过在 dsh 沙盒中完成安装与运行冒烟——装得上、跑得起来
安全审查低风险静态分析结论,未标注不代表已通过审查
仓库健康度活跃按仓库活跃度与最近更新时间给出
可信度金综合仓库活跃度与验证结果

上面的结论来自上游最近一次自动化验证(2026-10-08): 同一套检查会在插件发新版后重跑,页面显示的是最新一次的逐项结果。

逐项检查结果

L1 · 已找到 ✓ 通过
  • L1.0_DEFAULTED_FROM_L3 由 L3 推定 默认通过——L3 安装规范已通过(全库 L3 扫描策略)
L2 · 结构化 ✓ 通过
  • L2.0_DEFAULTED_FROM_L3 由 L3 推定 默认通过——L3 安装规范已通过(全库 L3 扫描策略)
L3 · 安装规范 ✓ 通过
  • L3.1_INSTALL_COMMAND_PARSED 安装命令已解析 方式:安装规范解析
  • L3.2_DSH_VERSION_DECLARED DSH 版本已声明 方式:DSH 版本声明
L4 · 安装已测 ✓ 通过
  • L4.1_INSTALL_EXECUTED_CONFINED 受限沙盒内执行安装 方式:沙盒安装执行
  • L4.2_INSTALL_SUCCESS 沙盒安装成功 方式:沙盒安装执行
  • L4.3_ARTIFACT_CONFIRMED 安装产物已确认 方式:沙盒安装执行
L5 · 运行已测 ✓ 通过
  • L5.1_INSTALL_PASSED_SANDBOXED 沙盒安装通过 方式:沙盒安装执行
  • L5.2_WEB_BOOT_READY Web 启动就绪 方式:Web 启动
  • L5.3_HTTP_SERVED HTTP 服务响应 方式:HTTP 请求
  • L5.4_PLUGIN_INVENTORY_ACTIVE 插件清单中已激活 方式:插件清单查询

风险详情

  • 审查结论 通过
  • 结论说明 vet 静态分析未发现可疑行为,判定为干净(clean)。
  • 风险计数 严重 0 / 高 0 / 中 0
  • 风险详情 未发现严重或警告级问题。

仓库档案

记忆与知识
字段来自项目仓库与公开索引,中文说明由本站标注
作者 / 维护方jasen215仓库 dsh-continual-harness · 默认分支 main
分类记忆与知识memory
收录类型可安装插件声明了 dsh.bundle、可用 dsh plugin add 安装的条目
开发语言TypeScript仓库主语言
许可证MIT商用或二次分发前请确认条款原文
星标 / 复刻 / issue9 / 2 / 0收录时的数值,非实时
创建 / 更新2026-08-17 · 2026-10-08最后推送 2026-10-08
本站收录2026-08-17首次进入本站目录的时间

README 全文

19.2 KB
作者原文,中文版优先;只做安全转义,不改内容

dsh-continual-harness

English | 中文

A DeepSeek Harness (DSH) plugin for self-improving AI agents, providing continual learning through persistent memory, periodic review and refinement, cross-session knowledge sharing, and automatic rollback on failure. It forms a closed loop of plan → validate → apply → rollback.

The design is inspired by the open-source prime-agent from Prime Intellect, a self-improving coding harness.

Capabilities

A single npm package (dsh-continual-harness) takes effect through the following extension points once mounted:

Capability Mechanism
State projection (inject harness context each step) agent/pre-step waterfall listener; incremental injection when the content digest changes
Review and automatic refinement session/event listener on turn interval / compaction end; runs LLM review → plan → apply automatically
Manual refinement tool Registers the harness_refine tool (directly callable by the LLM, supports rollback)
Manual refinement command Optional /refine slash command, registered through the host commands capability (@deepseek-ai/dsh-commands) when present
Memory lifecycle Manual archive/unarchive/pin through refinement metadata; archived entries are hidden from injection and skill materialization
Ranked injection Queries the latest effective direct-user message (up to 400 chars), ranks title matches above content matches, then applies freshness/id tie-breaks and a per-kind cap
Session wrap-up Optional harness_wrapup tool gives mechanical keep/promote/archive advice; promotion is copy-only and conflicts return a deterministic error
In-session review trajectory Rebuilt from session logs (tail-biased truncation)
Invariant guard harness/refinement event validation + batched failure reporting
Explicit A/B benchmark Single harness_benchmark action tool: fixed frozen cases, pre-refinement reference snapshots, and same-round reference/candidate A/B runs with code-owned decisions

Architecture

src/
domain.ts      event declaration merging (SessionEventMap / MessageSourceMap / cordis Events)
types.ts       HarnessState / RefinementProposal / RefinementResult and other types
storage.ts     disk read/write of state and history (atomic writes, corruption degradation, local/global merge, jsonl history)
refine.ts      validation, application, rollback (baseline conflict detection, version increments, growth limit)
skills.ts      SKILL.md rendering + file reconciliation (generated skills are real dsh skills)
render.ts      model-facing overview / summary / history rendering (ranked injection)
usage.ts       injection telemetry keys and in-memory usage aggregation
wrapup.ts      deterministic session wrap-up suggestions (keep/promote/archive)
planner.ts     LLM planning prompts and JSON parsing (plan / auto-refine review prompts)
store.ts       HarnessStore: combined storage + event publishing (session events + agent-scoped events)
complete.ts    completeViaAgent: completion through ctx.get(&#x27;llm&#x27;)
benchmark.ts   benchmark cases/snapshots + atomic benchmark store persistence
evaluate.ts    isolated per-cell executor/reviewer evaluation (evidence + score)
score.ts       code-owned aggregation and ACCEPTED/REJECTED decisions
tool.ts        harness_refine / harness_wrapup / harness_benchmark tools
projection.ts  pre-step projection (digest dedup,  injection)
driver.ts      automatic refinement driver (turn-interval gate / compaction gate / cooldown / re-entry guard)
invariant.ts   runtime invariant plugin
index.ts       plugin entry and Config
tests/           23 test files, 287 cases (storage / store / refine / rules / planner / driver / approval / audit / logfile / skills / invariant / plugin integration / rank / projection / archive / usage / wrapup / benchmark / evaluate / score / isolation / tool / benchmark integration)

Data layout

/                      shared ESP experience root; defaults to ~/.dsh/harness/
harness_state.json                cross-session global state (ESP)
refinements.jsonl                 global refinement history (append-only, ESP)
reviews.jsonl                     cross-batch gate/audit history (ESP extension)
continual-harness.log             continual-harness implementation log (JSONL, 0600)
continual-harness.log.1           rotated continual-harness log
usage.events.jsonl                append-only injection telemetry (lazily loaded into memory on first access)
benchmark/                        explicit benchmark store (validation layer)
cases.json                      fixed benchmark cases (draft/frozen + frozen material hashes)
snapshots/.json     captured reference snapshots (read-only merged harness state)
runs.jsonl                      append-only A/B run records (cells + evidence + code-owned decision)
sessions//
harness_state.json              session-local state (shadows same-id global entries)
refinements.jsonl               session refinement history
  • Skills are real dsh skills: applied skill edits materialize as /SKILL.md bundles (with provenance metadata) under Config.skillsDir, kept in sync by deletes/rollbacks without touching user-owned skills in the same directory.

Experience Solidification Protocol (ESP)

The Experience Solidification Protocol (ESP) is the protocol surface of this capability set, decoupled from this package's implementation:

Protocol element Carrier Description
Experience state schema harness_state.json (schemaVersion: 1) Four kinds of entries — prompt / memory / skill / subagent — each with id / kind / version / content / updatedAt
Experience history refinements.jsonl (append-only) One RefinementResult record per apply/rollback; rollback by id
Refinement event session event harness/refinement (retired) Written on apply/rollback by builds up to 0.3.0; this build never appends it and keeps only its payload type declared for legacy compatibility
Refinement notification agent event harness/refined Payload {agent, result}; subscribable by invariant and other plugins
Experience injection message source plugin (form: instructions, digest in the content marker) Pre-injected into the model context; deduplicated by digest change. The retired harness-state kind is still recognized so old logs replace their block instead of duplicating it

Any dsh plugin can read and write experience through this protocol (write state files, append history, publish events, inject messages); this package is the protocol's reference implementation and primary consumer (planning / refinement / projection / automatic gate).

Mounting (dsh profile)

Install into a profile in one line (published to npm):

dsh plugin --profile  add dsh-continual-harness

The package declares dsh.bundle, so dsh plugin installs it as a profile
layer and applies its cordis.patch.yml. Update with
dsh plugin --profile update dsh-continual-harness@latest.

Manual overlay (before publish, or to pin a local checkout): apply
cordis.patch.yml onto the profile, e.g.
~/.dsh/profiles//cordis.patch.yml; a patch layer must be a
top-level YAML array (insert rows append plugin entries; id-targeted rows override an existing row):

- insert:
- id: continual-harness
name: dsh-continual-harness
config:
defaultGlobal: true

An id-targeted row replaces the target's whole config instead of merging it, so a one-key override must restate the keys it relies on; anything omitted falls back to the defaults below. Overriding one unrelated key never disables the plugin.

Prerequisites: the tools, agents, session, llm, systemPrompt capability plugins must load before this plugin (its inject declaration enforces that; mounting is deferred until they load).

dsh version compatibility

Verified against dsh 0.2.0-rc.2 — typecheck, lint, build, the full 651-test suite, and a real profile boot on the 0.2.0-rc.2 runtime — and against 0.1.7-rc.1 with the same suite. One peer range admits every runtime from 0.1.5-rc.1 through 0.2.0-rc.2 (&gt;=0.1.5-rc.1 &lt;0.2.1), because that range is exactly what dsh evaluates in its plugin/runtime compatibility gate before mounting a plugin or a profile bundle. dsh 0.1.7 introduced that gate: when a plugin's @deepseek-ai/dsh* peers do not satisfy the running version, its profile bundle is skipped, so widening the range is what keeps one source loadable on both the older and the current runtime. Since dsh 0.1.2-alpha.3 no longer provides @deepseek-ai/dsh-home-paths inside the profile bundle, the plugin declares it as a hard dependency; @deepseek-ai/dsh-invariants is used for types only (dev-time) and is not required at runtime.

Config

Field Default Description
harnessRoot dsh data dir harness/ State root directory (temporary dir in tests)
skillsDir $DSH_HOME/skills Directory where skill entries materialize as dsh SKILL.md bundles (dsh's user skill root)
defaultGlobal true Target scope when the tool call omits global
maxTrajectoryChars 12000 Max characters of the planning trajectory (two-layer signal + digest summary; plannerPrefixCache-route dependent)
plannerMaxTokens 32000 Max tokens for the planner LLM call
plannerPrefixCache auto Planning input route: auto (Route A warm session prefix when the session shows cacheReadTokens &gt; 0, falling back to Route B on a truncated reply), session (always Route A), off (always Route B summary)
plannerPrefixMaxChars 12000 Tail-biased character cap for the Route A session prefix (deriveMessages text)
trajectorySignalRatio 0.5 Fraction of the Route B trajectory budget kept verbatim (signal layer) vs digested
autoRefine {turnInterval: 25, compact: true, cooldownMs: 1200000} Auto-refine: turn-interval gate, compaction-end gate, cooldown, disable switch
requireGlobalApproval false Require explicit human approval before a global write commits (conservative mode)
maxInjectedEntriesPerKind 6 Positive-integer cap (step 1, minimum 1) for ranked injected entries per kind
injectionAnchor stable What the injected block is selected by: stable (session opening request + project cwd — same entries all session, so the provider's cached prefix survives a topic change) or query (re-selected from the live question)
wrapupEnabled true Register the optional harness_wrapup session wrap-up tool
diagnosticsEnabled true Run post-apply structural diagnostics after each committed refinement
securityEnabled false Enable the local security (credential-pattern) diagnostic provider
auditReviews true Append every gate verdict to reviews.jsonl under the harness root
logToFile true Persist harness logs to continual-harness.log (JSONL, 0600, rotated)
logMaxBytes 5242880 (5 MB) Rotation cap for the harness log file
maxEntryGrowth 0.5 Per-commit entry growth fraction cap; 0 disables the check
protectedKinds [&#x27;skill&#x27;] Kinds the automatic path may not modify (reserved; per-entry protection is the enforced guard)
benchmark {enabled: true, defaultRuns: 1, maxRuns: 3, passThreshold: 60, regressionTolerance: 0, maxFailedCells: 0} Explicit harness_benchmark tool: iterations per case per side, run cap, report-only pass line, non-regression tolerance, max failed candidate cells

Refining

Two entry points: the harness_refine tool (LLM-callable) and the /refine slash command (when the host provides a commands capability).

harness_refine — mode: &#x27;plan&#x27; (default) plans from instructions and commits atomically; mode: &#x27;rollback&#x27; takes a rollbackId plus an explicit --local / --global scope to revert a committed refinement. Global writes require human approval when requireGlobalApproval is true.

/refine — same semantics, human-typed:

/refine --local organize my memories
/refine --global
/refine rollback  --local
/refine rollback  --global

Bare /refine plans with no instructions in the default scope. Output: status, scope, refinement, applied, rejected, summary, plus a diagnostics: line when enabled.

Governance

Every write path funnels through three guardrails: impact minimization (fixed contract validation; update/delete require a one-line reason; maxEntryGrowth caps per-commit growth), legality hard rejects (base_system_prompt and protected entries are immutable; global entries are read-only during a local refinement), and a necessity soft gate (a declined review never reaches the store). Every committed refinement rolls back by id.

Global writes are zero-approval by default; set requireGlobalApproval: true to ask the user first. Watch the plugin log live with:

tail -f ~/.dsh/harness/continual-harness.log

Benchmark

The validation layer is explicit and single-entry: one harness_benchmark action tool drives the whole workflow and never auto-triggers a refinement — nothing in the benchmark path starts a harness_refine or the automatic gate, and a REJECTED decision is reported and recorded only, never rolled back. The store lives under /benchmark/ (see the data layout above).

The minimal sequence is new → add-case → freeze → capture-reference → apply refinement → run → status (frozen case material is immutable and hashed; status lists cases, snapshots, and recent runs). Two steps carry real subtleties:

  • capture-reference must run BEFORE the refinement you want to validate: the candidate is later derived as the captured reference plus exactly that refinement, so capturing after the change would make the delta unprovable.
  • run evaluates the named refinement A/B against the reference (reference_snapshot_id + refinement_id). The candidate must be the single specified delta — derived from the reference plus the refinement's recorded applied edits and proved in code before any evaluation; a drifted or multi-change candidate is refused (benchmark:run:candidate-delta). Both sides run the same frozen cases in stored order with the same runs/provider/model.

A run returns the code-owned decision (src/score.ts), not a model verdict:

{
&quot;action&quot;: &quot;run&quot;,
&quot;ok&quot;: true,
&quot;run_id&quot;: &quot;run-...&quot;,
&quot;refinement_id&quot;: &quot;refine-1&quot;,
&quot;status&quot;: &quot;ACCEPTED&quot;,
&quot;reference_overall&quot;: 70,
&quot;candidate_overall&quot;: 90,
&quot;regression_cases&quot;: [],
&quot;failed_cells&quot;: 0,
&quot;feedback&quot;: [&quot;reference ok&quot;, &quot;candidate better&quot;],
&quot;auto_rollback&quot;: false,
&quot;runs&quot;: 1,
&quot;cells&quot;: 2
}
  • Scores are 0..100 per cell; a failed cell carries score: null — failure is never counted as 0 — and is excluded from the overall means.
  • passThreshold (default 60) is report-only: it never gates acceptance. A run is ACCEPTED only when neither side lacks usable cells, candidate failed cells stay within maxFailedCells, and no overall or per-case regression exceeds regressionTolerance (default 0).
  • Every run appends its full record (cells with executor evidence + the decision) to benchmark/runs.jsonl; evaluation reads only the captured snapshots and writes only that record, never touching reviews.jsonl, the harness state, injection telemetry, or skill files.

Development

The plugin is self-contained: devDependencies pin the published
@deepseek-ai/* packages (rc versions), so pnpm install, pnpm run typecheck, pnpm test, and pnpm run build (tsc emits
lib/types/*.js + *.d.ts; the &quot;.&quot; and &quot;./invariant&quot; exports point at the
artifacts) all work in a clean checkout — CI and the OIDC release workflow
run the same steps. peerDependencies declare the semver ranges consumers
(host dsh installations) must satisfy.

scripts/githooks/pre-commit runs the local regression gate (npm run verify,
~4s) on every commit, so a regression CI would catch on push is caught before the
commit instead; it bootstraps verify/latest.json when that file does not exist
yet. Hooks under .git/ are not versioned, so enable it once per clone:

git config core.hooksPath scripts/githooks

Plugin builds up to 0.3.0 logged the injected overview under a plugin-defined
harness-state message source. The released Session format migrations only
classify platform source kinds, so one such message makes the whole stored
artifact unreadable (cannot safely transform unclassified message source)
once a host reads it with a v3-capable dsh. This build logs a classified
plugin source instead; stored logs of any generation are repaired offline
with node scripts/repair-harness-state-logs.mjs (dry run by default; --apply
backs each artifact up and replaces it atomically, and artifacts written within
--min-age-seconds are skipped — see --help).

Known Limitations and Deferred Work

  • No end-to-end tests with a real LLM: completeViaAgent depends on the loaded llm capability and provider/model configuration; tests cover the planning/review paths with a stub Complete. Real e2e requires DEEPSEEK_API_KEY.
  • compaction/end is not part of the plugin's type union; the driver triggers it via string comparison after type narrowing, and the gate is silently skipped when the compaction capability is not loaded.
  • Projection dedup is an in-process WeakMap: the first step after a session restart re-injects (stateless and idempotent, but one extra injection).
  • Concurrent writes are last-writer-wins: multiple processes refining the same directory concurrently may overwrite each other; baseline conflict detection during planning can only catch read-after-write races, not serialize them.
  • A failed automatic refinement degrades silently (only logged) and never interrupts the session.
  • A content-shrink guard (rejecting updates that shrink an entry too far in one commit) is a planned follow-up and is not yet implemented; today only maxEntryGrowth caps how much an update may grow an entry.
  • A dedicated governance tool entry is deferred.

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
dsh-continual-harness 怎么安装?

在 DSH 里执行 `dsh plugin --profile web add [email protected]` 即可。对应的 npm 包名是 `dsh-continual-harness`。

dsh-continual-harness 的验证等级是什么意思?

L5 · 运行验证通过。在 dsh 沙盒中完成安装与运行冒烟——装得上、跑得起来

dsh-continual-harness 安全吗?

低风险。vet 静态分析未发现可疑行为,判定为干净(clean)。

dsh-continual-harness 支持哪些 DSH 版本?

上游记录的兼容版本包括 0.2.0-rc.2、0.2.0-rc.1、0.1.7-rc.2、0.1.7-rc.1、0.1.7-alpha.2、0.1.6-alpha.2、0.1.6-alpha.1、0.1.5-rc.2。版本较多,只列出前 8 个。

dsh-continual-harness 需要什么运行环境?

需要同时安装 @deepseek-ai/cordis@^4.0.1、@deepseek-ai/dsh-agent@>=0.1.5-rc.1 <0.2.1、@deepseek-ai/dsh-llm@>=0.1.5-rc.1 <0.2.1、@deepseek-ai/dsh-session@>=0.1.5-rc.1 <0.2.1、@deepseek-ai/dsh-system-prompt@>=0.1.5-rc.1 <0.2.1。环境不满足时安装会失败,建议先确认本机版本。

dsh-continual-harness 用的是什么许可证?

上游标注为 MIT。商用或二次分发前请到仓库确认许可证原文。

dsh-continual-harness 有哪些功能?

持久记忆存储、跨会话知识共享、自动审查优化、失败自动回滚、手动精炼工具。

这条记录的数据可靠吗?

本站按仓库名去重后合并整理,字段以作者仓库与 npm 元数据为准;安装命令、仓库地址与 README 保持原文,带 L4 / L5 标记的安装命令已在隔离沙盒里真实跑通。

记忆与知识
按星标排序,可作替代方案

ruflo

ruflo

L3 · 安装规范通过 7.4 万 星

OpenViking

OpenViking

面向 DeepSeek Harness 的 OpenViking 记忆与上下文插件:pre-step 自动召回与画像注入、会话捕获、`vik

L3 · 安装规范通过 3.9 万 星

WeKnora

WeKnora

把 WeKnora 知识库接入 dsh 的四个只读工具:列出知识库、混合检索原文片段、按顺序还原单篇文档,以及直接取用 WeKnora 自己

L4 · 沙盒安装通过 3.3 万 星

distilly

distilly

Distilly — Distill how they think into reusable Skills for any Agent o

L4 · 沙盒安装通过 2.5 万 星

EverOS

EverOS

L4 · 沙盒安装通过 1.3 万 星

MemOS

MemOS

L4 · 沙盒安装通过 1.2 万 星

插件的元信息来自作者仓库;分类、验证等级与安全结论的中文说明为中文整理,最近核验 2026-10-08。