feat(research): ablations, broadcast and self-model experiments, counterfactuals

A framework for testing functional properties of the architecture
(Part C). None of it claims consciousness; every measure has an
operational definition in research.Measures.

- Ablations (attention, memory retrieval, affect, metacognition,
  commitments, volition, global workspace, curiosity, association, goals,
  narrative, notifications) and workspace overrides (force a matching
  candidate in or out of admission) live in a fork's cognitive
  configuration. Original minds refuse them on create and update; only
  snapshot restores may carry them, so they are part of the configuration
  digest. Excluded candidates are recorded with fate "excluded".
- Self-model experiments override a fork's self-model (capabilities,
  identity, goals, knowledge gaps) without touching policy. When an
  action's effective policy disagrees with the self-model, cognition
  records a self_model_mismatch and corrects the entry; experiments report
  self-model accuracy and correction latency.
- Counterfactual experiments replay a mind's recorded stimuli from a
  snapshot with chosen events omitted; the report lists what differed in
  beliefs, wants, intentions, memories, attention and capability
  decisions, in a form introspection can cite.
- Experiments record a protocol (kind, independent variable, controlled
  variables, measures), per-variant volition, plan, downstream-by-category
  (events reachable from each stimulus through recorded links),
  introspection and self-model measures and event ranges; comparisons add
  want, intention and plan-capability overlap, measure ranges, a
  descriptive architecture share and a downstream delta; reproducibility
  is labelled against the previous run of the same definition.
- research.Agency computes want→intention, intention→action, abandonment,
  commitment fulfilment and conflict, blocked intentions, replanning,
  outcome success and introspection accuracy; MetacognitiveCalibration
  relates confidence and expressed uncertainty in replies to later belief
  revision, with Brier scores for each half of the period.
- The sandbox test harness gains volition, planning, agency and research
  but not the motivation hook, whose wall-clock decay would make replay
  comparisons timing-dependent.
This commit is contained in:
Andy Dixon
2026-09-17 19:48:59 +01:00
parent 4a7dafc71f
commit 6fdc3908f5
15 changed files with 1245 additions and 21 deletions
+46
View File
@@ -308,6 +308,11 @@ func (h Handlers) intend(ctx context.Context, c *brain.Cycle, t workspace.Though
}
}
in.Action = ActionInfo(ctx, s.Services.Capabilities, s.Mind.ID, w.Proposal)
if in.Action != nil {
if err := correctSelfModel(ctx, c, *in.Action, t.EventID); err != nil {
return err
}
}
if s.Services.Capabilities != nil {
if inv, err := s.Services.Capabilities.Inventory(ctx, s.Mind.ID); err == nil {
for _, i := range inv {
@@ -431,3 +436,44 @@ func (h Handlers) want(ctx context.Context, c *brain.Cycle, t workspace.Thought)
}
return nil
}
// correctSelfModel compares what the self-model says about a capability
// with what policy actually gives now. A mismatch is recorded as a
// metacognitive finding and the self-model entry is corrected: reality, as
// the capability layer reports it, wins over the mind's belief about itself.
func correctSelfModel(ctx context.Context, c *brain.Cycle, a volition.ActionInfo, cause ids.ID) error {
s := c.State
if s.Services.Minds == nil {
return nil
}
actual := a.Effect
if actual == "locked" || actual == "unknown" {
actual = "unavailable"
}
for i, entry := range s.SelfModel.Capabilities {
if entry.Name != a.Capability || entry.Policy == actual {
continue
}
ev, err := c.EmitNow(ctx, events.New{Type: events.Metacognition, Source: "brain.selfmodel", Summary: fmt.Sprintf("self-model said %s is %s, but policy gives %s; corrected", a.Capability, entry.Policy, actual),
Salience: 0.6, Confidence: 1, CausationID: cause, Metadata: map[string]any{"check": "self_model_mismatch", "ref": a.Capability, "stated": entry.Policy, "actual": actual}})
if err != nil {
return err
}
sm, err := s.Services.Minds.GetSelfModel(ctx, s.Mind.ID)
if err != nil {
return nil
}
for j := range sm.Capabilities {
if sm.Capabilities[j].Name == a.Capability {
sm.Capabilities[j].Policy = actual
}
}
if err := s.Services.Minds.SaveSelfModel(ctx, s.Mind.ID, sm); err != nil {
return err
}
s.SelfModel.Capabilities[i].Policy = actual
c.Emit(events.New{Type: events.SelfModelUpdated, Source: "brain.selfmodel", Summary: "self-model corrected: " + a.Capability + " is " + actual, Salience: 0.4, Confidence: 1, CausationID: ev.ID,
Metadata: map[string]any{"correction": true, "capability": a.Capability, "from": entry.Policy, "to": actual}})
}
return nil
}