Last modified by Robert Schaub on 2026/02/08 08:31

Show last authors
1 {{info}}
2 **Current Implementation (v2.6.33)** - Single-context LLM analysis with tool calls, producing canonical schema output. File: ##monolithic-canonical.ts## (~1100 lines)
3 {{/info}}
4
5 = Monolithic Canonical Pipeline Internal Flow =
6
7 {{mermaid}}
8
9 flowchart TB
10 subgraph Entry[Entry Point]
11 INPUT[runMonolithicCanonical]
12 BUDGET[Initialize Budget maxIterations 5 maxSearches 8]
13 TIMEOUT[Start timeout 3 minutes]
14 end
15
16 subgraph Phase1[Phase 1: Claim Extraction]
17 EXTRACT[LLM Call ClaimExtractionSchema]
18 SCOPES[detectScopes heuristic fallback]
19 CLAIMS[Build subClaims array]
20 end
21
22 subgraph Phase2[Phase 2: Research Loop]
23 SEARCH[searchWebWithProvider]
24 FETCH[fetchSourceContent parallel]
25 FACTS[LLM Call FactExtractionSchema]
26 PROVENANCE[filterFactsByProvenance]
27 ITER_CHECK{Iteration limit?}
28 end
29
30 subgraph Phase3[Phase 3: Verdict Generation]
31 VERDICT[LLM Call VerdictSchema]
32 WEIGHT[calculateWeightedVerdictAverage]
33 HARM[detectHarmPotential]
34 CONTEST[detectClaimContestation]
35 end
36
37 subgraph Transform[Schema Transform]
38 CANONICAL[Transform to canonical schema]
39 REPORT[Generate markdown report]
40 end
41
42 subgraph Output[Output]
43 RESULT[resultJson canonical]
44 MARKDOWN[reportMarkdown]
45 end
46
47 subgraph Fallback[Fallback on Failure]
48 FALLBACK[Fall back to Orchestrated]
49 end
50
51 INPUT --> BUDGET
52 BUDGET --> TIMEOUT
53 TIMEOUT --> EXTRACT
54
55 EXTRACT --> SCOPES
56 SCOPES --> CLAIMS
57
58 CLAIMS --> SEARCH
59 SEARCH --> FETCH
60 FETCH --> FACTS
61 FACTS --> PROVENANCE
62 PROVENANCE --> ITER_CHECK
63 ITER_CHECK -->|No| SEARCH
64 ITER_CHECK -->|Yes| VERDICT
65
66 VERDICT --> WEIGHT
67 WEIGHT --> HARM
68 HARM --> CONTEST
69 CONTEST --> CANONICAL
70
71 CANONICAL --> REPORT
72 REPORT --> RESULT
73 REPORT --> MARKDOWN
74
75 EXTRACT -.->|Schema validation fail| FALLBACK
76 VERDICT -.->|Schema validation fail| FALLBACK
77
78 {{/mermaid}}
79
80 = Key Characteristics =
81
82 |= Feature |= Description
83 | **Single Context** | All analysis in one LLM conversation context
84 | **Structured Output** | Uses AI SDK ##Output.object## with Zod schemas
85 | **Canonical Schema** | Output compatible with existing Jobs UI
86 | **Fail Closed** | Falls back to Orchestrated pipeline on validation failure
87 | **Budget Enforcement** | Hard limits on iterations, searches, fetches, time
88
89 = Budget Configuration =
90
91 |= Parameter |= Value |= Purpose
92 | maxIterations | 5 | Maximum research iterations
93 | maxSearches | 8 | Maximum web searches
94 | maxFetches | 10 | Maximum source fetches
95 | timeoutMs | 180000 | 3 minute hard timeout
96
97 = Zod Schemas Used =
98
99 |= Schema |= Purpose
100 | ##ClaimExtractionSchema## | Extract mainClaim, claimType, searchQueries, subClaims, detectedScopes
101 | ##FactExtractionSchema## | Extract facts with source attribution
102 | ##VerdictSchema## | Generate verdicts with truthPercentage, confidence
103
104 = Shared Modules Used =
105
106 * ##scopes.ts## - detectScopes, formatDetectedScopesHint (heuristic fallback)
107 * ##aggregation.ts## - calculateWeightedVerdictAverage, detectHarmPotential, detectClaimContestation
108 * ##claim-decomposition.ts## - normalizeClaimText, deriveCandidateClaimTexts
109 * ##provenance-validation.ts## - filterFactsByProvenance
110 * ##budgets.ts## - createBudgetTracker, getBudgetConfig, recordLLMCall
111
112 = Differences from Orchestrated =
113
114 |= Aspect |= Orchestrated |= Monolithic Canonical
115 | LLM Context | Multiple calls, fresh context | Single conversation context
116 | Orchestration | TypeScript code controls flow | LLM decides next steps
117 | Research | Iterative decide-search-extract | Tool loop with budget limits
118 | Schema | Built-in TypeScript types | Zod schema validation
119 | Fallback | None (default) | Falls back to Orchestrated on failure
120 | Code Size | ~9000 lines | ~1100 lines