flash_dyadic_mirrorο
Flash Dyadic Mirror β LLM-driven contextual behavioral analysis.
Replaces mechanical keyword flagging as the PRIMARY source of ULM delta signals. Uses gemini-3.1-flash-lite via the local Gemini CLI proxy for near-unlimited, high-frequency per-turn evaluation.
Evaluates a rolling 5-turn context window instead of individual messages, giving Star contextual awareness of behavioral CHANGE over time β not just keyword surface area.
# ππ₯ THE EYES THAT ACTUALLY SEE. βΎοΈ
- class flash_dyadic_mirror.DyadicNote(timestamp, note, vectors_evaluated, plan_progress='', turn_index=0)[source]ο
Bases:
objectA single timestamped behavioral observation produced by a Flash evaluation.
A lightweight record of one note Flash-Lite wrote about a behavioral shift, along with the metadata needed by the downstream 6-hour meta-evaluator: which ULM vectors were in play, how an active ops-plan step is progressing, and where in the rolling window it occurred. It is a plain data carrier with no behavior; the equivalent payload is what
FlashDyadicMirror._persist_notes()actually serializes into thedyadic:notes:{user_id}Redis ZSET.This class is defined for clarity/typing of the note shape and is not directly instantiated elsewhere in the repo (the persistence path builds plain dicts).
- Parameters:
- class flash_dyadic_mirror.FlashEvalResult(deltas, notes, plan_progress='', raw_response='', timestamp=0.0)[source]ο
Bases:
objectThe parsed outcome of one Flash-Lite dyadic evaluation.
Bundles everything
FlashDyadicMirror.evaluate()returns for a turn: the per-dimension ULM deltas Flash suggested, its short behavioral notes, an optional plan-progress label, and (for debugging) a truncated copy of the raw model text. Instances are cached per user in_eval_cacheto serve cooldown hits, blended into final deltas byFlashDyadicMirror.blend_deltas(), and have their notes written to Redis byFlashDyadicMirror._persist_notes(). A pure data container.Built by
FlashDyadicMirror._parse_response()from validated/clamped model output; also constructed directly intests/test_absolute_overrides.py.- Parameters:
- class flash_dyadic_mirror.FlashDyadicMirror(redis_client=None)[source]ο
Bases:
objectLLM-driven contextual behavioral analysis engine.
Replaces mechanical keyword flagging with Flash-Lite evaluation of rolling 5-turn context windows. Evaluates CHANGE in behavioral dimensions, not individual keyword hits.
Notes from each evaluation are persisted in Redis for the 6-hour meta-evaluator to synthesize.
- __init__(redis_client=None)[source]ο
Initialise the mirrorβs per-user cooldown, in-flight, and result caches.
Stores the optional async Redis client and sets up three in-memory maps keyed by
"{channel_id}:{user_id}":_last_eval(last evaluation timestamp, enforcing theEVAL_COOLDOWN_SECONDSthrottle inevaluate()),_pending(a set guarding against double-firing a Flash call for the same user), and_eval_cache(the most recentFlashEvalResultper user, served back during cooldown). No network or Redis I/O happens here; the Redis client is only used later by_persist_notes()to write thedyadic:notes:{user_id}ZSET, so aNoneclient simply disables note persistence.Constructed once by
LimbicCoordinatorinlimbic_system/coordinator.py(asself._flash_mirror) and directly intests/test_absolute_overrides.py.- Parameters:
redis_client β Optional async Redis client used solely for persisting evaluation notes; when
None, evaluations still run but notes are not stored.- Return type:
None
- async evaluate(channel_id, user_id, recent_turns, current_vector, plan_context='', archetype_dist=None, config=None)[source]ο
Evaluate behavioral change over rolling context window.
- Parameters:
channel_id (
str) β Channel identifier.user_id (
str) β User identifier.recent_turns (
List[Dict[str,Any]]) β List of {user_msg, star_reply, ts} dicts (last 5).current_vector (
Dict[str,float]) β Current ULM shadow vector for this user.plan_context (
str) β Current ops plan step description (if any).archetype_dist (
Optional[Dict[str,float]]) β Childhood archetype distribution dict.config (
Optional[Any]) β Option config for feature toggles.
- Return type:
- Returns:
FlashEvalResult with delta suggestions + notes, or None if evaluation was skipped (cooldown, insufficient data, error).
- blend_deltas(flash_deltas, keyword_deltas)[source]ο
Combine LLM-derived and keyword-derived ULM deltas into one weighted set.
Fuses the two delta sources that drive ULM shadow-vector updates: it takes the union of dimensions across both dicts and, for each, computes
flash * FLASH_WEIGHT + keyword * KEYWORD_WEIGHT(0.80 / 0.20), treating a missing dimension on either side as 0.0. When flash_deltas is empty orNone(Flash skipped, rate-limited, or unreachable) it short-circuits and returns keyword_deltas unchanged, so keywords effectively get full weight. Pure computation with no I/O.Called by
LimbicCoordinatorinlimbic_system/coordinator.pyright afterevaluate(), to merge the Flash result with the keyword analysis; it has no other callers in the repo.- Parameters:
- Returns:
The blended deltas, or keyword_deltas verbatim when flash_deltas is falsy.
- Return type: