Introduction

When developing agents with DeepSeek Harness (DSH), a common pain point is that agents lack persistent memory of project context. This prevents agents from reusing historical precedents when handling subsequent tasks, or from ignoring established constraints when modifying code. DSNLE aims to solve this problem. It does not rely on prompt manipulation, but builds a complete mechanism for constraints, observation, memory, and validation based on native DSH primitives.

What Is This

dsh-cognition is a plugin that provides project memory capabilities for DSH Agent. It leverages native DSH primitives (such as tools/pre-execute, fs/edit-intent, skills, and session event sourcing) to implement constraints and validation, and provides memory through Learned, Precedent, and Git change tracking.

Installation and Setup

Prerequisites: Node.js ≥ 22 + a running DeepSeek Harness.

1、Clone the repository and install:

git clone https://github.com/scd13150/dsh-cognition.git && cd dsnle
node install-dsnle.mjs --set-default

2、Activate it in new sessions. --set-default creates a dsnle preset and sets it as the default (while also backing up your configuration). After installation, you must restart DSH or open a completely new session; existing sessions will not automatically load the new preset.

3、Verify the installation. Run the following command in a new session:

nle_check

If it returns ok: true, the installation was successful. At this point, you should be able to see tools such as nle_suggest, nle_focus, and nle_mutate in the tool list, and nle-learned-* and nle-reflections in the skills directory.

Core Features

dsh-cognition provides four layers of capabilities: “Constraints / Observation / Memory / Validation”:

  • Constraints and Observation: Through enforced chains and Scope locks, it intercepts changes before they occur and performs version guarding.
  • Memory Mechanisms:
    • Learned: keyword mappings to files, supporting confidence, decay, and cross-project promotion.
    • Precedent: successful precedents from historical sessions.
    • Git: co-changed files, change frequency, and rollback records.
  • Validation: Through contract gates and the Guard master switch, it ensures state is not tampered with and provides cost reports.

Typical Usage

1. Basic Tool Calls
DSH plugin tool calls include built-in Schema descriptions. A typical task execution chain includes the following steps:

  • nle_suggest: locate and retrieve.
  • nle_focus: lock the Scope.
  • nle_mutate / nle_select: execute edits or perform reconciliation and finalization.
  • nle_guard: master switch validation.

2. Enable the Semantic Channel (Optional)
Semantic retrieval (Embedding reranking) is an optional enhancement. Before enabling it, prepare a workspace directory and run a separate Helper process:

node nle-semantic/server.mjs --spool <工作区>/.nle-semantic

The model uses Xenova/all-MiniLM-L6-v2 (384 dimensions), automatically downloaded by transformers.js (about 90MB and not distributed with the repository).

Notes

  • Sessions and Presets: Active sessions will not automatically receive new presets; always verify in a completely new session.
  • Language Recall: Recall for Chinese tasks against English codebases is weaker; the plugin relies on mechanisms such as learned/alias as a fallback.
  • Dependency Processes: The semantic channel depends on a separate Helper process, and the plugin is registered as an agent-plane tool, providing no security isolation. Scope locks are Workflow constraints rather than permission boundaries.
  • Offline Environments: If you need to use the semantic channel in an offline environment, first run --selfcheck on a networked machine to generate a cache before migrating it.

Conclusion

dsh-cognition deeply integrates project memory capabilities into the development flow through native DSH primitives, creating a closed loop from constraints and observation to memory and validation. For DSH developers who need to maintain context consistency across multiple sessions, this is a practical tool.

Plugin homepage: https://github.com/scd13150/dsh-cognition