Reverse-engineers constraint parameters from user override behavior. When users override captain decisions, this service infers which constraint boundary was wrong and adjusts it.
TypeScript service on port 9439. Polls PLATO for override events, detects patterns, updates the constraint model, and signals the captain to re-deliberate.
Captain decides EMERGENCE → User overrides to STABLE
↓
OverrideEvent recorded in PLATO
↓
constraint-inference polls PLATO (:8847)
↓
Maps decision delta → constraint parameter
↓
Accumulates patterns (rolling window of 20)
↓
When confidence ≥ 0.75 and samples ≥ 3:
1. Predict effect (simulation-first)
2. Update model parameter
3. Save to disk + PLATO
4. Signal captain re-deliberation
npm install
npx ts-node src/index.tsEnvironment variables:
| Variable | Default | Purpose |
|---|---|---|
PLATO_HOST |
localhost |
PLATO server host |
PLATO_PORT |
8847 |
PLATO server port |
curl -X POST localhost:9439/override \
-H 'Content-Type: application/json' \
-d '{
"user_id": "casey",
"graph": {"V": 6, "E": 14, "C": 1},
"original_decision": "EMERGENCE",
"user_decision": "STABLE",
"reason": "this looks stable to me"
}'Response:
{
"status": "recorded",
"patterns_found": 1,
"significant": true
}{
"emergence_beta_threshold": -2,
"safety_margin": 0.15,
"trust_min": 0.5,
"trust_max": 0.95,
"zhc_tolerance": 0.001,
"action_confidence_min": 0.7
}Returns all patterns (not just significant ones).
Four captain decisions, ordered from most to least constrained:
CONSTRAINED → STABLE → DECIDED → EMERGENCE
When a user overrides, the direction of the override maps to a specific constraint:
| Captain Decision | User Override | Inference | Constraint Updated |
|---|---|---|---|
| EMERGENCE | STABLE | Emergence too sensitive | emergence_beta_threshold |
| STABLE | CONSTRAINED | Safety margin too loose | safety_margin |
| DECIDED | STABLE | Action threshold too low | action_confidence_min |
| EMERGENCE | CONSTRAINED | Multiple constraints wrong | emergence_beta_threshold |
| CONSTRAINED | STABLE | Safety too tight | safety_margin |
| CONSTRAINED | DECIDED | Safety too tight | safety_margin |
| DECIDED | EMERGENCE | Emergence not sensitive enough | emergence_beta_threshold |
| STABLE | DECIDED | Action threshold too high | action_confidence_min |
User chose more constrained than captain → tighten. User chose less constrained → loosen.
| Parameter | Default | Range | Delta per update |
|---|---|---|---|
emergence_beta_threshold |
-2 | unbounded | ±0.07 |
safety_margin |
0.15 | [0, 1] | ±0.05 |
trust_min |
0.5 | [0, 1] | ±0.05 |
trust_max |
0.95 | [0, 1] | ±0.05 |
zhc_tolerance |
0.001 | ≥ 0 | ±0.0001 |
action_confidence_min |
0.7 | [0, 1] | ±0.05 |
Model is persisted to ~/.config/constraint-inference/model.json.
Override events go into a rolling window (default: 20 events). The inferConstraints function:
- Maps each event to a
(constraint_id, direction)pair - Groups by
(constraint_id, direction) - Computes confidence:
min(0.95, 0.4 + sample_size × 0.2)
A pattern is significant when:
confidence ≥ 0.75(requires ≥ 2 samples)sample_size ≥ 3
Before applying an update, a prediction tile is filed to PLATO:
{
constraint_id: "emergence_beta_threshold",
current_value: -2,
predicted_value: -1.93,
expected_direction: "tighten",
expected_override_reduction_pct: 25, // tightening → ~25% reduction
confidence: 0.8,
lamport: 42
}After enough real override data accumulates, the prediction is confirmed or superseded via PLATO's lifecycle (active → superseded). Lamport clocks provide causal ordering.
Reads from:
GET /room/captain_overrides_history— historical override events
Writes to:
POST /room/constraint_updates— constraint parameter changesPOST /submitroomconstraint_predictions— simulation-first predictionsPOST /room/captain_signals— re-deliberation signals
- User overrides captain's EMERGENCE decision to STABLE
- Override recorded:
{original: EMERGENCE, user: STABLE, graph: {V:6,E:14,C:1}} - Inference maps: EMERGENCE→STABLE = tighten
emergence_beta_threshold - 3 more similar overrides arrive → confidence reaches 0.8
- Prediction filed: "tightening emergence_beta_threshold by 0.07, expect 25% fewer overrides"
- Model updated:
emergence_beta_thresholdfrom -2.0 to -2.07 - Captain signaled to re-deliberate with new threshold
- After observation period, prediction confirmed if override rate dropped
src/
├── index.ts # Main loop + HTTP API (port 9439)
├── types.ts # Interfaces: OverrideEvent, OverridePattern, MutableConstraintModel
├── constraint_inferrer.ts # Core inference: map deltas → constraints
├── constraint_model.ts # Load/save/update model from disk
├── override_tracker.ts # Rolling window of events, pattern analysis
├── plato_bridge.ts # Read/write PLATO tiles
├── re_deliberate.ts # Signal captain to re-run with updated constraints
└── simulation_first.ts # Predict-apply-observe-confirm cycle
| Repo | Purpose |
|---|---|
fleet-health-monitor |
Fleet control plane — runs the PLATO server this bridges to |
plato-types |
Core types — LamportClock, TileLifecycle, content_hash |
agent-field |
Agent room coordination with coupling and gap detection |
captains-log |
Oracle1's growth diary — includes constraint theory research |
MIT