No description
  • Python 93.6%
  • Shell 6.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-01 10:21:23 +05:30
scripts feat: complete R.E.M.O backend, fallback engine, memory & systemd deployment 2026-10-01 10:07:13 +05:30
src/remo feat: add automatic owner pairing, group chat non-disturbance, and preserve pending updates 2026-10-01 10:21:23 +05:30
systemd feat: complete R.E.M.O backend, fallback engine, memory & systemd deployment 2026-10-01 10:07:13 +05:30
.env.example feat: complete R.E.M.O backend, fallback engine, memory & systemd deployment 2026-10-01 10:07:13 +05:30
.gitignore feat: complete R.E.M.O backend, fallback engine, memory & systemd deployment 2026-10-01 10:07:13 +05:30
README.md feat: complete R.E.M.O backend, fallback engine, memory & systemd deployment 2026-10-01 10:07:13 +05:30
requirements.txt feat: complete R.E.M.O backend, fallback engine, memory & systemd deployment 2026-10-01 10:07:13 +05:30

R.E.M.O (Responsive Embedded Memory Orchestrator)

Autonomous, Proactive "Secondary Brain" AI Companion for Hybrid Hardware.

R.E.M.O operates across a distributed two-node topology:

  1. Node A (Inference Hub - Lenovo LOQ): RTX 3050A GPU (4GB VRAM), 24GB RAM. Runs high-parameter Ollama models (qwen2.5:3b or llama3.2:3b) exposed over local network / Tailscale.
  2. Node B (Control Server - Lenovo V310 / i3-6006U): 8GB RAM, dual-core CPU. Runs 24/7. Hosts the Python orchestration engine, persistent SQLite database, ChromaDB vector store, APScheduler proactive loop, and Telegram bot.

🏛️ Architecture Overview

                      +------------------------------------------+
                      |         Telegram Client (Phone / PC)     |
                      +------------------------------------------+
                                           │
                                           │  HTTPS (Bot API)
                                           ▼
+──────────────────────────────────────────────────────────────────────────────────────────+
│ Node B: 24/7 Control Server (Lenovo V310 | Intel i3-6006U | 8GB RAM)                     │
│                                                                                          │
│  +─────────────────────────+     +───────────────────────────────────────────────────+   │
│  │   Telegram Bot Layer    │◄───►│            R.E.M.O Orchestrator (main.py)         │   │
│  │ (python-telegram-bot)   │     +───────────────────────────────────────────────────+   │
│  +─────────────────────────+               │                     │                       │
│                                            ▼                     ▼                       │
│  +─────────────────────────+     +──────────────────+   +────────────────────────────+   │
│  │   Proactive Scheduler   │     │ Persistent Store │   │       Tool Registry        │   │
│  │  - Reminder alerts (30s)│     │ - SQLite (db.py) │   │ - set_reminder()           │   │
│  │  - Hourly Heartbeat(60m)│     │ - ChromaDB (vec) │   │ - check_server_status()    │   │
│  +─────────────────────────+     +──────────────────+   │ - search_memory()          │   │
│                 │                                       │ - save_fact()              │   │
│                 ▼                                       +────────────────────────────+   │
│         [ Proactive Ping ]                                       │                       │
│                                                                  ▼                       │
│  +───────────────────────────────────────────────────────────────────────────────────+   │
│  │                     LLM Client with Circuit Breaker Failover                      │   │
│  +───────────────────────────────────────────────────────────────────────────────────+   │
│             │ (Primary: Connect timeout 3.5s)                      │ (Fallback)          │
+─────────────┼──────────────────────────────────────────────────────┼─────────────────────+
              │                                                      │
              ▼ (Tailscale IP / Local Wi-Fi)                         ▼ (Localhost:11434)
+─────────────────────────────────────────+         +──────────────────────────────────+
│ Node A: Inference Hub (Lenovo LOQ)      │         │ Local Ollama on Node B (i3 CPU)  │
│ - RTX 3050A GPU, 24GB RAM               │         │ - Model: qwen2.5:1.5b (CPU)      │
│ - Ollama on 0.0.0.0:11434               │         │ - Activated ONLY when Node A is  │
│ - Model: qwen2.5:3b + nomic-embed-text  │         │   asleep or unreachable          │
+─────────────────────────────────────────+         +──────────────────────────────────+

📂 Project Structure

REMO-AI/
├── .env.example              # Template configuration with all environment variables
├── .gitignore                # Excludes venv, data, logs, and sensitive credentials
├── README.md                 # Complete system architecture and operational manual
├── requirements.txt          # Python dependencies pinned for performance
├── scripts/
│   ├── deploy.sh             # Fast commit and git push to Node B remote
│   ├── setup_node_a.sh       # Automates Ollama GPU server setup on Node A (LOQ)
│   └── setup_node_b.sh       # Automates server setup, venv, and systemd on Node B
├── systemd/
│   └── remo.service          # Production systemd daemon unit file
└── src/
    └── remo/
        ├── __init__.py
        ├── main.py           # Application entry point & async lifecycle manager
        ├── config.py         # Type-safe environment loader and path validator
        ├── bot/
        │   ├── __init__.py
        │   └── telegram_bot.py # Async telegram bot, security whitelist & message router
        ├── llm/
        │   ├── __init__.py
        │   ├── client.py     # Remote inference engine with automatic failover
        │   └── prompts.py    # System prompts & proactive heartbeat reflection
        ├── memory/
        │   ├── __init__.py
        │   ├── db.py         # Async SQLite manager (messages, reminders, facts)
        │   └── vector_store.py # Persistent ChromaDB vector memory
        ├── scheduler/
        │   ├── __init__.py
        │   └── proactive.py  # APScheduler heartbeat loop & reminder dispatcher
        └── tools/
            ├── __init__.py
            ├── base.py       # Tool abstraction & Ollama JSON schema generator
            ├── registry.py   # Function-calling router & dispatcher
            └── system_tools.py # Reminders, server metrics, memory search & facts

🚀 Setup & Deployment Instructions

Phase 1: Setup Node A (Lenovo LOQ - Inference Hub)

  1. Make sure your Tailscale is running:

    tailscale status
    

    Note your Tailscale IP (e.g. 100.98.25.125).

  2. Run the automated Node A setup script:

    bash scripts/setup_node_a.sh
    

    This performs:

    • Configures Ollama systemd override with OLLAMA_HOST=0.0.0.0:11434.
    • Restarts Ollama and allows port 11434 through the firewall.
    • Pulls qwen2.5:3b and nomic-embed-text.
  3. Verify reachability:

    curl http://127.0.0.1:11434/api/tags
    

Phase 2: Push Code to Git Remote

From your LOQ workspace, push all project files to your server's Git repository:

git add .
git commit -m "Initialize R.E.M.O architecture and full backend"
git push origin main

Remote repository: https://remo-lenovo-v310-14isk.tail1fe50e.ts.net/Senju/R.E.M.O.git


Phase 3: Setup Node B (Lenovo V310 / i3 Control Server)

  1. SSH into Node B:

    ssh senju@100.90.191.40
    
  2. Clone or pull the repository on Node B:

    # If cloning for the first time:
    git clone https://remo-lenovo-v310-14isk.tail1fe50e.ts.net/Senju/R.E.M.O.git ~/Documents/REMO-AI
    cd ~/Documents/REMO-AI
    
    # Or if already present:
    cd ~/Documents/REMO-AI && git pull
    
  3. Run the automated server setup script:

    bash scripts/setup_node_b.sh
    
  4. Configure your .env file on Node B:

    nano .env
    

    Fill in your tokens:

    • TELEGRAM_BOT_TOKEN: Your token from @BotFather.
    • TELEGRAM_ALLOWED_USER_IDS: Your Telegram numerical User ID (get via @userinfobot).
    • PRIMARY_LLM_HOST: 100.98.25.125 (Node A's Tailscale IP).
    • FALLBACK_LLM_HOST: 127.0.0.1 (Node B local Ollama).
  5. Test run manually once:

    PYTHONPATH=src venv/bin/python -m remo.main
    

    Press Ctrl+C once verified.


Phase 4: Run as 24/7 Background Service (systemd)

Start and enable the systemd service so R.E.M.O starts on boot and restarts automatically if it crashes:

# Start service
sudo systemctl start remo.service

# Enable auto-start on boot
sudo systemctl enable remo.service

# Check live status
sudo systemctl status remo.service

# Stream live service logs
journalctl -u remo -f

⚡ Telegram Commands & Usage

Command Description Example
/start Activate bot & display connection status /start
/status View Node A reachability, Node B CPU/RAM, and active models /status
/remind Schedule a task with natural language time parsing /remind in 45 minutes to drink water
/reminders List all active pending reminders /reminders
/memory Inspect saved user profile or search vector database /memory project deadline
/clear Clear recent conversation history context /clear
/help Detailed guide and capabilities /help

Proactive Heartbeat Behavior

  • Every 30 seconds, R.E.M.O queries the SQLite database for due reminders and dispatches notifications instantly.
  • Every 60 minutes, R.E.M.O executes an autonomous reflection check.
  • During Quiet Hours (configured in .env, e.g. 23:00 to 07:00), non-urgent proactive messages are suppressed.
  • If there is an upcoming deadline or morning briefing (08:00–09:00), R.E.M.O proactively reaches out without requiring a user message.