Introduction¶
When building knowledge base agents in DeepSeek Harness (DSH), common approaches include spinning up separate services, scanning workspace files, or directly interacting with SQLite. SiYuan Note itself provides a kernel HTTP API (default http://127.0.0.1:6806), where writes go through the kernel transaction layer, while indexing and synchronization remain handled by SiYuan. If you want the model to search notes, create documents, read blocks, and append content, without installing additional plugins in SiYuan or modifying the siyuan.db file, you need a bridge plugin on the DSH side that solely calls the API.
Below is an introduction to the community-maintained dsh-siyuan-api (repository SherinG-official/dsh-siyuan-api), categorized as a “Networking Tool” in the SkillHub directory.
What is this¶
dsh-siyuan-api is a SiYuan Note plugin for DeepSeek Harness: it searches notes, creates documents, reads and appends block content, and supports read-only SQL queries on the local index database via the SiYuan Kernel HTTP API. It is maintained by SherinG-official, licensed under MIT, and relies only on Node’s built-in fetch at runtime, requiring no plugin installation on the SiYuan side nor Python.
Compared to “directly reading the workspace / modifying the database,” this plugin deliberately uses only the API: all writes pass through the kernel transaction layer, allowing SiYuan to perform indexing and synchronization normally.
Core Features¶
The plugin registers 5 tools with DSH and provides a read-only diagnostic route GET /dsh-siyuan-api/status when an HTTP host is available (does not echo the Token). It can optionally inject usage standards into the system prompt (disable by configuring prompt: false).
| Tool | Function |
|---|---|
siyuan_status |
Health check: kernel version, Token validity, index DB query capability, block count |
siyuan_notebooks |
List notebooks (name and ID) |
siyuan_search |
Search: mode=keyword for fuzzy keyword search; mode=sql for read-only SELECT |
siyuan_create_doc |
Create a new Markdown document in a specified notebook (can specify a parent document) |
siyuan_block |
Read Markdown by block ID, append content, insert before/after |
regarding error handling, scenarios such as SiYuan not running, authentication failure, or notebook not existing return readable messages with reason codes (e.g., SIYUAN_UNREACHABLE, SIYUAN_AUTH_FAILED) instead of throwing exceptions that interrupt the entire conversation turn. Read-only SQL undergoes a SELECT/WITH pre-check and LIMIT padding on the plugin side, and requests to the kernel always carry mode: "readonly".
Installation and Activation¶
For installation methods, refer to the README: create a tarball from a local directory, then install it into the target profile. Do not concatenate dsh plugin add github:… based on the repository name; the README does not provide a one-click installation command of that form.
Install from Tarball (web / headless profiles, etc.)¶
Ensure there are no spaces in the path (pnpm’s file: dependency will be cut off by spaces):
node <pnpm> pack --pack-destination C:/somewhere/no-spaces
dsh plugin --profile web add "file:C:/somewhere/no-spaces/dsh-siyuan-api-0.1.2.tgz"
dsh plugin add will write to the profile’s dependencies and add the package name to dsh.profile.bundles. Restart the profile after installation to take effect.
desktop profile¶
The CLI will reject dsh plugin --profile desktop … (the desktop profile is exclusive to Electron). You can manually modify the manifest or use the script included in the package:
node scripts/add-to-profile.mjs \
"$DSH_HOME/profiles/desktop/package.json" \
"C:/somewhere/no-spaces/dsh-siyuan-api-0.1.2.tgz"
cd "$DSH_HOME/profiles/desktop" && pnpm install
Restart DSH Desktop after making changes.
Environment and Dependencies¶
- Node:
>=22.13.0(seeenginesinpackage.json). @deepseek-ai/dsh-tools,@deepseek-ai/cordis, etc., are provided by the dsh host and are not written into the plugin’sdependencies, to preventpnpm installin the profile from attempting to fetch host-private packages from npm and failing.
Configuration¶
SiYuan Side¶
- Ensure SiYuan is running (system tray minimized is fine; kernel is unavailable if completely exited).
- Confirm the kernel address: Desktop defaults to
127.0.0.1:6806; if you have changed the port or enabled “Network Servitude”, check “Settings → About”. - API Token: “Settings → About → API token”. On localhost
127.0.0.1without a screen lock password, authentication is not required, and the Token can be left empty; if there is a screen lock password or non-local access, a Token must be filled in.
Plugin Configuration¶
Write to the profile’s cordis.patch.yml or use the settings page:
- id: dsh-siyuan-api
name: dsh-siyuan-api
config:
apiUrl: http://127.0.0.1:6806
token: ''
timeoutMs: 15000
maxRows: 64
defaultNotebook: ''
prompt: true
debug: false
The Token can also be placed in the environment variable SIYUAN_TOKEN (config file takes precedence). You can use !!js in the patch, e.g., token: !!js process.env.SIYUAN_TOKEN || '', to avoid storing the Token on disk.
Self-Check¶
After installation, you can call siyuan_status, or access the following in a web profile:
http://127.0.0.1:<dsh-port>/dsh-siyuan-api/status
Typical Usage¶
Health Check and Notebooks¶
First confirm connectivity, then use siyuan_notebooks to obtain accurate notebook names or IDs for use in the subsequent notebook parameter.
Search¶
siyuan_search requires query; mode defaults to keyword, performing fuzzy matching on fields such as content, name, alias, memo in blocks, returning block IDs, document paths, etc., for use with siyuan_block or parentID in siyuan_create_doc.
When mode=sql, pass a complete SELECT, for example:
SELECT id, content, hpath, updated FROM blocks WHERE type = 'd' ORDER BY updated DESC LIMIT 10
The number of rows returned in a single request is constrained by limit and the config item maxRows (1–1000).
Create New Document¶
siyuan_create_doc: title is required; if notebook is not passed, defaultNotebook is used; markdown is optional to create an empty document; parentID takes precedence over the / hierarchical notation in the title.
Read/Write Blocks¶
siyuan_block: id is a 22-digit block ID; passing a document ID reads the entire document. mode=read is default; append / insert require passing data and must explicitly include confirm: true to avoid accidental writes.
It is recommended to read to confirm the target block before writing, and then proceed with confirm=true.
Scenarios and Cautions¶
Who it is for: Those who are running SiYuan locally or on a LAN, want the DSH agent to treat notes as a searchable and writable knowledge base, and accept the boundary of “using only the official kernel API and not touching workspace files.”
Permissions and Security: The plugin runs with the current DSH process permissions. The Token and kernel address are equivalent to access credentials for the note database. You should review the GitHub Source Code and the MIT License before installation; the write capability of siyuan_block needs to be used in conjunction with confirm and business strategies.
Ecosystem Note: DSH adopts an “everything is a plugin” extension method; the SkillHub Plugin Directory is a community site and has no official affiliation with DeepSeek / High-Flyer.
Version: The repository’s package.json current version is 0.1.4; the tarball filename in the README installation example is dsh-siyuan-api-0.1.2.tgz. After packaging, please refer to the filename generated by your local pnpm pack.
Conclusion¶
dsh-siyuan-api consolidates SiYuan Note’s capabilities into a set of HTTP API tools on the DSH side: search, document creation, block-level read/write, and read-only SQL, without relying on SiYuan plugins or Python. If you want to connect local SiYuan in the Harness, you can install by creating a tarball according to the README, configure apiUrl and Token, and perform a self-check using siyuan_status or the diagnostic route.
- Directory Page: https://www.skillhub.cn/plugins/SherinG-official/dsh-siyuan-api
- Source Code and Documentation: https://github.com/SherinG-official/dsh-siyuan-api