cli-anything-siyuan

Manage SiYuan notebooks, documents, blocks, and search via the SiYuan HTTP API.

48.8k|4.5k|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/HKUDS/CLI-Anything --skill cli-anything-siyuan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-anything-siyuan
Source: https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-siyuan
Command: npx skills add https://github.com/HKUDS/CLI-Anything --skill cli-anything-siyuan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing a SiYuan knowledge base normally requires the desktop UI; this Skill lets AI agents and terminal users create notebooks, edit documents and blocks, run SQL queries, and search content programmatically through the SiYuan kernel's HTTP API.

Core Features & Use Cases

  • Notebook and Document Management: Create, rename, list, and delete notebooks and documents, and browse the document tree.
  • Block-Level Editing: Insert, update, delete, and inspect individual content blocks, including retrieving kramdown source.
  • SQL and Full-Text Search: Query the block database directly with SQL or run full-text search across all notes.
  • Use Case: An AI agent can create a new document with Markdown content piped via stdin, then run sql "SELECT * FROM blocks WHERE content LIKE '%meeting%'" to retrieve related notes for a summary.

Quick Start

Ask the agent to list all SiYuan notebooks in JSON format using the cli-anything-siyuan notebook list command.

Frequently Asked Questions about cli-anything-siyuan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage SiYuan notes from the command line?

Use the cli-anything-siyuan CLI, which connects to the running SiYuan kernel via its HTTP API at 127.0.0.1:6806. It provides notebook, doc, block, search, sql, and export command groups, all supporting --json output for scripting.

How to search SiYuan notes with SQL queries?

Run the sql subcommand with a SELECT statement against the blocks table, for example: cli-anything-siyuan sql "SELECT id, content FROM blocks WHERE content LIKE '%meeting%' LIMIT 5". This gives direct database-level access beyond standard full-text search.

Does the SiYuan CLI require the desktop app to be running?

Yes, SiYuan must be running because the CLI communicates with its local kernel over HTTP at 127.0.0.1:6806. You also need the API token found in SiYuan Settings under About.

How do I avoid shell escaping issues when creating documents with Markdown?

Pipe Markdown via stdin using --md - instead of passing content inline. Use a PowerShell here-string or a bash heredoc so backticks, quotes, and parentheses are preserved literally without escaping.

Why does the SiYuan CLI return connection or auth errors?

Connection errors mean the SiYuan kernel is not running or not reachable at 127.0.0.1:6806. Auth errors indicate an invalid token; verify it in ~/.siyuan-cli.json or the SIYUAN_TOKEN environment variable.