affect: feelings compose, crystallize into entities, tile feeling regions
This commit is contained in:
@@ -0,0 +1,169 @@
|
||||
# Calculations — exact math behind §9
|
||||
|
||||
Companion to `README.md` (§9 Opinion Substrate). Every dimension,
|
||||
driver, and score with its actual formula. Parameter short-names in
|
||||
`code style` refer to `docs/PARAMETER-REGISTRY.md`.
|
||||
|
||||
## 0. The space
|
||||
|
||||
All values live in **[−1, +1]** (`space.negative-pole` … `space.positive-pole`,
|
||||
0 = `space.neutral`, the tunnel — not a destination).
|
||||
Geometry per dimension: `bipolar | unipolar | categorical`.
|
||||
|
||||
## 1. Decay (lazy, computed at read time)
|
||||
|
||||
effective(t) = baseline + (value − baseline) · exp(−Δdays / decay_days)
|
||||
|
||||
- `baseline`: each dimension's own resting state (law 38 — not always 0)
|
||||
- `decay_days`: that dimension's registered clock (`hebbian.cool-off`, `validity.fade`, …)
|
||||
- `value`, `baseline` ∈ [−1, +1] ⇒ `effective` stays in range automatically
|
||||
- ±1 tolerance on every comparison (no exact equality anywhere)
|
||||
|
||||
## 2. Signed reinforcement
|
||||
|
||||
Given amount `a` ∈ [−1, +1]:
|
||||
|
||||
a ≥ 0: v ← v + a·(1 − v) # toward +1
|
||||
a < 0: v ← v − |a|·(v − (−1)) # toward −1
|
||||
|
||||
Clamped implicitly by construction. Updates `last_activated = now`.
|
||||
Positive = worked/helped; negative = contradicted/burned (inhibition).
|
||||
|
||||
## 3. Recency distances
|
||||
|
||||
recency(t₀) = exp(−Δdays / memory.recent-horizon) · 2 − 1
|
||||
|
||||
Fresh ≈ +1, old → −1. Used for written-by-us and written-by-source dims.
|
||||
|
||||
## 4. Novelty at arrival (resonance deficit)
|
||||
|
||||
novelty(new) = 1 − max over existing entities of resonance(new, e)
|
||||
|
||||
where `resonance = cos(embedding_new, embedding_e)` blended with graph
|
||||
proximity:
|
||||
|
||||
resonance = ½·cos_sim + ½·(1 / (1 + hop_distance))
|
||||
|
||||
Content vs structural novelty distinguished by local/global split:
|
||||
high local similarity + long bridge distance = structural (gold).
|
||||
|
||||
## 5. Surprise (pulse)
|
||||
|
||||
surprise = |observed − predicted|
|
||||
|
||||
Predictions come from regularity detection in the pulse (interval
|
||||
statistics on recurring event types). Coherent periodic accumulation
|
||||
grows ~n; random noise grows ~√n — regularity is detectable without
|
||||
any scheduler.
|
||||
|
||||
## 6. Retrieval scoring (augmented cosine)
|
||||
|
||||
Query vector Q, entity vector E (pure embedding, n dims):
|
||||
|
||||
Q' = [ Q , W·q₁..q₄ ] q = [1,1,1,1] (want recent/true/grounded/active)
|
||||
E' = [ E , W·r₁..r₄ ] r = [hebbian_eff, recency_us, recency_src, validity_eff]
|
||||
|
||||
score = cos(Q', E') W = retrieval.opinion-volume
|
||||
|
||||
Pipeline: structural walk → vector prefilter → opinion projection →
|
||||
spreading activation (2 hops, weight-decayed) → competition.
|
||||
|
||||
## 7. Competition (replaces top-k)
|
||||
|
||||
Candidate pool C from stages 1–4. Iterate ~5 rounds:
|
||||
|
||||
for each pair (i,j) sharing high cos_sim:
|
||||
s_i ← s_i + β·s_j·sim(i,j) # coalition boost
|
||||
s_j ← s_j − γ·max(0, s_i) # lateral suppression
|
||||
normalize; drop below retrieval.surface-line; repeat until stable
|
||||
|
||||
Output may be empty (silence is valid). Survivors leave priming traces
|
||||
(small hebbian deposits even for non-returners).
|
||||
|
||||
## 8. Salience (derived, never stored)
|
||||
|
||||
salience(x) = clamp( hebbian_eff(x) · context_match(x)
|
||||
+ novelty(x) + stakes(x) · urgency(x)
|
||||
− burn_penalty(x)
|
||||
× curiosity_widening , −1, +1 )
|
||||
|
||||
`context_match` = cos(current-context-embedding, x-embedding).
|
||||
`curiosity_widening` rises with boredom, falls with threat.
|
||||
|
||||
## 9. Drives
|
||||
|
||||
fear(region) ≈ stakes · |falling validity| · failure_proximity · exposure
|
||||
engagement ∈ [−1,+1]: activation invested (from pulse tempo + session state)
|
||||
stimulation ∈ [−1,+1]: reward-rate ÷ investment rate
|
||||
compulsion = engagement > τ_hi AND stimulation < τ_lo, persisting
|
||||
loneliness = desired_resonance − actual_resonance, integrated over window
|
||||
(actual counts only exchanges that formed new edges)
|
||||
sadness(region) = ∫ unresolved negative contributions (slow clock)
|
||||
boredom = low avg novelty ∧ high predictability ∧ no new edges lately
|
||||
|
||||
All clamped [−1,+1]. All derived per moment; none stored.
|
||||
|
||||
## 10. Feelings (nodes)
|
||||
|
||||
When any drive reading crosses its registered visibility threshold:
|
||||
|
||||
feeling_node { drive_snapshot, object_edges[], at }
|
||||
|
||||
Promoted by significance like any entity. Mood = slow integral of recent
|
||||
feeling-valence. Emotion names = labels bound to regions of this snapshot space.
|
||||
|
||||
## 11. Humility & trust
|
||||
|
||||
humility(entity) = 1 − mean|asserted_confidence − realized_outcome|
|
||||
|
||||
trust(source, domain): starts neutral;
|
||||
verified-correct event → trust += δ·(1 − trust)
|
||||
caught-wrong event → trust −= δ·(trust − (−1))
|
||||
Dual reading: public_trust (imported, unexamined fold) vs earned_trust
|
||||
(own audited record). Earned outranks public.
|
||||
Personal truth: no trust computation — speaker IS the source.
|
||||
|
||||
## 12. Originality
|
||||
|
||||
originality(a) = lineage_diversity(a) · transform_distance(a)
|
||||
|
||||
lineage_diversity = entropy over distinct derivation sources
|
||||
transform_distance = 1 − max similarity(a.output, any single source span)
|
||||
|
||||
one dominant lineage → derivative (extraction check runs)
|
||||
many fused, far moved → original
|
||||
|
||||
## 13. Health (metastability check)
|
||||
|
||||
Vital signs, each just a fold over recent graph activity:
|
||||
|
||||
growth_rate, integration_rate (new edges/window),
|
||||
resolution_rate (curiosity closed/opened), retrieval_yield,
|
||||
quarantine_ratio, mood_integral
|
||||
|
||||
healthy ⇔ all oscillating within their bands
|
||||
pinned at any extreme (either sign) ⇒ sick, name the pathology from §9.7 table
|
||||
|
||||
## 14. Provenance weave
|
||||
|
||||
artifact_id = SHA256(canonical content)
|
||||
artifact.birth_certificate = {
|
||||
generated_by, model, prompt_hash, source_hashes[], at }
|
||||
verify(x) = recompose hashes down the derivation DAG;
|
||||
any mismatch anywhere ⇒ everything downstream invalid at once
|
||||
|
||||
Append-only stores: verbs are add and read. Replication across ≥2
|
||||
independent locations. Deletion undefined.
|
||||
|
||||
## 15. Thought operations
|
||||
|
||||
The formulas above are levers; **insight is composition** — combining
|
||||
primitive readings into named patterns (compulsion = engagement∧¬stimulation
|
||||
persisting; dissonance = warmth↑∧validity↓; serendipity = unsought bridge∧later
|
||||
reinforced). Human thought operations — deduction, induction, abduction,
|
||||
analogy, counterfactual simulation, causal inference, generalization,
|
||||
contradiction scanning, meta-cognition, wonder — are registered as the same
|
||||
kind of composition recipes, and new ones get composed from old ones.
|
||||
|
||||
See `THOUGHT-OPERATIONS.md` for the full catalog: inputs, process,
|
||||
output, and validation per operation.
|
||||
Reference in New Issue
Block a user