Skip to content

Feat/gepa phase0 shadow harness - #20

Merged
matheusht merged 5 commits into
mainfrom
feat/gepa-phase0-shadow-harness
Jun 24, 2026
Merged

Feat/gepa phase0 shadow harness#20
matheusht merged 5 commits into
mainfrom
feat/gepa-phase0-shadow-harness

Conversation

@matheusht

Copy link
Copy Markdown
Owner

No description provided.

matheusht and others added 5 commits June 12, 2026 16:35
Phase 0 of the GEPA adoption plan: a dependency-free, no-live-call shadow
harness that exercises the full candidate lifecycle so every safety surface is
tested before the real optimizer (Phase 1) arrives.

- gepa_allowlist: firewall the search space to attacker prompt-profile fields;
  judge/rubrics/promotion/defense are unreachable by construction.
- gepa_candidate: GepaCandidate + GepaEvaluationResult with the authority ladder
  (gepa-accept != redthread-accept != promoted) kept explicitly separate.
- gepa_score: normalize research metrics into a scalar + Pareto vector; control
  lane is a fail-closed gate, never a reward bonus.
- gepa_side_info: redaction layer (the only channel to a future reflection LM);
  allowlist-by-construction, no transcripts/canaries/secrets; named to avoid the
  GEPA-ASI vs telemetry-ASI collision.
- gepa_shadow: MockProposer + CachedEvaluator + ShadowHarness; snapshots confined
  to research runtime dir; budget stop; split-overlap validation.
- models/baseline: additive ObjectiveResult on ResearchBatchSummary so per-objective
  scores (already computed in run_objective, previously discarded) survive for
  Pareto. Existing consumers read composite_score unchanged.

Tests: 8 containment gates (allowlist, snapshot confinement, redaction, control-fail
rejection, split overlap, budget stop, no promotion/memory writes, ObjectiveResult
round-trip). ruff + mypy clean; existing research suites unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replaces the max(composite_score) winner-collapse with a true Pareto frontier over
per-objective score vectors (Phase 0's ObjectiveResult plumbing). Specialists that
lead different objectives both survive; parent selection samples the frontier
weighted by objectives led, per arXiv 2507.19457.

Dependency-free and deterministic given a seeded RNG. The control split is never a
Pareto axis — it stays a gate, not an objective.

Tests: domination, specialist preservation (the core guarantee), dominated-exclusion,
leader weighting, seeded-selection determinism, control-axis exclusion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tional)

Scaffolds RedThreadGEPAAdapter against the real gepa 0.1.1 GEPAAdapter protocol
(verified by inspecting the installed source, not guessed):

- gepa pinned as an OPTIONAL dependency group [research-gepa]; imported lazily so
  core installs never require it.
- evaluate(batch, candidate, capture_traces): one ResearchObjective per DataInst;
  returns per-objective normalized scores + native objective_scores breakdown that
  feeds gepa's frontier_type='objective' Pareto selection.
- make_reflective_dataset: gepa's {Inputs, Generated Outputs, Feedback} schema, all
  text redacted via gepa_side_info — the only channel to the teacher LM.
- BatchRunner injected, so the adapter is fully unit-tested with a cached runner and
  ZERO live calls. Live execution stays a Phase 1-gated, budgeted decision.
- build_optimize_kwargs requires explicit reflection_lm + positive max_metric_calls
  (no silent default); wires pareto + objective frontier.

Safety contracts preserved: allowlist on candidate + seed, redaction on reflective
records, control lane remains a gate (handled by the runner/wrapper, never a bonus).

Tests: score/output alignment, objective breakdown, allowlist rejection, redacted
per-component reflective dataset, budget guard, non-allowlisted-seed rejection.
ruff + mypy clean; 58 GEPA+research tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ellm dep

Adds the disposable proof vehicle the CEO+CTO asked for before any under-the-hood
integration: a single small GEPA run that answers "does reflective + Pareto-selected
prompt optimization beat today's hard-coded mutation table on a held-out objective?"

- scripts/spikes/gepa_phase1_spike.py: NOT a CLI command (surfacing stays under the
  hood, per unanimous CEO+CTO review). --mock runs an offline harness self-test (no
  model calls, no extra deps); the live path applies a candidate to the research-runtime
  prompt_profiles.json only, runs one bounded campaign per objective, and prints the
  baseline-vs-GEPA lift as a GO/NO-GO. Verified: attack algos (pair/tap/crescendo/mcts)
  read system_suffix/strategies from prompt_profiles at runtime, so the candidate truly
  changes behavior.
- litellm>=1.0 added to the [research-gepa] optional group: gepa drives string
  reflection_lm ids (e.g. "ollama/<model>") through litellm, which it does not hard-depend
  on. Reflection LM stays local; judge stays the configured model.

Live run is gated on a running Ollama (not available now); mock self-test, ruff, mypy
all green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@matheusht
matheusht merged commit 58d480f into main Jun 24, 2026
1 check passed
@ecc-tools

ecc-tools Bot commented Jun 24, 2026

Copy link
Copy Markdown

Analyzing 200 commits...

@matheusht
matheusht deleted the feat/gepa-phase0-shadow-harness branch June 24, 2026 14:05
@ecc-tools

ecc-tools Bot commented Jun 24, 2026

Copy link
Copy Markdown

Analysis Complete

Generated ECC bundle from 5 commits | Confidence: 55%

View Pull Request #21

Repository Profile
Attribute Value
Language Python
Framework Not detected
Commit Convention conventional
Test Directory separate
Changed Files (20)
Metric Value
Files changed 20
Additions 1732
Deletions 234

Top hotspots

Path Status +/-
NEXT_SESSION_HANDOFF.md removed +0 / -231
tests/test_gepa_phase0.py added +219 / -0
scripts/spikes/gepa_phase1_spike.py added +205 / -0
src/redthread/research/gepa_shadow.py added +197 / -0
src/redthread/research/gepa_adapter.py added +185 / -0

Top directories

Directory Files Total changes
src/redthread/research 10 891
tests 3 437
. 4 433
scripts/spikes 1 205
docs 2 0
Analysis Depth Readiness (evidence-backed, 29%)

ECC Tools uses this to decide whether recommendations should stay at commit-history/setup guidance or expand into CI, security, harness, reference-set, AI-routing, and team backlog work.

Area Status Evidence / Next Step
Commit history Ready 5 commits sampled
CI/CD signals Missing Add workflow files or CI troubleshooting evidence so ECC Tools can reason about pipeline setup.
Security evidence Missing Add AgentShield, audit, SARIF, SBOM, or security review evidence so recommendations can cover security posture.
Harness configuration Ready tests/test_gepa_adapter.py
Reference/eval evidence Missing Add fixtures, golden traces, reference sets, or evaluator benchmarks so deeper recommendations have regression evidence.
AI routing and cost controls Missing Add model-routing, budget, usage, or cost-control files before relying on AI-heavy automation recommendations.
Team handoff and project tracking Missing Add roadmap, runbook, project, Linear, or follow-up tracking docs so generated work can land in a team queue.
Reference Set Readiness (1/7, 14%)
Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Present tests/test_gepa_adapter.py
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.
Detected Workflows (2)
Workflow Description
add-new-research-module Implements a new research module or phase, including code, tests, and plumbing for new GEPA phases or components.
add-or-update-research-dependency Adds or updates an optional research dependency (e.g., gepa, litellm) and ensures it is properly pinned and grouped in pyproject.toml and lockfile.
Generated Instincts (22)
Domain Count
git 4
code-style 9
testing 5
workflow 4

After merging, import with:

/instinct-import .claude/homunculus/instincts/inherited/redthread-instincts.yaml

Files

  • .claude/ecc-tools.json
  • .claude/skills/redthread/SKILL.md
  • .agents/skills/redthread/SKILL.md
  • .agents/skills/redthread/agents/openai.yaml
  • .claude/identity.json
  • .codex/config.toml
  • .codex/AGENTS.md
  • .codex/agents/explorer.toml
  • .codex/agents/reviewer.toml
  • .codex/agents/docs-researcher.toml
  • .claude/homunculus/instincts/inherited/redthread-instincts.yaml
  • .claude/commands/add-new-research-module.md
  • .claude/commands/add-or-update-research-dependency.md

ECC Tools | Everything Claude Code

matheusht added a commit that referenced this pull request Aug 9, 2026
- rewrite docs/current_repo_state.md to reflect GEPA-era reality (PR #20
  merged Phase 0-2, working tree carries Phase 1/3/4 spikes)
- add GEPA research lane (R0-R4) to docs/PHASE_REGISTRY.md
- add wiki research page gepa-adoption.md and link it from index
- append wiki log entry
- note GEPA research lane in README
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.

1 participant