Skip to content

feat(ai-partner): integrate sqlite-vec into scripture.db build (#1448)#1476

Merged
CraigBuckmaster merged 1 commit into
masterfrom
claude/issue-1448-sqlite-vec-build
Apr 17, 2026
Merged

feat(ai-partner): integrate sqlite-vec into scripture.db build (#1448)#1476
CraigBuckmaster merged 1 commit into
masterfrom
claude/issue-1448-sqlite-vec-build

Conversation

@CraigBuckmaster
Copy link
Copy Markdown
Owner

Closes #1448. Depends on #1447.

Summary

  • Adds chunk_text + chunk_metadata tables (regular, always created) and the embeddings vec0 virtual table (created inside the loader only when the extension is loadable).
  • populate_embeddings() merges embeddings.db into scripture.db, preserving rowid ↔ chunk_id order.
  • New _tools/sqlite_vec_loader.py wraps enable_load_extension() + sqlite_vec.load() with typed skip messages.
  • validate_sqlite.py gets section 6 EMBEDDINGS: table presence, row-count parity, orphan check, DB size cap (250MB).
  • Documents the client-side loading path in app/src/db/index.ts.

Graceful skip behavior

The content-pipeline CI doesn't have sqlite_vec installed and no embeddings.db is produced at PR time. The loader and validator both skip with a warning — no failure.

Test plan

  • python3 _tools/build_sqlite.py passes with no embeddings.db (CI scenario)
  • python3 _tools/validate_sqlite.py warns but passes in the same scenario
  • With a seeded embeddings.db + pip install sqlite-vec, build populates the vec0 table and validate section 6 goes fully green
  • Smoke SELECT rowid, distance FROM embeddings WHERE embedding MATCH ? ORDER BY distance LIMIT 5 returns results
  • DB size 100MB (pre-embedding) / ~106MB (with 3 test chunks) — well under cap

Out of scope

https://claude.ai/code/session_01Pht3kzgdvkn81DDfL9SnFe

Adds the Amicus vector-retrieval tables to scripture.db. The loader is
a graceful no-op when embeddings.db is missing or sqlite-vec isn't
installed, so existing CI stays green without needing Amicus tooling.

- _tools/build_sqlite_schema.py — add chunk_text + chunk_metadata
  tables + indexes (the vec0 virtual table is created inside the
  loader because it requires the extension)
- _tools/build_sqlite_loaders.py — add populate_embeddings() that
  creates the vec0 table and copies rows from embeddings.db
- _tools/build_sqlite.py — call populate_embeddings() after FTS build
- _tools/sqlite_vec_loader.py — new cross-platform helper wrapping
  sqlite_vec.load() + enable_load_extension()
- _tools/validate_sqlite.py — new section 6 EMBEDDINGS + 250MB size cap
- app/src/db/index.ts — document client-side sqlite-vec loading path

Verified locally:
- Build + validate pass with no embeddings.db (CI-like scenario): warns
- Build + validate pass with a seeded embeddings.db + sqlite-vec: all OK
- Smoke vec search `MATCH ? ORDER BY distance LIMIT 5` returns results

https://claude.ai/code/session_01Pht3kzgdvkn81DDfL9SnFe
@github-actions
Copy link
Copy Markdown

Content Pipeline Results

✅ All pipeline checks passed

Step Status Details
Schema Validation 136110 passed, 76 failed
Build DB
DB Integrity 93 passed, 0 failed

@github-actions
Copy link
Copy Markdown

Test Results

✅ All tests passed

Passed Failed Total
Tests ✅ 3183 ❌ 0 3183
Suites ✅ 426 ❌ 0 426

Coverage

Statements Branches Functions Lines

⏱️ Duration: 76.0s

@CraigBuckmaster CraigBuckmaster merged commit 12139eb into master Apr 17, 2026
7 checks passed
@CraigBuckmaster CraigBuckmaster deleted the claude/issue-1448-sqlite-vec-build branch April 17, 2026 11:17
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.

ai-partner: add sqlite-vec to scripture.db build

2 participants