diff --git a/.github/workflows/news-committee-reports.md b/.github/workflows/news-committee-reports.md index 186990c84..c8f6a805d 100644 --- a/.github/workflows/news-committee-reports.md +++ b/.github/workflows/news-committee-reports.md @@ -142,22 +142,12 @@ 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` + `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()` - **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 @@ -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. +> **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 @@ -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:** `.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` ## ๐Ÿ“Š 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` @@ -323,12 +275,7 @@ 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"` - -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,24 @@ 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({"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 -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` +### 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. + ```bash # Stage articles and analysis โ€” scoped to article type to stay within 100-file PR limit @@ -429,40 +345,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 @@ -647,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 @@ -944,16 +836,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 41377ca3a..f2d88271f 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` + `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) @@ -227,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 | @@ -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:** `.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` ## ๐Ÿ“Š 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 @@ -320,9 +272,8 @@ 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"` + +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({"message": "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,22 @@ 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. +### HOW SAFE PR CREATION WORKS -- โœ… **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 โ€” do NOT run `git push` or `git checkout -b` manually. Stage files, then call the tool 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 6039d429f..0880b7293 100644 --- a/.github/workflows/news-interpellations.md +++ b/.github/workflows/news-interpellations.md @@ -151,22 +151,12 @@ 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` + `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()` - **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 @@ -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:** `.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` ## ๐Ÿ“Š 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 @@ -326,12 +278,7 @@ 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"` - -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,24 @@ 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({"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 -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` +### 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. + ```bash # Stage articles and analysis โ€” scoped to article type to stay within 100-file PR limit @@ -433,39 +349,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 @@ -656,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 @@ -954,24 +846,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 a1d181364..ac4f71f46 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` + `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()` @@ -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:** `.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 @@ -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 @@ -291,12 +243,7 @@ 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"` - -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,89 +272,37 @@ 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({"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 -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 > **๐Ÿš€ 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 > 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 2e031e38d..65f494d4a 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` + `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()` @@ -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:** `.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 @@ -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 @@ -281,12 +233,7 @@ 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"` - -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,89 +262,37 @@ 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({"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 -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 > **๐Ÿš€ 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 > 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 0ef7bdbf1..7efaa9bc9 100644 --- a/.github/workflows/news-motions.md +++ b/.github/workflows/news-motions.md @@ -138,22 +138,12 @@ 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` + `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()` - **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 @@ -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. - -## ๐Ÿ›ก๏ธ 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 @@ -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:** `.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` ## ๐Ÿ“Š 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 @@ -311,12 +263,7 @@ 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"` - -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,24 @@ 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({"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 -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` +### 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. + ```bash # Stage articles and analysis โ€” scoped to article type to stay within 100-file PR limit @@ -418,39 +334,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 @@ -640,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 @@ -919,16 +811,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 9687e9806..97b897c62 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,22 +142,12 @@ 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` + `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()` - **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 @@ -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 - -> **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 @@ -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:** `.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` ## ๐Ÿ“Š 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 @@ -313,12 +256,7 @@ 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"` - -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,24 @@ 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({"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 -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` +### 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. + ```bash # Stage articles and analysis โ€” scoped to article type to stay within 100-file PR limit @@ -420,39 +327,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 @@ -643,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 @@ -925,24 +808,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 2441dc9b4..d51cab6d3 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 - -> **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`. ## โš ๏ธ 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` + `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) @@ -238,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 @@ -357,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. @@ -958,26 +916,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 +964,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:** `.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 607ddf44b..09df30d18 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` + `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()` @@ -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:** `.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 @@ -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 @@ -273,12 +225,7 @@ 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"` - -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,89 +254,37 @@ 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({"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 -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 > **๐Ÿš€ 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 > 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 2ade64fdf..4a6316840 100644 --- a/.github/workflows/news-weekly-review.md +++ b/.github/workflows/news-weekly-review.md @@ -140,22 +140,12 @@ 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` + `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()` - **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 @@ -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:** `.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 @@ -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 @@ -278,12 +230,7 @@ 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"` - -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,89 +259,37 @@ 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({"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 -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 > **๐Ÿš€ 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 > 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 2b99f609e..58ffa1c4c 100644 --- a/analysis/methodologies/README.md +++ b/analysis/methodologies/README.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + 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 bb56db81d..676849174 100644 --- a/analysis/methodologies/ai-driven-analysis-guide.md +++ b/analysis/methodologies/ai-driven-analysis-guide.md @@ -11,13 +11,13 @@

Owner - Version - Effective Date + 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 | Include Election 2026 section and explicitly mark as 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), 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 4d0cacd2d..954161b13 100644 --- a/analysis/methodologies/political-classification-guide.md +++ b/analysis/methodologies/political-classification-guide.md @@ -11,13 +11,13 @@

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

-**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 2.2 | **๐Ÿ“… Last Updated:** 2026-04-06 (UTC) -**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-06-30 +**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 2.3 | **๐Ÿ“… Last Updated:** 2026-06-01 (UTC) +**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-09-01 **๐Ÿข 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 9f9bde3ae..fe89a3bbc 100644 --- a/analysis/methodologies/political-risk-methodology.md +++ b/analysis/methodologies/political-risk-methodology.md @@ -11,13 +11,13 @@

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

-**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 2.1 | **๐Ÿ“… Last Updated:** 2026-04-06 (UTC) -**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-06-30 +**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 2.2 | **๐Ÿ“… Last Updated:** 2026-06-01 (UTC) +**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-09-01 **๐Ÿข 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 + +Apply a **proximity factor** to Electoral risk scores based on distance to the September 2026 election: + +| 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 8be140dfc..b01df5825 100644 --- a/analysis/methodologies/political-style-guide.md +++ b/analysis/methodologies/political-style-guide.md @@ -11,13 +11,13 @@

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

-**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 2.1 | **๐Ÿ“… Last Updated:** 2026-04-06 (UTC) -**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-06-30 +**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 2.2 | **๐Ÿ“… Last Updated:** 2026-06-01 (UTC) +**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-09-01 **๐Ÿข 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 6399340c0..ec52d6dc8 100644 --- a/analysis/methodologies/political-swot-framework.md +++ b/analysis/methodologies/political-swot-framework.md @@ -11,13 +11,13 @@

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

-**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 2.2 | **๐Ÿ“… Last Updated:** 2026-04-06 (UTC) -**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-06-30 +**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 2.3 | **๐Ÿ“… Last Updated:** 2026-06-01 (UTC) +**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-09-01 **๐Ÿข 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). **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. --- @@ -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 241aa6cc5..dd5003ce8 100644 --- a/analysis/methodologies/political-threat-framework.md +++ b/analysis/methodologies/political-threat-framework.md @@ -11,13 +11,13 @@

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

-**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 3.1 | **๐Ÿ“… Last Updated:** 2026-04-06 (UTC) -**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-06-30 +**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 3.2 | **๐Ÿ“… Last Updated:** 2026-06-01 (UTC) +**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** 2026-09-01 **๐Ÿข 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 af81fc000..1ef713fad 100644 --- a/analysis/templates/README.md +++ b/analysis/templates/README.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + 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 a22aec505..af17de23b 100644 --- a/analysis/templates/per-file-political-intelligence.md +++ b/analysis/templates/per-file-political-intelligence.md @@ -11,15 +11,15 @@

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. +> **๐Ÿ“Œ 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]** --- @@ -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]` | --- @@ -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,28 @@ 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]` | + +--- + +## ๐Ÿ—ณ๏ธ 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?]` --- @@ -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 c34708566..aba7b2234 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 d9642a10a..73a14697d 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,16 +421,19 @@ 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 +- [ ] **Confidence labels:** Every claim has VERY HIGH/HIGH/MEDIUM/LOW/VERY LOW confidence or numeric severity --- **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 5d1c2c0c2..fdbb97304 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 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 โ€” 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]` | + +**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 @@ -326,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 diff --git a/analysis/templates/stakeholder-impact.md b/analysis/templates/stakeholder-impact.md index c0a31a89a..b93a6efb2 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. @@ -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.]` @@ -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 @@ -413,8 +452,9 @@ quadrantChart **Document Control:** - **Template Path:** `/analysis/templates/stakeholder-impact.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 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 a9bb6734f..47a062a5b 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). @@ -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)`. @@ -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.* @@ -348,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 @@ -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 94c20525b..626874441 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]` | --- @@ -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) @@ -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: 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.]` + +**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 b45e20b77..fd4eb31a9 100644 --- a/analysis/templates/threat-analysis.md +++ b/analysis/templates/threat-analysis.md @@ -11,12 +11,12 @@

Owner - Version - Effective Date + Version + 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). @@ -203,8 +203,14 @@ 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]` | +**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]` | +| 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 +250,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 +290,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]` --- @@ -376,6 +382,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 +439,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 --- @@ -412,8 +448,9 @@ 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 -- **Effective Date:** 2026-04-06 (UTC) +- **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 - **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)