跳到正文
Skillpedia
写作58k · #3247

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/CLI-Anything/blob/main/siyuan/agent-harness/cli_anything/siyuan/skills/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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-siyuan or pip 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 --json for 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.json or SIYUAN_TOKEN env 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能