📋 Issue Type
Architecture / Code Quality / Testing
🎯 Objective
Identify and implement improvement areas across all 14 agentic workflows (.github/workflows/news-*.md), the prompt library (.github/prompts/), and compiled workflows (.github/workflows/news-*.lock.yml). Goals:
- Extract embedded code from agentic workflow Markdown sources and prompt modules into well-architected, strict-typed TypeScript modules with high-quality tests
- Enforce bounded contexts — each component has a single responsibility with explicit interfaces
- Improve test quality — ensure extracted modules have unit tests with >90% coverage
📊 Current State
- 14 agentic workflows in
.github/workflows/news-*.md contain inline bash/TypeScript logic embedded in prompt text
- 13 prompt modules in
.github/prompts/ define analysis pipeline logic, gate checks, and article generation rules inline
- Embedded code is untestable, untyped, and duplicated across workflows
- No TypeScript compilation or lint checking of code embedded in Markdown
- Existing scripts like
aggregate-analysis.ts, render-articles.ts, validate-methodology-reflection.ts already demonstrate the target architecture pattern
🚀 Desired State
Architecture Improvements
- All reusable logic extracted from Markdown into
scripts/ subdirectories with bounded contexts:
scripts/agentic/ — Workflow orchestration helpers (gate validation, artifact inventory)
scripts/analysis/ — Analysis pipeline logic (artifact checking, quality scoring)
scripts/prompts/ — Prompt-related utilities (template rendering, variable substitution)
- Each module has explicit TypeScript interfaces and type exports
- Clear dependency graph between modules (no circular dependencies)
Code Quality
- All extracted code passes
eslint with zero warnings
- Strict TypeScript (
strict: true, noUncheckedIndexedAccess: true)
- No
any types — use proper interfaces for all data structures
- JSDoc documentation on all public functions
Test Quality
- Every extracted module has a co-located
.test.ts file
- Unit tests cover success paths, error paths, and edge cases
- Tests use Vitest with proper mocking patterns (consistent with existing test suite)
- Integration tests validate end-to-end workflow artifact production
🔧 Implementation Approach
- Audit phase: Inventory all inline code in
news-*.md and .github/prompts/*.md files
- Design phase: Define bounded context boundaries and TypeScript interfaces
- Extract phase: Move code to typed modules in
scripts/ with proper exports
- Test phase: Write comprehensive unit and integration tests
- Integrate phase: Update workflows to call extracted modules instead of inline code
- Validate phase: Ensure all existing workflow behavior is preserved
📚 Key Files to Analyse
| File/Directory |
Purpose |
.github/workflows/news-*.md (14 files) |
Agentic workflow sources — contain embedded bash/TS |
.github/prompts/00-base-contract.md |
Role definition, AI-FIRST rule, pipeline order |
.github/prompts/03-data-download.md |
Download pipeline with embedded logic |
.github/prompts/04-analysis-pipeline.md |
23-artifact production rules |
.github/prompts/05-analysis-gate.md |
Blocking gate validation logic |
.github/prompts/06-article-generation.md |
Article generation rules |
.github/prompts/ext/tier-c-aggregation.md |
Tier-C aggregation additive rules |
.github/prompts/ext/long-horizon-forecasting.md |
Horizon stratification rules |
WORKFLOWS.md |
Workflow architecture documentation |
scripts/validate-methodology-reflection.ts |
Existing validation pattern to follow |
scripts/aggregate-analysis.ts |
Existing aggregation pattern to follow |
✅ Acceptance Criteria
🤖 Recommended Agent
code-quality-engineer — Code refactoring, TypeScript architecture, bounded contexts, test quality
🏷️ Labels
enhancement, agentic-workflow, refactor, testing, component:ai-workflows, priority-high, size-xl
📋 Issue Type
Architecture / Code Quality / Testing
🎯 Objective
Identify and implement improvement areas across all 14 agentic workflows (
.github/workflows/news-*.md), the prompt library (.github/prompts/), and compiled workflows (.github/workflows/news-*.lock.yml). Goals:📊 Current State
.github/workflows/news-*.mdcontain inline bash/TypeScript logic embedded in prompt text.github/prompts/define analysis pipeline logic, gate checks, and article generation rules inlineaggregate-analysis.ts,render-articles.ts,validate-methodology-reflection.tsalready demonstrate the target architecture pattern🚀 Desired State
Architecture Improvements
scripts/subdirectories with bounded contexts:scripts/agentic/— Workflow orchestration helpers (gate validation, artifact inventory)scripts/analysis/— Analysis pipeline logic (artifact checking, quality scoring)scripts/prompts/— Prompt-related utilities (template rendering, variable substitution)Code Quality
eslintwith zero warningsstrict: true,noUncheckedIndexedAccess: true)anytypes — use proper interfaces for all data structuresTest Quality
.test.tsfile🔧 Implementation Approach
news-*.mdand.github/prompts/*.mdfilesscripts/with proper exports📚 Key Files to Analyse
.github/workflows/news-*.md(14 files).github/prompts/00-base-contract.md.github/prompts/03-data-download.md.github/prompts/04-analysis-pipeline.md.github/prompts/05-analysis-gate.md.github/prompts/06-article-generation.md.github/prompts/ext/tier-c-aggregation.md.github/prompts/ext/long-horizon-forecasting.mdWORKFLOWS.mdscripts/validate-methodology-reflection.tsscripts/aggregate-analysis.ts✅ Acceptance Criteria
any).test.tsfile with >90% line coverageWORKFLOWS.mdupdated to document new module architecturenpm test(all 3,319+ existing tests pass)knipreports no new dead code🤖 Recommended Agent
code-quality-engineer— Code refactoring, TypeScript architecture, bounded contexts, test quality🏷️ Labels
enhancement,agentic-workflow,refactor,testing,component:ai-workflows,priority-high,size-xl