Your self-hosted AI assistant on Telegram. Powered by Claude Code.
It searches the web, remembers your conversations, handles photos and documents, and runs 24/7 on your own server.
- Web search β finds and summarizes info from the web
- Photos & documents β send images, PDFs, files β it can see and read them
- Persistent memory β remembers facts about you and keeps daily logs
- Conversations that stick β sessions persist, context carries across messages
- Live progress updates β sends you updates while working on long tasks
- Message queuing β send multiple messages while it's thinking, they all get processed
- Cost alerts β warns you at 50%, 80%, 100% of your daily budget
- Auto-updates β pulls from git every 5 minutes, push a change and it goes live
- Autosync β automatically commits and pushes local changes (via cron)
- Startup notification β messages you when it comes back online
This is a step-by-step guide. If you're an AI agent setting this up for your user, follow every step.
- Open Telegram and message @BotFather
- Send
/newbot - Choose a name (e.g. "My Assistant") and a username (e.g.
my_lobster_bot) - BotFather gives you a token like
1234567890:ABCdefGHIjklMNOpqrsTUVwxyzβ save this
- Message @userinfobot on Telegram
- It replies with your user ID β a number like
8574346253β save this
Any Ubuntu VPS works. Recommended: Hostinger ($4-6/mo), DigitalOcean ($6/mo), or any provider with Ubuntu 22.04+.
You need:
- Ubuntu 22.04 or newer
- At least 1 GB RAM
- SSH access (root or sudo)
ssh root@your-server-ipEnter your password when prompted. If this is your first time connecting, type yes to accept the fingerprint.
curl -sSL https://raw.githubusercontent.com/agent-lab-skool/lobster-bot/main/deploy/install.sh | bashThis automatically installs:
- Python 3 + pip (if missing)
- Node.js (if missing)
- Claude Code CLI
- Clones the repo to
~/lobster-bot - Installs Python dependencies
- Creates a
.envtemplate - Sets up the systemd service
This is a one-time step. Run:
claudeIt will show a URL β open it in your browser and log in with your Anthropic account. Once authenticated, type /exit to quit Claude.
Note: If the OAuth gives an error, try again β it can be flaky. Or use an API key instead:
claude config set apiKey YOUR_ANTHROPIC_API_KEY(Get an API key from https://console.anthropic.com/settings/keys)
nano ~/lobster-bot/.envReplace the placeholder values with your real token and user ID:
TELEGRAM_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
TELEGRAM_USER_IDS=8574346253
Multiple users? Comma-separate them: TELEGRAM_USER_IDS=111,222,333
Save: Ctrl+O, Enter, Ctrl+X
systemctl enable --now lobster-botYou should get a "i'm back online π¦" message on Telegram. Send it a message to test.
Autosync commits and pushes any local changes every 5 minutes β keeps your memory, config, and customizations backed up to git.
crontab -eAdd this line:
*/5 * * * * /root/lobster-bot/deploy/autosync.sh >> /root/lobster-bot/logs/autosync.log 2>&1
The bot:
- Runs 24/7 as a systemd service
- Restarts automatically if it crashes or the server reboots
- Auto-pulls updates from git every 5 minutes
- Logs everything to
logs/bot.log
Just message it on Telegram like you'd text a friend. It's Claude β it can do anything Claude can do, but through Telegram.
Things you can do:
- Ask it anything β it searches the web if it doesn't know
- Send photos β it can see and describe images, read text in screenshots
- Send documents β PDFs, code files, spreadsheets, whatever
- Send voice messages β it receives the audio file
- Ask it to remember things β it saves facts about you between conversations
- Ask it to run commands on your server β it has full root access
- Paste API keys or credentials β it'll save them wherever you need
- Ask it to install software, edit configs, set up services on your VPS
Commands:
/newβ Start a fresh conversation (clears session context)/cancelβ Stop a running request/historyβ Browse recent conversations and resume past sessions/memoryβ View saved facts and daily logs/toolsβ Browse installed tools/agentsβ List configured agents/logsβ View bot logs and filter errors/statusβ Check current session ID/repoβ Git repo info (status, commits, branches)/restartβ Restart the bot service/helpβ List commands
Tips:
- If the bot seems confused or stuck on old context, send
/newto reset - Send
/cancelif a request is taking too long or you changed your mind - Long responses get split into chunks automatically (Telegram limit)
- The bot remembers you across conversations via
memory/facts.md - It keeps a daily log at
memory/daily/β you can ask "what did we talk about yesterday?" - If you send messages while it's busy, they queue up and get processed next
systemctl status lobster-botYou want to see active (running). If it says failed, check the logs.
# Live stream
journalctl -u lobster-bot -f
# Or read the log file directly
tail -100 ~/lobster-bot/logs/bot.logjournalctl -u lobster-bot --since "5 minutes ago""Failed to parse Claude response"
Claude Code returned an error. Check the full log with journalctl. Common causes:
- Claude Code not authenticated β run
claudeto login - Permission denied β check
.claude/settings.json - Network issue β check internet connectivity
Bot not responding at all
systemctl status lobster-botIf it's not running:
systemctl restart lobster-bot
journalctl -u lobster-bot --since "1 minute ago""Not authorized" reply
Your Telegram user ID in .env doesn't match. Check it:
cat ~/lobster-bot/.envCompare with what @userinfobot says.
Bot takes too long to respond Claude Code is running in the background β give it 10-30 seconds. If it's consistently slow, check server resources:
htopOAuth "Invalid code_challenge_method" error Known issue with Claude Code OAuth. Try:
- Run
claudeagain β sometimes it works on retry - Use API key instead:
claude config set apiKey YOUR_KEY
systemctl restart lobster-botsystemctl stop lobster-botcd ~/lobster-bot && git pull && systemctl restart lobster-botOr just wait β the bot auto-pulls every 5 minutes.
du -sh ~/lobster-bot/media/
du -sh ~/lobster-bot/memory/rm -rf ~/lobster-bot/media/*Or ask the bot to do it via Telegram β it has permission.
Telegram β python-telegram-bot β claude -p --output-format json β Telegram
core/bot.pyβ Telegram handlers, typing indicator, message queuing, cost alertscore/bridge.pyβ Claude Code subprocess wrapper with cancel supportcore/commands.pyβ Slash commands with inline keyboard UIcore/session.pyβ SQLite session, usage, and chat log trackingcore/config.pyβ Loads env varsrun.pyβ Entry point with rotating log file setup.claude/settings.jsonβ Tool permissions (allow/deny)CLAUDE.mdβ Bot personality and behavior instructionstools/telegram/send.shβ Send live updates to Telegram from Claudedeploy/autosync.shβ Cron-based git commit + pushmemory/β Facts, daily logs (written by the bot)media/{chat_id}/β Downloaded photos, docs, voice messages
Edit CLAUDE.md β this is the system prompt Claude sees every conversation.
Edit .claude/settings.json β add or remove tools from the allow/deny lists.
Edit DAILY_BUDGET in core/bot.py (default: $5.00/day).
Edit .env and add comma-separated user IDs:
TELEGRAM_USER_IDS=111,222,333
Then restart: systemctl restart lobster-bot
Built by Agent Lab β a community where we teach people how to build with AI. Come hang out.
If this is useful to you, a β on the repo goes a long way.