homelab-brain/chatlogger/chatlogger-bot@.service
Homelab Cursor d82b6f97ef feat(chatlogger): multi-tenant + Jarvis tool integration
Phase 2 of the chatlogger feature.

Multi-tenant:
- chatlogger-bot.service -> chatlogger-bot@.service (systemd template)
- /opt/chatlogger/<instance>.env per bot, all share /opt/chatlogger/chats.db
- existing bot migrated: chatlogger-bot@arakawa.service
- adding a second group bot is now: cp arakawa.env <name>.env, edit token+chats,
  systemctl enable --now chatlogger-bot@<name>

Jarvis (hausmeister-bot) tool:
- homelab-ai-bot/tools/chatlog.py (autodiscovered by tool_loader.py)
- 4 tools: chatlog_list_chats, chatlog_recent, chatlog_search, chatlog_since
- Reads SQLite directly via sys.path += /opt/homelab-brain/chatlogger
- SYSTEM_PROMPT_EXTRA tells the LLM when to use these (Concierge, Airbnb,
  Listing, 'aktueller Stand', 'wer hat zugesagt', 'muss ich reagieren').

Tested live: hausmeister-bot loads 48 tools (44 + 4 new), all chatlog
handlers callable, returns real messages from the @arakawa_concierge_bot
recording of -1003924901022.
2026-05-01 12:13:00 +02:00

26 lines
682 B
Desktop File

[Unit]
Description=Chatlogger bot instance %i (passive Telegram group chat logger)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
WorkingDirectory=/opt/homelab-brain/chatlogger
EnvironmentFile=/opt/chatlogger/%i.env
Environment=PYTHONUNBUFFERED=1
Environment=CHATLOGGER_INSTANCE=%i
ExecStart=/opt/bot-venv/bin/python /opt/homelab-brain/chatlogger/chatlogger_bot.py
Restart=always
RestartSec=10
KillMode=control-group
TimeoutStopSec=10
# Hardening — bot only needs to read repo + write its own data dir.
ProtectSystem=strict
ReadWritePaths=/opt/chatlogger
ProtectHome=true
PrivateTmp=true
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target