High-Level Architecture
Component Map
Communication Adapters
Normalise events from Slack (future: Discord, Teams) into a channel-agnostic format and publish to the intake Lambda via API Gateway.Event Intake Lambda
- Validates adapter-specific request signatures (Slack
X-Slack-Signature) - Converts raw events into
NormalisedEventpayloads - Enqueues SQS jobs
- Responds within 3 seconds
Job Worker Lambda
- Triggered by SQS (batch size 1 for ordering)
- Resolves per-workspace credentials
- Sends acknowledgement via communication adapter
- Calls MCP client adapter and streams status updates
- Implements retry/backoff on 429/5xx
- Updates Postgres and pushes audit events
MCP Client Library
Shared TypeScript package with typed adapters per source (GitHub, Linear, Notion). Normalises responses into{ answer, citations[], raw }.
Credential Resolver
Multi-tenant credential lookup from AWS Secrets Manager. Provides per-workspace auth tokens with caching for the duration of a job.Web Application (Next.js 14)
- Server Components + App Router
- TipTap rich text editor
- pgvector semantic search
- React Query + Zustand state management
- WorkOS authentication
- Deployed on Vercel
Persistence Layer
- PostgreSQL (Neon) — primary database with pgvector extension
- Workspace configs, encrypted credentials, documents, embeddings, jobs
- All keyed by
workspace_idfor tenant isolation
Observability
- CloudWatch logs/metrics
- X-Ray tracing across Lambdas, SQS, Postgres
- DLQ for SQS with replay Lambda
- Slack alerts via SNS
Data Flow
1
User mentions @whilst
User asks a question in Slack, e.g. “What’s the latest open PR about churn?”
2
Event intake
Slack sends
app_mention to API Gateway. Intake Lambda verifies signature, persists job stub, enqueues SQS item, responds 200.3
Job processing
Job Worker pulls the message, resolves workspace credentials, sends acknowledgement to Slack.
4
MCP query + Knowledge Pipeline
MCP adapter fetches data (e.g. GitHub PRs). Knowledge Pipeline analyzes the thread for topics, decisions, and action items.
5
Response delivered
Final answer posted as Slack thread update. Auto-generated doc saved to Postgres. Job marked
complete.
