Introduction¶
Every new session in DeepSeek Harness (DSH) starts from scratch by default, with no cross-session memory. This plugin injects local state into the prompt of every new session by hooking ctx.systemPrompt.context.
Plugin Purpose¶
This is a DeepSeek Harness plugin. It injects a bounded, timestamped brain snapshot (identity + state fingerprint + open items + pointers and boundaries) into every new session. It is read-only, performs zero writes, fails loudly, and has zero dependencies.
Core Features¶
- Snapshot injection: Injects a snapshot of the local brain into the prompt context of every new session.
- Read-only and zero writes: The plugin only calls
readFileSyncand does not modify brain files. - Fail loudly: If the block length is less than 300 characters, the plugin refuses to register and prints the reason instead of failing silently.
- Zero dependencies: Pure ESM with no dependencies on other packages.
- Hard limit: Enforces a
maxCharslimit (default 1000, packaged patch is 1300) to prevent context window overflow.
Installation¶
The plugin requires a Node.js environment, version 18 or higher.
pnpm add @xianshu/dsh-second-brain
Configuration¶
After installation, the plugin is enabled by default (the default in v0.1.0 was the opposite, which can lead to misuse). The key configuration options are as follows:
| Option | Default | Description |
|---|---|---|
brainRoot |
~/.dsh/brain (or $DEEPSEEK_BRAIN) |
Directory containing the brain file |
maxChars |
1000 (packaged patch is 1300) | Maximum character count for the injected block; minimum is 300 |
order |
200 | Layer order in the system prompt |
inject |
true | Whether injection is enabled; set to false or environment variable DSH_SB_INJECT=0 to disable it |
Usage and Verification¶
After installing and restarting DSH, new sessions will automatically receive the injected content.
Verification steps:
1. Open a new session and ask: what Second Brain information did you get at startup?
2. If the answer is correct, the injection is working.
3. Check the logs. A record like the following should appear:
[second-brain-xianshu] ✅ 注入已注册:name=xianshu-second-brain order=200 块长=NNN 字符
Notes¶
- Snapshot mechanism: The injected content is a snapshot, not real-time state. If the file is modified externally, new sessions will still use the snapshot content (the file takes precedence over the snapshot).
- Installation default: In the current version,
Installed == ONis the default. - GitHub routing limitations: If installed via a
github:route, the system requiresgitto be available inPATHand able to accessgithub.com.
Ecosystem Context¶
The DeepSeek Harness philosophy is “everything is a plugin.” This plugin is maintained by DiaryOfUranus. You can view the directory page on SkillHub, or view the source code on GitHub.