How kongogaming/pocketai works
PocketAI is a local-first terminal assistant for chatting with Ollama and managing conversations, models, themes, and document-based RAG. The principal workflow runs from terminal input through the CLI: ordinary prompts stream responses from Ollama, while document-chat prompts retrieve relevant indexed chunks and ask Ollama using that context. Separate CLI commands manage setup, chat history, search, exports, models, and documents. The RAG indexing and retrieval links are visible in source; some CLI command-to-feature links rely on the README because the main-module excerpt is partial.
Main entry points: main.py CLI orchestrator · rag.py RAG workflow · ai.py Chat streaming · config.py Configuration
Components 20
Terminal app
- CLI orchestrator
pocketai/main.py - Terminal UI
pocketai/ui.py
Chat and history
- Chat streaming
pocketai/ai.py - Chat history store
pocketai/storage.py - Conversation search
pocketai/search.py - Conversation export
pocketai/exporter.py
Document RAG
- RAG workflow
pocketai/rag.py - Document loaders
pocketai/loaders.py - Text chunking
pocketai/chunking.py - Embedding client
pocketai/embeddings.py - Document registry
pocketai/documents.py - Vector index
pocketai/vectors.py
Setup and settings
- First-run setup
pocketai/setup.py - Setup screens
pocketai/setup_ui.py - Configuration
pocketai/config.py - Theme system
pocketai/theme.py - Model manager
pocketai/models.py - Update checker
pocketai/updater.py
Other components
- Terminal user
- Ollama server
Connections 24
- Terminal user → CLI orchestrator: enters commands
README.md - CLI orchestrator → Terminal UI: renders screens
pocketai/main.py - CLI orchestrator → First-run setup: starts setup
pocketai/main.py - First-run setup → Setup screens: uses prompts
pocketai/setup.py - CLI orchestrator → Configuration: loads settings
pocketai/main.py - CLI orchestrator → Chat streaming: requests replies
pocketai/main.py - Chat streaming → Ollama server: streams chat
pocketai/ai.py - CLI orchestrator → Chat history store: manages chats
README.md - CLI orchestrator → Conversation search: searches history
README.md - CLI orchestrator → Conversation export: exports chats
README.md - CLI orchestrator → Model manager: manages models
README.md - CLI orchestrator → Update checker: checks updates
README.md - CLI orchestrator → Theme system: sets theme
pocketai/main.py - Terminal UI → Theme system: uses styles
pocketai/ui.py - Chat history store → Configuration: reads model
pocketai/storage.py - CLI orchestrator → RAG workflow: indexes and queries
pocketai/main.py - RAG workflow → Document loaders: loads documents
pocketai/rag.py - RAG workflow → Text chunking: chunks text
pocketai/rag.py - RAG workflow → Embedding client: creates embeddings
pocketai/rag.py - RAG workflow → Document registry: registers files
pocketai/rag.py - RAG workflow → Vector index: indexes and searches
pocketai/rag.py - RAG workflow → Chat streaming: asks with context
pocketai/rag.py - Embedding client → Ollama server: requests vectors
pocketai/embeddings.py - Vector index → Configuration: loads settings
pocketai/vectors.py