feat: add goals, drives, affect state, predictions and curiosity

Phase 9. Goals form a mind-scoped tree with kind, priority, progress and
blockers; their deterministic relevance to a candidate feeds the
goal_relevance attention feature and a goal monitor raises stalled goals
and observations that touch one. Drives are a closed set of eight
scalars with operator-configured ranges and personality-derived
baselines; there is no self-preservation, replication or acquisition
drive and no way to add one at runtime. Affect is ten scalars moved by an
explicit rule table over events and decaying towards baseline; both
modulate attention weights each cycle and the effective weights are
recorded with every cycle and shown beside the configured ones.

Predictions carry a window and machine-checkable criteria (event terms
occurring or staying absent, a belief reaching a confidence, or operator
judgement). A resolver job judges them deterministically, keeps an
append-only outcome history for calibration (accuracy, Brier score,
confidence buckets, overconfidence flag), emits prediction_error events
scaled by how confident the miss was, and feeds the outcome back into the
linked belief as evidence. Causal hypotheses derive predictions
automatically. Curiosity turns misses, contradictions and unexplained
observations into questions that compete for attention and become
investigation goals when admitted.

Brain gains after-cycle hooks and goal/motivation state. API, UI (goals,
prediction dashboard, cognitive state panel, effective weights) and CLI
(goal, prediction, state). Demo scenario 4 verified end to end.
This commit is contained in:
Andy Dixon
2026-06-27 20:41:03 +01:00
parent 777e8f50b5
commit 9eb873cbe6
39 changed files with 3053 additions and 50 deletions
+32
View File
@@ -0,0 +1,32 @@
# Prediction system
A prediction is an explicit expectation with a resolution window and criteria that code can check (spec §11). Predictions are how the mind finds out it was wrong.
## Structure
| Field | Meaning |
|---|---|
| statement | what is expected, in words |
| confidence | 0.05–0.95; certainty is refused |
| window_start / window_end | when the expectation applies |
| criteria | `event_match` (terms occur or stay absent in events of given types), `belief` (a belief reaches a confidence), or `operator` (a person judges) |
| belief_id | the belief the prediction was derived from, if any |
| status | open → confirmed, refuted, expired or withdrawn |
`prediction_results` is append-only and keeps every outcome with the stated confidence and the error, so calibration cannot be rewritten.
## Resolution
A scheduler runs the resolver every minute. For each open prediction it judges deterministically (`predictions.Judge`): event-match predictions look at the mind's events inside the window (excluding the prediction's own creation and other prediction events); belief predictions compare the current confidence; operator predictions expire a week after the window. Operators can also confirm, refute or withdraw from the UI, API or CLI.
Outcomes emit `prediction_resolved` or, for refutations, `prediction_error` with salience scaled by how confident the miss was. The result becomes evidence on the linked belief: confirmed adds support (weight 0.3), refuted adds opposition (weight 0.5), and the belief is re-evaluated with the usual arithmetic. The motivation rules raise arousal and uncertainty and lower confidence after a miss; curiosity turns the miss into a question that competes for attention and, if admitted, becomes an investigation goal.
## Where predictions come from
- Operators, through the Predictions page, the API or `noemactl`.
- Causal hypotheses: when the associate process turns "A may have caused B" into a belief, a prediction is derived automatically — the effect should recur within 24 hours if the cause is real — with the belief's confidence, so a miss lowers the hypothesis.
- Later phases add predictions from consolidation and reflection.
## Calibration
The dashboard shows accuracy (confirmed over decided), the Brier score, and buckets of stated confidence against actual hit rate over the last 90 days. A mind whose mean stated confidence exceeds its hit rate by more than 0.15 across at least five decided predictions is flagged as overconfident; metacognition (phase 10) uses the same signal to discount new confident claims.