Memory
imemory
bass1125/imemory · ★ 1
DSH 自进化长期记忆插件:回合后 LLM 自动提取记忆、每步召回注入、语义重排检索、冲突合并、learned-* 技能沉淀,附记忆库管理面板。记忆文件默认存于 harness 根目录($DSH_HOME,未设时 ~/.dsh)下的 imemory/ 子目录,可用 config.memDir 覆盖。
An English summary is not available; the Chinese summary is shown.
安装
dsh plugin --profile web add 'github:bass1125/imemory#dc3d5e8f82368cf30847f3469add98034d9a5e1e'GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
For install and environment setup, plus plugin development tutorials, see DSH community docs ↗
README
Table of contents
中文文档:README.md
⚠️ Release status: Built on Aug 14, 2026 and put into daily use the very next day, this project has already gone through 4 iterations. Because it is highly personalized, the published version is still a beta — APIs and behavior may change as it evolves. Thanks for your understanding.
imemory is a self-evolving long-term memory plugin for DeepSeek Harness (DSH). It keeps your long-term memory in two plain-text files (MEMORY.md — your notes, and USER.md — the user profile; entries separated by a lone § line). After each turn, an LLM extracts durable facts worth remembering and writes them back; before each step, relevant memories are recalled and injected into the context. Reusable workflows are distilled into learned-* skills. A web panel is included.
Features
- Auto-extraction after each turn — the LLM mines the conversation for durable facts (importance 1–10; <3 is dropped; better few than many)
- Per-step recall injection — keyword pre-filter + LLM semantic re-rank (temperature 0), injected without announcing the memory use
- Session opener — new sessions start with the user profile + high-importance notes
- Conflict merge / dedup / decay — consolidated every 6 h (auto-merges plugin-owned entries; user-edited entries only get suggestions)
- Skill learning loop — reusable procedures become
learned-*skills (skills.json → DSH skill registry, loadable via theskilltool) - 6 tools —
memory_search/memory_add/memory_update/memory_forget/memory_sessions/memory_consolidate - Web panel —
/imemory/(browse entries / hit counts / importance up-down / delete / consolidate) - Zero dependency — imports no
@deepseek-aipackage; loads from any install path (manual copy,link:, npm/git) - Profile-agnostic —
webServeris optional: web profiles get the panel automatically; headless/tui profiles run fine without it
Quick start (60 s)
# 1. copy the plugin into your profile dir (web profile example)
cp imemory.mjs ~/.dsh/profiles/web/imemory.mjs
# 2. append to ~/.dsh/profiles/web/cordis.patch.yml:
# - insert:
# - id: imemory
# name: ./imemory.mjs
# 3. restart dsh. You should see: [imemory] 就绪 ... 记忆目录 ...
Installation
Target DSH: 0.1.0-rc.6 (Node ≥ 20). Two ways:
Method A — Manual mount (recommended, no build/npm)
- Copy
imemory.mjsinto your profile dir, e.g.~/.dsh/profiles/web/imemory.mjs - Append to the profile's
cordis.patch.yml:
- insert:
- id: imemory
name: ./imemory.mjs
# optional: config:
# memDir: ~/.dsh/my-memories
- Restart dsh.
Method B — Bundle install (npm / git)
dsh plugin --profile web add imemory # after npm publish
dsh plugin --profile web add https://github.com/bass1125/imemory.git
The package's dsh.bundle.patch declaration mounts the plugin automatically. Remove any manual mount line from Method A first to avoid double-mounting.
Hot reload
- Config changes (e.g.
memDir): the profile'scordis.patch.ymlis watched (watchUserPatches), saving takes effect immediately. - Plugin code changes: restart dsh; or force a re-import by bumping the module URL query in the insert line, e.g.
name: ./imemory.mjs?v=2.
Configuration
Only one option: memDir (memory/notes directory).
| Option | Default | Notes |
|---|---|---|
memDir |
$DSH_HOME/imemory/ (or ~/.dsh/imemory/) |
~ prefix supported; relative paths resolve against the harness home |
The directory is created automatically on startup.
Memory layout
The harness home is $DSH_HOME, defaulting to ~/.dsh (Windows: C:\Users\<you>\.dsh). No hardcoded paths — works out of the box on any machine:
| File | Purpose |
|---|---|
<memDir>/MEMORY.md |
your notes (environment, projects, lessons, skills) |
<memDir>/USER.md |
user profile (identity, preferences, rules) |
<memDir>/memories.index.json |
sidecar index (importance / hits / timestamps) |
<memDir>/skills.json |
learned learned-* skills |
The memory files are plain text — edit them anytime.
§on its own line separates entries; don't use lone§lines inside an entry.
Verification
- A new session's first step carries an
<imemory>opener block - 6
memory_*tools appear in the model's tool list - Panel:
http://<dsh-host>:<dsh-port>/imemory/(web profiles)
Behavior notes
- Extraction: root sessions only; 20 s cooldown; ≤6 memory ops / 2 skills per round
- Recall: keyword scoring, ≤15 candidates go through LLM re-rank; plain keyword fallback without a model
- Consolidation: every 6 h — conflict merge + dedup + decay (entries >14 days with effective score ≤1.5 are retired) + index orphan cleanup
- Importance: 1–10; <3 dropped; hits raise the effective score
- Hermes-compatible: same
§-separated format as Hermes memory files — pointmemDirat an existing Hermes memory dir to adopt old memories seamlessly
Development
imemory/
├─ imemory.mjs plugin body (single file, zero build, zero deps)
├─ package.json bundle declaration (dsh.bundle.patch)
├─ cordis.patch.yml bundle mount patch
├─ README.md / README_EN.md
└─ LICENSE
License
MIT