Files
2125_GCE/glyphos/__pycache__/cognitive_kernel.cpython-314.pyc
T

198 lines
18 KiB
Plaintext
Raw Normal View History

2026-05-20 18:03:25 -04:00
+
2026-07-09 12:54:44 -04:00
þÜ0j‹:ãóÎaRt0tRt^RIHtHtHtHt^RIt^RIH t ^RI
H t H t H
t
2026-05-20 18:03:25 -04:00
HtHtHt^RIHtHt^RIHt!RR4tRs]^kR R
ltR R R
R/RRlltRRltR#)z¶GlyphOS Cognitive Kernel
2026-07-09 12:54:44 -04:00
2026-05-20 18:03:25 -04:00
Orchestrates LAIN cognition engine with Supercharged Glyph Registry.
Provides a clean service API for executing GX files and managing glyph-aware analysis.
2026-07-09 12:54:44 -04:00
)ÚOptionalÚDictÚAnyÚListN)ÚPath)Úexecute_gx_pathÚload_gxÚnormalize_segmentsÚ map_lanesÚbuild_envelopeÚexecute_with_lain)Úload_all_superchargedÚ super_stats)Úemitcóøa]tRt^toRtRR/V3RlRlltV3RlRltRR R
2026-05-20 18:03:25 -04:00
R /V3R lR
lltRR R
R /V3RlRlltV3RlRlt V3RlRlt
V3RlRlt V3RlRlt V3RlRlt
V3RlRltRtVtR #)ÚCognitiveKernelz¬System service for GlyphOS cognition pipeline.
2026-07-09 12:54:44 -04:00
2026-05-20 18:03:25 -04:00
Orchestrates:
- LAIN 8-lane symbolic cognition
- Supercharged Glyph Registry integration
- Result caching and introspection
Úauto_load_glyphsTcó <V^8„dQhRS[/#)ér)Úbool)ÚformatÚ
__classdict__s"€Ú//home/t420/2125_GCE/glyphos/cognitive_kernel.pyÚ __annotate__ÚCognitiveKernel.__annotate__sø€÷  .©Dñ c óXWnRVnRVnRVnRVnRVnR#)zInitialize the Cognitive Kernel.
2026-05-20 18:03:25 -04:00
Args:
auto_load_glyphs: If True, load Supercharged Glyphs during warmup.
Defaults to True.
NF)Ú_auto_load_glyphsÚ _last_resultÚ
_startup_timeÚ_glyph_stats_cacheÚ
_warmed_upÚ
_last_mode)Úselfrs&$rÚ__init__ÚCognitiveKernel.__init__s0ð"2ÔØ6:ˆÔØ.2ˆÔØ<@ˆÔ؈ŒØ)-ˆŽrcó<V^8„dQhRR/#)rÚreturnN©)rrs"€rrr'sø€÷ ñ ˜ñ rc óVP'dR#\P!4VnVP'd \ 4\ 4VnRVn\RRVP RVP/4R#)z³Perform one-time initialization.
Loads:
- Supercharged Glyphs (if auto_load_glyphs)
- Registry statistics
Records:
- Kernel startup time
Emits:
- kernel.warmup.completed event
2026-05-20 18:03:25 -04:00
NTzkernel.warmup.completedÚ glyph_statsÚ startup_time)r!Útimerrr
rr r©r#s&rÚwarmupÚCognitiveKernel.warmup'skð ??ˆ?Ù ä!ŸYšY›[ˆÔà × #.£-ˆÔàˆŒô
Ð
˜4× ˜D×)
ö rÚmodeÚanalyzeÚcontextNc
ón<V^8„dQhRS[RS[RS[S[S[S[3,,RS[S[S[3,/#©rÚgx_pathr0r2r'©Ústrrrr)rrs"€rrrGsNø€÷EñEáðEñð Eñ
™$™s¡C˜x Eñ
‰c3ˆhñ
Erc óLVP'gVP4\RRVRVRV/4T;'g/pW$R&\WR7pWPnW nVP
R/4pVP
R/4p\R RVRVR
VP
R
4R VP
R 4R VP
R 4/4VP
R 4pV'dHVP
R
4'd1\RRVP
R4RVP
R4R V/4V#)aExecute a .gx file through the full cognition pipeline.
2026-07-09 12:54:44 -04:00
Args:
gx_path: Path to .gx file
mode: Cognitive mode (e.g., "analyze", "debug")
context: Optional execution context dict
Returns:
ExecutionResult dict with:
- fused_symbol: Combined 8-lane analysis
2026-05-20 18:03:25 -04:00
- output_text: Rendered analysis
- cognition_trace: Step-by-step processing
- diagnostics: Performance metrics + glyph resonance
Emits:
- cognition.started event
2026-07-09 12:54:44 -04:00
- cognition.completed event
- glyph.resonance.updated event (if glyph resonance present)
zcognition.startedr5r0r2Úcognitive_mode©r2Ú fused_symbolÚ diagnosticszcognition.completedÚelapsedÚglyph_resonanceÚsummaryÚ glyph_foundzglyph.resonance.updatedÚglyph_idÚ glyph_score)r!r.rrrr"Úget) r#r5r0r2Ú exec_contextÚresultr;r<r>s &&$$ rÚ
2026-05-20 18:03:25 -04:00
execute_gxÚCognitiveKernel.execute_gxGs1ð4ˆØ K‰KŒMô
Ð
2026-07-09 12:54:44 -04:00
Ø   #
ô ð—}} "ˆ Ø)-ÐÔðØŒð—z‘z .°"Ó Ø—jj °Ó ô
Ð
  {— yÓ ˜{ŸÐ/@Ó |×'¨ Ó %
ô ð&Ÿ/™/Ð*;Ó<ˆß ˜×2°=× Ð˜O×
Ó˜×2°=Ó! ?ð-ô
ð ˆ
2026-05-20 18:03:25 -04:00
rcó¶<V^8„dQhRS[S[S[3,RS[S[S[S[3,,RS[RS[RS[S[S[S[3,,RS[S[S[3,/#)rÚmanifestÚsegmentsÚpayloadr0r2r')rr7rrÚbytesr)rrs"€rrrŽsyø€÷OñOá‘s™Cx•.ðOñt™C¡˜H•~ÕOñð Oñ ð
Oñ™$™s¡C˜xOñ
‰c3ˆhñOrc ó€VP'gVP4T;'g/pWFR&VPR4pVRJ;'d\V4^8„p\ WV4p \ V 4p
\
WW6R7p \V 4p V'VPW|4p
RV 9d/V R&V R,pW~R&V
R,VR&RV9d/VR&V
R,P4FwppVVR,V&K V
R ,'d R
V 9d/V R
2026-07-09 12:54:44 -04:00
&V
2026-05-20 18:03:25 -04:00
R ,V R
,R &WÀn
W@n V #) aExecute cognition on in-memory GX components (no filesystem).
2026-07-09 12:54:44 -04:00
2026-05-20 18:03:25 -04:00
Supports both single-glyph and multi-glyph resonance modes.
Args:
2026-07-09 12:54:44 -04:00
manifest: GX manifest dict
2026-05-20 18:03:25 -04:00
segments: GX segments list
payload: Compressed GX payload bytes
mode: Cognitive mode
2026-07-09 12:54:44 -04:00
context: Optional execution context. May contain:
2026-05-20 18:03:25 -04:00
- glyph_id: Single glyph for glyph-aware cognition
- glyph_ids: List of glyphs for multi-glyph resonance
2026-05-20 18:03:25 -04:00
Returns:
ExecutionResult dict with fused_symbol containing:
- Single-glyph: summary, glyph_ids=[glyph_id], resonance_map
- Multi-glyph: summary, glyph_ids=[...], resonance_map with all metrics
r9Ú glyph_idsNr:r;Úglobal_resonance_scoreÚ
resonance_mapÚ
2026-07-09 12:54:44 -04:00
resonancesÚguardrails_triggeredr<Ú
2026-05-20 18:03:25 -04:00
guardrails) r!r.rCÚlenr r
2026-07-09 12:54:44 -04:00
r r Úcompute_multi_glyph_resonanceÚitemsrr")r#rIrJrKr0r2rDrNÚis_multi_glyphÚnormalized_segsÚlane_assignmentsÚenveloperEÚmulti_glyph_metricsÚfusedrAÚmetricss&&&&$$ rÚexecute_symbolicÚ CognitiveKernel.execute_symbolicŽscð6ˆØ K‰KŒMð—}} "ˆ Ø)-Ð!×$ 1ˆ Ø"¨$Ð.×E´3°y³>ÀAÑ3Eˆô-¨XÀÓô% ô" (¸\ˆô# ,ˆ÷ Ø"&×"DÑ"DÀYÓ"WÐ ð +Ø)+˜*ˆEØ!* Ø.AÐBZÕ.[ˆ  +Ø)+&à%8¸Õ%F×%LÑ%LÖ%NÑ!˜'Ø3:& &Oð#Ð#9× ¨Ô.Ø,.F˜)Ø6IÐJ`Õ6a% ØŒàˆ
rcó6<V^8„dQhRS[S[S[3,/#©rr'©rr7r)rrs"€rrrßsø€÷ñ¡¡c©3 h¥ñrc ó¤VP'gVP4VP;'g \4pVPVR&V#)aVGet Supercharged Glyph Registry statistics.
Returns:
Dict with:
- total_glyphs: 600
- categories: List of category names
- fields_present: All fields in registry
- sample_ids: First 5 glyph IDs
- loaded: Whether registry is loaded
- load_path: Path to data file
- kernel_startup_time: Kernel warmup timestamp
Úkernel_startup_time)r!r.r rr)r#Ústatss& rÚget_glyph_statsÚCognitiveKernel.get_glyph_statsßsCðˆØ K‰KŒMà×'×8¬;«=ˆð(,×'9Ñ'9ˆÐˆ rcóF<V^8„dQhRS[S[S[S[3,,/#ra©rrr7r)rrs"€rrrös!ø€÷©$©s±C¨x­.Õ!9ñ!rc óVP#)zYReturn the last ExecutionResult, if any.
Returns:
Full ExecutionResult dict or None
)rr-s&rÚget_last_resultÚCognitiveKernel.get_last_resultösð × Ñ Ð rcóV<V^8„dQhRS[S[S[S[S[3,,,/#ra)rrrr7r)rrs"€rrrþs&ø€÷©©d±3¹°8­nÕ)=Õ >ñ8rc óXVPfR#VPPR4#)zhReturn cognition_trace from last ExecutionResult, if present.
Returns:
2026-07-09 12:54:44 -04:00
List of trace steps or None
cognition_trace©rrCr-s&rÚget_last_traceÚCognitiveKernel.get_last_traceþs+ð × Ñ Ò Ø× Ñ ×$Ð%6Ó7rcóF<V^8„dQhRS[S[S[S[3,,/#rari)rrs"€rrrs!ø€÷5¡x±±S¹#°XµÕ'?ñ5rc óXVPfR#VPPR4#)zcReturn fused_symbol from last ExecutionResult, if present.
Returns:
2026-07-09 12:54:44 -04:00
Fused symbol dict or None
Nr;rpr-s&rÚget_last_fused_symbolÚ%CognitiveKernel.get_last_fused_symbols*ð × Ñ Ò Ø× Ñ ×$ ^Ó4rcóF<V^8„dQhRS[S[S[S[3,,/#rari)rrs"€rrrs!ø€÷
ñ
¡H©T±#±s°(­^Õ$<ñ
rc óÄVPfR#VPPR/4pRVPR4RVPR4RVPR4/#)zìReturn resonance metrics from last ExecutionResult, if present.
Returns:
Dict with:
- resonance: Overall resonance metrics (if present)
- glyph_resonance: Glyph-specific metrics (if glyph was used)
Or None if no result
Nr<Ú resonancer>r=rp)r#r<s& rÚget_last_resonanceÚ"CognitiveKernel.get_last_resonancesbð × Ñ Ò à×'×+¨M¸>ˆ ð
˜Ÿ¨Ó ˜{ŸÐ/@Ó {— yÓ
ð
rcóh<V^8„dQhRS[S[,RS[S[S[3,RS[S[S[3,/#)rrNrEr')rr7rr)rrs"€rrr&sBø€÷R
ñR
2026-05-20 18:03:25 -04:00
á•9ðR
ñS™#X•ðR
ñ
‰c3ˆhñ R
rc ó8^RIHp/p.pVEpV!V4pV'gKVPR/4pVPR/4p VPR/4p
VPR/4p VPR^4p V PR^4p
\RV R, R ,V
^d, R
2026-07-09 12:54:44 -04:00
,,4pV
PR ^4pTpVPR ^24pV^d, pV PR
2026-05-20 18:03:25 -04:00
^4V PR^4V PR^4V PR^4.p\ RV44R,^È, p\RV4pVPR^24pV^d, pR\ V^4R\ V^4R\ V^4R\ V^4R\ V^4/pW„V&VP
VR,4E V'd\ V4\V4, MRpRVRVR\ \RV4^4R./#)Compute multi-glyph resonance metrics from execution result.
2026-05-20 18:03:25 -04:00
Uses actual glyph metadata from the registry to compute real resonance scores:
- weight: Based on glyph score and activation state
- lineage_score: From lineage.inheritanceWeight
- contributor_score: From originalMetrics connectivity
- frequency_score: From praw vector magnitude
- grammar_score: From originalMetrics stability
Args:
glyph_ids: List of glyph IDs to compute resonance for
2026-07-09 12:54:44 -04:00
result: Execution result dict from LAIN
2026-05-20 18:03:25 -04:00
Returns:
Dict with:
- glyph_ids: Input glyph list
- resonances: Dict mapping glyph_id → metrics
- global_resonance_score: Weighted average across glyphs
- guardrails_triggered: List of guardrail messages
)Ú get_superÚoriginalMetricsÚ
activationÚlineageÚprawÚscoregð?iOgffffffæ?g333333Ó?ÚinheritanceWeightÚ connectivityÚWc3ó2"TF
2026-07-09 12:54:44 -04:00
qV,xK R#5i)Nr()Ú.0Úvs& rÚ <genexpr>Ú@CognitiveKernel.compute_multi_glyph_resonance.<locals>.<genexpr>^séÐ!=±¨A a§%¢%³ùsgà?Ú stabilityÚweightÚ
lineage_scoreÚcontributor_scoreÚfrequency_scoreÚ
grammar_scoregrNrQrOrR)Úglyphsr~rCÚminÚsumÚroundÚappendrT)r#rNrEr~rQÚscoresrAÚglyphr]r€rrÚactivation_scorerÚinheritance_weightrr…rÚ praw_valuesÚpraw_magnituder“rr”Úglobal_resonances&&& rrUÚ-CognitiveKernel.compute_multi_glyph_resonance&sõ2ˆ
؈ä!ˆHÙ˜hÓ'ˆEçÙà—i‘iÐ 1°2Ó6ˆGØŸ <°Ó4ˆJØ—ii  ¨2Ó.ˆGØ—9‘9˜V (ˆ—II˜g qÓ)ˆEØ)Ÿ~™~¨g°qÓ Ü˜˜u s{¨cÕ1Ð5EÈÕ5KÈsÕ4RÕSˆ")§¡Ð-@À!Ó!DÐ Ø.ˆ#Ÿ;™; ~°rÓ:ˆLØ ,¨sÕ 2Ð ð Ÿ8™8 C¨Ó+¨T¯X©X°c¸1Ó-=¸t¿x¹xÈÈQÓ?OÐQU×QYÑQYÐZ]Ð_`ÓQaÐbˆ!Ñ!=±Ó!=ÓÕÕKˆNÜ! # ~Ó6ˆOð Ÿ  K°Ó4ˆIØOˆMðœ% ¨Ó¤ }°aÓ!8Ø#¤UÐ+<¸aÓ%@Ø!¤5¨¸!Ó#<ؤ }°aÓ!8ð ˆ$+ Ø M‰M˜' +× ,ñU"÷Z9?œ3˜v¨V«Ö4ÀCÐð