# LifeLoveMe — Lightweight Architecture Audit

**Date:** 2026-05-11  
**Scope:** Documentation-only audit. No code or `deploy/web_public` changes. Large JSON corpora, `deploy/`, `media/`, dependency trees, and backup folders were not loaded end-to-end.

**Inputs read:** `docs/vision/LifeLoveMe_Grand_Vision.md`, `docs/architecture/Universal_Collection_Framework.md`, `docs/architecture/LifeLoveMe_Media_Hosting_Strategy.md`, `docs/design/LifeLoveMe_Visual_Enhancement_Plan.md`, `docs/testing/Local_Web_App_Testing_Plan.md`, plus sampled `web/` manifests, `scripts/prepare_deploy.sh` (header + rules), `web/home`, `web/library`, `web/apps/rcm-hub`, `web/apps/rcm-explorer` (HTML + targeted `rcm-explorer.js` grep), `web/apps/experience-player/index.html`, `scripts/test_local_pages.sh`, `scripts/LLMVision.sh`, `docs/collections/yoga-sutra/Yoga_Sutra_Ingestion_Plan.md` (existence / alignment).

---

## 1. Executive summary

The repository is **moving toward** the Universal Collection Framework (UCF) on the **data and documentation** side: `web/data/collections/collection_manifest.json`, RCM `index_definition.json`, `media_manifest.json` with `deployTier` / `includeInDeploy`, `UNIVERSAL_INDEX_SCHEMA.md` as a pointer, and Docs surfaces for Grand Vision and UCF.

The **runtime apps** remain **RCM-first**: dedicated **RCM Hub** and **RCM Explorer** URLs, Explorer JS and Experience Player paths centered on Ramcharitmanas data and AIR audio, and **Library** collection cards that are **static HTML** (not yet driven by `collection_manifest.json`). So the structure is **hybrid**: UCF-shaped **contracts** exist; **generic collection apps** and manifest-driven Library are **not** fully realized yet.

---

## 2. Current app structure

| Area | Role today |
|------|------------|
| **Home** (`web/home/`) | Brand entry: Life / Love / Me pillars, footer links to Library, Docs, RCM Hub. No **Ask LifeLoveMe** single-box routing yet (Grand Vision §5). |
| **Library** (`web/library/`) | Collection narrative + static cards (RCM active, Gita coming soon, etc.) + “Ask or search” **UI shell** (form present; not wired to global routing in this audit). |
| **Docs** (`web/docs/`) | Index, vision/architecture HTML, journey, commands; trust and onboarding. |
| **RCM Hub** (`web/apps/rcm-hub/`) | Collection landing: search stub → Explorer, CTAs, Reference/Help links; explicit note that Explorer stays on-page for play vs Player in new tab. |
| **RCM Reference** | Manifest-driven cards (`reference_manifest.json`) + static hub links. |
| **RCM Explorer** | Primary study app: modes Smart / Text / Starts / Index / Meaning, inline AIR read-along, LineRef + legacy ref plumbing. |
| **Experience Player** | Separate full-player / plans UI; RCM section + wellness; loads heavy JSON from under app (not audited byte-wise). |
| **`web/data/collections/`** | `collection_manifest.json` lists RCM + placeholders (GITA, CHANTS, …) + BOOKS/POEMS `beta`; RCM has `index_definition.json`, `media_manifest.json`, `search_aliases.json`. **YOGA** is not in manifest yet (ingestion plan lives under `docs/collections/yoga-sutra/`). |
| **Scripts / testing / deploy** | `prepare_deploy.sh` builds lean `deploy/web_public` from `web/` with exclusions and explicit allowlists for large JSON and beta MP3s. `LLMVision.sh` chains prepare + server + `test_local_pages.sh` + open Home. `test_local_pages.sh` curls key routes including collection JSON. |

---

## 3. Alignment with Grand Vision

**Already aligned**

- **RCM as proof-of-concept** — Deep search, meanings, indexing narrative, Reference/Help.  
- **Search as the heart** — Explorer exposes multiple modes; Smart path includes `interpretSmartSearch` / structured interpretation hooks.  
- **Hub vs Explorer vs Player** — Hub copy and testing plan state: **Play from search stays in Explorer**; Experience Player is a **separate tab** where linked.  
- **Docs / vision / architecture** — Linked from Docs index; UCF and Grand Vision mirrored for web readers.  
- **Universal collection idea** — `collection_manifest.json` + `CollectionType` values + long-term rows for Gita, wellness, family, Bollywood.  
- **Lean deploy principle** — Documented in Grand Vision §9 and implemented in spirit via `prepare_deploy.sh` exclusions and media manifest tiers.

**Gaps vs vision**

- **Ask LifeLoveMe** — Grand Vision §5: home has no equivalent single entry routing to collection / explorer / wellness; Library has a placeholder ask block only.  
- **Reader-first routing at scale** — Still requires user to pick RCM-specific apps by name.  
- **Wellness safety framing** — Present in vision; not evaluated in depth in this pass.

---

## 4. Alignment with Universal Collection Framework

**Present**

- **`collection_manifest.json`** — Per-collection `collectionId`, `collectionType`, `status`, `enabled`, `hubPath` / `explorerPath` / `basePath` / `indexDefinitionPath` (RCM populated; others mostly empty).  
- **`index_definition.json` (RCM)** — Parts, `lineRefFormat`, `sortKeyFormat`, legacy `legacyIdName`, examples including `RCM.001.004.002.Do`.  
- **`media_manifest.json` (RCM)** — Rows with `mediaId`, `publicPath`, `deployTier: beta`, `includeInDeploy: true`, optional line ref span fields (often null in sampled rows). Aligns with UCF §8 and Media Hosting Strategy.  
- **LineRef / SortKey movement** — Explorer uses `getLineRef`, `legacyRcmIdToCanonicalLineRef`, padding helpers consistent with UCF §6 narrative.  
- **Universal docs** — UCF doc + `UNIVERSAL_INDEX_SCHEMA.md` pointer under `web/data/collections/`.

**Partial / missing vs UCF**

- **Generic `items.json` for RCM under `web/data/collections/rcm/`** — Not confirmed in this audit (lines live under Experience Player data path per deploy script). Split between “collection contract folder” and “player corpus” is a **drift risk**.  
- **`aliases.json` / `help.json` / `references.json` per UCF filenames** — RCM uses `search_aliases.json`, hub help HTML, reference manifest; naming is **close but not identical** to UCF §4 file table.  
- **Apps reading `collection_manifest.json` at runtime** — Not evidenced for Library/Hub in static HTML reviewed.

---

## 5. RCM-specific assumptions still present

- **App names and routes** — `rcm-explorer`, `rcm-hub`, titles “RCM Explorer”, “Ramcharitmanas Hub”.  
- **Explorer copy and placeholders** — “Search Ramcharitmanas”, Ramcharitmanas-only intro.  
- **Data paths** — `prepare_deploy.sh` allowlists `apps/experience-player/data/Ramcharitmanas/*.json` and RCM media paths; Explorer likely loads from the same tree (not fully traced here).  
- **Logic** — `legacyRcmIdToCanonicalLineRef`, `LineID`, `RCMID`, kand/doha/metre vocabulary, `ANTAKSHARI_KAND_NAMES`, AIR episode line ranges, `normalizeHindiLineForAntakshari`, Prasang/theme modes.  
- **`prepare_deploy.sh` `PROJECT_ROOT`** — Hard-coded to a specific user iCloud path; **portability / CI risk** for other machines.

---

## 6. Legacy or unused-looking code candidates (do not delete from this audit)

*Candidates only — verify usage and product intent before any removal.*

- **`ANTAKSHARI_KAND_NAMES` and `normalizeHindiLineForAntakshari`** in `rcm-explorer.js` — Antakshari may be reduced in UI per testing plan; code paths may still exist.  
- **Duplicate Play defense** — Commented “defensive” dedupe after batch render (`renderResultActions` / strip duplicate controls) — suggests historical duplicate Play issues; keep until regression suite proves stable.  
- **Links stripping to `experience-player`** inside result dedupe — legacy routing cleanup; confirms past overlap between inline and external player.  
- **LineID still rendered** in parts of UI / meta strings (grep shows `LineID:` labels alongside LineRef) — conflicts with testing plan preference that LineID not be **primary** user identity.  
- **Repo folders** (not opened): `web/apps/experience-player_*BACKUP*`, `inner-ramayan-player-legacy` — archive noise per prior triage; not in lean copy list by default.

---

## 7. Search architecture (current)

| Mode | Role (high level) |
|------|-------------------|
| **Smart** | `interpretSmartSearch` / `trySmartSearchInterpretation`; dialog-style and structured queries; falls back to token-style behavior with logging. |
| **Text** | Field-scanned matching over line text / related fields (implementation not fully read). |
| **Starts** | Prefix-oriented search for Devanagari/Roman starts (testing plan examples). |
| **Index** | LineRef and legacy index patterns (e.g. `1.004.02.Do`, `RCM.001.004.002.Do`) via index-aware matching. |
| **Meaning** | English/Hindi meaning fields with diagnostics when keys missing. |
| **Wildcard** | Testing plan expects patterns like `nishad*`; exact grammar not fully reverse-engineered in this pass. |
| **Aliases** | Character / concept data in `web/data/knowledge/` and `search_aliases.json`; merged maps in JS (grep). |
| **Boolean / “but not”** | User journey examples include `ravan but not hanuman`; treated as Smart/intent family (confirm exact parser in dedicated pass). |
| **LineRef-first** | Primary display and inline play keyed off canonical LineRef with legacy fallbacks. |

**Risks**

- Smart + legacy ID + multiple field names increase **regression surface** (any change needs the scripted smoke + manual queries from testing plan).  
- **LineID still visible** in some blocks → user confusion vs UCF migration story.  
- **Console logging** in search paths → noise and minor perf cost in production builds if left on.

---

## 8. Media / playback architecture

- **Inline Explorer playback** — Dedicated `#rcmInlinePlayer` / episode panel; `playLineRefInlineFromSearch`; read-along note references `air_line_timings.json` when present.  
- **Experience Player** — Full AIR / plan experience; opens from Hub/Explorer nav in **new tab**; still part of product story.  
- **`media_manifest.json`** — Documents beta MP3s with `publicPath` under Experience Player media tree; matches “lean beta subset” notes.  
- **Netlify limits** — Large JSON and full archives excluded or allowlisted explicitly in `prepare_deploy.sh`; aligns with Media Hosting Strategy, though **full automation of “warnings for every excluded large file”** is partial (script has targeted `WARN` helpers).  
- **ExternalURL / CDN** — Strategy doc defines playback priority; **runtime** may still assume bundled `publicPath` for RCM beta (full ExternalURL path not verified in player.js this pass).  
- **Video / YouTube** — No first-class placeholder flow audited; future work for non-AIR video.

---

## 9. Deploy and testing architecture

- **`prepare_deploy.sh`** — Rsync `web/` → `deploy/web_public` with `common_excludes`, explicit **large JSON allowlist**, beta MP3 allowlist, `copy_reference_assets`, universal collection artifact copy, app folder copies (`rcm-hub`, `rcm-explorer`, `experience-player` with excludes). **Hard-coded `PROJECT_ROOT`.**  
- **`deploy/web_public`** — Output only; not source of truth.  
- **`deploy/web_public_large`** — Mentioned in Media Hosting Strategy; not verified whether a second script target exists in this audit (strategy > implementation gap possible).  
- **`LLMVision.sh`** — One-shot local verification from built tree.  
- **`test_local_pages.sh`** — HTTP 200 checks for home, library, docs, hub, reference, explorer, player, key JSON and reference assets.  
- **`open_home_only.sh`** — Referenced in testing plan for journey testing.  
- **Testing plan** — Strong behavioral expectations (no duplicate Play, no Player redirect from result Play, LineRef primary).

---

## 10. Readiness for a second collection (Yoga Sutra or Gita)

| Category | Assessment |
|----------|--------------|
| **Ready** | UCF documentation; `collection_manifest` pattern; RCM `index_definition` as template; `media_manifest` tier vocabulary; deploy/script awareness of lean vs heavy; Yoga Sutra **ingestion plan** doc exists. |
| **Partially ready** | Library **visual** slots for “coming soon” collections; Docs; validation scripts (`validate_universal_indexing.py` named in repo — not executed here); shared `rcm_line_ref.js` ideas for LineRef string rules. |
| **Not ready yet** | **No YOGA row** in `collection_manifest.json`; no generic **collection explorer** loading arbitrary `index_definition` + items; Explorer/Player **hardwired** to RCM paths; Library not **data-driven** from manifest; second corpus **items.json** location convention vs Experience Player data not unified; automated **validate_collection** pipeline from Yoga ingestion plan not yet a verified standard for all PRs. |

**Verdict:** **Gita or Yoga Sutra “sample slice”** is feasible as a **spike** once a second `index_definition.json` + small `items.json` land and a **minimal** hub/explorer route strategy is chosen (new static pages vs parameterized shell). **Not ready** for “flip a flag and ship full second scripture” without the above.

---

## 11. Recommended next milestones (small, safe)

1. **Confirm duplicate Play** — Re-run user journey from testing plan after any Explorer UI change; keep dedupe helper until stable.  
2. **Reduce LineID prominence** — Align UI with testing plan: LineRef primary, LineID debug-only or removed from default result cards.  
3. **Library polish (visual + optional data)** — Stage 1 from Visual Enhancement Plan; optionally load card list from `collection_manifest.json` read-only (small JS, no search behavior change).  
4. **Document `prepare_deploy.sh` `PROJECT_ROOT`** — Parameterize or env-override for other developers (doc-first if code change deferred).  
5. **Yoga or Gita sample** — 5–10 rows + `YOGA`/`GITA` manifest entries + **read-only** mini page (no Explorer feature parity on day one).  
6. **Universal media placeholder** — One `external` tier row + UI “not bundled” message per Media Hosting Strategy §8.  
7. **Ask LifeLoveMe prototype** — Static routing table + copy only (no LLM): maps keywords to Library/Docs/RCM Hub.

---

## 12. Risk list

- **Breaking RCM beta** — Any refactor of Explorer search or inline player affects the flagship path.  
- **Over-broad Cursor prompts** — Risk editing `deploy/` directly or merging duplicate logic paths.  
- **Large files on Netlify** — Accidental inclusion of full MP3/ZIP or giant JSON if allowlists/excludes drift.  
- **RCM-specific code in “shared” areas** — Future generic shell may inherit hidden assumptions.  
- **Search regressions** — Smart + legacy + multi-field matching hard to fully automated-test without golden fixtures.  
- **Old and new IDs mixed** — Dual-read period (UCF §7 RCM mapping) increases support burden until UI consistently LineRef-first.

---

## 13. Suggested next implementation prompt (safe)

Use this for a **single, bounded** follow-up (adjust paths if your machine does not use the default `PROJECT_ROOT` in `prepare_deploy.sh`):

---

**Prompt:** Document-only or **one** small mechanical fix: (A) Add a short subsection to `docs/testing/Local_Web_App_Testing_Plan.md` explaining that `scripts/prepare_deploy.sh` uses a fixed `PROJECT_ROOT` and how to override or symlink for local development; **or** (B) change **only** `prepare_deploy.sh` to resolve `PROJECT_ROOT` relative to the script location (e.g. `PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"`) with no other script behavior changes. After (B), run `./scripts/prepare_deploy.sh` and `./scripts/test_local_pages.sh http://localhost:8780` against an already-running local server, and report PASS/FAIL. **Do not** edit `deploy/web_public` by hand, **do not** modify RCM Explorer search logic, and **do not** load large JSON files into the chat.

---

*End of audit report.*
