README.md

April 24, 2026 ยท View on GitHub

Hack23 Logo

๐Ÿ”ฌ Riksdagsmonitor โ€” Analysis Directory

๐Ÿ“Š Political Intelligence Analysis Artifacts for Agentic Workflows
๐ŸŽฏ AI-Driven ยท Evidence-Based ยท Methodology-Guided ยท Never Scripted

Owner Version Effective Date Classification

๐Ÿ“‹ Document Owner: CEO | ๐Ÿ“„ Version: 4.0 | ๐Ÿ“… Last Updated: 2026-03-31 (UTC)
๐Ÿ”„ Review Cycle: Quarterly | โฐ Next Review: 2026-06-30
๐Ÿข Owner: Hack23 AB (Org.nr 5595347807) | ๐Ÿท๏ธ Classification: Public


๐Ÿ“š Architecture Documentation Map

Document Focus Description Documentation Link
Architecture ๐Ÿ›๏ธ Architecture C4 model showing current system structure View Source
Security Architecture ๐Ÿ›ก๏ธ Security Security controls and compliance mapping View Source
Threat Model ๐ŸŽฏ Security Political Threat Landscape analysis View Source
SWOT Analysis ๐Ÿ’ผ Business Strategic assessment (formatting exemplar) View Source
Data Model ๐Ÿ“Š Data Current data structures and relationships View Source
Flowcharts ๐Ÿ”„ Process Current data processing workflows View Source
Workflows โš™๏ธ DevOps CI/CD and agentic workflow documentation View Source
Analysis Methodologies ๐Ÿ“ Methodology 6 political intelligence analysis frameworks View Source
Analysis Templates ๐Ÿ“‹ Templates 23 structured analysis output templates (8 core single-type + 15 extended / Tier-C) View Source

๐Ÿ” ISMS Policy Alignment

ISMS PolicyAnalysis Implementation
๐Ÿ› ๏ธ Secure Development PolicyQuality gates enforce evidence-based analysis; anti-pattern rejection prevents low-quality output
๐Ÿค– AI PolicyAI agents MUST read methodology docs before analysis; per-file protocol ensures reproducibility
๐Ÿ“ Classification Policy7-dimension classification adapted from ISMS for Swedish political events (see reference/)
๐Ÿ” Vulnerability ManagementPolitical threat analysis uses 6 purpose-built dimensions, NOT software-centric models
๐Ÿ”“ Open Source PolicyAll methodology documents published under project license for transparency

๐Ÿšจ CRITICAL RULES โ€” Read Before Any Analysis Work

Rule 1: Folder Isolation โ€” Every Workflow Gets Its Own Folder

analysis/daily/YYYY-MM-DD/{articleType}/

Every agentic workflow MUST write ONLY to its own article-type subfolder. Workflows MUST NEVER write to another workflow's folder. This prevents overwriting.

WorkflowOutput FolderExample
news-committee-reportsanalysis/daily/YYYY-MM-DD/committeeReports/analysis/daily/2026-03-30/committeeReports/
news-propositionsanalysis/daily/YYYY-MM-DD/propositions/analysis/daily/2026-03-30/propositions/
news-motionsanalysis/daily/YYYY-MM-DD/motions/analysis/daily/2026-03-30/motions/
news-interpellationsanalysis/daily/YYYY-MM-DD/interpellations/analysis/daily/2026-03-30/interpellations/
news-evening-analysisanalysis/daily/YYYY-MM-DD/evening/analysis/daily/2026-03-30/evening/
news-realtime-monitoranalysis/daily/YYYY-MM-DD/realtime-HHMM/analysis/daily/2026-03-30/realtime-1400/
news-weekly-reviewanalysis/weekly/YYYY-WNN/analysis/weekly/2026-W13/
news-monthly-reviewanalysis/monthly/YYYY-MM/analysis/monthly/2026-03/

Rule 2: Never Overwrite Existing Analysis

An agentic workflow MUST NEVER overwrite analysis produced by another workflow. Each workflow run creates new files in its own scope. If a file already exists, the workflow MUST skip it or create an addendum, never replace.

flowchart LR
    A["Workflow starts"] --> B{"Does target folder<br/>already contain<br/>analysis files?"}
    B -->|"No"| C["โœ… Create analysis<br/>in own folder"]
    B -->|"Yes โ€” from SAME workflow"| D["โœ… Update/append<br/>to own files only"]
    B -->|"Yes โ€” from DIFFERENT workflow"| E["๐Ÿšซ NEVER touch<br/>other workflow's files"]

    style C fill:#4CAF50,color:#FFFFFF
    style D fill:#FFC107,color:#000000
    style E fill:#D32F2F,color:#FFFFFF

Rule 3: AI Performs ALL Analysis โ€” Never Scripted Content

Scripts download data. AI performs ALL analysis. This is a fundamental architectural principle.

โœ… Scripts MAY๐Ÿšซ Scripts MUST NEVER
Download MCP data to analysis/data/Generate analysis prose, tables, or conclusions
Catalog pending filesCreate SWOT entries, risk scores, or threat assessments
Validate output format (quality gate)Fill template sections with generated content
Move/rename filesProduce "placeholder" analysis that looks real

The AI agent reads the 6 core methodology guides (of 11 total) and the 8 core output templates (of 23 total), reads the actual data, and produces genuine analytical content based on evidence found in the documents. The remaining 5 methodology files (electoral-domain, per-document, strategic-extensions, structural-metadata, synthesis) provide domain-specific and meta-methodology context; the remaining 15 templates cover Tier-C aggregation (scenario-analysis, executive-brief, coalition-mathematics, election-2026-analysis, historical-parallels, comparative-international, devils-advocate, forward-indicators, implementation-feasibility, intelligence-assessment, media-framing-analysis, methodology-reflection, voter-segmentation, data-download-manifest, cross-reference-map).

Fallback mechanism: If AI analysis fails or produces unusable output (detected by the quality gate bash check in .github/prompts/ โ€” see the README for the module catalogue), the workflow should:

  1. Commit a minimal data-download-manifest.md documenting what was downloaded
  2. Flag the analysis as pending for the next workflow run
  3. Never commit placeholder or stub content that masquerades as genuine analysis

Rule 4: Deep Analysis โ€” Not Shallow Summaries

Every analysis file must demonstrate genuine political intelligence depth. The quality standard is SWOT.md (965 lines of strategic analysis) and THREAT_MODEL.md (2,938 lines of multi-framework threat modeling).

Minimum depth indicators:

  • โ‰ฅ 3 evidence-backed claims per SWOT quadrant (with dok_id citations)
  • โ‰ฅ 1 color-coded Mermaid diagram per analysis file (with real data, not placeholders)
  • Multi-perspective analysis (government, opposition, citizen, media, international)
  • Explicit confidence labels on every analytical claim
  • Forward-looking indicators (what to watch next, with specific triggers)
  • Cross-document pattern identification (how this document relates to other recent activity)

Rule 5: Mandatory Data Download โ€” ALWAYS Before Analysis

Every agentic workflow MUST download Riksdag data before deciding whether to produce an article. Data collection is NEVER optional:

flowchart TD
    Start(["๐Ÿš€ Workflow Triggered"]) --> Health["๐Ÿฅ MCP Health Gate\nget_sync_status"]
    Health -->|"โœ… Healthy"| Feeds["๐Ÿ“ก Download ALL\nFeed Endpoints"]
    Health -->|"โŒ Failed 3x"| Abort(["โ›” Abort Run"])
    Feeds --> Advisory["๐Ÿ“‹ Download Advisory\nFeeds MANDATORY"]
    Advisory --> Analytics["๐Ÿ”ฌ Run Analytical\nContext Tools"]
    Analytics --> Gate{"๐Ÿ“ฐ Newsworthy\nItems Found?"}
    Gate -->|"โœ… Yes"| Analyze["๐Ÿค– Per-File Analysis\n+ Article Generation"]
    Gate -->|"โŒ No"| Noop["๐Ÿ“ noop\nwith analysis summary"]

    style Start fill:#1565C0,stroke:#0D47A1,color:#FFFFFF
    style Health fill:#9E9E9E,stroke:#616161,color:#FFFFFF
    style Feeds fill:#2E7D32,stroke:#2E7D32,color:#FFFFFF
    style Advisory fill:#4CAF50,stroke:#2E7D32,color:#FFFFFF
    style Analytics fill:#7B1FA2,stroke:#4A148C,color:#FFFFFF
    style Gate fill:#FFC107,stroke:#FFA000,color:#000000
    style Analyze fill:#FF9800,stroke:#F57C00,color:#FFFFFF
    style Noop fill:#BDBDBD,stroke:#9E9E9E,color:#000000
    style Abort fill:#D32F2F,stroke:#B71C1C,color:#FFFFFF

Key rules:

  • timeframe: "today" first, fallback to "one-week" for empty/error/timeout feeds
  • Riksdag API can take 30โ€“90+ seconds per call โ€” NEVER abort slow responses
  • Partial data is better than no data โ€” continue with other feeds on individual failures
  • Even on noop, all data collection and analysis MUST complete first

Rule 6: Evidence-Based Only

Every factual claim must have a source citation. Every non-factual assessment must have a confidence level (HIGH/MEDIUM/LOW). Opinion-only entries are REJECTED.


๐ŸŽฏ Purpose

The analysis/ directory stores political intelligence analysis artifacts produced by Riksdagsmonitor's agentic workflows. These artifacts bridge raw Swedish parliamentary data (sourced via the riksdag-regering-mcp server) and the final published political intelligence articles, news summaries, and dashboards across 14 languages.

flowchart LR
    subgraph "๐Ÿ“ก Data Collection"
        RD["๐Ÿ›๏ธ Riksdag MCP\nServer"]
    end

    subgraph "๐Ÿ”ฌ Analysis Pipeline"
        DL["๐Ÿ“ฅ Download\nFeed Data"]
        AI["๐Ÿค– Per-File\nAI Analysis"]
        QG["โœ… Analysis Gate\n(05-analysis-gate.md)"]
    end

    subgraph "๐Ÿ“ฐ Article Generation (aggregate โ†’ render)"
        AGG["๐Ÿงฉ aggregate-analysis.ts\nโ†’ article.md"]
        REN["๐ŸŽจ render-articles.ts + render-lib/\nโ†’ $DATE-$SUB-en/sv.html"]
        TR["๐ŸŒ news-translate\nโ†’ 12 languages"]
    end

    RD --> DL --> AI --> QG --> AGG --> REN --> TR

    style RD fill:#0D47A1,stroke:#0D47A1,color:#FFFFFF
    style DL fill:#1565C0,stroke:#0D47A1,color:#FFFFFF
    style AI fill:#7B1FA2,stroke:#4A148C,color:#FFFFFF
    style QG fill:#2E7D32,stroke:#2E7D32,color:#FFFFFF
    style AGG fill:#FF9800,stroke:#F57C00,color:#FFFFFF
    style REN fill:#FF9800,stroke:#F57C00,color:#FFFFFF
    style TR fill:#D32F2F,stroke:#B71C1C,color:#FFFFFF

Analysis artifacts are genuine intelligence products โ€” not summaries or reformatted data โ€” that enable:

  • ๐Ÿ”„ Workflow composition: Upstream agents deposit analysis; downstream agents consume it
  • ๐Ÿ“ Consistent methodology: 6 core frameworks (of 11 methodology files) + 8 core templates (of 23 total output templates) enforce analytical rigor
  • ๐Ÿ“Š Full data analysis: Every downloaded MCP file receives per-file deep analysis
  • ๐Ÿง  Reusable intelligence: Cross-workflow pattern sharing and knowledge accumulation
  • ๐ŸŽฏ Quality assurance: Minimum 7.0/10 quality gate before article generation
  • ๐Ÿ”€ Collision-free design: Per-workflow directories prevent merge conflicts
  • ๐Ÿ“… Temporal aggregation: Daily โ†’ Weekly โ†’ Monthly intelligence roll-ups

๐Ÿ—๏ธ Analysis System Architecture

graph TB
    subgraph "๐ŸŒ Data Sources"
        RD["๐Ÿ›๏ธ Riksdag API<br/><i>Parliamentary data</i>"]
        REG["๐Ÿข Regeringen.se<br/><i>Government data</i>"]
        CIA["๐Ÿ“Š CIA Platform<br/><i>Hack23 intelligence</i>"]
    end

    subgraph "๐Ÿ“ฅ Data Ingestion Layer"
        MCP["๐Ÿ”Œ riksdag-regering-mcp<br/><i>MCP Server</i>"]
        PRE["๐Ÿ“ฅ download-parliamentary-data.ts<br/><i>Data download + catalog</i>"]
    end

    subgraph "๐Ÿ“š Methodology Framework (v3.0)"
        direction TB
        GUIDE["๐Ÿค– AI-Driven Guide<br/><i>Master Protocol</i>"]
        M1["๐Ÿท๏ธ Classification"]
        M2["โš ๏ธ Risk"]
        M3["๐Ÿ’ผ SWOT"]
        M4["๐ŸŽญ Threat"]
        M5["โœ๏ธ Style"]
    end

    subgraph "๐Ÿ“‹ Template Library (8 Core Single-Type Templates + 15 Extended for Tier-C)"
        T1["๐Ÿ” Per-File Intel"]
        T2["๐Ÿท๏ธ Classification"]
        T3["โš ๏ธ Risk"]
        T4["๐Ÿ’ผ SWOT"]
        T5["๐ŸŽญ Threat"]
        T6["๐Ÿ“ˆ Significance"]
        T7["๐Ÿ‘ฅ Stakeholder"]
        T8["๐Ÿงฉ Synthesis"]
    end

    subgraph "๐Ÿค– AI Analysis Engine"
        AI["๐Ÿง  GitHub Copilot<br/>Coding Agent<br/><i>All analysis performed here</i>"]
    end

    subgraph "โœ… Quality Assurance"
        QG["โœ… Analysis Gate<br/><i>05-analysis-gate.md validation</i>"]
    end

    subgraph "๐Ÿงฉ Article Pipeline (aggregate โ†’ render)"
        AGG["๐Ÿงฉ aggregate-analysis.ts<br/><i>analysis/daily/$DATE/$SUB/*.md โ†’ article.md</i>"]
        REN["๐ŸŽจ render-articles.ts + render-lib/<br/><i>unified โ†’ remark โ†’ rehype โ†’ sanitise โ†’ HTML chrome</i>"]
    end

    subgraph "๐Ÿ“ฐ Output"
        ART["๐Ÿ“ฐ News Articles<br/><i>en/sv master + 12 translations</i>"]
        DASH["๐Ÿ“Š Dashboards<br/><i>Political intelligence</i>"]
    end

    RD & REG & CIA --> MCP
    MCP --> PRE
    PRE -->|"raw data only"| AI
    GUIDE & M1 & M2 & M3 & M4 & M5 -->|"frameworks"| AI
    T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8 -->|"templates"| AI
    AI -->|"analysis artifacts"| QG
    QG -->|"approved"| AGG
    AGG --> REN
    REN --> ART
    AI -->|"data products"| DASH

    style RD fill:#1565C0,color:#FFFFFF,stroke:#0D47A1,stroke-width:2px
    style REG fill:#1565C0,color:#FFFFFF,stroke:#0D47A1,stroke-width:2px
    style CIA fill:#1565C0,color:#FFFFFF,stroke:#0D47A1,stroke-width:2px
    style MCP fill:#7B1FA2,color:#FFFFFF,stroke:#4A148C,stroke-width:2px
    style PRE fill:#7B1FA2,color:#FFFFFF,stroke:#4A148C,stroke-width:2px
    style GUIDE fill:#D32F2F,color:#FFFFFF,stroke:#B71C1C,stroke-width:2px
    style AI fill:#2E7D32,color:#FFFFFF,stroke:#2E7D32,stroke-width:3px
    style QG fill:#FF9800,color:#FFFFFF,stroke:#F57C00,stroke-width:2px
    style AGG fill:#FF9800,color:#FFFFFF,stroke:#F57C00,stroke-width:2px
    style REN fill:#FF9800,color:#FFFFFF,stroke:#F57C00,stroke-width:2px
    style ART fill:#FFC107,color:#000000,stroke:#FFA000,stroke-width:2px
    style DASH fill:#FFC107,color:#000000,stroke:#FFA000,stroke-width:2px
    style M1 fill:#EEEEEE,color:#212121,stroke:#BDBDBD
    style M2 fill:#EEEEEE,color:#212121,stroke:#BDBDBD
    style M3 fill:#EEEEEE,color:#212121,stroke:#BDBDBD
    style M4 fill:#EEEEEE,color:#212121,stroke:#BDBDBD
    style M5 fill:#EEEEEE,color:#212121,stroke:#BDBDBD
    style T1 fill:#BBDEFB,color:#0D47A1,stroke:#90CAF9
    style T2 fill:#BBDEFB,color:#0D47A1,stroke:#90CAF9
    style T3 fill:#BBDEFB,color:#0D47A1,stroke:#90CAF9
    style T4 fill:#BBDEFB,color:#0D47A1,stroke:#90CAF9
    style T5 fill:#BBDEFB,color:#0D47A1,stroke:#90CAF9
    style T6 fill:#BBDEFB,color:#0D47A1,stroke:#90CAF9
    style T7 fill:#BBDEFB,color:#0D47A1,stroke:#90CAF9
    style T8 fill:#BBDEFB,color:#0D47A1,stroke:#90CAF9

๐Ÿงฉ Article Pipeline โ€” analysis/ is the article

Articles are not authored in HTML. Every rendered news/$DATE-$SUB-$LANG.html is a pure projection of the markdown artifacts in this directory, produced by two deterministic CLI scripts:

StepScriptInputOutput
1. Aggregatescripts/aggregate-analysis.tsanalysis/daily/$DATE/$SUB/*.md (+ documents/*-analysis.md)analysis/daily/$DATE/$SUB/article.md (canonical, front-mattered)
2. Renderscripts/render-articles.ts + scripts/render-lib/article.md (or article.<lang>.md)news/$DATE-$SUB-$LANG.html (sanitised, chrome-wrapped)
3. Translate (EN+SV โ†’ 12 extra)news-translaterendered *-en.html / *-sv.htmlsibling *-$LANG.html files

The aggregator enforces a canonical narrative order (executive-brief โ†’ synthesis โ†’ significance โ†’ stakeholder โ†’ SWOT โ†’ risk โ†’ threat โ†’ per-document intelligence โ†’ scenario/forward/comparative/historical โ†’ methodology-reflection โ†’ data-download-manifest). The renderer uses the unified โ†’ remark-parse โ†’ remark-gfm โ†’ remark-rehype โ†’ rehype-raw โ†’ rehype-slug โ†’ rehype-autolink-headings โ†’ rehype-sanitize โ†’ rehype-stringify pipeline; Mermaid fences survive as <pre class="mermaid"> and are upgraded to SVG client-side.

Implications for every analysis author (human or AI):

  • โœ… Every .md you write under analysis/daily/$DATE/$SUB/ ships verbatim (modulo sanitisation) to the published article.
  • โœ… Fix quality by fixing the .md, not by editing the rendered HTML (HTML is regenerated on every run).
  • โœ… Relative links in analysis files are auto-rewritten to absolute github.com/Hack23/riksdagsmonitor/blob/main/โ€ฆ URLs so every citation stays auditable.
  • ๐Ÿšซ There is no scaffold, no AI_MUST_REPLACE marker, no HTML template to fill โ€” see .github/prompts/06-article-generation.md for the full contract.

๐Ÿ“š Documentation Map

Document Type Focus Link
Methodologies README ๐Ÿ“š Index Complete methodology catalog with architecture diagrams View
Templates README ๐Ÿ“‹ Index Template catalog with usage flow and quality standards View
AI-Driven Guide ๐Ÿค– Protocol Master protocol for all AI analysis View
Classification Guide ๐Ÿท๏ธ Method 7-dimension political taxonomy View
Risk Methodology โš ๏ธ Method Cascading risk assessment model View
SWOT Framework ๐Ÿ’ผ Method TOWS + Cross-SWOT analysis View
Threat Framework ๐ŸŽญ Method 4-framework threat modeling (v3.0) View
Style Guide โœ๏ธ Standards Evidence citation and writing standards View
ISMS Classification ๐Ÿ“– Reference ISO 27001 โ†’ Political classification mapping View
ISMS Risk ๐Ÿ“– Reference ISO 27001 โ†’ Political risk mapping View
ISMS Style ๐Ÿ“– Reference ISO 27001 โ†’ Political writing mapping View
ISMS Threat ๐Ÿ“– Reference ISO 27001 โ†’ Political threat mapping View

๐ŸŽฏ Article-Type-Specific Analytics Matrix

Every agentic workflow produces unique political intelligence tailored to its document type. This is not generic analysis โ€” each workflow downloads type-specific data via MCP and produces analytics that only that document type can provide.

graph TB
    subgraph "๐Ÿ“‹ Document-Type Workflows"
        CR["๐Ÿ“‹ Committee Reports<br/><code>get_betankanden</code>"]
        PR["๐Ÿ“œ Propositions<br/><code>get_propositioner</code>"]
        MO["โœŠ Motions<br/><code>get_motioner</code>"]
        IP["โ“ Interpellations<br/><code>get_interpellationer</code>"]
    end

    subgraph "๐Ÿ“ฐ Synthesis Workflows"
        EV["๐ŸŒ™ Evening Analysis<br/><code>search_voteringar + search_anforanden</code>"]
        RT["โšก Realtime Monitor<br/><code>search_dokument + get_calendar_events</code>"]
    end

    subgraph "๐Ÿ“Š Aggregation Workflows"
        WR["๐Ÿ“… Weekly Review<br/><code>search_dokument (7-day)</code>"]
        WA["๐Ÿ”ฎ Week Ahead<br/><code>get_calendar_events (7-day forward)</code>"]
        MR["๐Ÿ“Š Monthly Review<br/><code>search_dokument (30-day)</code>"]
        MA["๐Ÿ”ฎ Month Ahead<br/><code>get_calendar_events (30-day forward)</code>"]
    end

    CR -->|"vote records"| EV
    PR -->|"legislative pipeline"| EV
    MO -->|"opposition patterns"| EV
    IP -->|"accountability gaps"| EV
    EV -->|"daily synthesis"| WR
    RT -->|"breaking events"| WR
    WR -->|"weekly patterns"| MR
    WA -->|"calendar preview"| MA

    style CR fill:#2E7D32,color:#FFFFFF,stroke:#2E7D32,stroke-width:2px
    style PR fill:#1565C0,color:#FFFFFF,stroke:#0D47A1,stroke-width:2px
    style MO fill:#FF9800,color:#FFFFFF,stroke:#F57C00,stroke-width:2px
    style IP fill:#D32F2F,color:#FFFFFF,stroke:#B71C1C,stroke-width:2px
    style EV fill:#7B1FA2,color:#FFFFFF,stroke:#4A148C,stroke-width:2px
    style RT fill:#C2185B,color:#FFFFFF,stroke:#880E4F,stroke-width:2px
    style WR fill:#4CAF50,color:#000000,stroke:#2E7D32,stroke-width:2px
    style WA fill:#2196F3,color:#000000,stroke:#0097A7,stroke-width:2px
    style MR fill:#E91E63,color:#FFFFFF,stroke:#C2185B,stroke-width:2px
    style MA fill:#FF5722,color:#FFFFFF,stroke:#e64a19,stroke-width:2px

Per-Workflow Unique Analytics

WorkflowPrimary MCP ToolUnique Analytics Only This Workflow ProducesCross-Reference Tools
Committee Reportsget_betankandenCommittee voting splits, reservation analysis (dissenting opinions), committee-to-policy-domain mapping, fiscal/defence/healthcare committee specialisation metricssearch_voteringar (by beteckning), search_anforanden, get_propositioner
Propositionsget_propositionerLegislative pipeline tracking (committee referral โ†’ vote timeline), government legislative ambition scoring, policy domain impact analysis, budget allocation implicationssearch_dokument, analyze_g0v_by_department
Motionsget_motionerOpposition party strategy analysis (which parties push which issues), motion clustering by theme, cross-party alignment detection, signalverdi (signal value) for upcoming legislative battlessearch_dokument_fulltext, search_anforanden
Interpellationsget_interpellationerMinisterial accountability scoring (response rate, timeliness, evasion detection), question-to-response quality analysis, party oversight strategy mappingsearch_anforanden (minister speeches), get_calendar_events
Evening Analysissearch_voteringar + search_anforandenDaily parliamentary pulse (vote results + debate intensity), party discipline metrics, coalition cohesion scoring, MP-level voting deviation from party lineget_betankanden, get_propositioner, get_calendar_events
Realtime Monitorsearch_dokument + get_calendar_eventsBreaking event detection, urgency classification, real-time political temperature indexAll MCP tools as needed
Weekly Reviewsearch_dokument (7-day window)Week-over-week trend detection, cross-document-type pattern identification, political narrative arc trackingsearch_voteringar, search_anforanden
Week Aheadget_calendar_events (forward 7 days)Prospective calendar analysis, scheduled debate preview, expected voting outcomes based on committee compositionsearch_dokument, get_fragor, get_interpellationer
Monthly Reviewsearch_dokument (30-day window)Monthly legislative throughput metrics, party productivity rankings, government vs opposition scorecardAll MCP tools for comprehensive retrospective
Month Aheadget_calendar_events (forward 30 days)Strategic political calendar, legislative pipeline forecast, major policy decision timelinesearch_dokument, get_betankanden, get_propositioner

Per-Document Unique Intelligence (Examples)

For high-significance documents (significance score โ‰ฅ 70), workflows produce document-specific deep dives:

Document TypeExample dok_idUnique Deep-Dive Analysis
Committee ReportH901JuU15Voting split heatmap by party, reservation text analysis, comparison with original proposition intent, dissent pattern vs committee norms
PropositionH9032025/26:227Policy impact chain (which laws change โ†’ who is affected), budget envelope impact, comparison with previous government bills in same domain
MotionH902mot1234Opposition signalling analysis (is this a positioning motion or serious legislative bid?), cross-party co-sponsorship network, historical motion success rate for this topic
InterpellationH902ip456Question framing analysis (adversarial vs inquiry), minister response timeliness, evasion score (did the minister actually answer?), policy commitment extraction

๐Ÿ“ Directory Structure

analysis/
โ”œโ”€โ”€ README.md                          โ† This file (CRITICAL RULES โ€” read first)
โ”œโ”€โ”€ data/                              โ† Persistent MCP data repository (collision-free)
โ”‚   โ”œโ”€โ”€ README.md                      โ† Data repository documentation
โ”‚   โ”œโ”€โ”€ documents/                     โ† Parliamentary documents by type
โ”‚   โ”‚   โ”œโ”€โ”€ propositions/              โ† Government propositions ({dok_id}.json + .meta.json)
โ”‚   โ”‚   โ”œโ”€โ”€ motions/                   โ† Parliamentary motions
โ”‚   โ”‚   โ”œโ”€โ”€ committeeReports/          โ† Committee reports
โ”‚   โ”‚   โ”œโ”€โ”€ votes/                     โ† Voting records
โ”‚   โ”‚   โ”œโ”€โ”€ speeches/                  โ† Parliamentary speeches
โ”‚   โ”‚   โ”œโ”€โ”€ questions/                 โ† Written questions
โ”‚   โ”‚   โ””โ”€โ”€ interpellations/           โ† Interpellations
โ”‚   โ”œโ”€โ”€ votes/                         โ† Date-stamped vote ballots (YYYY-MM-DD/)
โ”‚   โ”œโ”€โ”€ events/                        โ† Date-stamped calendar events (YYYY-MM-DD/)
โ”‚   โ”œโ”€โ”€ mps/                           โ† MP profiles (intressent_id.json)
โ”‚   โ”œโ”€โ”€ worldbank/                     โ† World Bank economic indicators
โ”‚   โ”œโ”€โ”€ scb/                           โ† Statistics Sweden (SCB) table data
โ”‚   โ””โ”€โ”€ mcp-responses/                 โ† Generic MCP tool response archive
โ”œโ”€โ”€ templates/                         โ† Analysis templates (AI fills these โ€” NEVER scripts)
โ”‚   โ”œโ”€โ”€ political-classification.md    โ† Event classification template
โ”‚   โ”œโ”€โ”€ risk-assessment.md             โ† Political risk template (5ร—5 matrix + cascading risk)
โ”‚   โ”œโ”€โ”€ threat-analysis.md             โ† Multi-framework threat template (Attack Trees + Kill Chain)
โ”‚   โ”œโ”€โ”€ swot-analysis.md               โ† SWOT quadrant template (evidence-based, intersection analysis)
โ”‚   โ”œโ”€โ”€ stakeholder-impact.md          โ† Stakeholder impact template (6 analytical lenses)
โ”‚   โ”œโ”€โ”€ significance-scoring.md        โ† Significance scoring template (5-dimension rubric)
โ”‚   โ”œโ”€โ”€ synthesis-summary.md           โ† Daily synthesis template (aggregates all above)
โ”‚   โ””โ”€โ”€ per-file-political-intelligence.md โ† Per-file AI analysis template
โ”œโ”€โ”€ methodologies/                     โ† Detailed methodology guides (AI MUST read ALL before analyzing)
โ”‚   โ”œโ”€โ”€ ai-driven-analysis-guide.md    โ† Master protocol: folder isolation, AI-only analysis, quality gates
โ”‚   โ”œโ”€โ”€ political-classification-guide.md โ† Multi-dimensional classification, political temperature
โ”‚   โ”œโ”€โ”€ political-risk-methodology.md  โ† 5ร—5 matrix, cascading risk, Bayesian updating
โ”‚   โ”œโ”€โ”€ political-threat-framework.md  โ† Attack Trees, Kill Chain, Diamond Model, Political Threat Taxonomy
โ”‚   โ”œโ”€โ”€ political-swot-framework.md    โ† Evidence hierarchy, cross-SWOT interference, scenario generation
โ”‚   โ””โ”€โ”€ political-style-guide.md       โ† Intelligence writing standards, evidence density, attribution
โ”œโ”€โ”€ reference/                         โ† ISMS adaptation mappings
โ”‚   โ”œโ”€โ”€ isms-classification-adaptation.md
โ”‚   โ”œโ”€โ”€ isms-risk-assessment-adaptation.md
โ”‚   โ”œโ”€โ”€ isms-threat-modeling-adaptation.md
โ”‚   โ””โ”€โ”€ isms-style-guide-adaptation.md
โ”œโ”€โ”€ daily/                             โ† Per-day analysis (YYYY-MM-DD/{articleType}/ โ€” ISOLATED per workflow)
โ”‚   โ””โ”€โ”€ README.md
โ”œโ”€โ”€ weekly/                            โ† Per-week aggregations (YYYY-WNN/)
โ”‚   โ””โ”€โ”€ README.md
โ””โ”€โ”€ monthly/                           โ† Per-month strategic briefs (YYYY-MM/)
    โ””โ”€โ”€ README.md

๐Ÿ”’ Folder Isolation Model (Critical)

analysis/daily/2026-03-30/              โ† Date folder
โ”œโ”€โ”€ committeeReports/                   โ† news-committee-reports ONLY writes here
โ”‚   โ”œโ”€โ”€ documents/                      โ† Per-file analyses
โ”‚   โ”‚   โ”œโ”€โ”€ H901AU10-analysis.md
โ”‚   โ”‚   โ””โ”€โ”€ H901JuU25-analysis.md
โ”‚   โ”œโ”€โ”€ synthesis-summary.md
โ”‚   โ””โ”€โ”€ data-download-manifest.md
โ”œโ”€โ”€ propositions/                       โ† news-propositions ONLY writes here
โ”‚   โ”œโ”€โ”€ documents/
โ”‚   โ”‚   โ”œโ”€โ”€ H901prop227-analysis.md
โ”‚   โ”‚   โ””โ”€โ”€ H901prop213-analysis.md
โ”‚   โ”œโ”€โ”€ synthesis-summary.md
โ”‚   โ””โ”€โ”€ data-download-manifest.md
โ”œโ”€โ”€ motions/                            โ† news-motions ONLY writes here
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ interpellations/                    โ† news-interpellations ONLY writes here
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ evening/                            โ† news-evening-analysis ONLY writes here
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ realtime-1400/                      โ† news-realtime-monitor ONLY writes here (timestamped)
    โ””โ”€โ”€ ...

Enforcement: Each workflow's git add scope MUST be limited to its own subfolder:

# โœ… CORRECT โ€” scoped to article type
git add "analysis/daily/${ARTICLE_DATE}/${DOC_TYPE}/"

# ๐Ÿšซ WRONG โ€” broad scope can overwrite other workflows
git add "analysis/daily/${ARTICLE_DATE}/"

๐Ÿ“… Naming Conventions

ScopeFormatExampleDescription
DailyYYYY-MM-DD2026-03-26/ISO 8601 calendar date
WeeklyYYYY-WNN2026-W13/ISO 8601 week number (Monโ€“Sun)
MonthlyYYYY-MM2026-03/ISO 8601 year-month
Ad-hocdescriptivecoalition-risk/Named topic directories when needed

Rules:

  • All directory names use zero-padded numbers (W03, not W3)
  • Weekly directories align with ISO 8601: weeks start Monday
  • Never use locale-specific date formats (no 26/3/2026 or Mar-26)

๐Ÿค– Workflow Integration

The following agentic workflows produce analysis artifacts. All workflows MUST:

  1. Write ONLY to their own article-type subfolder (folder isolation)
  2. Never overwrite analysis produced by another workflow
  3. Follow the AI-driven analysis protocol (read methodologies, then analyze)
  4. Never use scripts to generate analytical content

๐ŸŒ… Daily Morning Workflows (scheduled Monโ€“Fri)

WorkflowScheduleOutput FolderPrimary Output
news-committee-reports04:00 UTCdaily/YYYY-MM-DD/committeeReports/Committee report analysis
news-propositions05:00 UTCdaily/YYYY-MM-DD/propositions/Proposition analysis
news-motions06:00 UTCdaily/YYYY-MM-DD/motions/Motion analysis
news-interpellations07:00 UTCdaily/YYYY-MM-DD/interpellations/Interpellation analysis

๐ŸŒ† news-evening-analysis (18:00 UTC Monโ€“Fri, 16:00 UTC Sat)

Output folder: daily/YYYY-MM-DD/evening/

The evening analysis workflow is the most comprehensive. It:

  1. Downloads data via populate-analysis-data.ts + download-parliamentary-data.ts (scripts for DATA only)
  2. AI reads ALL 6 methodology guides + ALL 8 templates
  3. AI performs per-file analysis on all pending files using genuine analytical reasoning
  4. AI composes daily synthesis from per-file analyses
  5. AI generates evening analysis articles โ€” all content is AI-produced intelligence

๐Ÿ“ก news-realtime-monitor (10:00+14:00 UTC Monโ€“Fri, 12:00 UTC weekends)

Output folder: daily/YYYY-MM-DD/realtime-HHMM/ (timestamped to prevent overwrites)

Real-time monitoring of parliamentary activity with per-file analysis on new data. Each run gets a unique timestamped folder so successive runs never overwrite each other.

๐Ÿ“… Weekly & Monthly Workflows

WorkflowScheduleOutput FolderOutput
news-week-aheadFridays 07:00 UTCweekly/YYYY-WNN/week-ahead/Weekly forecast + aggregated SWOT
news-weekly-reviewScheduledweekly/YYYY-WNN/review/Weekly parliamentary wrap-up
news-month-aheadScheduledmonthly/YYYY-MM/month-ahead/Monthly forecast
news-monthly-reviewScheduledmonthly/YYYY-MM/review/Monthly strategic brief

๐Ÿ“ Template Usage Guide

Using a Template

  1. Copy the template from analysis/templates/ to the appropriate dated subdirectory
  2. Rename using scope/workflow conventions from the target directory README.md (e.g. daily: morning-risk-snapshot.md / evening-swot-update.md / realtime-HHMM-risk-delta.md, weekly: week-summary-swot.md, monthly: monthly-risk-register.md)
  3. Fill all required fields (marked [REQUIRED])
  4. Complete optional fields where evidence is available
  5. Validate against the methodology guide before consuming downstream

Template Quick Reference

TemplateWhen to UseKey Output
political-classification.mdNew political event arrivesSensitivity + urgency classification
risk-assessment.mdCoalition/policy risk spikeRisk scores + mitigation map
threat-analysis.mdPolitical Threat Taxonomy reviewThreat inventory + actor mapping
swot-analysis.mdWeekly/strategic SWOT passQuadrant entries with evidence
stakeholder-impact.mdPolicy decision announcedImpact by stakeholder group
significance-scoring.mdDeciding what to publishComposite score โ†’ publish/skip
synthesis-summary.mdDaily synthesis (aggregation)Combined intelligence dashboard
per-file-political-intelligence.mdPer-file AI analysisFull deep analysis per document

PathPurpose
scripts/catalog-downloaded-data.tsCatalog downloaded files, list pending analysis
scripts/populate-analysis-data.tsStandalone MCP data fetcher (7 data types)
scripts/download-parliamentary-data.tsOrchestrates raw data download and persistence (manifest + JSON)
scripts/analysis-framework/Core analysis pipeline (TypeScript)
scripts/analysis-framework/lenses/Per-perspective classifiers (citizen, economic, government, international, media, opposition)
scripts/analysis-framework/significance-scorer.tsSignificance score computation
scripts/analysis-framework/cross-reference.tsCross-document reference linking
scripts/parliamentary-data/data-persistence.tsMCP data persistence to analysis/data/
scripts/parliamentary-data/data-downloader.tsDocument download from riksdag-regering-mcp
scripts/ai-analysis/AI-assisted analysis generation
scripts/ai-analysis/swot/SWOT generation pipeline
scripts/analysis-reader.tsRead daily analysis files with fallback
scripts/prompts/v2/LLM prompt templates for analysis (v2)

๐Ÿ“Š Per-File AI Analysis Quality Gate

Every per-file analysis must score โ‰ฅ 7.0/10 across the 5 weighted dimensions defined in methodologies/ai-driven-analysis-guide.md:

DimensionWeightMinimumDescription
Evidence25%6/10Evidence density, citations per claim, source variety, dok_id references
Depth25%6/10Multi-framework application, analytical depth, cross-reference density, non-trivial insights
Structural20%7/10All template sections filled, required Mermaid diagrams present, coherent flow
Actionable15%6/10Clear implications, decision support, Riksdag-specific relevance, stakeholder identification
Neutrality15%7/10Balanced tone, writing quality, style guide compliance, clarity, no boilerplate or bias

๐Ÿ”’ ISMS Compliance Framework Mapping

ISO 27001:2022 Controls

ControlTitleAnalysis Implementation
A.5.1Policies for information securityAll analysis methodologies align with Hack23 ISMS policy framework
A.5.10Acceptable use of informationClassification guide defines sensitivity-based data handling
A.5.33Protection of recordsStyle guide enforces evidence citation and audit trail
A.8.3Information access restrictionSensitivity levels (PUBLIC/SENSITIVE/RESTRICTED) gate access
A.8.10Information deletion180-day SWOT decay rule ensures stale data is removed
A.8.28Secure codingAI analysis guide enforces structured, reviewable output with quality gates

NIST CSF 2.0 Functions

FunctionAnalysis Relevance
Identify (ID)Classification guide identifies and categorizes Riksdag events by sensitivity and impact
Protect (PR)Style guide protects analytical quality through evidence requirements and anti-patterns
Detect (DE)Threat framework detects political threats across 6 dimensions using multiple analytical models
Respond (RS)Risk methodology provides quantified risk scores enabling proportionate response
Recover (RC)SWOT framework supports strategic recovery planning through forward-looking opportunity analysis

CIS Controls v8.1

ControlTitleAnalysis Relevance
Control 1Inventory and Control of Enterprise AssetsClassification guide inventories and categorizes all Riksdag data assets
Control 3Data ProtectionSensitivity levels enforce appropriate handling for each data classification
Control 8Audit Log ManagementAI analysis guide requires documented quality gate assessments (audit trail)
Control 14Security Awareness and Skills TrainingMethodology documents serve as training material for AI agents and analysts
Control 16Application Software SecurityQuality gates enforce structured, validated analytical output

๐Ÿ”’ ISMS Adaptation Reference

The reference/ directory maps ISMS security frameworks to political intelligence:

Reference DocumentSource ISMS DocumentPolitical Adaptation
isms-classification-adaptation.mdISO 27001 A.5.12โ€“A.5.13, Classification PolicyConfidentiality โ†’ Sensitivity, Integrity โ†’ Accuracy, Availability โ†’ Urgency
isms-risk-assessment-adaptation.mdISO 27001 A.8.8, Risk Assessment MethodologyCIA Triad โ†’ Political Triad (Accountability, Policy Fidelity, Democratic Continuity)
isms-threat-modeling-adaptation.mdISO 27001 A.5.7, NIST CSF ID.RA-3Political Threat Landscape + Attack Trees + Diamond Model
isms-style-guide-adaptation.mdSTYLE_GUIDEISMS writing standards โ†’ Political intelligence writing standards


๐Ÿค– Per-File AI Analysis (Primary Analysis Mode)

The primary analysis mode is per-file AI-driven analysis: for every downloaded MCP data file, the AI agent produces a deep analysis markdown file. The AI reads all methodology guides, reads the actual data, and produces genuine political intelligence โ€” not script-generated summaries.

How It Works

flowchart LR
    A["๐Ÿ“ฅ MCP Download<br/>(scripts โ€” DATA only)"] --> B["๐Ÿ“‹ Catalog<br/>pending files"]
    B --> C["๐Ÿ“– AI reads ALL<br/>6 methodology guides<br/>+ 8 templates"]
    C --> D["๐Ÿ” AI performs<br/>genuine analysis<br/>per document"]
    D --> E["๐Ÿ’พ {id}-analysis.md<br/>in workflow's folder"]
    E --> F["๐Ÿ“Š AI composes<br/>daily synthesis"]

    style A fill:#1565C0,color:#FFFFFF
    style C fill:#7B1FA2,color:#FFFFFF
    style D fill:#4CAF50,color:#FFFFFF
    style F fill:#7B1FA2,color:#FFFFFF
StepActionResponsibleTool / Reference
1. DownloadScripts fetch MCP data to analysis/data/Scriptsscripts/populate-analysis-data.ts
2. CatalogList files needing analysisScriptsscripts/catalog-downloaded-data.ts --pending-only
3. Read methodsAI reads ALL 6 methodology docs + 8 templatesAIanalysis/methodologies/*.md + analysis/templates/*.md
4. AnalyzeAI applies multi-framework analysis to each fileAIEvidence-based reasoning, not scripts
5. WriteSave {id}-analysis.md in workflow's isolated folderAIe.g. analysis/daily/YYYY-MM-DD/propositions/documents/H901prop227-analysis.md
6. SynthesizeAI composes synthesis from per-file analysesAIanalysis/daily/YYYY-MM-DD/{articleType}/synthesis-summary.md

What "Genuine AI Analysis" Means (vs. Scripted Content)

โœ… Genuine AI Analysis๐Ÿšซ Scripted/Shallow Content
"Proposition 2025/26:227 strengthens criminal penalties for gang crime, extending minimum sentences from 4โ†’6 years. Coalition partner L has historically resisted harsh sentencing (see L motion 2024/25:1234), creating potential friction. SD has publicly demanded even stricter measures (interpellation 2025/26:456). Risk: L could break ranks on floor vote, though KD mediation has historically bridged such gaps (vote record H901JuU15). [MEDIUM confidence]""This proposition relates to justice policy. The government's position is strengthened. [MEDIUM confidence]"
Cross-references 3+ documents, names specific actors with party, identifies tension dynamics, provides forward risk assessmentGeneric summary with no specific data, no cross-references, no named actors

Methodology Documents (AI Must Read Before Analyzing)

PriorityDocumentKey Analytical Frameworks
๐Ÿ”ด 1political-swot-framework.mdEvidence hierarchy, confidence levels, temporal decay, cross-SWOT interference, strategic scenario generation
๐Ÿ”ด 2political-risk-methodology.md5ร—5 Likelihoodร—Impact, cascading risk analysis, Bayesian updating, risk interconnection mapping
๐Ÿ”ด 3political-threat-framework.mdAttack Trees, Political Kill Chain, Diamond Model, Political Threat Taxonomy, threat actor profiling
๐ŸŸ  4political-classification-guide.mdMulti-dimensional classification, political temperature index, strategic significance
๐ŸŸ  5political-style-guide.mdIntelligence writing standards, evidence density requirements, attribution rules
๐ŸŸ  6ai-driven-analysis-guide.mdMaster protocol: folder isolation, AI-only analysis, quality gates, time budget

Analysis Prompts (v2)

PromptPurpose
per-file-intelligence-analysis.mdStep-by-step per-file analysis protocol
political-analysis.mdCore political analysis framework (6 lenses)
swot-generation.mdSWOT generation with pre-computed data
political-risk-prompt.mdRisk assessment prompt
political-threat-prompt.mdThreat analysis prompt
quality-criteria.mdQuality self-assessment rubric (โ‰ฅ7/10)

Conflict Resolution

Because each workflow writes to its own isolated folder:

  • Per-file analyses ({id}-analysis.md) are conflict-free โ€” each file analyzed independently in its workflow's folder
  • Daily synthesis files are scoped to each workflow's folder โ€” no cross-workflow conflicts
  • Weekly aggregations read from all daily folders (read-only) to compose weekly intelligence
  • Realtime monitor uses timestamped folders (realtime-HHMM/) so successive runs never overwrite

Quality Standard: Every per-file analysis must match SWOT.md and THREAT_MODEL.md formatting quality โ€” Hack23 header badges, color-coded Mermaid diagrams, evidence tables with confidence labels, multi-framework analysis, and actionable intelligence.


Document Control:


๐Ÿ“Š Temporal Aggregation Architecture

graph LR
    subgraph "๐Ÿ“… Daily Analysis"
        D1["๐Ÿ“„ Per-Document<br/>Analyses"]
        D2["๐Ÿงฉ Daily<br/>Synthesis"]
    end

    subgraph "๐Ÿ“† Weekly Intelligence"
        W1["๐Ÿ“ฐ Weekly<br/>Review"]
        W2["๐Ÿ”ฎ Week<br/>Ahead"]
    end

    subgraph "๐Ÿ“… Monthly Intelligence"
        M1["๐Ÿ“Š Monthly<br/>Review"]
        M2["๐Ÿ”ฎ Month<br/>Ahead"]
    end

    D1 -->|"aggregate"| D2
    D2 -->|"7-day roll-up"| W1
    D2 -->|"prospective"| W2
    W1 -->|"4-week roll-up"| M1
    W2 -->|"monthly forecast"| M2

    style D1 fill:#1565C0,color:#FFFFFF,stroke:#0D47A1,stroke-width:2px
    style D2 fill:#1565C0,color:#FFFFFF,stroke:#0D47A1,stroke-width:2px
    style W1 fill:#FF9800,color:#FFFFFF,stroke:#F57C00,stroke-width:2px
    style W2 fill:#7B1FA2,color:#FFFFFF,stroke:#4A148C,stroke-width:2px
    style M1 fill:#D32F2F,color:#FFFFFF,stroke:#B71C1C,stroke-width:2px
    style M2 fill:#C2185B,color:#FFFFFF,stroke:#880E4F,stroke-width:2px

๐Ÿ“Š Hack23 AB โ€” Political Intelligence Through Systematic Analysis