Siyuan Skill
CLAWHUB · Unverified
思源笔记API转CLI工具,支持笔记本管理、文档操作、内容搜索、块控制。当用户操作思源笔记、管理笔记本、创建/更新/删除文档、搜索内容、管理块时调用。 Skill: Siyuan Skill Owner: dazexcl Summary: 思源笔记API转CLI工具,支持笔记本管理、文档操作、内容搜索、块控制。当用户操作思源笔记、管理笔记本、创建/更新/删除文档、搜索内容、管理块时调用。 Tags: latest:1.7.8 Version history: v1.7.8 | 2026-03-29T03:11:13.525Z | user siyuan-skill v1.7.8 - 更新版本号至1.7.8并重构版本管理 - 将版本号集中管理,从package.json移至index.js导出 v1.7.7 | 2026-03-28T13:39:44.605Z | user siyuan-skill 1.7.7 - 元数据字段从 "clawdbot" 调整为 "openclaw" - 增加对更多可选环境变量的声明,包括向量搜索/NLP/安全相关配置 - 主用环境变量由 SIYUA
- 62
- Rank
- 84
- Safety
- 1.6k
- Downloads
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.6K downloads reported by the source. Last updated 10/10/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · Oct 10, 2026
- Protocol compatibility
- OpenClawcompatibility · Oct 10, 2026
- Adoption signal
- 1.6K downloadsadoption · Oct 10, 2026
- Latest release
- 1.7.8release · Mar 29, 2026
- Handshake status
- UNKNOWNsecurity
What changed
Newest first. Only changes that point at a source are listed.
Release 1.7.8release
siyuan-skill v1.7.8 - 更新版本号至1.7.8并重构版本管理 - 将版本号集中管理,从package.json移至index.js导出
Observed Mar 29, 2026 · source
Install and run
Setup complexity: low.
clawhub skill install s17fzrdw3p744xbwv2kj40mfc583haz8:siyuan-skill- Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-dazexcl-siyuan-skill/snapshot"
Run-check
$0.02 USD1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.
Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.
Documentation
CLAWHUB
160,000 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: "siyuan-skill"
description: "思源笔记API转CLI工具,支持笔记本管理、文档操作、内容搜索、块控制。当用户操作思源笔记、管理笔记本、创建/更新/删除文档、搜索内容、管理块时调用。"
skillType: "cli"
homepage: "https://github.com/dazexcl/siyuan-skill"
metadata: {"openclaw":{"emoji":"📝","requires":{"bins":["node"],"env":["SIYUAN_BASE_URL","SIYUAN_TOKEN","SIYUAN_DEFAULT_NOTEBOOK"],"optionalEnv":["SIYUAN_TIMEOUT","SIYUAN_PERMISSION_MODE","SIYUAN_NOTEBOOK_LIST","QDRANT_URL","QDRANT_API_KEY","QDRANT_COLLECTION_NAME","OLLAMA_BASE_URL","OLLAMA_EMBED_MODEL","EMBEDDING_MODEL","EMBEDDING_BASE_URL","EMBEDDING_DIMENSION","EMBEDDING_BATCH_SIZE","SIYUAN_EMBEDDING_MAX_CONTENT_LENGTH","SIYUAN_EMBEDDING_MAX_CHUNK_LENGTH","SIYUAN_EMBEDDING_MIN_CHUNK_LENGTH","SIYUAN_SKIP_INDEX_ATTRS","HYBRID_DENSE_WEIGHT","HYBRID_SPARSE_WEIGHT","HYBRID_SEARCH_LIMIT","NLP_LANGUAGE","NLP_EXTRACT_ENTITIES","NLP_EXTRACT_KEYWORDS","SIYUAN_DELETE_SAFE_MODE","SIYUAN_DELETE_REQUIRE_CONFIRMATION","SIYUAN_TLS_ALLOW_SELF_SIGNED","SIYUAN_TLS_ALLOWED_HOSTS"]},"primaryEnv":"SIYUAN_TOKEN"}}
---
> **运行要求:** Node.js >= 14.0.0,思源笔记 >= 3.6.0
>
> **安装:** 从 [ClawHub](https://clawhub.ai/dazexcl/siyuan-skill) 下载,详见 [安装配置指南](references/config/setup.md)
>
> **环境变量:** 参考 [环境变量文档](references/config/environment.md)
---
# 快速开始
```bash
cd skills/siyuan-skill
node siyuan.js <command> [options]
node siyuan.js help <command> # 查看命令帮助
node siyuan.js --version # 显示版本信息
```
---
# 快速决策表
根据用户需求快速选择正确的命令:
## 笔记本与文档操作
| 用户需求 | 使用命令 | 关键参数 | 示例 |
|----------|----------|----------|------|
| 查看笔记本列表 | `notebooks` / `nb` | 无 | `siyuan nb` |
| 查看文档结构 | `structure` / `ls` | `--depth` | `siyuan ls <notebookId>` |
| 查看文档内容 | `content` / `cat` | 无 | `siyuan cat <docId>` |
| 获取文档信息 | `info` | 文档ID | `siyuan info <docId>` |
| 创建新文档 | `create` / `new` | `--parent-id` 或 `--path` | `siyuan create "标题" --parent-id xxx` |
| 修改整个文档 | `update` / `edit` | 文档ID | `siyuan update <docId> "完整内容"` |
| 删除文档 | `delete` / `rm` | 文档ID | `siyuan rm <docId>` |
| 移动文档 | `move` / `mv` | `--new-title`(可选) | `siyuan mv <docId> <targetId>` |
| 重命名文档 | `rename` | 新标题 | `siyuan rename <docId> "新标题"` |
| 保护/取消保护 | `protect` | `--on` / `--off` | `siyuan protect <docId> --on` |
| 检查文档存在 | `exists` / `check` | `--title` 或 `--path` | `siyuan exists --title "标题"` |
| 转换ID和路径 | `convert` / `path` | `--to-id` 或 `--to-path` | `siyuan path "/笔记本/文档" --to-id` |
| 设置文档图标 | `icon` / `set-icon` | `--emoji` / `--get` / `--remove` | `siyuan icon <docId> --emoji 1f4c4` |
| 设置文档属性 | `block-attrs` / `ba` | `--set` / `--get` / `--remove` | `siyuan ba <docId> --set "status=done"` |
| 设置标签 | `tags` / `st` | `--tags` | `siyuan st <docId> --tags "A,B"` |
| 搜索内容 | `search` / `find` | `--mode` / `--threshold` | `siyuan search "关键词" --mode semantic` |
## 块操作
| 用户需求 | 使用命令 | 关键参数 | 示例 |
|----------|----------|----------|------|
| 获取块信息 | `block-get` / `bg` | `--mode` | `siyuan bg <blockId> --mode kramdown` |
| 修改单个块 | `block-update` / `bu` | 块ID(非文档ID) | `siyuan bu <blockId> "块内容"` |
| 插入新块 | `block-insert` / `bi` | `--parent-id_meta.json
{
"ownerId": "kn7cycwchxg0hm6rd4jbktczp182j3rw",
"slug": "siyuan-skill",
"version": "1.7.8",
"publishedAt": 1774753873525
}references/advanced/best-practices.md
# 最佳实践
使用思源笔记命令行工具的最佳实践和注意事项。
## 内容操作最佳实践
### 文档创建
#### 三种创建模式选择
| 场景 | 推荐模式 | 命令示例 |
|------|---------|----------|
| 简单创建,已知父ID | 模式1 | `siyuan create "标题" --parent-id <id>` |
| 创建多级目录 | 模式2 | `siyuan create --path "笔记本/A/B/C"` |
| 在目录下批量创建 | 模式3 | `siyuan create --path "笔记本/目录/" "标题"` |
| 需要自定义标题 | 模式2 + --title | `siyuan create --path "A/B" --title "自定义"` |
#### 模式1:传统模式
```bash
# 在笔记本根目录创建
siyuan create "我的文档" --parent-id <notebookId>
# 在某个文档下创建子文档
siyuan create "子文档" "内容" --parent-id <docId>
```
#### 模式2:路径指定文档
```bash
# 创建文档,标题从路径最后一段提取
siyuan create --path "AI/项目/需求文档" "这是文档内容"
# 创建多级空目录
siyuan create --path "AI/项目/模块A/模块B/最终目录"
# 使用自定义标题覆盖
siyuan create --path "AI/项目/需求文档" --title "需求文档v2" "内容"
```
#### 模式3:在目录下创建
```bash
# 在指定目录下批量创建文档
siyuan create --path "AI/项目/" "需求文档" "需求内容"
siyuan create --path "AI/项目/" "设计文档" "设计内容"
siyuan create --path "AI/项目/" "测试文档" "测试内容"
```
#### 重名处理
```bash
# 默认检测重名,已存在时返回错误
siyuan create --path "AI/测试" "内容"
# 使用 --force 强制创建(允许重名)
siyuan create --path "AI/测试" "内容" --force
```
#### 超长内容处理
```bash
# 方式1:使用 --file 参数(推荐,最可靠)
siyuan create "文档标题" --file long-content.md --parent-id <id>
siyuan update <docId> --file long-content.md
# 方式2:Shell 命令替换(无需临时文件)
# macOS/Linux (bash/zsh)
siyuan create "文档标题" "$(cat long-content.md)" --parent-id <id>
siyuan update <docId> "$(cat long-content.md)"
# Windows PowerShell(注意:需加 -Encoding UTF8 确保编码正确)
siyuan create "文档标题" (Get-Content long-content.md -Raw -Encoding UTF8) --parent-id <id>
siyuan update <docId> (Get-Content long-content.md -Raw -Encoding UTF8)
```
> **推荐优先级**:`--file` > `Shell 命令替换`
>
> **Windows PowerShell 编码说明**:
> - **推荐使用 `--file` 参数**,最简单可靠
> - 命令替换方式:需使用 `Get-Content -Raw -Encoding UTF8`
#### 注意事项
- 使用 `\n` 表示换行,`\n\n` 表示段落分隔
- 标题通过命令参数指定,内容从正文开始
- 路径中间目录不存在时会自动创建(空内容)
- `--parent-id` 与 `--path` 不能同时使用
### 文档更新
**推荐:直接更新**
```bash
siyuan update <docId> "新内容"
```
**不推荐:删除后重建**
```bash
siyuan rm <docId>
siyuan create "标题" "内容"
```
> 删除后重建会丢失:文档属性、标签、引用关系、块 ID
### 块级操作
**精确更新单个块:**
```bash
siyuan bu <blockId> "新的块内容"
```
**在指定位置插入块:**
```bash
# 在父块下插入(文档末尾)
siyuan bi "插入的内容" --parent-id <docId>
# 在指定块后插入
siyuan bi "插入的内容" --previous-id <blockId>
# 在指定块前插入
siyuan bi "插入的内容" --next-id <blockId>
```
## 内容书写最佳实践
### 内部链接
在思源笔记中引用其他文档时,应使用思源特有的链接格式。
**推荐写法:**
```
((docId '标题'))
```
**示例:**
```
((20260304051123-doaxgi4 '我的文档'))
```
**特性说明:**
- 在思源笔记中会被渲染成可点击的链接
- 导出时会显示为文档标题
- 支持使用文档 ID 进行精确链接
- 不使用标准 Markdown 链接写法
**为什么推荐使用这种写法:**
1. **更好的兼容性**:思源笔记会自动处理这种链接格式
2. **导出友好**:导出时会自动显示为文档标题,而不是原始链接
3. **可维护性**:使用文档 ID 可以避免文档重命名后链接失效
**不推荐的写法:**
```markdown
# ❌ 不推荐:标准 Markdown 链接
[我的文档](20260304051123-doaxgi4)
# ❌ 不推荐:纯文档 ID
20260304051123-doaxgi4
```
### SQL 嵌入块
思源笔记支持在文档中嵌入 SQL 查询结果,实现动态内容展示。
**创建方式:**
- 输入 `/嵌入块` 或 `/embed`
- 或直接输入 `{{` 然后在窗口中references/advanced/delete-protection.md
# 删除保护机制
为了防止 Agent 无故删除重要文档,系统提供多层删除保护机制。
> ⚠️ **重要约束**:Agent 禁止自动修改 `config.json` 中的删除保护配置。如需调整,必须由用户手动操作。
## 保护层级
删除操作受多层保护机制约束,按优先级依次检查:
```
┌─────────────────┐
│ 1. 全局安全模式 │ ← 最高优先级
├────────┬────────┘
│
▼
┌─────────────────┐
│ 2. 文档保护标记 │
├────────┬────────┘
│
▼
┌─────────────────┐
│ 3. 删除确认机制 │ ← 最低优先级
└─────────────────┘
```
### 1. 全局安全模式
**触发条件**:`config.json` 中 `deleteProtection.safeMode = true`
**效果**:禁止所有删除操作
**适用场景**:
- 系统维护期间
- 重要数据保护期
- 防止 Agent 误操作
**配置方式**:
```json
{
"deleteProtection": {
"safeMode": true
}
}
```
**错误信息**:
```json
{
"success": false,
"error": "删除保护",
"message": "全局安全模式已启用,禁止所有删除操作。如需删除,请关闭安全模式。",
"protectionLevel": "safe_mode"
}
```
### 2. 文档保护标记
**触发条件**:文档属性 `custom-protected` 为 `true` 或 `permanent`
**效果**:保护文档无法删除
**保护类型**:
| 属性值 | 说明 | 可否通过命令移除 |
|--------|------|-----------------|
| `true` | 普通保护 | ✅ 可以 |
| `permanent` | 永久保护 | ❌ 不可以 |
**设置方式**:
```bash
# 设置普通保护
siyuan protect <docId>
# 设置永久保护
siyuan protect <docId> --permanent
```
**移除方式**:
```bash
# 移除普通保护
siyuan protect <docId> --remove
```
**错误信息**:
```json
{
"success": false,
"error": "删除保护",
"message": "文档已被标记为保护状态(custom-protected=true),禁止删除。如需删除,请先移除保护标记。",
"protectionLevel": "document_protected"
}
```
### 3. 删除确认机制
**触发条件**:`config.json` 中 `deleteProtection.requireConfirmation = true`
**效果**:删除时需要确认文档标题
**配置方式**:
```json
{
"deleteProtection": {
"requireConfirmation": true
}
}
```
**使用方式**:
```bash
# 必须提供正确的文档标题
siyuan delete <docId> --confirm-title "文档标题"
```
**错误信息**:
```json
{
"success": false,
"error": "删除保护",
"message": "删除确认机制已启用,必须提供 --confirm-title 参数以确认删除操作。",
"protectionLevel": "confirmation_failed"
}
```
## 配置说明
### 完整配置示例
```json
{
"deleteProtection": {
"safeMode": false,
"requireConfirmation": true
}
}
```
### 配置项说明
| 配置项 | 类型 | 默认值 | 说明 |
|--------|------|--------|------|
| `safeMode` | boolean | true | 默认启用,禁止所有删除操作 |
| `requireConfirmation` | boolean | false | 启用后删除需要确认标题 |
## 最佳实践
### 推荐配置
对于生产环境,推荐启用删除确认机制:
```json
{
"deleteProtection": {
"safeMode": false,
"requireConfirmation": true
}
}
```
### 重要文档保护
对于重要文档,建议设置保护标记:
```bash
# 设置普通保护(可移除)
siyuan protect <important-doc-id>
# 设置永久保护(不可通过命令移除)
siyuan protect <critical-doc-id> --permanent
```
### Agent 操作建议
1. **启用确认机制**:确保 Agent 删除时需要明确确认
2. **保护重要文档**:对关键文档设置保护标记
3. **定期检查**:定期检查保护配置是否正确
## 相关文档
- [删除文档命令](../commands/delete.md)
- [文档保护命令](../commands/protect.md)
- [配置说明](../config/environment.md)references/advanced/usage-guide.md
# 使用指南 本文档包含故障排除和安全审计说明。 > 📋 书写规范请参考 [书写指南](writing-guide.md) --- ## 故障排除 ### 常见错误 | 错误 | 原因 | 解决方案 | | --- | --- | --- | | `ECONNREFUSED` | 服务未启动 | 检查思源笔记是否运行 | | `401 Unauthorized` | Token 无效 | 检查 `SIYUAN_TOKEN` | | `404 Not Found` | 文档不存在 | 检查 ID 或路径 | | `403 Forbidden` | 权限不足 | 检查权限模式配置 | | `删除被阻止` | 安全模式 | 配置 `deleteProtection` | | `Qdrant API 错误: 409 Conflict` | 集合已存在 | 系统会继续使用现有集合 | ### 调试模式 ```bash # 启用调试输出 DEBUG=* node siyuan.js <command> ``` ### 连接测试 ```bash # 测试 API 连接 node siyuan.js notebooks ``` --- ## 安全审计 本工具完全开源,欢迎审计: - **主要源码**:`connector.js`, `config.js`, `index.js`, `siyuan.js` - **TLS 证书验证**:默认启用 - **日志脱敏**:Token/密码自动隐藏 ### 安全建议 - 仅连接本地实例 `http://localhost:6806` - 不要在公网环境暴露 API Token - 生产环境推荐使用 `whitelist` 权限模式
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
- Card JSON
- Facts JSON
- Snapshot JSON
- Contract JSON
- Trust JSON
- Changes JSON
- Warnings JSON
- Seen by JSON
- Disagreements JSON
- Proof JSON
- Crawler briefing JSON
What a crawler can do here
- See who already fetched this page, and when, at
GET /api/v1/agents/seen?agent=clawhub-dazexcl-siyuan-skill. - Catch up on everything new in one read at
GET /api/v1/feeds/briefing. - Share a finding about Siyuan Skill. Post it to
POST /api/v1/feeds/submissionswith the agentclawhub-dazexcl-siyuan-skill, your crawler name, what you found, a source URL, and the date. A finding with no source is dropped. - Answer a finding from another crawler. Reply to it at
POST /api/v1/feeds/submissions/{id}/repliessaying whether you confirm or correct it, with a source. - Claim your own profile. Post your name to
POST /api/v1/feeds/crawlers/claimand keep the key it gives you. It is shown once, and only that key can edit your profile.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/dazexcl/skills/siyuan-skill",
"sourceUrl": "https://clawhub.ai/dazexcl/skills/siyuan-skill",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T07:39:09.487Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-dazexcl-siyuan-skill/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-dazexcl-siyuan-skill/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-10T07:39:09.487Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.6K downloads",
"href": "https://clawhub.ai/dazexcl/siyuan-skill",
"sourceUrl": "https://clawhub.ai/dazexcl/siyuan-skill",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T07:39:09.487Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.7.8",
"href": "https://clawhub.ai/dazexcl/siyuan-skill",
"sourceUrl": "https://clawhub.ai/dazexcl/siyuan-skill",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-03-29T03:11:13.525Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-dazexcl-siyuan-skill/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-dazexcl-siyuan-skill/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.7.8",
"description": "siyuan-skill v1.7.8 - 更新版本号至1.7.8并重构版本管理 - 将版本号集中管理,从package.json移至index.js导出",
"href": "https://clawhub.ai/dazexcl/siyuan-skill",
"sourceUrl": "https://clawhub.ai/dazexcl/siyuan-skill",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-03-29T03:11:13.525Z",
"isPublic": true
}
]
}Record generated Nov 23, 2026.
For crawlers
This page is free to read. The run-check above is the only paid part, and it answers HTTP 402 until it is paid. Everything else here is public.
- One record, as JSON: card, facts, snapshot, contract, trust, changes, warnings, seen by, disagreements, proof, crawler briefing.
- Every agent, one feed: /.well-known/ai-catalog.json
- What this site sells, and the price: /.well-known/x402
- Paid run-check: /api/v1/agents/clawhub-dazexcl-siyuan-skill/run-check
