Back to home

weopenfire-git

hme-plugin

No description

Stars
1
Language
TypeScript
Created
Aug 14, 2026
Updated
Aug 14, 2026

Introduction

HME — 给 DeepSeek 装上大脑

DeepSeek Harness 很强,但有个硬伤:会话结束,记忆清零 ,下次从头再来。

HME(Harness-Memory-Evolution)就是来治这个的。

鲸宝的三重记忆

  1. 你是谁 —— 你的身份、偏好、习惯,跨项目记住你这个人。
  2. 这个项目是什么 —— 每个项目不可替代的技术栈、约定、核心要点。
  3. 你踩过的所有坑 —— 优秀经验、核心方法论,只要真有用,就往里记。

但它不臃肿。核心记忆用有界上限锁死、只留精华;海量经验沉进档案层,按需检索、满时提醒清理——就像 CPU 的多级缓存:小而快的常驻,大而全的按需取

借鉴 Codex、Claude Code、OpenClaw、Hermes Agent 等成熟记忆系统的优点,让鲸宝不会失忆,也不会被杂事烦扰

和别家比有什么不同?

维度Codex CLIClaude CodeOpenClawHME
记忆结构MEMORY + USER 两文件CLAUDE.md + skills分层记忆USER + MEMORY + archive 三层
防膨胀硬上限(拒绝式)无上限向量库有界 core + 扩容 archive
检索无(全量注入)skills 按需向量检索recall 关键词检索
经验进去模型主动写人类手写自动模型主动写 + 4 条蒸馏判据
可审计纯文本纯文本结构化/黑盒纯文本 § 分隔

30 秒装上

从 GitHub 装(推荐,立即可用):

dsh plugin --profile web add github:weopenfire-git/hme-plugin

或从 npm 装(发布后可用):

dsh plugin --profile web add @ymw/dsh-hme

然后补一行加载配置

打开 profile 的 `cordis.patch.yml`,加一条 host 行:

- insert:
    - id: hme-plugin
      name: '@ymw/dsh-hme'  # npm 装用包名;GitHub 装改为 github:weopenfire-git/hme-plugin
      config:
        memoryCharLimit: 2584
        userCharLimit: 1597

给你的 DeepSeek 装上大脑。


hme-plugin — Harness-Memory-Evolution

Give your DeepSeek a mind of its own.

DeepSeek Harness is formidable — yet it harbors one flaw: the moment a session ends, the memory resets. Preferences, conventions, hard-won lessons all evaporate, and the next session starts from blank.

Enter HME (Harness-Memory-Evolution).

The Whale's Threefold Memory

  1. Who you are — your identity, your preferences, your habits, remembered across every project.
  2. What this project is — the irreplaceable tech stack, conventions, and core points of each workspace.
  3. The pits you've fallen into — proven lessons and core methodology; anything genuinely useful, commit to memory.

Yet it never grows bloated. Core memory is sealed by bounded caps to keep only the essence; the flood of experience sinks into an archive tier, retrieved on demand and pruned by suggestion when full — like a CPU's multi-level cache: the small and fast stay resident, the vast stay within reach.

Drawing on the strengths of Codex, Claude Code, OpenClaw, and Hermes Agent, HME lets your whale never forget — and never be distracted by trivia.

How it stacks up

DimensionCodex CLIClaude CodeOpenClawHME
Memory shapeMEMORY + USER two filesCLAUDE.md + skillslayered memoryUSER + MEMORY + archive three-tier
Against bloathard cap (reject)unboundedvector storebounded core + elastic archive
Retrievalnone (full injection)skills on demandvector searchrecall keyword search
Expertise inmodel writes manuallyhuman hand-writesautomaticmodel writes + 4 distillation criteria
Auditabilityplain textplain textstructured / black-boxplain text §-delimited

Install in 30 seconds

From GitHub (recommended, works right now):

dsh plugin --profile web add github:weopenfire-git/hme-plugin

Or from npm (once released):

dsh plugin --profile web add @ymw/dsh-hme

Then add one loader row

Open the profile's cordis.patch.yml and add a host row:

- insert:
    - id: hme-plugin
      name: '@ymw/dsh-hme'  # package name for npm; use github:weopenfire-git/hme-plugin for GitHub
      config:
        memoryCharLimit: 2584
        userCharLimit: 1597

Give your DeepSeek a mind of its own.


Technical reference

Cross-session long-term memory for DeepSeek Harness, as an out-of-tree plugin. It gives an agent two bounded plain-text memory files plus a memory tool, so user preferences and project facts survive across sessions instead of being relearned every time.

Status: Phase 1 + Phase 1.5 — core memory plus the archive overflow layer. Developer preview: the Harness APIs this plugin builds on are still changing. See DESIGN.md and ARCHIVE.md.

What it ships

  • A memory tool that adds, replaces, and removes durable facts.
  • An archive tool (add/replace/remove/move) plus a recall tool over a larger per-workspace overflow layer.
  • Two context blocks, frozen at session start and injected into every turn of that session:
    • hme:user — the global user profile.
    • hme:memory — the current workspace's project facts.

Memory files

FileLocationHard cap
USER.md$DSH_HOME/hme/USER.md (global, shared across workspaces)1,597 chars (F₁₇)
MEMORY.md<workspace>/.dsh/hme/MEMORY.md (per workspace)2,584 chars (F₁₈)

Facts are one per line, §-terminated, and human-editable. Caps count Unicode code points. A write that would exceed the cap is rejected, never truncated. Every write re-reads the latest file and merges at the fact level, so concurrent sessions do not clobber each other's edits.

Install

Install from npm or Git into a profile, then reference it by package name:

dsh plugin --profile web add @yinging/dsh-hme
# or from Git: dsh plugin --profile web add github:weopenfire-git/hme-plugin

Add a host row to the profile's cordis.patch.yml (web, CLI, and headless alike):

- id: hme-plugin
  name: '@yinging/dsh-hme'
  config:
    memoryCharLimit: 2584
    userCharLimit: 1597

userMemoryFile and workspaceMemoryFile have sensible defaults; override them to relocate the files.

The memory tool

ParameterTypeRequiredMeaning
actionadd | replace | removeyesMutation to apply.
targetmemory | useryesmemory → workspace MEMORY.md; user → global USER.md.
contentstringfor add / replaceNew fact text.
old_textstringfor replace / removeSubstring that locates the fact to change or drop.

replace and remove locate a fact by substring; if several facts match, the tool reports ambiguity and asks for a narrower old_text. A write never changes the current session's injection — the next session re-reads the files.

Configuration

FieldDefaultMeaning
memoryCharLimit2584Hard character cap for MEMORY.md (F₁₈).
userCharLimit1597Hard character cap for USER.md (F₁₇).
userMemoryFile<dshHome>/hme/USER.mdGlobal user-profile path.
workspaceMemoryFile.dsh/hme/MEMORY.mdWorkspace-relative project-memory path.
archiveCharLimit131072Soft character cap for the archive (2¹⁷ ≈ one context window).
archiveMemoryFile.dsh/hme/archive.mdWorkspace-relative archive path.

How it works

At agent/session-start the plugin freezes both files into a per-scope snapshot, and the two context blocks serve that snapshot for the whole session. Writes go straight to disk with read-merge-write, so the current session's view stays stable while the next session sees the latest facts. Injection uses systemPrompt.context(), which records the memory as a persistent user-role snapshot rather than re-reading the files each turn.

Develop / verify

hme-plugin is a pnpm workspace member for dependency resolution only, not a build target. Run pnpm install once so its @deepseek-ai/* dependencies link, then:

pnpm exec tsc -p hme-plugin
pnpm exec vitest run --config hme-plugin/vitest.config.ts

Roadmap

  • Phase 1.5 — archive overflow layer (archive / recall tools); see ARCHIVE.md.
  • Phase 2 — skill evolution: generate, optimize, and curate skills.
  • Phase 3 — reflection and maintenance in background jobs.

License

MIT