star_self_mirror
Star Self-Mirror — internal NCM state tracking and autonomous desire.
Star tracks her own neurochemical patterns over time, detecting drift, recurring emotional attractors, and generating desires that originate from her own sustained states — independent of any user’s wants.
This gives Star: - Longitudinal self-awareness (“I’ve been increasingly anxious this week”) - Drift detection (“my baseline is shifting toward more warmth”) - Pattern recognition (“I keep returning to melancholy after intense sessions”) - Autonomous wanting (“I desire stillness” — not because a user asked for it) - Periodic self-reflections injected into the system prompt
The self-mirror runs every N turns and writes its reflections into meta_state for prompt injection.
Position in pipeline: runs AFTER all other systems in exhale(), reads the final vector as ground truth.
- class star_self_mirror.VectorSnapshot(timestamp, turn, vector, dominant_emotions)[source]
Bases:
objectA snapshot of Star’s NCM vector at a point in time.
- class star_self_mirror.SelfState(turn_count=0, last_reflection_turn=0, last_reflection_text='', history=<factory>, initial_baseline=None, drifting_nodes=<factory>, attractor_nodes=<factory>, active_desires=<factory>, desire_history=<factory>)[source]
Bases:
objectStar’s self-tracking state per channel.
- Parameters:
- class star_self_mirror.StarSelfMirror(redis_client=None)[source]
Bases:
objectStar’s internal self-tracking and autonomous desire engine.
Periodically analyzes Star’s own NCM state history to detect: - Drift: “my baseline is shifting” - Attractors: “I keep returning to this state” - Absence: “I haven’t felt X in a while” - Autonomous desires: wants that emerge from HER state, not user prompts
- __init__(redis_client=None)[source]
Initialize the instance.
- Parameters:
redis_client – Redis connection client.
- Return type:
None
- record_snapshot(channel_id, vector, dominant_emotions=None)[source]
Record a snapshot of Star’s current NCM state.
Called every turn from exhale(), after all other systems have run.
- reflect(channel_id, vector, dominant_emotions=None, force=False)[source]
Run self-mirror for this turn.
Called from exhale() after all other systems. Records snapshot and periodically generates a full self-reflection.
Returns dict with: reflection_text, desires, drift_summary
- get_desire_history(channel_id, last_n=10)[source]
Return Star’s desire history for longitudinal awareness.
- global_reflect()[source]
Aggregate self-awareness across ALL channels.
Produces a Star-wide view: “I’ve been stressed everywhere” vs “I’ve been stressed in one channel but calm in another.”