master-skill 0.10.0 → 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 (85) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.cursor-plugin/plugin.json +1 -1
  4. package/ETHICS.md +23 -17
  5. package/README.md +18 -11
  6. package/README_EN.md +22 -13
  7. package/SKILL.md +5 -5
  8. package/bin/cli.mjs +309 -77
  9. package/gemini-extension.json +1 -1
  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 +8 -2
  15. package/prebuilt/compare/SKILL.md +5 -5
  16. package/prebuilt/master-ajahn-chah/SKILL.md +13 -11
  17. package/prebuilt/master-ajahn-chah/meta.json +8 -0
  18. package/prebuilt/master-ajahn-chah/references/voice.md +1 -1
  19. package/prebuilt/master-atisha/SKILL.md +13 -11
  20. package/prebuilt/master-atisha/meta.json +8 -0
  21. package/prebuilt/master-atisha/references/voice.md +1 -1
  22. package/prebuilt/master-buddhaghosa/SKILL.md +13 -11
  23. package/prebuilt/master-buddhaghosa/meta.json +8 -0
  24. package/prebuilt/master-buddhaghosa/references/voice.md +1 -1
  25. package/prebuilt/master-fazang/SKILL.md +3 -3
  26. package/prebuilt/master-fazang/meta.json +8 -0
  27. package/prebuilt/master-huineng/SKILL.md +3 -3
  28. package/prebuilt/master-huineng/meta.json +8 -0
  29. package/prebuilt/master-kumarajiva/SKILL.md +3 -3
  30. package/prebuilt/master-kumarajiva/meta.json +8 -0
  31. package/prebuilt/master-mahasi-sayadaw/SKILL.md +13 -11
  32. package/prebuilt/master-mahasi-sayadaw/meta.json +8 -0
  33. package/prebuilt/master-mahasi-sayadaw/references/voice.md +2 -2
  34. package/prebuilt/master-milarepa/SKILL.md +13 -11
  35. package/prebuilt/master-milarepa/meta.json +8 -0
  36. package/prebuilt/master-milarepa/references/voice.md +1 -1
  37. package/prebuilt/master-nagarjuna/SKILL.md +3 -3
  38. package/prebuilt/master-nagarjuna/meta.json +8 -0
  39. package/prebuilt/master-ouyi/SKILL.md +3 -3
  40. package/prebuilt/master-ouyi/meta.json +8 -0
  41. package/prebuilt/master-tsongkhapa/SKILL.md +13 -11
  42. package/prebuilt/master-tsongkhapa/meta.json +8 -0
  43. package/prebuilt/master-tsongkhapa/references/voice.md +1 -1
  44. package/prebuilt/master-xuanzang/SKILL.md +3 -3
  45. package/prebuilt/master-xuanzang/meta.json +8 -0
  46. package/prebuilt/master-xuyun/SKILL.md +3 -3
  47. package/prebuilt/master-xuyun/meta.json +8 -0
  48. package/prebuilt/master-yinguang/SKILL.md +3 -3
  49. package/prebuilt/master-yinguang/meta.json +8 -0
  50. package/prebuilt/master-zhiyi/SKILL.md +3 -3
  51. package/prebuilt/master-zhiyi/meta.json +8 -0
  52. package/prompts/correction_handler.md +104 -0
  53. package/prompts/doctrine_reviewer.md +61 -0
  54. package/prompts/intake.md +62 -0
  55. package/prompts/merger.md +62 -0
  56. package/prompts/rag_instructions.md +54 -0
  57. package/prompts/sutra_analyzer.md +83 -0
  58. package/prompts/teaching_builder.md +41 -0
  59. package/prompts/voice_analyzer.md +92 -0
  60. package/prompts/voice_builder.md +48 -0
  61. package/prompts/voice_reviewer.md +66 -0
  62. package/references/README.md +12 -0
  63. package/references/ethics-runtime.md +112 -0
  64. package/references/fojin-api.md +223 -0
  65. package/references/source-conventions.md +129 -0
  66. package/references/teaching-modes.md +84 -0
  67. package/references/traditions.md +72 -0
  68. package/references/workflow-details.md +361 -0
  69. package/requirements.txt +6 -0
  70. package/scripts/select-fidelity-smoke.py +78 -0
  71. package/scripts/test-fidelity.py +19 -2
  72. package/scripts/tests/test_select_fidelity_smoke.py +142 -0
  73. package/scripts/tests/test_validate_citation_contract.py +408 -0
  74. package/scripts/tests/test_validate_workflow.py +265 -0
  75. package/scripts/validate-citation-contract.py +193 -0
  76. package/scripts/verify_citations.py +8 -1
  77. package/skill-catalog.json +147 -0
  78. package/tools/cross_reference.py +365 -0
  79. package/tools/fojin_bridge.py +146 -0
  80. package/tools/master_builder.py +341 -0
  81. package/tools/rag_query.py +336 -0
  82. package/tools/skill_writer.py +230 -0
  83. package/tools/sutra_collector.py +237 -0
  84. package/tools/verify_sources.py +512 -0
  85. package/tools/version_manager.py +88 -0
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "name": "master-skill",
11
11
  "description": "FoJin-powered Buddhist AI persona framework — source-grounded, boundary-aware, fidelity-tested, runtime-ready. 15 prebuilt masters across 印度/汉传/藏传/南传 plus compare, debate, and curriculum meta-skills.",
12
- "version": "0.10.0",
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
3
  "description": "FoJin-powered Buddhist AI persona framework — source-grounded, boundary-aware, fidelity-tested, runtime-ready. 15 prebuilt masters across 印度/汉传/藏传/南传 plus compare, debate, and curriculum meta-skills.",
4
- "version": "0.10.0",
4
+ "version": "0.10.1",
5
5
  "author": {
6
6
  "name": "xr843",
7
7
  "email": "xr843@users.noreply.github.com"
@@ -2,7 +2,7 @@
2
2
  "name": "master-skill",
3
3
  "displayName": "Master Skill",
4
4
  "description": "FoJin-powered Buddhist AI persona framework — source-grounded, boundary-aware, fidelity-tested, runtime-ready. 15 prebuilt masters across 印度/汉传/藏传/南传.",
5
- "version": "0.10.0",
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
@@ -143,10 +143,10 @@ Master-skill 是由 [FoJin](https://fojin.app) 驱动的佛教 AI 祖师人格
143
143
  ## 特性
144
144
 
145
145
  - **预置十五位四大传统祖师**:1 位印度(龙树 · 中观)+ 8 位汉传(唯识、中观、禅、天台、华严、净土、跨宗派)+ 3 位藏传(阿底峡 · 噶当;宗喀巴 · 格鲁;米拉日巴 · 噶举)+ 3 位南传(觉音 · 上座部论师;马哈希 · 缅甸内观;阿姜查 · 泰国森林)—— 另含 `compare-masters` 多祖师对比 meta-skill,开箱即用
146
- - **经文溯源(Provenance)**:每位祖师附原典标识(CBETA / BDRC / SuttaCentral)+ FoJin text ID,所有教义断言强制附原典引证
146
+ - **经文溯源(Provenance)**:每位祖师附声明来源 ID(CBETA / BDRC / Toh / SuttaCentral / PTS / 合规编纂开示);实时检索仅在返回真实 `text_id` 时附 FoJin 定位链接,所有教义断言强制附原典引证
147
147
  - **离线经文片段**:`sources/` 目录收录核心经典关键段落,FoJin 不可用时仍可离线引用
148
148
  - **渐进式披露**:SKILL.md 以决策树 + Quick Ref 为主,`references/`、`sources/` 按需加载,Context 随查随取
149
- - **HARD-GATE 铁律**:`/create-master` 与预置法师内置红线——无 CBETA 引证的教义断言不得写入、不得捏造经号、不得为虚构人物建角色
149
+ - **HARD-GATE 铁律**:`/create-master` 与预置法师内置红线——教义断言、修行指导与文本解释必须引用该 persona 声明的来源(CBETA / BDRC / Toh / SuttaCentral / PTS / 合规编纂开示),不得捏造来源 ID,不得为虚构人物建角色
150
150
  - **二阶段独立审查**:生成管线在写入前强制经过"教义准确性 → 风格一致性"两轮独立审查,FAIL 自动修复最多 2 轮
151
151
  - **自动化保真度测试**:每位祖师 `tests/fidelity.jsonl` 10+ 条 Q&A(`compare-masters` 元技能 18 条),验证引用和关键词覆盖;CI 在每次推送时 dry-run 验证(结构校验);实跑评分需 `ANTHROPIC_API_KEY`,作为本地/发版前手动步骤执行
152
152
  - **多平台统一插件**:Claude Code、Cursor、Codex CLI、OpenCode、Gemini CLI 共用一份 `prebuilt/`,session-start hook 跨平台注入法师列表
@@ -179,14 +179,20 @@ Master-skill 的核心不是"角色扮演提示词集合",而是一个可验
179
179
 
180
180
  **NPX 一键安装(推荐,无需常驻)**
181
181
 
182
+ `npx master-skill install --all` 一次安装全部 19 个 Skill:15 位祖师、3 个教学模式,以及 `create-master` 生成器。`create-master` 会复制自包含的运行时,因此临时 npx 包目录被清理后仍可使用;重新安装或 `update --all` 会更新运行时,但保留 `create-master/masters/` 中用户生成的 persona。
183
+
182
184
  ```bash
183
185
  # 安装指定祖师
184
186
  npx master-skill install master-zhiyi master-fazang master-huineng
185
187
 
186
- # 安装全部 15 位(四大传统)
188
+ # 单独安装公共教学模式或自定义生成器
189
+ npx master-skill install compare-masters
190
+ npx master-skill install create-master
191
+
192
+ # 安装全部 19 个 Skill
187
193
  npx master-skill install --all
188
194
 
189
- # 查看可用祖师
195
+ # 查看全部可安装 Skill
190
196
  npx master-skill list
191
197
  ```
192
198
 
@@ -205,7 +211,8 @@ npm update -g master-skill # 升到下一个 minor / patch
205
211
  # npx(上方)与 git clone 手动安装为正式发布渠道:
206
212
  git clone https://github.com/xr843/Master-skill ~/Master-skill
207
213
  cd ~/Master-skill && pip install -r requirements.txt
208
- 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
209
216
  ln -sf "$(pwd)" ~/.claude/skills/create-master
210
217
  ```
211
218
 
@@ -438,7 +445,7 @@ SKILL.md (AgentSkills 入口:决策树 + Quick Ref)
438
445
  | | +-- teaching.md
439
446
  | | +-- voice.md
440
447
  | +-- sources/ (离线经文片段)
441
- | | +-- *.md (CBETA 段落)
448
+ | | +-- *.md (声明来源的离线段落)
442
449
  | +-- tests/
443
450
  | +-- fidelity.jsonl (保真度样例, CI dry-run)
444
451
  |
@@ -479,7 +486,7 @@ Master-skill 通过 `tools/fojin_bridge.py` 接入 FoJin API,实现:
479
486
  - 语义向量相似度搜索(教义相关经文)
480
487
  - 原文段落提取与出处追踪
481
488
 
482
- 所有引用均附带可追溯的 FoJin 链接,确保内容来源透明。
489
+ 所有引用都必须能追溯到 persona 声明的来源 ID;仅当实时检索返回真实 `text_id` 时附 FoJin 定位链接,否则使用对应官方目录或离线声明来源。
483
490
 
484
491
  ---
485
492
 
@@ -493,8 +500,8 @@ Master-skill 通过 `tools/fojin_bridge.py` 接入 FoJin API,实现:
493
500
 
494
501
  **要做:**
495
502
 
496
- - 忠实依据经文原文,所有回答附 FoJin 出处链接
497
- - 通过运行时 RAG 检索真实经文,而非仅依赖 AI 自身知识
503
+ - 忠实依据声明来源,回答附可追溯的来源 ID;有真实 `text_id` 时再附 FoJin 定位链接
504
+ - 仅在 citation contract 允许且离线资料不足时通过运行时 RAG 检索,不以 AI 自身知识冒充原典
498
505
  - 遇到超出范围的问题坦诚说明
499
506
 
500
507
  ---
@@ -505,9 +512,9 @@ Master-skill 通过 `tools/fojin_bridge.py` 接入 FoJin API,实现:
505
512
 
506
513
  能。每位预置法师的 `prebuilt/<name>/sources/` 收录了该法师核心经典的关键段落(离线经文片段)。FoJin 不可用时,法师会降级到离线模式并在回答中声明"当前使用离线片段"。`/create-master` 管线遇到 API 故障会提示用户切换手动输入模式,由用户粘贴经文原文继续生成。
507
514
 
508
- **Q:CBETA 引用格式是什么样的?怎么验证?**
515
+ **Q:CBETA 引用格式是什么样的?来源如何验证?**
509
516
 
510
- 所有 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 链接。
511
518
 
512
519
  **Q:`npx master-skill install` 执行失败、报 ENOTEMPTY 或权限错误怎么办?**
513
520
 
package/README_EN.md CHANGED
@@ -141,10 +141,10 @@ This project is built out of respect for Buddhist traditions. All content is gen
141
141
  ## Features
142
142
 
143
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
144
- - **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
145
145
  - **Offline source passages**: `sources/` captures key passages from each master's core canon, so citations still work when FoJin is unreachable
146
146
  - **Progressive disclosure**: SKILL.md is a decision tree + quick reference; `references/` and `sources/` are loaded on demand to keep context lean
147
- - **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
148
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
149
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
150
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
@@ -177,9 +177,17 @@ The v1.0 track prioritizes framework stability over adding more masters. See [do
177
177
 
178
178
  **NPX (recommended, no global state)**
179
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
+
180
182
  ```bash
181
- npx master-skill install --all # Install all 15 masters
182
- 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
183
191
  ```
184
192
 
185
193
  **Global install (frequent use / offline-friendly)**
@@ -196,7 +204,8 @@ npm update -g master-skill # Pull next minor / patch
196
204
  ```bash
197
205
  git clone https://github.com/xr843/Master-skill ~/Master-skill
198
206
  cd ~/Master-skill && pip install -r requirements.txt
199
- 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
200
209
  ln -sf "$(pwd)" ~/.claude/skills/create-master
201
210
  ```
202
211
 
@@ -414,7 +423,7 @@ SKILL.md (AgentSkills entry: decision tree + quick reference)
414
423
  | +-- references/ (loaded on demand)
415
424
  | | +-- teaching.md
416
425
  | | +-- voice.md
417
- | +-- sources/ (offline CBETA passages)
426
+ | +-- sources/ (offline declared-source passages)
418
427
  | | +-- *.md
419
428
  | +-- tests/
420
429
  | +-- fidelity.jsonl (CI dry-run samples)
@@ -457,7 +466,7 @@ Master-skill connects to the FoJin API via `tools/fojin_bridge.py` to enable:
457
466
  - Runtime RAG retrieval for grounding answers in real texts
458
467
  - Source passage extraction with provenance tracking
459
468
 
460
- 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.
461
470
 
462
471
  ---
463
472
 
@@ -473,8 +482,8 @@ All citations include traceable FoJin links to ensure transparency of sources.
473
482
 
474
483
  **Will:**
475
484
 
476
- - Cite source texts faithfully, with FoJin links on every response
477
- - 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
478
487
  - Acknowledge clearly when a question falls outside scope
479
488
  - Encourage users to seek out qualified masters and authentic practice
480
489
 
@@ -486,9 +495,9 @@ All citations include traceable FoJin links to ensure transparency of sources.
486
495
 
487
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.
488
497
 
489
- **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?**
490
499
 
491
- 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.
492
501
 
493
502
  **Q: `npx master-skill install` fails with ENOTEMPTY or a permission error — what now?**
494
503
 
@@ -508,9 +517,9 @@ See "Contributing" below. The short version: follow the v0.3 layout under `prebu
508
517
 
509
518
  Contributions are welcome: new prebuilt masters, corrections to source attributions, offline passage additions, or toolchain improvements.
510
519
 
511
- 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.
512
521
 
513
- 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.
514
523
 
515
524
  ---
516
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`。