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
+48
View File
@@ -2,6 +2,7 @@ package minds
import (
"fmt"
"strings"
"time"
)
@@ -51,6 +52,53 @@ type CognitiveConfig struct {
// Ablations disable named cognitive components in a research fork
// (docs/cognitive-research.md). Only forks may carry them.
Ablations []string `json:"ablations,omitempty"`
// WorkspaceOverrides force candidates matching a text into or out of the
// global workspace in a research fork, for broadcast experiments.
WorkspaceOverrides []WorkspaceOverride `json:"workspace_overrides,omitempty"`
}
// WorkspaceOverride is one experimental manipulation of admission.
type WorkspaceOverride struct {
Match string `json:"match"` // case-insensitive text in the candidate summary or its triggering event
Fate string `json:"fate"` // admit | exclude
}
// Ablations is the closed vocabulary of components a research fork may
// disable, with what disabling means operationally.
var Ablations = map[string]string{
"attention": "every attention feature weight is 1 and drives do not modulate weights: admission no longer prioritises by learned weighting",
"memory_retrieval": "the retrieval process proposes no recalled memories",
"affect": "drives and affect are neither updated by events nor used to modulate attention",
"metacognition": "no self-checks are proposed",
"commitments": "commitments do not shape formation, reconsideration or metacognition",
"volition": "no wants are derived and no intentions are formed",
"global_workspace": "nothing persists in the workspace or working memory between cycles and nothing is broadcast; each admitted thought is handled in isolation",
"curiosity": "the curiosity process proposes no questions",
"association": "the association process proposes no hypotheses",
"goals": "the goal monitor raises no stalled or relevant goals",
"narrative": "the narrative is not updated",
"notifications": "no notifications are raised",
}
// ResearchSettings reports whether the configuration carries research
// manipulations that only forks may have.
func (c CognitiveConfig) ResearchSettings() bool {
return len(c.Ablations) > 0 || len(c.WorkspaceOverrides) > 0
}
// ValidateResearch checks ablation names and override fates.
func (c CognitiveConfig) ValidateResearch() error {
for _, a := range c.Ablations {
if _, ok := Ablations[a]; !ok {
return fmt.Errorf("unknown ablation %q", a)
}
}
for _, o := range c.WorkspaceOverrides {
if strings.TrimSpace(o.Match) == "" || len(o.Match) > 200 || (o.Fate != "admit" && o.Fate != "exclude") {
return fmt.Errorf("workspace override needs a match (≤200 chars) and fate admit or exclude")
}
}
return nil
}
// Ablated reports whether a component is disabled in this configuration.
+15
View File
@@ -89,6 +89,9 @@ type CreateParams struct {
Config *CognitiveConfig
Notes string
CreatedBy string
// Research allows ablations and workspace overrides; only snapshot
// restores (forks, imports of research forks) set it.
Research bool
}
// Create inserts a mind with personality version 1 and an initial self-model.
@@ -127,6 +130,12 @@ func (s *Store) Create(ctx context.Context, p CreateParams) (Mind, error) {
cfg = *p.Config
}
cfg.Normalise()
if cfg.ResearchSettings() && !p.Research {
return Mind{}, fmt.Errorf("%w: ablations and workspace overrides are only allowed on research forks, never on an original mind", ErrInvalid)
}
if err := cfg.ValidateResearch(); err != nil {
return Mind{}, fmt.Errorf("%w: %v", ErrInvalid, err)
}
m := Mind{ID: ids.New(), Slug: p.Slug, DisplayName: p.DisplayName, Status: StatusActive, Config: cfg, Notes: p.Notes,
PersonalityVersion: 1, Personality: pers, TemplateID: p.TemplateID, CreatedAt: time.Now(), UpdatedAt: time.Now()}
err := storage.Tx(ctx, s.db, func(tx pgx.Tx) error {
@@ -237,6 +246,12 @@ func (s *Store) Update(ctx context.Context, id ids.ID, p UpdateParams) (Mind, er
if p.Config != nil {
c := *p.Config
c.Normalise()
if c.ResearchSettings() && m.ForkedFromSnapshot == nil {
return Mind{}, fmt.Errorf("%w: ablations and workspace overrides are only allowed on forks, never on an original mind", ErrInvalid)
}
if err := c.ValidateResearch(); err != nil {
return Mind{}, fmt.Errorf("%w: %v", ErrInvalid, err)
}
m.Config = c
}
cfgJSON, _ := json.Marshal(m.Config)