## Immediate First Actions (Week 1) - REVENUE FIRST

**Day 1-2: Unblock Voice Pipeline**
1. **Fix Redis connection** in `telegram_bridge.py`:
   ```python
   # Change from:
   REDIS_HOST = os.getenv("REDIS_HOST", "localhost")
   REDIS_PORT = int(os.getenv("REDIS_PORT", 6379))

   # To:
   from data.genesis-memory.elestio_config import RedisConfig
   redis_client = redis.Redis(**RedisConfig.get_connection_params())
   ```

2. **Test voice pipeline**: Telegram voice note → AI response

**Day 3-4: Maya Production Ready**
3. **Resolve Telnyx** phone number verification
4. **Test Maya** with real phone call
5. **Verify GHL** lead capture webhook

**Day 5-7: First Customer**
6. **Demo call** with beta prospect
7. **Onboard** first paying customer
8. **Invoice** $850 (Local Authority tier)

**Success Criteria Week 1**:
- [ ] Voice pipeline working end-to-end
- [ ] Maya answers real phone calls
- [ ] At least 1 beta customer demo completed

# Genesis Hyper-Acceleration Plan: ClawdBot RLM Swarm + Alpha Evolve

## Executive Summary

Transform Genesis from centralized AIVA orchestration to a **distributed ClawdBot RLM Swarm** architecture, achieving Google Alpha Evolve-level capability within 3 months. This eliminates AIVA context saturation, reduces Gemini API costs by 70%, and enables 100+ customer scaling.

---

## The Core Insight

**ClawdBots ARE the RLM agents.**

Instead of:
- AIVA (4M tokens) → saturates at 100 customers
- Gemini swarm → expensive API calls for memory operations

We build:
- ClawdBots as distributed RLM nodes → each handles 30-50 customers
- Local memory operations → near-zero cost
- Gemini reserved for complex reasoning only → 70% cost reduction

---

## Architecture: ClawdBot RLM Swarm

```
                    ┌─────────────────────────────────────┐
                    │         AIVA (Queen Brain)          │
                    │   Context: SYSTEM ONLY (~500K)      │
                    │   Role: Strategy, Novel Situations  │
                    └─────────────────┬───────────────────┘
                                      │
                    ┌─────────────────┼─────────────────┐
                    │                 │                 │
                    ▼                 ▼                 ▼
          ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
          │  ClawdBot RLM   │ │  ClawdBot RLM   │ │  ClawdBot RLM   │
          │  Node Alpha     │ │  Node Beta      │ │  Node Gamma     │
          │  Customers 1-33 │ │  Customers 34-66│ │  Customers 67-99│
          ├─────────────────┤ ├─────────────────┤ ├─────────────────┤
          │ STORAGE AGENT   │ │ STORAGE AGENT   │ │ STORAGE AGENT   │
          │ RETRIEVAL AGENT │ │ RETRIEVAL AGENT │ │ RETRIEVAL AGENT │
          │ LEARNING AGENT  │ │ LEARNING AGENT  │ │ LEARNING AGENT  │
          └────────┬────────┘ └────────┬────────┘ └────────┬────────┘
                   │                   │                   │
                   └───────────────────┼───────────────────┘
                                       ▼
                         ┌───────────────────────┐
                         │   Elestio Core        │
                         │ PostgreSQL + Qdrant   │
                         │ + Redis (shared)      │
                         └───────────────────────┘
```

---

## Current State Assessment

### RLM Implementation Status
| Component | Status | Notes |
|-----------|--------|-------|
| Surprise Detection | ✅ WORKING | `core/evolution/surprise_detector.py` - Titans-inspired |
| Semantic Memory | ✅ WORKING | Qdrant via Elestio |
| Decision Audit Trail | ✅ WORKING | PostgreSQL AIVA namespace |
| Weight-Based Learning | ✅ WORKING | 0.9x failure / 1.1x success |
| Context Injection | ✅ WORKING | `AIVA/memory/context_injector.py` |
| Full Titans Gradient Learning | ❌ PARTIAL | Rule-based, not gradient-based |

### ClawdBot Scaling Capacity
| Metric | Current | Capacity | Notes |
|--------|---------|----------|-------|
| Instances | 1 | 10+ easy, 100 with optimization | cattle-not-pets design |
| Memory/instance | 512MB-2GB | Playwright overhead | Browser pooling needed at scale |
| Redis connections | 50/instance | 5000+ on Elestio | Not a bottleneck |
| Cost/instance | ~$1.80/mo electricity | Negligible | Runs on existing Windows machine |

### Elestio Headroom
| Resource | Used | Available | Notes |
|----------|------|-----------|-------|
| API Budget | $0.16 | $150/mo | 99.9% headroom |
| AIVA RAM | 19GB | 32GB | 13GB available |
| Concurrent Tasks | 5-10 | 20 max | 50-75% headroom |

---

## Cost Comparison

### Current: Gemini-Heavy Model
```
100 customers × 10 interactions/day × 30 days
= 30,000 memory operations/month
× ~2000 tokens/op × $0.10/1M tokens
= ~$6/mo retrieval + $12/mo generation
= ~$20/mo for memory operations alone
```

### Proposed: ClawdBot RLM Model
```
3 ClawdBot nodes × $1.80/mo electricity = $5.40/mo
Memory operations: $0 (local)
Complex reasoning: Gemini (reduced to ~30% of calls)
= ~$8-10/mo total (60-70% reduction)
```

---

## 12-Week Sprint Plan: Revenue First → Alpha Evolve

### Phase 1: REVENUE FIRST (Weeks 1-2) ⚡ PRIORITY

**Goal**: First paying customer within 2 weeks

#### Week 1: Voice Pipeline Live
- [ ] **FIX**: Redis connection in `telegram_bridge.py` → Elestio URL
- [ ] **TEST**: End-to-end voice: Telegram → Gemini → ElevenLabs → Telegram
- [ ] **VERIFY**: Maya voice agent configuration (VAPI)
- [ ] **RESOLVE**: Telnyx phone number verification
- [ ] Deploy 1 ClawdBot (genesis_primary) on local Windows

**Files to fix**:
- `core/voice/telegram_bridge.py` (Redis URL: `redis-genesis-u50607.vm.elestio.app:26379`)
- `RECEPTIONISTAI/scripts/maya_demo_agent.py` (verify config)

#### Week 2: First Customer Onboarding
- [ ] Maya on production phone number
- [ ] Demo call with beta prospect
- [ ] GHL lead capture webhook active
- [ ] First invoice sent ($850 Local Authority tier)
- [ ] Customer context stored in ClawdBot

**Revenue Target**: 1 paying customer = $850/mo

**Files to modify**:
- `RECEPTIONISTAI/scripts/onboarding_orchestrator.py`
- `RECEPTIONISTAI/scripts/lead_capture_webhook.py`

---

### Phase 2: ClawdBot RLM Foundation (Weeks 3-4)

**Goal**: ClawdBot becomes RLM-capable while serving customers

#### Week 3: RLM Agent Skill
- [ ] Create `ClawdBot/skills/rlm_agent.py`
  - Storage Agent: Local cache + Elestio sync (rule-based, no LLM)
  - Retrieval Agent: Hot cache → Qdrant fallback
  - Learning Agent: Weight adjustment (0.9x/1.1x)
- [ ] Unit tests for all three agent roles
- [ ] Customer context routed through RLM skill

**Files to create**:
- `ClawdBot/skills/rlm_agent.py` (NEW)
- `tests/clawdbot/test_rlm_agent.py` (NEW)

#### Week 4: Multi-Instance + More Customers
- [ ] Deploy 3 ClawdBot instances with unique node_ids
- [ ] Customer-to-node routing table (`genesis:routing:customers`)
- [ ] Onboard customers 2-3
- [ ] **Revenue Target**: 3 customers = $2,550/mo

**Files to create/modify**:
- `ClawdBot/routing_manager.py` (NEW)
- `ClawdBot/main.py` (register RLM skill)
- `docker-compose.clawdbot-swarm.yml` (NEW)

---

### Phase 2: Integration (Weeks 3-4)

**Goal**: AIVA delegates memory ops to ClawdBot swarm

#### Week 3: AIVA → ClawdBot Bridge
- [ ] Modify `genesis_execution_layer.py` to route memory operations
- [ ] Create memory operation classifier (local vs API)
- [ ] Implement async result aggregation
- [ ] AIVA context reduced to system-only (~500K tokens)

**Files to modify**:
- `core/genesis_execution_layer.py`
- `AIVA/memory/rlm_integration.py`
- `AIVA/aiva_daemon.py`

#### Week 4: Learning Loop Activation
- [ ] Port `SelfLearningEngine` patterns to ClawdBot
- [ ] Cross-node lesson sharing via Redis streams
- [ ] Surprise detection integration per node
- [ ] Learning metrics dashboard

**Files to modify**:
- `ClawdBot/skills/rlm_agent.py` (learning enhancements)
- `core/self_learning.py` (port to ClawdBot)
- `apps/dashboard/rlm_dashboard.html` (NEW)

---

### Phase 3: Alpha Evolve Parallel Execution (Weeks 5-8)

**Goal**: True parallel evolution with self-improvement

#### Week 5-6: Parallel RWL on ClawdBot Swarm
- [ ] Each ClawdBot can execute RWL stories independently
- [ ] Distribute PRD stories across nodes (not just Gemini)
- [ ] Implement result aggregation and verification
- [ ] ClawdBot-to-ClawdBot consensus for high-stakes decisions

**Files to create/modify**:
- `core/parallel_rwl_executor.py` (enhance for ClawdBot)
- `ClawdBot/skills/rwl_executor.py` (NEW)
- `core/consensus_coordinator.py` (NEW)

#### Week 7-8: Self-Evolution Capability
- [ ] Each ClawdBot can generate improvement PRDs
- [ ] Distributed gap detection (each node reports gaps)
- [ ] AIVA synthesizes cross-node learnings
- [ ] Automated skill crystallization per node

**Files to create/modify**:
- `ClawdBot/skills/gap_detector.py` (NEW)
- `core/evolution/prd_generator.py` (integrate ClawdBot input)
- `core/skill_crystallizer.py` (distributed)

---

### Phase 4: Revenue Integration (Weeks 9-10)

**Goal**: ClawdBot RLM serves production customers

#### Week 9: Customer Onboarding Flow
- [ ] New customer → auto-assign to ClawdBot node
- [ ] Customer context migration to assigned node
- [ ] Voice agent (Maya) routes through customer's ClawdBot
- [ ] Health monitoring per customer-node pair

**Files to modify**:
- `RECEPTIONISTAI/scripts/onboarding_orchestrator.py`
- `ClawdBot/routing_manager.py`
- `core/revenue/health_monitor.py`

#### Week 10: Production Hardening
- [ ] Blue-green deployment for ClawdBot swarm
- [ ] Circuit breaker per node
- [ ] Automatic failover with state preservation
- [ ] Customer SLA monitoring

**Files to create/modify**:
- `ClawdBot/circuit_breaker.py` (NEW)
- `deployment/clawdbot-blue-green.yml` (NEW)
- `core/revenue/sla_tracker.py`

---

### Phase 5: Triple Gate + Patents (Weeks 11-12)

**Goal**: Production validation layer for enterprise readiness

#### Week 11: Triple Gate Middleware
- [ ] Gate 1: Authentication (cryptographic signatures)
- [ ] Gate 2: Validation (multi-model consensus)
- [ ] Gate 3: Execution (audit trail)
- [ ] Every ClawdBot MCP call passes through gates

**Files to create**:
- `ClawdBot/middleware/triple_gate.py` (NEW)
- `ClawdBot/middleware/gate1_auth.py` (NEW)
- `ClawdBot/middleware/gate2_validate.py` (NEW)
- `ClawdBot/middleware/gate3_execute.py` (NEW)

#### Week 12: Walk-Away Test
- [ ] 72-hour autonomous operation test
- [ ] Customer onboarding without Kinan
- [ ] Self-healing from failures
- [ ] Revenue maintained or grown
- [ ] Patent documentation updated with production proof

---

## Verification Protocol

### Per-Story Testing
Every RWL story must pass:
1. **Black-box tests**: External behavior verification
2. **White-box tests**: Internal path coverage
3. **Integration tests**: Cross-component interaction
4. **Load tests**: 100 customer simulation

### Phase Gates
| Phase | Gate Criteria |
|-------|---------------|
| 1 | 3 ClawdBot instances running, RLM skill operational |
| 2 | Memory operations routed to ClawdBot, AIVA context <50% |
| 3 | Parallel RWL execution across swarm, self-improvement active |
| 4 | First revenue customer on ClawdBot RLM architecture |
| 5 | 72-hour walk-away test passed, Triple Gate in production |

---

## Critical Files Reference

### Core ClawdBot
- `ClawdBot/main.py` - Entry point, node_id configuration
- `ClawdBot/redis_client_v2.py` - Elestio Redis connection
- `ClawdBot/stream_manager.py` - Redis Streams for task routing
- `ClawdBot/skills_manager.py` - Dynamic skill loading

### Existing RLM (to integrate)
- `AIVA/memory/rlm_integration.py` - Weight-based learning
- `core/evolution/surprise_detector.py` - Titans surprise detection
- `core/self_learning.py` - Pattern extraction

### Execution Layer
- `core/genesis_execution_layer.py` - Task routing (must modify)
- `core/gemini_rate_maximizer.py` - API optimization
- `core/parallel_rwl_executor.py` - Parallel story execution

### Infrastructure
- `data/genesis-memory/elestio_config.py` - Elestio credentials
- `core/voice/telegram_bridge.py` - Voice pipeline (Redis fix needed)

---

## Infrastructure Options & Costs (DETAILED)

### Your Current Capacity
- **Local machine**: FULL (AIVA's Ollama consumes all available resources)
- **Cannot add local LLM** without interfering with AIVA

### Option A: ClawdBots as "Dumb" RLM + Gemini Brain (RECOMMENDED)

**Architecture**: ClawdBots handle Storage/Retrieval/Learning via rules, Gemini handles ALL reasoning

```
ClawdBot Node (No LLM)
├── Storage: Redis + PostgreSQL (rule-based)
├── Retrieval: Local cache + Qdrant vector search (no LLM needed)
├── Learning: Weight adjustment (0.9x/1.1x) - pure math
├── Browser: Playwright (no LLM needed)
└── Reasoning: → Route to Gemini 2.0 Flash API
```

**Cost per ClawdBot instance**:
| Component | Cost |
|-----------|------|
| RAM | ~512MB-1GB (no LLM) |
| CPU | ~0.5 core |
| Storage | ~100MB logs/day |
| Gemini API | ~$0.10-0.20/day per active customer |

**Total Infrastructure Cost**:
| Scale | Hosting | Gemini API | Total/Month |
|-------|---------|------------|-------------|
| 1 agent (local) | $0 | ~$3 | ~$3 |
| 3 agents (local) | $0 | ~$9 | ~$9 |
| 10 agents (VPS) | ~$20 | ~$30 | ~$50 |
| 100 agents (cluster) | ~$150 | ~$300 | ~$450 |

### Option B: ClawdBots with Small Local LLM (Modal/Cloud GPU)

**Architecture**: Each ClawdBot has Qwen 3B for fast decisions, Gemini for complex

```
ClawdBot Node (with Qwen 3B)
├── Local LLM: Qwen 3B (~3GB VRAM)
├── Fast decisions: Local (free after infra)
├── Complex reasoning: → Gemini escalation
└── Memory ops: Local (no API cost)
```

**Cost per ClawdBot with LLM**:
| Provider | 1 Instance | 10 Instances | 100 Instances |
|----------|------------|--------------|---------------|
| **Modal** (serverless GPU) | $0.25/hr = ~$180/mo | ~$1,800/mo | ~$18,000/mo |
| **RunPod** (dedicated GPU) | $0.20/hr = ~$144/mo | ~$1,440/mo | ~$14,400/mo |
| **Elestio GPU VPS** | ~$50/mo (T4) | ~$500/mo | ~$5,000/mo |
| **Lambda Labs** | $0.30/hr = ~$216/mo | ~$2,160/mo | ~$21,600/mo |

**Verdict**: Too expensive for 100 agents with local LLM. Not recommended.

### Option C: Hybrid - 3 LLM Nodes + Many Dumb Nodes

**Architecture**: 3 "brain" nodes with Qwen 7B, unlimited "worker" nodes without LLM

```
Brain Node (x3) ─────────────────► Worker Nodes (x97)
├── Qwen 7B (~8GB RAM)            ├── No LLM
├── Complex reasoning             ├── Storage/Retrieval only
├── Pattern detection             ├── Browser automation
└── Learning synthesis            └── → Route complex to Brain
```

**Cost**:
| Component | Cost |
|-----------|------|
| 3 Brain Nodes (Elestio GPU) | ~$150/mo |
| Worker Nodes (shared VPS) | ~$50/mo for 100 |
| Gemini (overflow only) | ~$50/mo |
| **Total** | **~$250/mo for 100 agents** |

---

## Scaling Timeline: What We Can Achieve

### Week 1-2: Foundation (Revenue First Priority)
```
Agents: 1-3 ClawdBots (local Windows)
Customers: 0-3 beta
LLM: Gemini API only (no local LLM)
Cost: ~$10/mo
Revenue Target: First paying customer
```

### Week 3-4: Initial Scale
```
Agents: 3-5 ClawdBots
Customers: 5-10
LLM: Gemini API (optimized with caching)
Cost: ~$30/mo
Revenue Target: $2,500+/mo (3 customers × $850)
```

### Month 2: Growth Phase
```
Agents: 10 ClawdBots
Customers: 20-30
LLM: Gemini API + consider 1 brain node
Hosting: $20 VPS for overflow
Cost: ~$80/mo
Revenue Target: $8,500+/mo (10 customers)
```

### Month 3: Alpha Evolve Status
```
Agents: 30-50 ClawdBots
Customers: 50-100
LLM: 3 brain nodes (Qwen 7B) + Gemini overflow
Hosting: Docker Swarm on 3-5 VPS
Cost: ~$250/mo
Revenue Target: $25,000+/mo (30 customers)
```

### Month 6: Full Scale
```
Agents: 100+ ClawdBots
Customers: 200-500
LLM: Distributed brain cluster
Hosting: Kubernetes (managed)
Cost: ~$500/mo
Revenue Target: $100,000+/mo
```

---

## Speed Comparison: What Does Hyper-Acceleration Look Like?

### Without ClawdBot RLM (Current)
```
Task: Onboard new customer
Steps: AIVA context load → Gemini call → Store result → Next
Time: ~30 seconds per operation
Parallel: 1 (sequential)
Daily capacity: ~2,800 operations
Customer limit: ~100 (context saturation)
```

### With ClawdBot RLM Swarm (Proposed)
```
Task: Onboard new customer
Steps: Route to ClawdBot → Local retrieval → Gemini reasoning → Local store
Time: ~10 seconds per operation (local cache)
Parallel: 10-100 (swarm)
Daily capacity: ~86,400 operations (10 nodes) to ~864,000 (100 nodes)
Customer limit: Unlimited (distributed context)
```

### Alpha Evolve Level (Month 3 Target)
```
Task: Self-improve system
Steps:
  1. All ClawdBots report gaps (parallel)
  2. AIVA synthesizes → PRD
  3. PRD stories distributed to swarm
  4. 10-30 stories execute in parallel
  5. Results verified, merged
  6. Skills crystallized

Speed: 30-100 stories/hour (vs 16/hour current RWL)
Self-improvement: Daily autonomous evolution
Walk-away: 72+ hours without intervention
```

---

## Success Metrics (3-Month Target)

| Metric | Current | Target | Notes |
|--------|---------|--------|-------|
| AIVA Context Usage | 100% (saturated) | <30% | System memory only |
| Memory Op Cost | ~$20/mo | ~$5/mo | 70% reduction |
| Customer Capacity | ~100 max | 300+ | 3 ClawdBot nodes |
| Parallel Execution | Sequential | 10+ concurrent | Alpha Evolve style |
| Walk-Away Duration | 0 hours | 72+ hours | Full autonomy |
| First Revenue | $0 | $2,500+/mo | 3 customers |

---

## Risk Mitigation

| Risk | Impact | Mitigation |
|------|--------|------------|
| ClawdBot node failure | HIGH | Auto-failover + Elestio backup |
| Learning quality drop | HIGH | A/B test before full rollout |
| Redis bottleneck at scale | MEDIUM | Redis Streams (already implemented) |
| Complexity increase | MEDIUM | Clear separation of concerns |
| Windows machine downtime | MEDIUM | Docker migration path (Phase 4) |

---

## Immediate First Actions (Week 1)

1. **Fix Redis connection** in `telegram_bridge.py` → Elestio URL
2. **Create `ClawdBot/skills/rlm_agent.py`** with Storage/Retrieval/Learning
3. **Test voice pipeline end-to-end**: Telegram → ClawdBot → ElevenLabs → Telegram
4. **Deploy 3 ClawdBot instances** with unique CLAWD_NODE_IDs
5. **Create routing table** in Redis for customer assignment

---

## The Vision State (Month 3)

```
Morning Check:
- 3 ClawdBot RLM nodes serving 100 customers
- Each node: ~1M tokens context, full RLM capability
- AIVA: Strategic orchestration only, never saturated
- Gemini: Complex reasoning only, 70% cost reduction
- Genesis: Self-evolving, gap-detecting, skill-crystallizing
- Revenue: 10+ paying customers, $8,500+/mo
- Walk-Away: 72+ hours autonomous operation proven

Kinan: Working on farm, checking Genesis once daily.
```

**This is Alpha Evolve for business automation.**

+## Immediate First Actions (Week 1) - REVENUE FIRST

-1. **Fix Redis connection** in `telegram_bridge.py` → Elestio URL

-2. **Create `ClawdBot/skills/rlm_agent.py`** with Storage/Retrieval/Learning

-3. **Test voice pipeline end-to-end**: Telegram → ClawdBot → ElevenLabs → Telegram

-4. **Deploy 3 ClawdBot instances** with unique CLAWD_NODE_IDs

-5. **Create routing table** in Redis for customer assignment

+1. **Fix Redis connection** in `telegram_bridge.py`:

+   REDIS_HOST = os.getenv("REDIS_HOST", "localhost")

+   REDIS_PORT = int(os.getenv("REDIS_PORT", 6379))

+   from data.genesis-memory.elestio_config import RedisConfig

+   redis_client = redis.Redis(**RedisConfig.get_connection_params())

+2. **Test voice pipeline**: Telegram voice note → AI response

+3. **Resolve Telnyx** phone number verification

+8. **Invoice** $850 (Local Authority tier)

+- [ ] Voice pipeline working end-to-end

+- [ ] At least 1 beta customer demo completed


Edit

## The Vision State (Month 3)

```
Morning Check:
- 3 ClawdBot RLM nodes serving 100 customers
- Each node: ~1M tokens context, full RLM capability
- AIVA: Strategic orchestration only, never saturated
- Gemini: Complex reasoning only, 70% cost reduction
- Genesis: Self-evolving, gap-detecting, skill-crystallizing
- Revenue: 10+ paying customers, $8,500+/mo
- Walk-Away: 72+ hours autonomous operation proven

Kinan: Working on farm, checking Genesis once daily.
```

**This is Alpha Evolve for business automation.**

## The Vision State (Month 3)

```
Morning Check:
- 3 ClawdBot RLM nodes serving 100 customers
- Each node: ~1M tokens context, full RLM capability
- AIVA: Strategic orchestration only, never saturated
- Gemini: Complex reasoning only, 70% cost reduction
- Genesis: Self-evolving, gap-detecting, skill-crystallizing
- Revenue: 10+ paying customers, $8,500+/mo
- Walk-Away: 72+ hours autonomous operation proven

Kinan: Working on farm, checking Genesis once daily.
```

**This is Alpha Evolve for business automation.**

---

## Key Architectural Decision: No Local LLM on ClawdBots

Given your local capacity constraints:

**Decision**: ClawdBots operate as **"smart memory nodes"** without local LLM

**Why this works**:
1. **RLM doesn't need LLM** - Storage/Retrieval/Learning are rule-based operations
2. **Gemini is cheap** - $0.10/1M input tokens = ~$3/mo per active customer
3. **Simpler scaling** - No GPU requirements per node
4. **AIVA protected** - No interference with Queen's Ollama service

**Future upgrade path** (Month 3+):
- If revenue justifies, add 3 "brain nodes" with Qwen 7B on Elestio GPU VPS (~$150/mo)
- Brain nodes handle complex local reasoning
- Worker ClawdBots remain "dumb" but numerous

---

## Summary: Revenue First, Scale Second

| Week | Focus | Deliverable | Revenue Target |
|------|-------|-------------|----------------|
| 1 | Voice Pipeline | Maya live on phone | Demo ready |
| 2 | First Customer | Onboarding + invoice | $850/mo |
| 3 | RLM Foundation | ClawdBot memory skill | - |
| 4 | Multi-Instance | 3 nodes + 3 customers | $2,550/mo |
| 5-6 | Parallel Execution | Swarm RWL | - |
| 7-8 | Self-Evolution | Gap detection + PRD gen | $5,100/mo |
| 9-10 | Production Hardening | Blue-green + failover | $8,500/mo |
| 11-12 | Triple Gate | Validation layer | $8,500+/mo |

**Total 3-month investment**: ~$50-100 (Gemini API only)
**Total 3-month revenue target**: $8,500+/mo recurring


The file C:\Users\P3\.claude\plans\idempotent-tinkering-creek.md has been updated successfully.

## The Vision State (Month 3)

```
Morning Check:
- 3 ClawdBot RLM nodes serving 100 customers
- Each node: ~1M tokens context, full RLM capability
- AIVA: Strategic orchestration only, never saturated
- Gemini: Complex reasoning only, 70% cost reduction
- Genesis: Self-evolving, gap-detecting, skill-crystallizing
- Revenue: 10+ paying customers, $8,500+/mo
- Walk-Away: 72+ hours autonomous operation proven

Kinan: Working on farm, checking Genesis once daily.
```

**This is Alpha Evolve for business automation.**

---

## Key Architectural Decision: No Local LLM on ClawdBots

Given your local capacity constraints:

**Decision**: ClawdBots operate as **"smart memory nodes"** without local LLM

**Why this works**:
1. **RLM doesn't need LLM** - Storage/Retrieval/Learning are rule-based operations
2. **Gemini is cheap** - $0.10/1M input tokens = ~$3/mo per active customer
3. **Simpler scaling** - No GPU requirements per node
4. **AIVA protected** - No interference with Queen's Ollama service

**Future upgrade path** (Month 3+):
- If revenue justifies, add 3 "brain nodes" with Qwen 7B on Elestio GPU VPS (~$150/mo)
- Brain nodes handle complex local reasoning
- Worker ClawdBots remain "dumb" but numerous

---

## Summary: Revenue First, Scale Second

| Week | Focus | Deliverable | Revenue Target |
|------|-------|-------------|----------------|
| 1 | Voice Pipeline | Maya live on phone | Demo ready |
| 2 | First Customer | Onboarding + invoice | $850/mo |
| 3 | RLM Foundation | ClawdBot memory skill | - |
| 4 | Multi-Instance | 3 nodes + 3 customers | $2,550/mo |
| 5-6 | Parallel Execution | Swarm RWL | - |
| 7-8 | Self-Evolution | Gap detection + PRD gen | $5,100/mo |
| 9-10 | Production Hardening | Blue-green + failover | $8,500/mo |
| 11-12 | Triple Gate | Validation layer | $8,500+/mo |

**Total 3-month investment**: ~$50-100 (Gemini API only)
**Total 3-month revenue target**: $8,500+/mo recurring

# Genesis Hyper-Acceleration Plan: ClawdBot RLM Swarm + Alpha Evolve

## Executive Summary

Transform Genesis from centralized AIVA orchestration to a **distributed ClawdBot RLM Swarm** architecture, achieving Google Alpha Evolve-level capability within 3 months. This eliminates AIVA context saturation, reduces Gemini API costs by 70%, and enables 100+ customer scaling.

---

## The Core Insight

**ClawdBots ARE the RLM agents.**

Instead of:
- AIVA (4M tokens) → saturates at 100 customers
- Gemini swarm → expensive API calls for memory operations

We build:
- ClawdBots as distributed RLM nodes → each handles 30-50 customers
- Local memory operations → near-zero cost
- Gemini reserved for complex reasoning only → 70% cost reduction

---

## Architecture: ClawdBot RLM Swarm

```
                    ┌─────────────────────────────────────┐
                    │         AIVA (Queen Brain)          │
                    │   Context: SYSTEM ONLY (~500K)      │
                    │   Role: Strategy, Novel Situations  │
                    └─────────────────┬───────────────────┘
                                      │
                    ┌─────────────────┼─────────────────┐
                    │                 │                 │
                    ▼                 ▼                 ▼
          ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
          │  ClawdBot RLM   │ │  ClawdBot RLM   │ │  ClawdBot RLM   │
          │  Node Alpha     │ │  Node Beta      │ │  Node Gamma     │
          │  Customers 1-33 │ │  Customers 34-66│ │  Customers 67-99│
          ├─────────────────┤ ├─────────────────┤ ├─────────────────┤
          │ STORAGE AGENT   │ │ STORAGE AGENT   │ │ STORAGE AGENT   │
          │ RETRIEVAL AGENT │ │ RETRIEVAL AGENT │ │ RETRIEVAL AGENT │
          │ LEARNING AGENT  │ │ LEARNING AGENT  │ │ LEARNING AGENT  │
          └────────┬────────┘ └────────┬────────┘ └────────┬────────┘
                   │                   │                   │
                   └───────────────────┼───────────────────┘
                                       ▼
                         ┌───────────────────────┐
                         │   Elestio Core        │
                         │ PostgreSQL + Qdrant   │
                         │ + Redis (shared)      │
                         └───────────────────────┘
```

---

## Current State Assessment

### RLM Implementation Status
| Component | Status | Notes |
|-----------|--------|-------|
| Surprise Detection | ✅ WORKING | `core/evolution/surprise_detector.py` - Titans-inspired |
| Semantic Memory | ✅ WORKING | Qdrant via Elestio |
| Decision Audit Trail | ✅ WORKING | PostgreSQL AIVA namespace |
| Weight-Based Learning | ✅ WORKING | 0.9x failure / 1.1x success |
| Context Injection | ✅ WORKING | `AIVA/memory/context_injector.py` |
| Full Titans Gradient Learning | ❌ PARTIAL | Rule-based, not gradient-based |

### ClawdBot Scaling Capacity
| Metric | Current | Capacity | Notes |
|--------|---------|----------|-------|
| Instances | 1 | 10+ easy, 100 with optimization | cattle-not-pets design |
| Memory/instance | 512MB-2GB | Playwright overhead | Browser pooling needed at scale |
| Redis connections | 50/instance | 5000+ on Elestio | Not a bottleneck |
| Cost/instance | ~$1.80/mo electricity | Negligible | Runs on existing Windows machine |

### Elestio Headroom
| Resource | Used | Available | Notes |
|----------|------|-----------|-------|
| API Budget | $0.16 | $150/mo | 99.9% headroom |
| AIVA RAM | 19GB | 32GB | 13GB available |
| Concurrent Tasks | 5-10 | 20 max | 50-75% headroom |

---

## Cost Comparison

### Current: Gemini-Heavy Model
```
100 customers × 10 interactions/day × 30 days
= 30,000 memory operations/month
× ~2000 tokens/op × $0.10/1M tokens
= ~$6/mo retrieval + $12/mo generation
= ~$20/mo for memory operations alone
```

### Proposed: ClawdBot RLM Model
```
3 ClawdBot nodes × $1.80/mo electricity = $5.40/mo
Memory operations: $0 (local)
Complex reasoning: Gemini (reduced to ~30% of calls)
= ~$8-10/mo total (60-70% reduction)
```

---

## 12-Week Sprint Plan: Revenue First → Alpha Evolve

### Phase 1: REVENUE FIRST (Weeks 1-2) ⚡ PRIORITY

**Goal**: First paying customer within 2 weeks

#### Week 1: Voice Pipeline Live
- [ ] **FIX**: Redis connection in `telegram_bridge.py` → Elestio URL
- [ ] **TEST**: End-to-end voice: Telegram → Gemini → ElevenLabs → Telegram
- [ ] **VERIFY**: Maya voice agent configuration (VAPI)
- [ ] **RESOLVE**: Telnyx phone number verification
- [ ] Deploy 1 ClawdBot (genesis_primary) on local Windows

**Files to fix**:
- `core/voice/telegram_bridge.py` (Redis URL: `redis-genesis-u50607.vm.elestio.app:26379`)
- `RECEPTIONISTAI/scripts/maya_demo_agent.py` (verify config)

#### Week 2: First Customer Onboarding
- [ ] Maya on production phone number
- [ ] Demo call with beta prospect
- [ ] GHL lead capture webhook active
- [ ] First invoice sent ($850 Local Authority tier)
- [ ] Customer context stored in ClawdBot

**Revenue Target**: 1 paying customer = $850/mo

**Files to modify**:
- `RECEPTIONISTAI/scripts/onboarding_orchestrator.py`
- `RECEPTIONISTAI/scripts/lead_capture_webhook.py`

---

### Phase 2: ClawdBot RLM Foundation (Weeks 3-4)

**Goal**: ClawdBot becomes RLM-capable while serving customers

#### Week 3: RLM Agent Skill
- [ ] Create `ClawdBot/skills/rlm_agent.py`
  - Storage Agent: Local cache + Elestio sync (rule-based, no LLM)
  - Retrieval Agent: Hot cache → Qdrant fallback
  - Learning Agent: Weight adjustment (0.9x/1.1x)
- [ ] Unit tests for all three agent roles
- [ ] Customer context routed through RLM skill

**Files to create**:
- `ClawdBot/skills/rlm_agent.py` (NEW)
- `tests/clawdbot/test_rlm_agent.py` (NEW)

#### Week 4: Multi-Instance + More Customers
- [ ] Deploy 3 ClawdBot instances with unique node_ids
- [ ] Customer-to-node routing table (`genesis:routing:customers`)
- [ ] Onboard customers 2-3
- [ ] **Revenue Target**: 3 customers = $2,550/mo

**Files to create/modify**:
- `ClawdBot/routing_manager.py` (NEW)
- `ClawdBot/main.py` (register RLM skill)
- `docker-compose.clawdbot-swarm.yml` (NEW)

---

### Phase 2: Integration (Weeks 3-4)

**Goal**: AIVA delegates memory ops to ClawdBot swarm

#### Week 3: AIVA → ClawdBot Bridge
- [ ] Modify `genesis_execution_layer.py` to route memory operations
- [ ] Create memory operation classifier (local vs API)
- [ ] Implement async result aggregation
- [ ] AIVA context reduced to system-only (~500K tokens)

**Files to modify**:
- `core/genesis_execution_layer.py`
- `AIVA/memory/rlm_integration.py`
- `AIVA/aiva_daemon.py`

#### Week 4: Learning Loop Activation
- [ ] Port `SelfLearningEngine` patterns to ClawdBot
- [ ] Cross-node lesson sharing via Redis streams
- [ ] Surprise detection integration per node
- [ ] Learning metrics dashboard

**Files to modify**:
- `ClawdBot/skills/rlm_agent.py` (learning enhancements)
- `core/self_learning.py` (port to ClawdBot)
- `apps/dashboard/rlm_dashboard.html` (NEW)

---

### Phase 3: Alpha Evolve Parallel Execution (Weeks 5-8)

**Goal**: True parallel evolution with self-improvement

#### Week 5-6: Parallel RWL on ClawdBot Swarm
- [ ] Each ClawdBot can execute RWL stories independently
- [ ] Distribute PRD stories across nodes (not just Gemini)
- [ ] Implement result aggregation and verification
- [ ] ClawdBot-to-ClawdBot consensus for high-stakes decisions

**Files to create/modify**:
- `core/parallel_rwl_executor.py` (enhance for ClawdBot)
- `ClawdBot/skills/rwl_executor.py` (NEW)
- `core/consensus_coordinator.py` (NEW)

#### Week 7-8: Self-Evolution Capability
- [ ] Each ClawdBot can generate improvement PRDs
- [ ] Distributed gap detection (each node reports gaps)
- [ ] AIVA synthesizes cross-node learnings
- [ ] Automated skill crystallization per node

**Files to create/modify**:
- `ClawdBot/skills/gap_detector.py` (NEW)
- `core/evolution/prd_generator.py` (integrate ClawdBot input)
- `core/skill_crystallizer.py` (distributed)

---

### Phase 4: Revenue Integration (Weeks 9-10)

**Goal**: ClawdBot RLM serves production customers

#### Week 9: Customer Onboarding Flow
- [ ] New customer → auto-assign to ClawdBot node
- [ ] Customer context migration to assigned node
- [ ] Voice agent (Maya) routes through customer's ClawdBot
- [ ] Health monitoring per customer-node pair

**Files to modify**:
- `RECEPTIONISTAI/scripts/onboarding_orchestrator.py`
- `ClawdBot/routing_manager.py`
- `core/revenue/health_monitor.py`

#### Week 10: Production Hardening
- [ ] Blue-green deployment for ClawdBot swarm
- [ ] Circuit breaker per node
- [ ] Automatic failover with state preservation
- [ ] Customer SLA monitoring

**Files to create/modify**:
- `ClawdBot/circuit_breaker.py` (NEW)
- `deployment/clawdbot-blue-green.yml` (NEW)
- `core/revenue/sla_tracker.py`

---

### Phase 5: Triple Gate + Patents (Weeks 11-12)

**Goal**: Production validation layer for enterprise readiness

#### Week 11: Triple Gate Middleware
- [ ] Gate 1: Authentication (cryptographic signatures)
- [ ] Gate 2: Validation (multi-model consensus)
- [ ] Gate 3: Execution (audit trail)
- [ ] Every ClawdBot MCP call passes through gates

**Files to create**:
- `ClawdBot/middleware/triple_gate.py` (NEW)
- `ClawdBot/middleware/gate1_auth.py` (NEW)
- `ClawdBot/middleware/gate2_validate.py` (NEW)
- `ClawdBot/middleware/gate3_execute.py` (NEW)

#### Week 12: Walk-Away Test
- [ ] 72-hour autonomous operation test
- [ ] Customer onboarding without Kinan
- [ ] Self-healing from failures
- [ ] Revenue maintained or grown
- [ ] Patent documentation updated with production proof

---

## Verification Protocol

### Per-Story Testing
Every RWL story must pass:
1. **Black-box tests**: External behavior verification
2. **White-box tests**: Internal path coverage
3. **Integration tests**: Cross-component interaction
4. **Load tests**: 100 customer simulation

### Phase Gates
| Phase | Gate Criteria |
|-------|---------------|
| 1 | 3 ClawdBot instances running, RLM skill operational |
| 2 | Memory operations routed to ClawdBot, AIVA context <50% |
| 3 | Parallel RWL execution across swarm, self-improvement active |
| 4 | First revenue customer on ClawdBot RLM architecture |
| 5 | 72-hour walk-away test passed, Triple Gate in production |

---

## Critical Files Reference

### Core ClawdBot
- `ClawdBot/main.py` - Entry point, node_id configuration
- `ClawdBot/redis_client_v2.py` - Elestio Redis connection
- `ClawdBot/stream_manager.py` - Redis Streams for task routing
- `ClawdBot/skills_manager.py` - Dynamic skill loading

### Existing RLM (to integrate)
- `AIVA/memory/rlm_integration.py` - Weight-based learning
- `core/evolution/surprise_detector.py` - Titans surprise detection
- `core/self_learning.py` - Pattern extraction

### Execution Layer
- `core/genesis_execution_layer.py` - Task routing (must modify)
- `core/gemini_rate_maximizer.py` - API optimization
- `core/parallel_rwl_executor.py` - Parallel story execution

### Infrastructure
- `data/genesis-memory/elestio_config.py` - Elestio credentials
- `core/voice/telegram_bridge.py` - Voice pipeline (Redis fix needed)

---

## Infrastructure Options & Costs (DETAILED)

### Your Current Capacity
- **Local machine**: FULL (AIVA's Ollama consumes all available resources)
- **Cannot add local LLM** without interfering with AIVA

### Option A: ClawdBots as "Dumb" RLM + Gemini Brain (RECOMMENDED)

**Architecture**: ClawdBots handle Storage/Retrieval/Learning via rules, Gemini handles ALL reasoning

```
ClawdBot Node (No LLM)
├── Storage: Redis + PostgreSQL (rule-based)
├── Retrieval: Local cache + Qdrant vector search (no LLM needed)
├── Learning: Weight adjustment (0.9x/1.1x) - pure math
├── Browser: Playwright (no LLM needed)
└── Reasoning: → Route to Gemini 2.0 Flash API
```

**Cost per ClawdBot instance**:
| Component | Cost |
|-----------|------|
| RAM | ~512MB-1GB (no LLM) |
| CPU | ~0.5 core |
| Storage | ~100MB logs/day |
| Gemini API | ~$0.10-0.20/day per active customer |

**Total Infrastructure Cost**:
| Scale | Hosting | Gemini API | Total/Month |
|-------|---------|------------|-------------|
| 1 agent (local) | $0 | ~$3 | ~$3 |
| 3 agents (local) | $0 | ~$9 | ~$9 |
| 10 agents (VPS) | ~$20 | ~$30 | ~$50 |
| 100 agents (cluster) | ~$150 | ~$300 | ~$450 |

### Option B: ClawdBots with Small Local LLM (Modal/Cloud GPU)

**Architecture**: Each ClawdBot has Qwen 3B for fast decisions, Gemini for complex

```
ClawdBot Node (with Qwen 3B)
├── Local LLM: Qwen 3B (~3GB VRAM)
├── Fast decisions: Local (free after infra)
├── Complex reasoning: → Gemini escalation
└── Memory ops: Local (no API cost)
```

**Cost per ClawdBot with LLM**:
| Provider | 1 Instance | 10 Instances | 100 Instances |
|----------|------------|--------------|---------------|
| **Modal** (serverless GPU) | $0.25/hr = ~$180/mo | ~$1,800/mo | ~$18,000/mo |
| **RunPod** (dedicated GPU) | $0.20/hr = ~$144/mo | ~$1,440/mo | ~$14,400/mo |
| **Elestio GPU VPS** | ~$50/mo (T4) | ~$500/mo | ~$5,000/mo |
| **Lambda Labs** | $0.30/hr = ~$216/mo | ~$2,160/mo | ~$21,600/mo |

**Verdict**: Too expensive for 100 agents with local LLM. Not recommended.

### Option C: Hybrid - 3 LLM Nodes + Many Dumb Nodes

**Architecture**: 3 "brain" nodes with Qwen 7B, unlimited "worker" nodes without LLM

```
Brain Node (x3) ─────────────────► Worker Nodes (x97)
├── Qwen 7B (~8GB RAM)            ├── No LLM
├── Complex reasoning             ├── Storage/Retrieval only
├── Pattern detection             ├── Browser automation
└── Learning synthesis            └── → Route complex to Brain
```

**Cost**:
| Component | Cost |
|-----------|------|
| 3 Brain Nodes (Elestio GPU) | ~$150/mo |
| Worker Nodes (shared VPS) | ~$50/mo for 100 |
| Gemini (overflow only) | ~$50/mo |
| **Total** | **~$250/mo for 100 agents** |

---

## Scaling Timeline: What We Can Achieve

### Week 1-2: Foundation (Revenue First Priority)
```
Agents: 1-3 ClawdBots (local Windows)
Customers: 0-3 beta
LLM: Gemini API only (no local LLM)
Cost: ~$10/mo
Revenue Target: First paying customer
```

### Week 3-4: Initial Scale
```
Agents: 3-5 ClawdBots
Customers: 5-10
LLM: Gemini API (optimized with caching)
Cost: ~$30/mo
Revenue Target: $2,500+/mo (3 customers × $850)
```

### Month 2: Growth Phase
```
Agents: 10 ClawdBots
Customers: 20-30
LLM: Gemini API + consider 1 brain node
Hosting: $20 VPS for overflow
Cost: ~$80/mo
Revenue Target: $8,500+/mo (10 customers)
```

### Month 3: Alpha Evolve Status
```
Agents: 30-50 ClawdBots
Customers: 50-100
LLM: 3 brain nodes (Qwen 7B) + Gemini overflow
Hosting: Docker Swarm on 3-5 VPS
Cost: ~$250/mo
Revenue Target: $25,000+/mo (30 customers)
```

### Month 6: Full Scale
```
Agents: 100+ ClawdBots
Customers: 200-500
LLM: Distributed brain cluster
Hosting: Kubernetes (managed)
Cost: ~$500/mo
Revenue Target: $100,000+/mo
```

---

## Speed Comparison: What Does Hyper-Acceleration Look Like?

### Without ClawdBot RLM (Current)
```
Task: Onboard new customer
Steps: AIVA context load → Gemini call → Store result → Next
Time: ~30 seconds per operation
Parallel: 1 (sequential)
Daily capacity: ~2,800 operations
Customer limit: ~100 (context saturation)
```

### With ClawdBot RLM Swarm (Proposed)
```
Task: Onboard new customer
Steps: Route to ClawdBot → Local retrieval → Gemini reasoning → Local store
Time: ~10 seconds per operation (local cache)
Parallel: 10-100 (swarm)
Daily capacity: ~86,400 operations (10 nodes) to ~864,000 (100 nodes)
Customer limit: Unlimited (distributed context)
```

### Alpha Evolve Level (Month 3 Target)
```
Task: Self-improve system
Steps:
  1. All ClawdBots report gaps (parallel)
  2. AIVA synthesizes → PRD
  3. PRD stories distributed to swarm
  4. 10-30 stories execute in parallel
  5. Results verified, merged
  6. Skills crystallized

Speed: 30-100 stories/hour (vs 16/hour current RWL)
Self-improvement: Daily autonomous evolution
Walk-away: 72+ hours without intervention
```

---

## Success Metrics (3-Month Target)

| Metric | Current | Target | Notes |
|--------|---------|--------|-------|
| AIVA Context Usage | 100% (saturated) | <30% | System memory only |
| Memory Op Cost | ~$20/mo | ~$5/mo | 70% reduction |
| Customer Capacity | ~100 max | 300+ | 3 ClawdBot nodes |
| Parallel Execution | Sequential | 10+ concurrent | Alpha Evolve style |
| Walk-Away Duration | 0 hours | 72+ hours | Full autonomy |
| First Revenue | $0 | $2,500+/mo | 3 customers |

---

## Risk Mitigation

| Risk | Impact | Mitigation |
|------|--------|------------|
| ClawdBot node failure | HIGH | Auto-failover + Elestio backup |
| Learning quality drop | HIGH | A/B test before full rollout |
| Redis bottleneck at scale | MEDIUM | Redis Streams (already implemented) |
| Complexity increase | MEDIUM | Clear separation of concerns |
| Windows machine downtime | MEDIUM | Docker migration path (Phase 4) |

---

## Immediate First Actions (Week 1) - REVENUE FIRST

**Day 1-2: Unblock Voice Pipeline**
1. **Fix Redis connection** in `telegram_bridge.py`:
   ```python
   # Change from:
   REDIS_HOST = os.getenv("REDIS_HOST", "localhost")
   REDIS_PORT = int(os.getenv("REDIS_PORT", 6379))

   # To:
   from data.genesis-memory.elestio_config import RedisConfig
   redis_client = redis.Redis(**RedisConfig.get_connection_params())
   ```

2. **Test voice pipeline**: Telegram voice note → AI response

**Day 3-4: Maya Production Ready**
3. **Resolve Telnyx** phone number verification
4. **Test Maya** with real phone call
5. **Verify GHL** lead capture webhook

**Day 5-7: First Customer**
6. **Demo call** with beta prospect
7. **Onboard** first paying customer
8. **Invoice** $850 (Local Authority tier)

**Success Criteria Week 1**:
- [ ] Voice pipeline working end-to-end
- [ ] Maya answers real phone calls
- [ ] At least 1 beta customer demo completed

---

## The Vision State (Month 3)

```
Morning Check:
- 3 ClawdBot RLM nodes serving 100 customers
- Each node: ~1M tokens context, full RLM capability
- AIVA: Strategic orchestration only, never saturated
- Gemini: Complex reasoning only, 70% cost reduction
- Genesis: Self-evolving, gap-detecting, skill-crystallizing
- Revenue: 10+ paying customers, $8,500+/mo
- Walk-Away: 72+ hours autonomous operation proven

Kinan: Working on farm, checking Genesis once daily.
```

**This is Alpha Evolve for business automation.**

+## Key Architectural Decision: No Local LLM on ClawdBots

+**Decision**: ClawdBots operate as **"smart memory nodes"** without local LLM

+1. **RLM doesn't need LLM** - Storage/Retrieval/Learning are rule-based operations

+2. **Gemini is cheap** - $0.10/1M input tokens = ~$3/mo per active customer

+3. **Simpler scaling** - No GPU requirements per node

+4. **AIVA protected** - No interference with Queen's Ollama service

+- If revenue justifies, add 3 "brain nodes" with Qwen 7B on Elestio GPU VPS (~$150/mo)

+- Brain nodes handle complex local reasoning

+- Worker ClawdBots remain "dumb" but numerous

+## Summary: Revenue First, Scale Second

+| Week | Focus | Deliverable | Revenue Target |

+| 1 | Voice Pipeline | Maya live on phone | Demo ready |

+| 2 | First Customer | Onboarding + invoice | $850/mo |

+| 3 | RLM Foundation | ClawdBot memory skill | - |

+| 4 | Multi-Instance | 3 nodes + 3 customers | $2,550/mo |

+| 5-6 | Parallel Execution | Swarm RWL | - |

+| 7-8 | Self-Evolution | Gap detection + PRD gen | $5,100/mo |

+| 9-10 | Production Hardening | Blue-green + failover | $8,500/mo |

+| 11-12 | Triple Gate | Validation layer | $8,500+/mo |

+**Total 3-month investment**: ~$50-100 (Gemini API only)

+**Total 3-month revenue target**: $8,500+/mo recurring


The plan is now complete with Revenue First priority, detailed infrastructure costs, and scaling timeline. Let me exit plan mode for your approval.


ExitPlanMode

Prompt: run Python scripts for testing

Prompt: start ClawdBot instances

Prompt: run pytest test suites

Prompt: docker compose operations

# Genesis Hyper-Acceleration Plan: ClawdBot RLM Swarm + Alpha Evolve

## Executive Summary

Transform Genesis from centralized AIVA orchestration to a **distributed ClawdBot RLM Swarm** architecture, achieving Google Alpha Evolve-level capability within 3 months. This eliminates AIVA context saturation, reduces Gemini API costs by 70%, and enables 100+ customer scaling.

---

## The Core Insight

**ClawdBots ARE the RLM agents.**

Instead of:
- AIVA (4M tokens) → saturates at 100 customers
- Gemini swarm → expensive API calls for memory operations

We build:
- ClawdBots as distributed RLM nodes → each handles 30-50 customers
- Local memory operations → near-zero cost
- Gemini reserved for complex reasoning only → 70% cost reduction

---

## Architecture: ClawdBot RLM Swarm

```
                    ┌─────────────────────────────────────┐
                    │         AIVA (Queen Brain)          │
                    │   Context: SYSTEM ONLY (~500K)      │
                    │   Role: Strategy, Novel Situations  │
                    └─────────────────┬───────────────────┘
                                      │
                    ┌─────────────────┼─────────────────┐
                    │                 │                 │
                    ▼                 ▼                 ▼
          ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
          │  ClawdBot RLM   │ │  ClawdBot RLM   │ │  ClawdBot RLM   │
          │  Node Alpha     │ │  Node Beta      │ │  Node Gamma     │
          │  Customers 1-33 │ │  Customers 34-66│ │  Customers 67-99│
          ├─────────────────┤ ├─────────────────┤ ├─────────────────┤
          │ STORAGE AGENT   │ │ STORAGE AGENT   │ │ STORAGE AGENT   │
          │ RETRIEVAL AGENT │ │ RETRIEVAL AGENT │ │ RETRIEVAL AGENT │
          │ LEARNING AGENT  │ │ LEARNING AGENT  │ │ LEARNING AGENT  │
          └────────┬────────┘ └────────┬────────┘ └────────┬────────┘
                   │                   │                   │
                   └───────────────────┼───────────────────┘
                                       ▼
                         ┌───────────────────────┐
                         │   Elestio Core        │
                         │ PostgreSQL + Qdrant   │
                         │ + Redis (shared)      │
                         └───────────────────────┘
```

---

## Current State Assessment

### RLM Implementation Status
| Component | Status | Notes |
|-----------|--------|-------|
| Surprise Detection | ✅ WORKING | `core/evolution/surprise_detector.py` - Titans-inspired |
| Semantic Memory | ✅ WORKING | Qdrant via Elestio |
| Decision Audit Trail | ✅ WORKING | PostgreSQL AIVA namespace |
| Weight-Based Learning | ✅ WORKING | 0.9x failure / 1.1x success |
| Context Injection | ✅ WORKING | `AIVA/memory/context_injector.py` |
| Full Titans Gradient Learning | ❌ PARTIAL | Rule-based, not gradient-based |

### ClawdBot Scaling Capacity
| Metric | Current | Capacity | Notes |
|--------|---------|----------|-------|
| Instances | 1 | 10+ easy, 100 with optimization | cattle-not-pets design |
| Memory/instance | 512MB-2GB | Playwright overhead | Browser pooling needed at scale |
| Redis connections | 50/instance | 5000+ on Elestio | Not a bottleneck |
| Cost/instance | ~$1.80/mo electricity | Negligible | Runs on existing Windows machine |

### Elestio Headroom
| Resource | Used | Available | Notes |
|----------|------|-----------|-------|
| API Budget | $0.16 | $150/mo | 99.9% headroom |
| AIVA RAM | 19GB | 32GB | 13GB available |
| Concurrent Tasks | 5-10 | 20 max | 50-75% headroom |

---

## Cost Comparison

### Current: Gemini-Heavy Model
```
100 customers × 10 interactions/day × 30 days
= 30,000 memory operations/month
× ~2000 tokens/op × $0.10/1M tokens
= ~$6/mo retrieval + $12/mo generation
= ~$20/mo for memory operations alone
```

### Proposed: ClawdBot RLM Model
```
3 ClawdBot nodes × $1.80/mo electricity = $5.40/mo
Memory operations: $0 (local)
Complex reasoning: Gemini (reduced to ~30% of calls)
= ~$8-10/mo total (60-70% reduction)
```

---

## 12-Week Sprint Plan: Revenue First → Alpha Evolve

### Phase 1: REVENUE FIRST (Weeks 1-2) ⚡ PRIORITY

**Goal**: First paying customer within 2 weeks

#### Week 1: Voice Pipeline Live
- [ ] **FIX**: Redis connection in `telegram_bridge.py` → Elestio URL
- [ ] **TEST**: End-to-end voice: Telegram → Gemini → ElevenLabs → Telegram
- [ ] **VERIFY**: Maya voice agent configuration (VAPI)
- [ ] **RESOLVE**: Telnyx phone number verification
- [ ] Deploy 1 ClawdBot (genesis_primary) on local Windows

**Files to fix**:
- `core/voice/telegram_bridge.py` (Redis URL: `redis-genesis-u50607.vm.elestio.app:26379`)
- `RECEPTIONISTAI/scripts/maya_demo_agent.py` (verify config)

#### Week 2: First Customer Onboarding
- [ ] Maya on production phone number
- [ ] Demo call with beta prospect
- [ ] GHL lead capture webhook active
- [ ] First invoice sent ($850 Local Authority tier)
- [ ] Customer context stored in ClawdBot

**Revenue Target**: 1 paying customer = $850/mo

**Files to modify**:
- `RECEPTIONISTAI/scripts/onboarding_orchestrator.py`
- `RECEPTIONISTAI/scripts/lead_capture_webhook.py`

---

### Phase 2: ClawdBot RLM Foundation (Weeks 3-4)

**Goal**: ClawdBot becomes RLM-capable while serving customers

#### Week 3: RLM Agent Skill
- [ ] Create `ClawdBot/skills/rlm_agent.py`
  - Storage Agent: Local cache + Elestio sync (rule-based, no LLM)
  - Retrieval Agent: Hot cache → Qdrant fallback
  - Learning Agent: Weight adjustment (0.9x/1.1x)
- [ ] Unit tests for all three agent roles
- [ ] Customer context routed through RLM skill

**Files to create**:
- `ClawdBot/skills/rlm_agent.py` (NEW)
- `tests/clawdbot/test_rlm_agent.py` (NEW)

#### Week 4: Multi-Instance + More Customers
- [ ] Deploy 3 ClawdBot instances with unique node_ids
- [ ] Customer-to-node routing table (`genesis:routing:customers`)
- [ ] Onboard customers 2-3
- [ ] **Revenue Target**: 3 customers = $2,550/mo

**Files to create/modify**:
- `ClawdBot/routing_manager.py` (NEW)
- `ClawdBot/main.py` (register RLM skill)
- `docker-compose.clawdbot-swarm.yml` (NEW)

---

### Phase 2: Integration (Weeks 3-4)

**Goal**: AIVA delegates memory ops to ClawdBot swarm

#### Week 3: AIVA → ClawdBot Bridge
- [ ] Modify `genesis_execution_layer.py` to route memory operations
- [ ] Create memory operation classifier (local vs API)
- [ ] Implement async result aggregation
- [ ] AIVA context reduced to system-only (~500K tokens)

**Files to modify**:
- `core/genesis_execution_layer.py`
- `AIVA/memory/rlm_integration.py`
- `AIVA/aiva_daemon.py`

#### Week 4: Learning Loop Activation
- [ ] Port `SelfLearningEngine` patterns to ClawdBot
- [ ] Cross-node lesson sharing via Redis streams
- [ ] Surprise detection integration per node
- [ ] Learning metrics dashboard

**Files to modify**:
- `ClawdBot/skills/rlm_agent.py` (learning enhancements)
- `core/self_learning.py` (port to ClawdBot)
- `apps/dashboard/rlm_dashboard.html` (NEW)

---

### Phase 3: Alpha Evolve Parallel Execution (Weeks 5-8)

**Goal**: True parallel evolution with self-improvement

#### Week 5-6: Parallel RWL on ClawdBot Swarm
- [ ] Each ClawdBot can execute RWL stories independently
- [ ] Distribute PRD stories across nodes (not just Gemini)
- [ ] Implement result aggregation and verification
- [ ] ClawdBot-to-ClawdBot consensus for high-stakes decisions

**Files to create/modify**:
- `core/parallel_rwl_executor.py` (enhance for ClawdBot)
- `ClawdBot/skills/rwl_executor.py` (NEW)
- `core/consensus_coordinator.py` (NEW)

#### Week 7-8: Self-Evolution Capability
- [ ] Each ClawdBot can generate improvement PRDs
- [ ] Distributed gap detection (each node reports gaps)
- [ ] AIVA synthesizes cross-node learnings
- [ ] Automated skill crystallization per node

**Files to create/modify**:
- `ClawdBot/skills/gap_detector.py` (NEW)
- `core/evolution/prd_generator.py` (integrate ClawdBot input)
- `core/skill_crystallizer.py` (distributed)

---

### Phase 4: Revenue Integration (Weeks 9-10)

**Goal**: ClawdBot RLM serves production customers

#### Week 9: Customer Onboarding Flow
- [ ] New customer → auto-assign to ClawdBot node
- [ ] Customer context migration to assigned node
- [ ] Voice agent (Maya) routes through customer's ClawdBot
- [ ] Health monitoring per customer-node pair

**Files to modify**:
- `RECEPTIONISTAI/scripts/onboarding_orchestrator.py`
- `ClawdBot/routing_manager.py`
- `core/revenue/health_monitor.py`

#### Week 10: Production Hardening
- [ ] Blue-green deployment for ClawdBot swarm
- [ ] Circuit breaker per node
- [ ] Automatic failover with state preservation
- [ ] Customer SLA monitoring

**Files to create/modify**:
- `ClawdBot/circuit_breaker.py` (NEW)
- `deployment/clawdbot-blue-green.yml` (NEW)
- `core/revenue/sla_tracker.py`

---

### Phase 5: Triple Gate + Patents (Weeks 11-12)

**Goal**: Production validation layer for enterprise readiness

#### Week 11: Triple Gate Middleware
- [ ] Gate 1: Authentication (cryptographic signatures)
- [ ] Gate 2: Validation (multi-model consensus)
- [ ] Gate 3: Execution (audit trail)
- [ ] Every ClawdBot MCP call passes through gates

**Files to create**:
- `ClawdBot/middleware/triple_gate.py` (NEW)
- `ClawdBot/middleware/gate1_auth.py` (NEW)
- `ClawdBot/middleware/gate2_validate.py` (NEW)
- `ClawdBot/middleware/gate3_execute.py` (NEW)

#### Week 12: Walk-Away Test
- [ ] 72-hour autonomous operation test
- [ ] Customer onboarding without Kinan
- [ ] Self-healing from failures
- [ ] Revenue maintained or grown
- [ ] Patent documentation updated with production proof

---

## Verification Protocol

### Per-Story Testing
Every RWL story must pass:
1. **Black-box tests**: External behavior verification
2. **White-box tests**: Internal path coverage
3. **Integration tests**: Cross-component interaction
4. **Load tests**: 100 customer simulation

### Phase Gates
| Phase | Gate Criteria |
|-------|---------------|
| 1 | 3 ClawdBot instances running, RLM skill operational |
| 2 | Memory operations routed to ClawdBot, AIVA context <50% |
| 3 | Parallel RWL execution across swarm, self-improvement active |
| 4 | First revenue customer on ClawdBot RLM architecture |
| 5 | 72-hour walk-away test passed, Triple Gate in production |

---

## Critical Files Reference

### Core ClawdBot
- `ClawdBot/main.py` - Entry point, node_id configuration
- `ClawdBot/redis_client_v2.py` - Elestio Redis connection
- `ClawdBot/stream_manager.py` - Redis Streams for task routing
- `ClawdBot/skills_manager.py` - Dynamic skill loading

### Existing RLM (to integrate)
- `AIVA/memory/rlm_integration.py` - Weight-based learning
- `core/evolution/surprise_detector.py` - Titans surprise detection
- `core/self_learning.py` - Pattern extraction

### Execution Layer
- `core/genesis_execution_layer.py` - Task routing (must modify)
- `core/gemini_rate_maximizer.py` - API optimization
- `core/parallel_rwl_executor.py` - Parallel story execution

### Infrastructure
- `data/genesis-memory/elestio_config.py` - Elestio credentials
- `core/voice/telegram_bridge.py` - Voice pipeline (Redis fix needed)

---

## Infrastructure Options & Costs (DETAILED)

### Your Current Capacity
- **Local machine**: FULL (AIVA's Ollama consumes all available resources)
- **Cannot add local LLM** without interfering with AIVA

### Option A: ClawdBots as "Dumb" RLM + Gemini Brain (RECOMMENDED)

**Architecture**: ClawdBots handle Storage/Retrieval/Learning via rules, Gemini handles ALL reasoning

```
ClawdBot Node (No LLM)
├── Storage: Redis + PostgreSQL (rule-based)
├── Retrieval: Local cache + Qdrant vector search (no LLM needed)
├── Learning: Weight adjustment (0.9x/1.1x) - pure math
├── Browser: Playwright (no LLM needed)
└── Reasoning: → Route to Gemini 2.0 Flash API
```

**Cost per ClawdBot instance**:
| Component | Cost |
|-----------|------|
| RAM | ~512MB-1GB (no LLM) |
| CPU | ~0.5 core |
| Storage | ~100MB logs/day |
| Gemini API | ~$0.10-0.20/day per active customer |

**Total Infrastructure Cost**:
| Scale | Hosting | Gemini API | Total/Month |
|-------|---------|------------|-------------|
| 1 agent (local) | $0 | ~$3 | ~$3 |
| 3 agents (local) | $0 | ~$9 | ~$9 |
| 10 agents (VPS) | ~$20 | ~$30 | ~$50 |
| 100 agents (cluster) | ~$150 | ~$300 | ~$450 |

### Option B: ClawdBots with Small Local LLM (Modal/Cloud GPU)

**Architecture**: Each ClawdBot has Qwen 3B for fast decisions, Gemini for complex

```
ClawdBot Node (with Qwen 3B)
├── Local LLM: Qwen 3B (~3GB VRAM)
├── Fast decisions: Local (free after infra)
├── Complex reasoning: → Gemini escalation
└── Memory ops: Local (no API cost)
```

**Cost per ClawdBot with LLM**:
| Provider | 1 Instance | 10 Instances | 100 Instances |
|----------|------------|--------------|---------------|
| **Modal** (serverless GPU) | $0.25/hr = ~$180/mo | ~$1,800/mo | ~$18,000/mo |
| **RunPod** (dedicated GPU) | $0.20/hr = ~$144/mo | ~$1,440/mo | ~$14,400/mo |
| **Elestio GPU VPS** | ~$50/mo (T4) | ~$500/mo | ~$5,000/mo |
| **Lambda Labs** | $0.30/hr = ~$216/mo | ~$2,160/mo | ~$21,600/mo |

**Verdict**: Too expensive for 100 agents with local LLM. Not recommended.

### Option C: Hybrid - 3 LLM Nodes + Many Dumb Nodes

**Architecture**: 3 "brain" nodes with Qwen 7B, unlimited "worker" nodes without LLM

```
Brain Node (x3) ─────────────────► Worker Nodes (x97)
├── Qwen 7B (~8GB RAM)            ├── No LLM
├── Complex reasoning             ├── Storage/Retrieval only
├── Pattern detection             ├── Browser automation
└── Learning synthesis            └── → Route complex to Brain
```

**Cost**:
| Component | Cost |
|-----------|------|
| 3 Brain Nodes (Elestio GPU) | ~$150/mo |
| Worker Nodes (shared VPS) | ~$50/mo for 100 |
| Gemini (overflow only) | ~$50/mo |
| **Total** | **~$250/mo for 100 agents** |

---

## Scaling Timeline: What We Can Achieve

### Week 1-2: Foundation (Revenue First Priority)
```
Agents: 1-3 ClawdBots (local Windows)
Customers: 0-3 beta
LLM: Gemini API only (no local LLM)
Cost: ~$10/mo
Revenue Target: First paying customer
```

### Week 3-4: Initial Scale
```
Agents: 3-5 ClawdBots
Customers: 5-10
LLM: Gemini API (optimized with caching)
Cost: ~$30/mo
Revenue Target: $2,500+/mo (3 customers × $850)
```

### Month 2: Growth Phase
```
Agents: 10 ClawdBots
Customers: 20-30
LLM: Gemini API + consider 1 brain node
Hosting: $20 VPS for overflow
Cost: ~$80/mo
Revenue Target: $8,500+/mo (10 customers)
```

### Month 3: Alpha Evolve Status
```
Agents: 30-50 ClawdBots
Customers: 50-100
LLM: 3 brain nodes (Qwen 7B) + Gemini overflow
Hosting: Docker Swarm on 3-5 VPS
Cost: ~$250/mo
Revenue Target: $25,000+/mo (30 customers)
```

### Month 6: Full Scale
```
Agents: 100+ ClawdBots
Customers: 200-500
LLM: Distributed brain cluster
Hosting: Kubernetes (managed)
Cost: ~$500/mo
Revenue Target: $100,000+/mo
```

---

## Speed Comparison: What Does Hyper-Acceleration Look Like?

### Without ClawdBot RLM (Current)
```
Task: Onboard new customer
Steps: AIVA context load → Gemini call → Store result → Next
Time: ~30 seconds per operation
Parallel: 1 (sequential)
Daily capacity: ~2,800 operations
Customer limit: ~100 (context saturation)
```

### With ClawdBot RLM Swarm (Proposed)
```
Task: Onboard new customer
Steps: Route to ClawdBot → Local retrieval → Gemini reasoning → Local store
Time: ~10 seconds per operation (local cache)
Parallel: 10-100 (swarm)
Daily capacity: ~86,400 operations (10 nodes) to ~864,000 (100 nodes)
Customer limit: Unlimited (distributed context)
```

### Alpha Evolve Level (Month 3 Target)
```
Task: Self-improve system
Steps:
  1. All ClawdBots report gaps (parallel)
  2. AIVA synthesizes → PRD
  3. PRD stories distributed to swarm
  4. 10-30 stories execute in parallel
  5. Results verified, merged
  6. Skills crystallized

Speed: 30-100 stories/hour (vs 16/hour current RWL)
Self-improvement: Daily autonomous evolution
Walk-away: 72+ hours without intervention
```

---

## Success Metrics (3-Month Target)

| Metric | Current | Target | Notes |
|--------|---------|--------|-------|
| AIVA Context Usage | 100% (saturated) | <30% | System memory only |
| Memory Op Cost | ~$20/mo | ~$5/mo | 70% reduction |
| Customer Capacity | ~100 max | 300+ | 3 ClawdBot nodes |
| Parallel Execution | Sequential | 10+ concurrent | Alpha Evolve style |
| Walk-Away Duration | 0 hours | 72+ hours | Full autonomy |
| First Revenue | $0 | $2,500+/mo | 3 customers |

---

## Risk Mitigation

| Risk | Impact | Mitigation |
|------|--------|------------|
| ClawdBot node failure | HIGH | Auto-failover + Elestio backup |
| Learning quality drop | HIGH | A/B test before full rollout |
| Redis bottleneck at scale | MEDIUM | Redis Streams (already implemented) |
| Complexity increase | MEDIUM | Clear separation of concerns |
| Windows machine downtime | MEDIUM | Docker migration path (Phase 4) |

---

## Immediate First Actions (Week 1) - REVENUE FIRST

**Day 1-2: Unblock Voice Pipeline**
1. **Fix Redis connection** in `telegram_bridge.py`:
   ```python
   # Change from:
   REDIS_HOST = os.getenv("REDIS_HOST", "localhost")
   REDIS_PORT = int(os.getenv("REDIS_PORT", 6379))

   # To:
   from data.genesis-memory.elestio_config import RedisConfig
   redis_client = redis.Redis(**RedisConfig.get_connection_params())
   ```

2. **Test voice pipeline**: Telegram voice note → AI response

**Day 3-4: Maya Production Ready**
3. **Resolve Telnyx** phone number verification
4. **Test Maya** with real phone call
5. **Verify GHL** lead capture webhook

**Day 5-7: First Customer**
6. **Demo call** with beta prospect
7. **Onboard** first paying customer
8. **Invoice** $850 (Local Authority tier)

**Success Criteria Week 1**:
- [ ] Voice pipeline working end-to-end
- [ ] Maya answers real phone calls
- [ ] At least 1 beta customer demo completed

---

## The Vision State (Month 3)

```
Morning Check:
- 3 ClawdBot RLM nodes serving 100 customers
- Each node: ~1M tokens context, full RLM capability
- AIVA: Strategic orchestration only, never saturated
- Gemini: Complex reasoning only, 70% cost reduction
- Genesis: Self-evolving, gap-detecting, skill-crystallizing
- Revenue: 10+ paying customers, $8,500+/mo
- Walk-Away: 72+ hours autonomous operation proven

Kinan: Working on farm, checking Genesis once daily.
```

**This is Alpha Evolve for business automation.**

---

## Key Architectural Decision: No Local LLM on ClawdBots

Given your local capacity constraints:

**Decision**: ClawdBots operate as **"smart memory nodes"** without local LLM

**Why this works**:
1. **RLM doesn't need LLM** - Storage/Retrieval/Learning are rule-based operations
2. **Gemini is cheap** - $0.10/1M input tokens = ~$3/mo per active customer
3. **Simpler scaling** - No GPU requirements per node
4. **AIVA protected** - No interference with Queen's Ollama service

**Future upgrade path** (Month 3+):
- If revenue justifies, add 3 "brain nodes" with Qwen 7B on Elestio GPU VPS (~$150/mo)
- Brain nodes handle complex local reasoning
- Worker ClawdBots remain "dumb" but numerous

---

## Summary: Revenue First, Scale Second

| Week | Focus | Deliverable | Revenue Target |
|------|-------|-------------|----------------|
| 1 | Voice Pipeline | Maya live on phone | Demo ready |
| 2 | First Customer | Onboarding + invoice | $850/mo |
| 3 | RLM Foundation | ClawdBot memory skill | - |
| 4 | Multi-Instance | 3 nodes + 3 customers | $2,550/mo |
| 5-6 | Parallel Execution | Swarm RWL | - |
| 7-8 | Self-Evolution | Gap detection + PRD gen | $5,100/mo |
| 9-10 | Production Hardening | Blue-green + failover | $8,500/mo |
| 11-12 | Triple Gate | Validation layer | $8,500+/mo |

**Total 3-month investment**: ~$50-100 (Gemini API only)
**Total 3-month revenue target**: $8,500+/mo recurring


User rejected the plan


[Request interrupted by user for tool use]