# `scriptures/` — accuracy audit (2026-05-20)

This is the audit record that closed out a cross-source verification pass on
the two scriptures imported in the previous session (`bhagavad-geeta` and
`sundarkand`). It catalogues every defect found, the sources that confirmed
each, and the deterministic transform applied. The fix script
(`scripts/audit-fix.cjs`) is re-runnable; the verification script
(`scripts/audit-verify.cjs`) re-asserts every invariant.

## TL;DR

- **Bhagavad Geeta**: cross-checked 24 verses against IIT-Kanpur Gita Supersite
  (5 famous + 14 random, plus 5 confirmed at the matra-corrected positions);
  all 25 previously-repaired matra verses re-verified canonical against two
  sources; ran a full-corpus 701-verse comparison against Sanskrit Documents
  with orthographic-variant normalisation. **6 defects fixed** (1 missing
  suffix, 14-verse phantom-र, 1 letter substitution, 1 verse-initial vowel,
  3 decomposed-nukta long ṛ, 1 stray nukta) — total 21 verses changed.
- **Sundarkand**: spot-checked 10 doha-segments against Drik Panchang and
  Sanskrit Documents Tulsidas. **2 defects fixed** — segment 44 missing a ृ
  matra, and the three opening mangalacharan shlokas restored (previously a
  documented soft spot) after confirming the text across three sources.
- **All invariants pass post-fix** — 45/45 in `audit-verify.cjs`, including
  IAST round-trip across all 701 Geeta verses.

## A. Bhagavad Geeta verse-text accuracy

### A1 / A2 — Cross-check against IIT Kanpur

Cross-checked 24 verses end-to-end against IIT Kanpur Gita Supersite, akshara-
level (whitespace ignored, speaker-tag handling). 23 of 24 matched exactly.
Five additional famous verses (2.7, 5.1, 7.3, 12.17, 12.19) and 15 verses from
the matra-fix family were also checked and confirmed canonical.

Famous verses verified: 1.1, 2.47, 4.7, 4.8, 9.22, 11.32, 15.1, 18.66, 18.78.
Random verses verified: 1.26, 2.16, 3.6, 5.24, 6.23, 7.5, 8.23, 9.31, 10.21,
12.4, 13.30, 14.15, 16.5, 17.25 (defect found, see below), 18.45.

The one mismatch (17.25) is a real defect — see §A3 below.

### A2 — All 25 matra-corrected verses

Re-verified each of the 25 verses repaired in the previous session
(निश्चित / त्रिविध / भक्ति / व्यक्ति family). Results:

- **5 verses** (2.7, 5.1, 7.3, 12.17, 12.19): our repair produces the
  same form IIT Kanpur uses — exact akshara match.
- **20 verses**: IIT Kanpur **itself** still carries the malformed
  `्ि` / `ि्` cluster in their digital edition. Our shipped form is the
  canonical (matra correctly placed on the consonant), with character
  multiset identical to IIT's malformed version — confirming the repair
  is purely an order-fix, not content modification.

The canonical direction was independently confirmed via Mukundananda's
holy-bhagavad-gita.org for 3.2, 13.5, and 7.17 — all three show the form our
repair produces, not IIT's malformed form.

### A3 — Cross-check against Sanskrit Documents (full corpus, all 701 verses)

Used the all-in-one Devanagari Gita at
`sanskritdocuments.org/doc_giitaa/bhagvadnew.html`. Parsed all 701 verses, ran
a substring/multiset comparison against the shipped data with orthographic-
variant normalisation (anusvara ↔ homorganic nasal, avagraha/visarga
normalisation, nukta-decomposition).

Result: **547 verses byte-identical, 87 differ only in known orthographic
variants** (anusvara `ं` vs homorganic `ङ्/ञ्/ण्/न्/म््` before plosives — IIT
style vs SD style; sandhi-applied vs sandhi-elided compound boundaries),
**67 had remaining differences**, of which:

- **18 were parser artifacts** (chapter-starts include the preceding chapter's
  closing colophon and the following chapter's dhyāna shloka in SD's
  layout — false positives).
- **8 were SD-internal parenthetical alternative readings** in SD's edition
  apparatus (e.g. `(सौमदत्तिर्जयद्रथश्च…)` after 1.8) — not present in IIT or
  in our shipped form, so not a defect.
- **3 were edition-level textual variants** between IIT and SD — both readings
  attested by scholarly sources, our shipped follows IIT:
  - 2.33 `अथ चैत्त्वमिमं` (IIT, shipped) vs `अथ चेत्त्वमिमं` (SD,
    Mukundananda) — `चै` vs `चे`. The `चेत्` reading parses as "and if"
    grammatically; IIT prints `चैत्`. Edition disagreement, no fix.
  - 2.64 `रागद्वेषवियुक्तैस्तु` (IIT, shipped, Mukundananda) vs
    `विमुक्तैस्तु` (SD) — 3 sources agree on `वियुक्तैस्तु`; no fix.
  - 18.68 `य इमं परमं गुह्यं` (IIT, gita/gita, shipped) vs `य इदं परमं
    गुह्यं` (SD, Mukundananda) — `इमं` ("this here") vs `इदं` ("this").
    Edition variant; no fix.
- **6 real defects** found (one or more authoritative sources show the
  canonical form is different from what we shipped). These are documented
  below and **all fixed**.

#### Defect 1 — 17.25 missing instrumental-plural suffix

- **shipped**: `…मोक्षकाङ्क्षि।।17.25।।`
- **canonical**: `…मोक्षकाङ्क्षिभिः।।17.25।।`
- **sources confirming the canonical**:
  - IIT Kanpur Supersite (`भि:` rendered with ASCII colon for visarga, same character).
  - Sanskrit Documents (`मोक्षकाङ्क्षिभिः ॥ १७-२५॥`).
  - Swami Mukundananda (`मोक्षकाङ्क्षिभि:`).
- **fix transform**: append `भिः` immediately before `।।17.25।।`. Single
  replacement, multiset diff is exactly the addition of "भिः".

#### Defect 2 — 14 verses with phantom `र` in the शृ-imperative

The Sanskrit imperative root `śṛ-` ("listen!") spells canonically as `शृ`
(श + ृ vocalic-R matra). The source dataset encodes 14 instances as `श्रृ`
(श + ्virama + र + ृ), i.e. inserting an extra `र` consonant between श and the
vocalic-R matra. This is a non-canonical Unicode form: there's no `r`
phoneme in `śṛṇu`/`śṛṇoti`.

- **verses**: 2.29, 2.39, 5.8, 10.1, 10.18, 13.4, 16.6, 17.2, 17.7, 18.4,
  18.29, 18.36, 18.64, 18.71.
- **sources confirming canonical `शृ`**:
  - IIT Kanpur for 2.39 (canonical `शृणु`); for 2.29 IIT itself carries the
    same malformed `श्रृणोति` — they share the defect.
  - Mukundananda for 2.29 (`शृ्णोति` — a different defect at IIT's word, but
    the imperative root is `शृ`, not `श्रृ`) and 2.39 (clean `शृणु`).
  - Sanskrit Documents uses `श‍ृ` (ZWJ-separated rendering of the same `शृ`).
- **fix transform**: replace `श्रृण` with `शृण` everywhere. 14 replacements;
  multiset diff per verse is the removal of one `्` + one `र`.

#### Defect 3 — 1.34 letter substitution: `श्चशुर` → `श्वशुर`

- **shipped**: `मातुलाः श्चशुराः पौत्राः…`
- **canonical**: `मातुलाः श्वशुराः पौत्राः…` ("uncles, fathers-in-law,
  grandsons" — `śvaśura` is "father-in-law").
- The defect: the source has `च` (palatal stop) where canonical is `व`. The
  word `श्चशुर` is not a Sanskrit word.
- **sources confirming canonical**:
  - IIT Kanpur (`मातुलाः श्वशुराः`).
  - Mukundananda (`मातुला: श्वशुरा:`).
  - Sanskrit Documents (`मातुलाः श्वशुराः`).
- **fix transform**: single replacement `श्चशुराः` → `श्वशुराः`.

#### Defect 4 — 16.20 verse-initial vowel: `असुरीं` → `आसुरीं`

- **shipped**: `असुरीं योनिमापन्ना…` (asurīṃ — "asura-feminine")
- **canonical**: `आसुरीं योनिमापन्ना…` (āsurīṃ — "demoniacal-feminine
  [womb]", the adjective from `āsura`).
- Grammatically the verse asks about those who attain an *āsurī*-yoni — the
  adjectival, long-vowel form is the standard reading.
- **sources confirming canonical**:
  - IIT Kanpur (`आसुरीं योनिमापन्ना`).
  - Mukundananda (`आसुरीं योनिमापन्ना`).
  - Sanskrit Documents (`आसुरीं योनिमापन्ना`).
- **fix transform**: replace verse-initial `असुरीं ` with `आसुरीं `.

#### Defect 5 — 3 verses with decomposed long vocalic-R (`ृ + ़` → `ॄ`)

Sanskrit Unicode provides a precomposed long-vocalic-R matra `ॄ` (U+0944).
Three verses in the source dataset use the non-canonical decomposed encoding
`ृ + ़` (short vocalic-R + combining nukta), which both renders correctly
in many fonts but doesn't round-trip cleanly through transliteration and
isn't the canonical Unicode form.

- **verses**: 1.26 (`पितृ़न` → `पितॄन्`, also `भ्रातृ़न्` → `भ्रातॄन्`),
  9.25 (`पितृ़न्`), 10.29 (`पितृ़णाम`).
- **sources confirming canonical `ॄ`**:
  - Sanskrit Documents (`पितॄन`, `भ्रातॄन्`, `पितॄणाम`).
- **fix transform**: replace `ृ + U+093C` with `ॄ`. Four occurrences across
  three verses; multiset diff per occurrence is `−U+093C` and `ृ → ॄ`.
- **collateral benefit**: the IAST for these verses was producing literal
  Unicode nuktas in the output (e.g. `pitṛ़n` instead of `pitṝn`). After the
  fix, sanscript emits the canonical `ṝ`.

#### Defect 6 — 4.31 stray nukta between vowel sign and avagraha

- **shipped**: `नायं लोकोऽस्त्ययज्ञस्य कुतो़ऽन्यः…` — `कुतो + nukta + अवग्रह`.
- **canonical**: `नायं लोकोऽस्त्ययज्ञस्य कुतोऽन्यः…`.
- The nukta has no role here (no consonant to modify) — pure encoding noise.
- **sources confirming canonical**:
  - IIT Kanpur (verified via raw HTML).
  - The IAST artifact `kuto़'nyaḥ` in the shipped data was itself diagnostic.
- **fix transform**: replace `कुतो़ऽन्यः` with `कुतोऽन्यः`. Multiset diff is
  `−U+093C`.

### A4 — Colophons and missing verses

Sanskrit Documents and Gita Press editions include a closing colophon after
each chapter — `ॐ तत्सदिति श्रीमद्भगवद्गीतासूपनिषत्सु ब्रह्मविद्यायां
योगशास्त्रे श्रीकृष्णार्जुनसंवादे [chapter-name]-योगो नाम
[chapter-ordinal]ोऽध्यायः ॥ N॥`. Our import does not include these.

The colophons are paratext (the Gita itself does not internally
describe its own chapter boundaries); whether to include them is an editorial
choice rather than a defect. **Not fixed** — flagging as a soft spot. A future
session that decides to ship them can pull all 18 from SD's
`bhagvadnew.html` deterministically.

Verse counts: all 18 chapters present, gap-free and sequential, matching the
canonical counts (47, 72, 43, 42, 29, 47, 30, 28, 34, 42, 55, 20, 35, 27, 20,
24, 28, 78 — total 701). No missing verses.

## B. Sundarkand verse-text accuracy

### B1 / B3 — Cross-check against Drik Panchang and Sanskrit Documents

Spot-checked 10 doha-segments (1, 2, 3, 30, 39, 45, 56, 58, 59, 60) against
Drik Panchang per-page lyrics, then ran a full-text substring comparison of
all 60 segments against Sanskrit Documents' Tulsidas Sundarkand HTML
(`sanskritdocuments.org/doc_z_otherlang_hindi/sundarakaaNDa.html`).

52 of 60 matched as exact substrings in SD; 8 differed in minor ways. Of
those:

- **6 are SD-format artifacts**: SD uses `दो.` / `सो.` / `छं.` short
  labels and inserts hyphens at line breaks (e.g. `बचावन-बात…`). None are
  defects.
- **1 is a known Awadhi spelling difference**: segment 15 `तत्व` (shipped,
  Drik) vs `तत्त्व` (SD). Drik agrees with our shipped against SD's
  Sanskritised double-त; we keep the Awadhi-natural form.
- **1 is a real defect** — segment 44, see below.

### Defect — segment 44 missing ृ matra

- **shipped**: `जौं पै दुष्टहदय सोइ होई…`
- **canonical**: `जौं पै दुष्टहृदय सोइ होई…` (`hṛdaya`, heart).
- **sources confirming canonical**:
  - Drik Panchang (`दुष्ट हृदय`).
  - Sanskrit Documents (`दुष्टहृदय`).
- **fix transform**: replace `दुष्टहदय` with `दुष्टहृदय`. Multiset diff is
  exactly the addition of one `ृ` matra.

### B2 — Mangalacharan shlokas (closed)

The three Sanskrit shlokas that open Tulsidas's Sundarkand (`शान्तं
शाश्वतम्…`, `नान्या स्पृहा…`, `अतुलितबलधाम्…`) were absent from the
WirelessAlien source dataset and flagged as a soft spot in the previous
session. This audit confirmed identical text across **three** independent
authoritative sources:

1. **Drik Panchang** (`drikpanchang.com/lyrics/ramcharitmanas/sundarkand/sundarkand-lyrics.html`).
2. **Sanskrit Documents Tulsidas** (`sanskritdocuments.org/doc_z_otherlang_hindi/sundarakaaNDa.html`).
3. **BhaktiBharat** (the source cited in the previous session's SOURCES.md
   note — confirmed independently here).

Where the three sources differed only on minor orthography
(`पुङ्गव`/`पुंगव`, `चूड़ामणिम्`/`चूडामणिम्`), we used the form that matches
the rest of the corpus's homorganic-nasal style.

**Schema choice**: inserted as 3 leading `ScriptureVerse` entries inside the
existing single `Chapter` rather than as a new chapter — this keeps the doha-
segment indices (60) intact at positions 4..63 and matches how printed
editions render the opening: the shlokas precede the first chaupai inside the
same kand. Total verses now 63.

This closes the Phase 4 Sundarkand soft spot for the mangalacharan.

### Remaining soft spots (unchanged)

The other previously-documented soft spots remain unchanged:

- No human verification against a printed Gita Press edition (both
  scriptures).
- IAST is machine-generated and has not had a human Sanskrit-reviewer pass
  (Geeta).
- Sundarkand verse-end markers stay `।।N।।` ASCII-digit form (source's
  convention).
- No translations.
- No Awadhi Roman-script chant for Sundarkand.

## C. IAST quality

The shipped IAST is strict-IAST (śāstrīya), not the popular hybrid (`śh`,
`ṣh`, `ch`, hyphen-separated compounds) used by sites like Mukundananda. It
follows the source Devanagari's compound joining (sandhi-applied form,
compounds joined without hyphens) and uses `|` / `||` for `daṇḍa` /
`double-daṇḍa`.

Round-trip verified for **all 701 verses** post-fix (the previous round-trip
also passed; the audit fix only widened the toleration to cover daṇḍa-form
mismatches in the trailing verse-id marker).

Known sanscript artifacts (unchanged from the previous session's posture):

1. `oṃ` ↔ `ॐ` re-ligature — when the source contains a syllable that
   transliterates to `oṃ` (e.g. 9.17 `…पवित्रमों…`, 10.41 `…तेजों…`), the
   IAST→Devanagari back-transliteration may re-segment the surrounding
   consonant, splitting it off from the `ओम्` syllable. Documented and
   tolerated in the verification's normalisation.
2. Compounds rendered as joined words rather than hyphenated. Faithful to
   source; intentional.
3. Daṇḍa rendered as ASCII `|`. Convention choice.
4. Avagraha rendered as ASCII `'`. Convention choice.

The four-verse stray-nukta defect (Defect 5/6 above) was also producing
literal Unicode nuktas in the IAST output; fixing the Devanagari fixed the
IAST as a byproduct.

## D. Source-defect scan

### Bhagavad Geeta (`gita/gita`)

Per-chapter verse counts checked against canonical: all 18 match exactly,
gap-free and sequential (47, 72, 43, 42, 29, 47, 30, 28, 34, 42, 55, 20, 35,
27, 20, 24, 28, 78 — total 701).

All defects found in `gita/gita` are listed under §A3 above (six distinct
defect classes, 21 verses changed).

A note on IIT Kanpur as a "trusted" source: IIT Kanpur Gita Supersite is a
high-quality scholarly edition but is **not** byte-canonical — it shares the
matra defect with `gita/gita` for 20 of 25 verses, and itself prints
`श्रृणोति` rather than `शृणोति` at 2.29. Treat it as one source among several,
not the canonical reference.

### Sundarkand (`WirelessAlien/Ramcharitmanas`)

Found defects: see §B (segment 44 missing matra, mangalacharan absent — both
addressed). All 60 segments have both `चौपाई` and `दोहा/सोरठा` labels and the
correct sequence of doha numbers 1..60 (with the expected क/ख splits at 39,
49, 56).

The dataset uses inconsistent nukta encoding for the Awadhi retroflex flap
(both precomposed `ड़`/`ढ़` and decomposed `ड`+`़` / `ढ`+`़` forms appear),
which the previous session's note already covered. The variant is rendered
identically by all major fonts; not a defect.

## E. Chapter titles and schema

### Geeta `titleSanskrit`

Compared the shipped chapter Sanskrit titles to the colophon names in Sanskrit
Documents' bhagvadnew.html. Most match exactly; a few notes:

- **Ch 2**: shipped `सांख्ययोग` (anusvara) vs colophon `साङ्ख्ययोगः`
  (homorganic) — orthographic variant only; the rest of the corpus uses
  anusvara consistently.
- **Ch 5**: shipped `कर्मसंन्यासयोग` vs colophon `संन्यासयोगः` — the gita/gita
  source has the longer name (also widely attested in printed editions).
- **Ch 6**: shipped `ध्यानयोग` ("Yoga of meditation") vs colophon
  `आत्मसंयमयोगः` ("Yoga of self-restraint") — both names refer to the same
  chapter; the gita/gita source uses the popular short name.
- **Ch 13**: shipped includes a hyphen (`क्षेत्र-क्षेत्रज्ञविभागयोग`);
  the colophon does not.

These are all variant-acceptable names; no fix proposed. A future verification
pass against printed Gita Press editions can choose between the popular and
colophon forms.

### Geeta `titleEnglish`

Shipped uses the `name_meaning` descriptive titles from `gita/gita`
(e.g. "Arjuna's Dilemma", "Transcendental Knowledge"). These are not the
scholarly "Yoga of …" renderings (e.g. "The Yoga of Arjuna's Dejection").
Both styles have precedent. **Recommendation**: keep the descriptive titles
as the primary `titleEnglish`. A future schema extension could add an
optional `titleColophonEnglish` for the scholarly form; not done here.

### Sundarkand schema

Currently a single `Chapter` with N `ScriptureVerse` entries (now 63 — 3
mangalacharan + 60 doha-segments). The natural citation unit is the doha
number, so verse index 4..63 maps to doha 1..60.

An alternative would be 60 separate `Chapter`s (one per doha-segment, each
holding the chaupai couplets and the closing doha), with the mangalacharan as
either a dedicated opening chapter or three "verses" inside chapter 1.

The current schema mirrors the Geeta's ("chapter = major division, verse =
single named unit"). The 60-chapter schema would over-fragment a small text
and complicates the mangalacharan placement. **Recommendation**: keep the
current schema; the cost of changing it is higher than the consumer-side
benefit. Consumers wanting per-doha pagination can split on the trailing
`।।N।।` / `।।N(क)।।` / `।।N(ख)।।` marker.

## Reproduction

```bash
# In a fresh checkout:
npm install
npm run build
node scripts/audit-verify.cjs    # asserts all 45 invariants
```

To re-apply the fix (idempotent — second run will refuse, asserting expected
pattern counts):

```bash
node scripts/audit-fix.cjs
```

The audit fetched data from:

- IIT Kanpur Gita Supersite — `gitasupersite.iitk.ac.in/srimad?…`
- Sanskrit Documents — `sanskritdocuments.org/doc_giitaa/bhagvadnew.html`
  and `…/doc_z_otherlang_hindi/sundarakaaNDa.html`
- Drik Panchang — `drikpanchang.com/lyrics/ramcharitmanas/sundarkand/…`
- Holy Bhagavad Gita (Mukundananda) — `holy-bhagavad-gita.org/chapter/…/verse/…`
- BhaktiBharat — `bhaktibharat.com/granth/…sundar-kand-mangalacharan`

A snapshot of the comparison data lives in `/tmp/hdt-audit/` during the
session that ran this; it is **not** committed.
