psyche-ai 11.2.0 → 11.3.0

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)
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "psyche-ai",
3
- "version": "11.2.0",
3
+ "version": "11.3.0",
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",