ai-driven-analysis-guide.md

May 29, 2026 Β· View on GitHub

Hack23 Logo

πŸ€– AI-Driven Analysis Guide β€” Step-by-Step Protocol

πŸ“Š The Single, Canonical Protocol for Every Riksdagsmonitor Agentic Workflow
🎯 Clear Steps · Positive Voice · Deep Political Intelligence · Color-Coded Mermaid

Owner Version Effective Date Classification

πŸ“‹ Document Owner: CEO | πŸ“„ Version: 6.9 | πŸ“… Last Updated: 2026-05-15 (UTC) πŸ”„ Review Cycle: Quarterly | ⏰ Next Review: 2026-07-21 🏒 Owner: Hack23 AB (Org.nr 5595347807) | 🏷️ Classification: Public

v6.2 simplification: Every workflow now produces every file in every family (23 core files + per-document set) β€” no trigger gates, no conditional output. Depth per item adapts by DIW tier, not which files exist. methodology-reflection.md is elevated to ⭐ VITAL run-audit status. This guide is the single entry point for every agentic workflow, describing what to produce with a canonical 7-step protocol. Deep framework theory and extended examples live in the linked Family production methodologies.


🎯 AI-FIRST Methodology Card

🚦 Read this card before writing a single paragraph. It names the artifact this methodology owns, the gate check it satisfies, the evidence-density target it must hit, and the Pass-1 / Pass-2 discipline required by .github/copilot-instructions.md §5 (AI-FIRST Quality Principle).

FieldValue
PurposeSingle AI-FIRST orchestration index β€” names the 7-step protocol and points to every other methodology with a one-paragraph summary.
InputsAll other methodologies in this folder; .github/prompts/04-analysis-pipeline.md; analysis/article-types.json
OutputsWorkflow orchestration only β€” no artifact written directly; downstream artifacts: every Family A–E file
Owning artifact(s)(orchestration index β€” every artifact in the catalog)
Owning gate checkAll checks 1–11 in 05-analysis-gate.md
Citation density targetβ‰₯ 1 cross-link per linked methodology; this file is a router, not an evidence file
Banned phrasesEnforced via political-style-guide.md Β§Machine-readable banned-phrase list
Threshold sourcereference-quality-thresholds.json β†’ thresholds[articleType][artifact] (fallback defaults.coreArtifactFloor)

βœ… Pass-1 checklist (creation β€” minimal viable artifact)

  • Confirm every linked methodology resolves to an existing file in analysis/methodologies/
  • Re-check the 7-step protocol order matches 04-analysis-pipeline.md step IDs
  • Produce every required sub-section listed in the owning template
  • Add β‰₯ 1 evidence anchor (dok_id, vote id, named MP, or primary-source URL) per analytical claim
  • Apply the correct WEP confidence band for the run's horizon (72h / week / month / quarter / year / cycle)
  • Include β‰₯ 1 themed Mermaid diagram with style … or themeVariables config (where structurally meaningful)
  • Cross-link the relevant template under analysis/templates/ and the gate check it satisfies

πŸ” Pass-2 checklist (read-back & improve β€” AI-FIRST mandatory)

  • Audit every methodology summary paragraph for ≀ 4 sentences and concrete artifact names
  • Verify the Family A–E output matrix totals 23 always-on artifacts (9+2+5+7) per current contract
  • Re-read the file end-to-end; flag every claim that lacks an evidence anchor and add one
  • Replace every banned phrase listed in political-style-guide.md Β§Machine-readable banned-phrase list with an evidence-anchored alternative
  • Tighten WEP language: never above likely without β‰₯ 3 cycle-aged sources for year/cycle horizons
  • Strengthen Mermaid (color-coded style … directives, themeVariables, β‰₯ 5 nodes where the structure admits it)
  • Add β‰₯ 1 second-order effect, cui-bono note, or counterfactual where the artifact admits one
  • Verify citation density meets the per-file target below and the gate's evidence-density rules

🟒 Exemplar (good β€” pattern-match this)

(routing snippet) "Family C β€” Strategic Extensions: produces scenario-analysis.md, comparative-international.md, devils-advocate.md (ACH β‰₯ 3 hypotheses), intelligence-assessment.md (β‰₯ 3 KJs + PIRs), methodology-reflection.md. Methodology canon: strategic-extensions-methodology.md. Gate: Check 7."

πŸ”΄ Anti-exemplar (failure mode β€” never ship this)

(failure mode) "Family C extensions are produced when relevant." β€” vague, no artifact names, no gate reference, no methodology link, no evidence the agent can pattern-match against.


🎯 What This Guide Is For

Every Riksdagsmonitor agentic workflow (morning, midday, evening, realtime, weekly, monthly) runs the same protocol and produces the same output families. This guide defines that protocol once, so every workflow produces deep, consistent, publication-quality political intelligence from Swedish Riksdag and Regeringen data.

Quality standard: Every analysis file matches the depth and formatting of SWOT.md and THREAT_MODEL.md β€” evidence tables, color-coded Mermaid diagrams, confidence-labeled claims, and actionable forward indicators.


🧭 The 7-Step Analysis Protocol

flowchart LR
    S1["1️⃣ Prepare<br/>Read methodologies<br/>+ templates"] --> S2["2️⃣ Download<br/>MCP data into<br/>workflow folder"]
    S2 --> S3["3️⃣ Per-File Analysis<br/>One .md per document<br/>(Tier L1–L3)"]
    S3 --> S4["4️⃣ Core Synthesis<br/>Family A files<br/>(9 outputs)"]
    S4 --> S5["5️⃣ Extensions<br/>Family C & D<br/>(all 12 always)"]
    S5 --> S6["6️⃣ Quality Gate<br/>Self-audit against<br/>rubric β‰₯ 7.0/10"]
    S6 --> S7["7️⃣ Pass-2 Rewrite<br/>Read own output,<br/>deepen every section"]

    style S1 fill:#1565C0,color:#FFFFFF
    style S2 fill:#1565C0,color:#FFFFFF
    style S3 fill:#7B1FA2,color:#FFFFFF
    style S4 fill:#7B1FA2,color:#FFFFFF
    style S5 fill:#FF9800,color:#FFFFFF
    style S6 fill:#FFC107,color:#000000
    style S7 fill:#4CAF50,color:#FFFFFF

Every step is mandatory. Steps 3–7 run inside a single workflow folder at analysis/daily/YYYY-MM-DD/{scope}/ (or analysis/daily/YYYY-MM-DD/realtime-HHMM/ for realtime runs).


🚨 Common Failure Modes (read before Pass 1)

These are the patterns that most frequently cause quality failures. Each is enforced at a different stage β€” the Enforced by column indicates where. Avoid each one explicitly:

#Failure modeSymptomFixEnforced by
1Conditional Family C/D outputWorkflow ships only some of the 12 Family C+D files because "the day was quiet"All 12 always ship. Depth adapts via DIW tier; structure does not.05-analysis-gate.md Check 1 + 7
2Missing evidence anchorsClaims like "the opposition pushed back" without dok_id, vote count, named MP, or primary-source URLEvery analytical claim cites at least one anchor. Generic prose is rejected by the gate.05-analysis-gate.md Check 4
3Banned phrases"could potentially", "may eventually", "experts say"Replace with WEP language + named source. See political-style-guide.md Β§banned-phrase list.Methodology validation (Pass-2 checklist)
4WEP-language overshoot[horizon:year] claim tagged "very likely" without β‰₯ 3 cycle-aged sourcesCap at "likely" for year/cycle unless source diversity rule is satisfied (never above "likely" without three cycle-aged sources).Methodology validation (Pass-2 checklist)
5Pass-2 skippedSingle-pass output: shallow, generic, no read-back logPass-2 status MUST appear in methodology-reflection.md with executed in full.05-analysis-gate.md Check 6
6Provider violationMacro/fiscal/monetary/external/trade/commodity/FX claim citing World BankUse IMF (see imf-indicator-mapping.md). World Bank is reserved for non-economic domains (e.g. governance, environment, social, health, demographics, education, agriculture, innovation, infrastructure, energy, defence historicals, crime).Methodology validation (ECONOMIC_DATA_CONTRACT)
7Missing voting-record evidencecoalition-mathematics.md cites a betΓ€nkande without a seat/vote-breakdown table (regex: Ja|Nej|AvstΓ₯r|FrΓ₯nvarande|Seats|Mandat)Run fetch-voting-records and paste a table matching the gate regex. If data is genuinely unavailable, the file must still contain a table row with the matching pattern.05-analysis-gate.md Check 8
8Stale full-text fallback< 2 documents succeed in --auto-full-text-top-n and no <!-- full-text-fallback: <reason> --> annotation appearsEither fetch 2 successfully or annotate.05-analysis-gate.md Check 10
9Unfilled 14-language SEO seedsStep 2B row left blank for one or more languagesMark [machine-assisted β€” verify] if no human-quality localization, never leave blank.Article generation / SEO validation
10Per-doctype defaultGeneric mot template applied to a fpm shadow-budget or KU-anmΓ€lanRun doctype-variant detector first; pick the right variant template.Methodology validation (per-document checklist)

Step 1 β€” Prepare

Read, in order:

OrderFileWhat it gives you
1This guide (ai-driven-analysis-guide.md)The 7-step protocol and output matrix
2political-style-guide.mdTradecraft anchors: F3EAD cycle, PIR/EEI catalog, Admiralty Code (+ Source Diversity Rule), ICD 203 mapping, WEP + ODNI confidence, SATs, Collection Management Matrix (incl. IMF)
3per-document-methodology.mdπŸ“’ How to produce every {dok_id}-analysis.md and cluster file
4structural-metadata-methodology.mdπŸ“— How to produce manifest + cross-reference map
5synthesis-methodology.mdπŸ“˜ How to produce the 5 Family A synthesis outputs
6strategic-extensions-methodology.mdπŸ“™ How to produce Family C depth products (core β€” every run)
7electoral-domain-methodology.mdπŸ“• How to produce Family D lens products (core β€” every run)
8political-classification-guide.md7-dimension document classification
9political-swot-framework.mdSWOT, TOWS, cross-SWOT interference
10political-risk-methodology.md5Γ—5 LΓ—I matrix, cascading risk chains
11political-threat-framework.mdAttack trees, kill chain, threat taxonomy
12All templates in ../templates/Output structure for every .md family
13Article-Generation.md + .github/prompts/seo-metadata-contract.mdHow the analysis becomes article.md, HTML, UI/UX export and SEO title/description surfaces

Commit the read list into memory: cite the methodology section you used whenever you make a call β€” e.g. "Classification per political-classification-guide.md Β§Political Temperature" or "DIW tier assigned per synthesis-methodology.md Part 1" or "Admiralty [B2] per political-style-guide.md Β§Admiralty Source Reliability Code".


Step 2 β€” Download MCP Data (F3EAD: FIND β†’ FIX)

Scripts run the download. Example:

npx tsx scripts/download-parliamentary-data.ts \
  --date ${ARTICLE_DATE} \
  --doc-type ${DOC_TYPE} \
  --auto-full-text-top-n 2

--auto-full-text-top-n 2 (recommended for L2/L3 runs): after the bulk download, the script calls get_dokument_innehall with include_full_text=true for the top-2 documents (by order in the downloaded batch) and persists the retrieved content to analysis/daily/${ARTICLE_DATE}/${DOC_TYPE}/full-text/{dok_id}.md. Accept the extra 30–60 s as a documented quality investment. The manifest's ## Full-Text Fetch Outcomes table records coverage_state, full_text_available, and retrieval per dok_id; the analysis gate (check 10) enforces that β‰₯ 2 succeed or a <!-- full-text-fallback: <reason> --> annotation is present.

Write data-download-manifest.md using the manifest template. It records what arrived, from which MCP tools, with what data-depth distribution (FULL-TEXT / SUMMARY / METADATA-ONLY) and β€” when --auto-full-text-top-n is used β€” the ## Full-Text Fetch Outcomes table. The manifest must also surface MCPCoverageState (full_text, metadata_only, not_indexed, search_empty, fetch_error), row-level mcpProvenance, query/result-count diagnostics for every MCP call, and the deferred queue summary for same-day filings / voteringar lag.

After download-parliamentary-data.ts completes for committeeReports, also run the voting-records script to capture party-level vote counts and defector detection for each betΓ€nkande:

npx tsx scripts/fetch-voting-records.ts \
  --date ${ARTICLE_DATE} \
  --doc-type committeeReports \
  --persist

This writes data/voteringar/${ARTICLE_DATE}/{bet}.json and injects voting-record summaries into analysis/daily/${ARTICLE_DATE}/committeeReports/voting-records/. Each record carries an explicit status field. fetchVotingForBet emits one of three statuses: "fetched" (full table available), "not_found" (MCP returned successfully with zero rows β€” e.g. referral, procedural decision, or committee item without a chamber vote), or "error" (transient MCP/network failure with errorMessage). Editorial tooling that knows a vote is upcoming may also persist "vote_pending" annotations manually. The script emits a matching injection template for every non-fetched status (<!-- vote-not-found: {bet} -->, <!-- vote-fetch-error: {bet} -->, <!-- vote-pending: {bet} -->), so the coalition-mathematics section can paste the template verbatim and rerun the script to upgrade error / not_found to fetched once data is available.

To fetch the parliamentary forward calendar for week-ahead or month-ahead forecasting, run:

npx tsx scripts/fetch-calendar.ts \
  --from ${ARTICLE_DATE} \
  --tom ${TOM_DATE} \
  --persist

This writes analysis/data/calendar/${ARTICLE_DATE}_${TOM_DATE}.json using the MCP get_calendar_events primary path with automatic fallback to HTML parsing of riksdagen.se/sv/kalendarium/.

If the date yields 0 documents, apply the Empty-Day Protocol (Β§ Empty-Day Handling below) β€” never publish a "0 documents" file.


Step 2B β€” 14-Language SEO Metadata Seed (DISSEMINATE contract)

Before article aggregation, every workflow must seed the story metadata that will drive all 14 HTML outputs. This is part of the analysis product, not a renderer afterthought:

  1. In executive-brief.md, write a publishable H1/headline with actor + active verb + policy object + consequence. Do not rely on literal dates to make the title unique.
  2. In ## 🎯 BLUF, make the first paragraph a 145–200 character SERP-ready summary with the concrete story topic, named actor, action and so-what. The renderer localizes metadata around this BLUF for EN, SV, DA, NO/NB, FI, DE, FR, ES, NL, AR, HE, JA, KO and ZH.
  3. Add ## 🌐 14-Language SEO Metadata Seeds to the executive brief when the workflow has enough evidence. Fill all 14 rows with short localized title angles, description angles and keyword seeds. If a language cannot be human-quality localized, write the English story topic plus the language label and mark it [machine-assisted β€” verify]; do not leave it blank.
  4. Pass 2 must read every language row back and confirm that the title/description is contextual (policy object, actor, consequence) rather than a date-stuffed duplicate.

The H1 is doing triple duty. The executive-brief.md H1 and BLUF are not "just SEO". The renderer derives the page <title>, <meta description>, OG/Twitter cards and Schema.org headline from them and the brief body is now the on-page lead a reader meets first. For a localized page the renderer uses executive-brief_<lang>.md as the lead (localized if it exists, English otherwise β€” the same cascade as <title>/<meta description>), so the localized H1/BLUF must read as a finished, reader-attracting opening in that language, not a literal calque of the English. Write each H1 to earn the click and the first 10 seconds of reading attention.

πŸͺ Headline tradecraft (write the title to be clicked, not just indexed)

Pass-1 may write a serviceable H1; Pass-2 must sharpen it. A strong title is specific, consequential and curiosity-opening without being clickbait:

  • Lead with the named actor and an active, concrete verb β€” "Busch government tightens migration detention" beats "New propositions submitted".
  • Name the stake / so-what β€” quantify or sharpen the consequence ("…risking ECHR Article 8 review", "…shifting 12% of the housing budget").
  • Front-load the highest-DIW finding, never the document count or the date. The title must match the #1 finding the lede and significance scoring agree on.
  • Stay inside the SERP-safe envelope β€” 50–70 characters renders without truncation (the renderer trims long H1s at a word boundary and strips trailing connectors, so a title that needs its tail to make sense will lose meaning at ~70 chars).
  • No date-stuffing, no admin metadata, no template scaffolding (REPLACE THIS H1, Executive Brief, classification badges) β€” those are stripped/flagged and produce duplicate-looking SERP entries.
  • Localize the angle, not the words β€” each non-English title row should carry the same actor/verb/stake in idiomatic phrasing; a reader scanning the SV or JA page should feel the headline was written for them.

Mini self-check (apply to every language row in Pass-2): Does it name an actor? An active verb? A concrete stake? Would a non-expert understand the so-what in one read? Is it ≀ 70 chars and free of dates/admin text? Any "no" forces a rewrite.

Minimum row schema:

| lang | localized title angle (50–70 chars) | localized description angle (145–200 chars) | keyword seeds (5–8) |
|------|-------------------------------------|---------------------------------------------|---------------------|
| en | Actor verb object consequence | SERP-ready summary with so-what and provenance | topic, actor, policy, Riksdag, OSINT |
| sv | … | … | … |
| da | … | … | … |
| no | … | … | … |
| fi | … | … | … |
| de | … | … | … |
| fr | … | … | … |
| es | … | … | … |
| nl | … | … | … |
| ar | … | … | … |
| he | … | … | … |
| ja | … | … | … |
| ko | … | … | … |
| zh | … | … | … |

The TypeScript renderer still enforces safe fallbacks, but good AI-authored metadata seeds are the quality source. This prevents Bing/Google from seeing 14 translated pages or repeated article runs as duplicate descriptions.


Step 3 β€” Per-File Analysis (F3EAD: FINISH)

For every document in the manifest, write one file at:

analysis/daily/${ARTICLE_DATE}/${DOC_TYPE}/documents/${DOK_ID}-analysis.md

Use the per-file-political-intelligence.md template. Pick the depth tier that matches the document's political weight:

TierWord RangeFrameworks AppliedMermaid CountApplies To
L1 β€” Surface200–500Classification onlyβ‰₯ 1Routine questions, calendar notes, metadata-only items
L2 β€” Strategic800–2 000Classification + SWOT or Riskβ‰₯ 1Sector bills, standard committee reports, interpellations
L2+ β€” Priority1 500–3 000Classification + SWOT + Risk + Stakeholder + forward scenariosβ‰₯ 2Major sector reforms, contested votes, coalition-relevant motions
L3 β€” Constitutional / Intelligence-grade2 500–5 000Classification + SWOT + Risk + Threat + Stakeholder + Scenario tree + Red-Teamβ‰₯ 2Grundlag changes, budget bills, foreign-policy pivots, crisis interpellations

Every per-file analysis contains:

  • Document identity table (dok_id, type, committee, sponsor, Data Depth, depth tier, Admiralty Code)
  • Classification results (7 dimensions per political-classification-guide.md)
  • SWOT table with β‰₯ 2 entries per quadrant, each evidence-backed with Admiralty annotation [A–F][1–6]
  • Risk table (LΓ—I per political-risk-methodology.md) for L2 and above
  • Stakeholder-impact rows for L2 and above
  • Forward indicators with dated triggers
  • β‰₯ 1 color-coded Mermaid diagram
  • Confidence label on every claim using 5-Level Scale and WEP language for probability
  • For β‰₯ L2 documents: a Β§"Narrative" subsection per political-style-guide.md Β§"Narrative-Voice Standards" (lede + body + counter-narrative); the Family A synthesis-summary.md and executive-brief.md will pull from this when the document is the day's #1 or #2 ranked finding

πŸ’‘ Doctype detection (v1.3): before writing a per-file analysis, run the doctype-variant detector from per-document-methodology.md Β§"Per-doctype Mermaid taxonomy". The 5 extended variants (motion-package, fpm shadow-budget, utskottsbetΓ€nkande-variants with reservations, KU-anmΓ€lan constitutional scrutiny, EU-nΓ€mnd consultations) demand specialised Mermaid shapes and analytic handling β€” a generic mot template applied to a fpm misses the entire delta-envelope analysis.


Step 4 β€” Core Synthesis (F3EAD: EXPLOIT β†’ ANALYZE)

After per-file analysis, produce the nine core synthesis files that every workflow folder ships. Each has a dedicated template:

#FileTemplatePurpose
1README.mdREADME.md (Β§ Folder README)Folder index with links to every other file
2executive-brief.mdexecutive-brief.mdBLUF + 3 decisions + 60-second read
3synthesis-summary.mdsynthesis-summary.mdIntegrated intelligence picture + article decision
4significance-scoring.mdsignificance-scoring.mdDIW-weighted ranking of every document
5classification-results.mdpolitical-classification.mdAggregated classification across documents
6swot-analysis.mdswot-analysis.mdStakeholder SWOT + TOWS + cross-SWOT
7risk-assessment.mdrisk-assessment.md5-dimension risk register + cascading chains
8threat-analysis.mdthreat-analysis.mdPolitical Threat Taxonomy + attack tree
9stakeholder-perspectives.mdstakeholder-impact.md6-lens stakeholder impact matrix

Plus two structural files produced every run:

#FileTemplatePurpose
10data-download-manifest.mddata-download-manifest.mdWhat was downloaded, from where, with data-depth counts, coverage-state rows, and deferred-retry provenance
11cross-reference-map.mdcross-reference-map.mdPolicy clusters, legislative chains, coordinated-activity patterns β€” every Mermaid edge labelled with one of the 7 atomic edge types per structural-metadata-methodology.md Β§"Relationship taxonomy"

Step 5 β€” Extensions (F3EAD: ANALYZE continued)

Every run produces all five Family C files and all seven Family D files. They are not trigger-driven β€” the output set is stable, and depth adapts per item based on DIW tier (see Step 6). Each file has a dedicated template and a section in the Family methodologies.

FileAlways-produced roleTemplateSAT(s) Applied
scenario-analysis.mdPluralistic futures (3 scenarios + probabilities summing to 100%); when uncertainty is low, scenarios converge and the file documents the narrow-band consensusscenario-analysis.mdWhat If?, Morphological
comparative-international.mdPeer-country comparison for every policy area touched (β‰₯5 peers); when no reform is on the table, compares current Swedish baseline to Nordic + EU peerscomparative-international.mdOutside-In Thinking
devils-advocate.mdRed-team challenge with β‰₯3 competing hypotheses via ACH; when evidence is strong, the file documents which hypotheses were rejected and whydevils-advocate.mdACH, Red Team, Devil's Advocacy
intelligence-assessment.md3–7 Key Judgments with confidence + PIRs for next cycle; operates on every run because every day has a priority-intelligence requirementintelligence-assessment.mdKey Assumptions Check
⭐ methodology-reflection.mdVITAL run-audit gate. Evidence sufficiency, confidence distribution, source diversity, party-neutrality arithmetic, ICD 203 compliance audit, three concrete methodology improvements for the next cycle. Skipping it breaks the self-correction loop.methodology-reflection.mdKey Assumptions Check, Quality of Information Check
election-cycle-analysis.mdSeat-projection deltas + coalition viability for every run during the active pre-election window; after the election it converts to a permanent "post-election government-formation context" file (see Election lens β€” cycle anchors and rollover)election-cycle-analysis.mdMorphological
voter-segmentation.mdDemographic / regional / ideological segment impact; when the day's docs are procedural, documents baseline segment positionsvoter-segmentation.mdOutside-In Thinking
coalition-mathematics.mdCurrent seat map + pivotal votes + Sainte-LaguΓ« scenarios; stable structure regardless of daily contentiousness. MUST include a voting-record table sourced from fetch-voting-records output (data/voteringar/{date}/{bet}.json) for every betΓ€nkande cited, or one of the explicit annotations: <!-- vote-not-found: {bet} --> when status: "not_found" (MCP returned successfully with zero data β€” referral or procedural vote), <!-- vote-fetch-error: {bet} --> when status: "error" (transient MCP/network failure; rerun once the service is back), or β€” set manually by editorial tooling that knows a vote is upcoming β€” <!-- vote-pending: {bet} -->.coalition-mathematics.mdMorphological
historical-parallels.mdNamed precedent(s) ≀ 40 years with similarity score; when no obvious parallel exists, documents the "no-precedent" finding with reasoninghistorical-parallels.mdOutside-In Thinking
media-framing-analysis.mdv2.3 (analytics-first; preamble notices removed) β€” (0) Global Audience Orientation block (Swedish political-system context for international readers; 5-axis Multi-Dimensional Alignment Key replacing single left/right score); frame packages with Entman 4-functions, cognitive-vulnerability map, DISARM TTP map, narrative-laundering chain (fringe β†’ alt β†’ politician β†’ mainstream β†’ international), Outlet Bias Audit (every outlet declared with ownership / funding / board-appointment authority / 5-axis lean / Reuters Institute Trust / PO-PON complaints / foreign-actor link β€” no outlet is neutral β€” no single left/right score), CIB ABCDE block, algorithmic asymmetry with optimisation-target attribution, β‰₯ 2 comparative-international cognates + regional notes (Asia / Americas / Europe), strategic-doctrine detection, frame lifecycle / longevity, RRPA impact, L1–L5 counter-resilience ladder (procedural neutrality only), longitudinal frame-record entrymedia-framing-analysis.mdOutside-In Thinking + Red Cell + ACH (β‰₯ 3 hypotheses for any state-attribution claim) + Indicators & Signposts
implementation-feasibility.mdDelivery-risk view (budget / IT / regulatory / workforce); when no new bill lands, audits the backlog of in-flight commitmentsimplementation-feasibility.mdPremortem Analysis
forward-indicators.mdβ‰₯10 indicators across 4 horizons (72h / week / month / election); refreshed every run to maintain the forward-watch listforward-indicators.mdIndicators and Signposts

Long-horizon forecasting playbook

Long-horizon workflows (quarter-ahead, year-ahead, election-cycle) follow additional rules defined authoritatively in .github/prompts/ext/long-horizon-forecasting.md. This section summarises the contract β€” cross-reference, do not duplicate the full rules.

Horizon stratification. Every probabilistic judgement carries a [horizon:<band>] tag:

BandDaysUsage
72h3Imminent events
week7Near-term legislative calendar
month30Budget cycle, committee reports
quarter90Session-level outlook
year365Cross-session strategic forecast
cycle1 460Full mandate-period projection across the whole parliamentary cycle
election1 460Election-centred forecast: campaign dynamics, result space, coalition formation

Use cycle when the judgement spans the full mandate period as a governing horizon. Use election when the analysis is specifically anchored to an election event or its immediate government-formation consequences. For band-specific floor and calibration rules, follow the authoritative definitions in .github/prompts/ext/long-horizon-forecasting.md.

Scenario-tree depth per article type:

Article typeScenariosWildcardsBranches per scenario
quarter401
year451
election-cycle453 (coalition branches β†’ 12 leaves)

PESTLE mandatory threshold. year and election-cycle article types require a PESTLE artifact (pestle-analysis.md) β€” enforced via the pestleMandatory flag in analysis/article-types.json.

PIR roll-forward. Open PIRs from the predecessor cycle are carried forward by scripts/roll-forward-pirs.ts, degrading confidence one level per cycle. The full procedure is documented in Step 7 and the PIR status sidecar section.

Cross-horizon citation rule. Longer-horizon artifacts must cite shorter-horizon predecessors to ensure analytical continuity:

HorizonMust cite
quarterβ‰₯ 1 week-ahead + β‰₯ 1 month-ahead
yearβ‰₯ 2 quarter-ahead + β‰₯ 4 monthly-review
cycleβ‰₯ 2 year-ahead + β‰₯ 12 monthly-review

These citations appear in cross-reference-map.md. The gate at .github/prompts/05-analysis-gate.md currently verifies the presence of the required predecessor path types; the numeric minima in this table remain a Pass-2/review requirement until the gate is expanded to enforce counts.

Election lens β€” cycle anchors and rollover

Replaces static "election-specific-year" framing with a parameterised, registry-driven cycle model.

The election lens is active whenever the registry's electionCycleAnchor field is not none. All workflows assess the five electoral dimensions (Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, Policy Legacy) and classify significance as πŸ”΄ CRITICAL Β· 🟠 HIGH Β· 🟑 MODERATE Β· 🟒 LOW Β· βšͺ NEGLIGIBLE.

The four cycle anchors:

AnchorSemanticsWhen active
noneNo election in scope> 18 months from any election
currentAnalysing the mandate period currently in progressDefault outside rollover window
nextAnalysing the upcoming election and its coalition scenariosPost-rollover flip
bothSimultaneous analysis of outgoing + incoming mandatesΒ± 30-day rollover window around election day

Cycle-rollover trigger window. Within Β± 30 days of a Swedish election day, the rollover window predicate (cycleRolloverActive in horizon-context.ts) drives simultaneous outgoing + incoming mandate analysis, and the module in .github/prompts/ext/cycle-rollover.md governs the file-rename + content-carry-forward procedure. The registry's electionCycleAnchor is not auto-rotated by that window; it is flipped later via an operator PR. Election dates are parameterised in analysis/article-types.json β†’ electionCycles β€” they are never hard-coded in analysis guides.

Horizon helper API (scripts/horizon-context.ts)

The scripts/horizon-context.ts module exposes the runtime context every long-horizon workflow needs. Key exports:

FunctionReturnsPurpose
loadRegistry()ArticleTypesRegistryFull parsed article-types.json (cached)
getArticleType(id)ArticleTypeEntrySingle article-type entry by id
daysToElection(articleDate)numberSigned days to next election (negative = past)
activeCycleAnchor(articleDate)'current' | 'next'Which cycle anchor applies for the date
weoVintage(articleDate)stringMost-recent IMF WEO vintage ("Apr-YYYY" / "Oct-YYYY")
sessionPhase(articleDate)'autumn' | 'xmas-recess' | 'spring' | 'summer-recess'RiksmΓΆte session phase
horizonContext(typeId, articleDate)HorizonContextOne-shot resolution of all fields

The composite HorizonContext interface includes cycleRolloverActive: boolean (true when within Β± 30 days of the next election), enabling workflows to branch into the rollover procedure without manual date arithmetic.


Step 6 β€” Quality Gate (self-audit, blocking)

Score your own output against this rubric before commit:

DimensionWeightMinimum PassWhat to Check
πŸ“Ž Evidence25%7.0Every claim cites dok_id, vote count, named actor, or primary URL; Admiralty Code annotation on every evidence row; Source Diversity Rule met (P0/P1: β‰₯3 sources; single-source flagged)
πŸ“ Depth25%7.0Depth tier met; frameworks applied; forward indicators present; WEP language for probability claims
πŸ“‹ Structural20%7.0Templates followed; Mermaid color-coded; metadata + document-control blocks; F3EAD stage declared
🎯 Actionable15%6.0Dated triggers, thresholds, explicit "what to watch next"; PIR/EEI tags on findings
βš–οΈ Neutrality15%6.0Balanced coverage of government and opposition; every assessment labeled
πŸ“ ICD 203 Complianceβ€”PassAll 9 ICD 203 standards met (audit in methodology-reflection.md)

Composite β‰₯ 7.0 required to commit. Any single dimension below its floor triggers revision regardless of composite score. ICD 203 compliance is a hard pass/fail gate. Full rubric and examples live in political-style-guide.md.


Step 7 β€” Pass-2 Rewrite (F3EAD: DISSEMINATE)

Article and SEO handoff

Before running scripts/aggregate-analysis.ts, ensure executive-brief.md has a publishable H1 and BLUF that can become <title> and <meta description> without repair: actor-first, active verb, no literal date, no admin metadata, 55–70 character title target and 140–200 character one-sentence description target. synthesis-summary.md Β§Narrative Direction & Article Decision should agree with that H1/BLUF so article.md reads as one coherent intelligence article. Apply the same bar to every executive-brief_<lang>.md: its H1/BLUF is the localized page's on-page lead (the first thing a SV/DE/JA/AR reader sees) as well as that page's localized <title>/<meta description> β€” so each localized brief must open with the same reader-attracting, actor-and-stake headline in idiomatic prose, never a literal calque. Run the πŸͺ Headline-tradecraft self-check (Step 2B) against every language before aggregation.

Read every file you produced in Steps 3–5. For each one, improve every section:

  • Replace generic verbs with specific ones ("rose" β†’ "rose from 34% to 42% in the April SIFO poll").
  • Promote every [MEDIUM] finding that now has stronger evidence to [HIGH], and demote any overclaim.
  • Verify every Admiralty annotation β€” upgrade any [C3] that now has corroboration to [B2].
  • Check Source Diversity Rule β€” confirm P0/P1 claims have β‰₯3 sources; flag any single-source claims with [unconfirmed].
  • Add one more named actor (MP, minister, official) to every stakeholder and SWOT entry.
  • Add one more dok_id or vote-record citation to every evidence column that has < 2 citations.
  • Tag every key finding to a PIR/EEI from the catalog in political-style-guide.md.
  • Write pir-status.json β€” every cycle must produce $ANALYSIS_DIR/pir-status.json conforming to schemas/pir-status.schema.json v1.0 (required fields: schema_version, cycle, date, subfolder, pirs, generated_at). Newly extracted PIRs from intelligence-assessment.md default to status: "open"; rolled-forward PIRs from a prior cycle preserve their existing status (open / answered / superseded / deferred / cancelled) and may carry a populated inherits_from chain. Open PIRs that are carried forward have their confidence degraded one level (HIGH β†’ MEDIUM, etc.) by scripts/roll-forward-pirs.ts; non-open PIRs are preserved unchanged so the historical lineage is never lost. This file is the machine-readable PIR sidecar used for automated roll-forward and CI gate enforcement (Check 9 in 05-analysis-gate.md).
  • Add Statskontoret evidence to every implementation-capacity or agency-burden claim where a relevant public report/page exists.
  • Verify every macro/fiscal/monetary/external-sector claim is IMF-first, vintage-tagged when projected, and represented in economic-data.json when charted.
  • IMF data fallback hierarchy (scripts/imf-fetch.ts β€” weo subcommand only):
    1. Live fetch β€” tsx scripts/imf-fetch.ts weo --country SWE --indicator X --persist β†’ fresh data + persisted cache.
    2. Cached fallback β€” when live weo fetch fails (network block, timeout, API error), the script automatically loads from analysis/data/imf/{indicator}/{country}.json. The output includes _fallback: true and _vintageAnnotation.
    3. Stale vintage annotation β€” if cached data is >6 months old, output includes _staleVintage: true. All downstream artifacts must annotate with >6 month vintage.
    4. No cache available β€” report as πŸ”΄ in methodology-reflection.md Β§Data Source Connectivity Audit and flag in Β§What to Improve. Never silently substitute World Bank for IMF economic data.
    5. compare subcommand β€” compareCountriesWeo() fail-softs per country (returns null for failed fetches rather than throwing). When a country returns null, imf-fetch.ts fills it from the cached dataPoint persisted by prior --persist runs if available and annotates _cacheFilledCountries. Countries with no cache remain null in the output.
    6. sdmx subcommand β€” no cache fallback. If the SDMX data endpoint fails (e.g. HTTP 404), the command exits with an error; report as πŸ”΄ in Β§Data Source Connectivity Audit.
    7. World Bank prohibition β€” per ECONOMIC_DATA_CONTRACT v2.1, World Bank is reserved for governance (WGI), environment, and social residue. Using WB for GDP/growth/debt/inflation triggers the imf-primary-violation warning in validate-methodology-reflection.ts.
  • Re-rank the significance scoring if the rewrite reveals a stronger lead.
  • Rewrite the lede of synthesis-summary.md so it leads with the #1 DIW-ranked finding β€” not the document count.
  • Complete the ICD 203 compliance checklist in methodology-reflection.md.
  • Run the Pass-2 Self-Audit Checklist present in every template (10 items: tradecraft anchors / source diversity / evidence specificity / named-actor discipline / counter-narrative / Election 2026 lens applied (election-cycle lens) / no illustrative content as fact / cross-references resolve / Mermaid renders / line-floor check). Any unchecked ❌ at the end of Pass 2 forces a Pass-3 rewrite of the affected section.
  • Score the Narrative subsection in executive-brief.md, synthesis-summary.md, and any L2+ per-file artifact against the 6-axis narrative rubric in political-style-guide.md Β§"Narrative-Voice Standards" (lede / scene density / character density / surprise quotient / takeaway sharpness / counter-narrative). Hard floor: 18 / 30 total to publish; any single axis < 3 fails the gate.

Time budget rule: Pass 1 uses ≀ 60 % of workflow time; Pass 2 uses β‰₯ 25 %; Quality gate the remainder. Workflows completing in < 45 minutes of a 60-minute allocation indicate the pass-2 rewrite was skipped.


πŸ“‚ Output Matrix β€” Every File, Every Family

Every workflow produces every file in every family. No family is trigger-driven. The output set is stable, auditable, and identical across morning, evening, realtime, weekly, and monthly workflows β€” what varies is depth per item (tier L1 / L2 / L2+ / L3), not which files exist.

graph TB
    subgraph FA["πŸ“˜ Family A β€” Core Synthesis (every run Β· 9 files)"]
        A1[README.md]
        A2[executive-brief.md]
        A3[synthesis-summary.md]
        A4[significance-scoring.md]
        A5[classification-results.md]
        A6[swot-analysis.md]
        A7[risk-assessment.md]
        A8[threat-analysis.md]
        A9[stakeholder-perspectives.md]
    end

    subgraph FB["πŸ“— Family B β€” Structural Metadata (every run Β· 2 files)"]
        B1[data-download-manifest.md]
        B2[cross-reference-map.md]
    end

    subgraph FC["πŸ“™ Family C β€” Strategic Extensions (every run Β· 5 files)"]
        C1[scenario-analysis.md]
        C2[comparative-international.md]
        C3[devils-advocate.md]
        C4[intelligence-assessment.md]
        C5[methodology-reflection.md · ⭐ VITAL]
    end

    subgraph FD["πŸ“• Family D β€” Electoral & Domain Lenses (every run Β· 7 files)"]
        D1[election-2026-analysis.md]
        D2[voter-segmentation.md]
        D3[coalition-mathematics.md]
        D4[historical-parallels.md]
        D5[media-framing-analysis.md]
        D6[implementation-feasibility.md]
        D7[forward-indicators.md]
    end

    subgraph FE["πŸ“’ Family E β€” Per-Document (every run Β· N files)"]
        E1["documents/${dok_id}-analysis.md"]
        E2["documents/${cluster}-cluster-analysis.md"]
    end

    style FA fill:#1565C0,color:#FFFFFF
    style FB fill:#7B1FA2,color:#FFFFFF
    style FC fill:#FF9800,color:#FFFFFF
    style FD fill:#C2185B,color:#FFFFFF
    style FE fill:#2E7D32,color:#FFFFFF

Every workflow produces every file

WorkflowFamily AFamily BFamily CFamily DFamily E
Morning per-type (propositions, motions, betΓ€nkanden, interpellationer, frΓ₯gor)βœ… All 9βœ… Bothβœ… All 5βœ… All 7βœ… Every doc
Midday week-ahead / month-ahead forecastsβœ… All 9βœ… Bothβœ… All 5βœ… All 7βœ… Every forecast item

πŸ“… Week-ahead / month-ahead calendar enrichment: For midday forecasting runs, run fetch-calendar.ts before analysis to pre-populate forward events:

npx tsx scripts/fetch-calendar.ts --from ${ARTICLE_DATE} --tom ${TOM_DATE} --persist

The resulting analysis/data/calendar/${ARTICLE_DATE}_${TOM_DATE}.json feeds forward-indicators.md (horizon items) and coalition-mathematics.md (scheduled votes). Use the source field to cite whether events came from MCP ("mcp") or the web fallback ("web_fallback"), and apply the appropriate Admiralty reliability code. | Evening analysis | βœ… All 9 | βœ… Both | βœ… All 5 | βœ… All 7 | βœ… Every doc | | Realtime monitor | βœ… All 9 | βœ… Both | βœ… All 5 | βœ… All 7 | βœ… Every doc | | Weekly review | βœ… All 9 | βœ… Both | βœ… All 5 | βœ… All 7 | Top 20 | | Monthly review | βœ… All 9 | βœ… Both | βœ… All 5 | βœ… All 7 | Top 50 |

Depth calibration β€” the files are always produced; item-level depth is what adapts:

TierSignificance (DIW)What every mandatory file still containsAdded depth
L1 SurfaceDIW < 4.0Core structure + β‰₯1 Mermaid + β‰₯3 evidence citations per sectionShort cards
L2 Strategic4.0 ≀ DIW < 6.0Adds: per-party positions, 5-level confidence per claimComparison tables
L2+ Priority6.0 ≀ DIW < 8.0Adds: dissenting-view section, coalition mathScenario branching
L3 IntelligenceDIW β‰₯ 8.0Adds: full ACH matrix, red-team hypothesis, historical base rateDeep dives

⭐ methodology-reflection.md β€” the vital run-audit file

Of the 23 always-produced files, methodology-reflection.md is the run-audit gate: it assesses evidence sufficiency, confidence distribution, source diversity, party-neutrality arithmetic, and names three concrete methodology improvements for the next cycle. A workflow that skips this file has no internal self-correction mechanism β€” treat its absence as a broken run. Quality-gate enforcement details are in strategic-extensions-methodology.md Part 5.

πŸ“› Filename variants (all map to one template + one methodology section)

Canonical filenameAccepted alternate filename(s)TemplateMethodology
comparative-international.mdinternational-comparative.mdtemplates/comparative-international.mdstrategic-extensions Β§2
historical-parallels.mdhistorical-baseline.mdtemplates/historical-parallels.mdelectoral-domain Β§4
election-2026-analysis.mdelection-2026-implications.mdtemplates/election-2026-analysis.mdelectoral-domain Β§1
stakeholder-perspectives.md(canonical filename on disk β€” template filename is stakeholder-impact.md)templates/stakeholder-impact.mdsynthesis Β§3–§4
classification-results.md(canonical filename on disk β€” template filename is political-classification.md)templates/political-classification.mdpolitical-classification-guide
{dok_id}-analysis.mdany Riksdag dok_id (e.g. HD10432-analysis.md, hd03231-analysis.md)templates/per-file-political-intelligence.mdper-document Β§1
{cluster}-cluster-analysis.mdany theme slug (e.g. deportation-cluster-analysis.md, fuel-tax-cluster-analysis.md)templates/per-file-political-intelligence.md (cluster section)per-document Β§2

🎨 Color-Coded Mermaid β€” Single Source of Truth

Every Mermaid diagram in analysis files uses this palette. No greyscale, no ad-hoc colors.

graph LR
    A["πŸ”΄ CRITICAL / RESTRICTED<br/>#D32F2F"] --> B["🟠 HIGH / URGENT<br/>#FF9800"]
    B --> C["🟑 MEDIUM / ELEVATED<br/>#FFC107"]
    C --> D["🟒 LOW / ROUTINE<br/>#4CAF50"]
    D --> E["πŸ”΅ INFORMATIONAL<br/>#1565C0"]
    E --> F["🟣 STRATEGIC / SPECIAL<br/>#7B1FA2"]
    F --> G["🩷 THREAT / ATTACK SURFACE<br/>#C2185B"]
    G --> H["βšͺ CARRY-FORWARD / STALE<br/>#9E9E9E"]

    style A fill:#D32F2F,color:#FFFFFF
    style B fill:#FF9800,color:#FFFFFF
    style C fill:#FFC107,color:#000000
    style D fill:#4CAF50,color:#FFFFFF
    style E fill:#1565C0,color:#FFFFFF
    style F fill:#7B1FA2,color:#FFFFFF
    style G fill:#C2185B,color:#FFFFFF
    style H fill:#9E9E9E,color:#FFFFFF
SemanticHexTextUse for
Critical / Restricted#D32F2F#FFFFFFTop-risk nodes, coalition-breaking events, grundlag reversals
High / Urgent#FF9800`#FFFFFF$\text{High} \text{L} \times \text{I} \text{risks}, \text{P1} \text{documents}, \text{time}-\text{sensitive} \text{triggers}
\text{Medium} / \text{Elevated}$#FFC107`#000000P2 documents, elevated scrutiny, abstentions
Low / Routine#4CAF50#FFFFFFP3 documents, coalition strengths, resolved risks
Informational#1565C0#FFFFFFInputs, data sources, neutral events
Strategic / Special#7B1FA2#FFFFFFSynthesis, cross-links, opportunity nodes
Threat / Attack Surface#C2185B#FFFFFFThreat-analysis nodes, attack-tree branches
Carry-forward / Stale#9E9E9E#FFFFFFCarry-forward items, empty-day placeholders

SWOT quadrant charts additionally use: Strengths #2E7D32 Β· Weaknesses #D32F2F Β· Opportunities #1565C0 Β· Threats #FF9800 (aligned with ISMS Style Guide).


🎯 5-Level Confidence Scale

Every analytical claim carries one of these labels. Use the highest level whose evidence threshold is fully met.

LevelLabelEvidence RequiredApplies To
⬛ 1VERY LOW0–1 source, no corroborationSpeculation, pattern hypotheses
πŸŸ₯ 2LOW2 sources, indirect evidenceCircumstantial claims, emerging patterns
🟧 3MEDIUMβ‰₯ 3 sources with moderate agreementPartial records, reported intent
🟩 4HIGHOfficial records (Riksdag API, voting records, committee reports)Documented facts from primary sources
🟦 5VERY HIGHMultiple official sources + cross-validation + expert consensusVerified, cross-corroborated statements

Confidence ceilings by data depth (set in Step 2 and enforced through Step 4):

  • FULL-TEXT document β†’ up to VERY HIGH
  • SUMMARY-only document β†’ cap at MEDIUM
  • METADATA-only document β†’ cap at LOW, risk score ≀ 3/10, SWOT entries flagged ⚠️ metadata-only

πŸ›οΈ Democratic-Impact Weighting (DIW) β€” Significance Ranking

Every significance-scoring.md ranks documents against these six dimensions.

DimensionWeightWhat it measures
πŸ›οΈ Democratic-Infrastructure Impact30%Grundlag, electoral rules, press-freedom law, rule-of-law institutions β€” decadal reversal window
πŸ“œ Parliamentary Significance15%Document tier: grundlag > proposition > betΓ€nkande > motion > skriftlig frΓ₯ga
βš–οΈ Policy Impact15%Substantive effect on citizens, economy, rights
πŸ“° Public Interest15%Media salience, civic attention, search demand
⏰ Urgency / Time-Sensitivity15%Decision horizon, reversibility, deadline proximity
🌍 Cross-Party / International Dimension10%Consensus breadth + foreign-policy weight

Lead-story rule: the article <title>, <meta description>, OG/Twitter tags, Schema.org headline, and H1 reference the document with the highest DIW-weighted score. The lede names the principal human actor and cites the primary dok_id within the first two sentences.

Coverage-completeness rule: every document scoring β‰₯ 7.0 on DIW appears as a dedicated H3 section in the article body.

Rhetorical-tension rule: when the top-ranked findings carry opposing political valences, surface the tension in a dedicated subsection.

πŸ’‘ Worked example available (v1.3): for a line-by-line scoring of a hypothetical wealth-tax proposition + the Winner/loser quantification rubric (Identity / Magnitude / Direction / Confidence / Counter-narrative), see synthesis-methodology.md Β§"DIW formula β€” canonical". For the Sainte-LaguΓ« seat-allocation walkthrough used in coalition-mathematics.md, see electoral-domain-methodology.md Β§"Worked example β€” Sainte-LaguΓ« modified seat allocation". Always show the divisor table; never assert seat outcomes without the computation visible.


πŸ—³οΈ Election lens requirements

The election lens activates whenever electionCycleAnchor in analysis/article-types.json is not none. All workflows within the active window include an Election Cycle block in synthesis-summary.md and produce election-cycle-analysis.md as part of Family D. Compatibility note: in the current synthesis-summary.md template, this same required block may still appear under the heading ## πŸ—³οΈ Election 2026 Implications; operators should treat that heading as the canonical Election Cycle section until template terminology is fully aligned. The block assesses five dimensions:

DimensionQuestion
🎯 Electoral ImpactHow does this shift positioning for the next general election?
🧩 Coalition ScenariosWhich coalition configurations benefit or suffer?
πŸ«‚ Voter SalienceWhich voter segments are most affected, and by how much?
βš”οΈ Campaign VulnerabilityWhich attack vectors does this open for the opposition?
πŸ“œ Policy LegacyWill this become an electoral asset or liability by election day?

Classify electoral significance as πŸ”΄ CRITICAL Β· 🟠 HIGH Β· 🟑 MODERATE Β· 🟒 LOW Β· βšͺ NEGLIGIBLE.

The cycle anchor, rollover window, and file-carry-forward rules are documented in Step 5 Β§Election lens and .github/prompts/ext/cycle-rollover.md.


πŸ“š Deep Political Intelligence Requirements

Every analysis goes beyond summary to produce intelligence. Every file contains at least three of the following:

  1. Named-actor attribution β€” minister, MP, spokesperson, rapporteur, with party abbreviation (M/S/SD/V/MP/C/L/KD) on first mention.
  2. Quantified impact β€” SEK budget figures, affected population, timeline, vote margins, poll points.
  3. Coalition dynamics β€” who gained, who lost, which commitments were traded.
  4. Cross-document linkage β€” at least one concrete reference to another dok_id in the same analysis period or prior riksmΓΆte.
  5. Forward-looking trigger β€” dated event ("watch FiU vote 2026-04-24") that would update this analysis.
  6. Counter-argument β€” one paragraph stating the strongest opposing interpretation, with its own evidence.
  7. International benchmark (P0/P1 only) β€” at least five comparator jurisdictions or historical precedents.

πŸ“‚ Folder Isolation Rule

Every workflow writes only inside its own folder:

analysis/daily/${ARTICLE_DATE}/${DOC_TYPE}/                 # standard per-type
analysis/daily/${ARTICLE_DATE}/realtime-${HHMM}/            # realtime runs
analysis/daily/${ARTICLE_DATE}/evening-analysis/            # evening synthesis
analysis/weekly/${ISO_WEEK}/                                # weekly review
analysis/monthly/${YYYY-MM}/                                # monthly review

git add is scoped:

git add "analysis/daily/${ARTICLE_DATE}/${DOC_TYPE}/"

Never touch another workflow's folder. Realtime runs always use a timestamped folder so parallel realtime runs never collide.


πŸ“­ Empty-Day Handling

If the MCP query returns zero documents for the target date:

flowchart TD
    Q0["Step 2 query returns 0 documents"] --> LB["πŸ“… Lookback 5 business days<br/>(download pipeline)"]
    LB -->|"found"| ANALYSE["βœ… Analyse found documents<br/>set Data Freshness field"]
    LB -->|"still 0"| DIRECT["πŸ”„ Direct MCP queries<br/>get_propositioner, get_betankanden,<br/>get_motioner, get_fragor, get_calendar_events"]
    DIRECT -->|"found"| ANALYSE
    DIRECT -->|"still 0"| CARRY["πŸ“Š Carry-forward protocol<br/>stale tag on active risks/SWOT<br/>parliamentary-calendar context"]

    style Q0 fill:#FFC107,color:#000000
    style ANALYSE fill:#4CAF50,color:#FFFFFF
    style CARRY fill:#9E9E9E,color:#FFFFFF
    style DIRECT fill:#1565C0,color:#FFFFFF

Carry-forward files contain: a parliamentary-calendar explanation, the most recent active risk / SWOT register with staleness flags, forward indicators for the next analysis cycle, and at least one Mermaid diagram. They never ship with only "Documents Analyzed: 0".


βœ… Quality Gate Checklist (run before every commit)

#CheckWhat passes
1Hack23 header block present on every .mdLogo + title + owner/version/date/classification badges
2β‰₯ 1 color-coded Mermaid diagram per file, β‰₯ 2 for synthesis filesUses the palette above with style directives
3β‰₯ 1 evidence table with Evidence (dok_id), Confidence, Impact columnsEvidence column cites a primary source
4Every claim has a confidence label from the 5-level scaleNo unlabeled assertions
5All templates followed β€” metadata block, document-control footerTemplate section order preserved
6No remaining [REQUIRED], [OPTIONAL], TODO, TBD, placeholder tokensPlaceholders replaced with real content
7Every politician named with party abbreviation on first mentionUlf Kristersson (M), Magdalena Andersson (S)
8Forward indicators have dated triggersSpecific committee dates, vote schedules, not "1–2 weeks"
9Folder isolation respectedgit status shows only analysis/daily/${DATE}/${SCOPE}/ paths
10Pass-2 rewrite applied to every fileEach section measurably improved vs. first pass
11Pass-2 Self-Audit Checklist completed per template (10 items)Every box ticked; failures force Pass-3 rewrite
12Narrative subsection scored β‰₯ 18 / 30 on the 6-axis rubric for executive-brief.md, synthesis-summary.md, and L2+ per-file artifactsNo single axis < 3

πŸ“˜ Template-to-File Index

Every file this guide references has a dedicated template. Keep template and file names 1:1.

File producedTemplateFamily
README.md (folder index)templates/README.mdA
executive-brief.mdtemplates/executive-brief.mdA
synthesis-summary.mdtemplates/synthesis-summary.mdA
significance-scoring.mdtemplates/significance-scoring.mdA
classification-results.mdtemplates/political-classification.mdA
swot-analysis.mdtemplates/swot-analysis.mdA
risk-assessment.mdtemplates/risk-assessment.mdA
threat-analysis.mdtemplates/threat-analysis.mdA
stakeholder-perspectives.mdtemplates/stakeholder-impact.mdA
data-download-manifest.mdtemplates/data-download-manifest.mdB
cross-reference-map.mdtemplates/cross-reference-map.mdB
scenario-analysis.mdtemplates/scenario-analysis.mdC
comparative-international.mdtemplates/comparative-international.mdC
devils-advocate.mdtemplates/devils-advocate.mdC
intelligence-assessment.mdtemplates/intelligence-assessment.mdC
methodology-reflection.mdtemplates/methodology-reflection.mdC
election-2026-analysis.mdtemplates/election-2026-analysis.mdD
voter-segmentation.mdtemplates/voter-segmentation.mdD
coalition-mathematics.mdtemplates/coalition-mathematics.mdD
historical-parallels.mdtemplates/historical-parallels.mdD
media-framing-analysis.mdtemplates/media-framing-analysis.mdD
implementation-feasibility.mdtemplates/implementation-feasibility.mdD
forward-indicators.mdtemplates/forward-indicators.mdD
documents/${dok_id}-analysis.mdtemplates/per-file-political-intelligence.mdE
documents/${cluster}-cluster-analysis.mdtemplates/per-file-political-intelligence.md Β§ ClusterE

πŸ“Ž Document-Type β†’ Primary Frameworks

Use this mapping to choose which frameworks get the most depth for each Riksdag document type. All types still pass through Family A; this matrix only indicates emphasis.

Document TypeMCP SourcePrimary FrameworksKey MCP Cross-Reference Tools
πŸ›οΈ BetΓ€nkanden (committee reports)betClassification + Risk + SWOT + Threatget_betankanden, search_voteringar, search_dokument_fulltext
πŸ“œ Propositioner (government bills)propRisk + Stakeholder + Feasibilityget_propositioner, search_dokument_fulltext
✊ Motioner (MP motions)motClassification + SWOT + Coalition-mathematicsget_motioner, search_ledamoter
❓ InterpellationeripThreat + Stakeholder + Intelligence-assessmentget_interpellationer, search_anforanden
πŸ“ Skriftliga frΓ₯gorfrClassification + Significanceget_fragor
πŸ—³οΈ VoteringarvoteringClassification + SWOT + Coalition-mathematics + Threatsearch_voteringar, get_voting_group
🎀 AnfârandenanfStakeholder + Media-framing + Significancesearch_anforanden, get_ledamot
πŸ“… KalenderkalSignificance + Forward-indicatorsget_calendar_events
πŸ’° Budget / Fiscal billsprop (budget)Risk + Feasibility + Voter-segmentation + Election-2026get_propositioner, IMF (WEO/FM via tsx scripts/imf-fetch.ts), SCB
πŸ›‘οΈ Defence / NATOmixedThreat + Comparative-international + Scenariosearch_dokument, SCB

πŸ” ISMS Alignment

This protocol operates under Hack23 ISMS-PUBLIC:

ISMS PolicyHow this guide applies it
Information_Security_Policy.mdScope, roles, accountability for all analysis outputs
AI_Policy.mdAI-driven content with human-in-the-loop editorial review
CLASSIFICATION.mdAll outputs classified Public; sensitive-inference analyses routed per policy
Threat_Modeling.mdthreat-analysis.md applies the political adaptation
Secure_Development_Policy.mdScript/AI separation: scripts download & render, AI analyses
STYLE_GUIDE.mdSWOT quadrant palette, evidence-table conventions

Every security-relevant control in Family A maps to ISO 27001:2022, NIST CSF 2.0, CIS Controls v8.1, GDPR Article 9(2)(e)/(g), and NIS2.


Family production methodologies β€” one per Family A–E (step-by-step "how to produce each output")

DocumentCovers (template family)
synthesis-methodology.mdπŸ“˜ Family A β€” significance-scoring, synthesis-summary, stakeholder-perspectives, stakeholder-impact, executive-brief
structural-metadata-methodology.mdπŸ“— Family B β€” data-download-manifest, cross-reference-map
strategic-extensions-methodology.mdπŸ“™ Family C β€” scenario-analysis, comparative-international, devils-advocate, intelligence-assessment, methodology-reflection
electoral-domain-methodology.mdπŸ“• Family D β€” election-cycle-analysis, voter-segmentation, coalition-mathematics, historical-parallels, media-framing, implementation-feasibility, forward-indicators
per-document-methodology.mdπŸ“’ Family E β€” {dok_id}-analysis.md and {theme}-cluster-analysis.md

Analytical frameworks (invoked inside the family methodologies)

DocumentPurpose
political-classification-guide.md7-dimension classification taxonomy
political-swot-framework.mdSWOT + TOWS + cross-SWOT interference
political-risk-methodology.mdLikelihood Γ— Impact + cascading risk chains
political-threat-framework.mdAttack trees + kill chain + threat taxonomy
political-style-guide.mdWriting voice, attribution, evidence density

PIR status sidecar β€” automated roll-forward

Every analysis cycle writes a pir-status.json sidecar alongside the 23 required artifacts:

ItemDetail
Schemaschemas/pir-status.schema.json v1.0 β€” JSON Schema 2020-12
Locationanalysis/daily/YYYY-MM-DD/{subfolder}/pir-status.json
Fieldsschema_version, cycle, date, subfolder, generated_at, inherited_from, pirs[]
PIR entry fieldspir_id (pattern PIR-*), statement, status, confidence, trigger, answer_summary, inherits_from[], evidence_refs[], horizon, admiralty_grade
Roll-forward scriptscripts/roll-forward-pirs.ts β€” propagates open PIRs from the previous cycle to the current cycle, degrading confidence by one level to flag staleness
CI gateCheck 9 in .github/prompts/05-analysis-gate.md β€” blocks article generation if pir-status.json is absent or structurally invalid

How to write pir-status.json during analysis (Step 7):

{
  "schema_version": "1.0",
  "cycle": "month-ahead",
  "date": "2026-04-27",
  "subfolder": "month-ahead",
  "generated_at": "2026-04-27T10:00:00Z",
  "inherited_from": null,
  "pirs": [
    {
      "pir_id": "PIR-1",
      "statement": "SD voting discipline on prop. 2025/26:236 (fuel tax)",
      "trigger": "May 2026 chamber vote on HD01FiU48",
      "status": "open",
      "confidence": "HIGH",
      "evidence_refs": ["HD01FiU48"],
      "horizon": "2026-05-15",
      "admiralty_grade": "B2"
    }
  ]
}

Roll-forward usage (next cycle):

npx tsx scripts/roll-forward-pirs.ts \
  --date 2026-04-28 --cycle month-ahead

Templates and platform exemplars

DocumentPurpose
../templates/One template per output file (24 templates, covers all Families A–E)
../../SWOT.mdFormatting exemplar (platform SWOT)
../../THREAT_MODEL.mdFormatting exemplar (platform threat model)

Document Control

  • Path: /analysis/methodologies/ai-driven-analysis-guide.md
  • Version: 6.9 β€” Tightened header, Step-5 Mermaid label aligned to "(all 12 always)", Common Failure Modes callout added
  • Key changes in v6.9: Step 5 Mermaid label corrected from "if warranted" to "(all 12 always)" to match the v6.2 every-run-every-file contract; header version + effective date bumped to 2026-05-15; Common Failure Modes block added (see above). Companion fix in analytical-supplementary-methodology.md β€” "Family-S supplementary (S1–S7)" β†’ "(AS1..AS4)" β€” corrects a stale step reference.
  • Key changes in v6.8: Long-horizon forecasting playbook + multi-cycle election lens (horizon stratification, scenario-tree depth, PESTLE threshold, PIR roll-forward, cross-horizon citation rule), Β§Multi-cycle election lens (four anchors, Β± 30-day rollover window, cycle-rollover cross-link), and Β§Horizon helper API (scripts/horizon-context.ts exports); replaced static "Election 2026" framing with parameterised cycle model driven by analysis/article-types.json; all cross-links reference existing bounded-context modules without duplication.
  • Key changes in v6.7: Added mandatory pir-status.json sidecar write step to Pass-2 checklist (Step 7); added PIR status sidecar reference section under Related Documents; added roll-forward usage example (scripts/roll-forward-pirs.ts) and schema reference (schemas/pir-status.schema.json).
  • Key changes in v6.6: Step 3 now points at the v1.3 doctype-variant detector (5 extended types: motion-package, fpm, utskottsbetΓ€nkande-variants, KU-anmΓ€lan, EU-nΓ€mnd) and adds Narrative subsection requirement for β‰₯ L2 per-file artifacts; Step 4 cross-reference-map row links to the 7 atomic edge types in structural-metadata-methodology.md v1.3; Step 7 Pass-2 rewrite checklist adds two binding items β€” Pass-2 Self-Audit Checklist (10 items) and Narrative 6-axis rubric (18/30 floor); DIW section adds worked-example callout to synthesis-methodology.md v1.3 (line-by-line scoring + winner/loser rubric) and Sainte-LaguΓ« walkthrough in electoral-domain-methodology.md v1.3; Quality Gate Checklist gains rows 11–12.
  • Key changes in v6.5: source diversity rule integration (political-style-guide.md v3.1)
  • Key changes in v6.4: Updated Step 1 reading list to reference Source Diversity Rule in political-style-guide.md v3.1 (multi-source corroboration by claim priority, conflict resolution, worked scenario); added Source Diversity check to Quality Gate Evidence dimension (P0/P1: β‰₯3 sources required); added source diversity verification to Pass-2 rewrite checklist; added IMF collection tools to referenced Collection Management Matrix.
  • Key changes in v6.3: Integrated F3EAD intelligence cycle stage labels into all 7 steps (Step 2=FIND/FIX, Step 3=FINISH, Step 4=EXPLOIT/ANALYZE, Step 5=ANALYZE, Step 7=DISSEMINATE); added SAT(s) Applied column to Family C+D file table; added Admiralty Code and WEP requirements to quality gate rubric; added ICD 203 compliance as hard pass/fail gate; updated Step 7 Pass-2 rewrite checklist with PIR/EEI tagging and Admiralty verification; reordered reading list to put political-style-guide.md (tradecraft anchors) at #2 after this guide.
  • Key changes in v6.2: Elevated Families C + D to always-produced core (no more trigger language); marked methodology-reflection.md as ⭐ VITAL run-audit gate with explicit quality-gate enforcement; added filename-variant mapping table (historical-baseline↔historical-parallels, election-2026-implications↔election-2026-analysis, international-comparative↔comparative-international); added depth-tier calibration table (L1/L2/L2+/L3) showing how files adapt without changing the output set; Output Matrix now marks all 6 workflow rows as "βœ… All" for every family; Step 5 rewritten as "always produced β€” 12 files" with per-file behaviour on light-event vs P0-dense days; every downstream methodology cross-ref updated.
  • Key changes in v6.1: Added links to five new Family production methodologies (synthesis, structural-metadata, strategic-extensions, electoral-domain, per-document).
  • Key changes in v6.0: Rewrote as positive-voice step-by-step guide; collapsed ~2 200 lines of audit history and anti-pattern text into a single 7-step protocol + 5-family output matrix; added canonical Mermaid palette and 5-level confidence scale; linked each analysis file to a dedicated template (Families A–E).
  • Classification: Public
  • Next Review: 2026-07-21
  • Tradecraft Standards: F3EAD (NATO), PIR/EEI, Admiralty Code (STANAG 2022), ICD 203, WEP + ODNI Confidence