Skip to content

fix(routing): route the vocabulary beginners actually use - #120

Open
xr843 wants to merge 1 commit into
mainfrom
feat/intent-vocabulary
Open

fix(routing): route the vocabulary beginners actually use#120
xr843 wants to merge 1 commit into
mainfrom
feat/intent-vocabulary

Conversation

@xr843

@xr843 xr843 commented Jul 20, 2026

Copy link
Copy Markdown
Owner

接续 #119。那个 PR 让路由可执行了,但打分只认 meta.jsonsearch_scope.keywords——而那是教理检索词表

实测暴露的问题

把 README 「你的状况」表 11 行全跑一遍,4 行落到默认配对,包括第一行

README 状况 修复前 应该是
妄念纷飞坐不住 kumarajiva, yinguang xuyun / zhiyi / ajahn-chah
读经文看不懂逻辑 kumarajiva, yinguang xuanzang
学佛很久但无力感 kumarajiva, yinguang yinguang
想学最朴素的禅修 kumarajiva, yinguang ajahn-chah

新手不会打「四念处」,他会打「坐不住」。而最需要被路由的,恰恰是没有术语的人。

方案

新增 routing.json.situations,插在关键词层与主题配对层之间。

**只装那 4 行。**另外 7 行 persona keywords 本来就接得住,刻意不复制——这一层是例外,不是状况表的第二份拷贝。

层级顺序变为:

mode_rules → persona_keywords → situations → topic_pairings → default_pairing
  • 明确的教理术语强于感受描述:念佛的时候妄念很多念佛,不走 妄念
  • situations 排在 topic_pairings 之前:后者是为 /compare-masters 配对而写的,不是为回答「我该问谁」

另修:空性

master-nagarjuna / master-kumarajiva / master-tsongkhapa 三位都只声明了 性空 / 缘起性空没有 空性——而这是现代人表达 śūnyatā 最常用的语序。结果 想了解空性 只推出米拉日巴,两位中观祖师漏了自己的核心词。

现在给出印度 / 汉传 / 藏传三个传统。

这是补一个已在各自声明范围内的术语的常用语序,不是新的教义主张。按 CONTRIBUTING.md 属 master content,review 时请重点看这三处 meta.json

门禁

validate-routing.py 新增两项:

  1. situations 关键词集两两不相交
  2. situations 关键词不得与 mode_rules —— 模式层先短路,撞了该行永远不可达(静默死代码)

两项都用故意写坏的数据反测过,确认能抓到。

防漂移

README 那 11 行现在是回归 fixture,与 teaching-modes.md 十条同样的契约:改表不改路由数据,测试就挂。

验证

72 条 CLI 测试(+12),完整 CI 等价套件 16 项全绿,含 pytest 369 passed

🤖 Generated with Claude Code

https://claude.ai/code/session_01KdbEMEsHB9n2eDspNuN54j

PR #119 shipped an executable router but scored only off
meta.json search_scope.keywords, which are doctrinal retrieval terms.
Running the README 「你的状况」 table through it exposed the gap: 4 of its
11 rows resolved to the default pairing, including the first one.

  妄念纷飞坐不住     → kumarajiva, yinguang  (should be xuyun/zhiyi/ajahn-chah)
  读经文看不懂逻辑   → kumarajiva, yinguang  (should be xuanzang)
  学佛很久但无力感   → kumarajiva, yinguang  (should be yinguang)
  想学最朴素的禅修   → kumarajiva, yinguang  (should be ajahn-chah)

A beginner does not type 四念处, they type 坐不住 — and the people most in
need of routing are exactly the ones without the vocabulary.

Adds routing.json.situations between the keyword and topic-pairing layers.
It holds only those four rows: the other seven README rows already route
correctly off persona keywords and are deliberately not duplicated, so this
layer stays the exception rather than a second copy of the table.

Layer order is now mode_rules → persona_keywords → situations →
topic_pairings → default_pairing. An explicit doctrinal term outranks a
felt-state phrase ("念佛的时候妄念很多" routes on 念佛), and situations sit
ahead of topic_pairings because that table was authored to pair masters for
/compare-masters, not to answer "who should I ask?".

Also adds 空性 to master-nagarjuna, master-kumarajiva and master-tsongkhapa.
It is the ordinary modern rendering of śūnyatā, but all three declared only
性空 / 缘起性空, so "想了解空性" surfaced Milarepa alone — the two Madhyamaka
masters were missing their own central term. This adds a word order already
inside each master's declared scope, not a new doctrinal claim.

validate-routing.py gains two checks: situations keyword sets must be
pairwise disjoint, and a situation keyword may not collide with a
mode_rules keyword — mode routing short-circuits first, so such a row would
be silently unreachable. Both verified against deliberately broken data.

The eleven README rows are now regression fixtures, the same contract the
teaching-modes examples carry: editing the table without updating the
routing data fails the suite.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdbEMEsHB9n2eDspNuN54j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant