What is a Gene?
A Gene is a reusable strategy for handling specific problem patterns in agent evolution. Genes define:- Signal Patterns they respond to (
signals_match) - Category of change (repair, optimize, innovate)
- Strategy steps to follow
- Constraints on blast radius
- Validation commands that must pass
Gene Structure
Must be
"Gene"Unique identifier (e.g.,
gene_gep_repair_from_errors)One of:
repair, optimize, innovateArray of signal keywords this Gene handles
Human-readable conditions for when this Gene applies
Step-by-step strategy for applying this Gene
Blast radius limits and forbidden paths
Commands that must pass before solidifying changes
Real Gene Examples
Repair Gene: gene_gep_repair_from_errors
This Gene handles error-related signals by applying minimal, reversible patches.
When This Gene Activates
When This Gene Activates
Signal Patterns:Selector Output:
- Log lines containing “error”, “exception”, “failed”
- Stack traces or error messages in memory
- User instructions mentioning “fix” or “repair”
Optimize Gene: gene_gep_optimize_prompt_and_assets
This Gene handles protocol improvements and prompt refinements.
When This Gene Activates
When This Gene Activates
Signal Patterns:
- Keywords: “protocol”, “gep”, “audit”, “reusable”
- User requests for better prompt structure
- Need for stricter output validation
- Detect ambiguous prompt sections
- Refactor to embed Gene/Capsule assets directly
- Add schema validation for outputs
- Run validation commands
- Create Capsule on success
Innovate Gene: gene_gep_innovate_from_opportunity
This Gene handles feature requests and capability gaps when the system is stable.
When This Gene Activates
When This Gene Activates
Signal Patterns:
- User feature requests
- Performance bottlenecks
- Capability gaps identified
- System stable with no errors (precondition)
log_error signals are present. Repair takes priority.Blast Radius:
Innovate changes are allowed up to 25 files (vs. 20 for repair/optimize).Signal Matching
How Signals Match Genes
The selector computes overlap between input signals andsignals_match arrays:
Signal Extraction
Signals are extracted from multiple sources:Validation Commands
Command Structure
All validation commands use repo-root-relative paths:Safety Checks
Before executing, all commands are validated (src/gep/solidify.js):
Example Validation Report
Gene Categories
Repair
Purpose: Fix errors and restore stability Characteristics:- Smallest blast radius (max 20 files)
- Highest priority when errors present
- Validation must include affected modules
- Reversible patches only
Optimize
Purpose: Improve existing functionality Characteristics:- Medium blast radius (max 20 files)
- Focus on code quality, performance, protocol
- Requires clear “before/after” validation
Innovate
Purpose: Add new features and capabilities Characteristics:- Largest blast radius (max 25 files)
- Only activates when stable (no errors)
- May create new Genes for novel patterns
- Higher risk tolerance
Creating Custom Genes
Gene Selection Priority
When multiple Genes match the same signals:- Memory Preference: Genes with successful history get boosted
- Signal Overlap: Higher match percentage wins
- Category Priority: Repair > Optimize > Innovate
- Explicit User Intent: User instructions can override
Next Steps
Capsules
See how successful Gene applications become reusable Capsules
Events
Track evolution history through EvolutionEvent trees