Jarvis-OS-Agent

agent
Security Audit
Warn
Health Warn
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 5 GitHub stars
Code Pass
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
  • Permissions — No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

An open-source autonomous AI OS Agent for Windows. Features zero line-drift coding, lifelong memory, Android ADB control, and proactive HITL.

README.md

🧠 J.A.R.V.I.S. OS Agent – The Ultimate Open-Source Autonomous AI Assistant for Windows

Welcome to the Jarvis-OS-Agent by @thekaifansari01. > "We call it an AI Operating System because it autonomously controls your PC, Android Phone, Local Files, and Lifelong Memory — not just your code."

Open-Source AI Agent · Zero Line‑Drift Coding · Lifelong Episodic Memory · Voice‑First Multimodal · Proactive HITL · Android ADB Control · Telegram Remote Execution · Hybrid RAG

Python Version
Node.js
Groq LPU
Gemini
Regolo AI
OpenRouter
Custom Provider
Local Models
WhatsApp
Telegram
Gmail
Google Calendar

License: MIT
PRs Welcome

Built by an 18‑year‑old solo developer. Commerce background. BCA first year. No team. No funding. Just late nights, coffee, and a burning passion to build the impossible.


📌 Table of Contents


🎯 Core Features of J.A.R.V.I.S. AI Agent

Jarvis OS Agent is a highly advanced desktop-native AI Operating System built in Python. It bridges sub-second conversational AI with deep, multi-step autonomous engineering execution.

Icon Key AI Feature Technical Advantage & SEO Impact
💻 Autonomous Software Engineering Can autonomously explore codebases (repo_map), read files (view), replace exact code blocks (replace_block), execute Python scripts (run_python_code), and run terminal commands. Proven to autonomously fix bugs in milliseconds.
🛡️ Zero Line‑Drift Code Editing Uses exact replace_block diffs instead of fragile line numbers. This eliminates the "line‑drift bug" plaguing Claude Code. Auto-catches syntax errors via AST linter and self‑corrects without human intervention.
🧠 Lifelong Episodic LTM & Hybrid RAG Vector-based semantic knowledge graph backed by SentenceTransformers (all-MiniLM-L6-v2). Indexes local documents with smart chunk overlap, Hybrid search (Vector + BM25 + RRF), and Recency boost. Remembers history from months ago.
🔄 Hybrid Semantic AI Routing Cloud Regolo router + local rule‑based fallback. Intelligently routes simple commands to ultra‑fast FastBrain (Groq LPU, <1.5 sec), and complex tasks to deep‑reasoning AgenticBrain.
📱 Android ADB Mobile Control Remotely control your Android phone via ADB over Tailscale. Execute lock/unlock, open apps, make calls, send SMS, toggle WiFi/Data, and take screenshots directly from your PC.
🌍 Telegram Remote PC Control Control your Windows PC from anywhere globally via a secure Telegram bot. Commands trigger silent background execution without disrupting your active desktop workflow.
📨 Proactive Automation (Email/WhatsApp/Telegram) Background listeners for Gmail, WhatsApp, Telegram, and Google Calendar. Jarvis detects updates in real-time and utilizes Proactive HITL (Human-In-The-Loop) to ask for consent before modifying critical data.
🗣️ Voice‑First Multimodal AI Integrates Deepgram Nova-2 STT with Vosk KWS (Keyword Spotting) for sub-second noise-immune triggering. Features Edge TTS voice output, multimodal vision (OCR/Image Analysis), and AI Image Generation (Flux/AI Horde).
🔌 Multi‑LLM Auto‑Failover (Cloud & Local) Seamlessly switches between Regolo, Gemini, OpenRouter, or Local LLMs (Ollama, LM Studio, vLLM). Zero downtime workflow execution even if the primary provider hits API rate limits.
🎨 Reactive Dynamic UI Ecosystem Features a ZMQ‑powered floating PyQt5 Agent Panel with real‑time thought/action/observation streaming. Includes a live markdown typing popup with async image previews, glass‑morphism, and auto-resize dynamic glow.
🔒 Enterprise‑Grade Command Security Utilizes shlex tokenization and os.path.realpath canonicalization to auto‑block system‑destroying terminal commands (e.g., rm -rf /, format C:). Safe commands (pip, git) execute frictionlessly.
⚙️ ServiceWatchdog Resilience A dedicated background watchdog monitors processes (STT, Baileys, ADB, Telegram). It intelligently auto-restarts crashed services while skipping unauthenticated modules to prevent spam.

🔥 J.A.R.V.I.S. vs. Claude Code (The Superior Alternative)

For developers seeking an open-source AI coding agent and desktop assistant, the Jarvis OS Agent directly solves the critical pain points of paid enterprise solutions.

Traditional AI Agents (e.g., Claude Code) J.A.R.V.I.S. OS Agent Advantage
High Cost & Subscription Walls: Expensive API usage and monthly recurring fees. 100% Free & Open Source: Run entirely on local models (Ollama/LM Studio) or free-tier cloud APIs.
Line‑Drift Bugs: Edits often fail because LLMs miscalculate line numbers during code modification. Exact Diff-Matching (replace_block): Guaranteed zero line-drift. Finds the exact code block irrespective of line numbers.
Amnesia (Session-Only Memory): Forgets context within 2 minutes of a new chat. Lifelong Episodic Memory (LTM): Powered by local vector embeddings, temporal decay, and subgraph extraction.
Text-Only Constraints: Generates code but lacks real-world native execution capabilities. Native Tool Execution: Terminal, Python REPL, File CRUD, Email, WhatsApp, Telegram, Calendar, Image Gen, and Android ADB.
Isolated Environment: Cannot be triggered remotely. Telegram Remote Bot: Issue commands to your PC remotely via Telegram; executed silently in the background.
Reactive Only: Waits for you to prompt it. Proactive HITL: Background listeners read emails/chats and proactively suggest calendar updates or replies.
Basic RAG Integration: Uses either semantic OR keyword search, yielding poor results. Hybrid RAG System: BM25 keyword search + Vector semantic search merged via Reciprocal Rank Fusion (RRF).

🏗️ Technical Architecture of Jarvis OS

Trust through transparency. Here is the complete architecture flow of the Python Autonomous Agent:

flowchart TD
    User[👤 Voice or Text Command] --> Input{Input Type}
    Input -->|Voice| Wake[🎙️ Vosk KWS Wake Word]
    Input -->|Text| Hotkey[⌨️ Ctrl+Shift+J Popup]
    Input -->|Remote| TelegramBot[🤖 Telegram Remote Bot]
    Wake --> STT[⚡ Deepgram Nova-2 STT]
    Hotkey --> Router[🚦 Hybrid Semantic Router]
    TelegramBot -->|Silent Flag| Router
    STT --> Router
    Router -->|Fallback| LocalRouter[🔄 Local Rule-Based Router]
    
    Router -->|Simple / Stateless| FastBrain[⚡ FastBrain<br/>Groq Llama-3.3-70B]
    Router -->|Complex / Stateful| AgenticBrain[🧠 AgenticBrain<br/>Regolo/Gemini/OpenRouter/Custom]
    
    AgenticBrain --> Providers[🔌 Provider Abstraction Layer]
    Providers --> Regolo[Regolo MoE]
    Providers --> Gemini[Gemini Reasoning]
    Providers --> OpenRouter[OpenRouter<br/>Claude 3.7 / o1 / DeepSeek]
    Providers --> Custom[Custom Provider<br/>Any OpenAI‑compatible<br/>endpoint including Ollama]
    
    subgraph Memory[🧠 Memory Ecosystem]
        LTM[(🗄️ Vector Semantic Graph LTM<br/>Weighted Graph + Subgraph + Decay)]
        RAG[(📚 ChromaDB RAG<br/>Hybrid Vector+BM25+RRF)]
        JSONL[📜 JSONL Rolling History<br/>15-Day Context]
        Profile[👤 User Profile & Mood]
    end
    
    AgenticBrain <--> Memory
    FastBrain <--> Memory
    
    subgraph Tools[🛠️ Native Tool Ecosystem]
        Code[💻 Repo-Map / Replace-Block / AST Linter]
        Comms[📨 Gmail / WhatsApp / Telegram / Calendar]
        System[⚙️ OS Control / Apps / Clipboard]
        Search[🌐 Tavily / ArXiv / Scraper]
        Vision[👁️ Vision Multimodal / OCR]
        Image[🎨 Image Gen / Edit]
        Mobile[📱 ADB / Mobile Control]
    end
    
    AgenticBrain --> Tools
    FastBrain --> System
    FastBrain --> Search
    
    subgraph UI[🎨 UI & Visualization]
        AgentPanel[🖥️ ZMQ Agent Panel]
        TypingPopup[📝 Markdown Typing Popup]
        STTPopup[🗣️ STT Status Popup]
        InputPopup[⌨️ Input Popup]
    end
    
    AgenticBrain -->|ZMQ PUB| AgentPanel
    FastBrain -->|typing_status.json| TypingPopup
    STT --> STTPopup
    InputPopup --> Router
    
    subgraph Proactive[🛡️ Proactive HITL Watchdog]
        Listeners[📡 Gmail / WhatsApp / Telegram / Reminders]
        Scout[🛡️ Proactive Scout Agent]
        Consent[🔒 HITL Consent Gate]
    end
    
    Listeners -->|Conditional Start| Scout
    Scout -->|Suggested Action| AgenticBrain
    AgenticBrain -->|Requires Permission| Consent -->|User Confirms| AgenticBrain
    
    subgraph Resilience[⚙️ Resilience Layer]
        Watchdog[🛡️ ServiceWatchdog]
        Failover[🔄 Provider Failover]
        Recovery[🔄 Two-Strike Rule]
    end
    
    Watchdog -.->|Smart Skip| System
    Failover -.-> Providers
    Recovery -.-> AgenticBrain

⚡ Dual‑Engine AI: FastBrain vs 🧠 AgenticBrain

Jarvis utilizes a dual-engine architecture to optimize API costs, speed, and reasoning depth.

Feature / Capability ⚡ FastBrain (Groq LPU) 🧠 AgenticBrain (Regolo/Gemini/OpenRouter/Local)
Core Philosophy Stateless, sub‑second latency (<1.5s). Stateful, deep reasoning, multi-step tool execution.
Routing Trigger Short commands, casual chat, simple OS toggles. Complex prompts, software engineering, long-term memory.
System Controls Open/Close Apps, URLs, YouTube direct play. Full system automation via Python scripts & CMD/PowerShell.
Hardware Toggles Volume, Brightness, Mute, Screenshot, Lock. (Included inside complex workflow chains)
File Operations ❌ Cannot modify files. ✅ Full CRUD, repo_map, replace_block, create_many.
Communication ❌ No email/WhatsApp/Telegram execution. ✅ Send Gmails, WhatsApp & Telegram messages, fetch chat history.
Code Execution ❌ No Python/Terminal execution. run_python_code (preferred) and execute_terminal_command.
Memory Recall ❌ No LTM; only short-term context. memory_actions (Lifetime vector graph recall + temporal decay).
Multimodal Vision ❌ No vision processing. vision (Image/Video analysis, OCR, Object detection).
Web Research ❌ Basic real-time search (quick_web_search). deep_research (420s synthesis), ArXiv, YouTube scraping.
Mobile Control ❌ No Android connection. ✅ Full ADB mobile control over Tailscale.
Proactive HITL ❌ No background scanning. ✅ Strict Partner Confirmation Mode before permanent modifications.

🧠 Lifelong Episodic Memory & Hybrid RAG System

JARVIS implements a four‑tier artificial memory system, setting a new standard for open-source AI desktop agents:

  1. 📜 Rolling JSONL History (Short‑Term): 15‑day rolling conversation context, auto‑pruned and archived.
  2. 🗄️ Weighted Lifetime Episodic Graph (Long‑Term):
  • Built on NetworkX with weighted edges and temporal decay (relations older than 6 months lose half their weight).
  • Semantic Vector Embeddings: Uses SentenceTransformers (all-MiniLM-L6-v2) for zero-shot semantic matching. Maps conceptual synonyms (e.g., "React" matches "ReactJS") autonomously.
  • Batched Array Queries & Preloading: Preloads the embedding engine at startup to process multi-entity graph queries in a single agent step with zero latency.
  • Subgraph Retrieval: Extracts complete 2-hop subgraphs around matched nodes to retain secondary contextual facts.
  1. 📚 Hybrid RAG (Workspace Documents):
  • Smart Chunking: Text is chunked with 1500 character limits and a 200-character overlap to preserve cross-boundary context.
  • Hybrid Retrieval: Merges BM25 keyword search and Gemini embedding vector search via Reciprocal Rank Fusion (RRF).
  • Recency Boost: Recently modified files receive a 20% score lift, creating a self-updating knowledge base.
  1. 👤 User Profile & Mood Tracker: Automatically extracts and tracks user bio, preferences, and mood states into knowledge-graph triplets.

📱 Android Mobile Control via ADB

Control your Android smartphone completely hands-free from your Windows PC using the Jarvis Agent via ADB and Tailscale:

Capability Category Example Agentic Commands
System Actions Lock/Unlock, Home Button, Back Button, Recent Apps
Volume & Media Volume Up/Down, Mute Device, Flashlight Toggle
App Launching Open WhatsApp, Chrome, YouTube, Spotify, Camera, Settings
Telecom (Calls & SMS) Make direct phone calls, Open dialer, Read/Send SMS messages
Screenshots Capture Android screenshot and save/analyze on Windows PC
Network Toggles Enable/Disable WiFi, Toggle Mobile Data
Notifications Expand notification panel, Access Quick Settings
Battery & Sensors Check exact battery percentage and charging state
File Transfer Pull files from Android to PC, Push files to Android

Setup Note: Enable USB debugging on your Android, run adb tcpip 5555, connect your devices via Tailscale, and assign ADB_PHONE_IP in the .env file.


🛠️ Integrated AI Tool Ecosystem

AI Category Integrated Capabilities
💻 Software Engineering repo_map, replace_block (zero line-drift), AST linting, create_many
📨 Communication Agents Gmail Pub/Sub (send/read), WhatsApp & Telegram API, Google Calendar OAuth
📂 Workspace & RAG Single‑file CRUD, recursive repo scanning, Hybrid RAG (BM25+Vector+RRF)
📱 Mobile Control ADB Suite (lock, apps, calls, SMS, screenshot, WiFi/Data, file push/pull)
🌍 Remote Control Telegram Bot API for triggering silent PC commands externally
🌐 Search & Research Tavily web search, ArXiv academic search, YouTube transcript extraction, Deep Research
⚙️ System Automation App launch/kill, volume/brightness control, clipboard CRUD operations
👁️ Multimodal Vision Screen/Video analysis, Object detection, OCR data extraction
🎨 Image Generation Text‑to‑image generation (Regolo/FLUX), Image‑to‑image editing (AI Horde)

🚀 How to Install Jarvis OS Agent (Quick Setup)

📋 Prerequisites

  • Windows 10/11 (Primary supported OS)
  • Python 3.10+ (Required for AI models and dependencies)
  • Node.js 18+ (Required for the WhatsApp Baileys bridge)

🛠️ Single Block Installation

Copy and paste this exact command block into your PowerShell terminal:

# 1. Clone the Jarvis Repository
git clone [https://github.com/thekaifansari01/Jarvis-OS-Agent.git](https://github.com/thekaifansari01/Jarvis-OS-Agent.git)
cd Jarvis-OS-Agent

# 2. Setup Python Virtual Environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt

# 3. Setup Node.js Dependencies (WhatsApp Integration)
cd tools/Messanger/whatsapp/BaileysServer
npm install
cd ../../../..

# 4. Global CLI Registry Setup (Run ONCE from the root directory)
python SetupRegistry.py

⚠️ CRITICAL: Ensure your terminal is in the root Jarvis-OS-Agent/ directory before executing python SetupRegistry.py.

🌐 Global Command Initialization

Once setup is complete, open a new terminal window and launch your agent globally by typing:

jarvis

You do not need to activate the virtual environment manually again; the jarvis command is now system‑wide.


📋 Real‑World Autonomous AI Use Cases

🐞 Scenario 1: Automated Bug Fixing (Zero Line‑Drift)

  1. User: "Run the tests in my Python project and fix any failing ones."
  2. Jarvis (AgenticBrain): Executes pytest -v via terminal; identifies 3 failing test cases.
  3. Jarvis: Utilizes the view tool to read the specific failing files.
  4. Jarvis: Employs replace_block (exact search & replace) to fix the core logic errors safely.
  5. Jarvis: Re‑runs pytest -v to verify 100% success.
  6. Jarvis (Voice): "Sir, all tests have passed. I have made changes to 3 files. Would you like to review them?"

🚨 Scenario 2: Proactive HITL (Your AI Executive Assistant)

  1. Background Listener: The EmailProactive service detects an incoming email: "Meeting shifted to 5 PM."
  2. Jarvis (Scout Mode): Evaluates priority and flags it for user consent.
  3. Jarvis (Voice Alert): "[Alert] There is an email from Ram saying the meeting has been moved to 5 PM. Should I update the calendar?"
  4. User: "Yes, do it."
  5. Jarvis: Triggers AgenticBrain → calendar_action to securely update the Google Calendar event.
  6. Jarvis: "Done sir, the calendar has been updated."

🧪 Scenario 3: Full‑Stack Application Generation

  1. User: "Create a project named 'TaskFlow' on the Desktop. FastAPI backend with SQLite, React frontend with Tailwind, and 10+ unit tests. Run pytest and make all tests pass."
  2. Jarvis (Autonomous Execution):
  • Scaffolds the folder architecture.
  • Generates requirements.txt and package.json.
  • Codes FastAPI CRUD endpoints and React UI.
  • Writes the test suite.
  • Executes npm install and pip install autonomously.
  • Runs pytest. If failures occur, utilizes replace_block to iterate and fix until 100% success.
  • Invokes complete_task.

🧠 Scenario 4: Weighted Graph Knowledge Recall

  1. Day 1: User: "I like BMW." → Graph Database stores [User] --(LIKES)--> [BMW] (Weight=1).
  2. Day 60: User: "What is the color of my automobile?" → Semantic vector search identifies automobile maps to BMW, returning the stored relation.
  3. Day 100: User: "I really like BMW." → Knowledge Graph Weight increases to 2.
  4. Day 400: User: "What do I like?" → Algorithm calculates temporal decay (Day 400 vs Day 100). Adjusted weight prioritizes the most relevant lifelong facts instantly.

⚙️ Command Line Interface (CLI) & Agent Configuration

Agent Session & Memory Management CLI

⚠️ Important: Ensure the main Jarvis application is OFF before running memory, login, or reset commands.

CLI Command Execution Action
jarvis login --whatsapp Initialize WhatsApp Web QR authentication
jarvis login --telegram Initialize Telegram authentication (Phone + OTP)
jarvis login --mail Authenticate Gmail via OAuth2
jarvis login --calendar Authenticate Google Calendar via OAuth2
jarvis login --all Run batch authentication for all integrations
jarvis logout --whatsapp Logout WhatsApp and destroy session data
jarvis logout --telegram Logout Telegram and destroy session data
jarvis logout --mail Revoke Gmail OAuth tokens
jarvis logout --calendar Revoke Calendar OAuth tokens
jarvis logout --all Revoke ALL connected services instantly
jarvis bot --activate Configure and activate the Remote Telegram Control Bot
jarvis bot --deactivate Revoke tokens and offline the remote bot
jarvis bot --status Check the live status of your remote bot
jarvis memory --clear Purge AI contextual memory (maintains active service sessions)
jarvis reset --hard FACTORY RESET – Wipes all memory graphs, vector databases, and API sessions
jarvis --help Display the global help documentation

Environment Variables (.env) Configuration

Copy .env.example to .env in the root directory and populate your API credentials. For 100% Local LLM Execution (e.g., Ollama), configure the Custom Provider block:

Environment Variable Description Default Status
GROQ_API_KEY FastBrain Routing & Sub-second Tasks (Required)
GEMINI_API_KEY Embeddings, Vision Processing, Reasoning (Required)
REGOLO_API_KEY Primary Agentic Engine Provider (Required)
OPENROUTER_API_KEY Fallback Agentic Provider (Claude 3.7/DeepSeek) (Optional)
TAVILY_API_KEY Real-time Web Search Engine (Required)
DEEPGRAM_API_KEY Ultra-low latency Speech-to-Text (Required)
ADB_PHONE_IP Tailscale IP for Android Mobile Control (Optional)
TELEGRAM_API_ID Telegram App API ID for Desktop Client (Optional)
TELEGRAM_API_HASH Telegram App API Hash for Desktop Client (Optional)
CUSTOM_BASE_URL Local OpenAI‑compatible endpoint (Ollama/LM Studio) http://localhost:11434/v1
CUSTOM_MODEL Specific Local Model string llama3.2:3b
CUSTOM_API_KEY Pass API key for local/custom deployment EMPTY_KEY

🔧 Troubleshooting & FAQ

Known Issue Proven Solution
ModuleNotFoundError during startup Ensure you are running inside the .venv and execute pip install -r requirements.txt.
Vosk Offline Wake-Word model missing Run jarvis once to trigger auto‑download, or manually download and place in Data/model/vosk-model-small/.
WhatsApp Service fails to launch Verify Node.js 18+ is installed. Run npm install inside tools/Messanger/whatsapp/BaileysServer. Ensure port 3000 is available.
Telegram Desktop Client fails Verify TELEGRAM_API_ID and TELEGRAM_API_HASH in .env and authenticate via jarvis login --telegram.
Remote Telegram Bot is unresponsive Ensure activation via jarvis bot --activate with a valid BotFather token and restart the Jarvis OS Agent.
jarvis command not recognized globally Run python SetupRegistry.py from your activated virtual environment in the root directory, then launch a new terminal.
Unwanted popup authentications on boot Run jarvis logout --service. Proactive listeners only start if valid credentials exist.
Mobile ADB Connection Timeout Verify ADB_PHONE_IP in .env, confirm Tailscale VPN status, and manually test adb devices in CMD.
Custom Local Provider (Ollama) failing Double-check CUSTOM_BASE_URL ends with /v1 and the endpoint strictly follows OpenAI formatting.
Knowledge Graph memory feels stale Delete Data/jarvis_memory/lifetime_graph.json and reboot. Graph nodes, temporal weights, and vector embeddings will auto-rebuild.
Hybrid RAG Search returning poor data Delete Data/jarvis_memory/rag_chroma_db and reboot to force a fresh index with updated chunk overlap logic.

🤝 Contributing to the Open Source Agent

We actively welcome contributions to make the Jarvis OS Agent the best open-source AI desktop assistant! Whether it's patching bugs, integrating new LLM providers, or expanding documentation:

  1. Fork the repository.
  2. Create a Feature Branch (git checkout -b feature/AdvancedRAGUpdate).
  3. Commit your Changes (git commit -m 'Implement AdvancedRAGUpdate').
  4. Push to the Branch (git push origin feature/AdvancedRAGUpdate).
  5. Open a Pull Request for review.

📄 License

This open-source AI project is distributed under the MIT License. See the LICENSE file for full documentation.


🌟 Show Your Support for the Developer

If the Jarvis OS Agent streamlined your workflow, autonomously fixed your bugs, or inspired your own AI projects:

  • Star this repository to help it rank and grow the community.
  • 🐦 Follow & Tweet your use cases by tagging @thekaifansari01.
  • Buy me a coffee (Link coming soon) – Late nights, compiling code, and building AI operating systems run purely on caffeine.

Reviews (0)

No results found