darwinian-evolver

Evolve prompts, regex, SQL, and code snippets with an LLM-driven evolutionary search loop.

Updated Jul 7, 2026
One-click install
npx skills add https://github.com/episvr/USTB-2026-SummerInternship --skill darwinian-evolver-episvr
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: darwinian-evolver
Source: https://github.com/episvr/USTB-2026-SummerInternship/tree/main/hermes-config/optional-skills/research/darwinian-evolver
Command: npx skills add https://github.com/episvr/USTB-2026-SummerInternship --skill darwinian-evolver-episvr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires openai, jinja2, darwinian_evolver, and includes scripts (resource) components.

What problem does it solve? Manually iterating on prompts, regex patterns, SQL queries, or small code snippets to improve their measured performance is slow and unsystematic. This Skill runs Imbue's darwinian_evolver loop to automatically mutate candidates against a fitness function until scores improve. ## Core Features & Use Cases - LLM-Driven Evolution Loop: Defines an Organism, Evaluator, and Mutator, then iterates generations of candidates scored on a 0-1 fitness scale with trainable and holdout failure cases to detect overfitting. - OpenRouter Driver: Ships a parrot_openrouter.py script that routes LLM calls through OpenRouter via the OpenAI SDK, so any provider model works without an Anthropic key. - Custom Problem Template: Provides templates/custom_problem_template.py with marked sections for defining your own organism, evaluator, and mutator, plus a snapshot inspector for ranked results. - Use Case: You have a prompt template that only scores 0.0 on verbatim phrase repetition. Run the parrot example for 3 iterations and get 7 evolved templates ranked by score, with the best reaching 0.6-0.8. ## Quick Start Ask the agent to install the darwinian_evolver repo and run the OpenRouter parrot example with your OPENROUTER_API_KEY for three iterations.

Frequently Asked Questions about darwinian-evolver

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize a prompt with evolutionary search?▼

Define an Organism holding your prompt template, an Evaluator that scores outputs on a 0-1 scale with failure cases, and an LLM-based Mutator that proposes fixes. Then run EvolveProblemLoop for several iterations and inspect the ranked population snapshots.

How to run darwinian_evolver without an Anthropic API key?▼

The upstream CLI is hardcoded to Anthropic, but the shipped parrot_openrouter.py driver routes LLM calls through OpenRouter using the OpenAI SDK. Set OPENROUTER_API_KEY and EVOLVER_MODEL to use any OpenRouter provider.

Can I use darwinian_evolver to evolve regex or SQL queries?▼

Yes, the Organism is a Pydantic model that can hold a regex_pattern, sql_query, or code_block field instead of a prompt_template. You implement a run method that exercises the artifact and an evaluator that scores the results.

Why does my evolution run fail with HTTP 400 errors?▼

Azure-backed OpenRouter models reject phrases like "ignore previous instructions" via content filters. Wrap the LLM call in try/except and return an error string so the evolver scores that organism 0 and continues instead of crashing.

When should I not use evolutionary prompt optimization?▼

Avoid it when the optimization target is differentiable (use gradient descent or DSPy), when you only need 2-3 variants you can write by hand, or when the fitness signal is purely subjective with no measurable criterion.

How many LLM calls does an evolution run cost?▼

A typical run uses 50-500 LLM calls depending on iterations, parents per iteration, and concurrency settings. On gpt-4o-mini that costs pennies, while Claude Sonnet runs can cost a few dollars.