fabricatio_character.models.mental
Mental model data models for dynamic character psychological state.
Complete psychological state model covering: - BigFiveProfile: 5-dimensional personality (Costa & McCrae, 1992) - CognitiveDistortion: CBT distortion tendency weights (Beck, 1976) - SomaticState: embodied perception (EFT-CoT, Du et al., 2026) - QualitativeSuffering: irreversible trauma (Emotional Cost Functions) - LinguisticStyle: decoupled expression patterns (TTM, Zhan et al., 2025) - CharacterMind: stable identity (personality + cognition + language) - EmotionalState: volatile per-event state (emotion + body + active distortion) - NeedState: Maslow hierarchy tracking (Maslow, 1943) - MentalState: composite of all layers - EventImpact: LLM-generated impact from event analysis
Classes
Recognized emotion types. |
|
Cognitive distortion types from CBT framework. |
|
Personality trait condition flags for prompt injection. |
|
Maslow's hierarchy of needs. Higher value = higher need. |
|
Big Five personality dimension names. |
|
DIAMONDS situational dimensions (Rauthmann et al., 2014). |
|
8-dimensional situational classification per event. |
|
Big Five personality traits. Each dimension 0-100. |
|
CBT cognitive distortion tendency weights for a character. |
|
Decoupled language expression patterns. Extracted from character dialogues. |
|
Heart rate states. |
|
Breathing patterns. |
|
Muscle tension levels. |
|
Facial expression states. |
|
Voice quality states. |
|
Body sensations derived from emotion type and intensity. |
|
Irreversible trauma that permanently reshapes character. |
|
Stable psychological identity. Seeded once from CharacterCard, drifts slowly. |
|
Volatile per-event emotional and physical state. |
|
Maslow need hierarchy tracking. Accumulated over time. |
|
Complete psychological state. All theories represented. |
|
LLM-generated impact from event analysis. |
|
CBT distortion analysis output — used by LLM distortion judgment path. |
|
Typed context for event analysis template rendering. |
|
Suffering entry for template rendering. |
|
Typed data for system prompt template rendering. |
Module Contents
- class fabricatio_character.models.mental.Emotion
Bases:
enum.StrEnumRecognized emotion types.
- NEUTRAL
- FEAR
- ANXIETY
- ANGER
- RAGE
- SADNESS
- GRIEF
- JOY
- HAPPINESS
- DISGUST
- CONTEMPT
- class fabricatio_character.models.mental.Distortion
Bases:
enum.StrEnumCognitive distortion types from CBT framework.
- CATASTROPHIZING
- BLACK_AND_WHITE
- PERSONALIZATION
- EMOTIONAL_REASONING
- SHOULD_THINKING
- class fabricatio_character.models.mental.PersonalityFlag
Bases:
enum.StrEnumPersonality trait condition flags for prompt injection.
- HIGH_NEUROTICISM
- LOW_AGREEABLENESS
- HIGH_EXTRAVERSION
- LOW_EXTRAVERSION
- HIGH_CONSCIENTIOUSNESS
- HIGH_OPENNESS
- class fabricatio_character.models.mental.MaslowLevel
Bases:
enum.IntEnumMaslow’s hierarchy of needs. Higher value = higher need.
- PHYSIOLOGICAL
- SAFETY
- BELONGING
- ESTEEM
- SELF_ACTUALIZATION
- class fabricatio_character.models.mental.BigFiveDimension
Bases:
enum.StrEnumBig Five personality dimension names.
- OPENNESS
- CONSCIENTIOUSNESS
- EXTRAVERSION
- AGREEABLENESS
- NEUROTICISM
- class fabricatio_character.models.mental.SituationDimension
Bases:
enum.StrEnumDIAMONDS situational dimensions (Rauthmann et al., 2014).
- DUTY
- INTELLECT
- ADVERSITY
- MATING
- POSITIVITY
- NEGATIVITY
- DECEPTION
- SOCIALITY
- class fabricatio_character.models.mental.SituationProfile(/, **data: Any)
Bases:
fabricatio_core.models.generic.ProposedAble8-dimensional situational classification per event.
Each dimension scored 0.0-1.0 by LLM extraction.
- top_dimension() SituationDimension
- class fabricatio_character.models.mental.BigFiveProfile(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseBig Five personality traits. Each dimension 0-100.
- distance_to(other: BigFiveProfile) float
Euclidean distance between two personality profiles.
- personality_flag(flag: PersonalityFlag) bool
Check a personality condition flag against this profile.
- class fabricatio_character.models.mental.CognitiveDistortion(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseCBT cognitive distortion tendency weights for a character.
- top(n: int = 1) list[Distortion]
Return top-N most likely distortion types.
- rule_filter(situation: SituationProfile) dict[str, float]
Compute distortion scores boosted by DIAMONDS situational dimensions.
Base = character tendency weight. Boost = dim_score * boost_value from config. Returns dict with Distortion enum value strings as keys.
- class fabricatio_character.models.mental.LinguisticStyle(/, **data: Any)
Bases:
fabricatio_core.models.generic.ProposedAbleDecoupled language expression patterns. Extracted from character dialogues.
- class fabricatio_character.models.mental.HeartRate
Bases:
enum.StrEnumHeart rate states.
- NORMAL
- ELEVATED
- RACING
- class fabricatio_character.models.mental.Breathing
Bases:
enum.StrEnumBreathing patterns.
- NORMAL
- SLOW
- SHALLOW
- RAPID
- class fabricatio_character.models.mental.MuscleTension
Bases:
enum.StrEnumMuscle tension levels.
- RELAXED
- TENSE
- RIGID
- TREMBLING
- class fabricatio_character.models.mental.FacialExpression
Bases:
enum.StrEnumFacial expression states.
- NEUTRAL
- FROWN
- WIDE_EYES
- BLUSH
- class fabricatio_character.models.mental.VoiceQuality
Bases:
enum.StrEnumVoice quality states.
- STEADY
- TREMBLING
- FAST
- QUIET
- class fabricatio_character.models.mental.SomaticState(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseBody sensations derived from emotion type and intensity.
- muscle_tension: MuscleTension
Muscle tension level.
- facial_expression: FacialExpression
Facial expression.
- voice: VoiceQuality
Voice quality.
- classmethod from_emotion(emotion: Emotion, intensity: float) SomaticState
Create SomaticState from emotion type and intensity via config mapping.
- class fabricatio_character.models.mental.QualitativeSuffering(/, **data: Any)
Bases:
fabricatio_core.models.generic.ProposedAbleIrreversible trauma that permanently reshapes character.
- class fabricatio_character.models.mental.CharacterMind(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseStable psychological identity. Seeded once from CharacterCard, drifts slowly.
Contains personality, cognitive tendencies, and linguistic style. Changes only through slow drift over many events.
- personality: BigFiveProfile = None
Stable personality traits.
- cognitive_tendencies: CognitiveDistortion = None
Character’s cognitive distortion tendency weights.
- linguistic_style: LinguisticStyle = None
Decoupled language expression patterns.
- class fabricatio_character.models.mental.EmotionalState(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseVolatile per-event emotional and physical state.
Replaced (not mutated) every event. Contains the current emotion, its physical manifestation, and which cognitive distortion is active.
- somatic: SomaticState = None
Current body sensations.
- active_distortion: Distortion | None = None
Currently activated cognitive distortion (per-event, volatile).
- latest_situation: SituationProfile | None = None
DIAMONDS profile from the latest event (volatile, for prompt injection).
- class fabricatio_character.models.mental.NeedState(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseMaslow need hierarchy tracking. Accumulated over time.
- current_level: MaslowLevel
Current dominant need level.
- satisfied: List[MaslowLevel] = None
Already satisfied need levels.
- counters: dict[MaslowLevel, int] = None
Accumulated satisfaction events per level.
- class fabricatio_character.models.mental.MentalState(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseComplete psychological state. All theories represented.
Three layers: - mind: stable identity (personality, cognition, language) - emotion: volatile per-event state (emotion, body, active distortion) - needs: accumulated Maslow hierarchy Plus sufferings (permanent trauma history).
- mind: CharacterMind
Stable psychological identity.
- emotion: EmotionalState = None
Volatile per-event emotional state.
- sufferings: List[QualitativeSuffering] = None
Accumulated irreversible traumas.
- classmethod from_card(card: fabricatio_character.models.character.CharacterCard) MentalState
Seed MentalState from a CharacterCard with minimal defaults.
Sets character name and default values. For intelligent seeding with LLM-driven need/distortion classification, use UseMind.seed_from().
- drop_level(threatened: MaslowLevel) MentalState
Drop to or below the threatened need level.
- accumulate_satisfaction(fulfilled: MaslowLevel) MentalState
Accumulate satisfaction count; rise level when threshold met.
- class fabricatio_character.models.mental.EventImpact(/, **data: Any)
Bases:
fabricatio_core.models.generic.ProposedAbleLLM-generated impact from event analysis.
Contains all fields the LLM determines: emotion, personality drift, distortion activation, and need transitions.
- personality_shift: dict[BigFiveDimension, float] = None
5.0}).
- Type:
BigFive dimension deltas (e.g. {BigFiveDimension.NEUROTICISM
- triggers_distortion: Distortion | None = None
Triggered cognitive distortion type.
- threatens_need: MaslowLevel | None = None
Need level threatened by the event.
- fulfills_need: MaslowLevel | None = None
Need level fulfilled by the event.
- created_suffering: QualitativeSuffering | None = None
Suffering created from high-intensity emotional events.
- situation: SituationProfile | None = None
DIAMONDS situation profile from event analysis.
- class fabricatio_character.models.mental.DistortionAnalysis(/, **data: Any)
Bases:
fabricatio_core.models.generic.ProposedAbleCBT distortion analysis output — used by LLM distortion judgment path.
- triggered_distortion: Distortion | None = None
- class fabricatio_character.models.mental.EventContext(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseTyped context for event analysis template rendering.
- current_need: MaslowLevel
Current MaslowLevel.
- class fabricatio_character.models.mental.SufferingSummary(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseSuffering entry for template rendering.
- class fabricatio_character.models.mental.AsPromptData(/, **data: Any)
Bases:
fabricatio_core.models.generic.BaseTyped data for system prompt template rendering.
- sufferings: list[SufferingSummary] = None