README.md
April 24, 2026 ยท View on GitHub
๐ฌ Riksdagsmonitor โ Analysis Directory
๐ Political Intelligence Analysis Artifacts for Agentic Workflows
๐ฏ AI-Driven ยท Evidence-Based ยท Methodology-Guided ยท Never Scripted
๐ 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 Policy | Analysis Implementation |
|---|---|
| ๐ ๏ธ Secure Development Policy | Quality gates enforce evidence-based analysis; anti-pattern rejection prevents low-quality output |
| ๐ค AI Policy | AI agents MUST read methodology docs before analysis; per-file protocol ensures reproducibility |
| ๐ Classification Policy | 7-dimension classification adapted from ISMS for Swedish political events (see reference/) |
| ๐ Vulnerability Management | Political threat analysis uses 6 purpose-built dimensions, NOT software-centric models |
| ๐ Open Source Policy | All 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.
| Workflow | Output Folder | Example |
|---|---|---|
news-committee-reports | analysis/daily/YYYY-MM-DD/committeeReports/ | analysis/daily/2026-03-30/committeeReports/ |
news-propositions | analysis/daily/YYYY-MM-DD/propositions/ | analysis/daily/2026-03-30/propositions/ |
news-motions | analysis/daily/YYYY-MM-DD/motions/ | analysis/daily/2026-03-30/motions/ |
news-interpellations | analysis/daily/YYYY-MM-DD/interpellations/ | analysis/daily/2026-03-30/interpellations/ |
news-evening-analysis | analysis/daily/YYYY-MM-DD/evening/ | analysis/daily/2026-03-30/evening/ |
news-realtime-monitor | analysis/daily/YYYY-MM-DD/realtime-HHMM/ | analysis/daily/2026-03-30/realtime-1400/ |
news-weekly-review | analysis/weekly/YYYY-WNN/ | analysis/weekly/2026-W13/ |
news-monthly-review | analysis/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 files | Create SWOT entries, risk scores, or threat assessments |
| Validate output format (quality gate) | Fill template sections with generated content |
| Move/rename files | Produce "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:
- Commit a minimal
data-download-manifest.mddocumenting what was downloaded - Flag the analysis as
pendingfor the next workflow run - 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:
| Step | Script | Input | Output |
|---|---|---|---|
| 1. Aggregate | scripts/aggregate-analysis.ts | analysis/daily/$DATE/$SUB/*.md (+ documents/*-analysis.md) | analysis/daily/$DATE/$SUB/article.md (canonical, front-mattered) |
| 2. Render | scripts/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-translate | rendered *-en.html / *-sv.html | sibling *-$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
.mdyou write underanalysis/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_REPLACEmarker, no HTML template to fill โ see.github/prompts/06-article-generation.mdfor 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
| Workflow | Primary MCP Tool | Unique Analytics Only This Workflow Produces | Cross-Reference Tools |
|---|---|---|---|
| Committee Reports | get_betankanden | Committee voting splits, reservation analysis (dissenting opinions), committee-to-policy-domain mapping, fiscal/defence/healthcare committee specialisation metrics | search_voteringar (by beteckning), search_anforanden, get_propositioner |
| Propositions | get_propositioner | Legislative pipeline tracking (committee referral โ vote timeline), government legislative ambition scoring, policy domain impact analysis, budget allocation implications | search_dokument, analyze_g0v_by_department |
| Motions | get_motioner | Opposition party strategy analysis (which parties push which issues), motion clustering by theme, cross-party alignment detection, signalverdi (signal value) for upcoming legislative battles | search_dokument_fulltext, search_anforanden |
| Interpellations | get_interpellationer | Ministerial accountability scoring (response rate, timeliness, evasion detection), question-to-response quality analysis, party oversight strategy mapping | search_anforanden (minister speeches), get_calendar_events |
| Evening Analysis | search_voteringar + search_anforanden | Daily parliamentary pulse (vote results + debate intensity), party discipline metrics, coalition cohesion scoring, MP-level voting deviation from party line | get_betankanden, get_propositioner, get_calendar_events |
| Realtime Monitor | search_dokument + get_calendar_events | Breaking event detection, urgency classification, real-time political temperature index | All MCP tools as needed |
| Weekly Review | search_dokument (7-day window) | Week-over-week trend detection, cross-document-type pattern identification, political narrative arc tracking | search_voteringar, search_anforanden |
| Week Ahead | get_calendar_events (forward 7 days) | Prospective calendar analysis, scheduled debate preview, expected voting outcomes based on committee composition | search_dokument, get_fragor, get_interpellationer |
| Monthly Review | search_dokument (30-day window) | Monthly legislative throughput metrics, party productivity rankings, government vs opposition scorecard | All MCP tools for comprehensive retrospective |
| Month Ahead | get_calendar_events (forward 30 days) | Strategic political calendar, legislative pipeline forecast, major policy decision timeline | search_dokument, get_betankanden, get_propositioner |
Per-Document Unique Intelligence (Examples)
For high-significance documents (significance score โฅ 70), workflows produce document-specific deep dives:
| Document Type | Example dok_id | Unique Deep-Dive Analysis |
|---|---|---|
| Committee Report | H901JuU15 | Voting split heatmap by party, reservation text analysis, comparison with original proposition intent, dissent pattern vs committee norms |
| Proposition | H9032025/26:227 | Policy impact chain (which laws change โ who is affected), budget envelope impact, comparison with previous government bills in same domain |
| Motion | H902mot1234 | Opposition signalling analysis (is this a positioning motion or serious legislative bid?), cross-party co-sponsorship network, historical motion success rate for this topic |
| Interpellation | H902ip456 | Question 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
| Scope | Format | Example | Description |
|---|---|---|---|
| Daily | YYYY-MM-DD | 2026-03-26/ | ISO 8601 calendar date |
| Weekly | YYYY-WNN | 2026-W13/ | ISO 8601 week number (MonโSun) |
| Monthly | YYYY-MM | 2026-03/ | ISO 8601 year-month |
| Ad-hoc | descriptive | coalition-risk/ | Named topic directories when needed |
Rules:
- All directory names use zero-padded numbers (
W03, notW3) - Weekly directories align with ISO 8601: weeks start Monday
- Never use locale-specific date formats (no
26/3/2026orMar-26)
๐ค Workflow Integration
The following agentic workflows produce analysis artifacts. All workflows MUST:
- Write ONLY to their own article-type subfolder (folder isolation)
- Never overwrite analysis produced by another workflow
- Follow the AI-driven analysis protocol (read methodologies, then analyze)
- Never use scripts to generate analytical content
๐ Daily Morning Workflows (scheduled MonโFri)
| Workflow | Schedule | Output Folder | Primary Output |
|---|---|---|---|
news-committee-reports | 04:00 UTC | daily/YYYY-MM-DD/committeeReports/ | Committee report analysis |
news-propositions | 05:00 UTC | daily/YYYY-MM-DD/propositions/ | Proposition analysis |
news-motions | 06:00 UTC | daily/YYYY-MM-DD/motions/ | Motion analysis |
news-interpellations | 07:00 UTC | daily/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:
- Downloads data via
populate-analysis-data.ts+download-parliamentary-data.ts(scripts for DATA only) - AI reads ALL 6 methodology guides + ALL 8 templates
- AI performs per-file analysis on all pending files using genuine analytical reasoning
- AI composes daily synthesis from per-file analyses
- 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
| Workflow | Schedule | Output Folder | Output |
|---|---|---|---|
news-week-ahead | Fridays 07:00 UTC | weekly/YYYY-WNN/week-ahead/ | Weekly forecast + aggregated SWOT |
news-weekly-review | Scheduled | weekly/YYYY-WNN/review/ | Weekly parliamentary wrap-up |
news-month-ahead | Scheduled | monthly/YYYY-MM/month-ahead/ | Monthly forecast |
news-monthly-review | Scheduled | monthly/YYYY-MM/review/ | Monthly strategic brief |
๐ Template Usage Guide
Using a Template
- Copy the template from
analysis/templates/to the appropriate dated subdirectory - 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) - Fill all required fields (marked
[REQUIRED]) - Complete optional fields where evidence is available
- Validate against the methodology guide before consuming downstream
Template Quick Reference
| Template | When to Use | Key Output |
|---|---|---|
political-classification.md | New political event arrives | Sensitivity + urgency classification |
risk-assessment.md | Coalition/policy risk spike | Risk scores + mitigation map |
threat-analysis.md | Political Threat Taxonomy review | Threat inventory + actor mapping |
swot-analysis.md | Weekly/strategic SWOT pass | Quadrant entries with evidence |
stakeholder-impact.md | Policy decision announced | Impact by stakeholder group |
significance-scoring.md | Deciding what to publish | Composite score โ publish/skip |
synthesis-summary.md | Daily synthesis (aggregation) | Combined intelligence dashboard |
per-file-political-intelligence.md | Per-file AI analysis | Full deep analysis per document |
๐ Related Scripts
| Path | Purpose |
|---|---|
scripts/catalog-downloaded-data.ts | Catalog downloaded files, list pending analysis |
scripts/populate-analysis-data.ts | Standalone MCP data fetcher (7 data types) |
scripts/download-parliamentary-data.ts | Orchestrates 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.ts | Significance score computation |
scripts/analysis-framework/cross-reference.ts | Cross-document reference linking |
scripts/parliamentary-data/data-persistence.ts | MCP data persistence to analysis/data/ |
scripts/parliamentary-data/data-downloader.ts | Document download from riksdag-regering-mcp |
scripts/ai-analysis/ | AI-assisted analysis generation |
scripts/ai-analysis/swot/ | SWOT generation pipeline |
scripts/analysis-reader.ts | Read 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:
| Dimension | Weight | Minimum | Description |
|---|---|---|---|
| Evidence | 25% | 6/10 | Evidence density, citations per claim, source variety, dok_id references |
| Depth | 25% | 6/10 | Multi-framework application, analytical depth, cross-reference density, non-trivial insights |
| Structural | 20% | 7/10 | All template sections filled, required Mermaid diagrams present, coherent flow |
| Actionable | 15% | 6/10 | Clear implications, decision support, Riksdag-specific relevance, stakeholder identification |
| Neutrality | 15% | 7/10 | Balanced tone, writing quality, style guide compliance, clarity, no boilerplate or bias |
๐ ISMS Compliance Framework Mapping
ISO 27001:2022 Controls
| Control | Title | Analysis Implementation |
|---|---|---|
| A.5.1 | Policies for information security | All analysis methodologies align with Hack23 ISMS policy framework |
| A.5.10 | Acceptable use of information | Classification guide defines sensitivity-based data handling |
| A.5.33 | Protection of records | Style guide enforces evidence citation and audit trail |
| A.8.3 | Information access restriction | Sensitivity levels (PUBLIC/SENSITIVE/RESTRICTED) gate access |
| A.8.10 | Information deletion | 180-day SWOT decay rule ensures stale data is removed |
| A.8.28 | Secure coding | AI analysis guide enforces structured, reviewable output with quality gates |
NIST CSF 2.0 Functions
| Function | Analysis 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
| Control | Title | Analysis Relevance |
|---|---|---|
| Control 1 | Inventory and Control of Enterprise Assets | Classification guide inventories and categorizes all Riksdag data assets |
| Control 3 | Data Protection | Sensitivity levels enforce appropriate handling for each data classification |
| Control 8 | Audit Log Management | AI analysis guide requires documented quality gate assessments (audit trail) |
| Control 14 | Security Awareness and Skills Training | Methodology documents serve as training material for AI agents and analysts |
| Control 16 | Application Software Security | Quality gates enforce structured, validated analytical output |
๐ ISMS Adaptation Reference
The reference/ directory maps ISMS security frameworks to political intelligence:
| Reference Document | Source ISMS Document | Political Adaptation |
|---|---|---|
| isms-classification-adaptation.md | ISO 27001 A.5.12โA.5.13, Classification Policy | Confidentiality โ Sensitivity, Integrity โ Accuracy, Availability โ Urgency |
| isms-risk-assessment-adaptation.md | ISO 27001 A.8.8, Risk Assessment Methodology | CIA Triad โ Political Triad (Accountability, Policy Fidelity, Democratic Continuity) |
| isms-threat-modeling-adaptation.md | ISO 27001 A.5.7, NIST CSF ID.RA-3 | Political Threat Landscape + Attack Trees + Diamond Model |
| isms-style-guide-adaptation.md | STYLE_GUIDE | ISMS writing standards โ Political intelligence writing standards |
๐ Related Documentation
- ๐ ARCHITECTURE.md โ System architecture overview
- ๐ง MINDMAP.md โ Conceptual relationship map
- ๐ FLOWCHART.md โ Data flow diagrams
- ๐ก๏ธ THREAT_MODEL.md โ Platform threat analysis (formatting exemplar)
- ๐ผ SWOT.md โ Platform strategic analysis (formatting exemplar)
- ๐ SECURITY_ARCHITECTURE.md โ Security controls
๐ค 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
| Step | Action | Responsible | Tool / Reference |
|---|---|---|---|
| 1. Download | Scripts fetch MCP data to analysis/data/ | Scripts | scripts/populate-analysis-data.ts |
| 2. Catalog | List files needing analysis | Scripts | scripts/catalog-downloaded-data.ts --pending-only |
| 3. Read methods | AI reads ALL 6 methodology docs + 8 templates | AI | analysis/methodologies/*.md + analysis/templates/*.md |
| 4. Analyze | AI applies multi-framework analysis to each file | AI | Evidence-based reasoning, not scripts |
| 5. Write | Save {id}-analysis.md in workflow's isolated folder | AI | e.g. analysis/daily/YYYY-MM-DD/propositions/documents/H901prop227-analysis.md |
| 6. Synthesize | AI composes synthesis from per-file analyses | AI | analysis/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 assessment | Generic summary with no specific data, no cross-references, no named actors |
Methodology Documents (AI Must Read Before Analyzing)
| Priority | Document | Key Analytical Frameworks |
|---|---|---|
| ๐ด 1 | political-swot-framework.md | Evidence hierarchy, confidence levels, temporal decay, cross-SWOT interference, strategic scenario generation |
| ๐ด 2 | political-risk-methodology.md | 5ร5 LikelihoodรImpact, cascading risk analysis, Bayesian updating, risk interconnection mapping |
| ๐ด 3 | political-threat-framework.md | Attack Trees, Political Kill Chain, Diamond Model, Political Threat Taxonomy, threat actor profiling |
| ๐ 4 | political-classification-guide.md | Multi-dimensional classification, political temperature index, strategic significance |
| ๐ 5 | political-style-guide.md | Intelligence writing standards, evidence density requirements, attribution rules |
| ๐ 6 | ai-driven-analysis-guide.md | Master protocol: folder isolation, AI-only analysis, quality gates, time budget |
Analysis Prompts (v2)
| Prompt | Purpose |
|---|---|
| per-file-intelligence-analysis.md | Step-by-step per-file analysis protocol |
| political-analysis.md | Core political analysis framework (6 lenses) |
| swot-generation.md | SWOT generation with pre-computed data |
| political-risk-prompt.md | Risk assessment prompt |
| political-threat-prompt.md | Threat analysis prompt |
| quality-criteria.md | Quality 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:
- Repository: https://github.com/Hack23/riksdagsmonitor
- Path:
/analysis/README.md - Format: Markdown
- Classification: Public
- Version: 4.0
- Next Review: 2026-06-30
๐ 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