dsh-whale-pal: Cross-Session Memory, Compressed Archives, and Persona Core

Foreword

In DSH (DeepSeek Harness), when pairing programming for a long time or repeatedly changing requirements, two common issues arise: one is starting a new session and having to explain the greeting, preferences, and progress from scratch; the other is that as conversations get longer, previously set constraints are squeezed out by context compression, causing the model to vaguely say “I don’t remember.” Relying solely on expanding the context window or occasionally manually /compact often fails to stop the question of “Can I still retrieve what was said by number after hundreds of rounds?”

Below introduces the community plugin dsh-whale-pal (maintainer: qihao1123, category: Memory). Once installed into a profile, it performs cross-session memory extraction on the host side, turns compressed history into retrievable archive cards, and automatically or manually switches sessions by rules when the window is too full to handle; it also provides configurable persona cores and mode segments switchable by working directory. The plugin has no third-party dependencies, does not initiate network requests itself, but every round of memory extraction calls the host model, and the most recent 24 turns of dialogue (≤4000 chars) are sent with the host request—when using a cloud model, this part leaves the local machine.

What is it

dsh-whale-pal is an npm package for the DSH desktop version (Cordis plugin interface), current version 0.2.1, license MIT. It injects systemPrompt, webServer, commands, tools, workspaceController into the host; in the system prompt, it sequentially concatenates the persona core, mode, current round memory directory, processing flow progress, and compressed archive directory. State persistence is in ~/.dsh/whale-pal/<profile>/, and the ledger and compressed archives are written under the user-specified note library’s 台账/ (Ledger) and _上下文/ (Context) folders.

Core selling points consistent with README description: Cross-session memory (retrieve by number), Compression doesn’t lose history (archive cards retain original text), Switch sessions when full (if still exceeds limit after compression, open a new session, stop the old one).

Core Features

Memory: Extraction every round, directory in prompt, body read on demand

At the end of every round (turn/end), when the slot allows (default important: both human and AI speak and transcript ≥80 chars), a separate small model is called to extract facts, preferences, events, unfinished items, etc., from recent dialogue. Each item is one sentence (≤40 chars), showing “Remember / Always Remember / Promised / Unfinished” in the short-term prompt; repeated mentions can be promoted to the long-term layer. Items have numbers (e.g., M-003), each body ≤300 chars, will fade over time and be eliminated when capacity is full, with elimination traceable. At most 5 lines of directory summary in the system prompt per round; when the model needs details, it retrieves them by number, up to 2000 chars at a time, and does not fabricate if the number is not found.

Memory and configuration exist locally in state.json, config.json; when correcting conclusions, the ledger only appends, it does not tamper with historical lines.

Compression: Follow DSH native flow, compressed paragraphs become archive cards

Compression ratio is configurable (compaction.ratio / floorMargin), order consistent with DSH: trim first, then test, only summarize if still exceeds; summary uses host /compact, plugin does not replace compressor. The compressed segment is written as an “Archive Card”, entering the note library _上下文/压缩档案/, batch number B00x; the system prompt gets an extra line of archive directory (e.g., C032 · …), details are read back by number. Supports search by word, list by batch, and batch rollback (move to _上下文/回收站/, not hard delete).

Modes and Persona

The settings page has eleven persona fields, which can be split from a paragraph and filled in; if name is not filled, use placeholder “Whale”. /whale bind adds the current directory to the “Whale” workspace list, sessions in the list are in Whale mode, others are Assistant mode; the criterion is the session’s current directory strictly equal (subdirectories don’t count as the same disk). Assistant mode emphasizes task accuracy, Whale mode prioritizes persona expression.

Switch sessions when full

After automatic compression, if the next round still triggers the limit, the plugin will open a new session with the same directory and preset and re-attach to the original workspace: Assistant mode includes a handover note, Whale mode opens cleanly; the old session prompts the new session id and stops. Can also manually /whale new.

Commands and Tools

Common session commands include /whale mode, /whale bind / unbind, /whale new, as well as search, read, batch, rollback under /whale ctx. The host side registers 7 tools (e.g., whale_pal_memory, whale_ctx, whale_pal_health etc.). After installation, the Web GUI has a settings page, HTTP channel is at /api/whale-pal (including /health, /status).

Installation and Enablement

Dependencies: Node.js ≥ 22, DSH ≥ 0.2.2-rc.3 (see engines.dsh inside the package, host will reject activation if below this version), and one profile. Installation is consistent with the official README, divided into three steps.

1. Install to profile’s node_modules

npm i dsh-whale-pal

2. Insert the package’s built-in mount items into the profile’s cordis.patch.yml

- insert:
    - id: dsh-whale-pal
      name: dsh-whale-pal

3. Restart DSH

Modifying host-side code such as index.js and lib/host.js requires a restart; only lib/client.js (settings page) requires refreshing the browser.

The plugin reads and writes local configuration and note library directories with the current DSH process permissions. Before installing, it is advisable to browse the GitHub repository source code and MIT license to confirm the note library path and backup strategy fit your environment.

Typical Usage

The “Five-Minute Guide” in the README can be followed directly:

  1. Fill out the persona card on the settings page (can “split” it to auto-fill items).
  2. Execute /whale bind in the project directory you want to be in Whale mode.
  3. Use /whale mode to confirm the current directory’s belonging to the list.

In long conversation scenarios, relying on the default memory slot allows the model to see a short memory directory in the prompt; after context compression, use /whale ctx subcommands to query archives by number or batch. When changing the note library, change the path in the settings page; the plugin will validate and copy 台账/ and _上下文/ to the new library before submitting the configuration.

Local quality verification (provided by maintainer):

node scripts/verify.mjs

Suitable Scenarios and Notes

Who is it for: Developers who set up DSH themselves, pair program for a long time in fixed repositories, need “seamless switching between sessions”, and want compressed history still retrievable by card.

Boundaries to watch out for (all from README “Known Boundaries”):

  • When using the minimal preset of @deepseek-ai/dsh-persona and complete: true, the plugin-injected segment will be completely overwritten by the preset, and whale_pal_health might still display normal—do not use this preset to verify functionality.
  • Memory evaluation may add one host model call per round; it does not save tokens; failed rounds do not record half an item.
  • Memory fades and is eliminated; retrieving original words is not 100% (README gives sample ratios and three breakpoints).
  • When the old plugin dsh-persona-framework is mounted in the same profile, refusal to start to avoid double persona injection.
  • Officially verified only on Windows + DSH Desktop (profile desktop); Linux/macOS unverified.

DSH ecosystem philosophy is “everything is a plugin”; SkillHub Directory Page is community recorded, with no official affiliation with DeepSeek or Fantom.

Conclusion

dsh-whale-pal turns “what is remembered after chatting for a long time, whether squeezed history can be found, and how to continue when the window is full” into a process of local state + note library archives, rather than claiming never to forget. If your pain points are exactly these two areas, you can install it into the profile in three steps above and try starting from the persona card and workspace binding.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye