-
Notifications
You must be signed in to change notification settings - Fork 141
Notifications
Multi-channel notification system for Slack, Discord, custom webhooks, and dashboard triggers.
Loki Mode sends real-time notifications for:
- Session start/end
- Task completion
- Errors and warnings
- Milestones
In addition to external webhooks, Loki Mode includes a built-in notification trigger system that monitors autonomous sessions and generates alerts visible in the dashboard.
| Trigger ID | Type | Severity | Description |
|---|---|---|---|
budget-80pct |
Budget threshold | Warning | Fires when budget usage exceeds 80% |
context-90pct |
Context threshold | Critical | Fires when context window exceeds 90% |
sensitive-file |
File access | Critical | Fires when .env, .pem, .key, credentials, or secret files are accessed |
quality-gate-fail |
Quality gate | Warning | Fires when a quality gate check fails |
stuck-iteration |
Stagnation | Warning | Fires after 3+ consecutive no-progress iterations |
compaction-freq |
Compaction frequency | Warning | Fires when 3+ context compactions occur per hour |
Triggers are stored in .loki/notifications/triggers.json and can be managed via the dashboard UI or API.
# View triggers
curl http://localhost:57374/api/notifications/triggers
# Update triggers
curl -X PUT http://localhost:57374/api/notifications/triggers \
-H "Content-Type: application/json" \
-d '{"triggers": [{"id": "budget-80pct", "enabled": false}]}'
# View active notifications
curl http://localhost:57374/api/notifications
# Acknowledge a notification
curl -X POST http://localhost:57374/api/notifications/notif-001/acknowledgeThe Notifications section in the dashboard (keyboard shortcut: Cmd+0) has two tabs:
- Feed: Chronological list of notifications with severity indicators (red=critical, yellow=warning, blue=info), timestamps, and acknowledge buttons
- Triggers: Enable/disable toggles and threshold configuration for each trigger type
Notification triggers work with all providers (Claude, Codex, Gemini). The trigger evaluation reads from .loki/ flat files which are provider-agnostic.
All notifications are:
- Non-blocking - Run in background
- Fail-safe - Won't break sessions if webhook fails
- Color-coded - Visual status indication
export LOKI_SLACK_WEBHOOK="https://hooks.slack.com/services/T00/B00/xxx"
loki notify testexport LOKI_DISCORD_WEBHOOK="https://discord.com/api/webhooks/xxx/yyy"
loki notify testexport LOKI_WEBHOOK_URL="https://your-server.com/api/events"
loki notify testloki notify statusOutput:
Notification Channel Status
[OK] Slack - Configured
[OK] Discord - Configured
[--] Webhook - Not configured
Active channels: slack,discord
Test with: loki notify test
# Test all channels
loki notify test
# Test with custom message
loki notify test "Hello from Loki!"
# Test specific channel
loki notify slack "Build complete"
loki notify discord "Deployment started"
loki notify webhook "Custom event"| Event | Color (Slack) | Color (Discord) | When |
|---|---|---|---|
session_start |
Blue | 3447003 | Session begins |
session_end |
Green | 5763719 | Session completes |
task_complete |
Green | 5763719 | Task finished |
milestone |
Purple | 10181046 | Major progress |
error |
Red | 15548997 | Error occurred |
warning |
Orange | 15981348 | Warning issued |
- Go to Slack Apps
- Create New App > From scratch
- Add "Incoming Webhooks" feature
- Activate and add to channel
- Copy webhook URL
{
"attachments": [{
"color": "#3498DB",
"title": "Loki Mode: Session Started",
"text": "Starting Loki Mode session with PRD: my-app.md",
"fields": [
{"title": "Event", "value": "session_start", "short": true},
{"title": "Project", "value": "my-app", "short": true}
],
"footer": "Loki Mode",
"ts": 1706875200
}]
}# .loki/config.yaml
notifications:
enabled: true
slack_webhook: "https://hooks.slack.com/services/T00/B00/xxx"
channels: slack- Open Discord server settings
- Go to Integrations > Webhooks
- Create New Webhook
- Select channel and copy URL
{
"embeds": [{
"title": "Loki Mode: Task Completed",
"description": "Implemented user authentication",
"color": 5763719,
"fields": [
{"name": "Event", "value": "task_complete", "inline": true},
{"name": "Project", "value": "my-app", "inline": true}
],
"footer": {"text": "Loki Mode"},
"timestamp": "2026-02-02T12:00:00Z"
}]
}# .loki/config.yaml
notifications:
enabled: true
discord_webhook: "https://discord.com/api/webhooks/xxx/yyy"
channels: discordPOST request with JSON body:
{
"event": "task_complete",
"project": "my-app",
"title": "Task Completed",
"message": "Implemented user authentication",
"timestamp": "2026-02-02T12:00:00Z",
"metadata": {}
}- Create Zap with "Webhooks by Zapier" trigger
- Choose "Catch Hook"
- Copy webhook URL
- Set
LOKI_WEBHOOK_URL
- Create Applet with Webhooks trigger
- Copy webhook URL
- Set
LOKI_WEBHOOK_URL
// Express.js example
app.post('/loki-webhook', (req, res) => {
const { event, project, title, message, timestamp } = req.body;
console.log(`[${timestamp}] ${project}: ${event} - ${message}`);
// Forward to monitoring, database, etc.
res.status(200).send('OK');
});| Variable | Description |
|---|---|
LOKI_NOTIFICATIONS |
Enable/disable (default: true) |
LOKI_SLACK_WEBHOOK |
Slack webhook URL |
LOKI_DISCORD_WEBHOOK |
Discord webhook URL |
LOKI_WEBHOOK_URL |
Custom webhook URL |
LOKI_PROJECT |
Project name override |
LOKI_NOTIFICATION_SOUND |
Desktop sound (default: true) |
notifications:
enabled: true
sound: true
slack_webhook: "https://hooks.slack.com/..."
discord_webhook: "https://discord.com/api/webhooks/..."
webhook_url: "https://your-server.com/webhook"
channels: all # or: slack,discord,webhookexport LOKI_NOTIFY_CHANNELS=all# Only Slack and Discord
export LOKI_NOTIFY_CHANNELS=slack,discord
# Only webhook
export LOKI_NOTIFY_CHANNELS=webhookexport LOKI_NOTIFICATIONS=false
loki start ./prd.mdnotifications:
enabled: false# Typical CI config
export LOKI_NOTIFICATIONS=false
export LOKI_DASHBOARD=false-
Check configuration:
loki notify status
-
Test connectivity:
loki notify test "Test message"
-
Verify webhook URL is correct
-
Check network/firewall
# Check active channels
loki notify status
# Set specific channels
export LOKI_NOTIFY_CHANNELS=slack- Slack: Check channel permissions
- Discord: Verify webhook is active
- Webhook: Check server logs
Notifications are rate-limited by the receiving service:
- Slack: ~1 message/second
- Discord: ~5 messages/5 seconds
Loki Mode batches rapid events to avoid limits.