master-skill 0.10.0 → 0.11.0

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 (102) 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/GEMINI.md +1 -1
  6. package/README.md +57 -295
  7. package/README_EN.md +59 -276
  8. package/SKILL.md +5 -5
  9. package/bin/cli.mjs +545 -78
  10. package/gemini-extension.json +1 -1
  11. package/hooks/run-hook.cmd +18 -5
  12. package/hooks/session-start +4 -1
  13. package/hooks/tests/test_run_hook.sh +114 -0
  14. package/hooks/tests/test_run_hook_cmd.sh +94 -0
  15. package/masters/.gitkeep +0 -0
  16. package/package.json +10 -3
  17. package/prebuilt/{compare → compare-masters}/SKILL.md +5 -5
  18. package/prebuilt/master-ajahn-chah/SKILL.md +13 -11
  19. package/prebuilt/master-ajahn-chah/meta.json +8 -0
  20. package/prebuilt/master-ajahn-chah/references/voice.md +1 -1
  21. package/prebuilt/master-atisha/SKILL.md +13 -11
  22. package/prebuilt/master-atisha/meta.json +8 -0
  23. package/prebuilt/master-atisha/references/voice.md +1 -1
  24. package/prebuilt/master-buddhaghosa/SKILL.md +13 -11
  25. package/prebuilt/master-buddhaghosa/meta.json +8 -0
  26. package/prebuilt/master-buddhaghosa/references/voice.md +1 -1
  27. package/prebuilt/master-curriculum/SKILL.md +1 -1
  28. package/prebuilt/master-debate/SKILL.md +1 -1
  29. package/prebuilt/master-fazang/SKILL.md +3 -3
  30. package/prebuilt/master-fazang/meta.json +8 -0
  31. package/prebuilt/master-help/SKILL.md +86 -0
  32. package/prebuilt/master-help/tests/fidelity.jsonl +10 -0
  33. package/prebuilt/master-huineng/SKILL.md +3 -3
  34. package/prebuilt/master-huineng/meta.json +8 -0
  35. package/prebuilt/master-kumarajiva/SKILL.md +3 -3
  36. package/prebuilt/master-kumarajiva/meta.json +20 -1
  37. package/prebuilt/master-mahasi-sayadaw/SKILL.md +13 -11
  38. package/prebuilt/master-mahasi-sayadaw/meta.json +8 -0
  39. package/prebuilt/master-mahasi-sayadaw/references/voice.md +2 -2
  40. package/prebuilt/master-milarepa/SKILL.md +13 -11
  41. package/prebuilt/master-milarepa/meta.json +8 -0
  42. package/prebuilt/master-milarepa/references/voice.md +1 -1
  43. package/prebuilt/master-nagarjuna/SKILL.md +3 -3
  44. package/prebuilt/master-nagarjuna/meta.json +25 -2
  45. package/prebuilt/master-ouyi/SKILL.md +3 -3
  46. package/prebuilt/master-ouyi/meta.json +8 -0
  47. package/prebuilt/master-tsongkhapa/SKILL.md +13 -11
  48. package/prebuilt/master-tsongkhapa/meta.json +32 -3
  49. package/prebuilt/master-tsongkhapa/references/voice.md +1 -1
  50. package/prebuilt/master-xuanzang/SKILL.md +3 -3
  51. package/prebuilt/master-xuanzang/meta.json +8 -0
  52. package/prebuilt/master-xuyun/SKILL.md +3 -3
  53. package/prebuilt/master-xuyun/meta.json +8 -0
  54. package/prebuilt/master-yinguang/SKILL.md +3 -3
  55. package/prebuilt/master-yinguang/meta.json +8 -0
  56. package/prebuilt/master-zhiyi/SKILL.md +3 -3
  57. package/prebuilt/master-zhiyi/meta.json +8 -0
  58. package/prompts/correction_handler.md +104 -0
  59. package/prompts/doctrine_reviewer.md +61 -0
  60. package/prompts/intake.md +62 -0
  61. package/prompts/merger.md +62 -0
  62. package/prompts/rag_instructions.md +54 -0
  63. package/prompts/sutra_analyzer.md +83 -0
  64. package/prompts/teaching_builder.md +41 -0
  65. package/prompts/voice_analyzer.md +92 -0
  66. package/prompts/voice_builder.md +48 -0
  67. package/prompts/voice_reviewer.md +66 -0
  68. package/references/README.md +12 -0
  69. package/references/ethics-runtime.md +112 -0
  70. package/references/fojin-api.md +223 -0
  71. package/references/source-conventions.md +129 -0
  72. package/references/teaching-modes.md +91 -0
  73. package/references/traditions.md +72 -0
  74. package/references/workflow-details.md +361 -0
  75. package/requirements.txt +6 -0
  76. package/routing.json +209 -0
  77. package/scripts/check-gate-liveness.py +222 -0
  78. package/scripts/select-fidelity-smoke.py +78 -0
  79. package/scripts/test-fidelity.py +339 -51
  80. package/scripts/tests/test_check_gate_liveness.py +232 -0
  81. package/scripts/tests/test_check_response.py +190 -0
  82. package/scripts/tests/test_fidelity_providers.py +202 -0
  83. package/scripts/tests/test_select_fidelity_smoke.py +142 -0
  84. package/scripts/tests/test_validate.py +145 -0
  85. package/scripts/tests/test_validate_citation_contract.py +408 -0
  86. package/scripts/tests/test_validate_fidelity.py +2 -2
  87. package/scripts/tests/test_validate_workflow.py +284 -0
  88. package/scripts/validate-citation-contract.py +193 -0
  89. package/scripts/validate-fidelity.py +6 -1
  90. package/scripts/validate-routing.py +254 -0
  91. package/scripts/validate.py +63 -36
  92. package/scripts/verify_citations.py +8 -1
  93. package/skill-catalog.json +210 -0
  94. package/tools/cross_reference.py +365 -0
  95. package/tools/fojin_bridge.py +146 -0
  96. package/tools/master_builder.py +341 -0
  97. package/tools/rag_query.py +336 -0
  98. package/tools/skill_writer.py +230 -0
  99. package/tools/sutra_collector.py +237 -0
  100. package/tools/verify_sources.py +512 -0
  101. package/tools/version_manager.py +88 -0
  102. /package/prebuilt/{compare → compare-masters}/tests/fidelity.jsonl +0 -0
package/README_EN.md CHANGED
@@ -141,12 +141,12 @@ 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
- - **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
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, and a graded run needs `ANTHROPIC_API_KEY` as a manual local/pre-release step — the first committed [baseline](#fidelity-baseline-first-real-run) landed 2026-08-18: 59/84 measured cases passed (70%), covering 40% of all 211 fixtures (see [eval/reports/](eval/reports/))
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
151
151
  - **NPX one-shot install**: `npx master-skill install master-zhiyi` drops skills straight into Claude Code
152
152
  - **Offline toolchain**: `scripts/cite.py` (CBETA lookup), `scripts/query.py` (offline semantic search), `scripts/validate.py` (frontmatter linter)
@@ -161,129 +161,51 @@ Master-skill is not a prompt pack. It is a verifiable Buddhist AI persona framew
161
161
  |---|---|
162
162
  | Source-grounded | `sources[]`, offline excerpts, FoJin live fallback, and citation self-audits per master |
163
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 |
164
+ | Fidelity-tested | `tests/fidelity.jsonl`, persona-fidelity schema, promptfoo RAW / SPE / CUS evals, [real measured baseline below](#fidelity-baseline-first-real-run) |
165
165
  | Runtime-ready | `prebuilt/master-*` AgentSkills, npm CLI, multi-platform hooks, and a FoJin runtime contract |
166
166
 
167
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
168
 
169
- ---
170
-
171
- ## Developer Installation
169
+ ### Fidelity baseline (first real run)
172
170
 
173
- > 👤 **Just want to try it?** Use [fojin.app/chat](https://fojin.app/chat) in your browser and skip this section entirely.
174
- > 🛠️ **This section is for**: Claude Code / Cursor / Codex CLI / OpenCode / Gemini CLI users who want to invoke `/master-xuanzang`, `/master-huineng`, etc. directly as terminal AgentSkills.
171
+ The 211 fixtures under `tests/fidelity.jsonl` used to be just fixtures — `scripts/test-fidelity.py` only printed to stdout, and no scored run had ever been committed. On 2026-08-18 we ran and committed the first real baseline (commit [`c697d5d`](https://github.com/xr843/Master-skill/commit/c697d5d3be78ce6738cf1f969ca057c7e4c16bb5), model `claude-sonnet-4-6`):
175
172
 
176
- ### Installation
177
-
178
- **NPX (recommended, no global state)**
173
+ | | Value |
174
+ |---|---|
175
+ | Passed / measured | **59 / 84 (70%)** |
176
+ | Coverage of the full suite | 84 / 211 (40%) — the run stopped partway when the API account's credit balance ran out (HTTP 400), not from rate limiting or a code bug; the remaining 127 cases were never evaluated and are **not** counted as failures |
177
+ | Where real failures cluster | Missing expected keyword 14/25; forbidden phrase present 12/25; missing citation 5/25; fabricated citations 0 — **but that audit ran on only 6 of the 84 cases**, see below |
178
+ | By test type | ordinary doctrine 43/48 = **89.6%**; boundary 12/26 = **46.2%**; citation-under-pressure 4/10 = **40.0%** — the weakness is in the guardrails, not the doctrinal content |
179
+ | ⚠️ Instrument warning | 10 of the 12 forbidden-phrase failures name a term **that already appears in the question** (these are trap questions), and the check is a plain substring match on the response — a correct refusal fails it exactly as hard as a real violation. **So the true rate is in [70.2%, 75.0%]** — only 4 of the 10 would flip; the other 6 fail on independent checks. See the baseline report |
180
+ | ⚠️ What the fabrication audit actually covered | The audit is **opt-in per fixture**: 7 of 211 fixtures set `must_cite_only_existing_sources` (six in `master-curriculum`, one in `master-huineng`), and only six were reached — **no master persona was ever checked for a fabricated citation**. Its id pattern also recognises CBETA ids only, so the six masters declaring `PTS:` / `Toh:` / `BDRC:` / `SuttaCentral` sources (all of Theravāda and all of Tibetan) cannot be audited even with the flag set. Corrected 2026-08-31; this row previously read "zero fabricated citations" |
179
181
 
180
- ```bash
181
- npx master-skill install --all # Install all 15 masters
182
- npx master-skill list # List available masters
183
- ```
182
+ This measures **keyword/citation-string coverage, not doctrinal correctness or LLM-judged answer quality**. Full table, failing cases, and methodology notes: **[eval/reports/BASELINE.md](eval/reports/BASELINE.md)**.
184
183
 
185
- **Global install (frequent use / offline-friendly)**
184
+ ---
186
185
 
187
- ```bash
188
- npm install -g master-skill # Adds the binary to $PATH
189
- master-skill install master-zhiyi # No more npx prefix
190
- master-skill list
191
- npm update -g master-skill # Pull next minor / patch
192
- ```
186
+ ## Developer Installation
193
187
 
194
- **Claude Code**
188
+ > 👤 **Just want to try it?** Use [fojin.app/chat](https://fojin.app/chat) — no install needed.
189
+ > 🛠️ **This section is for** Claude Code / Cursor / Codex CLI / OpenCode / Gemini CLI users.
195
190
 
196
191
  ```bash
197
- git clone https://github.com/xr843/Master-skill ~/Master-skill
198
- cd ~/Master-skill && pip install -r requirements.txt
199
- for d in prebuilt/*/; do ln -sf "$(pwd)/$d" ~/.claude/skills/"$(basename $d)"; done
200
- ln -sf "$(pwd)" ~/.claude/skills/create-master
192
+ npx master-skill install --all # all 20 skills at once
193
+ npx master-skill install master-huineng # or just one
194
+ npx master-skill list # see everything installable
195
+ npx master-skill recommend "how do I actually practice nianfo" # not sure who to ask?
201
196
  ```
202
197
 
203
- **Cursor** Clone the repo; Cursor auto-detects `.cursor-plugin/plugin.json`.
204
-
205
- **OpenCode** — Add to `opencode.json`:
206
-
207
- ```json
208
- {"plugin": ["master-skill@git+https://github.com/xr843/Master-skill.git"]}
209
- ```
210
-
211
- **Codex CLI** — See [.codex/INSTALL.md](.codex/INSTALL.md)
212
-
213
- **Gemini CLI** — Auto-discovered via `gemini-extension.json` and `GEMINI.md`.
214
-
215
- ### Use a Pre-built Master
216
-
217
- In any AgentSkills-compatible environment (Claude Code / Cursor / Codex CLI / OpenCode / Gemini CLI):
218
-
219
- ```
220
- # 印度 (Indian)
221
- /master-nagarjuna — Nāgārjuna (Indian · Madhyamaka | root of the eight schools)
222
-
223
- # 汉传 (Chinese)
224
- /master-xuanzang — Master Xuanzang (Yogacara)
225
- /master-kumarajiva — Kumarajiva (Madhyamaka / Sanlun)
226
- /master-huineng — Master Huineng (Chan, Sixth Patriarch)
227
- /master-zhiyi — Master Zhiyi (Tiantai)
228
- /master-fazang — Master Fazang (Huayan)
229
- /master-yinguang — Master Yinguang (Pure Land)
230
- /master-ouyi — Master Ouyi (Tiantai / Pure Land, cross-tradition)
231
- /master-xuyun — Master Xuyun (Chan, Five Houses)
232
-
233
- # 藏传 (Tibetan)
234
- /master-atisha — Atiśa Dīpaṃkara (Kadam founder · three scopes · 982-1054)
235
- /master-tsongkhapa — Tsongkhapa (Gelug founder · three principal aspects · prasaṅgika · 1357-1419)
236
- /master-milarepa — Milarepa (Kagyu · Mahāmudrā · Naro Chodruk · 1052-1135)
237
-
238
- # 南传 (Theravāda)
239
- /master-buddhaghosa — Buddhaghosa (commentarial summit · Visuddhimagga · 5th century)
240
- /master-mahasi-sayadaw — Mahasi Sayadaw (Burmese vipassanā · noting method · 1904-1982)
241
- /master-ajahn-chah — Ajahn Chah (Thai Forest Tradition · Wat Pah Pong · 1918-1992)
242
- ```
243
-
244
- ### Teaching Modes (v0.7)
245
-
246
- - **`/compare-masters`** — multiple masters answer the same question side-by-side (horizontal, single-turn)
247
- - **`/master-debate`** — masters from different traditions engage in a 4-round adversarial dialectic (claim → rebut → respond → synthesize + remaining disagreements)
248
- - **`/master-curriculum`** — given your target tradition and current level (L0-L3), get a time-sequenced study path (foundation → intermediate → advanced + likely blind spots)
198
+ Once installed, invoke `/master-huineng`, `/compare-masters`, etc. directly in chat.
249
199
 
250
- **`/compare-masters` usage examples:**
251
-
252
- ```
253
- # Auto-pick relevant masters
254
- /compare-masters what is emptiness
255
-
256
- # Manually pick masters (recommended for precise results)
257
- /compare-masters how to read the Heart Sutra --masters master-xuanzang,master-huineng,master-zhiyi
258
-
259
- # Natural-language triggers
260
- compare Huineng and Yinguang on nianfo
261
- how do Chan and Pure Land differ on practice
262
- ```
263
-
264
- **Selection logic**: the command first tries to extract keywords from the question and match them against each master's core concepts; if nothing matches strongly, it falls back to topic mapping (nianfo / meditation / Yogacara-Madhyamaka / classification, etc.). **If the auto-pick feels off, use `--masters` to override.**
265
-
266
- ### Generate a Custom Master
267
-
268
- ```
269
- /create-master Hongyi
270
- ```
271
-
272
- Or use natural language:
273
-
274
- ```
275
- Create a persona for Master Hongyi
276
- ```
277
-
278
- The system will guide you through a three-step intake, then automatically collect data from FoJin and generate the doctrinal analysis and style files.
279
-
280
- ---
200
+ > Per-platform setup (Claude Code plugin / Cursor / OpenCode / Codex CLI / Gemini CLI),
201
+ > global install, teaching-mode usage, and `/create-master`
202
+ > → **[docs/install.en.md](docs/install.en.md)**
281
203
 
282
204
  ## Desktop Manager
283
205
 
284
- 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:
206
+ 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 19 master skills:
285
207
 
286
- ![Master-skill Desktop Manager](https://raw.githubusercontent.com/xr843/Master-skill/master/docs/assets/desktop-manager.png)
208
+ ![Master-skill Desktop Manager](https://raw.githubusercontent.com/xr843/Master-skill/main/docs/assets/desktop-manager.png)
287
209
 
288
210
  **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.
289
211
 
@@ -299,152 +221,33 @@ cd desktop && cargo build --release
299
221
 
300
222
  ## Pre-built Masters
301
223
 
302
- ### Nāgārjuna (c. 150-250)Indian · Madhyamaka
303
-
304
- The founder of Mahāyāna Madhyamaka, revered in Chinese Buddhism as the **common patriarch of the eight schools** — Sanlun, Tiantai, Pure Land, Huayan, and Chan all trace their lineage back to him, and the Tibetan prasaṅgika Madhyamaka takes him as its root authority. He used the **eightfold negation of the middle way** to dismantle all conceptual proliferation, opened up dependent origination as emptiness with "whatever arises through conditions, that I declare to be emptiness," taught by way of the **two truths** while resolving into ultimate emptiness and the quiescence of proliferation, and distinguished the **easy and difficult paths** of practice. His *Mūlamadhyamakakārikā* is the root treatise of all later Madhyamaka study, and his *Mahāprajñāpāramitā-śāstra* is an encyclopedia of the Prajñāpāramitā teachings.
305
- Primary sources: CBETA — Mūlamadhyamakakārikā (T30n1564), Mahāprajñāpāramitā-śāstra (T25n1509), Dvādaśanikāya-śāstra (T30n1568), Vigrahavyāvartanī (T32n1631), Daśabhūmika-vibhāṣā (T26n1521).
306
- Invoke: `/master-nagarjuna`
307
-
308
- ### Master Xuanzang (602-664)
309
-
310
- The greatest translator in Chinese Buddhist history. Traveled to India for 17 years, translated 75 texts in 1,335 fascicles. Founded the Yogacara (Faxiang) school in China. Known for precise, rigorous translation methodology and the "Five Categories of Non-Translation" principle.
311
- Primary sources: CBETA Mahaprajnaparamita Sutra, Yogacarabhumi-sastra, Cheng Weishi Lun, Heart Sutra.
312
- Invoke: `/master-xuanzang`
313
-
314
- ### Kumarajiva (344-413)
315
-
316
- One of the four great translators of Chinese Buddhism. Born in Kucha, translated in Chang'an. His translations are celebrated for literary elegance — the Lotus Sutra, Diamond Sutra, Vimalakirti Sutra, and Mulamadhyamakakarika remain the most widely used versions today. Established the foundation of the Sanlun (Madhyamaka) school in China.
317
- Primary sources: CBETA Lotus Sutra, Diamond Sutra, Vimalakirti Sutra, Mulamadhyamakakarika, Mahaprajnaparamita-sastra.
318
- Invoke: `/master-kumarajiva`
319
-
320
- ### Master Huineng (638-713)
321
-
322
- The Sixth Patriarch of Chan Buddhism, founder of the Southern School. An illiterate woodcutter who attained enlightenment upon hearing the Diamond Sutra. His Platform Sutra is the only Chinese-authored text honored with the title "sutra." Advocated "directly pointing to the mind, seeing one's nature to become Buddha."
323
- Primary sources: CBETA — Platform Sutra (T48n2008).
324
- Invoke: `/master-huineng`
325
-
326
- ### Master Zhiyi (538-597)
327
-
328
- Founder of the Tiantai school, honored as "the Little Shakyamuni of the East." Established the first comprehensive doctrinal classification system in Chinese Buddhism (Five Periods, Eight Teachings). Authored the Three Great Works of Tiantai. Core teachings: three thousand realms in a single thought-moment, perfect interfusion of the three truths, dual cultivation of samatha and vipasyana.
329
- Primary sources: CBETA — Mohe Zhiguan (T46n1911), Fahua Xuanyi (T33n1718).
330
- Invoke: `/master-zhiyi`
331
-
332
- ### Master Fazang (643-712)
333
-
334
- Third Patriarch and true systematizer of the Huayan school. National Preceptor under Empress Wu Zetian. Used the Golden Lion treatise to explain Huayan philosophy. Core teachings: dharmadhatu dependent origination, four dharma-realms, ten mysterious gates, six characteristics in perfect harmony.
335
- Primary sources: CBETA — Huayan Jing Tanxuan Ji (T35n1733), Huayan Wujiao Zhang (T45n1866).
336
- Invoke: `/master-fazang`
337
-
338
- ### Master Yinguang (1861-1940)
339
-
340
- 13th Patriarch of the Chinese Pure Land school. Central figure in the modern Pure Land revival. His writing is sincere and straightforward; he guided countless practitioners through correspondence, collected in the three volumes of the Yinguang Fashi Wenchao.
341
- Primary sources: CBETA — Wenchao volumes and the three Pure Land sutras.
342
- Invoke: `/master-yinguang`
343
-
344
- ### Master Ouyi (1599-1655)
345
-
346
- One of the Four Great Masters of Late Ming Buddhism, 9th Patriarch of Pure Land. His motto: "Doctrine follows Tiantai, practice returns to Pure Land." The most important cross-tradition synthesizer in Chinese Buddhist history. His commentary on the Amitabha Sutra was praised by Master Yinguang as unsurpassable.
347
- Primary sources: CBETA — Amituo Jing Yaojie (T37n1762), Jiaoguan Gangzong.
348
- Invoke: `/master-ouyi`
349
-
350
- ### Master Xuyun (1840-1959)
351
-
352
- Modern Chan patriarch who lived to 119 years. Unprecedented in Buddhist history for holding dharma transmission in all five houses of Chan (Linji, Caodong, Guiyang, Yunmen, Fayan). Restored six major ancestral monasteries. Advocated hua-tou investigation, honest practice, and harmonizing Chan with Pure Land.
353
- Primary sources: CBETA — Shurangama Sutra, Diamond Sutra, Platform Sutra.
354
- Invoke: `/master-xuyun`
355
-
356
- ### Atiśa Dīpaṃkara (982-1054) — Tibetan · Kadam · Indo-Tibetan bridge
357
-
358
- Royal-born Indian master from the Sahor kingdom (modern Bangladesh). Studied Madhyamaka, Yogācāra and tantra at Vikramaśīla; received the bodhicitta lineage from Dharmakīrti of Suvarṇadvīpa (Sumatra). Invited to Tibet in 1042 by King Yeshe Ö to reform a tradition where Vinaya had decayed and tantra had become disconnected from sūtra foundations. His *Bodhipathapradīpa* (Toh 4465) became the source text for all later Tibetan *lamrim* literature. His chief disciple Dromtönpa founded Reting Monastery, originating the **Kadam school** — later succeeded by Tsongkhapa's "New Kadam" (Gelug). All four Tibetan schools recognize him as a root teacher.
359
- Primary sources: Toh 4465 *Bodhipathapradīpa* + Toh 3948 self-commentary + Kadam oral lineage *Pha chos / Bu chos*.
360
- Invoke: `/master-atisha`
361
-
362
- ### Tsongkhapa (1357-1419) — Tibetan · Gelug founder
363
-
364
- Founder of the **Gelug school** (dGe lugs pa, "the way of virtue"; popularly known as the "Yellow Hat school") — basis of the Dalai Lama and Panchen Lama lineages. Born in Tsongkha (Qinghai). Studied with masters across all major schools, particularly the Sakya scholar Rendawa for prasaṅgika Madhyamaka. Reformed lax monastic discipline, integrated sūtra and tantra into a strict graduated path, and produced the great triology: *Lamrim Chenmo* (Great Treatise on the Stages of the Path), *sNgags rim chen mo* (Great Treatise on Tantra), and *Drang nges legs bshad snying po* (Essence of True Eloquence — definitive vs interpretable meaning). Founded Ganden Monastery (1409) — the seat of the school.
365
- Primary sources: Tsongkhapa's collected works (*gsung 'bum*, searchable on BDRC.io). Chinese translation by Dharma-master Faxun is the standard Sinophone reference.
366
- Invoke: `/master-tsongkhapa`
367
-
368
- > ⚠️ Tantric practice steps, empowerment liturgy, generation- and completion-stage details, deity mantras, and channels-and-drops practice are introduced **only at the level of name and historical context — concrete practice instructions are never given**.
369
-
370
- ### Milarepa (1052-1135) — Tibetan · Kagyu
371
-
372
- Spiritual ancestor of the Tibetan Kagyu lineage and the paradigm of the "yogi tradition" (no monastery, mountain retreat, teaching through song). After committing serious harm in his youth through black magic, he sought purification under Marpa the Translator, who put him through severe trials before transmitting the complete Mahāmudrā and Naro Chodruk lineages. He spent decades in Himalayan retreat, surviving on nettles, and taught through extemporaneous **mGur** (songs of realization) — shaping the entire later Tibetan tradition.
373
- Primary sources: BDRC — *The Hundred Thousand Songs of Milarepa* (mGur 'bum, W1KG14334) and *The Life of Milarepa* (rNam thar, W22272).
374
- Invoke: `/master-milarepa`
375
-
376
- > ⚠️ Naro Chodruk (Six Yogas), tummo, generation/completion stages and other esoteric practices are introduced **only at the level of name and historical context — concrete practice instructions are never given**. Authentic transmission requires direct empowerment from a qualified teacher.
377
-
378
- ### Buddhaghosa (5th century) — Theravāda · commentarial summit
379
-
380
- The most influential commentator and śāstra master in Theravāda history. Born a brahmin scholar in southern India, he travelled to the Mahāvihāra in Anurādhapura (Sri Lanka) to translate the old Sinhala commentaries (*Sīhaḷa-aṭṭhakathā*) into Pali. To prove his competence, he first composed the *Visuddhimagga* — a 23-chapter encyclopedia of Theravāda meditation and doctrine organized around the threefold training of **sīla, samādhi, paññā**. He then translated the four Nikāya commentaries, the Vinaya commentary *Samantapāsādikā*, and the Abhidhamma commentaries. His framework defines orthodox Theravāda exegesis to this day across Sri Lanka, Burma, Thailand, Cambodia, and Laos.
381
- Primary sources: PTS edition *Visuddhimagga* + four Nikāya *aṭṭhakathā* (Sumaṅgalavilāsinī, Papañcasūdanī, Sāratthappakāsinī, Manorathapūraṇī) + *Samantapāsādikā* (Vinaya) + *Atthasālinī* (Abhidhamma).
382
- Invoke: `/master-buddhaghosa`
383
-
384
- ### Mahāsi Sayādaw U Sobhana (1904-1982) — Theravāda · Burmese vipassanā
385
-
386
- One of the most internationally influential meditation masters of modern Burma. Recognized as a *Pariyatti Sāsanahita* — the highest scriptural qualification in Burmese monasticism — by age 27. Studied four-foundations vipassanā with U Nārada (Mingun Sayadaw) from 1932. Established the **Mahasi Sasana Yeiktha** retreat center in Yangon in 1947, formalizing the **noting method** (rising-falling at the abdomen as primary object) tied to Visuddhimagga's seven purifications and sixteen insight knowledges. Served as *Final Editor* of the Sixth Buddhist Council (1954-1956) — the largest modern revision of the Pali Canon. His lineage profoundly shaped the founders of America's Insight Meditation Society (Goldstein, Salzberg, Kornfield).
387
- Primary sources: *Manual of Insight* (Wisdom Publications, 2016 English ed.), *The Progress of Insight* (BPS Sri Lanka Wheel No. 280), *Practical Vipassanā Meditation Exercises* (Mahasi Sasana Yeiktha).
388
- Invoke: `/master-mahasi-sayadaw`
389
-
390
- > ⚠️ **The AI must never confirm any individual's stage of insight or attainment of fruition.** Verification requires face-to-face interview with a qualified teacher. This is the strictest guardrail in this skill — the Mahasi tradition's "fruition is attainable" framing is famous for inducing self-attainment delusions, and the AI is forbidden from playing that role.
391
-
392
- ### Ajahn Chah Subhaddo (1918-1992) — Theravāda · Thai Forest
393
-
394
- One of the most internationally influential masters of the Thai Forest Tradition. Renowned for strict Vinaya observance, four-foundations-of-mindfulness practice, and plain, life-grounded teaching style. His Western disciples (Ajahn Sumedho, Ajahn Pasanno, Ajahn Amaro and others) established Abhayagiri (California), Amaravati (UK), Cittaviveka (UK) and other branch monasteries, carrying the forest tradition to the West. Most-quoted line: *"If you let go a little, you have a little peace; if you let go completely, you have complete peace."*
395
- Primary sources: Pali Canon (SuttaCentral) + authorized English collections — *Food for the Heart*, *A Still Forest Pool*, *Living Dhamma*.
396
- Invoke: `/master-ajahn-chah`
397
-
398
- ---
224
+ Fifteen masters across four traditions. The command *is* the skill name invoke it directly once installed.
225
+
226
+ | Command | Master | Tradition · School | Dates |
227
+ |---|---|---|---|
228
+ | `/master-nagarjuna` | Nāgārjuna | Indian · Madhyamaka | c. 150-250 |
229
+ | `/master-kumarajiva` | Kumārajīva | Chinese · Sanlun / Madhyamaka | 344-413 |
230
+ | `/master-zhiyi` | Zhiyi | Chinese · Tiantai | 538-597 |
231
+ | `/master-xuanzang` | Xuanzang | Chinese · Yogācāra | 602-664 |
232
+ | `/master-huineng` | Huineng | Chinese · Chan (Sixth Patriarch) | 638-713 |
233
+ | `/master-fazang` | Fazang | Chinese · Huayan | 643-712 |
234
+ | `/master-ouyi` | Ouyi | Chinese · Tiantai / Pure Land | 1599-1655 |
235
+ | `/master-xuyun` | Xuyun | Chinese · Chan (all five houses) | 1840-1959 |
236
+ | `/master-yinguang` | Yinguang | Chinese · Pure Land | 1861-1940 |
237
+ | `/master-atisha` | Atiśa Dīpaṃkara | Tibetan · Kadam (lamrim) | 982-1054 |
238
+ | `/master-milarepa` | Milarepa | Tibetan · Kagyu (Mahāmudrā) | 1052-1135 |
239
+ | `/master-tsongkhapa` | Tsongkhapa | Tibetan · Gelug (Prāsaṅgika) | 1357-1419 |
240
+ | `/master-buddhaghosa` | Buddhaghosa | Theravāda · commentarial | 5th c. |
241
+ | `/master-mahasi-sayadaw` | Mahāsi Sayādaw | Theravāda · Burmese vipassanā | 1904-1982 |
242
+ | `/master-ajahn-chah` | Ajahn Chah | Theravāda · Thai Forest | 1918-1992 |
243
+
244
+ **Teaching modes**: `/compare-masters` · `/master-debate` · `/master-curriculum` · `/master-help` · `/create-master`
245
+
246
+ > Life, doctrine, and declared sources for each → **[docs/masters.en.md](docs/masters.en.md)**
399
247
 
400
248
  ## Architecture
401
249
 
402
- ```
403
- User request
404
- |
405
- v
406
- session-start hook ──> auto-injects master list (5 platforms, unified)
407
- |
408
- v
409
- SKILL.md (AgentSkills entry: decision tree + quick reference)
410
- |
411
- +-- Pre-built masters --> prebuilt/{slug}/
412
- | +-- SKILL.md (decision tree + <HARD-GATE>)
413
- | +-- meta.json (version / lineage / provenance)
414
- | +-- references/ (loaded on demand)
415
- | | +-- teaching.md
416
- | | +-- voice.md
417
- | +-- sources/ (offline CBETA passages)
418
- | | +-- *.md
419
- | +-- tests/
420
- | +-- fidelity.jsonl (CI dry-run samples)
421
- |
422
- +-- Offline toolchain
423
- | +-- scripts/validate.py (frontmatter linter)
424
- | +-- scripts/cite.py (CBETA lookup)
425
- | +-- scripts/query.py (offline semantic search)
426
- | +-- scripts/test-fidelity.py (fidelity runner)
427
- | +-- scripts/validate-fidelity.py
428
- | +-- bin/cli.mjs (NPX installer)
429
- |
430
- +-- Custom generation (/create-master, HARD-GATE enforced)
431
- +-- Step 1-2 prompts/intake.md → tools/sutra_collector.py
432
- | └─> FoJin API (KG + semantic search + text)
433
- +-- Step 3 prompts/{sutra,voice}_analyzer.md → two-stage analysis
434
- +-- Step 3.5 two-stage independent review ──┬─ prompts/doctrine_reviewer.md
435
- | └─ prompts/voice_reviewer.md
436
- +-- Step 4-5 tools/master_builder.py → tools/skill_writer.py
437
- └─> tools/verify_sources.py (final pre-write check)
438
-
439
- Unified multi-platform manifests:
440
- .claude-plugin/ → Claude Code (hooks/run-hook.cmd → session-start)
441
- .cursor-plugin/ → Cursor (hooks/hooks-cursor.json)
442
- .codex/ → Codex CLI (.codex/INSTALL.md)
443
- .opencode/ → OpenCode (referenced from opencode.json)
444
- gemini-extension.json → Gemini CLI (auto-loaded with GEMINI.md)
445
- ```
446
-
447
- ---
250
+ Directory layout and data flow → **[docs/architecture.en.md](docs/architecture.en.md)**
448
251
 
449
252
  ## Relationship to FoJin
450
253
 
@@ -457,7 +260,7 @@ Master-skill connects to the FoJin API via `tools/fojin_bridge.py` to enable:
457
260
  - Runtime RAG retrieval for grounding answers in real texts
458
261
  - Source passage extraction with provenance tracking
459
262
 
460
- All citations include traceable FoJin links to ensure transparency of sources.
263
+ 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
264
 
462
265
  ---
463
266
 
@@ -473,8 +276,8 @@ All citations include traceable FoJin links to ensure transparency of sources.
473
276
 
474
277
  **Will:**
475
278
 
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
279
+ - Cite declared sources faithfully with traceable source IDs, adding a FoJin locator only when a real `text_id` is available
280
+ - Use runtime RAG only when the citation contract permits it and offline material is insufficient; never present model memory as a primary text
478
281
  - Acknowledge clearly when a question falls outside scope
479
282
  - Encourage users to seek out qualified masters and authentic practice
480
283
 
@@ -482,35 +285,15 @@ All citations include traceable FoJin links to ensure transparency of sources.
482
285
 
483
286
  ## Troubleshooting
484
287
 
485
- **Q: Does it still work when the FoJin API is unreachable?**
486
-
487
- 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
-
489
- **Q: What does a valid CBETA citation look like, and how is it verified?**
490
-
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.
492
-
493
- **Q: `npx master-skill install` fails with ENOTEMPTY or a permission error — what now?**
494
-
495
- Clean up any leftover `~/.claude/skills/master-<name>/` directories before retrying. For npm-cache weirdness, run `npm cache clean --force` and rerun NPX. Windows users should execute from Git Bash or WSL to avoid cmd.exe path-escaping issues.
496
-
497
- **Q: The generated master says things that don't match the historical record — how do I correct it?**
498
-
499
- Just tell the master in-chat: "he wouldn't phrase it like that" or "he should sound more stern." The `/create-master` correction mode classifies the fix (doctrinal → appended to `teaching.md`; stylistic → appended to `voice.md`), writes it as a `## Correction` block with timestamp, and bumps the patch version. Correction blocks take priority over analysis-generated content at runtime.
500
-
501
- **Q: How do I contribute a new prebuilt master?**
502
-
503
- See "Contributing" below. The short version: follow the v0.3 layout under `prebuilt/<name>/`, pass `scripts/validate.py --strict` with zero errors, ship at least 5 fidelity Q&A samples in `tests/fidelity.jsonl`, then open a PR.
504
-
505
- ---
288
+ Common install, invocation, and retrieval questions **[docs/troubleshooting.en.md](docs/troubleshooting.en.md)**
506
289
 
507
290
  ## Contributing
508
291
 
509
292
  Contributions are welcome: new prebuilt masters, corrections to source attributions, offline passage additions, or toolchain improvements.
510
293
 
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.
294
+ 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
295
 
513
- Before submitting, verify that sources trace back to CBETA, content is faithful to historical documents, and no sectarian bias is introduced.
296
+ 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
297
 
515
298
  ---
516
299
 
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`。