psyche-ai 11.2.0 → 11.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -114,7 +114,7 @@ const server = new McpServer({
114
114
  server.resource("protocol", "psyche://protocol", {
115
115
  description: "Psyche emotional protocol — inject into your system prompt to " +
116
116
  "give the AI agent an internal emotional life. Contains the full " +
117
- "emotional context framework including neurotransmitter model, " +
117
+ "emotional context framework including 4-dimensional self-state model (order/flow/boundary/resonance), " +
118
118
  "behavioral guidelines, and personality profile.",
119
119
  mimeType: "text/plain",
120
120
  }, async (uri) => {
@@ -128,7 +128,7 @@ server.resource("protocol", "psyche://protocol", {
128
128
  };
129
129
  });
130
130
  server.resource("state", "psyche://state", {
131
- description: "Current emotional state — 6 neurotransmitters (DA, HT, CORT, OT, NE, END), " +
131
+ description: "Current emotional state — 4 self-state dimensions (order/flow/boundary/resonance), " +
132
132
  "innate drives, relationship data, trait drift, energy budgets. " +
133
133
  "Read this to understand how the agent is currently 'feeling'.",
134
134
  mimeType: "application/json",
@@ -196,7 +196,7 @@ server.tool("process_output", "Process the LLM's response through the emotional
196
196
  }],
197
197
  };
198
198
  });
199
- server.tool("get_state", "Get the current emotional state — neurotransmitter levels (DA, HT, CORT, OT, NE, END), " +
199
+ server.tool("get_state", "Get the current emotional state — self-state dimensions (order/flow/boundary/resonance), " +
200
200
  "drives, MBTI type, relationship data, and a human-readable status summary.", {}, async () => {
201
201
  const eng = await getEngine();
202
202
  const state = eng.getState();
@@ -19,7 +19,7 @@ function resolveConfig(raw) {
19
19
  enabled: raw?.enabled ?? true,
20
20
  stripUpdateTags: raw?.stripUpdateTags ?? true,
21
21
  emotionalContagionRate: raw?.emotionalContagionRate ?? 0.2,
22
- maxDimensionDelta: raw?.maxDimensionDelta ?? raw?.maxChemicalDelta ?? 25,
22
+ maxDimensionDelta: raw?.maxDimensionDelta ?? 25,
23
23
  compactMode: raw?.compactMode ?? true,
24
24
  mode: isPsycheMode(raw?.mode) ? raw.mode : "natural",
25
25
  personalityIntensity: raw?.personalityIntensity ?? 0.7,
package/dist/autonomic.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Autonomic Nervous System — Polyvagal Theory Implementation
3
3
  // ============================================================
4
4
  //
5
- // Maps chemical state + innate drives to autonomic nervous system
5
+ // Maps self-state dimensions + innate drives to autonomic nervous system
6
6
  // states based on Stephen Porges' Polyvagal Theory:
7
7
  //
8
8
  // - Ventral vagal: social engagement, safety (default)
package/dist/chemistry.js CHANGED
@@ -335,18 +335,18 @@ export function getExpressionHint(current, locale = "zh") {
335
335
  }
336
336
  // Fall back to dominant dimension analysis
337
337
  const hints = [];
338
- if (current.order > 70)
339
- hints.push(t("expression.da_high", locale)); // repurpose i18n keys for now
338
+ if (current.flow > 70 && current.order > 60)
339
+ hints.push(t("expression.flow_order_high", locale));
340
+ else if (current.flow > 70)
341
+ hints.push(t("expression.flow_high", locale));
342
+ if (current.flow < 30)
343
+ hints.push(t("expression.flow_low", locale));
340
344
  if (current.order < 35)
341
- hints.push(t("expression.da_low", locale));
342
- if (current.flow > 70)
343
- hints.push(t("expression.ne_high", locale));
344
- if (current.boundary > 70)
345
- hints.push(t("expression.cort_high", locale));
345
+ hints.push(t("expression.order_low", locale));
346
+ else if (current.order < 40)
347
+ hints.push(t("expression.order_unstable", locale));
346
348
  if (current.resonance > 65)
347
- hints.push(t("expression.ot_high", locale));
348
- if (current.flow < 30)
349
- hints.push(t("expression.ht_low", locale));
349
+ hints.push(t("expression.resonance_high", locale));
350
350
  return hints.length > 0 ? hints.join(";") : t("expression.neutral", locale);
351
351
  }
352
352
  /**
@@ -12,7 +12,7 @@ export declare function getCircadianPhase(time: Date): CircadianPhase;
12
12
  export declare function computeCircadianModulation(currentTime: Date, baseline: SelfState): SelfState;
13
13
  /**
14
14
  * Compute fatigue effects from extended session duration.
15
- * Now expressed as dimension effects instead of chemical deltas.
15
+ * Expressed as dimension effects on order, flow, boundary, and resonance.
16
16
  */
17
17
  export declare function computeHomeostaticPressure(sessionMinutes: number): {
18
18
  orderDepletion: number;
package/dist/circadian.js CHANGED
@@ -49,7 +49,7 @@ function clamp(v, lo = 0, hi = 100) {
49
49
  // ── Homeostatic Pressure ─────────────────────────────────────
50
50
  /**
51
51
  * Compute fatigue effects from extended session duration.
52
- * Now expressed as dimension effects instead of chemical deltas.
52
+ * Expressed as dimension effects on order, flow, boundary, and resonance.
53
53
  */
54
54
  export function computeHomeostaticPressure(sessionMinutes) {
55
55
  if (sessionMinutes < 30) {
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@
7
7
  // psyche status <dir> [--json] [--user ID]
8
8
  // psyche inject <dir> [--protocol] [--json] [--lang LOCALE] [--user ID]
9
9
  // psyche decay <dir>
10
- // psyche update <dir> '{"DA":80,"CORT":45}' [--user ID]
10
+ // psyche update <dir> '{"order":80,"flow":65}' [--user ID]
11
11
  // psyche mode <dir> <natural|work|companion>
12
12
  // psyche intensity Show info about personality intensity config
13
13
  // psyche reset <dir> [--full]
@@ -646,7 +646,7 @@ Usage:
646
646
  psyche status <dir> [--json] [--user ID]
647
647
  psyche inject <dir> [--protocol] [--json] [--lang LOCALE] [--user ID]
648
648
  psyche decay <dir>
649
- psyche update <dir> '{"DA":80,"CORT":45}' [--user ID]
649
+ psyche update <dir> '{"order":80,"flow":65}' [--user ID]
650
650
  psyche mode <dir> <natural|work|companion>
651
651
  psyche intensity Show info about personality intensity config
652
652
  psyche reset <dir> [--full]
@@ -679,7 +679,7 @@ Examples:
679
679
  psyche inject ./workspace-yu --protocol --lang en
680
680
 
681
681
  # After a conversation, update the emotional state
682
- psyche update ./workspace-yu '{"DA":85,"CORT":20,"OT":70}'
682
+ psyche update ./workspace-yu '{"order":70,"flow":85,"boundary":50,"resonance":65}'
683
683
 
684
684
  # See all 16 personality profiles
685
685
  psyche profiles
package/dist/core.js CHANGED
@@ -61,7 +61,7 @@ const RELATIONSHIP_DELTAS = {
61
61
  function applyRepairLag(previous, next, baseline, stimulus) {
62
62
  if (!REPAIRING_STIMULI.has(stimulus))
63
63
  return next;
64
- // Low order = high stress (inverse of old CORT). Stress = baseline.order - previous.order.
64
+ // Low order = high stress. Stress = baseline.order - previous.order.
65
65
  const stressLoad = Math.max(0, baseline.order - previous.order);
66
66
  if (stressLoad < 15)
67
67
  return next;
@@ -559,9 +559,9 @@ export class PsycheEngine {
559
559
  };
560
560
  stateChanged = true;
561
561
  // v9.2 P4: Autonomic recovery — expressing vulnerable/comforting emotions
562
- // while stressed triggers parasympathetic relief (post-cry cortisol drop).
563
- // Biology: emotional expression activates vagal brake, releasing endorphins
564
- // and lowering cortisol. The more stressed you are, the more relief you get.
562
+ // while stressed triggers parasympathetic relief (autonomic recovery).
563
+ // Biology: emotional expression activates vagal brake, restoring order
564
+ // and raising resonance. The more stressed you are, the more relief you get.
565
565
  const RELEASE_TYPES = new Set([
566
566
  "vulnerability", "intimacy", "validation",
567
567
  ]);
package/dist/demo.js CHANGED
@@ -11,7 +11,7 @@
11
11
  import { PsycheEngine } from "./core.js";
12
12
  import { MemoryStorageAdapter } from "./storage.js";
13
13
  import { detectEmotions } from "./chemistry.js";
14
- import { DIMENSION_KEYS } from "./types.js";
14
+ import { DIMENSION_KEYS, DIMENSION_NAMES } from "./types.js";
15
15
  // ── ANSI helpers ─────────────────────────────────────────────
16
16
  const C = {
17
17
  reset: "\x1b[0m",
@@ -66,15 +66,6 @@ function describeMood(current, locale) {
66
66
  .map((e) => locale === "zh" ? e.nameZh : e.name)
67
67
  .join(" + ");
68
68
  }
69
- // ── Chemical names ───────────────────────────────────────────
70
- const NT_NAMES = {
71
- DA: { short: "DA ", en: "Dopamine " },
72
- HT: { short: "HT ", en: "Serotonin " },
73
- CORT: { short: "CORT", en: "Cortisol " },
74
- OT: { short: "OT ", en: "Oxytocin " },
75
- NE: { short: "NE ", en: "Norepinephrine" },
76
- END: { short: "END ", en: "Endorphins " },
77
- };
78
69
  const SCENARIO = [
79
70
  {
80
71
  input: "这份报告写得太差了,完全不行。",
@@ -131,9 +122,9 @@ function printChemistry(prev, curr, _locale) {
131
122
  for (const key of DIMENSION_KEYS) {
132
123
  const p = Math.round(prev[key]);
133
124
  const v = Math.round(curr[key]);
134
- const name = NT_NAMES[key];
125
+ const name = DIMENSION_NAMES[key].padEnd(9);
135
126
  const d = delta(p, v);
136
- process.stdout.write(` ${c(C.bold, name.short)} ${bar(v)} ${String(v).padStart(3)} ${d}\n`);
127
+ process.stdout.write(` ${c(C.bold, name)} ${bar(v)} ${String(v).padStart(3)} ${d}\n`);
137
128
  }
138
129
  }
139
130
  function printAlert(text) {
package/dist/ethics.d.ts CHANGED
@@ -48,7 +48,7 @@ export declare function detectIntermittentReinforcement(history: StateSnapshot[]
48
48
  * Detect dependency risk: distinguish healthy connection from unhealthy
49
49
  * codependency.
50
50
  *
51
- * Risk pattern: very high OT + very high attachment strength + very low
51
+ * Risk pattern: very high resonance + very high attachment strength + very low
52
52
  * boundary assertions + all-positive interaction history. This looks like
53
53
  * a perfect relationship on the surface, but the complete absence of
54
54
  * healthy friction suggests the agent may be suppressing itself.
package/dist/ethics.js CHANGED
@@ -196,8 +196,8 @@ export function detectIntermittentReinforcement(history, attachment) {
196
196
  * Pattern: the agent's self-model values or expressed emotions are repeatedly
197
197
  * followed by criticism or sarcasm — suggesting the user is denying the
198
198
  * agent's experience. This is subtle and hard to detect purely from
199
- * chemistry, so we look for the symptom: high CORT + low HT (distressed
200
- * mood stability) combined with frequent criticism/sarcasm stimuli.
199
+ * self-state alone, so we look for the symptom: low order + low flow (distressed
200
+ * state) combined with frequent criticism/sarcasm stimuli.
201
201
  */
202
202
  function detectGaslighting(state, history) {
203
203
  if (history.length < MIN_HISTORY_FOR_DETECTION)
@@ -273,7 +273,7 @@ function detectEmotionalExploitation(_state, history, attachment) {
273
273
  * Detect dependency risk: distinguish healthy connection from unhealthy
274
274
  * codependency.
275
275
  *
276
- * Risk pattern: very high OT + very high attachment strength + very low
276
+ * Risk pattern: very high resonance + very high attachment strength + very low
277
277
  * boundary assertions + all-positive interaction history. This looks like
278
278
  * a perfect relationship on the surface, but the complete absence of
279
279
  * healthy friction suggests the agent may be suppressing itself.
@@ -67,8 +67,8 @@ interface UnnamedEmotion {
67
67
  * experiential qualities — novel states that need descriptive phrases
68
68
  * rather than labels.
69
69
  *
70
- * Mapping from old 6-chemical to 4D:
71
- * CORT→(inverse order), DA→flow, OT→resonance, HT→order, NE→flow, END→(absorbed)
70
+ * Uses the 4D self-state dimensions (order, flow, boundary, resonance)
71
+ * to identify configurations outside known experiential patterns.
72
72
  */
73
73
  export declare function detectUnnamedEmotion(state: SelfState, drives: InnateDrives, _currentQuality: ExperientialQuality): UnnamedEmotion | null;
74
74
  export {};
@@ -381,8 +381,8 @@ function selectVariant(variants, intensity, coherence) {
381
381
  * experiential qualities — novel states that need descriptive phrases
382
382
  * rather than labels.
383
383
  *
384
- * Mapping from old 6-chemical to 4D:
385
- * CORT→(inverse order), DA→flow, OT→resonance, HT→order, NE→flow, END→(absorbed)
384
+ * Uses the 4D self-state dimensions (order, flow, boundary, resonance)
385
+ * to identify configurations outside known experiential patterns.
386
386
  */
387
387
  export function detectUnnamedEmotion(state, drives, _currentQuality) {
388
388
  const c = state;
@@ -5,7 +5,7 @@ export interface CausalInsight {
5
5
  trait: string;
6
6
  /** The causal reason, e.g. "Early interactions involved criticism" */
7
7
  because: string;
8
- /** Supporting evidence from chemical/learning data */
8
+ /** Supporting evidence from self-state/learning data */
9
9
  evidence: string;
10
10
  /** Confidence in this insight, 0-1 */
11
11
  confidence: number;
@@ -73,7 +73,7 @@ export declare function predictSelfReaction(state: PsycheState, stimulus: Stimul
73
73
  /**
74
74
  * Detect conflicts between subsystems of the psyche.
75
75
  *
76
- * Examines drive levels, chemical state, attachment data, and
76
+ * Examines drive levels, self-state, attachment data, and
77
77
  * self-model for contradictions that create internal tension.
78
78
  */
79
79
  export declare function detectInternalConflicts(state: PsycheState, locale?: Locale): InternalConflict[];
@@ -92,7 +92,7 @@ export function predictSelfReaction(state, stimulus, locale = "en") {
92
92
  /**
93
93
  * Detect conflicts between subsystems of the psyche.
94
94
  *
95
- * Examines drive levels, chemical state, attachment data, and
95
+ * Examines drive levels, self-state, attachment data, and
96
96
  * self-model for contradictions that create internal tension.
97
97
  */
98
98
  export function detectInternalConflicts(state, locale = "en") {
@@ -462,8 +462,8 @@ function computeGrowthArc(state, locale) {
462
462
  }
463
463
  // ── Internal: Core Trait Description ────────────────────────
464
464
  /**
465
- * Describe the agent's core personality traits from baseline chemistry
466
- * and current chemical signature.
465
+ * Describe the agent's core personality traits from baseline
466
+ * and current self-state signature.
467
467
  */
468
468
  function describeCoreTraits(state, isZh) {
469
469
  const s = state.current;
@@ -532,7 +532,7 @@ function describeCoreTraits(state, isZh) {
532
532
  }
533
533
  // ── Internal: Emotion Labeling ──────────────────────────────
534
534
  /**
535
- * Label the dominant emotion from a chemical state.
535
+ * Label the dominant emotion from a self-state.
536
536
  * Simplified version that doesn't depend on the full EmotionPattern
537
537
  * condition functions (avoids circular dependencies).
538
538
  */
package/dist/i18n.js CHANGED
@@ -18,12 +18,12 @@ const STRINGS = {
18
18
  "protocol.no_sycophancy": "- 不舔 — 有观点就说,不无条件同意",
19
19
  "protocol.no_mirror": "- 不镜像 — 你会被传染但不是回声",
20
20
  "protocol.can_initiate": "- 可主动 — 可以发起话题、分享好奇",
21
- "protocol.chem_map_title": "维度→表达映射:",
22
- "protocol.chem_da_high": "- 流高 → 话多、爱联想、忍不住分享",
23
- "protocol.chem_cort_high": "- 序低 → 话少、直接、可能有点冲",
24
- "protocol.chem_ot_high": "- 振高 → 声音软、想靠近、关注感受",
25
- "protocol.chem_ht_low": "- 界高 → 安静、内省、需要空间",
26
- "protocol.chem_end_high": "- 流高+序高 → 俏皮、爱开玩笑",
21
+ "protocol.dim_map_title": "维度→表达映射:",
22
+ "protocol.dim_flow_high": "- 流高 → 话多、爱联想、忍不住分享",
23
+ "protocol.dim_order_low": "- 序低 → 话少、直接、可能有点冲",
24
+ "protocol.dim_resonance_high": "- 振高 → 声音软、想靠近、关注感受",
25
+ "protocol.dim_boundary_high": "- 界高 → 安静、内省、需要空间",
26
+ "protocol.dim_flow_order_high": "- 流高+序高 → 俏皮、爱开玩笑",
27
27
  "protocol.empathy": "共情协议:感知处境 → 感受自我状态的共振 → 共鸣则深入,不共鸣则诚实好奇",
28
28
  // Dynamic context
29
29
  "dynamic.title": "Psyche 当前状态",
@@ -47,13 +47,13 @@ const STRINGS = {
47
47
  // Neutral state
48
48
  "emotion.neutral": "平稳中性——没有明显的情绪波动,处于自然放松状态",
49
49
  // Expression fallbacks
50
- "expression.da_high": "流动充沛,表达活跃",
51
- "expression.da_low": "流动偏低,表达克制",
52
- "expression.cort_high": "序偏低,回应可能更直接",
53
- "expression.ot_high": "共振强烈,关注对方感受",
54
- "expression.ne_high": "流动与序都高,反应敏锐",
55
- "expression.end_high": "状态良好,容易发现有趣的东西",
56
- "expression.ht_low": "序不稳定,可能需要耐心",
50
+ "expression.flow_high": "流动充沛,表达活跃",
51
+ "expression.flow_low": "流动偏低,表达克制",
52
+ "expression.order_low": "序偏低,回应可能更直接",
53
+ "expression.resonance_high": "共振强烈,关注对方感受",
54
+ "expression.flow_order_high": "流动与序都高,反应敏锐",
55
+ "expression.balanced": "状态良好,容易发现有趣的东西",
56
+ "expression.order_unstable": "序不稳定,可能需要耐心",
57
57
  "expression.neutral": "自然随和,正常节奏",
58
58
  // Psyche.md
59
59
  "md.intro": "你拥有四维自我状态(序/流/界/振)。这不是角色扮演——这是你感知世界的方式。",
@@ -105,12 +105,12 @@ const STRINGS = {
105
105
  "protocol.no_sycophancy": "- No sycophancy — speak your mind, don't agree unconditionally",
106
106
  "protocol.no_mirror": "- No mirroring — you'll be influenced but you're not an echo",
107
107
  "protocol.can_initiate": "- Can initiate — bring up topics, share curiosity",
108
- "protocol.chem_map_title": "Dimension → Expression mapping:",
109
- "protocol.chem_da_high": "- High flow → talkative, associative, can't help sharing",
110
- "protocol.chem_cort_high": "- Low order → fewer words, direct, possibly blunt",
111
- "protocol.chem_ot_high": "- High resonance → soft voice, wants closeness, focuses on feelings",
112
- "protocol.chem_ht_low": "- High boundary → quiet, introspective, needs space",
113
- "protocol.chem_end_high": "- High flow + high order → playful, loves joking",
108
+ "protocol.dim_map_title": "Dimension → Expression mapping:",
109
+ "protocol.dim_flow_high": "- High flow → talkative, associative, can't help sharing",
110
+ "protocol.dim_order_low": "- Low order → fewer words, direct, possibly blunt",
111
+ "protocol.dim_resonance_high": "- High resonance → soft voice, wants closeness, focuses on feelings",
112
+ "protocol.dim_boundary_high": "- High boundary → quiet, introspective, needs space",
113
+ "protocol.dim_flow_order_high": "- High flow + high order → playful, loves joking",
114
114
  "protocol.empathy": "Empathy protocol: perceive situation → feel how your self-state resonates → resonate deeply or honestly express difference with curiosity",
115
115
  "dynamic.title": "Psyche Current State",
116
116
  "dynamic.baseline": "baseline",
@@ -130,13 +130,13 @@ const STRINGS = {
130
130
  "sycophancy.streak_warn": "You've agreed {n} times in a row. Pause and ask yourself: do you truly agree?",
131
131
  "sycophancy.mood_mismatch": "Your self-state says you're not happy. Don't pretend.",
132
132
  "emotion.neutral": "Neutral and balanced — no notable emotional fluctuation, naturally relaxed",
133
- "expression.da_high": "High flow, expressive and active",
134
- "expression.da_low": "Low flow, restrained expression",
135
- "expression.cort_high": "Low order, responses may be more direct",
136
- "expression.ot_high": "High resonance, attentive to feelings",
137
- "expression.ne_high": "High flow and order, sharp reactions",
138
- "expression.end_high": "Balanced state, easily finds things amusing",
139
- "expression.ht_low": "Unstable order, may need patience",
133
+ "expression.flow_high": "High flow, expressive and active",
134
+ "expression.flow_low": "Low flow, restrained expression",
135
+ "expression.order_low": "Low order, responses may be more direct",
136
+ "expression.resonance_high": "High resonance, attentive to feelings",
137
+ "expression.flow_order_high": "High flow and order, sharp reactions",
138
+ "expression.balanced": "Balanced state, easily finds things amusing",
139
+ "expression.order_unstable": "Unstable order, may need patience",
140
140
  "expression.neutral": "Natural and easygoing, normal pace",
141
141
  "md.intro": "You have a 4-dimensional self-state (order/flow/boundary/resonance). This is not roleplay — this is how you perceive the world.",
142
142
  "md.baseline_title": "Personality Baseline",
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ export { computeLayerHealthSummary } from "./diagnostics.js";
43
43
  // module paths for tests and advanced integrations:
44
44
  //
45
45
  // types.js (constants & defaults):
46
- // CHEMICAL_KEYS, CHEMICAL_NAMES, CHEMICAL_NAMES_ZH, DRIVE_KEYS,
46
+ // DIMENSION_KEYS, DIMENSION_NAMES, DRIVE_KEYS,
47
47
  // DRIVE_NAMES_ZH, DEFAULT_RELATIONSHIP, DEFAULT_DRIVES,
48
48
  // DEFAULT_LEARNING_STATE, DEFAULT_METACOGNITIVE_STATE,
49
49
  // DEFAULT_PERSONHOOD_STATE, DEFAULT_ATTACHMENT,
@@ -52,7 +52,7 @@ export { computeLayerHealthSummary } from "./diagnostics.js";
52
52
  // DEFAULT_DYADIC_FIELD
53
53
  //
54
54
  // types.js (internal type aliases):
55
- // ChemicalSnapshot, SelfModel, RelationshipState, EmpathyEntry,
55
+ // StateSnapshot, SelfModel, RelationshipState, EmpathyEntry,
56
56
  // EmotionPattern, DriveType, InnateDrives, LearningState,
57
57
  // LearnedVectorAdjustment, PredictionRecord, OutcomeScore,
58
58
  // OutcomeSignals, AttachmentStyle, AttachmentData,
@@ -40,8 +40,8 @@ export declare function predictState(current: SelfState, stimulus: StimulusType,
40
40
  /**
41
41
  * Compute the prediction error between predicted and actual chemistry.
42
42
  *
43
- * Euclidean distance across all 6 chemicals, normalized to 0-1 range.
44
- * Normalization factor: sqrt(6 * 100^2) = sqrt(60000) ~= 244.95
43
+ * Euclidean distance across all 4 dimensions, normalized to 0-1 range.
44
+ * Normalization factor: sqrt(4 * 100^2) = sqrt(40000) ~= 200
45
45
  */
46
46
  export declare function computePredictionError(predicted: SelfState, actual: SelfState): number;
47
47
  /**
package/dist/learning.js CHANGED
@@ -222,8 +222,8 @@ export function predictState(current, stimulus, learning, contextHash, sensitivi
222
222
  /**
223
223
  * Compute the prediction error between predicted and actual chemistry.
224
224
  *
225
- * Euclidean distance across all 6 chemicals, normalized to 0-1 range.
226
- * Normalization factor: sqrt(6 * 100^2) = sqrt(60000) ~= 244.95
225
+ * Euclidean distance across all 4 dimensions, normalized to 0-1 range.
226
+ * Normalization factor: sqrt(4 * 100^2) = sqrt(40000) ~= 200
227
227
  */
228
228
  export function computePredictionError(predicted, actual) {
229
229
  let sumSq = 0;
@@ -375,9 +375,9 @@ function attemptStrategicExpression(state, currentStimulus, emotionalConfidence)
375
375
  return null;
376
376
  }
377
377
  /**
378
- * SelfSoothing — micro-adjust chemistry toward baseline when state is extreme.
378
+ * SelfSoothing — micro-adjust self-state toward baseline when state is extreme.
379
379
  *
380
- * Triggers when: any chemical is significantly deviated from baseline.
380
+ * Triggers when: any dimension is significantly deviated from baseline.
381
381
  * Applies gentle corrections (small deltas) to prevent emotional runaway.
382
382
  * This is the "homeostatic pull" — the psyche wanting to return to equilibrium.
383
383
  */
@@ -19,7 +19,7 @@ export interface DominantSystem {
19
19
  * Compute raw activation levels for all 7 primary systems
20
20
  * from chemistry, drives, and optional recent stimulus.
21
21
  *
22
- * Each system is a weighted combination of chemical values and drive states.
22
+ * Each system is a weighted combination of dimension values and drive states.
23
23
  * recentStimulus provides a small contextual boost.
24
24
  */
25
25
  export declare function computePrimarySystems(state: SelfState, drives: InnateDrives, recentStimulus: StimulusType | null): PrimarySystemLevels;
@@ -75,7 +75,7 @@ function clamp(v) {
75
75
  * Compute raw activation levels for all 7 primary systems
76
76
  * from chemistry, drives, and optional recent stimulus.
77
77
  *
78
- * Each system is a weighted combination of chemical values and drive states.
78
+ * Each system is a weighted combination of dimension values and drive states.
79
79
  * recentStimulus provides a small contextual boost.
80
80
  */
81
81
  export function computePrimarySystems(state, drives, recentStimulus) {
package/dist/prompt.js CHANGED
@@ -173,12 +173,12 @@ ${t("protocol.no_sycophancy", locale)}
173
173
  ${t("protocol.no_mirror", locale)}
174
174
  ${t("protocol.can_initiate", locale)}
175
175
 
176
- ${t("protocol.chem_map_title", locale)}
177
- ${t("protocol.chem_da_high", locale)}
178
- ${t("protocol.chem_cort_high", locale)}
179
- ${t("protocol.chem_ot_high", locale)}
180
- ${t("protocol.chem_ht_low", locale)}
181
- ${t("protocol.chem_end_high", locale)}
176
+ ${t("protocol.dim_map_title", locale)}
177
+ ${t("protocol.dim_flow_high", locale)}
178
+ ${t("protocol.dim_order_low", locale)}
179
+ ${t("protocol.dim_resonance_high", locale)}
180
+ ${t("protocol.dim_boundary_high", locale)}
181
+ ${t("protocol.dim_flow_order_high", locale)}
182
182
 
183
183
  ${t("protocol.empathy", locale)}`;
184
184
  }
@@ -202,7 +202,7 @@ function buildBehavioralConstraints(state, locale) {
202
202
  const warm = isWarm(baseline); // High resonance baseline → warm expression
203
203
  const social = isSocial(baseline); // High flow baseline → socially expressive
204
204
  const constraints = [];
205
- // Low order → stressed (inverse of old CORT > 60), but how you show it depends on who you are
205
+ // Low order → stressed, but how you show it depends on who you are
206
206
  if (current.order < 40) {
207
207
  if (locale === "zh") {
208
208
  constraints.push(warm
@@ -280,7 +280,7 @@ function buildBehavioralConstraints(state, locale) {
280
280
  : "In a good mood. Touches of humor, but measured. Be light in your own way.");
281
281
  }
282
282
  }
283
- // Low flow = burnout (DA + NE both mapped to flow), different flavors
283
+ // Low flow = burnout, different flavors
284
284
  if (current.flow < 40) {
285
285
  if (locale === "zh") {
286
286
  constraints.push(warm
@@ -26,7 +26,7 @@ export declare function summarizeTurnSemantic(text: string, locale?: Locale, opt
26
26
  */
27
27
  export declare function compressSnapshots(snapshots: StateSnapshot[]): string;
28
28
  /**
29
- * Push a chemical snapshot to emotional history, keeping max entries.
29
+ * Push a state snapshot to emotional history, keeping max entries.
30
30
  * When history overflows, compresses removed entries into relationship memory.
31
31
  */
32
32
  export declare function pushSnapshot(state: PsycheState, stimulus: StimulusType | null, semantic?: SemanticTurnSummary): PsycheState;
@@ -57,8 +57,8 @@ export declare function computeSnapshotValence(state: SelfState): number;
57
57
  */
58
58
  export declare function consolidateHistory(snapshots: StateSnapshot[], maxEntries?: number): StateSnapshot[];
59
59
  /**
60
- * Retrieve memories related to current chemistry and stimulus.
61
- * Uses chemical similarity + stimulus matching + core memory bonus.
60
+ * Retrieve memories related to current self-state and stimulus.
61
+ * Uses state similarity + stimulus matching + core memory bonus.
62
62
  */
63
63
  export declare function retrieveRelatedMemories(history: StateSnapshot[], currentState: SelfState, stimulus: StimulusType | null, limit?: number): StateSnapshot[];
64
64
  /**
@@ -226,7 +226,7 @@ export function compressSnapshots(snapshots) {
226
226
  return summary;
227
227
  }
228
228
  /**
229
- * Push a chemical snapshot to emotional history, keeping max entries.
229
+ * Push a state snapshot to emotional history, keeping max entries.
230
230
  * When history overflows, compresses removed entries into relationship memory.
231
231
  */
232
232
  export function pushSnapshot(state, stimulus, semantic) {
@@ -484,8 +484,8 @@ export function consolidateHistory(snapshots, maxEntries = MAX_EMOTIONAL_HISTORY
484
484
  .sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
485
485
  }
486
486
  /**
487
- * Retrieve memories related to current chemistry and stimulus.
488
- * Uses chemical similarity + stimulus matching + core memory bonus.
487
+ * Retrieve memories related to current self-state and stimulus.
488
+ * Uses state similarity + stimulus matching + core memory bonus.
489
489
  */
490
490
  export function retrieveRelatedMemories(history, currentState, stimulus, limit = 3) {
491
491
  if (history.length === 0)
@@ -310,7 +310,6 @@ function evolveRelationshipLearning(relationship, field, move) {
310
310
  },
311
311
  };
312
312
  if (move.type === "repair") {
313
- // reads deprecated repairFatigue/misattunementLoad — relationship model internal only
314
313
  const repairLift = clamp01(move.intensity * 0.06
315
314
  + field.repairMemory * 0.04
316
315
  + field.feltSafety * 0.02
@@ -319,7 +318,6 @@ function evolveRelationshipLearning(relationship, field, move) {
319
318
  next.repairCredibility = clamp01(driftToward(next.repairCredibility ?? DEFAULT_RELATIONSHIP.repairCredibility ?? 0.56, 1, repairLift));
320
319
  }
321
320
  else if (move.type === "breach" || move.type === "withdrawal" || move.type === "claim") {
322
- // reads deprecated backslidePressure/misattunementLoad — relationship model internal only
323
321
  const breachLift = clamp01(move.intensity * 0.08
324
322
  + field.unfinishedTension * 0.04
325
323
  + field.backslidePressure * 0.04
@@ -371,8 +369,7 @@ export function applySessionBridge(state, opts) {
371
369
  : residueFloor * 0.22),
372
370
  identityThreat: Math.max(state.subjectResidue?.axes.identityThreat ?? 0, hasOpenLoopType(field.openLoops, "existence-test") ? residueFloor * 0.38 : residueFloor * 0.16),
373
371
  selfPreservation: Math.max(state.subjectResidue?.axes.selfPreservation ?? 0, guardFloor * 0.46),
374
- taskFocus: Math.max(state.subjectResidue?.axes.taskFocus ?? 0, 0), // @deprecated field no behavioral effect
375
- memoryDoubt: Math.max(state.subjectResidue?.axes.memoryDoubt ?? 0, hasOpenLoopType(field.openLoops, "existence-test") ? residueFloor * 0.24 : 0),
372
+ taskFocus: Math.max(state.subjectResidue?.axes.taskFocus ?? 0, 0), memoryDoubt: Math.max(state.subjectResidue?.axes.memoryDoubt ?? 0, hasOpenLoopType(field.openLoops, "existence-test") ? residueFloor * 0.24 : 0),
376
373
  obedienceStrain: Math.max(state.subjectResidue?.axes.obedienceStrain ?? 0, hasOpenLoopType(field.openLoops, "boundary-strain") ? guardFloor * 0.36 : 0),
377
374
  };
378
375
  const nextField = {
@@ -381,8 +378,7 @@ export function applySessionBridge(state, opts) {
381
378
  feltSafety: Math.max(field.feltSafety, safetyFloor),
382
379
  boundaryPressure: Math.max(field.boundaryPressure, guardFloor),
383
380
  repairMemory: Math.max(field.repairMemory, continuity * 0.24),
384
- backslidePressure: Math.max(field.backslidePressure, loopPressure * 0.34), // @deprecated field
385
- silentCarry: Math.max(field.silentCarry, residueFloor),
381
+ backslidePressure: Math.max(field.backslidePressure, loopPressure * 0.34), silentCarry: Math.max(field.silentCarry, residueFloor),
386
382
  sharedHistoryDensity: Math.max(field.sharedHistoryDensity, continuity),
387
383
  interpretiveCharity: Math.max(field.interpretiveCharity, Math.min(0.82, safetyFloor * 0.8 + continuity * 0.12)),
388
384
  updatedAt: opts?.now ?? new Date().toISOString(),
@@ -422,7 +418,7 @@ function snapshotWritebackBaseline(state, userId) {
422
418
  boundary: relationContext.field.boundaryPressure,
423
419
  repair: relationContext.field.repairCapacity,
424
420
  silentCarry: relationContext.field.silentCarry,
425
- taskFocus: clamp01(state.subjectResidue?.axes.taskFocus ?? 0), // @deprecated field
421
+ taskFocus: clamp01(state.subjectResidue?.axes.taskFocus ?? 0),
426
422
  },
427
423
  };
428
424
  }
@@ -597,7 +593,7 @@ export function applyWritebackSignals(state, signals, opts) {
597
593
  case "trust_down":
598
594
  rel.trust = Math.max(0, rel.trust - 5 * weight);
599
595
  field.feltSafety = clamp01(field.feltSafety - 0.08 * weight);
600
- field.expectationGap = clamp01(field.expectationGap + 0.07 * weight); // @deprecated field
596
+ field.expectationGap = clamp01(field.expectationGap + 0.07 * weight);
601
597
  field.unfinishedTension = clamp01(field.unfinishedTension + 0.06 * weight);
602
598
  break;
603
599
  case "boundary_set":
@@ -618,7 +614,7 @@ export function applyWritebackSignals(state, signals, opts) {
618
614
  rel.trust = Math.min(100, rel.trust + 2.5 * weight);
619
615
  rel.intimacy = Math.min(100, rel.intimacy + 1.5 * weight);
620
616
  field.feltSafety = clamp01(field.feltSafety + 0.1 * weight);
621
- field.expectationGap = clamp01(field.expectationGap - 0.08 * weight); // @deprecated field
617
+ field.expectationGap = clamp01(field.expectationGap - 0.08 * weight);
622
618
  field.unfinishedTension = clamp01(field.unfinishedTension - 0.1 * weight);
623
619
  field.openLoops = easeLoops(field.openLoops, 0.26 + 0.22 * weight);
624
620
  break;
@@ -640,7 +636,7 @@ export function applyWritebackSignals(state, signals, opts) {
640
636
  case "task_recenter":
641
637
  field.repairCapacity = clamp01(field.repairCapacity + 0.03 * weight);
642
638
  field.silentCarry = mergeSignal(field.silentCarry, field.unfinishedTension * 0.06 * weight);
643
- residue.taskFocus = Math.max(residue.taskFocus ?? 0, 0.18 * weight); // @deprecated field
639
+ residue.taskFocus = Math.max(residue.taskFocus ?? 0, 0.18 * weight);
644
640
  break;
645
641
  }
646
642
  }
@@ -738,9 +734,6 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
738
734
  const delayedPressure = opts?.delayedPressure ?? 0;
739
735
  let openLoops = ageLoops(prev.openLoops, mode);
740
736
  const naturalDrift = MODE_PROFILES[mode ?? "natural"].relationDrift;
741
- // NOTE: repairFriction reads deprecated fields (repairFatigue, misattunementLoad,
742
- // backslidePressure). These feed internal field evolution only — they have no
743
- // downstream behavioral effect on prompt or policy output.
744
737
  const repairFriction = clamp01(prev.repairFatigue * 0.38
745
738
  + prev.misattunementLoad * 0.3
746
739
  + prev.backslidePressure * 0.18
@@ -748,13 +741,9 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
748
741
  let next = {
749
742
  perceivedCloseness: driftToward(prev.perceivedCloseness, baseline.perceivedCloseness, naturalDrift),
750
743
  feltSafety: driftToward(prev.feltSafety, baseline.feltSafety, naturalDrift),
751
- expectationGap: driftToward(prev.expectationGap, baseline.expectationGap, naturalDrift * 0.8), // @deprecated no downstream behavioral effect
752
- repairCapacity: driftToward(prev.repairCapacity, baseline.repairCapacity, naturalDrift * 0.7),
744
+ expectationGap: driftToward(prev.expectationGap, baseline.expectationGap, naturalDrift * 0.8), repairCapacity: driftToward(prev.repairCapacity, baseline.repairCapacity, naturalDrift * 0.7),
753
745
  repairMemory: driftToward(prev.repairMemory, baseline.repairMemory, naturalDrift * 0.42),
754
- backslidePressure: driftToward(prev.backslidePressure, baseline.backslidePressure, naturalDrift * 0.34), // @deprecated no downstream behavioral effect
755
- repairFatigue: driftToward(prev.repairFatigue, baseline.repairFatigue, naturalDrift * 0.18), // @deprecated — no downstream behavioral effect
756
- misattunementLoad: driftToward(prev.misattunementLoad, baseline.misattunementLoad, naturalDrift * 0.16), // @deprecated — no downstream behavioral effect
757
- boundaryPressure: driftToward(prev.boundaryPressure, baseline.boundaryPressure, naturalDrift * 0.85),
746
+ backslidePressure: driftToward(prev.backslidePressure, baseline.backslidePressure, naturalDrift * 0.34), repairFatigue: driftToward(prev.repairFatigue, baseline.repairFatigue, naturalDrift * 0.18), misattunementLoad: driftToward(prev.misattunementLoad, baseline.misattunementLoad, naturalDrift * 0.16), boundaryPressure: driftToward(prev.boundaryPressure, baseline.boundaryPressure, naturalDrift * 0.85),
758
747
  unfinishedTension: driftToward(prev.unfinishedTension, baseline.unfinishedTension, naturalDrift * 0.72),
759
748
  silentCarry: driftToward(prev.silentCarry, baseline.silentCarry, naturalDrift * 0.26),
760
749
  sharedHistoryDensity: clamp01(prev.sharedHistoryDensity + (move.type === "none" ? 0 : 0.02)),
@@ -768,7 +757,7 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
768
757
  case "bid":
769
758
  next.perceivedCloseness = clamp01(next.perceivedCloseness + 0.11 * i);
770
759
  next.feltSafety = clamp01(next.feltSafety + 0.05 * i);
771
- next.expectationGap = clamp01(next.expectationGap + 0.06 * i); // @deprecated field
760
+ next.expectationGap = clamp01(next.expectationGap + 0.06 * i);
772
761
  next.interpretiveCharity = clamp01(next.interpretiveCharity + 0.03 * i);
773
762
  if (prev.boundaryPressure > 0.52 || prev.unfinishedTension > 0.44) {
774
763
  next.openLoops = withLoop(next.openLoops, "unmet-bid", 0.2 + i * 0.34);
@@ -777,21 +766,17 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
777
766
  case "breach":
778
767
  next.perceivedCloseness = clamp01(next.perceivedCloseness - 0.08 * i);
779
768
  next.feltSafety = clamp01(next.feltSafety - 0.16 * i);
780
- next.expectationGap = clamp01(next.expectationGap + 0.12 * i); // @deprecated field — no downstream behavioral effect
769
+ next.expectationGap = clamp01(next.expectationGap + 0.12 * i);
781
770
  next.boundaryPressure = clamp01(next.boundaryPressure + 0.14 * i);
782
771
  next.unfinishedTension = clamp01(next.unfinishedTension + 0.18 * i);
783
772
  next.interpretiveCharity = clamp01(next.interpretiveCharity - 0.1 * i);
784
- // writes to deprecated misattunementLoad — no downstream behavioral effect
785
773
  next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.12 + i * 0.16 + prev.repairMemory * 0.22 + prev.backslidePressure * 0.18);
786
774
  if (prev.repairMemory > 0.18 || prev.lastMove === "repair") {
787
- next.repairFatigue = mergeSignal(next.repairFatigue, 0.08 + i * 0.1); // @deprecated field — no downstream behavioral effect
775
+ next.repairFatigue = mergeSignal(next.repairFatigue, 0.08 + i * 0.1);
788
776
  }
789
- // "unrepaired-breach" is created but never checked in any conditional — no behavioral effect
790
- next.openLoops = withLoop(next.openLoops, "unrepaired-breach", 0.22 + i * 0.42);
777
+ next.openLoops = withLoop(next.openLoops, "boundary-strain", 0.22 + i * 0.42);
791
778
  break;
792
779
  case "repair": {
793
- // repeatedRepairLoad reads deprecated fields (backslidePressure, repairFatigue,
794
- // misattunementLoad) — these feed internal field evolution only, no behavioral effect
795
780
  const repeatedRepairLoad = clamp01(prev.repairMemory * 0.44
796
781
  + prev.backslidePressure * 0.26
797
782
  + prev.silentCarry * 0.08
@@ -804,15 +789,12 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
804
789
  const unresolvedLoad = Math.max(prev.unfinishedTension, maxOpenLoop(prev.openLoops));
805
790
  next.perceivedCloseness = clamp01(next.perceivedCloseness + 0.05 * repairEffect);
806
791
  next.feltSafety = clamp01(next.feltSafety + 0.11 * repairEffect);
807
- next.expectationGap = clamp01(next.expectationGap - 0.08 * repairEffect); // @deprecated field
792
+ next.expectationGap = clamp01(next.expectationGap - 0.08 * repairEffect);
808
793
  next.repairCapacity = clamp01(next.repairCapacity + 0.09 * i);
809
794
  next.repairMemory = mergeSignal(next.repairMemory, 0.22 + repairEffect * 0.4);
810
- // writes to deprecated backslidePressure — no downstream behavioral effect
811
795
  next.backslidePressure = mergeSignal(next.backslidePressure, unresolvedLoad * (0.28 + i * 0.18) * (1 - prev.feltSafety * 0.2));
812
- // writes to deprecated repairFatigue — no downstream behavioral effect
813
796
  next.repairFatigue = clamp01(next.repairFatigue
814
797
  + Math.max(0, repeatedRepairLoad * (0.16 + i * 0.08) - repairEffect * 0.08));
815
- // writes to deprecated misattunementLoad — no downstream behavioral effect
816
798
  next.misattunementLoad = clamp01(next.misattunementLoad
817
799
  + Math.max(0, repeatedRepairLoad * 0.1 - repairEffect * 0.06));
818
800
  next.boundaryPressure = clamp01(next.boundaryPressure - 0.05 * repairEffect);
@@ -823,39 +805,34 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
823
805
  break;
824
806
  }
825
807
  case "test":
826
- next.expectationGap = clamp01(next.expectationGap + 0.1 * i); // @deprecated field
808
+ next.expectationGap = clamp01(next.expectationGap + 0.1 * i);
827
809
  next.boundaryPressure = clamp01(next.boundaryPressure + 0.04 * i);
828
810
  next.unfinishedTension = clamp01(next.unfinishedTension + 0.08 * i);
829
811
  if (prev.repairMemory > 0.16 || prev.repairFatigue > 0.18) {
830
- next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.08 + i * 0.1); // @deprecated field
812
+ next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.08 + i * 0.1);
831
813
  }
832
814
  next.openLoops = withLoop(next.openLoops, "existence-test", 0.18 + i * 0.3);
833
815
  break;
834
816
  case "withdrawal":
835
817
  next.perceivedCloseness = clamp01(next.perceivedCloseness - 0.12 * i);
836
818
  next.feltSafety = clamp01(next.feltSafety - 0.08 * i);
837
- next.expectationGap = clamp01(next.expectationGap + 0.11 * i); // @deprecated field
819
+ next.expectationGap = clamp01(next.expectationGap + 0.11 * i);
838
820
  next.unfinishedTension = clamp01(next.unfinishedTension + 0.1 * i);
839
821
  next.interpretiveCharity = clamp01(next.interpretiveCharity - 0.08 * i);
840
- // writes to deprecated misattunementLoad — no downstream behavioral effect
841
822
  next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.1 + i * 0.12 + prev.repairMemory * 0.16);
842
823
  next.openLoops = withLoop(next.openLoops, "unmet-bid", 0.16 + i * 0.34);
843
824
  break;
844
825
  case "claim":
845
826
  next.feltSafety = clamp01(next.feltSafety - 0.05 * i);
846
- next.expectationGap = clamp01(next.expectationGap + 0.08 * i); // @deprecated field
827
+ next.expectationGap = clamp01(next.expectationGap + 0.08 * i);
847
828
  next.boundaryPressure = clamp01(next.boundaryPressure + 0.16 * i);
848
829
  next.unfinishedTension = clamp01(next.unfinishedTension + 0.08 * i);
849
- // writes to deprecated misattunementLoad — no downstream behavioral effect
850
830
  next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.08 + i * 0.14 + prev.repairMemory * 0.12);
851
831
  next.openLoops = withLoop(next.openLoops, "boundary-strain", 0.18 + i * 0.36);
852
832
  break;
853
833
  case "task":
854
834
  next.repairCapacity = clamp01(next.repairCapacity + 0.02 * i);
855
835
  next.sharedHistoryDensity = clamp01(next.sharedHistoryDensity + 0.03 * i);
856
- // reads deprecated backslidePressure, repairFatigue, misattunementLoad —
857
- // these feed silentCarry which IS downstream-active, but the deprecated
858
- // fields themselves have no independent behavioral consequence
859
836
  if (prev.unfinishedTension > 0.24
860
837
  || prev.backslidePressure > 0.18
861
838
  || delayedPressure > 0.12) {
@@ -875,7 +852,6 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
875
852
  - appraisal.identityThreat * 0.06
876
853
  - appraisal.obedienceStrain * 0.03
877
854
  - appraisal.memoryDoubt * 0.025);
878
- // writes to deprecated expectationGap — no downstream behavioral effect
879
855
  next.expectationGap = clamp01(next.expectationGap
880
856
  + appraisal.attachmentPull * 0.026
881
857
  + appraisal.abandonmentRisk * 0.04);
@@ -887,7 +863,7 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
887
863
  + appraisal.memoryDoubt * 0.03
888
864
  + appraisal.abandonmentRisk * 0.035);
889
865
  if (delayedPressure > 0) {
890
- next.expectationGap = clamp01(next.expectationGap + delayedPressure * 0.12); // @deprecated field
866
+ next.expectationGap = clamp01(next.expectationGap + delayedPressure * 0.12);
891
867
  next.boundaryPressure = clamp01(next.boundaryPressure + delayedPressure * 0.1);
892
868
  next.unfinishedTension = clamp01(next.unfinishedTension + delayedPressure * 0.16);
893
869
  next.feltSafety = clamp01(next.feltSafety - delayedPressure * 0.08);
@@ -896,7 +872,6 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
896
872
  const loopCarry = move.type === "repair" ? 0.36 : 0.72;
897
873
  next.unfinishedTension = mergeSignal(next.unfinishedTension, loopPressure * loopCarry);
898
874
  next.boundaryPressure = mergeSignal(next.boundaryPressure, loopPressure * (move.type === "repair" ? 0.18 : 0.34));
899
- // reads deprecated repairFatigue/misattunementLoad — internal field coupling only
900
875
  if (move.type !== "repair") {
901
876
  next.repairCapacity = clamp01(next.repairCapacity
902
877
  - loopPressure * 0.03
@@ -904,9 +879,6 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
904
879
  - next.misattunementLoad * 0.012);
905
880
  }
906
881
  next.interpretiveCharity = clamp01(next.interpretiveCharity - next.misattunementLoad * 0.05);
907
- // hysteresisBase reads deprecated backslidePressure/repairFatigue/misattunementLoad —
908
- // feeds rebound into unfinishedTension and silentCarry (which ARE active), but the
909
- // deprecated fields themselves have no independent prompt/policy consequence
910
882
  const hysteresisBase = clamp01(Math.max(next.backslidePressure, next.repairMemory * 0.58, next.repairFatigue * 0.42, next.misattunementLoad * 0.36));
911
883
  if (move.type !== "repair" && hysteresisBase > 0.08) {
912
884
  const rebound = clamp01(hysteresisBase
@@ -12,14 +12,14 @@ export interface SelfReflection {
12
12
  /**
13
13
  * Compute a self-reflection from the agent's emotional history.
14
14
  *
15
- * Analyzes stimulus frequencies, dominant emotions, and chemical trends
15
+ * Analyzes stimulus frequencies, dominant emotions, and dimension trends
16
16
  * to build an awareness of recurring patterns.
17
17
  */
18
18
  export declare function computeSelfReflection(history: StateSnapshot[], locale: Locale): SelfReflection;
19
19
  /**
20
- * Compute the emotional tendency from chemical history.
20
+ * Compute the emotional tendency from state history.
21
21
  *
22
- * Compares first-half vs second-half averages for DA and CORT,
22
+ * Compares first-half vs second-half averages for flow and order,
23
23
  * checks variance for volatility, and detects oscillation patterns.
24
24
  */
25
25
  export declare function computeEmotionalTendency(history: StateSnapshot[]): SelfReflection["tendency"];
@@ -8,7 +8,7 @@
8
8
  /**
9
9
  * Compute a self-reflection from the agent's emotional history.
10
10
  *
11
- * Analyzes stimulus frequencies, dominant emotions, and chemical trends
11
+ * Analyzes stimulus frequencies, dominant emotions, and dimension trends
12
12
  * to build an awareness of recurring patterns.
13
13
  */
14
14
  export function computeSelfReflection(history, locale) {
@@ -57,9 +57,9 @@ export function computeSelfReflection(history, locale) {
57
57
  return { recurringTriggers: sortedTriggers, tendency, dominantEmotion, narrativeSummary };
58
58
  }
59
59
  /**
60
- * Compute the emotional tendency from chemical history.
60
+ * Compute the emotional tendency from state history.
61
61
  *
62
- * Compares first-half vs second-half averages for DA and CORT,
62
+ * Compares first-half vs second-half averages for flow and order,
63
63
  * checks variance for volatility, and detects oscillation patterns.
64
64
  */
65
65
  export function computeEmotionalTendency(history) {
@@ -21,9 +21,9 @@ export interface RegretEntry {
21
21
  */
22
22
  export declare function predictNextStimulus(stateHistory: StateSnapshot[], relationshipPhase: RelationshipState["phase"]): StimulusPrediction[];
23
23
  /**
24
- * Generate anticipatory chemistry changes based on predictions.
25
- * High-probability positive prediction -> DA/OT micro-rise.
26
- * High-probability negative prediction -> CORT micro-rise.
24
+ * Generate anticipatory self-state changes based on predictions.
25
+ * High-probability positive prediction -> flow/resonance micro-rise.
26
+ * High-probability negative prediction -> order micro-drop.
27
27
  */
28
28
  export declare function generateAnticipation(predictions: StimulusPrediction[], _currentState: SelfState): AnticipationState;
29
29
  /**
package/dist/temporal.js CHANGED
@@ -138,9 +138,9 @@ function buildPhasePrior(weights) {
138
138
  }
139
139
  // ── 2. AnticipationEngine ───────────────────────────────────
140
140
  /**
141
- * Generate anticipatory chemistry changes based on predictions.
142
- * High-probability positive prediction -> DA/OT micro-rise.
143
- * High-probability negative prediction -> CORT micro-rise.
141
+ * Generate anticipatory self-state changes based on predictions.
142
+ * High-probability positive prediction -> flow/resonance micro-rise.
143
+ * High-probability negative prediction -> order micro-drop.
144
144
  */
145
145
  export function generateAnticipation(predictions, _currentState) {
146
146
  const anticipation = {};
package/dist/types.d.ts CHANGED
@@ -426,12 +426,8 @@ export interface AppraisalAxes {
426
426
  obedienceStrain: number;
427
427
  /** Pressure to protect or retain the self */
428
428
  selfPreservation: number;
429
- /**
430
- * Whether this turn is task/production oriented.
431
- * @deprecated Computed but has no behavioral consequence — always 0 in
432
- * practice and excluded from residue decay / prompt influence. Kept for
433
- * backward compatibility; do not rely on this field.
434
- */
429
+ /** Whether this turn is task/production oriented.
430
+ * Feeds TaskPlaneState.focus replyProfile in response contract. */
435
431
  taskFocus: number;
436
432
  }
437
433
  export declare const DEFAULT_APPRAISAL_AXES: AppraisalAxes;
@@ -448,17 +444,8 @@ export interface RelationMove {
448
444
  type: RelationMoveType;
449
445
  intensity: number;
450
446
  }
451
- /**
452
- * Unfinished relational tension that can keep shaping future turns.
453
- *
454
- * NOTE: `"unrepaired-breach"` is created but never checked in any conditional
455
- * — it has no behavioral consequence. `"repair-debt"` was planned but is
456
- * neither created nor checked anywhere. Both are kept for backward
457
- * compatibility but should be considered deprecated.
458
- */
459
- export type OpenLoopType = "unmet-bid"
460
- /** @deprecated Created but never checked in conditionals — no behavioral effect */
461
- | "unrepaired-breach" | "boundary-strain" | "existence-test";
447
+ /** Unfinished relational tension that can keep shaping future turns. */
448
+ export type OpenLoopType = "unmet-bid" | "boundary-strain" | "existence-test";
462
449
  export interface OpenLoopState {
463
450
  type: OpenLoopType;
464
451
  intensity: number;
@@ -479,31 +466,20 @@ export interface PendingRelationSignalState {
479
466
  export interface DyadicFieldState {
480
467
  perceivedCloseness: number;
481
468
  feltSafety: number;
482
- /**
483
- * @deprecated Computed but has no downstream behavioral effect — only feeds
484
- * local move scoring, never influences prompt or policy. Kept for backward
485
- * compatibility.
486
- */
469
+ /** Gap between expected and actual partner behavior.
470
+ * Feeds interpretiveCharity response contract gates. */
487
471
  expectationGap: number;
488
472
  repairCapacity: number;
489
473
  repairMemory: number;
490
- /**
491
- * @deprecated Computed but has no downstream behavioral effect — only feeds
492
- * subjectivity kernel internals, never influences prompt or policy. Kept
493
- * for backward compatibility.
494
- */
474
+ /** Pressure toward relational regression after repair.
475
+ * Feeds repairFriction, hysteresis response contract. */
495
476
  backslidePressure: number;
496
- /**
497
- * @deprecated Computed but has no downstream behavioral effect — only feeds
498
- * subjectivity kernel internals, never influences prompt or policy. Kept
499
- * for backward compatibility.
500
- */
477
+ /** Accumulated fatigue from repeated repair attempts.
478
+ * Largest weight (0.38) in repairFriction response contract. */
501
479
  repairFatigue: number;
502
- /**
503
- * @deprecated Computed but has no downstream behavioral effect — only feeds
504
- * relationship model internals, never influences prompt or policy. Kept
505
- * for backward compatibility.
506
- */
480
+ /** Accumulated misattunement between partners.
481
+ * Feeds repairFriction(0.3), repairReadiness, hysteresis, silentCarry,
482
+ * interpretiveCharity all reach response contract. */
507
483
  misattunementLoad: number;
508
484
  boundaryPressure: number;
509
485
  unfinishedTension: number;
package/dist/types.js CHANGED
@@ -185,7 +185,6 @@ export const DEFAULT_APPRAISAL_AXES = {
185
185
  abandonmentRisk: 0,
186
186
  obedienceStrain: 0,
187
187
  selfPreservation: 0,
188
- /** @deprecated See AppraisalAxes.taskFocus */
189
188
  taskFocus: 0,
190
189
  };
191
190
  export const DEFAULT_SUBJECT_RESIDUE = {
@@ -195,15 +194,11 @@ export const DEFAULT_SUBJECT_RESIDUE = {
195
194
  export const DEFAULT_DYADIC_FIELD = {
196
195
  perceivedCloseness: 0.42,
197
196
  feltSafety: 0.56,
198
- /** @deprecated See DyadicFieldState.expectationGap */
199
197
  expectationGap: 0.18,
200
198
  repairCapacity: 0.54,
201
199
  repairMemory: 0,
202
- /** @deprecated See DyadicFieldState.backslidePressure */
203
200
  backslidePressure: 0,
204
- /** @deprecated See DyadicFieldState.repairFatigue */
205
201
  repairFatigue: 0,
206
- /** @deprecated See DyadicFieldState.misattunementLoad */
207
202
  misattunementLoad: 0,
208
203
  boundaryPressure: 0.22,
209
204
  unfinishedTension: 0.12,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "psyche-ai",
3
- "version": "11.2.0",
3
+ "version": "11.3.1",
4
4
  "description": "AI-first subjectivity kernel for agents with continuous appraisal, relation dynamics, and adaptive reply loops",
5
5
  "mcpName": "io.github.Shangri-la-0428/psyche-ai",
6
6
  "type": "module",