How chiazor-daniel/olac works
Purpose and deployable surfaces
OLAC is a mobile AI executive assistant for conversational calendar, email, contacts, briefings, and voice interaction. Its primary product path is a FastAPI backend plus Expo/React Native client:
• Backend server: backend/run.py, backend/app/main.py
• Mobile bootstrap: frontend/index.js, frontend/App.js
• A separate, much broader PocketPaw agent platform is vendored/colocated under backend/pocketpaw/, with its own CLI/API surface: backend/pocketpaw/__main__.py, backend/pocketpaw/api/serve.py.
Mobile client and dynamic UI
The Expo client owns authentication, navigation, screen state, and rendering of backend-provided structured UI blocks. App flows center on Home/dashboard, chat, voice, settings, and sign-in:
• Navigation/screens: frontend/src/navigation/AppNavigator.js, frontend/src/screens/ChatScreen.js, frontend/src/screens/HomeScreen.js
• Shared state: frontend/src/context/AuthContext.js, frontend/src/context/ChatContext.js, frontend/src/context/VoiceContext.js
• Dynamic block boundary: frontend/src/components/DynamicScreen.js, frontend/src/components/BlockRegistry.js, frontend/src/utils/blockSanitizer.js
Client requests are centralized in frontend/src/utils/api.js. Backend response blocks must remain compatible with the registry and sanitizer; this is the principal API/UI contract.
OLAC HTTP, auth, and realtime boundary
FastAPI composes API routers for chat, dashboard, reminders, voice, and realtime. Google OAuth establishes user identity and authorizes Google Workspace access:
• Application/API entry: backend/app/main.py, backend/app/api/chat.py, backend/app/api/voice.py
• OAuth: backend/app/auth/router.py, backend/app/auth/oauth.py
• WebSocket/realtime delivery: backend/app/api/realtime.py, backend/app/api/voice_ws.py, backend/app/realtime/hub.py
Request handling should enforce security and validation before invoking LLM or external side effects: backend/app/core/security.py, backend/app/core/validation.py.
Assistant orchestration and conversation flow
Chat begins at the chat router, enters an assistant/intent-routing layer, then selects tools or workspace execution. The engine maintains context, commitments, attention, relationships, and formatted responses. It produces natural text plus actions and structured blocks for the mobile renderer:
• LLM orchestration: backend/app/llm/assistant.py, backend/app/llm/intent_router.py, backend/app/llm/client.py
• OLAC domain engine: backend/app/engine/olac_engine.py, backend/app/engine/context_manager.py, backend/app/engine/response_formatter.py
• UI composition: backend/app/core/screen_composer.py, backend/app/core/block_builder.py
Confirmation boundaries are architecturally important for write actions; preserve the distinction between planning/read-only retrieval and externally visible mutations.
Persistence, memory, and productivity services
SQLAlchemy-style models represent users, conversations, commitments, and relationships; services encapsulate provider access and short-lived caching:
• Database/models: backend/app/db/database.py, backend/app/models/conversation.py, backend/app/models/commitment.py
• Conversation and briefing services: backend/app/services/chat_memory_service.py, backend/app/services/briefing_service.py
• Google-facing services: backend/app/services/google_client.py, backend/app/services/calendar_service.py, backend/app/services/gmail_service.py
Material infrastructure is PostgreSQL or SQLite, optionally Redis, and Google OAuth/API credentials. External AI/media services are Groq-compatible LLM APIs, Whisper STT, Cartesia TTS, and fallback edge TTS: backend/app/services/cartesia_service.py, backend/app/services/voice_service.py.
PocketPaw agent platform
backend/pocketpaw/ is a second substantial runtime: a multi-provider, multi-agent automation platform with REST APIs, dashboard, messaging channels, tool registry, memory, scheduling, and mission execution. It is not the OLAC FastAPI path, but shared deployment or integration work must treat it as a separate subsystem:
• Agent routing/delegation: backend/pocketpaw/agents/router.py, backend/pocketpaw/agents/delegation.py, backend/pocketpaw/agents/model_router.py
• Provider abstraction: backend/pocketpaw/llm/router.py, backend/pocketpaw/llm/providers/registry.py
• Tools and MCP: backend/pocketpaw/tools/registry.py, backend/pocketpaw/mcp/manager.py
• Async/proactive work: backend/pocketpaw/daemon/executor.py, backend/pocketpaw/mission_control/executor.py
It supports OpenAI-compatible, Anthropic, Gemini, Ollama, and OpenRouter providers; external channels include Slack, Discord, Telegram, WhatsApp, Teams, and webhooks through backend/pocketpaw/bus/adapters/.
Google Workspace MCP service
google_workspace_mcp/ is an independently runnable MCP server exposing authenticated Google Workspace tools. It provides a cleaner tool-protocol boundary for Gmail, Calendar, Drive, Docs, Sheets, and related APIs:
• Server entrypoints: google_workspace_mcp/main.py, google_workspace_mcp/fastmcp_server.py, google_workspace_mcp/core/server.py
• OAuth/credential storage: google_workspace_mcp/auth/google_auth.py, google_workspace_mcp/auth/credential_store.py
• Tool registration and examples: google_workspace_mcp/core/tool_registry.py, google_workspace_mcp/gmail/gmail_tools.py, google_workspace_mcp/gcalendar/calendar_tools.py
It can be containerized and deployed separately, including Kubernetes via google_workspace_mcp/helm-chart/workspace-mcp/.
Main entry points: main.py FastAPI application · olac_engine.py OLAC domain engine · AppNavigator.js App navigation & screens · assistant.py Assistant & intent routing
Components 26
Expo Mobile Client
- Expo app bootstrap
frontend/App.js - App navigation & screens · Home, chat, voice, settings, and sign-in flows.
frontend/src/navigation/AppNavigator.js - Auth, chat & voice state
frontend/src/context/ChatContext.js - API client
frontend/src/utils/api.js - Dynamic block renderer · Sanitizes and renders backend-provided blocks.
frontend/src/components/DynamicScreen.js
OLAC Backend
- FastAPI application · Composes chat, dashboard, reminders, voice, and realtime routes.
backend/app/main.py - Google OAuth · Establishes users and Workspace authorization.
backend/app/auth/router.py - Security & validation · Guards requests before model calls or side effects.
backend/app/core/security.py - Chat router
backend/app/api/chat.py - Assistant & intent routing · Chooses intent, tools, or Workspace execution.
backend/app/llm/assistant.py - OLAC domain engine · Maintains context, commitments, attention, and relationships.
backend/app/engine/olac_engine.py - Response & block composer · Produces text, actions, and mobile UI blocks.
backend/app/core/screen_composer.py - Write confirmation boundary · Separates plans and reads from externally visible writes.
backend/app/core/validation.py - Realtime & voice delivery
backend/app/api/realtime.py - Memory & briefing services
backend/app/services/chat_memory_service.py - Google productivity services · Calendar and Gmail access for OLAC actions.
backend/app/services/google_client.py - OLAC database · Users, conversations, commitments, and relationships.
backend/app/db/database.py
PocketPaw Platform
Separate agent-platform runtime.
- PocketPaw CLI & API · Broad automation platform API surface.
backend/pocketpaw/api/serve.py - Agent routing & delegation
backend/pocketpaw/agents/router.py - Tools, MCP & providers · Routes multi-provider models and registered tools.
backend/pocketpaw/tools/registry.py - Daemon & mission execution · Runs proactive and scheduled work.
backend/pocketpaw/daemon/executor.py
Google Workspace MCP
Independently deployable MCP server.
- Workspace MCP server · Authenticated Google Workspace tool protocol endpoint.
google_workspace_mcp/main.py - Google credentials
google_workspace_mcp/auth/google_auth.py - Workspace tool registry · Gmail, Calendar, Drive, Docs, and Sheets tools.
google_workspace_mcp/core/tool_registry.py
Other components
- AI & voice providers · Groq-compatible LLM, Whisper STT, Cartesia TTS, and edge TTS.
backend/app/services/voice_service.py - Google Workspace APIs
Connections 28
- Expo app bootstrap → App navigation & screens: starts
- App navigation & screens → Auth, chat & voice state: uses state
- App navigation & screens → API client: requests
- API client → FastAPI application: HTTP
- FastAPI application → Google OAuth: authenticates
- FastAPI application → Security & validation: guards
- Security & validation → Chat router: validated chat
- Chat router → Assistant & intent routing: conversation input
- Assistant & intent routing → OLAC domain engine: intent and execution
- Assistant & intent routing → AI & voice providers: model calls
- OLAC domain engine → Memory & briefing services: loads and stores context
- Memory & briefing services → OLAC database: persists
- OLAC domain engine → Google productivity services: plans reads/actions
- Google productivity services → Write confirmation boundary: write actions
- Write confirmation boundary → Google Workspace APIs: confirmed mutations
- Google productivity services → Google Workspace APIs: read access
- OLAC domain engine → Response & block composer: response data
- Response & block composer → Dynamic block renderer: structured blocks · Principal backend/mobile UI contract.
- FastAPI application → Realtime & voice delivery: realtime routes
- Realtime & voice delivery → Auth, chat & voice state: WebSocket events
- PocketPaw CLI & API → Agent routing & delegation: agent requests
- Agent routing & delegation → Tools, MCP & providers: delegates tools/models
- Daemon & mission execution → Agent routing & delegation: executes missions
- Tools, MCP & providers → Workspace MCP server: MCP integration
- Workspace MCP server → Google credentials: authorizes
- Workspace MCP server → Workspace tool registry: registers
- Workspace tool registry → Google Workspace APIs: tool calls
- Google OAuth → Google Workspace APIs: OAuth consent