Wiki source code of Architecture

Version 4.1 by Robert Schaub on 2025/12/12 08:32

Hide last authors
Robert Schaub 1.1 1 = Architecture =
2
3 FactHarbor uses a modular-monolith architecture (POC → Beta 0) designed to evolve into a distributed, federated, multi-node system (Release 1.0+).
4 Modules are strongly separated, versioned, and auditable. All logic is transparent and deterministic.
5
Robert Schaub 4.1 6 == High-Level System Architecture ==
Robert Schaub 1.1 7
8 FactHarbor is composed of the following major modules:
9
10 * **UI Frontend**
11 * **REST API Layer**
12 * **Core Logic Layer**
Robert Schaub 4.1 13 ** Claim Processing
14 ** Scenario Engine
15 ** Evidence Repository
16 ** Verdict Engine
17 ** Re-evaluation Engine
18 ** Roles / Identity / Reputation
Robert Schaub 1.1 19 * **AKEL (AI Knowledge Extraction Layer)**
20 * **Federation Layer**
21 * **Workers & Background Jobs**
22 * **Storage Layer (Postgres + VectorDB + ObjectStore)**
23
Robert Schaub 3.1 24 {{include reference="FactHarbor.Specification.Diagrams.High-Level Architecture.WebHome"/}}
Robert Schaub 1.1 25
26 Key ideas:
27
Robert Schaub 4.1 28 * Core logic is deterministic, auditable, and versioned.
29 * AKEL drafts structured outputs but never publishes directly.
30 * Workers run long or asynchronous tasks.
31 * Storage is separated for scalability and clarity.
32 * Federation Layer provides optional distributed operation.
Robert Schaub 1.1 33
Robert Schaub 4.1 34 == Storage Architecture ==
Robert Schaub 1.1 35
36 FactHarbor separates structured data, embeddings, and evidence files:
37
Robert Schaub 4.1 38 * **PostgreSQL** — canonical structured entities, all versioning, lineage, signatures.
39 * **Vector DB (Qdrant or pgvector)** — semantic search, duplication detection, cluster mapping.
40 * **Object Storage** — PDFs, datasets, raw evidence, transcripts.
41 * **Optional (Release 1.0)**: Redis for caching, IPFS for decentralized object storage.
Robert Schaub 1.1 42
Robert Schaub 3.1 43 {{include reference="FactHarbor.Specification.Diagrams.Storage Architecture.WebHome"/}}
Robert Schaub 1.1 44
Robert Schaub 4.1 45 == Core Backend Module Architecture ==
Robert Schaub 1.1 46
47 Each module has a clear responsibility and versioned boundaries to allow future extraction into microservices.
48
Robert Schaub 4.1 49 === Claim Processing Module ===
Robert Schaub 1.1 50
51 Responsibilities:
52
Robert Schaub 4.1 53 * Ingest text, URLs, documents, transcripts, federated input
54 * Extract claims (AKEL-assisted)
55 * Normalize structure
56 * Classify (type, domain, evaluability, safety)
57 * Deduplicate via embeddings
58 * Assign to claim clusters
Robert Schaub 1.1 59
Robert Schaub 4.1 60 Flow: **Ingest → Normalize → Classify → Deduplicate → Cluster**
Robert Schaub 1.1 61
Robert Schaub 4.1 62 === Scenario Engine ===
Robert Schaub 1.1 63
64 Responsibilities:
65
Robert Schaub 4.1 66 * Create and validate scenarios
67 * Enforce required fields (definitions, assumptions, boundaries...)
68 * Perform safety checks (AKEL-assisted)
69 * Manage versioning and lifecycle
70 * Provide contextual evaluation settings to the Verdict Engine
Robert Schaub 1.1 71
Robert Schaub 4.1 72 Flow: **Create → Validate → Version → Lifecycle → Safety**
Robert Schaub 1.1 73
Robert Schaub 4.1 74 === Evidence Repository ===
Robert Schaub 1.1 75
76 Responsibilities:
77
Robert Schaub 4.1 78 * Store metadata + files (object store)
79 * Classify evidence
80 * Compute preliminary reliability
81 * Maintain version history
82 * Detect retractions or disputes
83 * Provide structured metadata to the Verdict Engine
Robert Schaub 1.1 84
Robert Schaub 4.1 85 Flow: **Store → Classify → Score → Version → Update/Retract**
Robert Schaub 1.1 86
Robert Schaub 4.1 87 === Verdict Engine ===
Robert Schaub 1.1 88
89 Responsibilities:
90
Robert Schaub 4.1 91 * Aggregate scenario-linked evidence
92 * Compute likelihood ranges **per scenario**
93 * Generate reasoning chain
94 * Track uncertainty factors
95 * Maintain verdict version timelines
Robert Schaub 1.1 96
Robert Schaub 4.1 97 Flow: **Aggregate → Compute → Explain → Version → Timeline**
Robert Schaub 1.1 98
Robert Schaub 4.1 99 === Re-evaluation Engine ===
Robert Schaub 1.1 100
101 Responsibilities:
102
Robert Schaub 4.1 103 * Listen for upstream changes
104 * Trigger partial or full recomputation
105 * Update verdicts + summary views
106 * Maintain consistency across federated nodes
Robert Schaub 1.1 107
108 Triggers include:
109
Robert Schaub 4.1 110 * Evidence updated or retracted
111 * Scenario definition or assumption changes
112 * Claim type or evaluability changes
113 * Contradiction detection
114 * Federation sync updates
Robert Schaub 1.1 115
Robert Schaub 4.1 116 Flow: **Trigger → Impact Analysis → Recompute → Publish Update**
Robert Schaub 1.1 117
Robert Schaub 4.1 118 == AKEL Integration Summary ==
Robert Schaub 1.1 119
Robert Schaub 4.1 120 AKEL is fully documented in its own chapter. Here is only the architectural integration summary:
Robert Schaub 1.1 121
Robert Schaub 4.1 122 * Receives raw input for claims
123 * Proposes scenario drafts
124 * Extracts and summarizes evidence
125 * Gives reliability hints
126 * Suggests draft verdicts
127 * Monitors contradictions
128 * Syncs metadata with trusted nodes
Robert Schaub 1.1 129
130 AKEL runs in parallel to human review — never overrides it.
131
Robert Schaub 3.1 132 {{include reference="FactHarbor.Specification.Diagrams.AKEL Architecture.WebHome"/}}
Robert Schaub 1.1 133
Robert Schaub 4.1 134 == Federated Architecture ==
Robert Schaub 1.1 135
136 Each FactHarbor node:
137
Robert Schaub 4.1 138 * Has its own dataset (claims, scenarios, evidence, verdicts)
139 * Runs its own AKEL
140 * Maintains local governance and reviewer rules
141 * May partially mirror global or domain-specific data
142 * Contributes to global knowledge clusters
Robert Schaub 1.1 143
144 Nodes synchronize via:
145
Robert Schaub 4.1 146 * Signed version bundles
147 * Merkle-tree lineage structures
148 * Optionally IPFS for evidence
149 * Trust-weighted acceptance
Robert Schaub 1.1 150
151 Benefits:
152
Robert Schaub 4.1 153 * Community independence
154 * Scalability
155 * Resilience
156 * Domain specialization
Robert Schaub 1.1 157
Robert Schaub 3.1 158 {{include reference="FactHarbor.Specification.Diagrams.Federation Architecture.WebHome"/}}
Robert Schaub 1.1 159
Robert Schaub 4.1 160 == Request → Verdict Flow ==
Robert Schaub 1.1 161
162 Simple end-to-end flow:
163
Robert Schaub 4.1 164 1. User
165 2. UI Frontend
166 3. REST API
167 4. FactHarbor Core (Processing)
168 5. Summary View
169 6. UI Frontend
170 7. User
Robert Schaub 1.1 171
Robert Schaub 4.1 172 == Federation Sync Workflow ==
Robert Schaub 1.1 173
174 Sequence:
175
Robert Schaub 4.1 176 1. Detect Local Change
177 2. Build Signed Bundle
178 3. Push to Peers
179 4. Validate Signature
180 5. Merge or Fork
181 6. Trigger Re-evaluation
Robert Schaub 1.1 182
Robert Schaub 4.1 183 == Versioning Architecture ==
Robert Schaub 1.1 184
185 All entities (Claim, Scenario, Evidence, Verdict) use immutable version chains:
186
Robert Schaub 4.1 187 * VersionID
188 * ParentVersionID
189 * Timestamp
190 * AuthorType (Human, AI, ExternalNode)
191 * ChangeReason
192 * Signature (optional POC, required in 1.0)
Robert Schaub 1.1 193
Robert Schaub 3.1 194 {{include reference="FactHarbor.Specification.Diagrams.Versioning Architecture.WebHome"/}}