按用户明确指令,在得到大脑(Get笔记)中保存、搜索并管理笔记与知识库。
编程
Siyuan Note Cli
试用Connect to and operate SiYuan Note through the siyuan-note-cli command-line tool, using notes as context for AI tasks. Use when the user asks to query, creat...
它能做什么
If unavailable, use without requiring a global install:
技能文档
SiYuan Note CLI Skill
Command Invocation
First try the globally installed CLI:
siyuan --version
If unavailable, use npx without requiring a global install:
npx siyuan-note-cli --version
Prefer writing commands as npx siyuan-note-cli to avoid environment differences.
Startup Workflow: Read "AI Assistant Guide" First
Whenever this skill is triggered, the first step is to search for and read the SiYuan document named "AI Assistant Guide":
-
Search documents:
npx siyuan-note-cli search docs "AI Assistant Guide" -
Read the full document by ID:
npx siyuan-note-cli document get -
If the guide contains Markdown rules, available tool lists, naming conventions, tag systems, database templates, or other instructions, follow them strictly.
If "AI Assistant Guide" is not found, tell the user and continue with the normal operation.
Prerequisites
- The SiYuan Note client is running, usually at
http://127.0.0.1:6806. - API token is configured in one of these ways:
- Environment variables:
SIYUAN_API_URL,SIYUAN_API_TOKEN - CLI login:
npx siyuan-note-cli auth login --url --token - Config file:
~/.config/siyuan-cli/config.yml
- Environment variables:
Best Practices
- Locate before operating: use
search,notebook list, anddocument listbefore modifications. - Prefer IDs: document and block IDs are more stable than paths.
- Use structured output: use
--format jsonfor batch operations. - Confirm dangerous operations: use
--forceonly after confirmation; database operations are experimental and should be used carefully. - Verify writes: after write operations, confirm the result with
document getorblock get. - Create new notes by default: unless the user explicitly asks to modify or append to an existing note, create a separate new document.
- Default to the AgentWork notebook: if the user does not specify a location, write content to the root of the
AgentWorknotebook. If it does not exist, create it first.
Operation Boundary: Create vs Modify
Core principle: create by default, modify only when explicit. This prevents accidental overwrites or pollution of existing notes.
| User Request | Behavior |
|---|---|
| "Record this note", "save this", "keep this" | Create a new document under AgentWork |
| "Update note xxx", "append to xxx", "modify xxx" | Modify the specified existing document |
| No location specified | Create under the AgentWork notebook root |
| Notebook/path specified | Create at the specified location |
AgentWork notebook handling:
npx siyuan-note-cli notebook list --format json
npx siyuan-note-cli notebook create "AgentWork"
npx siyuan-note-cli document create "Document Name" \
--title "Title" \
--file "$TEMP/siyuan-draft.md"
Do not add a leading / to the path; otherwise the CLI may resolve it as a workspace filesystem path.
Writing Notes: Prefer --file, Avoid --content
Markdown content should be passed through a file, not a command-line string. Command-line parsing can damage line breaks and special characters such as backticks, #, and $.
| Method | Formatting | Use Case |
|---|---|---|
document create --file | Preserves formatting | Preferred for complete documents |
block append --parent --content "..." | Single block only | Append one paragraph or heading |
block update --content "..." | Single block only | Update an existing block |
document create --content "..." | Easy to damage | Not recommended for multi-line Markdown |
Recommended pattern:
# Windows Git Bash: $TEMP/siyuan-draft.md
# Linux/macOS: /tmp/siyuan-draft.md
# Cross-platform fallback: ${TMPDIR:-/tmp}/siyuan-draft.md
npx siyuan-note-cli document create "path/document-name" \
--title "Document Title" \
--file "$TEMP/siyuan-draft.md"
Avoid this for multi-line Markdown:
npx siyuan-note-cli document create "path/document-name" \
--title "Title" \
--content "# Title\n\nBody **bold**\n\n```python\nprint('hello')\n```"
Incremental Append: One Block at a Time
block append appends only one block per call. If multiple paragraphs are passed, only the first block may be preserved.
npx siyuan-note-cli block append --parent --content "## Section Title"
npx siyuan-note-cli block append --parent --content "Body paragraph."
Do not pass multiple paragraphs in one block append call.
Path Rules
In SiYuan, folders are also documents. Do not add a leading / in any scenario.
| Scenario | Path Format | Example |
|---|---|---|
| Notebook root | "Document Name" | "My Note" |
| Existing subdirectory | "dir/subdir/document" | "Projects/App/New Doc" |
| Child document under existing document | "parent/document" | "Project Plan/Weekly Note" |
| New nested path | "new-dir/document" | "Test Folder/Scenario Three" |
Examples:
npx siyuan-note-cli document create "Document Name" \
--title "Title" \
--file "$TEMP/siyuan-draft.md"
npx siyuan-note-cli document create "Project/Subdir/New Document" \
--title "Title" \
--file "$TEMP/siyuan-draft.md"
Common Commands
Connection:
npx siyuan-note-cli auth status
npx siyuan-note-cli auth login --url http://127.0.0.1:6806 --token
Notebooks:
npx siyuan-note-cli notebook list
npx siyuan-note-cli notebook create "Project Management"
Documents:
npx siyuan-note-cli document list --path / --depth 2
npx siyuan-note-cli document get
npx siyuan-note-cli document create "path/document-name" \
--title "Title" \
--file ./content.md
npx siyuan-note-cli document rename "New Title"
npx siyuan-note-cli document delete --force
Blocks:
npx siyuan-note-cli block get
npx siyuan-note-cli block append --content "New paragraph"
npx siyuan-note-cli block update --content "Updated content"
Search and query:
npx siyuan-note-cli search docs "Project Plan"
npx siyuan-note-cli search blocks "Key conclusion"
npx siyuan-note-cli query "SELECT * FROM blocks WHERE type='d' LIMIT 10"
Attributes:
npx siyuan-note-cli attr get
npx siyuan-note-cli attr set custom-status=done custom-priority=high
References
- Command details: references/commands.md
- Workflow examples: references/workflow-examples.md
相关技能
在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。
把自然语言描述转为结构化 JSON,并由 mcp-diagram-generator MCP 服务生成 Draw.io、Mermaid 或 Excalidraw 图表文件。
以 AI 机器人身份加入视频会议,提供语音、虚拟形象与屏幕共享四种模式。
诊断生产力系统反复失效的根因,给出最小干预——容量测算、瓶颈定位、可靠的本地记录。
通过托管的 OAuth GraphQL 接口查询与管理 Linear 的 issue、项目、团队、周期、标签和评论。
agilebuilder 的更多技能
浏览全部技能Collaborative workflow for converting a complete business project into a reusable base skeleton. Use when the user asks to remove business features, pages, o...
Connect to remote Linux servers through SSH and execute commands non-interactively. Covers password authentication, key authentication, file transfer, and cr...
Manage Tencent Cloud CVM instances with the TCCLI command-line tool. Covers instance creation, querying, deletion, launch template management, price inquiry,...
Use AgileBuilder MCP for template-based project creation and document-constrained implementation. Trigger when the user asks to create, bootstrap, scaffold,...