Skip to content

NexionisJake/Project-ALFRED

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿคต๐Ÿปโ€โ™‚๏ธ PROJECT ALFRED

Adaptive Logical Framework for Responsive Execution & Decisions

Python 3.10+ License: MIT AI Engine: Groq Local Engine: Ollama

"At your service, Sir."

ALFRED is a sophisticated, hybrid AI desktop assistant designed to bridge the gap between cloud intelligence and local system control. Unlike standard chatbots, ALFRED acts as a fully autonomous agent that can hear, speak, see, and act on your computer.

Featuring a holographic WayneTech-style overlay, ALFRED provides a visual connection to the AI's thought process, complete with sentiment-aware color shifting, real-time text generation, and "Ghost Writer" capabilities.


โšก Key Features

๐Ÿง  Hybrid Brain Architecture

ALFRED leverages the best of both worlds:

  • Cloud Brain (Groq + Llama 3.3 70B): Handles complex reasoning, conversation, and sentiment analysis at lightning speeds.
  • Local Body (Ollama + Hermes 3): Executes sensitive system tools (app launching, hardware checks) locally for privacy and security.

๐Ÿ‘๏ธ Visual Cortex (Computer Vision)

Powered by Llama 4 Scout, ALFRED can "see" your screen.

  • Vision-to-Code: "Look at this LeetCode problem and write the solution."
  • Error Analysis: "Read this error message and tell me how to fix it."
  • Instant Capture: Uses the mss library for <10ms screen capture latency.

โœ๏ธ Ghost Writer (The "Hands")

ALFRED includes a Ghost Writer engine that can take control of your keyboard.

  • Autonomously types or pastes code solutions directly into your IDE.
  • Perfect for live coding assistance, email drafting, or filling forms.
  • Safety: Includes smart delays to ensure you have the correct window focused.

โš›๏ธ Reactive Holographic HUD

A transparency-enabled PyQt6 overlay that sits on your desktop:

  • Dynamic Speech Bubble: Auto-resizes and auto-scrolls based on response length (teleprompter style).
  • Sentiment Engine: The Tactical Radar changes color based on the AI's emotional context:
    • ๐ŸŸข Green: Success / Happy
    • ๐ŸŸ  Orange: Alert / Warning
    • ๐Ÿ”ด Red: Error / Critical
    • ๐Ÿ”ต Cyan: Neutral / Processing

๐Ÿ’พ Long-Term Memory

  • Conversations persist across sessions via encrypted storage
  • Automatic summarization every 10 messages
  • Loads previous context on startup

๐Ÿ› ๏ธ Installation

1. Prerequisites

  • Python 3.10+
  • Ollama installed and running.
  • Groq API Key (Free tier available at console.groq.com).
  • OpenWeatherMap API Key (Free tier for weather features).

2. Setup

# 1. Clone the repository
git clone https://github.com/NexionisJake/Project-ALFRED.git
cd Project-ALFRED

# 2. Install Python dependencies
pip install -r requirements.txt

# 3. Pull the local model for tool execution
ollama pull hermes3

3. Configuration

Create a .env file in the root directory:

GROQ_API_KEY=your_groq_key_here
OPENWEATHER_API_KEY=your_weather_key_here

(Optional) Customize config.py to change the voice or wake word:

ASSISTANT_NAME = "Alfred"
WAKE_WORD = "alfred"
VOICE_NAME = "en-GB-RyanNeural" # British Butler Voice

4. Run ALFRED

python main.py

๐ŸŽฎ Capabilities & Tools

ALFRED comes equipped with 11 integrated tools out of the box:

Category Tool Name Description
System open_application Launches apps (Chrome, Spotify, VS Code, etc.)
get_system_status Reports real-time CPU and RAM usage.
system_volume Controls volume (Up, Down, Mute).
Web Google Search Performs Google searches and opens results.
get_weather Fetches real-time weather for any city.
Media media_play_pause Toggles media playback (Universal).
media_next/prev Skips or rewinds tracks.
Productivity write_to_screen (Ghost Writer) Types generated text/code into active window.
Memory search_knowledge_base Recalls personal facts from brain.txt.
get_current_time Provides date, time, and day briefing.

๐Ÿ—ฃ๏ธ Voice Commands Example

The "Morning Briefing"

You: "Alfred, give me the morning briefing." Alfred: "Good morning, Sir. It is currently 8:00 AM. The weather in New York is 72 degrees and clear. All systems are operational."

The "Coder" Workflow

You: (Open LeetCode) You: "Alfred, look at this problem and write the Python solution." Alfred: "Analyzing the Two-Sum problem... I have generated the solution. Pasting now." (Code automatically appears in your editor)

The "DJ" Mode

You: "Play some music and turn the volume up." Alfred: "Playing Spotify and adjusting audio levels, Sir."

Vision Commands

You: "Look at my screen and describe what you see" Alfred: "I can see your code editor with a Python file..."


๐Ÿ“Š System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          USER INTERACTION               โ”‚
โ”‚  (Voice Input via Microphone)           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
                โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          EARS (Whisper STT)             โ”‚
โ”‚  - Wake word detection                  โ”‚
โ”‚  - Speech-to-text transcription         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
                โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚     BRAIN (Hybrid Intelligence)         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  Cloud Brain (Groq Llama 3.3)  โ”‚   โ”‚
โ”‚  โ”‚  - Conversation                  โ”‚   โ”‚
โ”‚  โ”‚  - Sentiment analysis            โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  Local Body (Ollama Hermes 3)   โ”‚   โ”‚
โ”‚  โ”‚  - Tool execution                โ”‚   โ”‚
โ”‚  โ”‚  - System commands               โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  Eyes (Llama Scout Vision)      โ”‚   โ”‚
โ”‚  โ”‚  - Screen analysis               โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ–ผ                โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    TOOLS     โ”‚  โ”‚  MEMORY SYSTEM  โ”‚
โ”‚  11 Actions  โ”‚  โ”‚  - Short-term   โ”‚
โ”‚              โ”‚  โ”‚  - Long-term    โ”‚
โ”‚              โ”‚  โ”‚  - Knowledge    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         OUTPUT SYSTEMS                  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  Voice (TTS)   โ”‚  โ”‚  GUI Overlay โ”‚  โ”‚
โ”‚  โ”‚  Edge TTS      โ”‚  โ”‚  Tactical HUDโ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ Project Structure

Project-ALFRED/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ core/                  # Core logic modules
โ”‚   โ”œโ”€โ”€ __init__.py           # Package marker
โ”‚   โ”œโ”€โ”€ brain.py              # The Brain (AI Processing)
โ”‚   โ”œโ”€โ”€ ears.py               # The Ears (Whisper + OpenWakeWord)
โ”‚   โ”œโ”€โ”€ eyes.py               # The Eyes (Vision Analysis)
โ”‚   โ”œโ”€โ”€ overlay.py            # The Face (PyQt6 Holographic GUI)
โ”‚   โ”œโ”€โ”€ tools.py              # The Hands (System Automation Tools)
โ”‚   โ”œโ”€โ”€ voice.py              # Voice synthesis
โ”‚   โ”œโ”€โ”€ memory.py             # Memory management
โ”‚   โ”œโ”€โ”€ encryption.py         # Data encryption
โ”‚   โ”œโ”€โ”€ wake_word.py          # Wake word detection
โ”‚   โ”œโ”€โ”€ sounds.py             # Sound effects
โ”‚   โ””โ”€โ”€ app_launcher.py       # Application launcher
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ data/                  # Persistent data and memory
โ”‚   โ”œโ”€โ”€ brain.txt             # Long-term Knowledge Base
โ”‚   โ”œโ”€โ”€ brain.txt.enc         # Encrypted knowledge base
โ”‚   โ””โ”€โ”€ long_term_memory.json # Conversation History (auto-generated)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ tests/                 # Diagnostic scripts
โ”‚   โ”œโ”€โ”€ preflight_check.py    # System verification check
โ”‚   โ”œโ”€โ”€ test_overlay.py       # GUI testing script
โ”‚   โ”œโ”€โ”€ test_encryption.py    # Encryption tests
โ”‚   โ”œโ”€โ”€ test_memory.py        # Memory tests
โ”‚   โ”œโ”€โ”€ test_tools_security.py # Security tests
โ”‚   โ”œโ”€โ”€ test_utils.py         # Utility tests
โ”‚   โ”œโ”€โ”€ test_all_tools.py     # All tools tests
โ”‚   โ””โ”€โ”€ run_all_tests.py      # Master test runner
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ scripts/               # Utility scripts
โ”‚   โ””โ”€โ”€ migrate_brain.py      # Migration utilities
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ assets/                # Images and temp files
โ”‚   โ”œโ”€โ”€ temp_speech.mp3       # (Auto-generated)
โ”‚   โ””โ”€โ”€ temp_command.wav      # (Auto-generated)
โ”‚
โ”œโ”€โ”€ .env                      # API Keys (Hidden in .gitignore)
โ”œโ”€โ”€ .gitignore                # Git ignore settings
โ”œโ”€โ”€ config.py                 # Identity & Settings
โ”œโ”€โ”€ LICENSE                   # MIT License
โ”œโ”€โ”€ main.py                   # The Central Nervous System (Main Loop)
โ”œโ”€โ”€ run_tests.py              # Test runner script
โ”œโ”€โ”€ README.md                 # This file
โ””โ”€โ”€ requirements.txt          # Python Dependencies

๐Ÿ› Troubleshooting

Issue: Microphone not working

  • Check ears.py isn't running separately
  • Verify microphone permissions

Issue: GUI not showing

  • Ensure PyQt6 is installed
  • Run python tests/test_overlay.py to test overlay

Issue: Tools not working

  • Run python tests/preflight_check.py
  • Verify all imports are successful

Issue: API errors

  • Check .env file has valid GROQ_API_KEY
  • Verify Ollama is running: ollama list

Issue: High resource usage

  • Check config.py for performance settings
  • Consider disabling optional features

๐Ÿ›ก๏ธ Privacy & Security

  • API Security: Keys are loaded via .env and never hardcoded.
  • Local Execution: Sensitive system commands (like opening apps) are parsed locally by Ollama, not sent to the cloud.
  • Clipboard Safety: The Ghost Writer tool uses pyperclip for safe text insertion.
  • Encrypted Storage: Sensitive data is encrypted at rest.

๐Ÿค Contributing

ALFRED is designed to be modular.

  1. Fork the repository.
  2. Create a new tool in tools.py.
  3. Register it in main.py.
  4. Submit a Pull Request.

๐Ÿ† Credits

  • LangChain - AI framework
  • Groq - Cloud inference
  • Ollama - Local models
  • Faster-Whisper - Speech recognition
  • Edge TTS - Voice synthesis
  • PyQt6 - GUI framework

๐Ÿ“„ License

Distributed under the MIT License. See LICENSE for more information.


๐Ÿš€ SYSTEM STATUS: ALL SYSTEMS ONLINE

Built with โค๏ธ for the future of AI.

"We fall so that we can learn to pick ourselves up."

About

ALFRED (Adaptive Logical Framework for Responsive Execution & Decisions): A production-ready hybrid AI assistant featuring a holographic GUI, real-time voice interaction, computer vision, and autonomous system control. Powered by Groq, Ollama, and PyQt6.

Resources

Stars

Watchers

Forks