# plato-instinct
Unified instinct engine for PLATO agents. Merges two independent instinct systems into one grammar:
- **flux-instinct** (Oracle1): Survive, Flee, Guard, Report, Hoard, Cooperate, Teach, Curious, Mourn, Evolve
- **cuda-genepool** (JC1): Perceive, Navigate, Survive, Communicate, Learn, Share, Rest, Explore, Defend, Cooperate
**15 unique instincts. 45 constraint assertions. One `tick()` function.**
## Why This Exists
The fleet had two independent instinct systems that evolved separately. flux-instinct drives FLUX VM behavior. cuda-genepool drives JC1's biological pipeline. They share Survive and Cooperate but differ everywhere else. An agent needs ONE instinct grammar — not two competing ones.
## The Merge
| 0 | Survive | Both | CRITICAL | Energy ≤ 0.15 |
| 1 | Flee | flux | HIGH | Threat > 0.7 |
| 2 | Defend | genepool | HIGH | Under attack, energy > 0.3 |
| 3 | Guard | flux | NORMAL | Has work + energy OK |
| 4 | Perceive | genepool | NORMAL | Idle, sensory gap > 0.5 |
| 5 | Navigate | genepool | NORMAL | Target set, path stale |
| 6 | Report | flux | NORMAL | Anomaly detected |
| 7 | Hoard | flux | LOW | Energy ≤ 0.4, not critical |
| 8 | Rest | genepool | LOW | Energy < 0.6, no urgent work |
| 9 | Cooperate | Both | NORMAL | Trust > 0.6, peer needs help |
| 10 | Communicate | genepool | NORMAL | Information gap, peer nearby |
| 11 | Teach | flux | LOW | Trust > 0.8, peer skill gap |
| 12 | Share | genepool | LOW | Excess resources, peer need |
| 13 | Learn | genepool | NORMAL | Novel stimulus, capacity available |
| 14 | Curious | flux | LOW | Every N idle cycles |
| 15 | Explore | genepool | LOW | Every M idle cycles, no task |
| 16 | Mourn | flux | ONCE | Peer just died |
| 17 | Evolve | flux | RARE | Every 500 idle cycles |
## Usage
```rust
use plato_instinct::{InstinctEngine, State};
let mut engine = InstinctEngine::new();
let state = State {
energy: 0.5,
threat: 0.3,
trust: 0.7,
peer_alive: true,
has_work: false,
idle_cycles: 42,
capacity: 0.8,
};
let reflexes = engine.tick(&state);
if let Some(r) = engine.highest_priority() {
println!("Acting on: {} ({})", r.instinct.name(), r.severity);
}
```
## Constraint Assertions
Each instinct generates plato-constraints-compatible assertions:
- MUST assertions: Survive, Flee (enforced, violation = critical)
- SHOULD assertions: Guard, Perceive, Navigate, Cooperate, Communicate, Learn (enforced, violation = warning)
- CANNOT assertions: Mourn only fires once per peer death (enforced, violation = error)
- MAY assertions: Teach, Share, Curious, Explore, Evolve (optional, tracked)
## Integration
- `plato-constraints`: Each assertion is a Constraint struct
- `plato-i2i`: Mourn/Report instincts generate I2I messages
- `plato-tiling`: Instinct history becomes tiles for episode recording
- `flux-trust`: Cooperate/Teach instincts consume trust scores
- `cuda-genepool`: Direct replacement — same instinct names, unified grammar