Introduction¶
DeepSeek Harness (DSH) starts each session from scratch by default: build commands you figured out together yesterday, deployment details, preferences you corrected—none of these carry over automatically into a new session. In the community, Hermes Agent solves similar problems with bounded memory files and automatic post-turn reviews; DSH provides primitives like ctx.tools and ctx.systemPrompt, but does not ship an equivalent implementation out of the box.
The following introduces dsh-self-evolution (current package version 0.9.0, MIT license), published by maintainer Tommy00748 in the SkillHub directory and the GitHub repository. It ports Hermes’s self-improvement loop into a DSH plugin form, without modifying the DSH core; the memory file format is byte-level compatible with Hermes and interchangeable. It is classified as a “memory” plugin.
What Is This¶
In one sentence: a self-evolution layer on top of DSH—bounded long-term memory, automatic post-turn reviews, programmatic skill writing and merging, skill health checks, cross-session retrieval, and “appears only when there is content” learning indicators (persistent in-conversation rows + cards above the input box).
One of the design goals is: automatic learning can stay on for the long term without worrying about corrupting files, silently deleting or altering memory, or missing notifications that get treated as fleeting toasts.
Core Features¶
1. Bounded, Self-Managed Memory¶
Memory is stored under <dshHome>/self-evolution/:
MEMORY.md: agent notesUSER.md: information about you
Entries are separated by §, using the same format as Hermes. The tools support add / replace / remove / list; replace and remove locate entries by unique substring and refuse operations when ambiguous.
Default capacity matches Hermes: MEMORY at 2200 characters, USER at 1375 characters; no automatic compression. When full, the tool returns ok:false along with all current entries so you can merge and retry within the same turn. Completely duplicate entries are rejected.
A security scan is performed before writes by default (can be disabled with scanOnWrite: false): invisible Unicode, prompt injection, private keys and cloud credentials, authorized_keys, curl … | sh, etc. Writes are rejected on a hit.
Memory is injected via the system prompt section self-evolution:memory (order 100, interpolate: false, so memory bodies are not parsed as {{template}}), with the header line showing the usage ratio, e.g., [67% — 1474/2200 chars].
2. skill_learn: Turn Processes into Loadable Skills¶
Writes a process that just worked into a SKILL.md under a directory DSH actually scans. The default root is <projectRoot>/.dsh/skills (inside the workspace, no extra approval or restart needed).
After writing, it re-reads and lints immediately; if the loader would discard the file, it rolls back, rather than reporting “saved” when it is actually unusable. Frontmatter scalars are output with JSON double quotes to reduce cases where YAML parsing failures cause the skill to be silently discarded; description longer than 500 characters is rejected outright (the directory would silently truncate longer descriptions).
3. skill_doctor: Finds Skills That Get Silently Discarded¶
DSH silently discards skills with frontmatter parse failures and emits no warning. skill_doctor scans all skill roots that DSH reads and distinguishes:
- Load errors: no frontmatter, missing
name/description, non-kebab-case names, unquoted values containing": ", unclosed quotes, etc. - Quality warnings: e.g.,
descriptiontoo long.
When fix: true, it surgically fixes only the offending lines, leaving the remaining bytes untouched, backs up as <file>.bak-<timestamp>, re-validates after fixing, and gives up if it cannot verify.
4. Automatic Post-Turn Review¶
Listens for turn/end, using a helper model (no tools, JSON output) to decide whether the turn is worth keeping. Turns that end due to interruption or error are not learned; turns with fewer than reviewMinSteps (default 2) tool steps are treated as trivial; only one review runs at a time.
The input is a compact text of up to reviewMaxEvents (40) events from the end of the turn, capped at reviewMaxChars (6000) characters. The output contract is strict JSON containing memory, skill, and reason; the prompt asks for restraint, with 0–2 memory entries and empty results being valid.
The landing path is the same as the manual tools (scanning, limits, deduplication, read-back validation). Failures (model unavailable, timeout, invalid JSON, write rejected) are all swallowed and do not affect the current session. On the skill side it supports create and improve: the latter calls the model a second time to merge new knowledge into the existing skill and compact it, avoiding the accumulation of near-duplicate skills; if the merged body exceeds skillMaxChars (12000), it is rejected and the old version is kept. reviewSkillUpdates: false disables rewriting and only keeps new creations.
Automatic review can only append to memory; deletion or rewriting requires queuing for your approval (see “Trust and Approval” below).
5. session_search: Cross-Session Recall¶
Searches real messages from past sessions (complementing the MEMORY that the agent proactively writes). Modes include search (full-text, can scope to session_id), list (recent sessions), read (read a window of context by seq).
The README recommends: search one distinctive word at a time; multiple words are matched as exact phrases. Chinese is tokenized by word; without Hermes-style CJK tokenization, substring-level search can use grep to scan files.
This tool is optionally registered: without a search backend, the rest of the plugin remains usable. Enabling it requires overriding DSH’s session query plugin in the profile patch, for example:
- id: session-query-sqlite
name: '@deepseek-ai/dsh-session-query-sqlite'
config:
path: '/Users/<you>/.dsh/storages/session-search.db'
openAt: first-search # startup | first-search | never
The index is a separate derived database that can be safely deleted and rebuilt; do not point it at the session persistence database itself (single-process index).
6. In-Conversation Learning Records and Input Box Cards¶
When learning occurs, a persistent context line is written after the corresponding reply (can be disabled with transcriptRow: false), with a summary like “Remembered an experience: …”; expanding it shows the review rationale, memory usage, and current entries. The body starts with [self-evolution record · not a message from the user] to avoid being misread as a user message; at most one line per turn, and it is written after the turn is already idle, so it does not trigger an extra step.
Above the input box: when there is no news, it only occupies a faint ◈ in the stats row; when there are learnings or pending approvals, a clickable summary line appears. Clicking expands a panel (pending approvals, MEMORY/USER usage, recent learning timeline, current entries). The card stays visible while there are pending items or the panel is open; read state is stored in browser localStorage (dsh:self-evolution:seen).
A stable guidance block can also be injected into the system prompt (enabled by default with guidance: true), explaining when to write memory, when to distill skills, checking capacity before writing, prioritizing user corrections, etc.
Installation and Activation¶
The installation command comes from the repository README (not an npm published package):
dsh plugin --profile <your-profile> add github:Tommy00748/dsh-self-evolution
Then add the bundle to the profile’s cordis.patch.yml (path like ~/.dsh/profiles/<profile>/cordis.patch.yml):
- id: self-evolution
name: 'dsh-self-evolution'
config:
memoryCharLimit: 2200
userCharLimit: 1375
Host-side components (tools, prompt sections, HTTP routes) are loaded on the next DSH startup; the client client.js can be hot-updated by DSH polling, while changes to index.js require a restart.
Runtime environment: package.json requires Node >= 22, and depends on peer dependencies such as @deepseek-ai/dsh-tools, @deepseek-ai/dsh-llm, @deepseek-ai/schemastery (provided by the installed DSH).
To uninstall, remove the bundle from the profile’s dsh.profile.bundles and delete the package; the memory and skill files under <dshHome>/self-evolution/ are not automatically deleted and must be cleaned up manually.
Configuration Essentials¶
Override configuration using the id self-evolution in the profile’s cordis.patch.yml. Patch replaces the entire config object and does not merge field-by-field, so you must list all the keys you want to keep.
Common options include: storeDir, skillsDir, extraSkillDirs, enableMemoryTool, enableSkillTools, autoReview, reviewProvider / reviewModel, approveReviewEdits (default true: deletion/rewriting requires approval; false auto-merges), uiMode, notify, scanOnWrite, etc. See the Configuration section of the repository README for the full list.
Typical Usage¶
- After installing and writing the profile patch, restart DSH and chat normally; after complex tasks, the automatic review may write to MEMORY or improve/create skills under
.dsh/skills. - When you need to proactively solidify a process, let the model call
skill_learn; when you suspect a skill was “written but never takes effect”, callskill_doctor(withfix: trueif needed). - When memory is full, merge based on the existing entries returned by the tool and then
addwithin the same turn. - If you want to search chat history across sessions, configure
session-query-sqliteper the README and usesession_search; queries should use single, distinctive words. - When automatic review proposes deleting or rewriting memory, view the full text that will be replaced in the card before approving; the approval endpoint only accepts requests from the local loopback that declare JSON.
Use Cases and Caveats¶
Who it’s for: users who develop projects in the same DSH environment long-term, want build/deploy/preferences to persist across sessions, and also want skill files not to be silently eaten by small YAML errors; also suitable for migrating and exchanging Hermes memory files.
Trust boundary (read carefully): the plugin writes through the host process’s node:fs and is not constrained by the session file sandbox. By default it writes to <dshHome>/self-evolution/ and <projectRoot>/.dsh/skills/ (both configurable). Memory is continuously injected into the system prompt, so scanOnWrite is enabled by default. Review the source code and MIT license yourself before installing; the plugin runs with the permissions of the current dsh process.
Other limitations (excerpted from the README Known limits): conversation lines are user-role context injections rather than system lines; the card timeline is read-only and shows only part of the records; session_search uses SQLite unicode61 tokenization, not arbitrary substrings; memory is shared globally by default, and can be isolated per project by pointing storeDir into the workspace.
Conclusion¶
In DSH’s “everything is a plugin” ecosystem, dsh-self-evolution brings bounded memory, turn reviews, skill refinement, and visible learning feedback together, and adds constraints such as provenance, append-only, and approval queues around unattended writes. For further information on categorization and introductions, see the SkillHub directory page; for installation, configuration, and testing instructions, refer to the GitHub repository README.