Skip to content

Enforce 15-min analysis minimum, quality gate, and template compliance across all agentic workflows#1453

Merged
pethers merged 4 commits intomainfrom
copilot/improve-analysis-methods-templates
Mar 30, 2026
Merged

Enforce 15-min analysis minimum, quality gate, and template compliance across all agentic workflows#1453
pethers merged 4 commits intomainfrom
copilot/improve-analysis-methods-templates

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

PR #1452 produced plain-prose SWOT analysis with no structured tables, no Mermaid diagrams, no dok_id citations, and no template structure. Root cause: workflows allocated only 10 min for analysis, defaulted to standard depth (1-2 iterations), and had no blocking quality gate.

SHARED_PROMPT_PATTERNS.md

  • Added mandatory 15-minute minimum analysis time with enforcement rationale
  • Added quality gate bash script that blocks commit if analysis files lack Mermaid diagrams, color-coded style directives, or contain [REQUIRED] placeholders
  • Updated Standardised Analysis Depth Gate default from standarddeep

ai-driven-analysis-guide.md (v1.0 → v1.1)

All 11 news workflows

  • analysis_depth default: standarddeep across all workflows
  • Time budgets restructured: separate Download (3 min) from AI Analysis (15 min minimum) phases
  • 30-minute workflows (week-ahead, month-ahead, monthly-review) get 10-min minimum

All 8 analysis templates

  • Added anti-pattern warning block to each template referencing the methodology guide

Example quality gate check added to SHARED_PROMPT_PATTERNS:

# Check: Every analysis file must contain at least 1 Mermaid diagram
for f in "$ANALYSIS_DIR"/*.md; do
  MERMAID_COUNT=$(grep -c '```mermaid' "$f" 2>/dev/null || echo 0)
  if [ "$MERMAID_COUNT" -eq 0 ]; then
    echo "❌ FAIL: $f has NO Mermaid diagrams (minimum: 1)"
    QUALITY_PASS=false
  fi
done

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@github-actions github-actions bot added the size-xs Extra small change (< 10 lines) label Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: size-xs

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

…ements in SHARED_PROMPT_PATTERNS, ai-driven-analysis-guide, and news-realtime-monitor

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/d9709bf9-e994-4bc9-9bc5-1d498d61da9c

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions github-actions bot added documentation Documentation updates workflow GitHub Actions workflows ci-cd CI/CD pipeline changes news News articles and content generation agentic-workflow Agentic workflow changes size-l Large change (250-1000 lines) labels Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

…sis_depth default to deep, quality gate enforcement

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/d9709bf9-e994-4bc9-9bc5-1d498d61da9c

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copilot AI changed the title [WIP] Update analysis methods and templates for better compliance Enforce 15-min analysis minimum, quality gate, and template compliance across all agentic workflows Mar 30, 2026
Copilot AI requested a review from pethers March 30, 2026 01:10
@pethers pethers marked this pull request as ready for review March 30, 2026 01:10
Copilot AI review requested due to automatic review settings March 30, 2026 01:10
@pethers pethers merged commit 7438a98 into main Mar 30, 2026
14 checks passed
@pethers pethers deleted the copilot/improve-analysis-methods-templates branch March 30, 2026 01:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR strengthens the agentic news-analysis workflow guidance to prevent low-quality “plain prose” outputs by requiring longer analysis time, deeper default analysis depth, template compliance, and a pre-commit quality gate.

Changes:

  • Added anti-pattern warnings to all analysis templates and expanded the AI-driven analysis methodology with mandatory quality requirements and good/bad examples.
  • Updated news workflows to default analysis_depth to deep and restructured time budgets to reserve explicit analysis time.
  • Introduced a reusable “quality gate” bash check in SHARED_PROMPT_PATTERNS.md intended to block committing non-compliant analysis artifacts.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
analysis/templates/threat-analysis.md Adds anti-pattern warning requiring structured evidence, Mermaid, and template compliance.
analysis/templates/synthesis-summary.md Adds anti-pattern warning to enforce template-structured synthesis output.
analysis/templates/swot-analysis.md Adds detailed anti-pattern warning and points to SWOT.md exemplar.
analysis/templates/stakeholder-impact.md Adds anti-pattern warning to prevent plain-prose stakeholder output.
analysis/templates/significance-scoring.md Adds anti-pattern warning emphasizing tables/diagrams/evidence.
analysis/templates/risk-assessment.md Adds anti-pattern warning to enforce structured risk output.
analysis/templates/political-classification.md Adds anti-pattern warning to enforce classification template compliance.
analysis/templates/per-file-political-intelligence.md Adds anti-pattern warning for per-file analyses.
analysis/methodologies/ai-driven-analysis-guide.md Adds “Mandatory Quality Requirements” and expands bad-vs-good examples.
.github/workflows/news-weekly-review.md Sets default depth to deep, reworks time budget, and reinforces quality requirements.
.github/workflows/news-week-ahead.md Sets default depth to deep, reworks time budget, and updates depth gate table.
.github/workflows/news-realtime-monitor.md Sets default depth to deep, reworks phases to allocate 15 min analysis, and strengthens instructions.
.github/workflows/news-propositions.md Sets default depth to deep, reworks time budget, and updates depth gate table.
.github/workflows/news-motions.md Sets default depth to deep, reworks time budget, and updates depth gate table.
.github/workflows/news-monthly-review.md Reworks time budget and updates depth gate table/requirements.
.github/workflows/news-month-ahead.md Sets default depth to deep, reworks time budget, and updates depth gate table.
.github/workflows/news-interpellations.md Sets default depth to deep, reworks time budget, and updates depth gate table.
.github/workflows/news-evening-analysis.md Sets default depth to deep, reworks phases for 15 min analysis, and updates depth gate table.
.github/workflows/news-committee-reports.md Sets default depth to deep, reworks time budget, and updates depth gate table.
.github/workflows/news-article-generator.md Sets default depth to deep, reworks phases for 15 min analysis, and updates depth gate table.
.github/workflows/SHARED_PROMPT_PATTERNS.md Updates shared depth gate defaults and adds the reusable quality-gate bash check.

description: 'Analysis depth for AI iterations (standard=1-2 iterations, deep=2-3 iterations, comprehensive=3+ iterations). Controls SWOT complexity, stakeholder count, and dashboard charts.'
required: false
default: standard
default: deep
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow source .md sets analysis_depth default to deep, but the compiled .lock.yml still has analysis_depth.default: standard (so GitHub Actions will keep using standard). Regenerate and commit the updated lock file via gh aw compile so the new default (and any other frontmatter changes) actually take effect.

Suggested change
default: deep
default: standard

Copilot uses AI. Check for mistakes.
Comment on lines +466 to +474
| S1 | Coalition maintains working majority — AU10 vote showed standard party alignment with SD support | AU10 vote record (dok_id: H901AU10) | H | H | 2026-03-30 |
| S2 | Strong legislative output — 20+ propositions in March covering criminal justice and defense | Prop 2025/26:227, 213, 210 (criminal justice), Prop 2025/26:205 (food stockpile) | H | M | 2026-03-30 |

### ⚠️ Weaknesses — Government Coalition

| # | Weakness Statement | Evidence (dok_id) | Confidence | Impact | Entry Date |
|---|-------------------|-------------------|:----------:|:------:|:----------:|
| W1 | MP Marléne Lund Kopparklint leaving M party group signals internal dissent — narrows parliamentary arithmetic | Riksdag MP registry, party group change notice | H | M | 2026-03-30 |
| W2 | Minister Andreas Carlson (KD) under KU scrutiny for Lantmäteriet security failures — G7-8 complaint dockets | KU hearing agenda, dockets G7, G8 | H | H | 2026-03-30 |
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guide states confidence labels should be [HIGH]/[MEDIUM]/[LOW], but the “GOOD” example evidence tables use H/M (e.g., | ... | H | H |). Either update the requirement wording to allow H/M/L in tables (and define the mapping), or update the example to use the same confidence-label format the guide mandates.

Suggested change
| S1 | Coalition maintains working majority — AU10 vote showed standard party alignment with SD support | AU10 vote record (dok_id: H901AU10) | H | H | 2026-03-30 |
| S2 | Strong legislative output — 20+ propositions in March covering criminal justice and defense | Prop 2025/26:227, 213, 210 (criminal justice), Prop 2025/26:205 (food stockpile) | H | M | 2026-03-30 |
### ⚠️ Weaknesses — Government Coalition
| # | Weakness Statement | Evidence (dok_id) | Confidence | Impact | Entry Date |
|---|-------------------|-------------------|:----------:|:------:|:----------:|
| W1 | MP Marléne Lund Kopparklint leaving M party group signals internal dissent — narrows parliamentary arithmetic | Riksdag MP registry, party group change notice | H | M | 2026-03-30 |
| W2 | Minister Andreas Carlson (KD) under KU scrutiny for Lantmäteriet security failures — G7-8 complaint dockets | KU hearing agenda, dockets G7, G8 | H | H | 2026-03-30 |
| S1 | Coalition maintains working majority — AU10 vote showed standard party alignment with SD support | AU10 vote record (dok_id: H901AU10) | [HIGH] | [HIGH] | 2026-03-30 |
| S2 | Strong legislative output — 20+ propositions in March covering criminal justice and defense | Prop 2025/26:227, 213, 210 (criminal justice), Prop 2025/26:205 (food stockpile) | [HIGH] | [MEDIUM] | 2026-03-30 |
### ⚠️ Weaknesses — Government Coalition
| # | Weakness Statement | Evidence (dok_id) | Confidence | Impact | Entry Date |
|---|-------------------|-------------------|:----------:|:------:|:----------:|
| W1 | MP Marléne Lund Kopparklint leaving M party group signals internal dissent — narrows parliamentary arithmetic | Riksdag MP registry, party group change notice | [HIGH] | [MEDIUM] | 2026-03-30 |
| W2 | Minister Andreas Carlson (KD) under KU scrutiny for Lantmäteriet security failures — G7-8 complaint dockets | KU hearing agenda, dockets G7, G8 | [HIGH] | [HIGH] | 2026-03-30 |

Copilot uses AI. Check for mistakes.
description: 'Analysis depth for AI iterations (standard=1-2 iterations, deep=2-3 iterations, comprehensive=3+ iterations). Controls SWOT complexity, stakeholder count, and dashboard charts.'
required: false
default: standard
default: deep
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow source .md sets analysis_depth default to deep, but the compiled .lock.yml still has analysis_depth.default: standard (so GitHub Actions will keep using standard). Regenerate and commit the updated lock file via gh aw compile so the new default (and any other frontmatter changes) actually take effect.

Suggested change
default: deep
default: standard

Copilot uses AI. Check for mistakes.
description: 'Analysis depth for AI iterations (standard=1-2 iterations, deep=2-3 iterations, comprehensive=3+ iterations). Controls SWOT complexity, stakeholder count, and dashboard charts.'
required: false
default: standard
default: deep
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow source .md sets analysis_depth default to deep, but the compiled .lock.yml still has analysis_depth.default: standard (so GitHub Actions will keep using standard). Regenerate and commit the updated lock file via gh aw compile so the new default (and any other frontmatter changes) actually take effect.

Suggested change
default: deep
default: standard

Copilot uses AI. Check for mistakes.
Comment on lines 31 to +34
analysis_depth:
description: 'Analysis depth for AI iterations (standard=1-2 iterations, deep=2-3 iterations, comprehensive=3+ iterations). Controls SWOT complexity, stakeholder count, and dashboard charts.'
description: 'Analysis depth for AI iterations (standard=1-2 iterations, deep=2-3 iterations, comprehensive=3+ iterations). Controls SWOT complexity, stakeholder count, and dashboard charts. Default: deep (minimum 15 min analysis, Mermaid diagrams required).'
required: false
default: standard
default: deep
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow source .md sets analysis_depth default to deep, but the compiled .lock.yml still has analysis_depth.default: standard (so GitHub Actions will keep using standard). Regenerate and commit the updated lock file via gh aw compile so the new default (and any other frontmatter changes) actually take effect.

Copilot uses AI. Check for mistakes.
description: 'Analysis depth for AI iterations (standard=1-2 iterations, deep=2-3 iterations, comprehensive=3+ iterations). Controls SWOT complexity, stakeholder count, and dashboard charts.'
required: false
default: standard
default: deep
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow source .md sets analysis_depth default to deep, but the compiled .lock.yml still has analysis_depth.default: standard (so GitHub Actions will keep using standard). Regenerate and commit the updated lock file via gh aw compile so the new default (and any other frontmatter changes) actually take effect.

Suggested change
default: deep
default: standard

Copilot uses AI. Check for mistakes.
description: 'Analysis depth for AI iterations (standard=1-2 iterations, deep=2-3 iterations, comprehensive=3+ iterations). Controls SWOT complexity, stakeholder count, and dashboard charts.'
required: false
default: standard
default: deep
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow source .md sets analysis_depth default to deep, but the compiled .lock.yml still has analysis_depth.default: standard (so GitHub Actions will keep using standard). Regenerate and commit the updated lock file via gh aw compile so the new default (and any other frontmatter changes) actually take effect.

Suggested change
default: deep
default: standard

Copilot uses AI. Check for mistakes.
Comment on lines +216 to +223
# Check 3: No [REQUIRED] placeholders remaining
for f in "$ANALYSIS_DIR"/*.md; do
[ ! -f "$f" ] && continue
REQ_COUNT=$(grep -c '\[REQUIRED\]' "$f" 2>/dev/null || echo 0)
if [ "$REQ_COUNT" -gt 0 ]; then
echo "❌ FAIL: $f has $REQ_COUNT unfilled [REQUIRED] placeholders"
QUALITY_PASS=false
fi
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quality requirements mention zero placeholders, but the quality gate only checks for [REQUIRED] and never flags remaining [OPTIONAL] placeholders. Consider adding a corresponding [OPTIONAL] check so the gate enforces the stated “No placeholders” rule consistently.

Suggested change
# Check 3: No [REQUIRED] placeholders remaining
for f in "$ANALYSIS_DIR"/*.md; do
[ ! -f "$f" ] && continue
REQ_COUNT=$(grep -c '\[REQUIRED\]' "$f" 2>/dev/null || echo 0)
if [ "$REQ_COUNT" -gt 0 ]; then
echo "❌ FAIL: $f has $REQ_COUNT unfilled [REQUIRED] placeholders"
QUALITY_PASS=false
fi
# Check 3: No [REQUIRED] or [OPTIONAL] placeholders remaining
for f in "$ANALYSIS_DIR"/*.md; do
[ ! -f "$f" ] && continue
REQ_COUNT=$(grep -c '\[REQUIRED\]' "$f" 2>/dev/null || echo 0)
OPT_COUNT=$(grep -c '\[OPTIONAL\]' "$f" 2>/dev/null || echo 0)
if [ "$REQ_COUNT" -gt 0 ]; then
echo "❌ FAIL: $f has $REQ_COUNT unfilled [REQUIRED] placeholders"
QUALITY_PASS=false
fi
if [ "$OPT_COUNT" -gt 0 ]; then
echo "❌ FAIL: $f has $OPT_COUNT unfilled [OPTIONAL] placeholders"
QUALITY_PASS=false
fi

Copilot uses AI. Check for mistakes.
description: 'Analysis depth for AI iterations (standard=1-2 iterations, deep=2-3 iterations, comprehensive=3+ iterations). Controls SWOT complexity, stakeholder count, and dashboard charts.'
required: false
default: standard
default: deep
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow source .md sets analysis_depth default to deep, but the compiled .lock.yml still has analysis_depth.default: standard (so GitHub Actions will keep using standard). Regenerate and commit the updated lock file via gh aw compile so the new default (and any other frontmatter changes) actually take effect.

Suggested change
default: deep
default: standard

Copilot uses AI. Check for mistakes.
description: 'Analysis depth for AI iterations (standard=1-2 iterations, deep=2-3 iterations, comprehensive=3+ iterations). Controls SWOT complexity, stakeholder count, and dashboard charts.'
required: false
default: standard
default: deep
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow source .md sets analysis_depth default to deep, but the compiled .lock.yml still has analysis_depth.default: standard (so GitHub Actions will keep using standard). Regenerate and commit the updated lock file via gh aw compile so the new default (and any other frontmatter changes) actually take effect.

Suggested change
default: deep
default: standard

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentic-workflow Agentic workflow changes ci-cd CI/CD pipeline changes documentation Documentation updates news News articles and content generation size-l Large change (250-1000 lines) size-xs Extra small change (< 10 lines) workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants