Skip to content

Releases: JosephOIbrahim/Harlo

v9.0.0 — Cognitive State Machine + Production Engine

30 Mar 17:52

Choose a tag to compare

v9.0.0 — Cognitive State Machine + Production Engine

Complete v8→v9 rewrite across 5 sprints. Harlo now models how you think — not what you said — via a real-time cognitive state machine with XGBoost prediction, Hydra-style capability-matched delegates, and real USD .usda persistence. Production-hardened with independent failure isolation.


Sprint 1: Cognitive State Machine Simulation (84 tests)

  • 5 interlinked state machines: Momentum (CRASHED→PEAK), Burnout (GREEN→RED), Energy (DEPLETED→HIGH), Burst (5-phase hyperfocus lifecycle), Allostasis (6-weight composite)
  • Pydantic schemas with IntEnum ordinal types + CognitiveObservation canonical telemetry block
  • MockCogExec: networkx DAG with topological evaluation (7 pure computation nodes)
  • Pure computation functions: momentum, burnout, energy, burst, allostasis, injection_gain, context_budget, routing
  • Adrenaline masking: energy suspends during burst, debt accumulates and applies on exit
  • Anchor immunity: injection gain = 1.0 ALWAYS (structurally enforced, separate function)
  • 26-invariant validator (INV-01 to INV-26, RED exception for INV-14)
  • Trajectory generator: 10,000 sessions, 278,577 exchanges, 0 invariant violations, Profile-Driven Markov Biasing (7 profiles)
  • XGBoost MultiOutputRegressor: 111 features per 3-step sliding window, 4 targets, 100% per-field accuracy on synthetic data
  • Bridge: 50-exchange end-to-end with delegate + observation buffer + predictor

Sprint 2: USD 26 OpenExec Build (Circuit Breaker)

  • USD 26.03 built from source with PXR_BUILD_EXEC=ON on Windows
  • C++ Exec libraries compiled (usd_exec.dll, usd_execGeom.dll, usd_execIr.dll, usd_execUsd.dll)
  • Circuit breaker triggered: Zero Python bindings in v26.03 source — MockCogExec continues as production evaluator
  • Architecture remains OpenExec-native for future swap when Pixar ships Python bindings

Sprint 3: Hydra Cognitive Delegates + Live MCP (85 tests)

  • HdCognitiveDelegate ABC: Sync / Execute / CommitResources
  • HdClaude (interactive reasoning) + HdClaudeCode (batch implementation) — two concrete delegates
  • DelegateRegistry: capability-matching selection (DAG outputs WHAT, registry selects WHO)
  • compute_routing: outputs capability requirements, NOT delegate names
  • OOB consent tokens: HMAC-signed, TTL-limited, revocable, application-layer only
  • Sublayer-per-delegate concurrency: each delegate writes to isolated .usda, composed via LIVRPS (interactive wins)
  • CognitiveEngine singleton: 7-step exchange pipeline (Author→Evaluate→Route→Delegate→Observe→Predict→Save)
  • 20-exchange end-to-end live test with full pipeline

Sprint 4: Real USD Stage — Backend Swap (59 tests)

  • CognitiveStage: drop-in replacement wrapping pxr.Usd.Stage (real USD 26.03)
  • Real .usda files on disk: data/stages/cognitive_twin.usda + delegate sublayers
  • Time samples via Usd.TimeCode(exchange_index) — human-readable timeline
  • stage_factory: USE_REAL_USD env var toggle, unified interface
  • Backend parity verified: mock = real USD produce identical state transitions
  • In-memory mode (Usd.Stage.CreateInMemory()) for test isolation

Sprint 5: Production Hardening & Verification (22 tests)

  • Graceful degradation: 7 independent failure modes, each with fallback
  • Health check endpoint: engine.get_health() with full component status
  • Kill switches: ENGINE_ENABLED, USE_REAL_USD, OBSERVATION_LOGGING, PREDICTION_ENABLED
  • First session verified: 10 exchanges, real .usda on disk, predictions flowing
  • 458 organic observations collected
  • MCP server NEVER crashes from engine failure

Key Architectural Patterns

Pattern Description
Pure function computations All 7 nodes read from authored history (t-1), compute deterministically, return new state
Capability-requirement decoupling DAG → requirements → DelegateRegistry → implementation
Sublayer composition Per-delegate .usda files, LIVRPS resolution (interactive wins)
Ordinal state encoding Progressive states as integers for XGBoost compatibility
Adrenaline masking Energy suspends during burst, debt accumulates
Hysteresis gates Context budget promote >4.2x / demote <3.8x (no thrashing)
Anchor immunity Injection gain structurally 1.0, separate function
Independent failure isolation Every component fails without cascading

MCP Tools (8 total, unchanged from v8)

Tool Description
twin_store Hot Tier zero-encoding store
twin_recall Warm Tier SDR search
query_past_experience Federated Hot+Warm recall
twin_coach System prompt projection
twin_patterns Pattern detection
twin_session_status Session lifecycle
resolve_verifications Actor-side Elenchus deferral
trigger_cognitive_recalibration Intake/trust reset

By the Numbers

Metric Value
Sprint-specific tests 250
Total Python tests 1,067
Rust tests (hippocampus) 41
Total tests 1,108
New Python modules (src/) 29
New LOC (src/) ~3,874
State machines 5
Invariants enforced 26
Computation nodes 8
Delegates 2
Kill switches 4
Failure modes with fallback 7
Synthetic trajectories 10,000
Synthetic exchanges 278,577
Organic observations 458
Invariant violations 0

New Modules

src/
├── schemas.py                    # Pydantic ordinal state types
├── mock_usd_stage.py             # Dict-based USD mock
├── mock_cogexec.py               # networkx DAG evaluator
├── cognitive_stage.py            # Real pxr.Usd.Stage wrapper
├── cognitive_engine.py           # 7-step exchange pipeline
├── stage_factory.py              # USD backend toggle
├── usd_bootstrap.py              # USD 26.03 path/DLL setup
├── engine_config.py              # Kill switches + paths
├── bridge.py                     # End-to-end orchestration
├── delegate_base.py              # HdCognitiveDelegate ABC
├── delegate_claude.py            # Interactive reasoning delegate
├── delegate_claude_code.py       # Batch implementation delegate
├── delegate_registry.py          # Capability-matching selection
├── consent.py                    # OOB HMAC-signed consent tokens
├── observation_buffer.py         # SQLite priority queue
├── predict.py                    # XGBoost 3-step window inference
├── train_predictor.py            # XGBoost training pipeline
├── trajectory_generator.py       # 10K session Markov generator
├── validator.py                  # 26 invariant enforcement
└── computations/
    ├── compute_momentum.py       # State transition logic
    ├── compute_burnout.py        # Frustration accumulation
    ├── compute_energy.py         # Adrenaline masking
    ├── compute_burst.py          # Hyperfocus lifecycle
    ├── compute_allostasis.py     # 6-weight composite
    ├── compute_injection_gain.py # Anchor immunity
    ├── compute_context_budget.py # Hysteresis promotion
    └── compute_routing.py        # Capability requirements

Documentation Added

  • docs/PRODUCTION.md — deployment config, kill switches, health check, graceful degradation
  • INSTALL.md — full installation guide (Python 3.12, USD 26.03, Rust, ONNX)
  • docs/patent/ — CIP evidence (P1_CIP_EVIDENCE.md, P1_CIP_FIGURES.md, P1_CIP_TEST_EVIDENCE.txt)
  • docs/OPENEXEC_BUILD.md — USD 26.03 build-from-source instructions

Patent Evidence

Three patent applications supported by Sprint 1-5 implementation:

  1. USD-native cognitive state composition — LIVRPS-ordered sublayer resolution with capability-matched delegates
  2. Digital injection framework — Pharmacokinetic-modeled behavior modulation with anchor immunity
  3. Predictive cognitive modeling — XGBoost prediction from Profile-Driven Markov Biasing trajectories

Breaking Changes

  • Version lineage: v3.3.1 legacy numbering → v9.0.0 (follows v6→v7→v8 architecture lineage)
  • src/ directory added with cognitive state machine modules (does not conflict with python/cognitive_twin/)
  • New dependencies: networkx, xgboost, scikit-learn, joblib

Built from the inside out. Body-first. Coach energy, always.
v9.0.0 — COGNITIVE STATE MACHINE + PRODUCTION ENGINE

v8.0.0 — Actor/Observer Disaggregation + Hot/Warm Tiered Memory

17 Mar 19:10

Choose a tag to compare

v8.0.0 — Actor/Observer Disaggregation + Hot/Warm Tiered Memory

Complete v7 → v8 architectural rewrite. The Actor (LLM) reasons. The Observer (Twin) stores and projects. No local LLM required.

7 phases completed

  1. Encoding & Hot Path — Zero-encoding Hot Tier (SQLite + FTS5, <0.2ms store p99), ONNX Runtime encoder (BGE-small CLS pooling, Hamming correlation >= 0.95), Hot→Warm promotion pipeline
  2. Disaggregation — Killed twin_ask, removed ANTHROPIC_API_KEY from MCP server, built Observer + Coach
  3. Trust & Cognitive Profile — Continuous [0.0, 1.0] Trust Ledger with 3-tier gating, trigger_cognitive_recalibration tool
  4. Aletheia Deferral — Pending verification queue, Actor-side resolve_verifications tool
  5. Temporal Compaction — Replay-then-archive with decay commutation invariant
  6. Federated Recallquery_past_experience merges Hot (FTS5) + Warm (SDR Hamming) search
  7. Test Suite + SLAs — Latency enforcement (store <2ms, FTS5 <2ms, Coach <10ms)

MCP Tools (8 total)

Tool Status
twin_store Modified — Hot Tier, zero-encoding
twin_recall Kept — warm-tier SDR search
query_past_experience New — federated Hot+Warm
twin_coach New — system prompt projection
twin_patterns Kept
twin_session_status Kept
resolve_verifications New — Actor-side Aletheia
trigger_cognitive_recalibration New — intake/trust reset
twin_ask Deleted

By the numbers

  • 791 tests, 0 failures
  • 27 test modules
  • 8 MCP tools (was 5)
  • 0 LLM dependencies in MCP server (was 1)
  • <0.2ms store latency (p99)
  • = 0.95 Hamming correlation (ONNX vs reference encoder)

Breaking changes

  • twin_ask removed
  • twin_store response format changed: {status: "stored", tier: "hot", encoded: false}
  • ANTHROPIC_API_KEY no longer required by MCP server
  • New dependencies: onnxruntime>=1.17, transformers>=4.36

v7.0.0 — USD Brain Housing + Brainstem + Hebbian Neuroplasticity

16 Mar 16:08

Choose a tag to compare

Copy everything below the line and paste it into the GitHub release description box:


A complete v6 → v7 architectural rewrite: biologically-architected AI memory with USD-inspired composition, lossless brainstem translation, and Hebbian neuroplasticity. Informed by 2026 frontier research (Titans, Mnemis, SSGM, REMem, HiMem, LoCoMo-Plus) plus neuropsych-informed cognitive profile calibration.

Architecture Highlights

  • USD-Lite Container Format — 17 typed prim dataclasses with .usda serialization, LIVRPS composition, and hex-packed SDR encoding (512-char strings, not 6KB arrays)
  • Brainstem Translation Layer — Lossless adapter pairs with Hypothesis property-based fidelity proofs; Z-score surprise metric drives dual-process routing (System 1 fast / System 2 deliberative)
  • Hebbian Neuroplasticity — Dual-mask SDR evolution (base | strengthen) & ~weaken, homeostatic plasticity [3%-5%], episodic context reconstruction with reconsolidation boost
  • Cognitive Profile Intake — Adaptive neuropsych-informed questionnaire with continuous [0.0, 1.0] scoring and semantic ceiling detection
  • Incremental Skills Observer — Cursor-based O(new_traces) competence tracking, ghost-window safe
  • Aletheia Training Data Pipeline — JSONL output with full cognitive profile feature vectors, O(1) amortized log rotation
  • Structured Provenance — 5 source types with deterministic hashing

By the Numbers

Metric Value
Tests 761 (720 Python + 41 Rust), all passing
Test modules 20 across all subsystems
Prim dataclasses 17 in USD-Lite container
MCP tools 5 (twin_recall, twin_store, twin_ask, twin_patterns, twin_session_status)
Architectural rules 33 inviolable, enforced by tests
Specification patches 11 (Gemini-reviewed)
Implementation phases 5

Install

git clone https://github.com/JosephOIbrahim/cognitive-twin.git && cd cognitive-twin
python -m venv .venv && source .venv/bin/activate   # or .venv\Scripts\activate on Windows
pip install -e .
pip install anthropic sentence-transformers

# Optional: build Rust hot path for <2ms recall
pip install maturin && maturin develop -r

export ANTHROPIC_API_KEY="sk-ant-..."
python -m cognitive_twin.cli.main ask "What patterns do you notice in my recent traces?"