Preface¶
When running Agents in DSH, the default approach for finding information mostly relies on read, grep, and glob. A common scenario is that grep hits multiple files, which are then read one by one, only to finally discover that what’s actually needed is just a single paragraph. If knowledge is scattered across docs/*.md, line numbers change, references are hard to maintain, and there’s no unified structural self-check.
Below we introduce the DSH plugin project-node-memory by maintainer levodoubt (community category: Memory). It treats .nodekb/ under the project as a knowledge base: no index database, no vectors, no background processes—after removing the plugin, it’s still just a collection of ordinary Markdown files.
What This Is¶
In one sentence: Markdown-as-database—providing 10 kb_* tools for Agents and a three-column sidebar panel “Project Node Knowledge Base” for humans; supporting stable TID addressing, transclusion, and structural self-checks.
- Catalog page: skillhub.cn/plugins/levodoubt/project-node-memory
- Source code: github.com/levodoubt/project-node-memory
- License: MIT (see
package.json) - Current package version: 1.3.2; requires Node.js >= 18; DSH compatibility
>=0.1.5-rc.1
Typical directory structure:
项目/
└── .nodekb/
├── index/entry.md
├── doc/03-build.md
├── lessons/001.md
└── diag_ignore.json # Optional: exemption sample
Core Capabilities¶
Four Things Compared to Using read/grep Bare¶
| Capability | Tool | Effect |
|---|---|---|
| View structure before reading content | kb_read mode=toc |
Replaces full read with a ~200 token table-of-contents view |
Stable TID (e.g., doc:03-build:3.1) |
kb_read target=… |
Doesn’t rely on line numbers; file changes don’t break references |
| Expand references in-place | kb_read mode=subtree |
Get assembled context in one call |
| Structural self-check | kb_diag |
Detects dangling references, reference-position paragraphs, cycles, orphans, etc. |
mode=subtree exceeding maxlen (default 50000 characters) will throw an error directly, suggesting to switch to toc / node, without silent truncation.
10 kb_* Tools¶
| Tool | Purpose |
|---|---|
kb_list |
List libraries and default library; call first when unsure about the kb parameter |
kb_read |
target + mode (subtree / node / toc / raw) + maxlen |
kb_search |
Chinese-friendly search returning stable TID, type, source line, and snippet |
kb_diag |
Structural self-check; fails directly when there are errors |
kb_backlinks |
Who references this node; recommended to run before changing TID or deleting nodes |
kb_init |
Idempotent creation of .nodekb skeleton and placement conventions |
kb_write |
append / replace / create / node; validates before writing, self-checks after writing |
kb_rename |
Rename files and update all library-wide references |
kb_vcs_status |
Snapshots and uncommitted changes of embedded git in the library (only describes when git is absent) |
Four Layers to Guide Agents to Prefer kb_*¶
- System prompt section (enabled by default, can be disabled with
prompt.enabled=false): About five lines of rules, guiding knowledge precipitation via.nodekb/andkb_*instead of manually buildingdocs/*.mdwithwrite. UseGET /nodekb/api/promptto verify registration. kb_init: A single call to lay outdoc/,lessons/,todo/,index/entry.md, etc., preventing Agents from creating directories on their own.kb_write: Validates TID,<node>occupying a single line, path boundaries; runs diag after writing. Regularwritelacks equivalent constraints.- Bundled skill
project-node-memory-guide(can be disabled withskill.enabled=false): Detailed writing procedures are inskills/project-node-memory-guide/SKILL.md; the plugin registers to memory viactx.skills.register(), not relying on DSH’s automatic discovery ofskills/within the npm package.GET /nodekb/api/skillcan be used for verification.
Panel (Read-only Browsing)¶
After opening the sidebar “Project Node Knowledge Base”, it has three columns: left for node tree and graph settings, middle for node graph (tree layout, type coloring), right for rendered Markdown content and node properties; [[TID]] is clickable. Data comes from host /nodekb/api/*. The right panel renders at most 10000 characters per view. To write to the library, md files must still be edited (write / edit or kb_write).
Installation and Configuration¶
Installation¶
After npm release:
dsh plugin add project-node-memory
Packaging from source (for development):
npm pack
dsh plugin add ./project-node-memory-<version>.tgz
Note: You should add the packaged .tgz, not directly add the source directory (link dependencies may cause DSH to fail to start after the directory is moved or deleted). Host-side changes require restarting DSH; panel changes can be hot-loaded after reinstallation.
Configuration (Optional)¶
Written under the config: of the corresponding plugin entry in cordis.patch.yml:
| Key | Default | Effect |
|---|---|---|
workspace |
Session workspace / process cwd | Library discovery and path whitelist boundaries |
libraries |
None | name: directory, registering libraries outside the workspace (the directory must contain .nodekb/) |
registries |
Workspace .nodekb/registry.json + user global registry |
Additional kb_registry.json |
exclude |
See README | Directory names ignored during library discovery, supporting * and !pattern |
prompt.enabled |
true |
Whether to register the system prompt section |
skill.enabled |
true |
Whether to register the bundled skill |
exclude example:
config:
exclude: ['tmp_*', '!tmp_keep', 'scratch']
Workspace resolution priority (summary): exec context (panel directory / session workspace) → config.workspace → environment variable DSH_NODEKB_WORKSPACE → the most recently used directory by a tool → process cwd. Debug via GET /nodekb/api/where.
Typical Usage¶
1. Initialize the Library¶
Call kb_init from the Agent or in the session to generate the standard .nodekb/ structure in the workspace (existing structure is not overwritten).
2. Read and Expand by TID¶
Call kb_list first when unsure of the library name; use kb_read to read a node, e.g., set target to doc:03-build:3.1, use the default mode=subtree when assembled context is needed.
3. Writing Style and Syntax (Excerpt)¶
Position-based headings and explicit nodes:
## 3.1 编译契约 → tid = doc:03-build:3.1
<node name="fact:abi" type="fact" parent="doc:03-build">
正文
</node>
Structural references and value embedding:
[[node="doc:03-build:3.1"]]
[[tscl="fact:abi"]]
Use kb_write to modify the library; use kb_backlinks and kb_diag before major changes. The library location parameter kb can accept a registered name or path; when not provided, it resolves via workspace .nodekb, the uniquely discovered library, or the unique registry entry. Within the workspace, it also auto-discovers by convention (e.g., <ws>/.dsh/skills/<skill>/.nodekb/); see README “How Libraries Are Located” for details.
Use Cases and Notes¶
Suitable for: Teams wanting project knowledge in Markdown, Agents needing stable references and structural self-checks, and multiple people managing .nodekb/ with git.
Notes:
- The plugin runs with the current DSH process privileges; review the source code and MIT license before installation.
- The community catalog skillhub.cn is an independent site, with no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem philosophy is “everything is a plugin”, this article only introduces the plugin’s capabilities without fabricating cases or user data.
- The repository has 0 stars on GitHub (based on clues from the catalog page); features and commands are subject to the README and
package.json.
Conclusion¶
project-node-memory consolidates “exploratory grep + reading multiple files” into a table-of-contents view, TID addressing, transclusion, and kb_diag, keeping knowledge in .nodekb/ md files. For installation or to read the complete syntax and registry format, please open the plugin catalog page and GitHub README.