Add LLMCompress subsystem - sandbox for symbolic compression of LLM behavior
New subsystem fully self-contained: Components: - LLMCompress/llm_adapter.py: LLMAdapter + LLMResponse (abstract over LLM backends) - LLMCompress/compression_report.py: CompressionReport (symbolic analysis results) - LLMCompress/llm_compressor.py: compress_interaction() and compress_session() - LLMCompress/tests/test_llm_compress.py: 5 comprehensive tests Integration: - Uses GlyphOS Cognitive Kernel for symbolic analysis - Integrates with GlyphOS Event System - Emits cognition.started and cognition.completed events - Supports in-memory GX execution via execute_symbolic() Test Coverage: - LLMCompress tests: 5/5 PASS - All existing tests still pass (52/52) - Total: 57 tests passing Bug fixes in cognitive_kernel.py: - Fixed execute_symbolic() method calls to use correct function signatures - normalize_segments(manifest, segments, payload) - map_lanes(segments) - build_envelope(manifest, lanes, payload, context) - execute_with_lain(envelope) Constraints: - No modifications to gx_compiler/* - No modifications to glyphs/super_registry.py - Self-contained subsystem with proper isolation - Full backward compatibility maintained
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
"""Compression report structures for LLMCompress."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class CompressionReport:
|
||||
"""Symbolic compression report for a single LLM interaction or session."""
|
||||
|
||||
# Raw interaction(s)
|
||||
interactions: List[Dict[str, Any]] = field(default_factory=list)
|
||||
|
||||
# Symbolic outputs from LAIN / GlyphOS
|
||||
fused_symbol: Optional[Dict[str, Any]] = None
|
||||
diagnostics: Optional[Dict[str, Any]] = None
|
||||
cognition_trace: Optional[List[Dict[str, Any]]] = None
|
||||
|
||||
# Glyph-related summaries
|
||||
glyph_ids: List[str] = field(default_factory=list)
|
||||
glyph_resonance: Optional[Dict[str, Any]] = None
|
||||
|
||||
# Free-form notes / tags
|
||||
tags: List[str] = field(default_factory=list)
|
||||
metadata: Dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
return {
|
||||
"interactions": self.interactions,
|
||||
"fused_symbol": self.fused_symbol,
|
||||
"diagnostics": self.diagnostics,
|
||||
"cognition_trace": self.cognition_trace,
|
||||
"glyph_ids": self.glyph_ids,
|
||||
"glyph_resonance": self.glyph_resonance,
|
||||
"tags": self.tags,
|
||||
"metadata": self.metadata,
|
||||
}
|
||||
Reference in New Issue
Block a user