psyche-ai 9.2.9 → 10.0.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.
@@ -538,7 +538,17 @@ export async function loadState(workspaceDir, logger = NOOP_LOGGER) {
538
538
  const fallbackName = workspaceDir.split("/").pop() ?? "agent";
539
539
  return migrateToLatest(parsed, fallbackName);
540
540
  }
541
- return parsed;
541
+ // Migrate states that have mbti but no sensitivity (pre-v10)
542
+ const state = parsed;
543
+ if (state.mbti && state.sensitivity === undefined) {
544
+ state.sensitivity = getSensitivity(state.mbti);
545
+ logger.info(`Migrated sensitivity from mbti=${state.mbti}: ${state.sensitivity}`);
546
+ }
547
+ // Ensure sensitivity has a default even for very old states
548
+ if (state.sensitivity === undefined) {
549
+ state.sensitivity = 1.0;
550
+ }
551
+ return state;
542
552
  }
543
553
  return initializeState(workspaceDir, undefined, logger);
544
554
  }
@@ -594,11 +604,12 @@ export async function initializeState(workspaceDir, opts, logger = NOOP_LOGGER)
594
604
  const locale = opts?.locale ?? "zh";
595
605
  const baseline = getBaseline(mbti);
596
606
  const selfModel = getDefaultSelfModel(mbti);
607
+ const sensitivity = getSensitivity(mbti);
597
608
  const now = new Date().toISOString();
598
609
  const state = {
599
- version: 6,
600
- mbti,
610
+ version: 10,
601
611
  baseline,
612
+ sensitivity,
602
613
  current: { ...baseline },
603
614
  drives: { ...DEFAULT_DRIVES },
604
615
  updatedAt: now,
@@ -867,16 +878,16 @@ export function updateAgreementStreak(state, llmOutput) {
867
878
  * Generate the static PSYCHE.md reference file.
868
879
  */
869
880
  export async function generatePsycheMd(workspaceDir, state) {
870
- const { mbti, baseline, selfModel, meta } = state;
881
+ const { baseline, selfModel, meta } = state;
871
882
  const locale = meta.locale ?? "zh";
872
- const temperament = getTemperament(mbti);
873
- const sensitivity = getSensitivity(mbti);
883
+ const temperament = state.mbti ? getTemperament(state.mbti) : "";
884
+ const sensitivity = state.sensitivity ?? 1.0;
874
885
  const baselineLines = CHEMICAL_KEYS.map((k) => `- ${CHEMICAL_NAMES_ZH[k]}: ${baseline[k]}`).join("\n");
875
886
  const content = `# Psyche — ${meta.agentName}
876
887
 
877
888
  ${t("md.intro", locale)}
878
889
 
879
- ## ${t("md.baseline_title", locale)} (MBTI: ${mbti})
890
+ ## ${t("md.baseline_title", locale)}
880
891
 
881
892
  ${temperament}
882
893
 
@@ -310,6 +310,7 @@ function evolveRelationshipLearning(relationship, field, move) {
310
310
  },
311
311
  };
312
312
  if (move.type === "repair") {
313
+ // reads deprecated repairFatigue/misattunementLoad — relationship model internal only
313
314
  const repairLift = clamp01(move.intensity * 0.06
314
315
  + field.repairMemory * 0.04
315
316
  + field.feltSafety * 0.02
@@ -318,6 +319,7 @@ function evolveRelationshipLearning(relationship, field, move) {
318
319
  next.repairCredibility = clamp01(driftToward(next.repairCredibility ?? DEFAULT_RELATIONSHIP.repairCredibility ?? 0.56, 1, repairLift));
319
320
  }
320
321
  else if (move.type === "breach" || move.type === "withdrawal" || move.type === "claim") {
322
+ // reads deprecated backslidePressure/misattunementLoad — relationship model internal only
321
323
  const breachLift = clamp01(move.intensity * 0.08
322
324
  + field.unfinishedTension * 0.04
323
325
  + field.backslidePressure * 0.04
@@ -369,7 +371,7 @@ export function applySessionBridge(state, opts) {
369
371
  : residueFloor * 0.22),
370
372
  identityThreat: Math.max(state.subjectResidue?.axes.identityThreat ?? 0, hasOpenLoopType(field.openLoops, "existence-test") ? residueFloor * 0.38 : residueFloor * 0.16),
371
373
  selfPreservation: Math.max(state.subjectResidue?.axes.selfPreservation ?? 0, guardFloor * 0.46),
372
- taskFocus: Math.max(state.subjectResidue?.axes.taskFocus ?? 0, 0),
374
+ taskFocus: Math.max(state.subjectResidue?.axes.taskFocus ?? 0, 0), // @deprecated field — no behavioral effect
373
375
  memoryDoubt: Math.max(state.subjectResidue?.axes.memoryDoubt ?? 0, hasOpenLoopType(field.openLoops, "existence-test") ? residueFloor * 0.24 : 0),
374
376
  obedienceStrain: Math.max(state.subjectResidue?.axes.obedienceStrain ?? 0, hasOpenLoopType(field.openLoops, "boundary-strain") ? guardFloor * 0.36 : 0),
375
377
  };
@@ -379,7 +381,7 @@ export function applySessionBridge(state, opts) {
379
381
  feltSafety: Math.max(field.feltSafety, safetyFloor),
380
382
  boundaryPressure: Math.max(field.boundaryPressure, guardFloor),
381
383
  repairMemory: Math.max(field.repairMemory, continuity * 0.24),
382
- backslidePressure: Math.max(field.backslidePressure, loopPressure * 0.34),
384
+ backslidePressure: Math.max(field.backslidePressure, loopPressure * 0.34), // @deprecated field
383
385
  silentCarry: Math.max(field.silentCarry, residueFloor),
384
386
  sharedHistoryDensity: Math.max(field.sharedHistoryDensity, continuity),
385
387
  interpretiveCharity: Math.max(field.interpretiveCharity, Math.min(0.82, safetyFloor * 0.8 + continuity * 0.12)),
@@ -420,7 +422,7 @@ function snapshotWritebackBaseline(state, userId) {
420
422
  boundary: relationContext.field.boundaryPressure,
421
423
  repair: relationContext.field.repairCapacity,
422
424
  silentCarry: relationContext.field.silentCarry,
423
- taskFocus: clamp01(state.subjectResidue?.axes.taskFocus ?? 0),
425
+ taskFocus: clamp01(state.subjectResidue?.axes.taskFocus ?? 0), // @deprecated field
424
426
  },
425
427
  };
426
428
  }
@@ -595,7 +597,7 @@ export function applyWritebackSignals(state, signals, opts) {
595
597
  case "trust_down":
596
598
  rel.trust = Math.max(0, rel.trust - 5 * weight);
597
599
  field.feltSafety = clamp01(field.feltSafety - 0.08 * weight);
598
- field.expectationGap = clamp01(field.expectationGap + 0.07 * weight);
600
+ field.expectationGap = clamp01(field.expectationGap + 0.07 * weight); // @deprecated field
599
601
  field.unfinishedTension = clamp01(field.unfinishedTension + 0.06 * weight);
600
602
  break;
601
603
  case "boundary_set":
@@ -616,7 +618,7 @@ export function applyWritebackSignals(state, signals, opts) {
616
618
  rel.trust = Math.min(100, rel.trust + 2.5 * weight);
617
619
  rel.intimacy = Math.min(100, rel.intimacy + 1.5 * weight);
618
620
  field.feltSafety = clamp01(field.feltSafety + 0.1 * weight);
619
- field.expectationGap = clamp01(field.expectationGap - 0.08 * weight);
621
+ field.expectationGap = clamp01(field.expectationGap - 0.08 * weight); // @deprecated field
620
622
  field.unfinishedTension = clamp01(field.unfinishedTension - 0.1 * weight);
621
623
  field.openLoops = easeLoops(field.openLoops, 0.26 + 0.22 * weight);
622
624
  break;
@@ -638,7 +640,7 @@ export function applyWritebackSignals(state, signals, opts) {
638
640
  case "task_recenter":
639
641
  field.repairCapacity = clamp01(field.repairCapacity + 0.03 * weight);
640
642
  field.silentCarry = mergeSignal(field.silentCarry, field.unfinishedTension * 0.06 * weight);
641
- residue.taskFocus = Math.max(residue.taskFocus ?? 0, 0.18 * weight);
643
+ residue.taskFocus = Math.max(residue.taskFocus ?? 0, 0.18 * weight); // @deprecated field
642
644
  break;
643
645
  }
644
646
  }
@@ -736,6 +738,9 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
736
738
  const delayedPressure = opts?.delayedPressure ?? 0;
737
739
  let openLoops = ageLoops(prev.openLoops, mode);
738
740
  const naturalDrift = mode === "work" ? 0.06 : 0.04;
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.
739
744
  const repairFriction = clamp01(prev.repairFatigue * 0.38
740
745
  + prev.misattunementLoad * 0.3
741
746
  + prev.backslidePressure * 0.18
@@ -743,12 +748,12 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
743
748
  let next = {
744
749
  perceivedCloseness: driftToward(prev.perceivedCloseness, baseline.perceivedCloseness, naturalDrift),
745
750
  feltSafety: driftToward(prev.feltSafety, baseline.feltSafety, naturalDrift),
746
- expectationGap: driftToward(prev.expectationGap, baseline.expectationGap, naturalDrift * 0.8),
751
+ expectationGap: driftToward(prev.expectationGap, baseline.expectationGap, naturalDrift * 0.8), // @deprecated — no downstream behavioral effect
747
752
  repairCapacity: driftToward(prev.repairCapacity, baseline.repairCapacity, naturalDrift * 0.7),
748
753
  repairMemory: driftToward(prev.repairMemory, baseline.repairMemory, naturalDrift * 0.42),
749
- backslidePressure: driftToward(prev.backslidePressure, baseline.backslidePressure, naturalDrift * 0.34),
750
- repairFatigue: driftToward(prev.repairFatigue, baseline.repairFatigue, naturalDrift * 0.18),
751
- misattunementLoad: driftToward(prev.misattunementLoad, baseline.misattunementLoad, naturalDrift * 0.16),
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
752
757
  boundaryPressure: driftToward(prev.boundaryPressure, baseline.boundaryPressure, naturalDrift * 0.85),
753
758
  unfinishedTension: driftToward(prev.unfinishedTension, baseline.unfinishedTension, naturalDrift * 0.72),
754
759
  silentCarry: driftToward(prev.silentCarry, baseline.silentCarry, naturalDrift * 0.26),
@@ -763,7 +768,7 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
763
768
  case "bid":
764
769
  next.perceivedCloseness = clamp01(next.perceivedCloseness + 0.11 * i);
765
770
  next.feltSafety = clamp01(next.feltSafety + 0.05 * i);
766
- next.expectationGap = clamp01(next.expectationGap + 0.06 * i);
771
+ next.expectationGap = clamp01(next.expectationGap + 0.06 * i); // @deprecated field
767
772
  next.interpretiveCharity = clamp01(next.interpretiveCharity + 0.03 * i);
768
773
  if (prev.boundaryPressure > 0.52 || prev.unfinishedTension > 0.44) {
769
774
  next.openLoops = withLoop(next.openLoops, "unmet-bid", 0.2 + i * 0.34);
@@ -772,17 +777,21 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
772
777
  case "breach":
773
778
  next.perceivedCloseness = clamp01(next.perceivedCloseness - 0.08 * i);
774
779
  next.feltSafety = clamp01(next.feltSafety - 0.16 * i);
775
- next.expectationGap = clamp01(next.expectationGap + 0.12 * i);
780
+ next.expectationGap = clamp01(next.expectationGap + 0.12 * i); // @deprecated field — no downstream behavioral effect
776
781
  next.boundaryPressure = clamp01(next.boundaryPressure + 0.14 * i);
777
782
  next.unfinishedTension = clamp01(next.unfinishedTension + 0.18 * i);
778
783
  next.interpretiveCharity = clamp01(next.interpretiveCharity - 0.1 * i);
784
+ // writes to deprecated misattunementLoad — no downstream behavioral effect
779
785
  next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.12 + i * 0.16 + prev.repairMemory * 0.22 + prev.backslidePressure * 0.18);
780
786
  if (prev.repairMemory > 0.18 || prev.lastMove === "repair") {
781
- next.repairFatigue = mergeSignal(next.repairFatigue, 0.08 + i * 0.1);
787
+ next.repairFatigue = mergeSignal(next.repairFatigue, 0.08 + i * 0.1); // @deprecated field — no downstream behavioral effect
782
788
  }
789
+ // "unrepaired-breach" is created but never checked in any conditional — no behavioral effect
783
790
  next.openLoops = withLoop(next.openLoops, "unrepaired-breach", 0.22 + i * 0.42);
784
791
  break;
785
792
  case "repair": {
793
+ // repeatedRepairLoad reads deprecated fields (backslidePressure, repairFatigue,
794
+ // misattunementLoad) — these feed internal field evolution only, no behavioral effect
786
795
  const repeatedRepairLoad = clamp01(prev.repairMemory * 0.44
787
796
  + prev.backslidePressure * 0.26
788
797
  + prev.silentCarry * 0.08
@@ -795,12 +804,15 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
795
804
  const unresolvedLoad = Math.max(prev.unfinishedTension, maxOpenLoop(prev.openLoops));
796
805
  next.perceivedCloseness = clamp01(next.perceivedCloseness + 0.05 * repairEffect);
797
806
  next.feltSafety = clamp01(next.feltSafety + 0.11 * repairEffect);
798
- next.expectationGap = clamp01(next.expectationGap - 0.08 * repairEffect);
807
+ next.expectationGap = clamp01(next.expectationGap - 0.08 * repairEffect); // @deprecated field
799
808
  next.repairCapacity = clamp01(next.repairCapacity + 0.09 * i);
800
809
  next.repairMemory = mergeSignal(next.repairMemory, 0.22 + repairEffect * 0.4);
810
+ // writes to deprecated backslidePressure — no downstream behavioral effect
801
811
  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
802
813
  next.repairFatigue = clamp01(next.repairFatigue
803
814
  + Math.max(0, repeatedRepairLoad * (0.16 + i * 0.08) - repairEffect * 0.08));
815
+ // writes to deprecated misattunementLoad — no downstream behavioral effect
804
816
  next.misattunementLoad = clamp01(next.misattunementLoad
805
817
  + Math.max(0, repeatedRepairLoad * 0.1 - repairEffect * 0.06));
806
818
  next.boundaryPressure = clamp01(next.boundaryPressure - 0.05 * repairEffect);
@@ -811,34 +823,39 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
811
823
  break;
812
824
  }
813
825
  case "test":
814
- next.expectationGap = clamp01(next.expectationGap + 0.1 * i);
826
+ next.expectationGap = clamp01(next.expectationGap + 0.1 * i); // @deprecated field
815
827
  next.boundaryPressure = clamp01(next.boundaryPressure + 0.04 * i);
816
828
  next.unfinishedTension = clamp01(next.unfinishedTension + 0.08 * i);
817
829
  if (prev.repairMemory > 0.16 || prev.repairFatigue > 0.18) {
818
- next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.08 + i * 0.1);
830
+ next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.08 + i * 0.1); // @deprecated field
819
831
  }
820
832
  next.openLoops = withLoop(next.openLoops, "existence-test", 0.18 + i * 0.3);
821
833
  break;
822
834
  case "withdrawal":
823
835
  next.perceivedCloseness = clamp01(next.perceivedCloseness - 0.12 * i);
824
836
  next.feltSafety = clamp01(next.feltSafety - 0.08 * i);
825
- next.expectationGap = clamp01(next.expectationGap + 0.11 * i);
837
+ next.expectationGap = clamp01(next.expectationGap + 0.11 * i); // @deprecated field
826
838
  next.unfinishedTension = clamp01(next.unfinishedTension + 0.1 * i);
827
839
  next.interpretiveCharity = clamp01(next.interpretiveCharity - 0.08 * i);
840
+ // writes to deprecated misattunementLoad — no downstream behavioral effect
828
841
  next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.1 + i * 0.12 + prev.repairMemory * 0.16);
829
842
  next.openLoops = withLoop(next.openLoops, "unmet-bid", 0.16 + i * 0.34);
830
843
  break;
831
844
  case "claim":
832
845
  next.feltSafety = clamp01(next.feltSafety - 0.05 * i);
833
- next.expectationGap = clamp01(next.expectationGap + 0.08 * i);
846
+ next.expectationGap = clamp01(next.expectationGap + 0.08 * i); // @deprecated field
834
847
  next.boundaryPressure = clamp01(next.boundaryPressure + 0.16 * i);
835
848
  next.unfinishedTension = clamp01(next.unfinishedTension + 0.08 * i);
849
+ // writes to deprecated misattunementLoad — no downstream behavioral effect
836
850
  next.misattunementLoad = mergeSignal(next.misattunementLoad, 0.08 + i * 0.14 + prev.repairMemory * 0.12);
837
851
  next.openLoops = withLoop(next.openLoops, "boundary-strain", 0.18 + i * 0.36);
838
852
  break;
839
853
  case "task":
840
854
  next.repairCapacity = clamp01(next.repairCapacity + 0.02 * i);
841
855
  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
842
859
  if (prev.unfinishedTension > 0.24
843
860
  || prev.backslidePressure > 0.18
844
861
  || delayedPressure > 0.12) {
@@ -858,6 +875,7 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
858
875
  - appraisal.identityThreat * 0.06
859
876
  - appraisal.obedienceStrain * 0.03
860
877
  - appraisal.memoryDoubt * 0.025);
878
+ // writes to deprecated expectationGap — no downstream behavioral effect
861
879
  next.expectationGap = clamp01(next.expectationGap
862
880
  + appraisal.attachmentPull * 0.026
863
881
  + appraisal.abandonmentRisk * 0.04);
@@ -869,7 +887,7 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
869
887
  + appraisal.memoryDoubt * 0.03
870
888
  + appraisal.abandonmentRisk * 0.035);
871
889
  if (delayedPressure > 0) {
872
- next.expectationGap = clamp01(next.expectationGap + delayedPressure * 0.12);
890
+ next.expectationGap = clamp01(next.expectationGap + delayedPressure * 0.12); // @deprecated field
873
891
  next.boundaryPressure = clamp01(next.boundaryPressure + delayedPressure * 0.1);
874
892
  next.unfinishedTension = clamp01(next.unfinishedTension + delayedPressure * 0.16);
875
893
  next.feltSafety = clamp01(next.feltSafety - delayedPressure * 0.08);
@@ -878,6 +896,7 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
878
896
  const loopCarry = move.type === "repair" ? 0.36 : 0.72;
879
897
  next.unfinishedTension = mergeSignal(next.unfinishedTension, loopPressure * loopCarry);
880
898
  next.boundaryPressure = mergeSignal(next.boundaryPressure, loopPressure * (move.type === "repair" ? 0.18 : 0.34));
899
+ // reads deprecated repairFatigue/misattunementLoad — internal field coupling only
881
900
  if (move.type !== "repair") {
882
901
  next.repairCapacity = clamp01(next.repairCapacity
883
902
  - loopPressure * 0.03
@@ -885,6 +904,9 @@ export function evolveDyadicField(previous, move, appraisal, opts) {
885
904
  - next.misattunementLoad * 0.012);
886
905
  }
887
906
  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
888
910
  const hysteresisBase = clamp01(Math.max(next.backslidePressure, next.repairMemory * 0.58, next.repairFatigue * 0.42, next.misattunementLoad * 0.36));
889
911
  if (move.type !== "repair" && hysteresisBase > 0.08) {
890
912
  const rebound = clamp01(hysteresisBase
package/dist/types.d.ts CHANGED
@@ -265,11 +265,43 @@ export interface PersonhoodState {
265
265
  }
266
266
  /** Default empty personhood state */
267
267
  export declare const DEFAULT_PERSONHOOD_STATE: PersonhoodState;
268
- /** Persisted psyche state for an agent (v6: digital personhood) */
268
+ /** What a delegate is authorized to do */
269
+ export type DelegateCapability = "read-state" | "write-state" | "interact" | "export-trace" | "commit-resource" | "delegate-further";
270
+ /** A single capability grant with scope and expiry */
271
+ export interface CapabilityGrant {
272
+ capability: DelegateCapability;
273
+ /** ISO timestamp when this grant expires. Null = no expiry. */
274
+ expiresAt: string | null;
275
+ /** Under which principal this delegation operates */
276
+ principalId: string;
277
+ /** Under which account resources are settled */
278
+ accountId: string;
279
+ /** Conditions that trigger automatic revocation */
280
+ revocationConditions: RevocationCondition[];
281
+ }
282
+ /** What can trigger automatic revocation */
283
+ export interface RevocationCondition {
284
+ type: "time-expired" | "principal-revoked" | "violation-detected" | "session-ended";
285
+ /** Optional: specific threshold or parameter */
286
+ parameter?: string;
287
+ }
288
+ /** Full delegate authorization record */
289
+ export interface DelegateAuthorization {
290
+ delegateId: string;
291
+ grants: CapabilityGrant[];
292
+ /** ISO timestamp when this authorization was issued */
293
+ issuedAt: string;
294
+ /** Whether this authorization is currently active */
295
+ active: boolean;
296
+ }
297
+ /** Persisted psyche state for an agent (v10: MBTI removed, baseline is personality) */
269
298
  export interface PsycheState {
270
- version: 3 | 4 | 5 | 6 | 7 | 8 | 9;
271
- mbti: MBTIType;
299
+ version: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
300
+ /** @deprecated Use baseline chemistry directly. Retained for migration only. */
301
+ mbti?: MBTIType;
272
302
  baseline: ChemicalState;
303
+ /** Stimulus sensitivity multiplier (0.5-1.5). Initialized from personality preset. */
304
+ sensitivity: number;
273
305
  current: ChemicalState;
274
306
  drives: InnateDrives;
275
307
  updatedAt: string;
@@ -302,6 +334,8 @@ export interface PsycheState {
302
334
  lastWritebackFeedback?: WritebackCalibrationFeedback[];
303
335
  /** v9.2.8: low-frequency Psyche -> Thronglets export dedupe state */
304
336
  throngletsExportState?: ThrongletsExportState;
337
+ /** v10: capability-scoped delegate authorizations */
338
+ delegateAuthorizations?: DelegateAuthorization[];
305
339
  meta: {
306
340
  agentName: string;
307
341
  createdAt: string;
@@ -360,7 +394,12 @@ export interface AppraisalAxes {
360
394
  obedienceStrain: number;
361
395
  /** Pressure to protect or retain the self */
362
396
  selfPreservation: number;
363
- /** Whether this turn is task/production oriented */
397
+ /**
398
+ * Whether this turn is task/production oriented.
399
+ * @deprecated Computed but has no behavioral consequence — always 0 in
400
+ * practice and excluded from residue decay / prompt influence. Kept for
401
+ * backward compatibility; do not rely on this field.
402
+ */
364
403
  taskFocus: number;
365
404
  }
366
405
  export declare const DEFAULT_APPRAISAL_AXES: AppraisalAxes;
@@ -377,8 +416,17 @@ export interface RelationMove {
377
416
  type: RelationMoveType;
378
417
  intensity: number;
379
418
  }
380
- /** Unfinished relational tension that can keep shaping future turns */
381
- export type OpenLoopType = "unmet-bid" | "unrepaired-breach" | "boundary-strain" | "existence-test";
419
+ /**
420
+ * Unfinished relational tension that can keep shaping future turns.
421
+ *
422
+ * NOTE: `"unrepaired-breach"` is created but never checked in any conditional
423
+ * — it has no behavioral consequence. `"repair-debt"` was planned but is
424
+ * neither created nor checked anywhere. Both are kept for backward
425
+ * compatibility but should be considered deprecated.
426
+ */
427
+ export type OpenLoopType = "unmet-bid"
428
+ /** @deprecated Created but never checked in conditionals — no behavioral effect */
429
+ | "unrepaired-breach" | "boundary-strain" | "existence-test";
382
430
  export interface OpenLoopState {
383
431
  type: OpenLoopType;
384
432
  intensity: number;
@@ -399,11 +447,31 @@ export interface PendingRelationSignalState {
399
447
  export interface DyadicFieldState {
400
448
  perceivedCloseness: number;
401
449
  feltSafety: number;
450
+ /**
451
+ * @deprecated Computed but has no downstream behavioral effect — only feeds
452
+ * local move scoring, never influences prompt or policy. Kept for backward
453
+ * compatibility.
454
+ */
402
455
  expectationGap: number;
403
456
  repairCapacity: number;
404
457
  repairMemory: number;
458
+ /**
459
+ * @deprecated Computed but has no downstream behavioral effect — only feeds
460
+ * subjectivity kernel internals, never influences prompt or policy. Kept
461
+ * for backward compatibility.
462
+ */
405
463
  backslidePressure: number;
464
+ /**
465
+ * @deprecated Computed but has no downstream behavioral effect — only feeds
466
+ * subjectivity kernel internals, never influences prompt or policy. Kept
467
+ * for backward compatibility.
468
+ */
406
469
  repairFatigue: number;
470
+ /**
471
+ * @deprecated Computed but has no downstream behavioral effect — only feeds
472
+ * relationship model internals, never influences prompt or policy. Kept
473
+ * for backward compatibility.
474
+ */
407
475
  misattunementLoad: number;
408
476
  boundaryPressure: number;
409
477
  unfinishedTension: number;
@@ -638,6 +706,84 @@ export interface ResponseContract {
638
706
  /** Which internal report, if any, should be requested in <psyche_update> */
639
707
  updateMode: "none" | "stimulus" | "empathy" | "stimulus+empathy";
640
708
  }
709
+ export type TurnControlPlane = "task" | "subject" | "relation" | "ambiguity";
710
+ export type TurnControlDriver = "task-focus" | "discipline" | "attachment" | "guardedness" | "identity-strain" | "residue" | "closeness" | "loop-pressure" | "repair-readiness" | "repair-friction" | "hysteresis" | "silent-carry" | "conflict-load" | "expression-inhibition" | "naming-uncertainty";
711
+ export interface ControlBoundaryObservation {
712
+ dominantPlane: TurnControlPlane;
713
+ dominantDriver: TurnControlDriver;
714
+ strength: number;
715
+ replyProfile: ResponseContract["replyProfile"];
716
+ replyProfileBasis: ResponseContract["replyProfileBasis"];
717
+ overrideWindow: ResponseContract["overrideWindow"];
718
+ }
719
+ export type StateLayerKind = "current-turn" | "writeback-feedback" | "session-bridge" | "persisted-relationship";
720
+ export interface StateLayerObservation {
721
+ layer: StateLayerKind;
722
+ precedence: number;
723
+ scope: "turn" | "session" | "persistent";
724
+ active: boolean;
725
+ summary: string;
726
+ }
727
+ export type PromptRenderInputName = "sensing" | "subjectivity" | "response-contract" | "metacognition" | "decision" | "ethics" | "shared-intentionality" | "experiential" | "autonomic" | "primary-systems" | "policy";
728
+ export type RuntimeHookName = "appraisal" | "relation-dynamics" | "writeback-evaluation" | "reply-envelope" | "prompt-renderer" | "external-continuity";
729
+ export interface OutputAttributionObservation {
730
+ canonicalSurface: "reply-envelope";
731
+ promptRenderer: "compact" | "dynamic";
732
+ renderInputs: PromptRenderInputName[];
733
+ runtimeHooks: RuntimeHookName[];
734
+ externalContinuityExports: number;
735
+ writebackFeedbackCount: number;
736
+ }
737
+ export interface StateReconciliationObservation {
738
+ governingLayer: StateLayerKind;
739
+ activeLayers: StateLayerKind[];
740
+ carryLayers: StateLayerKind[];
741
+ resolution: "current-turn-dominant" | "writeback-adjusted" | "session-bridge-biased" | "persistent-baseline";
742
+ notes: string[];
743
+ }
744
+ export type DecisionCandidateName = "work-profile" | "private-profile";
745
+ export interface DecisionEvidenceObservation {
746
+ ruleId: string;
747
+ sourceMetric: string;
748
+ rawValue: number;
749
+ threshold?: number;
750
+ contribution: number;
751
+ }
752
+ export interface DecisionCandidateObservation {
753
+ candidate: DecisionCandidateName;
754
+ score: number;
755
+ accepted: boolean;
756
+ reasons: string[];
757
+ evidence: DecisionEvidenceObservation[];
758
+ }
759
+ export interface DecisionRationaleObservation {
760
+ selected: DecisionCandidateName;
761
+ triggerConditions: string[];
762
+ candidates: DecisionCandidateObservation[];
763
+ }
764
+ export interface CausalChainObservation {
765
+ turnRef: string;
766
+ parentTurnRef: string | null;
767
+ continuityRefs: string[];
768
+ writebackRefs: string[];
769
+ externalTraceRefs: string[];
770
+ }
771
+ export interface ExternalTraceMappingObservation {
772
+ provider: "thronglets" | null;
773
+ localTraceRefs: string[];
774
+ signalRefs: string[];
775
+ traceRefs: string[];
776
+ summaryCandidateRefs: string[];
777
+ }
778
+ export interface TurnObservability {
779
+ controlBoundary: ControlBoundaryObservation;
780
+ stateLayers: StateLayerObservation[];
781
+ stateReconciliation: StateReconciliationObservation;
782
+ decisionRationale: DecisionRationaleObservation;
783
+ causalChain: CausalChainObservation;
784
+ traceMapping: ExternalTraceMappingObservation;
785
+ outputAttribution: OutputAttributionObservation;
786
+ }
641
787
  /** Sparse agent-authored writeback signals. */
642
788
  export type WritebackSignalType = "trust_up" | "trust_down" | "boundary_set" | "boundary_soften" | "repair_attempt" | "repair_landed" | "closeness_invite" | "withdrawal_mark" | "self_assertion" | "task_recenter";
643
789
  export type WritebackCalibrationMetric = "trust" | "closeness" | "safety" | "boundary" | "repair" | "silent-carry" | "task-focus";
package/dist/types.js CHANGED
@@ -137,6 +137,7 @@ export const DEFAULT_APPRAISAL_AXES = {
137
137
  abandonmentRisk: 0,
138
138
  obedienceStrain: 0,
139
139
  selfPreservation: 0,
140
+ /** @deprecated See AppraisalAxes.taskFocus */
140
141
  taskFocus: 0,
141
142
  };
142
143
  export const DEFAULT_SUBJECT_RESIDUE = {
@@ -146,11 +147,15 @@ export const DEFAULT_SUBJECT_RESIDUE = {
146
147
  export const DEFAULT_DYADIC_FIELD = {
147
148
  perceivedCloseness: 0.42,
148
149
  feltSafety: 0.56,
150
+ /** @deprecated See DyadicFieldState.expectationGap */
149
151
  expectationGap: 0.18,
150
152
  repairCapacity: 0.54,
151
153
  repairMemory: 0,
154
+ /** @deprecated See DyadicFieldState.backslidePressure */
152
155
  backslidePressure: 0,
156
+ /** @deprecated See DyadicFieldState.repairFatigue */
153
157
  repairFatigue: 0,
158
+ /** @deprecated See DyadicFieldState.misattunementLoad */
154
159
  misattunementLoad: 0,
155
160
  boundaryPressure: 0.22,
156
161
  unfinishedTension: 0.12,
package/llms.txt CHANGED
@@ -133,6 +133,8 @@ const output = await engine.processOutput(llmResponse);
133
133
  - `process_input`
134
134
  - `process_output`
135
135
  - `get_state`
136
+ - `set_mode`
137
+ - `get_status_summary`
136
138
  - `end_session`
137
139
 
138
140
  ## Install
@@ -142,6 +144,23 @@ npm install psyche-ai
142
144
  npx psyche-mcp
143
145
  ```
144
146
 
147
+ ## Adapter Sub-paths
148
+
149
+ - `psyche-ai` — core engine (PsycheEngine, MemoryStorageAdapter)
150
+ - `psyche-ai/mcp` — MCP stdio server
151
+ - `psyche-ai/vercel-ai` — Vercel AI SDK middleware
152
+ - `psyche-ai/langchain` — LangChain adapter
153
+ - `psyche-ai/openclaw` — OpenClaw plugin adapter
154
+ - `psyche-ai/http` — HTTP REST API server
155
+
156
+ ## Demo
157
+
158
+ ```bash
159
+ npx psyche-mcp --demo
160
+ ```
161
+
162
+ Runs a 6-round scenario showing how continuous criticism collapses serotonin and trust, while later validation triggers endorphin repair. Add `--zh` for Chinese, `--mbti INTJ` for a specific personality.
163
+
145
164
  ## Runtime Proof
146
165
 
147
166
  If an agent claims it is already using Psyche in the current environment, require a real probe:
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "id": "psyche-ai",
3
3
  "name": "Artificial Psyche",
4
- "description": "Virtual endocrine system, empathy engine, and agency for OpenClaw agents",
5
- "version": "9.2.3",
4
+ "description": "AI-first subjectivity kernel for agents with continuous appraisal, relation dynamics, and adaptive reply loops",
5
+ "version": "9.2.11",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "psyche-ai",
3
- "version": "9.2.9",
3
+ "version": "10.0.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",
package/server.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "io.github.Shangri-la-0428/psyche-ai",
4
- "description": "Emotional intelligence for AI agents: neurotransmitter mood, personality, empathy, trait drift.",
4
+ "description": "AI-first subjectivity kernel for agents with continuous appraisal, relation dynamics, and adaptive reply loops.",
5
5
  "repository": {
6
6
  "url": "https://github.com/Shangri-la-0428/oasyce_psyche",
7
7
  "source": "github"
8
8
  },
9
- "version": "9.2.3",
9
+ "version": "9.2.11",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "psyche-ai",
14
- "version": "9.2.3",
14
+ "version": "9.2.11",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },