|
1 | 1 | # flux-evolve |
2 | | -Rust self-modification engine: genome, mutation, revert, rollback, elite protection |
| 2 | + |
| 3 | +> Behavioral evolution engine with mutation, scoring, fitness-based selection, and rollback for FLUX agents. |
| 4 | +
|
| 5 | +## What This Is |
| 6 | + |
| 7 | +`flux-evolve` is a Rust crate implementing an **evolutionary engine** for agent behaviors — it manages tunable parameters with mutation rates, tracks fitness scores, supports aggressive/normal/elite evolution modes, and provides full rollback capabilities. |
| 8 | + |
| 9 | +## Role in the FLUX Ecosystem |
| 10 | + |
| 11 | +Agent adaptation is core to the FLUX philosophy. `flux-evolve` drives continuous improvement: |
| 12 | + |
| 13 | +- **`flux-trust`** provides fitness signals (trust scores) that feed evolution cycles |
| 14 | +- **`flux-social`** determines which behaviors evolve based on agent role |
| 15 | +- **`flux-memory`** persists evolved parameters across sessions via snapshots |
| 16 | +- **`flux-profiler`** measures performance of evolved behaviors |
| 17 | +- **`flux-grimoire`** records successful evolutions as "spells" for other agents to learn |
| 18 | + |
| 19 | +## Key Features |
| 20 | + |
| 21 | +| Feature | Description | |
| 22 | +|---------|-------------| |
| 23 | +| **Mutation Engine** | 8 mutation types: ParamAdjust, ThresholdShift, WeightRebalance, etc. | |
| 24 | +| **Fitness Modes** | Aggressive (low fitness), Normal, Elite (high fitness — only worst mutate) | |
| 25 | +| **Scoring** | `score(behavior, outcome)` accumulates evidence for each parameter | |
| 26 | +| **Best/Worst** | Rank behaviors by average cumulative score | |
| 27 | +| **Revert & Rollback** | Undo specific mutations or roll back to a generation | |
| 28 | +| **Bounded Parameters** | Every behavior has min/max clamping with configurable mutation rates | |
| 29 | + |
| 30 | +## Quick Start |
| 31 | + |
| 32 | +```rust |
| 33 | +use flux_evolve::Engine; |
| 34 | + |
| 35 | +let mut engine = Engine::new(); |
| 36 | + |
| 37 | +// Define evolvable behaviors |
| 38 | +engine.add_behavior("exploration_depth", 0.5, 0.0, 1.0, 0.1); |
| 39 | +engine.add_behavior("caution_threshold", 0.3, 0.0, 1.0, 0.05); |
| 40 | +engine.add_behavior("collaboration_weight", 0.7, 0.0, 1.0, 0.08); |
| 41 | + |
| 42 | +// Score outcomes |
| 43 | +engine.score("exploration_depth", 0.8); |
| 44 | +engine.score("caution_threshold", -0.3); |
| 45 | + |
| 46 | +// Evolution cycle (fitness determines strategy) |
| 47 | +let mutations = engine.cycle(0.5); // normal fitness → normal mutation rate |
| 48 | +println!("Generation {}: {} mutations", engine.generation(), mutations); |
| 49 | + |
| 50 | +// Rollback if things go wrong |
| 51 | +engine.rollback(2); // undo all mutations after generation 2 |
| 52 | + |
| 53 | +// Inspect |
| 54 | +let worst = engine.worst_behaviors(3); |
| 55 | +let best = engine.best_behaviors(3); |
| 56 | +``` |
| 57 | + |
| 58 | +## Building & Testing |
| 59 | + |
| 60 | +```bash |
| 61 | +cargo build |
| 62 | +cargo test |
| 63 | +``` |
| 64 | + |
| 65 | +## Related Fleet Repos |
| 66 | + |
| 67 | +- [`flux-trust`](https://github.com/SuperInstance/flux-trust) — Trust scoring as fitness signal |
| 68 | +- [`flux-social`](https://github.com/SuperInstance/flux-social) — Social context for behavior selection |
| 69 | +- [`flux-memory`](https://github.com/SuperInstance/flux-memory) — Persist evolved parameters |
| 70 | +- [`flux-grimoire`](https://github.com/SuperInstance/flux-grimoire) — Curriculum of learned "spells" |
| 71 | +- [`flux-profiler`](https://github.com/SuperInstance/flux-profiler) — Measure evolved behavior performance |
| 72 | + |
| 73 | +## License |
| 74 | + |
| 75 | +Part of the [SuperInstance](https://github.com/SuperInstance) FLUX fleet. |
0 commit comments