Skip to content

iamLudok/Ludext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Ludext β€” Private AI Morning Briefing

License MIT Python Runs on Self-hosted

Ludext is a self-hosted assistant that runs on a Raspberry Pi. Every morning it collects your emails, calendar events, tasks, and news from your own infrastructure, summarizes everything with a local AI model, and sends you a Telegram message before you start your day.

No data ever leaves your home network. No subscriptions. No third-party AI APIs.


Why Ludext?

Most AI assistants send your personal data to external servers. Ludext is built around a different principle: your data stays yours.

  • 🧠 Local AI β€” Ollama runs the language model directly on your Raspberry Pi. Your emails and calendar are never sent to OpenAI, Anthropic, or any cloud provider.
  • 🏠 Self-hosted data β€” Nextcloud stores your calendar, tasks, notes, and news feeds on hardware you own and control.
  • πŸ’Έ No subscriptions β€” Once set up, Ludext runs for free indefinitely.

Tech Stack

Layer Technology Role
Email Gmail (IMAP) Fetches and filters unread messages
Self-hosted data Nextcloud Calendar, tasks, news feeds, notes
AI Ollama + Llama 3.2 3B Summarizes everything locally, no cloud
Delivery Telegram Bot Sends the briefing and accepts commands
Runtime Raspberry Pi 4/5 Runs the whole stack, 24/7

Features

Daily Briefing (automatic, every morning at 7:30)

  • πŸ“§ Unread emails β€” filtered and summarized, only what matters
  • πŸ“… Calendar β€” events for today and tomorrow
  • βœ… Pending tasks β€” most urgent ones highlighted
  • πŸ“° News β€” relevant articles from your Nextcloud News feeds
  • πŸ’Š Medicines β€” which ones to take today and at what time
  • πŸ€– AI summary β€” generated by a local LLM, sent to Telegram

Telegram Bot (always on, responds instantly)

Manage tasks, calendar events, medicines, shopping list, car expenses, and wishlist directly from Telegram. The bot also monitors system health and sends automatic alerts for high CPU temperature, RAM, or disk usage.

β†’ Full command reference
β†’ Feature documentation


Requirements

Hardware

  • Raspberry Pi 4 or 5 (8 GB RAM recommended)

Nextcloud apps

  • Calendar β€” for CalDAV events and tasks
  • News β€” for RSS feed summaries
  • Notes β€” for shopping list, car expenses, and medicine tracking

Other

  • A Gmail account with IMAP enabled
  • A Telegram account to create a bot
  • nmap installed on the Pi (for the /red command)

Installation

1. Clone the repository

git clone https://github.com/iamLudok/ludext.git ~/Ludext
cd ~/Ludext

2. Run the setup script

bash deploy/setup.sh

This installs system dependencies, creates a Python virtual environment, sets up Ollama with Llama 3.2 3B, configures the daily cron job at 7:30, and installs the Telegram bot as a systemd service.

3. Configure your credentials

cp .env.example .env
nano .env
Variable Description
GMAIL_USER Your Gmail address
GMAIL_APP_PASSWORD Gmail app password (see below)
NEXTCLOUD_URL Your Nextcloud URL, e.g. http://192.168.1.50:8080
NEXTCLOUD_USER Your Nextcloud username
NEXTCLOUD_PASSWORD Your Nextcloud password
NEXTCLOUD_CALDAV_URL Usually NEXTCLOUD_URL/remote.php/dav
OLLAMA_URL Leave as http://localhost:11434
OLLAMA_MODEL Leave as llama3.2:3b
TELEGRAM_TOKEN Your Telegram bot token
TELEGRAM_CHAT_ID Your Telegram chat ID

4. Gmail App Password

Gmail requires an app-specific password for IMAP access:

  1. Go to myaccount.google.com/security
  2. Enable 2-Step Verification if not already active
  3. Go to App passwords and create a new one named "Ludext"
  4. Copy the 16-character code into .env β†’ GMAIL_APP_PASSWORD

5. Telegram Bot

  1. Open Telegram and search for @BotFather
  2. Send /newbot and follow the steps
  3. Copy the token into .env β†’ TELEGRAM_TOKEN
  4. Send any message to your new bot, then open:
    https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
  5. Find "id" inside "chat" β€” that's your TELEGRAM_CHAT_ID

6. Register bot commands

This makes Telegram show the command menu when you type / in the chat.
Run setMyCommands once with whichever commands you want to expose (replace <YOUR_TOKEN>):

curl -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/setMyCommands" \
  -H "Content-Type: application/json" \
  -d '{
    "commands": [
      {"command": "ayuda", "description": "Muestra todos los comandos"},
      {"command": "tareas", "description": "Lista tus tareas pendientes"}
    ]
  }'

Full list of available commands: /ayuda inside the bot or docs/commands.md.
You only need to do this once β€” the commands persist on Telegram's side and survive bot restarts.

7. Test it

source ~/ludext-env/bin/activate
python3 ludext.py

Use --debug to inspect the prompt sent to the AI:

python3 ludext.py --debug
cat /tmp/ludext_prompt.txt

Project Structure

Ludext/
β”œβ”€β”€ .env.example            ← Template for .env
β”œβ”€β”€ .gitignore              ← Excludes files from git
β”œβ”€β”€ LICENSE                 ← MIT license
β”œβ”€β”€ ludext.py               ← Daily briefing script (runs via cron)
β”œβ”€β”€ README.md               ← Project documentation
β”œβ”€β”€ bot/
β”‚   β”œβ”€β”€ __main__.py         ← Telegram polling and background threads
β”‚   β”œβ”€β”€ background.py       ← Background alerts
β”‚   └── handlers.py         ← Telegram bot command handlers
β”œβ”€β”€ calendar/
β”‚   β”œβ”€β”€ events.py           ← Event CRUD (Nextcloud CalDAV)
β”‚   └── tasks.py            ← Task CRUD (Nextcloud CalDAV)
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ ai.py               ← Builds the prompt and queries Ollama
β”‚   β”œβ”€β”€ config.py           ← Reads .env and exposes CONFIG
β”‚   └── sources.py          ← Data collection (emails, calendar, tasks, news)
β”œβ”€β”€ deploy/
β”‚   └── setup.sh            ← Automated installation script
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ commands.md         ← Full Telegram command reference
β”‚   └── features.md         ← Feature documentation
β”œβ”€β”€ notes/
β”‚   β”œβ”€β”€ api.py              ← Nextcloud Notes interface
β”‚   β”œβ”€β”€ car.py              ← Car expenses
β”‚   β”œβ”€β”€ medicine.py         ← Medicine tracking
β”‚   β”œβ”€β”€ shopping.py         ← Shopping list
β”‚   └── wishlist.py         ← Wishlist
└── system/
    β”œβ”€β”€ monitor.py          ← System monitor (CPU temp, RAM, disk, uptime)
    └── network.py          ← Network device scanner

AI Model

By default Ludext uses Llama 3.2 3B, which runs comfortably on a Raspberry Pi 5 with 8 GB RAM. If you have more RAM available:

ollama pull llama3.2:8b    # Better quality, needs ~6 GB RAM
ollama pull gemma2:2b      # Lighter alternative

Then update OLLAMA_MODEL in your .env.


Cron & Services

crontab -l                                  # daily briefing schedule
sudo systemctl status ludext-bot            # Telegram bot service

cat ~/ludext.log                            # daily briefing logs
journalctl -u ludext-bot -n 50 --no-pager  # bot logs

License

MIT License β€” see LICENSE for details.

About

Ludext is a self-hosted assistant that runs on a Raspberry Pi. Every morning it collects your emails, calendar events, tasks, and news from your own infrastructure, summarizes everything with a local AI model, and sends you a Telegram message before you start your day.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors