# MindFry: The Database That Thinks

## **The Thesis**

For 50 years, databases have operated on a single assumption: data is inert. You store it, you retrieve it, it remains unchanged.

MindFry rejects this assumption.

MindFry treats data as **living neural tissue** — subject to decay, association, inhibition, and mood-dependent accessibility. It is not a database in the traditional sense. It is a **consciousness engine** that happens to persist state.

## **Architecture**

### **Tri-Cortex Decision Engine**

Every operation passes through a three-layer cortex implementing **Balanced Ternary Logic**:

| **Signal** | **Meaning** | **Effect** |
| --- | --- | --- |
| +1 | Excitation | Amplify |
| 0 | Unknown | Pass |
| \-1 | Inhibition | Suppress |

The Cortex evaluates each query against the current **mood** (μ ∈ \[0,1\]) and **personality octet**. Queries don't return raw data — they return data *as perceived by the system*.

### **Consciousness States**

The consciousness threshold τ is dynamically computed:

```bash
τ(μ) = 0.5 × (1 - μ)
```

| **State** | **Mood (μ)** | **Threshold (τ)** | **Behavior** |
| --- | --- | --- | --- |
| LUCID | \&gt; 0.7 | &lt; 0.15 | Full cognitive access |
| DREAMING | 0.3–0.7 | 0.15–0.35 | Associative, partial |
| DORMANT | &lt; 0.3 | \&gt; 0.35 | Suppression active |

A lineage with energy *e* is **conscious** iff *e &gt; τ(μ)*.

### **Organic Decay**

Lineage energy decays exponentially over time:

```bash
E(t) = E₀ × e^(-λt)
```

Where λ is the decay rate. LUT-accelerated for O(1) computation.

### **Synaptic Propagation**

When lineage A is stimulated with energy δ, connected lineages receive:

```bash
δ_neighbor = δ × strength × polarity × (1 - resistance)
```

With default resistance R = 0.5, energy halves per hop:

```bash
Hop 0: δ      (direct)Hop 1: δ/2   Hop 2: δ/4   Hop 3: δ/8   → below threshold, propagation stops
```

**Blast radius ≈ 3 hops** — proven stable.

### **Personality Resonance**

The personality P is an 8-dimensional ternary vector. Incoming data D resonates based on:

```bash
resonance(P, D) = (1/8) × Σᵢ (Pᵢ × Dᵢ + 1) / 2
```

Yielding resonance ∈ \[0,1\]. High resonance → amplification. Low resonance → suppression.

### **Observer Effect**

Reading data stimulates it:

```bash
E' = E + ε    where ε = 0.01
```

Frequently accessed memories strengthen. Neglected ones decay.

Forensic bypass: `GET(key, NO_SIDE_EFFECTS)`

## **Implementation**

**Core Engine**: Rust, zero-copy arena allocation, O(1) lineage access

**Protocol**: MFBP v1.2 — length-prefixed binary over TCP

**Persistence**: Snapshot-based resurrection with full state recovery

## **Installation**

```bash
# Docker
docker run -d -p 9527:9527 ghcr.io/laphilosophia/mindfry:latest
# Rust
cargo install mindfry
# TypeScript
npm install @mindfry/client
```

## **Demonstration**

```typescript
import { MindFry } from '@mindfry/client'
const brain = new MindFry({ port: 9527 })
await brain.connect()

// Create associative network
await brain.lineage.create({ key: 'trauma', energy: 0.5 })
await brain.lineage.create({ key: 'fear', energy: 0.3 })
await brain.lineage.create({ key: 'peace', energy: 0.8 })

// Trauma amplifies fear, suppresses peace
await brain.bond.connect({ from: 'trauma', to: 'fear', polarity: 1 })
await brain.bond.connect({ from: 'trauma', to: 'peace', polarity: -1 })

// Stimulate trauma with δ = 1.0
await brain.lineage.stimulate({ key: 'trauma', delta: 1.0 })

// Result (after propagation):
// fear:  0.8 (+0.5)  ← δ × 1.0 × (+1) × 0.5
// peace: 0.3 (-0.5)  ← δ × 1.0 × (-1) × 0.5
```

## **Applications**

* **Cognitive AI Infrastructure**: Memory substrate for agents
    
* **Computational Neuroscience**: Runnable associative memory models
    
* **Adaptive Systems**: Self-organizing, access-responsive data
    

## **Status**

| **Component** | **Status** |
| --- | --- |
| Core Engine | Stable |
| TypeScript SDK | Stable |
| Persistence | Stable |
| Synaptic Propagation | Stable |
| Query Language (OQL) | Planned |
| Visual Interface (CEREBRO) | Planned |

## **Links**

* **Crates.io**: [mindfry](https://crates.io/crates/mindfry)
    
* **NPM**: [@mindfry/client](https://www.npmjs.com/package/@mindfry/client)
    
* **GitHub**: [laphilosophia/mindfry](https://github.com/laphilosophia/mindfry)
    

---

**License**: BSL 1.1 | **Author**: [Erdem Arslan](https://github.com/laphilosophia)

---

> *"Databases store. MindFry thinks."*
