AI Task Reminders: Beat Deadlines With Smart Slack DMs

Alex Johnson
-
AI Task Reminders: Beat Deadlines With Smart Slack DMs

In today's fast-paced work environment, staying on top of tasks and deadlines is crucial. This article explores how to enhance task management systems by leveraging AI for proactive communication and streamlining user interactions. We'll delve into the details of pre-deadline AI-driven direct messages (DMs) for incomplete tasks, unifying action IDs, and centralizing the reason-capture flow to ensure efficiency and consistency.

The Challenge: Incomplete Tasks and Communication Gaps

Keeping tasks on track can be a major headache, especially when deadlines loom. Often, roadblocks arise that prevent timely completion. Current systems often lack proactive communication, leaving managers and team members in the dark until it's too late. Existing reminder systems might be too generic, failing to address the specific challenges an individual assignee faces. Add to this inconsistencies in user interface (UI) actions and duplicated logic within the codebase, and you have a recipe for inefficiencies and potential errors. The goal is to create a system that anticipates potential delays, offers timely assistance, and captures valuable insights into the reasons behind incomplete tasks.

The Vision: Proactive, Intelligent, and Unified Task Management

The vision is to create a system where an AI-powered bot proactively DMs assignees shortly before a task's deadline. This bot delivers a brief, empathetic prompt, inquiring about any obstacles hindering task completion. This proactive approach surfaces risks early, allowing for timely intervention and support. Key to this vision is a unified approach, where Slack action IDs are consistent across the UI and backend handlers. This consistency eliminates duplicated handlers and ensures that the reason for incomplete tasks is captured and persisted reliably. By unifying these elements, the system becomes more maintainable, efficient, and user-friendly.

Current System Architecture: A Detailed Look

To understand the proposed improvements, let's examine the existing system architecture:

Functions and Orchestration

The core functions and orchestration are handled by:

  • src/functions/index.ts: This file registers the various tools used by the system.
  • src/orchestrator/runAiOrchestrator.ts: This component executes the tools using OpenAI's gpt-4o-mini model with a temperature of 0.2. The temperature setting controls the randomness of the AI's output, with a lower value leading to more predictable results.
  • src/orchestrator/conversationStore.ts: This handles the persistence of conversations, allowing the AI to maintain context across interactions.
  • src/index.ts: This serves as the entry point, feeding conversations into the orchestrator.

AI Prompt and Parsing

  • src/ai/prompt.ts: This file defines the system prompt and the expected format for tool calls. The system prompt guides the AI's behavior, while the tool-call contract specifies how the AI should request the execution of specific functions.
  • src/orchestrator/parseAiResponse.ts: This component parses the AI's response, extracting the tool name and any associated JSON data. It is designed to be resilient, ignoring malformed JSON and focusing on correctly formatted tool calls.

Core Tools

The system includes several core tools:

  • CreateTask: This tool persists tasks to the database using src/db/writeTask.ts and normalizeToDBTask from src/services/normalizeTask.ts.
  • UpdateTaskStatus: This tool marks tasks as completed or pending and can attach a note when a task is not completed. It is located in src/functions/updateTaskStatus.ts.
  • ListTasks and DeleteTask: These tools provide functionality for listing and deleting tasks, respectively.

Reminders

  • src/scheduler/taskReminder.ts: This component uses a cron scheduler to query upcoming tasks, determine the appropriate lead time using src/scheduler/reminderPolicy.ts, and send a reminder card via src/ui/taskCard.ts. It updates the Task.deadlineReminderSentAt field to prevent duplicate reminders.
  • src/slack/postTaskReminder.ts: This supports posting reminders to channels and DMs to each assignee, accommodating multi-assignee tasks.

Actions and UX

  • src/ui/taskCard.ts: This defines the UI card, which currently uses the action IDs task_completed and task_not_completed.
  • src/actions/taskActions.ts: This registers handlers for actions like task_complete, task_delay_15m, and task_delay_60m.
  • src/index.ts: This file also registers direct handlers for task_completed and task_not_completed and maintains a pendingTaskReasons Map to capture free-text DM reasons. This duplication introduces potential conflicts with taskActions.ts.

Identifying the Problems: Inconsistencies and Inefficiencies

Several problems plague the current system:

  • Lack of AI-Authored Pre-Deadline Intro: The current DM is generic and lacks a personalized touch.
  • Action ID Drift: The UI uses task_completed/task_not_completed, while handlers use task_complete/etc.. This inconsistency can lead to confusion and errors.
  • Duplicate Handler Logic: The splitting of handler logic between index.ts and taskActions.ts increases maintenance risk and can cause inconsistent behavior.
  • Inconsistent Multi-Assignee Experience: While postTaskReminder can DM each assignee, the scheduler currently DMs only a single assignee.

Proposed Solutions: A Step-by-Step Approach

To address these issues, the following solutions are proposed:

1) AI-Authored Intro in DM Before Deadline

  • Objective: To create a more personalized and empathetic reminder experience.
  • Implementation:
    • Add src/ai/generateReminderIntro.ts to produce a concise, empathetic prompt using OpenAI (gpt-4o-mini, temperature 0.2). A templated fallback will be used if the OPENAI_API_KEY is missing or the API fails.
    • In src/scheduler/taskReminder.ts:
      • When shouldSend is true, prepend a section block containing the AI/template intro to the message before the existing buildTaskBlocks card.
      • DM every assignee if task.assignees is present; otherwise, DM the primary assignee. Preserve deadlineReminderSentAt to avoid duplicate sends.

2) Unify Action IDs and Centralize Handlers

  • Objective: To eliminate inconsistencies and reduce maintenance overhead.
  • Implementation:
    • Choose a single set of action IDs and a single handler location:
      • Option A (minimal change): Keep UI action IDs as-is (task_completed, task_not_completed); move these handlers into src/actions/taskActions.ts and remove the duplicates in src/index.ts.
      • Option B (long-term hygiene): Change UI to task_complete and introduce a task_reason_open (modal) path; implement modal open/view submission in src/actions/taskActions.ts; remove index.ts handlers.
    • Regardless of the option, ensure only one handler source of truth (taskActions.ts), and update src/ui/taskCard.ts action_id values to match.

3) Persist “Not Completed” Reason Consistently

  • Objective: To capture valuable insights into the reasons behind incomplete tasks.
  • Implementation:
    • MVP (fast path): Keep the free-text DM flow. When a user clicks “Not Completed,” prompt for a short reason and persist Task.notCompletedReason and Task.notCompletedReasonAt. Co-locate this logic with taskActions.ts (or dedicated actions) rather than index.ts to avoid duplication.
    • Enhancement (optional): Switch to a modal to capture the reason immediately; or expose UpdateTaskStatus with note in a guided flow.

4) Multi-Assignee Consistency

  • Objective: To ensure a consistent reminder experience for all assignees.
  • Implementation:
    • Update the scheduler’s DM logic to DM each assignee (similar to src/slack/postTaskReminder.ts).
    • Ensure buildTaskBlocks shows the per-recipient assignee mention while still listing all assignees in the card text.

5) Tests and Docs

  • Objective: To ensure the reliability and maintainability of the changes.
  • Implementation:
    • Add a pure helper for the “should send now” decision (targetTs = deadline - leadMs, +/- window, 5-minute catch-up) and unit test it.
    • Keep reminder policy buckets verified (tests/reminderPolicy.test.ts), and add tests for the decision helper.
    • README: document the pre-deadline DM behavior, action IDs, the reason-capture flow, and AI vs. fallback behavior.

Acceptance Criteria: Measuring Success

The success of these changes will be measured by the following criteria:

  • For each incomplete task reaching the configured lead time:
    • Each assignee receives a DM with:
      • A short AI-authored (or templated) intro asking what’s blocking and offering help.
      • The task card with “Completed” and “Not Completed” actions.
    • “Completed” marks the task as completed successfully.
    • “Not Completed” captures a brief reason and persists notCompletedReason and notCompletedReasonAt.
    • No duplicate DMs for the same task event (deadlineReminderSentAt guards).
  • Action IDs are consistent across UI (src/ui/taskCard.ts) and handlers (src/actions/taskActions.ts); no duplicated handlers in src/index.ts.
  • Multi-assignee tasks DM each assignee.
  • Unit tests cover the reminder decision helper; README updated with behavior and env requirements (OPENAI_API_KEY).

File-Level Changes: A Summary

The implementation will involve the following file-level changes:

  • New: src/ai/generateReminderIntro.ts (OpenAI integration; fallback supported)
  • Edit: src/scheduler/taskReminder.ts (prepend intro; DM each assignee; keep catch-up and lead-time logic)
  • Edit: src/ui/taskCard.ts (align action_id values to the chosen single set)
  • Edit: src/actions/taskActions.ts (centralize handlers for “completed”/“not completed”; add reason flow or modal)
  • Edit: src/index.ts (remove duplicate handlers and pending reason Map if logic is moved into taskActions.ts)
  • Docs/Tests: README section and unit tests for the send decision helper

Conclusion: Streamlining Task Management with AI and Unified Actions

By implementing these proposed solutions, task management systems can become more proactive, efficient, and user-friendly. The integration of AI-powered DMs provides personalized support to assignees, while the unification of action IDs and centralization of handlers reduces maintenance overhead and ensures consistency. Ultimately, these changes will lead to improved task completion rates and a more streamlined workflow. Embracing these enhancements will empower teams to stay on track, meet deadlines, and achieve their goals more effectively.

Learn more about AI in project management

You may also like