Skip to content

prompts/workflows: directive-style rewrite of agentic news instructions#2659

Merged
pethers merged 10 commits into
mainfrom
copilot/analyze-python-translations
May 21, 2026
Merged

prompts/workflows: directive-style rewrite of agentic news instructions#2659
pethers merged 10 commits into
mainfrom
copilot/analyze-python-translations

Conversation

Copilot AI commented May 21, 2026

Copy link
Copy Markdown
Contributor
  • 02-mcp-access.md — Health-gate third-attempt failure now sets IMPROVEMENT_MODE (via pre-flight or explicit =false) before invoking the scaffold heredoc, preventing set -u unbound-variable abort.
  • 06-article-generation.md — Updated news-translate reference: default batch 3 sourcesdefault batch 2 sources (matches workflow's actual max_briefs default).
  • 03-data-download.md — Reworded post-scaffold paragraph to reflect that scripts/download-parliamentary-data rewrites data-download-manifest.md in full via writeManifest() / fs.writeFileSync; edit is only for post-download agent amendments. Updated the in-scaffold placeholder line accordingly.
  • 00-base-contract.md — Rule Bump ossf/scorecard-action from 2.4.0 to 2.4.3 #8 now explicitly names the 03-data-download.md early-scaffold unquoted heredoc as the sole exception alongside the read-only JSON validator.
  • README.md — Fixed broken §5 anchor → §Non-negotiable rules #5 for the AI-FIRST rule reference.

…hon3

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI requested a review from pethers May 21, 2026 20:25
@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-m Medium change (50-250 lines) labels May 21, 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: documentation,workflow,ci-cd,size-m,news,agentic-workflow

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

…kflows

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title prompts: pin edit tool preference for file writes (cat heredoc fallback, ban python3) Pin edit tool as the primary file-write mechanism across all agentic workflows May 21, 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

…4/06/ext prompts

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title Pin edit tool as the primary file-write mechanism across all agentic workflows Repeat gh-aw file-write policy at point-of-use across all 14 workflows + 04/06/ext prompts May 21, 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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 refactors the agentic news prompt modules and news workflow bodies into a more directive, scan-friendly style while aiming to preserve the existing execution contract, and regenerates the compiled lock workflows accordingly (including the established fetch-depth: 0 patch).

Changes:

  • Rewrites/condenses multiple .github/prompts/*.md modules into directive-form instructions and adds point-of-use file-write contract reminders.
  • Updates many .github/workflows/news-*.md bodies with a standardized “File-write contract” section and tightens some timing/translation directives.
  • Regenerates corresponding .lock.yml files and patches actions/checkout to fetch-depth: 0.

Reviewed changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated 24 comments.

Show a summary per file
File Description
.github/workflows/news-year-ahead.md Adds standardized file-write contract section to workflow body.
.github/workflows/news-year-ahead.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-weekly-review.md Condenses timing guidance and adds standardized file-write contract section.
.github/workflows/news-weekly-review.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-week-ahead.md Condenses timing guidance and adds standardized file-write contract section.
.github/workflows/news-week-ahead.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-translate.md Tightens translation step to require per-language edit writes.
.github/workflows/news-translate.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-realtime-monitor.md Condenses timing guidance and adds standardized file-write contract section.
.github/workflows/news-realtime-monitor.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-quarter-ahead.md Adds standardized file-write contract section to workflow body.
.github/workflows/news-quarter-ahead.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-propositions.md Condenses AI-FIRST + file-limit guidance, updates timing paragraph, adds file-write contract section.
.github/workflows/news-propositions.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-motions.md Condenses timing paragraph and adds standardized file-write contract section.
.github/workflows/news-motions.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-monthly-review.md Condenses timing paragraph and adds standardized file-write contract section.
.github/workflows/news-monthly-review.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-month-ahead.md Condenses timing paragraph and adds standardized file-write contract section.
.github/workflows/news-month-ahead.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-interpellations.md Condenses timing paragraph and adds standardized file-write contract section.
.github/workflows/news-interpellations.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-evening-analysis.md Condenses timing paragraph and adds standardized file-write contract section.
.github/workflows/news-evening-analysis.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-election-cycle.md Adds standardized file-write contract section to workflow body.
.github/workflows/news-election-cycle.lock.yml Patches checkout depth to fetch-depth: 0.
.github/workflows/news-committee-reports.md Condenses timing paragraph and adds standardized file-write contract section.
.github/workflows/news-committee-reports.lock.yml Patches checkout depth to fetch-depth: 0.
.github/prompts/README.md Updates module catalogue phrasing and AI-FIRST reference formatting.
.github/prompts/ext/tier-c-aggregation.md Adds explicit edit-only file-write contract reminder for Tier-C extensions.
.github/prompts/ext/long-horizon-forecasting.md Adds explicit edit-only file-write contract reminder for long-horizon extensions.
.github/prompts/ext/cycle-rollover.md Adds explicit edit-only file-write contract reminder for rollover/archival writes.
.github/prompts/07-commit-and-pr.md Directive rewrite of PR/no-op policy, file-budget guard, and deadline enforcement wording.
.github/prompts/06-article-generation.md Directive rewrite of aggregate+render instructions; adds explicit file-write contract reminder.
.github/prompts/05-analysis-gate.md Condenses rerun guidance and post-aggregation Check 12 ordering note.
.github/prompts/04-analysis-pipeline.md Adds point-of-use file-write contract reminder; directive rewrite of improvement-mode steps.
.github/prompts/03-data-download.md Directive rewrite of router/scaffold guidance; clarifies early-scaffold heredoc exception and edit-appending.
.github/prompts/02-mcp-access.md Directive rewrite and tightened tool naming/inventory guidance; IMF CLI section reformatted.
.github/prompts/01-bash-and-shell-safety.md Rewrites bash safety guidance; adds a full file-write hierarchy section and self-check list.
.github/prompts/00-base-contract.md Directive rewrite of non-negotiables, timing, inputs contract, and language/output constraints.

Comment on lines +89 to +92
For short ASCII writes (< 200 bytes, no special chars), `printf '%s\n' "$CONTENT" > "$TARGET"` is acceptable. `echo "$CONTENT" > file` is not — `echo` mangles backslashes and lines starting with `-`.

### Banned for file writes

Comment thread .github/workflows/news-week-ahead.md Outdated
Comment on lines +330 to +334
@@ -331,4 +331,8 @@ At the start of every run, the pre-flight check in `03-data-download.md` detects

Repeated runs for the same `$ARTICLE_DATE` always use the same analysis folder when `force_generation=false`.

## File-write contract
Comment thread .github/workflows/news-week-ahead.md Outdated

## File-write contract

> 🛠 **Write every analysis artifact (`analysis/daily/$DATE/$SUB/*.md`, `documents/*.md`, JSON sidecars, `methodology-reflection.md` re-run deltas) with the `edit` tool.** `cat <<'QUOTED_EOF' > file` is a Tier-2 fallback only — ASCII-only, no code fences / Mermaid / `$` / backticks / `EOF` markers, < 200 lines, and only after `edit` has failed for a non-content reason. Banned for `analysis/daily/**` writes: `python3`, `node -e`, `sed -i`, `echo … > file`, `tee file`, unquoted heredocs (`<<EOF`). The aggregator (`scripts/aggregate-analysis.ts`) and renderer (`scripts/render-articles.ts`) are the only writers for `article.md` and `news/*.html`. See [`01-bash-and-shell-safety.md` §File creation & overwrite strategy](../prompts/01-bash-and-shell-safety.md).
Comment thread .github/workflows/news-propositions.md Outdated
Comment on lines +330 to +334
@@ -331,4 +331,8 @@ At the start of every run, the pre-flight check in `03-data-download.md` detects

Repeated runs for the same `$ARTICLE_DATE` always use the same analysis folder when `force_generation=false`.

## File-write contract
Comment thread .github/workflows/news-propositions.md Outdated

## File-write contract

> 🛠 **Write every analysis artifact (`analysis/daily/$DATE/$SUB/*.md`, `documents/*.md`, JSON sidecars, `methodology-reflection.md` re-run deltas) with the `edit` tool.** `cat <<'QUOTED_EOF' > file` is a Tier-2 fallback only — ASCII-only, no code fences / Mermaid / `$` / backticks / `EOF` markers, < 200 lines, and only after `edit` has failed for a non-content reason. Banned for `analysis/daily/**` writes: `python3`, `node -e`, `sed -i`, `echo … > file`, `tee file`, unquoted heredocs (`<<EOF`). The aggregator (`scripts/aggregate-analysis.ts`) and renderer (`scripts/render-articles.ts`) are the only writers for `article.md` and `news/*.html`. See [`01-bash-and-shell-safety.md` §File creation & overwrite strategy](../prompts/01-bash-and-shell-safety.md).
Comment on lines +341 to +345
@@ -342,4 +342,8 @@ At the start of every run, the pre-flight check in `03-data-download.md` detects

Repeated runs for the same `$ARTICLE_DATE` always use the same analysis folder when `force_generation=false`.

## File-write contract

## File-write contract

> 🛠 **Write every analysis artifact (`analysis/daily/$DATE/$SUB/*.md`, `documents/*.md`, JSON sidecars, `methodology-reflection.md` re-run deltas) with the `edit` tool.** `cat <<'QUOTED_EOF' > file` is a Tier-2 fallback only — ASCII-only, no code fences / Mermaid / `$` / backticks / `EOF` markers, < 200 lines, and only after `edit` has failed for a non-content reason. Banned for `analysis/daily/**` writes: `python3`, `node -e`, `sed -i`, `echo … > file`, `tee file`, unquoted heredocs (`<<EOF`). The aggregator (`scripts/aggregate-analysis.ts`) and renderer (`scripts/render-articles.ts`) are the only writers for `article.md` and `news/*.html`. See [`01-bash-and-shell-safety.md` §File creation & overwrite strategy](../prompts/01-bash-and-shell-safety.md).
Comment thread .github/workflows/news-quarter-ahead.md Outdated

## File-write contract

> 🛠 **Write every analysis artifact (`analysis/daily/$DATE/$SUB/*.md`, `documents/*.md`, JSON sidecars, `methodology-reflection.md` re-run deltas) with the `edit` tool.** `cat <<'QUOTED_EOF' > file` is a Tier-2 fallback only — ASCII-only, no code fences / Mermaid / `$` / backticks / `EOF` markers, < 200 lines, and only after `edit` has failed for a non-content reason. Banned for `analysis/daily/**` writes: `python3`, `node -e`, `sed -i`, `echo … > file`, `tee file`, unquoted heredocs (`<<EOF`). The aggregator (`scripts/aggregate-analysis.ts`) and renderer (`scripts/render-articles.ts`) are the only writers for `article.md` and `news/*.html`. See [`01-bash-and-shell-safety.md` §File creation & overwrite strategy](../prompts/01-bash-and-shell-safety.md).
Comment thread .github/workflows/news-year-ahead.md Outdated

## File-write contract

> 🛠 **Write every analysis artifact (`analysis/daily/$DATE/$SUB/*.md`, `documents/*.md`, JSON sidecars, `methodology-reflection.md` re-run deltas) with the `edit` tool.** `cat <<'QUOTED_EOF' > file` is a Tier-2 fallback only — ASCII-only, no code fences / Mermaid / `$` / backticks / `EOF` markers, < 200 lines, and only after `edit` has failed for a non-content reason. Banned for `analysis/daily/**` writes: `python3`, `node -e`, `sed -i`, `echo … > file`, `tee file`, unquoted heredocs (`<<EOF`). The aggregator (`scripts/aggregate-analysis.ts`) and renderer (`scripts/render-articles.ts`) are the only writers for `article.md` and `news/*.html`. See [`01-bash-and-shell-safety.md` §File creation & overwrite strategy](../prompts/01-bash-and-shell-safety.md).

## File-write contract

> 🛠 **Write every analysis artifact (`analysis/daily/$DATE/$SUB/*.md`, `documents/*.md`, JSON sidecars, `methodology-reflection.md` re-run deltas) with the `edit` tool.** `cat <<'QUOTED_EOF' > file` is a Tier-2 fallback only — ASCII-only, no code fences / Mermaid / `$` / backticks / `EOF` markers, < 200 lines, and only after `edit` has failed for a non-content reason. Banned for `analysis/daily/**` writes: `python3`, `node -e`, `sed -i`, `echo … > file`, `tee file`, unquoted heredocs (`<<EOF`). The aggregator (`scripts/aggregate-analysis.ts`) and renderer (`scripts/render-articles.ts`) are the only writers for `article.md` and `news/*.html`. See [`01-bash-and-shell-safety.md` §File creation & overwrite strategy](../prompts/01-bash-and-shell-safety.md).
…tf allowance per review feedback

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 5 comments.

| Multiple file writes inside one Python/Node `-e` invocation | Whole tool-call message (with every file body inline) replays each turn → O(n²) token blowup. |
| `tee "$FILE"` for content writes | Same hazards as `cat >` plus stdout duplication. `tee` is fine for log capture (`… 2>&1 | tee /tmp/pipeline.log`). |

Self-check before any file-write `bash` call: if the command contains `>`, `>>`, `<<`, `<<<`, `tee`, `python3`, `sed -i`, or `dd`, and the target is under the repo working tree (anything other than `/tmp/`), switch to `edit`.
Comment thread .github/prompts/03-data-download.md Outdated
The download step appends to this file (it does **not** overwrite — see
§Provenance manifest below). If MCP is unreachable from start, the per-document
table simply remains empty and the MCP-attempts section explains why.
The download step appends to this file using the `edit` tool (str-replace at the section anchor, or insert before the EOF marker line). See [`01-bash-and-shell-safety.md §File creation & overwrite strategy`](01-bash-and-shell-safety.md). When MCP is unreachable from start, the per-document table stays empty and the MCP-attempts section explains why.
Comment on lines +484 to 487
1. **Pass 1 — translate**: Read the source `executive-brief.md` in full. For every language in `TRANSLATION_LANGS`, produce `analysis/daily/$DATE/$SUB/executive-brief_<lang>.md` following the TRANSLATION_GUIDE rules — **write each file with one `edit` tool call per language** (never via `python3`, `bash` heredocs, or shell redirection — see `01-bash-and-shell-safety.md §File creation & overwrite strategy`). Preserve every verbatim block (YAML, HTML comments except `source-sha`, `dok_id` codes, Mermaid DSL bodies, code fences, URLs, file paths, evidence-anchor canonical column values). Translate every always-translate block (prose, headings, list items, table cell text, image alt-text, BLUF, decisions, link text).
2. **Pass 2 — read-back & refine**: Read every translation back in full. Verify structural parity (heading / fence / table / Mermaid counts match source ±0). Verify dok_id and URL set equality. Verify no banned English phrases remain in non-English files (`Executive Brief`, `Decisions`, `Confidence`, `BLUF`, …). Tighten tone register for the target language using the per-language guidance in TRANSLATION_GUIDE. For `ar` and `he`, ensure the file starts with `<!-- dir: rtl -->`.
3. **Append the source-revision marker**: compute `SRC_SHA=$(git log -1 --format=%H -- <source>)` in the runtime shell. Append `<!-- source-sha: $SRC_SHA -->` as the last non-empty line of every translation file. This is the drift signal future runs use to decide whether to retranslate.
4. **Validate**: run `npx tsx scripts/validate-executive-brief-translations.ts --source <source>` (when available) or fall back to the structural sanity checks listed in TRANSLATION_GUIDE §Acceptance checklist. Fix any failures by re-translating the offending language; do not commit a file that fails validation.
Comment thread .github/prompts/04-analysis-pipeline.md Outdated

## File-write contract (point-of-use reminder)

> 🛠 **All 23 artifacts on this page use the `edit` tool** — Pass 1 creates, Pass 2 read-back-and-improves, improvement-mode extensions, `pass1/` snapshot copies (`cp` is fine), `documents/{dok_id}-analysis.md`, and `## Re-run delta` appends in `methodology-reflection.md`. Tier-2 fallback (`cat <<'EOF_RAW' > file`) is acceptable only when `edit` has failed for non-content-shape reasons and the content is pure ASCII without code fences / Mermaid / `$` / backticks / `EOF` markers. Mermaid blocks, `ö ä å`, RTL/CJK characters, and non-trivial YAML/JSON sidecars ⇒ `edit` only. Banned for file writes: `python3`, `node -e`, `sed -i`, `echo … > file`, `tee file`, unquoted heredocs (`<<EOF`). See [`01-bash-and-shell-safety.md` §File creation & overwrite strategy](01-bash-and-shell-safety.md) for the full hierarchy.
## What the AI does

## What the AI still MUST do
> 🛠 **File-write contract**: `article.md` is a script-generated projection of upstream `.md` artifacts — fix upstream artifacts (with the `edit` tool) and re-aggregate. The aggregator + renderer (`scripts/aggregate-analysis.ts`, `scripts/render-articles.ts`) are the only writers for `article.md` and `news/*.html`. For any upstream edit between aggregate and render (e.g. last-minute SEO H1/dek tightening in `executive-brief.md`, fixing a stale `dok_id` cross-reference in `cross-reference-map.md`), use the `edit` tool. Banned for `analysis/daily/**` writes: `python3`, `node -e`, `sed -i`, `echo … > file`, `tee file`, unquoted heredocs (`<<EOF`). See [`01-bash-and-shell-safety.md` §File creation & overwrite strategy](01-bash-and-shell-safety.md).
- 01-bash-and-shell-safety.md: self-check now explicitly exempts the
  03-data-download scaffold heredoc
- 03-data-download.md: reference actual in-file anchor (## Per-document
  table heading) instead of non-existent EOF marker line
- news-translate.md: step 3 source-sha marker now explicitly requires
  `edit` tool instead of ambiguous "append"
- 04-analysis-pipeline.md: add scaffold exception to file-write contract
- 06-article-generation.md: scope ban to "agent-generated content writes"
  and add scaffold exception

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 4 comments.

Comment thread .github/prompts/02-mcp-access.md Outdated
1. Call `get_sync_status({})`. Retry up to **3 times**, 20 s apart (server is pre-warmed by the CI `steps:` block).
2. On third-attempt failure: set `ANALYSIS_DIR=analysis/daily/$ARTICLE_DATE/$SUBFOLDER` and branch on `[ -s "$ANALYSIS_DIR/synthesis-summary.md" ]`:
- **Prior analysis exists** → route to improvement-mode in [`04-analysis-pipeline.md`](04-analysis-pipeline.md). Extend using on-disk evidence, refresh `article.md` + HTML, PR once.
- **No prior analysis** apply the MCP-unreachable no-op rule in [`07-commit-and-pr.md §No-op policy`](07-commit-and-pr.md) and exit.
Comment on lines 79 to +83
## Early-scaffold marker (resilience — write **immediately** after pre-flight)

> 🛟 **Closes the "MCP unreachable from start + no prior analysis" no-op hole.**
> By writing a tracked-on-disk file *before* the first MCP call, the run is
> guaranteed to have a non-empty diff to commit even when every MCP attempt
> fails — turning what was previously a `safeoutputs___noop` into a partial
> `safeoutputs___create_pull_request` with the failure documented.
Writing a tracked on-disk file *before* the first MCP call guarantees a non-empty diff even when every MCP attempt fails — turning a would-be `safeoutputs___noop` into a partial `safeoutputs___create_pull_request` with the failure documented.

Run this **once**, immediately after the pre-flight block above and **before**
the first `download-parliamentary-data.ts` invocation:
Run **once**, immediately after the pre-flight block above and **before** the first `download-parliamentary-data.ts` invocation:
`news/$ARTICLE_DATE-$SUBFOLDER-$LANG.html` (e.g. `news/2026-04-23-propositions-en.html` … `news/2026-04-23-propositions-zh.html`)

Every per-type workflow renders the full 14-language set in the same agentic run. The dedicated `news-translate` workflow has been re-scoped: it now produces `executive-brief_<lang>.md` markdown translations of every `analysis/daily/**/executive-brief.md` for the 13 non-English target languages (3 runs/day, default batch 3 sources). It does **not** touch `news/*.html` and does **not** back-fill `article.<lang>.md`. See `.github/workflows/news-translate.md` for the executive-brief translation contract.
Every per-type workflow renders the full 14-language set in one agentic run. The dedicated `news-translate` workflow is re-scoped to produce `executive-brief_<lang>.md` markdown translations of every `analysis/daily/**/executive-brief.md` for the 13 non-English target languages (3 runs/day, default batch 3 sources). It does not touch `news/*.html` and does not back-fill `article.<lang>.md`. See `.github/workflows/news-translate.md`.
Comment on lines +484 to +486
1. **Pass 1 — translate**: Read the source `executive-brief.md` in full. For every language in `TRANSLATION_LANGS`, produce `analysis/daily/$DATE/$SUB/executive-brief_<lang>.md` following the TRANSLATION_GUIDE rules — **write each file with one `edit` tool call per language** (never via `python3`, `bash` heredocs, or shell redirection — see `01-bash-and-shell-safety.md §File creation & overwrite strategy`). Preserve every verbatim block (YAML, HTML comments except `source-sha`, `dok_id` codes, Mermaid DSL bodies, code fences, URLs, file paths, evidence-anchor canonical column values). Translate every always-translate block (prose, headings, list items, table cell text, image alt-text, BLUF, decisions, link text).
2. **Pass 2 — read-back & refine**: Read every translation back in full. Verify structural parity (heading / fence / table / Mermaid counts match source ±0). Verify dok_id and URL set equality. Verify no banned English phrases remain in non-English files (`Executive Brief`, `Decisions`, `Confidence`, `BLUF`, …). Tighten tone register for the target language using the per-language guidance in TRANSLATION_GUIDE. For `ar` and `he`, ensure the file starts with `<!-- dir: rtl -->`.
3. **Append the source-revision marker**: compute `SRC_SHA=$(git log -1 --format=%H -- <source>)` in the runtime shell. Append `<!-- source-sha: $SRC_SHA -->` as the last non-empty line of every translation file. This is the drift signal future runs use to decide whether to retranslate.
3. **Append the source-revision marker**: compute `SRC_SHA=$(git log -1 --format=%H -- <source>)` in the runtime shell. Use the `edit` tool to add or replace the final `<!-- source-sha: $SRC_SHA -->` line at the end of every translation file (consistent with the file-write contract — no `>>` or `echo`). This is the drift signal future runs use to decide whether to retranslate.
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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 5 comments.

Comment thread .github/prompts/02-mcp-access.md Outdated
- `status: unavailable` or `data/imf-unavailable.flag` present: inject the standard warning block and use cached IMF / SCB fallback only; never substitute World Bank for macroeconomic claims.
5. Pre-warm IMF with one throwaway `weo` call through the CLI (not raw `fetch`): `npx tsx scripts/imf-fetch.ts weo --country SWE --indicator NGDP_RPCH --years 1 >/dev/null 2>&1 || true ; sleep 1`.
1. Call `get_sync_status({})`. Retry up to **3 times**, 20 s apart (server is pre-warmed by the CI `steps:` block).
2. On third-attempt failure: write the early-scaffold marker per [`03-data-download.md §Early-scaffold marker`](03-data-download.md) (guarantees a non-empty diff even when MCP is totally unreachable). Then set `ANALYSIS_DIR=analysis/daily/$ARTICLE_DATE/$SUBFOLDER` and branch on `[ -s "$ANALYSIS_DIR/synthesis-summary.md" ]`:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3521b24 — the third-attempt failure path now runs the 03-data-download.md pre-flight first so IMPROVEMENT_MODE is set before the scaffold heredoc expands it under set -euo pipefail, with an explicit IMPROVEMENT_MODE=false fallback prepend documented when the full pre-flight cannot run.

`news/$ARTICLE_DATE-$SUBFOLDER-$LANG.html` (e.g. `news/2026-04-23-propositions-en.html` … `news/2026-04-23-propositions-zh.html`)

Every per-type workflow renders the full 14-language set in the same agentic run. The dedicated `news-translate` workflow has been re-scoped: it now produces `executive-brief_<lang>.md` markdown translations of every `analysis/daily/**/executive-brief.md` for the 13 non-English target languages (3 runs/day, default batch 3 sources). It does **not** touch `news/*.html` and does **not** back-fill `article.<lang>.md`. See `.github/workflows/news-translate.md` for the executive-brief translation contract.
Every per-type workflow renders the full 14-language set in one agentic run. The dedicated `news-translate` workflow is re-scoped to produce `executive-brief_<lang>.md` markdown translations of every `analysis/daily/**/executive-brief.md` for the 13 non-English target languages (3 runs/day, default batch 3 sources). It does not touch `news/*.html` and does not back-fill `article.<lang>.md`. See `.github/workflows/news-translate.md`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3521b24 — updated to default batch 2 sources (with the run #26008347629 note about the 3→2 reduction) to match the workflow's actual max_briefs default.

Comment thread .github/prompts/03-data-download.md Outdated
Comment on lines +113 to +120
## Per-document table
_(populated by the download step)_
_(populated by the download step via the \`edit\` tool — never \`cat >>\` and never \`python3\`)_
EOF
echo "✅ scaffold marker written: $SCAFFOLD"
fi
```

The download step appends to this file (it does **not** overwrite — see
§Provenance manifest below). If MCP is unreachable from start, the per-document
table simply remains empty and the MCP-attempts section explains why.
The download step appends to this file using the `edit` tool (str-replace at the `## Per-document table` section anchor, or insert under the `_(populated by the download step …)_` placeholder line). See [`01-bash-and-shell-safety.md §File creation & overwrite strategy`](01-bash-and-shell-safety.md). When MCP is unreachable from start, the per-document table stays empty and the MCP-attempts section explains why.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3521b24 — reworded the paragraph and the in-scaffold placeholder line to clarify that scripts/download-parliamentary-data rewrites data-download-manifest.md in full via writeManifest() / fs.writeFileSync (citing output-writer.ts), and that edit is only used for post-download agent amendments. The scaffold is now correctly described as the pre-MCP fallback marker.

Comment thread .github/prompts/00-base-contract.md Outdated
| 5 | **AI FIRST — 2 complete iterations minimum**. Pass 1 creates every artifact. Pass 2 reads Pass 1 back and improves every section. |
| 6 | No psyops, propaganda, or partisan influence operations. |
| 7 | Complete the task inside the time budget. Trim *scope*, never *quality*. |
| 8 | **File writes — use `edit`.** `cat <<'QUOTED_EOF'` heredoc is the only fallback. `python3` / `node -e` / `sed -i` are banned for file writes (sole exception: read-only JSON validator in `05-analysis-gate.md`). Full hierarchy → [`01-bash-and-shell-safety.md` §File creation & overwrite strategy](01-bash-and-shell-safety.md). |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3521b24 — rule #8 now explicitly lists the 03-data-download.md §Early-scaffold marker unquoted heredoc as a sole exception alongside the read-only JSON validator, so the two contracts no longer conflict.

Comment thread .github/prompts/README.md Outdated
- **Tier-C aggregation** produces the same 23 artifacts plus depth multipliers, cross-type sibling-folder citations, prior-cycle PIR ingestion, and a 1 500-word article floor — see [`ext/tier-c-aggregation.md`](ext/tier-c-aggregation.md).
- **Single blocking gate**: [`05-analysis-gate.md`](05-analysis-gate.md) is the only enforcer. No article may be touched until the gate passes.
- **AI-FIRST rule** (from [`00-base-contract.md`](00-base-contract.md) §Non-negotiable rules #5): minimum 2 complete iterations — Pass 1 creates every artifact, Pass 2 reads Pass 1 back in full and improves every section.
- **AI-FIRST rule** ([`00-base-contract.md`](00-base-contract.md) §5): minimum 2 complete iterations — Pass 1 creates every artifact, Pass 2 reads Pass 1 back and improves every section.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3521b24 — replaced §5 with §Non-negotiable rules #5, which points at the actual heading + rule number rather than a non-existent anchor.

…ST anchor + max_briefs default

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

@pethers
pethers merged commit cf5221a into main May 21, 2026
13 checks passed
@pethers
pethers deleted the copilot/analyze-python-translations branch May 21, 2026 23:54
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-m Medium change (50-250 lines) workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants