█

AI/TLDR

Buy me a coffee
Buy me a coffee

SiYuan

A self-hosted, block-level knowledge base you can query, script and point an LLM at

Notes & Knowledge BasesOpen core
Language
TypeScript
License
AGPL-3.0
IN SHORT

What is SiYuan?

SiYuan is a privacy-first personal knowledge management system built around content blocks. It sits in the Notes & Knowledge Bases category of the AI Productivity & Writing tools and is open-source, written in TypeScript and licensed AGPL-3.0. To get started: install the app.

Overview

SiYuan is a privacy-first personal knowledge management system built around content blocks. Every block can be referenced and back-linked, carry custom attributes, be addressed by a `siyuan://` URL, and be pulled into a document by an embedded SQL query — which is what separates it from a folder of Markdown files. The editor is block-style Markdown WYSIWYG with list outlining, block zoom-in, math and diagram rendering, web clipping and PDF annotation links, and it is built to survive million-word documents.

Data lives on your own machine or your own server. It ships as desktop apps, Android, iOS and HarmonyOS apps, and a Docker image (`b3log/siyuan`) for self-hosting, where the `serve` subcommand takes a workspace path and an access code, with optional OIDC authentication against Google, Microsoft, GitHub or a custom provider. A built-in CLI reads and writes workspace data without a running server: notebooks, documents, blocks, attributes, tags, bookmarks, templates, full-text and SQL queries, backlinks, import/export, snapshots and sync — with `-f json` output for scripting and `--dry-run` on mutating commands.

The AI surface is deliberately modest: AI writing and question-answering through an OpenAI-compatible API, Tesseract OCR on assets, plus an HTTP API and a community marketplace of plugins, themes and templates that other tools (including MCP bridges) build on. Spaced-repetition flashcards, a table database view, JavaScript/CSS snippets and export to PDF, Word, HTML or standard Markdown round it out. The code is AGPL-3.0; most features are free, including for commercial use, while cloud sync and some extras are reserved for paid members.

What it does

  • Block-level references, two-way links, custom attributes and embedded SQL queries over your notes
  • Markdown WYSIWYG editing with outlining, block zoom, formulas, diagrams, web clipping and PDF annotation
  • Self-hosting via Docker with workspace mounting, access codes and optional OIDC login
  • A scriptable CLI for notebooks, blocks, search, SQL, export/import, snapshots and sync — JSON output, `--dry-run`
  • AI writing and Q&A chat through an OpenAI-compatible API, plus Tesseract OCR
  • Spaced-repetition flashcards, database table views, plugin API and a community marketplace

Getting started

Install the app from a store or package, or self-host the kernel with Docker. The CLI works against a workspace directory directly.

Install the app

The project recommends the app stores so upgrades are one click; installers and packages are also published on B3log and GitHub Releases.

Or self-host with Docker

Since v3.7.0 the `serve` subcommand must be passed explicitly. Mount a workspace directory and set the lock-screen access code.

bashbash
docker run -d \
  -v workspace_dir_host:workspace_dir_container \
  -p 6806:6806 \
  -e PUID=1001 -e PGID=1002 \
  b3log/siyuan \
  serve \
  --workspace=workspace_dir_container \
  --accessAuthCode=xxx

Wire up the CLI

The binary lives inside the installed app; symlink it onto your PATH (macOS shown; Linux is the same against your install directory).

bashbash
ln -s /Applications/SiYuan.app/Contents/Resources/kernel/SiYuan-Kernel /usr/local/bin/siyuan

Query the workspace from a script

Every command takes `-w <workspace>`; `-f json` makes the output script-friendly.

bashbash
siyuan notebook list -w ~/SiYuan
siyuan search "keyword" -w ~/SiYuan -f json
siyuan export md --id <block-id> -w ~/SiYuan

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Keep a personal or team knowledge base on hardware you control instead of a hosted notes SaaS
  • Build structured notes where SQL queries over blocks assemble views instead of copy-pasting
  • Feed an assistant your own notes through the CLI, HTTP API or a marketplace plugin
  • Study with spaced repetition over the same blocks you write in

How SiYuan compares

SiYuan alongside other open-source notes & knowledge bases tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
SiYuan★ 47kA self-hosted, block-level knowledge base you can query, script and point an LLM at
notebooklm-py★ 20.1kAn unofficial Python API, CLI and MCP server for Google's Gemini Notebook (formerly NotebookLM): bulk source import, cited Q&A, and batch export of audio, video, slides, quizzes, mind maps and data tables.
MineContext★ 5.5kLocal-first desktop app that captures and understands your screen context, then proactively delivers summaries, to-do lists and activity records.
Smart Connections★ 5.5kObsidian plugin that surfaces semantically related notes and excerpts as you write, using a bundled local embedding model that needs no API key and works offline and on mobile.
OpenKnowledge★ 4.8kA local-first WYSIWYG markdown IDE and LLM wiki that keeps a knowledge base as plain files in git and exposes it to Claude, Codex and OpenCode over MCP.
ReadAny★ 2.9kA local-first e-book reader for desktop and mobile that indexes your library into a local vector store, then answers questions about a book with hybrid vector + BM25 retrieval, alongside highlights, notes, TTS and WebDAV sync.
LLM Wiki Compiler★ 2.2kCLI, MCP server and TypeScript SDK (llmwiki) that compiles raw sources into an interlinked, citation-traceable markdown wiki for people and agents.
LLM Wiki★ 1.7kAn open-source take on Karpathy's LLM Wiki that has Claude compile your documents, web clips and highlights into a cited, cross-linked Markdown wiki over MCP, with a web app, graph viewer and Chrome clipper.