Introduction¶
In DeepSeek Harness (DSH), each workspace operates as an isolated context. Simply placing files in a shared directory won’t make a new session automatically know to “go look up the knowledge.” The common workaround is to manually copy the index into the system prompt or rely on external sync tools, both of which are prone to omissions or drift.
Below is an introduction to dsh-shared-workspace-memory. It provides DSH with a cross-workspace shared memory / knowledge base: the knowledge base lives in a single directory on disk, its keyword index is automatically injected into every session’s system prompt, and new sessions will “go check the knowledge base” without you having to remind them. It also ships a kb command for on-the-fly terminal search, and exposes three agent tools: kb_search / kb_read / kb_append.
What It Installs on Your Machine¶
| Location | Content | Purpose |
|---|---|---|
~/work/knowledge/ (configurable) |
INDEX.md, conventions.md, lessons/, decisions/, projects/ |
The knowledge base itself — plain Markdown, no database |
~/.local/bin/kb (configurable) |
A bash script, ~2 KB | Terminal search command |
~/.local/bin/.dsh-shared-workspace-memory-kb.json |
Install manifest (script sha256, install timestamp) | Proves kb was installed by this plugin; used to safely remove it on uninstall |
kb is a new script file introduced by this plugin — please be aware before installing. It only reads Markdown files under the knowledge base directory and prints matching lines. It makes no network calls and writes nowhere else.
If a file named kb already exists at the target path (installed by another program), the installer will skip and preserve the existing file, reporting a different kb command already exists in the status.
Installation¶
# Install from npm (recommended)
plugin_manager install_bundle target=dsh-shared-workspace-memory
# Or pin a version
plugin_manager install_bundle target=dsh-shared-workspace-memory@0.2.2
# Local directory install (dev mode)
plugin_manager install_bundle target=file:/path/to/dsh-shared-workspace-memory
After installation:
- The package is copied to
~/Library/Application Support/dsh-desktop/harness/profiles/.generations/live/dsh-shared-workspace-memory+<ver>+<hash>/node_modules/dsh-shared-workspace-memory,
andprofiles/desktop/node_modules/dsh-shared-workspace-memoryis a symlink pointing to it; - The host side (
index.js) is hot-loaded — no restart required; - The browser side (
client.js) is auto-discovered by the Host scanningpackage.jsonfordsh.client; just refresh the page to see the settings panel.
The dsh declaration in the package:
"dsh": {
"bundle": { "patch": "./cordis.patch.yml" },
"client": { "platform": "web", "immediately": true, "inject": ["@deepseek-ai/dsh-api-remotes", "@deepseek-ai/dsh-client-locale", "@deepseek-ai/dsh-client-ui-plugin-manager"] }
}
Using the kb Command¶
kb # List all files in the knowledge base
kb 帧 压缩 # Search (OR across multiple terms); hits are highlighted in the terminal
kb --path # Print the knowledge base path
kb --version # kb 0.2.2
kb --uninstall # Remove only the kb command (knowledge base is kept)
kb --uninstall --purge # Remove kb AND delete knowledge base content (requires typing "yes" to confirm)
When kb output goes to a terminal (stdout is a tty), it uses grep --color=always for highlighting. When piped or redirected, colors are automatically stripped so agents can parse the output cleanly.
In-Session Usage¶
Within a DSH session:
/kb status,/kb search <keyword>,/kb add <file> <content>,/kb scaffold,/kb cleanup [--purge]- Tools:
kb_search/kb_read/kb_append - Settings → Plugins → Shared Knowledge Base: view path, kb status, file groups, injected character count; buttons for “Refresh / Reinstall kb”; cleanup section with two entry points
What Gets Auto-Injected¶
Each time the system prompt is assembled:
- Read the “Keyword Index” section from
INDEX.md(falls back to the first 40 lines if absent); - Truncate to
maxIndexChars; - Append the path, file listing, and four usage rules as the
knowledge-basesection (order: 900).
text() must return synchronously, so it returns the last rendered result while checking once in the background:
INDEX.mdmtime changed → re-render (the keyword table is the main body of the injection);- More than 30 seconds since last render → re-render anyway, so newly added files appear in the “Existing files” line even if
INDEX.mdwasn’t touched; - Checks are throttled to at most one
statper second, and concurrent calls share the same render pass.
Result: after editing INDEX.md or adding a new file, the next conversation turn picks it up — no restart needed (since 0.2.2; 0.2.1 and earlier froze the index in-process and required a restart).
The injected section looks like this (excerpt):
## 共享知识库(dsh-shared-workspace-memory 自动注入)
路径:<你的知识库绝对路径>(默认 ~/work/knowledge)
现有文件:INDEX.md、conventions.md、lessons/…、decisions/…、projects/…
| 关键词 | 去哪份文件 |
...
检索命令:grep -rl "<关键词>" ~/work/knowledge
Configuration¶
- insert:
- id: memory
name: dsh-shared-workspace-memory
config:
root: ~/work/knowledge # Knowledge base directory
binDir: ~/.local/bin # kb install directory
injectIndex: true # Whether to inject into system prompt
installCli: true # Whether to install the kb command
maxIndexChars: 1200 # Max characters for injected index
order: 900 # Prompt section order
harnessRoot: null # Usually leave as-is; defaults to $DSH_HOME or app support dir
The defaults shown above are what you get out of the box; ~ expands to your home directory.
Uninstall: What You Brought, You Take With You¶
The plugin does not modify session, does not alter workspace.json, and does not touch DSH’s own files. Cleanup is available from three entry points, all of which ask first whether to keep the knowledge content:
- Settings page: Settings → Plugins → Shared Knowledge Base → Cleanup
- “Remove kb command only (keep knowledge base)”
- “Remove kb command and delete knowledge base content” (requires a second confirmation beforepurgeKnowledge: true) /kb cleanup(add--purgeto also delete content)- Terminal:
kb --uninstall/kb --uninstall --purge
Details:
- Before deleting
kb, the manifest’s marker and sha256 are verified — anykbnot written by this plugin is left untouched; - The legacy manifest
.dsh-knowledge-kb.jsonleft behind from a previous name is automatically cleaned up; - No problem if you skip cleanup:
plugin_manager remove_bundle dsh-shared-workspace-memoryonly removes the package; thekbscript stays and you can runkb --uninstallanytime; - After uninstall, if you want a trace:
purgeonly deletes the contents underroot— it does not remove the directory itself.
Troubleshooting¶
| Symptom | Check first |
|---|---|
| Injected section not visible in new sessions | curl .../api/dsh-shared-workspace-memory/status to check injectIndex and char count; then confirm INDEX.md has a “Keyword Index” section |
| Injected section present, but agent doesn’t use it | Check if the usage rules in that section are being overridden by other instructions; verify kb_search appears in the tool list |
kb: command not found |
Does echo $PATH include ~/.local/bin? Or click “Reinstall kb” on the settings page |
| No color in terminal | Highlighting only applies to ttys; kb x \| cat intentionally strips colors |
| Settings page won’t open | The page key is <package-name>#<cordis.patch.yml id>, i.e. dsh-shared-workspace-memory#memory — all three must stay in sync |
| Bridge returns 401/404 | It goes through the Host’s same-origin + loopback guard; must be accessed from the GUI same-origin, not fetched from another site |
Data Access Declaration¶
- Read: Markdown under
root; the plugin’s own manifest underbinDir. - Write: Missing scaffold files under
root; lines appended bykb_append;kband its manifest underbinDir. That’s all. - Network: None. HTTP routes only listen on the Host’s existing local port and validate same-origin / loopback.
- Does not read or write files in other workspaces, does not touch DSH session logs,
workspace.json, or projection caches.
No Local Machine Info in the Package¶
The published parts of the plugin (index.js / client.js / lib/ / scripts/kb / locale/ / cordis.patch.yml) contain no local paths, usernames, or workspace names; the templates in lib/kb.js for generating INDEX.md and conventions.md use generic copy (with placeholders like projects/<project>.md).
What belongs to your local data and is NOT shipped with the package:
| Location | Content | Could it be injected onto another machine? |
|---|---|---|
~/work/knowledge/** |
Your knowledge base content and INDEX.md index |
No. root is determined by local config; the package itself carries no content |
$DSH_HOME/AGENTS.md |
Workspace map, sedimentation protocol | No. That’s a local global instruction |
~/.local/bin/kb |
The installed script | No. The install manifest is rewritten on package install |
One practical tip: the “Keyword Index” section of INDEX.md is injected wholesale into every local session, so don’t put machine-specific absolute paths or workspace name lists there — use ~/work/knowledge-style references, and keep workspace listings in $DSH_HOME/AGENTS.md.
Renaming: Linked Touchpoints to Watch¶
The rename from dsh-knowledge to dsh-shared-workspace-memory actually touched 6 places. When renaming the package, replicate all of them:
package.jsonname(the browser-side__ModuleLoader__.load({ id })must match exactly);cordis.patch.ymlname(module name) andid(row id);client.jsPLUGIN_PAGE_KEY(<package-name>#<row-id>) andBASE(HTTP prefix);index.jsPREFIXandexport const name;lib/install.jsMANIFEST_NAME/MARKER/pluginfield (and add the old manifest name toLEGACY_MANIFEST_NAMES);- Comments and manifest path in
scripts/kb.
After renaming, re-running install_bundle creates a new generation. Remember to remove_bundle the old package, or both will be installed simultaneously and the index gets injected twice. Even more critical: the old and new generations must NOT share the same cordis row id, or disabling one row / enabling the other will conflict. Swap the id along with the rename (memory → workspace-memory).
Known Limitations¶
- No automatic knowledge extraction: what gets written is still decided by the human / agent (frequency is governed by the global
AGENTS.md: at most one proactive reminder per session). - What’s injected is an index summary; specific content still requires
kb_readto read the file. - A very large
INDEX.mdwill consume tokens in the injection; control it withmaxIndexChars. - Markdown only; no PDF / image search.
- What’s injected is the index — if
INDEX.mdis too long it gets truncated. Body content is always accessed via tools / commands.
Changelog¶
0.2.2¶
- Fixed startup crash:
client.jsnow exportsinject: ['slots', 'locale']. Previously it accessedctx.slotsdirectly without declaring the injection, causing Cordis to throwcannot get property "slots" without injectand the entire Web client to crash during startup (surfacing on desktop as “The desktop host stopped”). Registration failure is now only a warning and no longer blocks startup. - Fixed frozen injection block:
lib/kb.jsaddscreatePromptCache;text()returns the last rendered result on each call and checksINDEX.mdmtime plus a 30-second staleness threshold in the background, so edits or new files appear in the next turn without a restart.
0.2.1¶
Renamed dsh-shared-session-memory → dsh-shared-workspace-memory; cordis row id changed to workspace-memory; INDEX.md no longer contains local workspace names or absolute paths.
0.2.0¶
First rename to dsh-shared-session-memory; README rewritten; backward-compatible upgrade for old kb manifest / marker.
0.1.0¶
First installable release.
Use Cases¶
Suitable for people / agents who need to share knowledge across workspaces, accumulate decisions and protocols, and reuse the same context across multiple sessions.
Notes¶
- The plugin runs with the permissions of the current DSH process.
- Review the source code and license before installing.
- Knowledge base content must be organized manually; the plugin does not provide automatic extraction.
- Markdown only; no PDF / image search.
Recap¶
dsh-shared-workspace-memory provides a shared memory within DSH: one directory, an auto-injected index, a terminal search command kb, and three agent tools. It does not modify DSH’s own files, does not touch other workspaces, and only reads/writes at the locations it declares. It’s well-suited as infrastructure for long-term knowledge accumulation.
- Directory page: https://www.skillhub.cn/plugins/tanxiaolong/dsh-shared-workspace-memory
- GitHub: https://github.com/tanxiaolong/dsh-shared-workspace-memory