A self-modification engine for autonomous agents. Behaviors mutate their parameters based on performance fitness — elite performers are protected, low performers are aggressively adjusted.
- Zero dependencies, no
malloc— pure stack-based C11 - Deterministic pseudo-random mutations via hash of (timestamp + index + generation)
- Elite protection, normal mutation, and aggressive low-fitness modes
- Full mutation history with revert and rollback
- Behavior scoring and ranking (best/worst)
void evolve_init(EvolutionEngine *e, uint64_t now);
int genome_add_behavior(Genome *g, const char *name, float value, float min, float max, float mut_rate);
float genome_get(Genome *g, const char *name);
int genome_set(Genome *g, const char *name, float value);
int evolve_cycle(EvolutionEngine *e, uint64_t now, float fitness);
int evolve_score(EvolutionEngine *e, const char *behavior, float outcome);
int evolve_revert(EvolutionEngine *e, int history_index);
int evolve_rollback(EvolutionEngine *e, uint32_t target_generation);
int evolve_best_behaviors(const EvolutionEngine *e, int n, Behavior *results);
int evolve_worst_behaviors(const EvolutionEngine *e, int n, Behavior *results);make test| Constant | Value |
|---|---|
| BEHAVIORS_MAX | 32 |
| MUTATIONS_MAX | 256 |
| BEHAVIOR_NAME_MAX | 32 |
| MUT_REASON_MAX | 64 |
Public domain / CC0