How brentonbluehouse/pocketpal-ai works
PocketPal AI is a React Native mobile assistant centered on private, on-device model use. The principal workflow is to find and download a model, load it, then chat; chat turns can dispatch Pal-enabled tools and return their results to the model. Other documented capabilities include personalized Pals and PalsHub, speech, benchmarking, and Hugging Face access. The graph combines README-documented product flows with source-index and excerpt evidence; some subsystem internals are unsampled, so their links are limited to documented relationships.
Main entry points: useChatSession.ts Chat turn orchestration · index.ts Talent registry · ChatScreen.tsx Chat experience · ModelsScreen.tsx Model discovery
Components 26
App and chat
- Mobile app
App.tsx - Chat experience
src/screens/ChatScreen/ChatScreen.tsx - Chat turn orchestration
src/hooks/useChatSession.ts - Session state
src/store/ChatSessionStore.ts - Session persistence
src/repositories/ChatSessionRepository.ts - App database
src/database/schema.ts
Models and inference
- Model discovery
src/screens/ModelsScreen/ModelsScreen.tsx - Hugging Face API
src/api/hf.ts - Model downloads
src/services/downloads/DownloadManager.ts - Native inference bridge
ios/PocketPal/AppIntents/LlamaInferenceEngine.swift - Completion engines
src/api/completionEngines.ts - Model state
src/store/ModelStore.ts
Assistant features
- Talent registry
src/services/talents/index.ts - Web search talent
src/services/talents/WebSearchEngine.ts - URL reader talent
src/services/talents/ReadUrlEngine.ts - Calculator talent
src/services/talents/CalculateEngine.ts - Speech engines
src/services/tts/engineRegistry.ts - Device benchmarking
src/screens/BenchmarkScreen/BenchmarkScreen.tsx
Pals marketplace
- Pal configuration
src/store/PalStore.ts - Pal persistence
src/repositories/PalRepository.ts - PalsHub services
src/services/palshub/PalsHubApiService.ts - Pal checkout
src/store/CheckoutFlowStore.ts
Native platform
- Phone hardware
Other components
- App user
- AI Phone Leaderboard
- Hugging Face Hub
Connections 27
- App user → Mobile app: uses
- Mobile app → Chat experience: opens chat
App.tsx - App user → Model discovery: selects model
- Model discovery → Hugging Face API: searches models
- Hugging Face API → Hugging Face Hub: queries
- Model discovery → Model downloads: starts download
- Model downloads → Native inference bridge: provides model
- App user → Chat experience: sends prompt
- Chat experience → Chat turn orchestration: submits turn
- Chat turn orchestration → Completion engines: requests completion
src/hooks/useChatSession.ts - Completion engines → Native inference bridge: runs inference
- Chat turn orchestration → Talent registry: dispatches tools
src/hooks/useChatSession.ts - Talent registry → Web search talent: registers engine
src/services/talents/index.ts - Talent registry → URL reader talent: registers engine
src/services/talents/index.ts - Talent registry → Calculator talent: registers engine
src/services/talents/index.ts - Web search talent → URL reader talent: allows result URLs
src/services/talents/WebSearchEngine.ts - Chat turn orchestration → Session state: updates turns
src/hooks/useChatSession.ts - Session state → Session persistence: persists sessions
src/store/ChatSessionStore.ts - Session persistence → App database: reads and writes
src/repositories/ChatSessionRepository.ts - Chat experience → Speech engines: speaks responses
- App user → Device benchmarking: runs benchmark
- Device benchmarking → Phone hardware: measures device
- Device benchmarking → AI Phone Leaderboard: shares opt-in results
- App user → Pal configuration: configures Pals
- Pal configuration → Pal persistence: persists Pals
- App user → PalsHub services: browses Pals
- PalsHub services → Pal checkout: starts purchase