---
id: T01
parent: S04
milestone: M013
provides: []
requires: []
affects: []
key_files: ["backend/pipeline/quality/scorer.py", "backend/pipeline/quality/variant_generator.py"]
key_decisions: ["Used backward-compat properties on ScoreResult instead of migrating all callers", "Made VARIANT_META_PROMPT a template with {dimension_descriptions} filled per-stage"]
patterns_established: []
drill_down_paths: []
observability_surfaces: []
duration: ""
verification_result: "All three verification commands pass: STAGE_CONFIGS has entries for stages 2-5, ScoreResult works with scores dict, backward-compat getattr works, StageConfig.get_schema() resolves all schema classes, PromptVariantGenerator imports cleanly."
completed_at: 2026-04-01T09:20:20.599Z
blocker_discovered: false
---

# T01: Added STAGE_CONFIGS registry (stages 2-5) with per-stage rubrics, generalized ScoreResult to scores dict, and made variant generator stage-agnostic

> Added STAGE_CONFIGS registry (stages 2-5) with per-stage rubrics, generalized ScoreResult to scores dict, and made variant generator stage-agnostic

## What Happened
---
id: T01
parent: S04
milestone: M013
key_files:
  - backend/pipeline/quality/scorer.py
  - backend/pipeline/quality/variant_generator.py
key_decisions:
  - Used backward-compat properties on ScoreResult instead of migrating all callers
  - Made VARIANT_META_PROMPT a template with {dimension_descriptions} filled per-stage
duration: ""
verification_result: passed
completed_at: 2026-04-01T09:20:20.600Z
blocker_discovered: false
---

# T01: Added STAGE_CONFIGS registry (stages 2-5) with per-stage rubrics, generalized ScoreResult to scores dict, and made variant generator stage-agnostic

**Added STAGE_CONFIGS registry (stages 2-5) with per-stage rubrics, generalized ScoreResult to scores dict, and made variant generator stage-agnostic**

## What Happened

Built STAGE_CONFIGS registry mapping stages 2-5 to StageConfig objects with rubrics, dimensions, format markers, fixture keys, prompt file names, and schema classes. Generalized ScoreResult from named float fields to a scores dict with backward-compat properties for stage 5. Added score_stage_output() to ScoreRunner for arbitrary stage scoring. Updated variant_generator.py with templatized meta-prompt and format_markers/stage parameters on generate().

## Verification

All three verification commands pass: STAGE_CONFIGS has entries for stages 2-5, ScoreResult works with scores dict, backward-compat getattr works, StageConfig.get_schema() resolves all schema classes, PromptVariantGenerator imports cleanly.

## Verification Evidence

| # | Command | Exit Code | Verdict | Duration |
|---|---------|-----------|---------|----------|
| 1 | `python -c "from pipeline.quality.scorer import STAGE_CONFIGS, ScoreResult, ScoreRunner, DIMENSIONS; assert 2 in STAGE_CONFIGS and 3 in STAGE_CONFIGS and 4 in STAGE_CONFIGS and 5 in STAGE_CONFIGS; r = ScoreResult(scores={'structural': 0.8, 'readability': 0.7}, composite=0.75); print('scorer ok')"` | 0 | ✅ pass | 1000ms |
| 2 | `python -c "from pipeline.quality.variant_generator import PromptVariantGenerator; print('generator ok')"` | 0 | ✅ pass | 1000ms |
| 3 | `python -c "from pipeline.quality.scorer import STAGE_CONFIGS, ScoreResult, DIMENSIONS; [cfg.get_schema() for cfg in STAGE_CONFIGS.values()]; r = ScoreResult(scores={'structural': 0.8}, composite=0.8); assert r.structural == 0.8; print('compat ok')"` | 0 | ✅ pass | 1000ms |


## Deviations

Added SCORING_RUBRIC backward-compat alias. Made VARIANT_META_PROMPT a template string with {dimension_descriptions} placeholder.

## Known Issues

__main__.py line 148 uses getattr pattern that only works for stage 5 — will need updating when optimize CLI is generalized.

## Files Created/Modified

- `backend/pipeline/quality/scorer.py`
- `backend/pipeline/quality/variant_generator.py`


## Deviations
Added SCORING_RUBRIC backward-compat alias. Made VARIANT_META_PROMPT a template string with {dimension_descriptions} placeholder.

## Known Issues
__main__.py line 148 uses getattr pattern that only works for stage 5 — will need updating when optimize CLI is generalized.
