Skip to content

feat(liturgy): concept tooltips + Heart Sutra + dharani rebuild + AI-text cleanup#68

Merged
anantham merged 7 commits into
mainfrom
feat/opus-heart-concept-tooltip
May 19, 2026
Merged

feat(liturgy): concept tooltips + Heart Sutra + dharani rebuild + AI-text cleanup#68
anantham merged 7 commits into
mainfrom
feat/opus-heart-concept-tooltip

Conversation

@anantham
Copy link
Copy Markdown
Owner

Summary

This branch follows up on the merged Heart Sutra concept-graph (PR #67) with two big features and a broad cleanup pass — driven entirely by reader feedback on the live /liturgy/maple/heart-sutra page.

Features

  • Click-to-cycle concept tooltips (mn10 pattern) — when a token attests one or more concepts from the registry, clicking the token cycles its tooltip through facets:

    • facet 0: surface gloss
    • facet 1+: ◇ <concept preferredLabel> · <first sentence of definition> per attested concept
      The 1/N indicator on the existing sutta-studio Tooltip lights up automatically. Honours the user's earlier "no-pin" preference — facets advance only while the cursor is still over the token.
  • 15 new Heart Sutra chant-line segments — the two MAPLE-elided prose passages between the form-emptiness chiasmus and the result-section (six negations, long enumeration) are now broken into per-breath triple-script-witness segments matching the surrounding rhythm. Sanskrit + Devanāgarī + Chinese (Xuanzang T251) + Sino-Japanese + Tibetan + four English witnesses (MAPLE, Conze, Red Pine, Plum Village). 118 new alignment-audit assertions, all green.

  • Sho Sai dharani interleaving — converted from monolithic sound-formula to 9 chant-line triple-script-witness segments. Each line shows Sanskrit IAST + Devanāgarī, the Sino-Japanese chant text, the Chinese kanji as phonetic carriers, and a per-line English meaning. Kanji morphemes carry scriptMorphemes tooltips that disambiguate phonetic-carrier vs semantic readings (e.g. 曩 "long ago" → "phonetic: transliterates na").

  • Endpoint dots on alignment lines — small filled circles at each line's source + target, so the termination is unambiguous even when the curve sweeps past intervening text rows. Earlier margin-arc experiment reverted at user request ("perverse and wrong") in favour of the original gentle vertical bezier + dots.

Cleanup

Driven by user-flagged AI-generated curator prose:

  • Sangha index footer: removed "Hand-curated. Each sangha's chants…" meta-boilerplate.
  • Sangha cards: removed primaryTradition badges (ZEN / MIXED).
  • Sangha descriptions (data/liturgy/sanghas.ts): replaced AI-generated text with the monasteries' own self-descriptions, fetched from bodhizendo.org and monasticacademy.org and cited as comments.
  • Heart Sutra: deleted the three-paragraph opening framing block ("shortest and most widely-chanted Mahāyāna sutra..."), the "Above: the canonical core..." commentary, the dharani framing prose, the dharani reconstruction prose, and the "On translating the Heart Sutra" closing essay. The mantra now has an en script variant accessible via dots — short gloss instead of paragraph.
  • Sho Sai page: deleted framing prose section + "Why Namu Samando" + "Sanskrit traces" prose blocks. The per-segment data carries that ground.
  • Chant cards: every context: field rewritten across 16 chants from when-chanted prose to what-it-IS prose. Examples:
    • Bodhicitta Dedication: "Bodhicitta — the aspiration to awaken for the benefit of all beings. This four-line dedication…"
    • Heart Sutra: "The shortest Mahāyāna sutra — the hṛdaya (heart, essence) of the Perfection-of-Wisdom literature."
    • Metta Sutta: "The Buddha's teaching on cultivating loving-kindness (mettā) toward all beings, without exception."
  • Chant cards: removed the small {doc.tradition} badge per chant.
  • Segment-level "+ NOTE" expand-toggles removed from TripleScriptWitness — user-flagged as noise.
  • Morning Chants subtitle: "Theravāda devotional sequence, chanted before breakfast at MAPLE" → "Threefold Refuge · Five Precepts · Ovāda Pāṭimokkha (Dhp 183)".
  • SoundFormula chant body: bumped from text-2xl/3xl to text-4xl/5xl/6xl so dharanis are easy to read during chanting practice.

MN10 audit (informational)

User asked whether mn10 curation tapers off toward the back of the sutta. Yes — modestly:

  • First-half average: 1.98 facets/segment
  • Second-half average: 1.52 facets/segment (1.31× drop)
  • High-empty zones: phase-aw (36% empty), phase-av (29%), phase-ax (27%)
  • The really long-word phrases at the back got skim treatment

Not blocking; logged for a future curation round.

Commits

  • `82e0fcc` click-to-cycle concept facets in token tooltip
  • `4a7f298` margin-arc alignment lines + endpoint dots
  • `ff05e73` revert margin-arc, strip AI framing prose
  • `e321105` strip dharani prose, bump chant font size, add English variant
  • `e1dcbe5` author 15 chant-line segments for the missing middle
  • `d007683` drop chant-card tradition badges, rewrite context blurbs
  • `533aa0d` interleave Sho Sai dharani with Sanskrit + Chinese kanji

Test plan

  • `npx vitest run tests/components/liturgy/` — 515 passed, 58 skipped (pre-existing). 129 new alignment-audit assertions across the new segments, all green.
  • `npx vitest run tests/components/liturgy/concept-coverage.test.ts` — 3 pass; the 30-concept registry auto-resolves across all the new segments via existing wiring (no new manual conceptIds needed).
  • `npx vitest run tests/components/liturgy/concept-tooltip-facets.test.ts` — 4 pass.
  • `npx tsc --noEmit` — only pre-existing errors in song-of-zazen.ts / AboutThisText.tsx / build-dpd.ts (out of scope); no new errors introduced.
  • Browser hover/click verification of concept facets — partially manual; HMR-confirmed during the session for the Heart Sutra opening segment.

Pending threads (not in this PR)

  • `feat(db): pre-migration backup + version gate + restore #14` Rename `components/sutta-studio/demoPacket.json` → `content/references/sutta/mn10.json` — pre-existing scope decision; deferred.
  • mn10 curation back-half catch-up — logged from this session's density audit; would be a separate authoring pass.

🤖 Generated with Claude Code

anantham and others added 7 commits May 18, 2026 18:33
…attern)

When a Heart Sutra token attests one or more concepts (registry
membership computed by `conceptsForToken`), clicking the token now
advances the tooltip through facets:

  facet 0: morpheme/word gloss (unchanged surface-level reading)
  facet 1: ◇ <concept preferredLabel> · first sentence of definition
  facet 2..N: same, one per additional concept

The pattern is borrowed from `components/sutta-studio/PaliWord.tsx` —
the mn10 demo shows multiple `tooltips[]` facets per segment cycled by
click, indicated by a small "1/N" badge on the tooltip. Heart Sutra
gets the same affordance for free, sourcing facet content from the
30-concept registry built earlier this session.

This surfaces the registry's rich data (definitions grounded in 84000,
DDB, Princeton Dictionary, Wikipedia) without bloating the default
hover. Readers see the gloss first; one click reveals "what concept is
this token a member of?" with a one-sentence registry-grounded answer.

Honours `feedback_tooltip_bulk.md` (memory 2026-05-12): tooltips remain
hover-only — no pin, no persistent sticky state. Click only cycles the
facet *while still hovering*; mouseLeave closes everything.

New helper: `data/concepts/tooltipFacets.ts` — `conceptFacets()` takes
conceptIds, returns one short facet string per known concept. Uses only
the first sentence of multi-sentence definitions to keep the tooltip
scannable.

Tests:
  - `tests/components/liturgy/concept-tooltip-facets.test.ts` — unit
    test of the helper (4 tests, all pass).
  - Coverage probe + alignment audit still pass.
  - Pre-existing song-of-zazen TS error unchanged (out of scope).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous bezier ran straight down from a source token to its
English mapping, passing through any intervening row (transliteration,
sibling words). Visually the line looked like it terminated at the
first text it touched, not the actual target several rows below.

Two changes:

1. Margin-arc routing — the curve now bows OUT to one side margin
   (chosen by which half of the container the line midpoint is in) and
   back, so the path travels through empty page space rather than
   slicing through text. `arcPath` computes a bezier whose control
   points share a "lane X" pulled `max(40, min(120, containerWidth *
   0.06))` outside the further endpoint. SVG `overflow: visible`
   (already set) lets the arc render past the container's bounds.

2. Endpoint dots — small 2.5px-radius filled circles at each line end.
   Termination is now unambiguous: the dot is the actual endpoint, even
   if the curve sweeps past other text on its way out to the margin.

Requested by user after seeing the existing renderer cut through the
Heart Sutra page's transliteration row, e.g. a curve from a Devanāgarī
token to "Prajñāpāramitā" appeared to end at the transliteration
"gambhīrāṃ..." line above it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
User feedback: the margin-arc made alignment lines look "perverse" —
the dramatic lane offset created a J-shaped loop. Reverted to the
gentle near-vertical bezier that already exists, kept the endpoint
dots as the unambiguous termination cue.

Other strips, all driven by user pointing at AI-generated curator
prose:
- Sangha index footer: removed "Hand-curated. Each sangha's chants…"
  meta-boilerplate.
- Sangha cards: removed primaryTradition badge (ZEN / MIXED).
- Sangha descriptions: replaced AI-generated text with the
  monasteries' own self-descriptions, fetched from bodhizendo.org and
  monasticacademy.org (one-line each, cited as comments in the data).
- Heart Sutra opening: deleted the three-paragraph framing block
  about "shortest and most widely-chanted Mahāyāna sutra…"
- Heart Sutra core section: deleted "Above: the canonical core…"
  commentary that interrupted the chant flow with structural
  scaffolding.
- Sho Sai dharani page: deleted the framing prose section ("A
  dharani — a sound-formula, not a translatable phrase…") and the
  separate `framing:` line above the chant itself.
- Morning Chants subtitle: was timing prose ("Theravāda devotional
  sequence, chanted before breakfast at MAPLE"), now describes the
  chant content itself ("Threefold Refuge · Five Precepts · Ovāda
  Pāṭimokkha (Dhp 183)").
- Segment notes: removed the "+ NOTE" expand-toggles on every chant
  segment — user-flagged as noise. Note text in data is left in
  place so we can decide later whether to surface it differently.

Captured but NOT yet executed (in task list): the bigger sweep across
chant `context:` fields, the rewrite of descriptions to grounded
what-it-IS prose, the dharani interleaving with Chinese kanji
breakdown, and the authoring work to convert the two MAPLE elided
prose passages into proper Xuanzang chant-line segments matching the
surrounding rhythm.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…h variant

Heart Sutra dharani section:
- Removed `framing:` ("The sutra ends not with a translation but with
  a mantra...") and `reconstruction:` ("Read literally: gate (locative
  or vocative of gata)...") — both flagged as scholarly prose-feel.
- Added a 5th script variant `en` ("gone, gone, gone-beyond,
  fully-gone-beyond — awakening, svāhā") so the meaning is reachable
  by clicking the script-cycle dots, without a prose paragraph.
- Removed the "On translating the Heart Sutra" prose-commentary
  section at the bottom of the page.

SoundFormula component: bumped chant body from text-2xl/3xl to
text-4xl/5xl/6xl. The dharani text was too small to read in chanting
practice; the larger size matches the TripleScriptWitness chant-line
treatment on the rest of the page.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ing middle

The two MAPLE-elided prose passages — "Śāriputra, all dharmas are
characterized by emptiness..." and "Therefore in emptiness there is
no appearance..." — were previously rendered as raw prose-commentary,
breaking the visual rhythm of the surrounding Xuanzang chant-line
segments. Replaced both with a new `heart-middle` triple-script-witness
section containing 15 properly-broken segments matching the rest of the
page.

Six-negations passage (5 segments):
  舍利子 / 是諸法空相 / 不生不滅 / 不垢不淨 / 不增不減

Long-enumeration passage (10 segments):
  是故空中無色 / 無受想行識 / 無眼耳鼻舌身意 / 無色聲香味觸法 /
  無眼界 乃至 無意識界 / 無無明 亦無無明盡 /
  乃至 無老死 亦無老死盡 / 無苦集滅道 / 無智亦無得 / 以無所得故

Each segment carries Sanskrit (IAST + Devanāgarī), Chinese (Xuanzang
T251), Sino-Japanese, and Tibetan (Kangyur short-form), plus four
witness translations: MAPLE chant text, Conze 1958, Red Pine 2004, and
Thich Nhat Hanh / Plum Village 2014. Word-level glosses + key
morphemes for the doctrinally load-bearing terms (skandhas, six
faculties, six objects, dhātus, twelve nidānas, Four Noble Truths,
*jñāna*, *prāpti*). The concept-graph already auto-resolves new
attestations from the registry on hover.

`alignTo` arrays validated by the existing alignment-audit test
(`tests/components/liturgy/alignment-audit.test.ts`) — 118 new
assertions, all green. The renderer's per-token whitespace-split
English count must match the `alignTo` length and each non-(-1) entry
must point at a valid surface Pāli word; the audit caught 24
off-by-ones in the first authoring pass, fixed here.

Refs #71.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Index UI:
- LiturgyIndex.tsx — removed the small `{doc.tradition}` badge that
  rendered next to each chant title. Same call as the sangha-card
  badge removal; user-flagged as noise.

Chant data — `context:` field rewritten across 16 chants to describe
what the chant *is* rather than when it's chanted at MAPLE or Bodhi.
The schedule already shows order/timing; the context line is the
chant's own subtitle blurb on the index card.

Pattern, per chant:
- bodhi-enmei-jikku-kannon-gyo: invocation of Kanzeon, 10 phrases
- bodhi-heart-sutra: Aitken-Rochester / Diamond Sangha lineage of the
  English recension
- bodhi-vows: pan-Mahāyāna bodhisattva-vow formula
- bodhicitta-dedication: bodhicitta as aspiration to awaken for all
  beings; dedication of merit toward that aim (per user's exemplar)
- bodhisattva-vow-torei: Tōrei Enji's late-18th-c. composition
- dedication-and-evening-call: ceremonial closing pieces
- enmei-jikku-kannon-gyo (MAPLE): 延命 = "life-extending"; protection
- heart-sutra (MAPLE): hṛdaya of the Perfection-of-Wisdom literature
- jade-method: MAPLE-composed contemplative practice
- metta-sutta: Khp 9 / Sn 1.8, loving-kindness
- om-mani-padme-hum: six-syllable mantra of Chenrezig
- precepts: two-voice format (Bodhidharma + Dōgen) + Dhp 183
- shin-jin-no-mei: Sengcan's Xinxin Ming, non-duality foundation
- sho-sai-myo-kichijo-darani: 消災 + 妙吉祥 etymology
- song-of-zazen: Hakuin's defining "this very place is the Lotus
  Land" declaration
- ti-sarana: Pali devotional pieces in Bodhi's Japanese-Zen liturgy
- vows (MAPLE): Four Great Vows + closing Mitákuye Oyás'iŋ
- way-of-compassion: Burtt 1955 rendering + Om Tat Sat closing

All-tests green; pre-existing TS errors in
song-of-zazen.ts/AboutThisText.tsx/build-dpd.ts unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…se kanji

Converted the Sho Sai Myō Kichijō Darani from a single sound-formula
block into 9 chant-line triple-script-witness segments — one per
breath of the chant book layout. Each segment carries:

- Sanskrit IAST + Devanāgarī (the doctrinal anchor)
- Sino-Japanese phonetic line (the MAPLE chant text)
- Chinese kanji (phonetic carriers from T251)
- A literal English gloss (for the meaningful lines; "(ritual sound)"
  where the syllables are non-semantic mantra particles)

Each kanji is broken into `scriptMorphemes` for hover tooltips that
disambiguate phonetic-carrier vs semantic readings — e.g. 曩 ("long
ago" semantically) is annotated "phonetic: transliterates *na*",
making it clear the kanji is a sound vehicle, not a meaning vehicle.
Each Sanskrit word's `scriptAlts` link to the corresponding
Japanese-phonetic and Chinese-kanji chunks so alignment lines connect
the sound to the Sanskrit word it phoneticizes.

Lines:
  1. namaḥ samanta-buddhānāṃ — homage to all the buddhas
  2. apratihata-śāsanānām — whose teaching is unimpeded
  3. tadyathā oṃ kha kha khāhi khāhi
  4. hūṃ hūṃ jvala jvala
  5. prajvala prajvala — blaze forth, blaze forth
  6. tiṣṭha tiṣṭha — stand, stand (be established)
  7. ṣṭri ṣṭri — (ritual sound)
  8. sphaṭ sphaṭ — (ritual sound)
  9. śāntika śrīye svāhā — for peace, for prosperity, svāhā

Removed the now-redundant "Why Namu Samando" and "Sanskrit traces"
prose-commentary sections — the per-segment data carries that ground.

Alignment audit: 11 new assertions, all green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexicon-forge Ready Ready Preview, Comment May 19, 2026 1:55am

@anantham anantham merged commit 005df79 into main May 19, 2026
4 checks passed
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