Skip to content

Repository files navigation

🧵 ContextThread — The Incident Intelligence Agent

ContextThread uses Slack's Real-Time Search API to mine your entire workspace history at the exact moment of an incident, synthesizing past solutions to resolve current downtime faster.

Slack Agent Builder Challenge


The Problem

When production goes down, the on-call engineer drops everything to investigate. Often, the exact same issue occurred 4 months ago, solved by a different team member in a completely different channel. Because that knowledge is lost in the noise of Slack, the engineer spends 2 hours debugging an issue that should have taken 5 minutes.


How It Works

ContextThread surfaces institutional knowledge exactly when it's needed.

  1. Trigger: An engineer reacts with 📌 (pushpin) on an incident alert.
  2. Search: The agent uses the Slack Real-Time Search (RTS) API to hunt for similar error codes and service names across all historical channels.
  3. Synthesis: Claude 3.5 Sonnet synthesizes the current thread and the historical matches into a unified Incident Manifest.
  4. Resolution: ContextThread uses Slack Web API methods to generate a fully formatted Slack Canvas (for root cause analysis and patterns) and a Slack List (for action items), then posts the links directly in the thread.

Features

  • Historical Mining: Leverages Slack RTS via assistant.search.context to find identical past incidents, with a legacy search.messages fallback for older sandboxes.
  • Canvas & Lists automation: Automatically provisions rich Canvas documents and actionable Lists through Slack's Web API, eliminating manual documentation during a crisis.
  • Recurring Pattern Alerts: Automatically escalates the issue to an #incidents-patterns channel if the same error class has occurred 3+ times.
  • Dynamic Fallbacks: If API rate limits are hit or the workspace does not support Canvas/Lists APIs, the agent seamlessly degrades to posting a formatted Block Kit message.

Tech Stack

Layer Technology
Framework @slack/bolt v4
Language TypeScript
Runtime Node.js
AI Claude 3.5 Sonnet (@anthropic-ai/sdk)
Search Slack Real-Time Search API (assistant.search.context)
Slack Primitives Canvas (canvases:write), Lists (lists:write)

Quick Start

Prerequisites

  • Node.js 20+
  • A Slack workspace
  • AI provider key (Gemini, Anthropic, OpenAI, or OpenRouter)
  • Slack user token with RTS search scopes for full workspace search

Installation

# Clone the repository
cd contextthread
npm install

# Configure environment
cp .env.example .env
# Edit .env with your SLACK_BOT_TOKEN, SLACK_APP_TOKEN, and ANTHROPIC_API_KEY

# Start the agent in Socket Mode
npm run dev

Try it out!

  1. Post a fake database timeout error in a channel.
  2. React to it with 📌.
  3. Watch ContextThread fetch context, synthesize the RCA, and post your Canvas and Action List.

Security & Privacy

ContextThread operates entirely on-demand via the reaction_added event. It only reads the specific thread it is invoked upon and searches workspace history safely via Slack's native Search APIs, ensuring data never leaks outside the boundaries of your organizational permissions.

Free Vercel Deployment

ContextThread supports Vercel Hobby without an always-running server. See docs/VERCEL_FREE_DEPLOYMENT.md for environment variables and Slack URL changes.


Built for the Slack Agent Builder Challenge

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages