Skip to content

feat(arena): skills arena + genetic synthesis PoCs (#28) - #13

Draft
rotnov wants to merge 5 commits into
mainfrom
feat/skills-arena-poc
Draft

feat(arena): skills arena + genetic synthesis PoCs (#28)#13
rotnov wants to merge 5 commits into
mainfrom
feat/skills-arena-poc

Conversation

@rotnov

@rotnov rotnov commented May 24, 2026

Copy link
Copy Markdown
Member

Summary

Four PoC scripts validating the methodology and design choices for godfather task #28 (skills arena — L4+L5 of the iEvo evolution hierarchy).

Script Question Answer Cost
skills_arena_poc.py Does A/B arena methodology produce sensible quality signals? ✅ Strong skill > stripped skill (controlled experiment) $0.58
skills_genetic_poc.py Does LLM-mediated crossover beat both parents? ✅ (but only as compressor when one parent is weak) $3.81
skills_genetic_v2_poc.py Does crossover MIX ideas when parents are strategy-diverse? ✅ all 3 children dominate; parents get 0/4 each $4.75
skills_genetic_v3_multigen_poc.py Does gen-2 keep improving over gen-1? ✅ gen-2 strictly dominates (4-0-2); variance high → best-of-N critical $5.36

Total: ~$14.50 to empirically answer four #28 design questions.

Key findings for #28 design

  • Arena methodology works — position-swapped Opus judging cleanly separates skill quality (controlled experiment proves this before applying to real candidates).
  • Single-gen crossover beats both parents reliably when parents represent distinct valid strategies (not strong+weak — that's just compression).
  • Multi-gen improves further but with higher variance — only 1/3 grandchildren strongly improved in v3. Arena loop needs explicit best-of-N selection + stopping criterion when no improvement.
  • Qualitative gen-2 improvements are real refinements, not cosmetic: 4-way decision tree instead of slogan, concrete JSON manifest schema, exponential backoff, explicit user choice on transient failure.

Files

  • scripts/skills_arena_poc.py — arena methodology PoC
  • scripts/skills_genetic_poc.py — single-gen genetic synthesis
  • scripts/skills_genetic_v2_poc.py — strategy-diverse parents (defensive × optimistic)
  • scripts/skills_genetic_v3_multigen_poc.py — multi-generation crossover

Next steps (not in this PR)

Update task #28 spec with PoC findings; design the production arena loop with best-of-N selection and gen-stopping criterion.

🧬 Evolved with iEVO

rotnov and others added 2 commits May 24, 2026 10:49
Phase 1 of the skills arena roadmap (per
.ievo/research/2026-05-24-skills-arena.md). Standalone script that runs
ONE controlled-experiment arena round to validate the A/B eval
methodology before investing in full implementation.

## Controlled experiment design

- Candidate A: full production-style SKILL.md (verbose ievo:init
  orchestrator with 7 steps, pre-flight, stack detection, security
  audit, install, summary, journal)
- Candidate B: deliberately stripped variant of the same skill
  (3-line body, no steps, no failure handling)
- Same task: "you just ran /ievo:init in a Next.js+TS project, walk
  through every step"
- Ground truth: A should win. If arena says B or tie, methodology has
  a bug.

## Pipeline

1. Run each candidate K times (default 3) with Haiku, passing
   SKILL.md as system prompt
2. Pick representative output per candidate (longest non-empty —
   verbosity bias is a known issue, Phase 5 of roadmap adds correction)
3. Opus judge sees both outputs side-by-side, picks winner + emits JSON
   verdict
4. Position-swap: re-run judge with outputs reversed
5. Consistent-winner only counts (mitigates first-position bias —
   GPT-4 30%, Claude-v1 75% per MT-Bench)

## Reuses

- `cortex.claude.query_raw` — same machinery as cortex evolution A/B
  eval (task #31, shipped v0.5.2)
- Methodology validated in `.ievo/research/2026-03-06-blind-ab-eval.md`

## Configuration via env

- `ARENA_RUNS_PER` (default 3) — Haiku runs per candidate
- `ARENA_RUNNER_MODEL` (default haiku) — model for candidate runs
- `ARENA_JUDGE_MODEL` (default opus) — judge model

## Output

- Stdout: human-readable report with both verdicts + consistency check
- `dist/arena-poc/round-A-vs-B.json` — full transcripts + cost data
- Exit codes: 0 = A won (methodology validated), 1 = B won
  (unexpected — investigate), 2 = tie, 3 = position-bias inconsistent

## Cost

~$0.50-1.00 per round (3 Haiku × 2 candidates + 2 Opus judges).
Requires CLAUDE_CODE_OAUTH_TOKEN in env.

## Out of scope (deferred to Phase 2+ of roadmap)

- Real sandbox installer (current PoC inlines SKILL.md content as
  system prompt; production version installs via `npx skills add`)
- Token-length anti-verbosity correction
- Author/owner anonymization at the metadata level (judge prompt
  already strips author info)
- Real candidate pairs from skills.sh
- Multi-candidate (N>2) round-robin or tournament logic
- `/ievo:arena <name>` CLI integration
- Periodic re-rank workflow in cortex CI

## Next step after PoC runs successfully

If consistent_winner = production: methodology validated → Phase 2
(real sandbox installer). If unexpected: investigate Haiku output
patterns or judge prompt before scaling.

Co-Authored-By: iEVO <noreply@ievo.ai>
First PoC run (2026-05-24 10:51-11:00) validated methodology
mechanically but with degenerate inputs: tools=[] + max_turns=3
caused Haiku to produce empty text in 4/6 candidate runs. Judge was
comparing real-vs-empty, not real-vs-real.

Operator caught it: "у агента нет доступка к тулам?" — yes, that was
the bug. Skill orchestrators ARE agent harnesses; without tools the
agent has nothing to demonstrate.

## Changes

- Each iteration gets a fresh sandbox cwd at $TMPDIR/arena_poc_*/
  with minimal Next.js+TS project markers (package.json with next/
  react/typescript deps, tsconfig, README, .gitignore) so the skill
  agent has something realistic to inspect
- Tool set: Read, Write, Glob, Grep, Bash — realistic for a skill
  orchestrator doing project inspection + execution simulation
- max_turns: 3 → 15 (realistic budget for an orchestrator with
  several steps)
- Each candidate iteration gets its OWN sandbox (no contamination
  between runs of the same candidate or between candidates)

## Second run result (2026-05-24 11:16-11:19)

Both candidates produced real text outputs. Judges substantively
ranked them on quality dimensions:
  - Forward: A wins on security audit, trust tiers, ecosystem
    specificity, failure handling
  - Swapped: same quality observations, swap-consistent
  - Consistent winner: ievo-init-full ✓
  - Cost: $0.5756

Methodology produces meaningful quality signals, not just
real-vs-empty distinctions. Phase 1 PoC fully validated.

Co-Authored-By: iEVO <noreply@ievo.ai>
@rotnov
rotnov marked this pull request as ready for review May 24, 2026 10:27
@rotnov
rotnov marked this pull request as draft May 24, 2026 10:30
rotnov and others added 3 commits May 24, 2026 12:41
Tests whether two parent skills crossed by Opus produce a child that
beats both in arena. Multi-child population (N=3) + all-vs-all
round-robin to validate the effect isn't lucky-draw variance.

Result on ievo-init-full × ievo-init-weak: all 3 children beat both
parents (2/4 wins each vs 1/4 strong, 0/4 weak). Cost: $3.81.

Caveat: weak parent contributed nothing — child is compressed strong
parent. Real idea-mixing requires parents with different valid
strategies (next step).

Co-Authored-By: iEVO <noreply@ievo.ai>
v1 limitation: strong+weak parents → child was compressed strong parent
(weak contributed nothing). Crossover acted as compressor, not idea-mixer.

v2: two valid, philosophically opposite parents for the same /ievo:init
goal:
  - defensive-sequential: strict order, audit-first, halt on ambiguity
  - optimistic-parallel: parallel discovery, retry transients, rollback

Result: all 3 children beat BOTH parents. Parents got 0/4 wins each
(including head-to-head: inconsistent). Cost $4.75.

Best child synthesizes:
  - Parallel read-only work (Phase 1) — explicit safety classification
  - Audit gate before write (Phase 4) — combines safety + parallel speedup
  - Cascading rollback (Phase 5) — per-candidate + halt-if-rollback-fails
  - "Fast where safe, strict where it matters" — synthesizing principle

This is real idea-mixing, not compression. L5 genetic synthesis is viable
for skill domain when parents represent distinct valid strategies.

Co-Authored-By: iEVO <noreply@ievo.ai>
Tests: does gen-2 keep improving over gen-1, or plateau?

Pipeline: defensive × optimistic → 2 gen-1 children → cross them →
3 grandchildren → 5-way arena.

Result: gen-2 strictly dominates gen-1.
  Head-to-head: gen-2 wins 4, gen-1 wins 0, ties/inconsistent 2.
  Best grandchild: 3/4 wins. Both gen-1 parents: 0/4 each.
  Total cost: $5.36.

Key finding: variance is higher at gen-2 — only 1/3 grandchildren
strongly improved (3 wins), the others stayed flat (1 win each).
This means multi-gen needs explicit best-of-N selection: a single
gen-2 sample is unreliable; pooling 3+ and keeping the winner
recovers the improvement signal.

Qualitative diff (v3 grandchild-2 vs v2 synth-1):
  - 4-way decision tree (parallel/sequential/rollback/halt) vs
    2-way "fast where safe" slogan
  - Phase 5 reverted to sequential install — safer trade-off
  - discover.mjs failure: explicit user choice instead of silent
    fallback
  - Exponential backoff 2s→4s→8s vs flat 2s
  - Concrete manifest JSON schema with exact keys
  - Named invariant: "no code lands on disk before its audit clears"

For #28 design: arena loop should "generate N → keep best →
recurse → stop when no improvement for K generations."

Co-Authored-By: iEVO <noreply@ievo.ai>
@rotnov rotnov changed the title feat(arena): PoC script for skills arena methodology validation (#28) feat(arena): skills arena + genetic synthesis PoCs (#28) May 25, 2026
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