# RALPH MATRIX HARDENING PRD

> **Status**: APPROVED
> **Executor**: Universal Ralph Wiggum Loop
> **Goal**: Embed Ralph Matrix protocols (TRUE Method) into Genesis Core and harden the system against context rot.

## Strategic Intent
Operationalize the "Ralph Matrix" by baking its principles (Atomic Stories, Fresh Context) into the system's operational framework (Universal Runner).

## User Stories

### US-001: True Method Axiom Injection
**Goal:** Inject "TRUE Method" principles into Genesis Axioms.
**Acceptance Criteria:**
- Create `e:/genesis-system/data/axioms/ralph_matrix_axioms.json`
- Content must explicitly state: "One Story = One Session", "No Context Rot", "Manual Verification".
- Update `genesis_kernel.py` to load these axioms.
**Files to Create:**
- `e:/genesis-system/data/axioms/ralph_matrix_axioms.json`
- `e:/genesis-system/core/axiom_loader.py` (if not exists, or verify loading)

### US-002: Context Rot Detector
**Goal:** Create a utility to detect when an agent session is "rotting".
**Acceptance Criteria:**
- Script scans current session logs (if available) or simply provides a metric logic.
- Returns "ROT_RISK: HIGH" if iteration count > 30.
- Returns "ROT_RISK: LOW" if fresh session.
**Files to Create:**
- `e:/genesis-system/core/context_rot_detector.py`

### US-003: Ralph Matrix Dashboard Widget
**Goal:** Create a visual widget for the dashboard showing Swarm Status.
**Acceptance Criteria:**
- HTML/JS component that reads `_REPORT.md` files from `logs/`.
- Displays: "Active Swarms", "Success Rate", "Last Awakening".
- Green/Red indicators.
**Files to Create:**
- `e:/genesis-system/swarms/ralph_matrix_widget.html`
- `e:/genesis-system/swarms/ralph_matrix_widget.js`

### US-004: Universal Runner Hardening
**Goal:** Improve `universal_rwl_runner.py` with robustness features.
**Acceptance Criteria:**
- Add automatic retry (already there, but verify).
- Add "Anti-Stall" check: if a file isn't created in 3 attempts, escalate or skip.
- Ensure UTF-8 is the default for ALL writes (reinforcing the manual hotfix).
**Files to Create:**
- `e:/genesis-system/core/universal_rwl_runner_v2.py` (Iterate on existing)

### US-005: Voice PRD Processor (Stub)
**Goal:** Create the entry point for "Wispr Flow" processing.
**Acceptance Criteria:**
- Python script that takes a text file (transcript).
- Puts it through the "Claude Clarification" prompt (template).
- Outputs a draft `tasks.json` or PRD markdown.
**Files to Create:**
- `e:/genesis-system/skills/voice_prd_processor.py`
