## Phase 6: Sophia (Research & Knowledge) Migration

### 6.1 Sophia Library: Document Schemas ✅

- [x] **6.1.1** Create libs/sophia/schemas/ project
- [x] **6.1.2** Add project.json with scope:sophia, layer:contracts tags
- [x] **6.1.3** Define ResearchDocument schema
- [x] **6.1.4** Define Citation schema
- [x] **6.1.5** Define Claim schema
- [x] **6.1.6** Define KnowledgePack schema
- [x] **6.1.7** Define Entity schema (for knowledge graph)
- [x] **6.1.8** Define Relation schema

### 6.2 Sophia Library: Indexing Pipelines ✅

- [x] **6.2.1** Create libs/sophia/indexing/ project
- [x] **6.2.2** Add project.json with scope:sophia, layer:domain tags
- [x] **6.2.3** Migrate lilith/services/ingestion chunking logic
- [x] **6.2.4** Create chunking strategies (semantic, fixed, sliding window)
- [x] **6.2.5** Create embedding interface
- [x] **6.2.6** Add embedding provider adapters (OpenAI, Cohere, local)
- [x] **6.2.7** Create index builder utilities

### 6.3 Sophia Library: Vector DB ✅

- [x] **6.3.1** Create libs/sophia/vectordb/ project
- [x] **6.3.2** Add project.json with scope:sophia, layer:data tags
- [x] **6.3.3** Migrate lilith/packages/vectordb (Milvus client)
- [x] **6.3.4** Migrate lilith/services/vectordb
- [x] **6.3.5** Create vector search interface
- [x] **6.3.6** Add hybrid search (vector + keyword)
- [x] **6.3.7** Create index management utilities

### 6.4 Sophia Library: Cultural Research ✅

- [x] **6.4.1** Create libs/sophia/cultural-research/ project
- [x] **6.4.2** Add project.json with scope:sophia, layer:domain tags
- [x] **6.4.3** Migrate yemaya/packages/cultural-research
- [x] **6.4.4** Create AI cultural consultant interface
- [x] **6.4.5** Create translation pipeline
- [x] **6.4.6** Add inclusive design utilities

### 6.5 Sophia Library: Theory (Research Frameworks) ✅

- [x] **6.5.1** Create libs/sophia/theory/ project
- [x] **6.5.2** Add project.json with scope:sophia, layer:domain tags
- [x] **6.5.3** Migrate yemaya/packages/theory research components
- [x] **6.5.4** Create research methodology frameworks
- [x] **6.5.5** Add citation integrity validation

### 6.6 Sophia Library: Evaluation

- [x] **6.6.1** Create libs/sophia/evaluation/ project
- [x] **6.6.2** Add project.json with scope:sophia, layer:domain tags
- [x] **6.6.3** Create retrieval quality evaluation harness
- [x] **6.6.4** Create citation integrity checker
- [x] **6.6.5** Create groundedness scorer
- [x] **6.6.6** Add benchmark datasets

### 6.7 Sophia App: Ingestion Service

- [x] **6.7.1** Create apps/sophia/ingestion/ project
- [x] **6.7.2** Add project.json with scope:sophia, type:app tags
- [x] **6.7.3** Migrate lilith/services/ingestion
- [x] **6.7.4** Create connector framework:
  - [x] PDF connector
  - [x] Web scraper connector
  - [x] API connectors (arXiv, PubMed, etc.)
- [x] **6.7.5** Add OCR pipeline
- [x] **6.7.6** Create chunking worker
- [x] **6.7.7** Create enrichment pipeline (entity extraction, summarization)

### 6.8 Sophia App: Search/RAG API

- [x] **6.8.1** Create apps/sophia/search-api/ project
- [x] **6.8.2** Add project.json with scope:sophia, type:app tags
- [x] **6.8.3** Migrate lilith/services/rag
- [x] **6.8.4** Create retrieval endpoints
- [x] **6.8.5** Create citation endpoints
- [x] **6.8.6** Create knowledge pack endpoints
- [x] **6.8.7** Add reranking pipeline
- [x] **6.8.8** Implement semantic search
- [x] **6.8.9** Add hybrid search (BM25 + vector)

### 6.9 Sophia App: Knowledge Graph API

- [x] **6.9.1** Create apps/sophia/knowledge-graph/ project
- [x] **6.9.2** Add project.json with scope:sophia, type:app tags
- [x] **6.9.3** Migrate lilith/services/knowledge
- [x] **6.9.4** Migrate lilith/services/curator-admin
- [x] **6.9.5** Create entity CRUD endpoints
- [x] **6.9.6** Create relation endpoints
- [x] **6.9.7** Create graph query endpoints (subgraph, paths)
- [x] **6.9.8** Add entity resolution

### 6.10 Sophia App: Research Workbench

- [x] **6.10.1** Create apps/sophia/workbench/ project
- [x] **6.10.2** Add project.json with scope:sophia, type:app tags
- [x] **6.10.3** Create curation UI
- [x] **6.10.4** Create review workflow UI
- [x] **6.10.5** Add annotation tools

### 6.11 Sophia Client SDK

- [x] **6.11.1** Create libs/sophia/client/ project
- [x] **6.11.2** Add project.json with scope:sophia, layer:clients tags
- [x] **6.11.3** Generate TypeScript client from OpenAPI
- [x] **6.11.4** Create @oshun/sophia-client package
- [x] **6.11.5** Add search helpers
- [x] **6.11.6** Add citation retrieval helpers
- [x] **6.11.7** Add document ingestion helpers

### 6.12 Sophia Database Schema

- [x] **6.12.1** Create libs/sophia/database/ project
- [x] **6.12.2** Add project.json with scope:sophia, layer:data tags
- [x] **6.12.3** Define Prisma schema for Sophia:
  - [x] Document model
  - [x] DocumentChunk model
  - [x] Citation model
  - [x] Entity model
  - [x] Relation model
  - [x] KnowledgePack model
  - [x] IngestionJob model
- [x] **6.12.4** Create migrations
- [x] **6.12.5** Add seed data

### 6.13 Knowledge Stack Convergence (from Lilith)

- [x] **6.13.1** Audit lilith/services/spiritual-embeddings for migration
  - OpenAI/HuggingFace embedding providers
  - Hash-based fallback for development
  - Batch embedding generation
- [x] **6.13.2** Audit lilith/services/knowledge-access for migration
  - ContentBundle, AccessPolicy, AccessPass models
  - Token-gated access control
  - IPFS storage integration
- [x] **6.13.3** Plan convergence of lilith knowledge services to Sophia
  - Created CONVERGENCE_PLAN.md in libs/sophia/
  - Data model mappings defined
  - Entity type and relation type mappings
- [x] **6.13.4** Create migration scripts for existing knowledge data
  - migrate-lilith-knowledge.ts in database/prisma/
  - Migrates traditions, concepts, figures, practices, texts, places
  - Creates cross-tradition relationships
- [x] **6.13.5** Update Lilith services to consume Sophia APIs
  - Created @lilith/sophia-adapter library
  - KnowledgeAccessAdapter for ContentBundle/AccessPolicy/AccessPass mapping
  - KnowledgeGraphAdapter for Entity/Relation mapping
  - EmbeddingAdapter for embedding API mapping

---

