AI DOSSIER / 10 / MVP IMPLEMENTATION PLAN / 2026
План реализации Dossier MVP.
Финальный документ mini-серии Dossier. Он переводит canonical model, timeline, conflicts, merge, API, permissions, projections, failure handling и benchmark discipline в конкретный coding roadmap для server2.
Главное правило: сначала реализовать минимальный canonical Dossier Core на Postgres и проверить его end-to-end. TriliumNext/OpenCTI/Aleph подключать только как projection после benchmark, а не как фундамент модели.
1. Repository layout
ai-dossier/
├── pyproject.toml
├── README.md
├── config/
│ ├── dossier.yaml
│ ├── permissions.yaml
│ └── projections.yaml
├── migrations/
├── src/ai_dossier/
│ ├── api/
│ │ ├── dossiers.py
│ │ ├── entities.py
│ │ ├── sources.py
│ │ ├── claims.py
│ │ ├── evidence.py
│ │ ├── timeline.py
│ │ ├── conflicts.py
│ │ ├── questions.py
│ │ ├── merge.py
│ │ └── export.py
│ ├── domain/
│ │ ├── dossier.py
│ │ ├── entity.py
│ │ ├── source.py
│ │ ├── claim.py
│ │ ├── evidence.py
│ │ ├── event.py
│ │ ├── conflict.py
│ │ ├── question.py
│ │ └── version_scope.py
│ ├── services/
│ │ ├── dossier_service.py
│ │ ├── identity_service.py
│ │ ├── timeline_service.py
│ │ ├── conflict_service.py
│ │ ├── merge_service.py
│ │ └── context_export_service.py
│ ├── storage/
│ │ ├── repositories.py
│ │ └── attachments.py
│ ├── projections/
│ │ ├── base.py
│ │ ├── fake.py
│ │ ├── trilium.py
│ │ ├── opencti.py
│ │ └── aleph.py
│ ├── integrations/
│ │ ├── researcher.py
│ │ ├── curator.py
│ │ ├── writer.py
│ │ └── source_watch.py
│ ├── security/
│ ├── audit/
│ └── cli.py
└── tests/
├── unit/
├── golden/
├── integration/
├── security/
├── failure/
└── migration/
2. Порядок разработки
PHASE 0
Domain + migrations
↓
PHASE 1
Canonical CRUD + provenance
↓
PHASE 2
Timeline + conflicts + questions
↓
PHASE 3
Versioning + supersede + merge
↓
PHASE 4
API/MCP + permissions + audit
↓
PHASE 5
Integrations with ИИшка modules
↓
PHASE 6
Projection adapter interface
↓
PHASE 7
Benchmark real candidates
↓
SHADOW/REAL WORKFLOW
3. Phase 0 — Domain + DB
Implement models
Dossier Entity EntityAlias Relation SourceRef DocumentRef ClaimRef EvidenceBundle EvidenceLink TimelineEvent Conflict OpenQuestion VersionScope SupersedeEdge ResearchRunRef CuratorDecisionRef ProjectionMapping AuditEvent
Migrations
001_dossiers 002_entities_relations 003_sources_documents 004_claims_evidence 005_timeline 006_conflicts_questions 007_versions_supersede 008_integrations 009_projection_mapping 010_audit
DoD
[ ] schema applies clean [ ] rollback tested [ ] canonical IDs generated by us [ ] JSON round-trip [ ] object revision field mandatory [ ] foreign keys/provenance constraints active
4. Phase 1 — Canonical CRUD
Build
dossier.create/get/search entity add/update relation add source add document ref add claim add evidence bundle add context export basic
Critical rules
- expected_revision on writes;
- idempotency key;
- actor/origin stored;
- archived dossier read-only;
- broken provenance rejected;
- external IDs non-canonical.
5. Phase 2 — Timeline / conflicts / questions
Timeline
occurred_at discovered_at precision version scope entities claims sources status
Conflict
create classify resolve defer preserve both sides
Open questions
open researching resolved deferred closed_unanswered
DoD
Writer context export должен уже уметь показывать chronology, unresolved conflicts и open questions.
6. Phase 3 — Versioning / supersede / merge
Implement
VersionScope matcher CURRENT/HISTORICAL classification FULL/PARTIAL/SCOPE_ONLY supersede entity duplicate candidate detection transactional merge alias redirects merge rollback
Must test
same model name / different vendor 3.1 vs 3.2 scope partial supersede merge crash duplicate document by hash timeline rebuild conflict preservation
7. Phase 4 — API / permissions / audit
Roles
Writer Researcher Curator SourceWatch Human Admin
Endpoints/tools
create/get/search add_entity add_source add_claim add_evidence add_event add_conflict add_open_question attach_research_run attach_curator_decision export_context merge archive/reopen export/import
Audit
Merge, archive/reopen, import, Curator link и all provenance-relevant mutations обязаны создавать audit event.
8. Phase 5 — ИИшка integrations
Researcher
get current context get open questions append research result attach ResearchRunRef
Writer
read-only ContextPack current claims timeline conflicts sources open questions
Curator
read evidence attach REJECT/RUN_ONLY/PROMOTE ref never write permanent knowledge through Dossier
Source Watch
append SOURCE_CHANGE event append new SourceRef open question if materially changed
Skeptic
optional read-only scoped context for claim verification
9. Phase 6 — Projection layer
Start with fake adapter
ProjectionAdapter upsert_dossier upsert_entity upsert_source upsert_claim upsert_event upsert_conflict archive_dossier health
Projection queue
PENDING → APPLYING → APPLIED or → FAILED → RETRY
Then real spikes
TriliumNext adapter OpenCTI adapter Aleph adapter Only one needs production implementation after benchmark/ADR.
10. Rollout on server2
STEP 1 Postgres canonical core only STEP 2 fixture/golden data STEP 3 Researcher integration STEP 4 Writer read-only context STEP 5 Curator decision refs STEP 6 Source Watch-compatible event path STEP 7 real dossier on one technical topic STEP 8 run benchmark: TriliumNext / OpenCTI / Aleph / baseline STEP 9 write ADR STEP 10 implement only winning projection, or stay baseline-only
Baseline-only is a valid outcome. Не требуется обязательно внедрять один из найденных проектов.
11. Test pyramid
| Layer | Coverage |
|---|---|
| Unit | models, scope matcher, lifecycle, permissions |
| Golden | version/conflict/merge scenarios |
| Integration | Researcher→Dossier→Writer |
| Security | role bypass, injection, archive bypass |
| Failure | DB/backend/projection outage, crash merge |
| Migration | export/import + schema upgrades |
| Projection | canonical↔vendor mapping |
Release blockers
lost provenance = 0 silent historical overwrite = 0 silent merge data loss = 0 unauthorized writes = 0 archive bypass = 0 restore mismatch = 0 vendor ID leakage as canonical = 0
12. Definition of Dossier MVP Done
[ ] canonical Postgres schema [ ] Dossier lifecycle works [ ] Entity/Relation works [ ] SourceRef/DocumentRef works [ ] Claims work [ ] EvidenceBundle works [ ] Timeline works [ ] occurred/discovered time separate [ ] Conflicts retained [ ] OpenQuestions work [ ] VersionScope works [ ] Supersede works [ ] historical state preserved [ ] merge transactional [ ] archive/reopen works [ ] Writer read-only integration [ ] Researcher working-write integration [ ] Curator decision refs [ ] Source Watch event path [ ] optimistic concurrency [ ] idempotency [ ] audit [ ] export/import [ ] backup/restore [ ] failure/security tests pass [ ] projection adapter interface [ ] practical benchmark completed on server2 [ ] ADR written from real results [ ] no direct permanent-RAG write [ ] no vendor backend lock-in
После MVP — не раньше
graph UI vector search automatic entity resolution cross-dossier contradiction mining multiple simultaneous projections semantic dossier clustering LLM-generated merge proposals
Mini-серия Dossier завершена. Следующий модуль по исходной очереди Additional — Source Watch. Его нужно начинать отдельной mini-серией с reuse-first research, не смешивая реализацию с Dossier.