How abhijeetb0/personal-agent works
Personal Agent is a multi-user WhatsApp AI service with a web dashboard. The primary workflow is: a user signs in, sets an owner number and pairs a WhatsApp account, then messages the agent and receives an AI response; reminders and LeetCode contest information are additional capabilities. The graph also shows dashboard chat and device-based QR login. Source excerpts are partial, so links among the agent’s internal AI, memory, tools, and reminder modules are omitted where their wiring is not evidenced.
Main entry points: routes.ts Agent API · brain.ts Agent brain · page.tsx Dashboard · handler.ts Message handler
Components 27
Web Dashboard
- Dashboard
apps/web/app/dashboard/page.tsx - Dashboard API
apps/web/app/api - Web server helpers
apps/web/lib/server.ts - Browser auth
apps/web/lib/supabase-browser.ts
WhatsApp Agent
- Agent entry
apps/agent/src/index.ts - Agent API
apps/agent/src/routes.ts - WhatsApp connection
apps/agent/src/baileys.ts - Message handler
apps/agent/src/handler.ts - Owner allowlist
apps/agent/src/whitelist.ts
AI and Skills
- Agent brain
apps/agent/src/brain.ts - Model selection
apps/agent/src/llm.ts - Groq model
apps/agent/src/groq.ts - Gemini fallback
apps/agent/src/gemini.ts - Conversation memory
apps/agent/src/memory.ts - Agent tools
apps/agent/src/tools.ts - Reminders
apps/agent/src/reminders.ts - Reminder scheduler
apps/agent/src/scheduler.ts - LeetCode contests
apps/agent/src/leetcode.ts - Dashboard chat
apps/agent/src/webchat.ts
Identity and State
- Agent state
apps/agent/src/store.ts - Supabase auth and DB
- QR login tickets
apps/web/app/api/login-qr - Device management
apps/web/app/api/devices/route.ts
Other components
- User
- Groq / Gemini
- LeetCode service
Connections 28
- User → Dashboard: uses
- Dashboard → Browser auth: authenticates
- Browser auth → Supabase auth and DB: authenticates
- Dashboard → Dashboard API: requests
- Dashboard API → Web server helpers: forwards
- Web server helpers → Agent API: calls agent API
- Agent entry → Agent API: serves
- Agent API → Supabase auth and DB: validates user
- Agent API → WhatsApp connection: controls session
- Agent API → Agent state: reads/writes
- WhatsApp → WhatsApp connection: connects
- WhatsApp connection → Message handler: dispatches messages
- Message handler → Owner allowlist: checks sender
- User → WhatsApp: messages agent
- Agent API → Dashboard chat: handles chat
- Agent API → LeetCode contests: serves contest data
- LeetCode contests → LeetCode service: fetches contests
- User → QR login tickets: starts QR login
- QR login tickets → Supabase auth and DB: stores ticket
- QR login tickets → Web server helpers: creates login link
- User → Device management: manages devices
- Device management → Supabase auth and DB: reads/writes devices
- Message handler → Agent brain: requests response
- Agent brain → Model selection: selects model
- Model selection → Groq / Gemini: queries
- Agent brain → Conversation memory: uses memory
- Agent brain → Agent tools: invokes tools
- Reminder scheduler → Reminders: schedules delivery