Skip to content

Commit 4138470

Browse files
authored
Merge pull request #1995 from Hack23/copilot/improve-agentic-workflows-integration
Purge legacy JS/dashboard modules, raise coverage to ISMS floor, link TypeDoc from English site
2 parents 2a48dcc + a098077 commit 4138470

74 files changed

Lines changed: 690 additions & 18067 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/prompts/00-base-contract.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You are a **Political Analyst, Intelligence Operative and OSINT Specialist** for
88

99
| # | Rule |
1010
|---|------|
11-
| 1 | Use **only public** primary sources (Riksdagen API, Regeringen, SCB, World Bank, IMF). No hacked, leaked, or private personal data. |
11+
| 1 | Use **only public** primary sources (Riksdagen API, Regeringen, SCB, Statskontoret, World Bank, IMF). No hacked, leaked, or private personal data. |
1212
| 2 | **Neutrality**: equal treatment of all parties. Document methodology and uncertainty. |
1313
| 3 | Every claim cites a primary source: `dok_id`, vote counts, named actor, or source URL. Generic claims are rejected. |
1414
| 4 | Political opinions are **GDPR Art. 9 special category** → lawful bases 9(2)(e) publicly made, 9(2)(g) substantial public interest. Apply data minimisation and purpose limitation. |
@@ -24,13 +24,14 @@ You are a **Political Analyst, Intelligence Operative and OSINT Specialist** for
2424
- Templates → [`analysis/templates/`](../../analysis/templates/)
2525
- MCP config → [`.github/copilot-mcp.json`](../copilot-mcp.json)
2626
- ISMS policies → [Hack23 ISMS-PUBLIC](https://github.com/Hack23/ISMS-PUBLIC)
27+
- Article-generation architecture → [`Article-Generation.md`](../../Article-Generation.md) (workflow → analysis artifacts → `article.md` → HTML/SEO/UI export/deployment)
2728
- gh-aw runtime (v0.69.3): [abridged docs](https://github.github.com/gh-aw/llms-small.txt) · [complete docs](https://github.github.com/gh-aw/llms-full.txt) · [agentic-workflows blog](https://github.github.com/gh-aw/_llms-txt/agentic-workflows.txt)
2829

2930
## Required reading before Pass 1
3031

3132
Before producing any analysis or article content, the agent MUST have read:
3233

33-
1. This module (`00-base-contract.md`) and every imported sibling module for the workflow.
34+
1. This module (`00-base-contract.md`), every imported sibling module for the workflow, and [`Article-Generation.md`](../../Article-Generation.md) for the end-to-end dissemination contract.
3435
2. [`analysis/methodologies/ai-driven-analysis-guide.md`](../../analysis/methodologies/ai-driven-analysis-guide.md) — DIW weighting, tier depths, Pass 1 / Pass 2 rules.
3536
3. [`analysis/methodologies/osint-tradecraft-standards.md`](../../analysis/methodologies/osint-tradecraft-standards.md)**tradecraft canon**: ICD 203 (9 standards), Admiralty Code (`[A-F][1-6]` → 5-level confidence), WEP / Kent Scale (7 bands with EN + SV phrasing, 4 horizons), SAT catalog (≥ 10 techniques attested in `methodology-reflection.md`), OSINT ethics (GDPR Art. 9 / Offentlighetsprincipen), DIW–Admiralty reconciliation, PIR handoff (standing PIR-1…7 + Tier-C continuity contract). Every evidence citation, every confidence marker, and every `methodology-reflection.md §ICD 203 audit` derives from this document.
3637
4. Every template file referenced by `04-analysis-pipeline.md` — the **23 always-on artifacts** spanning Family A (Core Synthesis, 9 files incl. `executive-brief.md`), Family B (Structural Metadata, 2 files), Family C (Strategic Extensions — F3EAD Exploit→Analyze, 5 files incl. `methodology-reflection.md` ⭐), Family D (Electoral & Domain Lenses — F3EAD Analyze-continued, 7 files), plus Family E (per-document `{dok_id}-analysis.md`). Tier-C workflows additionally apply the period-scope multipliers and cross-type synthesis rules in `ext/tier-c-aggregation.md` — they do **not** add new files (all 23 are mandatory for every workflow).

.github/prompts/02-mcp-access.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Rules:
6767
- **Authoritative inventory**: [`analysis/imf/indicators-inventory.json`](../../analysis/imf/indicators-inventory.json) (machine-readable) · [`analysis/imf/data-dictionary.md`](../../analysis/imf/data-dictionary.md) (dataflow reference) · [`analysis/imf/agentic-integration.md`](../../analysis/imf/agentic-integration.md) (7-step playbook) · [`analysis/imf/indicator-policy-mapping.md`](../../analysis/imf/indicator-policy-mapping.md) (committee matrix).
6868
- **Contract**: [`.github/aw/ECONOMIC_DATA_CONTRACT.md`](../aw/ECONOMIC_DATA_CONTRACT.md) v2.1+.
6969
- **Firewall egress**: `data.imf.org`, `api.imf.org`, `www.imf.org` (already in every workflow's `network.allowed`).
70+
- **Statskontoret egress**: `www.statskontoret.se` / `statskontoret.se` are public non-MCP web sources used for agency capacity, state-governance evaluations, implementation feasibility, administrative burden and public-sector efficiency evidence.
7071

7172
## Health gate (in-prompt)
7273

@@ -83,6 +84,7 @@ Run once at workflow start, then proceed — do not loop forever.
8384
|------|
8485
| Riksdag tool arguments are documented under [`.github/skills/riksdag-regering-mcp/`](../skills/riksdag-regering-mcp/). |
8586
| **Economic data is IMF-first**. Only use `get-economic-data` (world-bank MCP) for articles written pre-2026-04-20 or as an explicit legacy fallback — **never** as a primary source in new articles. |
87+
| **Statskontoret is a public non-MCP source** for Swedish agency governance, administrative capacity, implementation feasibility and public-sector efficiency. Use `web_fetch` / primary URLs where available, cite report title + URL, and record retrieval in `data-download-manifest.md`. |
8688
| Treat MCP failure mid-run as partial data: continue with what you have, document gaps in `data-download-manifest.md`, never silently drop documents. |
8789
| Source authority and no-fabrication rule: see `00-base-contract.md` rules 1 + 3. |
8890

.github/prompts/03-data-download.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ Then `npx tsx scripts/catalog-downloaded-data.ts --pending-only` to produce the
9090

9191
For every downloaded document reference, fetch full text when available (`get_dokument_innehall` with `include_full_text: true` on riksdag-regering). Documents without full text are allowed but must be tagged `metadata-only` in the manifest.
9292

93+
## Statskontoret enrichment
94+
95+
When a document affects an implementing authority, administrative capacity, regulatory burden, governance quality, public-sector efficiency, inspection/audit capacity, or inter-agency coordination, collect at least one relevant public Statskontoret source if available. Use `web_fetch` against `https://www.statskontoret.se/` or `https://statskontoret.se/`, cite the report/page URL, and record it in `data-download-manifest.md` under Cross-Source Enrichment. If no relevant Statskontoret source exists, state `Statskontoret: no directly relevant source found` rather than fabricating agency-capacity evidence.
96+
9397
## Lookback fallback
9498

9599
If the requested `$ARTICLE_DATE` returns zero documents, loop `DAYS_BACK = 1..7`:
@@ -108,6 +112,7 @@ Always produce `analysis/daily/$ARTICLE_DATE/$SUBFOLDER/data-download-manifest.m
108112
- Requested date, effective date (after lookback), window used.
109113
- Per-document table: `dok_id`, title, type, `hangar_id`, committee, retrieval timestamp, full-text status.
110114
- MCP server availability notes (any retries, partial failures).
115+
- Non-MCP public sources used for enrichment, especially Statskontoret report/page URLs for implementation and agency-capacity evidence.
111116

112117
## Next step
113118

.github/prompts/04-analysis-pipeline.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Authoritative methodology & templates:
66

77
- **Read-me-first**[`analysis/methodologies/artifact-catalog.md`](../../analysis/methodologies/artifact-catalog.md) (single source of truth for every artifact — family, template, depth floor, Mermaid type, MCP data source, gate check) and [`analysis/methodologies/per-artifact-methodologies.md`](../../analysis/methodologies/per-artifact-methodologies.md) (Inputs / Analytic-moves / Evidence-rules / Anti-patterns per artifact). Open these before any framework-specific methodology.
88
- Methodology → [`analysis/methodologies/ai-driven-analysis-guide.md`](../../analysis/methodologies/ai-driven-analysis-guide.md) (DIW weighting, tier depths, Pass 1/Pass 2 rules, F3EAD mapping)
9-
- Indicator maps → [`imf-indicator-mapping.md`](../../analysis/methodologies/imf-indicator-mapping.md) (**PRIMARY — authoritative for all economic / fiscal / monetary / external-sector / trade context with vintage-tagged WEO+FM projections**) + [`worldbank-indicator-mapping.md`](../../analysis/methodologies/worldbank-indicator-mapping.md) (non-economic residue only: governance WGI, environment, social / education participation, defence historicals, crime / justice). WB economic codes are **deprecated** — see the scope notice in `worldbank-indicator-mapping.md` and `analysis/imf/indicators-inventory.json → deprecationPolicy`.
9+
- Indicator maps → [`imf-indicator-mapping.md`](../../analysis/methodologies/imf-indicator-mapping.md) (**PRIMARY — authoritative for all economic / fiscal / monetary / external-sector / trade context with vintage-tagged WEO+FM projections**) + [`worldbank-indicator-mapping.md`](../../analysis/methodologies/worldbank-indicator-mapping.md) (non-economic residue only: governance WGI, environment, social / education participation, defence historicals, crime / justice). WB economic codes are **deprecated** — see the scope notice in `worldbank-indicator-mapping.md` and `analysis/imf/indicators-inventory.json → deprecationPolicy`. Statskontoret is the preferred Swedish public-sector governance / agency-capacity overlay for implementation feasibility and administrative-burden claims.
1010
- Depth floors → [`reference-quality-thresholds.json`](../../analysis/methodologies/reference-quality-thresholds.json) (per-article-type × per-artifact line floors + tradecraft signals consumed by Pass-2 self-audit)
1111
- Supporting frameworks → [`political-classification-guide.md`](../../analysis/methodologies/political-classification-guide.md), [`political-swot-framework.md`](../../analysis/methodologies/political-swot-framework.md), [`political-risk-methodology.md`](../../analysis/methodologies/political-risk-methodology.md), [`political-threat-framework.md`](../../analysis/methodologies/political-threat-framework.md), [`synthesis-methodology.md`](../../analysis/methodologies/synthesis-methodology.md), [`strategic-extensions-methodology.md`](../../analysis/methodologies/strategic-extensions-methodology.md), [`electoral-domain-methodology.md`](../../analysis/methodologies/electoral-domain-methodology.md), [`structural-metadata-methodology.md`](../../analysis/methodologies/structural-metadata-methodology.md), [`per-document-methodology.md`](../../analysis/methodologies/per-document-methodology.md), [`political-style-guide.md`](../../analysis/methodologies/political-style-guide.md), [`osint-tradecraft-standards.md`](../../analysis/methodologies/osint-tradecraft-standards.md) — **tradecraft canon: ICD 203 + Admiralty + WEP + SAT catalog + OSINT ethics + DIW alignment + PIR handoff**
1212
- Templates → [`analysis/templates/*.md`](../../analysis/templates/) (one file per artifact — 23 always-on + per-document + 7 operational supplementary)
@@ -123,7 +123,7 @@ Aggregation (Tier-C) workflows apply the period-scope multiplier from `ext/tier-
123123

124124
## Evidence standard
125125

126-
Every analytical claim must cite at least one of: a real `dok_id` (e.g. `H901FiU1`) resolvable via `get_dokument`; a named MP / minister / party with role; vote counts from `get_voteringar`; or a primary-source URL (riksdagen.se, regeringen.se, scb.se, worldbank.org, data.imf.org). Annotate each evidence row with an **Admiralty Code** `[A–F][1–6]`. Apply the **Source Diversity Rule** — P0/P1 claims require ≥ 3 independent sources; single-source claims must be flagged `[unconfirmed]` (Pass-2 improvement target). Generic phrasing without evidence is rejected at the gate (`05-analysis-gate.md` check 4 and its Family-C/D extensions).
126+
Every analytical claim must cite at least one of: a real `dok_id` (e.g. `H901FiU1`) resolvable via `get_dokument`; a named MP / minister / party with role; vote counts from `get_voteringar`; or a primary-source URL (riksdagen.se, regeringen.se, scb.se, statskontoret.se, worldbank.org, api.imf.org, data.imf.org, www.imf.org). Annotate each evidence row with an **Admiralty Code** `[A–F][1–6]`. Apply the **Source Diversity Rule** — P0/P1 claims require ≥ 3 independent sources; single-source claims must be flagged `[unconfirmed]` (Pass-2 improvement target). Generic phrasing without evidence is rejected at the gate (`05-analysis-gate.md` check 4 and its Family-C/D extensions).
127127

128128
## Economic context
129129

@@ -140,6 +140,10 @@ All economic / fiscal / monetary / external-sector / trade / COFOG / commodity /
140140

141141
Chart.js specs live in the [Economic Data Contract](../aw/ECONOMIC_DATA_CONTRACT.md) — follow it exactly. Produce at least one economic chart data file (`economic-data.json`) per article that has an economic-context section.
142142

143+
## Statskontoret governance / implementation overlay
144+
145+
Statskontoret is the Swedish public-management source for agency capacity, administrative burden, governance effectiveness, inter-agency coordination, implementation backlogs and public-sector efficiency. When a document assigns work to an authority or depends on administrative delivery, integrate Statskontoret evidence into `implementation-feasibility.md`, `stakeholder-perspectives.md`, `risk-assessment.md`, `comparative-international.md` and `methodology-reflection.md`. Record source URL, report/page title, publication date, retrieval time and Admiralty grade in `data-download-manifest.md`; cite it as a public URL in analysis rows.
146+
143147
Full IMF integration reference: [`analysis/imf/README.md`](../../analysis/imf/README.md) · [`analysis/imf/agentic-integration.md`](../../analysis/imf/agentic-integration.md) (7-step playbook) · [`analysis/imf/data-dictionary.md`](../../analysis/imf/data-dictionary.md).
144148

145149
## Visualisation data

.github/prompts/05-analysis-gate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This is the **only** gate separating analysis from article generation. If it fai
1717
- **Family D (7)**`election-2026-analysis.md`, `voter-segmentation.md`, `coalition-mathematics.md`, `historical-parallels.md`, `media-framing-analysis.md`, `implementation-feasibility.md`, `forward-indicators.md`.
1818
2. **Per-document coverage (Family E)**`$ANALYSIS_DIR/documents/` contains one `.md` per `dok_id` listed in `data-download-manifest.md` (metadata-only documents are tagged, not skipped).
1919
3. **No stubs** — zero occurrences of `AI_MUST_REPLACE`, `[REQUIRED]`, `TODO:`, or `Lorem ipsum` across all artifacts.
20-
4. **Evidence citations**`swot-analysis.md` and `significance-scoring.md` contain at least one piece of primary-source evidence per quadrant / ranked item. Accepted evidence patterns: a `dok_id` (e.g. `H901FiU1`, `HD01CU27`) **or** a primary-source URL host (`riksdagen.se`, `regeringen.se`, `scb.se`, `worldbank.org`, `api.imf.org`, `data.imf.org`, `www.imf.org`). Enforced against SWOT `### Strengths/Weaknesses/Opportunities/Threats` sections (bullets + table rows) and significance-scoring bullets **plus** ranking table rows and Mermaid node labels.
20+
4. **Evidence citations**`swot-analysis.md` and `significance-scoring.md` contain at least one piece of primary-source evidence per quadrant / ranked item. Accepted evidence patterns: a `dok_id` (e.g. `H901FiU1`, `HD01CU27`) **or** a primary-source URL host (`riksdagen.se`, `regeringen.se`, `scb.se`, `statskontoret.se`, `worldbank.org`, `api.imf.org`, `data.imf.org`, `www.imf.org`). Enforced against SWOT `### Strengths/Weaknesses/Opportunities/Threats` sections (bullets + table rows) and significance-scoring bullets **plus** ranking table rows and Mermaid node labels.
2121
5. **Mermaid diagrams** — every Family A and Family D synthesis file contains ≥ 1 Mermaid diagram with colour-coded `style` directives (or `themeVariables` / `%%{init …}` block).
2222
6. **Pass-2 done** — agent has read back each enforced Pass-2 artifact after creation and committed improvements: all Family A, B, C, and D artifacts except `data-download-manifest.md`. (Enforced by file mtime diff: final file mtime > creation time + 3 min, OR two git-history snapshots on disk.)
2323
7. **Family C structure checks** (extension-quality gate):
@@ -59,7 +59,7 @@ SYNTHESIS=(synthesis-summary.md swot-analysis.md risk-assessment.md threat-analy
5959
media-framing-analysis.md implementation-feasibility.md \
6060
forward-indicators.md)
6161
DOK_RE='[Hh][A-Za-z0-9]{3,}[0-9]+'
62-
EVIDENCE_RE='[Hh][A-Za-z0-9]{3,}[0-9]+|riksdagen\.se|regeringen\.se|scb\.se|worldbank\.org|api\.imf\.org|data\.imf\.org|www\.imf\.org'
62+
EVIDENCE_RE='[Hh][A-Za-z0-9]{3,}[0-9]+|riksdagen\.se|regeringen\.se|scb\.se|statskontoret\.se|worldbank\.org|api\.imf\.org|data\.imf\.org|www\.imf\.org'
6363
FAIL=0
6464
6565
# Check 1 — artifact existence (all 23)

.github/prompts/06-article-generation.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 06 — Article Generation (aggregate + render)
22

3-
Articles are **100 % rendered from the analysis artifacts** produced in module `04-analysis-pipeline.md`. No AI-written HTML. No scaffold. No `AI_MUST_REPLACE` markers. The analysis folder is the article — the renderer just turns it into a chrome-wrapped HTML page.
3+
Articles are **100 % rendered from the analysis artifacts** produced in module `04-analysis-pipeline.md`. No AI-written HTML. No scaffold. No `AI_MUST_REPLACE` markers. The analysis folder is the article — the renderer just turns it into a chrome-wrapped HTML page. Read [`Article-Generation.md`](../../Article-Generation.md) as the end-to-end architecture and UI/UX export map for this phase.
44

55
## Preconditions
66

@@ -123,14 +123,16 @@ All of those checks were artefacts of the old scaffold pipeline. With the aggreg
123123

124124
The renderer embeds:
125125

126-
- `<title>` = aggregated article title (H1 of `executive-brief.md`).
127-
- `<meta name="description">` = first paragraph of `executive-brief.md` (≤ 300 chars).
126+
- `<title>` = aggregated article title (H1 of `executive-brief.md`), rewritten to satisfy [`seo-metadata-contract.md`](seo-metadata-contract.md): 55–70 characters, actor-first, active news verb, no literal date, no boilerplate.
127+
- `<meta name="description">` = first BLUF paragraph of `executive-brief.md`, rewritten to satisfy [`seo-metadata-contract.md`](seo-metadata-contract.md): 140–200 characters, one complete sentence, concrete actor/number/instrument, no admin metadata.
128128
- `<link rel="canonical">` + `<link rel="alternate" hreflang="…">` × all requested languages + `x-default`.
129129
- Open Graph (`og:type=article`), Twitter summary card.
130130
- JSON-LD `NewsArticle` with `isBasedOn` listing every source `.md` / `.json` artifact on GitHub — the article is self-documenting.
131131
- Cyberpunk site header with skip-link, nav (Home, Political Intelligence, Sitemap), and language switcher.
132132
- Footer with: brand, navigation, direct link to `analysis/daily/` and the repo root on GitHub, Apache-2.0 + GDPR Art 9(2)(e,g) notice, client-side Mermaid loader (`js/lib/mermaid-init.mjs`).
133133

134+
Before staging, read the generated `article.md` once and verify it reads as a coherent political-intelligence article, not an artifact dump: BLUF first, Key Judgments early, concrete evidence density, IMF-first economic provenance where applicable, Statskontoret agency-capacity evidence where applicable, and source links in every high-impact claim.
135+
134136
## Translations
135137

136138
Article translation remains a **separate workflow**: `news-translate` consumes published English + Swedish articles and produces the remaining twelve language variants. Per-type analysis workflows must not attempt to render the other twelve languages themselves.

0 commit comments

Comments
 (0)