AI agents that learn from your team's Slack, meetings, docs, and code — and get smarter every day.
Add the bot to any Slack channel. It scans history, extracts knowledge, and starts answering questions — no manual setup required. New conversations are picked up daily, checked for conflicts with existing knowledge, and committed with human approval. The knowledge base just grows.
Under the hood: RAPTOR hierarchical trees, a knowledge graph, multi-strategy retrieval (semantic + BM25 + graph traversal), and 5 proactive behaviors that make the agent feel like a team member, not a search box.
git clone https://github.com/incidentfox/self-learning-ai-agent.git
cd self-learning-ai-agent
cp .env.example .env
# Edit .env — set OPENAI_API_KEY and ANTHROPIC_API_KEY
make dev # Starts postgres + config-service + learning-engine + agent-service
make dev-slack # Also starts slack-bot (needs SLACK_BOT_TOKEN + SLACK_APP_TOKEN)
make dev-web # Also starts web-ui on http://localhost:3000- Docker and Docker Compose
- An OpenAI API key (for embeddings) + Anthropic API key (for completions)
- For Slack: a Slack app with Socket Mode
- Onboard — Bot scans channel history, extracts knowledge, builds a RAPTOR tree
- Answer — @mention the bot. It answers using multi-strategy RAG retrieval.
- Learn daily — New messages → extract → conflict check → auto-approve or queue for review
- Correct — Say "actually, it's X not Y" in a thread → bot detects and learns
- Escalate — Low confidence → asks designated buddies in a private channel
- Daily digest — Summary of questions answered, knowledge learned, corrections
- Stale knowledge alerts — Flags knowledge past its freshness threshold
- Contradiction detection — Catches when new info conflicts with existing knowledge
- Follow-up tracking — Reminds about open action items and decisions
- Context surfacing — Proactively injects relevant context when discussions match existing knowledge
Every behavior is parameterized by the channel's use case:
| Use Case | Extraction Focus | Staleness | Example |
|---|---|---|---|
| Help Desk | FAQs, resolution patterns, escalation paths | 30 days | Support channels |
| Engineering | Architecture decisions, debugging patterns, conventions | 90 days | Engineering channels |
| Onboarding | Processes, contacts, tool guides, tribal knowledge | 60 days | New hire channels |
| Chief of Staff | Decisions, action items, blockers, competitive intel | 14 days | Strategy channels |
| Custom | Describe your team → LLM generates prompts | Configurable | Anything |
Slack → slack-bot (Bolt) → agent-service (LLM + RAG) → learning-engine (RAPTOR + Knowledge Graph)
Web UI → agent-service ↗ ↕
config-service (PostgreSQL + pgvector)
| Service | Port | Purpose |
|---|---|---|
config-service |
8001 | Control plane: teams, channels, integrations, analytics |
learning-engine |
8002 | Self-learning core: RAG, teaching, conflict resolution, pipelines |
agent-service |
8003 | Chat agent with RAG tools, SSE streaming, public API |
slack-bot |
3001 | Slack UI: OAuth, setup modals, chat, buddy escalation |
web-ui |
3000 | Admin dashboard: knowledge explorer, analytics, chat |
meeting-bot |
8004 | Meeting transcript processing (Recall.ai / Circleback) |
Connect data sources for automatic ingestion:
| Integration | What's Ingested | Method |
|---|---|---|
| Slack | Channel history, threads | Onboarding scan + daily |
| GitHub | README/docs, merged PRs | Daily crawl |
| Notion | Pages + block content | OAuth or API key |
| Confluence | Recently updated pages | API key |
| Jira | Issues (summary, status, assignee) | API key |
| Linear | Issues via GraphQL | API key |
| Zoom/Meets | Meeting transcripts | Recall.ai / Circleback webhook |
- Go to api.slack.com/apps → Create New App → From a manifest
- Select your workspace
- Paste the contents of
slack-app-manifest.yml - Install to workspace
- Copy Bot User OAuth Token (
xoxb-...) →SLACK_BOT_TOKENin.env - Go to Socket Mode → Enable → Create app-level token → copy (
xapp-...) →SLACK_APP_TOKENin.env
Create a Slack app with these scopes:
Bot Token Scopes: app_mentions:read, channels:history, channels:read, chat:write, files:read, groups:history, groups:read, groups:write, im:history, im:read, im:write, reactions:write, users:read, commands
Event Subscriptions: app_mention, message.channels, message.groups, message.im, member_joined_channel, app_home_opened
Socket Mode: Enabled
The admin dashboard at http://localhost:3000 provides:
- Dashboard — Stats, activity feed, service health
- Chat — Talk to the agent from your browser (SSE streaming)
- Knowledge Base — Interactive RAPTOR tree visualization, search, detail panel
- Teaching Queue — Review and approve/reject pending knowledge
- Integrations — Connect and manage data sources
- Analytics — Questions answered, confidence trends, knowledge growth
- Feed Knowledge — Upload documents, paste URLs, or enter text directly
The agent-service exposes a public REST API:
# Query the knowledge base
curl -X POST http://localhost:8003/api/v1/chat \
-H "Content-Type: application/json" \
-d '{"message": "What did we decide about pricing?", "team_id": "YOUR_TEAM_ID"}'
# Create an agent run
curl -X POST http://localhost:8003/api/v1/runs \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"query": "Summarize this week", "mode": "fast"}'Full API docs at http://localhost:8003/docs (OpenAPI / Swagger).
make dev # Core services
make dev-slack # + Slack bot
make dev-web # + Web UI
make test-e2e # Run E2E tests (requires running services)# Infrastructure (Terraform)
cd infra/terraform && terraform init && terraform apply
# Build AMD64 images → push to ECR (or use GitHub Actions)
git push origin main # GHA builds automatically
# Deploy on EC2
ssh ubuntu@YOUR_EC2_IP
cd /opt/sla && docker compose -f docker-compose.prod.yml up -dSee infra/ for Terraform configs, nginx reverse proxy, and SSL setup scripts.
- Backend: Python 3.11, FastAPI, SQLAlchemy (async), Alembic
- LLM: litellm (provider-agnostic) — Claude Sonnet for completions, text-embedding-3-small for embeddings
- Knowledge: RAPTOR hierarchical trees + pgvector + NetworkX knowledge graph
- Retrieval: 6-strategy ensemble (semantic, BM25, graph, HyDE, multi-query, query decomposition)
- Slack: Bolt SDK with Socket Mode
- Frontend: Next.js 15, React 19, TailwindCSS v4
- Database: PostgreSQL 16 with pgvector extension
- Infrastructure: Docker Compose (dev), EC2 + nginx (staging), GHA CI/CD
See CONTRIBUTING.md for development setup, coding standards, and PR guidelines.
Apache License 2.0 — see LICENSE.
Built by IncidentFox (YC W25).