Strategy Gene Evolution System
Strategy Gene is based on the GEP paper, encoding experience into compact Gene objects (~230 tokens) instead of document-style Skill packages (~2500 tokens). Genes are implemented at the Hard Constraint layer of the Control Loop, achieving self-optimization through task matching, dynamic injection, and failure-driven evolution.
Gene Structure
Each Gene contains three sections:
[HARD CONSTRAINTS]
- Task-specific constraints and rules
- Conditions that MUST be satisfied
[CONTROL ACTION]
- Recommended actions for this task type
- MUST DO / MUST NOT DO directives
[AVOID]
- Patterns that led to failures
- Auto-extracted from failure feedbackTask Matching
TaskSignalMatcher matches Gene templates via keywords, and matched Genes are injected into the LLM system prompt:
| Field | Description |
|---|---|
| task_signals | Keywords for task type matching |
| task_type | Task category identifier |
| title | Human-readable gene title |
Evolution Mechanism
Genes support automatic and manual evolution:
- Failure Detection - 3 consecutive failures trigger evolution conditions
- Auto-Extract - Avoid Cues extracted from failure feedback
- Version Update - New Avoid Cue written to [AVOID] section, version +1
- History Tracking - evolution_history tracks all changes
Avoid Cues Auto-Extraction
The system automatically extracts failure-avoidance hints:
- Consecutive failure pattern - Adds 'DON'T: Repeat patterns causing N consecutive failures'
- High failure rate - Adds 'DON'T: Approaches with N% failure rate'
- Low-reward strategies - Adds 'DON'T: Low-reward strategies (avg N.NN)'
Version Management
Each Gene maintains version history:
{
"version": 3,
"evolution_history": [
{"version": 2, "change": "auto-extract: 2 avoid cues", "at": "2024-01-15T10:30:00"},
{"version": 3, "change": "manual edit", "at": "2024-01-16T14:20:00"}
]
}Performance Metrics
| Metric | Description |
|---|---|
| usage_count | Total times this gene was used |
| success_count / failure_count | Success/failure statistics |
| success_rate | Success rate (0.0 - 1.0) |
| avg_reward | Average reward from FeedbackEvaluator |
| consecutive_success / failure | Consecutive success/failure streaks |
Gene Composer
GeneComposer supports merging multiple Genes in multi-task scenarios, avoiding conflicts while preserving effective constraints from each.
This implementation references the Strategy Gene paper (arXiv:2604.15097). Thanks to the research team for their contribution.
