Conversation
… workflow prompts with AI-driven analysis instructions - Updated SHARED_PROMPT_PATTERNS.md: clarified distinction between deprecated analysis generators and active HTML renderer functions, added HTML Renderer Functions table, added Minor TypeScript/Script Corrections Policy section, extended Shared Skill Block with per-file-intelligence-analysis.md, ai-driven-analysis-guide.md, and templates - Updated 8 news workflow .md files: replaced all 'Generate generateSwotSection()/generateDashboardSection()/generateMindmapSection()' call-style patterns with clear AI-driven analysis instructions - Updated scripts/prompts/v2 references: added clarifying notes that HTML renderers are script-side, not AI-callable Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/9e0dc1aa-65fc-4722-a2a4-b19bb162fb37 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: documentation,workflow,ci-cd,refactor,size-m,news,agentic-workflow Label Categories
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
Pull request overview
This PR cleans up agentic workflow prompt text and shared workflow guidance to remove misleading “function-call-like” instructions, clarifying that AI agents write analysis in markdown while scripts perform HTML rendering.
Changes:
- Replaced prompt language like “Generate
generateSwotSection()/generateDashboardSection()/generateMindmapSection()” with instructions to write analysis + provide structured inputs that scripts render. - Updated
SHARED_PROMPT_PATTERNS.mdto distinguish deprecated analysis generators vs active HTML renderer utilities and to add a script-corrections policy. - Added clarifying notes in v2 prompt reference docs describing script-side rendering flow.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/prompts/v2/swot-generation.md | Adds an explicit note that generateSwotSection() is script-side and not AI-invoked. |
| scripts/prompts/v2/political-analysis.md | Clarifies that generateSwotSection() is an HTML renderer called by scripts, not AI agents. |
| .github/workflows/SHARED_PROMPT_PATTERNS.md | Refines deprecated-function guidance; adds an HTML renderer table and a minor script-corrections policy; extends referenced skills/templates. |
| .github/workflows/news-weekly-review.md | Replaces deprecated function-call phrasing with “write/provide/define” instructions for SWOT/dashboard/mindmap. |
| .github/workflows/news-week-ahead.md | Updates dashboard instruction to request chart data for script rendering. |
| .github/workflows/news-realtime-monitor.md | Updates activity chart instruction to request chart data for script rendering. |
| .github/workflows/news-propositions.md | Replaces function-call phrasing with explicit AI outputs + script rendering notes. |
| .github/workflows/news-motions.md | Updates dashboard instruction to request chart data for script rendering. |
| .github/workflows/news-monthly-review.md | Replaces SWOT/dashboard/mindmap function-call phrasing; updates stakeholder SWOT instruction to be AI-written. |
| .github/workflows/news-month-ahead.md | Updates dashboard/mindmap instructions to request structured inputs for script rendering. |
| .github/workflows/news-interpellations.md | Updates dashboard instruction to request chart data for script rendering. |
| .github/workflows/news-evening-analysis.md | Replaces scoreNewsworthiness() mention with AI-based scoring; updates dashboard instruction to request chart data for script rendering. |
| | `scripts/data-transformers/content-generators/ai-swot-analyzer.ts` | ⚠️ DEPRECATED | AI agent generates SWOT per political-swot-framework.md | | ||
| | `scripts/data-transformers/content-generators/stakeholder-swot-section.ts` | ⚠️ DEPRECATED | AI agent generates stakeholder analysis per stakeholder-impact.md | |
There was a problem hiding this comment.
The table references scripts/data-transformers/content-generators/ai-swot-analyzer.ts, but that file does not exist in the repo. Update this entry to point to the actual module (e.g. scripts/generate-news-enhanced/swot-analyzer.ts) or remove the row to avoid broken guidance.
| | `scripts/data-transformers/content-generators/ai-swot-analyzer.ts` | ⚠️ DEPRECATED | AI agent generates SWOT per political-swot-framework.md | | |
| | `scripts/data-transformers/content-generators/stakeholder-swot-section.ts` | ⚠️ DEPRECATED | AI agent generates stakeholder analysis per stakeholder-impact.md | | |
| | `scripts/generate-news-enhanced/swot-analyzer.ts` | ⚠️ DEPRECATED | AI agent generates SWOT per political-swot-framework.md | |
| | `scripts/ai-analysis/` | ⚠️ DEPRECATED for analysis generation | AI agent performs analysis per workflow prompts | | ||
| | `scripts/analysis-framework/` | ⚠️ DEPRECATED for analysis generation | AI agent uses methodology guides directly | | ||
| | `scripts/data-transformers/content-generators/ai-swot-analyzer.ts` | ⚠️ DEPRECATED | AI agent generates SWOT per political-swot-framework.md | | ||
| | `scripts/data-transformers/content-generators/stakeholder-swot-section.ts` | ⚠️ DEPRECATED | AI agent generates stakeholder analysis per stakeholder-impact.md | |
There was a problem hiding this comment.
This row references scripts/data-transformers/content-generators/stakeholder-swot-section.ts, but the module is not present under scripts/data-transformers/content-generators/. If the intent is to document the current stubbed generateStakeholderSwotSection, point to its actual location (currently implemented as a stub in scripts/data-transformers/content-generators/index.ts).
| | `scripts/data-transformers/content-generators/stakeholder-swot-section.ts` | ⚠️ DEPRECATED | AI agent generates stakeholder analysis per stakeholder-impact.md | | |
| | `scripts/data-transformers/content-generators/index.ts` → `generateStakeholderSwotSection()` | ⚠️ DEPRECATED | AI agent generates stakeholder analysis per stakeholder-impact.md | |
| | `scripts/generate-news-enhanced/ai-analysis-pipeline.ts` → `buildKeyTakeaways()` | ⚠️ DEPRECATED | AI prompt: "Extract 5 key takeaways with confidence levels" | | ||
| | `scripts/generate-news-enhanced/ai-analysis-pipeline.ts` → `buildLegislativeImpact()` | ⚠️ DEPRECATED | AI prompt: "Assess legislative impact using committee + vote data" | | ||
| | `scripts/generate-news-enhanced/ai-analysis-pipeline.ts` → `buildCrossPartyImplications()` | ⚠️ DEPRECATED | AI prompt: "Analyze cross-party dynamics from voting records" | | ||
| | `scripts/generate-news-enhanced/ai-analysis-pipeline.ts` → `AIAnalysisPipeline` class | ⚠️ DEPRECATED | AI agent performs all analysis; class retained only for type definitions | |
There was a problem hiding this comment.
The AIAnalysisPipeline entry says the class is “retained only for type definitions”, but it is still instantiated and executed in scripts/generate-news-enhanced/generators.ts (pipeline.analyze). Please adjust the wording to reflect its current runtime role (even if its analysis output is considered deprecated/stub).
| | `scripts/generate-news-enhanced/ai-analysis-pipeline.ts` → `AIAnalysisPipeline` class | ⚠️ DEPRECATED | AI agent performs all analysis; class retained only for type definitions | | |
| | `scripts/generate-news-enhanced/ai-analysis-pipeline.ts` → `AIAnalysisPipeline` class | ⚠️ DEPRECATED | AI agent performs the primary analysis; class still runs as a deprecated/stub runtime pipeline | |
| | `scripts/data-transformers/content-generators/shared.ts` → `genericConsequencesText()`, `propConsequencesText()`, `motConsequencesText()` | 🔴 STUB | Now outputs `AI_MUST_REPLACE` marker — AI MUST write specific consequences analysis | | ||
| | `scripts/data-transformers/content-generators/shared.ts` → `defaultCriticalText()` | 🔴 STUB | Now outputs `AI_MUST_REPLACE` marker — AI MUST write specific critical assessment | | ||
| | `scripts/editorial-pillars.ts` → `INTER_PILLAR_TRANSITIONS` | 🔴 EMPTY | Transitions now return empty strings — AI MUST write article-specific connective prose or omit | | ||
| | `scripts/data-transformers/content-generators/newsworthiness.ts` → `scoreNewsworthiness()` | ✅ ACTIVE (data utility) | Heuristic scoring still used by scripts; AI SHOULD also independently assess newsworthiness | |
There was a problem hiding this comment.
This row claims scoreNewsworthiness() is “still used by scripts”, but there are no in-repo runtime call sites (only the function definition/exports and unit tests). Consider rewording to accurately describe current usage (e.g., retained for routing/experimentation/tests) and keep the note that it’s deprecated for editorial significance assessment.
| | `scripts/data-transformers/content-generators/newsworthiness.ts` → `scoreNewsworthiness()` | ✅ ACTIVE (data utility) | Heuristic scoring still used by scripts; AI SHOULD also independently assess newsworthiness | | |
| | `scripts/data-transformers/content-generators/newsworthiness.ts` → `scoreNewsworthiness()` | ✅ ACTIVE (data utility) | Heuristic scoring retained for routing/experimentation/tests; AI MUST independently assess editorial significance | |
|
@copilot apply changes based on the comments in this thread |
…eprecated functions table - Fix ai-swot-analyzer.ts path to scripts/generate-news-enhanced/swot-analyzer.ts - Fix stakeholder-swot-section.ts to actual location in index.ts - Fix AIAnalysisPipeline description: still runs as deprecated/stub runtime pipeline - Fix scoreNewsworthiness description: retained for routing/experimentation/tests Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/fb6a6cc1-6af8-43fc-add9-798d2b873756 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Applied all 4 review comments in
|
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
| | `generateSwotSection({ data, lang })` | `swot-section.ts` | Renders SWOT quadrant HTML from `SwotData` | AI writes SWOT analysis in markdown → script reads it → calls this function to render HTML | | ||
| | `generateDashboardSection({ data, lang })` | `dashboard-section.ts` | Renders Chart.js canvas HTML from chart config | AI provides chart data in analysis → script calls this to render chart containers | | ||
| | `generateMindmapSection({ topic, branches, lang })` | `mindmap-section.ts` | Renders CSS mindmap HTML from branch data | AI defines mindmap structure in analysis → script renders it as interactive HTML | | ||
| | `generateMultiPanelDashboardSection(...)` | `dashboard-section.ts` | Renders multi-panel CSS dashboards | AI provides panel data → script renders the full dashboard | | ||
| | `generateEconomicDashboardSection(...)` | `economic-dashboard-section.ts` | Renders economic indicator dashboard | AI provides economic data → script renders comparative charts | | ||
|
|
||
| > **How AI agents interact with these**: AI agents do NOT call these TypeScript functions directly. Instead, AI agents write rich analysis content (SWOT entries, chart data, mindmap structures) in their analysis markdown files. The `generate-news-enhanced` script reads the analysis, extracts the structured data, and calls these renderer functions to produce the final HTML article sections. |
There was a problem hiding this comment.
This section says AI supplies chart data and the script “reads the analysis, extracts the structured data” for dashboards/mindmaps. In the current code, scripts/analysis-reader.ts parses classification/risk/SWOT/etc. but not dashboard/mindmap structures, and scripts/generate-news-enhanced/generators.ts uses stubbed analyzeDashboardData() (returns empty charts/tables). Please either (1) scope this guidance to SWOT-only, (2) document the actual extraction mechanism/location for dashboard+mindmap data, or (3) rephrase as a future/aspirational capability.
| | `generateSwotSection({ data, lang })` | `swot-section.ts` | Renders SWOT quadrant HTML from `SwotData` | AI writes SWOT analysis in markdown → script reads it → calls this function to render HTML | | |
| | `generateDashboardSection({ data, lang })` | `dashboard-section.ts` | Renders Chart.js canvas HTML from chart config | AI provides chart data in analysis → script calls this to render chart containers | | |
| | `generateMindmapSection({ topic, branches, lang })` | `mindmap-section.ts` | Renders CSS mindmap HTML from branch data | AI defines mindmap structure in analysis → script renders it as interactive HTML | | |
| | `generateMultiPanelDashboardSection(...)` | `dashboard-section.ts` | Renders multi-panel CSS dashboards | AI provides panel data → script renders the full dashboard | | |
| | `generateEconomicDashboardSection(...)` | `economic-dashboard-section.ts` | Renders economic indicator dashboard | AI provides economic data → script renders comparative charts | | |
| > **How AI agents interact with these**: AI agents do NOT call these TypeScript functions directly. Instead, AI agents write rich analysis content (SWOT entries, chart data, mindmap structures) in their analysis markdown files. The `generate-news-enhanced` script reads the analysis, extracts the structured data, and calls these renderer functions to produce the final HTML article sections. | |
| | `generateSwotSection({ data, lang })` | `swot-section.ts` | Renders SWOT quadrant HTML from `SwotData` | **Current implementation:** AI writes SWOT analysis in markdown → script reads it → extracts SWOT data → calls this function to render HTML | | |
| | `generateDashboardSection({ data, lang })` | `dashboard-section.ts` | Renders Chart.js canvas HTML from chart config | Renderer utility: used when structured chart data is provided by the pipeline; automatic extraction from AI analysis markdown is not currently documented here as a standard implemented flow | | |
| | `generateMindmapSection({ topic, branches, lang })` | `mindmap-section.ts` | Renders CSS mindmap HTML from branch data | Renderer utility: used when structured mindmap branch data is provided by the pipeline; analysis-to-mindmap extraction is workflow-specific or future-facing | | |
| | `generateMultiPanelDashboardSection(...)` | `dashboard-section.ts` | Renders multi-panel CSS dashboards | Renderer utility for pre-structured panel data; not a guaranteed current markdown-extraction path | | |
| | `generateEconomicDashboardSection(...)` | `economic-dashboard-section.ts` | Renders economic indicator dashboard | Renderer utility for structured economic dashboard data when available; automated extraction from agent analysis should be treated as planned or workflow-specific unless separately implemented | | |
| > **How AI agents interact with these**: AI agents do NOT call these TypeScript functions directly. In the current documented flow, AI agents write rich analysis content and the pipeline extracts **SWOT-style structured data** before calling the relevant renderer. Other renderer functions in this table remain available HTML utilities, but dashboard, mindmap, multi-panel, and economic dashboard extraction from analysis markdown should be treated as requiring explicit pipeline support rather than assumed as a universally implemented capability. |
| | `generateSwotSection({ data, lang })` | `swot-section.ts` | Renders SWOT quadrant HTML from `SwotData` | AI writes SWOT analysis in markdown → script reads it → calls this function to render HTML | | ||
| | `generateDashboardSection({ data, lang })` | `dashboard-section.ts` | Renders Chart.js canvas HTML from chart config | AI provides chart data in analysis → script calls this to render chart containers | | ||
| | `generateMindmapSection({ topic, branches, lang })` | `mindmap-section.ts` | Renders CSS mindmap HTML from branch data | AI defines mindmap structure in analysis → script renders it as interactive HTML | | ||
| | `generateMultiPanelDashboardSection(...)` | `dashboard-section.ts` | Renders multi-panel CSS dashboards | AI provides panel data → script renders the full dashboard | | ||
| | `generateEconomicDashboardSection(...)` | `economic-dashboard-section.ts` | Renders economic indicator dashboard | AI provides economic data → script renders comparative charts | | ||
|
|
||
| > **How AI agents interact with these**: AI agents do NOT call these TypeScript functions directly. Instead, AI agents write rich analysis content (SWOT entries, chart data, mindmap structures) in their analysis markdown files. The `generate-news-enhanced` script reads the analysis, extracts the structured data, and calls these renderer functions to produce the final HTML article sections. |
There was a problem hiding this comment.
The statement that agents “write rich analysis content (… mindmap structures) in their analysis markdown files” and generate-news-enhanced then renders it implies the pipeline consumes those markdown structures. If the intended flow is “AI writes final HTML/sections in the article content” (instead of structured extraction), clarify that here to prevent workflow authors from assuming a supported structured-parse step that doesn’t exist yet.
| | `generateSwotSection({ data, lang })` | `swot-section.ts` | Renders SWOT quadrant HTML from `SwotData` | AI writes SWOT analysis in markdown → script reads it → calls this function to render HTML | | |
| | `generateDashboardSection({ data, lang })` | `dashboard-section.ts` | Renders Chart.js canvas HTML from chart config | AI provides chart data in analysis → script calls this to render chart containers | | |
| | `generateMindmapSection({ topic, branches, lang })` | `mindmap-section.ts` | Renders CSS mindmap HTML from branch data | AI defines mindmap structure in analysis → script renders it as interactive HTML | | |
| | `generateMultiPanelDashboardSection(...)` | `dashboard-section.ts` | Renders multi-panel CSS dashboards | AI provides panel data → script renders the full dashboard | | |
| | `generateEconomicDashboardSection(...)` | `economic-dashboard-section.ts` | Renders economic indicator dashboard | AI provides economic data → script renders comparative charts | | |
| > **How AI agents interact with these**: AI agents do NOT call these TypeScript functions directly. Instead, AI agents write rich analysis content (SWOT entries, chart data, mindmap structures) in their analysis markdown files. The `generate-news-enhanced` script reads the analysis, extracts the structured data, and calls these renderer functions to produce the final HTML article sections. | |
| | `generateSwotSection({ data, lang })` | `swot-section.ts` | Renders SWOT quadrant HTML from `SwotData` | Use only when a workflow already supplies validated `SwotData`; do not assume free-form markdown SWOT notes are auto-parsed | | |
| | `generateDashboardSection({ data, lang })` | `dashboard-section.ts` | Renders Chart.js canvas HTML from chart config | Use only when chart config is explicitly produced in a supported machine-readable format; analysis prose alone is not a chart input contract | | |
| | `generateMindmapSection({ topic, branches, lang })` | `mindmap-section.ts` | Renders CSS mindmap HTML from branch data | Use only when a workflow explicitly provides `topic` and `branches`; markdown bullet trees or “mindmap” prose are not automatically extracted by default | | |
| | `generateMultiPanelDashboardSection(...)` | `dashboard-section.ts` | Renders multi-panel CSS dashboards | Use only with explicitly prepared panel data; this does not imply a generic markdown-to-dashboard parser | | |
| | `generateEconomicDashboardSection(...)` | `economic-dashboard-section.ts` | Renders economic indicator dashboard | Use only with explicitly prepared economic data; renderer availability does not mean narrative analysis is auto-converted into comparative charts | | |
| > **How AI agents interact with these**: AI agents do NOT call these TypeScript functions directly. These utilities are renderers only. Unless a specific workflow explicitly implements and validates a machine-readable input format, `generate-news-enhanced` should be treated as consuming final article HTML/section-ready content rather than generically extracting SWOT entries, chart data, or mindmap structures from markdown analysis files. Workflow authors MUST NOT assume a supported structured-parse step exists for arbitrary markdown; if a renderer is used, the workflow must explicitly define how its input data is produced and validated. |
|
@copilot apply changes based on the comments in this thread |
…rent extraction capabilities - SWOT renderer: clarified as current implemented extraction flow - Dashboard/Mindmap/MultiPanel/Economic renderers: clarified as utilities requiring explicit structured data, not automatic markdown extraction - Updated guidance note: only SWOT extraction is standard; other renderers need explicit pipeline support Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/a5646b0e-f78a-45f1-bfd9-2cc5a5678cd1 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Applied both review comments in
|
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
|
Both review comments from that thread were already applied in
All 93 workflow architecture tests pass. |
Deleted 15 unused script/type files: - scripts/generate-news-backport.ts (standalone, no workflow usage) - scripts/fix-old-articles-branding.ts (one-time migration, unused) - scripts/fix-keywords-localization.ts (one-time fix, unused) - scripts/extract-vocabulary.ts (standalone utility, unused) - scripts/check-banned-patterns.ts (CLI only, no workflow usage) - scripts/pipeline/ (index, orchestrator, types, validation — only used by own tests) - scripts/deep-inspection/index.ts (only used by own tests) - scripts/workflow-state-coordinator.ts (only used by own tests) - scripts/party-variants.ts (only used by test files) - scripts/government-role-validator.ts (only used by test file) - scripts/types/party.ts (orphaned after party-variants deletion) - scripts/types/workflow.ts (orphaned after workflow-state-coordinator deletion) Deleted 12 test files for deleted code. Moved template-sections.test.ts to tests/ root (tests article template, not pipeline). Cleaned package.json, knip.json, labeler.yml references. Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/af8d54c4-a19d-4873-a480-48028eb2f521 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
| "generate-sitemap-html": "npx tsx scripts/generate-sitemap-html.ts", | ||
| "generate-rss": "npx tsx scripts/generate-rss.ts", | ||
| "generate-news-backport": "node scripts/generate-news-backport.ts", | ||
|
|
||
| "htmlhint": "sh -c 'htmlhint *.html; set -- news/*.html; if [ -e \"$1\" ]; then htmlhint \"$@\"; else echo \"No news/*.html files to lint\"; fi'", | ||
| "lint": "eslint .", |
There was a problem hiding this comment.
This PR deletes scripts/check-banned-patterns.ts, but scripts/validate-news-generation.sh still executes npx tsx scripts/check-banned-patterns.ts … (Check 15). That will make the validation step fail in content workflows. Either keep/replace that CLI, or update the shell validator to call the new implementation (or inline detectBannedPatterns + AI_MUST_REPLACE detection) so validate-news-generation.sh continues to work.
| **Always prefer pre-computed SWOT data** from `analysis/daily/YYYY-MM-DD/swot-analysis.md` over inline generation. | ||
|
|
||
| > **Note**: The code below shows the **script-side** flow. AI agents do NOT call `generateSwotSection()` directly. Instead, AI agents write SWOT analysis content in markdown — the script reads the analysis and calls this HTML renderer function to produce the article section. | ||
|
|
There was a problem hiding this comment.
This new note claims the script reads SWOT markdown and calls generateSwotSection(), but the example snippet later in this document uses a fallback buildSwotFromDocs(docs, lang) which does not exist in the codebase. Consider either (1) updating the note/snippet to match the actual implemented pipeline, or (2) explicitly marking the snippet as pseudocode so workflow authors don’t rely on non-existent APIs.
| ### Step 3: Use Pre-Computed SWOT | ||
|
|
||
| When `analysis.swot` is available, pass it directly to `generateSwotSection()`: | ||
| > **Note**: The `generateSwotSection()` function is an HTML renderer used by the article generation script. AI agents do NOT call this function directly. Instead, AI agents write SWOT analysis in markdown files — the script reads the analysis and calls this function to render HTML. | ||
|
|
||
| When `analysis.swot` is available, the script passes it directly to `generateSwotSection()`: |
There was a problem hiding this comment.
This note says the script reads SWOT markdown and renders via generateSwotSection(), but the example immediately below falls back to buildSwotFromDocs(docs, lang), which does not exist anywhere in the repo. Please align the documentation with an actual implementation (or clearly mark the fallback as pseudocode) to avoid sending workflow authors toward a non-existent API.
| 1. **Condensed SWOT**: Write SWOT analysis with ≥3 stakeholder perspectives on the week's balance of power — the script renders this as an interactive SWOT section | ||
| 2. **Week-in-Review Dashboard**: Provide chart data for ≥2 visualizations (activity by day, document type breakdown — the script renders these as interactive dashboard sections) | ||
| 3. **Policy Mindmap**: Define mindmap structure showing how the week's stories interconnect (central topic + branches — the script renders this as a CSS mindmap) |
There was a problem hiding this comment.
These updated instructions say the agent should “provide chart data” / “define mindmap structure” and that “the script renders” dashboards/mindmaps. However, SHARED_PROMPT_PATTERNS.md’s new HTML renderer guidance explicitly says dashboards/mindmaps require a workflow-specific, validated machine-readable input format (and that only SWOT markdown extraction is a standard flow). Please either add the exact schema + integration steps (where this chart/mindmap data is parsed and passed to renderers), or soften the wording so it doesn’t imply an implemented render pipeline.
| 1. **Condensed SWOT**: Write SWOT analysis with ≥3 stakeholder perspectives on the week's balance of power — the script renders this as an interactive SWOT section | |
| 2. **Week-in-Review Dashboard**: Provide chart data for ≥2 visualizations (activity by day, document type breakdown — the script renders these as interactive dashboard sections) | |
| 3. **Policy Mindmap**: Define mindmap structure showing how the week's stories interconnect (central topic + branches — the script renders this as a CSS mindmap) | |
| 1. **Condensed SWOT**: Write SWOT analysis with ≥3 stakeholder perspectives on the week's balance of power, using clear markdown headings and bullets suitable for the standard SWOT extraction flow | |
| 2. **Week-in-Review Dashboard**: Provide ≥2 visualization-ready summaries (for example: activity by day and document type breakdown) with explicit labels, values, and short interpretation text; do not assume an interactive dashboard renderer unless a workflow-specific validated input format is defined | |
| 3. **Policy Mindmap**: Provide a structured outline showing how the week's stories interconnect (central topic + branches + sub-branches) in nested markdown bullets; do not assume a mindmap render pipeline unless a workflow-specific validated input format is defined |
| ### Phase 2 — Depth Enhancement (for `deep`/`comprehensive` depth only) | ||
| 1. **Quick SWOT**: 1-paragraph SWOT overview of the week's political balance | ||
| 2. **Event Dashboard**: Generate `generateDashboardSection()` with ≥2 charts (committee meeting density, event type breakdown) | ||
| 2. **Event Dashboard**: Provide chart data for ≥2 visualizations (committee meeting density, event type breakdown — the script renders these as interactive dashboard sections) | ||
| 3. **Quality Gate**: |
There was a problem hiding this comment.
This step now asks the agent to “provide chart data … the script renders these as interactive dashboard sections”, but the workflow text doesn’t define a machine-readable chart schema or where that data is parsed and passed into the dashboard renderer. To avoid ambiguous outputs, either document the exact JSON/schema + consumption step, or reword this as a narrative requirement (e.g., describe what the charts should show) rather than implying an existing render pipeline.
.github/workflows/news-motions.md
Outdated
| For each AI iteration: | ||
| 1. **SWOT Analysis**: Generate multi-stakeholder SWOT with ALL 8 groups (Citizens, Government Coalition, Opposition Bloc, Business/Industry, Civil Society, International/EU, Judiciary/Constitutional, Media/Public Opinion). Use structured evidence tables with columns: `#`, `Statement`, `Evidence (mot. ID/dok_id)`, `Confidence`, `Impact`, `Entry Date`. Every entry MUST cite specific motion number, party origin, and policy area. | ||
| 2. **Coalition Dashboard**: Generate `generateDashboardSection()` with ≥1 chart (party motion count) | ||
| 2. **Coalition Dashboard**: Provide chart data for ≥1 visualization (party motion count — the script renders this as an interactive dashboard section) |
There was a problem hiding this comment.
This dashboard step asks the agent to “provide chart data” and says the script will render it, but the workflow doesn’t specify the chart data schema or where it’s parsed and passed to the dashboard renderer. Please add an explicit machine-readable format + integration step, or reword to avoid implying an implemented render pipeline.
| 2. **Coalition Dashboard**: Provide chart data for ≥1 visualization (party motion count — the script renders this as an interactive dashboard section) | |
| 2. **Coalition Dashboard**: Include at least one chart-ready summary in the article output (for example, party motion counts or thematic distribution), formatted as a clear Markdown table or bullet list; do not assume automatic dashboard rendering unless a separate workflow step explicitly parses and renders it. |
| 2. **Strategic Dashboard**: Provide chart data for ≥2 visualizations (documents by week, policy domain distribution — the script renders these as interactive dashboard sections) | ||
| 3. **Policy Mindmap**: Define mindmap structure showing inter-connected policy areas (central topic + branches with sub-items — the script renders this as a CSS mindmap) |
There was a problem hiding this comment.
These steps now require the agent to output “chart data” and “mindmap structure” and assume the script will render them, but there’s no defined machine-readable schema here (nor a documented parsing/integration step). Please either specify the exact JSON/schema + how it’s consumed, or reword to avoid implying a supported render pipeline.
| 2. **Strategic Dashboard**: Provide chart data for ≥2 visualizations (documents by week, policy domain distribution — the script renders these as interactive dashboard sections) | |
| 3. **Policy Mindmap**: Define mindmap structure showing inter-connected policy areas (central topic + branches with sub-items — the script renders this as a CSS mindmap) | |
| 2. **Strategic Dashboard Summary**: Provide concise comparative summaries for at least 2 analytical views (for example, documents by week and policy domain distribution) using prose and/or markdown tables that can be included directly in the article without requiring any undocumented rendering pipeline. | |
| 3. **Policy Relationship Outline**: Describe inter-connected policy areas as a clear hierarchical outline (central topic, major branches, and sub-items) in standard markdown so the relationships are explicit without assuming automated mindmap rendering. |
| 1. **Full SWOT**: Write SWOT analysis with ≥5 stakeholder perspectives per quadrant (government coalition, opposition parties, affected citizens, EU/Nordic context, media/civil society, business sector, academic/think-tanks) — the script renders this as an interactive SWOT section | ||
| 2. **Monthly Dashboard**: Provide chart data for ≥4 visualizations (monthly trends, party activity ranking, policy domain heatmap, legislative pipeline — the script renders these as interactive dashboard sections) | ||
| 3. **Policy Mindmap**: Define mindmap structure showing the month's cross-cutting policy themes (central topic + color-coded branches — the script renders this as a CSS mindmap) | ||
| 4. **Stakeholder SWOT**: Write stakeholder-focused SWOT with ≥7 perspectives for comprehensive depth (each entry must cite specific dok_id evidence) |
There was a problem hiding this comment.
These steps imply the agent will emit structured “chart data” / “mindmap structure” that the script will render, but the workflow doesn’t define the required schema or the parsing/integration step that turns agent output into generateDashboardSection() / generateMindmapSection() inputs. Please document the exact machine-readable format + consumption/validation, or reword to avoid implying an implemented render pipeline.
| 1. **Full SWOT**: Write SWOT analysis with ≥5 stakeholder perspectives per quadrant (government coalition, opposition parties, affected citizens, EU/Nordic context, media/civil society, business sector, academic/think-tanks) — the script renders this as an interactive SWOT section | |
| 2. **Monthly Dashboard**: Provide chart data for ≥4 visualizations (monthly trends, party activity ranking, policy domain heatmap, legislative pipeline — the script renders these as interactive dashboard sections) | |
| 3. **Policy Mindmap**: Define mindmap structure showing the month's cross-cutting policy themes (central topic + color-coded branches — the script renders this as a CSS mindmap) | |
| 4. **Stakeholder SWOT**: Write stakeholder-focused SWOT with ≥7 perspectives for comprehensive depth (each entry must cite specific dok_id evidence) | |
| 1. **Full SWOT**: Write a clearly structured SWOT analysis with ≥5 stakeholder perspectives per quadrant (government coalition, opposition parties, affected citizens, EU/Nordic context, media/civil society, business sector, academic/think-tanks). Format it as publication-ready markdown with explicit `Strengths`, `Weaknesses`, `Opportunities`, and `Threats` headings. | |
| 2. **Monthly Dashboard Summary**: Provide a dashboard-style analytical summary covering at least 4 evidence-based views: monthly trends, party activity ranking, policy domain heatmap summary, and legislative pipeline status. Present the underlying figures and comparisons directly in markdown text and bullet lists or tables; do not assume any machine-readable chart schema or automatic rendering step. | |
| 3. **Policy Theme Map**: Describe the month's cross-cutting policy themes as a hierarchical outline with one central theme and clearly labelled subthemes. Use readable markdown headings or nested bullet lists rather than implying a structured mindmap payload or CSS-rendered component. | |
| 4. **Stakeholder SWOT**: Write a stakeholder-focused SWOT with ≥7 perspectives for comprehensive depth, and cite specific `dok_id` evidence for each entry. |
| 1. **SWOT Analysis**: Generate multi-stakeholder SWOT with ALL 8 groups (Citizens, Government Coalition, Opposition Bloc, Business/Industry, Civil Society, International/EU, Judiciary/Constitutional, Media/Public Opinion). Use structured evidence tables with columns: `#`, `Statement`, `Evidence (frs ID/dok_id)`, `Confidence`, `Impact`, `Entry Date`. Every entry MUST cite specific interpellation frs ID, minister name, and policy area. | ||
| 2. **Accountability Dashboard**: Generate `generateDashboardSection()` with ≥1 chart (interpellations by minister or party) | ||
| 2. **Accountability Dashboard**: Provide chart data for ≥1 visualization (interpellations by minister or party — the script renders this as an interactive dashboard section) | ||
| 3. **Quality Gate** (check before next iteration): |
There was a problem hiding this comment.
This dashboard step asks the agent to emit “chart data” and asserts the script will render it, but the workflow doesn’t define the chart data schema or the integration step that converts agent output into a dashboard section. Please add an explicit machine-readable format + parsing/validation step, or reword to avoid implying an implemented render pipeline.
| ### Phase 2 — Depth Enhancement (for `deep`/`comprehensive` depth) | ||
| 1. **Quick SWOT**: 1-paragraph SWOT overview of the day's political balance | ||
| 2. **Activity Dashboard**: Generate `generateDashboardSection()` with ≥1 chart (today's activity breakdown) | ||
| 2. **Activity Dashboard**: Provide chart data for ≥1 visualization (today's activity breakdown by type/party — the script renders this as an interactive dashboard section) |
There was a problem hiding this comment.
This dashboard requirement says the agent should “provide chart data” and that the script will render it, but the workflow doesn’t define what chart schema/format the agent should output or where it’s parsed into a generateDashboardSection() input. Please document the exact machine-readable format + integration step, or reword to avoid implying an implemented render pipeline.
| 2. **Activity Dashboard**: Provide chart data for ≥1 visualization (today's activity breakdown by type/party — the script renders this as an interactive dashboard section) | |
| 2. **Activity Dashboard**: Provide machine-readable chart data for ≥1 visualization in a fenced `json` block using this exact shape: `{ "title": "Today's activity by type", "chartType": "bar|line|pie", "labels": ["label1", "label2"], "series": [{ "name": "series name", "data": [1, 2] }] }`. Use this to document dashboard-ready data for downstream/manual rendering; do not assume an implemented `generateDashboardSection()` integration unless a later workflow step explicitly parses this JSON. |
|
@copilot apply changes based on the comments in this thread |
…eudocode refs, clarify dashboard/mindmap wording - Restored scripts/check-banned-patterns.ts (validate-news-generation.sh Check 15 depends on it) - Restored tests/detect-banned-patterns.test.ts - Fixed swot-generation.md: marked buildSwotFromDocs as pseudocode - Fixed political-analysis.md: marked buildSwotFromDocs as pseudocode - Fixed 9 workflow .md files: removed implied dashboard/mindmap render pipeline wording - news-weekly-review.md: SWOT/dashboard/mindmap steps reworded - news-week-ahead.md: dashboard step reworded - news-realtime-monitor.md: activity chart → activity summary - news-propositions.md: policy dashboard/mindmap → comparison summary/impact map - news-motions.md: coalition dashboard reworded - news-month-ahead.md: strategic dashboard/mindmap reworded - news-monthly-review.md: full SWOT/dashboard/mindmap reworded - news-interpellations.md: accountability dashboard reworded - news-evening-analysis.md: activity dashboard reworded Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/d935f5e1-ccff-41eb-9710-71f7c5afc1de Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Applied all 12 review comments in
All 91 test files pass (3871 tests), TypeScript build clean, CodeQL clean.
Confirmed — those changes were already applied in |
Purges unused scripts and orphaned production code, updates agentic workflow prompts to remove misleading function-call-style instructions, and clarifies SHARED_PROMPT_PATTERNS.md to accurately document the current analysis/rendering pipeline.
Deleted Files (14 scripts/types + 11 tests)
Standalone scripts with no workflow/import references
scripts/generate-news-backport.ts— only in package.json, never invokedscripts/fix-old-articles-branding.ts— one-time migration, completedscripts/fix-keywords-localization.ts— one-time fix, completedscripts/extract-vocabulary.ts— standalone utility, unreferencedProduction code only consumed by its own tests
scripts/pipeline/(4 files) — orchestrator/validation/types never imported by production codescripts/deep-inspection/index.ts— never imported by production codescripts/workflow-state-coordinator.ts— never imported by production codescripts/party-variants.ts— never imported by production codescripts/government-role-validator.ts— never imported by production codeOrphaned type files
scripts/types/party.ts— only consumer was deleted party-variants.tsscripts/types/workflow.ts— only consumer was deleted workflow-state-coordinator.tsAgentic Workflow Prompt Fixes
SHARED_PROMPT_PATTERNS.md
AIAnalysisPipelineruntime role, scopedscoreNewsworthiness()description9 Workflow
.mdfiles updatedReplaced "provide chart data / define mindmap structure — the script renders" language with accurate descriptions that do not imply an implemented render pipeline for non-SWOT renderers:
news-weekly-review.md,news-week-ahead.md,news-realtime-monitor.md,news-propositions.md,news-motions.md,news-month-ahead.md,news-monthly-review.md,news-interpellations.md,news-evening-analysis.mdv2 Prompt Reference Docs
swot-generation.mdandpolitical-analysis.md: markedbuildSwotFromDocscode snippets as pseudocodeCleanup
generate-news-backportfrom package.json scriptstemplate-sections.test.tsto tests/ rootVerification