---
name: slack-mentions
description: >
  Monitor Slack for @walle mentions from the owner and create tasks or reply
  to questions. Searches recent messages, deduplicates via watermark, creates
  brain tasks for assignments, and replies in-thread for questions.
version: 1.0.0
author: wall-e
execution: script
entry: run.js
trigger:
  type: interval
  schedule: "every 30s"
tags: [slack, mentions, inbox]
permissions:
  - slack:read
  - slack:write
  - brain:read
  - brain:write
---
# Slack Mentions

## What This Skill Does

Polls Slack for messages mentioning @walle or @wall-e from the owner.
Classifies each mention as either a task assignment or a question, then:

- **Task**: Creates a brain task with `source: 'slack'` and `source_ref` linking
  back to the original message. Replies in-thread confirming receipt.
- **Question**: Replies in-thread with a short acknowledgement (actual answering
  is deferred to the Wall-E chat agent).

## How It Works

1. Search Slack for `@walle` and `@wall-e` mentions in the last 60 seconds
2. Compare message timestamps against a local watermark file to skip duplicates
3. For each new mention from the owner:
   - Classify as task or question based on imperative/interrogative language
   - Create a brain task or log the question
   - Reply in the Slack thread
4. Update the watermark to the latest processed timestamp

## Watermark

Stored in `.watermark.json` alongside this skill (not in the brain DB) for
simplicity and crash-safety.

## Error Handling

- Slack token expiry exits with code 1 and a clear message
- Individual message processing errors are logged and skipped
- The watermark is only advanced past successfully processed messages
