dual-loop-controller 2.5.0__tar.gz → 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. {dual_loop_controller-2.5.0/dual_loop_controller.egg-info → dual_loop_controller-3.0.0}/PKG-INFO +13 -13
  2. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/README.md +10 -7
  3. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/README_PYPI.md +11 -11
  4. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/__init__.py +40 -5
  5. dual_loop_controller-3.0.0/dual_loop/adapters/universal_adapter.py +433 -0
  6. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/cli.py +38 -16
  7. dual_loop_controller-3.0.0/dual_loop/cognitive_os.py +224 -0
  8. dual_loop_controller-3.0.0/dual_loop/firewall.py +215 -0
  9. dual_loop_controller-3.0.0/dual_loop/sleep_consolidation.py +225 -0
  10. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0/dual_loop_controller.egg-info}/PKG-INFO +13 -13
  11. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop_controller.egg-info/SOURCES.txt +6 -1
  12. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/pyproject.toml +2 -2
  13. dual_loop_controller-3.0.0/tests/test_universal_v3.py +212 -0
  14. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/LICENSE +0 -0
  15. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/__main__.py +0 -0
  16. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/adapters/__init__.py +0 -0
  17. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/adapters/latent_adapter.py +0 -0
  18. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/adapters/qwen_adapter.py +0 -0
  19. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/allostasis.py +0 -0
  20. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/__init__.py +0 -0
  21. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/benchmark_bidirectional_multimodal.py +0 -0
  22. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/benchmark_cross_modal.py +0 -0
  23. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/benchmark_glm4_v24.py +0 -0
  24. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/benchmark_qwen_reasoning.py +0 -0
  25. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/comprehensive_suite.py +0 -0
  26. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/epistemic_plasticity_benchmark.py +0 -0
  27. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/graph_reasoning.py +0 -0
  28. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/halting_audit.py +0 -0
  29. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/initiative_benchmark.py +0 -0
  30. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/large_scale_usecase_benchmark.py +0 -0
  31. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/plot_cross_modal_benchmark.py +0 -0
  32. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/benchmarks/run_20_benchmarks_three_regimes.py +0 -0
  33. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/checkpoints/checkpoint_trained_dualloop.pt +0 -0
  34. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/cognitive_judge.py +0 -0
  35. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/controller.py +0 -0
  36. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/curiosity_daemon.py +0 -0
  37. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/decoder.py +0 -0
  38. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/directional_reservoir.py +0 -0
  39. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/evidential.py +0 -0
  40. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/functorial_engine.py +0 -0
  41. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/halting.py +0 -0
  42. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/homeostasis.py +0 -0
  43. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/matrix_helper.py +0 -0
  44. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/mdl_selector.py +0 -0
  45. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/memory.py +0 -0
  46. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/multimodal_transport.py +0 -0
  47. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/nullspace_engine.py +0 -0
  48. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/open_concept.py +0 -0
  49. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/plasticity.py +0 -0
  50. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/runtime/__init__.py +0 -0
  51. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/runtime/detector.py +0 -0
  52. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/runtime/hf_publisher.py +0 -0
  53. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/self_awareness.py +0 -0
  54. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/topological_cwm.py +0 -0
  55. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/validation/__init__.py +0 -0
  56. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/validation/benchmark_validator.py +0 -0
  57. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop/verification.py +0 -0
  58. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop_controller.egg-info/dependency_links.txt +0 -0
  59. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop_controller.egg-info/entry_points.txt +0 -0
  60. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop_controller.egg-info/requires.txt +0 -0
  61. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/dual_loop_controller.egg-info/top_level.txt +0 -0
  62. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/setup.cfg +0 -0
  63. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_adapter_integration.py +0 -0
  64. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_allostatic_modulation.py +0 -0
  65. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_benchmark_validator.py +0 -0
  66. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_bottleneck_adapter.py +0 -0
  67. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_brain_sandbox.py +0 -0
  68. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_cognitive_judge.py +0 -0
  69. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_curiosity_daemon.py +0 -0
  70. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_directional_reservoir.py +0 -0
  71. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_dual_loop.py +0 -0
  72. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_episodic_self_correction.py +0 -0
  73. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_functorial_mdl.py +0 -0
  74. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_homeostasis.py +0 -0
  75. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_hypothesis_verification.py +0 -0
  76. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_matrix_helper.py +0 -0
  77. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_metacognitive_loop.py +0 -0
  78. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_multimodal_bidirectional.py +0 -0
  79. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_nullspace_engine.py +0 -0
  80. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_plasticity_and_evidential.py +0 -0
  81. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_qwen_adapter.py +0 -0
  82. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_runtime_and_publisher.py +0 -0
  83. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_security_and_runtime.py +0 -0
  84. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_self_awareness.py +0 -0
  85. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_smart_brain_architecture.py +0 -0
  86. {dual_loop_controller-2.5.0 → dual_loop_controller-3.0.0}/tests/test_surprise_and_ddm.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dual-loop-controller
3
- Version: 2.5.0
4
- Summary: A hardware-aligned, manifold-preserving latent deliberation & bidirectional multimodal framework for Transformers
3
+ Version: 3.0.0
4
+ Summary: A unified cognitive operating system with model-agnostic canonical adapters, sleep-phase consolidation, and prefrontal invariant firewalls for Transformers
5
5
  Author: Ch3nOff
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/Ch3nOff/dual-loop-controller
@@ -34,8 +34,8 @@ Dynamic: license-file
34
34
  English | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_id.md">Bahasa Indonesia</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_zh.md">简体中文</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ja.md">日本語</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ko.md">한국어</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_es.md">Español</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_fr.md">Français</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_de.md">Deutsch</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ru.md">Русский</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ar.md">العربية</a>
35
35
  </p>
36
36
 
37
- <h1 align="center">Dual-Loop Cognitive Controller (v2.5.0)</h1>
38
- <h3 align="center">Hardware-Aligned Autopoietic Latent Deliberation, Curiosity-Driven Active Exploration & Bidirectional Multimodal Plasticity</h3>
37
+ <h1 align="center">Dual-Loop Cognitive Controller (v3.0.0)</h1>
38
+ <h3 align="center">Unified Cognitive OS: Model-Agnostic Canonical Projection, Sleep-Phase Consolidation & Prefrontal Invariant Firewalls</h3>
39
39
 
40
40
  <p align="center">
41
41
  <a href="https://pypi.org/project/dual-loop-controller/"><img src="https://img.shields.io/pypi/v/dual-loop-controller.svg?color=blue" alt="PyPI version"></a>
@@ -50,15 +50,12 @@ Dynamic: license-file
50
50
 
51
51
  ## Overview
52
52
 
53
- **Dual-Loop Cognitive Controller (HADL v2.5.0)** is a universal framework that equips standard autoregressive Transformers with hardware-aligned, dual-process System 1 (fast, intuitive) and System 2 (deliberative) cognitive capabilities, plus native bidirectional multimodal synthesis without token overhead or KV-cache explosion.
54
-
55
- ### What's New in v2.5.0:
56
- * **Bidirectional Hetero-Associative Plasticity ($M_{cross}$ & $M_{cross}^T$)**: Native two-way translation between text and sensory (photo/audio) latents. Performs **1-Shot In-situ Hebbian Binding** in fast weights ($<0.05\text{ ms}$) and **Text $\to$ Sensory Mental Imagery in $1.4\text{ ms}$** without external diffusion models!
57
- * **Universal Procrustes Manifold Transport**: Closed-form affine optimal transport that aligns out-of-distribution visual/audio covariances into the text tangent space ($\mathcal{O}(D)$ algebra, $<0.1\text{ ms}$).
58
- * **Spatio-Temporal Entropic CWM**: Compresses 256 visual patches or 128 audio frames into 16 topological working memory slots (93.8% KV-cache reduction), preventing Token Explosion.
59
- * **Allostatic Energy Modulation**: Unified scalar energy potential $\Gamma_{allostatic} \in [0.40, 0.95]$ guaranteeing **sub-5ms fast-path execution** (streaming bypass: **7.8 $\mu$s**).
60
- * **Autonomous Curiosity Daemon Loop**: Background contemplation during idle intervals with Popperian self-play and orthogonal nullspace memory consolidation.
61
- * **100% Frozen Backbone**: Zero base weight gradient updates. Seamlessly hooks into Qwen, LLaMA, Mistral, and GLM-4.
53
+ **Dual-Loop Cognitive Controller (HADL v3.0.0 Unified Cognitive OS)** is an open-source, model-agnostic cognitive framework that upgrades ANY autoregressive Transformer into an autonomous dual-process system with 5 Computational Brain Organs:
54
+ 1. **Universal Model-Agnostic Adapter**: Dynamic Runtime Graph Introspection (`DynamicGraphIntrospector`) discovers layer containers and hooks automatically across Qwen, LLaMA, Mistral, Gemma, GLM-4, and custom architectures. Standardizes latent deliberation onto a **Canonical Manifold** ($\mathbb{R}^{D_{native}} \to \mathbb{R}^{1024} \to \mathbb{R}^{D_{native}}$) with strict mathematical ReZero Identity Preservation ($\Delta_{init} \equiv 0$).
55
+ 2. **vLLM & TensorRT High-Throughput Ready**: Pure branchless tensor arithmetic with 100% CUDA-Graph safety, zero Python runtime branches in the hot-path, and native support for both 3D $[B, S, D]$ and 2D $[N, D_{native}]$ flat batch tensor formats.
56
+ 3. **Sleep-Phase Consolidation Engine (Organ 4)**: Offline memory replay translating waking Hebbian fast weights ($M_{fast}$) into permanent LoRA parameters via truncated SVD low-rank distillation and QR nullspace orthogonalization ($0.000000$ knowledge interference leakage).
57
+ 4. **Sheaf-Theoretic Invariant Firewall (Organ 5)**: Sub-0.05ms prefrontal executive inhibition computing cohomological obstructions to clamp explosive gradients, suppress Dirichlet vacuous hallucinations, and prevent instruction corruption.
58
+ 5. **Bidirectional Multimodal Plasticity**: Native two-way translation between text and sensory (photo/audio) latents with 1-shot in-situ Hebbian binding.
62
59
 
63
60
  ---
64
61
 
@@ -142,6 +139,9 @@ hadl validate-benchmark eval_results
142
139
 
143
140
  # Execute single autonomous background contemplation cycle
144
141
  hadl daemon-step --slots 6 --d-model 128
142
+
143
+ # Execute offline sleep-phase consolidation replay and SVD distillation
144
+ hadl sleep-cycle --episodes 10 --rank 16
145
145
  ```
146
146
 
147
147
  ---
@@ -2,8 +2,8 @@
2
2
  English | <a href="docs/README_id.md">Bahasa Indonesia</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_zh.md">简体中文</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ja.md">日本語</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ko.md">한국어</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_es.md">Español</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_fr.md">Français</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_de.md">Deutsch</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ru.md">Русский</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ar.md">العربية</a>
3
3
  </p>
4
4
 
5
- <h1 align="center">Dual-Loop Cognitive Controller (HADL v2.5.0)</h1>
6
- <h3 align="center">Hardware-Aligned Autopoietic Latent Deliberation, Curiosity-Driven Active Exploration & Bidirectional Multimodal Plasticity</h3>
5
+ <h1 align="center">Dual-Loop Cognitive Controller (HADL v3.0.0)</h1>
6
+ <h3 align="center">Unified Cognitive OS: Model-Agnostic Canonical Projection, Sleep-Phase Consolidation & Prefrontal Invariant Firewalls</h3>
7
7
 
8
8
  <p align="center">
9
9
  <a href="https://pypi.org/project/dual-loop-controller/"><img src="https://img.shields.io/pypi/v/dual-loop-controller.svg?color=blue" alt="PyPI version"></a>
@@ -12,7 +12,7 @@
12
12
  <a href="https://huggingface.co/spaces/CH3NDev/dual-loop-controller-demo"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces%20Live%20Demo-blue.svg" alt="Hugging Face Spaces"></a>
13
13
  <a href="https://huggingface.co/CH3NDev/dual-loop-qwen3.5-2b"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Adapter%20Weights-yellow.svg" alt="Hugging Face"></a>
14
14
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
15
- <a href="tests/"><img src="https://img.shields.io/badge/tests-109%20passed%20(100%25)-brightgreen.svg" alt="Unit Tests"></a>
15
+ <a href="tests/"><img src="https://img.shields.io/badge/tests-134%20passed%20(100%25)-brightgreen.svg" alt="Unit Tests"></a>
16
16
  <a href="#fast-path-inference"><img src="https://img.shields.io/badge/streaming%20bypass-0.0078%20ms%20(sub--5ms)-blueviolet.svg" alt="Sub-5ms Latency"></a>
17
17
  <a href="#orthogonal-nullspace-projection"><img src="https://img.shields.io/badge/nullspace%20overlap-0.000000%20(zero%20interference)-success.svg" alt="Zero Overlap"></a>
18
18
  </p>
@@ -21,11 +21,14 @@
21
21
 
22
22
  ---
23
23
 
24
- ## 🏛️ System Architecture v2.4.0: The Autopoietic Dual-Process Engine
24
+ ## 🏛️ System Architecture v3.0.0: The Unified Cognitive OS
25
25
 
26
- In **v2.4.0**, the Dual-Loop Cognitive Controller resolves two long-standing challenges in artificial reasoning:
27
- 1. **The Clock Coupling Bottleneck**: Conventional LLMs are passive autoregressive engines $P(Y \mid X)$ that only compute when user prompts arrive. HADL decouples inference from the user clock via an **Autonomous Background Curiosity Daemon** that actively inspects memory, detects contradictions, and refines hypotheses during idle intervals.
28
- 2. **Gate Cascade Collapse & Signal Vanishing**: Naive multiplicative cascades ($g_1 \cdot g_2 \dots g_5$) exponentially suppress latent deltas to near zero ($<0.15$). v2.4.0 introduces **Consolidated Allostatic Energy Modulation**, evaluating homeostasis, surprise, vacuity, and drift in a unified energy-logit potential ($\Gamma_{allostatic} \in [0.40, 0.95]$), ensuring continuous non-zero gradients and guaranteeing **sub-5ms fast-path execution** (streaming bypass: **0.0078 ms / 7.8 $\mu$s**).
26
+ In **v3.0.0**, the Dual-Loop Cognitive Controller transitions into a **Unified Cognitive Operating System** resolving structural bottlenecks across LLMs and VLMs via 5 Computational Brain Organs:
27
+ 1. **Dynamic Runtime Graph Introspection (`DynamicGraphIntrospector`) & Canonical Projection**: Unifies all model families (Qwen, LLaMA, Mistral, Gemma, GLM-4) by mapping native representations into a standardized canonical deliberation space $\mathbb{R}^{D_{native}} \to \mathbb{R}^{1024} \to \mathbb{R}^{D_{native}}$ with strict ReZero Identity Preservation ($\Delta_{init} \equiv 0$).
28
+ 2. **vLLM & TensorRT Inference Compatibility**: Pure branchless tensor arithmetic with 100% CUDA-Graph safety, zero dynamic Python dispatch, and native support for 2D $[N, D_{native}]$ flat tensors.
29
+ 3. **Sleep-Phase Consolidation Engine (Organ 4)**: Offline replay translating waking Hebbian fast weights ($M_{fast}$) into permanent LoRA parameters via truncated SVD low-rank distillation and QR nullspace orthogonalization ($0.000000$ interference leakage).
30
+ 4. **Sheaf-Theoretic Invariant Firewall (Organ 5)**: Sub-0.05ms prefrontal executive inhibition enforcing topological invariants against norm explosions, epistemic vacuity, and instruction corruption.
31
+ 5. **Bidirectional Multimodal Plasticity**: Native two-way translation between text and sensory (photo/audio) latents with 1-shot in-situ Hebbian binding.
29
32
 
30
33
  ![Dual-Loop v2.4.0 Complete Architecture Diagram](hadl_v24_system_architecture.png)
31
34
 
@@ -2,8 +2,8 @@
2
2
  English | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_id.md">Bahasa Indonesia</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_zh.md">简体中文</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ja.md">日本語</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ko.md">한국어</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_es.md">Español</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_fr.md">Français</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_de.md">Deutsch</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ru.md">Русский</a> | <a href="https://github.com/Ch3nOff/dual-loop-controller/blob/main/docs/README_ar.md">العربية</a>
3
3
  </p>
4
4
 
5
- <h1 align="center">Dual-Loop Cognitive Controller (v2.5.0)</h1>
6
- <h3 align="center">Hardware-Aligned Autopoietic Latent Deliberation, Curiosity-Driven Active Exploration & Bidirectional Multimodal Plasticity</h3>
5
+ <h1 align="center">Dual-Loop Cognitive Controller (v3.0.0)</h1>
6
+ <h3 align="center">Unified Cognitive OS: Model-Agnostic Canonical Projection, Sleep-Phase Consolidation & Prefrontal Invariant Firewalls</h3>
7
7
 
8
8
  <p align="center">
9
9
  <a href="https://pypi.org/project/dual-loop-controller/"><img src="https://img.shields.io/pypi/v/dual-loop-controller.svg?color=blue" alt="PyPI version"></a>
@@ -18,15 +18,12 @@
18
18
 
19
19
  ## Overview
20
20
 
21
- **Dual-Loop Cognitive Controller (HADL v2.5.0)** is a universal framework that equips standard autoregressive Transformers with hardware-aligned, dual-process System 1 (fast, intuitive) and System 2 (deliberative) cognitive capabilities, plus native bidirectional multimodal synthesis without token overhead or KV-cache explosion.
22
-
23
- ### What's New in v2.5.0:
24
- * **Bidirectional Hetero-Associative Plasticity ($M_{cross}$ & $M_{cross}^T$)**: Native two-way translation between text and sensory (photo/audio) latents. Performs **1-Shot In-situ Hebbian Binding** in fast weights ($<0.05\text{ ms}$) and **Text $\to$ Sensory Mental Imagery in $1.4\text{ ms}$** without external diffusion models!
25
- * **Universal Procrustes Manifold Transport**: Closed-form affine optimal transport that aligns out-of-distribution visual/audio covariances into the text tangent space ($\mathcal{O}(D)$ algebra, $<0.1\text{ ms}$).
26
- * **Spatio-Temporal Entropic CWM**: Compresses 256 visual patches or 128 audio frames into 16 topological working memory slots (93.8% KV-cache reduction), preventing Token Explosion.
27
- * **Allostatic Energy Modulation**: Unified scalar energy potential $\Gamma_{allostatic} \in [0.40, 0.95]$ guaranteeing **sub-5ms fast-path execution** (streaming bypass: **7.8 $\mu$s**).
28
- * **Autonomous Curiosity Daemon Loop**: Background contemplation during idle intervals with Popperian self-play and orthogonal nullspace memory consolidation.
29
- * **100% Frozen Backbone**: Zero base weight gradient updates. Seamlessly hooks into Qwen, LLaMA, Mistral, and GLM-4.
21
+ **Dual-Loop Cognitive Controller (HADL v3.0.0 Unified Cognitive OS)** is an open-source, model-agnostic cognitive framework that upgrades ANY autoregressive Transformer into an autonomous dual-process system with 5 Computational Brain Organs:
22
+ 1. **Universal Model-Agnostic Adapter**: Dynamic Runtime Graph Introspection (`DynamicGraphIntrospector`) discovers layer containers and hooks automatically across Qwen, LLaMA, Mistral, Gemma, GLM-4, and custom architectures. Standardizes latent deliberation onto a **Canonical Manifold** ($\mathbb{R}^{D_{native}} \to \mathbb{R}^{1024} \to \mathbb{R}^{D_{native}}$) with strict mathematical ReZero Identity Preservation ($\Delta_{init} \equiv 0$).
23
+ 2. **vLLM & TensorRT High-Throughput Ready**: Pure branchless tensor arithmetic with 100% CUDA-Graph safety, zero Python runtime branches in the hot-path, and native support for both 3D $[B, S, D]$ and 2D $[N, D_{native}]$ flat batch tensor formats.
24
+ 3. **Sleep-Phase Consolidation Engine (Organ 4)**: Offline memory replay translating waking Hebbian fast weights ($M_{fast}$) into permanent LoRA parameters via truncated SVD low-rank distillation and QR nullspace orthogonalization ($0.000000$ knowledge interference leakage).
25
+ 4. **Sheaf-Theoretic Invariant Firewall (Organ 5)**: Sub-0.05ms prefrontal executive inhibition computing cohomological obstructions to clamp explosive gradients, suppress Dirichlet vacuous hallucinations, and prevent instruction corruption.
26
+ 5. **Bidirectional Multimodal Plasticity**: Native two-way translation between text and sensory (photo/audio) latents with 1-shot in-situ Hebbian binding.
30
27
 
31
28
  ---
32
29
 
@@ -110,6 +107,9 @@ hadl validate-benchmark eval_results
110
107
 
111
108
  # Execute single autonomous background contemplation cycle
112
109
  hadl daemon-step --slots 6 --d-model 128
110
+
111
+ # Execute offline sleep-phase consolidation replay and SVD distillation
112
+ hadl sleep-cycle --episodes 10 --rank 16
113
113
  ```
114
114
 
115
115
  ---
@@ -5,7 +5,7 @@ A hardware-aligned, manifold-preserving latent reasoning framework
5
5
  for Transformer architectures.
6
6
  """
7
7
 
8
- from .memory import CognitiveWorkingMemory
8
+ from .memory import CognitiveWorkingMemory, EpisodicMemoryBuffer
9
9
  from .halting import EntropyHaltingUnit, LearnedHaltingGate, DriftDiffusionHalting
10
10
  from .controller import RecurrentLatentController, TopKCapacityCrossAttention, LatentCritiqueRefinementUnit
11
11
  from .plasticity import PlasticFastWeightUnit
@@ -46,15 +46,35 @@ from .adapters.qwen_adapter import (
46
46
  attach_dual_loop_to_glm4,
47
47
  attach_dual_loop_to_glm
48
48
  )
49
+ from .adapters.universal_adapter import (
50
+ UniversalDualLoopAdapter,
51
+ UniversalDualLoopModelWrapper,
52
+ DynamicGraphIntrospector,
53
+ attach_universal_dual_loop,
54
+ CANONICAL_DIM
55
+ )
56
+ from .firewall import (
57
+ SheafInvariantFirewall,
58
+ BoundedNormInvariant,
59
+ DirectionalStabilityInvariant,
60
+ DirichletVacuityInvariant,
61
+ CodeExecutionIntegrityInvariant
62
+ )
63
+ from .sleep_consolidation import SleepPhaseConsolidationEngine, SleepMemoryEpisode
64
+ from .cognitive_os import (
65
+ UnifiedCognitiveOS,
66
+ CognitiveConflictEvaluator,
67
+ VitalStateVector
68
+ )
49
69
 
50
- # Convenient shorthand alias for users
51
- attach = attach_dual_loop
70
+ # Convenient shorthand alias for users: default to Universal Adapter in v3.0!
71
+ attach = attach_universal_dual_loop
52
72
 
53
73
  import os
54
74
  import torch
55
75
  from typing import Optional
56
76
 
57
- __version__ = "2.5.0"
77
+ __version__ = "3.0.0"
58
78
 
59
79
  def get_default_checkpoint_path() -> Optional[str]:
60
80
  """
@@ -95,6 +115,7 @@ def load_trained_checkpoint(model: Optional[DualLoopTransformer] = None, checkpo
95
115
 
96
116
  __all__ = [
97
117
  "CognitiveWorkingMemory",
118
+ "EpisodicMemoryBuffer",
98
119
  "EntropyHaltingUnit",
99
120
  "LearnedHaltingGate",
100
121
  "DriftDiffusionHalting",
@@ -121,7 +142,21 @@ __all__ = [
121
142
  "PopperianSelfPlayEngine",
122
143
  "AutonomousDaemonController",
123
144
  "DualLoopQwenModel",
124
- "DualLoopTransformerModel",
145
+ "UniversalDualLoopAdapter",
146
+ "UniversalDualLoopModelWrapper",
147
+ "DynamicGraphIntrospector",
148
+ "attach_universal_dual_loop",
149
+ "CANONICAL_DIM",
150
+ "SheafInvariantFirewall",
151
+ "BoundedNormInvariant",
152
+ "DirectionalStabilityInvariant",
153
+ "DirichletVacuityInvariant",
154
+ "CodeExecutionIntegrityInvariant",
155
+ "SleepPhaseConsolidationEngine",
156
+ "SleepMemoryEpisode",
157
+ "UnifiedCognitiveOS",
158
+ "CognitiveConflictEvaluator",
159
+ "VitalStateVector",
125
160
  "attach_dual_loop_to_qwen",
126
161
  "attach_dual_loop",
127
162
  "attach",