You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo"🔴 UNDERSIZED Tier-C: $REQUIRED_FILE ($FSIZE bytes < $MIN_SIZE scaled minimum — base $BASE_SIZE × ${MULT_NUM}/${MULT_DEN}) — MUST ENRICH"
524
+
echo"🔴 UNDERSIZED Tier-C: $REQUIRED_FILE ($FSIZE bytes < $MIN_SIZE scaled minimum — base $BASE_SIZE × $MULT_NUM/$MULT_DEN) — MUST ENRICH"
519
525
TIER_C_MISSING=$((TIER_C_MISSING +1))
520
526
else
521
527
echo"✅ OK Tier-C: $REQUIRED_FILE ($FSIZE bytes ≥ $MIN_SIZE scaled minimum)"
@@ -2663,9 +2669,10 @@ Then call the health gate:
2663
2669
> 🚨 **UNIVERSAL SAFE OUTPUT RULES — ALL WORKFLOWS MUST FOLLOW:**
2664
2670
>
2665
2671
> 1. **Call `safeoutputs___create_pull_request` as EARLY as possible** — the moment you have committed files. The safeoutputs MCP session has a finite lifetime. Successful runs call it by minute ~25. Failed runs that delayed past minute 40 got "session not found" and lost all work.
2666
-
> 2. **NEVER call `safeoutputs___noop` when artifacts exist.** Noop means "I did nothing." If you created files, you DID something and MUST create a PR. Partial work in a PR is infinitely better than lost work via noop.
2667
-
> 3. **At HARD DEADLINE**: If ANY files were created → `safeoutputs___create_pull_request`. ONLY noop if truly ZERO files were created.
2668
-
> 4. **Architecture reminder**: `safeoutputs___create_pull_request` records your intent. A separate `safe_outputs` job executes the PR creation AFTER the agent job ends. If the MCP session expires before you record the intent, the `safe_outputs` job is SKIPPED and all work is lost.
2672
+
> 2. **Heartbeat PR to keep the safeoutputs session alive (`max: 2+`)** — the Streamable-HTTP safeoutputs MCP session has a ~30–35 min idle lifetime (observed in PR #1835 and run #24672037751). Every `safeoutputs___create_pull_request` call **resets the session idle timer**. If the workflow sets `create-pull-request.max: 2` or higher, call the tool once at minute ~22–25 as a **heartbeat PR** capturing work-in-progress (partial analysis + first article draft), then call it again at minute 40–45 with the polished final output. Each call creates a separate PR on a separate branch; the final PR supersedes the heartbeat. This pattern was proven in `news-translate` (`max: 5`, zero session expiries across 55-minute runs) and `news-realtime-monitor` (`max: 3`). **Single-PR workflows (`max: 1`) that delay their only call past minute 35 WILL lose all work to session expiry.**
2673
+
> 3. **NEVER call `safeoutputs___noop` when artifacts exist.** Noop means "I did nothing." If you created files, you DID something and MUST create a PR. Partial work in a PR is infinitely better than lost work via noop.
2674
+
> 4. **At HARD DEADLINE**: If ANY files were created → `safeoutputs___create_pull_request`. ONLY noop if truly ZERO files were created.
2675
+
> 5. **Architecture reminder**: `safeoutputs___create_pull_request` records your intent. A separate `safe_outputs` job executes the PR creation AFTER the agent job ends. If the MCP session expires before you record the intent, the `safe_outputs` job is SKIPPED and all work is lost.
2669
2676
2670
2677
### Layer 3: MCP Gateway Diagnostics (run when tools fail)
| Download | 3–6 | Run data download scripts (MCP data fetch) |
381
382
|**AI Analysis Pass 1**|**6–21**|**🚨 MANDATORY 15 min minimum**: Read ALL methodology guides, create per-file analysis for EVERY document with Mermaid diagrams, evidence tables, SWOT entries. |
382
-
|**AI Analysis Pass 2**|**21–28**|**🚨 MANDATORY 7 min minimum**: Read ALL analysis back completely, improve every section, replace ALL script stubs with AI analysis. |
383
+
|**AI Analysis Pass 2 (Part A)**|**21–22**| Begin reading ALL analysis artifacts back and identify improvement targets. |
384
+
|**Heartbeat PR**|**22–25**| 🫀 `git add && git commit` analysis + any drafts so far, then `safeoutputs___create_pull_request` (title `🫀 Heartbeat - Article Generator - {date}`). This refreshes the safeoutputs MCP session (which expires after ~30–35 min idle) AND guarantees no work is lost if later phases fail. After the call succeeds, run `git checkout main` so subsequent commits don't stack onto the frozen patch. |
385
+
|**AI Analysis Pass 2 (Part B)**|**25–28**|**Complete improvements (6 min improvement work total across Parts A+B)**: improve every section, replace ALL script stubs with AI analysis. |
383
386
| Gates | 28–30 | Run ENFORCED Minimum Time Gate + Enrichment Verification Gate (SHARED_PROMPT_PATTERNS.md). Both MUST pass. |
384
387
| Generate | 30–36 | Run `generate-news-enhanced.ts` in batches |
385
388
|**Article Improvement**|**36–40**| 🚨 Read ALL articles back, replace AI_MUST_REPLACE markers, improve content. Run article quality component gate. |
> ⚠️ **Analysis phase is 22 minutes minimum (Pass 1: 15 min + Pass 2: 7 min)** — every analysis file must contain color-coded Mermaid diagrams, structured evidence tables with dok_id citations, and follow template structure exactly. ALL script-generated stubs MUST be replaced with AI-enriched analysis. Run the ENFORCED gates from SHARED_PROMPT_PATTERNS.md before article generation.
390
393
391
394
**Hard cutoffs** — check elapsed time before each phase:
395
+
-`>= 25 min` and no safeoutputs call yet → 🚨 call `safeoutputs___create_pull_request` as a heartbeat with whatever files exist. Do NOT delay — the safeoutputs session expires at ~30–35 min idle.
392
396
-`>= 35 min` → Stop generating, commit what you have, create PR immediately
-**Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()`
287
288
-**Minutes 3–6**: Run download-parliamentary-data pipeline (download data)
288
289
-**Minutes 6–21**: 🚨 **AI Analysis Pass 1 (15 min minimum)**: Read ALL methodology guides, create per-file analysis for EVERY document with Mermaid diagrams, evidence tables, SWOT entries.
289
-
-**Minutes 21–28**: 🚨 **AI Analysis Pass 2 (7 min minimum)**: Read ALL analysis back completely, improve every section, replace ALL script stubs with AI analysis. Run enrichment verification gate.
290
+
-**Minutes 21–22**: 🚨 **AI Analysis Pass 2 (Part A, start)**: Begin reading ALL analysis artifacts back and identify improvement targets.
291
+
-**Minutes 22–25**: 🫀 **Heartbeat PR** — `git add && git commit` analysis artifacts so far, then `safeoutputs___create_pull_request` (title `🫀 Heartbeat - Committee Reports - {date}`). Refreshes the safeoutputs MCP session (idle timeout ~30–35 min) AND preserves work if later phases fail. Run `git checkout main` after the call so subsequent commits don't stack onto the frozen patch.
292
+
-**Minutes 25–28**: 🚨 **AI Analysis Pass 2 (Part B, complete — 6 min improvement work total across Parts A+B)**: Improve every section, replace ALL script stubs with AI analysis. Run enrichment verification gate.
290
293
-**Minutes 28–30**: Run ENFORCED Minimum Time Gate + Enrichment Verification Gate (SHARED_PROMPT_PATTERNS.md). Both MUST pass.
291
294
-**Minutes 30–36**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts`
292
295
-**Minutes 36–40**: 🚨 **Article Improvement Pass**: Read ALL articles back, replace AI_MUST_REPLACE markers, improve content. Run article quality component gate.
| Setup | 0–3 | Date check, `get_sync_status()`, determine day type | MCP responds |
318
319
| Download | 3–6 | Run `populate-analysis-data.ts` + `download-parliamentary-data.ts` (script-driven data download) | Data files exist |
319
320
|**AI Analysis Pass 1**|**6–21**|**🚨 MANDATORY 15 min minimum**: Read ALL methodology guides, create per-file analysis for EVERY document with Mermaid diagrams, evidence tables, SWOT entries. **Create ALL 9 required artifacts.**| 9 artifact files exist |
320
-
|**AI Analysis Pass 2**|**21–28**|**🚨 MANDATORY 7 min minimum**: Read ALL 9 analysis artifacts back completely, improve every section, add missing Mermaid diagrams and evidence tables, replace ALL script stubs with AI analysis. | All 9 files ≥500 bytes |
321
+
|**AI Analysis Pass 2 (Part A)**|**21–22**| Begin reading ALL 9 analysis artifacts back and identify improvement targets. | Files opened for review |
322
+
|**Heartbeat PR**|**22–25**| 🫀 `git add && git commit` analysis + any drafts so far, then `safeoutputs___create_pull_request` (title `🫀 Heartbeat - Evening Analysis - {date}`). This refreshes the safeoutputs MCP session (which expires after ~30–35 min idle) AND guarantees no work is lost if later phases fail. After the call succeeds, run `git checkout main` so subsequent commits don't stack onto the frozen patch. | Heartbeat PR created |
323
+
|**AI Analysis Pass 2 (Part B)**|**25–28**|**Complete improvements (6 min improvement work total across Parts A+B)**: improve every section, add missing Mermaid diagrams and evidence tables, replace ALL script stubs with AI analysis. | All 9 files ≥500 bytes |
321
324
| Gates | 28–30 | Run ENFORCED Minimum Time Gate + Enrichment Verification Gate + **9-artifact completeness check** (SHARED_PROMPT_PATTERNS.md). ALL MUST pass. | 0 failures |
322
325
| Generate | 30–36 | Run generation script OR manual synthesis (see Step 3) | HTML files created |
**Hard cutoffs**: `>= 25 min` and no safeoutputs call yet → 🚨 call `safeoutputs___create_pull_request` as a heartbeat with whatever files exist (do NOT delay — the safeoutputs session expires at ~30–35 min idle); `>= 35 min` → commit & PR now; `>= 43 min` → STOP ALL WORK, call safe output immediately.
332
335
333
336
## Required Skills
334
337
@@ -611,9 +614,12 @@ for REQUIRED_FILE in README.md executive-brief.md scenario-analysis.md comparati
611
614
echo"🔴 MISSING Tier-C: $REQUIRED_FILE — aggregation workflow MUST CREATE"
612
615
MISSING=$((MISSING +1))
613
616
else
614
-
FSIZE=$(wc -c <"$ANALYSIS_DIR/$REQUIRED_FILE")
617
+
# AWF-safe: no $(...) command substitution — use tempfile + read redirection, then clean up.
-**Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()`
296
297
-**Minutes 3–6**: Run download-parliamentary-data pipeline (download data)
297
298
-**Minutes 6–21**: 🚨 **AI Analysis Pass 1 (15 min minimum)**: Read ALL methodology guides, create per-file analysis for EVERY document with Mermaid diagrams, evidence tables, SWOT entries.
298
-
-**Minutes 21–28**: 🚨 **AI Analysis Pass 2 (7 min minimum)**: Read ALL analysis back completely, improve every section, replace ALL script stubs with AI analysis. Run enrichment verification gate.
299
+
-**Minutes 21–22**: 🚨 **AI Analysis Pass 2 (Part A, start)**: Begin reading ALL analysis artifacts back and identify improvement targets.
300
+
-**Minutes 22–25**: 🫀 **Heartbeat PR** — `git add && git commit` analysis artifacts so far, then `safeoutputs___create_pull_request` (title `🫀 Heartbeat - Interpellations - {date}`). Refreshes the safeoutputs MCP session (idle timeout ~30–35 min) AND preserves work if later phases fail. Run `git checkout main` after the call so subsequent commits don't stack onto the frozen patch.
301
+
-**Minutes 25–28**: 🚨 **AI Analysis Pass 2 (Part B, complete — 6 min improvement work total across Parts A+B)**: Improve every section, replace ALL script stubs with AI analysis. Run enrichment verification gate.
299
302
-**Minutes 28–30**: Run ENFORCED Minimum Time Gate + Enrichment Verification Gate (SHARED_PROMPT_PATTERNS.md). Both MUST pass.
300
303
-**Minutes 30–36**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts`
301
304
-**Minutes 36–40**: 🚨 **Article Improvement Pass**: Read ALL articles back, replace AI_MUST_REPLACE markers, improve content. Run article quality component gate.
-**Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()`
275
276
-**Minutes 3–5**: Run download-parliamentary-data pipeline (download data)
276
277
-**Minutes 5–15**: 🚨 **AI Analysis Pass 1 (10 min minimum)**: Read ALL methodology guides, create analysis for EVERY document with Mermaid diagrams, evidence tables, SWOT entries.
277
-
-**Minutes 15–22**: 🚨 **AI Analysis Pass 2 + Enrichment Verification (7 min minimum)**: Read ALL analysis back, improve every section, replace ALL script stubs with AI analysis, and complete enrichment verification before the shared minimum-time gate.
278
+
-**Minutes 15–19**: 🚨 **AI Analysis Pass 2 (Part A)**: Read ALL analysis back, improve major sections, replace script stubs.
279
+
-**Minutes 19–21**: 🫀 **Heartbeat PR** — `git add && git commit` analysis artifacts so far, then `safeoutputs___create_pull_request` (title `🫀 Heartbeat - Month Ahead - {date}`). Refreshes the safeoutputs MCP session AND preserves work if later phases fail. Run `git checkout main` after the call so subsequent commits don't stack onto the frozen patch.
280
+
-**Minutes 21–22**: 🚨 **AI Analysis Pass 2 (Part B) + Enrichment Verification**: Complete remaining improvements and run enrichment verification before the shared minimum-time gate.
278
281
-**Minutes 22–23**: Run ENFORCED Minimum Time Gate (set `MINIMUM_ANALYSIS_MINUTES=14` for 30-min workflows) + final Enrichment Verification Gate (SHARED_PROMPT_PATTERNS.md). Both MUST pass.
279
282
-**Minutes 23–28**: Generate articles for all 14 languages. Read articles back, replace AI_MUST_REPLACE markers. Run article quality gate.
280
283
-**Minutes 28–29**: Validate and commit analysis + articles
0 commit comments