AI CURATOR / 16 / MVP IMPLEMENTATION PLAN / 2026
План реализации Curator MVP.
Пошаговый coding plan для реализации engine-neutral архитектуры Curator: пакеты, порядок разработки, migration points, tests и Definition of Curator MVP Done.
Главное правило: не начинать с Cognee/RAGFlow integration. Сначала control plane и contract tests, затем выбранный storage adapter.
1. Repository layout
ai-curator/
├── pyproject.toml
├── migrations/
├── config/
├── src/ai_curator/
│ ├── api/
│ ├── domain/
│ ├── policy/
│ ├── provenance/
│ ├── storage/adapters/
│ ├── promotion/
│ ├── review/
│ ├── audit/
│ ├── security/
│ └── cli.py
└── tests/
├── unit/
├── golden/
├── integration/
└── security/2. Последовательность
PHASE 0 Domain schemas + control DB ↓ PHASE 1 Policy Engine ↓ PHASE 2 Provenance / Docling ↓ PHASE 3 API + permissions + audit ↓ PHASE 4 Promotion transaction + verification + rollback ↓ PHASE 5 Storage adapter ↓ PHASE 6 Golden / security / lifecycle tests ↓ SHADOW MVP ↓ LIMITED PRODUCTION
3. Phase 0 — Domain + control DB
Реализовать: SourceRecord, CanonicalDocument, PassageRecord, KnowledgeItem, VersionScope, FreshnessState, ConflictRecord, SupersedeLink, PolicyDecision, PromotionManifest, ReviewCase, AuditEvent.
tables: sources documents passages knowledge_items knowledge_support version_scopes freshness_states conflicts supersede_links policy_decisions promotion_manifests review_cases audit_events write_transactions verification_results rollback_records
[ ] migrations clean [ ] schemas round-trip JSON [ ] canonical IDs owned by Curator [ ] vendor IDs external only [ ] UNKNOWN version supported
4. Phase 1 — Policy Engine
gates: 1 provenance 2 rights 3 authority 4 applicability 5 version 6 conflict 7 dedup 8 risk 9 reuse_value
Каждый gate выдаёт structured result + reason codes. Не делать единый LLM prompt «реши PROMOTE».
{
"decision":"PROMOTE|RUN_ONLY|REJECT|HUMAN_REVIEW",
"gate_results":{},
"rule_hits":[],
"limitations":[],
"reason_codes":[],
"policy_version":"..."
}5. Phase 2 — Provenance / Docling
raw source → SourceRecord → Docling conversion → CanonicalDocument → PassageRecord[] → hashes → page/source refs → lineage → control DB
- source → passage trace;
- page refs;
- parser version saved;
- reparse lineage;
- malformed source isolation.
6. Phase 3 — API, permissions, audit
READ: search get_knowledge get_provenance get_source get_conflicts get_version_history CONTROL: propose_candidate evaluate_candidate promote reject mark_run_only mark_stale supersede rollback_promotion
Writer = read Researcher = read + propose Curator = controlled write Reviewer = review resolution Admin = destructive maintenance
Никаких shared admin credentials между агентами.
7. Phase 4 — Promotion transaction
validate PolicyDecision → validate PromotionManifest → idempotency lock → begin transaction → persist governance state → write storage adapter → retrieval verification → audit commit → mark CURRENT
states: PENDING WRITING VERIFYING CURRENT FAILED_WRITE FAILED_VERIFICATION ROLLED_BACK
8. Phase 5 — Storage adapter
health upsert_source upsert_document upsert_passages upsert_knowledge_items retrieve retrieve_by_id update_status supersede remove_from_current_retrieval backup restore verify_capabilities
- не содержит policy;
- не решает rights/conflicts;
- не создаёт canonical IDs;
- не выдаёт admin API агентам;
- проходит contract tests.
9. Rollout
1 local dev with fake adapter 2 golden tests with fixture 3 chosen storage adapter 4 server2 shadow mode 5 isolated benchmark namespace 6 read comparison vs existing Technical RAG 7 limited topics 8 Curator-only permanent writes 9 monitor regressions 10 MVP acceptance
Rollback point существует на каждом шаге.
10. Test pyramid
| Layer | Tests |
|---|---|
| Unit | schemas, gates, version logic |
| Golden | REJECT/RUN_ONLY/PROMOTE/REVIEW |
| Contract | storage adapters |
| Integration | promotion, verification, rollback |
| Security | permissions, bypass, idempotency |
| Failure | DB/index/Qwen/service failures |
release blockers: false unsafe promotion = 0 direct write bypass = 0 lost provenance = 0 false full supersede critical = 0 silent data loss = 0 critical idempotency = 100%
11. Definition of Curator MVP Done
[ ] Researcher submits candidate [ ] structured PolicyDecision [ ] REJECT works [ ] RUN_ONLY works [ ] HUMAN_REVIEW works [ ] PROMOTE requires gates [ ] provenance survives promotion [ ] version/applicability stored [ ] conflicts preserved [ ] duplicates handled [ ] PromotionManifest generated [ ] permanent write only through Curator [ ] Writer/Researcher direct write blocked [ ] retrieval verification after write [ ] failed verification rolls back [ ] partial supersede works [ ] stale state works [ ] promotion rollback works [ ] audit complete [ ] chosen adapter passes contract tests [ ] golden/security tests pass [ ] backup/restore tested [ ] server2 shadow run completed [ ] no critical unsafe promotion
MVP не требует
Graphiti full UI automatic source watching complex reputation model multi-engine federation distributed workers
Итог mini-серии: Curator спроектирован до MVP implementation plan. Теперь следующий правильный шаг — фактическая реализация + benchmark на server2; после реальных результатов — окончательный ADR.