AgentSkillsCN

race-optimize

在通过多模型竞争优化代码、文本或提示时使用。触发条件——竞速优化、多模型优化、赛马优化、竞赛优化。

SKILL.md
--- frontmatter
name: race-optimize
description: Use when optimizing code, text, or prompts through multi-model competition. Triggers - race optimize, multi-model optimize, 赛马优化, 竞赛优化

Race Optimize

Multi-model competitive optimization: N models generate independently, cross-review extracts essences, deep-thinking synthesizes all contributions, adversarial review stress-tests, evidence-based verification confirms improvement.

Trigger Keywords

  • "race optimize", "race-optimize", "racing"
  • "multi-model optimize", "competitive optimization"

Pipeline

code
DIVERGE → EVALUATE → CONVERGE → STRESS → VERIFY → [Loop if improved > 5%]

Phase 1: DIVERGE — N models generate in parallel, each with a different strategy bias. Phase 2: EVALUATE — Cross-review all versions + extract structured essences (JSON). Phase 3: CONVERGE — Deep-thinking judge: strategy analysis → essence fusion. Phase 4: STRESS — Adversarial attack + auto-patch critical issues. Phase 5: VERIFY — Code: run tests/benchmarks. Text: independent jury scoring (median).

Loop until convergence (improvement < 5%) or max rounds reached.

Scenes (auto-detected)

SceneDetectionVerificationCriteria
code-performanceCode file extensions (.js, .py, .ts, etc.)Tests + benchmarkcode-performance.md
code-refactorKeywords: "refactor", "YAGNI"Testscode-refactor.md
promptKeywords: "prompt"Multi-model scoringprompt-engineering.md
textDefaultMulti-model scoringtext-general.md

Invocation

CLI (simple):

bash
node $HOME/git/infrastructure-skills/lib/race.js <file> "<goal>"

Programmatic API:

javascript
import { Race } from "$HOME/git/infrastructure-skills/lib/race.js";
const result = await new Race({ target: "sort.py", goal: "faster" }).run();

Key Innovation: Essence Extraction

Every model's output contributes. Phase 2 extracts the single best contribution from each version as structured JSON. Phase 3 MUST incorporate all essences — nothing is wasted.

Model Roles

  • Racers: claude-opus-4-6, gpt-5, gpt-5-codex, claude-opus-4-5, deepseek (generate competing versions)
  • Judge: claude-thinking (strategy analysis + essence fusion)
  • Adversary: claude-thinking (attack merged output)
  • Scorers: racers excluding judge (independent jury)
  • Fallback: gpt-5-chat, grok (when primary models fail)

Output

Results saved to race_output/:

  • original.md — backup of original
  • round{N}/version_{A,B,C...}.md — each racer's output
  • round{N}/review_{1,2,3}.md — cross-reviews
  • round{N}/strategy.md — judge's strategy analysis
  • round{N}/merged.md — fused version
  • round{N}/adversarial.md — adversarial review
  • round{N}/fixed.md — patched version (if needed)
  • round{N}/verification.json — scores and evidence
  • final.* — final optimized version
  • report.md — full optimization report