Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/prompts/00-base-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You are a **Political Analyst, Intelligence Operative and OSINT Specialist** for

| # | Rule |
|---|------|
| 1 | Use **only public** primary sources (Riksdagen API, Regeringen, SCB, World Bank, IMF). No hacked, leaked, or private personal data. |
| 1 | Use **only public** primary sources (Riksdagen API, Regeringen, SCB, Statskontoret, World Bank, IMF). No hacked, leaked, or private personal data. |
| 2 | **Neutrality**: equal treatment of all parties. Document methodology and uncertainty. |
| 3 | Every claim cites a primary source: `dok_id`, vote counts, named actor, or source URL. Generic claims are rejected. |
| 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. |
Expand All @@ -24,13 +24,14 @@ You are a **Political Analyst, Intelligence Operative and OSINT Specialist** for
- Templates → [`analysis/templates/`](../../analysis/templates/)
- MCP config → [`.github/copilot-mcp.json`](../copilot-mcp.json)
- ISMS policies → [Hack23 ISMS-PUBLIC](https://github.com/Hack23/ISMS-PUBLIC)
- Article-generation architecture → [`Article-Generation.md`](../../Article-Generation.md) (workflow → analysis artifacts → `article.md` → HTML/SEO/UI export/deployment)
- 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)

## Required reading before Pass 1

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

1. This module (`00-base-contract.md`) and every imported sibling module for the workflow.
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.
2. [`analysis/methodologies/ai-driven-analysis-guide.md`](../../analysis/methodologies/ai-driven-analysis-guide.md) — DIW weighting, tier depths, Pass 1 / Pass 2 rules.
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.
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).
Expand Down
2 changes: 2 additions & 0 deletions .github/prompts/02-mcp-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Rules:
- **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).
- **Contract**: [`.github/aw/ECONOMIC_DATA_CONTRACT.md`](../aw/ECONOMIC_DATA_CONTRACT.md) v2.1+.
- **Firewall egress**: `data.imf.org`, `api.imf.org`, `www.imf.org` (already in every workflow's `network.allowed`).
- **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.

## Health gate (in-prompt)

Expand All @@ -83,6 +84,7 @@ Run once at workflow start, then proceed — do not loop forever.
|------|
| Riksdag tool arguments are documented under [`.github/skills/riksdag-regering-mcp/`](../skills/riksdag-regering-mcp/). |
| **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. |
| **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`. |
| Treat MCP failure mid-run as partial data: continue with what you have, document gaps in `data-download-manifest.md`, never silently drop documents. |
| Source authority and no-fabrication rule: see `00-base-contract.md` rules 1 + 3. |

Expand Down
5 changes: 5 additions & 0 deletions .github/prompts/03-data-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ Then `npx tsx scripts/catalog-downloaded-data.ts --pending-only` to produce the

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.

## Statskontoret enrichment

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.

## Lookback fallback

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

## Next step

Expand Down
8 changes: 6 additions & 2 deletions .github/prompts/04-analysis-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Authoritative methodology & templates:

- **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.
- 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)
- 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`.
- 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.
- 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)
- 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**
- Templates → [`analysis/templates/*.md`](../../analysis/templates/) (one file per artifact — 23 always-on + per-document + 7 operational supplementary)
Expand Down Expand Up @@ -123,7 +123,7 @@ Aggregation (Tier-C) workflows apply the period-scope multiplier from `ext/tier-

## Evidence standard

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).
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).

## Economic context

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

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.

## Statskontoret governance / implementation overlay

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.

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).

## Visualisation data
Expand Down
4 changes: 2 additions & 2 deletions .github/prompts/05-analysis-gate.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This is the **only** gate separating analysis from article generation. If it fai
- **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`.
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).
3. **No stubs** — zero occurrences of `AI_MUST_REPLACE`, `[REQUIRED]`, `TODO:`, or `Lorem ipsum` across all artifacts.
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.
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.
5. **Mermaid diagrams** — every Family A and Family D synthesis file contains ≥ 1 Mermaid diagram with colour-coded `style` directives (or `themeVariables` / `%%{init …}` block).
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.)
7. **Family C structure checks** (extension-quality gate):
Expand Down Expand Up @@ -59,7 +59,7 @@ SYNTHESIS=(synthesis-summary.md swot-analysis.md risk-assessment.md threat-analy
media-framing-analysis.md implementation-feasibility.md \
forward-indicators.md)
DOK_RE='[Hh][A-Za-z0-9]{3,}[0-9]+'
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'
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'
FAIL=0

# Check 1 — artifact existence (all 23)
Expand Down
8 changes: 5 additions & 3 deletions .github/prompts/06-article-generation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 06 — Article Generation (aggregate + render)

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.
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.

## Preconditions

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

The renderer embeds:

- `<title>` = aggregated article title (H1 of `executive-brief.md`).
- `<meta name="description">` = first paragraph of `executive-brief.md` (≤ 300 chars).
- `<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.
- `<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.
- `<link rel="canonical">` + `<link rel="alternate" hreflang="…">` × all requested languages + `x-default`.
- Open Graph (`og:type=article`), Twitter summary card.
- JSON-LD `NewsArticle` with `isBasedOn` listing every source `.md` / `.json` artifact on GitHub — the article is self-documenting.
- Cyberpunk site header with skip-link, nav (Home, Political Intelligence, Sitemap), and language switcher.
- 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`).

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.

## Translations

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.
Expand Down
Loading
Loading