Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

slack-summarizer

A CLI tool for SRE teams to summarize Slack war-room channels, triage alert floods, and generate structured postmortem drafts using an LLM of your choice.

What it does

Mode Command Output
Postmortem draft summarize Severity, timeline, root cause, action items
Alert triage summarize --mode findings Dedup analysis, noise assessment, recommended action
Alert table alerts Messages grouped by alert type × resource, with threshold/value
Raw transcript fetch Timestamped message table, saveable as text
Payload inspector inspect Raw Slack API JSON with human-readable timestamps

Output renders in the terminal and can be saved as Markdown ready to paste into Confluence, Notion, or a GitHub issue.

Bot messages (Google Cloud Monitoring, PagerDuty, etc.) are included alongside human messages in all modes.

Supported LLM providers

Provider Models
anthropic Claude Sonnet, Opus, Haiku
openai GPT-4o, GPT-4-turbo, etc.
deepseek deepseek-chat, deepseek-reasoner
ollama Any locally running model

Switch providers by changing two lines in your config file — no code changes needed.

Requirements

  • Python 3.11+
  • uv
  • A Slack app with a Bot or User OAuth token
  • An API key for your chosen LLM provider

Installation

git clone https://github.com/your-username/slack-summarizer.git
cd slack-summarizer
make install

Slack app setup

The tool reads channel history via the Slack Web API, which requires an OAuth token.

1. Create a Slack app

Go to api.slack.com/apps → Create New App → From scratch.

2. Add OAuth scopes

Navigate to OAuth & Permissions → Scopes. Add the following under User Token Scopes (lets you read any channel you're already a member of without inviting a bot):

Scope Purpose
channels:history Read messages from public channels
channels:read Look up channel info
users:read Resolve user IDs to display names
groups:history Read private channels you're in
groups:read Look up private channel info

3. Install to workspace

Still on the OAuth & Permissions page, click Install to Workspace → Allow.

4. Copy the token

Copy the User OAuth Token (starts with xoxp-).

Configuration

Copy the example config and fill in your credentials:

cp config.yaml.example config.yaml
# config.yaml
slack:
  bot_token: "xoxp-your-token-here"

llm:
  provider: "anthropic"         # anthropic | openai | deepseek | ollama
  api_key: "sk-ant-your-key"
  model: "claude-sonnet-4-6"

TOML format is also supported — copy config.toml.example instead.

Provider-specific config examples

OpenAI

llm:
  provider: "openai"
  api_key: "sk-your-openai-key"
  model: "gpt-4o"

DeepSeek

llm:
  provider: "deepseek"
  api_key: "sk-your-deepseek-key"
  model: "deepseek-chat"        # or deepseek-reasoner for deeper analysis

Ollama (local)

llm:
  provider: "ollama"
  api_key: "ollama"             # ignored, but required by the config schema
  model: "llama3"
  base_url: "http://localhost:11434/v1"  # optional, this is the default

Usage

Verify your Slack connection

slacksumm auth

Find the channel ID

# list all channels
slacksumm channels

# filter by name
slacksumm channels --search incident

The ID column (e.g. C0123ABCDEF) is what you pass to all other commands.

Browse raw messages

# last 24 hours (default)
slacksumm fetch C0123ABCDEF

# specific time window, with thread replies
slacksumm fetch C0123ABCDEF --hours 6 --threads

# save raw transcript to a file
slacksumm fetch C0123ABCDEF --hours 6 --output transcript.txt

Generate a postmortem draft

Includes human messages and bot alert messages (monitoring systems, PagerDuty, etc.).

# print to terminal
slacksumm summarize C0123ABCDEF --hours 6

# save as markdown
slacksumm summarize C0123ABCDEF --hours 6 --output postmortem.md

# use a non-default config file
slacksumm summarize C0123ABCDEF --hours 6 --config ~/.config/slacksumm/config.yaml

Triage an alert flood

Use --mode findings when a channel is flooded with monitoring alerts and you need to quickly determine whether they are duplicates, refer to the same resource, or represent multiple distinct issues.

# print findings to terminal
slacksumm summarize C0123ABCDEF --hours 2 --mode findings

# save as markdown
slacksumm summarize C0123ABCDEF --hours 2 --mode findings --output findings.md

The output includes:

  • Verdict — all identical / same resource varied / same alert multiple resources / mixed
  • Alert groups — alert type × resource × count × time window × sample message
  • Noise assessment — flap, real incident, or unknown
  • Recommended action — one concrete next step

Display alerts as a table

Fetches bot alert messages and renders them grouped by alert type. Columns are dynamically built from the labels embedded in each alert (e.g. instance_name, zone, project_id) alongside value and threshold where present.

# grouped alert table for the last 24 hours
slacksumm alerts C0123ABCDEF

# last 2 hours, save as markdown
slacksumm alerts C0123ABCDEF --hours 2 --output alerts.md

# include full raw message text per row
slacksumm alerts C0123ABCDEF --hours 2 --raw

Inspect raw Slack API payloads

Dumps the actual JSON returned by the Slack API — useful for understanding the message structure before building alert parsers or debugging unexpected output. Includes a _datetime field alongside the raw epoch ts for readability.

# print to terminal (last 2 hours, up to 10 messages)
slacksumm inspect C0123ABCDEF

# save to file for inspection
slacksumm inspect C0123ABCDEF --hours 4 --limit 50 --output raw.json

List available LLM providers

slacksumm providers

Development

# install dependencies including dev tools
make install

# run tests
make test

# lint, format check, type check, and test (CI gate)
make check

# auto-format code
make fmt

# update dependencies to latest allowed versions
make upgrade

Project structure

cli.py                        # CLI entry point (Typer)
server.py                     # FastAPI server for Slack slash commands
src/
  config.py                   # Config loading — YAML and TOML
  alerts.py                   # Alert message parser (GCM and generic formats)
  slack/
    client.py                 # Slack Web API wrapper
    models.py                 # SlackMessage, SlackChannel dataclasses
  llm/
    base.py                   # LLMProvider protocol
    anthropic.py              # Claude
    openai.py                 # OpenAI
    deepseek.py               # DeepSeek (OpenAI-compatible)
    ollama.py                 # Ollama (OpenAI-compatible)
    factory.py                # get_provider(config) → LLMProvider
  summarizer/
    transcript.py             # SlackMessages → plain-text transcript
    prompts.py                # System prompts and user prompt templates
    engine.py                 # Orchestrates fetch → prompt → parse
    models.py                 # PostmortemDraft, FindingsSummary Pydantic schemas
    render.py                 # Draft/summary → Markdown
tests/
  test_config.py              # Config loading tests

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages