Skip to content

Optimizer Slice B: live shadow A/B — promote/retire in dollars (v1.7.0-rc.1)#74

Merged
Ryfter merged 8 commits into
masterfrom
feature/optimizer-slice-b
Jul 3, 2026
Merged

Optimizer Slice B: live shadow A/B — promote/retire in dollars (v1.7.0-rc.1)#74
Ryfter merged 8 commits into
masterfrom
feature/optimizer-slice-b

Conversation

@Ryfter

@Ryfter Ryfter commented Jul 3, 2026

Copy link
Copy Markdown
Owner

What

Closes the GEPA loop with live evidence (spec: docs/superpowers/specs/2026-07-02-optimizer-slice-b-live-shadow-ab-design.md, decision d072). A gate-surviving candidate becomes the challenger: real /baton:go runs alternate champion/challenger (fewer live runs takes the run), CostResolver-metered realized cost + acceptance verdicts accrue per variant, and the pool answers promote/retire on cost per accepted outcome — rework dollars included by construction.

  • Assignment (Invoke-PlanPhase + Resolve-ShadowVariant): fail-open — no pool / no challenger / --shadow off / unreadable challenger text → today's behavior exactly. Assignment logged as a shadow event + shadow.json.
  • Accrual + auto-retire (Complete-Run, after the report, fail-open): live.* counters + realized/rework dollars; at ≥5 gated runs per variant a challenger losing in dollars is auto-retired, a winner gets a PROMOTE recommendation — deployment stays human --apply (d070 unchanged).
  • One retirement door (Set-CandidateRetired): every retirement — mechanical, gate failure, superseded, live A/B loss — now records why, when (retired_at), and what beat it (retired_by).
  • CLI: --shadow on|off kill switch (persisted; absent = on); --pool grows live columns + a shadow-verdict footer.

Verification

  • Suites green: prompt-pool 57, optimize-prompt 32, conductor 102 (incl. SB1–SB10), bootstrap.
  • Final whole-branch review (opus): READY TO MERGE — 0 Critical / 0 Important / 3 Minor; M3 (CLI clean exit 2) fixed pre-merge (1bf27cc), M1/M2 documented + deferred (informational event repetition; self-healing attribution edge).
  • Notable catches during build: ConvertFrom-Json DateTime auto-parse would have corrupted retired_at round-trips (fixed in Get-PromptPool); challenger text now validated before role selection so a dead challenger can't skew alternation.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 3, 2026 00:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Implements “Optimizer Slice B” live shadow A/B for the Conductor planner prompt: real /baton:go runs alternate champion vs challenger, accrue realized/rework dollars plus gate verdicts per variant, and use cost-per-accepted-outcome to recommend promotion or auto-retire losing challengers (with a persisted --shadow on|off kill switch and retirement provenance fields).

Changes:

  • Added prompt-pool Slice B primitives: single retirement door with provenance, shadow assignment, live accrual, and dollars-based verdict.
  • Wired shadow assignment into planning and live accrual/auto-retire into Complete-Run, plus CLI support and expanded pool reporting.
  • Added comprehensive hermetic PowerShell test coverage and updated docs/specs/version to 1.7.0-rc.1.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/prompt-pool-lib.ps1 Adds Slice B pool schema fields + retirement door + shadow selection + live accrual + dollars verdict.
scripts/conductor-lib.ps1 Wires shadow assignment into plan prompt building and accrues live results + auto-retire after reporting.
scripts/optimize-prompt-lib.ps1 Refactors all retirement paths to go through Set-CandidateRetired with provenance.
scripts/fleet-optimize-prompt.ps1 Adds `-Shadow on
scripts/test-prompt-pool-lib.ps1 Adds unit tests P30–P55a for all new pool Slice B primitives.
scripts/test-optimize-prompt-lib.ps1 Adds E14/E15 tests for retirement provenance stamping.
scripts/test-conductor-lib.ps1 Adds SB1–SB10 tests for shadow assignment, accrual, fail-open, and auto-retire behavior.
docs/superpowers/specs/2026-07-02-optimizer-slice-b-live-shadow-ab-design.md Design spec for Slice B shadow A/B behavior and constraints.
docs/superpowers/plans/2026-07-02-optimizer-slice-b-live-shadow-ab.md Implementation plan capturing task breakdown and required interfaces.
docs/COMMANDS.md Documents Slice B shadow lifecycle and adds `--shadow on
commands/optimize-prompt.md Updates command invocation + documents live shadow A/B lifecycle and kill switch.
commands/go.md Notes that runs may include a shadow event when a challenger is live.
.claude-plugin/plugin.json Bumps plugin version to 1.7.0-rc.1.

Comment thread scripts/conductor-lib.ps1
Comment on lines +345 to +353
if ($sv.role -eq 'challenger') { $shadowTemplate = [string]$sv.template }
try {
@{ variant_id = [string]$sv.variant_id; role = [string]$sv.role
challenger_id = [string]$sv.challenger_id
assigned = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') } |
ConvertTo-Json | Set-Content -LiteralPath (Join-Path $RunDir 'shadow.json') -Encoding utf8NoBOM
$vsOther = if ($sv.role -eq 'challenger') { 'champion' } else { "challenger $($sv.challenger_id)" }
Add-RunEvent -RunDir $RunDir -EventObj (New-RunEvent -Kind 'shadow' -Message "prompt variant $($sv.variant_id) ($($sv.role)) — live A/B vs $vsOther")
} catch { $shadowTemplate = $null }
Comment thread scripts/conductor-lib.ps1
Comment on lines +434 to +435
$poolLoaded = Get-PromptPool
if (($null -ne $assign) -and $assign.variant_id -and $poolLoaded.ok) {
@Ryfter
Ryfter merged commit 7da5826 into master Jul 3, 2026
1 check passed
@Ryfter
Ryfter deleted the feature/optimizer-slice-b branch July 3, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants