File size: 1,726 Bytes
77da5ce | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # conflict_generator.md — Conflict Generator Reference
`agent/conflict_generator.py` — ConflictEvent templates and TaskGenerator.
---
## Overview
Two parallel systems for generating crises:
| System | Purpose |
|---|---|
| `ConflictEvent` + `TEMPLATES` | 15 handcrafted conflicts at difficulty 1–5 |
| `TaskGenerator` | Generates long-horizon `Task` objects (two domains) |
---
## `ConflictEvent` (Legacy)
```python
@dataclass
class ConflictEvent:
id: str
title: str
story: str
primary_disruption: dict # Metric deltas applied on env reset
decisions_required: list[str]
resource_budget: dict # {"time", "money", "energy"}
difficulty: int # 1–5
```
### Helper functions
```python
conflict = generate_conflict() # random from all 15
conflict = generate_conflict(difficulty=3) # difficulty-3 pool
escalated = escalate_conflict(conflict) # 1.4× disruption, 0.7× budget
new, reason = adaptive_escalate(conflict, agent_history) # auto-tune
```
---
## `TaskGenerator`
```python
generator = TaskGenerator()
task = generator.generate()
task = generator.generate(domain="flight_crisis", difficulty=4)
task = generator.generate(domain="code_merge_crisis")
```
### Supported Domains
| Domain | Goal |
|---|---|
| `flight_crisis` | Survive Airport Cancellation |
| `code_merge_crisis` | Resolve Production Outage |
Unknown domains fall back to `flight_crisis`.
---
## Adding a New Domain
1. Add `generate_<domain>(self, difficulty) -> Task` to `TaskGenerator`.
2. Add to the `if/elif` in `generate()`.
3. Update this file and `docs/INDEX.md` and `README.md`.
---
## Change Log
| Date | Change |
|---|---|
| 2026-04-23 | Initial doc created |
|