Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Sourcegraph 5 min read Case study mediumAdept

Lessons on UX, security, and scale when building an enterprise-grade Slack agent

Sourcegraph's Deep Search Slack agent fits into enterprise workflows through staged status messages (emoji acknowledgement, escalation links for long searches), TL;DR answers with threaded follow-ups, and rich link unfurling via Slack's link_shared events, SHA256-based entity IDs, chat.unfurl work objects and flexpane details. On the enterprise side it supports Enterprise Grid's one-app-to-many-workspaces model, auto-links Slack users to Sourcegraph accounts by verified email so permissions match code access, and validates setup by forcing a fresh Slack event-URL ping with a random retry parameter. Abuse is controlled with simple Redis fixed-window counters per user and team that fail open if Redis is down.

Assumes: Slack app developmentRedis basicsOAuth basics

Related posts

  • How Grab built Scarlet: the AI teammate that turns a Slack message into a production data pipeline

    Grab Engineering mediumAdept

    Grab's ADW team rebuilt Scarlet, its Slack-based data-pipeline agent, around a short core prompt plus a versioned library of Markdown skills (platform, routing, repository, workflow) loaded on demand, shrinking the prompt about 25x and letting new teams onboard by adding one reviewed repository skill. Platform tools sit behind two-tool MCP bridges, data-platform actions run under the requester's short-lived token, and sign-in pauses use LangGraph interrupts to resume runs. Scarlet now validates the data its changes produce by comparing CI candidate output against production (schema, counts, keys, nulls, stats, row diffs), with inconclusive treated as failure and verdicts bound to commits. Deterministic scaffolds replaced model guesses for predictable config, and after rollout the merge rate rose from about 50% to over 85% while repositories served grew about fourfold.

  • Building effective agent automations

    claude.dev mediumAdept

    A scheduled daily-brief agent built on Claude Managed Agents reads Slack channels and GitHub pull requests, tracks what changed since the last run, and posts a short brief to Slack. The design runs through sources, destination, agent config, cron schedule, memory and guardrails, and pairs each with a common failure mode and its fix. Fixes include per-source bookmarks instead of fixed time windows, flagging failed reads instead of reporting a quiet day, and confirming Slack's ok response before updating the ledger. Credentials sit in a vault outside the sandbox, preferences are read-only and re-read every run, the GitHub token is read-only to limit prompt-injection damage, and per-run spending is capped.

  • How we built enterprise search to be secure and private

    Slack Engineering easyNovice

    Slack's enterprise search, which brings Google Drive and GitHub results into Slack search and AI Answers, uses a federated, real-time design instead of an index. Queries go to partner search APIs at request time using per-user OAuth tokens, so no external data is stored server-side and results and permissions can't go stale. The system reuses Slack AI's model: LLMs hosted in an escrow VPC on AWS, RAG with the user's ACL rather than training on customer data, and Search Answers discarded after display. Admins and users must each opt in per source, and only read-only OAuth scopes are requested.

  • Security Automation Evolved: From SlackOps to Programmatic SIEM Triage (Part 1/2)

    Sourcegraph mediumAdept

    Sourcegraph's security team built SecBot, a Slackbot that enriches SIEM alerts with context from Entitle JIT permissions, Okta, Google Workspace, GCP asset metadata and threat intel, so alerts can be triaged and closed from Slack via emoji reactions. After migrating detections from Elastalert regex hacks to Elastic Security, the bot templates alerts with full fields and fetches GCP descriptions at alert time rather than syncing state into Elasticsearch. Auto-close rules are written in expr-lang, a Go expression library, with custom runtime functions such as on-call lookups and project labels. Example: auto-closing changes to internal instances or by on-call Platform engineers, while still posting them to Slack for visibility.

  • Automating Security Triage with HackerOne and Deep Search

    Sourcegraph easyNovice

    Sourcegraph's security team built a small service that receives signed HackerOne webhooks for new bug bounty reports, verifies the signature, and sends the report to the Deep Search API to investigate it against the relevant codebase. The service posts a team-only comment back with a validity verdict, severity, links to affected code, suggested fixes and a link to the Deep Search conversation, and in one case it surfaced a separate critical config-override logic flaw that the reporter had not mentioned. Known risks are reporters driving token consumption, wrong repository mapping and prompt injection in report text. Mitigations include entitlement-based rate limits, invite-only programs, explicit service-to-repo mappings in the prompt and tagging untrusted input.

The quest for software engineering knowledge.

Look:
Layout: