How chatboxai/chatbox works
Chatbox is a local-first AI copilot spanning desktop, web, and mobile clients. The principal workflow is configuring a provider, sending a prompt, and receiving a streamed reply; conversations are retained locally. The map also preserves documented image generation, prompt reuse, and localization, plus repository-supported session persistence, browser, sandbox, MCP, and knowledge-base capabilities. Several of these branches are identified by the tree or README, but their runtime wiring was not sampled; those links are omitted rather than inferred.
Main entry points: GenerationService.ts Generation runtime · definitions Model providers · main.ts Desktop app · ChatMessageService.ts Chat service
Components 22
Client experience
- Desktop app
src/main/main.ts - React integration
packages/chatbox-react/src - Localization
packages/chatbox-i18n/src
AI interaction
- Chat service
packages/chatbox-core/src/application/chat/ChatMessageService.ts - Generation runtime
packages/chatbox-core/src/generation/GenerationService.ts - Model providers
src/shared/providers/definitions - Image generation
packages/chatbox-core/src/application/image-generation - Copilot services
packages/chatbox-core/src/application/copilots
Conversation data
- Session services
packages/chatbox-core/src/application/session - Row repository
packages/chatbox-core/src/application/session/RowBackedSessionRepository.ts - Session row storage
packages/chatbox-core/src/ports/session-row-store.ts - Renderer storage
src/renderer/storage/SessionRowStorage.ts - Settings services
packages/chatbox-core/src/application/settings - Backup transfer
packages/chatbox-core/src/backup-export
Tools and knowledge
- Built-in browser
src/main/built-in-browser/controller.ts - Execution sandbox
src/main/sandbox/manager.ts - MCP tools
packages/chatbox-core/src/mcp/controller.ts - Knowledge base
src/main/knowledge-base - Session search
packages/chatbox-core/src/application/session/SessionSearchService.ts
Platform services
- Electron main
src/main/main.ts - File edits
src/shared/file-edits.ts
Other components
- User
Connections 22
- User → Desktop app: uses
README.md - Desktop app → Model providers: configures provider
README.md - User → Chat service: sends prompt
README.md - Chat service → Generation runtime: starts generation
- Generation runtime → Model providers: requests reply
README.md - Model providers → Generation runtime: streams response
README.md - Generation runtime → Session services: updates conversation
- Session services → Row repository: uses repository
packages/chatbox-core/src/application/session/RowBackedSessionRepository.ts - Row repository → Session row storage: uses port
packages/chatbox-core/src/application/session/RowBackedSessionRepository.ts - Renderer storage → Session row storage: implements port
- User → Image generation: requests images
README.md - User → Copilot services: uses prompts
README.md - User → Settings services: configures app
README.md - User → Localization: selects language
README.md - User → Backup transfer: backs up data
- Generation runtime → MCP tools: uses tools
- Generation runtime → Built-in browser: uses browser
- Generation runtime → Execution sandbox: runs tasks
- Generation runtime → Knowledge base: retrieves context
- User → Session search: searches sessions
- Electron main → Knowledge base: initializes
src/main/main.ts - Execution sandbox → File edits: writes files
src/main/sandbox/manager.ts