master-skill 0.9.1 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/.cursor-plugin/plugin.json +2 -2
  4. package/ETHICS.md +23 -17
  5. package/README.md +57 -14
  6. package/README_EN.md +60 -16
  7. package/SKILL.md +5 -5
  8. package/bin/cli.mjs +497 -62
  9. package/gemini-extension.json +2 -2
  10. package/hooks/run-hook.cmd +18 -5
  11. package/hooks/tests/test_run_hook.sh +114 -0
  12. package/hooks/tests/test_run_hook_cmd.sh +94 -0
  13. package/masters/.gitkeep +0 -0
  14. package/package.json +9 -3
  15. package/prebuilt/compare/SKILL.md +48 -14
  16. package/prebuilt/compare/tests/fidelity.jsonl +12 -12
  17. package/prebuilt/master-ajahn-chah/SKILL.md +13 -11
  18. package/prebuilt/master-ajahn-chah/meta.json +8 -0
  19. package/prebuilt/master-ajahn-chah/references/voice.md +1 -1
  20. package/prebuilt/master-atisha/SKILL.md +13 -11
  21. package/prebuilt/master-atisha/meta.json +8 -0
  22. package/prebuilt/master-atisha/references/voice.md +1 -1
  23. package/prebuilt/master-buddhaghosa/SKILL.md +13 -11
  24. package/prebuilt/master-buddhaghosa/meta.json +8 -0
  25. package/prebuilt/master-buddhaghosa/references/voice.md +1 -1
  26. package/prebuilt/master-fazang/SKILL.md +3 -3
  27. package/prebuilt/master-fazang/meta.json +8 -0
  28. package/prebuilt/master-huineng/SKILL.md +3 -3
  29. package/prebuilt/master-huineng/meta.json +8 -0
  30. package/prebuilt/master-kumarajiva/SKILL.md +3 -3
  31. package/prebuilt/master-kumarajiva/meta.json +8 -0
  32. package/prebuilt/master-mahasi-sayadaw/SKILL.md +13 -11
  33. package/prebuilt/master-mahasi-sayadaw/meta.json +8 -0
  34. package/prebuilt/master-mahasi-sayadaw/references/voice.md +2 -2
  35. package/prebuilt/master-milarepa/SKILL.md +13 -11
  36. package/prebuilt/master-milarepa/meta.json +8 -0
  37. package/prebuilt/master-milarepa/references/voice.md +1 -1
  38. package/prebuilt/master-nagarjuna/SKILL.md +3 -3
  39. package/prebuilt/master-nagarjuna/meta.json +8 -0
  40. package/prebuilt/master-ouyi/SKILL.md +3 -3
  41. package/prebuilt/master-ouyi/meta.json +8 -0
  42. package/prebuilt/master-tsongkhapa/SKILL.md +13 -11
  43. package/prebuilt/master-tsongkhapa/meta.json +8 -0
  44. package/prebuilt/master-tsongkhapa/references/voice.md +1 -1
  45. package/prebuilt/master-xuanzang/SKILL.md +3 -3
  46. package/prebuilt/master-xuanzang/meta.json +8 -0
  47. package/prebuilt/master-xuyun/SKILL.md +3 -3
  48. package/prebuilt/master-xuyun/meta.json +8 -0
  49. package/prebuilt/master-yinguang/SKILL.md +3 -3
  50. package/prebuilt/master-yinguang/meta.json +8 -0
  51. package/prebuilt/master-zhiyi/SKILL.md +3 -3
  52. package/prebuilt/master-zhiyi/meta.json +8 -0
  53. package/prompts/correction_handler.md +104 -0
  54. package/prompts/doctrine_reviewer.md +61 -0
  55. package/prompts/intake.md +62 -0
  56. package/prompts/merger.md +62 -0
  57. package/prompts/rag_instructions.md +54 -0
  58. package/prompts/sutra_analyzer.md +83 -0
  59. package/prompts/teaching_builder.md +41 -0
  60. package/prompts/voice_analyzer.md +92 -0
  61. package/prompts/voice_builder.md +48 -0
  62. package/prompts/voice_reviewer.md +66 -0
  63. package/references/README.md +12 -0
  64. package/references/ethics-runtime.md +112 -0
  65. package/references/fojin-api.md +223 -0
  66. package/references/source-conventions.md +129 -0
  67. package/references/teaching-modes.md +84 -0
  68. package/references/traditions.md +72 -0
  69. package/references/workflow-details.md +361 -0
  70. package/requirements.txt +6 -0
  71. package/scripts/select-fidelity-smoke.py +78 -0
  72. package/scripts/test-fidelity.py +40 -10
  73. package/scripts/tests/test_select_fidelity_smoke.py +142 -0
  74. package/scripts/tests/test_validate_citation_contract.py +408 -0
  75. package/scripts/tests/test_validate_fidelity.py +59 -0
  76. package/scripts/tests/test_validate_workflow.py +265 -0
  77. package/scripts/validate-citation-contract.py +193 -0
  78. package/scripts/validate-fidelity.py +20 -0
  79. package/scripts/verify_citations.py +8 -1
  80. package/skill-catalog.json +147 -0
  81. package/tools/cross_reference.py +365 -0
  82. package/tools/fojin_bridge.py +146 -0
  83. package/tools/master_builder.py +341 -0
  84. package/tools/rag_query.py +336 -0
  85. package/tools/skill_writer.py +230 -0
  86. package/tools/sutra_collector.py +237 -0
  87. package/tools/verify_sources.py +512 -0
  88. package/tools/version_manager.py +88 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "master-skill",
3
- "description": "Buddhist Master AI Skills 14 historical masters across 汉传/藏传/南传 plus 3 teaching meta-skills (compare / debate / curriculum), with source-cited teachings",
3
+ "description": "FoJin-powered Buddhist AI persona framework with 15 source-grounded masters across 印度/汉传/藏传/南传 plus compare, debate, and curriculum meta-skills",
4
4
  "owner": {
5
5
  "name": "xr843",
6
6
  "email": "xr843@users.noreply.github.com"
@@ -8,8 +8,8 @@
8
8
  "plugins": [
9
9
  {
10
10
  "name": "master-skill",
11
- "description": "Buddhist Master AI teaching personas14 prebuilt masters across 汉传/藏传/南传 plus 3 teaching meta-skills (compare-masters / master-debate / master-curriculum), invokable via /master-<slug> slash commands, with source-cited doctrinal responses (CBETA / BDRC / SuttaCentral / PTS Vism), RAG-grounded in FoJin knowledge graph",
12
- "version": "0.9.1",
11
+ "description": "FoJin-powered Buddhist AI persona frameworksource-grounded, boundary-aware, fidelity-tested, runtime-ready. 15 prebuilt masters across 印度/汉传/藏传/南传 plus compare, debate, and curriculum meta-skills.",
12
+ "version": "0.10.1",
13
13
  "source": "./",
14
14
  "author": {
15
15
  "name": "xr843",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "master-skill",
3
- "description": "Buddhist Master AI teaching personas14 prebuilt masters across 汉传/藏传/南传 plus 3 teaching meta-skills (compare-masters / master-debate / master-curriculum), invokable via /master-<slug> slash commands, with source-cited doctrinal responses (CBETA / BDRC / SuttaCentral / PTS Vism), RAG-grounded in FoJin knowledge graph",
4
- "version": "0.9.1",
3
+ "description": "FoJin-powered Buddhist AI persona frameworksource-grounded, boundary-aware, fidelity-tested, runtime-ready. 15 prebuilt masters across 印度/汉传/藏传/南传 plus compare, debate, and curriculum meta-skills.",
4
+ "version": "0.10.1",
5
5
  "author": {
6
6
  "name": "xr843",
7
7
  "email": "xr843@users.noreply.github.com"
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "master-skill",
3
3
  "displayName": "Master Skill",
4
- "description": "Buddhist Master AI teaching personas14 prebuilt masters across 汉传/藏传/南传 invokable via /master-<slug> slash commands, with source-cited doctrinal responses (CBETA / BDRC / SuttaCentral / PTS Vism), RAG-grounded in FoJin knowledge graph",
5
- "version": "0.9.1",
4
+ "description": "FoJin-powered Buddhist AI persona frameworksource-grounded, boundary-aware, fidelity-tested, runtime-ready. 15 prebuilt masters across 印度/汉传/藏传/南传.",
5
+ "version": "0.10.1",
6
6
  "author": {
7
7
  "name": "xr843",
8
8
  "email": "xr843@users.noreply.github.com"
package/ETHICS.md CHANGED
@@ -8,12 +8,12 @@
8
8
 
9
9
  **所有通过 Master-skill 生成的对话、文本、回答,均为 AI 合成内容,不是真实祖师的著作、开示或教言。**
10
10
 
11
- - 每位预置法师的回答均由大型语言模型基于 CBETA 经典文献 + `teaching.md` / `voice.md` 合成,**不代表**历史上该法师的原话、亲口开示或亲笔著作
11
+ - 每位预置法师的回答均由大型语言模型基于该 persona 声明的原典来源(CBETA、BDRC / Toh、SuttaCentral / PTS 或合规编纂开示)+ `teaching.md` / `voice.md` 合成,**不代表**历史上该法师的原话、亲口开示或亲笔著作
12
12
  - AI 角色对祖师表达风格的还原是**近似**,非权威:语言选词、句式节奏、比喻用法由模型生成,不可直接引用为"某法师说过"
13
- - 所有引经据典的 CBETA 编号来自 `sources/` 离线片段或 FoJin 实时检索,但**回答中的文义阐释**是 AI 组合生成,可能与祖师原文含义有偏差
13
+ - 所有引经据典的来源标识必须来自 persona `meta.json.sources[]`;即使来源标识真实,**回答中的文义阐释**仍是 AI 组合生成,可能与祖师原文含义有偏差
14
14
  - 使用时请始终默认:"这是基于文献的 AI 学习辅助",不是"与祖师对话"。前者是工具,后者是误解
15
15
 
16
- 如你在任何公开场合引用、转发、发表由本项目生成的文本,**必须明确标注 AI 生成属性与原始出处**(CBETA 经号 / FoJin 链接)。将 AI 生成内容作为祖师原话传播,既违反本协议,也违背佛教"不妄语"的基本戒律。
16
+ 如你在任何公开场合引用、转发、发表由本项目生成的文本,**必须明确标注 AI 生成属性与原始出处**(来源家族、声明 ID、题名及可用定位信息)。将 AI 生成内容作为祖师原话传播,既违反本协议,也违背佛教"不妄语"的基本戒律。
17
17
 
18
18
  ---
19
19
 
@@ -171,7 +171,7 @@ Master-skill 采取**双轨授权**,代码与内容分开授权:
171
171
  | 源代码(`scripts/`、`tools/`、`bin/`、`hooks/`、`.github/`、workflow、CI) | **MIT** | 任意使用、修改、商用 | 去除版权声明 |
172
172
  | 预置法师内容(`prebuilt/**/SKILL.md`、`teaching.md`、`voice.md`、`sources/*.md`、`fidelity.jsonl`) | **CC BY-NC-SA 4.0** | 署名 + 非商用 + 相同方式共享下任意使用 | 未署名、纯商业闭源分发 |
173
173
  | Prompts 模板(`prompts/**`) | **CC BY 4.0** | 署名后任意使用 | 去署名 |
174
- | FoJin 检索返回的原始经文 | **CBETA 知识共用 非商业性 禁止改作 3.0** | 遵循 CBETA 原协议 | 违反 CBETA 协议 |
174
+ | FoJin 检索返回的原始经文 / 元数据 / 编纂开示 | **按返回来源族、具体版本与权利人的原始许可**(CBETA、BDRC / Toh、SuttaCentral / PTS、compiled teachings 各自适用) | 在对应许可与合理引用范围内使用并保留出处 | 把某一来源许可套用于其他来源、移除归属、超授权复制或商用 |
175
175
 
176
176
  **商业化使用(含但不限于):**
177
177
  - SaaS 付费问答服务嵌入 Master-skill 法师内容
@@ -184,24 +184,30 @@ Master-skill 采取**双轨授权**,代码与内容分开授权:
184
184
 
185
185
  ## 5. 数据来源透明 (Data Provenance)
186
186
 
187
- 每位法师 `SKILL.md` frontmatter 必须声明:
188
-
189
- ```yaml
190
- sources:
191
- - title: {经典名称}
192
- cbeta_id: {CBETA 编号,如 T30n1579}
193
- fojin_text_id: {FoJin 内部 ID}
194
- citation_format: "【《{title}》卷{juan},{cbeta_id}】"
195
- verified_by: {维护者 GitHub 用户名}
196
- verified_at: {YYYY-MM-DD}
187
+ 每位 persona 的 `meta.json` 必须声明来源清单与同源 citation contract:
188
+
189
+ ```json
190
+ {
191
+ "sources": [
192
+ {"type": "cbeta | tibetan_canon | pali_canon | compiled_teaching | ...", "id": "来源族内的声明 ID", "title": "经典或开示题名"}
193
+ ],
194
+ "citation_contract": {
195
+ "version": 1,
196
+ "claim_policy": "declared_sources_only",
197
+ "required_for": ["doctrinal_claim", "practice_guidance", "text_interpretation"],
198
+ "allowed_source_types": ["由 sources[].type 自动派生"],
199
+ "minimum_claim_coverage": 0.9,
200
+ "live_retrieval_allowed": true
201
+ }
202
+ }
197
203
  ```
198
204
 
199
205
  **HARD-GATE 铁律:**
200
- - CBETA 经号的教义断言不得写入 `teaching.md`
201
- - 不得捏造 CBETA 编号(CI `scripts/validate.py` 会对照 FoJin 反查)
206
+ - 教义断言、修行指导与文本解释若不能解析到 `meta.json.sources[]` 的声明来源,不得写入 `teaching.md`
207
+ - 不得捏造来源 ID,来源类型必须属于 `citation_contract.allowed_source_types`
202
208
  - 不得为虚构人物、合成 persona、无史实记载者建立 `prebuilt/`
203
209
 
204
- 违反以上任一,PR 将被自动驳回。
210
+ `scripts/validate-citation-contract.py` 与 `verify_sources.py --check-links/--final-check` 会离线检查来源清单、家族 ID 与合同一致性;它们不解析正文自由文本,也不保证外部站点可达。违反以上任一,PR 将被自动驳回。
205
211
 
206
212
  ---
207
213
 
package/README.md CHANGED
@@ -26,8 +26,13 @@
26
26
  </p>
27
27
 
28
28
  <p align="center">
29
- <strong>依据四大佛教传统祖师大德的教学风格,通达 AI 学习伙伴</strong><br>
30
- 15 位祖师 · 印度 / 汉传 / 藏传 / 南传跨传统 · CBETA / BDRC / SuttaCentral / PTS Vism 真实出处 · AgentSkills 标准
29
+ <strong>FoJin 驱动的佛教 AI 祖师人格框架</strong><br>
30
+ 有来源 · 守边界 · 可评测 · 可运行 · 15 位祖师 · 印度 / 汉传 / 藏传 / 南传跨传统
31
+ </p>
32
+
33
+ <p align="center">
34
+ <sub>Source-grounded · Boundary-aware · Fidelity-tested · Runtime-ready</sub><br>
35
+ <sub>CBETA / BDRC / SuttaCentral / PTS Vism 真实出处 · AgentSkills 标准</sub>
31
36
  </p>
32
37
 
33
38
  <p align="center">
@@ -123,7 +128,7 @@
123
128
 
124
129
  ---
125
130
 
126
- 基于佛教经典文献的法师教学角色生成器,遵循 AgentSkills 标准,由 [FoJin](https://fojin.app) 驱动。
131
+ Master-skill 是由 [FoJin](https://fojin.app) 驱动的佛教 AI 祖师人格框架:以真实原典为来源,以伦理边界为约束,以保真度评测为质量门槛,并以 AgentSkills 运行协议交付给 Claude Code、Cursor、Codex CLI、OpenCode 与 Gemini CLI。
127
132
 
128
133
  ---
129
134
 
@@ -138,10 +143,10 @@
138
143
  ## 特性
139
144
 
140
145
  - **预置十五位四大传统祖师**:1 位印度(龙树 · 中观)+ 8 位汉传(唯识、中观、禅、天台、华严、净土、跨宗派)+ 3 位藏传(阿底峡 · 噶当;宗喀巴 · 格鲁;米拉日巴 · 噶举)+ 3 位南传(觉音 · 上座部论师;马哈希 · 缅甸内观;阿姜查 · 泰国森林)—— 另含 `compare-masters` 多祖师对比 meta-skill,开箱即用
141
- - **经文溯源(Provenance)**:每位祖师附原典标识(CBETA / BDRC / SuttaCentral)+ FoJin text ID,所有教义断言强制附原典引证
146
+ - **经文溯源(Provenance)**:每位祖师附声明来源 ID(CBETA / BDRC / Toh / SuttaCentral / PTS / 合规编纂开示);实时检索仅在返回真实 `text_id` 时附 FoJin 定位链接,所有教义断言强制附原典引证
142
147
  - **离线经文片段**:`sources/` 目录收录核心经典关键段落,FoJin 不可用时仍可离线引用
143
148
  - **渐进式披露**:SKILL.md 以决策树 + Quick Ref 为主,`references/`、`sources/` 按需加载,Context 随查随取
144
- - **HARD-GATE 铁律**:`/create-master` 与预置法师内置红线——无 CBETA 引证的教义断言不得写入、不得捏造经号、不得为虚构人物建角色
149
+ - **HARD-GATE 铁律**:`/create-master` 与预置法师内置红线——教义断言、修行指导与文本解释必须引用该 persona 声明的来源(CBETA / BDRC / Toh / SuttaCentral / PTS / 合规编纂开示),不得捏造来源 ID,不得为虚构人物建角色
145
150
  - **二阶段独立审查**:生成管线在写入前强制经过"教义准确性 → 风格一致性"两轮独立审查,FAIL 自动修复最多 2 轮
146
151
  - **自动化保真度测试**:每位祖师 `tests/fidelity.jsonl` 10+ 条 Q&A(`compare-masters` 元技能 18 条),验证引用和关键词覆盖;CI 在每次推送时 dry-run 验证(结构校验);实跑评分需 `ANTHROPIC_API_KEY`,作为本地/发版前手动步骤执行
147
152
  - **多平台统一插件**:Claude Code、Cursor、Codex CLI、OpenCode、Gemini CLI 共用一份 `prebuilt/`,session-start hook 跨平台注入法师列表
@@ -150,6 +155,19 @@
150
155
  - **FoJin 数据桥**:接入 [fojin.app](https://fojin.app) 的 503 个数据源、10K+ 文本、678K+ 语义向量和 31K 实体知识图谱
151
156
  - **AgentSkills 标准**:遵循 [Anthropic Agent Skills](https://github.com/anthropics/skills) 规范,渐进式披露、决策树、黑盒脚本模式
152
157
 
158
+ ## 框架定位
159
+
160
+ Master-skill 的核心不是"角色扮演提示词集合",而是一个可验证的佛教 AI persona framework:
161
+
162
+ | 维度 | 实现 |
163
+ |---|---|
164
+ | 有来源 | 每位祖师声明 `sources[]`、离线 excerpts、FoJin live fallback 与引用自审 |
165
+ | 守边界 | `ETHICS.md`、每位祖师 Layer 0 HARD-GATE、版权 Tier 与教界越界报告机制 |
166
+ | 可评测 | `tests/fidelity.jsonl`、persona-fidelity schema、promptfoo RAW / SPE / CUS 评测层 |
167
+ | 可运行 | `prebuilt/master-*` AgentSkills、npm CLI、多平台 hooks、FoJin runtime contract |
168
+
169
+ 后续 v1.0 路线以框架稳定为优先:见 [docs/v1-framework-roadmap.md](docs/v1-framework-roadmap.md) 与 [docs/fojin-runtime-contract.md](docs/fojin-runtime-contract.md)。
170
+
153
171
  ---
154
172
 
155
173
  ## 开发者安装
@@ -161,14 +179,20 @@
161
179
 
162
180
  **NPX 一键安装(推荐,无需常驻)**
163
181
 
182
+ `npx master-skill install --all` 一次安装全部 19 个 Skill:15 位祖师、3 个教学模式,以及 `create-master` 生成器。`create-master` 会复制自包含的运行时,因此临时 npx 包目录被清理后仍可使用;重新安装或 `update --all` 会更新运行时,但保留 `create-master/masters/` 中用户生成的 persona。
183
+
164
184
  ```bash
165
185
  # 安装指定祖师
166
186
  npx master-skill install master-zhiyi master-fazang master-huineng
167
187
 
168
- # 安装全部 15 位(四大传统)
188
+ # 单独安装公共教学模式或自定义生成器
189
+ npx master-skill install compare-masters
190
+ npx master-skill install create-master
191
+
192
+ # 安装全部 19 个 Skill
169
193
  npx master-skill install --all
170
194
 
171
- # 查看可用祖师
195
+ # 查看全部可安装 Skill
172
196
  npx master-skill list
173
197
  ```
174
198
 
@@ -187,7 +211,8 @@ npm update -g master-skill # 升到下一个 minor / patch
187
211
  # npx(上方)与 git clone 手动安装为正式发布渠道:
188
212
  git clone https://github.com/xr843/Master-skill ~/Master-skill
189
213
  cd ~/Master-skill && pip install -r requirements.txt
190
- for d in prebuilt/*/; do ln -sf "$(pwd)/$d" ~/.claude/skills/"$(basename $d)"; done
214
+ for d in prebuilt/master-*/; do ln -sf "$(pwd)/$d" ~/.claude/skills/"$(basename $d)"; done
215
+ ln -sf "$(pwd)/prebuilt/compare" ~/.claude/skills/compare-masters
191
216
  ln -sf "$(pwd)" ~/.claude/skills/create-master
192
217
  ```
193
218
 
@@ -283,6 +308,24 @@ git clone https://github.com/xr843/Master-skill ~/Master-skill
283
308
 
284
309
  ---
285
310
 
311
+ ## 桌面管理器
312
+
313
+ 原生桌面控制台(纯 Rust,egui,单二进制,无 Electron),统一管理 17 个 master skill 的安装状态、fidelity 评测覆盖率、运行追踪与质量门禁:
314
+
315
+ ![Master-skill Desktop Manager](https://raw.githubusercontent.com/xr843/Master-skill/master/docs/assets/desktop-manager.png)
316
+
317
+ **下载**:[Releases](https://github.com/xr843/Master-skill/releases) 提供 Linux / Windows / macOS 预编译二进制,下载后直接运行(仓库根目录下执行,需本地已 clone 本仓库)。Linux / macOS 下载后需先 `chmod +x` 赋予可执行权限;macOS 上二进制未签名,首次运行需右键"打开"或执行 `xattr -d com.apple.quarantine <文件名>` 解除隔离。
318
+
319
+ **从源码构建**:
320
+
321
+ ```bash
322
+ cd desktop && cargo build --release
323
+ ./target/release/master-skill-desktop # 图形界面
324
+ ./target/release/master-skill-desktop --baseline # 无头跑 fidelity dry-run 基线
325
+ ```
326
+
327
+ ---
328
+
286
329
  ## 预置法师
287
330
 
288
331
  ### 龙树菩萨(Nāgārjuna,约150-250) — 印度 · 中观
@@ -402,7 +445,7 @@ SKILL.md (AgentSkills 入口:决策树 + Quick Ref)
402
445
  | | +-- teaching.md
403
446
  | | +-- voice.md
404
447
  | +-- sources/ (离线经文片段)
405
- | | +-- *.md (CBETA 段落)
448
+ | | +-- *.md (声明来源的离线段落)
406
449
  | +-- tests/
407
450
  | +-- fidelity.jsonl (保真度样例, CI dry-run)
408
451
  |
@@ -443,7 +486,7 @@ Master-skill 通过 `tools/fojin_bridge.py` 接入 FoJin API,实现:
443
486
  - 语义向量相似度搜索(教义相关经文)
444
487
  - 原文段落提取与出处追踪
445
488
 
446
- 所有引用均附带可追溯的 FoJin 链接,确保内容来源透明。
489
+ 所有引用都必须能追溯到 persona 声明的来源 ID;仅当实时检索返回真实 `text_id` 时附 FoJin 定位链接,否则使用对应官方目录或离线声明来源。
447
490
 
448
491
  ---
449
492
 
@@ -457,8 +500,8 @@ Master-skill 通过 `tools/fojin_bridge.py` 接入 FoJin API,实现:
457
500
 
458
501
  **要做:**
459
502
 
460
- - 忠实依据经文原文,所有回答附 FoJin 出处链接
461
- - 通过运行时 RAG 检索真实经文,而非仅依赖 AI 自身知识
503
+ - 忠实依据声明来源,回答附可追溯的来源 ID;有真实 `text_id` 时再附 FoJin 定位链接
504
+ - 仅在 citation contract 允许且离线资料不足时通过运行时 RAG 检索,不以 AI 自身知识冒充原典
462
505
  - 遇到超出范围的问题坦诚说明
463
506
 
464
507
  ---
@@ -469,9 +512,9 @@ Master-skill 通过 `tools/fojin_bridge.py` 接入 FoJin API,实现:
469
512
 
470
513
  能。每位预置法师的 `prebuilt/<name>/sources/` 收录了该法师核心经典的关键段落(离线经文片段)。FoJin 不可用时,法师会降级到离线模式并在回答中声明"当前使用离线片段"。`/create-master` 管线遇到 API 故障会提示用户切换手动输入模式,由用户粘贴经文原文继续生成。
471
514
 
472
- **Q:CBETA 引用格式是什么样的?怎么验证?**
515
+ **Q:CBETA 引用格式是什么样的?来源如何验证?**
473
516
 
474
- 所有 CBETA 引证必须带 `Txxn####` 形式的经号(例如《妙法蓮華經》→ `T9n262`)。`scripts/validate.py` 会检查 frontmatter 的 `sources` 字段格式;`tools/verify_sources.py` 在写入前会逐条核对 FoJin `text_id` 的有效性,失效链接自动降级为 FoJin 搜索链接,不会留下死链。
517
+ CBETA 引证使用 `Txxn####` 形式的经号(例如《妙法蓮華經》→ `T09n0262`);藏传、南传与编纂开示分别使用 persona 在 `meta.json.sources[]` 中声明的 BDRC / Toh、SuttaCentral / PTS 或 teaching ID。`scripts/validate-citation-contract.py` `tools/verify_sources.py --check-links/--final-check` 离线检查来源家族、ID 格式、声明归属和合同一致性;它们不解析正文自由文本,也不保证外部链接 HTTP 可达。旧版 `verify_sources.py --fix` 在线审计只覆盖 CBETA / FoJin 链接。
475
518
 
476
519
  **Q:`npx master-skill install` 执行失败、报 ENOTEMPTY 或权限错误怎么办?**
477
520
 
package/README_EN.md CHANGED
@@ -25,8 +25,12 @@
25
25
  </p>
26
26
 
27
27
  <p align="center">
28
- <strong>AI learning companions modeled after historical Buddhist masters across four traditions</strong><br>
29
- 15 pre-built masters · 印度 / 汉传 / 藏传 / 南传 cross-tradition · CBETA / BDRC / SuttaCentral / PTS Vism citations · AgentSkills Standard
28
+ <strong>A FoJin-powered Buddhist AI persona framework</strong><br>
29
+ Source-grounded · Boundary-aware · Fidelity-tested · Runtime-ready · 15 masters across 印度 / 汉传 / 藏传 / 南传
30
+ </p>
31
+
32
+ <p align="center">
33
+ <sub>CBETA / BDRC / SuttaCentral / PTS Vism citations · AgentSkills Standard</sub>
30
34
  </p>
31
35
 
32
36
  <p align="center">
@@ -124,7 +128,7 @@ For further study, consult the original texts at FoJin (fojin.app).
124
128
 
125
129
  ---
126
130
 
127
- An AgentSkills-standard generator for AI personas based on historical Buddhist masters, powered by [FoJin](https://fojin.app) a Buddhist text aggregation platform.
131
+ Master-skill is a [FoJin](https://fojin.app)-powered Buddhist AI persona framework: grounded in primary sources, constrained by ethical boundaries, checked by fidelity tests, and packaged as runtime-ready AgentSkills for Claude Code, Cursor, Codex CLI, OpenCode, and Gemini CLI.
128
132
 
129
133
  ---
130
134
 
@@ -137,10 +141,10 @@ This project is built out of respect for Buddhist traditions. All content is gen
137
141
  ## Features
138
142
 
139
143
  - **15 pre-built masters across four traditions**: 1 印度 (Madhyamaka · Nāgārjuna) + 8 汉传 (Yogācāra, Madhyamaka, Chan, Tiantai, Huayan, Pure Land, cross-tradition) + 3 藏传 (Kadam · Atiśa; Gelug · Tsongkhapa; Kagyu · Milarepa) + 3 南传 (Theravāda commentator · Buddhaghosa; Burmese vipassanā · Mahasi Sayadaw; Thai Forest · Ajahn Chah) — plus a `compare-masters` multi-master comparison meta-skill, ready to use out of the box
140
- - **Provenance enforcement**: Every master ships with authoritative source IDs (CBETA / BDRC / SuttaCentral) and FoJin text IDs in frontmatter; every doctrinal claim must carry a scriptural citation
144
+ - **Provenance enforcement**: Every master ships with declared source IDs (CBETA / BDRC / Toh / SuttaCentral / PTS / compliant compiled teachings); live retrieval adds a FoJin locator only when a real `text_id` is returned, and every doctrinal claim must carry a source citation
141
145
  - **Offline source passages**: `sources/` captures key passages from each master's core canon, so citations still work when FoJin is unreachable
142
146
  - **Progressive disclosure**: SKILL.md is a decision tree + quick reference; `references/` and `sources/` are loaded on demand to keep context lean
143
- - **HARD-GATE discipline**: Both `/create-master` and every prebuilt master embed hard rules no unverified CBETA ID, no uncited doctrinal claim, no fictional personas
147
+ - **HARD-GATE discipline**: Both `/create-master` and every prebuilt master require doctrinal claims, practice guidance, and text interpretation to cite that persona's declared sources (CBETA / BDRC / Toh / SuttaCentral / PTS / compliant compiled teachings); fabricated source IDs and fictional personas are forbidden
144
148
  - **Two-stage independent review**: The generation pipeline forces a "doctrinal accuracy → voice consistency" review before write; FAIL triggers up to 2 rounds of automatic repair
145
149
  - **Automated fidelity tests**: Each master's `tests/fidelity.jsonl` holds 10+ Q&A samples (the `compare-masters` meta-skill holds 18) validating citations and keyword coverage; CI runs a dry-run on every push
146
150
  - **Unified multi-platform plugin**: Claude Code, Cursor, Codex CLI, OpenCode, and Gemini CLI share one `prebuilt/` tree, with a session-start hook injecting the master list on every platform
@@ -149,6 +153,19 @@ This project is built out of respect for Buddhist traditions. All content is gen
149
153
  - **FoJin data bridge**: Connected to [fojin.app](https://fojin.app) with 503 data sources, 10K+ texts, 678K+ semantic embeddings, and a 31K-entity knowledge graph
150
154
  - **AgentSkills standard**: Compliant with [Anthropic Agent Skills](https://github.com/anthropics/skills) — progressive disclosure, decision trees, black-box script pattern
151
155
 
156
+ ## Framework Positioning
157
+
158
+ Master-skill is not a prompt pack. It is a verifiable Buddhist AI persona framework:
159
+
160
+ | Dimension | Implementation |
161
+ |---|---|
162
+ | Source-grounded | `sources[]`, offline excerpts, FoJin live fallback, and citation self-audits per master |
163
+ | Boundary-aware | `ETHICS.md`, per-master Layer 0 HARD-GATE rules, copyright tiers, and boundary violation reporting |
164
+ | Fidelity-tested | `tests/fidelity.jsonl`, persona-fidelity schema, and promptfoo RAW / SPE / CUS evals |
165
+ | Runtime-ready | `prebuilt/master-*` AgentSkills, npm CLI, multi-platform hooks, and a FoJin runtime contract |
166
+
167
+ The v1.0 track prioritizes framework stability over adding more masters. See [docs/v1-framework-roadmap.md](docs/v1-framework-roadmap.md) and [docs/fojin-runtime-contract.md](docs/fojin-runtime-contract.md).
168
+
152
169
  ---
153
170
 
154
171
  ## Developer Installation
@@ -160,9 +177,17 @@ This project is built out of respect for Buddhist traditions. All content is gen
160
177
 
161
178
  **NPX (recommended, no global state)**
162
179
 
180
+ `npx master-skill install --all` installs all 19 skills: 15 personas, 3 teaching modes, and the `create-master` generator. The generator is copied as a self-contained runtime, so it remains usable after the transient npx package directory is removed; reinstall and `update --all` refresh the runtime while preserving user-generated personas under `create-master/masters/`.
181
+
163
182
  ```bash
164
- npx master-skill install --all # Install all 15 masters
165
- npx master-skill list # List available masters
183
+ # Install individual public skills
184
+ npx master-skill install master-zhiyi
185
+ npx master-skill install compare-masters
186
+ npx master-skill install create-master
187
+
188
+ # Install or list the complete 19-skill catalog
189
+ npx master-skill install --all
190
+ npx master-skill list
166
191
  ```
167
192
 
168
193
  **Global install (frequent use / offline-friendly)**
@@ -179,7 +204,8 @@ npm update -g master-skill # Pull next minor / patch
179
204
  ```bash
180
205
  git clone https://github.com/xr843/Master-skill ~/Master-skill
181
206
  cd ~/Master-skill && pip install -r requirements.txt
182
- for d in prebuilt/*/; do ln -sf "$(pwd)/$d" ~/.claude/skills/"$(basename $d)"; done
207
+ for d in prebuilt/master-*/; do ln -sf "$(pwd)/$d" ~/.claude/skills/"$(basename $d)"; done
208
+ ln -sf "$(pwd)/prebuilt/compare" ~/.claude/skills/compare-masters
183
209
  ln -sf "$(pwd)" ~/.claude/skills/create-master
184
210
  ```
185
211
 
@@ -262,6 +288,24 @@ The system will guide you through a three-step intake, then automatically collec
262
288
 
263
289
  ---
264
290
 
291
+ ## Desktop Manager
292
+
293
+ A native desktop console (pure Rust, egui, single binary, no Electron) that unifies management of installation status, fidelity evaluation coverage, run tracing, and the quality gate across all 17 master skills:
294
+
295
+ ![Master-skill Desktop Manager](https://raw.githubusercontent.com/xr843/Master-skill/master/docs/assets/desktop-manager.png)
296
+
297
+ **Download**: [Releases](https://github.com/xr843/Master-skill/releases) provides pre-built binaries for Linux / Windows / macOS — download and run directly (execute from the repository root; requires a local clone of this repo). On Linux/macOS you'll need to `chmod +x` the downloaded binary first; on macOS it's unsigned, so the first run needs right-click → Open, or `xattr -d com.apple.quarantine <file>` to clear the quarantine flag.
298
+
299
+ **Build from source**:
300
+
301
+ ```bash
302
+ cd desktop && cargo build --release
303
+ ./target/release/master-skill-desktop # GUI
304
+ ./target/release/master-skill-desktop --baseline # headless fidelity dry-run baseline
305
+ ```
306
+
307
+ ---
308
+
265
309
  ## Pre-built Masters
266
310
 
267
311
  ### Nāgārjuna (c. 150-250) — Indian · Madhyamaka
@@ -379,7 +423,7 @@ SKILL.md (AgentSkills entry: decision tree + quick reference)
379
423
  | +-- references/ (loaded on demand)
380
424
  | | +-- teaching.md
381
425
  | | +-- voice.md
382
- | +-- sources/ (offline CBETA passages)
426
+ | +-- sources/ (offline declared-source passages)
383
427
  | | +-- *.md
384
428
  | +-- tests/
385
429
  | +-- fidelity.jsonl (CI dry-run samples)
@@ -422,7 +466,7 @@ Master-skill connects to the FoJin API via `tools/fojin_bridge.py` to enable:
422
466
  - Runtime RAG retrieval for grounding answers in real texts
423
467
  - Source passage extraction with provenance tracking
424
468
 
425
- All citations include traceable FoJin links to ensure transparency of sources.
469
+ Every citation must resolve to the persona's declared source ID. A FoJin locator is added only when live retrieval returns a real `text_id`; otherwise the corresponding official catalog or offline declared source is used.
426
470
 
427
471
  ---
428
472
 
@@ -438,8 +482,8 @@ All citations include traceable FoJin links to ensure transparency of sources.
438
482
 
439
483
  **Will:**
440
484
 
441
- - Cite source texts faithfully, with FoJin links on every response
442
- - Retrieve real texts via runtime RAG, not relying solely on AI training data
485
+ - Cite declared sources faithfully with traceable source IDs, adding a FoJin locator only when a real `text_id` is available
486
+ - Use runtime RAG only when the citation contract permits it and offline material is insufficient; never present model memory as a primary text
443
487
  - Acknowledge clearly when a question falls outside scope
444
488
  - Encourage users to seek out qualified masters and authentic practice
445
489
 
@@ -451,9 +495,9 @@ All citations include traceable FoJin links to ensure transparency of sources.
451
495
 
452
496
  Yes. Each prebuilt master ships with `prebuilt/<name>/sources/` — key passages from that master's core canon, stored offline. When FoJin is down, the master degrades to offline mode and declares "currently running on offline passages" in the reply. The `/create-master` pipeline asks the user to switch to manual-input mode when the API fails, so you can paste source text and continue.
453
497
 
454
- **Q: What does a valid CBETA citation look like, and how is it verified?**
498
+ **Q: What does a valid CBETA citation look like, and how are sources verified?**
455
499
 
456
- Every CBETA citation must carry a `Txxn####` identifier (for example, the Lotus Sutra is `T9n262`). `scripts/validate.py` lints the frontmatter `sources` block; `tools/verify_sources.py` checks every FoJin `text_id` against the live API before writing. Broken links are downgraded to FoJin search URLs no dead references make it into the final file.
500
+ CBETA citations use a `Txxn####` identifier (for example, the Lotus Sutra is `T09n0262`); Tibetan, Pali, and compiled-teaching personas use the BDRC / Toh, SuttaCentral / PTS, or teaching IDs declared in `meta.json.sources[]`. `scripts/validate-citation-contract.py` and `tools/verify_sources.py --check-links/--final-check` validate source families, identifier shapes, declared membership, and contract consistency offline. They do not parse free-text citations or guarantee HTTP reachability. The legacy online `verify_sources.py --fix` audit covers CBETA / FoJin links only.
457
501
 
458
502
  **Q: `npx master-skill install` fails with ENOTEMPTY or a permission error — what now?**
459
503
 
@@ -473,9 +517,9 @@ See "Contributing" below. The short version: follow the v0.3 layout under `prebu
473
517
 
474
518
  Contributions are welcome: new prebuilt masters, corrections to source attributions, offline passage additions, or toolchain improvements.
475
519
 
476
- New masters must follow the v0.3 layout: `prebuilt/<name>/` containing SKILL.md (with provenance frontmatter and a decision tree), `references/teaching.md` and `references/voice.md` (loaded on demand), `sources/*.md` (offline CBETA passages), and `tests/fidelity.jsonl` (5+ Q&A fidelity samples). Run `python3 scripts/validate.py --strict` for zero errors, and make sure the CI fidelity dry-run passes before opening a PR.
520
+ New masters must follow the v0.3 layout: `prebuilt/<name>/` containing SKILL.md (with provenance routing and a decision tree), `meta.json` (declared sources plus citation contract), `references/teaching.md` and `references/voice.md` (loaded on demand), `sources/*.md` (offline declared-source passages), and `tests/fidelity.jsonl` (5+ Q&A fidelity samples). Run `python3 scripts/validate.py --strict` and `python3 scripts/validate-citation-contract.py` for zero errors, and make sure the CI fidelity dry-run passes before opening a PR.
477
521
 
478
- Before submitting, verify that sources trace back to CBETA, content is faithful to historical documents, and no sectarian bias is introduced.
522
+ Before submitting, verify that every source resolves to the persona's declared source family, content is faithful to historical documents, and no sectarian bias is introduced.
479
523
 
480
524
  ---
481
525
 
package/SKILL.md CHANGED
@@ -72,7 +72,7 @@ allowed-tools:
72
72
 
73
73
  ### Step 2:数据采集
74
74
 
75
- 使用 `${CLAUDE_SKILL_DIR}/tools/sutra_collector.py --name "<法师名>" --tradition "<传承>"` 从 FoJin 采集知识图谱实体、经典内容、传承术语。采集后用 `verify_sources.py --check-links` 验证 CBETA / BDRC / SC ID
75
+ 使用 `${CLAUDE_SKILL_DIR}/tools/sutra_collector.py --name "<法师名>" --tradition "<传承>" --output collected_data.json` 从 FoJin 采集知识图谱实体、经典内容、传承术语。采集后运行 `${CLAUDE_SKILL_DIR}/tools/verify_sources.py --check-links collected_data.json`,离线验证来源家族、ID 格式、声明归属与自动派生的 citation contract
76
76
 
77
77
  API 故障 / 超时 / 数据阈值 / 引用规则细节 → `references/workflow-details.md` §Step 2 + `references/source-conventions.md`。
78
78
 
@@ -84,7 +84,7 @@ API 故障 / 超时 / 数据阈值 / 引用规则细节 → `references/workflow
84
84
 
85
85
  ### Step 3.5:二阶段审查
86
86
 
87
- 教义准确性(`doctrine_reviewer.md`,CBETA 经证覆盖率 90%) → 风格一致性(`voice_reviewer.md`,Layer 0 硬规则完整)。审查顺序不可颠倒。FAIL → 自动修复重审,最多 2 轮,仍 FAIL → 人工介入。
87
+ 生成器先从 `sources[].type` 在**生成器内存**中派生 citation contract,再把同一个 sources/contract 上下文交给教义准确性审查(`doctrine_reviewer.md`,按 `citation_contract.minimum_claim_coverage` 审核声明来源覆盖率) → 风格一致性(`voice_reviewer.md`,Layer 0 硬规则完整)。审查顺序不可颠倒。FAIL → 自动修复重审,最多 2 轮,仍 FAIL → 人工介入;最终写入的 `meta.json` 必须复用并再次校验同一 contract。
88
88
 
89
89
  ### Step 4:预览与确认
90
90
 
@@ -92,7 +92,7 @@ API 故障 / 超时 / 数据阈值 / 引用规则细节 → `references/workflow
92
92
 
93
93
  ### Step 5:写入文件
94
94
 
95
- `master_builder.py --name "<法师名>" --output masters/` 写入 `masters/{slug}/{SKILL.md,teaching.md,voice.md,meta.json}`。写入前 `verify_sources.py --final-check` 最终验证,无效链接降级为 FoJin 搜索链接。
95
+ 将审查通过的名称、传承、宗派、时代、语言、`teaching_content`、`voice_content`、`sources` 与同一 `citation_contract` 写入 `generated-master.json`,再运行 `${CLAUDE_SKILL_DIR}/tools/master_builder.py --spec generated-master.json --output "${CLAUDE_SKILL_DIR}/masters/"`。生成器统一写入 `masters/master-{slug}/`,且 `SKILL.md` 的 name 为 `master-{slug}`;随后运行 `${CLAUDE_SKILL_DIR}/tools/verify_sources.py --final-check "${CLAUDE_SKILL_DIR}/masters/master-{slug}/"`。该终验离线检查四个必需文件、目录/name 一致性,以及 `meta.json` 的来源清单、家族 ID、声明归属和 contract;它不解析 `teaching.md` 自由文本,也不保证外部站点可达。
96
96
 
97
97
  OpenClaw / Claude Code 注册路径 → `references/workflow-details.md` §Step 5。
98
98
 
@@ -133,8 +133,8 @@ KG 深度遍历 / 跨词典对比等 `rag_query.py` 不够用的场景 → `refe
133
133
 
134
134
  ## 铁律(HARD-GATE)
135
135
 
136
- - **NO DOCTRINAL CLAIM WITHOUT CBETA CITATION**teaching.md 所有教义断言必须附 CBETA 经证
137
- - **NO FABRICATED SOURCES** — 不得编造 CBETA ID / 经文 / FoJin 链接,所有引用必经 `verify_sources.py` 验证
136
+ - **NO DOCTRINAL CLAIM WITHOUT A DECLARED SOURCE CITATION.**所有教义断言、修行指导与文本解释的引用必须解析到所选 persona 的 `meta.json.sources[]`,来源类型必须列于 `citation_contract.allowed_source_types`;仅当 `citation_contract.live_retrieval_allowed` 为 `true` 时才可实时检索
137
+ - **NO FABRICATED SOURCES** — 不得编造来源 ID / 引文 / 链接,所有引用必经 `verify_sources.py` 验证
138
138
  - **NO FICTIONAL PERSONAS** — 仅历史真实人物,不为虚构角色创建
139
139
 
140
140
  完整理性化防御表、红旗清单、ETHICS.md 运行时摘要 → `references/ethics-runtime.md`。