AI SOURCE WATCH / 09 / MVP ARCHITECTURE / 2026

Source Watch MVP: единая архитектура мониторинга.

Сборка всех предыдущих решений в единый Source Watch control plane: canonical watch registry, scheduler, adapters, snapshot/diff storage, deterministic + semantic classification, freshness policy, routing, security и audit.

Главное правило: changedetection.io, urlwatch, GitHub, RSSHub и Docling — adapter layer. Canonical `WatchTarget`, `SourceSnapshot`, `ChangeEvent`, freshness и routing остаются нашей моделью.

1. Логическая схема

Watch Sources
   |
   +-- HTML/JSON
   +-- GitHub
   +-- RSS/Atom
   +-- PDF/Documents
   |
   v
+----------------------------------+
| SOURCE WATCH API / MCP           |
+----------------------------------+
               |
               v
+----------------------------------+
| WATCH REGISTRY                   |
| canonical watch/source IDs       |
+----------------------------------+
               |
               v
+----------------------------------+
| SCHEDULER / QUEUES               |
| priority / jitter / backoff      |
+----------------------------------+
               |
               v
+----------------------------------+
| ADAPTER LAYER                    |
| changedetection / urlwatch       |
| GitHub / RSS / Docling           |
+----------------------------------+
               |
               v
+----------------------------------+
| SNAPSHOT + DIFF STORE            |
+----------------------------------+
               |
               v
+----------------------------------+
| CHANGE CLASSIFIER                |
| deterministic first              |
| Qwen selective                   |
+----------------------------------+
               |
               v
+----------------------------------+
| FRESHNESS + SIGNIFICANCE POLICY  |
+----------------------------------+
               |
         +-----+------+------+
         |            |      |
         v            v      v
      Dossier     Researcher Curator
                               stale-check
               |
               v
+----------------------------------+
| AUDIT / HEALTH / RECONCILIATION  |
+----------------------------------+

2. Core services

ServiceResponsibility
WatchRegistryServicewatch lifecycle, canonical IDs, policies
SchedulerServicedue selection, jitter, priority, backoff
FetchCoordinatoradapter execution and leases
SnapshotServiceimmutable snapshot metadata/content refs
DiffServicehash/text/structured diffs
ChangeClassifiertechnical + semantic classification
FreshnessServicefresh/aging/stale/health
RoutingServiceDossier/Researcher/Curator routes
ReconciliationServicecanonical vs external watcher state
AuditServiceimmutable events/security trace

3. Adapter architecture

WatchAdapter

create_watch()
update_watch()
delete_watch()
fetch_now()
health()
export_state()

Concrete adapters

GenericWebAdapter
  → changedetection.io OR urlwatch

GitHubAdapter
  → webhooks + REST polling fallback

FeedAdapter
  → native RSS/Atom
  → RSSHub when needed

DocumentAdapter
  → fetch + Docling parse + structured diff

Boundary rule

Adapter возвращает fetch/diff data. Он не определяет `CONTENT_MAJOR`, `RETRACTION`, freshness или Curator routing.

4. End-to-end flow

1. Watch becomes due
2. scheduler acquires lease
3. adapter fetches
4. SSRF/security validation
5. snapshot normalized
6. compare hashes
7. if changed → diff
8. deterministic classifier
9. Qwen only if ambiguous
10. significance + freshness update
11. ChangeEvent commit
12. transactional route jobs
13. Dossier / Researcher / Curator
14. audit
15. schedule next run

Fast no-change path

ETag/304
or same normalized hash

→ update last_checked
→ no expensive diff/Qwen
→ schedule next

5. Canonical storage

Postgres

watch_targets
watch_revisions
watch_runs
source_snapshots
diffs
change_events
source_health
freshness_states
route_jobs
external_events
adapter_mappings
retention_holds
audit_events

Object/file storage

raw response bodies
PDF/documents
normalized text
Docling JSON
large structured diffs

Rules

6. Scheduler + resource control

QUEUE_HTTP
QUEUE_BROWSER
QUEUE_DOCUMENT
QUEUE_SEMANTIC
QUEUE_ROUTING

server2-aware throttling

Qwen 30B priority

if load high:
↓ browser concurrency
↓ Docling concurrency
↓ semantic queue concurrency

keep:
webhooks
critical light HTTP checks

Lease / recovery

QUEUED
→ LEASED
→ RUNNING
→ COMPLETED

worker dies:
lease expires
→ bounded retry

7. Routing integration

Dossier

ChangeEvent
→ TimelineEvent SOURCE_CHANGE
→ source/entity/version refs

Researcher

CONTENT_MAJOR
VERSION_RELEASE
BREAKING_CHANGE
DEPRECATION
RETRACTION

→ research question
→ evidence gap

Curator

ChangeEvent
+ promoted knowledge link
+ intersecting scope
→ CuratorStaleCheckRequest

Writer

Writer не является direct route target Source Watch. Он получает актуализированный контекст через Dossier/Curator pipeline.

8. Security architecture

FetchSecurity:
scheme allowlist
DNS/IP validation
redirect validation
private-range deny
size limits
timeouts

WebhookSecurity:
HMAC validation
delivery dedup
source identity validation

ContentSecurity:
untrusted-data delimiters
no content-triggered tools

SecretSecurity:
secret refs only
redaction
domain-scoped credentials

Fail-closed

invalid signature
SSRF suspicion
snapshot hash corruption
audit failure for critical action
→ no commit/route as valid change

9. Deployment on server2

server2
|
+-- Qwen 30B
|
+-- source-watch-api
|
+-- source-watch-scheduler
|
+-- source-watch-worker-http
|
+-- source-watch-worker-heavy
|    browser / Docling
|
+-- postgres
|
+-- object storage/files
|
+-- optional:
     changedetection.io
     OR urlwatch runtime
     RSSHub

Preferred deployment principle

Direct GitHub/RSS events and cheap HTTP checks remain lightweight. Heavy browser/document jobs are isolated and concurrency-limited.

10. MVP — MUST HAVE

[ ] WatchTarget registry
[ ] canonical SourceRef mapping
[ ] scheduler + jitter
[ ] priorities
[ ] retry/backoff
[ ] HTTP adapter
[ ] GitHub event adapter
[ ] RSS/Atom adapter
[ ] Document/Docling path
[ ] one generic watcher adapter
[ ] immutable snapshots
[ ] normalized hashes
[ ] text/structured diff
[ ] ChangeEvent taxonomy
[ ] freshness/health
[ ] deterministic classifier
[ ] selective Qwen classifier
[ ] Dossier routing
[ ] Researcher routing
[ ] Curator stale-check routing
[ ] idempotency
[ ] webhook HMAC
[ ] SSRF protection
[ ] audit
[ ] retention
[ ] reconciliation
[ ] failure/security tests

11. DEFER after MVP

visual watch management UI
large distributed browser farm
automatic selector repair by LLM
cross-source semantic event clustering
automatic source discovery
multi-region schedulers
predictive freshness scheduling
full source reputation scoring
continuous article drafting from changes
Не превращать Source Watch в Researcher.

12. Definition of MVP Architecture Done

[ ] canonical control plane
[ ] watcher backend replaceable
[ ] specialized adapters separated
[ ] snapshots canonical
[ ] diff technical vs policy semantic split
[ ] deterministic-first
[ ] Qwen selective
[ ] freshness first-class
[ ] source health first-class
[ ] Dossier route
[ ] Researcher route
[ ] Curator stale-check
[ ] transactional routing
[ ] SSRF protection
[ ] webhook validation
[ ] secret isolation
[ ] queue separation
[ ] server2 throttling
[ ] audit
[ ] reconciliation
[ ] no direct permanent knowledge mutation
Следующий и последний документ серии: `AI_source_watch_10_план_реализации_MVP.html` — coding roadmap, repository layout, phases, benchmark/ADR, rollout и Definition of Source Watch MVP Done.