cli-anything-siyuan — Claude Code skill: what it does, how to install
The cli-anything-siyuan skill gives an agent CLI access to SiYuan for notebook, document, and block management, full-text search, SQL queries, and Markdown export.
Apache-2.0 255 installs ★ 62,125 updated 2026-09-22
npx skills add HKUDS/CLI-Anything --skill cli-anything-siyuan -a claude-codeWhat cli-anything-siyuan does
The skill connects to a running SiYuan kernel over its HTTP API. Through the CLI, an agent can create, rename, open, and remove notebooks and documents, inspect document trees, edit blocks, search their contents, and export a document as Markdown. It also exposes tag listing, connection status, kernel version, SQL access, and an interactive REPL.
SiYuan must be running, and the API token is available in Settings → About. The CLI requires Python 3.10+ and can be installed with pip install cli-anything-siyuan or with pip install -e . from agent-harness/. Machine-readable responses use --json; authentication can read the token from ~/.siyuan-cli.json or SIYUAN_TOKEN.
The connection target is http://127.0.0.1:6806, so the CLI cannot connect until SiYuan is running with a valid token. SQL can search the blocks table directly. Markdown can also come through stdin when shell escaping would get in the way.
What it helps with
- create a document inside a selected notebook
- search blocks with text or SQL
- rename or remove documents and blocks
- export a document as Markdown
- inspect the SiYuan connection and kernel version
Example prompts for the agent
- Create a document in notebook
nb1at/projects/newfrom the Markdown in my message, and return JSON output. - Search the
blockstable formeetingwith SQL and show the first matching rows. - Check the SiYuan connection status, then export document
doc123as Markdown.
How to install cli-anything-siyuan
1Skills CLI (Vercel)
npx skills add HKUDS/CLI-Anything --skill cli-anything-siyuan -a claude-code2Manually: put the files in place
~/.claude/skills/cli-anything-siyuan/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cli-anything-siyuan/
1Skills CLI (Vercel)
npx skills add HKUDS/CLI-Anything --skill cli-anything-siyuan -a codex2Manually: put the files in place
.agents/skills/cli-anything-siyuan/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add HKUDS/CLI-Anything --skill cli-anything-siyuan -a cursor2Manually: put the files in place
.cursor/skills/cli-anything-siyuan/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install HKUDS/CLI-Anything skills/cli-anything-siyuan2Manually: put the files in place
.github/skills/cli-anything-siyuan/SKILL.md1Skills CLI (Vercel)
npx skills add HKUDS/CLI-Anything --skill cli-anything-siyuan -a gemini-cli2Platform CLI
gemini skills install https://github.com/HKUDS/CLI-Anything --path skills/cli-anything-siyuanManually: put the files in place
.devin/skills/cli-anything-siyuan/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add HKUDS/CLI-Anything --skill cli-anything-siyuan -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about cli-anything-siyuan
How do I install cli-anything-siyuan in Claude Code?
Run npx skills add HKUDS/CLI-Anything --skill cli-anything-siyuan -a claude-code, then check ~/.claude/skills/cli-anything-siyuan/SKILL.md.
What does cli-anything-siyuan do?
It gives an agent terminal access to SiYuan notebooks, documents, and blocks. The CLI also supports content search, SQL, Markdown export, tags, status, and an interactive REPL.
What does cli-anything-siyuan need to run?
SiYuan must be running, with an API token from Settings → About. Python 3.10+ is required, and authentication can use ~/.siyuan-cli.json or SIYUAN_TOKEN.
Source text
SKILL.md · Apache-2.0
---
name: "cli-anything-siyuan"
description: SiYuan (思源笔记) CLI — manage notebooks, documents, blocks, and search your knowledge base from the terminal.
---
# cli-anything-siyuan
CLI harness for [SiYuan](https://github.com/siyuan-note/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
```bash
# 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
© HKUDS · Apache-2.0 · HKUDS/CLI-Anything