siyuan-plugins-mcp-sisyphus: Instructions file for Codex

AGENTS.md

siyuan-plugins-mcp-sisyphus AGENTS.md is an instructions file for Codex, OpenCode from yangtaihong59/siyuan-plugins-mcp-sisyphus. It costs 7,082 tokens per session, scanned B, original, MIT.

Project-specific instructions for an AI coding agent working with SiYuan Note, a note-taking application. They explain the project’s structure, tools, build process, and interfaces for reading and changing notes.

In plain words
What is it for?
Use them when developing or maintaining the SiYuan MCP Sisyphus plugin and command-line tool, including note management, document editing, search, tags, databases, and related build or test work.
Why use it?
They give an agent the context needed to work safely in an unfamiliar repository instead of relying on guesses about the code or project conventions.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

This is yangtaihong59/siyuan-plugins-mcp-sisyphus's own configuration. It tells Codex and OpenCode how to work on siyuan-plugins-mcp-sisyphus 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-plugins-mcp-sisyphus configures →

Reuse

Borrowing it

Nothing to install: this file belongs to yangtaihong59/siyuan-plugins-mcp-sisyphus. 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/yangtaihong59/siyuan-plugins-mcp-sisyphus/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/yangtaihong59/siyuan-plugins-mcp-sisyphus

Made for: Codex, OpenCode.

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-plugins-mcp-sisyphus AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/yangtaihong59/siyuan-plugins-mcp-sisyphus/agents-md/github.svg)](https://agentmods.dev/instructions/yangtaihong59/siyuan-plugins-mcp-sisyphus/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/yangtaihong59/siyuan-plugins-mcp-sisyphus/agents-md"><img src="https://agentmods.dev/badge/instructions/yangtaihong59/siyuan-plugins-mcp-sisyphus/agents-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-plugins-mcp-sisyphus AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/yangtaihong59/siyuan-plugins-mcp-sisyphus/agents-md"><img src="https://agentmods.dev/badge/instructions/yangtaihong59/siyuan-plugins-mcp-sisyphus/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 7,082 This file is loaded in full into every session.
When invoked 7,082 The same file — it is already loaded in full.
Security scan B 2 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.07082 $0.07082
Opus 5 $0.03541 $0.03541
Sonnet 5 $0.01416 $0.01416
Haiku 4.5 $0.00708 $0.00708

Measured 11d ago against content hash ab7394197217, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade B, and why

siyuan-plugins-mcp-sisyphus AGENTS.md scanned grade B with 2 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 11d 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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

- 输出 banner `#!/usr/bin/env node`,build 后自动 `chmod 755`。

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- 大量 Node 内置模块标记为 `external`(`child_process`、`fs`、`http`、`crypto` 等)。
AGENTS.md · 440 lines

How it starts

The opening of the file, as written. The whole thing — 440 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SiYuan MCP Sisyphus —— AI 编码代理项目指南

本文档面向 AI 编码代理。阅读者应对本项目一无所知,所有信息均基于实际代码与配置,不假设、不泛化。


项目概述

SiYuan MCP Sisyphus 是 SiYuan Note(思源笔记)的插件 + 独立 CLI 工具,让 AI Agent 能够通过两种接口安全地操作思源笔记:

  1. MCP Server 插件:作为 SiYuan 插件运行,对外暴露 MCP(Model Context Protocol)服务。AI 客户端(Claude Desktop、Cursor、Cherry Studio 等)通过 HTTP 或 stdio 连接。
  2. 独立 CLI siyuan-sisyphus:发布到 npm 的包名 siyuan-sisyphus,安装后提供 siyuan-sisyphus / siyuan 命令。直接通过思源 HTTP API 执行单次操作后退出,无需 MCP 客户端。

两种接口共享同一套底层能力,覆盖思源绝大部分功能:笔记本管理、文档操作、块级读写、属性视图(数据库)、搜索、标签、文件资源、闪卡、系统接口等。聚合工具类别和静态 action 清单以 src/core/config.tsTOOL_CATEGORIESACTIONS_BY_CATEGORY 为唯一事实来源;extension 还可按官方注册表发现动态 action。

  • 仓库地址:https://github.com/yangtaihong59/siyuan-plugins-mcp-sisyphus
  • 作者:Taihong Yang
  • 许可证:MIT
  • 当前版本:0.6.1(根 package.jsonplugin.json 同步)

技术栈

层级 技术
语言 TypeScript 5.1+
构建工具 Vite 5.2+(多 target 构建)
UI 框架 Svelte 4(插件设置面板、桌面悬浮宠物组件)
校验 Zod 4(action 参数校验)
MCP SDK @modelcontextprotocol/{server,client,core,node} ^2.0.0
测试 Vitest 1.6+(Node 环境)
文档 VitePress 1.6+(docs/ 双语站点)
包管理 pnpm(推荐)

关键约束

  • 所有产物为 CommonJS (CJS)
  • 插件在 Electron 渲染进程以 CJS 运行;MCP Server 以 Node 进程运行;CLI 为自包含 CJS bundle。
  • 必须兼容远程场景:任何读写操作都经过思源 HTTP API(http://127.0.0.1:6806 或用户配置地址),禁止直接访问本地文件系统。特许例外仅有两处:① CLI 自身配置(~/.siyuan-sisyphus/config.json);② 上传/下载/导出类 action(如 upload_assetexport_resources),因 SiYuan API 不支持流式二进制传输,必须通过本地文件系统中转。

项目结构

siyuan-plugins-mcp-sisyphus/
├── src/
│   ├── index.ts                 # 插件入口(SiYuan Plugin 基类)
│   ├── server-launcher.ts       # HttpServerLauncher:在插件进程内 spawn mcp-server.cjs 子进程
│   ├── index.scss               # 插件全局样式(几乎为空)
│   │
│   ├── api/                     # 思源 HTTP API 封装层
│   │   ├── client.ts            # SiYuanClient:fetch 封装、token 注入、超时控制
│   │   ├── notebook.ts          # /api/notebook/*
│   │   ├── document.ts          # /api/filetree/* 与文档相关
│   │   ├── block.ts             # /api/block/*
│   │   ├── av.ts                # /api/av/*(attribute view / 数据库)
│   │   ├── search.ts            # /api/search/*、/api/query/sql
│   │   ├── file.ts              # /api/file/*、/api/export/*、/api/asset/*
│   │   ├── system.ts            # /api/system/*
│   │   ├── tag.ts               # /api/tag/*
│   │   ├── flashcard.ts         # /api/riff/*
│   │   └── transaction.ts       # /api/transaction 批量操作
│   │
│   ├── core/                    # MCP 服务器核心与工具元数据
│   │   ├── server.ts            # MCP Server 入口:createSiYuanServer()、startMcpServer()
│   │   ├── http-transport.ts    # HTTP MCP 2026 无状态 + legacy 有会话双协议传输
│   │   ├── tool-registry.ts     # TOOL_REGISTRY:聚合工具注册表
│   │   ├── tool-lifecycle.ts    # 工具调用生命周期:analytics、telemetry、token 计数、错误包装
│   │   ├── config.ts            # ToolConfig 类型、默认值、配置迁移(扁平 → 嵌套)、危险动作定义
│   │   ├── permissions.ts       # PermissionManager:笔记本级权限(rwd/rw/r/none)
│   │   ├── types.ts             # 所有 action 的 Zod schema 定义
│   │   ├── resources.ts         # MCP Resources:help 文档资源路由
│   │   ├── help.ts              # 各工具的帮助文案与提示
│   │   ├── normalize.ts         # 请求参数归一化(类型短码展开、sortBy 别名等)
│   │   ├── analytics.ts         # 调用统计与洞察数据聚合
│   │   ├── telemetry.ts         # 调用事件遥测上报
│   │   ├── token-usage.ts       # 请求/响应近似 token 计算
│   │   ├── puppy-state.ts       # 桌面悬浮宠物(ToolPuppy)状态管理
│   │   ├── server-instructions.ts # 服务端 instructions 文本构建
│   │   └── runtime.ts           # 运行时环境检测(isPluginMode 等)
│   │
│   ├── tools/                   # 聚合工具的实现
│   │   ├── index.ts             # barrel export:统一导出所有工具模块
│   │   ├── internal/            # 工具层共享基础设施(非独立工具)
│   │   │   ├── define-tool.ts   # defineTool() 工厂:统一工具定义模式
│   │   │   ├── shared.ts        # 聚合工具公共函数:schema 构建、结果包装、分页、错误翻译
│   │   │   ├── context.ts       # 工具上下文辅助(权限校验、子文档查询等)
│   │   │   ├── errorTranslation.ts # 思源错误码 → 用户友好文案
│   │   │   ├── ui-refresh.ts    # 触发思源 UI 刷新(所有模式默认开启)
│   │   │   ├── help-render.ts   # help action 输出渲染
│   │   │   ├── schema-analyzer.ts # schema 分析与描述裁剪
│   │   │   └── helpers/         # 跨工具小型 helper,如 notebookName 补全
│   │   ├── notebook/            # notebook 工具(index.ts + handlers.ts)
│   │   ├── document/            # document 工具
│   │   ├── block/               # block 工具
│   │   ├── av/                  # av(数据库)工具
│   │   ├── search/              # search 工具(含 sql-builder、permission-filter)
│   │   ├── file/                # file 工具
│   │   ├── tag/                 # tag 工具
│   │   ├── system/              # system 工具
│   │   ├── flashcard/           # flashcard 工具
│   │   └── mascot/              # mascot(吉祥物余额)工具
│   │
│   ├── cli/                     # 独立 CLI 源码(被 cli Vite target 打包)
│   │   ├── index.ts             # CLI 入口:命令分发(dispatch/list/help/init/config/version)
│   │   ├── dispatch.ts          # 核心转发:调 TOOL_REGISTRY[tool].callTool()
│   │   ├── args.ts              # 顶层参数解析:支持 kebab/camel/snake flag 混用
│   │   ├── flag-mapper.ts       # 基于 inputSchema 做 flag → 参数映射与类型强转
│   │   ├── render.ts            # 人类可读渲染 / --json 紧凑输出 / ANSI 颜色 / 交互式分页
│   │   ├── list-help.ts         # list 与 help 子命令实现
│   │   ├── config.ts            # 配置读写(~/.siyuan-sisyphus/config.json)
│   │   ├── config-command.ts    # config 子命令:多 profile 管理(list/get/set/use)
│   │   ├── init.ts              # 交互式初始化
│   │   ├── plugin-check.ts      # 插件在线检测
│   │   └── runtime.ts           # CLI 运行时环境检测
│   │
│   ├── ui/                      # Svelte UI 与设置面板
│   │   ├── components/          # 桌面悬浮宠物组件与行为逻辑
│   │   ├── setting/             # 插件设置面板
│   │   └── shared/              # UI 共享组件
│   │
│   ├── shared/                  # 跨层通用工具库
│   │   ├── error.ts             # 错误处理辅助
│   │   ├── promise-pool.ts      # 并发池
│   │   └── invocation-format.ts # 调用格式化
│   │
│   ├── types/
│   │   ├── index.d.ts           # 思源常用数据结构(Block、Notebook 等)
│   │   └── api.d.ts             # API 响应类型定义
│   │
│   └── presentation/            # 展示层辅助
│       └── invocation-format.ts # 调用格式化
│
├── cli/                         # 独立 npm 子包(发布为 `siyuan-sisyphus`)
│   ├── package.json             # 子包元数据(version 与根包独立,bin 指向 dist/cli.cjs)
│   ├── README.md / README_zh_CN.md
│   └── dist/                    # CLI 构建产物 cli.cjs(自包含,无外部依赖)
│
├── tests/                       # 测试套件
│   ├── setup.ts                 # Vitest 全局 setup:fetch mock 恢复、vi.restoreAllMocks
│   ├── unit/                    # 单元测试(按 src 目录结构镜像)
│   ├── integration/             # 集成测试(HTTP 并发、端到端 MCP、server 启动)
│   ├── smoke/                   # 冒烟测试(需真实思源实例)
│   ├── mocks/siyuan.ts          # `siyuan` 模块 mock(用于 vitest alias)
│   └── helpers/                 # 测试辅助函数
│
├── docs/                        # VitePress 文档站点(双语:en / zh)
│   ├── .vitepress/config.ts     # VitePress 配置
│   ├── en/                      # 英文文档
│   └── zh/                      # 中文文档
│
├── scripts/                     # 构建与开发辅助脚本
│   ├── make_dev_link.js         # 创建 dev 目录到思源插件目录的符号链接
│   ├── make_install.js          # 构建后安装到思源插件目录
│   ├── update_version.js        # 同步 version 到 plugin.json 与 cli/package.json
│   ├── analyze-description-tokens.ts # 工具描述 token 分析
│   └── repro-index-error*.cjs   # 索引问题复现脚本
│
├── public/i18n/                 # 国际化源文件(JSON 格式,build 时自动复制到 dist)
│   ├── en_US.json
│   └── zh_CN.json
│
├── dist/                        # 生产构建输出(自动生成)
├── dev/                         # 我测试时插件实际上运行的输出,开发模式输出(pnpm dev 时生成)
│
├── package.json                 # 根包(插件本体)
├── plugin.json                  # 思源插件元数据
├── vite.config.ts               # Vite 多入口配置(renderer / server / cli)
├── vitest.config.ts             # Vitest 测试配置
├── tsconfig.json                # TypeScript 配置(strict: false,路径别名 @/*)
├── svelte.config.js             # Svelte 配置(vitePreprocess,压制 a11y 警告)
└── yaml-plugin.js               # 自定义 Vite 插件:YAML i18n → JSON 转换

Read the full file on GitHub · 440 lines

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. 11d ago First seen · 440 lines · 7,082 tokens per session scan B ab7394197217

Subscribe to this mod's changes

siyuan-plugins-mcp-sisyphus AGENTS.md is an instructions file published in the GitHub repository yangtaihong59/siyuan-plugins-mcp-sisyphus (104 stars, last pushed yesterday), licensed MIT. It adds 7,082 tokens to every session, about $0.0354 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens