Skip to content

slingvector/ai-augmented-live-streaming

Repository files navigation

MetalOS - Autonomous Cognitive Operating System 🧠

Docker Compose n8n Workflows PostgreSQL Redis Ollama License: Proprietary

Production-grade agentic operating system - Manages Attention, Context, Intent, and Meaning instead of traditional hardware resources. Orchestrates autonomous workflows, content creation, and audience engagement through a quadripartite governance model.

🎯 What It Does

MetalOS is a revolutionary approach to operating systems that replaces hardware resource management with cognitive resource management:

Instead of managing CPU, RAM, and disk, MetalOS manages:

  • Attention - What deserves focus and why
  • Context - Historical and situational awareness
  • Intent - Goals and desired outcomes
  • Meaning - Understanding and interpretation

πŸ’‘ Core Capabilities

βœ… Autonomous content ideation and generation
βœ… AI-powered engagement analysis and response
βœ… Intelligent workflow orchestration (n8n + Ollama)
βœ… Content Intent Objects (CIO) for structured planning
βœ… Work Intent Objects (WIO) for project management
βœ… Universal signal inbox for all communication
βœ… Vector embeddings for semantic search and memory
βœ… Human-in-the-loop governance model
βœ… Real-time performance metrics tracking
βœ… Lessons learned compounding system


πŸ›οΈ Governance Model

MetalOS implements a Quadripartite Governance System:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           MetalOS Governance Model                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                     β”‚
β”‚  Legislature (LLMs)                                 β”‚
β”‚  β”œβ”€ Ollama (Local): Knowledge & Meaning            β”‚
β”‚  β”œβ”€ Gemini (Cloud): Advanced Reasoning             β”‚
β”‚  └─ Purpose: Interpret reality & generate options  β”‚
β”‚                                                     β”‚
β”‚  Executive (n8n)                                    β”‚
β”‚  β”œβ”€ Workflow Orchestration                         β”‚
β”‚  β”œβ”€ Decision Execution                             β”‚
β”‚  └─ Purpose: Execute decisions autonomously        β”‚
β”‚                                                     β”‚
β”‚  Judiciary (Human)                                  β”‚
β”‚  β”œβ”€ Review & Approval                              β”‚
β”‚  β”œβ”€ Override & Direction                           β”‚
β”‚  └─ Purpose: Governance & safety                   β”‚
β”‚                                                     β”‚
β”‚  People (Signals)                                   β”‚
β”‚  β”œβ”€ Feedback & Market Signals                      β”‚
β”‚  β”œβ”€ Content Performance Data                       β”‚
β”‚  └─ Purpose: Continuous learning & adaptation      β”‚
β”‚                                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—οΈ Architecture

MetalOS uses a distributed fortress architecture for reliability:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  MetalOS Fortress                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ n8n-editor   │───▢│    Redis     │◀───│ n8n-    β”‚  β”‚
β”‚  β”‚ (Brain)      β”‚    β”‚  (Nervous)   β”‚    β”‚ worker  β”‚  β”‚
β”‚  β”‚ :5679        β”‚    β”‚  :6379       β”‚    β”‚(Muscle) β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚         β”‚                 β”‚                    β”‚        β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β”‚                           β–Ό                             β”‚
β”‚                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚                  β”‚   PostgreSQL     β”‚                   β”‚
β”‚                  β”‚    (Memory)      β”‚                   β”‚
β”‚                  β”‚     :5432        β”‚                   β”‚
β”‚                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚     Ollama       β”‚
                  β”‚  (Legislature)   β”‚
                  β”‚   :11434         β”‚
                  β”‚                  β”‚
                  β”‚  Local LLM       β”‚
                  β”‚  (Host Metal)    β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Service Breakdown

Service Purpose Port Status
n8n-editor Workflow builder & UI 5679 Dashboard
n8n-worker Async job execution N/A Background
PostgreSQL Primary data store 5432 Database
Redis Queue & cache 6379 In-Memory
Ollama Local LLM inference 11434 Host-based

πŸ“‹ Core Database Schema

Content Intent Objects (CIO)

Manages creative content workflows:

  • Intent - Goal, message, audience, tone
  • Context - Source, urgency, strategic pillar
  • Execution - Platforms, format, constraints
  • Learning - Predicted vs actual impact
  • Embeddings - Vector storage for RAG

Work Intent Objects (WIO)

Manages technical/freelance deliverables:

  • Domain & Client - Project tracking
  • Scope - In-scope/out-of-scope items
  • Risk - Profiling and mitigation
  • Success - Criteria and metrics
  • Embeddings - Semantic search capability

Signal Objects

Universal inbox for incoming communication:

  • Source - YouTube, Email, Twitch, etc.
  • Classification - SPAM, NOISE, OPPORTUNITY, CRITICAL
  • Raw Payload - Full signal data
  • Processing - Status and outcome

Lessons Learned

Vector memory for compounding improvement:

  • Lesson - What was learned
  • Context - When and why
  • Impact - Score and measurement
  • Embeddings - For semantic recall

Execution Metrics

Performance tracking:

  • Links to CIO/WIO - Context
  • Metric Name - What's being measured
  • Time Series - Historical data points

πŸš€ Quick Start

Prerequisites

  • Docker Desktop (Mac) or Docker Engine (Linux)
  • Ollama (for local LLM inference)
  • 16GB+ RAM recommended
  • 50GB+ free disk space

Installation

# Clone repository
git clone https://github.com/slingvector/ai-augmented-live-streaming.git
cd ai-augmented-live-streaming

# Copy environment template
cp .env.example .env

# Generate secure credentials
export DB_PASSWORD=$(openssl rand -base64 32)
export ENCRYPTION_KEY=$(openssl rand -hex 32)

# Update .env with values
nano .env  # Edit and save

Configuration

Edit .env:

# PostgreSQL
DB_USER=n8n
DB_PASSWORD=<generated-above>
DB_NAME=n8n
POSTGRES_HOST=postgres
POSTGRES_PORT=5432

# n8n
N8N_HOST=localhost
N8N_PORT=5679
N8N_PROTOCOL=http
N8N_WEBHOOK_TUNNEL_URL=http://localhost/

# Redis
REDIS_HOST=redis
REDIS_PORT=6379

# Encryption
ENCRYPTION_KEY=<generated-above>

# Ollama
OLLAMA_HOST=http://host.docker.internal:11434
OLLAMA_MODEL=llama3

Launch MetalOS

1. Start Ollama on host:

# macOS
OLLAMA_HOST=0.0.0.0 ollama serve

# Linux/Docker
docker run -d --gpus all -v ollama:/root/.ollama -p 11434:11434 ollama/ollama
ollama run llama3

2. Start the Fortress:

docker-compose up -d

3. Verify services:

docker-compose ps
# All should show "healthy" status

4. Access n8n: Open http://localhost:5679 in your browser


πŸ” Environment Setup

Development (Sandbox)

Port: 5678
Database: SQLite
Mode: Monolithic
Use Case: Rapid prototyping

Production (Fortress)

Port: 5679
Database: PostgreSQL
Mode: Queue Mode (distributed)
Use Case: Stable execution

πŸ“ Project Structure

streaming-prod/
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ ARCHITECTURE_SPEC.md      # Deep technical spec
β”‚   β”œβ”€β”€ BACKEND_STANDARDS.md      # Code standards
β”‚   β”œβ”€β”€ FRONTEND_STANDARDS.md     # UI/UX standards
β”‚   β”œβ”€β”€ PRODUCT_REQUIREMENTS.md   # PRD & roadmap
β”‚   └── GOVERNANCE_MODEL.md       # Philosophy & design
β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ README.md                 # Schema docs
β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   β”œβ”€β”€ content_intent_objects.sql
β”‚   β”‚   β”œβ”€β”€ work_intent_objects.sql
β”‚   β”‚   β”œβ”€β”€ signal_objects.sql
β”‚   β”‚   β”œβ”€β”€ lessons_learned.sql
β”‚   β”‚   └── execution_metrics.sql
β”‚   └── scripts/
β”‚       └── init-database.sh
β”œβ”€β”€ python-bridge/
β”‚   β”œβ”€β”€ README.md                 # EOE (Emotional Orchestration Engine)
β”‚   β”œβ”€β”€ eoe_engine.py
β”‚   β”œβ”€β”€ state_evaluator.py
β”‚   β”œβ”€β”€ obs_controller.py
β”‚   β”œβ”€β”€ chat_monitor.py
β”‚   └── audio_monitor.py
β”œβ”€β”€ docker-compose.yml            # Infrastructure definition
β”œβ”€β”€ .env.example                  # Environment template
β”œβ”€β”€ .env.production               # Production config
└── README.md                     # This file

πŸ”„ Implementation Phases

Phase Status Component Purpose
Phase 0 βœ… Complete Fortress Construction Docker, PostgreSQL, Redis, n8n
Phase 1 πŸ”„ In Progress Sensory Integration Universal Inbox, Python Bridge
Phase 2 ⏳ Planned Cognitive Layer Ollama, Gatekeeper Agent
Phase 3 ⏳ Planned Governance Kernel CIO Schema, Priority Engine
Phase 4 ⏳ Planned Feedback Loop Analyst Agent, Vector DB

πŸ› οΈ Workflow Examples

Basic Content Generation Flow

{
  "name": "Generate LinkedIn Content",
  "trigger": "Manual",
  "steps": [
    {
      "node": "Ollama - Generate Ideas",
      "action": "POST /api/generate",
      "prompt": "Generate 5 LinkedIn post ideas about AI"
    },
    {
      "node": "Human - Review",
      "action": "Wait for approval"
    },
    {
      "node": "PostgreSQL - Save CIO",
      "action": "Store in content_intent_objects"
    }
  ]
}

Engagement Monitoring Flow

{
  "name": "Monitor & React to Signals",
  "trigger": "Webhook (new signal)",
  "steps": [
    {
      "node": "Signal Classifier",
      "action": "Classify by importance"
    },
    {
      "node": "Ollama - Generate Response",
      "action": "Create contextual reply"
    },
    {
      "node": "Human - Final Check",
      "action": "Approval before posting"
    }
  ]
}

πŸ“Š Database Operations

Initialize Database

cd database
./scripts/init-database.sh

Query Content Intent Objects

docker-compose exec postgres psql -U n8n -d n8n -c \
  'SELECT id, primary_goal, core_message FROM content_intent_objects;'

Search via Vector Embeddings

SELECT id, primary_goal, core_message
FROM content_intent_objects
ORDER BY embedding <=> '[your_embedding_vector]'
LIMIT 5;

🚒 Deployment

Docker Compose (Local/Staging)

docker-compose -f docker-compose.yml up -d

Production with Docker Swarm

docker stack deploy -c docker-compose.yml metalos

Production with Kubernetes

kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/configmap.yaml
kubectl apply -f k8s/secrets.yaml
kubectl apply -f k8s/deployments.yaml

πŸ“ˆ Monitoring

View All Logs

docker-compose logs -f

Specific Service Logs

docker-compose logs -f n8n-worker
docker-compose logs -f postgres
docker-compose logs -f redis

Health Check

curl http://localhost:5679/healthz

πŸ”§ Troubleshooting

Redis Connection Issues

docker-compose restart redis
docker-compose exec redis redis-cli ping

PostgreSQL Locked

docker-compose exec postgres pg_isready -U n8n

Ollama Not Accessible

curl http://host.docker.internal:11434/api/tags

πŸ› οΈ Tech Stack

Component Technology Purpose
Orchestration n8n Workflow automation
Database PostgreSQL Primary data store
Cache/Queue Redis State & job queue
LLM Ollama + Gemini Intelligence layer
Container Docker Compose Infrastructure as Code
Programming Python + Node.js Backend & plugins

🀝 Contributing

See CONTRIBUTING.md for guidelines.


πŸ“„ License

Proprietary - Internal use only. All rights reserved.


πŸ‘¨β€πŸ’» Author

Slingvector


πŸ™ Acknowledgments

Built with:

  • n8n for workflow orchestration
  • Ollama for local LLM inference
  • PostgreSQL for reliable data storage
  • Redis for high-performance caching
  • Google Gemini API for advanced reasoning

πŸ“ž Support

For issues and questions:

  1. Check Issues
  2. Review Architecture Spec
  3. Check logs with docker-compose logs -f
  4. Open detailed issue with logs and screenshots

πŸ—ΊοΈ Roadmap

  • Phase 0: Fortress Construction
  • Phase 1: Sensory Integration (Signal inbox, Python bridge)
  • Phase 2: Cognitive Layer (Ollama agents, reasoning)
  • Phase 3: Governance Kernel (Priority engine, CIO schema)
  • Phase 4: Feedback Loop (Analytics, vector memory)
  • Multi-modal understanding (Vision + Audio)
  • Predictive analytics
  • Autonomous decision-making with human oversight

⭐ If you find this useful, please star the repository!

About

MetalOS: Revolutionary cognitive OS managing attention, context, intent, and meaning. Autonomous workflow orchestration via n8n, Ollama LLM, and PostgreSQL vector embeddings.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors