Project memory for coding agents on DeepSeek Harness: similar past edits surface as precedents, out-of-scope edits are blocked, and cognition persists across sessions (47 upstream-verified fixes, gold-free 20-task run).
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:scd13150/dsh-cognition
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
DSNLE gives your DeepSeek Harness agent a memory of your project.
New tasks start with what you already did: edits from similar past tasks surface as precedents, out-of-scope edits get blocked, and knowledge keeps accumulating across sessions — enforced by DSH's native mechanisms (per-tool gates, kernel-level version guards, the skills knowledge layer, session event sourcing), not by prompt tricks.
Honest status: a research prototype with a working implementation — 47 real-repo fixes verified by upstream test suites, a gold-free 20-task continuous run (20/20), 245 deterministic regression assertions — and openly documented boundaries (docs/research/).
Quick start(3 steps)
Requires: Node.js ≥ 22 + a running DeepSeek Harness.
git clone https://github.com/scd13150/dsh-cognition.git && cd dsnle
node install-dsnle.mjs --set-default # creates the dsnle preset and makes it DSH's default (backs up your config)
Then restart DSH (or open a new session) — the new session should show:
nle_suggest/nle_focus/nle_mutate/nle_select/nle_guard… in your toolsnle-learned-*andnle-reflectionsin your skill catalog
Verify: run nle_check (no args) in the new session — ok: true means installed.
Other install modes / uninstall / troubleshooting
- Keep your global default untouched: omit
--set-default, then set the default preset in DSH settings (agent-presets → default), or pickdsnleper session - Inject into an existing preset:
node install-dsnle.mjs --into <preset-id>(backs up agent.cordis.yml) - Dry-run any command with
--dry-run - Uninstall: delete
~/.dsh/.agent-presets/dsnle/(+ restoresettings.yaml.bak-*if you changed the default); injected mode: restoreagent.cordis.yml.bak-* - No tools in a new session? The session must use the dsnle preset (check settings); running sessions never pick up new presets — always open a fresh session
怎么工作
每个任务走一条可审计的 ritual 链(强制,乱序改码会被 deny):
nle_suggest(定位检索)→ nle_focus(锁 scope)→ [nle_impact(高影响声明)]→ 编辑
→ [nle_reorient(证据推翻 scope)]→ nle_select(对账收尾)→ nle_guard(总闸)
| 层 | 机制 | DSH 原生落点 |
|---|---|---|
| 约束 | 强制链 + scope 锁 + shell 绕行防护 + 版本守卫 | tools/pre-execute 瀑布、fs/edit-intent 内核版本守卫 |
| 观测 | 内容哈希 cell + CON 码(CON200/404/405/422)+ 真相对账 | tools/result 冻结结果、fs 意图观测 |
| 记忆 | learned(关键词→文件,置信度/衰减/跨项目提升)+ precedent(历史会话先例)+ git 共改/churn/rollback | skills provider、sessionQuery 会话检索 |
| 可靠 | 契约门(声明 vs 真相)、guard 总闸、状态防篡改、反射观测 | 事件溯源日志、tokenMeter 成本报告 |
完整工具说明:调用 nle_suggest 等工具的 schema 即自带描述;机制规格见
docs/research/DSH_NLE_SPEC.md。
语义通道(可选)
语义检索(embedding 重排)是可选增强,不启用时自动降级为 BM25 + 符号/先例/共改检索,主链路不受影响。
启用:运行独立 helper 进程(transformers.js 首次运行自动下载模型,~90MB,缓存于 HF 缓存目录):
node nle-semantic/server.mjs --spool <工作区>/.nle-semantic
- 模型:Xenova/all-MiniLM-L6-v2(quantized),384 维,不随本仓库分发,由 transformers.js 自动下载或从 HF 缓存复用
- 离线环境:预先在有网机器跑一次
node nle-semantic/server.mjs --selfcheck生成缓存再迁移;或干脆不用语义通道 - 自检:
node nle-semantic/server.mjs --selfcheck→{"ok":true,"dim":384}
For DSH plugin developers: this repo also ships
docs/DSH_DEV_EXPERIENCE.md — battle-tested deep-dive notes
(dynamic-plugin sandbox traps, fs five-arg contract, preset generations, sessionQuery
deployment differences, tool-pipeline events) distilled from building DSNLE on dsh.
For DSH 插件开发者:仓库另附 docs/DSH_DEV_EXPERIENCE.md
——从零到 85KB 持久插件的全部踩坑提炼(动态插件沙箱陷阱、fs 五参契约、preset 代际语义、
sessionQuery 部署差异、工具管线事件),与 NLE 本体无关,可独立阅读。
已知边界(诚实声明)
- "长期"是初步证据:连续 20 卡(单仓库单日)累积曲线有实证;跨仓库、跨月、有害累积无数据——这正是开源想从真实使用中获得的
- 中文任务对英文代码库召回弱(learned/alias 兜底)
- 语义通道依赖独立 helper 进程;FTS 全文检索若部署禁用(
openAt: "never"),precedent 走字面扫描降级 - 插件注册为 agent-plane 工具,不提供安全隔离;作用域锁是 workflow 约束而非权限边界
研究附录(docs/research/)
| 文档 | 内容 |
|---|---|
| DSNLE_JOURNEY.md | 全程历程与版本链 |
| P7_REFACTOR.md | 模块化重构 + P7 三机制 + 实验后修复 |
| P6_DATA.md / P7_DATA.md | 40 卡实验逐卡数据(含去 gold 化 20 卡) |
| AUDIT_ADJUDICATION.md | 四角度深度审计裁定(修了什么/裁定不修什么及理由) |
| NLE_DSH_FIT.md / DSH_NLE_SPEC.md | 机制规格与 DSH 契合论证 |
| NLE_VALUE_ASSESSMENT.md / REPLAY_REPORT.md / HANDOFF.md | 价值评估、轨迹重放、实验纪律 |
开发
nle-plugin/
nle-rules-core.mjs ← 仓库根(规则唯一源,插件经 import 引入)
dsnle-plugin.mjs ← [生成] 持久插件(preset 挂载入口,勿手改)
frag-apply-*.mjs ×4 ← apply 函数体碎片(改插件逻辑改这里)
build-dsnle.mjs ← 纯拼接构建器
nle-semantic/server.mjs ← 语义/git 信号 helper(可选)
install-dsnle.mjs ← 安装脚本(standalone / --into 两模式)
改代码 → node nle-plugin/build-dsnle.mjs → 重跑安装脚本(覆盖 preset 内副本)→ 新会话生效。
规则层回归:node smoke-test.mjs(无文件依赖纯函数断言)。
实验装置完整回归(fixture-gate 245 断言)依赖实验仓库,不在本仓库分发。
License
Links
More in this category
vectorize-io/hindsight#coding-agents★ 41184
Hindsight, agent memory that learns: long-term project memory with auto recall and retain, knowledge pages, deep reflection, and per-repo memory banks.
volcengine/OpenViking#examples/dsh-memory-plugin★ 38914
OpenViking memory and context bundle for DeepSeek Harness: pre-step auto-recall and profile injection, session capture, `viking://` URI guarding, and recall/write memory tools backed by an OpenViking server.
agentscope-ai/ReMe#dsh★ 3530
Connects DeepSeek Harness to ReMe's local-first, self-evolving personal knowledge base: automatically captures completed main-agent conversations as user-owned Markdown memory, searches conversations and source material through reme_search with BM25, optional embeddings, and wikilink expansion, and schedules daily memory consolidation.
zilliztech/memsearch#MemSearch★ 2679
Shared Markdown memory for DSH and other coding agents, with automatic capture, pre-step context injection, searchable recall, and memory-to-skill self-evolution through a review panel.
vshulcz/deja-vu#extensions/dsh★ 1081
Reads the session files thirty-three other coding agents on this machine already wrote — Claude Code, Codex, Cursor, VS Code Copilot Chat, opencode, OpenClaw, Hermes, Kimi, Cline, Zed and more — including sessions from before it was installed: six tools (deja_recall, deja_session, deja_blame, deja_fix, deja_how, deja_remember), a /deja command, and optional automatic recall added to the runtime context. Local BM25 index, no LLM, no embeddings, no network (dsh plugin --profile web add dsh-deja).
adoresever/graph-memory★ 631
Traceable, searchable cross-session memory for DeepSeek Harness — conversation knowledge as typed graph nodes (TASK/SKILL/EVENT) and typed edges.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.