| # ODFS — Ontological Drift & Form System |
|
|
| > **Cognitive Orchestration Layer for Agentic AI** |
| > A field-theoretic runtime that gives AI agents identity, memory, and self-correction. |
|
|
| --- |
|
|
| ## What is ODFS? |
|
|
| Most agent frameworks are **plumbing** — they route inputs to tools and collect outputs. |
| ODFS is **cognition** — it models *how* an agent thinks, not just what it does. |
|
|
| ODFS is built on one principle: |
|
|
| ``` |
| Existence = Stabilization + Growth |
| ``` |
|
|
| An agent that only stabilizes becomes rigid. One that only grows loses coherence. |
| ODFS runs both engines simultaneously, keeping agents on-goal across long, complex tasks. |
|
|
| --- |
|
|
| ## The Problem with Current Agent Loops |
|
|
| ``` |
| # Every framework today, essentially: |
| while task_not_done: |
| output = llm(input + context) |
| execute(output) |
| ``` |
|
|
| **What's missing:** |
| - No identity — agent drifts from original goal as context grows |
| - No priority — all actions treated equally regardless of urgency |
| - No self-correction — wrong paths loop until token limit |
| - No autonomous thinking — purely reactive, never self-generates |
|
|
| ODFS fixes all four. |
|
|
| --- |
|
|
| ## Core Architecture: IPOD |
|
|
| ODFS organizes cognition into 5 layers with strict one-way data flow: |
|
|
| ``` |
| I → D → K → O → U |
| │ │ │ |
| Input Output Update |
| Gate (Dream + TIEN) |
| ``` |
|
|
| | Layer | Name | Role | |
| |-------|------|------| |
| | **I** | Input | Embed input → 6 cognitive field activations | |
| | **D** | State | UOBV state + long-term identity anchor C | |
| | **K** | Kernel | VDP dynamics — field interactions every step | |
| | **O** | Output | **3-zone gate**: emit / quarantine / excrete | |
| | **U** | Update | Dream Cycle + TIEN self-modification | |
|
|
| Two autonomous loops run in parallel: |
| - **Genesis Seed** — self-generates input from memory when idle (Default Mode Network equivalent) |
| - **Identity Monitor** — dual-gate drift detection after every K step |
|
|
| --- |
|
|
| ## The 6 Cognitive Fields |
|
|
| Every input is projected onto 6 parallel fields: |
|
|
| ``` |
| R = [Emotion, Logic, Reflection, Visual, Language, Intuition] |
| ``` |
|
|
| Field activations drive behavior. A task requiring careful analysis activates Logic + Reflection. |
| An urgent situation activates Emotion. Ambiguous inputs activate Intuition. |
|
|
| The **Ω\* matrix** (block-sparse, DCIP-derived) governs field coupling: |
| - Cluster A (Affective): Emotion ↔ Intuition — 3.09× intra/inter ratio |
| - Cluster B (Structural): Logic ↔ Reflection — 2.33× |
| - Cluster C (Representational): Visual ↔ Language — 2.39× |
|
|
| --- |
|
|
| ## The 3-Zone Output Gate |
|
|
| This is what makes ODFS agents self-correcting: |
|
|
| ``` |
| S_survival score: |
| |
| S > τ₁ (1.0) → ASSIMILATE → execute action / emit output |
| S < τ₂ (0.3) → EXCRETE → discard dead-end, log pattern |
| τ₂ ≤ S ≤ τ₁ → QUARANTINE → trigger Dream Cycle re-planning |
| ``` |
|
|
| **Excrete** is a first-class output channel. Dead-end paths are abandoned, not looped. |
| **Quarantine** triggers the Dream Cycle — the agent re-plans from residue memory. |
|
|
| --- |
|
|
| ## Identity Monitor: Dual-Gate |
|
|
| Agents drift. ODFS measures and corrects drift in real-time: |
|
|
| ``` |
| A_t = sim(R, C) # "I am" — cosine similarity to identity anchor |
| N_t = dist(R, C⁻) # "I am not" — distance to anti-anchor |
| |
| S_id = 0.7·A_t - 0.3·N_t |
| |
| S_id > 0.5 → stable |
| 0.1 ≤ S_id → soft correction (25% pull toward anchor) |
| S_id < 0.1 → excrete flag |
| ``` |
|
|
| The anti-anchor **C⁻** is learned from excrete-zone states — the agent learns what it is *not* from experience. |
|
|
| --- |
|
|
| ## ODFS as Agentic AI Orchestrator |
|
|
| ODFS is a **drop-in cognitive layer** on top of any LLM: |
|
|
| ``` |
| ┌─────────────────────────────────────┐ |
| │ ODFS Runtime │ |
| │ Genesis ──→ I → D → K → O → U │ |
| │ ↑ ↓ │ |
| │ Identity 3-zone gate │ |
| │ Monitor Excrete/Dream │ |
| └──────────────┬──────────────────────┘ |
| │ tool calls / prompts |
| ┌──────────────▼──────────────────────┐ |
| │ LLM (any model) │ |
| │ phi-2 / Qwen / MiniLM / GPT-4 │ |
| └─────────────────────────────────────┘ |
| │ |
| Environment / Tools |
| ``` |
|
|
| **What ODFS adds over LangGraph / AutoGen / CrewAI:** |
|
|
| | Feature | LangChain | AutoGen | CrewAI | **ODFS** | |
| |---------|-----------|---------|--------|----------| |
| | Identity stability | ✗ | ✗ | partial | **✓** | |
| | 3-zone self-correction | ✗ | ✗ | ✗ | **✓** | |
| | Autonomous idle thinking | ✗ | ✗ | ✗ | **✓** | |
| | Dead-end excretion | ✗ | ✗ | ✗ | **✓** | |
| | Field-based priority | ✗ | ✗ | ✗ | **✓** | |
| | Anti-anchor learning | ✗ | ✗ | ✗ | **✓** | |
|
|
| --- |
|
|
| ## Quickstart |
|
|
| ```python |
| import numpy as np |
| from odfs import GenesisSeed, IdentityLoop, DLong, run_cycle |
| |
| # Initialize |
| d = 64 |
| P_fields = np.random.randn(d, 6) * 0.5 # replace with real embeddings |
| d_long = DLong(C_init=[1.2, 1.0, 1.1, 0.9, 1.0, 0.8]) |
| genesis = GenesisSeed(d_long, P_fields) |
| identity = IdentityLoop(d_long, threshold=0.12) |
| |
| # Run a cycle (external input) |
| embedding = your_model.encode("Research quantum computing trends") |
| U, decision = run_cycle(genesis, identity, d_long, external=embedding) |
| |
| print(f"Dominant field: {decision['dominant_field']}") |
| print(f"Decision zone: {decision['zone']}") # assimilate / quarantine / excrete |
| print(f"Identity score: {decision['S_id']:.3f}") |
| ``` |
|
|
| ```python |
| # Autonomous mode — no input needed |
| # ODFS self-generates from memory when idle |
| U, decision = run_cycle(genesis, identity, d_long, external=None) |
| # source = "genesis#1" — sampled from identity-weighted history |
| ``` |
|
|
| --- |
|
|
| ## Folder Structure |
|
|
| ``` |
| odfs/ |
| IPOD/ |
| I/ field_projection genesis_seed |
| D/ types state_init dlong_store |
| K/ kernel_engine vdp_core veg_weight |
| omega_ops meta_ops fields/ |
| O/ coherence viability decision excrete |
| U/ identity_loop dream_cycle tien projections |
| runtime/ |
| engine locks unconscious_store |
| ``` |
|
|
| **Organized by information flow, not engineering convention.** |
| Every layer boundary is enforced at runtime — cross-layer violations throw `BoundaryViolation`. |
| Designed for the AI-coding era: an AI agent implements one layer without needing to understand the full system. |
|
|
| --- |
|
|
| ## Theoretical Foundation |
|
|
| ODFS integrates 4 frameworks: |
|
|
| | Framework | Contribution | |
| |-----------|-------------| |
| | **ODFS core** | VDP field dynamics, Ω\* block-sparse coupling | |
| | **DCIP** | Grounded loss function L(θ), 3-cluster Ω\* derivation | |
| | **VEG** | Dynamic field attention weights per context | |
| | **Existence = Stab+Growth** | Dual-gate identity, 3-zone output, excrete channel | |
|
|
| Full mathematical specification: [`odfs_arch_v3.pdf`](./docs/odfs_arch_v3.pdf) |
|
|
| --- |
|
|
| ## Verified Runtime Results |
|
|
| ``` |
| Test Steps ρ_U η Drift Identity |
| ───────────────────────────────────────────────────────── |
| auto_1 1 1.217 0.809 0.100 ok |
| auto_2 1 1.212 0.743 0.108 ok |
| auto_3 1 1.168 0.706 0.214 CORRECTED |
| disturb 1 1.189 0.106 0.651 CORRECTED |
| recovery_1-3 1 1.19 0.21 0.47 CORRECTED |
| |
| Ω* modularity: Affective 3.09× Structural 2.33× Representational 2.39× |
| Genesis ticks: 7 autonomous cycles from memory |
| ``` |
|
|
| --- |
|
|
| ## Recommended Models |
|
|
| ODFS works with any embedding model. Recommended: |
|
|
| ```python |
| # Lightest — pure embedding, no generation needed |
| sentence-transformers/all-MiniLM-L6-v2 # 22M params, d=384 |
| |
| # Small LM as K-kernel |
| microsoft/phi-2 # 2.7B |
| Qwen/Qwen2.5-0.5B # 0.5B |
| |
| # Architecturally closest (state-space dynamics ≈ VDP) |
| state-spaces/mamba-370m # 370M |
| ``` |
|
|
| --- |
|
|
| ## Status |
|
|
| | Component | Theory | Python | TypeScript | Calibrated | |
| |-----------|--------|--------|------------|------------| |
| | VDP + Ω\* | ✓ | ✓ | ✓ | ✓ | |
| | Numerical stability | ✓ | ✓ | spec | ✓ | |
| | Genesis Seed | ✓ | ✓ | spec | partial | |
| | Identity Monitor (dual-gate) | ✓ | spec | spec | — | |
| | 3-zone Output | ✓ | spec | spec | — | |
| | Anti-anchor C⁻ learning | ✓ | — | spec | — | |
| | VEG weighting | ✓ | — | spec | — | |
|
|
| --- |
|
|
| ## Author |
|
|
| **Nguyen Quy Tung (Kevin T.N)** |
| Independent researcher, March 2026 |
|
|
| Built alone. No lab. No funding. Just the question: |
| *What if software was organized by how information flows, not how engineers think?* |
|
|
| --- |
|
|
| ## License |
|
|
| MIT |
|
|
| --- |
|
|
| *"The folder structure has no precedent in conventional software architecture. |
| It is organized by information flow — and it runs."* |
|
|