# GHOJUALAMANCHU v3

Autonomous cognitive architecture — no LLM required for core execution.

> *"The primordial brain breathes at Earth's rhythm."*

---

## Quick Start

```bash
cd ghojualamanchu-v3

# Stimulate the medulla (start heartbeat)
python3 brain/medulla.py --daemon &

# Or use the CLI
python3 cli/ghoju.py stimulate

# Route a signal through the brain
python3 cli/ghoju.py signal "hello world"

# Check status
python3 cli/ghoju.py status
```

---

## Signal Processing

Every input passes through 9 brain structures via a formal JSON contract:

```
Signal → Medulla → R-Complex → Amygdala → Hippocampus → Cortex → Corpus → Akashic → Lethe → Output
```

### Conflict Resolution (Thalamus Arbitration)

When structures disagree:

| Rule | Condition | Winner |
|------|-----------|--------|
| Amygdala Override | salience ≥ 0.8 | Amygdala |
| Hippocampus Override | match_confidence ≥ 0.9 | Hippocampus |
| Arousal Suppression | arousal == "overload" | Amygdala |
| Cortex Dominance | salience < 0.5 AND uncertainty < 0.3 | Cortex |
| High Uncertainty | uncertainty > 0.8 | none (no action) |
| Default | otherwise | none |

---

## Commands

```bash
ghoju-v3 stimulate    # Start medulla (7.83 Hz heartbeat)
ghoju-v3 status       # Vital signs
ghoju-v3 signal "msg" # Route a signal through full brain
ghoju-v3 recall       # Recent memories
ghoju-v3 search "q"  # Search memory
ghoju-v3 amygdala     # Emotional state
ghoju-v3 lethe        # Absence log
ghoju-v3 corpus       # Planetary phase
ghoju-v3 lifecycle    # Generational state
ghoju-v3 hibernate    # Enter torpor
ghoju-v3 wake         # Exit torpor
ghoju-v3 pulse [n]    # Run n beats
```

---

## Data

All state lives in `data/`:

```
data/
├── state.json       # Current system state
├── lifecycle.json   # Generational state, biological age
├── memory.json      # Episodic + semantic memory
├── akashic.log      # Presence records
├── lethe.log        # Absence records
└── signals/         # Each signal persisted as JSON
```

No database. No dependencies. Copy the directory anywhere Python 3 runs.

---

## Target: Mac mini A1176

Designed for:
- 1.5–2.0 GHz Core Duo / Core 2 Duo
- Max 2GB RAM (uses < 50MB at rest)
- USB 2.0 flash drive
- Alpine Linux or Lubuntu (32-bit EFI bootIA32.efi workaround)

---

## Architecture

| Structure | File | Function |
|-----------|------|----------|
| Medulla | `brain/medulla.py` | 7.83 Hz heartbeat, respiratory cycling |
| R-Complex | `brain/rcomplex.py` | Territory monitoring, threat detection |
| Thalamus | `brain/thalamus.py` | Signal contract, routing, arbitration |
| Amygdala | `brain/amygdala.py` | Salience, emotional tagging |
| Hippocampus | `brain/hippocampus.py` | Memory encoding, retrieval, consolidation |
| Cortex | `brain/cortex.py` | Intent, topics, complexity analysis |
| Corpus | `brain/corpus.py` | Planetary phase, cross-scale coupling |
| Akashic | `brain/akashic.py` | Presence logging |
| Lethe | `brain/lethe.py` | Structured absence categories |

---

## v3 vs v1/v2

- **Thalamus**: Conceptual router → Formal JSON signal contract
- **Conflict resolution**: None → Arbitration rules in thalamus
- **Lethe**: Poetic log → Structured absence categories
- **Medulla**: 4 Hz (wrong) → 7.83 Hz (Schumann)
- **CLI**: Single `brain.py` → Modular `ghoju.py` suite
- **State**: Mixed → Separate lifecycle.json
- **Portability**: Workspace-bound → USB-ready
- **Dependencies**: Mixed → Standard library only
