Skip to content

Feature: Automated Daily/Weekly Slack Usage Reports #10

@Q00

Description

@Q00

Summary

Automatically send daily or weekly usage reports to Slack, giving individuals and teams a digest of their Claude Code activity without needing to open the dashboard.

Motivation

Dashboards require active visits. Many users forget to check their stats, and managers want a passive way to stay informed. Slack-based reports provide:

  • Individual awareness: "Here's how you used Claude Code today" — keeps users engaged
  • Team visibility: Managers see aggregate team usage without logging into the admin panel
  • Trend alerts: Catch anomalies early (cost spikes, usage drops, new skill adoption)
  • Culture building: Sharing usage highlights reinforces Claude Code as a team tool

Current State

  • All usage data exists in ClickHouse (sessions, tokens, cost, skills)
  • Dashboard renders this data on-demand via API routes
  • No scheduled job or notification system exists
  • No Slack integration for outbound messages

Proposed Solution

1. Report Types

Personal Daily Digest (DM to each user):

  • Sessions count, total cost, tokens used
  • Top 3 skills invoked today
  • Streak counter ("5 consecutive days using Claude Code!")
  • Comparison to personal 7-day average

Team Weekly Summary (posted to team's Slack channel):

  • Team aggregate: total sessions, cost, active members
  • Top 5 skills across the team
  • MVP of the week (most sessions / most diverse skill usage)
  • New skill adoptions this week
  • Week-over-week trend arrows

2. Architecture

  • Scheduler: Cron job or serverless scheduled function (e.g., Vercel Cron, GitHub Actions)
  • Report Generator: Server-side function that queries ClickHouse, formats the report
  • Slack Delivery: Slack Incoming Webhook or Slack Bot API
    • Personal digests → Slack DM via Bot
    • Team summaries → configured Slack channel
  • Configuration: Admin dashboard page to configure:
    • Enable/disable per-user and per-team reports
    • Set schedule (daily 9am / weekly Monday 9am)
    • Choose Slack channel per team
    • Customize which metrics to include

3. API & Config

  • POST /api/admin/reports/configure — set report preferences
  • GET /api/admin/reports/preview — preview what the next report will look like
  • POST /api/reports/trigger — manually trigger a report (for testing)
  • Store config in Supabase: zeude_report_configs table

4. Message Format

Use Slack Block Kit for rich formatting:

Your Claude Code Daily Digest — Jan 15, 2025

Sessions: 12  (+3 vs avg)
Cost: $4.82
Tokens: 142K in / 38K out

Top Skills Today:
  1. /commit (8x)
  2. /review-pr (3x)
  3. /autopilot (1x)

5-day streak! Keep it going.

Design Considerations

  • Privacy: Users should be able to opt out of personal digests
  • Rate limits: Batch Slack API calls to avoid rate limiting with large teams
  • Timezone: Reports should respect each user's timezone setting
  • Cost: Scheduled functions should be lightweight; pre-aggregate data if needed

Acceptance Criteria

  • Personal daily digest is sent via Slack DM to opted-in users
  • Team weekly summary is posted to a configured Slack channel
  • Admin can configure report schedule, content, and target channels
  • Users can opt in/out of personal reports
  • Report includes: sessions, cost, tokens, top skills, trends
  • Preview mode available for admins before enabling

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions