Repository navigation
中文 · English ↓
中文
核心升级:把「回答能不能被用户逐条核验」变成硬约束。新增出处纪律、溯源标记、问答纪律三段;检索器补否定词/方位词豁免;加出处审计函数与考据陷阱判据。
目标不是让回答更长,而是让每个条文号、每个方证归属都能被宋本和讲稿原文对上。
一、出处纪律(SKILL.md 硬约束段)
修复痛点:模型把《温病条辨》的「白虎四大症」当成《伤寒论》白虎汤证背书——「正确的方剂 + 错误的出处」,旧硬约束无一条能拦。
- 🔴 条文号、出处只取检索返回的
title;检索没返回就写「讲稿未覆盖此条」,不得凭记忆补「第 N 条」 - 🔴 方证归属与讲稿一致:讲稿只讲「大汗出、大烦渴、脉洪大」就只写这三个,不得拿后世著作的四症背书;引后世著作必须显式标书名
- 🔴 【方剂库摘要】的「四大证」等说法是本地整理、非倪师原话,不得当《伤寒论》条文引
- 🔴 诱导式提问(「是不是 X 方证?」)先答讲稿里 X 的条件,再答符合与否
二、溯源标记
- 行内写
〔伤寒论讲稿·九六〕/〔金匮要略讲稿·呕而发热〕,医案写「医案 #序号」,不另起注脚 - 明确区分「面向用户的溯源」与「内部检索线索」——
modules/XX、路径、行号、(源XXXX)永不输出
三、问答纪律(对齐 App persona)
- 症状提问固定五步走:归纳主症 → 定病位 → 方证名 + 首选方 → 鉴别相邻方证 → 引医案
- 针灸四步答:辨证定经 → 取穴 → 手法 → 禁忌
- 穴位只用检索块给出的;无本地统计不凭空报数;无医案片段不虚构病案
- 同批:篇幅抑制三条(禁整串罗列方名、临床行不补全、不主动延展)
四、检索器:否定词与方位词豁免
- 背景:自由率过滤对口语方位/身体词系统性偏杀,「无汗」「左边」「肚子」这类核心鉴别症状召回不到
- 改动:
EXEMPT_TERMS进 priority 档(tier=0 天然豁免自由率),只取提问中实际出现的词;未改过滤层 - 效果:
test_holdout.py12/13 → 13/13;test_differential.py42/42 不变
五、出处审计函数
- 新增
unverified_formulas(answer, r),挑出回答里无检索依据的方名(支撑面=命中方剂清单 ∪ 医案用方 ∪ 讲义片段正文) - 只标注、不改写、不拦截;天花板=只认方剂库已有方名,漏报但不误报
六、考据陷阱判据
- 新增
test_source_discipline.py,按句判「后世概念是否被归给《伤寒论》」,与检索解耦,含题 4 重建用例 - 修订:加否定式与反问豁免(
不是/并非/不可当/哪一条)+ 标点归一化,消除真实正确回答被误报(首轮在真实回答上出现 2 处假阳性) - 判据 14/14
七、两条硬规则补强
- 剂量核对:检索片段按 520 字窗口截断,方剂剂量一律视为不完整,必须回
modules/搜方名取原方行逐字核对,不得因片段断在方名处就判「未列全」 - 编号统一:索引
title前缀=宋本编号,面向用户一律用它;modules/的「条文N」是倪师讲课编号(与宋本整体错位,如条文80≈宋本74),只用于内部检索定位,不得写进回答
验证
| 项 | 结果 |
|---|---|
nishi_retrieve.py --selftest |
通过 |
test_holdout.py |
13/13 |
test_differential.py |
42/42 |
test_source_discipline.py |
14/14 |
3 轮独立 agent 验证(每轮 2–3 题,同题跨轮对比):
- v1:抓到剂量截断误判(模型把截断片段当完整原方)
- v2:抓到讲稿编号混入 + 伪造引语
- v3:全部通过——条号全宋本、讲课编号 0 残留、剂量完整、无伪造引语
多语言 README
新增 日本語 与 한국어,同步更新 中文 / English;英文版补齐滞后的数据(本草 345→374、医案 849→1,257+243、内经 71→72)。
分支与编号说明
main→ 本版(v2.3.3);原main历史保留为v2.3.1分支- 条文号统一为宋本编号后,读者拿任何一本宋本都能逐条核对;此前混用的「讲课编号」不再进入回答
English
Core upgrade: "Can the user verify this answer line by line?" is now a hard constraint. Adds source discipline, provenance markers, and Q&A discipline; gives the retriever a negation/positional-term exemption; adds a citation-audit function and provenance-trap tests.
The goal is not longer answers — it is that every article number and every formula-to-pattern attribution can be checked against the Song edition and the lecture transcript.
1 · Source discipline (hard-constraint section of SKILL.md)
Problem being fixed: the model was backing the Shang Han Lun Baihu Tang pattern with the Wen Bing Tiao Bian "four great signs" — correct formula, wrong source. No existing hard constraint could catch it.
- 🔴 Article numbers and sources may come only from the retrieved
title; if retrieval returns nothing, write "the lecture does not cover this article" — never fill in "article N" from memory - 🔴 Attribution must match the lecture: if the lecture says only "heavy sweating, great thirst, large pulse", write only those three — never back it with a later-era "four signs"; any later work must be named explicitly
- 🔴 The "four great signs" wording in the formula-library summary is locally compiled, not Master Ni's words, and must not be cited as a Shang Han Lun article
- 🔴 Leading questions ("is this pattern X?"): first state what the lecture requires for X, then say whether the description fits — never simply agree
2 · Provenance markers
- Inline
〔傷寒論講稿·九六〕/〔金匮要略講稿·呕而发热〕, and "case #N" for medical records; no separate footnotes - Clear separation between user-facing provenance and internal retrieval breadcrumbs —
modules/XX, file paths, line numbers, and(src XXXX)are never output
3 · Q&A discipline (aligned with the App persona)
- Symptom questions follow a fixed five-step path: summarize chief complaints → locate the pattern (six meridians / Jin Gui chapter) → pattern name + 1–2 primary formulas → differentiate from the neighbouring pattern → cite a matching case
- Acupuncture questions follow four steps: identify the meridian → select points → technique → contraindications
- Acupoints only from the retrieved block; no invented counts without local statistics; no fabricated case narratives without a case snippet
- Same batch: three length-control clauses (no dumping whole formula lists, no padding clinical-dose rows, no unsolicited extension)
4 · Retriever: negation and positional-term exemption
- Background: the free-ratio filter systematically killed colloquial positional/body terms, so discriminating symptoms such as "no sweat", "left side", "abdomen" could not be retrieved
- Change:
EXEMPT_TERMSnow enters the priority tier (tier=0 bypasses the free-ratio check); only terms actually present in the question are added; the filter layer itself is untouched - Effect:
test_holdout.py12/13 → 13/13;test_differential.pyunchanged at 42/42
5 · Citation audit
- New
unverified_formulas(answer, r)flags formula names in an answer that have no retrieved basis (support set = matched formula list ∪ case formulas ∪ formula names inside lecture snippets) - Flag only — no rewriting, no blocking; known ceiling: only formulas present in the formula library are recognised (false negatives, not false positives)
6 · Provenance-trap tests
- New
test_source_discipline.pyjudges sentence by sentence whether a later-era concept has been attributed to the Shang Han Lun; decoupled from retrieval; includes a reconstruction of the original failing case - Revision: negation and rhetorical-question exemptions (
不是/并非/不可当/哪一条) plus punctuation normalisation, eliminating false positives on genuinely correct answers (the first run produced 2 false positives on real answers) - Result: 14/14
7 · Two hardened rules
- Dosage verification: retrieval snippets are truncated at 520 characters, so any formula dosage is treated as incomplete — you must go back to
modules/and check the original formula line character by character; never conclude "not fully listed" just because the snippet breaks at a formula name - Unified numbering: the index
titleprefix is the Song-edition number and is used in all user-facing output;modules/'s "article N" is Master Ni's lecture-order number (offset from the Song edition, e.g. lecture 80 ≈ Song 74) and is for internal lookup only — never written into an answer
Validation
| Item | Result |
|---|---|
nishi_retrieve.py --selftest |
pass |
test_holdout.py |
13/13 |
test_differential.py |
42/42 |
test_source_discipline.py |
14/14 |
Three rounds of independent agent verification (2–3 questions per round, same questions across rounds):
- v1: caught a truncation misjudgement (the model treated a truncated snippet as the complete original formula)
- v2: caught lecture-order numbering leaking into output, plus a fabricated quotation
- v3: all passed — Song-edition numbers only, zero lecture-number leakage, complete dosages, no fabricated quotations
Multilingual README
Added 日本語 and 한국어; updated 中文 and English. The English README's stale figures were corrected (herbs 345→374, cases 849→1,257+243, Nei Jing 71→72 chapters).
Branch and numbering notes
mainnow points at this release (v2.3.3); the previousmainhistory is preserved as thev2.3.1branch- With all article numbers unified to the Song edition, readers can check every citation against any Song-edition copy; the previously mixed-in "lecture numbers" no longer appear in answers