| Metadata | Value |
|---|---|
| Status | Active |
| Version | 1.0.0 |
| Last Updated | 2026-09-10 |
| Author | Principal Data & AI Engineering review (for Seshadri) |
| Document Type | Design reference |
| Companion doc | sangeetha-grantha-state-of-nation-july-2026.md |
| Scope | Re-prioritised task list factoring open Conductor tracks against the uplift findings. Gemma 4 deliberately excluded per your call. |
[!NOTE] Design/reference material: this page may include proposals or earlier implementation assumptions. Use current feature map for implemented behavior and current operating steps.
[!NOTE] U7 (semantic search) is done — TRACK-108, Gemini Embedding 2 + pgvector, Curator Console hybrid mode. This June 2026 sequencing document is otherwise historical.
This takes the findings from the State-of-Nation review (F1–F8) and collides them with what’s actually open in Conductor. The priority order in the companion doc assumed a clean slate; it isn’t one. Once you factor in the in-flight Trinity import and the payload-convergence cleanup, the ordering tightens — because the AI breakage sits directly underneath the content work you’ve already started. The headline: you cannot safely resume the Trinity import until the AI layer is fixed, so that moves to the front regardless of how “infrastructural” it felt in the abstract.
The State-of-Nation doc ranked the AI-availability fixes (F1/F3) first on correctness grounds, but treated them as standalone platform hygiene. They are not standalone. The open tracks reveal the coupling:
gemini_enricher.py. That file imports the deprecated google.generativeai SDK and the worker config defaults the model to gemini-2.0-flash — a model that reached retirement on 1 June 2026. So the single largest piece of in-flight content work is sitting on top of a dead/dying AI dependency. Finishing TRACK-093 before fixing F1/F3 risks importing 1,245 krithis through a degraded or failing enrichment path.parsed_payload a single, schema-true CanonicalExtractionDto. Do them together and the structured-output adoption reinforces the convergence rather than competing with it.So the re-hash is less “new work” and more “sequence the work you already have so the foundation is sound before you pour content on it.”
| Track | Title | Status | Relevance to uplift |
|---|---|---|---|
| TRACK-093 | Trinity Krithi Bulk Import (1,245 krithis) | In Progress | Blocked by AI fixes (F1/F3); prime candidate for Batch Mode (F5) |
| TRACK-096 | Payload Format Convergence (deprecate ScrapedKrithiMetadata) |
In Progress | Phase 4 cleanup pending; aligns with F4 |
| TRACK-099 | Backend Compiler Warning Cleanup (zero-warning target) | Not Started (registry) / file says “staged” — discrepancy, see §6 | Coupled to TRACK-096 Phase 4 |
| TRACK-065 | Python Extraction Module Promotion & Rename | Deferred | Bundle the rename with the SDK migration (F3) — same module, one disturbance |
| TRACK-035 | Frontend E2E Testing (Playwright) | Deferred | Playwright pinned at 1.40.0 (old); revive alongside frontend patch bumps |
| TRACK-014 | Bulk Import Testing & QA | Deferred | Regression safety net for the re-enabled enrichment path |
| TRACK-042 | MCP Database Tooling Optimization | Deferred | Low priority; unrelated to uplift |
| TRACK-002 | Doc Header Standardizations | Deferred | Housekeeping; do opportunistically |
Tasks are tagged with the finding (F#) and track they serve. Effort is engineer-days for one person. “Blocked by” is hard sequencing.
U1 — Migrate the extraction worker off the deprecated google.generativeai SDK → google-genai
F3 · serves TRACK-093, TRACK-065 · ~1 day · blocks: U2, U3, TRACK-093 resume
tools/krithi-extract-enrich-worker/pyproject.toml:27 — replace google-generativeai>=0.8.0 with google-genai.tools/krithi-extract-enrich-worker/src/gemini_enricher.py:59-62 — replace the import google.generativeai as genai / genai.configure(api_key=...) / genai.GenerativeModel(model) pattern with the client-first form: from google import genai → client = genai.Client(api_key=...) → client.models.generate_content(model=..., contents=..., config=...).tests/test_schema.py:190,200 and tests/test_worker.py:210 — the provider="google-generativeai" string literals; decide whether to keep as a provenance label or rename to google-genai.response_schema path (already present at gemini_enricher.py:111) still returns valid JSON.U2 — Repoint the model string off retired gemini-2.0-flash → gemini-3.5-flash, behind config
F1,F2 · serves TRACK-093 · ~1 day incl. eval · blocked by: U1
tools/krithi-extract-enrich-worker/src/config.py:33-34 — change the SG_GEMINI_MODEL default from "gemini-2.0-flash" to "gemini-3.5-flash". Keep it env-overridable (it already is — good).gemini-1.5-* / gemini-2.0-* strings used for the “musicological validation” path (F2) and collapse onto the same constant.grep clean outside .venv).U3 — Formalise structured output with a Pydantic response_schema
F4 · serves TRACK-096 · ~1 day (reduced — partial adoption already exists) · blocked by: U1
gemini_enricher.py already passes a response_schema (line ~111) via the old SDK. Port it to the new SDK’s config=types.GenerateContentConfig(response_schema=...) and bind it to a Pydantic model that mirrors CanonicalExtractionDto (you already run Pydantic 2.12).ScrapedKrithiMetadata shape. It also stabilises output across the U2 model swap.imported_krithis.parsed_payload ≈ 0 on a re-run of the test corpus; schema validation enforced at decode time, not by post-hoc parsing.U4 — Resume and complete TRACK-093 (Trinity import, 1,245 krithis) serves TRACK-093 · ~2–3 days · blocked by: U1, U2, U3
make test).U5 — Run the Trinity backfill through Batch Mode
F5 · serves TRACK-093 · ~1 day (fold into U4) · blocked by: U1
U6 — Complete TRACK-096 Phase 4 + TRACK-099 together (DTO convergence + zero-warning build)
F4 · serves TRACK-096, TRACK-099 · ~2 days · best done after U3
ScrapedKrithiMetadata/ScrapedSectionDto/IWebScraper types that TRACK-096 Phase 4 removes. Do them as one unit:
WebScrapingService.kt, DeterministicWebScraper.kt, IWebScraper DI binding) — after confirming no active route callers.LyricVariantPersistenceService.kt, StructuralVotingEngine.kt, StructuralVotingProcessor.kt, ImportService.kt) ScrapedSectionDto → CanonicalSectionDto.ImportService.kt:491,517; ImportRoutes.kt:186).ScrapedKrithiMetadata fallback from LyricVariantPersistenceService only once no legacy payloads remain in the DB (run a count first)../gradlew … compileKotlin 2>&1 | grep "w:" returns zero lines; :modules:backend:api:test green; single payload format in parsed_payload.U7 — Semantic search v1: gemini-embedding-001 + pgvector
F6 · new track · ~1 week · blocked by: U1 (new SDK)
krithi_embedding table (krithi_id, section_id, vector, model_version); HNSW index; embeddings beside relational data in your existing Postgres 18 — no new datastore.U8 — Bundle the Python module rename (TRACK-065) into the U1 SDK migration serves TRACK-065 · ~0.5 day · do with U1
pyproject.toml/imports for U1 — fold the rename in so the module is disturbed once, not twice. Skip if it widens the U1 blast radius.U9 — Backend minor bumps: Kotlin 2.4 / Ktor 3.5; evaluate Ktor OpenAPI generation
F7 · ~1 day
gradle/libs.versions.toml. While there, evaluate Ktor’s built-in OpenAPI generation against your hand-maintained openapi/sangita-grantha.openapi.yaml.current-versions.md + the three sync targets in CLAUDE.md updated.U10 — Frontend + Python patch roll-up; revive TRACK-035 (Playwright E2E)
F8 · serves TRACK-035 · ~1–2 days
@google/genai (frontend already on the new unified SDK). Upgrade Playwright off the stale 1.40.0 pin and un-defer TRACK-035 so the re-enabled enrichment path has UI regression coverage.U11 — Revive TRACK-014 (Bulk Import Testing & QA) as the regression net for U4/U6 serves TRACK-014 · ~2 days
U12 — Opportunistic: TRACK-002 (doc headers), TRACK-042 (MCP DB tooling)
U1 (SDK migration) ──┬──> U2 (model repoint) ──┐
├──> U3 (structured out) ──┼──> U4 (resume Trinity import) ──> U5 (batch backfill)
├──> U5 (Batch Mode) │
├──> U7 (embeddings) │
└──> U8 (module rename) │
│
U3 ───────────────────────> U6 (convergence + zero-warning) [TRACK-096 P4 + TRACK-099]
│
U9 / U10 / U11 / U12 — independent, schedule around the above
U1 is the keystone: it unblocks the model swap, structured output, Batch, embeddings, and the rename. Do it first.
Sprint 1 — “Make the foundation sound” (P0 + start P1): U1 → U2 → U3 (the AI keystone, ~3 days), then U6 (convergence + zero-warning, ~2 days). End state: pipeline runs on a supported SDK + live model, payloads are schema-true, build is warning-free. Now it’s safe to import content.
Sprint 2 — “Pour content + one new capability”: U4 + U5 (Trinity import via Batch, ~3 days), then U7 (semantic search v1, ~1 week) if appetite allows. Slot U8/U9/U10/U11 housekeeping around them.
This ordering means the 1,245-krithi import (U4) only runs after the SDK, model, and schema are fixed — which is the whole reason the priority was re-hashed.
TRACK-099 status is inconsistent. The registry (conductor/tracks.md) lists it as Not Started, but the track file’s own header says Status: Completed with a progress log entry “2026-03-17: … Staged for commit.” “Staged but not committed” is the most likely reality — i.e. the work was done in a working tree that was never merged. Before starting U6, verify whether that change actually landed (git log/git status on the listed files); if it was lost, U6 absorbs it; if it merged, update the registry to Completed. Don’t trust either source until you’ve checked the build for the 53 warnings yourself.
Per your 09-ai/README.md convention, register these before starting (each needs a TRACK-XXX row + detail file):
gemini_enricher.py blast radius.Remember the project commit rule: every commit needs a Ref: application_documentation/... line, and version changes must sync current-versions.md, 02-architecture/tech-stack.md, and 00-onboarding/getting-started.md.
Fix the AI keystone (U1–U3) and clear the convergence/warning debt (U6) before you resume the Trinity import (U4) — because the import you’ve already started is quietly sitting on a retired model and a deprecated SDK. Everything else is cheap follow-on.
application_documentation/sangeetha-grantha-state-of-nation-july-2026.md (findings F1–F8)tools/krithi-extract-enrich-worker/src/config.py:33-34, src/gemini_enricher.py:59-62,111, pyproject.toml:27conductor/tracks.md; TRACK-093, TRACK-096, TRACK-099, TRACK-065, TRACK-035, TRACK-014