Sync Architecture MoE Evaluation
CODITECT Sync Architecture - MoE Evaluation Report
Date: 2025-12-29
Status: Complete
Outcome: ADR-044 - Custom REST Sync Architecture
Executive Summary
A Mixture of Experts (MoE) evaluation was conducted to select the optimal sync architecture for CODITECT's context memory system. Four specialized judges evaluated four architecture options across technical, legal, operational, and financial dimensions.
Winner: Option D (SQLite + Custom REST Sync) with weighted score of 7.49/10
Key Finding: PowerSync (Option B) is legally disqualified due to FSL license "Competing Use" restrictions.
Evaluation Framework
MoE Judge Panel
| Judge | Specialization | Key Criteria |
|---|
| Judge 1 | Technical Architecture | Scalability, reliability, integration, future-proofing |
| Judge 2 | License & Security | Legal risk, compliance, vendor dependency, attack surface |
| Judge 3 | Operations | Deployment complexity, maintenance, disaster recovery |
| Judge 4 | Cost-Benefit | Development cost, infrastructure, TCO, time-to-market |
Options Evaluated
| Option | Architecture | Key Technology |
|---|
| A | PostgreSQL-Everywhere | postgresql-embedded + pglogical |
| B | SQLite + PowerSync | PowerSync (FSL license) |
| C | SQLite + ElectricSQL | ElectricSQL (Apache 2.0) |
| D | SQLite + Custom REST | FastAPI/Django REST API |
Consolidated Scoring Matrix
| Judge | Option A | Option B | Option C | Option D |
|---|
| Technical (15%) | 8.10 | 7.70 | 8.40 | 6.15 |
| License/Security (30%) | 8.80 | 4.65 ⛔ | 8.25 | 8.85 ✅ |
| Operations (25%) | 7.05 | 5.00 | 6.55 | 7.75 ✅ |
| Cost-Benefit (30%) | 4.85 | 6.95 | 5.15 | 7.20 ✅ |
| WEIGHTED TOTAL | 7.20 | 6.08 | 7.09 | 7.49 ✅ |
Ranking by Weighted Score
- Option D (Custom REST Sync) - 7.49/10 ✅ RECOMMENDED
- Option A (PostgreSQL-Everywhere) - 7.20/10
- Option C (ElectricSQL) - 7.09/10
- Option B (PowerSync) - 6.08/10 ⛔ DISQUALIFIED (License)
Judge 1: Technical Architecture Evaluation
Detailed Scores
| Criterion (Weight) | Option A | Option B | Option C | Option D |
|---|
| Architectural Elegance (15%) | 7/10 | 8/10 | 9/10 | 6/10 |
| Scalability (20%) | 9/10 | 8/10 | 8/10 | 7/10 |
| Reliability (20%) | 9/10 | 8/10 | 7/10 | 5/10 |
| Maintainability (15%) | 6/10 | 7/10 | 8/10 | 4/10 |
| Integration Fit (15%) | 8/10 | 9/10 | 9/10 | 7/10 |
| Future Proofing (15%) | 9/10 | 6/10 | 10/10 | 8/10 |
| TOTAL | 8.10 | 7.70 | 8.40 | 6.15 |
Key Findings
- ElectricSQL leads technically (8.4/10) - CRDT conflict resolution, elegant 2-component architecture
- Custom REST lowest technical score (6.15/10) - but acceptable for CODITECT's current scale
- PostgreSQL-Everywhere overkill - 50-100MB client install vs 1MB SQLite
Judge 2: License & Security Assessment
Detailed Scores
| Criterion (Weight) | Option A | Option B | Option C | Option D |
|---|
| License Safety (30%) | 9/10 | 3/10 ⛔ | 10/10 | 10/10 |
| Data Security (25%) | 10/10 | 8/10 | 9/10 | 9/10 |
| Compliance Readiness (20%) | 10/10 | 6/10 | 8/10 | 9/10 |
| Vendor Risk (15%) | 7/10 | 2/10 ⛔ | 5/10 | 9/10 |
| Attack Surface (10%) | 8/10 | 7/10 | 7/10 | 6/10 |
| TOTAL | 8.80 | 4.65 ⛔ | 8.25 | 8.85 ✅ |
Critical Finding: PowerSync License
FSL "Competing Use" clause is a legal minefield:
"You may not use the Software for any Competing Use. 'Competing Use' means making available any product or service that substitutes for the Products."
- JourneyApps offers no-code mobile app builder with offline sync
- CODITECT's development platform could be interpreted as competing
- Legal risk of license violation unacceptable for SaaS
- Score: 3/10 for License Safety = DISQUALIFIED
ElectricSQL Concern
- Development paused November 2024
- Apache 2.0 license is safe, but maintenance burden unknown
- Score reduced from 10/10 to 5/10 for Vendor Risk
Judge 3: Operational Complexity
Detailed Scores
| Criterion (Weight) | Option A | Option B | Option C | Option D |
|---|
| Deployment Complexity (25%) | 6/10 | 3/10 | 5/10 | 8/10 |
| Client Installation (15%) | 4/10 | 9/10 | 9/10 | 9/10 |
| Monitoring & Observability (20%) | 9/10 | 5/10 | 6/10 | 8/10 |
| Disaster Recovery (20%) | 9/10 | 6/10 | 7/10 | 8/10 |
| Scaling Operations (10%) | 7/10 | 4/10 | 6/10 | 7/10 |
| Maintenance Burden (10%) | 8/10 | 4/10 | 6/10 | 7/10 |
| TOTAL | 7.05 | 5.00 | 6.55 | 7.75 ✅ |
Key Findings
- Custom REST simplest topology - 3 services (Django, PostgreSQL, Redis)
- PowerSync most complex - 5 services (Django, PostgreSQL, PowerSync, Redis, MongoDB)
- Client installation parity - SQLite options all ~1MB vs 50-100MB for PostgreSQL-embedded
Judge 4: Cost-Benefit Analysis
5-Year Total Cost of Ownership
| Component | Option A | Option B | Option C | Option D |
|---|
| Development | $45,000 | $15,000 | $30,000 | $18,000 |
| Infrastructure (5yr) | $36,000 | $17,700 | $12,000 | $3,000 |
| Maintenance (5yr) | $60,000 | $36,000 | $108,000 | $25,200 |
| TOTAL TCO | $117,000 | $54,300 | $150,000 | $41,400 ✅ |
Time to Market
| Option | Implementation Time | Meets Dec 2025 Pilot? |
|---|
| A: PostgreSQL-Everywhere | 19 weeks | ❌ No |
| B: PowerSync | 6 weeks | ⛔ Disqualified |
| C: ElectricSQL | 10 weeks | ❌ No |
| D: Custom REST | 8 weeks | ✅ Achievable |
Cost-Benefit Scores
| Criterion (Weight) | Option A | Option B | Option C | Option D |
|---|
| Development Cost (25%) | 4/10 | 8/10 | 5/10 | 7/10 |
| Infrastructure Cost (20%) | 6/10 | 4/10 | 7/10 | 9/10 |
| Maintenance Cost (20%) | 5/10 | 7/10 | 4/10 | 6/10 |
| Time to Market (15%) | 3/10 | 9/10 | 4/10 | 7/10 |
| Business Value (10%) | 7/10 | 8/10 | 7/10 | 6/10 |
| 5-Year TCO (10%) | 5/10 | 6/10 | 4/10 | 8/10 |
| TOTAL | 4.85 | 6.95 | 5.15 | 7.20 ✅ |
Decision Rationale
Why Custom REST Sync (Option D)?
- Best weighted score (7.49/10) across all judges
- Lowest 5-year TCO ($41,400) - $12,900 less than PowerSync
- Zero legal risk - no third-party sync library licenses
- Simplest operations - 3 services, familiar Django/FastAPI stack
- Full control - custom sync logic, no vendor lock-in
- Achievable timeline - 8 weeks fits pilot launch
Why NOT the Others?
| Option | Reason for Rejection |
|---|
| A: PostgreSQL-Everywhere | 50-100MB client install too heavy; 19-week timeline misses pilot |
| B: PowerSync | FSL license legally disqualifying - "Competing Use" risk |
| C: ElectricSQL | Development paused (Nov 2024); highest TCO ($150K); maintenance risk |
Implementation Recommendation
Phase 1: Backend API (Weeks 1-2)
- FastAPI/Django sync endpoints
- PostgreSQL schema with
tenant_id
- JWT authentication integration
Phase 2: Conflict Resolution (Weeks 3-4)
- Last-write-wins with timestamps
- Content-hash deduplication
- Soft delete support
Phase 3: Client Library (Weeks 5-6)
- Python sync client with retry logic
- Background sync daemon
- Offline queue management
Phase 4: Testing (Weeks 7-8)
- Integration tests
- Load testing (100+ concurrent clients)
- Security review
Risk Mitigation
| Risk | Probability | Impact | Mitigation |
|---|
| Timeline overrun | Medium | High | Start immediately; reduce scope if needed |
| Conflict resolution bugs | Medium | Medium | Comprehensive test suite |
| Scaling bottlenecks | Low | Medium | Cloud Run auto-scales |
| Security vulnerabilities | Low | High | Third-party pentest ($15-25K) |
Appendix: Judge Weighting Methodology
| Judge | Weight | Rationale |
|---|
| License & Security | 30% | Legal risk is existential for SaaS |
| Cost-Benefit | 30% | Budget constraints critical for pilot |
| Operations | 25% | DevOps capacity limited |
| Technical | 15% | All options technically viable |
Total: 100%
References
Evaluation Completed: 2025-12-29
Decision Document: ADR-044
Confidence Level: 85% (High)
Review Date: Q1 2026 (post-pilot)