siyuan-cli: Instructions file for Claude Code

CLAUDE.md

siyuan-cli CLAUDE.md is an instructions file for Claude Code from cicbyte/siyuan-cli. It costs 714 tokens per session, scanned A, original, MIT.

Repository-specific instructions for a Go command-line tool that manages SiYuan Note, a note-taking application, through its API and an interactive text interface.

In plain words
What is it for?
Use it when changing commands, note and document operations, the interactive interface, API integration, configuration, or the build process.
Why use it?
It gives a coding agent the project layout, build commands, configuration location, and important implementation details so it can work in the repository correctly.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is cicbyte/siyuan-cli's own configuration. It tells Claude Code how to work on siyuan-cli itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything siyuan-cli configures →

Reuse

Borrowing it

Nothing to install: this file belongs to cicbyte/siyuan-cli. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/cicbyte/siyuan-cli/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/cicbyte/siyuan-cli

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for siyuan-cli CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/cicbyte/siyuan-cli/claude-md/github.svg)](https://agentmods.dev/instructions/cicbyte/siyuan-cli/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/cicbyte/siyuan-cli/claude-md"><img src="https://agentmods.dev/badge/instructions/cicbyte/siyuan-cli/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for siyuan-cli CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/cicbyte/siyuan-cli/claude-md"><img src="https://agentmods.dev/badge/instructions/cicbyte/siyuan-cli/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 714 This file is loaded in full into every session.
When invoked 714 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00714 $0.00714
Opus 5.5 $0.00286 $0.00286
Sonnet 5.5 $0.00143 $0.00143
Haiku 4.5 $0.00071 $0.00071

Measured 2mo ago against content hash 2b60bc9aab59, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

siyuan-cli CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 54 lines

What it actually says

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

项目概述

思源笔记(SiYuan Note)命令行管理工具,Go 语言编写。通过思源内核 API 实现笔记本管理、文档操作、块编辑等功能,并提供交互式 TUI 界面。

构建与运行

# 开发构建
go build -o siyuan-cli .

# 直接运行
go run cmd/*.go

# 生产构建(含 Web 前端构建 + UPX 压缩)
python build.py

build.py 流程:npm build(web/dist) → 清理 resources/static → 复制前端产物 → go build → UPX 压缩。构建信息(版本号、commit hash、分支)通过 -ldflags 注入 main 包变量。

当前无单元测试框架。

架构

分层结构,职责清晰:

  • cmd/ — Cobra 命令定义,每个子命令一个文件(root.go、notebook.go、document.go、fav.go)
  • internal/logic/ — 业务逻辑层,按领域分包(notebook/、document/、fav/)
  • internal/siyuan/ — 思源内核 API 的 Go SDK 封装。client.go 定义 Client 结构体和 post/postMultipart 基础请求方法;factory.go 从全局配置创建客户端实例
  • internal/ui/ — Bubble Tea TUI 组件(笔记本列表、文档树、路径选择器等)
  • internal/models/ — 数据结构定义,核心是 AppConfig(YAML 配置模型)
  • internal/utils/config.go — 配置管理单例,处理目录创建、配置加载/保存、默认值
  • internal/common/ — 全局变量(AppConfigModel)
  • internal/log/ — Zap 日志初始化

关键设计

配置系统:YAML 配置文件位于 ~/.cicbyte/siyuan-cli/config/config.yaml,首次运行自动创建。common.AppConfigModel 是全局配置入口,在 cmd/root.go 的 init() 中加载。

SiYuan SDK:Client 线程安全、可复用。所有 API 均为 POST 请求,返回 {code, msg, data} 结构,code != 0 时返回 *SiYuanError。通过 factory.go 的 GetDefaultSiYuanClient() 获取客户端。

启动流程(cmd/root.go init):初始化应用目录 → 加载配置 → 初始化日志 → 连接 SQLite 数据库。

依赖

  • Cobra — CLI 框架
  • Bubble Tea + Lipgloss + Bubbles — TUI
  • Zap + Lumberjack — 日志(按天轮转)
  • GORM + SQLite — 数据持久化
  • go.yaml.in/yaml/v3 — 配置解析
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 54 lines · 714 tokens per session scan A 2b60bc9aab59

Subscribe to this mod's changes

siyuan-cli CLAUDE.md is an instructions file published in the GitHub repository cicbyte/siyuan-cli (5 stars, last pushed 6mo ago), licensed MIT. It adds 714 tokens to every session, about $0.0029 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

siyuan-cli CLAUDE.md compared with instructions from other repositories

siyuan-cli CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
siyuan-cli CLAUDE.mdcicbyte/siyuan-cliInstructions file56mo agoMITA714Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode