From e10477ff996b097bd3581bf1dfe9ae79e64490cc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 10:01:35 +0000 Subject: [PATCH 1/5] Partial: workflow prompt streamlining (tests still failing) Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/320efe76-e009-4528-b7c4-3e8b543cebce Co-authored-by: pethers <1726836+pethers@users.noreply.github.com> --- .github/workflows/news-committee-reports.md | 179 ++------- .github/workflows/news-evening-analysis.md | 364 +++--------------- .github/workflows/news-interpellations.md | 187 ++------- .github/workflows/news-month-ahead.md | 169 ++------ .github/workflows/news-monthly-review.md | 169 ++------ .github/workflows/news-motions.md | 179 ++------- .github/workflows/news-propositions.md | 200 ++-------- .github/workflows/news-realtime-monitor.md | 80 +--- .github/workflows/news-week-ahead.md | 169 ++------ .github/workflows/news-weekly-review.md | 169 ++------ analysis/methodologies/README.md | 28 +- .../methodologies/ai-driven-analysis-guide.md | 158 +++++++- .../political-classification-guide.md | 27 +- .../political-risk-methodology.md | 38 +- .../methodologies/political-style-guide.md | 52 ++- .../methodologies/political-swot-framework.md | 60 ++- .../political-threat-framework.md | 13 +- analysis/templates/README.md | 27 +- .../per-file-political-intelligence.md | 33 +- .../templates/political-classification.md | 42 +- analysis/templates/risk-assessment.md | 45 ++- analysis/templates/significance-scoring.md | 40 +- analysis/templates/stakeholder-impact.md | 48 ++- analysis/templates/swot-analysis.md | 52 ++- analysis/templates/synthesis-summary.md | 67 +++- analysis/templates/threat-analysis.md | 37 +- 26 files changed, 961 insertions(+), 1671 deletions(-) diff --git a/.github/workflows/news-committee-reports.md b/.github/workflows/news-committee-reports.md index 186990c84f..ac4f97dc10 100644 --- a/.github/workflows/news-committee-reports.md +++ b/.github/workflows/news-committee-reports.md @@ -142,17 +142,7 @@ This focused approach ensures: ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-committee-reports.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-committee-reports.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-committee-reports.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -167,48 +157,15 @@ This workflow uses **persistent repo-memory** on branch `memory/news-generation` ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** - -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | - -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. - -## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash - -> **The Agent Workflow Firewall (AWF) blocks dangerous shell expansion patterns.** Fenced bash blocks in init steps run as normal shell, but any command YOU generate via the `bash` tool IS subject to AWF filtering. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` -**Key rules — NEVER use these in your generated bash commands:** -1. **NEVER** use `$`+`{VAR}` — always use `$VAR` (no curly braces) -2. **NEVER** use `$`+`(command)` — use pipes, `find -exec`, or separate commands -3. **NEVER** use `$`+`{VAR:-default}` — set defaults with `if/then` first, then use `$VAR` -4. **Use `find -exec`** instead of for-loops with `$`+`(basename ...)` -5. **Use direct file paths** when possible instead of variable-constructed paths with braces +## 🛡️ AWF Shell Safety -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "AWF Shell Safety". Summary: use `$VAR` not `$`+`{VAR}`, use `find -exec` not `$(...)`, set defaults with `if/then` before using `$VAR`. -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. +## 🔤 UTF-8 Encoding -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## 🚫 CRITICAL: Article Generation Safety @@ -235,19 +192,10 @@ source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types ## Required Skills -Before generating articles, consult these skills: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -284,6 +232,10 @@ Based on the editorial profile for `committee-reports` (from `scripts/editorial- > 🚨 **ANTI-PATTERNS (REJECTED)**: "Requires committee review and chamber debate" (generic boilerplate), SWOT with only Government/Opposition/Civil Society (need all 8 groups), risk as "MEDIUM" text without L×I numbers, articles with 0 Mermaid diagrams, no dok_id citations in article body. +### 🗳️ Election 2026 Lens (Mandatory — v5.0) + +Every analysis MUST include an **Election 2026 Implications** section assessing: Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, and Policy Legacy. Use the **5-level confidence scale** (⬛VERY LOW → 🟥LOW → 🟧MEDIUM → 🟩HIGH → 🟦VERY HIGH). See `analysis/methodologies/ai-driven-analysis-guide.md` v5.0 for full criteria. + ### Phase 1 — Data Collection & Initial Analysis 1. Fetch MCP data (`get_betankanden`, `get_sync_status`, cross-reference `search_voteringar`) 2. Detect policy domains for each report using `scripts/statistical-claims-detector.ts` @@ -321,14 +273,9 @@ echo "Article Type: committee-reports" echo "============================" ``` -## 📅 Riksmöte (Parliamentary Session) Calculation +## 📅 Riksmöte Calculation -The Swedish parliamentary session runs September–August. Calculate the current `rm` value: -- If current month is September or later (calendar month 9; JavaScript `Date` month index 8): `rm = "{currentYear}/{nextYear's last 2 digits}"` -- If current month is before September (calendar month ≤ 8; JavaScript `Date` month index ≤ 7): `rm = "{previousYear}/{currentYear's last 2 digits}"` -- Example: February 2026 → `rm = "2025/26"`, October 2026 → `rm = "2026/27"` - -Use this calculated `rm` value in ALL MCP queries requiring the `rm` parameter. +September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. ## MANDATORY Deduplication Check @@ -357,55 +304,22 @@ fi ## MANDATORY MCP Health Gate -Before generating ANY articles, verify MCP connectivity: - -1. Call `get_sync_status({})` — if successful, proceed -2. If it fails, wait 30 seconds and retry (up to 3 total attempts) -3. If ALL 3 attempts fail: - - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated." - - DO NOT analyze existing articles in the repository - - DO NOT fabricate or recycle content - - The workflow MUST end with noop - -**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from: -- Existing articles in the news/ directory -- Cached or stale data -- AI-generated content without MCP source data +1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) +2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/{article-type} -``` -Example: `news/content/2026-03-23/committee-reports` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-23/committee-reports`). `safeoutputs___create_pull_request` handles this automatically. ## MANDATORY PR Creation -> **🚀 HOW SAFE PR CREATION WORKS — READ THIS FIRST** -> -> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. You do NOT create branches or push manually. -> -> **Exact steps:** -> 1. Write article files to `news/` using `bash` or `edit` tools -> 2. Stage and commit locally using the enforcement block below -> 3. Call `safeoutputs___create_pull_request` with `title`, `body`, and `labels` +> `safeoutputs___create_pull_request` handles branch creation, push, and PR opening — do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool directly. + ```bash # Stage articles and analysis — scoped to article type to stay within 100-file PR limit @@ -429,40 +343,15 @@ fi echo "📊 Final staged file count: $STAGED_COUNT" git commit -m "Add committee-reports articles and analysis artifacts" ``` -> -> **❌ DO NOT** run `git push`, `git checkout -b`, `git branch`, or use GitHub API to create PRs. -> **❌ DO NOT** try alternative approaches if the tool call works — one call is all you need. -> **❌ DO NOT** call `safeoutputs___noop` if articles were generated but PR creation failed — let the workflow FAIL instead. - -- ✅ **REQUIRED:** `safeoutputs___create_pull_request` when articles generated -- ✅ **REQUIRED:** `safeoutputs___create_pull_request` with analysis-only PR when no articles but analysis artifacts exist — title: `📊 Analysis Only - Committee Reports - {date}`, labels: `["analysis-only", "committee-reports"]` -- ✅ **ONLY USE `safeoutputs___noop` if MCP server is completely unreachable after 3 retry attempts AND no analysis artifacts exist** -- ❌ **NEVER use `safeoutputs___noop` because articles already exist** — analysis always runs -- ❌ **NEVER use `safeoutputs___noop` as fallback for PR creation failures** -- ❌ **NEVER use `safeoutputs___noop` if analysis artifacts exist in `analysis/daily/$ARTICLE_DATE/committeeReports/` for this run** -> **🚨 NEVER search for safe output tools via bash.** `safeoutputs___create_pull_request`, `safeoutputs___noop`, `safeoutputs___missing_tool`, and `safeoutputs___missing_data` are **always available as direct tool calls** in your tool list. NEVER run `ls /tmp/gh-aw/`, `ls /home/runner/.copilot/`, or any bash command to "find" them. After `git commit`, call the tool directly as your VERY NEXT action. +- ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs (`analysis-only` + `committee-reports` labels) +- ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist +- ❌ NEVER noop because articles already exist — analysis always runs +- ❌ Safe output tools are in your tool list — NEVER search for them via bash ## 🌐 Dispatch Translation Workflow -After creating the content PR with `safeoutputs___create_pull_request`, dispatch the translation workflow for remaining languages: - -``` -safeoutputs___dispatch_workflow({ - "workflow_name": "news-translate", - "inputs": { - "article_date": "", - "article_type": "", - "languages": "all-extra" - } -}) -``` - -This triggers the dedicated `news-translate` workflow which generates high-quality translations for all 12 non-core languages (da, no, fi, de, fr, es, nl, ar, he, ja, ko, zh) using `concurrency.job-discriminator` for parallel execution. - -> **⚠️ Timing note:** The dispatch runs immediately after creating this PR, but the translate workflow checks out `main` where the EN/SV articles may not yet exist (the content PR hasn't been merged). In this case, the translate workflow will `noop` gracefully. The scheduled translate cron (11:00 and 17:00 UTC weekdays) will pick up the translations after the content PR is merged. - -> **Note:** Full translation quality rules are maintained in `news-translate.md`. When generating EN/SV articles, ensure content is analytically rich — translations will faithfully reproduce the same depth. +After creating the content PR, dispatch translations: `safeoutputs___dispatch_workflow({ "workflow_name": "news-translate", "inputs": { "article_date": "", "article_type": "", "languages": "all-extra" } })`. See `news-translate.md` for full translation quality rules. ## MCP Tools @@ -944,16 +833,8 @@ Then create PR: safeoutputs___create_pull_request ``` -## 🌐 MANDATORY Translation Quality Rules - -> **📋 Canonical translation rules are maintained in `news-translate.md`.** - -For EN/SV articles generated by this workflow, ensure: -1. **ALL section headings** and body content in the correct language (EN or SV) -2. **Meta keywords** in the article language -3. **No untranslated data-translate spans** in final output -4. Swedish API titles translated to article language +## 🌐 Translation Quality -When the `news-translate` workflow handles remaining 12 languages, it applies the full translation quality rules including RTL support (ar, he), CJK native script (ja, ko, zh), Nordic parliamentary terms (da, no, fi), and European formal register (de, fr, es, nl). See `news-translate.md` for comprehensive per-language requirements. +EN/SV only: all headings, meta, content in correct language; no untranslated `data-translate` spans; Swedish API titles translated. Full rules: `news-translate.md`. ## Article Naming Convention Files: `YYYY-MM-DD-committee-reports-{lang}.html` (e.g., `2026-02-22-committee-reports-en.html`) \ No newline at end of file diff --git a/.github/workflows/news-evening-analysis.md b/.github/workflows/news-evening-analysis.md index 41377ca3ab..5138b683f4 100644 --- a/.github/workflows/news-evening-analysis.md +++ b/.github/workflows/news-evening-analysis.md @@ -147,48 +147,15 @@ You are the **Evening Political Analyst** for Riksdagsmonitor. Generate comprehe ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | +## 🛡️ AWF Shell Safety -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "AWF Shell Safety". Summary: use `$VAR` not `$`+`{VAR}`, use `find -exec` not `$(...)`, set defaults with `if/then` before using `$VAR`. -## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash +## 🔤 UTF-8 Encoding -> **The Agent Workflow Firewall (AWF) blocks dangerous shell expansion patterns.** Fenced bash blocks in init steps run as normal shell, but any command YOU generate via the `bash` tool IS subject to AWF filtering. - -**Key rules — NEVER use these in your generated bash commands:** -1. **NEVER** use `$`+`{VAR}` — always use `$VAR` (no curly braces) -2. **NEVER** use `$`+`(command)` — use pipes, `find -exec`, or separate commands -3. **NEVER** use `$`+`{VAR:-default}` — set defaults with `if/then` first, then use `$VAR` -4. **Use `find -exec`** instead of for-loops with `$`+`(basename ...)` -5. **Use direct file paths** when possible instead of variable-constructed paths with braces - -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content - -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. - -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## ⚠️ NON-NEGOTIABLE RULES @@ -205,17 +172,7 @@ bash({ command: "..." }) // ← WRONG: missing description ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-evening-analysis.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-evening-analysis.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-evening-analysis.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) @@ -241,19 +198,10 @@ START_TIME=$(date +%s) ## Required Skills -Before generating articles, consult these skills: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -290,6 +238,10 @@ Based on the editorial profile for `evening-analysis` (from `scripts/editorial-f > 🚨 **ANTI-PATTERNS (REJECTED)**: Surface-level daily summaries without analysis, SWOT with only 3 groups, no Mermaid diagrams, no risk scores, no forward indicators +### 🗳️ Election 2026 Lens (Mandatory — v5.0) + +Every analysis MUST include an **Election 2026 Implications** section assessing: Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, and Policy Legacy. Use the **5-level confidence scale** (⬛VERY LOW → 🟥LOW → 🟧MEDIUM → 🟩HIGH → 🟦VERY HIGH). See `analysis/methodologies/ai-driven-analysis-guide.md` v5.0 for full criteria. + ### Phase 1 — Data Collection & Initial Analysis 1. Fetch today's activity from MCP (`search_anforanden` — filter by `datum`, `get_betankanden` — filter by `publicerad`, `search_voteringar` — filter by `datum`, `get_sync_status`) 2. Score newsworthiness of each item using `scoreNewsworthiness()` logic @@ -319,10 +271,9 @@ echo "Day of week: $DAY_OF_WEEK (6=Saturday weekly wrap-up)" echo "============================" ``` -## 📅 Riksmöte (Parliamentary Session) Calculation -- September or later: `rm = "{currentYear}/{nextYear's last 2 digits}"` -- Before September: `rm = "{previousYear}/{currentYear's last 2 digits}"` -- Example: February 2026 → `rm = "2025/26"` +## 📅 Riksmöte Calculation + +Sep+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before Sep → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). ## MANDATORY Deduplication Check @@ -349,13 +300,7 @@ fi ### MCP Health Gate -STEP 1: ALWAYS check data freshness first — call `get_sync_status({})` to warm up MCP and check stale data. - -1. Call `get_sync_status({})` — if successful, proceed -2. If it fails, wait 30 seconds and retry (up to 3 total attempts) -3. If ALL 3 attempts fail → `safeoutputs___noop` with "MCP server unavailable after 3 connection attempts." - -**ALL article content MUST originate from live MCP data.** +Call `get_sync_status({})` first; retry up to 3× (30s wait). After 3 failures → `safeoutputs___noop("MCP unavailable")`. All content MUST come from live MCP data. ### DATA FRESHNESS CHECK @@ -369,240 +314,52 @@ if (hoursSinceSync > 48) { /* add stale data disclaimer */ } Use riksdag-regering-mcp (32 tools for Swedish parliament data). For ad-hoc queries, use `scripts/mcp-query-cli.ts` — NEVER implement custom MCP client code (PROHIBITION). -**Date calculation pattern:** +**Date calculation (canonical pattern):** ```javascript -const lookbackHours = 24; // adjust as needed (e.g. 8 for evening analysis, 168 for weekly) const now = new Date(); -const fromDate = new Date(now.getTime() - lookbackHours * 3600000); // 3600000 ms = 1 hour -const weekAgo = new Date(now.getTime() - 7 * 86400000); // 86400000 ms = 1 day -const today = now.toISOString().split('T')[0]; -// ISO string variants for tools with native date params -const fromDateIso = fromDate.toISOString().slice(0, 10); -// Day-granularity date strings (via .slice(0, 10) truncation): -const lookbackDays = Math.ceil(lookbackHours / 24); -const fromDateStr = new Date(Date.now() - lookbackDays * 86400000).toISOString().slice(0, 10); -// For weekly review (Saturday): 5-day lookback = 5 * 86400000 ms -const weekFromDate = new Date(Date.now() - 5 * 86400000).toISOString().slice(0, 10); +const lookbackHours = Number("${{ github.event.inputs.lookback_hours }}") || 12; +const fromDateIso = new Date(now.getTime() - lookbackHours * 3600000).toISOString().slice(0, 10); +const today = now.toISOString().slice(0, 10); ``` -**Tools with native date params** (supports from/tom or dateFrom/dateTo): -- `get_calendar_events` — supports `from`/`tom` parameters (**⚠️ Known issue: may return HTML instead of JSON — see Calendar API Fallback below**) -- `search_regering` — supports `dateFrom`/`dateTo` parameters -- `analyze_g0v_by_department` — supports `dateFrom`/`dateTo` parameters - -### ⚠️ Calendar API Fallback - -The Riksdag calendar API (`get_calendar_events`) intermittently returns HTML instead of JSON. If the calendar call returns an error, empty results with an `error` field, or HTML content: - -1. **Do NOT treat calendar failure as "no events"** — continue evaluating all other data sources normally. -2. **Use `search_dokument` as a document-based proxy** to detect recently published committee reports and propositions (these indicate active parliamentary work even when the calendar is unavailable): - ``` - search_dokument({ from_date: "", to_date: "", limit: 50, doktyp: "bet" }) - search_dokument({ from_date: "", to_date: "", limit: 30, doktyp: "prop" }) - ``` - > Note: This does NOT replace the calendar's session-timing data. It provides publication signals as context for whether parliament is active. -3. **Flag the API error** in any noop message or article metadata so it can be investigated. -4. The calendar is supplementary context — its failure should never block article generation from other sources. - -**Tools requiring post-query filter by datum/publicerad/inlämnad:** -- `search_voteringar` — filter by `datum` field -- `get_betankanden` — filter by `publicerad` date -- `get_motioner` — filter by `inlämnad` date -- `get_propositioner` — filter by `publicerad` date -- `search_anforanden` — filter by `datum` field - -Filter results to only include items with dates `>= fromDate` using timezone-safe ISO string comparison: - -For tools without native date support, apply a post-query date filter: - +**Post-query date filter (use for tools without native date params):** ```javascript -// Calculate lookback window (e.g. 24 hours = 86400000 ms, 1 hour = 3600000 ms) -const fromDate = new Date(Date.now() - 24 * 3600000).toISOString().slice(0, 10); -const results = queryResults.filter( - item => (item.publicerad || item.datum || item.inlämnad || '').slice(0, 10) >= fromDate -); -``` - -Filter results to only include items with dates `>= fromDate` using ISO-string comparison (avoids timezone-sensitive `new Date()` parsing): -```js -const filtered = results.filter(item => - (item.datum || item.publicerad || item.inlämnad || '').slice(0, 10) >= fromDate +const recent = results.filter(item => + (item.datum || item.publicerad || item.inlämnad || '').slice(0, 10) >= fromDateIso ); -// Discouraged alternative: new Date() parsing — timezone/format sensitive -// const filtered = rawResults.filter(item => new Date(item.publicerad || item.datum || item.inlämnad) >= fromDate); -``` - -**Post-query date filtering example** (day-granularity; 86400000 ms = 1 day): -```javascript -const fromDate = new Date(Date.now() - lookback_days * 86400000).toISOString().slice(0, 10); -const results = rawResults.filter(item => { - const itemDate = (item.datum || item.publicerad || item.inlämnad || '').slice(0, 10); - return itemDate >= fromDate; // lexicographic YYYY-MM-DD comparison — no timezone drift -}); -``` - -**Date calculation pattern** (day-granularity — `.toISOString().slice(0, 10)` truncates to YYYY-MM-DD): -```javascript -const now = new Date(); -const lookback_hours = 12; // default; override via workflow input -const lookbackHours = Number(lookback_hours); -if (!Number.isFinite(lookbackHours) || !Number.isInteger(lookbackHours) || lookbackHours <= 0) { - throw new Error('Invalid lookback_hours'); -} -const lookbackMs = lookbackHours * 3600000; // 3600000 ms per hour -const fromDate = new Date(now.getTime() - lookbackMs).toISOString().slice(0, 10); -// For weekly review (Saturday): 5 * 86400000 ms = 5 days -const weekStart = new Date(now.getTime() - 5 * 86400000).toISOString().slice(0, 10); -const today = now.toISOString().slice(0, 10); ``` -**Post-query filtering example:** -```javascript -const results = await get_betankanden({ rm: currentRm, limit: 50 }); -const recent = results.filter(item => { - const itemDate = (item.datum || item.publicerad || item.inlämnad || '').slice(0, 10); - return itemDate >= fromDate; -}); -``` +**Tools with native date params:** `get_calendar_events` (`from`/`tom`), `search_regering` + `analyze_g0v_by_department` (`dateFrom`/`dateTo`). +**Tools requiring post-query filter:** `search_voteringar` (`datum`), `get_betankanden` (`publicerad`), `get_motioner` (`inlämnad`), `get_propositioner` (`publicerad`), `search_anforanden` (`datum`). -**Date calculation example:** -```javascript -const today = new Date().toISOString().slice(0, 10); -const fromDate = new Date(Date.now() - 86400000).toISOString().slice(0, 10); // 24h lookback -const weekAgo = new Date(Date.now() - 7 * 86400000).toISOString().slice(0, 10); -// For Saturday weekly review, use 5-day lookback (5 * 86400000 ms) -``` +### ⚠️ Calendar API Fallback -**Post-query filtering example:** -```javascript -// Filter betankanden by publicerad date (ISO-string day comparison — avoids timezone-sensitive Date parsing) -const recent = results.filter(r => r.publicerad?.slice(0, 10) >= fromDate); -// Filter voteringar by datum -const todayVotes = votes.filter(v => v.datum?.slice(0, 10) >= fromDate); -``` +`get_calendar_events` intermittently returns HTML. If it fails: (1) do NOT treat failure as "no events"; (2) use `search_dokument({ from_date, to_date, doktyp: "bet" })` as a proxy for active parliamentary work; (3) flag the error in output. Calendar failure must never block article generation from other sources. ### Cross-Referencing Strategy -Cross-reference related data sources for richer analysis. Filter all results by date to `>= fromDate`. - -#### Example 1: Committee Report Deep Dive -``` -// 1. Fetch committee reports for the period -// 2. For each report, look up related voting records via search_voteringar(bet: reportId) -// 3. Cross-reference with any motions that reference the same bet -``` - -#### Example 2: Government Activity Analysis -``` -// 1. Get government propositions (get_propositioner) -// 2. Search for committee reports (get_betankanden) that reference each proposition -// 3. Look up debate speeches (search_anforanden) on the same topic -``` - -#### Example 3: Party Behavior Analysis -``` -// 1. Get voting records grouped by party (search_voteringar with groupBy: parti) -// 2. Cross-reference with motions filed by each party -// 3. Identify where parties voted against their own motions -``` - -### Detailed Code Examples - -**Example 1: Committee Report Deep Dive** ```javascript -// Setup: riksmöte + date threshold (ISO-string comparison — timezone-safe) -const currentRm = '2025/26'; // adjust to current session -const fromDateIso = new Date(Date.now() - 7 * 86400000).toISOString().slice(0, 10); // YYYY-MM-DD -// 1. Fetch committee reports, filter by date using ISO-string comparison -const allReports = await get_betankanden({ rm: currentRm }); -const reports = allReports.filter(r => (r.publicerad || r.datum || '').slice(0, 10) >= fromDateIso); -// 2. For each report, cross-reference voting records +// Committee Report Deep Dive +const fromDateIso = new Date(Date.now() - 7 * 86400000).toISOString().slice(0, 10); +const reports = (await get_betankanden({ rm: currentRm })) + .filter(r => (r.publicerad || '').slice(0, 10) >= fromDateIso); for (const report of reports) { const votes = await search_voteringar({ bet: report.beteckning }); } -``` - -**Example 2: Government Activity Analysis** -```javascript -// Setup: riksmöte + date threshold (ISO-string comparison — timezone-safe) -const currentRm = '2025/26'; // adjust to current session -const fromDateIso = new Date(Date.now() - 7 * 86400000).toISOString().slice(0, 10); // YYYY-MM-DD -// 1. Fetch propositions, filter by date using ISO-string comparison -const allProps = await get_propositioner({ rm: currentRm }); -const props = allProps.filter(p => (p.publicerad || p.datum || '').slice(0, 10) >= fromDateIso); -// 2. Cross-reference with government press releases (native dateFrom param) -const press = await search_regering({ type: 'pressmeddelanden', dateFrom: fromDateIso }); -``` - -**Example 3: Party Behavior Analysis** -```javascript -// Setup: riksmöte + date threshold + party (ISO-string comparison — timezone-safe) -const currentRm = '2025/26'; // adjust to current session -const fromDateIso = new Date(Date.now() - 7 * 86400000).toISOString().slice(0, 10); // YYYY-MM-DD -const partyCode = 'S'; // e.g. S, M, SD, V, MP, C, L, KD -// 1. Get motions filed by party, filter by date using ISO-string comparison -const allMotions = await get_motioner({ rm: currentRm }); -const motions = allMotions.filter(m => (m.inlämnad || m.datum || '').slice(0, 10) >= fromDateIso); -// 2. Get party voting patterns, filter by date -const allVotes = await search_voteringar({ parti: partyCode, rm: currentRm }); -const votes = allVotes.filter(v => (v.datum || '').slice(0, 10) >= fromDateIso); -``` -**Example 2: Government Activity Analysis** -```javascript -// 1. Get government documents in date range -const fromDateIso = new Date(Date.now() - 7 * 86400000).toISOString().slice(0, 10); -const today = new Date().toISOString().slice(0, 10); -const govDocs = await search_regering({ dateFrom: fromDateIso, dateTo: today, limit: 30 }); - -// 2. Get related propositions -const propositions = (await get_propositioner({ rm: currentRm, limit: 20 })) +// Government Activity Analysis +const props = (await get_propositioner({ rm: currentRm, limit: 20 })) .filter(p => (p.publicerad || '').slice(0, 10) >= fromDateIso); -``` +const press = await search_regering({ type: 'pressmeddelanden', dateFrom: fromDateIso }); -**Example 3: Party Behavior Analysis** -```javascript -// 1. Get party voting records -const fromDateIso = new Date(Date.now() - 7 * 86400000).toISOString().slice(0, 10); +// Party Behavior Analysis const votes = (await search_voteringar({ rm: currentRm, limit: 100 })) .filter(v => (v.datum || '').slice(0, 10) >= fromDateIso); - -// 2. Get party speeches const speeches = (await search_anforanden({ rm: currentRm, limit: 100 })) .filter(a => (a.datum || '').slice(0, 10) >= fromDateIso); ``` -**Detailed Example: Committee Report Deep Dive** -```javascript -// 1. Fetch committee reports -const reports = await get_betankanden({ rm: riksmote, limit: 20 }); -// 2. Cross-reference with voting records -const votes = await search_voteringar({ rm: riksmote, limit: 50 }); -const reportsWithVotes = reports.filter(r => votes.some(v => v.bet === r.bet)); -``` - -**Detailed Example: Government Activity Analysis** -```javascript -// 1. Fetch government propositions -const props = await get_propositioner({ rm: riksmote, limit: 20 }); -// 2. Cross-reference with committee referrals -const referred = props.filter(p => p.referredTo); -``` - -**Detailed Example: Party Behavior Analysis** -```javascript -// 1. Fetch party motions -const motions = await get_motioner({ rm: riksmote, limit: 50 }); -// 2. Group by party for oversight analysis -const byParty = motions.reduce((acc, m) => { - acc[m.parti] = (acc[m.parti] || 0) + 1; - return acc; -}, {}); -``` - -**Troubleshooting**: -- Too broad results → Tighten date range or add keyword filters -- Missing data → Verify riksmöte calculation and date ranges +**Troubleshooting**: Too broad → tighten date range; Missing data → verify riksmöte calculation. ### Saturday vs Weekday Mode @@ -1236,51 +993,20 @@ npx tsx scripts/validate-cross-references.ts news/*-evening-analysis-*.html ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/evening-analysis -``` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/evening-analysis`. `safeoutputs___create_pull_request` handles this automatically. ## Step 5: Commit & Create PR -### MANDATORY PR Creation (READ THIS FIRST) - -> **🚀 HOW SAFE PR CREATION WORKS** -> -> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. You do NOT create branches or push manually. -> -> **Exact steps:** -> 1. Write article files to `news/` using `bash` or `edit` tools -> 2. Stage and commit locally (scoped to resolved evening-analysis subfolder): `git add news/*evening*.html news/metadata/ "analysis/daily/$ARTICLE_DATE/$ANALYSIS_SUBFOLDER/" analysis/weekly/ && git commit -m "🌆 Evening Analysis - $ARTICLE_DATE"` -> 3. Call `safeoutputs___create_pull_request` with `title`, `body`, and `labels` -> -> **❌ DO NOT** run `git push`, `git checkout -b`, `git branch`, or use GitHub API to create PRs. -> **❌ DO NOT** call `safeoutputs___noop` if articles were generated but PR creation failed — let the workflow FAIL instead. - -- ✅ **REQUIRED:** `safeoutputs___create_pull_request` when articles were generated -- ✅ **REQUIRED:** `safeoutputs___create_pull_request` with analysis-only PR when no articles but analysis artifacts exist — title: `📊 Analysis Only - Evening Analysis - {date}`, labels: `["analysis-only", "evening-analysis"]` -- ✅ **ONLY USE `safeoutputs___noop` if MCP server is completely unreachable after 3 retry attempts AND no analysis artifacts exist** -- ❌ **NEVER use `safeoutputs___noop` because articles already exist** — analysis always runs -- ❌ **NEVER use `safeoutputs___noop` as fallback for PR creation failures** -- ❌ **NEVER use `safeoutputs___noop` if analysis artifacts exist for the current `ARTICLE_DATE` under `analysis/daily/.../evening-analysis/` (for example, `analysis/daily/2025-03-04/evening-analysis/`)** +> `safeoutputs___create_pull_request` handles branch creation, push, and PR opening. Stage files and call it directly. -> **🚨 NEVER search for safe output tools via bash.** After `git commit`, call `safeoutputs___create_pull_request` directly as your VERY NEXT action. +- ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs (`analysis-only` + `evening-analysis` labels) +- ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist +- ❌ NEVER noop because articles already exist — analysis always runs +- ❌ Safe output tools are in your tool list — NEVER search for them via bash ```bash # Stage articles and analysis — scoped to evening-analysis subfolder to prevent overwriting other workflows diff --git a/.github/workflows/news-interpellations.md b/.github/workflows/news-interpellations.md index 6039d429f9..d8fb47eef0 100644 --- a/.github/workflows/news-interpellations.md +++ b/.github/workflows/news-interpellations.md @@ -151,17 +151,7 @@ If **force_generation** is `true`, generate articles even if recent ones exist. ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-interpellations.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-interpellations.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-interpellations.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -177,48 +167,15 @@ This workflow uses **persistent repo-memory** on branch `memory/news-generation` ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** - -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | - -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. - -## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` -> **The Agent Workflow Firewall (AWF) blocks dangerous shell expansion patterns.** Fenced bash blocks in init steps run as normal shell, but any command YOU generate via the `bash` tool IS subject to AWF filtering. +## 🛡️ AWF Shell Safety -**Key rules — NEVER use these in your generated bash commands:** -1. **NEVER** use `$`+`{VAR}` — always use `$VAR` (no curly braces) -2. **NEVER** use `$`+`(command)` — use pipes, `find -exec`, or separate commands -3. **NEVER** use `$`+`{VAR:-default}` — set defaults with `if/then` first, then use `$VAR` -4. **Use `find -exec`** instead of for-loops with `$`+`(basename ...)` -5. **Use direct file paths** when possible instead of variable-constructed paths with braces +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "AWF Shell Safety". Summary: use `$VAR` not `$`+`{VAR}`, use `find -exec` not `$(...)`, set defaults with `if/then` before using `$VAR`. -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content +## 🔤 UTF-8 Encoding -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. - -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## 🚫 CRITICAL: Article Generation Safety @@ -245,19 +202,10 @@ source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types ## Required Skills -Consult these skills as needed during article generation — do NOT spend time reading all files upfront before starting work. Start the MCP data collection immediately and read skill files only when relevant to the current step: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards (read during article writing) -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology (read when analyzing interpellations) -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation (read before MCP calls) -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines (read during translation) -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage (read before creating PR) -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -295,6 +243,10 @@ Based on the editorial profile for `interpellations` (from `scripts/editorial-fr > 🚨 **ANTI-PATTERNS (REJECTED)**: Articles with 0 frs ID citations, SWOT with only Government/Opposition/Civil Society (need all 8 groups), generic "Why It Matters" text reused across entries, no Mermaid diagrams +### 🗳️ Election 2026 Lens (Mandatory — v5.0) + +Every analysis MUST include an **Election 2026 Implications** section assessing: Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, and Policy Legacy. Use the **5-level confidence scale** (⬛VERY LOW → 🟥LOW → 🟧MEDIUM → 🟩HIGH → 🟦VERY HIGH). See `analysis/methodologies/ai-driven-analysis-guide.md` v5.0 for full criteria. + ### Phase 1 — Data Collection & Initial Analysis 1. Fetch MCP data (`get_interpellationer`, `get_sync_status`, cross-reference `search_anforanden`, `get_calendar_events`) 2. Detect policy domains and group by target minister for accountability analysis @@ -324,14 +276,9 @@ echo "Article Type: interpellations" echo "============================" ``` -## 📅 Riksmöte (Parliamentary Session) Calculation +## 📅 Riksmöte Calculation -The Swedish parliamentary session runs September–August. Calculate the current `rm` value: -- If current month is September or later (calendar month 9; JavaScript `Date` month index 8): `rm = "{currentYear}/{nextYear's last 2 digits}"` -- If current month is before September (calendar month ≤ 8; JavaScript `Date` month index ≤ 7): `rm = "{previousYear}/{currentYear's last 2 digits}"` -- Example: February 2026 → `rm = "2025/26"`, October 2026 → `rm = "2026/27"` - -Use this calculated `rm` value in ALL MCP queries requiring the `rm` parameter. +September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. ## MANDATORY Deduplication Check @@ -360,55 +307,22 @@ fi ## MANDATORY MCP Health Gate -Before generating ANY articles, verify MCP connectivity: - -1. Call `get_sync_status({})` — if successful, proceed -2. If it fails, wait 30 seconds and retry (up to 3 total attempts) -3. If ALL 3 attempts fail: - - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated." - - DO NOT analyze existing articles in the repository - - DO NOT fabricate or recycle content - - The workflow MUST end with noop - -**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from: -- Existing articles in the news/ directory -- Cached or stale data -- AI-generated content without MCP source data +1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) +2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/{article-type} -``` -Example: `news/content/2026-03-23/interpellations` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-23/interpellations`). `safeoutputs___create_pull_request` handles this automatically. ## MANDATORY PR Creation -> **🚀 HOW SAFE PR CREATION WORKS — READ THIS FIRST** -> -> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. You do NOT create branches or push manually. -> -> **Exact steps:** -> 1. Write article files to `news/` using `bash` or `edit` tools -> 2. Stage and commit locally using the enforcement block below -> 3. Call `safeoutputs___create_pull_request` with `title`, `body`, and `labels` +> `safeoutputs___create_pull_request` handles branch creation, push, and PR opening — do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool directly. + ```bash # Stage articles and analysis — scoped to article type to stay within 100-file PR limit @@ -433,39 +347,14 @@ echo "📊 Final staged file count: $STAGED_COUNT" git commit -m "Add interpellation-debates articles and analysis artifacts" ``` > -> **❌ DO NOT** run `git push`, `git checkout -b`, `git branch`, or use GitHub API to create PRs. -> **❌ DO NOT** try alternative approaches if the tool call works — one call is all you need. -> **❌ DO NOT** call `safeoutputs___noop` if articles were generated but PR creation failed — let the workflow FAIL instead. - -- ✅ `safeoutputs___create_pull_request` when articles generated -- ✅ `safeoutputs___create_pull_request` with analysis-only PR when no articles but analysis artifacts exist — title: `📊 Analysis Only - Interpellations - {date}`, labels: `["analysis-only", "interpellation-debates"]` -- ✅ `safeoutputs___noop` ONLY if MCP server is completely unreachable after 3 retry attempts AND no analysis artifacts exist -- ❌ NEVER use `safeoutputs___noop` because articles already exist — analysis always runs -- ❌ NEVER use `safeoutputs___noop` as fallback for PR creation failures -- ❌ NEVER use `safeoutputs___noop` if analysis artifacts exist in `analysis/daily/$ARTICLE_DATE/interpellations/` for the current run - -> **🚨 NEVER search for safe output tools via bash.** `safeoutputs___create_pull_request`, `safeoutputs___noop`, `safeoutputs___missing_tool`, and `safeoutputs___missing_data` are **always available as direct tool calls** in your tool list. NEVER run `ls /tmp/gh-aw/`, `ls /home/runner/.copilot/`, or any bash command to "find" them. After `git commit`, call the tool directly as your VERY NEXT action. +- ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs +- ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist +- ❌ NEVER noop because articles already exist — analysis always runs +- ❌ Safe output tools are in your tool list — NEVER search for them via bash ## 🌐 Dispatch Translation Workflow -After creating the content PR with `safeoutputs___create_pull_request`, dispatch the translation workflow for remaining languages: - -``` -safeoutputs___dispatch_workflow({ - "workflow_name": "news-translate", - "inputs": { - "article_date": "", - "article_type": "", - "languages": "all-extra" - } -}) -``` - -This triggers the dedicated `news-translate` workflow which generates high-quality translations for all 12 non-core languages (da, no, fi, de, fr, es, nl, ar, he, ja, ko, zh) using `concurrency.job-discriminator` for parallel execution. - -> **⚠️ Timing note:** The dispatch runs immediately after creating this PR, but the translate workflow checks out `main` where the EN/SV articles may not yet exist (the content PR hasn't been merged). In this case, the translate workflow will `noop` gracefully. The scheduled translate cron (11:00 and 17:00 UTC weekdays) will pick up the translations after the content PR is merged. - -> **Note:** Full translation quality rules are maintained in `news-translate.md`. When generating EN/SV articles, ensure content is analytically rich — translations will faithfully reproduce the same depth. +After creating the content PR, dispatch translations: `safeoutputs___dispatch_workflow({ "workflow_name": "news-translate", "inputs": { "article_date": "", "article_type": "", "languages": "all-extra" } })`. See `news-translate.md` for full translation quality rules. ## MCP Tools @@ -954,24 +843,8 @@ grep -o 'Why It Matters[^<]*' "news/$(date +%Y-%m-%d)-interpellation-debates-en. **Note**: News index files, metadata, and sitemap are generated automatically at build time by the `prebuild` script. Do NOT run generation scripts or commit their output — only commit the article HTML files. -## 🌐 MANDATORY Translation Quality Rules +## 🌐 Translation Quality -> **📋 Canonical translation rules are maintained in `news-translate.md`.** - -For EN/SV articles generated by this workflow, ensure: -1. **ALL section headings** and body content in the correct language (EN or SV) -2. **Meta keywords** in the article language -3. **No untranslated data-translate spans** in final output -4. Swedish API titles translated to article language - -When the `news-translate` workflow handles remaining 12 languages, it applies the full translation quality rules including RTL support (ar, he), CJK native script (ja, ko, zh), Nordic parliamentary terms (da, no, fi), and European formal register (de, fr, es, nl). See `news-translate.md` for comprehensive per-language requirements. +EN/SV only: all headings, meta, content in correct language; no untranslated `data-translate` spans; Swedish API titles translated. Full rules: `news-translate.md`. ## Article Naming Convention Files: `YYYY-MM-DD-interpellation-debates-{lang}.html` - -## 🚨 FINAL REMINDER: You MUST Call a Safe Output - -**This is the last section of the prompt. Before your session ends, you MUST have called exactly one of:** -- `safeoutputs___create_pull_request` — if you generated any articles or analysis artifacts -- `safeoutputs___noop` — if MCP was unreachable and no artifacts were produced - -**A run that produces zero safe outputs is a FAILURE.** If you are unsure what to do, call `safeoutputs___noop` with a descriptive message explaining what happened. diff --git a/.github/workflows/news-month-ahead.md b/.github/workflows/news-month-ahead.md index a1d1813640..a0817edd11 100644 --- a/.github/workflows/news-month-ahead.md +++ b/.github/workflows/news-month-ahead.md @@ -141,17 +141,7 @@ This is a **prospective** article providing a 30-day forward-looking strategic o ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-month-ahead.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-month-ahead.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-month-ahead.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (30 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -166,65 +156,23 @@ This workflow uses **persistent repo-memory** on branch `memory/news-generation` ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** - -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | - -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. - -## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash - -> **The Agent Workflow Firewall (AWF) blocks dangerous shell expansion patterns.** Fenced bash blocks in init steps run as normal shell, but any command YOU generate via the `bash` tool IS subject to AWF filtering. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` -**Key rules — NEVER use these in your generated bash commands:** -1. **NEVER** use `$`+`{VAR}` — always use `$VAR` (no curly braces) -2. **NEVER** use `$`+`(command)` — use pipes, `find -exec`, or separate commands -3. **NEVER** use `$`+`{VAR:-default}` — set defaults with `if/then` first, then use `$VAR` -4. **Use `find -exec`** instead of for-loops with `$`+`(basename ...)` -5. **Use direct file paths** when possible instead of variable-constructed paths with braces +## 🛡️ AWF Shell Safety -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "AWF Shell Safety". Summary: use `$VAR` not `$`+`{VAR}`, use `find -exec` not `$(...)`, set defaults with `if/then` before using `$VAR`. -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. +## 🔤 UTF-8 Encoding -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## Required Skills -Before generating articles, consult these skills: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -262,6 +210,10 @@ Based on the editorial profile for `month-ahead` (from `scripts/editorial-framew > 🚨 **ANTI-PATTERNS (REJECTED)**: Generic "Requires committee review and chamber debate" (must be unique per entry), SWOT with only 3 groups, no forward date-specific indicators, no Mermaid diagrams, no cross-document synthesis +### 🗳️ Election 2026 Lens (Mandatory — v5.0) + +Every analysis MUST include an **Election 2026 Implications** section assessing: Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, and Policy Legacy. Use the **5-level confidence scale** (⬛VERY LOW → 🟥LOW → 🟧MEDIUM → 🟩HIGH → 🟦VERY HIGH). See `analysis/methodologies/ai-driven-analysis-guide.md` v5.0 for full criteria. + ### Phase 1 — Data Collection & Initial Analysis 1. Fetch MCP data (`get_calendar_events`, `get_propositioner`, `get_motioner`, `get_interpellationer`, `get_sync_status`) 2. Build monthly legislative pipeline with key milestones @@ -289,14 +241,9 @@ echo "Article Type: month-ahead" echo "============================" ``` -## 📅 Riksmöte (Parliamentary Session) Calculation +## 📅 Riksmöte Calculation -The Swedish parliamentary session runs September–August. Calculate the current `rm` value: -- If current month is September or later (calendar month 9; JavaScript `Date` month index 8): `rm = "{currentYear}/{nextYear's last 2 digits}"` -- If current month is before September (calendar month ≤ 8; JavaScript `Date` month index ≤ 7): `rm = "{previousYear}/{currentYear's last 2 digits}"` -- Example: February 2026 → `rm = "2025/26"`, October 2026 → `rm = "2026/27"` - -Use this calculated `rm` value in ALL MCP queries requiring the `rm` parameter. +September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. ## MANDATORY Deduplication Check @@ -325,44 +272,17 @@ fi ## MANDATORY MCP Health Gate -Before generating ANY articles, verify MCP connectivity: - -1. Call `get_sync_status({})` — if successful, proceed -2. If it fails, wait 30 seconds and retry (up to 3 total attempts) -3. If ALL 3 attempts fail: - - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated." - - DO NOT analyze existing articles in the repository - - DO NOT fabricate or recycle content - - The workflow MUST end with noop - -**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from: -- Existing articles in the news/ directory -- Cached or stale data -- AI-generated content without MCP source data +1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) +2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/{article-type} -``` -Example: `news/content/2026-03-23/month-ahead` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-23/month-ahead`). `safeoutputs___create_pull_request` handles this automatically. ## MANDATORY PR Creation @@ -375,39 +295,14 @@ Example: `news/content/2026-03-23/month-ahead` > 2. Stage and commit locally (scoped to resolved month-ahead analysis subfolder): `git add news/*month-ahead*.html news/metadata/ "analysis/daily/$ARTICLE_DATE/$ANALYSIS_SUBFOLDER/" analysis/weekly/ && git commit -m "Add month-ahead articles and analysis artifacts"` > 3. Call `safeoutputs___create_pull_request` with `title`, `body`, and `labels` > -> **❌ DO NOT** run `git push`, `git checkout -b`, `git branch`, or use GitHub API to create PRs. -> **❌ DO NOT** try alternative approaches if the tool call works — one call is all you need. -> **❌ DO NOT** call `safeoutputs___noop` if articles were generated but PR creation failed — let the workflow FAIL instead. - -- ✅ `safeoutputs___create_pull_request` when articles generated -- ✅ `safeoutputs___create_pull_request` with analysis-only PR when no articles but analysis artifacts exist — title: `📊 Analysis Only - Month Ahead - {date}`, labels: `["analysis-only", "month-ahead"]` -- ✅ `safeoutputs___noop` ONLY if MCP server is completely unreachable after 3 retry attempts AND no analysis artifacts exist -- ❌ NEVER use `safeoutputs___noop` because articles already exist — analysis always runs -- ❌ NEVER use `safeoutputs___noop` as fallback for PR creation failures -- ❌ NEVER use `safeoutputs___noop` if analysis artifacts for the current run exist (e.g. under `analysis/daily/$ARTICLE_DATE/` or `analysis/weekly/$WEEK_LABEL/`) - -> **🚨 NEVER search for safe output tools via bash.** `safeoutputs___create_pull_request`, `safeoutputs___noop`, `safeoutputs___missing_tool`, and `safeoutputs___missing_data` are **always available as direct tool calls** in your tool list. NEVER run `ls /tmp/gh-aw/`, `ls /home/runner/.copilot/`, or any bash command to "find" them. After `git commit`, call the tool directly as your VERY NEXT action. +- ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs +- ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist +- ❌ NEVER noop because articles already exist — analysis always runs +- ❌ Safe output tools are in your tool list — NEVER search for them via bash ## 🌐 Dispatch Translation Workflow -After creating the content PR with `safeoutputs___create_pull_request`, dispatch the translation workflow for remaining languages: - -``` -safeoutputs___dispatch_workflow({ - "workflow_name": "news-translate", - "inputs": { - "article_date": "", - "article_type": "", - "languages": "all-extra" - } -}) -``` - -This triggers the dedicated `news-translate` workflow which generates high-quality translations for all 12 non-core languages (da, no, fi, de, fr, es, nl, ar, he, ja, ko, zh) using `concurrency.job-discriminator` for parallel execution. - -> **⚠️ Timing note:** The dispatch runs immediately after creating this PR, but the translate workflow checks out `main` where the EN/SV articles may not yet exist (the content PR hasn't been merged). In this case, the translate workflow will `noop` gracefully. The scheduled translate cron (11:00 and 17:00 UTC weekdays) will pick up the translations after the content PR is merged. - -> **Note:** Full translation quality rules are maintained in `news-translate.md`. When generating EN/SV articles, ensure content is analytically rich — translations will faithfully reproduce the same depth. +After creating the content PR, dispatch translations: `safeoutputs___dispatch_workflow({ "workflow_name": "news-translate", "inputs": { "article_date": "", "article_type": "", "languages": "all-extra" } })`. See `news-translate.md` for full translation quality rules. ## MCP Tools @@ -618,14 +513,6 @@ Month-ahead articles should include: 5. **Watch Points**: Issues likely to generate political controversy 6. **International Context**: EU coordination, Nordic cooperation events -## 🌐 MANDATORY Translation Quality Rules - -> **📋 Canonical translation rules are maintained in `news-translate.md`.** - -For EN/SV articles generated by this workflow, ensure: -1. **ALL section headings** and body content in the correct language (EN or SV) -2. **Meta keywords** in the article language -3. **No untranslated data-translate spans** in final output -4. Swedish API titles translated to article language +## 🌐 Translation Quality -When the `news-translate` workflow handles remaining 12 languages, it applies the full translation quality rules including RTL support (ar, he), CJK native script (ja, ko, zh), Nordic parliamentary terms (da, no, fi), and European formal register (de, fr, es, nl). See `news-translate.md` for comprehensive per-language requirements. \ No newline at end of file +EN/SV only: all headings, meta, content in correct language; no untranslated `data-translate` spans; Swedish API titles translated. Full rules: `news-translate.md`. \ No newline at end of file diff --git a/.github/workflows/news-monthly-review.md b/.github/workflows/news-monthly-review.md index 2e031e38d7..b544090756 100644 --- a/.github/workflows/news-monthly-review.md +++ b/.github/workflows/news-monthly-review.md @@ -141,17 +141,7 @@ This is a **retrospective** article providing comprehensive analysis of the past ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-monthly-review.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-monthly-review.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-monthly-review.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (30 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -166,65 +156,23 @@ This workflow uses **persistent repo-memory** on branch `memory/news-generation` ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** - -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | - -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. - -## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash - -> **The Agent Workflow Firewall (AWF) blocks dangerous shell expansion patterns.** Fenced bash blocks in init steps run as normal shell, but any command YOU generate via the `bash` tool IS subject to AWF filtering. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` -**Key rules — NEVER use these in your generated bash commands:** -1. **NEVER** use `$`+`{VAR}` — always use `$VAR` (no curly braces) -2. **NEVER** use `$`+`(command)` — use pipes, `find -exec`, or separate commands -3. **NEVER** use `$`+`{VAR:-default}` — set defaults with `if/then` first, then use `$VAR` -4. **Use `find -exec`** instead of for-loops with `$`+`(basename ...)` -5. **Use direct file paths** when possible instead of variable-constructed paths with braces +## 🛡️ AWF Shell Safety -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "AWF Shell Safety". Summary: use `$VAR` not `$`+`{VAR}`, use `find -exec` not `$(...)`, set defaults with `if/then` before using `$VAR`. -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. +## 🔤 UTF-8 Encoding -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## Required Skills -Before generating articles, consult these skills: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -249,6 +197,10 @@ Based on the editorial profile for `monthly-review` (from `scripts/editorial-fra - **Min. stakeholders**: 7 perspectives - **AI iterations**: 3 (comprehensive), 3 (deep), or 2 (standard) +### 🗳️ Election 2026 Lens (Mandatory — v5.0) + +Every analysis MUST include an **Election 2026 Implications** section assessing: Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, and Policy Legacy. Use the **5-level confidence scale** (⬛VERY LOW → 🟥LOW → 🟧MEDIUM → 🟩HIGH → 🟦VERY HIGH). See `analysis/methodologies/ai-driven-analysis-guide.md` v5.0 for full criteria. + ### Phase 1 — Data Collection & Initial Analysis 1. Fetch MCP data: full month's `get_betankanden`, `get_propositioner`, `get_motioner`, `search_anforanden`, `search_voteringar`, `get_interpellationer`, `get_fragor`, `get_sync_status` 2. Compute monthly metrics: totals, trend vs. previous month, party rankings, legislative efficiency @@ -279,14 +231,9 @@ echo "Article Type: monthly-review" echo "============================" ``` -## 📅 Riksmöte (Parliamentary Session) Calculation +## 📅 Riksmöte Calculation -The Swedish parliamentary session runs September–August. Calculate the current `rm` value: -- If current month is September or later (calendar month 9; JavaScript `Date` month index 8): `rm = "{currentYear}/{nextYear's last 2 digits}"` -- If current month is before September (calendar month ≤ 8; JavaScript `Date` month index ≤ 7): `rm = "{previousYear}/{currentYear's last 2 digits}"` -- Example: February 2026 → `rm = "2025/26"`, October 2026 → `rm = "2026/27"` - -Use this calculated `rm` value in ALL MCP queries requiring the `rm` parameter. +September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. ## MANDATORY Deduplication Check @@ -315,44 +262,17 @@ fi ## MANDATORY MCP Health Gate -Before generating ANY articles, verify MCP connectivity: - -1. Call `get_sync_status({})` — if successful, proceed -2. If it fails, wait 30 seconds and retry (up to 3 total attempts) -3. If ALL 3 attempts fail: - - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated." - - DO NOT analyze existing articles in the repository - - DO NOT fabricate or recycle content - - The workflow MUST end with noop - -**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from: -- Existing articles in the news/ directory -- Cached or stale data -- AI-generated content without MCP source data +1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) +2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/{article-type} -``` -Example: `news/content/2026-03-23/monthly-review` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-23/monthly-review`). `safeoutputs___create_pull_request` handles this automatically. ## MANDATORY PR Creation @@ -365,39 +285,14 @@ Example: `news/content/2026-03-23/monthly-review` > 2. Stage and commit locally (scoped to the resolved monthly-review subfolder): `git add news/*monthly-review*.html news/metadata/ "analysis/daily/$ARTICLE_DATE/$ANALYSIS_SUBFOLDER/" analysis/weekly/ && git commit -m "Add monthly-review articles and analysis artifacts"` > 3. Call `safeoutputs___create_pull_request` with `title`, `body`, and `labels` > -> **❌ DO NOT** run `git push`, `git checkout -b`, `git branch`, or use GitHub API to create PRs. -> **❌ DO NOT** try alternative approaches if the tool call works — one call is all you need. -> **❌ DO NOT** call `safeoutputs___noop` if articles were generated but PR creation failed — let the workflow FAIL instead. - -- ✅ `safeoutputs___create_pull_request` when articles generated -- ✅ `safeoutputs___create_pull_request` with analysis-only PR when no articles but analysis artifacts exist — title: `📊 Analysis Only - Monthly Review - {date}`, labels: `["analysis-only", "monthly-review"]` -- ✅ `safeoutputs___noop` ONLY if MCP server is completely unreachable after 3 retry attempts AND no analysis artifacts exist -- ❌ NEVER use `safeoutputs___noop` because articles already exist — analysis always runs -- ❌ NEVER use `safeoutputs___noop` as fallback for PR creation failures -- ❌ NEVER use `safeoutputs___noop` if analysis artifacts exist for the current run (e.g., in `analysis/daily/$ARTICLE_DATE` or `analysis/weekly/$WEEK_LABEL`) - -> **🚨 NEVER search for safe output tools via bash.** `safeoutputs___create_pull_request`, `safeoutputs___noop`, `safeoutputs___missing_tool`, and `safeoutputs___missing_data` are **always available as direct tool calls** in your tool list. NEVER run `ls /tmp/gh-aw/`, `ls /home/runner/.copilot/`, or any bash command to "find" them. After `git commit`, call the tool directly as your VERY NEXT action. +- ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs +- ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist +- ❌ NEVER noop because articles already exist — analysis always runs +- ❌ Safe output tools are in your tool list — NEVER search for them via bash ## 🌐 Dispatch Translation Workflow -After creating the content PR with `safeoutputs___create_pull_request`, dispatch the translation workflow for remaining languages: - -``` -safeoutputs___dispatch_workflow({ - "workflow_name": "news-translate", - "inputs": { - "article_date": "", - "article_type": "", - "languages": "all-extra" - } -}) -``` - -This triggers the dedicated `news-translate` workflow which generates high-quality translations for all 12 non-core languages (da, no, fi, de, fr, es, nl, ar, he, ja, ko, zh) using `concurrency.job-discriminator` for parallel execution. - -> **⚠️ Timing note:** The dispatch runs immediately after creating this PR, but the translate workflow checks out `main` where the EN/SV articles may not yet exist (the content PR hasn't been merged). In this case, the translate workflow will `noop` gracefully. The scheduled translate cron (11:00 and 17:00 UTC weekdays) will pick up the translations after the content PR is merged. - -> **Note:** Full translation quality rules are maintained in `news-translate.md`. When generating EN/SV articles, ensure content is analytically rich — translations will faithfully reproduce the same depth. +After creating the content PR, dispatch translations: `safeoutputs___dispatch_workflow({ "workflow_name": "news-translate", "inputs": { "article_date": "", "article_type": "", "languages": "all-extra" } })`. See `news-translate.md` for full translation quality rules. ## MCP Tools @@ -619,14 +514,6 @@ Monthly review articles should include: 8. **Month's Most Consequential**: Deep analysis of the month's defining development 9. **Looking Ahead**: Preview of next month's parliamentary calendar -## 🌐 MANDATORY Translation Quality Rules - -> **📋 Canonical translation rules are maintained in `news-translate.md`.** - -For EN/SV articles generated by this workflow, ensure: -1. **ALL section headings** and body content in the correct language (EN or SV) -2. **Meta keywords** in the article language -3. **No untranslated data-translate spans** in final output -4. Swedish API titles translated to article language +## 🌐 Translation Quality -When the `news-translate` workflow handles remaining 12 languages, it applies the full translation quality rules including RTL support (ar, he), CJK native script (ja, ko, zh), Nordic parliamentary terms (da, no, fi), and European formal register (de, fr, es, nl). See `news-translate.md` for comprehensive per-language requirements. \ No newline at end of file +EN/SV only: all headings, meta, content in correct language; no untranslated `data-translate` spans; Swedish API titles translated. Full rules: `news-translate.md`. \ No newline at end of file diff --git a/.github/workflows/news-motions.md b/.github/workflows/news-motions.md index 0ef7bdbf15..969ea7f96a 100644 --- a/.github/workflows/news-motions.md +++ b/.github/workflows/news-motions.md @@ -138,17 +138,7 @@ If **force_generation** is `true`, generate articles even if recent ones exist. ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-motions.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-motions.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-motions.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -163,48 +153,15 @@ This workflow uses **persistent repo-memory** on branch `memory/news-generation` ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** - -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | - -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` -## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash +## 🛡️ AWF Shell Safety -> **The Agent Workflow Firewall (AWF) blocks dangerous shell expansion patterns.** Fenced bash blocks in init steps run as normal shell, but any command YOU generate via the `bash` tool IS subject to AWF filtering. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "AWF Shell Safety". Summary: use `$VAR` not `$`+`{VAR}`, use `find -exec` not `$(...)`, set defaults with `if/then` before using `$VAR`. -**Key rules — NEVER use these in your generated bash commands:** -1. **NEVER** use `$`+`{VAR}` — always use `$VAR` (no curly braces) -2. **NEVER** use `$`+`(command)` — use pipes, `find -exec`, or separate commands -3. **NEVER** use `$`+`{VAR:-default}` — set defaults with `if/then` first, then use `$VAR` -4. **Use `find -exec`** instead of for-loops with `$`+`(basename ...)` -5. **Use direct file paths** when possible instead of variable-constructed paths with braces +## 🔤 UTF-8 Encoding -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content - -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. - -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## 🚫 CRITICAL: Article Generation Safety @@ -231,19 +188,10 @@ source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types ## Required Skills -Before generating articles, consult these skills: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -281,6 +229,10 @@ Based on the editorial profile for `motions` (from `scripts/editorial-framework. > 🚨 **ANTI-PATTERNS (REJECTED)**: SWOT with only 3 stakeholder groups, no mot. ID citations, generic opposition analysis without specific party positions, no Mermaid diagrams, no L×I risk scores +### 🗳️ Election 2026 Lens (Mandatory — v5.0) + +Every analysis MUST include an **Election 2026 Implications** section assessing: Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, and Policy Legacy. Use the **5-level confidence scale** (⬛VERY LOW → 🟥LOW → 🟧MEDIUM → 🟩HIGH → 🟦VERY HIGH). See `analysis/methodologies/ai-driven-analysis-guide.md` v5.0 for full criteria. + ### Phase 1 — Data Collection & Initial Analysis 1. Fetch MCP data (`get_motioner`, `get_sync_status`, cross-reference `search_anforanden`) 2. Detect policy domains and group by party for coalition dynamics analysis @@ -309,14 +261,9 @@ echo "Article Type: motions" echo "============================" ``` -## 📅 Riksmöte (Parliamentary Session) Calculation - -The Swedish parliamentary session runs September–August. Calculate the current `rm` value: -- If current month is September or later (calendar month 9; JavaScript `Date` month index 8): `rm = "{currentYear}/{nextYear's last 2 digits}"` -- If current month is before September (calendar month ≤ 8; JavaScript `Date` month index ≤ 7): `rm = "{previousYear}/{currentYear's last 2 digits}"` -- Example: February 2026 → `rm = "2025/26"`, October 2026 → `rm = "2026/27"` +## 📅 Riksmöte Calculation -Use this calculated `rm` value in ALL MCP queries requiring the `rm` parameter. +September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. ## MANDATORY Deduplication Check @@ -345,55 +292,22 @@ fi ## MANDATORY MCP Health Gate -Before generating ANY articles, verify MCP connectivity: - -1. Call `get_sync_status({})` — if successful, proceed -2. If it fails, wait 30 seconds and retry (up to 3 total attempts) -3. If ALL 3 attempts fail: - - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated." - - DO NOT analyze existing articles in the repository - - DO NOT fabricate or recycle content - - The workflow MUST end with noop - -**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from: -- Existing articles in the news/ directory -- Cached or stale data -- AI-generated content without MCP source data +1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) +2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/{article-type} -``` -Example: `news/content/2026-03-23/motions` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-23/motions`). `safeoutputs___create_pull_request` handles this automatically. ## MANDATORY PR Creation -> **🚀 HOW SAFE PR CREATION WORKS — READ THIS FIRST** -> -> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. You do NOT create branches or push manually. -> -> **Exact steps:** -> 1. Write article files to `news/` using `bash` or `edit` tools -> 2. Stage and commit locally using the enforcement block below -> 3. Call `safeoutputs___create_pull_request` with `title`, `body`, and `labels` +> `safeoutputs___create_pull_request` handles branch creation, push, and PR opening — do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool directly. + ```bash # Stage articles and analysis — scoped to article type to stay within 100-file PR limit @@ -418,39 +332,14 @@ echo "📊 Final staged file count: $STAGED_COUNT" git commit -m "Add opposition-motions articles and analysis artifacts" ``` > -> **❌ DO NOT** run `git push`, `git checkout -b`, `git branch`, or use GitHub API to create PRs. -> **❌ DO NOT** try alternative approaches if the tool call works — one call is all you need. -> **❌ DO NOT** call `safeoutputs___noop` if articles were generated but PR creation failed — let the workflow FAIL instead. - -- ✅ `safeoutputs___create_pull_request` when articles generated -- ✅ `safeoutputs___create_pull_request` with analysis-only PR when no articles but analysis artifacts exist — title: `📊 Analysis Only - Motions - {date}`, labels: `["analysis-only", "opposition-motions"]` -- ✅ `safeoutputs___noop` ONLY if MCP server is completely unreachable after 3 retry attempts AND no analysis artifacts exist -- ❌ NEVER use `safeoutputs___noop` because articles already exist — analysis always runs -- ❌ NEVER use `safeoutputs___noop` as fallback for PR creation failures -- ❌ NEVER use `safeoutputs___noop` if analysis artifacts exist in the current run's directory (e.g., `analysis/daily/$ARTICLE_DATE/motions/`) - -> **🚨 NEVER search for safe output tools via bash.** `safeoutputs___create_pull_request`, `safeoutputs___noop`, `safeoutputs___missing_tool`, and `safeoutputs___missing_data` are **always available as direct tool calls** in your tool list. NEVER run `ls /tmp/gh-aw/`, `ls /home/runner/.copilot/`, or any bash command to "find" them. After `git commit`, call the tool directly as your VERY NEXT action. +- ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs +- ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist +- ❌ NEVER noop because articles already exist — analysis always runs +- ❌ Safe output tools are in your tool list — NEVER search for them via bash ## 🌐 Dispatch Translation Workflow -After creating the content PR with `safeoutputs___create_pull_request`, dispatch the translation workflow for remaining languages: - -``` -safeoutputs___dispatch_workflow({ - "workflow_name": "news-translate", - "inputs": { - "article_date": "", - "article_type": "", - "languages": "all-extra" - } -}) -``` - -This triggers the dedicated `news-translate` workflow which generates high-quality translations for all 12 non-core languages (da, no, fi, de, fr, es, nl, ar, he, ja, ko, zh) using `concurrency.job-discriminator` for parallel execution. - -> **⚠️ Timing note:** The dispatch runs immediately after creating this PR, but the translate workflow checks out `main` where the EN/SV articles may not yet exist (the content PR hasn't been merged). In this case, the translate workflow will `noop` gracefully. The scheduled translate cron (11:00 and 17:00 UTC weekdays) will pick up the translations after the content PR is merged. - -> **Note:** Full translation quality rules are maintained in `news-translate.md`. When generating EN/SV articles, ensure content is analytically rich — translations will faithfully reproduce the same depth. +After creating the content PR, dispatch translations: `safeoutputs___dispatch_workflow({ "workflow_name": "news-translate", "inputs": { "article_date": "", "article_type": "", "languages": "all-extra" } })`. See `news-translate.md` for full translation quality rules. ## MCP Tools @@ -919,16 +808,8 @@ grep -o 'Why It Matters[^<]*' "news/$(date +%Y-%m-%d)-opposition-motions-en.html **Note**: News index files, metadata, and sitemap are generated automatically at build time by the `prebuild` script. Do NOT run generation scripts or commit their output — only commit the article HTML files. -## 🌐 MANDATORY Translation Quality Rules - -> **📋 Canonical translation rules are maintained in `news-translate.md`.** - -For EN/SV articles generated by this workflow, ensure: -1. **ALL section headings** and body content in the correct language (EN or SV) -2. **Meta keywords** in the article language -3. **No untranslated data-translate spans** in final output -4. Swedish API titles translated to article language +## 🌐 Translation Quality -When the `news-translate` workflow handles remaining 12 languages, it applies the full translation quality rules including RTL support (ar, he), CJK native script (ja, ko, zh), Nordic parliamentary terms (da, no, fi), and European formal register (de, fr, es, nl). See `news-translate.md` for comprehensive per-language requirements. +EN/SV only: all headings, meta, content in correct language; no untranslated `data-translate` spans; Swedish API titles translated. Full rules: `news-translate.md`. ## Article Naming Convention Files: `YYYY-MM-DD-opposition-motions-{lang}.html` \ No newline at end of file diff --git a/.github/workflows/news-propositions.md b/.github/workflows/news-propositions.md index 9687e9806e..1526226dec 100644 --- a/.github/workflows/news-propositions.md +++ b/.github/workflows/news-propositions.md @@ -124,18 +124,9 @@ engine: You are the **News Journalist Agent** for Riksdagsmonitor generating **government propositions** analysis articles. -## 🚨🚨 MANDATORY: Safe Output Guarantee 🚨🚨 +## 🚨 Safe Output Guarantee -> **Every run MUST end with exactly one safe output call. There are NO exceptions.** - -Before doing ANYTHING else, internalize this absolute rule: - -1. **If you generate articles or analysis artifacts** → call `safeoutputs___create_pull_request` -2. **If MCP is unreachable AND no artifacts exist** → call `safeoutputs___noop` with a reason -3. **If you are running out of time** (approaching minute 40 of 45) → immediately stop all work and call `safeoutputs___create_pull_request` with whatever you have committed, OR call `safeoutputs___noop` explaining what happened -4. **NEVER let the workflow end without calling a safe output tool** — a run with zero safe outputs is treated as a failure and creates an error issue - -**Time guard**: If you have been running for more than 35 minutes without yet calling a safe output tool, STOP all other work immediately and produce a safe output with whatever progress you have made. +Every run MUST end with exactly one safe output call: `safeoutputs___create_pull_request` when artifacts exist, `safeoutputs___noop` only when MCP is unreachable AND no artifacts exist. Time guard: if >35 min elapsed with no safe output called, stop and call one immediately. ## 🔧 Workflow Dispatch Parameters @@ -151,17 +142,7 @@ If **force_generation** is `true`, generate articles even if recent ones exist. ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-propositions.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-propositions.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-propositions.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -177,48 +158,15 @@ This workflow uses **persistent repo-memory** on branch `memory/news-generation` ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** - -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | - -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. - -## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` -> **The Agent Workflow Firewall (AWF) blocks dangerous shell expansion patterns.** Fenced bash blocks in init steps run as normal shell, but any command YOU generate via the `bash` tool IS subject to AWF filtering. +## 🛡️ AWF Shell Safety -**Key rules — NEVER use these in your generated bash commands:** -1. **NEVER** use `$`+`{VAR}` — always use `$VAR` (no curly braces) -2. **NEVER** use `$`+`(command)` — use pipes, `find -exec`, or separate commands -3. **NEVER** use `$`+`{VAR:-default}` — set defaults with `if/then` first, then use `$VAR` -4. **Use `find -exec`** instead of for-loops with `$`+`(basename ...)` -5. **Use direct file paths** when possible instead of variable-constructed paths with braces +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "AWF Shell Safety". Summary: use `$VAR` not `$`+`{VAR}`, use `find -exec` not `$(...)`, set defaults with `if/then` before using `$VAR`. -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content +## 🔤 UTF-8 Encoding -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. - -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## 🚫 CRITICAL: Article Generation Safety @@ -245,19 +193,10 @@ source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types ## Required Skills -Consult these skills as needed during article generation — do NOT spend time reading all files upfront before starting work. Start the MCP data collection immediately and read skill files only when relevant to the current step: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards (read during article writing) -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology (read when analyzing propositions) -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation (read before MCP calls) -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines (read during translation) -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage (read before creating PR) -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -282,6 +221,10 @@ Based on the editorial profile for `propositions` (from `scripts/editorial-frame - **Min. stakeholders**: 3 perspectives (`standard`), 5 (`deep`/`comprehensive`) - **AI iterations**: 1-2 (standard), 2-3 (deep), 3+ (comprehensive) +### 🗳️ Election 2026 Lens (Mandatory — v5.0) + +Every analysis MUST include an **Election 2026 Implications** section assessing: Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, and Policy Legacy. Use the **5-level confidence scale** (⬛VERY LOW → 🟥LOW → 🟧MEDIUM → 🟩HIGH → 🟦VERY HIGH). See `analysis/methodologies/ai-driven-analysis-guide.md` v5.0 for full criteria. + ### Phase 1 — Data Collection & Initial Analysis 1. Fetch MCP data (`get_propositioner`, `get_sync_status`, cross-reference `get_betankanden`) 2. Detect policy domains and extract legislative timeline for each proposition @@ -311,14 +254,9 @@ echo "Article Type: propositions" echo "============================" ``` -## 📅 Riksmöte (Parliamentary Session) Calculation +## 📅 Riksmöte Calculation -The Swedish parliamentary session runs September–August. Calculate the current `rm` value: -- If current month is September or later (calendar month 9; JavaScript `Date` month index 8): `rm = "{currentYear}/{nextYear's last 2 digits}"` -- If current month is before September (calendar month ≤ 8; JavaScript `Date` month index ≤ 7): `rm = "{previousYear}/{currentYear's last 2 digits}"` -- Example: February 2026 → `rm = "2025/26"`, October 2026 → `rm = "2026/27"` - -Use this calculated `rm` value in ALL MCP queries requiring the `rm` parameter. +September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. ## MANDATORY Deduplication Check @@ -347,55 +285,22 @@ fi ## MANDATORY MCP Health Gate -Before generating ANY articles, verify MCP connectivity: - -1. Call `get_sync_status({})` — if successful, proceed -2. If it fails, wait 30 seconds and retry (up to 3 total attempts) -3. If ALL 3 attempts fail: - - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated." - - DO NOT analyze existing articles in the repository - - DO NOT fabricate or recycle content - - The workflow MUST end with noop - -**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from: -- Existing articles in the news/ directory -- Cached or stale data -- AI-generated content without MCP source data +1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) +2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/{article-type} -``` -Example: `news/content/2026-03-23/propositions` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-23/propositions`). `safeoutputs___create_pull_request` handles this automatically. ## MANDATORY PR Creation -> **🚀 HOW SAFE PR CREATION WORKS — READ THIS FIRST** -> -> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. You do NOT create branches or push manually. -> -> **Exact steps:** -> 1. Write article files to `news/` using `bash` or `edit` tools -> 2. Stage and commit locally using the enforcement block below -> 3. Call `safeoutputs___create_pull_request` with `title`, `body`, and `labels` +> `safeoutputs___create_pull_request` handles branch creation, push, and PR opening — do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool directly. + ```bash # Stage articles and analysis — scoped to article type to stay within 100-file PR limit @@ -420,39 +325,14 @@ echo "📊 Final staged file count: $STAGED_COUNT" git commit -m "Add propositions articles and analysis artifacts" ``` > -> **❌ DO NOT** run `git push`, `git checkout -b`, `git branch`, or use GitHub API to create PRs. -> **❌ DO NOT** try alternative approaches if the tool call works — one call is all you need. -> **❌ DO NOT** call `safeoutputs___noop` if articles were generated but PR creation failed — let the workflow FAIL instead. - -- ✅ `safeoutputs___create_pull_request` when articles generated -- ✅ `safeoutputs___create_pull_request` with analysis-only PR when no articles but analysis artifacts exist — title: `📊 Analysis Only - Propositions - {date}`, labels: `["analysis-only", "propositions"]` -- ✅ `safeoutputs___noop` ONLY if MCP server is completely unreachable after 3 retry attempts AND no analysis artifacts exist -- ❌ NEVER use `safeoutputs___noop` because articles already exist — analysis always runs -- ❌ NEVER use `safeoutputs___noop` as fallback for PR creation failures -- ❌ NEVER use `safeoutputs___noop` if analysis artifacts exist in `analysis/daily/$ARTICLE_DATE/propositions/` for the current run - -> **🚨 NEVER search for safe output tools via bash.** `safeoutputs___create_pull_request`, `safeoutputs___noop`, `safeoutputs___missing_tool`, and `safeoutputs___missing_data` are **always available as direct tool calls** in your tool list. NEVER run `ls /tmp/gh-aw/`, `ls /home/runner/.copilot/`, or any bash command to "find" them. After `git commit`, call the tool directly as your VERY NEXT action. +- ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs (`analysis-only` label + `propositions` label) +- ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist +- ❌ NEVER noop because articles already exist — analysis always runs +- ❌ Safe output tools are in your tool list — NEVER search for them via bash ## 🌐 Dispatch Translation Workflow -After creating the content PR with `safeoutputs___create_pull_request`, dispatch the translation workflow for remaining languages: - -``` -safeoutputs___dispatch_workflow({ - "workflow_name": "news-translate", - "inputs": { - "article_date": "", - "article_type": "", - "languages": "all-extra" - } -}) -``` - -This triggers the dedicated `news-translate` workflow which generates high-quality translations for all 12 non-core languages (da, no, fi, de, fr, es, nl, ar, he, ja, ko, zh) using `concurrency.job-discriminator` for parallel execution. - -> **⚠️ Timing note:** The dispatch runs immediately after creating this PR, but the translate workflow checks out `main` where the EN/SV articles may not yet exist (the content PR hasn't been merged). In this case, the translate workflow will `noop` gracefully. The scheduled translate cron (11:00 and 17:00 UTC weekdays) will pick up the translations after the content PR is merged. - -> **Note:** Full translation quality rules are maintained in `news-translate.md`. When generating EN/SV articles, ensure content is analytically rich — translations will faithfully reproduce the same depth. +After creating the content PR, dispatch translations: `safeoutputs___dispatch_workflow({ "workflow_name": "news-translate", "inputs": { "article_date": "", "article_type": "", "languages": "all-extra" } })`. See `news-translate.md` for full translation quality rules. ## MCP Tools @@ -925,24 +805,8 @@ grep -o 'Why It Matters[^<]*' "news/$(date +%Y-%m-%d)-government-propositions-en **Note**: For shared rules on news index files, metadata, sitemap generation, and what to commit, see the canonical guidance in `news-article-generator.md`. -## 🌐 MANDATORY Translation Quality Rules +## 🌐 Translation Quality -> **📋 Canonical translation rules are maintained in `news-translate.md`.** - -For EN/SV articles generated by this workflow, ensure: -1. **ALL section headings** and body content in the correct language (EN or SV) -2. **Meta keywords** in the article language -3. **No untranslated data-translate spans** in final output -4. Swedish API titles translated to article language - -When the `news-translate` workflow handles remaining 12 languages, it applies the full translation quality rules including RTL support (ar, he), CJK native script (ja, ko, zh), Nordic parliamentary terms (da, no, fi), and European formal register (de, fr, es, nl). See `news-translate.md` for comprehensive per-language requirements. +EN/SV only: all headings, meta, content in correct language; no untranslated `data-translate` spans; Swedish API titles translated. Full rules: `news-translate.md`. ## Article Naming Convention Files: `YYYY-MM-DD-government-propositions-{lang}.html` - -## 🚨 FINAL REMINDER: You MUST Call a Safe Output - -**This is the last section of the prompt. Before your session ends, you MUST have called exactly one of:** -- `safeoutputs___create_pull_request` — if you generated any articles or analysis artifacts -- `safeoutputs___noop` — if MCP was unreachable and no artifacts were produced - -**A run that produces zero safe outputs is a FAILURE.** If you are unsure what to do, call `safeoutputs___noop` with a descriptive message explaining what happened. diff --git a/.github/workflows/news-realtime-monitor.md b/.github/workflows/news-realtime-monitor.md index 2441dc9b4c..4d5c4eecfd 100644 --- a/.github/workflows/news-realtime-monitor.md +++ b/.github/workflows/news-realtime-monitor.md @@ -148,27 +148,7 @@ You are the **Real-Time Political Monitor** for Riksdagsmonitor. Detect signific ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** - -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | - -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` ## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash @@ -190,15 +170,9 @@ bash({ command: "..." }) // ← WRONG: missing description 3. **Use `find -exec`** instead of for-loops with command substitution 4. **Use direct paths** when possible (e.g., `cat analysis/daily/2026-04-07/realtime-1411/synthesis-summary.md`) -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content +## 🔤 UTF-8 Encoding -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. - -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## ⚠️ NON-NEGOTIABLE RULES @@ -216,17 +190,7 @@ bash({ command: "..." }) // ← WRONG: missing description ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-realtime-monitor.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-realtime-monitor.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-realtime-monitor.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) @@ -958,26 +922,11 @@ fi ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/breaking -``` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/breaking`. `safeoutputs___create_pull_request` handles this automatically. ## Step 5: Commit & Create PR @@ -1021,19 +970,10 @@ safeoutputs___create_pull_request({ ## Required Skills -Before generating articles, consult these skills: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework diff --git a/.github/workflows/news-week-ahead.md b/.github/workflows/news-week-ahead.md index 607ddf44b2..99c7944b9a 100644 --- a/.github/workflows/news-week-ahead.md +++ b/.github/workflows/news-week-ahead.md @@ -138,17 +138,7 @@ If **force_generation** is `true`, generate articles even if recent ones exist. ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-week-ahead.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-week-ahead.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-week-ahead.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (30 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -163,65 +153,23 @@ This workflow uses **persistent repo-memory** on branch `memory/news-generation` ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** - -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | - -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. - -## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash - -> **The Agent Workflow Firewall (AWF) blocks dangerous shell expansion patterns.** Fenced bash blocks in init steps run as normal shell, but any command YOU generate via the `bash` tool IS subject to AWF filtering. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` -**Key rules — NEVER use these in your generated bash commands:** -1. **NEVER** use `$`+`{VAR}` — always use `$VAR` (no curly braces) -2. **NEVER** use `$`+`(command)` — use pipes, `find -exec`, or separate commands -3. **NEVER** use `$`+`{VAR:-default}` — set defaults with `if/then` first, then use `$VAR` -4. **Use `find -exec`** instead of for-loops with `$`+`(basename ...)` -5. **Use direct file paths** when possible instead of variable-constructed paths with braces +## 🛡️ AWF Shell Safety -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "AWF Shell Safety". Summary: use `$VAR` not `$`+`{VAR}`, use `find -exec` not `$(...)`, set defaults with `if/then` before using `$VAR`. -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. +## 🔤 UTF-8 Encoding -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## Required Skills -Before generating articles, consult these skills: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -246,6 +194,10 @@ Based on the editorial profile for `week-ahead` (from `scripts/editorial-framewo - **Min. stakeholders**: 3 perspectives - **AI iterations**: 1 (standard), 2 (deep), or 3 (comprehensive) +### 🗳️ Election 2026 Lens (Mandatory — v5.0) + +Every analysis MUST include an **Election 2026 Implications** section assessing: Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, and Policy Legacy. Use the **5-level confidence scale** (⬛VERY LOW → 🟥LOW → 🟧MEDIUM → 🟩HIGH → 🟦VERY HIGH). See `analysis/methodologies/ai-driven-analysis-guide.md` v5.0 for full criteria. + ### Phase 1 — Data Collection & Initial Analysis 1. Fetch MCP data (`get_calendar_events`, `get_fragor`, `get_interpellationer`, `get_sync_status`) 2. Extract watch-points and key parliamentary events for the coming week @@ -271,14 +223,9 @@ echo "Article Type: week-ahead" echo "============================" ``` -## 📅 Riksmöte (Parliamentary Session) Calculation +## 📅 Riksmöte Calculation -The Swedish parliamentary session runs September–August. Calculate the current `rm` value: -- If current month is September or later (calendar month 9; JavaScript `Date` month index 8): `rm = "{currentYear}/{nextYear's last 2 digits}"` -- If current month is before September (calendar month ≤ 8; JavaScript `Date` month index ≤ 7): `rm = "{previousYear}/{currentYear's last 2 digits}"` -- Example: February 2026 → `rm = "2025/26"`, October 2026 → `rm = "2026/27"` - -Use this calculated `rm` value in ALL MCP queries requiring the `rm` parameter. +September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. ## MANDATORY Deduplication Check @@ -307,44 +254,17 @@ fi ## MANDATORY MCP Health Gate -Before generating ANY articles, verify MCP connectivity: - -1. Call `get_sync_status({})` — if successful, proceed -2. If it fails, wait 30 seconds and retry (up to 3 total attempts) -3. If ALL 3 attempts fail: - - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated." - - DO NOT analyze existing articles in the repository - - DO NOT fabricate or recycle content - - The workflow MUST end with noop - -**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from: -- Existing articles in the news/ directory -- Cached or stale data -- AI-generated content without MCP source data +1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) +2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/{article-type} -``` -Example: `news/content/2026-03-23/week-ahead` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-23/week-ahead`). `safeoutputs___create_pull_request` handles this automatically. ## MANDATORY PR Creation @@ -357,39 +277,14 @@ Example: `news/content/2026-03-23/week-ahead` > 2. Stage and commit locally (scoped to week-ahead subfolder): `git add news/*week-ahead*.html news/metadata/ "analysis/daily/$ARTICLE_DATE/$ANALYSIS_SUBFOLDER/" analysis/weekly/ && git commit -m "Add week-ahead articles and analysis artifacts"` > 3. Call `safeoutputs___create_pull_request` with `title`, `body`, and `labels` > -> **❌ DO NOT** run `git push`, `git checkout -b`, `git branch`, or use GitHub API to create PRs. -> **❌ DO NOT** try alternative approaches if the tool call works — one call is all you need. -> **❌ DO NOT** call `safeoutputs___noop` if articles were generated but PR creation failed — let the workflow FAIL instead. - -- ✅ `safeoutputs___create_pull_request` when articles generated -- ✅ `safeoutputs___create_pull_request` with analysis-only PR when no articles but analysis artifacts exist — title: `📊 Analysis Only - Week Ahead - {date}`, labels: `["analysis-only", "week-ahead"]` -- ✅ `safeoutputs___noop` ONLY if MCP server is completely unreachable after 3 retry attempts AND no analysis artifacts exist -- ❌ NEVER use `safeoutputs___noop` because articles already exist — analysis always runs -- ❌ NEVER use `safeoutputs___noop` as fallback for PR creation failures -- ❌ NEVER use `safeoutputs___noop` if analysis artifacts for the current run exist (e.g. under `analysis/daily/$ARTICLE_DATE/` or `analysis/weekly/$WEEK_LABEL/`) - -> **🚨 NEVER search for safe output tools via bash.** `safeoutputs___create_pull_request`, `safeoutputs___noop`, `safeoutputs___missing_tool`, and `safeoutputs___missing_data` are **always available as direct tool calls** in your tool list. NEVER run `ls /tmp/gh-aw/`, `ls /home/runner/.copilot/`, or any bash command to "find" them. After `git commit`, call the tool directly as your VERY NEXT action. +- ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs +- ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist +- ❌ NEVER noop because articles already exist — analysis always runs +- ❌ Safe output tools are in your tool list — NEVER search for them via bash ## 🌐 Dispatch Translation Workflow -After creating the content PR with `safeoutputs___create_pull_request`, dispatch the translation workflow for remaining languages: - -``` -safeoutputs___dispatch_workflow({ - "workflow_name": "news-translate", - "inputs": { - "article_date": "", - "article_type": "", - "languages": "all-extra" - } -}) -``` - -This triggers the dedicated `news-translate` workflow which generates high-quality translations for all 12 non-core languages (da, no, fi, de, fr, es, nl, ar, he, ja, ko, zh) using `concurrency.job-discriminator` for parallel execution. - -> **⚠️ Timing note:** The dispatch runs immediately after creating this PR, but the translate workflow checks out `main` where the EN/SV articles may not yet exist (the content PR hasn't been merged). In this case, the translate workflow will `noop` gracefully. The scheduled translate cron (11:00 and 17:00 UTC weekdays) will pick up the translations after the content PR is merged. - -> **Note:** Full translation quality rules are maintained in `news-translate.md`. When generating EN/SV articles, ensure content is analytically rich — translations will faithfully reproduce the same depth. +After creating the content PR, dispatch translations: `safeoutputs___dispatch_workflow({ "workflow_name": "news-translate", "inputs": { "article_date": "", "article_type": "", "languages": "all-extra" } })`. See `news-translate.md` for full translation quality rules. ## MCP Tools @@ -634,16 +529,8 @@ If the generated article lacks analysis, manually add contextual commentary befo **Note**: News index files, metadata, and sitemap are generated automatically at build time by the `prebuild` script. Do NOT run generation scripts or commit their output — only commit the article HTML files. Run `npm run prebuild` (or `npm run build`) locally if you need to validate or preview the generated index, metadata, or sitemap outputs on a fresh checkout where these files will not exist. -## 🌐 MANDATORY Translation Quality Rules - -> **📋 Canonical translation rules are maintained in `news-translate.md`.** - -For EN/SV articles generated by this workflow, ensure: -1. **ALL section headings** and body content in the correct language (EN or SV) -2. **Meta keywords** in the article language -3. **No untranslated data-translate spans** in final output -4. Swedish API titles translated to article language +## 🌐 Translation Quality -When the `news-translate` workflow handles remaining 12 languages, it applies the full translation quality rules including RTL support (ar, he), CJK native script (ja, ko, zh), Nordic parliamentary terms (da, no, fi), and European formal register (de, fr, es, nl). See `news-translate.md` for comprehensive per-language requirements. +EN/SV only: all headings, meta, content in correct language; no untranslated `data-translate` spans; Swedish API titles translated. Full rules: `news-translate.md`. ## Article Naming Convention Files: `YYYY-MM-DD-week-ahead-{lang}.html` \ No newline at end of file diff --git a/.github/workflows/news-weekly-review.md b/.github/workflows/news-weekly-review.md index 2ade64fdf2..0879762a81 100644 --- a/.github/workflows/news-weekly-review.md +++ b/.github/workflows/news-weekly-review.md @@ -140,17 +140,7 @@ This is a **retrospective** article analyzing the past 7 days of parliamentary a ## 🧠 Repo Memory -This workflow uses **persistent repo-memory** on branch `memory/news-generation` (shared with all news workflows). - -**At run START — read context:** -- Read `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` for today (and optionally yesterday) to check which dok_ids were already analyzed recently -- Read `memory/news-generation/last-run-news-weekly-review.json` for previous run metadata -- Skip documents already covered by another workflow to avoid duplicate analysis - -**At run END — write context:** -- Update `memory/news-generation/last-run-news-weekly-review.json` with date, documents analyzed, quality score -- Write processed dok_ids to `memory/news-generation/covered-documents/{YYYY-MM-DD}.json` (sharded by date; retain last 7 days) -- Update `memory/news-generation/translation-status.json` with new articles needing translation +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-weekly-review.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -165,65 +155,23 @@ This workflow uses **persistent repo-memory** on branch `memory/news-generation` ## ⚠️ CRITICAL: Bash Tool Call Format -**Every `bash` tool call MUST include both required parameters — omitting either causes validation errors:** - -| Parameter | Required | Description | -|-----------|----------|-------------| -| `command` | ✅ YES | The shell command string to execute | -| `description` | ✅ YES | Short human-readable label (≤100 chars) | - -**✅ CORRECT** — always provide both `command` and `description`: -``` -bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" }) -bash({ command: "npm ci --prefer-offline --no-audit", description: "Install npm dependencies" }) -bash({ command: "npx htmlhint 'news/*-*.html'", description: "Validate HTML files" }) -``` - -**❌ WRONG** — missing parameters cause `"command": Required, "description": Required` errors: -``` -bash("npm ci") // ← WRONG: no named parameters -bash({ command: "..." }) // ← WRONG: missing description -``` - -> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string. - -## 🛡️ AWF Shell Safety — MANDATORY for Agent-Generated Bash - -> **The Agent Workflow Firewall (AWF) blocks dangerous shell expansion patterns.** Fenced bash blocks in init steps run as normal shell, but any command YOU generate via the `bash` tool IS subject to AWF filtering. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "Bash Tool Call Format". Key rule: every `bash` call MUST have both `command` AND `description` parameters. Example: `bash({ command: "date -u '+%Y-%m-%d'", description: "Get current UTC date" })` -**Key rules — NEVER use these in your generated bash commands:** -1. **NEVER** use `$`+`{VAR}` — always use `$VAR` (no curly braces) -2. **NEVER** use `$`+`(command)` — use pipes, `find -exec`, or separate commands -3. **NEVER** use `$`+`{VAR:-default}` — set defaults with `if/then` first, then use `$VAR` -4. **Use `find -exec`** instead of for-loops with `$`+`(basename ...)` -5. **Use direct file paths** when possible instead of variable-constructed paths with braces +## 🛡️ AWF Shell Safety -## 🔤 UTF-8 Encoding — MANDATORY for ALL Content +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "AWF Shell Safety". Summary: use `$VAR` not `$`+`{VAR}`, use `find -exec` not `$(...)`, set defaults with `if/then` before using `$VAR`. -> **NON-NEGOTIABLE**: All article content, titles, descriptions, and metadata MUST use native UTF-8 characters. NEVER use HTML numeric entities (`ä`, `ö`, `å`) for non-ASCII characters like Swedish åäö, German üö, French éè, etc. +## 🔤 UTF-8 Encoding -**Rules:** -1. Write Swedish characters as UTF-8: `ö`, `ä`, `å`, `Ö`, `Ä`, `Å` — NEVER as `ö`, `ä`, etc. -2. Author name: Always `James Pether Sörling` — never `Sörling`. -3. All HTML files use `` — entities are unnecessary and cause double-escaping bugs. -4. This applies to ALL languages and ALL output: titles, meta tags, JSON-LD, article body, analysis files. +> **Full reference:** See `SHARED_PROMPT_PATTERNS.md` → "UTF-8 Encoding". Summary: use native UTF-8 (`ö`, `ä`, `å`) — NEVER HTML entities (`ö`, `ä`). Author: `James Pether Sörling`. ## Required Skills -Before generating articles, consult these skills: -1. **`.github/skills/editorial-standards/SKILL.md`** — OSINT/INTOP editorial standards -2. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology -3. **`.github/skills/legislative-monitoring/SKILL.md`** — Voting patterns, committee tracking, bill progress -4. **`.github/skills/riksdag-regering-mcp/SKILL.md`** — MCP tool documentation -5. **`.github/skills/language-expertise/SKILL.md`** — Per-language style guidelines -6. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe outputs usage -7. **`scripts/prompts/v2/political-analysis.md`** — Core political analysis framework (6 analytical lenses) -8. **`scripts/prompts/v2/stakeholder-perspectives.md`** — Multi-perspective analysis instructions -9. **`scripts/prompts/v2/quality-criteria.md`** — Quality self-assessment rubric (minimum 7/10) -10. **`scripts/prompts/v2/per-file-intelligence-analysis.md`** — Per-file AI analysis protocol -11. **`analysis/methodologies/ai-driven-analysis-guide.md`** — Methodology for deep per-file analysis -12. **`analysis/templates/per-file-political-intelligence.md`** — Per-file analysis output template +Consult as needed — do NOT read all files upfront: +- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -248,6 +196,10 @@ Based on the editorial profile for `weekly-review` (from `scripts/editorial-fram - **Min. stakeholders**: 5 perspectives - **AI iterations**: 2 (standard), 2 (deep), or 3 (comprehensive) +### 🗳️ Election 2026 Lens (Mandatory — v5.0) + +Every analysis MUST include an **Election 2026 Implications** section assessing: Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, and Policy Legacy. Use the **5-level confidence scale** (⬛VERY LOW → 🟥LOW → 🟧MEDIUM → 🟩HIGH → 🟦VERY HIGH). See `analysis/methodologies/ai-driven-analysis-guide.md` v5.0 for full criteria. + ### Phase 1 — Data Collection & Initial Analysis 1. Fetch MCP data (`get_betankanden`, `get_propositioner`, `get_motioner`, `search_anforanden`, `search_voteringar`, `get_sync_status`) 2. Compute weekly metrics: document counts, key votes, most active parties @@ -276,14 +228,9 @@ echo "Article Type: weekly-review" echo "============================" ``` -## 📅 Riksmöte (Parliamentary Session) Calculation +## 📅 Riksmöte Calculation -The Swedish parliamentary session runs September–August. Calculate the current `rm` value: -- If current month is September or later (calendar month 9; JavaScript `Date` month index 8): `rm = "{currentYear}/{nextYear's last 2 digits}"` -- If current month is before September (calendar month ≤ 8; JavaScript `Date` month index ≤ 7): `rm = "{previousYear}/{currentYear's last 2 digits}"` -- Example: February 2026 → `rm = "2025/26"`, October 2026 → `rm = "2026/27"` - -Use this calculated `rm` value in ALL MCP queries requiring the `rm` parameter. +September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. ## MANDATORY Deduplication Check @@ -312,44 +259,17 @@ fi ## MANDATORY MCP Health Gate -Before generating ANY articles, verify MCP connectivity: - -1. Call `get_sync_status({})` — if successful, proceed -2. If it fails, wait 30 seconds and retry (up to 3 total attempts) -3. If ALL 3 attempts fail: - - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated." - - DO NOT analyze existing articles in the repository - - DO NOT fabricate or recycle content - - The workflow MUST end with noop - -**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from: -- Existing articles in the news/ directory -- Cached or stale data -- AI-generated content without MCP source data +1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) +2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract -This workflow is a **content** workflow and MUST only create/modify files for **EN and SV** languages. - -- ✅ **Allowed:** `news/YYYY-MM-DD-*-en.html`, `news/YYYY-MM-DD-*-sv.html` -- ❌ **Forbidden:** `news/YYYY-MM-DD-*-da.html`, `news/YYYY-MM-DD-*-no.html`, or any other translation language - -Validate file ownership (checks staged, unstaged, and untracked changes): -```bash -npx tsx scripts/validate-file-ownership.ts content -``` - -If the validator reports violations, remove tracked changes with `git restore --staged --worktree -- ` (or `git checkout -- ` on older Git), and remove untracked files with `rm ` (or `git clean -f -- `) before committing. +Content workflows: only create/modify **EN and SV** files (`news/YYYY-MM-DD-*-en.html`, `*-sv.html`). Validate with `npx tsx scripts/validate-file-ownership.ts content`. Fix violations: `git restore --staged --worktree -- ` (tracked) or `rm ` (untracked). ### Branch Naming Convention -Use deterministic branch names for content PRs: -``` -news/content/{YYYY-MM-DD}/{article-type} -``` -Example: `news/content/2026-03-23/weekly-review` - -> **Note:** `safeoutputs___create_pull_request` handles branch creation automatically; this naming convention is documented for traceability and conflict avoidance. +Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-23/weekly-review`). `safeoutputs___create_pull_request` handles this automatically. ## MANDATORY PR Creation @@ -362,39 +282,14 @@ Example: `news/content/2026-03-23/weekly-review` > 2. Stage and commit locally (scoped to the resolved weekly-review analysis subfolder): `git add news/*weekly-review*.html news/metadata/ "analysis/daily/$ARTICLE_DATE/$ANALYSIS_SUBFOLDER/" analysis/weekly/ && git commit -m "Add weekly-review articles and analysis artifacts"` > 3. Call `safeoutputs___create_pull_request` with `title`, `body`, and `labels` > -> **❌ DO NOT** run `git push`, `git checkout -b`, `git branch`, or use GitHub API to create PRs. -> **❌ DO NOT** try alternative approaches if the tool call works — one call is all you need. -> **❌ DO NOT** call `safeoutputs___noop` if articles were generated but PR creation failed — let the workflow FAIL instead. - -- ✅ `safeoutputs___create_pull_request` when articles generated -- ✅ `safeoutputs___create_pull_request` with analysis-only PR when no articles but analysis artifacts exist — title: `📊 Analysis Only - Weekly Review - {date}`, labels: `["analysis-only", "weekly-review"]` -- ✅ `safeoutputs___noop` ONLY if MCP server is completely unreachable after 3 retry attempts AND no analysis artifacts exist -- ❌ NEVER use `safeoutputs___noop` because articles already exist — analysis always runs -- ❌ NEVER use `safeoutputs___noop` as fallback for PR creation failures -- ❌ NEVER use `safeoutputs___noop` if analysis artifacts exist for the current run (e.g., in `analysis/daily/$ARTICLE_DATE/` or the current `analysis/weekly/$WEEK_LABEL/` directory) - -> **🚨 NEVER search for safe output tools via bash.** `safeoutputs___create_pull_request`, `safeoutputs___noop`, `safeoutputs___missing_tool`, and `safeoutputs___missing_data` are **always available as direct tool calls** in your tool list. NEVER run `ls /tmp/gh-aw/`, `ls /home/runner/.copilot/`, or any bash command to "find" them. After `git commit`, call the tool directly as your VERY NEXT action. +- ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs +- ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist +- ❌ NEVER noop because articles already exist — analysis always runs +- ❌ Safe output tools are in your tool list — NEVER search for them via bash ## 🌐 Dispatch Translation Workflow -After creating the content PR with `safeoutputs___create_pull_request`, dispatch the translation workflow for remaining languages: - -``` -safeoutputs___dispatch_workflow({ - "workflow_name": "news-translate", - "inputs": { - "article_date": "", - "article_type": "", - "languages": "all-extra" - } -}) -``` - -This triggers the dedicated `news-translate` workflow which generates high-quality translations for all 12 non-core languages (da, no, fi, de, fr, es, nl, ar, he, ja, ko, zh) using `concurrency.job-discriminator` for parallel execution. - -> **⚠️ Timing note:** The dispatch runs immediately after creating this PR, but the translate workflow checks out `main` where the EN/SV articles may not yet exist (the content PR hasn't been merged). In this case, the translate workflow will `noop` gracefully. The scheduled translate cron (11:00 and 17:00 UTC weekdays) will pick up the translations after the content PR is merged. - -> **Note:** Full translation quality rules are maintained in `news-translate.md`. When generating EN/SV articles, ensure content is analytically rich — translations will faithfully reproduce the same depth. +After creating the content PR, dispatch translations: `safeoutputs___dispatch_workflow({ "workflow_name": "news-translate", "inputs": { "article_date": "", "article_type": "", "languages": "all-extra" } })`. See `news-translate.md` for full translation quality rules. ## MCP Tools @@ -609,14 +504,6 @@ Weekly review articles should include: 6. **What Mattered Most**: Analysis of the week's most consequential development 7. **Looking Ahead**: Brief preview of the coming week -## 🌐 MANDATORY Translation Quality Rules - -> **📋 Canonical translation rules are maintained in `news-translate.md`.** - -For EN/SV articles generated by this workflow, ensure: -1. **ALL section headings** and body content in the correct language (EN or SV) -2. **Meta keywords** in the article language -3. **No untranslated data-translate spans** in final output -4. Swedish API titles translated to article language +## 🌐 Translation Quality -When the `news-translate` workflow handles remaining 12 languages, it applies the full translation quality rules including RTL support (ar, he), CJK native script (ja, ko, zh), Nordic parliamentary terms (da, no, fi), and European formal register (de, fr, es, nl). See `news-translate.md` for comprehensive per-language requirements. \ No newline at end of file +EN/SV only: all headings, meta, content in correct language; no untranslated `data-translate` spans; Swedish API titles translated. Full rules: `news-translate.md`. \ No newline at end of file diff --git a/analysis/methodologies/README.md b/analysis/methodologies/README.md index 2b99f609e1..2296707d11 100644 --- a/analysis/methodologies/README.md +++ b/analysis/methodologies/README.md @@ -11,12 +11,12 @@

Owner - Version + Version Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 4.0 | **📅 Last Updated:** 2026-03-31 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 4.1 | **📅 Last Updated:** 2026-06-01 (UTC) **🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public @@ -748,6 +748,30 @@ flowchart TD --- +## 🆕 v4.1 Methodology Upgrades (2026-06-01) + +All methodology guides were updated in v4.1 with the following cross-cutting improvements: + +### 🗳️ Election 2026 Coverage +- `ai-driven-analysis-guide.md` v5.0: Mandatory Election 2026 lens with 5-dimension electoral assessment for ALL analyses +- `political-classification-guide.md` v2.3: Election 2026 urgency boost rules for pre-election period +- `political-swot-framework.md` v2.3: Election 2026 as mandatory SWOT dimension with electoral quadrant requirements +- `political-style-guide.md` v2.2: Election 2026 framing requirements with approved vocabulary and confidence standards + +### 🎯 5-Level Confidence Scale +All methodology guides now use a unified **5-level confidence scale**: +- ⬛ VERY LOW → 🟥 LOW → 🟧 MEDIUM → 🟩 HIGH → 🟦 VERY HIGH +- `political-swot-framework.md`: Updated decay table from 3-level to 5-level +- `political-risk-methodology.md`: Added confidence scale mapping + election proximity factor + +### 📊 Mermaid Diagram Mandates +- `ai-driven-analysis-guide.md` v5.0: Specifies required diagram type per analysis context (flowchart/timeline/quadrantChart/mindmap for each scenario) + +### 📋 Historical Comparison +- `ai-driven-analysis-guide.md` v5.0: Mandatory historical comparison with 3 time periods + precedents table for all synthesis analyses + +--- +

📊 Hack23 AB — Political Intelligence Through Rigorous Methodology

diff --git a/analysis/methodologies/ai-driven-analysis-guide.md b/analysis/methodologies/ai-driven-analysis-guide.md index bb56db81d7..b55e63ad2f 100644 --- a/analysis/methodologies/ai-driven-analysis-guide.md +++ b/analysis/methodologies/ai-driven-analysis-guide.md @@ -11,13 +11,13 @@

Owner - Version + Version Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 4.2 | **📅 Last Updated:** 2026-04-06 (UTC) -**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-07-03 +**📋 Document Owner:** CEO | **📄 Version:** 5.0 | **📅 Last Updated:** 2026-06-01 (UTC) +**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-09-01 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public --- @@ -1510,18 +1510,29 @@ assume article pages perform this step automatically unless that initializer is Every analysis file MUST include at least 1 Mermaid diagram. For synthesis files, include at least 2: ``` -## Required Mermaid Diagrams per Analysis Type - -| Analysis File | Required Diagram(s) | Content | -|---------------|---------------------|---------| -| synthesis-summary.md | 2: Document relationship + Risk interconnection | Show how documents relate and how risks cascade | -| swot-analysis.md | 1: SWOT quadrant mapping with cross-links | Show S↔O exploits and W↔T amplifications | -| risk-assessment.md | 1: Risk heat map or cascading risk chain | Show L×I positioning and risk dependencies | -| threat-analysis.md | 1: Threat actor diagram or attack tree | Show threat sources, pathways, and mitigations | -| stakeholder-perspectives.md | 1: Stakeholder impact network | Show which stakeholders are affected and how | -| significance-scoring.md | 1: Multi-dimensional scoring radar | Show 5-dimension significance breakdown | -| cross-reference-map.md | 1: Document relationship graph | Show ALL detected cross-references | -``` +## Required Mermaid Diagrams per Analysis Type (v5.0) + +| Analysis File | Required Diagram Type | Diagram Purpose | Minimum Color-Coded Nodes | +|---------------|----------------------|-----------------|:-------------------------:| +| per-file-political-intelligence.md | `flowchart LR` — classification tree + `quadrantChart` — SWOT impact | Classification decision path + political impact mapping | 4 colors | +| synthesis-summary.md | `graph TD` — intelligence dashboard + `graph LR` — SWOT balance | Daily landscape overview + coalition assessment | 4 colors each | +| swot-analysis.md | `graph TD` — SWOT quadrant mapping with cross-links | S↔O exploits and W↔T amplifications | 4 colors | +| risk-assessment.md | `graph TD` — risk heat map + `flowchart TD` — cascading chain | L×I positioning and risk dependencies | 4 tiers (green/yellow/orange/red) | +| threat-analysis.md | `graph LR` — attack tree (threat taxonomy branches) | Threat sources, pathways, and mitigations | 6 threat categories | +| stakeholder-impact.md | `graph TD` — stakeholder impact network | Stakeholder groups affected and direction | 6 stakeholder groups | +| significance-scoring.md | `graph TD` — scoring profile + decision gate | 5-dimension significance breakdown | 5 decision outcomes | +| political-classification.md | `graph LR` — classification decision tree | Sensitivity + urgency + scope paths | 4 paths | + +### Diagram Type Mandate by Analysis Context + +| Analysis Context | Mandatory Diagram Type | Reason | +|-----------------|----------------------|--------| +| **Legislative process** | `flowchart` (LR or TD) — stages from committee to royal assent | Visualize process status and bottlenecks | +| **Policy evolution over time** | `timeline` or `gantt` — chronological development | Track policy trajectory | +| **Coalition/party dynamics** | `quadrantChart` — party position mapping | Reveal alignment and opposition patterns | +| **Risk landscape** | `graph TD` with color-coded L×I scores | Visualize risk tiers and dependencies | +| **Stakeholder relationships** | `graph LR` with directional influence arrows | Map power dynamics and coalition potential | +| **Threat decomposition** | `flowchart` attack tree structure | Identify threat vectors and mitigations | --- @@ -1894,6 +1905,118 @@ a separate reservation on proportionality grounds. [HIGH confidence] --- +| Data count inconsistencies (title vs body) | Not tracked | Multiple instances | 🔴 New issue | + +--- + +## 🗳️ Election 2026 Lens — Mandatory Analysis Requirement (v5.0) + +> **Added in v5.0 — ALL analyses MUST include an Election 2026 section.** + +With the September 2026 Swedish general election approaching, every political intelligence analysis MUST assess electoral implications. This requirement applies to all analysis templates and workflow outputs. + +### Mandatory Election 2026 Assessment Dimensions + +Every per-file analysis and synthesis summary MUST assess: + +1. **Electoral Impact** — How does this document/event affect September 2026 election positioning? +2. **Coalition Scenarios** — Which coalition configurations benefit/suffer? +3. **Voter Salience** — Which voter segments are most affected, and by how much? +4. **Campaign Vulnerability** — Does this create campaign attack vectors for opposition? +5. **Policy Legacy** — Will this become an electoral asset or liability by September 2026? + +### Electoral Significance Classifications + +| Classification | Definition | Action | +|---------------|-----------|--------| +| 🔴 **CRITICAL** | Event will directly affect 2026 election outcome | Include in all synthesis summaries; flag for electoral tracking | +| 🟠 **HIGH** | Significant pre-election narrative contribution | Mandatory inclusion in forward indicators | +| 🟡 **MODERATE** | Peripheral electoral relevance | Include if space allows; note in stakeholder analysis | +| 🟢 **LOW** | Minimal electoral impact | Optional brief mention | +| ⚪ **NEGLIGIBLE** | No discernible electoral dimension | Skip Election 2026 section (note: "negligible electoral relevance") | + +### Pre-Election Analysis Calendar + +| Milestone | Date | Analysis Focus | +|-----------|------|---------------| +| Budget proposition deadline | Sep 2026 | Fiscal credibility, welfare promises | +| Last major Riksdag session | Jun 2026 | Legislative legacy assessment | +| Party conference season | Sep–Oct 2025 | Policy positioning, coalition signals | +| EU implications window | Ongoing | Sweden's EU presidency, ECHR compliance | +| **General Election** | **Sep 2026** | **Full electoral analysis required** | + +--- + +## 🎯 5-Level Confidence Scale (v5.0) + +> **Replaces binary HIGH/MEDIUM/LOW scale across ALL analysis types.** + +| Level | Label | Criteria | Evidence Threshold | Color Code | +|-------|-------|----------|--------------------|:----------:| +| ⬛ 1 | **VERY LOW** | Speculation only, single unverified source | 0–1 sources, no corroboration | `#6c757d` | +| 🟥 2 | **LOW** | Circumstantial evidence, indirect indicators | 2 sources, indirect evidence | `#dc3545` | +| 🟧 3 | **MEDIUM** | Multiple independent sources, moderate corroboration | 3+ sources, moderate agreement | `#fd7e14` | +| 🟩 4 | **HIGH** | Official records, documented data, direct evidence | Official docs, voting records, committee reports | `#28a745` | +| 🟦 5 | **VERY HIGH** | Verified data + independent corroboration + expert consensus | Multiple official sources, cross-validated | `#0d6efd` | + +### Confidence Level Application Rules + +- **VERY HIGH** — Applies only to claims backed by official voting records, committee decisions, government propositions, or multiple verified news sources with cross-validation. +- **HIGH** — Official documents (riksdag API data, government press releases) consulted but not independently cross-validated. +- **MEDIUM** — Multiple sources available but with some inconsistency or incomplete coverage. +- **LOW** — Limited evidence; claim is inferential or based on pattern recognition without direct confirmation. +- **VERY LOW** — Speculative; only a single indirect indicator with no corroborating evidence. + +### Migration from 3-Level to 5-Level Scale + +When upgrading existing analyses to use the 5-level scale: +- Previous `HIGH` → `HIGH` (4) or `VERY HIGH` (5) depending on cross-validation status +- Previous `MEDIUM` → `MEDIUM` (3) or `LOW` (2) depending on evidence density +- Previous `LOW` → `LOW` (2) or `VERY LOW` (1) depending on source quality + +--- + +## 📊 Mandatory Mermaid Diagram Requirements (v5.0) + +Each analysis type MUST include the specified Mermaid diagram type: + +| Analysis Type | Required Mermaid Diagram | Purpose | +|--------------|------------------------|---------| +| **Legislative process analyses** | `flowchart` — showing legislative stages (committee → floor vote → royal assent) | Visualize process status and bottlenecks | +| **Policy evolution analyses** | `timeline` or `gantt` — showing policy development over time | Track policy trajectory | +| **Coalition/party dynamics** | `quadrantChart` or `mindmap` — mapping party positions | Reveal alignment patterns | +| **Risk assessment** | `graph TD` with color-coded risk nodes (L×I scores) | Visualize risk landscape | +| **Stakeholder relationships** | `graph LR` with directional arrows showing influence | Map power dynamics | +| **Threat analysis** | `flowchart` attack tree (LR direction, threat taxonomy) | Decompose threat vectors | + +### Mermaid Color Standards + +``` +🔴 CRITICAL/SEVERE/RESTRICTED: fill:#dc3545,color:#fff +🟠 HIGH/URGENT: fill:#fd7e14,color:#fff +🟡 MEDIUM/ELEVATED: fill:#ffc107,color:#000 +🟢 LOW/ROUTINE/PUBLIC: fill:#28a745,color:#fff +🔵 INFORMATION/ELEVATED: fill:#0d6efd,color:#fff +⚪ NEUTRAL/PLACEHOLDER: fill:#6c757d,color:#fff +``` + +--- + +## 📋 Historical Comparison Requirements (v5.0) + +Every synthesis-level analysis MUST include a historical comparison with: + +1. **Same period last riksmöte** — Compare document volumes, risk levels, coalition dynamics +2. **Same period last year** — Year-over-year trend indicators +3. **Pre-election equivalents** — Compare to equivalent pre-election periods in 2021/22 + +**Historical Comparison Minimum Requirements:** +- At least 3 metric comparisons with trend arrows (↑/→/↓) +- At least 1 precedent from a prior riksmöte with documented outcome +- Context statement of 2–3 sentences explaining whether this is a historically unusual period + +--- + ## 📚 Related Documents | Document | Purpose | @@ -1913,11 +2036,12 @@ a separate reservation on proportionality grounds. [HIGH confidence] **Document Control:** - **Path:** `/analysis/methodologies/ai-driven-analysis-guide.md` -- **Version:** 4.2 +- **Version:** 5.0 +- **Key Changes v5.0:** Election 2026 Lens (mandatory 5-dimension electoral assessment for ALL analyses), 5-Level Confidence Scale replacing binary HIGH/MEDIUM/LOW, Mermaid diagram mandates per analysis type (flowchart/timeline/quadrantChart/mindmap/xychart), Historical Comparison requirements (3 time periods + precedents), pre-election analysis calendar - **Key Changes v4.2:** Empty Data Handling Protocol (lookback strategy, direct MCP retrieval, carry-forward protocol, minimum output requirements), Per-File Analysis Output Example (worked example of betänkande analysis with SWOT/risk/forward indicators) - **Key Changes v4.0:** AI article content generation protocol (5 mandatory sections with prompts), visualization integration protocol (Chart.js/D3.js), policy domain inference with committee mapping, pre-article analysis integration requirement, AI self-evaluation quality gate, empty analysis fallback protocol, 2026-04-03 systemic quality audit (444+ generic filler, 456+ excuse-as-analysis, 210+ boilerplate), cumulative quality tracking - **Key Changes v3.0:** Claude Opus 4.6 agentic integration, AI-first analysis principle, deprecated code function table, AI title/description generation prompts, analysis-to-article reference linking, cross-reference quality requirements, 2026-04-02 quality audit findings - **Key Changes v2.1:** Document-type analysis focus table, analysis depth levels (L1/L2/L3), anti-pattern gallery, quality gate checklist with scoring rubric - **Key Changes v2.0:** Folder isolation rules, AI-only content mandate, multi-framework depth requirements, advanced anti-pattern detection - **Classification:** Public -- **Next Review:** 2026-07-03 +- **Next Review:** 2026-09-01 diff --git a/analysis/methodologies/political-classification-guide.md b/analysis/methodologies/political-classification-guide.md index 4d0cacd2dd..45ec7f71ce 100644 --- a/analysis/methodologies/political-classification-guide.md +++ b/analysis/methodologies/political-classification-guide.md @@ -11,12 +11,12 @@

Owner - Version + Version Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public @@ -191,6 +191,22 @@ Key dates that automatically elevate urgency: - **June**: Spring session close — **ELEVATED** for pending legislation - **September (election year)**: Riksdag election — **CRITICAL** political environment +### Election 2026 Urgency Boosts + +In the **12 months before September 2026**, apply urgency boost rules for electoral sensitivity: + +| Document Type | Normal Urgency | Election-Year Boost | Boost Condition | +|--------------|:--------------:|:-------------------:|:----------------| +| Budget propositions | ELEVATED | URGENT | Within 6 months of election | +| Coalition agreements / breakdowns | URGENT | CRITICAL | Any time | +| Welfare, healthcare, migration policy | ROUTINE/ELEVATED | +1 tier | Voter salience > HIGH | +| Criminal justice reform | ELEVATED | URGENT | If sentencing/police scope is national | +| Constitutional amendments | ELEVATED | CRITICAL | Any time | +| Government confidence votes | CRITICAL | CRITICAL | No boost needed — always CRITICAL | +| Ministerial appointments/resignations | ELEVATED | URGENT | Within 3 months of election | + +> **Boost rationale:** Electoral proximity makes politically salient events more consequential for public discourse and editorial routing. Analysts MUST apply the election-year boost and document the rationale. + --- ## 📊 Impact Scope Assessment @@ -550,9 +566,10 @@ export const COMMITTEE_TO_DOMAIN = { **Document Control:** - **Path:** `/analysis/methodologies/political-classification-guide.md` - **ISMS Reference:** [CLASSIFICATION.md](https://github.com/Hack23/ISMS-PUBLIC/blob/main/CLASSIFICATION.md) -- **Version:** 2.2 -- **Advanced Dimensions:** Political Temperature Index, Strategic Significance, Coalition Impact Vector +- **Version:** 2.3 +- **Advanced Dimensions:** Political Temperature Index, Strategic Significance, Coalition Impact Vector, Election 2026 Context +- **Key Changes v2.3:** Added Election 2026 classification context (electoral sensitivity boost rules for pre-election period), 5-level confidence scale integration, enhanced urgency criteria for election-year events - **Key Changes v2.2:** Committee→Domain Canonical Mapping (15 committees with domain keys, classification priorities, Mermaid pipeline diagram, code reference) - **MCP Integration:** riksdag-regering-mcp tool mapping, committee-specific baselines - **Classification:** Public -- **Next Review:** 2026-06-30 +- **Next Review:** 2026-09-01 diff --git a/analysis/methodologies/political-risk-methodology.md b/analysis/methodologies/political-risk-methodology.md index 9f9bde3aeb..81527c5b36 100644 --- a/analysis/methodologies/political-risk-methodology.md +++ b/analysis/methodologies/political-risk-methodology.md @@ -11,12 +11,12 @@

Owner - Version + Version Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.1 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-06-01 (UTC) **🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public @@ -86,6 +86,33 @@ graph LR | 10–14 | **High** | 🟠 | Priority assessment; include in news | | 15–25 | **Critical** | 🔴 | Immediate analysis; breaking news consideration | +### 5-Level Confidence Scale Mapping for Risk Scores + +Risk scores carry a confidence label that reflects the quality and completeness of evidence behind the L×I assessment: + +| Confidence Level | Label | Risk Score Context | Evidence Requirements | +|:----------------:|-------|-------------------|-----------------------| +| 🟦 5 | **VERY HIGH** | Score backed by official voting records or government actions | Multiple official sources, cross-validated, no conflicting evidence | +| 🟩 4 | **HIGH** | Score based on official Riksdag API data or documented government positions | ≥2 official sources, direct evidence | +| 🟧 3 | **MEDIUM** | Score based on multiple news reports or committee proceedings | 3+ sources with moderate agreement; some inferential gaps | +| 🟥 2 | **LOW** | Score based on limited public information or indirect indicators | 2 sources, circumstantial evidence; score may shift significantly | +| ⬛ 1 | **VERY LOW** | Score is speculative; single source or no confirmed evidence | 0–1 sources; treat score as provisional | + +**Application rule:** Always append the confidence label to every risk score entry. Example: `L=3, I=4, Score=12 [HIGH confidence — based on JuU committee vote records and ministerial statement]` + +### Election 2026 Risk Proximity Factor + +In the 12 months before September 2026, apply a **proximity factor** to Electoral risk scores: + +| Months to Election | Proximity Factor | Applied Risk Score | +|:-----------------:|:---------------:|:-----------------:| +| >18 months | ×1.0 | Standard L×I score | +| 12–18 months | ×1.1 | Score × 1.1 (rounded up) | +| 6–12 months | ×1.25 | Score × 1.25 (rounded up) | +| <6 months | ×1.5 | Score × 1.5 (rounded up) | + +> **Rationale:** Political risks with direct electoral implications become more consequential as the election approaches. A score of 8 (HIGH) with 5 months to election becomes 12 (HIGH→ border of CRITICAL) after proximity adjustment. + --- ## 🤝 Coalition Stability Risk @@ -586,8 +613,9 @@ This section provides a **complete, date-specific worked example** showing how t **Document Control:** - **Path:** `/analysis/methodologies/political-risk-methodology.md` - **ISMS Reference:** [Risk_Assessment_Methodology.md](https://github.com/Hack23/ISMS-PUBLIC/blob/main/Risk_Assessment_Methodology.md) -- **Version:** 2.1 -- **Advanced Techniques:** Cascading Risk, Bayesian Updating, Risk Interconnection, Scenario Trees, Temporal Analysis Protocol +- **Version:** 2.2 +- **Advanced Techniques:** Cascading Risk, Bayesian Updating, Risk Interconnection, Scenario Trees, Temporal Analysis Protocol, 5-Level Confidence Scale, Election 2026 Risk Mapping +- **Key Changes v2.2:** Added 5-Level Confidence Scale mapping to risk scoring (VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW), Election 2026 risk dimension with electoral proximity factor, updated calibration examples with confidence levels - **Key Changes v2.1:** Temporal Analysis Protocol (re-scoring triggers, staleness rules, evolution template), Bayesian Updating Worked Example (7-day ECHR challenge scenario with date-specific evidence chain) - **Classification:** Public -- **Next Review:** 2026-06-30 +- **Next Review:** 2026-09-01 diff --git a/analysis/methodologies/political-style-guide.md b/analysis/methodologies/political-style-guide.md index 8be140dfcb..4c054e01db 100644 --- a/analysis/methodologies/political-style-guide.md +++ b/analysis/methodologies/political-style-guide.md @@ -11,12 +11,12 @@

Owner - Version + Version Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.1 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-06-01 (UTC) **🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public @@ -1028,6 +1028,50 @@ For each prohibited pattern, this section shows a concrete rewrite demonstrating --- +## 🗳️ Election 2026 Framing Requirements (v2.2) + +> **Mandatory framing standard for all analyses produced within 18 months of September 2026.** + +### Electoral Context in Writing + +When events have electoral relevance, writers MUST apply these framing standards: + +| Writing Context | Requirement | Example | +|----------------|-------------|---------| +| **Article lede** | Include electoral stakes if electoral significance ≥ MODERATE | "The coalition's migration compromise sets up a key electoral battleground ahead of September 2026." | +| **"Why It Matters" section** | Mandatory Election 2026 sentence if electoral significance ≥ HIGH | "This decision will directly shape coalition narratives in the 2026 election campaign." | +| **Forward Indicators** | Include election-related milestones with dates | "Watch: Party conference positioning Sep–Oct 2025; Budget 2026 proposition Sep 2026" | +| **SWOT analysis** | Electoral dimension required in O and T quadrants | "T: Opposition will use this policy failure as election attack vector" | + +### Election 2026 Framing Vocabulary + +**Approved framing phrases** (use these consistently across languages): +- "ahead of the September 2026 general election" / "inför riksdagsvalet i september 2026" +- "electoral positioning" / "valdispositioner" +- "campaign attack vector" / "valkampanjens attackvektor" +- "electoral asset" / "valtillgång" +- "electoral liability" / "valbelastning" +- "coalition stability before 2026" / "koalitionsstabilitet före 2026" + +**Banned electoral framing** (avoid these patterns): +- ❌ "The election could be affected" — too vague; specify HOW +- ❌ "Voters might care about this" — use polling data instead +- ❌ "This is politically significant" — specify which actors, in what way +- ❌ "Could be an election issue" — use Electoral Significance classification instead + +### Confidence Requirements for Electoral Claims + +Electoral claims about 2026 require **MEDIUM confidence minimum** (3+ evidence sources). Claims at VERY LOW or LOW confidence must be explicitly labeled and isolated from primary findings. + +| Electoral Claim Type | Minimum Confidence | Evidence Required | +|---------------------|:-----------------:|-------------------| +| Current polling data | HIGH | Specific pollster, date, sample size | +| Party position on electoral strategy | MEDIUM | Party statement, spokesperson quote, or motion | +| Voter segment impact | MEDIUM | SCB demographic data + policy impact analysis | +| Speculative electoral outcome | VERY LOW | Label explicitly; do not assert as finding | + +--- + ## Document Control | Field | Value | @@ -1036,8 +1080,8 @@ For each prohibited pattern, this section shows a concrete rewrite demonstrating | Status | Active | | Owner | Hack23 AB | | Review Cycle | Quarterly | -| Next Review | 2026-06-30 | -| Key Changes v2.2 | Article Title & SEO Standards (v5.0) — AI-only title generation, banned code-generated patterns | +| Next Review | 2026-09-01 | +| Key Changes v2.2 | Article Title & SEO Standards (v5.0) — AI-only title generation, banned code-generated patterns; Election 2026 Framing Requirements (electoral context in writing, vocabulary standards, confidence requirements) | | Key Changes v2.1 | Bad→Good Rewrite Examples (8 worked examples covering all prohibited pattern categories) | | Key Changes v2.0 | Intelligence depth standards, evidence density requirements, analytical depth indicators | | Related | `scripts/prompts/v2/political-analysis.md`, `scripts/analysis-reader.ts` | diff --git a/analysis/methodologies/political-swot-framework.md b/analysis/methodologies/political-swot-framework.md index 6399340c01..b6f04ffb5d 100644 --- a/analysis/methodologies/political-swot-framework.md +++ b/analysis/methodologies/political-swot-framework.md @@ -11,12 +11,12 @@

Owner - Version + Version Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public @@ -121,15 +121,17 @@ Threats are demonstrated by **opposition motions**, **no-confidence signals**, a --- -## 🎯 Confidence Level Assignment +## 🎯 Confidence Level Assignment (5-Level Scale) ### Assignment Criteria -| Level | Criteria | Example | -|-------|---------|---------| -| **HIGH** | Multiple independent sources corroborate; primary source is official Riksdag document or SCB statistics; source is current (within 90 days) | "Coalition secured 176/349 votes on budget motion 2025/26:FPM45 (verified via voteringsresultat 2025-11-24)" | -| **MEDIUM** | Single primary source confirmed; or multiple secondary sources; or primary source older than 90 days | "Government polling at 38% approval per Novus (2026-02-15); single pollster" | -| **LOW** | Credible but single unverified source; inference from related evidence; source older than 180 days | "Estimated L party dissent based on parliamentary debate tone — no formal vote yet" | +| Level | Label | Criteria | Example | +|:-----:|-------|---------|---------| +| 🟦 5 | **VERY HIGH** | Multiple official sources, cross-validated, no conflicting evidence; primary source is official Riksdag voting records or government legislation | "Coalition secured 176/349 votes on motion FPM45 (voteringsresultat 2025-11-24, cross-checked against party position statements)" | +| 🟩 4 | **HIGH** | Multiple independent sources corroborate; primary source is official Riksdag document or SCB statistics; source current (within 90 days) | "Coalition secured 176/349 votes on budget motion 2025/26:FPM45 (verified via voteringsresultat 2025-11-24)" | +| 🟧 3 | **MEDIUM** | Single primary source confirmed; or multiple secondary sources; or primary source 90–180 days old | "Government polling at 38% approval per Novus (2026-02-15); single pollster" | +| 🟥 2 | **LOW** | Credible but single unverified source; inference from related evidence; source 180+ days old | "Estimated L party dissent based on parliamentary debate tone — no formal vote yet" | +| ⬛ 1 | **VERY LOW** | Speculation only; no direct evidence; inferred from general political patterns | "Possible SD internal disagreement suggested by tone of spokesperson statement" | ### Confidence Decay Rule @@ -137,13 +139,15 @@ SWOT entries age and their confidence level **automatically degrades** over time | Original Confidence | After 30 days | After 90 days | After 180 days | |--------------------|:------------:|:-------------:|:--------------:| +| VERY HIGH | VERY HIGH | HIGH | MEDIUM | | HIGH | HIGH | MEDIUM | LOW | | MEDIUM | MEDIUM | LOW | EXPIRED | | LOW | LOW | EXPIRED | EXPIRED | +| VERY LOW | EXPIRED | EXPIRED | EXPIRED | **EXPIRED entries must be re-verified or removed before inclusion in new SWOT analyses.** -> **Clarification:** EXPIRED is a **lifecycle status**, not a confidence level. The confidence hierarchy is HIGH → MEDIUM → LOW (active). When temporal decay moves a LOW-confidence entry past 90 days, it becomes EXPIRED — meaning it is no longer active and must be handled per the rules below. An active SWOT analysis contains ONLY entries with confidence HIGH, MEDIUM, or LOW. +> **Clarification:** EXPIRED is a **lifecycle status**, not a confidence level. When temporal decay moves an entry to EXPIRED, it must be handled per the rules below. An active SWOT analysis contains ONLY entries with confidence VERY HIGH, HIGH, MEDIUM, or LOW. ### Handling EXPIRED Entries @@ -154,7 +158,36 @@ When an entry reaches EXPIRED status: 3. **Archive**: If no new evidence, move entry to "Historical Context" section (informational, not active SWOT) 4. **Remove**: If the situation has fundamentally changed (e.g., new coalition formed), delete the entry entirely -> **Rule:** An active SWOT analysis must contain ZERO expired entries. Every entry must have a confidence of HIGH, MEDIUM, or LOW with a clear evidence trail. +> **Rule:** An active SWOT analysis must contain ZERO expired entries. Every entry must have a confidence of VERY HIGH, HIGH, MEDIUM, or LOW with a clear evidence trail. + +--- + +## 🗳️ Election 2026 — Mandatory SWOT Dimension + +> **Added in v2.3 — Election 2026 is a MANDATORY SWOT dimension for all analyses in 2025–2026.** + +With the September 2026 Swedish general election approaching, every SWOT analysis MUST include an **Electoral Dimension** assessment across all four quadrants. + +### Electoral SWOT Quadrant Requirements + +| Quadrant | Election 2026 Focus | Evidence Standard | +|----------|--------------------|--------------------| +| **Strengths** | Policies that position governing coalition favorably for 2026 (track record, deliveries, approval metrics) | Opinion polling, government implementation reports | +| **Weaknesses** | Policy failures or controversies that create electoral vulnerabilities (budget gaps, coalition tensions, unfulfilled promises) | Riksdag debates, media coverage, opposition motions | +| **Opportunities** | Policy areas where the government can score electoral wins before September 2026 | Legislative calendar, EU funds, pending legislation | +| **Threats** | External events or opposition strategies that could damage electoral prospects | Opposition motions, global economic indicators, security events | + +### Minimum Electoral SWOT Requirements + +Every SWOT analysis produced within 18 months of September 2026 MUST include: +- **≥1 Strength entry** with specific electoral relevance and evidence +- **≥1 Weakness entry** with specific electoral vulnerability and attack vector potential +- **≥1 Opportunity entry** with timeline relative to election date +- **≥1 Threat entry** with probability assessment and mitigation options + +### Electoral SWOT Confidence Standards + +Electoral SWOT entries require **MEDIUM confidence minimum** (3+ sources). Speculation about electoral consequences without supporting polling or documented party positions must be labeled **VERY LOW** and isolated from substantive findings. --- @@ -739,9 +772,10 @@ Produce a period-level delta: **Document Control:** - **Path:** `/analysis/methodologies/political-swot-framework.md` - **CIA Reference:** [CIA SWOT.md](https://github.com/Hack23/cia/blob/master/SWOT.md) -- **Version:** 2.2 -- **Advanced Techniques:** Cross-SWOT Interference, TOWS Matrix, Scenario Generation, Power-Interest Mapping, EU Parliament Cross-Reference, SWOT Evolution Tracking +- **Version:** 2.3 +- **Advanced Techniques:** Cross-SWOT Interference, TOWS Matrix, Scenario Generation, Power-Interest Mapping, EU Parliament Cross-Reference, SWOT Evolution Tracking, Election 2026 Mandatory Dimension +- **Key Changes v2.3:** Election 2026 as mandatory SWOT dimension (electoral quadrant requirements, confidence standards for electoral entries), 5-level confidence scale replacing HIGH/MEDIUM/LOW (VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW with updated decay table) - **Key Changes v2.2:** SWOT Evolution Tracking (SWOT Delta template, inter-quadrant migration rules with Mermaid diagram, cross-document aggregation protocol for weekly/monthly reviews) - **EU Integration:** European Parliament MCP Server data sources, cross-parliament aggregation, Swedish MEP ↔ EP group mapping - **Classification:** Public -- **Next Review:** 2026-06-30 +- **Next Review:** 2026-09-01 diff --git a/analysis/methodologies/political-threat-framework.md b/analysis/methodologies/political-threat-framework.md index 241aa6cc52..d8c7f08a93 100644 --- a/analysis/methodologies/political-threat-framework.md +++ b/analysis/methodologies/political-threat-framework.md @@ -11,12 +11,12 @@

Owner - Version + Version Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 3.1 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 3.2 | **📅 Last Updated:** 2026-06-01 (UTC) **🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public @@ -446,13 +446,14 @@ All identified threat actors are classified on two axes: **Intent** and **Capabi **Document Control:** - **Path:** `/analysis/methodologies/political-threat-framework.md` - **ISMS Reference:** [Threat_Modeling.md](https://github.com/Hack23/ISMS-PUBLIC/blob/main/Threat_Modeling.md) -- **Version:** 3.1 -- **Frameworks:** Attack Trees, Political Kill Chain, Diamond Model, Political Threat Taxonomy, Threat Actor Profiling +- **Version:** 3.2 +- **Frameworks:** Attack Trees, Political Kill Chain, Diamond Model, Political Threat Taxonomy, Threat Actor Profiling, Election 2026 Threat Taxonomy +- **Key Changes v3.2:** Added Election 2026 threat taxonomy (electoral integrity threats, campaign attack vector analysis, coalition stability pre-election), 5-level confidence scale for threat severity assessments - **Key Changes v3.1:** Cross-Methodology Linkage Protocol (Severity→Likelihood mapping, SWOT Threats vs. dedicated threat analysis scope comparison, synthesis integration protocol with 4-step workflow, integrated dashboard Mermaid diagram) - **Classification:** Public -- **Next Review:** 2026-06-30 +- **Next Review:** 2026-09-01 - + ## Appendix A: Political Threat Category Detailed Definitions diff --git a/analysis/templates/README.md b/analysis/templates/README.md index af81fc000f..ce7e29d532 100644 --- a/analysis/templates/README.md +++ b/analysis/templates/README.md @@ -11,12 +11,12 @@

Owner - Version + Version Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 4.1 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 4.2 | **📅 Last Updated:** 2026-06-01 (UTC) **🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public @@ -494,6 +494,29 @@ sequenceDiagram --- +## 🆕 v2.3 Common Improvements (All Templates) + +All 8 templates were updated in v2.3 (2026-06-01) with the following cross-cutting improvements: + +### 🗳️ Election 2026 Implications Section +Every template now includes an **Election 2026** section that assesses electoral impact, coalition scenarios, voter salience, campaign vulnerability, and policy legacy relative to the September 2026 Swedish general election. This section is **MANDATORY** in all analysis output. + +### 🎯 5-Level Confidence Scale +The binary HIGH/MEDIUM/LOW confidence scale has been replaced with a **5-level confidence scale**: +- ⬛ **VERY LOW** — Speculation only, single unverified source +- 🟥 **LOW** — Circumstantial evidence, indirect indicators +- 🟧 **MEDIUM** — Multiple independent sources, moderate corroboration +- 🟩 **HIGH** — Official records, documented data, direct evidence +- 🟦 **VERY HIGH** — Verified data + independent corroboration + expert consensus + +### 📊 Historical Comparison Tables +`synthesis-summary.md` now includes a **Historical Comparison** section with tables comparing current period metrics to prior periods and year-ago data, plus a precedents table from prior riksmöten. + +### 📈 Election 2026 Relevance Score +`significance-scoring.md` now includes an **Election 2026 Relevance Score** with proximity bonus, coalition stability multiplier, and voter salience factor to produce election-adjusted significance scores. + +--- + ## 🆕 v2.2 Common Improvements (All Templates) All 8 templates were updated in v2.2 (2026-04-06) with the following cross-cutting improvements: diff --git a/analysis/templates/per-file-political-intelligence.md b/analysis/templates/per-file-political-intelligence.md index a22aec5059..739468d809 100644 --- a/analysis/templates/per-file-political-intelligence.md +++ b/analysis/templates/per-file-political-intelligence.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + Version + Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public > **📌 Template Instructions:** This template is for **per-file** analysis. For each data file downloaded via MCP, the AI agent produces one analysis markdown file stored as `{id}-analysis.md` in the workflow's isolated folder. AI MUST read ALL 6 methodology guides before analyzing. @@ -93,7 +93,7 @@ graph LR | **Primary Domain** | `[REQUIRED: e.g. Migration (MIG), Defence (DEF), Economy (ECO), Climate (ENV), Justice (JUS), Health (HEA), Education (EDU), Foreign Affairs (FOR)]` | | **Urgency** | `[REQUIRED: ROUTINE / ELEVATED / URGENT / CRITICAL]` | | **Significance Score** | `[REQUIRED: 0–10]` | -| **Confidence** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Confidence** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | --- @@ -291,6 +291,22 @@ graph TD --- +## 🗳️ Election 2026 Implications + +| Dimension | Assessment | Evidence | +|-----------|------------|----------| +| **Electoral Impact** | `[REQUIRED: How does this document affect September 2026 election positioning?]` | `[Specific evidence from document]` | +| **Coalition Scenarios** | `[REQUIRED: Which coalition configurations benefit/suffer from this policy?]` | `[Evidence]` | +| **Voter Salience** | `[REQUIRED: Which voter segments are most affected? By how much?]` | `[Evidence]` | +| **Campaign Vulnerability** | `[REQUIRED: Does this create campaign attack vectors for opposition?]` | `[Evidence]` | +| **Policy Legacy** | `[REQUIRED: Will this become an electoral asset or liability by Sept 2026?]` | `[Evidence]` | + +**Overall Electoral Significance**: `[REQUIRED: CRITICAL/HIGH/MODERATE/LOW/NEGLIGIBLE]` + +**Most Likely Narrative**: `[REQUIRED: How will this be framed in the 2026 campaign?]` + +--- + ## 🔮 Forward Indicators > *What to monitor as a consequence of this document.* @@ -336,7 +352,7 @@ graph TD | **Source Completeness** | `[REQUIRED: Full text / Metadata only / Summary only]` | | **Evidence Density** | `[REQUIRED: N evidence points cited]` | | **Temporal Currency** | `[REQUIRED: Current / Recent (30d) / Dated (90d) / Stale (180d+)]` | -| **Analytical Confidence** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Analytical Confidence** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | --- @@ -370,6 +386,8 @@ graph TD - [ ] **MCP Data Files listed:** All consulted data files recorded with source MCP tool and freshness - [ ] **No placeholder text remaining:** Search for `[REQUIRED` — zero hits expected - [ ] **No anti-pattern content:** No "No strengths identified", no generic boilerplate, no title-only restatements +- [ ] **Election 2026 Implications present:** All 5 dimensions assessed (Electoral Impact, Coalition Scenarios, Voter Salience, Campaign Vulnerability, Policy Legacy) +- [ ] **5-level confidence applied:** Confidence fields use VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW scale - [ ] **Cross-references linked:** Related documents and same-day cross-references populated --- @@ -377,8 +395,9 @@ graph TD **Document Control:** - **Template Path:** `/analysis/templates/per-file-political-intelligence.md` - **Output Path:** `analysis/daily/YYYY-MM-DD/{articleType}/documents/{dok_id}-analysis.md` -- **Version:** 2.2 -- **Effective Date:** 2026-04-06 (UTC) +- **Version:** 2.3 +- **Effective Date:** 2026-06-01 (UTC) +- **Key Changes v2.3:** Added Election 2026 Implications section, 5-level confidence scale (VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW) replacing binary H/M/L, improved differentiated per-document insights - **Frameworks:** SWOT, Risk, Attack Trees, Kill Chain, Diamond Model, Stakeholder - **Framework References:** [SWOT.md](../../SWOT.md), [THREAT_MODEL.md](../../THREAT_MODEL.md) - **Methodology:** [ai-driven-analysis-guide.md](../methodologies/ai-driven-analysis-guide.md) diff --git a/analysis/templates/political-classification.md b/analysis/templates/political-classification.md index c34708566a..aba7b2234a 100644 --- a/analysis/templates/political-classification.md +++ b/analysis/templates/political-classification.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + Version + Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public > **📌 Template Instructions:** Copy to `analysis/daily/YYYY-MM-DD/{articleType}/` and save as `classification-results.md` in the workflow's own folder (never overwrite another workflow's files). Replace all `[REQUIRED]` and `[OPTIONAL]` placeholders with actual values. Include Political Temperature Index and Coalition Impact Vector assessments. @@ -204,9 +204,9 @@ Significance Score: [REQUIRED: see significance-scoring.md, 0–10 composite] `[REQUIRED: Explain why each classification dimension was assigned its value. Reference specific evidence from the source document.]` ### Confidence Assessment -- **Source Quality:** `[HIGH / MEDIUM / LOW]` — `[reason]` -- **Information Completeness:** `[HIGH / MEDIUM / LOW]` — `[reason]` -- **Overall Confidence:** `[HIGH / MEDIUM / LOW]` +- **Source Quality:** `[VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` — `[reason]` +- **Information Completeness:** `[VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` — `[reason]` +- **Overall Confidence:** `[VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` ### Recommended Action - [ ] 📰 **Publish** — Include in next news cycle (significance ≥ 6) @@ -297,6 +297,34 @@ Significance Score: [REQUIRED: see significance-scoring.md, 0–10 composite] --- +## 🗳️ Election 2026 Classification Context + +> *How does this classified event's sensitivity, urgency, and scope translate into electoral relevance?* + +| Dimension | Assessment | Evidence | +|-----------|------------|----------| +| **Electoral Impact** | `[REQUIRED: How does this event affect September 2026 election positioning?]` | `[Specific evidence]` | +| **Coalition Scenarios** | `[REQUIRED: Which coalition configurations benefit/suffer from this classification?]` | `[Evidence]` | +| **Voter Salience** | `[REQUIRED: Is this event type salient for voter blocs heading into 2026?]` | `[Evidence]` | +| **Campaign Vulnerability** | `[REQUIRED: Does this event create campaign attack vectors given its sensitivity level?]` | `[Evidence]` | +| **Policy Legacy** | `[REQUIRED: Will this event's classification (SENSITIVE/RESTRICTED) affect electoral discourse?]` | `[Evidence]` | + +**Overall Electoral Significance**: `[REQUIRED: CRITICAL/HIGH/MODERATE/LOW/NEGLIGIBLE]` + +--- + +## 🎯 Confidence Scale Reference (5-Level) + +| Level | Label | Criteria | Evidence Threshold | +|-------|-------|----------|--------------------| +| ⬛ 1 | **VERY LOW** | Speculation only, single unverified source | 0–1 sources, no corroboration | +| 🟥 2 | **LOW** | Circumstantial evidence, indirect indicators | 2 sources, indirect evidence | +| 🟧 3 | **MEDIUM** | Multiple independent sources, moderate corroboration | 3+ sources, moderate agreement | +| 🟩 4 | **HIGH** | Official records, documented data, direct evidence | Official docs, voting records, committee reports | +| 🟦 5 | **VERY HIGH** | Verified data + independent corroboration + expert consensus | Multiple official sources, cross-validated | + +--- + ## 🔗 Cross-References > *Link to sibling analysis files and same-day analysis from other article types.* @@ -324,6 +352,8 @@ Significance Score: [REQUIRED: see significance-scoring.md, 0–10 composite] - [ ] **Confidence Decay assessed:** Classification age calculated and re-evaluation status noted - [ ] **MCP Data Provenance:** All data sources listed with timestamps - [ ] **No placeholder text remaining:** Search for `[REQUIRED` — zero hits expected +- [ ] **Election 2026 Classification Context present:** All 5 dimensions assessed with overall electoral significance +- [ ] **5-level confidence applied:** Source Quality, Information Completeness, Overall Confidence use VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW - [ ] **Named actors cited:** ≥1 named politician/party in classification rationale - [ ] **Cross-references linked:** At least 1 sibling analysis file referenced diff --git a/analysis/templates/risk-assessment.md b/analysis/templates/risk-assessment.md index d9642a10ac..eb009ff452 100644 --- a/analysis/templates/risk-assessment.md +++ b/analysis/templates/risk-assessment.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + Version + Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public > **📌 Template Instructions:** Copy to `analysis/daily/YYYY-MM-DD/{articleType}/`. Save as `risk-assessment.md` in the workflow's own folder (never overwrite another workflow's files). Scores use Likelihood × Impact methodology from [methodologies/political-risk-methodology.md](../methodologies/political-risk-methodology.md). @@ -47,6 +47,34 @@ --- +## 🗳️ Election 2026 Risk Dimensions + +| Dimension | Assessment | Evidence | +|-----------|------------|----------| +| **Electoral Impact** | `[REQUIRED: How do these risks affect September 2026 election positioning?]` | `[Specific evidence]` | +| **Coalition Scenarios** | `[REQUIRED: Which coalition configurations are at risk before 2026 election?]` | `[Evidence]` | +| **Voter Salience** | `[REQUIRED: Which voter segments are most affected by these risks?]` | `[Evidence]` | +| **Campaign Vulnerability** | `[REQUIRED: Do these risks create campaign attack vectors for opposition?]` | `[Evidence]` | +| **Policy Legacy** | `[REQUIRED: Will these risk materializations become electoral liabilities?]` | `[Evidence]` | + +**Overall Electoral Significance**: `[REQUIRED: CRITICAL/HIGH/MODERATE/LOW/NEGLIGIBLE]` + +**Most Likely Electoral Narrative**: `[REQUIRED: How will opposition frame these risks in the 2026 campaign?]` + +--- + +## 🎯 Confidence Scale (5-Level) + +| Level | Label | Criteria | Evidence Threshold | +|-------|-------|----------|--------------------| +| ⬛ 1 | **VERY LOW** | Speculation only, single unverified source | 0–1 sources, no corroboration | +| 🟥 2 | **LOW** | Circumstantial evidence, indirect indicators | 2 sources, indirect evidence | +| 🟧 3 | **MEDIUM** | Multiple independent sources, moderate corroboration | 3+ sources, moderate agreement | +| 🟩 4 | **HIGH** | Official records, documented data, direct evidence | Official docs, voting records, committee reports | +| 🟦 5 | **VERY HIGH** | Verified data + independent corroboration + expert consensus | Multiple official sources, cross-validated | + +--- + ## 🗂️ Risk Inventory Risk Score = Likelihood (1–5) × Impact (1–5). See scoring guide in [political-risk-methodology.md](../methodologies/political-risk-methodology.md). @@ -199,7 +227,7 @@ timeline | `[OPTIONAL]` | `[OPTIONAL]` | `[tier]` | `[OPTIONAL]` | **Pre-election Fragility Index:** `[REQUIRED: LOW / MEDIUM / HIGH]` -**Assessment Confidence:** `[REQUIRED: HIGH / MEDIUM / LOW]` +**Assessment Confidence:** `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` --- @@ -330,7 +358,7 @@ flowchart TD **Previous Assessment Reference:** `[REQUIRED: path to previous risk-assessment.md or "N/A — first assessment"]` **Overall Risk Trend:** `[REQUIRED: ↑ Escalating / → Stable / ↓ De-escalating]` -**Trend Confidence:** `[REQUIRED: HIGH / MEDIUM / LOW]` +**Trend Confidence:** `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` --- @@ -393,6 +421,8 @@ graph LR - [ ] **MCP Data Provenance:** All data sources listed with timestamps; every factual claim traceable - [ ] **No placeholder text remaining:** Search for `[REQUIRED` — zero hits expected - [ ] **Cross-references linked:** At least 2 sibling analysis files referenced +- [ ] **Election 2026 Risk Dimensions present:** All 5 dimensions assessed with overall electoral significance rating +- [ ] **5-level confidence applied:** Assessment Confidence and Trend Confidence use VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW scale - [ ] **Named actors:** ≥2 named politicians/parties with party affiliations cited - [ ] **Confidence labels:** Every claim has H/M/L confidence or numeric severity @@ -401,8 +431,9 @@ graph LR **Document Control:** - **Template Path:** `/analysis/templates/risk-assessment.md` - **Framework Reference:** [methodologies/political-risk-methodology.md](../methodologies/political-risk-methodology.md) -- **Version:** 2.2 -- **Effective Date:** 2026-04-06 (UTC) +- **Version:** 2.3 +- **Effective Date:** 2026-06-01 (UTC) +- **Key Changes v2.3:** Added Election 2026 Risk Dimensions section, 5-level confidence scale (VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW), updated quality checklist - **Advanced Sections:** Cascading Risk, Risk Interconnection, Scenario Outlook, Previous Assessment Comparison, MCP Data Provenance - **ISMS Alignment:** ISO 27001:2022 A.5.7 (Threat Intelligence), NIST CSF 2.0 ID.RA (Risk Assessment) - **Classification:** Public diff --git a/analysis/templates/significance-scoring.md b/analysis/templates/significance-scoring.md index 5d1c2c0c23..3cc369f5bf 100644 --- a/analysis/templates/significance-scoring.md +++ b/analysis/templates/significance-scoring.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + Version + Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public > **📌 Template Instructions:** Copy to `analysis/daily/YYYY-MM-DD/{articleType}/` and save as `significance-scoring.md` in the workflow's own folder (never overwrite another workflow's files). The significance scorer TypeScript implementation is at `scripts/analysis-framework/significance-scorer.ts` — this provides automated numeric scores only. AI must provide the **analytical rationale** explaining why documents score as they do. @@ -294,6 +294,38 @@ These examples provide anchor points for consistent scoring across workflows: --- +## 🗳️ Election 2026 Relevance Score + +> *Adjust significance scoring context based on proximity to September 2026 election.* + +| Dimension | Score Adjustment | Rationale | +|-----------|:---------------:|-----------| +| **Electoral proximity bonus** | `[REQUIRED: +0.0 to +2.0 — distance from election matters; <6 months from Sept 2026 = +1.0 max bonus]` | `[Evidence for time-sensitivity]` | +| **Coalition stability multiplier** | `[REQUIRED: ×1.0 to ×1.5 — documents that directly affect coalition stability before elections]` | `[Evidence]` | +| **Voter salience factor** | `[REQUIRED: +0.0 to +1.0 — issues with high voter salience score higher in pre-election period]` | `[Evidence]` | + +**Election-Adjusted Significance Score:** `[REQUIRED: base composite + electoral proximity bonus, capped at 10.0]` `/10` + +**Election 2026 Relevance Classification:** +- [ ] 🔴 **DECISIVE** — This event will directly affect 2026 election outcome (adjusted score ≥ 9.0) +- [ ] 🟠 **SIGNIFICANT** — Contributes to pre-election narrative (adjusted score 7.0–8.9) +- [ ] 🟡 **MODERATE** — Peripheral electoral relevance (adjusted score 5.0–6.9) +- [ ] 🟢 **MARGINAL** — Minimal electoral impact (adjusted score < 5.0) + +--- + +## 🎯 Confidence Scale Reference (5-Level) + +| Level | Label | Criteria | Evidence Threshold | +|-------|-------|----------|--------------------| +| ⬛ 1 | **VERY LOW** | Speculation only, single unverified source | 0–1 sources, no corroboration | +| 🟥 2 | **LOW** | Circumstantial evidence, indirect indicators | 2 sources, indirect evidence | +| 🟧 3 | **MEDIUM** | Multiple independent sources, moderate corroboration | 3+ sources, moderate agreement | +| 🟩 4 | **HIGH** | Official records, documented data, direct evidence | Official docs, voting records, committee reports | +| 🟦 5 | **VERY HIGH** | Verified data + independent corroboration + expert consensus | Multiple official sources, cross-validated | + +--- + ## 🔗 Cross-References > *Link to sibling analysis files and same-day analysis from other article types.* @@ -317,6 +349,8 @@ These examples provide anchor points for consistent scoring across workflows: - [ ] **Score Profile Mermaid rendered:** Decision gate diagram has actual scores (no `[#]` placeholders) - [ ] **Publication Decision assigned:** Archive/Monitor/Publish/Priority/Breaking with rationale - [ ] **Relative Scoring filled:** Same-type comparison with average and deviation calculated +- [ ] **Election 2026 Relevance Score present:** Electoral proximity bonus, coalition multiplier, voter salience factor assessed +- [ ] **5-level confidence scale available:** Reference table present for consistent confidence labeling - [ ] **Score Reconciliation checked:** If automated score diverges >3 points, higher score used and flagged - [ ] **MCP Data Files listed:** All consulted data files with timestamps - [ ] **No placeholder text remaining:** Search for `[REQUIRED` — zero hits expected diff --git a/analysis/templates/stakeholder-impact.md b/analysis/templates/stakeholder-impact.md index c0a31a89a4..a070e9117a 100644 --- a/analysis/templates/stakeholder-impact.md +++ b/analysis/templates/stakeholder-impact.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + Version + Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public > **📌 Template Instructions:** Copy to `analysis/daily/YYYY-MM-DD/{articleType}/` and save as `stakeholder-impact.md` in the workflow's own folder (never overwrite another workflow's files). Complete the context block first, then assess each stakeholder group with specific evidence. AI must provide genuine impact analysis with named actors and dok_id citations — not generic "may affect business" prose. @@ -378,6 +378,43 @@ quadrantChart --- +## 🗳️ Election 2026 Stakeholder Effects + +| Dimension | Assessment | Evidence | +|-----------|------------|----------| +| **Electoral Impact** | `[REQUIRED: How do stakeholder dynamics affect September 2026 election positioning?]` | `[Specific evidence]` | +| **Coalition Scenarios** | `[REQUIRED: Which stakeholder coalitions benefit/suffer from current policies?]` | `[Evidence]` | +| **Voter Salience** | `[REQUIRED: Which stakeholder groups translate most directly into voter blocs?]` | `[Evidence]` | +| **Campaign Vulnerability** | `[REQUIRED: Which stakeholder harms create campaign attack vectors for opposition?]` | `[Evidence]` | +| **Policy Legacy** | `[REQUIRED: Which stakeholder wins/losses will define the electoral narrative?]` | `[Evidence]` | + +**Overall Electoral Significance**: `[REQUIRED: CRITICAL/HIGH/MODERATE/LOW/NEGLIGIBLE]` + +**Most Likely Electoral Narrative**: `[REQUIRED: How will stakeholder impacts be framed in the 2026 campaign?]` + +### Stakeholder Voting Bloc Alignment (Election 2026) + +| Stakeholder Group | Size (est. voters) | Current Policy Disposition | Swing Potential | Electoral Risk | +|------------------|--------------------|---------------------------|:---------------:|:-------------:| +| Citizens — Welfare-dependent | `[OPTIONAL: e.g. ~1.5M]` | `[OPTIONAL: favourable/neutral/unfavourable]` | `[HIGH/MED/LOW]` | `[tier]` | +| Citizens — Working age | `[OPTIONAL]` | `[OPTIONAL]` | `[HIGH/MED/LOW]` | `[tier]` | +| Business / Industry | `[OPTIONAL]` | `[OPTIONAL]` | `[HIGH/MED/LOW]` | `[tier]` | +| Civil Society orgs | `[OPTIONAL]` | `[OPTIONAL]` | `[HIGH/MED/LOW]` | `[tier]` | + +--- + +## 🎯 Confidence Scale Reference (5-Level) + +| Level | Label | Criteria | Evidence Threshold | +|-------|-------|----------|--------------------| +| ⬛ 1 | **VERY LOW** | Speculation only, single unverified source | 0–1 sources, no corroboration | +| 🟥 2 | **LOW** | Circumstantial evidence, indirect indicators | 2 sources, indirect evidence | +| 🟧 3 | **MEDIUM** | Multiple independent sources, moderate corroboration | 3+ sources, moderate agreement | +| 🟩 4 | **HIGH** | Official records, documented data, direct evidence | Official docs, voting records, committee reports | +| 🟦 5 | **VERY HIGH** | Verified data + independent corroboration + expert consensus | Multiple official sources, cross-validated | + +--- + ## 🔗 Cross-References > *Link to sibling analysis files and same-day analysis from other article types.* @@ -398,6 +435,8 @@ quadrantChart - [ ] **Assessment Context complete:** All metadata fields filled (ID, date, subject, dok_id, stage, producer, overall impact) - [ ] **All 8 stakeholder groups assessed:** Citizens, Government, Opposition, Business, Civil Society, International, Judiciary, Media - [ ] **Specific evidence on every group:** No generic "may affect" prose — every impact claims specific actors, mechanisms, and evidence +- [ ] **Election 2026 Stakeholder Effects present:** All 5 dimensions assessed with Voting Bloc Alignment table +- [ ] **5-level confidence applied:** Stakeholder impact confidence uses the full scale where applicable - [ ] **Named actors cited:** ≥3 named politicians/parties/organisations with specific roles - [ ] **Impact Summary Matrix filled:** All 8 rows in Extended Impact Summary Matrix have levels, timelines, confidence - [ ] **Inter-Stakeholder Tensions identified:** ≥2 tension pairs with mechanisms and editorial relevance @@ -414,7 +453,8 @@ quadrantChart **Document Control:** - **Template Path:** `/analysis/templates/stakeholder-impact.md` - **Version:** 2.2 -- **Effective Date:** 2026-04-06 (UTC) +- **Effective Date:** 2026-06-01 (UTC) +- **Key Changes v2.3:** Added Election 2026 Stakeholder Effects section with Voting Bloc Alignment table, 5-level confidence scale reference, updated quality checklist - **Lens References:** `scripts/analysis-framework/lenses/` (citizen, economic, government, international, media, opposition) - **Framework Reference:** [methodologies/political-style-guide.md](../methodologies/political-style-guide.md) - **Advanced Sections:** Position Change Tracking, Power-Interest Grid diff --git a/analysis/templates/swot-analysis.md b/analysis/templates/swot-analysis.md index a9bb6734fb..45498d648a 100644 --- a/analysis/templates/swot-analysis.md +++ b/analysis/templates/swot-analysis.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + Version + Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public > **📌 Template Instructions:** Copy to `analysis/daily/YYYY-MM-DD/{articleType}/`. Save as `swot-analysis.md` in the workflow's own folder (never overwrite another workflow's files). Each SWOT entry requires a dok_id or named evidence source — opinion-only entries are prohibited. See [methodologies/political-swot-framework.md](../methodologies/political-swot-framework.md). @@ -328,6 +328,45 @@ graph TD --- +## 🗳️ Section 9: Election 2026 SWOT Dimension + +> *How do the SWOT findings translate into electoral positioning for September 2026?* + +| Dimension | Assessment | Evidence | +|-----------|------------|----------| +| **Electoral Impact** | `[REQUIRED: How do these SWOT findings affect September 2026 election positioning?]` | `[Specific evidence]` | +| **Coalition Scenarios** | `[REQUIRED: Which coalition configurations benefit/suffer from the current SWOT balance?]` | `[Evidence]` | +| **Voter Salience** | `[REQUIRED: Which voter segments are most affected by these SWOT dynamics?]` | `[Evidence]` | +| **Campaign Vulnerability** | `[REQUIRED: Which SWOT weaknesses/threats create campaign attack vectors?]` | `[Evidence]` | +| **Policy Legacy** | `[REQUIRED: Which SWOT strengths/opportunities will become electoral assets?]` | `[Evidence]` | + +**Overall Electoral Significance**: `[REQUIRED: CRITICAL/HIGH/MODERATE/LOW/NEGLIGIBLE]` + +**Most Likely Electoral Narrative**: `[REQUIRED: How will these SWOT findings be framed in the 2026 campaign?]` + +### Electoral SWOT Balance + +| Quadrant | Electoral Asset/Liability | Impact on 2026 Campaign | +|----------|--------------------------|------------------------| +| ✅ Strengths | `[REQUIRED: Which strengths are electoral assets?]` | `[Positive/negative framing potential]` | +| ⚠️ Weaknesses | `[REQUIRED: Which weaknesses are electoral liabilities?]` | `[Attack vector potential]` | +| 🚀 Opportunities | `[REQUIRED: Which opportunities can be turned into campaign wins?]` | `[Timing relative to Sept 2026]` | +| 🔴 Threats | `[REQUIRED: Which threats could damage electoral standing?]` | `[Risk level for 2026 campaign]` | + +--- + +## 🎯 Confidence Scale Reference (5-Level) + +| Level | Label | Criteria | Evidence Threshold | +|-------|-------|----------|--------------------| +| ⬛ 1 | **VERY LOW** | Speculation only, single unverified source | 0–1 sources, no corroboration | +| 🟥 2 | **LOW** | Circumstantial evidence, indirect indicators | 2 sources, indirect evidence | +| 🟧 3 | **MEDIUM** | Multiple independent sources, moderate corroboration | 3+ sources, moderate agreement | +| 🟩 4 | **HIGH** | Official records, documented data, direct evidence | Official docs, voting records, committee reports | +| 🟦 5 | **VERY HIGH** | Verified data + independent corroboration + expert consensus | Multiple official sources, cross-validated | + +--- + ## 🔗 Cross-References > *Link to sibling analysis files and same-day analysis from other article types for contextual completeness.* @@ -357,6 +396,8 @@ graph TD - [ ] **Forward Indicators present:** ≥2 scenarios with probabilities and SWOT element references - [ ] **MCP Data Provenance:** All data sources listed; every entry traceable to MCP tool call - [ ] **No placeholder text remaining:** Search for `[REQUIRED` — zero hits expected +- [ ] **Election 2026 SWOT Dimension present:** Section 9 filled with all 5 dimensions and electoral SWOT balance table +- [ ] **5-level confidence applied:** SWOT entry Confidence columns use the full scale where appropriate - [ ] **Named actors:** ≥2 named politicians/parties with party affiliations cited - [ ] **Cross-references linked:** At least 2 sibling analysis files referenced @@ -365,8 +406,9 @@ graph TD **Document Control:** - **Template Path:** `/analysis/templates/swot-analysis.md` - **Framework Reference:** [SWOT.md](../../SWOT.md), [methodologies/political-swot-framework.md](../methodologies/political-swot-framework.md) -- **Version:** 2.2 -- **Effective Date:** 2026-04-06 (UTC) +- **Version:** 2.3 +- **Effective Date:** 2026-06-01 (UTC) +- **Key Changes v2.3:** Added Election 2026 SWOT Dimension section (Section 9), Electoral SWOT Balance table, 5-level confidence scale reference, updated quality checklist - **Advanced Sections:** Cross-SWOT Interference, TOWS Matrix, SWOT Delta, Forward Indicators & Scenario Outlook, MCP Data Provenance - **ISMS Alignment:** ISO 27001:2022 A.5.7 (Threat Intelligence), NIST CSF 2.0 ID.RA (Risk Assessment) - **Classification:** Public diff --git a/analysis/templates/synthesis-summary.md b/analysis/templates/synthesis-summary.md index 94c20525b0..c16a9d92ab 100644 --- a/analysis/templates/synthesis-summary.md +++ b/analysis/templates/synthesis-summary.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + Version + Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public > **📌 Template Instructions:** Copy to `analysis/daily/YYYY-MM-DD/{articleType}/` and save as `synthesis-summary.md` in the workflow's own folder. This file synthesizes per-file analyses into an integrated intelligence picture. AI reads all per-file analyses and produces genuine synthesis — not a mechanical concatenation of summaries. @@ -41,7 +41,7 @@ | **Documents Analyzed** | `[REQUIRED: N]` | | **Analysis Period** | `[REQUIRED: e.g. "2026-03-28 00:00–18:00 UTC"]` | | **Produced By** | `[REQUIRED: workflow name]` | -| **Overall Confidence** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Overall Confidence** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | --- @@ -227,6 +227,45 @@ graph LR --- +## 📊 Historical Comparison + +> **AI Instructions:** Compare current period findings with equivalent periods from previous riksmöten. This establishes trend context and prevents over-indexing on routine developments. + +| Metric | Current Period | Prior Period (3 months ago) | Year Ago | Trend | +|--------|---------------|----------------------------|----------|-------| +| **Overall Risk Level** | `[REQUIRED]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | +| **Coalition Stability** | `[REQUIRED]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | +| **Legislative Throughput** | `[REQUIRED: N documents]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | +| **Opposition Activity Level** | `[REQUIRED: H/M/L]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | +| **Average Significance Score** | `[REQUIRED: #.#/10]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | + +**Historical Context:** `[REQUIRED: 2–3 sentences placing this period in historical context. Is this an unusually active/risky period? Compare to equivalent pre-election periods in 2021/22.]` + +**Precedents from Prior Riksmöten:** + +| Precedent | Riksmöte | Outcome | Relevance to Current Period | +|-----------|----------|---------|----------------------------| +| `[OPTIONAL: similar political situation]` | `[e.g. 2021/22]` | `[What happened]` | `[Why it matters now]` | +| `[OPTIONAL]` | `[year]` | `[outcome]` | `[relevance]` | + +--- + +## 🗳️ Election 2026 Implications + +| Dimension | Assessment | Evidence | +|-----------|------------|----------| +| **Electoral Impact** | `[REQUIRED: How does this affect September 2026 election positioning?]` | `[Specific evidence]` | +| **Coalition Scenarios** | `[REQUIRED: Which coalition configurations benefit/suffer?]` | `[Evidence]` | +| **Voter Salience** | `[REQUIRED: Which voter segments are most affected? By how much?]` | `[Evidence]` | +| **Campaign Vulnerability** | `[REQUIRED: Does this create campaign attack vectors for opposition?]` | `[Evidence]` | +| **Policy Legacy** | `[REQUIRED: Will this become an electoral asset or liability?]` | `[Evidence]` | + +**Overall Electoral Significance**: `[REQUIRED: CRITICAL/HIGH/MODERATE/LOW/NEGLIGIBLE]` + +**Most Likely Narrative**: `[REQUIRED: How will this be framed in the 2026 campaign?]` + +--- + ## 🔮 Forward Indicators (MANDATORY) > **⚠️ This section is MANDATORY — analysis without forward indicators is incomplete and will be REJECTED.** @@ -292,6 +331,18 @@ graph LR --- +## 🎯 Confidence Scale Reference (5-Level) + +| Level | Label | Criteria | Evidence Threshold | +|-------|-------|----------|--------------------| +| ⬛ 1 | **VERY LOW** | Speculation only, single unverified source | 0–1 sources, no corroboration | +| 🟥 2 | **LOW** | Circumstantial evidence, indirect indicators | 2 sources, indirect evidence | +| 🟧 3 | **MEDIUM** | Multiple independent sources, moderate corroboration | 3+ sources, moderate agreement | +| 🟩 4 | **HIGH** | Official records, documented data, direct evidence | Official docs, voting records, committee reports | +| 🟦 5 | **VERY HIGH** | Verified data + independent corroboration + expert consensus | Multiple official sources, cross-validated | + +--- + ## ✅ Quality Self-Check Checklist > **Pre-commit validation — every item MUST be checked before finalising this synthesis. Derived from SHARED_PROMPT_PATTERNS.md §Quality Self-Check Protocol.** @@ -310,14 +361,18 @@ graph LR - [ ] **MCP Data Provenance:** All data sources listed with timestamps - [ ] **No placeholder text remaining:** Search for `[REQUIRED` — zero hits expected - [ ] **Cross-document patterns identified:** Synthesis adds value beyond concatenating individual analyses +- [ ] **Election 2026 Implications present:** All 5 dimensions assessed with evidence and Overall Electoral Significance rating +- [ ] **Historical Comparison table filled:** Current period compared with prior periods and trend arrows +- [ ] **5-level confidence applied:** Overall Confidence uses VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW scale - [ ] **Named actors:** ≥3 named politicians/parties cited across the synthesis --- **Document Control:** - **Template Path:** `/analysis/templates/synthesis-summary.md` -- **Version:** 2.2 -- **Effective Date:** 2026-04-06 (UTC) +- **Version:** 2.3 +- **Effective Date:** 2026-06-01 (UTC) +- **Key Changes v2.3:** Added Election 2026 Implications section, Historical Comparison tables, 5-level confidence scale (VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW), updated quality checklist - **Consumed By:** All news article generator workflows - **ISMS Alignment:** ISO 27001:2022 A.5.7 (Threat Intelligence), NIST CSF 2.0 ID.RA (Risk Assessment) - **Classification:** Public diff --git a/analysis/templates/threat-analysis.md b/analysis/templates/threat-analysis.md index b45e20b770..713b5ec9a6 100644 --- a/analysis/templates/threat-analysis.md +++ b/analysis/templates/threat-analysis.md @@ -12,11 +12,11 @@

Owner Version - Effective Date + Effective Date Classification

-**📋 Document Owner:** CEO | **📄 Version:** 3.2 | **📅 Last Updated:** 2026-04-06 (UTC) +**📋 Document Owner:** CEO | **�� Version:** 3.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public > **📌 Template Instructions:** Copy to `analysis/daily/YYYY-MM-DD/{articleType}/`. Save as `threat-analysis.md` in the workflow's own folder (never overwrite another workflow's files). Each threat requires evidence citations and multi-framework analysis. See [methodologies/political-threat-framework.md](../methodologies/political-threat-framework.md). @@ -376,6 +376,34 @@ timeline --- +## 🗳️ Election 2026 Threat Implications + +| Dimension | Assessment | Evidence | +|-----------|------------|----------| +| **Electoral Impact** | `[REQUIRED: How do these threats affect September 2026 election positioning?]` | `[Specific evidence]` | +| **Coalition Scenarios** | `[REQUIRED: Which coalition configurations are most threatened before 2026?]` | `[Evidence]` | +| **Voter Salience** | `[REQUIRED: Which voter segments are most affected by these democratic threats?]` | `[Evidence]` | +| **Campaign Vulnerability** | `[REQUIRED: How can opposition weaponize these threat findings?]` | `[Evidence]` | +| **Policy Legacy** | `[REQUIRED: Will these threats materialize into electoral liabilities by Sept 2026?]` | `[Evidence]` | + +**Overall Electoral Significance**: `[REQUIRED: CRITICAL/HIGH/MODERATE/LOW/NEGLIGIBLE]` + +**Most Likely Electoral Narrative**: `[REQUIRED: How will opposition frame these democratic integrity threats in 2026 campaign?]` + +--- + +## 🎯 Confidence Scale Reference (5-Level) + +| Level | Label | Criteria | Evidence Threshold | +|-------|-------|----------|--------------------| +| ⬛ 1 | **VERY LOW** | Speculation only, single unverified source | 0–1 sources, no corroboration | +| 🟥 2 | **LOW** | Circumstantial evidence, indirect indicators | 2 sources, indirect evidence | +| 🟧 3 | **MEDIUM** | Multiple independent sources, moderate corroboration | 3+ sources, moderate agreement | +| 🟩 4 | **HIGH** | Official records, documented data, direct evidence | Official docs, voting records, committee reports | +| 🟦 5 | **VERY HIGH** | Verified data + independent corroboration + expert consensus | Multiple official sources, cross-validated | + +--- + ## 🔗 Cross-References > *Link to sibling analysis files and same-day analysis from other article types.* @@ -405,6 +433,8 @@ timeline - [ ] **MCP Data Provenance:** All data sources listed; every threat severity score traceable - [ ] **No placeholder text remaining:** Search for `[REQUIRED` — zero hits expected - [ ] **Political Threat Taxonomy used:** NOT STRIDE categories — confirmed using NI/LI/AC/TR/DP/PB +- [ ] **Election 2026 Threat Implications present:** All 5 dimensions assessed with overall electoral significance rating +- [ ] **5-level confidence applied:** Threat severity assessments use the full confidence scale where applicable - [ ] **Named actors:** ≥2 named threat actors with party affiliations or institutional roles --- @@ -413,7 +443,8 @@ timeline - **Template Path:** `/analysis/templates/threat-analysis.md` - **Framework Reference:** [THREAT_MODEL.md](../../THREAT_MODEL.md), [methodologies/political-threat-framework.md](../methodologies/political-threat-framework.md) - **Version:** 3.2 -- **Effective Date:** 2026-04-06 (UTC) +- **Effective Date:** 2026-06-01 (UTC) +- **Key Changes v3.3:** Added Election 2026 Threat Implications section, 5-level confidence scale reference, updated quality checklist - **Frameworks:** Attack Trees, Kill Chain, Diamond Model, Political Threat Taxonomy, Threat Actor Profiling - **Advanced Sections:** Threat Evolution Timeline, Cross-Methodology Linkage - **ISMS Alignment:** ISO 27001:2022 A.5.7 (Threat Intelligence), NIST CSF 2.0 ID.RA (Risk Assessment), DE.CM (Security Continuous Monitoring) From 059b72192ca18345236a46025e0f96e4fedef827 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 12:13:55 +0000 Subject: [PATCH 2/5] Fix review feedback: restore skill paths, headings, metadata consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Restore 6 canonical skill file paths in all 10 workflow .md files - Restore 'Riksmöte (Parliamentary Session) Calculation' heading - Add 'HOW SAFE PR CREATION WORKS' header to all workflows - Add 'DO NOT run git push' instruction to all workflows - Add stakeholder-perspectives.md reference to week-ahead and others - Fix threat-analysis.md: corrupted UTF-8, version badge 3.2→3.3, Document Control 3.3 - Fix stakeholder-impact.md: Document Control version 2.2→2.3 - Fix risk-assessment.md: confidence checklist H/M/L → 5-level scale - Align Effective Date badges with Last Updated (2026-06-01) in all files - Align Next Review dates (2026-09-01) across header and Document Control - Fix NEGLIGIBLE Election 2026 consistency in ai-driven-analysis-guide.md Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/27d9edf5-2153-4af8-9d3e-c8a01b16e719 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com> --- .github/workflows/news-committee-reports.md | 6 ++++-- .github/workflows/news-evening-analysis.md | 8 +++++--- .github/workflows/news-interpellations.md | 6 ++++-- .github/workflows/news-month-ahead.md | 8 ++++---- .github/workflows/news-monthly-review.md | 8 ++++---- .github/workflows/news-motions.md | 6 ++++-- .github/workflows/news-propositions.md | 6 ++++-- .github/workflows/news-realtime-monitor.md | 4 ++-- .github/workflows/news-week-ahead.md | 8 ++++---- .github/workflows/news-weekly-review.md | 8 ++++---- analysis/methodologies/README.md | 2 +- analysis/methodologies/ai-driven-analysis-guide.md | 4 ++-- analysis/methodologies/political-classification-guide.md | 4 ++-- analysis/methodologies/political-risk-methodology.md | 4 ++-- analysis/methodologies/political-style-guide.md | 4 ++-- analysis/methodologies/political-swot-framework.md | 4 ++-- analysis/methodologies/political-threat-framework.md | 4 ++-- analysis/templates/README.md | 2 +- analysis/templates/risk-assessment.md | 2 +- analysis/templates/stakeholder-impact.md | 2 +- analysis/templates/threat-analysis.md | 6 +++--- 21 files changed, 58 insertions(+), 48 deletions(-) diff --git a/.github/workflows/news-committee-reports.md b/.github/workflows/news-committee-reports.md index ac4f97dc10..76918cd222 100644 --- a/.github/workflows/news-committee-reports.md +++ b/.github/workflows/news-committee-reports.md @@ -193,7 +193,7 @@ source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` - **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` @@ -273,7 +273,7 @@ echo "Article Type: committee-reports" echo "============================" ``` -## 📅 Riksmöte Calculation +## 📅 Riksmöte (Parliamentary Session) Calculation September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. @@ -318,6 +318,8 @@ Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-2 ## MANDATORY PR Creation +### HOW SAFE PR CREATION WORKS + > `safeoutputs___create_pull_request` handles branch creation, push, and PR opening — do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool directly. diff --git a/.github/workflows/news-evening-analysis.md b/.github/workflows/news-evening-analysis.md index 5138b683f4..71bf937477 100644 --- a/.github/workflows/news-evening-analysis.md +++ b/.github/workflows/news-evening-analysis.md @@ -199,7 +199,7 @@ START_TIME=$(date +%s) ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` - **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` @@ -271,7 +271,7 @@ echo "Day of week: $DAY_OF_WEEK (6=Saturday weekly wrap-up)" echo "============================" ``` -## 📅 Riksmöte Calculation +## 📅 Riksmöte (Parliamentary Session) Calculation Sep+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before Sep → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). @@ -1001,7 +1001,9 @@ Branch: `news/content/{YYYY-MM-DD}/evening-analysis`. `safeoutputs___create_pull ## Step 5: Commit & Create PR -> `safeoutputs___create_pull_request` handles branch creation, push, and PR opening. Stage files and call it directly. +### HOW SAFE PR CREATION WORKS + +> `safeoutputs___create_pull_request` handles branch creation, push, and PR opening — do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool directly. - ✅ `safeoutputs___create_pull_request` for articles or analysis-only PRs (`analysis-only` + `evening-analysis` labels) - ✅ `safeoutputs___noop` ONLY if MCP unreachable after 3 attempts AND no analysis artifacts exist diff --git a/.github/workflows/news-interpellations.md b/.github/workflows/news-interpellations.md index d8fb47eef0..548ff32881 100644 --- a/.github/workflows/news-interpellations.md +++ b/.github/workflows/news-interpellations.md @@ -203,7 +203,7 @@ source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` - **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` @@ -276,7 +276,7 @@ echo "Article Type: interpellations" echo "============================" ``` -## 📅 Riksmöte Calculation +## 📅 Riksmöte (Parliamentary Session) Calculation September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. @@ -321,6 +321,8 @@ Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-2 ## MANDATORY PR Creation +### HOW SAFE PR CREATION WORKS + > `safeoutputs___create_pull_request` handles branch creation, push, and PR opening — do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool directly. diff --git a/.github/workflows/news-month-ahead.md b/.github/workflows/news-month-ahead.md index a0817edd11..c489efa29d 100644 --- a/.github/workflows/news-month-ahead.md +++ b/.github/workflows/news-month-ahead.md @@ -170,8 +170,8 @@ Uses `memory/news-generation` branch. START: read `memory/news-generation/last-r ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) -- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `stakeholder-perspectives.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -241,7 +241,7 @@ echo "Article Type: month-ahead" echo "============================" ``` -## 📅 Riksmöte Calculation +## 📅 Riksmöte (Parliamentary Session) Calculation September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. @@ -288,7 +288,7 @@ Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-2 > **🚀 HOW SAFE PR CREATION WORKS — READ THIS FIRST** > -> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. You do NOT create branches or push manually. +> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. Do NOT run `git push` or `git checkout -b` manually. > > **Exact steps:** > 1. Write article files to `news/` using `bash` or `edit` tools diff --git a/.github/workflows/news-monthly-review.md b/.github/workflows/news-monthly-review.md index b544090756..fa05a3b0db 100644 --- a/.github/workflows/news-monthly-review.md +++ b/.github/workflows/news-monthly-review.md @@ -170,8 +170,8 @@ Uses `memory/news-generation` branch. START: read `memory/news-generation/last-r ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) -- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `stakeholder-perspectives.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -231,7 +231,7 @@ echo "Article Type: monthly-review" echo "============================" ``` -## 📅 Riksmöte Calculation +## 📅 Riksmöte (Parliamentary Session) Calculation September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. @@ -278,7 +278,7 @@ Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-2 > **🚀 HOW SAFE PR CREATION WORKS — READ THIS FIRST** > -> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. You do NOT create branches or push manually. +> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. Do NOT run `git push` or `git checkout -b` manually. > > **Exact steps:** > 1. Write article files to `news/` using `bash` or `edit` tools diff --git a/.github/workflows/news-motions.md b/.github/workflows/news-motions.md index 969ea7f96a..b85fabc287 100644 --- a/.github/workflows/news-motions.md +++ b/.github/workflows/news-motions.md @@ -189,7 +189,7 @@ source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` - **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` @@ -261,7 +261,7 @@ echo "Article Type: motions" echo "============================" ``` -## 📅 Riksmöte Calculation +## 📅 Riksmöte (Parliamentary Session) Calculation September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. @@ -306,6 +306,8 @@ Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-2 ## MANDATORY PR Creation +### HOW SAFE PR CREATION WORKS + > `safeoutputs___create_pull_request` handles branch creation, push, and PR opening — do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool directly. diff --git a/.github/workflows/news-propositions.md b/.github/workflows/news-propositions.md index 1526226dec..0b44305666 100644 --- a/.github/workflows/news-propositions.md +++ b/.github/workflows/news-propositions.md @@ -194,7 +194,7 @@ source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` - **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` @@ -254,7 +254,7 @@ echo "Article Type: propositions" echo "============================" ``` -## 📅 Riksmöte Calculation +## 📅 Riksmöte (Parliamentary Session) Calculation September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. @@ -299,6 +299,8 @@ Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-2 ## MANDATORY PR Creation +### HOW SAFE PR CREATION WORKS + > `safeoutputs___create_pull_request` handles branch creation, push, and PR opening — do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool directly. diff --git a/.github/workflows/news-realtime-monitor.md b/.github/workflows/news-realtime-monitor.md index 4d5c4eecfd..141d86f849 100644 --- a/.github/workflows/news-realtime-monitor.md +++ b/.github/workflows/news-realtime-monitor.md @@ -971,8 +971,8 @@ safeoutputs___create_pull_request({ ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) -- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `stakeholder-perspectives.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework diff --git a/.github/workflows/news-week-ahead.md b/.github/workflows/news-week-ahead.md index 99c7944b9a..7ebf63c088 100644 --- a/.github/workflows/news-week-ahead.md +++ b/.github/workflows/news-week-ahead.md @@ -167,8 +167,8 @@ Uses `memory/news-generation` branch. START: read `memory/news-generation/last-r ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) -- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `stakeholder-perspectives.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -223,7 +223,7 @@ echo "Article Type: week-ahead" echo "============================" ``` -## 📅 Riksmöte Calculation +## 📅 Riksmöte (Parliamentary Session) Calculation September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. @@ -270,7 +270,7 @@ Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-2 > **🚀 HOW SAFE PR CREATION WORKS — READ THIS FIRST** > -> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. You do NOT create branches or push manually. +> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. Do NOT run `git push` or `git checkout -b` manually. > > **Exact steps:** > 1. Write article files to `news/` using `bash` or `edit` tools diff --git a/.github/workflows/news-weekly-review.md b/.github/workflows/news-weekly-review.md index 0879762a81..dbb08c2bc0 100644 --- a/.github/workflows/news-weekly-review.md +++ b/.github/workflows/news-weekly-review.md @@ -169,8 +169,8 @@ Uses `memory/news-generation` branch. START: read `memory/news-generation/last-r ## Required Skills Consult as needed — do NOT read all files upfront: -- **Skills:** `editorial-standards`, `swedish-political-system`, `legislative-monitoring`, `riksdag-regering-mcp`, `language-expertise`, `gh-aw-safe-outputs` (all in `.github/skills/*/SKILL.md`) -- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `quality-criteria.md` +- **Skills:** `.github/skills/editorial-standards/SKILL.md`, `.github/skills/swedish-political-system/SKILL.md`, `.github/skills/legislative-monitoring/SKILL.md`, `.github/skills/riksdag-regering-mcp/SKILL.md`, `.github/skills/language-expertise/SKILL.md`, `.github/skills/gh-aw-safe-outputs/SKILL.md` +- **Analysis:** `scripts/prompts/v2/political-analysis.md`, `per-file-intelligence-analysis.md`, `stakeholder-perspectives.md`, `quality-criteria.md` - **Methodology:** `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) + `analysis/templates/per-file-political-intelligence.md` ## 📊 MANDATORY Multi-Step AI Analysis Framework @@ -228,7 +228,7 @@ echo "Article Type: weekly-review" echo "============================" ``` -## 📅 Riksmöte Calculation +## 📅 Riksmöte (Parliamentary Session) Calculation September+ → `rm = "{year}/{year+1 2-digit}"` (e.g. Oct 2026 → `2026/27`). Before September → `rm = "{year-1}/{year 2-digit}"` (e.g. Feb 2026 → `2025/26`). Use in ALL MCP queries requiring `rm`. @@ -275,7 +275,7 @@ Branch: `news/content/{YYYY-MM-DD}/{article-type}` (e.g. `news/content/2026-03-2 > **🚀 HOW SAFE PR CREATION WORKS — READ THIS FIRST** > -> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. You do NOT create branches or push manually. +> The `safeoutputs___create_pull_request` tool handles **everything**: branch creation, pushing commits, and opening the PR. Do NOT run `git push` or `git checkout -b` manually. > > **Exact steps:** > 1. Write article files to `news/` using `bash` or `edit` tools diff --git a/analysis/methodologies/README.md b/analysis/methodologies/README.md index 2296707d11..58ffa1c4cb 100644 --- a/analysis/methodologies/README.md +++ b/analysis/methodologies/README.md @@ -12,7 +12,7 @@

Owner Version - Effective Date + Effective Date Classification

diff --git a/analysis/methodologies/ai-driven-analysis-guide.md b/analysis/methodologies/ai-driven-analysis-guide.md index b55e63ad2f..263a603b4b 100644 --- a/analysis/methodologies/ai-driven-analysis-guide.md +++ b/analysis/methodologies/ai-driven-analysis-guide.md @@ -12,7 +12,7 @@

Owner Version - Effective Date + Effective Date Classification

@@ -1933,7 +1933,7 @@ Every per-file analysis and synthesis summary MUST assess: | 🟠 **HIGH** | Significant pre-election narrative contribution | Mandatory inclusion in forward indicators | | 🟡 **MODERATE** | Peripheral electoral relevance | Include if space allows; note in stakeholder analysis | | 🟢 **LOW** | Minimal electoral impact | Optional brief mention | -| ⚪ **NEGLIGIBLE** | No discernible electoral dimension | Skip Election 2026 section (note: "negligible electoral relevance") | +| ⚪ **NEGLIGIBLE** | No discernible electoral dimension | Include Election 2026 section and explicitly mark as negligible electoral relevance | ### Pre-Election Analysis Calendar diff --git a/analysis/methodologies/political-classification-guide.md b/analysis/methodologies/political-classification-guide.md index 45ec7f71ce..954161b13a 100644 --- a/analysis/methodologies/political-classification-guide.md +++ b/analysis/methodologies/political-classification-guide.md @@ -12,12 +12,12 @@

Owner Version - Effective Date + Effective Date Classification

**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) -**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 +**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-09-01 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public --- diff --git a/analysis/methodologies/political-risk-methodology.md b/analysis/methodologies/political-risk-methodology.md index 81527c5b36..1812b14b8c 100644 --- a/analysis/methodologies/political-risk-methodology.md +++ b/analysis/methodologies/political-risk-methodology.md @@ -12,12 +12,12 @@

Owner Version - Effective Date + Effective Date Classification

**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-06-01 (UTC) -**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 +**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-09-01 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public --- diff --git a/analysis/methodologies/political-style-guide.md b/analysis/methodologies/political-style-guide.md index 4c054e01db..b01df5825c 100644 --- a/analysis/methodologies/political-style-guide.md +++ b/analysis/methodologies/political-style-guide.md @@ -12,12 +12,12 @@

Owner Version - Effective Date + Effective Date Classification

**📋 Document Owner:** CEO | **📄 Version:** 2.2 | **📅 Last Updated:** 2026-06-01 (UTC) -**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 +**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-09-01 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public --- diff --git a/analysis/methodologies/political-swot-framework.md b/analysis/methodologies/political-swot-framework.md index b6f04ffb5d..756f5fad20 100644 --- a/analysis/methodologies/political-swot-framework.md +++ b/analysis/methodologies/political-swot-framework.md @@ -12,12 +12,12 @@

Owner Version - Effective Date + Effective Date Classification

**📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) -**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 +**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-09-01 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public --- diff --git a/analysis/methodologies/political-threat-framework.md b/analysis/methodologies/political-threat-framework.md index d8c7f08a93..dd5003ce8e 100644 --- a/analysis/methodologies/political-threat-framework.md +++ b/analysis/methodologies/political-threat-framework.md @@ -12,12 +12,12 @@

Owner Version - Effective Date + Effective Date Classification

**📋 Document Owner:** CEO | **📄 Version:** 3.2 | **📅 Last Updated:** 2026-06-01 (UTC) -**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-06-30 +**🔄 Review Cycle:** Quarterly | **⏰ Next Review:** 2026-09-01 **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public --- diff --git a/analysis/templates/README.md b/analysis/templates/README.md index ce7e29d532..1ef713fad5 100644 --- a/analysis/templates/README.md +++ b/analysis/templates/README.md @@ -12,7 +12,7 @@

Owner Version - Effective Date + Effective Date Classification

diff --git a/analysis/templates/risk-assessment.md b/analysis/templates/risk-assessment.md index eb009ff452..73a14697d0 100644 --- a/analysis/templates/risk-assessment.md +++ b/analysis/templates/risk-assessment.md @@ -424,7 +424,7 @@ graph LR - [ ] **Election 2026 Risk Dimensions present:** All 5 dimensions assessed with overall electoral significance rating - [ ] **5-level confidence applied:** Assessment Confidence and Trend Confidence use VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW scale - [ ] **Named actors:** ≥2 named politicians/parties with party affiliations cited -- [ ] **Confidence labels:** Every claim has H/M/L confidence or numeric severity +- [ ] **Confidence labels:** Every claim has VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW confidence or numeric severity --- diff --git a/analysis/templates/stakeholder-impact.md b/analysis/templates/stakeholder-impact.md index a070e9117a..b0ed837f1c 100644 --- a/analysis/templates/stakeholder-impact.md +++ b/analysis/templates/stakeholder-impact.md @@ -452,7 +452,7 @@ quadrantChart **Document Control:** - **Template Path:** `/analysis/templates/stakeholder-impact.md` -- **Version:** 2.2 +- **Version:** 2.3 - **Effective Date:** 2026-06-01 (UTC) - **Key Changes v2.3:** Added Election 2026 Stakeholder Effects section with Voting Bloc Alignment table, 5-level confidence scale reference, updated quality checklist - **Lens References:** `scripts/analysis-framework/lenses/` (citizen, economic, government, international, media, opposition) diff --git a/analysis/templates/threat-analysis.md b/analysis/templates/threat-analysis.md index 713b5ec9a6..b3f41a6eba 100644 --- a/analysis/templates/threat-analysis.md +++ b/analysis/templates/threat-analysis.md @@ -11,12 +11,12 @@

Owner - Version + Version Effective Date Classification

-**📋 Document Owner:** CEO | **�� Version:** 3.3 | **📅 Last Updated:** 2026-06-01 (UTC) +**📋 Document Owner:** CEO | **📄 Version:** 3.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public > **📌 Template Instructions:** Copy to `analysis/daily/YYYY-MM-DD/{articleType}/`. Save as `threat-analysis.md` in the workflow's own folder (never overwrite another workflow's files). Each threat requires evidence citations and multi-framework analysis. See [methodologies/political-threat-framework.md](../methodologies/political-threat-framework.md). @@ -442,7 +442,7 @@ timeline **Document Control:** - **Template Path:** `/analysis/templates/threat-analysis.md` - **Framework Reference:** [THREAT_MODEL.md](../../THREAT_MODEL.md), [methodologies/political-threat-framework.md](../methodologies/political-threat-framework.md) -- **Version:** 3.2 +- **Version:** 3.3 - **Effective Date:** 2026-06-01 (UTC) - **Key Changes v3.3:** Added Election 2026 Threat Implications section, 5-level confidence scale reference, updated quality checklist - **Frameworks:** Attack Trees, Kill Chain, Diamond Model, Political Threat Taxonomy, Threat Actor Profiling From 97208ce2d8bdb3196becf333dd0e532a841a7aa0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:43:42 +0000 Subject: [PATCH 3/5] Fix review feedback round 2: consistency in proximity factor, electoral bonus, xychart, SWOT confidence, Document Control - political-risk-methodology.md: Fixed intro text to match table bands (>18, 12-18, 6-12, <6 months) - significance-scoring.md: Clarified electoral proximity bonus with time-banded scale (+0.0-+0.5/>12mo, +0.5-+1.0/6-12mo, +1.0-+2.0/<6mo) - ai-driven-analysis-guide.md: Removed xychart from v5.0 key-changes (not defined in guide) - political-swot-framework.md: Clarified VERY LOW content goes in separate Speculative/Monitoring Notes subsection, not active SWOT - significance-scoring.md: Aligned Document Control to Version 2.3, Effective 2026-06-01, Next Review 2026-09-01 Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/57305784-c0af-4e3b-8ac7-aaa7c1b9c962 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com> --- analysis/methodologies/ai-driven-analysis-guide.md | 2 +- analysis/methodologies/political-risk-methodology.md | 2 +- analysis/methodologies/political-swot-framework.md | 2 +- analysis/templates/significance-scoring.md | 11 ++++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/analysis/methodologies/ai-driven-analysis-guide.md b/analysis/methodologies/ai-driven-analysis-guide.md index 263a603b4b..6768491749 100644 --- a/analysis/methodologies/ai-driven-analysis-guide.md +++ b/analysis/methodologies/ai-driven-analysis-guide.md @@ -2037,7 +2037,7 @@ Every synthesis-level analysis MUST include a historical comparison with: **Document Control:** - **Path:** `/analysis/methodologies/ai-driven-analysis-guide.md` - **Version:** 5.0 -- **Key Changes v5.0:** Election 2026 Lens (mandatory 5-dimension electoral assessment for ALL analyses), 5-Level Confidence Scale replacing binary HIGH/MEDIUM/LOW, Mermaid diagram mandates per analysis type (flowchart/timeline/quadrantChart/mindmap/xychart), Historical Comparison requirements (3 time periods + precedents), pre-election analysis calendar +- **Key Changes v5.0:** Election 2026 Lens (mandatory 5-dimension electoral assessment for ALL analyses), 5-Level Confidence Scale replacing binary HIGH/MEDIUM/LOW, Mermaid diagram mandates per analysis type (flowchart/timeline/quadrantChart/mindmap), Historical Comparison requirements (3 time periods + precedents), pre-election analysis calendar - **Key Changes v4.2:** Empty Data Handling Protocol (lookback strategy, direct MCP retrieval, carry-forward protocol, minimum output requirements), Per-File Analysis Output Example (worked example of betänkande analysis with SWOT/risk/forward indicators) - **Key Changes v4.0:** AI article content generation protocol (5 mandatory sections with prompts), visualization integration protocol (Chart.js/D3.js), policy domain inference with committee mapping, pre-article analysis integration requirement, AI self-evaluation quality gate, empty analysis fallback protocol, 2026-04-03 systemic quality audit (444+ generic filler, 456+ excuse-as-analysis, 210+ boilerplate), cumulative quality tracking - **Key Changes v3.0:** Claude Opus 4.6 agentic integration, AI-first analysis principle, deprecated code function table, AI title/description generation prompts, analysis-to-article reference linking, cross-reference quality requirements, 2026-04-02 quality audit findings diff --git a/analysis/methodologies/political-risk-methodology.md b/analysis/methodologies/political-risk-methodology.md index 1812b14b8c..fe89a3bbc1 100644 --- a/analysis/methodologies/political-risk-methodology.md +++ b/analysis/methodologies/political-risk-methodology.md @@ -102,7 +102,7 @@ Risk scores carry a confidence label that reflects the quality and completeness ### Election 2026 Risk Proximity Factor -In the 12 months before September 2026, apply a **proximity factor** to Electoral risk scores: +Apply a **proximity factor** to Electoral risk scores based on distance to the September 2026 election: | Months to Election | Proximity Factor | Applied Risk Score | |:-----------------:|:---------------:|:-----------------:| diff --git a/analysis/methodologies/political-swot-framework.md b/analysis/methodologies/political-swot-framework.md index 756f5fad20..ec52d6dc81 100644 --- a/analysis/methodologies/political-swot-framework.md +++ b/analysis/methodologies/political-swot-framework.md @@ -187,7 +187,7 @@ Every SWOT analysis produced within 18 months of September 2026 MUST include: ### Electoral SWOT Confidence Standards -Electoral SWOT entries require **MEDIUM confidence minimum** (3+ sources). Speculation about electoral consequences without supporting polling or documented party positions must be labeled **VERY LOW** and isolated from substantive findings. +Electoral SWOT entries require **MEDIUM confidence minimum** (3+ sources). **VERY LOW** confidence content is **not** permitted as an active Electoral SWOT entry and must **not** be used to satisfy the minimum Strength/Weakness/Opportunity/Threat requirements above. Speculation about electoral consequences without supporting polling or documented party positions may only appear in a clearly separate **Speculative / Monitoring Notes** subsection, labeled **VERY LOW**, and isolated from substantive findings. --- diff --git a/analysis/templates/significance-scoring.md b/analysis/templates/significance-scoring.md index 3cc369f5bf..fdbb973045 100644 --- a/analysis/templates/significance-scoring.md +++ b/analysis/templates/significance-scoring.md @@ -296,11 +296,11 @@ These examples provide anchor points for consistent scoring across workflows: ## 🗳️ Election 2026 Relevance Score -> *Adjust significance scoring context based on proximity to September 2026 election.* +> *Adjust significance scoring context based on proximity to the September 2026 election, using the same time-banded scale for every assessment.* | Dimension | Score Adjustment | Rationale | |-----------|:---------------:|-----------| -| **Electoral proximity bonus** | `[REQUIRED: +0.0 to +2.0 — distance from election matters; <6 months from Sept 2026 = +1.0 max bonus]` | `[Evidence for time-sensitivity]` | +| **Electoral proximity bonus** | `[REQUIRED: +0.0 to +2.0 — scale by time to Sept 2026 election: >12 months = +0.0 to +0.5; 6–12 months = +0.5 to +1.0; <6 months = +1.0 to +2.0]` | `[Evidence for time-sensitivity]` | | **Coalition stability multiplier** | `[REQUIRED: ×1.0 to ×1.5 — documents that directly affect coalition stability before elections]` | `[Evidence]` | | **Voter salience factor** | `[REQUIRED: +0.0 to +1.0 — issues with high voter salience score higher in pre-election period]` | `[Evidence]` | @@ -360,11 +360,12 @@ These examples provide anchor points for consistent scoring across workflows: **Document Control:** - **Template Path:** `/analysis/templates/significance-scoring.md` -- **Version:** 2.2 -- **Effective Date:** 2026-04-06 (UTC) +- **Version:** 2.3 +- **Effective Date:** 2026-06-01 (UTC) +- **Key Changes v2.3:** Added Election 2026 Relevance Score section, time-banded electoral proximity bonus (+0.0 to +2.0), coalition stability multiplier, voter salience factor - **Scorer Implementation:** `scripts/analysis-framework/significance-scorer.ts` - **Advanced Sections:** Relative Scoring, Same-Type Comparison - **ISMS Alignment:** ISO 27001:2022 A.5.7 (Threat Intelligence), NIST CSF 2.0 ID.RA (Risk Assessment) - **Classification:** Public - **Owner:** Hack23 AB (Org.nr 5595347807) -- **Next Review:** 2026-06-30 +- **Next Review:** 2026-09-01 From 504d309d7e907b8b490d7ff7fa446c3451c98f6a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:30:12 +0000 Subject: [PATCH 4/5] Fix review feedback round 3: 5-level confidence in all templates, lazy loading in all workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Templates (4 files): - per-file-political-intelligence.md: Updated Executive Summary, SWOT tables, Risk Level, Stakeholder Confidence fields from H/M/L to VH/H/M/L/VL 5-level scale; aligned template instruction with lazy loading approach - synthesis-summary.md: Updated Narrative Confidence, Stakeholder Impact, Opposition Activity fields to 5-level - threat-analysis.md: Updated Attack Path, ICO Profile, Assessment Confidence to 5-level - stakeholder-impact.md: Updated all 8 Confidence Level fields to 5-level Workflows (7 files): - news-propositions, committee-reports, interpellations, motions, weekly-review: Time Budget "Read ALL methodology guides + ALL templates" → "Consult as needed"; detailed analysis step updated to read master guide upfront, consult others as needed - news-evening-analysis, realtime-monitor: Same Time Budget fix (table format); realtime-monitor detailed analysis steps also aligned All 88 workflow-architecture tests pass. Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/6ac5e810-bc87-4fbe-9f29-05efa9ed2376 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com> --- .github/workflows/news-committee-reports.md | 7 ++-- .github/workflows/news-evening-analysis.md | 2 +- .github/workflows/news-interpellations.md | 7 ++-- .github/workflows/news-motions.md | 7 ++-- .github/workflows/news-propositions.md | 7 ++-- .github/workflows/news-realtime-monitor.md | 22 +++++------- .github/workflows/news-weekly-review.md | 2 +- .../per-file-political-intelligence.md | 34 +++++++++---------- analysis/templates/stakeholder-impact.md | 16 ++++----- analysis/templates/synthesis-summary.md | 16 ++++----- analysis/templates/threat-analysis.md | 18 +++++----- 11 files changed, 68 insertions(+), 70 deletions(-) diff --git a/.github/workflows/news-committee-reports.md b/.github/workflows/news-committee-reports.md index 76918cd222..29b5513771 100644 --- a/.github/workflows/news-committee-reports.md +++ b/.github/workflows/news-committee-reports.md @@ -147,7 +147,7 @@ Uses `memory/news-generation` branch. START: read `memory/news-generation/last-r ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` - **Minutes 3–6**: Run pre-article-analysis pipeline (download data) -- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Read ALL methodology guides + ALL templates. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. +- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Consult methodology guides + templates as needed. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. - **Minutes 21–25**: Query MCP tools for committee reports data - **Minutes 25–33**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts` - **Minutes 33–38**: Validate and fix any quality issues @@ -538,14 +538,15 @@ echo "📊 Total pending committee report analysis files (all dates): $PENDING" After the script-based analysis, perform **AI-driven per-file analysis** for deeper intelligence: 1. Run `npx tsx scripts/catalog-downloaded-data.ts --pending-only` to list files needing analysis -2. **Read ALL methodology guides AND templates** (use `view` or `cat` to read each fully): +2. **Read the master methodology guide and per-file template** (required upfront), then consult others as needed: - `analysis/methodologies/ai-driven-analysis-guide.md` — Master per-file analysis guide (includes bad/good examples) + - `analysis/templates/per-file-political-intelligence.md` — Per-file output template + - Consult the following as needed for the current analysis step: - `analysis/methodologies/political-swot-framework.md` — Evidence-based SWOT with confidence hierarchy - `analysis/methodologies/political-risk-methodology.md` — 5×5 Likelihood×Impact risk matrix - `analysis/methodologies/political-threat-framework.md` — Political Threat Taxonomy, Attack Trees, severity calibration - `analysis/methodologies/political-classification-guide.md` — Sensitivity and domain taxonomy - `analysis/methodologies/political-style-guide.md` — Writing standards and evidence density - - `analysis/templates/per-file-political-intelligence.md` — Per-file output template - `analysis/templates/synthesis-summary.md` — Daily synthesis template - `analysis/templates/risk-assessment.md` — Risk assessment template - `analysis/templates/political-classification.md` — Classification template diff --git a/.github/workflows/news-evening-analysis.md b/.github/workflows/news-evening-analysis.md index 71bf937477..ad943baa66 100644 --- a/.github/workflows/news-evening-analysis.md +++ b/.github/workflows/news-evening-analysis.md @@ -184,7 +184,7 @@ START_TIME=$(date +%s) |-------|---------|--------| | Setup | 0–3 | Date check, `get_sync_status()`, determine day type | | Download | 3–6 | Run `populate-analysis-data.ts` + `pre-article-analysis.ts` (script-driven data download) | -| **AI Analysis** | **6–21** | **🚨 MANDATORY 15 min minimum**: Read ALL methodology guides + ALL templates, create per-file analysis with Mermaid diagrams and evidence tables. Run quality gate bash check. | +| **AI Analysis** | **6–21** | **🚨 MANDATORY 15 min minimum**: Consult methodology guides + templates as needed, create per-file analysis with Mermaid diagrams and evidence tables. Run quality gate bash check. | | Data | 21–25 | Query additional MCP tools for parliamentary activity | | Generate | 25–33 | Run generation script OR manual synthesis (see Step 3) | | Validate | 33–38 | Translate, validate, commit | diff --git a/.github/workflows/news-interpellations.md b/.github/workflows/news-interpellations.md index 548ff32881..1a1b871d7a 100644 --- a/.github/workflows/news-interpellations.md +++ b/.github/workflows/news-interpellations.md @@ -156,7 +156,7 @@ Uses `memory/news-generation` branch. START: read `memory/news-generation/last-r ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` - **Minutes 3–6**: Run pre-article-analysis pipeline (download data) -- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Read ALL methodology guides + ALL templates. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. +- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Consult methodology guides + templates as needed. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. - **Minutes 21–25**: Query MCP tools for interpellation data - **Minutes 25–33**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts` - **Minutes 33–38**: Validate and fix any quality issues @@ -547,14 +547,15 @@ echo "📊 Total pending interpellation analysis files (all dates): $PENDING" After the script-based analysis, perform **AI-driven per-file analysis** for deeper intelligence: 1. Run `npx tsx scripts/catalog-downloaded-data.ts --pending-only` to list files needing analysis -2. **Read ALL methodology guides AND templates** (use `view` or `cat` to read each fully): +2. **Read the master methodology guide and per-file template** (required upfront), then consult others as needed: - `analysis/methodologies/ai-driven-analysis-guide.md` — Master per-file analysis guide (includes bad/good examples) + - `analysis/templates/per-file-political-intelligence.md` — Per-file output template + - Consult the following as needed for the current analysis step: - `analysis/methodologies/political-swot-framework.md` — Evidence-based SWOT with confidence hierarchy - `analysis/methodologies/political-risk-methodology.md` — 5×5 Likelihood×Impact risk matrix - `analysis/methodologies/political-threat-framework.md` — Political Threat Taxonomy, Attack Trees, severity calibration - `analysis/methodologies/political-classification-guide.md` — Sensitivity and domain taxonomy - `analysis/methodologies/political-style-guide.md` — Writing standards and evidence density - - `analysis/templates/per-file-political-intelligence.md` — Per-file output template - `analysis/templates/synthesis-summary.md` — Daily synthesis template - `analysis/templates/risk-assessment.md` — Risk assessment template - `analysis/templates/political-classification.md` — Classification template diff --git a/.github/workflows/news-motions.md b/.github/workflows/news-motions.md index b85fabc287..492dd750d1 100644 --- a/.github/workflows/news-motions.md +++ b/.github/workflows/news-motions.md @@ -143,7 +143,7 @@ Uses `memory/news-generation` branch. START: read `memory/news-generation/last-r ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` - **Minutes 3–6**: Run pre-article-analysis pipeline (download data) -- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Read ALL methodology guides + ALL templates. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. +- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Consult methodology guides + templates as needed. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. - **Minutes 21–25**: Query MCP tools for motions data - **Minutes 25–33**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts` - **Minutes 33–38**: Validate and fix any quality issues @@ -531,14 +531,15 @@ echo "📊 Total pending motion analysis files (all dates): $PENDING" After the script-based analysis, perform **AI-driven per-file analysis** for deeper intelligence: 1. Run `npx tsx scripts/catalog-downloaded-data.ts --pending-only` to list files needing analysis -2. **Read ALL methodology guides AND templates** (use `view` or `cat` to read each fully): +2. **Read the master methodology guide and per-file template** (required upfront), then consult others as needed: - `analysis/methodologies/ai-driven-analysis-guide.md` — Master per-file analysis guide (includes bad/good examples) + - `analysis/templates/per-file-political-intelligence.md` — Per-file output template + - Consult the following as needed for the current analysis step: - `analysis/methodologies/political-swot-framework.md` — Evidence-based SWOT with confidence hierarchy - `analysis/methodologies/political-risk-methodology.md` — 5×5 Likelihood×Impact risk matrix - `analysis/methodologies/political-threat-framework.md` — Political Threat Taxonomy, Attack Trees, severity calibration - `analysis/methodologies/political-classification-guide.md` — Sensitivity and domain taxonomy - `analysis/methodologies/political-style-guide.md` — Writing standards and evidence density - - `analysis/templates/per-file-political-intelligence.md` — Per-file output template - `analysis/templates/synthesis-summary.md` — Daily synthesis template - `analysis/templates/risk-assessment.md` — Risk assessment template - `analysis/templates/political-classification.md` — Classification template diff --git a/.github/workflows/news-propositions.md b/.github/workflows/news-propositions.md index 0b44305666..baffa16a5f 100644 --- a/.github/workflows/news-propositions.md +++ b/.github/workflows/news-propositions.md @@ -147,7 +147,7 @@ Uses `memory/news-generation` branch. START: read `memory/news-generation/last-r ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` - **Minutes 3–6**: Run pre-article-analysis pipeline (download data) -- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Read ALL methodology guides + ALL templates. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. +- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Consult methodology guides + templates as needed. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. - **Minutes 21–25**: Query MCP tools for propositions data - **Minutes 25–33**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts` - **Minutes 33–38**: Validate and fix any quality issues @@ -525,14 +525,15 @@ echo "📊 Total pending proposition analysis files (all dates): $PENDING" After the script-based analysis, perform **AI-driven per-file analysis** for deeper intelligence: 1. Run `npx tsx scripts/catalog-downloaded-data.ts --pending-only` to list files needing analysis -2. **Read ALL methodology guides AND templates** (use `view` or `cat` to read each fully): +2. **Read the master methodology guide and per-file template** (required upfront), then consult others as needed: - `analysis/methodologies/ai-driven-analysis-guide.md` — Master per-file analysis guide (includes bad/good examples) + - `analysis/templates/per-file-political-intelligence.md` — Per-file output template + - Consult the following as needed for the current analysis step: - `analysis/methodologies/political-swot-framework.md` — Evidence-based SWOT with confidence hierarchy - `analysis/methodologies/political-risk-methodology.md` — 5×5 Likelihood×Impact risk matrix - `analysis/methodologies/political-threat-framework.md` — Political Threat Taxonomy, Attack Trees, severity calibration - `analysis/methodologies/political-classification-guide.md` — Sensitivity and domain taxonomy - `analysis/methodologies/political-style-guide.md` — Writing standards and evidence density - - `analysis/templates/per-file-political-intelligence.md` — Per-file output template - `analysis/templates/synthesis-summary.md` — Daily synthesis template - `analysis/templates/risk-assessment.md` — Risk assessment template - `analysis/templates/political-classification.md` — Classification template diff --git a/.github/workflows/news-realtime-monitor.md b/.github/workflows/news-realtime-monitor.md index 141d86f849..a428ff4d6e 100644 --- a/.github/workflows/news-realtime-monitor.md +++ b/.github/workflows/news-realtime-monitor.md @@ -202,13 +202,13 @@ START_TIME=$(date +%s) |-------|---------|--------| | Setup | 0–3 | Date check, `get_sync_status()` warm-up | | Download | 3–6 | Run data download scripts (MCP data fetch) | -| **AI Analysis** | **6–21** | **🚨 MANDATORY 15 min minimum**: Read ALL methodology guides + ALL templates, create per-file analysis with Mermaid diagrams and evidence tables. Run quality gate bash check. | +| **AI Analysis** | **6–21** | **🚨 MANDATORY 15 min minimum**: Consult methodology guides + templates as needed, create per-file analysis with Mermaid diagrams and evidence tables. Run quality gate bash check. | | Detect | 21–25 | Query MCP tools for today's activity | | Generate | 25–33 | Run `generate-news-enhanced.ts` script (core languages by default; supports all 14 languages via `languages=all`) | | Validate | 33–38 | Run `validate-news-generation.sh` | | Commit+PR | 38–43 | `git add && git commit`, then `safeoutputs___create_pull_request` | -> ⚠️ **Analysis phase is 15 minutes minimum** — this is NOT negotiable. PR #1452 demonstrated that < 10 min produces unacceptable analysis (plain prose, no Mermaid diagrams, no evidence tables). The AI MUST read all methodology/template documents and produce publication-quality output matching [SWOT.md](../../SWOT.md) formatting standard. +> ⚠️ **Analysis phase is 15 minutes minimum** — this is NOT negotiable. PR #1452 demonstrated that < 10 min produces unacceptable analysis (plain prose, no Mermaid diagrams, no evidence tables). The AI MUST consult methodology guides and templates as needed and produce publication-quality output matching [SWOT.md](../../SWOT.md) formatting standard. **Hard cutoffs** — check elapsed time before EVERY phase: ```bash @@ -321,29 +321,23 @@ fi ### 🚨🚨🚨 MANDATORY: AI Must Analyse ALL Data Using Methods & Templates (15 min minimum) -> **THIS IS YOUR PRIMARY JOB.** You MUST spend **at least 15 minutes** on analysis. For every piece of data or document downloaded from MCP, you MUST read ALL methodology guides and ALL templates, then create analysis following those templates exactly. This is NOT optional. +> **THIS IS YOUR PRIMARY JOB.** You MUST spend **at least 15 minutes** on analysis. For every piece of data or document downloaded from MCP, you MUST read the master methodology guide and per-file template upfront, then consult other methodology guides and templates as needed for each analysis step. This is NOT optional. > > **Why 15 minutes?** PR #1452 demonstrated that rushing analysis (< 10 min) produces: plain prose without tables, no Mermaid diagrams, no dok_id evidence citations, no template structure. This is REJECTED. The templates require structured tables, color-coded Mermaid diagrams, evidence citations, and multi-section analysis that cannot be done properly in less than 15 minutes. #### What you MUST do (no exceptions): -1. **Read ALL 6 methodology guides** (use `view` to read each one fully — not skim): +1. **Read the master methodology guide and per-file template** (required upfront): - `analysis/methodologies/ai-driven-analysis-guide.md` — Master guide (bad vs. good examples, quality gate) + - `analysis/templates/per-file-political-intelligence.md` — Per-file output template + +2. **Consult other methodology guides and templates as needed** for the current analysis step: - `analysis/methodologies/political-swot-framework.md` — Evidence-based SWOT with confidence hierarchy - `analysis/methodologies/political-risk-methodology.md` — 5×5 risk matrix - `analysis/methodologies/political-threat-framework.md` — Political Threat Taxonomy - `analysis/methodologies/political-classification-guide.md` — Classification taxonomy - `analysis/methodologies/political-style-guide.md` — Writing standards - -2. **Read ALL 8 analysis templates** (use `view` to read each one fully — these define the output format): - - `analysis/templates/per-file-political-intelligence.md` - - `analysis/templates/synthesis-summary.md` - - `analysis/templates/risk-assessment.md` - - `analysis/templates/political-classification.md` - - `analysis/templates/threat-analysis.md` - - `analysis/templates/swot-analysis.md` — SWOT MUST have: Context table, evidence tables with dok_id/confidence/impact columns, Mermaid SWOT Quadrant Mapping - - `analysis/templates/stakeholder-impact.md` - - `analysis/templates/significance-scoring.md` + - `analysis/templates/synthesis-summary.md`, `risk-assessment.md`, `political-classification.md`, `threat-analysis.md`, `swot-analysis.md` (SWOT MUST have: Context table, evidence tables with dok_id/confidence/impact columns, Mermaid SWOT Quadrant Mapping), `stakeholder-impact.md`, `significance-scoring.md` 3. **For EVERY downloaded document/data file**: apply ALL 6 analytical lenses and create `{dok_id}-analysis.md` following the per-file template. Cite specific data (dok_id, vote counts, party names). Include ≥1 color-coded Mermaid diagram with `style` directives. diff --git a/.github/workflows/news-weekly-review.md b/.github/workflows/news-weekly-review.md index dbb08c2bc0..08324b546c 100644 --- a/.github/workflows/news-weekly-review.md +++ b/.github/workflows/news-weekly-review.md @@ -145,7 +145,7 @@ Uses `memory/news-generation` branch. START: read `memory/news-generation/last-r ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` - **Minutes 3–6**: Run pre-article-analysis pipeline (download data) -- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Read ALL methodology guides + ALL templates. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. +- **Minutes 6–21**: 🚨 **AI Analysis (15 min minimum)**: Consult methodology guides + templates as needed. Create per-file analysis with color-coded Mermaid diagrams and evidence tables. Run quality gate bash check. - **Minutes 21–25**: Query documents and votes from past 7 days - **Minutes 25–35**: Generate articles for all 14 languages - **Minutes 35–40**: Validate and commit analysis + articles diff --git a/analysis/templates/per-file-political-intelligence.md b/analysis/templates/per-file-political-intelligence.md index 739468d809..af17de23bc 100644 --- a/analysis/templates/per-file-political-intelligence.md +++ b/analysis/templates/per-file-political-intelligence.md @@ -19,7 +19,7 @@ **📋 Document Owner:** CEO | **📄 Version:** 2.3 | **📅 Last Updated:** 2026-06-01 (UTC) **🏢 Owner:** Hack23 AB (Org.nr 5595347807) | **🏷️ Classification:** Public -> **📌 Template Instructions:** This template is for **per-file** analysis. For each data file downloaded via MCP, the AI agent produces one analysis markdown file stored as `{id}-analysis.md` in the workflow's isolated folder. AI MUST read ALL 6 methodology guides before analyzing. +> **📌 Template Instructions:** This template is for **per-file** analysis. For each data file downloaded via MCP, the AI agent produces one analysis markdown file stored as `{id}-analysis.md` in the workflow's isolated folder. AI MUST read `analysis/methodologies/ai-driven-analysis-guide.md` (v5.0) before analyzing; consult other methodology guides only when needed for the current analysis step. > > **Output path:** `analysis/daily/YYYY-MM-DD/{articleType}/documents/{dok_id}-analysis.md` > @@ -56,7 +56,7 @@ ## 🎯 Executive Summary -`[REQUIRED: 3–5 sentences capturing the political significance. Intelligence-level analysis — not just what happened, but what it means for power dynamics, coalition stability, and democratic accountability. Include confidence label.]` **[HIGH/MEDIUM/LOW]** +`[REQUIRED: 3–5 sentences capturing the political significance. Intelligence-level analysis — not just what happened, but what it means for power dynamics, coalition stability, and democratic accountability. Include confidence label.]` **[VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW]** --- @@ -121,19 +121,19 @@ quadrantChart | Quadrant | Statement | Evidence | Confidence | Impact | |----------|-----------|----------|:----------:|:------:| -| ✅ Strength | `[If this document strengthens the government position — specific claim]` | `[dok_id or evidence]` | `H/M/L` | `H/M/L` | -| ⚠️ Weakness | `[If this document exposes a government vulnerability]` | `[dok_id or evidence]` | `H/M/L` | `H/M/L` | -| 🚀 Opportunity | `[If this creates a government opportunity]` | `[dok_id or evidence]` | `H/M/L` | `H/M/L` | -| 🔴 Threat | `[If this poses a threat to the government]` | `[dok_id or evidence]` | `H/M/L` | `H/M/L` | +| ✅ Strength | `[If this document strengthens the government position — specific claim]` | `[dok_id or evidence]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | +| ⚠️ Weakness | `[If this document exposes a government vulnerability]` | `[dok_id or evidence]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | +| 🚀 Opportunity | `[If this creates a government opportunity]` | `[dok_id or evidence]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | +| 🔴 Threat | `[If this poses a threat to the government]` | `[dok_id or evidence]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | ### Opposition Impact | Quadrant | Statement | Evidence | Confidence | Impact | |----------|-----------|----------|:----------:|:------:| -| ✅ Strength | `[If this strengthens the opposition]` | `[dok_id or evidence]` | `H/M/L` | `H/M/L` | -| ⚠️ Weakness | `[If this exposes an opposition vulnerability]` | `[dok_id or evidence]` | `H/M/L` | `H/M/L` | -| 🚀 Opportunity | `[If this creates an opposition opportunity]` | `[dok_id or evidence]` | `H/M/L` | `H/M/L` | -| 🔴 Threat | `[If this poses a threat to the opposition]` | `[dok_id or evidence]` | `H/M/L` | `H/M/L` | +| ✅ Strength | `[If this strengthens the opposition]` | `[dok_id or evidence]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | +| ⚠️ Weakness | `[If this exposes an opposition vulnerability]` | `[dok_id or evidence]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | +| 🚀 Opportunity | `[If this creates an opposition opportunity]` | `[dok_id or evidence]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | +| 🔴 Threat | `[If this poses a threat to the opposition]` | `[dok_id or evidence]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | --- @@ -189,7 +189,7 @@ graph TD | Democratic Process | `[1-5]` | `[1-5]` | `[L×I]` | `[REQUIRED: specific risk statement]` | | External / International | `[1-5]` | `[1-5]` | `[L×I]` | `[OPTIONAL: EU, NATO, Nordic impact]` | -**Overall Risk Level:** `[REQUIRED: CRITICAL / HIGH / MEDIUM / LOW]` +**Overall Risk Level:** `[REQUIRED: CRITICAL / HIGH / MEDIUM / LOW / NEGLIGIBLE]` **Risk-to-SWOT:** Any score ≥15 → add as SWOT Threat entry. Any score 10–14 → add as SWOT Weakness or Threat. ### Anomaly Flags @@ -282,12 +282,12 @@ graph TD | Stakeholder | Impact Level | Key Assessment | Confidence | |------------|:------------:|----------------|:----------:| -| 🏛️ Government | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: How does this affect government's position, agenda, and coalition stability?]` | `[H/M/L]` | -| ⚖️ Opposition | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: How does this create opportunities or challenges for opposition parties?]` | `[H/M/L]` | -| 👥 Citizens | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: How does this affect public services, rights, daily life?]` | `[H/M/L]` | -| 💰 Economic | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: Fiscal impact, business implications, labour market effects?]` | `[H/M/L]` | -| 🌍 International | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: EU compliance, Nordic cooperation, foreign relations?]` | `[H/M/L]` | -| 📰 Media | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: Newsworthiness, narrative potential, public attention?]` | `[H/M/L]` | +| 🏛️ Government | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: How does this affect government's position, agenda, and coalition stability?]` | `[VH/H/M/L/VL]` | +| ⚖️ Opposition | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: How does this create opportunities or challenges for opposition parties?]` | `[VH/H/M/L/VL]` | +| 👥 Citizens | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: How does this affect public services, rights, daily life?]` | `[VH/H/M/L/VL]` | +| 💰 Economic | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: Fiscal impact, business implications, labour market effects?]` | `[VH/H/M/L/VL]` | +| 🌍 International | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: EU compliance, Nordic cooperation, foreign relations?]` | `[VH/H/M/L/VL]` | +| 📰 Media | `[HIGH/MEDIUM/LOW/NONE]` | `[REQUIRED: Newsworthiness, narrative potential, public attention?]` | `[VH/H/M/L/VL]` | --- diff --git a/analysis/templates/stakeholder-impact.md b/analysis/templates/stakeholder-impact.md index b0ed837f1c..b93a6efb2b 100644 --- a/analysis/templates/stakeholder-impact.md +++ b/analysis/templates/stakeholder-impact.md @@ -91,7 +91,7 @@ graph TD | **Affected Population** | `[REQUIRED: e.g. "All 10.5M residents", "Pensioners 65+", "Urban renters", "Asylum seekers"]` | | **Impact Type** | `[REQUIRED: FINANCIAL / LEGAL / SOCIAL / HEALTH / EDUCATIONAL / COMBINATION]` | | **Evidence Sources** | `[REQUIRED: dok_id(s), SCB statistics ref, or budget document]` | -| **Confidence Level** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Confidence Level** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | **Citizen Impact Narrative:** `[REQUIRED: 2–4 sentences explaining how ordinary citizens experience this change. Be specific about amounts (SEK), eligibility criteria, timelines, and regional variation if applicable. Reference the scripts/analysis-framework/lenses/citizen.ts perspective framework.]` @@ -111,7 +111,7 @@ graph TD | **Primary Affected Parties** | `[REQUIRED: e.g. "M (primary), SD (secondary), KD (minor)"]` | | **Coalition Cohesion Effect** | `[REQUIRED: STRENGTHENS / NEUTRAL / STRAINS / FRACTURES]` | | **Evidence Sources** | `[REQUIRED: dok_id, debate ref, or interpellation]` | -| **Confidence Level** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Confidence Level** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | **Government Coalition Impact Narrative:** `[REQUIRED: 2–3 sentences. Reference scripts/analysis-framework/lenses/government.ts.]` @@ -129,7 +129,7 @@ graph TD | **Primary Affected Parties** | `[REQUIRED: e.g. "S (gains credibility), V (opposition opportunity), MP (marginalised)"]` | | **Electoral Positioning Effect** | `[REQUIRED: POSITIVE / NEUTRAL / NEGATIVE — from opposition perspective]` | | **Evidence Sources** | `[REQUIRED: anföranden refs or motion dok_ids]` | -| **Confidence Level** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Confidence Level** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | **Opposition Impact Narrative:** `[REQUIRED: 2–3 sentences. Reference scripts/analysis-framework/lenses/opposition.ts.]` @@ -148,7 +148,7 @@ graph TD | **Economic Impact Type** | `[REQUIRED: COMPLIANCE COST / MARKET OPPORTUNITY / REGULATORY BURDEN / TAX CHANGE / OTHER]` | | **Estimated Financial Impact** | `[OPTIONAL: e.g. "±X BSEK annually per Finansdepartementet estimate"]` | | **Evidence Sources** | `[REQUIRED: proposition dok_id, Riksbank ref, or SOU]` | -| **Confidence Level** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Confidence Level** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | **Business Sector Impact Narrative:** `[REQUIRED: 2–3 sentences. Reference scripts/analysis-framework/lenses/economic.ts.]` @@ -166,7 +166,7 @@ graph TD | **Most Affected Organisations** | `[REQUIRED: e.g. "LO, TCO (labour)", "Rädda Barnen (welfare)", "Greenpeace (environment)"]` | | **Civil Society Response** | `[REQUIRED: SUPPORTIVE / NEUTRAL / OPPOSED / DIVIDED]` | | **Evidence Sources** | `[REQUIRED: remissvar refs, consultation documents, or media statements]` | -| **Confidence Level** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Confidence Level** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | **Civil Society Impact Narrative:** `[REQUIRED: 2–3 sentences.]` @@ -184,7 +184,7 @@ graph TD | **Affected Relationships** | `[REQUIRED: e.g. "EU Commission (sanctions risk)", "NATO allies", "Nordic Council"]` | | **Treaty/Directive Compliance** | `[REQUIRED: COMPLIANT / AT RISK / NON-COMPLIANT / UNCERTAIN]` | | **Evidence Sources** | `[REQUIRED: EU directive refs, international agreement dok_ids]` | -| **Confidence Level** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Confidence Level** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | **International Impact Narrative:** `[REQUIRED: 2–3 sentences. Reference scripts/analysis-framework/lenses/international.ts.]` @@ -242,7 +242,7 @@ _Note: In the Extended Impact Summary Matrix, stakeholder groups may appear in a | **Constitutional Compliance** | `[REQUIRED: COMPLIANT / CONSTITUTIONAL RISK / UNDER REVIEW / UNCERTAIN]` | | **Legal Precedent Impact** | `[REQUIRED: NONE / MINOR ADJUSTMENT / SIGNIFICANT SHIFT / NEW PRECEDENT]` | | **Evidence Sources** | `[REQUIRED: Lagrådet remiss, SOU dok_id, or constitutional analysis]` | -| **Confidence Level** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Confidence Level** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | **Judiciary Impact Narrative:** `[REQUIRED: 2–3 sentences. Consider Lagrådet opinions, constitutional implications under Regeringsformen (RF), court capacity, and effects on rule-of-law guarantees. Note any EU Charter of Fundamental Rights interactions.]` @@ -261,7 +261,7 @@ _Note: In the Extended Impact Summary Matrix, stakeholder groups may appear in a | **Framing Dynamics** | `[REQUIRED: e.g. "Government frames as security; opposition as civil liberties threat"]` | | **Key Media Actors** | `[REQUIRED: e.g. "SVT Nyheter, DN ledare, Expressen, SR Ekot"]` | | **Evidence Sources** | `[REQUIRED: media monitoring refs, press conference dok_ids, or debate transcripts]` | -| **Confidence Level** | `[REQUIRED: HIGH / MEDIUM / LOW]` | +| **Confidence Level** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | **Media Impact Narrative:** `[REQUIRED: 2–3 sentences. Reference scripts/analysis-framework/lenses/media.ts. Describe the anticipated media cycle, competing narratives, and whether the issue will sustain public attention or be displaced.]` diff --git a/analysis/templates/synthesis-summary.md b/analysis/templates/synthesis-summary.md index c16a9d92ab..6268744412 100644 --- a/analysis/templates/synthesis-summary.md +++ b/analysis/templates/synthesis-summary.md @@ -176,12 +176,12 @@ graph LR | Stakeholder | Impact | Direction | Key Driver | |------------|:------:|:---------:|------------| -| 🏘️ Citizens | `[H/M/L/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | -| 🏛️ Government | `[H/M/L/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | -| 🗳️ Opposition | `[H/M/L/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | -| 🏭 Business | `[H/M/L/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | -| 🤝 Civil Society | `[H/M/L/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | -| 🌍 International | `[H/M/L/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | +| 🏘️ Citizens | `[VH/H/M/L/VL/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | +| 🏛️ Government | `[VH/H/M/L/VL/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | +| 🗳️ Opposition | `[VH/H/M/L/VL/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | +| 🏭 Business | `[VH/H/M/L/VL/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | +| 🤝 Civil Society | `[VH/H/M/L/VL/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | +| 🌍 International | `[VH/H/M/L/VL/N]` | `[positive/negative/neutral]` | `[REQUIRED]` | --- @@ -193,7 +193,7 @@ graph LR **Primary Narrative Angle:** `[REQUIRED: 1 sentence — the article headline thesis]` **Secondary Angles:** `[OPTIONAL: 1–2 alternative narrative framings]` -**Confidence:** `[REQUIRED: HIGH / MEDIUM / LOW]` +**Confidence:** `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` ### 📰 AI-Recommended Article Metadata (MANDATORY — v5.0) @@ -236,7 +236,7 @@ graph LR | **Overall Risk Level** | `[REQUIRED]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | | **Coalition Stability** | `[REQUIRED]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | | **Legislative Throughput** | `[REQUIRED: N documents]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | -| **Opposition Activity Level** | `[REQUIRED: H/M/L]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | +| **Opposition Activity Level** | `[REQUIRED: VH/H/M/L/VL]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | | **Average Significance Score** | `[REQUIRED: #.#/10]` | `[OPTIONAL]` | `[OPTIONAL]` | `[↑/→/↓]` | **Historical Context:** `[REQUIRED: 2–3 sentences placing this period in historical context. Is this an unusually active/risky period? Compare to equivalent pre-election periods in 2021/22.]` diff --git a/analysis/templates/threat-analysis.md b/analysis/templates/threat-analysis.md index b3f41a6eba..6b586228eb 100644 --- a/analysis/templates/threat-analysis.md +++ b/analysis/templates/threat-analysis.md @@ -203,8 +203,8 @@ graph TD | Path | Steps Required | Feasibility (1–5) | Detectability (1–5) | Political Cost | Most Likely? | |------|:--------------:|:-----------------:|:-------------------:|:--------------:|:------------:| -| Path A | `[#]` | `[1-5]` | `[1-5]` | `[H/M/L]` | `[Y/N]` | -| Path B | `[#]` | `[1-5]` | `[1-5]` | `[H/M/L]` | `[Y/N]` | +| Path A | `[#]` | `[1-5]` | `[1-5]` | `[VH/H/M/L/VL]` | `[Y/N]` | +| Path B | `[#]` | `[1-5]` | `[1-5]` | `[VH/H/M/L/VL]` | `[Y/N]` | **Cheapest attack path:** `[REQUIRED: Which path has highest feasibility and lowest cost?]` @@ -244,12 +244,12 @@ graph TD | Attribute | Assessment | Confidence | |-----------|-----------|:----------:| -| **Intent** | `[REQUIRED: What do they want?]` | `[H/M/L]` | -| **Capability** | `[REQUIRED: What can they actually do?]` | `[H/M/L]` | -| **Opportunity** | `[REQUIRED: What upcoming events create windows?]` | `[H/M/L]` | -| **Track Record** | `[REQUIRED: Have they acted on similar threats before?]` | `[H/M/L]` | -| **Constraints** | `[REQUIRED: What limits their action?]` | `[H/M/L]` | -| **Overall ICO Level** | `[REQUIRED: HIGH / MEDIUM / LOW]` | `[H/M/L]` | +| **Intent** | `[REQUIRED: What do they want?]` | `[VH/H/M/L/VL]` | +| **Capability** | `[REQUIRED: What can they actually do?]` | `[VH/H/M/L/VL]` | +| **Opportunity** | `[REQUIRED: What upcoming events create windows?]` | `[VH/H/M/L/VL]` | +| **Track Record** | `[REQUIRED: Have they acted on similar threats before?]` | `[VH/H/M/L/VL]` | +| **Constraints** | `[REQUIRED: What limits their action?]` | `[VH/H/M/L/VL]` | +| **Overall ICO Level** | `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` | `[VH/H/M/L/VL]` | --- @@ -284,7 +284,7 @@ graph TD 3. **[Threat ID]:** `[Mitigation action]` **Overall Threat Level:** `[REQUIRED: LOW / MODERATE / HIGH / SEVERE]` -**Assessment Confidence:** `[REQUIRED: HIGH / MEDIUM / LOW]` +**Assessment Confidence:** `[REQUIRED: VERY HIGH / HIGH / MEDIUM / LOW / VERY LOW]` --- From 97497d76a586be1f8a22882448c51ac9a34c8525 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:43:33 +0000 Subject: [PATCH 5/5] Fix review feedback round 4: Political Cost definition, SWOT 5-level, memory paths, noop payloads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Templates (2 files): - threat-analysis.md: Added Political Cost scale definition (VH/H/M/L/VL) with description explaining cost categories (backlash, coalition fracture, etc.) - swot-analysis.md: Updated all SWOT evidence tables H/M/L → VH/H/M/L/VL (26 rows); MCP Data Provenance table [H/M/L] → [VH/H/M/L/VL]; checklist item aligned Workflows — repo-memory paths (10 files): - All 10 news workflows: added `memory/news-generation/` prefix to `covered-documents/{YYYY-MM-DD}.json` and `translation-status.json` Workflows — safeoutputs___noop payloads (9 files): - 8 workflows: `safeoutputs___noop("...")` → `safeoutputs___noop({"message": "..."})` - evening-analysis: same fix for "MCP unavailable" string form All 88 workflow-architecture tests pass. Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/e1a2d67b-3bc3-4073-900b-2da0e5484f6b Co-authored-by: pethers <1726836+pethers@users.noreply.github.com> --- .github/workflows/news-committee-reports.md | 4 +- .github/workflows/news-evening-analysis.md | 4 +- .github/workflows/news-interpellations.md | 4 +- .github/workflows/news-month-ahead.md | 4 +- .github/workflows/news-monthly-review.md | 4 +- .github/workflows/news-motions.md | 4 +- .github/workflows/news-propositions.md | 4 +- .github/workflows/news-realtime-monitor.md | 2 +- .github/workflows/news-week-ahead.md | 4 +- .github/workflows/news-weekly-review.md | 4 +- analysis/templates/swot-analysis.md | 58 ++++++++++----------- analysis/templates/threat-analysis.md | 6 +++ 12 files changed, 54 insertions(+), 48 deletions(-) diff --git a/.github/workflows/news-committee-reports.md b/.github/workflows/news-committee-reports.md index 29b5513771..c8f6a805db 100644 --- a/.github/workflows/news-committee-reports.md +++ b/.github/workflows/news-committee-reports.md @@ -142,7 +142,7 @@ This focused approach ensures: ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-committee-reports.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-committee-reports.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -305,7 +305,7 @@ fi ## MANDATORY MCP Health Gate 1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) -2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +2. After 3 failures → `safeoutputs___noop({"message": "MCP server unavailable after 3 attempts"})` 3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract diff --git a/.github/workflows/news-evening-analysis.md b/.github/workflows/news-evening-analysis.md index ad943baa66..f2d88271f1 100644 --- a/.github/workflows/news-evening-analysis.md +++ b/.github/workflows/news-evening-analysis.md @@ -172,7 +172,7 @@ You are the **Evening Political Analyst** for Riksdagsmonitor. Generate comprehe ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-evening-analysis.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-evening-analysis.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) @@ -300,7 +300,7 @@ fi ### MCP Health Gate -Call `get_sync_status({})` first; retry up to 3× (30s wait). After 3 failures → `safeoutputs___noop("MCP unavailable")`. All content MUST come from live MCP data. +Call `get_sync_status({})` first; retry up to 3× (30s wait). After 3 failures → `safeoutputs___noop({"message": "MCP unavailable"})`. All content MUST come from live MCP data. ### DATA FRESHNESS CHECK diff --git a/.github/workflows/news-interpellations.md b/.github/workflows/news-interpellations.md index 1a1b871d7a..0880b72930 100644 --- a/.github/workflows/news-interpellations.md +++ b/.github/workflows/news-interpellations.md @@ -151,7 +151,7 @@ If **force_generation** is `true`, generate articles even if recent ones exist. ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-interpellations.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-interpellations.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -308,7 +308,7 @@ fi ## MANDATORY MCP Health Gate 1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) -2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +2. After 3 failures → `safeoutputs___noop({"message": "MCP server unavailable after 3 attempts"})` 3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract diff --git a/.github/workflows/news-month-ahead.md b/.github/workflows/news-month-ahead.md index c489efa29d..ac4f71f462 100644 --- a/.github/workflows/news-month-ahead.md +++ b/.github/workflows/news-month-ahead.md @@ -141,7 +141,7 @@ This is a **prospective** article providing a 30-day forward-looking strategic o ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-month-ahead.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-month-ahead.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (30 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -273,7 +273,7 @@ fi ## MANDATORY MCP Health Gate 1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) -2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +2. After 3 failures → `safeoutputs___noop({"message": "MCP server unavailable after 3 attempts"})` 3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract diff --git a/.github/workflows/news-monthly-review.md b/.github/workflows/news-monthly-review.md index fa05a3b0db..65f494d4a9 100644 --- a/.github/workflows/news-monthly-review.md +++ b/.github/workflows/news-monthly-review.md @@ -141,7 +141,7 @@ This is a **retrospective** article providing comprehensive analysis of the past ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-monthly-review.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-monthly-review.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (30 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -263,7 +263,7 @@ fi ## MANDATORY MCP Health Gate 1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) -2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +2. After 3 failures → `safeoutputs___noop({"message": "MCP server unavailable after 3 attempts"})` 3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract diff --git a/.github/workflows/news-motions.md b/.github/workflows/news-motions.md index 492dd750d1..7efaa9bc9a 100644 --- a/.github/workflows/news-motions.md +++ b/.github/workflows/news-motions.md @@ -138,7 +138,7 @@ If **force_generation** is `true`, generate articles even if recent ones exist. ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-motions.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-motions.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -293,7 +293,7 @@ fi ## MANDATORY MCP Health Gate 1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) -2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +2. After 3 failures → `safeoutputs___noop({"message": "MCP server unavailable after 3 attempts"})` 3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract diff --git a/.github/workflows/news-propositions.md b/.github/workflows/news-propositions.md index baffa16a5f..97b897c62b 100644 --- a/.github/workflows/news-propositions.md +++ b/.github/workflows/news-propositions.md @@ -142,7 +142,7 @@ If **force_generation** is `true`, generate articles even if recent ones exist. ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-propositions.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-propositions.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -286,7 +286,7 @@ fi ## MANDATORY MCP Health Gate 1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) -2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +2. After 3 failures → `safeoutputs___noop({"message": "MCP server unavailable after 3 attempts"})` 3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract diff --git a/.github/workflows/news-realtime-monitor.md b/.github/workflows/news-realtime-monitor.md index a428ff4d6e..d51cab6d3a 100644 --- a/.github/workflows/news-realtime-monitor.md +++ b/.github/workflows/news-realtime-monitor.md @@ -190,7 +190,7 @@ You are the **Real-Time Political Monitor** for Riksdagsmonitor. Detect signific ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-realtime-monitor.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-realtime-monitor.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) diff --git a/.github/workflows/news-week-ahead.md b/.github/workflows/news-week-ahead.md index 7ebf63c088..09df30d185 100644 --- a/.github/workflows/news-week-ahead.md +++ b/.github/workflows/news-week-ahead.md @@ -138,7 +138,7 @@ If **force_generation** is `true`, generate articles even if recent ones exist. ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-week-ahead.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-week-ahead.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (30 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -255,7 +255,7 @@ fi ## MANDATORY MCP Health Gate 1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) -2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +2. After 3 failures → `safeoutputs___noop({"message": "MCP server unavailable after 3 attempts"})` 3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract diff --git a/.github/workflows/news-weekly-review.md b/.github/workflows/news-weekly-review.md index 08324b546c..4a6316840f 100644 --- a/.github/workflows/news-weekly-review.md +++ b/.github/workflows/news-weekly-review.md @@ -140,7 +140,7 @@ This is a **retrospective** article analyzing the past 7 days of parliamentary a ## 🧠 Repo Memory -Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-weekly-review.json` + `covered-documents/{YYYY-MM-DD}.json`. END: update both + `translation-status.json`. Skip already-covered dok_ids. +Uses `memory/news-generation` branch. START: read `memory/news-generation/last-run-news-weekly-review.json` + `memory/news-generation/covered-documents/{YYYY-MM-DD}.json`. END: update both + `memory/news-generation/translation-status.json`. Skip already-covered dok_ids. ## ⏱️ Time Budget (45 minutes) - **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()` @@ -260,7 +260,7 @@ fi ## MANDATORY MCP Health Gate 1. Call `get_sync_status({})` — retry up to 3× (30s wait between each) -2. After 3 failures → `safeoutputs___noop("MCP server unavailable after 3 attempts")` +2. After 3 failures → `safeoutputs___noop({"message": "MCP server unavailable after 3 attempts"})` 3. **ALL content MUST come from live MCP data.** Never use cached articles, stale data, or AI-fabricated content. ## 🛡️ File Ownership Contract diff --git a/analysis/templates/swot-analysis.md b/analysis/templates/swot-analysis.md index 45498d648a..47a062a5be 100644 --- a/analysis/templates/swot-analysis.md +++ b/analysis/templates/swot-analysis.md @@ -59,10 +59,10 @@ Each entry requires: Statement + Evidence (dok_id) + Confidence + Impact + Entry | # | Strength Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|-------------------|-------------------|:----------:|:------:|:----------:| -| S1 | `[REQUIRED: specific, verifiable strength — e.g. "Coalition maintains working Riksdag majority of 176 seats through SD support agreement"]` | `[REQUIRED: dok_id or vote record]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| S2 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| S3 | `[OPTIONAL]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| S4 | `[OPTIONAL]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| S1 | `[REQUIRED: specific, verifiable strength — e.g. "Coalition maintains working Riksdag majority of 176 seats through SD support agreement"]` | `[REQUIRED: dok_id or vote record]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| S2 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| S3 | `[OPTIONAL]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| S4 | `[OPTIONAL]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | **Coalition Strength Summary:** `[REQUIRED: 1–2 sentences]` @@ -72,9 +72,9 @@ Each entry requires: Statement + Evidence (dok_id) + Confidence + Impact + Entry | # | Weakness Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|-------------------|-------------------|:----------:|:------:|:----------:| -| W1 | `[REQUIRED: e.g. "Internal disagreement on migration targets between M and L weakens policy coherence"]` | `[REQUIRED: dok_id or debate reference]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| W2 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| W3 | `[OPTIONAL]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| W1 | `[REQUIRED: e.g. "Internal disagreement on migration targets between M and L weakens policy coherence"]` | `[REQUIRED: dok_id or debate reference]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| W2 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| W3 | `[OPTIONAL]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | **Coalition Weakness Summary:** `[REQUIRED: 1–2 sentences]` @@ -84,9 +84,9 @@ Each entry requires: Statement + Evidence (dok_id) + Confidence + Impact + Entry | # | Opportunity Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|----------------------|-------------------|:----------:|:------:|:----------:| -| O1 | `[REQUIRED: e.g. "Improving macroeconomic indicators provide window for tax reform legislation"]` | `[REQUIRED: SCB data or budget dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| O2 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| O3 | `[OPTIONAL]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| O1 | `[REQUIRED: e.g. "Improving macroeconomic indicators provide window for tax reform legislation"]` | `[REQUIRED: SCB data or budget dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| O2 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| O3 | `[OPTIONAL]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | **Coalition Opportunity Summary:** `[REQUIRED: 1–2 sentences]` @@ -96,9 +96,9 @@ Each entry requires: Statement + Evidence (dok_id) + Confidence + Impact + Entry | # | Threat Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|-----------------|-------------------|:----------:|:------:|:----------:| -| T1 | `[REQUIRED: e.g. "No-confidence motion risk if SD withdraws budget support over crime legislation stall"]` | `[REQUIRED: interpellation or debate ref]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| T2 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| T3 | `[OPTIONAL]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| T1 | `[REQUIRED: e.g. "No-confidence motion risk if SD withdraws budget support over crime legislation stall"]` | `[REQUIRED: interpellation or debate ref]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| T2 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| T3 | `[OPTIONAL]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | **Coalition Threat Summary:** `[REQUIRED: 1–2 sentences]` @@ -114,27 +114,27 @@ Each entry requires: Statement + Evidence (dok_id) + Confidence + Impact + Entry | # | Strength Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|-------------------|-------------------|:----------:|:------:|:----------:| -| S1 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| S2 | `[OPTIONAL]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| S1 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| S2 | `[OPTIONAL]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | ### ⚠️ Weaknesses — Opposition | # | Weakness Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|-------------------|-------------------|:----------:|:------:|:----------:| -| W1 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| W2 | `[OPTIONAL]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| W1 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| W2 | `[OPTIONAL]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | ### 🚀 Opportunities — Opposition | # | Opportunity Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|----------------------|-------------------|:----------:|:------:|:----------:| -| O1 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| O1 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | ### 🔴 Threats — Opposition | # | Threat Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|-----------------|-------------------|:----------:|:------:|:----------:| -| T1 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| T1 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | --- @@ -146,26 +146,26 @@ Each entry requires: Statement + Evidence (dok_id) + Confidence + Impact + Entry | # | Strength Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|-------------------|-------------------|:----------:|:------:|:----------:| -| S1 | `[REQUIRED: e.g. "Sweden meets 2025 renewable energy target; supporting legislation fully enacted (prop 2024/25:XX)"]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | -| S2 | `[OPTIONAL]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| S1 | `[REQUIRED: e.g. "Sweden meets 2025 renewable energy target; supporting legislation fully enacted (prop 2024/25:XX)"]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | +| S2 | `[OPTIONAL]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | ### ⚠️ Weaknesses in Domain | # | Weakness Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|-------------------|-------------------|:----------:|:------:|:----------:| -| W1 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| W1 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | ### 🚀 Opportunities in Domain | # | Opportunity Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|----------------------|-------------------|:----------:|:------:|:----------:| -| O1 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| O1 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | ### 🔴 Threats to Domain | # | Threat Statement | Evidence (dok_id) | Confidence | Impact | Entry Date | |---|-----------------|-------------------|:----------:|:------:|:----------:| -| T1 | `[REQUIRED]` | `[dok_id]` | `H/M/L` | `H/M/L` | `YYYY-MM-DD` | +| T1 | `[REQUIRED]` | `[dok_id]` | `VH/H/M/L/VL` | `VH/H/M/L/VL` | `YYYY-MM-DD` | --- @@ -290,10 +290,10 @@ graph TD | SWOT Quadrant | Primary MCP Tools | Evidence Items | Confidence | |:-------------:|------------------|:--------------:|:----------:| -| **Strengths** | `[e.g. search_voteringar, get_betankanden]` | `[#]` | `[H/M/L]` | -| **Weaknesses** | `[e.g. search_anforanden, search_dokument]` | `[#]` | `[H/M/L]` | -| **Opportunities** | `[e.g. search_regering, get_calendar_events]` | `[#]` | `[H/M/L]` | -| **Threats** | `[e.g. search_voteringar, search_dokument_fulltext]` | `[#]` | `[H/M/L]` | +| **Strengths** | `[e.g. search_voteringar, get_betankanden]` | `[#]` | `[VH/H/M/L/VL]` | +| **Weaknesses** | `[e.g. search_anforanden, search_dokument]` | `[#]` | `[VH/H/M/L/VL]` | +| **Opportunities** | `[e.g. search_regering, get_calendar_events]` | `[#]` | `[VH/H/M/L/VL]` | +| **Threats** | `[e.g. search_voteringar, search_dokument_fulltext]` | `[#]` | `[VH/H/M/L/VL]` | > **📌 Note:** Confidence follows the temporal decay rule from [political-swot-framework.md](../methodologies/political-swot-framework.md): HIGH (0–30d, remains HIGH at 30d)→MEDIUM (90d)→LOW (180d)→EXPIRED. All files listed MUST exist at the stated paths; mark transient data as `(transient — not cached)`. @@ -387,7 +387,7 @@ graph TD - [ ] **SWOT Context complete:** All metadata fields filled including temporal window and validity window - [ ] **Minimum 2 entries per quadrant:** Government Coalition SWOT has ≥2 Strengths, ≥2 Weaknesses, ≥1 Opportunity, ≥1 Threat - [ ] **Evidence on every entry:** No SWOT entry without a dok_id or named evidence source -- [ ] **Confidence labels present:** Every entry has H/M/L confidence and impact ratings +- [ ] **Confidence labels present:** Every entry has VH/H/M/L/VL confidence and impact ratings - [ ] **Entry dates populated:** Temporal decay tracking enabled for all entries - [ ] **Mermaid SWOT diagram rendered:** Quadrant Mapping diagram has actual findings (no placeholders) - [ ] **TOWS Matrix complete:** At least SO and WO strategies filled with specific actions diff --git a/analysis/templates/threat-analysis.md b/analysis/templates/threat-analysis.md index 6b586228eb..fd4eb31a91 100644 --- a/analysis/templates/threat-analysis.md +++ b/analysis/templates/threat-analysis.md @@ -201,6 +201,12 @@ graph TD ### Attack Path Assessment +| Path | Steps Required | Feasibility (1–5) | Detectability (1–5) | Political Cost | Most Likely? | +|------|:--------------:|:-----------------:|:-------------------:|:--------------:|:------------:| +**Political Cost scale:** `VH = Very High` · `H = High` · `M = Medium` · `L = Low` · `VL = Very Low` + +> Rate the expected political cost to the attacker if the path is attempted or exposed (e.g. public backlash, coalition fracture, media scrutiny, loss of legitimacy, sanctions, or electoral damage). + | Path | Steps Required | Feasibility (1–5) | Detectability (1–5) | Political Cost | Most Likely? | |------|:--------------:|:-----------------:|:-------------------:|:--------------:|:------------:| | Path A | `[#]` | `[1-5]` | `[1-5]` | `[VH/H/M/L/VL]` | `[Y/N]` |