/ core / attention / __pycache__ / aha_detection.cpython-314.pyc
aha_detection.cpython-314.pyc
  1  +
  2  )�gi�X�
  3  �l�Rt^RIHtHt^RIHt^RIHtHtHtH	t	H
  4  t
  5  ^RIHt^RI
t
!RR]4t!RR	]4t]!R
  6  R44t]!RR
44t]!RR44t!RR4t!RR4tR7RRllt]R8XEd%]!R4]!4wtt]!R4]P5R.R.RRR7t]'dK]!R]P824]!R]P:P<24]!R ]P>R!
24]!R"4]PAR#R$R%.R8OR&7t!]!'d5]!R]!P824]!R]!P:P<24]!R'4]PER(.R9OR)R*7t#]#'d5]!R]#P824]!R]#P:P<24]!R+4]!]PH!4^U^HRR,^A^7R-7t%]!R.]%PLR/
24]!R0]%PNR/
24]!R1]%PPR/
24]'d(]PS]PT]%4t+]!R2]+24]!R34]PY4F/t-]!R4]-P:P<R5]-P824K1	]!R64R#R#):u�
  7  Aha Detection Module
  8  
  9  Two types of aha moments, each with distinct phenomenology:
 10  
 11  1. DISCOVERY (weak → strong)
 12     - Surprise, expansion, "I didn't know this mattered"
 13     - Graph expands - new territory opens
 14     - Biometric: HR spike, GSR spike, pupil dilation
 15     - Example: Realizing podcast episode connects to unrelated project
 16  
 17  2. ARCHITECTURAL (strong → strong)
 18     - "Resonant clunk" - settling, clicking into place
 19     - Graph contracts - disparate parts collapse together
 20     - Biometric: HRV increase (parasympathetic), slow breath
 21     - Example: Two systems you've been building finally unified
 22  
 23  The "resonant clunk" is the sound of graph distance shrinking.
 24  Space collapsing. Things that were far apart are now adjacent.
 25  
 26  Integration with Attention:
 27  - Attention tracking shows WHERE you're looking
 28  - Aha detection shows WHEN insight crystallizes
 29  - Together: both the gaze and the moment of recognition
 30  
 31  "Attention is all you need" - the aha moment IS attention
 32  crystallizing into insight.
 33  )�	dataclass�field)�datetime)�Optional�List�Dict�Callable�Any)�EnumNc�"�]tRt^%tRtRtRtRtR#)�AhaTypez1Two phenomenologically distinct types of insight.�	discovery�
architectural�N)�__name__�
 34  __module__�__qualname__�__firstlineno__�__doc__�	DISCOVERY�
ARCHITECTURAL�__static_attributes__r��core/attention/aha_detection.pyrr%s��;��I�#�Mrrc�.�]tRt^+tRtRtRtRtRtRt	Rt
 35  R#)	�AhaSurfaceTargetz"Where aha moments can be surfaced.�inline�aha_log�audio�nav�dailyrN)rrrrr�INLINE_MARKDOWN�AHA_LOG�AUDIO_ANNOUNCE�
 36  NAV_MARKER�
DAILY_SUMMARYrrrrrr+s��,��O��G��N��J��Mrrc�$a�]tRt^4toRtRtRtRtRtRt	Rt
 37  RtRtRt
RtRtRt]V3RlRl4t]V3RlRl4t]V3RlRl4t]V3R	lR
 38  l4t]V3RlRl4t]V3R
lRl4t]V3RlRl4tV3RltRtVtR#)�BiometricSnapshota
 39  Biometric state at moment of potential aha.
 40  
 41  Used for calibration and validation - the body knows
 42  before the mind articulates.
 43  
 44  EEG fields (from Mind Monitor via EEG Bridge):
 45  - eeg_focus: Derived from alpha/theta ratio
 46  - eeg_flow: Derived from band pattern matching
 47  - eeg_engagement: Derived from beta+gamma elevation
 48  - eeg_bands: Raw band powers (delta, theta, alpha, beta, gamma)
 49  Nc�0<�V^8�dQhRS[S[,/#���return�r�float)�format�
__classdict__s"�r�__annotate__�BiometricSnapshot.__annotate__Ss�����(�5�/�rc��VP'dAVP'd/VPVP,
 50  VP,#R#)z&Heart rate spike relative to baseline.N)�
 51  heart_rate�heart_rate_baseline��selfs&r�hr_spike�BiometricSnapshot.hr_spikeRs;���?�?�?�t�7�7�7��O�O�d�&>�&>�>�$�BZ�BZ�Z�Z�rc�0<�V^8�dQhRS[S[,/#r)r,)r.r/s"�rr0r1Zs�����8�E�?�rc��VP'dAVP'd/VPVP,
 52  VP,#R#)zGSR spike relative to baseline.N)�gsr�gsr_baseliner5s&r�	gsr_spike�BiometricSnapshot.gsr_spikeY�;���8�8�8��)�)�)��H�H�t�0�0�0�D�4E�4E�E�E�rc�0<�V^8�dQhRS[S[,/#r)r,)r.r/s"�rr0r1as�����H�U�O�rc��VP'dAVP'd/VPVP,
 53  VP,#R#)z HRV change relative to baseline.N)�hrv�hrv_baseliner5s&r�
 54  hrv_change�BiometricSnapshot.hrv_change`r?rc� <�V^8�dQhRS[/#r)��bool)r.r/s"�rr0r1hs���C�C��Crc�L�VPRJ;'dVPR8�#)zIs EEG focus elevated? (> 0.7)N�ffffff�?)�	eeg_focusr5s&r�eeg_focus_high� BiometricSnapshot.eeg_focus_highgs$���~�~�T�)�B�B�d�n�n�s�.B�Brc� <�V^8�dQhRS[/#r)rG)r.r/s"�rr0r1ms���A�A�t�Arc�L�VPRJ;'dVPR8�#)z"Is operator in flow state? (> 0.6)N�333333�?)�eeg_flowr5s&r�
eeg_flow_high�BiometricSnapshot.eeg_flow_highls$���}�}�D�(�@�@�T�]�]�S�-@�@rc� <�V^8�dQhRS[/#r)rG)r.r/s"�rr0r1rs���M�M�T�Mrc�L�VPRJ;'dVPR8�#)z'Is engagement/arousal elevated? (> 0.7)NrJ)�eeg_engagementr5s&r�eeg_engagement_high�%BiometricSnapshot.eeg_engagement_highqs(���"�"�$�.�L�L�4�3F�3F��3L�Lrc� <�V^8�dQhRS[/#r)rG)r.r/s"�rr0r1ws�����d�rc�f�\VPRJVPRJVPRJ.4#)zCheck if EEG data is available.N)�anyrKrQrVr5s&r�has_eeg_data�BiometricSnapshot.has_eeg_datavs<����N�N�$�&��M�M��%����t�+�
 55  ��	rc�<�V^8�dQh/S[;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R	&S[S[,;R
 56  &S[S[,;R&S[S[,;R&S[S[S[S[3,,;R
&#)r*�	timestampr3r4r;r<rBrC�pupil_diameter�breath_raterKrQrV�	eeg_bands)rrr-r�str)r.r/s"�rr0r14s�����������&�� "�%��/�!�"
 57  �%���#�$�5�/�(�%�&
 58  �%���'�(�5�/�(�)�*�U�O�*�+�,�%��'�-�2���%�3�4�u�o�$�5�6�U�O�*�7�8��S�%�Z�(�)�0�9rr)rrrrrr3r4r;r<rBrCr`rarKrQrVrb�propertyr7r=rDrLrRrWr\�__annotate_func__r�__classdictcell__�r/s@rr'r'4s������#'�J�+/���C�$(�L��C�$(�L�&*�N�#'�K�"&�I� $�H�&*�N�,0�I�
�������������C��C��A��A��M��M�����G�rr'c�a�]tRt^�toRt]!RR7t]!]PR7t	]
 59  PtRt
Rt]!]R7t]!]R7tRtRtRtRtRtRtRtRt]V3RlR	l4tRV3R
 60  lRlltV3RltR
tVtR#)�AhaCandidatez|
 61  A potential aha moment detected by the system.
 62  
 63  May be validated by biometrics, user confirmation,
 64  or subsequent behavior.
 65  c�L�\\P!44R,#):N�N)rc�uuid�uuid4rrr�<lambda>�AhaCandidate.<lambda>�s��C��
 66 67  ��,=�b�,Ar��default_factory�NF��?c�0<�V^8�dQhRS[S[,/#r)r,)r.r/s"�rr0�AhaCandidate.__annotate__�s�����8�E�?�rc��VP'd0VP'dVPVP,
 68  #R#)z7How much the graph contracted (for architectural ahas).N)�graph_distance_before�graph_distance_afterr5s&r�graph_contraction�AhaCandidate.graph_contraction�s5���%�%�%�$�*C�*C�*C��-�-��0I�0I�I�I�rc�><�V^8�dQhRS[RS[RS[RS[RS[RS[/#)r*�hr_threshold�
gsr_threshold�
hrv_threshold�eeg_focus_threshold�eeg_engagement_thresholdr+)r-rH)r.r/s"�rr0ru�sG���7(�7(��7(��7(��	7(�
 69  #�7(�#(�
7(�
 70  �7(rc�f�VP'gR#RpRpRpRp	VP\P8Xd�VPP;'g^V8�pVPP
 71  ;'g^V8�pVPP'd5VPP;'dVPPp	T;'dT;'gT	Vn	M�VP\P8XdgVPP;'g^V8�pVPP'dVPPp	T;'gT	Vn	VP'd#\RVPR,4VnVP#)a
 72  Validate aha candidate using biometric signals.
 73  
 74  Discovery ahas: HR spike + GSR spike (arousal, surprise)
 75                 OR EEG: High engagement + focus spike
 76  Architectural ahas: HRV increase (parasympathetic, settling)
 77                     OR EEG: High flow state
 78  F��?�333333�?)�
 79  biometrics�aha_typerrr7r=r\rWrL�biometric_validatedrrDrR�min�
 80  confidence)
 81  r6r|r}r~rr��hr_valid�	gsr_valid�	hrv_valid�	eeg_valids
 82  &&&&&&    r�validate_with_biometrics�%AhaCandidate.validate_with_biometrics�sY�� ��������	��	��	��=�=�G�-�-�-����0�0�5�5�A�,�F�H����2�2�7�7�a�M�I�I����+�+�+��O�O�7�7�3�3��O�O�2�2��
 83  )1�(>�(>�Y�'L�'L�9�D�$�
�]�]�g�3�3�
3����3�3�8�8�q�]�J�I����+�+�+� �O�O�9�9�	�'0�'=�'=�I�D�$��#�#�#�!�#�t����'<�=�D�O��'�'�'rc�.<�V^8�dQh/S[;R&S[;R&S[;R&S[;R&S[;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R	&S[S[,;R
 84  &S[;R&S[;R&S[S[,;R
&S[;R&S[;R&#)r*�idr_r��trigger_source�trigger_content�source_concepts�target_conceptsrwrxr�r�r��user_validated�summary�context)rcrrrrr-r'rH)r.r/s"�rr0ru�s�����	�B���=���)��������"�#�Y�<�#�$�#�Y�<�%�&$�E�?�1�'�(#�5�/�0�)�.�*�+�2�/�0�%�1�6��7�8�T�N�)�9�>��?�@��Ar)r�r�)�333333�?皙�����?皙�����?rJrJ) rrrrrrr�r�nowr_rrr�r�r��listr�r�rwrxr�r�r�r�r�r�rdryr�rerrfrgs@rriri�s�������$A�B�B�����=�I��)�)�H��N��O�"'�t�!<�O�!&�t�!<�O�-1��,0��/3�J� %���J�%)�N��G��G�
����7(�7(�S�rric�Ta�]tRt^�toRt]!RR7tRtRtRt	Rt
 85  V3RltRtVt
R#)	�AhaSurfacingConfigz(Configuration for how ahas are surfaced.c�$�\P.#�N)rr%rrrrn�AhaSurfacingConfig.<lambda>�s���&�&�ErrprPFNc�v<�V^8�dQh/S[S[,;R&S[;R&S[;R&S[;R&S[S[,;R&#)r*�targets�min_confidence�require_biometric�
audio_enabled�daily_note_path)rrr-rHrrc)r.r/s"�rr0�AhaSurfacingConfig.__annotate__�sR�����"�
#�����
��#������c�]�)�rr)rrrrrrr�r�r�r�r�rerrfrgs@rr�r��s5����2�&+�=�'�G� �N�#���M�%)�O��rr�c��a�]tRt^�toRtRtRtRtRtV3RlRlt	V3RlR	lt
 86  V3R
 87  lRltV3RlR
ltV3RlRlt
V3RlRltV3RlRltRV3RlRlltRV3RlRlltRtVtR#)�AhaDetectora2
 88  Detects aha moments from attention and graph signals.
 89  
 90  Integration points:
 91  - AttentionTracker: attention events feed detection
 92  - EdgePredictionEngine: predicted edges trigger candidates
 93  - BiometricStream: validates candidates with body signals
 94  - CrossSessionTracker: cross-pollination triggers candidates
 95  r�r�r�c�>�.Vn.Vn.VnRVnR#r�)�
 96  candidates�validated_ahas�
 97  _callbacks�_biometric_streamr5s&r�__init__�AhaDetector.__init__�s ��.0���24���@B���04��rc�:<�V^8�dQhRS[S[.R3,RR/#)r*�callbackNr+)rri)r.r/s"�rr0�AhaDetector.__annotate__s'���)�)�x����(<�=�)�$�)rc�<�VPPV4R#)z,Register callback for validated aha moments.N)r��append)r6r�s&&r�on_aha�AhaDetector.on_ahas�������x�(rc�h<�V^8�dQhRS[S[,RS[S[,RS[RS[RS[S[,/#)r*r�r��prediction_confidence�graph_distancer+)rrcr-rri)r.r/s"�rr0r�	sJ������c����c��� %�	�
 98  ��
 99  �,�	�
rc��VR8�dRVR8�dK\\PRVVVVR,RVRV2R7pVPP	V4V#R#)	z�
100  Detect potential aha from edge prediction.
101  
102  When the edge prediction engine predicts a connection
103  between concepts, this may signal an aha.
104  g@rJ�edge_predictiong�������?zConnection predicted: � → )r�r�r�r�rwr�r�N)rirrr�r�)r6r�r�r�r��	candidates&&&&& r�detect_from_edge_prediction�'AhaDetector.detect_from_edge_prediction	sj���C��$9�C�$?�$� �*�*�0� /� /�&4�0�3�6�0��0A���FW�X��I�
�O�O�"�"�9�-���rc�X<�V^8�dQhRS[RS[RS[RS[S[,RS[S[,/#)r*�concept�resonance_before�resonance_after�related_conceptsr+)rcr-rrri)r.r/s"�rr0r�&sF���#�#��#� �#��	#�
105  �s�)�#�
106  �,�	�
#rc��W2,
107  pVR8�duVR8d\PpM\Pp\VRVV.V\	RRV,4RVRVR
R	VR
2R
108  7pVP
109  P
V4V#R#)z_
110  Detect potential aha from resonance spike.
111  
112  When resonance suddenly jumps, something clicked.
113  r�g�������?�resonance_spiker�rszResonance spike on 'z': �.2fr��r�r�r�r�r�r�r�N)rrrrir�r�r�)r6r�r�r�r��deltar�r�s&&&&&   r�detect_from_resonance_spike�'AhaDetector.detect_from_resonance_spike&s��� �2���3�;��#�%�"�,�,��#�0�0��$�!�0� '�!(�	� 0��s�C�%�K�0�.�w�i�s�;K�C�:P�PU�Ve�fi�Uj�k��I�
�O�O�"�"�9�-���rc	�R<�V^8�dQhRS[RS[S[,RS[RS[S[,/#)r*�topic�session_ids�combined_intensityr+)rcrr-rri)r.r/s"�rr0r�Ks<��������#�Y��"�	�
114  
115  �,�	�rc��\V4^8�dpVR8�di\\PRTVUu.uFpRV2NK
116  	upV.VR,RVR\V4R2R7pVPPV4V#R	#uupi)
117  z�
118  Detect potential aha from cross-session convergence.
119  
120  When multiple sessions converge on the same topic,
121  that's distributed cognition crystallizing.
122  rP�
cross_session�session_��������?zCross-session convergence on 'z	' across z	 sessionsr�N)�lenrirrr�r�)r6r�r�r��sr�s&&&&  r�detect_from_cross_session�%AhaDetector.detect_from_cross_sessionKs����{��q� �%7�#�%=�$� �.�.�.� %�9D� E��A�8�A�3��� E�!&��-��3�8���y��[�IY�HZ�Zc�d��I�
�O�O�"�"�9�-�����!Fs�Bc�,<�V^8�dQhRS[RS[RS[/#)r*�candidate_idr�r+)rcr'rH)r.r/s"�rr0r�fs)�������&��
123  �	rc���VPFipVPV8XgKW#nVPVPVP
124  VPR7pV'dVPV4Vu#	R#)zb
125  Attach biometric data to a candidate and validate.
126  
127  Returns True if biometrics validate the aha.
128  )r|r}r~F)r�r�r�r��HR_SPIKE_THRESHOLD�GSR_SPIKE_THRESHOLD�HRV_INCREASE_THRESHOLD�_promote_to_validated)r6r�r�r��	validateds&&&  r�attach_biometrics�AhaDetector.attach_biometricsfsr�����I��|�|�|�+�'1�$�%�>�>�!%�!8�!8�"&�":�":�"&�"=�"=�?��	���.�.�y�9� � �)�rc�*<�V^8�dQhRS[RS[RR/#)r*r��is_validr+N)rcrH)r.r/s"�rr0r��s"�����#����$�rc��VPFopVPV8XgKW#nV'd0\VPR4VnVPV4R#\
VPR4VnR#	R#)zo
129  User explicitly validates or rejects a candidate.
130  
131  This is the ground truth that calibrates future detection.
132  r�r�N)r�r�r��maxr�r�r�)r6r�r�r�s&&& r�
user_validate�AhaDetector.user_validate�si�����I��|�|�|�+�+3�(��+.�y�/C�/C�S�+I�I�(��.�.�y�9��,/�y�/C�/C�S�+I�I�(��)rc�$<�V^8�dQhRS[RR/#)r*r�r+N�ri)r.r/s"�rr0r��s���$�$�|�$��$rc��WP9d9VPPV4VPFpV!V4K
	R#R#)z9Promote candidate to validated aha and trigger callbacks.N)r�r�r�)r6r�r�s&& rr��!AhaDetector._promote_to_validated�s=���/�/�/����&�&�y�1� �O�O����#�,�0rNc�L<�V^8�dQhRS[S[,RS[RS[S[,/#)r*�sincer�r+)rrr-rri)r.r/s"�rr0r��s8���K�K���!�K��K�
133  �l�	�	Krc���VPpV'd$VUu.uFqDPV8�gKVNK	ppV^8�d$VUu.uFqDPV8�gKVNK	pp\VRRR7#uupiuupi)zGet recent aha candidates.c��VP#r��r_)�cs&rrn�3AhaDetector.get_recent_candidates.<locals>.<lambda>�s����rT��key�reverse)r�r_r��sorted)r6r�r�r�r�s&&&  r�get_recent_candidates�!AhaDetector.get_recent_candidates�sr���_�_�
134  ��%/�H�Z��;�;�%�3G�!�!�Z�J�H��A��%/�R�Z��<�<�>�3Q�!�!�Z�J�R��j�&;�T�J�J��I��Ss�A1�A1�A6�A6c�F<�V^8�dQhRS[S[,RS[S[,/#)r*r�r+)rrrri)r.r/s"�rr0r��s-���
135  E�
136  E���!�
137  E�
138  �l�	�
139  Erc��VPpV'd$VUu.uFq3PV8�gKVNK	pp\VRRR7#uupi)zGet validated aha moments.c��VP#r�r�)�as&rrn�0AhaDetector.get_validated_ahas.<locals>.<lambda>�s��!�+�+rTr�)r�r_r�)r6r��ahasr�s&&  r�get_validated_ahas�AhaDetector.get_validated_ahas�sF��
140  �"�"���#�<�t�!�{�{�e�';�A�A�t�D�<��d� 5�t�D�D��=s
141  �A�A)r�r�r�r�)Ngr�)rrrrrr�r�r�r�r�r�r�r�r�r�r�r�rrrfrgs@rr�r��s����������!��5�)�)���:#�#�J��6��4��$$�$�K�K� 
142  E�
143  E�
144  Err�c��a�]tRtRtoRtV3RlRltV3RlRltV3RlRltV3R	lR
145  ltV3RlRlt	V3R
lRlt
146  V3RlRltV3RlRltV3RlRlt
RtVtR#)�
147  AhaManageri�a1
148  Manages aha surfacing across multiple outputs.
149  
150  Outputs:
151  - Inline markdown: inject into current content stream
152  - Aha log: append to dedicated log file
153  - Audio announce: text-to-speech for ambient awareness
154  - Nav marker: add to navigation/breadcrumb trail
155  - Daily summary: include in daily note synthesis
156  c� <�V^8�dQhRS[/#)r*�config)r�)r.r/s"�rr0�AhaManager.__annotate__�s���5�5�1�5rc��Wn\4Vn.VnVPP	VP
157  4R#r�)rr��detector�	_surfacedr��_on_validated_aha)r6rs&&rr��AhaManager.__init__�s1����#�
��
�$&���	
�
�
���T�3�3�4rc�$<�V^8�dQhRS[RR/#)r*�ahar+Nr�)r.r/s"�rr0r�s�����\��d�rc���VPVPP8�dDVPP'dVP'gR#VPV4R#R#)z Called when an aha is validated.N)r�rr�r�r��surface�r6rs&&rr�AhaManager._on_validated_aha�sG���>�>�T�[�[�7�7�7��{�{�,�,�,�S�5L�5L�5L���L�L���	8rc�<<�V^8�dQhRS[RS[S[S[3,/#�r*rr+)rirrcrH)r.r/s"�rr0r�s#�����<��D��d��O�rc�J�VPVP9d/#/pVPPEF
158  pV\P
159  8Xd VP
V4W#P&K9V\P8Xd VPV4W#P&KmV\P8Xd VPV4W#P&K�V\P8Xd VPV4W#P&K�V\P8Xd!VPV4W#P&EK
160  EK
	VPP%VP4V# \ d,p\#RTRT24RY#P&Rp?EKgRp?ii;i)uS
161  Surface an aha moment to configured targets.
162  
163  Returns dict of target → success.
164  z"[AhaManager] Failed to surface to z: FN)r�r
165  rr�rr!�_surface_inline�valuer"�_surface_to_logr#�_surface_audior$�_surface_navr%�_surface_daily�	Exception�printr�)r6r�results�target�es&&   rr�AhaManager.surface�sN���6�6�T�^�^�#��I����k�k�)�)�F�

.��-�=�=�=�,0�,@�,@��,E�G�L�L�)��/�7�7�7�,0�,@�,@��,E�G�L�L�)��/�>�>�>�,0�,?�,?��,D�G�L�L�)��/�:�:�:�,0�,=�,=�c�,B�G�L�L�)��/�=�=�=�,0�,?�,?��,D�G�L�L�)�>�*� 	
�����c�f�f�%�����
.��:�6�(�"�Q�C�H�I�(-����%�%��
.�s/�2E,�/2E,�#2E,�2E,�2E,�,F"�7F�F"c�&<�V^8�dQhRS[RS[/#r�rirH)r.r/s"�rr0r�s�����<��D�rc	��VP\P8XdRMRp\RVRVPPRVP
166  R24R#)zSurface as inline markdown.�💡�🔧�
167  z **Aha [z]**: T)r�rrrrr�)r6r�emojis&& rr�AhaManager._surface_inline�sK���,�,�'�*;�*;�;����
��5�'��#�,�,�"4�"4�!5�U�3�;�;�-�r�J�K�rc�&<�V^8�dQhRS[RS[/#rr#)r.r/s"�rr0r�s�����<��D�rc��RVPP4RVPPRVP2p\RV24R#)zAppend to aha log file.�[z] [�] z	[AhaLog] T)r_�	isoformatr�rr�r)r6r�	log_entrys&& rr�AhaManager._surface_to_log�sK����
�
�/�/�1�2�#�c�l�l�6H�6H�5I��C�K�K�=�Y�	�
�	�)��%�&�rc�&<�V^8�dQhRS[RS[/#rr#)r.r/s"�rr0rs�����,��4�rc�r�VPP'gR#\RVP24R#)zText-to-speech announcement.Fz[Audio] Would announce: T)rr�rr�rs&&rr�AhaManager._surface_audios.���{�{�(�(�(��	�(����
�6�7�rc�&<�V^8�dQhRS[RS[/#rr#)r.r/s"�rr0r	s��������rc�F�\RVPR,R24R#)zAdd to navigation markers.z[Nav] Marker added: :N�Nz...T)rr�rs&&rr�AhaManager._surface_nav	s#��	�$�S�[�[��%5�$6�c�:�;�rc�&<�V^8�dQhRS[RS[/#rr#)r.r/s"�rr0rs�����,��4�rc��VPP'gR#VPV4p\RV24R#)z Include in daily note synthesis.Fz![Daily] Would add to daily note:
168  T)rr��_format_for_dailyr)r6r�entrys&& rr�AhaManager._surface_dailys:���{�{�*�*�*���&�&�s�+��
�2�5�'�:�;�rc�&<�V^8�dQhRS[RS[/#r)rirc)r.r/s"�rr0rs��� � �\� �c� rc	�>�VP\P8XdRMRpRVPR
R2pRVRVRVPPP4R	VP2.pVP'djVP'dXVPR
169  RPVPR,4R
RPVPR,424VP'dVPR4RPV4#)z Format aha for daily note entry.r%r&r,z.0%�]z- � z **z**: z  - Connected: z + :N�Nr�u  - ✓ Biometrically validatedr')r�rrr�r�titler�r�r�r��joinr�)r6rr(�confidence_str�liness&&   rr:�AhaManager._format_for_dailys����,�,�'�*;�*;�;�����S�^�^�C�0��2�����q��(��C�L�L�,>�,>�,D�,D�,F�+G�t�C�K�K�=�Y�
170  ������3�#6�#6�#6��L�L�?�5�:�:�c�6I�6I�"�6M�+N�*O�u�UZ�U_�U_�`c�`s�`s�tv�`w�Ux�Ty�z�{��"�"�"��L�L�:�;��y�y���r)r
171  rr	N)rrrrrr�rrrrrrrr:rrfrgs@rrr�sd����	�5�5�����<���������� � rrc�R�V^8�dQhR\\,R\R\/#)r*r�r�r+)rrcrH�tuple)r.s"rr0r0+s*��%�%��c�]�%��%��%rc��\\P\P.RRVVR7p\	V4pVP
172  V3#)zT
173  Create the aha detection and surfacing system.
174  
175  Returns (AhaDetector, AhaManager).
176  rPF)r�r�r�r�r�)r�rr%r"rr	)r�r�r�managers&&  r�create_aha_systemrK+sP�� ��*�*��$�$�
177  ���#�'�	�F��� �G����W�$�$r�__main__z=== Aha Detection Module ===
178  z*1. Simulating edge prediction detection...�attention_tracking�
aha_detectiong333333�?g������@)r�r�r�r�z   Candidate: z	   Type: z   Confidence: r�z+
179  2. Simulating resonance spike detection...�markov_blanketsrJgffffff�?)r�r�r�r�z+
180  3. Simulating cross-session convergence...�attention_is_all_you_needg=
181  ףp=�?)r�r�r�z&
182  4. Simulating biometric validation...g@)r_r3r4r;r<rBrCz
   HR spike: z.1%z   GSR spike: z   HRV change: z   Biometric validation: z
183  5. Validated ahas:z   - [r-zA
184  'Attention is all you need' - the aha IS attention crystallizing)NF)�	attention�membrane�boundary)�abc123�def456�ghi789).r�dataclassesrrr�typingrrrrr	�enumr
185  rlrrr'rir�r�rrKrrr	rJr�r�r�r�rr�r��
186  candidate2r��
187  candidate3r�r�r7r=rDr�r�r�rrrrr�<module>r\s���:)��6�6���$�d�$��t���H�H��H�V�_(�_(��_(�D�*�*��*�EE�EE�Pq �q �h%�0�z��	�
188  *�+�*�+��H�g�
189190  6�7��4�4�-�.�(�)�"��	5��I��
��y�0�0�1�2�3�
�	�)�,�,�2�2�3�4�5�
��	� 4� 4�S�9�:�;�
191192  8�9��5�5�!���>�	6��J��
��z�1�1�2�3�4�
�	�*�-�-�3�3�4�5�6�
193194  8�9��3�3�)�2��4��J�
195  �
��z�1�1�2�3�4�
�	�*�-�-�3�3�4�5�6�
196197  3�4�"��,�,�.��������J�
198  �M�*�-�-�c�2�
199  3�4�	�N�:�/�/��4�
200  5�6�	�O�J�1�1�#�6�
201  7�8���.�.�y�|�|�Z�H�	�
�)�)��5�6�	�
202   �!��*�*�,��
��s�|�|�)�)�*�"�S�[�[�M�:�;�-�
203204  N�O�Cr