From 2ad8a7928d3f3e82b557fdcca853d45cc9e69371 Mon Sep 17 00:00:00 2001 From: dwrz Date: Sun, 4 Jan 2026 21:09:05 +0000 Subject: [PATCH] Add example configuration and systemd units --- config.example.yaml | 110 +++++++++++++++++++++++++++++ init/systemd/system/raven@.service | 22 ++++++ init/systemd/user/raven.service | 19 +++++ 3 files changed, 151 insertions(+) create mode 100644 config.example.yaml create mode 100644 init/systemd/system/raven@.service create mode 100644 init/systemd/user/raven.service diff --git a/config.example.yaml b/config.example.yaml new file mode 100644 index 0000000..5e7b5c8 --- /dev/null +++ b/config.example.yaml @@ -0,0 +1,110 @@ +# Example Configuration +# Copy this file to config.yaml and edit as needed. +# Environment variables can be used with ${VAR} syntax. + +# Number of concurrent message processing workers (LLM queries + SMTP sends). +# Default: 1 (for llama.cpp without the -np / --parallel flag). +concurrency: 1 + +# How long to wait for in-flight messages during shutdown. +shutdown_timeout: 30s + +# Message filtering configuration. +# All specified filters are AND'd together. +# Excluding allowed_senders, filters are used for IMAP search and will match +# substrings. +filters: + # Only accept emails from these addresses (case-insensitive exact match). + # Empty list = accept from anyone (not recommended for production). + allowed_senders: + - trusted@example.com + # - another@example.com + + # Only process emails with body containing these keywords. + # body: + # - "token:e5a78ec2-18f5-4d13-8e97-4062393eb439" + # - "user:e8220e30-cdb6-4c20-a579-35c757bddb7b" + + # Only process emails with subject containing this string. + # subject: "[AI]" + + # Only process emails sent to this address. + # Useful for plus-addressing: you+ai@example.com + # to: you+ai@example.com + +# IMAP server connection for reading messages. +imap: + host: imap.gmail.com + port: "993" + user: you@gmail.com + password: ${RAVEN_IMAP_PASSWORD} + +# Message retrieval strategy. +intake: + # Mode: idle | poll + # - idle: Use IMAP IDLE for real-time notifications (requires server support) + # - poll: Periodically check for new messages + mode: poll + # How often to poll for new messages (only used in poll mode). + poll_interval: 30s + +# LLM configuration. +llm: + url: http://localhost:8080/v1 + key: ${RAVEN_LLM_KEY} + model: local-model + system_prompt: | + You are a helpful assistant responding to plain text emails. + Be concise and helpful. Do not use Markdown formatting. + # Maximum time to wait for LLM response. + timeout: 15m + +# SMTP server connection for sending replies. +# User, password, and from default to IMAP values if not specified. +smtp: + host: smtp.gmail.com + port: "587" + # user: you@gmail.com + # password: ${RAVEN_SMTP_PASSWORD} + # from: you@example.com + +# External tools available to the LLM. +tools: + - name: echo + description: Echoes back the input message. Useful for testing. + command: echo + arguments: + - "'{{ .message }}'" + parameters: + type: object + properties: + message: + type: string + description: The message to echo back + required: + - message + timeout: 3s + + - name: man + description: Read a Unix manual page. + command: man + arguments: + - "{{ .page_name }}" + parameters: + type: object + properties: + page_name: + type: string + description: | + The name of the man page to read. + Can optionally include a section number. + For example: '2 read' or 'cat(1)'. + required: + - page_name + + - name: now + description: Retrieves the current local date, time, and timezone. + command: date + arguments: + - "+%Y-%m-%dT%H:%M:%S%:z" + timeout: 1s diff --git a/init/systemd/system/raven@.service b/init/systemd/system/raven@.service new file mode 100644 index 0000000..5edbe28 --- /dev/null +++ b/init/systemd/system/raven@.service @@ -0,0 +1,22 @@ +[Unit] +Description=raven +Documentation=https://code.chimeric.al/dwrz/raven +After=network.target + +[Service] +User=%i +ExecStart=/usr/local/bin/raven -c /etc/raven/config.yaml +Restart=on-failure +RestartSec=10 + +ProtectSystem=full +PrivateTmp=true +SystemCallArchitectures=native +MemoryDenyWriteExecute=true +NoNewPrivileges=true + +StartLimitIntervalSec=60 +StartLimitBurst=4 + +[Install] +WantedBy=multi-user.target diff --git a/init/systemd/user/raven.service b/init/systemd/user/raven.service new file mode 100644 index 0000000..fe36a72 --- /dev/null +++ b/init/systemd/user/raven.service @@ -0,0 +1,19 @@ +[Unit] +Description=raven +Documentation=https://code.chimeric.al/dwrz/raven +After=network.target + +[Service] +ExecStart=%h/.local/bin/raven -c %h/.config/raven/config.yaml +Restart=on-failure +RestartSec=10 + +SystemCallArchitectures=native +MemoryDenyWriteExecute=true +NoNewPrivileges=true + +StartLimitIntervalSec=60 +StartLimitBurst=4 + +[Install] +WantedBy=default.target