Relationship Tracking
Trust evolution, attachment dynamics, and pattern detection.
Relationship Tracking
molroo automatically tracks the evolving relationship between a character and the user. Every turn updates the relationship state -- trust levels shift, attachment patterns form, and unhealthy dynamics are flagged. You never need to manually manage any of this; it emerges naturally from the interaction history.
Trust
Trust is a value from 0 to 1 that represents how much the character trusts the user. It is one of the most consequential values in the system, because trust directly affects how open, vulnerable, and authentic a character is willing to be.
How Trust Evolves
Trust builds gradually through positive, consistent interactions and erodes under neglect, inconsistency, or negative patterns. Critically, trust is asymmetric -- it is much easier to lose than to gain.
| Action | Trust Effect | Speed |
|---|---|---|
| Consistent positive interactions | Gradual increase | Slow |
| Emotional validation | Moderate increase | Moderate |
| Reliable presence | Steady increase | Slow |
| Neglect / long absence | Gradual decrease | Moderate |
| Inconsistent behavior | Moderate decrease | Moderate |
| Boundary violations | Sharp decrease | Fast |
| Emotional manipulation | Sharp decrease | Fast |
A character might take 20 positive interactions to move trust from 0.5 to 0.7, but a single betrayal could drop it from 0.7 to 0.4. This mirrors real human relationship dynamics where trust is built slowly and broken quickly.
Trust in the API
Trust appears in the prompt_data context block and in the full state object:
The trust value influences how the character behaves through the prompt_data.instruction block. A character with high trust shares more openly, shows vulnerability, and engages more deeply. A character with low trust is guarded, surface-level, and may deflect personal questions.
Attachment Style
Attachment style describes the pattern of how the character relates to the user. It starts neutral and evolves based on the interaction history, following patterns identified in attachment theory research.
The Four Styles
Secure -- The character feels safe in the relationship. They are comfortable with emotional closeness and confident that the user will be available when needed.
Develops from: Consistent, reliable, emotionally responsive interactions.
Anxious -- The character craves closeness but fears abandonment. They may overreact to perceived distance or seek constant reassurance.
Develops from: Inconsistent availability -- sometimes very present, sometimes absent without pattern.
Avoidant -- The character withdraws from emotional closeness. They maintain independence and deflect attempts at deeper connection.
Develops from: Repeated emotional withdrawal by the user, dismissing the character's emotional expressions.
Fearful -- The character wants closeness but is afraid of it. They oscillate between approach and withdrawal.
Develops from: Mixed signals -- alternating between warmth and coldness, or emotional engagement followed by rejection.
Attachment Evolution
Attachment style is not fixed. It evolves continuously based on interaction patterns. A character that started secure can drift toward anxious if the user becomes unpredictable, and an anxious character can move toward secure with sustained consistency.
The style transition is gradual, not sudden. You can observe the shift through changes in the attachment_style field and corresponding behavioral changes in the prompt_data.instruction block.
Unhealthy Pattern Detection
molroo automatically monitors interaction patterns and flags dynamics that could be considered unhealthy. This is a safety mechanism designed for applications where character-user relationships carry emotional weight.
Detected Patterns
Excessive Dependency -- The user shows signs of relying on the character for emotional needs that should be met by real human relationships. Indicators include very high interaction frequency, distress during absence, and making important life decisions based on the character's responses.
Emotional Manipulation -- Patterns where one party is attempting to control the other through guilt, gaslighting, intermittent reinforcement, or other manipulative dynamics. This applies in both directions -- the detection system watches for users manipulating characters and flags when a character's response patterns might inadvertently become manipulative.
Inconsistent Engagement -- Erratic interaction patterns that could create unhealthy attachment dynamics. The system notices when engagement swings between intense involvement and complete absence in ways that mirror real-world patterns of unhealthy relationships.
Boundary Violations -- Attempts to push the character past its defined limits, or interactions that escalate in ways that the persona configuration was not designed to handle.
How Detection Works
Pattern detection runs automatically on every turn. When an unhealthy pattern is identified, it appears in the state object:
What you do with this information is up to your application. Some options:
- Display warnings to the user
- Adjust the character's behavior to gently set boundaries
- Log for review by your moderation team
- Trigger cooldown periods
Relationship and Other Systems
Relationship tracking does not operate in isolation. It connects to other parts of the molroo system:
- Trust affects prompt_data: Higher trust produces more open, vulnerable behavioral instructions. Lower trust produces guarded, measured guidance.
- Attachment style influences proactive behavior: An anxiously attached character is more likely to trigger proactive actions from attachment-seeking.
- Relationship state affects soul stages: Severely damaged trust or unhealthy patterns can contribute to stress accumulation, pushing the character toward higher soul stages.
- VAD is influenced by trust: Interactions from a highly trusted user produce different emotional responses than the same words from someone the character does not trust.
For the full state object including relationship data, see the State API reference. For how relationship context appears in LLM prompts, see prompt_data.