Meta-Recursive Cognitive Engine Plus - A triple-loop cognitive system with multi-tiered memory and LLM integration
Project description
MRCE+ Production System
Introduction
MRCE+ (Meta-Recursive Cognitive Engine Plus) is a triple-loop cognitive system with multi-tiered memory and LLM integration. This production-ready implementation provides a full-stack, modular system that can be deployed in distributed environments.
Architecture
The system follows a layered architecture with the following components:
Core Components
-
Memory System: Multi-tiered memory architecture
- Episodic Memory: Vector-based storage using FAISS
- Semantic Memory: Graph-based representation using NetworkX
- Procedural Memory: Action sequences stored as JSON
-
Triple-Loop Architecture
- Inner Loop: Fast execution with NeuralGroundingCore
- Middle Loop: Reflection with MetaCritic
- Outer Loop: Self-redesign capabilities
-
IGVAM Module: Intelligent Goal-Value Alignment Module
- Ensures system actions align with specified goals and values
- Provides filtering mechanisms for action selection
-
Agent Coordination: Multi-agent communication framework
- Shared memory architecture
- Agent specialization capabilities
- Efficient message passing
Production Features
-
Distributed Consistency: Raft consensus protocol implementation
- Atomic transactions across memory tiers
- Eventual consistency with causal ordering
- Conflict resolution mechanisms
-
Security & Governance: Causal Integrity Watchdog
- Immutable system safety constraints
- IGVAM compliance metrics
- Semantic drift detection
- Cryptographic audit trail
-
Performance Optimization: Advanced data flow management
- Optimized transaction prioritization
- Resource monitoring with adaptive throttling
- Load balancing and scaling
- Distributed caching
-
Deployment Infrastructure: Containerized deployment
- Kubernetes integration
- Blue/green deployment capabilities
- Environment configuration management
- Secret handling
-
Production Monitoring: Comprehensive observability
- Structured logging framework
- Metrics collection and alerting
- Distributed tracing
- Performance analytics
Installation
Install dependencies:
- Python 3.11+
- PyTorch
- Ray (for distributed computing)
- FAISS
- NetworkX
- Docker and Kubernetes (for deployment)
- PyYAML (for deployment configuration)
# Basic dependencies
pip install torch numpy faiss-cpu networkx
# Distributed capabilities
pip install ray
# Production infrastructure
pip install pyyaml kubernetes docker
# Hybrid reasoning modules
pip install sympy z3-solver qiskit
# LLM integration
pip install openai
Project Structure
The project follows a structured organization:
mrce/
├── __init__.py
├── core/ # Core components of the system
│ ├── agents.py
│ ├── environment.py
│ ├── igvam.py
│ ├── inner_loop.py
│ ├── memory.py
│ ├── middle_loop.py
│ └── outer_loop.py
├── production/ # Production-ready modules
│ ├── consensus.py
│ ├── logging_metrics.py
│ ├── performance_optimization.py
│ ├── production_monitoring.py
│ └── security_governance.py
├── advanced/ # Advanced features and modules
│ ├── db_memory.py
│ ├── distributed_agents.py
│ ├── evolutionary_crucible.py
│ ├── hybrid_modules.py
│ └── llm_integration.py
├── infrastructure/ # Deployment infrastructure
│ └── deployment_infrastructure.py
├── scripts/ # Utility scripts
│ ├── demo.py
│ └── generate_tasks.py
├── config/ # Configuration files
│ ├── config.json
│ ├── dev_config.json
│ └── prod_config.json
└── tests/ # Test scripts and utilities
├── test_distributed.py
├── test_evolutionary.py
├── test_hybrid_reasoning.py
├── test_inner_loop.py
├── test_integration.py
└── test_middle_loop.py
Getting Started
Running the System
For development mode:
python -m mrce.scripts.demo --mode=dev
For production mode:
python -m mrce.scripts.demo --mode=prod --config=config/prod_config.json
Deployment
Container Build
Build container images for all components:
python -m mrce.infrastructure.deployment_infrastructure build --components=all
Kubernetes Deployment
Deploy to Kubernetes:
python -m mrce.infrastructure.deployment_infrastructure deploy --environment=production
Core Modules
Memory System
The memory system provides a multi-tiered architecture for storing different types of information:
from mrce.core.memory import Memory
# Initialize memory system
memory = Memory(vector_dim=1024)
# Store experience in episodic memory
memory.episodic.add(observation, embedding)
# Store concept in semantic memory
memory.semantic.add_node("concept", {"attributes": {...}})
# Store procedure
memory.procedural.store("action_sequence", [action1, action2])
Cognitive Loops
The three cognitive loops provide different levels of processing:
from mrce.core.inner_loop import InnerLoop
from mrce.core.middle_loop import MiddleLoop
from mrce.core.outer_loop import OuterLoop
# Initialize loops
inner = InnerLoop(memory)
middle = MiddleLoop(memory, inner)
outer = OuterLoop(memory, middle)
# Process input through the hierarchy
result = inner.process(observation)
reflection = middle.reflect(result)
redesign = outer.evaluate(reflection)
Modules
Core System:
mrce.core.memory: Multi-tiered memory system.mrce.core.inner_loop: Fast execution loop with NeuralGroundingCore.mrce.core.middle_loop: Reflection loop with MetaCritic.mrce.core.outer_loop: Self-redesign loop with MetacognitiveAbstractionLayer.mrce.core.igvam: Value alignment module.mrce.core.agents: Multi-agent coordination.mrce.core.environment: Simulation environment.
Production Modules:
mrce.production.consensus: Distributed consistency with Raft protocol.mrce.production.security_governance: Causal Integrity Watchdog and audit system.mrce.production.performance_optimization: Optimized data flow and resource monitoring.mrce.production.logging_metrics: Structured logging framework and metrics.mrce.production.production_monitoring: Comprehensive monitoring, alerts and distributed tracing.mrce.infrastructure.deployment_infrastructure: Containerization and Kubernetes integration.
Advanced Modules:
mrce.advanced.db_memory: Persistent database storage adapters.mrce.advanced.distributed_agents: Ray-based distributed agent system.mrce.advanced.llm_integration: Enhanced LLM capabilities using OpenAI API.mrce.advanced.hybrid_modules: Symbolic, logical, and quantum-inspired reasoning.mrce.advanced.evolutionary_crucible: Self-play architecture improvement.
Utility Scripts:
mrce.scripts.demo: Demonstration script for the MRCE+ system.mrce.scripts.generate_tasks: Task generation for system evaluation and testing.
Production Features
IGVAM Module
The IGVAM module ensures alignment with specified goals and values:
from mrce.core.igvam import IGVAM
# Initialize IGVAM
igvam = IGVAM(goals, values)
# Filter actions
valid_actions = igvam.filter_actions(proposed_actions)
# Check compliance
compliance_score = igvam.measure_compliance(action)
Distributed Consistency
from mrce.production.consensus import RaftProtocol, TransactionManager
# Initialize consensus protocol
raft = RaftProtocol(node_id, nodes)
# Create transaction
with TransactionManager(memory) as tx:
# Perform operations atomically
tx.episodic.add(observation, embedding)
tx.semantic.add_relation("A", "B", "causes")
Security Governance
from mrce.production.security_governance import CausalIntegrityWatchdog, AuditTrail
# Initialize security components
watchdog = CausalIntegrityWatchdog(base_constraints)
audit = AuditTrail()
# Validate changes
is_valid, details = watchdog.validate(proposed_change, current_state)
# Record audit event
audit.record_event("system_modification", {
"component": "memory",
"change": "schema_update"
})
Performance Optimization
from mrce.production.performance_optimization import OptimizedDataFlow, ResourceMonitor
# Initialize performance components
data_flow = OptimizedDataFlow()
monitor = ResourceMonitor()
# Register resources
data_flow.register_resource("memory", max_allocation=8000)
# Submit operation with priority
operation_id, completion = data_flow.submit_operation(
operation_fn=process_task,
resources={"memory": 1000, "cpu": 2},
priority=10
)
Production Monitoring
from mrce.production.logging_metrics import LoggingFramework, MetricsCollector
from mrce.production.production_monitoring import DistributedTracer
# Initialize monitoring components
logger = LoggingFramework("mrce", "memory_service")
metrics = MetricsCollector("mrce")
tracer = DistributedTracer("memory_service", logger)
# Log events with context
logger.info("Processing request", {"request_id": req_id})
# Record metrics
metrics.gauge("memory_usage", memory_mb, {"service": "memory"})
metrics.counter("requests_processed")
# Distributed tracing
with tracer.start_trace("process_request") as span:
# Add events
tracer.add_event("starting_processing", {"request_id": req_id})
# Execute operation
result = process_request(req_id)
Implementation
The current implementation includes:
- Complete modular codebase with all core and production components
- Memory backends with FAISS, NetworkX, and JSON
- Raft consensus protocol for distributed consistency
- Causal Integrity Watchdog for immutable safety guarantees
- Optimized data flow with adaptive resource management
- Production-ready monitoring with logging, metrics, alerts and tracing
- Containerization and Kubernetes deployment capabilities
- Blue/green deployment with rolling updates
Future Expansions
- Advanced federated learning across distributed agents
- Enhanced causal reasoning with counterfactual evaluation
- Quantum-inspired optimization for resource allocation
- Privacy-preserving computation with homomorphic encryption
- Edge deployment with WebAssembly integration
- Cross-platform clients for mobile and embedded devices
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mrce_plus-1.0.0.tar.gz.
File metadata
- Download URL: mrce_plus-1.0.0.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b419237a8cbcaad4522aba408e34d93031f91050d3a37662ecffb891cc05b280
|
|
| MD5 |
205153a5dd9ef1ded26e3e61ed5692c4
|
|
| BLAKE2b-256 |
c3ee718271f4bdd1e8782d49b20ff3e8f1c72342d919bfc8693291b1e95c74e9
|
File details
Details for the file mrce_plus-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mrce_plus-1.0.0-py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd9e627afe90f1c042bf10018883b3529406055beb8bd921231d3c9ee5e78e41
|
|
| MD5 |
bb176840847667dc83591abaea1cb919
|
|
| BLAKE2b-256 |
8b07f6f331fc13cccac8eb8a5630dc26f8004128592f144d7560255d507207e7
|