Agent Skill
2/7/2026

prose

OpenProse VM skill pack. Activate on any `prose` command, .prose files, or OpenProse mentions; orchestrates multi-agent workflows.

M
m
0GitHub Stars
1Views
npx skills add M-Dev-Lab/ultimate-agent

SKILL.md

Nameprose
DescriptionOpenProse VM skill pack. Activate on any `prose` command, .prose files, or OpenProse mentions; orchestrates multi-agent workflows.

Ultimate Agent v5.0

AI-powered autonomous agent ecosystem with multi-LLM orchestration, social media automation, and wireless mobile device fleet management.

Built on FastAPI, Multi-LLM Router (Ollama/Gemini/Claude/GPT), Autonomous Scheduling, Mobile Device Farm, and comprehensive security (OWASP ASI compliant). Runs local-first on your Linux machine with wireless Android device orchestration β€” no cloud deployment required.


🎯 What's New in v5.0

βœ… Completed Enhancements

  • Multi-LLM Orchestrator: Smart routing across Ollama (local), Gemini (free tier), Claude (premium), and GPT (budget)
  • Wireless Mobile Fleet: Android devices connected via WiFi (ADB over WiFi + HTTP API + MQTT)
  • Network Architecture: Linux orchestrator on Ethernet, Android agents on WiFi with internet-based communication
  • Social Agent v2: AI-powered caption generation with platform-specific hashtags
  • Content Generation Pipeline: Trending topic-based bulk content generation (20+ items queue)
  • Autonomous Scheduling: Background posting, learning, health checks, and content generation
  • Enhanced Security: OWASP ASI Top 10 compliance with per-agent security profiles

πŸ”„ In Progress

  • Unified UX with Master Orchestrator and confirmation workflows
  • Menu consolidation (removing duplicate buttons)
  • Niche configuration UI for social agent
  • MQTT real-time control for mobile devices (optional)

πŸ“‹ Consolidated Task Status

Based on the complete MP files review, here's the comprehensive status:

Architecture & Core Systems βœ…

  • Multi-LLM Router with 4 provider clients (Ollama, Gemini, Claude, OpenAI)
  • Task-based routing with smart fallback chains
  • Budget controls and cost tracking per provider
  • Adaptive infrastructure (local-first, Docker optional)
  • File-based event bus for local mode (no Redis required)
  • Security gateway with per-agent tool allowlists
  • Key vault with encrypted API key management

Social Media Automation βœ…

  • AI caption generation for images/videos (Gemini Flash + Ollama)
  • Platform-specific hashtag optimization (5-10 for Instagram, 1-2 for Twitter)
  • Content queue system with 20+ items pre-generated
  • Scheduling with random jitter (20min intervals)
  • Post-and-delete workflow with verification
  • Brand voice configuration system
  • Trending topic integration (Google Trends + NewsAPI)

Mobile Device Fleet 🟑

  • ADB over WiFi connection (one-time USB setup per device)
  • HTTP API server deployment on Android (Termux)
  • Health monitoring with auto-reconnect (30s intervals)
  • Device fleet configuration and registry
  • MQTT real-time control (optional, in progress)
  • Offline queue with resilience (planned)
  • Fleet status dashboard via Telegram (planned)

Code Duplication Fixes πŸ”„

  • Delete social_automation_bot.py (V1) - superseded by V2
  • Delete android_posting_scheduler.py - superseded by autonomous_scheduler
  • Consolidate restart/shutdown logic into system_control.py
  • Remove duplicate Telegram handlers from telegram_bot.py
  • Create social_apps/constants.py for package names
  • Merge SocialPosterSkill into SocialMediaManager
  • Consolidate menu display functions into MenuManager

πŸ—οΈ Architecture

Network Topology

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Linux Orchestrator (Ethernet Connected)        β”‚
β”‚      Your Main Machine - ultimate-agent running        β”‚
β”‚                                                        β”‚
β”‚  β”œβ”€ Multi-LLM Router (Ollama/Gemini/Claude/GPT)      β”‚
β”‚  β”œβ”€ Master Orchestrator (Task Routing)                β”‚
β”‚  β”œβ”€ Social Agent (Content Generation)                 β”‚
β”‚  β”œβ”€ Content Generation Agent (Trending Topics)        β”‚
β”‚  β”œβ”€ Learning Agent (RAG + Self-Improvement)           β”‚
β”‚  β”œβ”€ Mobile Fleet Manager (Device Orchestration)       β”‚
β”‚  β”œβ”€ Autonomous Scheduler (Background Jobs)            β”‚
β”‚  └─ Telegram Bot (Admin Interface)                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    ↓ Internet via Ethernet ↓
                    ↓  (Router/WiFi Network) ↓
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    ↓ WiFi                        WiFi ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Android Burner 1 β”‚      β”‚ Android Burner 2 β”‚
β”‚  (WiFi Connected)β”‚      β”‚  (WiFi Connected)β”‚
β”‚                  β”‚      β”‚                  β”‚
β”‚ β”œβ”€ HTTP Server   β”‚      β”‚ β”œβ”€ HTTP Server   β”‚
β”‚ β”‚  Port 8000     β”‚      β”‚ β”‚  Port 8000     β”‚
β”‚ β”œβ”€ ADB Daemon    β”‚      β”‚ β”œβ”€ ADB Daemon    β”‚
β”‚ β”‚  Port 5555     β”‚      β”‚ β”‚  Port 5555     β”‚
β”‚ β”œβ”€ MQTT Client   β”‚      β”‚ β”œβ”€ MQTT Client   β”‚
β”‚ └─ Termux Agent  β”‚      β”‚ └─ Termux Agent  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Points:

  • Linux Machine: Connected via Ethernet cable for stable, high-speed internet
  • Android Devices: Connected to the same WiFi network (no USB required after initial setup)
  • Communication: ADB over WiFi (file transfer), HTTP API (social posting), MQTT (real-time commands)
  • Content Flow: Linux generates content β†’ Sends to Android local storage β†’ Android devices post automatically

System Components

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    MULTI-LLM ORCHESTRATOR                     β”‚
β”‚  Smart routing: Gemini (free) β†’ Claude (premium) β†’ Ollama    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 MASTER ORCHESTRATOR (Brain)                   β”‚
β”‚  LLM-powered routing + Confirmation workflow + State Manager  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          ↓
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    ↓         ↓          ↓          ↓          ↓          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Code   β”‚ β”‚Socialβ”‚ β”‚ Content  β”‚ β”‚ Learn  β”‚ β”‚  Device  β”‚
β”‚  Agent  β”‚ β”‚Agent β”‚ β”‚   Gen    β”‚ β”‚ Agent  β”‚ β”‚   Farm   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            SHARED INFRASTRUCTURE (Adaptive)                   β”‚
β”‚  Local: SQLite + FileEventBus + APScheduler                  β”‚
β”‚  Docker: PostgreSQL + Redis + APScheduler (optional)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Linux (Ubuntu/Debian recommended) with Ethernet connection
  • Python 3.10+
  • Ollama running locally (ollama serve)
  • Telegram Bot Token from @BotFather
  • Your Telegram ID from @userinfobot
  • Android devices on the same WiFi network as the Linux machine

Installation

git clone https://github.com/M-Dev-Lab/ultimate-agent.git
cd ultimate-agent

# Run the setup script (creates directories, .env, installs dependencies)
./start-agent.sh setup

# Edit configuration
nano config/secrets.env
# Add your credentials:
#   TELEGRAM_BOT_TOKEN=your_bot_token
#   ADMIN_TELEGRAM_IDS=[your_telegram_id]
#   GEMINI_API_KEY=your_gemini_key (optional, free tier available)
#   ANTHROPIC_API_KEY=your_claude_key (optional, premium features)

Run

# Start the agent (local-first mode)
./start-agent.sh start

# The agent will:
# 1. Check Ollama is running (starts local LLM)
# 2. Initialize Multi-LLM Router (Gemini free β†’ Claude β†’ Ollama fallback)
# 3. Start FastAPI server on localhost:8000
# 4. Start Telegram bot
# 5. Start autonomous scheduler (background jobs)

Mobile Device Setup (One-Time Per Device)

Step 1: Initial USB Setup (Required Once)

# Connect device via USB
adb devices  # Verify device is connected

# Enable ADB over WiFi on port 5555
adb tcpip 5555

# Get device IP address
DEVICE_IP=$(adb shell ip -f inet addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
echo "Device IP: $DEVICE_IP"

# Add to device registry
echo "Record this IP in config/mobile_fleet.json"

Step 2: Deploy Termux Agent (On Android Device)

# Install Termux from F-Droid (not Play Store)
# Open Termux on the device and run:

pkg update && pkg upgrade -y
pkg install python openssh -y
pip install fastapi uvicorn pydantic

# Download agent server script
curl -o ~/termux_agent_server.py \
  https://raw.githubusercontent.com/M-Dev-Lab/ultimate-agent/main/provision/termux_agent_server.py

# Set device ID (unique per device)
export DEVICE_ID="burner_1"
echo "export DEVICE_ID='burner_1'" >> ~/.bashrc

# Start server
python ~/termux_agent_server.py &

# Make it auto-start on boot
mkdir -p ~/.termux/boot
echo '#!/data/data/com.termux/files/usr/bin/bash' > ~/.termux/boot/start_agent.sh
echo 'termux-wake-lock' >> ~/.termux/boot/start_agent.sh
echo 'cd ~' >> ~/.termux/boot/start_agent.sh
echo 'python termux_agent_server.py &' >> ~/.termux/boot/start_agent.sh
chmod +x ~/.termux/boot/start_agent.sh

Step 3: Connect Wirelessly from Linux

# Now disconnect USB cable from the device
# From your Linux machine:

# Connect to device over WiFi
adb connect $DEVICE_IP:5555

# Verify connection
adb devices
# Output should show: 192.168.x.x:5555   device

# Test HTTP API
curl http://$DEVICE_IP:8000/health
# Should return: {"device_id": "burner_1", "status": "healthy", ...}

Step 4: Update Device Registry

Edit config/mobile_fleet.json:

{
  "devices": [
    {
      "id": "burner_1",
      "ip": "192.168.1.100",
      "port": 5555,
      "name": "Samsung A12 - Social Agent 1",
      "platforms": ["facebook", "twitter"],
      "status": "online",
      "http_api_port": 8000
    },
    {
      "id": "burner_2",
      "ip": "192.168.1.101",
      "port": 5555,
      "name": "Xiaomi Redmi - Social Agent 2",
      "platforms": ["linkedin", "instagram"],
      "status": "online",
      "http_api_port": 8000
    }
  ]
}

πŸ“± Telegram Commands

Main Menu

🏠 MAIN MENU
β”œβ”€β”€ πŸ’¬ Chat        β†’ Natural language commands
β”œβ”€β”€ πŸ”¨ Code        β†’ Code Agent (build, analyze, refactor)
β”œβ”€β”€ πŸ“± Social      β†’ Social Agent (post, schedule, analytics)
β”œβ”€β”€ 🧠 Learn       β†’ Learning Agent (RAG, document ingestion)
β”œβ”€β”€ πŸ‘₯ All Agents  β†’ Sub-agent selector
β”œβ”€β”€ βš™οΈ System      β†’ System controls (restart, shutdown, health)
β”œβ”€β”€ πŸ“Š Status      β†’ Full system status report
└── ❓ Help        β†’ Command reference

Social Media Commands

πŸ“± SOCIAL MENU
β”œβ”€β”€ πŸ“€ Post Now     β†’ /post_now      β†’ Post from content queue
β”œβ”€β”€ πŸ”₯ Viral Scan   β†’ /viral_scan    β†’ Scan trending topics
β”œβ”€β”€ πŸ“… Schedule     β†’ /schedule      β†’ View/modify posting schedule
β”œβ”€β”€ πŸ“ˆ Analytics    β†’ /social_stats  β†’ Engagement metrics
β”œβ”€β”€ 🌊 Trending     β†’ /trending      β†’ Current trending topics
β”œβ”€β”€ ⏸️ Pause        β†’ /social_pause  β†’ Pause automated posting
β”œβ”€β”€ ▢️ Resume       β†’ /social_resume β†’ Resume automated posting
β”œβ”€β”€ 🎨 Brand Voice  β†’ /brand_voice   β†’ Configure brand voice
└── πŸ“± Devices      β†’ /farm_status   β†’ Mobile fleet status

LLM & Budget Commands

🧠 BRAIN MENU
β”œβ”€β”€ πŸ€– LLM Status  β†’ /llm_status    β†’ Provider health & usage
β”œβ”€β”€ πŸ’° Budget      β†’ /budget        β†’ Spending overview
β”œβ”€β”€ πŸ“Š Analytics   β†’ /brain_stats   β†’ Model performance comparison
β”œβ”€β”€ 🎯 Skills      β†’ /skills        β†’ Manage agent skills
β”œβ”€β”€ πŸ’Ύ Memory      β†’ /memory        β†’ View/edit agent memories
└── πŸ”„ Improve     β†’ /improve       β†’ Trigger optimization cycle

🎨 Features

Multi-LLM Smart Routing

The agent automatically routes tasks to the optimal LLM based on task type, cost, and availability:

  • Gemini Free Tier (primary for high-volume tasks)

    • Caption generation: 250 posts/day
    • Hashtag generation: 1,000/day (Flash-Lite)
    • Trending analysis: 100/day (Pro)
  • Claude (premium for complex reasoning)

    • Weekly strategy reports (Sonnet)
    • Skill generation (Sonnet)
    • Architecture decisions (Opus)
  • OpenAI GPT (budget-conscious)

    • GPT-4.1 Nano ($0.10/1M tokens)
    • GPT-4o Mini (general tasks)
  • Ollama Local (unlimited, zero cost)

    • Quality scoring (Llama 3.2 8B)
    • Hashtag generation (unlimited)
    • Fallback for all tasks

Budget Controls:

  • Daily spending cap: $5.00 (configurable)
  • Per-provider limits (Claude: $3/day, OpenAI: $2/day)
  • Alerts at 80% of budget
  • Auto-downgrade to cheaper models under pressure

Social Media Automation

Content Creation Pipeline:

  1. Fetch trending topics (Google Trends + NewsAPI + RSS)
  2. Filter by niche/domain preferences
  3. Generate captions with AI (Gemini Flash)
  4. Generate platform-specific hashtags (Ollama)
  5. Quality scoring (Ollama, 1-10 scale)
  6. Queue items above threshold (default: 7.0)
  7. Below-threshold items go to review folder

Automated Posting:

  • Randomized 20-minute intervals with jitter
  • Platform-specific caption formatting
  • Hashtag optimization (Instagram: 5-10, Twitter: 1-2, LinkedIn: 3-5)
  • Post-and-delete workflow (removes source files after successful post)
  • Verification with screenshot capture
  • Engagement tracking and analytics

Supported Platforms:

  • Facebook (Playwright + Appium)
  • Twitter/X (Playwright + Appium)
  • LinkedIn (Playwright + Appium)
  • Instagram (Appium only)
  • TikTok (Appium planned)

Mobile Device Fleet

Wireless Orchestration:

  • ADB over WiFi (file transfer, app installation)
  • HTTP API (social posting, health checks)
  • MQTT (real-time commands, optional)
  • Auto-reconnect on connection loss
  • Load balancing across devices
  • Per-device platform assignment

Health Monitoring:

  • Battery status tracking
  • Connection status (online/offline)
  • Last seen timestamp
  • Auto-alerts on device offline

Content Distribution:

  • Linux generates content β†’ Saves to device local storage β†’ Device posts automatically
  • Queue management per device
  • Offline resilience with retry logic

Autonomous Learning (RAG)

  • ChromaDB vector store with Ollama nomic-embed-text embeddings
  • Document Ingestion β€” 5-layer fetch chain
  • Auto-Refresh Scheduler β€” decay rates (hourly/daily/weekly)
  • Self-Skill Writing β€” Claude Sonnet generates new skills autonomously
  • Weekly Strategy Reports β€” Analyze performance, suggest optimizations

Security (OWASP ASI Compliant)

  • Per-Agent Tool Allowlists β€” Social agent cannot execute shell commands
  • Per-Agent LLM Access β€” Budget agents use Ollama/Gemini only
  • Prompt Injection Detection β€” Input sanitization on all LLM calls
  • Memory Integrity Checks β€” Expiration and isolation
  • Circuit Breakers β€” Auto-disable on repeated failures
  • Audit Logging β€” Every action logged with agent ID

πŸ“ Project Structure

ultimate-agent/
β”œβ”€β”€ README.md                            # This file
β”œβ”€β”€ ULTIMATE_AGENT_v5_COMPLETE_PLAN.md   # Complete v5.0 specification
β”œβ”€β”€ ENHANCEMENT_PLAN_V5.md               # Enhancement roadmap
β”œβ”€β”€ DUPLICATION_ANALYSIS.md              # Code duplication audit
β”œβ”€β”€ KNOWLEDGE_BASE.md                    # Technical knowledge base
β”‚
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ llm.yaml                        # β˜… Multi-LLM routing config
β”‚   β”œβ”€β”€ secrets.env.example             # β˜… API key template
β”‚   β”œβ”€β”€ secrets.env                     # β˜… Your API keys (gitignored)
β”‚   β”œβ”€β”€ agents.yaml                     # Sub-agent configurations
β”‚   β”œβ”€β”€ social.yaml                     # Platform configs, hashtags
β”‚   β”œβ”€β”€ content.yaml                    # Content generation settings
β”‚   β”œβ”€β”€ brand_voice.yaml                # Brand voice configuration
β”‚   β”œβ”€β”€ farm.yaml                       # Device fleet configuration
β”‚   β”œβ”€β”€ security.yaml                   # Per-agent security profiles
β”‚   β”œβ”€β”€ mobile_fleet.json               # Device registry (IPs, status)
β”‚   └── menu_structure.json             # Telegram menu tree
β”‚
β”œβ”€β”€ input/                              # Content ready for posting
β”‚   β”œβ”€β”€ images/                         # .jpg/.png + .meta.yaml sidecars
β”‚   β”œβ”€β”€ videos/                         # .mp4/.mov + .meta.yaml
β”‚   β”œβ”€β”€ reels/                          # Short-form vertical + .meta.yaml
β”‚   β”œβ”€β”€ stories/                        # Ephemeral content + .meta.yaml
β”‚   └── review/                         # Below-threshold, needs admin OK
β”‚
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ agent.db                        # β˜… SQLite database (local-first)
β”‚   β”œβ”€β”€ events/                         # β˜… FileEventBus message store
β”‚   β”œβ”€β”€ content_queue/                  # Pre-generated content (20+ items)
β”‚   β”œβ”€β”€ posted/                         # Archive of posted content
β”‚   β”œβ”€β”€ analytics/                      # Engagement metrics
β”‚   β”œβ”€β”€ learnings/                      # Auto-learn insights
β”‚   └── trending/                       # Cached trending topics
β”‚
β”œβ”€β”€ python-agent/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py                     # FastAPI entry point
β”‚   β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”‚   β”œβ”€β”€ llm_router.py           # β˜… Multi-LLM orchestrator
β”‚   β”‚   β”‚   β”œβ”€β”€ key_vault.py            # β˜… API key management
β”‚   β”‚   β”‚   β”œβ”€β”€ infrastructure.py       # β˜… Adaptive local/docker
β”‚   β”‚   β”‚   β”œβ”€β”€ file_event_bus.py       # β˜… File-based pub/sub
β”‚   β”‚   β”‚   β”œβ”€β”€ agent_security.py       # Security gateway
β”‚   β”‚   β”‚   β”œβ”€β”€ cost_tracker.py         # β˜… Budget monitoring
β”‚   β”‚   β”‚   └── config.py               # Pydantic settings
β”‚   β”‚   β”œβ”€β”€ providers/                  # β˜… LLM provider clients
β”‚   β”‚   β”‚   β”œβ”€β”€ ollama_client.py
β”‚   β”‚   β”‚   β”œβ”€β”€ gemini_client.py
β”‚   β”‚   β”‚   β”œβ”€β”€ claude_client.py
β”‚   β”‚   β”‚   β”œβ”€β”€ openai_client.py
β”‚   β”‚   β”‚   └── base_provider.py
β”‚   β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”‚   β”œβ”€β”€ master_orchestrator.py  # Main brain / coordinator
β”‚   β”‚   β”‚   β”œβ”€β”€ base_agent.py           # Universal sub-agent template
β”‚   β”‚   β”‚   β”œβ”€β”€ agent_factory.py        # Agent creation factory
β”‚   β”‚   β”‚   β”œβ”€β”€ social_agent.py         # β˜… Enhanced with AI captions
β”‚   β”‚   β”‚   β”œβ”€β”€ content_agent.py        # β˜… Trending-based content gen
β”‚   β”‚   β”‚   β”œβ”€β”€ learn_agent.py          # β˜… RAG + self-improvement
β”‚   β”‚   β”‚   β”œβ”€β”€ farm_manager.py         # β˜… Device fleet orchestration
β”‚   β”‚   β”‚   └── code_agent.py           # Code generation agent
β”‚   β”‚   β”œβ”€β”€ integrations/
β”‚   β”‚   β”‚   β”œβ”€β”€ telegram_bot.py
β”‚   β”‚   β”‚   β”œβ”€β”€ mobile_fleet_manager.py # β˜… ADB WiFi manager
β”‚   β”‚   β”‚   β”œβ”€β”€ mobile_automator.py     # UIAutomator2 wrapper
β”‚   β”‚   β”‚   β”œβ”€β”€ autonomous_scheduler.py # Background job scheduler
β”‚   β”‚   β”‚   β”œβ”€β”€ caption_generator.py    # β˜… AI caption generation
β”‚   β”‚   β”‚   β”œβ”€β”€ news_sources.py         # Google Trends + NewsAPI
β”‚   β”‚   β”‚   └── ollama.py
β”‚   β”‚   β”œβ”€β”€ skills/
β”‚   β”‚   β”‚   β”œβ”€β”€ registry.py
β”‚   β”‚   β”‚   β”œβ”€β”€ base_skill.py
β”‚   β”‚   β”‚   β”œβ”€β”€ social_media_manager.py # β˜… Social posting skill
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ handlers/
β”‚   β”‚   β”‚   β”œβ”€β”€ social_config_handlers.py # β˜… Niche configuration UI
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   └── tests/
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ provision/
β”‚   β”œβ”€β”€ termux_agent_server.py          # β˜… HTTP API server (deploy to Android)
β”‚   β”œβ”€β”€ termux_mqtt_client.py           # β˜… MQTT client (deploy to Android)
β”‚   β”œβ”€β”€ on_device_agent.py              # Self-contained on-device agent
β”‚   └── deploy_termux_agent.sh          # β˜… Deployment script
β”‚
β”œβ”€β”€ memory/
β”‚   β”œβ”€β”€ SOUL.md                         # Agent personality
β”‚   β”œβ”€β”€ IDENTITY.md                     # User profile
β”‚   β”œβ”€β”€ MEMORY.md                       # Long-term facts
β”‚   β”œβ”€β”€ HEARTBEAT.md                    # Proactive monitoring
β”‚   └── agents/
β”‚       β”œβ”€β”€ social_memory.md            # β˜… Social agent memory (niche, brand voice)
β”‚       β”œβ”€β”€ content_memory.md           # Content generation preferences
β”‚       └── learn_memory.md             # Learning agent memory
β”‚
β”œβ”€β”€ start-agent.sh                      # β˜… Local-first startup script
β”œβ”€β”€ start-mobile.sh                     # Mobile-specific setup
β”œβ”€β”€ docker-compose.yml                  # β˜… Optional: only for scale mode
└── Dockerfile                          # β˜… Optional: only for scale mode

🌐 Environment Variables

Required

# Telegram Bot
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
ADMIN_TELEGRAM_IDS=[your_telegram_id]

# JWT Secret (min 32 chars)
JWT_SECRET=your-secret-key-at-least-32-characters-long

Optional LLM Providers

# Google Gemini (FREE TIER - no credit card needed!)
# Get key at: https://aistudio.google.com/apikey
GEMINI_API_KEY=your_gemini_key

# Anthropic Claude (premium, best quality)
# Get key at: https://platform.claude.com/settings/keys
ANTHROPIC_API_KEY=your_claude_key

# OpenAI GPT (requires $5 minimum deposit)
# Get key at: https://platform.openai.com/api-keys
OPENAI_API_KEY=your_openai_key

Content Sources

# NewsAPI (free tier: 100 requests/day)
# Get key at: https://newsapi.org/register
NEWSAPI_KEY=your_newsapi_key

Ollama

OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=qwen2.5-coder:7b          # Auto-detected by start script
OLLAMA_API_KEY=                         # Optional: Ollama Cloud API key
EMBEDDING_MODEL=nomic-embed-text

System

DATABASE_URL=sqlite:///./data/agent.db
ENVIRONMENT=development                 # development, staging, production
DEBUG=false
LOG_LEVEL=INFO
AUTONOMOUS_MODE=true
CHECK_INTERVAL=300                      # Autonomous task check interval (seconds)

πŸ’° Cost Optimization

Free Tier Strategy (Zero Cost Operation)

  1. Ollama Local (unlimited, $0)

    • Primary for high-volume tasks (hashtags, quality scoring)
    • Fallback for all tasks when cloud APIs fail
    • Models: Llama 3.3 70B, Mistral 3.1 24B, Qwen 2.5 7B
  2. Gemini Free Tier ($0, no credit card)

    • Caption generation: 250/day (Flash)
    • Trending analysis: 100/day (Pro)
    • Image prompts: 1,000/day (Flash-Lite)
  3. Total Monthly Cost: $0

    • Perfect for: 5-10 posts/day, 20+ pre-generated items, trending content

Premium Strategy ($10-50/month)

Add Claude for complex reasoning:

  • Weekly strategy reports (1x/week, Sonnet)
  • Skill generation (rare, Sonnet)
  • Architecture decisions (rare, Opus)

Budget caps prevent runaway costs:

budget:
  daily_max_usd: 5.00
  monthly_max_usd: 50.00
  alert_at_percent: 80
  per_provider_daily:
    claude: 3.00
    openai: 2.00

πŸ§ͺ Testing

cd python-agent
source venv/bin/activate

# Run all tests
pytest tests/ -v

# Test LLM Router
pytest tests/test_llm_router.py -v

# Test Mobile Fleet
pytest tests/test_mobile_fleet_manager.py -v

# Test Social Agent
pytest tests/test_social_agent.py -v

# With coverage
pytest --cov=app tests/

🚒 Deployment

Local-First (Recommended)

# Just run the script
./start-agent.sh start

Systemd Service

sudo tee /etc/systemd/system/ultimate-agent.service << 'EOF'
[Unit]
Description=Ultimate Agent v5.0
After=network.target ollama.service

[Service]
Type=simple
User=YOUR_USER
WorkingDirectory=/path/to/ultimate-agent/python-agent
Environment=PATH=/path/to/ultimate-agent/python-agent/venv/bin:/usr/local/bin:/usr/bin
ExecStart=/path/to/ultimate-agent/python-agent/venv/bin/uvicorn app.main:app --host 127.0.0.1 --port 8000
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable ultimate-agent
sudo systemctl start ultimate-agent

Docker (Optional, for Scale)

Only use Docker when you need:

  • Multiple machines orchestration
  • CI/CD pipelines
  • Team collaboration with identical environments
docker-compose up -d

πŸ“Š Monitoring & Analytics

Health Check

curl http://localhost:8000/health

LLM Provider Status

Via Telegram: /llm_status

Shows:

  • Provider health (βœ… online, ❌ offline)
  • Requests today / rate limits
  • Cost today / budget remaining
  • Last error (if any)

Mobile Fleet Status

Via Telegram: /farm_status

Shows:

  • Device online/offline status
  • Battery percentage
  • Last seen timestamp
  • Platform assignments

Budget Overview

Via Telegram: /budget

Shows:

  • Daily/monthly spending
  • Per-provider breakdown
  • Alerts threshold (80% by default)
  • Cost per task type

πŸ”’ Security

OWASP ASI Top 10 Compliance

RiskMitigation
ASI-01: Agent HijackingInput sanitization, prompt isolation
ASI-02: Tool MisusePer-agent tool allowlists
ASI-03: Cascading FailuresCircuit breakers, error isolation
ASI-04: Unauthorized AutonomyHITL for critical actions
ASI-05: Memory PoisoningIntegrity checks, expiration
ASI-06: Data ExfiltrationNetwork egress controls
ASI-07: Supply ChainSkill vetting, sandboxed execution
ASI-08: Excessive TrustValidate agent output
ASI-09: Logging GapsStructured audit logs
ASI-10: Insecure ConfigValidation on startup

Network Security

  • All services bound to 127.0.0.1 (localhost only)
  • Mobile devices communicate via same WiFi network
  • Optional: Use VPN (Tailscale) for internet-based control
  • HTTP API authentication tokens (planned)
  • MQTT TLS encryption (optional)

πŸ›£οΈ Roadmap

v5.1 (March 2026)

  • Complete menu consolidation (remove duplicate buttons)
  • Unified Master Orchestrator with confirmation workflows
  • MQTT real-time control for mobile devices
  • Offline queue with resilience

v5.2 (April 2026)

  • A/B testing for captions (multiple variants per post)
  • Engagement prediction (ML model)
  • Video content generation (text-to-video)
  • Story/Reels automation

v6.0 (May 2026)

  • Multi-user support (separate agent instances)
  • Voice command support via Telegram
  • Web dashboard (non-Telegram management)
  • Cloud-based device orchestration (AWS/GCP emulators)

πŸ› Known Issues

Code Duplication (In Progress)

See DUPLICATION_ANALYSIS.md for detailed audit. Key duplications:

  • social_automation_bot.py (V1) needs deletion
  • android_posting_scheduler.py superseded
  • Telegram handlers duplicated in 2 files
  • Restart/shutdown logic duplicated
  • Android package names defined 4Γ— times

Action: Following the prioritized cleanup plan in DUPLICATION_ANALYSIS.md

Network Connectivity

Issue: Android devices lose ADB WiFi connection after router reboot or IP change

Workaround:

  • Mobile Fleet Manager auto-reconnects every 30s
  • Use static IP assignment in router DHCP settings
  • Fallback to HTTP API when ADB connection is lost

πŸ“š Documentation


🀝 Contributing

See CONTRIBUTING.md for guidelines.

Key principles:

  • Local-first architecture (Docker optional)
  • No code duplication (DRY principle)
  • Security-first design (OWASP ASI)
  • Test coverage >85%

πŸ“ License

MIT License - see LICENSE for details.


Version: 5.0.0
Updated: February 21, 2026
Maintained by: M-Dev-Lab

Network Architecture: Linux orchestrator (Ethernet) + Android devices (WiFi) + Internet-based communication
Cost to Operate: $0/month (Ollama + Gemini free tier) to ~$50/month (with Claude + GPT)
Autonomous Operation: 90% (minimal manual intervention)

Skills Info
Original Name:proseAuthor:m