Files
blackroad-operating-system/qlm_lab/__init__.py
Claude e478add607 Add complete QLM (Quantum Language Model) implementation
This commit introduces the QLM system - a stateful semantic layer for
tracking HI (Human Intelligence), AI (Agent Intelligence), and QI
(Quantum/Emergent Intelligence) in BlackRoad OS.

Core Features:
- HI/AI/QI intelligence layer modeling
- Event-driven state management
- QI emergence detection (agent self-correction, feedback loops, etc.)
- HI-AI alignment scoring
- Operator-facing query interface
- Reality ingestion (git, CI, agent logs)

Components Added:
- qlm_lab/models.py: Core data models (Actor, QLMEvent, QIEmergence, etc.)
- qlm_lab/state.py: State management and transition tracking
- qlm_lab/api.py: Public QLMInterface API
- qlm_lab/ingestion/: Git, CI, and agent log connectors
- qlm_lab/experiments/: Alignment and emergence validation
- qlm_lab/visualization.py: Timeline, actor graph, alignment plots
- qlm_lab/demo.py: Interactive demo script
- tests/test_qlm_core.py: Comprehensive test suite
- docs/QLM.md: Complete documentation (concepts, API, integration)

Usage:
  from qlm_lab.api import QLMInterface

  qlm = QLMInterface()
  qlm.record_operator_intent("Build feature X")
  qlm.record_agent_execution("agent-1", "Implement X", "task-1")
  summary = qlm.get_summary(days=7)

Run:
  python -m qlm_lab.demo
  python -m qlm_lab.experiments.alignment_detection
  pytest tests/test_qlm_core.py -v

Integrates with:
- cognitive/intent_graph.py (intent tracking)
- cognitive/agent_coordination.py (multi-agent coordination)
- operator_engine/scheduler.py (background analysis)

Next steps: Integrate with FastAPI backend, add Prism Console UI,
implement Lucidia language runtime.
2025-11-18 08:15:06 +00:00

77 lines
2.0 KiB
Python

"""
QLM Lab - Quantum Language Model Implementation
This module implements the QLM (Quantum Language Model) system for BlackRoad OS.
QLM is a stateful semantic layer that:
- Tracks HI (Human Intelligence), AI (Agent Intelligence), and QI (Quantum/Emergent Intelligence)
- Connects Operator intent to system execution
- Detects emergent behaviors in HI+AI feedback loops
- Provides introspection and control tools for the Operator
Key Components:
- models: Core data structures (IntelligenceLayer, Actor, QLMEvent, QIEmergence)
- state: QLM state management and transitions
- events: Event ingestion and processing
- api: Public API for QLM operations
- ingestion: Connectors to real system data (git, CI, agents)
- experiments: Validation experiments and metrics
- visualization: Tools for visualizing QLM state
Integration Points:
- cognitive.intent_graph: Foundation for intent tracking
- cognitive.agent_coordination: Multi-agent collaboration
- operator_engine.scheduler: Background QLM analysis
- agents: Event source for AI actions
Usage:
from qlm_lab import QLMState, QLMEvent
from qlm_lab.api import QLMInterface
# Initialize QLM
qlm = QLMInterface()
# Record Operator intent
qlm.record_operator_intent("Deploy authentication feature")
# Record agent execution
qlm.record_agent_execution(agent_id="coder-001", task="implement login")
# Query state
state = qlm.get_current_state()
summary = qlm.summarize_for_operator(days=7)
"""
__version__ = "0.1.0"
from qlm_lab.models import (
IntelligenceType,
ActorType,
ActorRole,
IntelligenceLayer,
Actor,
QLMEvent,
EventType,
QIEmergence,
QLMMetrics,
)
from qlm_lab.state import QLMState, StateTransition
from qlm_lab.api import QLMInterface
__all__ = [
"IntelligenceType",
"ActorType",
"ActorRole",
"IntelligenceLayer",
"Actor",
"QLMEvent",
"EventType",
"QIEmergence",
"QLMMetrics",
"QLMState",
"StateTransition",
"QLMInterface",
]