How thevickypedia/jarvis works
Project Type and Purpose
• This is a standalone, voice-activated, natural-language user interface (Jarvis). It exposes both a CLI/Python API and an HTTP API. Internally it’s an event-driven, modular “core” (listener, scheduler, executors) that interacts with OS peripherals (mic, camera), local resources (file I/O, database), and external services (Telegram, Robinhood, email).
File-Structure Analysis
• Top-level:
• dev_scripts, docker-compose.yml, pre_commit.sh, pyproject.toml – setup, CI/CD, packaging
• docs, docs_gen – Sphinx-based documentation and GitHub Pages
• jarvis/ – the Python package
• jarvis/ subpackages:
• api/ – FastAPI (routers, models, server), SQUIRE scheduler
• executors/ – concrete action implementations (alarm, lights, VPN, etc.)
• modules/ – low-level interfaces (audio, camera, database, Telegram bot, TTS/STT)
• lib/ – installer scripts, requirements files
• indicators/ – UI audio cues
• scripts/ – AppleScript integrations
• main.py – entry point that wires everything together
• tests/ – unit tests for core modules
README Insights
• Jarvis is installed via pip, initialized via jarvis start or import jarvis; jarvis.start()
• Under the hood it registers permissions (mic, camera, automation), then spins up:
• A listener thread for speech recognition
• A TTS engine for responses
• An internal scheduler (SQUIRE) for timed jobs
• A FastAPI server with routers for remote control
• A registry of “executors” to perform tasks
Components
a. Main Components
1. Jarvis CLI / Python API (frontend trigger)
2. Jarvis Core Orchestrator (jarvis.main)
3. Event Bus / Command Dispatcher
4. Listener Module (speech-to-text)
5. NLU / Keyword Handler (preexec)
6. Scheduler (SQUIRE)
7. Executors (action layer)
8. Modules (hardware & service adapters)
9. API Server (FastAPI + routers)
10. Data Store (settings, logs)
11. External Services (Telegram, Robinhood, Email, Webhooks)
b. Relationships and Data Flows
• CLI/API → Core Orchestrator → Event Bus
• Listener Module → Event Bus
• Event Bus → Keyword Handler → Triggers
• Triggers → Scheduler or Direct Executor Invocation
• Executors → Modules → OS / External Services
• API Server ←→ Core Orchestrator (HTTP endpoints call into command dispatcher or scheduler)
• Modules (database) ↔ Data Store
• Scheduler → Executors at scheduled times
c. Architectural Patterns & Principles
• Modular / Plugin architecture: executors & modules are discoverable by registry
• Event-driven: commands dispatched via an internal bus
• Layered separation: input (listener, CLI), processing (dispatcher, scheduler), actions (executors, modules)
• Adapter pattern: modules abstract OS/peripheral/service specifics
d. Key Technologies & Frameworks
• Python 3.10+, FastAPI (HTTP API), pydantic models (api/models)
• Speech recognition & TTS libraries (jarvis/modules/audio)
• Sphinx for docs, pre-commit hooks, Docker Compose for environment
Detailed Breakdown to Capture All Elements
• Jarvis CLI / Python API → invokes jarvis.start()
• Listener Thread → STT module → Event Bus
• Keyword Handler → maps to executor commands
• Scheduler (SQUIRE) → triggers time-based tasks
• API Server (FastAPI) → routers (basics, fileio, stock_analysis, telegram, etc.) → pydantic models
• Executor Registry → executor classes (alarm, lights, TV, vpn_server…)
• Modules: audio (listener, speaker), camera, database, telegram bot, internet, robinhood, email templates
• Data Store: settings.json, logs, sqlite or files
• External: Telegram API, Robinhood API, email SMTP, system calls (AppleScript), OS peripherals