How isair/jarvis works
Purpose and entry points
Jarvis is a local-first Python desktop voice assistant. It combines continuous microphone listening, local LLM inference via Ollama, long-term memory, tool execution, and local speech output; it also offers hold-to-talk dictation. Core runtime entry points are src/jarvis/main.py and src/jarvis/daemon.py; the packaged desktop shell starts through src/desktop_app/__main__.py and src/desktop_app/app.py.
Desktop lifecycle and configuration
The desktop application owns tray/UI lifecycle, first-run setup, settings, updates, and visibility into stored memory. It launches/configures the assistant daemon rather than implementing reply logic itself. Configuration is centralized in src/jarvis/config.py; desktop-specific paths and setup flow live in src/desktop_app/paths.py, src/desktop_app/setup_wizard.py, and src/desktop_app/settings_window.py.
Voice ingestion and intent boundary
Audio handling separates transcription and conversational control from downstream reasoning. src/jarvis/listening/listener.py orchestrates microphone capture; src/jarvis/listening/wake_detection.py, intent_judge.py, and echo_detection.py identify directed requests, extract query text, recognize stop/follow-up behavior, and suppress assistant-speech echoes. The shared Whisper-backed transcription layer is src/jarvis/dictation/dictation_engine.py. Dictation is a parallel interaction mode in src/jarvis/dictation/dictation_engine.py and src/jarvis/dictation/history.py, with the listener paused as needed.
Reply orchestration and LLM calls
src/jarvis/reply/engine.py is the central turn coordinator: it receives an accepted utterance, assembles context, selects/plans tools, runs the agentic response loop, and returns a response for speech. Local Ollama model access is abstracted in src/jarvis/llm.py. Planning and quality control are distinct stages: src/jarvis/reply/planner.py decomposes multistep work and can resolve steps to calls; src/jarvis/reply/evaluator.py validates or steers generated work. Prompt policy and model-specific variants reside in src/jarvis/reply/prompts/system.py and src/jarvis/reply/prompts/model_variants.py.
Memory, privacy, and context assembly
Persistent conversation and knowledge memory are local storage concerns under src/jarvis/memory/. src/jarvis/memory/db.py manages persistence, conversation.py supplies dialogue history, and graph.py/graph_ops.py maintain a self-organizing knowledge graph. src/jarvis/memory/recall_gate.py controls what recalled information enters a turn; embeddings and vector retrieval are in src/jarvis/memory/embeddings.py and src/jarvis/utils/vector_store.py. Sensitive values are redacted before disk persistence through src/jarvis/utils/redact.py. The reply engine’s enrichment/digest boundary is src/jarvis/reply/enrichment.py, limiting memory and tool payload growth for smaller models.
Tool catalogue, selection, and execution
Tools implement a common interface under src/jarvis/tools/base.py and are registered by src/jarvis/tools/registry.py. Before the main model sees tools, src/jarvis/tools/selection.py filters the catalogue using LLM, embeddings, keywords, or all-tools strategies; src/jarvis/tools/builtin/tool_search.py lets the agent expand its accessible set mid-turn. Built-ins cover web/search, screen, filesystem, weather, and nutrition, e.g. src/jarvis/tools/builtin/web_search.py, src/jarvis/tools/builtin/screenshot.py, and src/jarvis/tools/builtin/nutrition/log_meal.py.
External and runtime services
Ollama is the material local inference dependency for chat, intent classification, routing/planning, and optional digest passes. Whisper transcription may use GPU acceleration; desktop packaging includes CUDA recovery support in src/desktop_app/cuda_recovery.py. Speech output is handled by src/jarvis/output/tts.py with Piper default and optional Chatterbox. MCP servers are external subprocess/stdin-stdout integrations managed by src/jarvis/tools/external/mcp_runtime.py and mcp_client.py, maintaining sessions for stateful tools such as browser automation. Optional network boundaries are explicit: web search/fetch tools, configured MCP services, and location detection in src/jarvis/utils/location.py.
Main entry points: engine.py Reply engine · registry.py Tool registry · app.py Desktop application · daemon.py Assistant daemon
Components 20
Desktop shell
- Desktop application · Owns tray, setup, settings, updates, and daemon lifecycle.
src/desktop_app/app.py - Setup and settings
src/desktop_app/setup_wizard.py
Voice interaction
- Microphone listener
src/jarvis/listening/listener.py - Wake and intent gate · Detects directed requests, follow-ups, stops, and echoes.
src/jarvis/listening/intent_judge.py - Whisper transcription · Shared by continuous listening and hold-to-talk dictation.
src/jarvis/dictation/dictation_engine.py - Local speech output · Uses Piper by default with optional Chatterbox.
src/jarvis/output/tts.py
Turn reasoning
- Reply engine · Builds context, drives the agent loop, and returns speech-ready replies.
src/jarvis/reply/engine.py - Planning and evaluation · Decomposes work and validates or steers generated work.
src/jarvis/reply/planner.py - Prompt policy
src/jarvis/reply/prompts/system.py - Context enrichment · Limits memory and tool payload growth for smaller models.
src/jarvis/reply/enrichment.py
Local memory
- Memory persistence · Stores conversation and knowledge memory locally.
src/jarvis/memory/db.py - Recall gate and graph · Controls recalled context and maintains the knowledge graph.
src/jarvis/memory/recall_gate.py - Sensitive-data redaction · Redacts sensitive values before persistence.
src/jarvis/utils/redact.py
Tool runtime
- Tool selection · Narrows tools before they are exposed to the model.
src/jarvis/tools/selection.py - Tool registry · Registers common-interface built-in and external tools.
src/jarvis/tools/registry.py - Built-in tools · Includes web, screen, filesystem, weather, and nutrition actions.
src/jarvis/tools/builtin/web_search.py - MCP runtime · Manages stateful subprocess stdin/stdout tool sessions.
src/jarvis/tools/external/mcp_runtime.py
Other components
- Assistant daemon · Runs the continuous local assistant.
src/jarvis/daemon.py - Shared configuration
src/jarvis/config.py - Ollama · Provides chat, classification, routing, planning, and optional digest inference.
src/jarvis/llm.py
Connections 22
- Desktop application → Setup and settings: hosts
- Desktop application → Assistant daemon: launches and configures
- Assistant daemon → Microphone listener: runs
- Shared configuration → Desktop application: configures
- Shared configuration → Assistant daemon: configures
- Microphone listener → Whisper transcription: audio to text
- Whisper transcription → Wake and intent gate: utterance text
- Wake and intent gate → Reply engine: accepted request
- Reply engine → Context enrichment: assembles bounded context
- Context enrichment → Recall gate and graph: requests recall
- Recall gate and graph → Memory persistence: retrieves local memory
- Reply engine → Planning and evaluation: plans and evaluates
- Planning and evaluation → Ollama: local inference
- Reply engine → Prompt policy: applies policy
- Reply engine → Tool selection: selects tools
- Tool selection → Tool registry: filters catalogue
- Tool registry → Built-in tools: executes
- Tool registry → MCP runtime: opens external sessions
- Reply engine → Ollama: agent loop
- Reply engine → Local speech output: response text
- Reply engine → Sensitive-data redaction: memory writes
- Sensitive-data redaction → Memory persistence: safe persistence