cli-anything-siyuan
它能做什么
这个技能让 AI 智能体处理 SiYuan,这是一款用于构建知识库的本地笔记应用。适合用 SiYuan 记笔记、并希望智能体帮忙整理和搜索的人。
适用场景
- ✓当你想在 SiYuan 中创建新笔记本或新文档的时候。
- ✓当你需要在整个知识库中搜索某个主题的笔记的时候。
- ✓当你想修改或添加现有文档中的一段文字块的时候。
技能链接
https://github.com/HKUDS/CLI-Anything/blob/main/siyuan/agent-harness/cli_anything/siyuan/skills/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我在 SiYuan 笔记中搜索关于春季项目的内容,并把它总结到一个新文档中。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体通过本地 API,使用 API 令牌连接你电脑上的 SiYuan 应用。它可以读写笔记本、文档和块。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
cli-anything-siyuan
CLI harness for SiYuan (思源笔记), a local-first knowledge management and note-taking application.
This CLI connects to a running SiYuan kernel via its HTTP API
(http://127.0.0.1:6806) and provides structured access to notebooks,
documents, blocks, search, and export.
Prerequisites
- SiYuan must be running (Settings → About shows the API token)
- Python 3.10+
- Install:
pip install cli-anything-siyuanorpip install -e .from agent-harness/
Command Groups
notebook — Notebook management
| Subcommand | Description |
|---|---|
list |
List all notebooks |
create <name> |
Create a new notebook |
rename <id> <name> |
Rename a notebook |
remove <id> |
Delete a notebook |
open <id> |
Open a notebook |
doc — Document management
| Subcommand | Description |
|---|---|
create <notebook> <path> [--md "content"] |
Create a document |
list <notebook> [path] |
List documents |
tree <notebook> [--path / --depth] |
Show doc tree |
get <id> |
Get document path by ID |
rename <id> <title> |
Rename a document |
remove <id> |
Delete a document |
block — Block operations
| Subcommand | Description |
|---|---|
insert <data> [--previous / --parent] |
Insert a block |
update <id> <data> |
Update a block |
delete <id> |
Delete a block |
get <id> |
Get block kramdown source |
children <id> |
Get child blocks |
Other commands
| Command | Description |
|---|---|
sql <stmt> |
Execute SQL on the block database |
search <query> |
Full-text search across blocks |
export md <doc-id> |
Export document as Markdown |
tag list |
List all tags |
version |
Show SiYuan kernel version |
status |
Show connection and session status |
repl |
Start interactive REPL |
Agent Guidance
- Always use
--jsonfor machine-readable output - Power search: use
sql "SELECT * FROM blocks WHERE content LIKE '%keyword%'"for SQL-level access - Document IDs look like
20210817205410-2kvfpfn(timestamp-based) - API token can be found in SiYuan Settings → About
- Connection defaults:
http://127.0.0.1:6806
Examples
# List notebooks (JSON)
cli-anything-siyuan --json notebook list
# Create a document with Markdown (--md flag, watch shell escaping)
cli-anything-siyuan doc create nb1 /projects/new --md "## Title\n\nContent"
# Create a document — pipe Markdown via stdin (avoids shell escaping)
# PowerShell here-string (literal, no escaping needed):
@'
## Title
Content with `backticks` and (parentheses) and "quotes"
'@ | cli-anything-siyuan doc create nb1 /projects/new --md -
# Bash heredoc:
# cat <<'EOF' | cli-anything-siyuan doc create nb1 /projects/new --md -
# ## Title
# Content with `backticks` and (parentheses)
# EOF
# SQL search
cli-anything-siyuan sql "SELECT id, content FROM blocks WHERE content LIKE '%meeting%' LIMIT 5"
# Export
cli-anything-siyuan export md doc123
# Enter REPL
cli-anything-siyuan
Error Handling
- Connection errors: check that SiYuan is running and the API token is correct
- API errors: returned as
{"code": N, "msg": "..."}— check the message field - Auth errors: verify the token in
~/.siyuan-cli.jsonorSIYUAN_TOKENenv var
常见问题
SiYuan 需要处于运行状态吗?
需要。SiYuan 内核必须正在运行,你可以在“设置”的“关于”中找到 API 令牌。
它可以导出我的笔记吗?
可以。该技能包含文档的导出选项。
它可以删除笔记吗?
可以。笔记本和文档都有删除命令,因此请谨慎使用。
详情
作者的原始描述
SiYuan (思源笔记) CLI — manage notebooks, documents, blocks, and search your knowledge base from the terminal.
repo: HKUDS/CLI-Anything
热度
- GitHub 星标
- 58k
- 排名
- #3247
- 许可证
- Apache-2.0
- 更新时间
- 2026/9/21
评论
- …
同一仓库的更多技能
cli-anything-3mf
58k帮你的智能体检查和修复 3D 打印文件,包括查找圆孔、调整孔径、修复网格,以及比较两个文件。
cli-anything-qgis
58k帮你的智能体在终端中打开、编辑和导出 QGIS 地图项目,包括图层、要素、打印布局和处理工具。
cli-anything-adguardhome
58k帮你的智能体管理 AdGuard Home,这是一款全网络广告拦截器,可管理过滤规则、DNS 重写、客户端和查询日志。
cli-anything-anygen
58k帮你的智能体借助 AnyGen 服务,根据文字提示生成幻灯片、文档、网站和图表。