# The Sovereign Stack Overview
### Aethonex - Private AI Operating Stack for Independent Agencies

> **"Your SaaS bill is GBP 3,200/mo. After us: GBP 38/mo. And you own the capital asset permanently."**

This document outlines the **Sovereign Stack V1.0** - a lightweight, 4-layer private AI operating framework engineered exclusively for digital agencies. It replaces expensive, recurring SaaS subscriptions (OpEx) with permanently owned digital infrastructure (CapEx) deployed on your own client-owned servers.

---

## 🏛️ The 4-Layer Architecture

Instead of managing 30+ separate tools, Aethonex isolates your data and processing within a highly secure, simplified **4-layer stack**:

```mermaid
graph TD
    subgraph Layer 1: Ingress & Security [Layer 1: Security & Routing]
        Caddy["Caddy Server (SSL/Reverse Proxy)"]
        CrowdSec["CrowdSec (Intrusion Detection)"]
    end

    subgraph Layer 2: Data & Vector Foundation [Layer 2: Database & Context Memory]
        Postgres["PostgreSQL (Persistent Storage)"]
        Qdrant["Qdrant (Vector Memory / RAG)"]
    end

    subgraph Layer 3: Cognitive Intelligence [Layer 3: Cognitive Inference Engine]
        Ollama["Ollama (Local Models: Llama 3.3/Mistral)"]
        LiteLLM["LiteLLM (API Gateway & Cost Router)"]
    end

    subgraph Layer 4: Delivery & Workflow [Layer 4: Automation & App Surface]
        n8n["n8n (Visual Automation Core)"]
        NextJS["Next.js Web Surface (Client Portals)"]
    end

    %% Ingress and Traffic Flow
    User((Agency Team)) -->|Secure HTTPS| Caddy
    Caddy -->|Filter & Protect| CrowdSec
    Caddy -->|Route Request| n8n
    Caddy -->|Access Portal| NextJS
    
    %% Execution Flow
    n8n -->|Fetch Context| Qdrant
    n8n -->|Store Data| Postgres
    n8n -->|Inference Call| LiteLLM
    LiteLLM -->|Local Run| Ollama
    LiteLLM -.->|Fallback if Busy| Cloud[Cloud APIs: OpenAI/Anthropic]
```

---

## ⚡ What We Replace

We replace variable-cost operations and AI tools with free, self-hosted, industrial-grade open-source infrastructure:

| Replaced Tool | Open-Source Replacement | Core Benefit | Monthly Saving |
| :--- | :--- | :--- | :--- |
| **ChatGPT Teams** | Ollama + Open WebUI | Unlimited users, private history, zero data tracking | GBP 300/mo |
| **Zapier Professional** | n8n (Self-hosted) | Visual workflow builder, zero execution limits | GBP 250/mo |
| **Jasper / Copy.ai** | LiteLLM + n8n AI Nodes | Structured, custom prompts; zero per-query fees | GBP 125/mo |
| **Acuity / Calendly** | Cal.com | Fully brand-customized scheduling under your domain | GBP 90/mo |
| **HubSpot CRM / Email** | Twenty CRM + Listmonk | Unlimited contacts, private CRM database, high deliverability | GBP 800/mo |
| **Monday.com / Asana** | Plane | High-velocity developer and client project tracking | GBP 240/mo |

**Estimated Total Software Replaced:** **GBP 1,805 - GBP 3,200/mo**  
**Your New Operating Cost:** **~GBP 38/mo** (Flat server hosting on a dedicated Hetzner AMD node).

---

## 🛡️ The Zero-Egress Posture

The Sovereign Stack enforces absolute data sovereignty. It guarantees that client briefs, financial structures, and proprietary intelligence never leak to third-party providers through two security gates:

1. **Telemetry Severance**: All deployed services are pre-configured to hard-disable outbound analytical telemetry (`TELEMETRY_DISABLED=true`, `SCARF_ANALYTICS=false`).
2. **Bridge Isolation**: The data databases (PostgreSQL and Qdrant) are quarantined within an isolated internal Docker bridge network that lacks physical access to the external internet. External access is only allowed through Caddy under strict authentication.

---

## 🚀 Payback Period: The Math

- **One-time Project Setup Fee**: GBP 4,800
- **Existing SaaS Burn**: GBP 2,400/month
- **Payback Achieved**: **Month 2**
- **Year 1 Net Savings**: **GBP 24,000+**
- **Asset Value**: A permanent, private AI infrastructure that lives on your balance sheet as a capital asset.

---

### 📥 Demo Assets Included
- **`docker-compose.demo.yml`**: A simple, 5-container orchestrator to spin up your local demo environment.
- **`litellm-config.demo.yaml`**: Pre-configured cost tracking and local model gateway routing.
