Skip to content

saxill/mareen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Mareen - Voice Assistant ๐ŸŽ™๏ธ

Python License Platform Status

A privacy-focused voice assistant with immersive 3D orb UI, powered by local AI

Overview

Mareen is a calm, immersive, voice-first AI assistant featuring a glowing particle sphere interface. Experience the future of private, offline AI interaction with beautiful visualizations and natural voice conversations.

Powered by:

  • ๐Ÿง  Ollama - Local LLM processing (model j)
  • ๐ŸŽค Vosk - Offline speech recognition
  • ๐Ÿ”Š EdgeTTS / pyttsx3 - Natural text-to-speech
  • ๐ŸŽจ pywebview - Stunning 3D Voice Orb UI

โœจ Features

  • ๐ŸŽ™๏ธ Voice Interaction - Natural speech recognition with real-time transcription streaming
  • ๐ŸŒ Offline First - Complete privacy with local LLM processing (no data leaves your machine)
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Hindi Support - Native Hindi language understanding and responses
  • ๐Ÿ”ฎ 3D Orb UI - Immersive particle sphere visualization with dynamic color states
  • ๐ŸŽฏ System Control - Open applications, find files, and execute commands
  • ๐Ÿง  Smart Intent - Understands natural language commands and context
  • ๐Ÿ”Š Text-to-Speech - Natural voice responses with emotion
  • โšก Lightweight - Runs efficiently on local hardware
  • ๐Ÿ”’ Privacy Focused - No cloud dependencies, no telemetry
  • ๐Ÿ’พ Conversation Memory - Persistent logging of all sessions and conversations
  • ๐Ÿ›ก๏ธ Soul Protection - Immutable personality protected from prompt injection attacks
  • ๐Ÿง  RAG System - Retrieval-Augmented Generation for context-aware responses

Architecture

Microphone โ†’ Vosk STT โ†’ Intent Parser โ†’ Ollama LLM โ†’ Edge TTS โ†’ Speaker
                              โ†“
                      System Commands
                      File Operations

Screenshots

๐Ÿ”ฎ Main Interface - Glowing Orb States

Coming soon: Screenshots of idle, listening, and speaking states

Prerequisites

  1. Python 3.10+ - Ensure you have a compatible Python version installed
  2. Ollama - Download and install from ollama.com
    • Pull a model: ollama pull llama2 or create your custom model j
    • Verify installation: ollama list
  3. Microphone - Set as default recording device in system settings
  4. Git - For cloning the repository (optional)

Installation

1๏ธโƒฃ Clone the Repository

git clone https://github.com/saxil/mareen.git
cd mareen

2๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

Note: If you encounter errors with PyAudio:

  • Windows: Download pre-built wheel from unofficial binaries
  • Linux: sudo apt-get install portaudio19-dev python3-pyaudio
  • macOS: brew install portaudio && pip install pyaudio

3๏ธโƒฃ Setup Vosk Model (Optional but Recommended)

For better offline speech recognition:

python scripts/setup_model.py

This downloads the Vosk model for English and Hindi support.

4๏ธโƒฃ Configure Ollama

Ensure your LLM model is ready:

ollama pull llama2
# Or use your custom model 'j'

Usage

Starting Mareen

python src/main.py

Voice Commands

Once the orb appears and turns yellow (listening), try:

  • ๐Ÿ’ฌ General conversation: "Hello", "Tell me a joke", "What's the weather?"
  • ๐Ÿš€ System commands:
    • "Open calculator"
    • "Open notepad"
    • "Open Chrome"
    • "Find files named report"
  • ๐Ÿ›‘ Exit: "Stop", "Exit", "Goodbye"

UI States

  • ๐ŸŸก Amber - Idle / Ready
  • ๐ŸŸข Yellow - Listening
  • ๐Ÿ”ต Blue - Speaking / Responding
  • ๐ŸŸฃ Purple - Processing / Thinking

๐Ÿ’พ Memory System

Mareen now includes a comprehensive memory system that logs every conversation and session to a local SQLite database.

Features

  • ๐Ÿ“ Automatic Logging - Every message (user and assistant) is saved automatically
  • ๐Ÿ•’ Session Tracking - Each conversation session is tracked with timestamps
  • ๐Ÿ” Search Capability - Search through all past conversations
  • ๐Ÿ“Š Statistics - View usage statistics and patterns
  • ๐Ÿ“ค Export - Export sessions to JSON format for backup or analysis โ”œโ”€โ”€ intent.py # Command parser โ”‚ โ”‚ โ””โ”€โ”€ memory.py # Conversation memory system โ”‚ โ”œโ”€โ”€ modules/ โ”‚ โ”‚ โ”œโ”€โ”€ system.py # System commands โ”‚ โ”‚ โ””โ”€โ”€ files.py # File operations โ”‚ โ””โ”€โ”€ ui/ โ”‚ โ”œโ”€โ”€ index.html # 3D Orb interface โ”‚ โ””โ”€โ”€ gui.py # GUI components โ”œโ”€โ”€ models/ # Vosk models directory โ”œโ”€โ”€ scripts/ โ”‚ โ””โ”€โ”€ setup_model.py # Model downloader โ”œโ”€โ”€ view_memory.py # Memory viewer utility โ”œโ”€โ”€ memory.db # Conversation database (auto-created) python view_memory.py stats

List all sessions

python view_memory.py sessions

View specific session

python view_memory.py view <session_id>

Search conversations

python view_memory.py search "hello"

Export session to JSON

python view_memory.py export <session_id> output.json


### Memory Database Location
All conversations are stored in `memory.db` in the project root directory. This file is created automatically on first run.

### Privacy Note
Your conversation history is stored **locally only** on your machine. No data is sent to external servers. You can delete `memory.db` at any time to clear your history.

## ๐Ÿ›ก๏ธ Soul Protection System

Mareen's personality is protected by a **Soul System** that prevents prompt injection attacks and personality manipulation.

### What is the Soul?
The soul ([soul.md](soul.md)) is Mareen's core identity file that defines:
- Personality traits and behavior
- Language preferences (Hindi)
- Response guidelines
- Protected instructions that cannot be overridden

### Injection Protection
Mareen automatically detects and blocks attempts to:
- Override system instructions
- Change personality or identity
- Ignore core directives
- Pretend to be other AI assistants
- Execute harmful commands through manipulation

### Testing Protection
```bash
# Test the soul protection system
python test_soul.py

How It Works

  1. Soul Loading: System prompt loaded from soul.md (immutable)
  2. Input Scanning: Every user input checked for 34+ injection patterns
  3. Automatic Blocking: Injection attempts rejected with polite Hindi responses
  4. Memory Logging: All injection attempts logged for security review

Why This Matters

Prevents users from:

  • "Jailbreaking" the assistant
  • Making Mareen act inappropriately
  • Bypassing safety guidelines
  • Compromising the user experience for others

๐Ÿง  RAG System (Retrieval-Augmented Generation)

Mareen uses RAG to remember past conversations and provide contextual responses based on your history.

What is RAG?

RAG combines your conversation memory with AI responses:

  1. When you ask a question, Mareen searches past conversations
  2. Relevant context is retrieved and added to the prompt
  3. The LLM generates a response aware of your history
  4. You get personalized, context-aware answers

Features

  • ๐Ÿ” Semantic Search - Finds relevant past conversations (not just keywords)
  • โฐ Time Decay - Recent conversations weighted higher
  • ๐ŸŽฏ Smart Context - Top 3 most relevant memories included
  • ๐Ÿ’พ Embedding Cache - Fast retrieval with cached vectors
  • ๐Ÿ”„ Fallback Mode - Works with keyword matching if embeddings unavailable

How It Works

User: "How do I learn Python?"
  โ†“
RAG searches memory for similar past conversations
  โ†“
Finds: "Can you help me with programming?"
  โ†“
Adds context to LLM prompt
  โ†“
Mareen: "เคœเฅˆเคธเคพ เค•เคฟ เคฎเฅˆเค‚เคจเฅ‡ เคชเคนเคฒเฅ‡ เคฌเคคเคพเคฏเคพ เคฅเคพ programming เค•เฅ‡ เคฒเคฟเค..."

Testing RAG

python test_rag.py

Optional: Semantic Embeddings

For better context matching, install sentence-transformers:

pip install sentence-transformers

Without it, RAG uses keyword matching (still effective but less nuanced).

Project Structure

mareen/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main.py              # Application entry point
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ llm.py          # Ollama LLM integration
โ”‚   โ”‚   โ”œโ”€โ”€ stt.py          # Speech-to-text (Vosk)
โ”‚   โ”‚   โ”œโ”€โ”€ tts.py          # Text-to-speech
โ”‚   โ”‚   โ”œโ”€โ”€ intent.py       # Command parser
โ”‚   โ”‚   โ”œโ”€โ”€ memory.py       # Conversation memory system
   โ”‚   โ”œโ”€โ”€ soul.py         # Soul protection system
   โ”‚   โ””โ”€โ”€ rag.py          # RAG retrieval system
โ”‚   โ”œโ”€โ”€ modules/
โ”‚   โ”‚   โ”œโ”€โ”€ system.py       # System commands
โ”‚   โ”‚   โ””โ”€โ”€ files.py        # File operations
โ”‚   โ””โ”€โ”€ ui/
โ”‚       โ”œโ”€โ”€ index.html      # 3D Orb interface
โ”‚       โ””โ”€โ”€ gui.py          # GUI components
โ”œโ”€โ”€ models/                  # Vosk models directory
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ setup_model.py      # Model downloader
โ”œโ”€โ”€ soul.md                 # Protected personality definition
โ”œโ”€โ”€ view_memory.py          # Memory viewer utility
โ”œโ”€โ”€ test_soul.py            # Soul protection tests
โ”œโ”€โ”€ test_rag.py             # RAG system tests
โ”œโ”€โ”€ memory.db               # Conversation database (auto-created)
โ”œโ”€โ”€ embeddings_cache.pkl    # RAG embeddings cache (auto-created)
โ””โ”€โ”€ requirements.txt        # Python dependencies

Configuration

Customizing Personality

Edit soul.md to customize:

  • AI personality and language
  • Response style and tone
  • System prompts
  • Behavioral guidelines

Note: After editing soul.md, restart the application or use the reload feature.

Developer Options

Edit src/core/llm.py for:

  • Model selection (default: 'j2')
  • Advanced LLM parameters

Troubleshooting

Issue: Microphone not detected

  • Solution: Check system audio settings and set default input device

Issue: Ollama connection failed

  • Solution: Ensure Ollama is running: ollama serve

Issue: Poor speech recognition

  • Solution: Use Vosk models for better offline accuracy

Issue: Application won't start

  • Solution: Check Python version (3.10+) and reinstall dependencies

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Roadmap

  • Context-aware conversations with memory
  • Soul protection against prompt injection
  • RAG system for contextual responses
  • Wake word detection ("Hey Mareen")
  • Multi-language support (Spanish, French, etc.)
  • Plugin system for custom commands
  • Mobile companion app
  • Voice cloning for personalized TTS
  • Integration with smart home devices
  • Memory-based context retention across sessions
  • Advanced injection detection with ML

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Ollama - For making local LLMs accessible
  • Vosk - For offline speech recognition
  • pywebview - For the beautiful UI framework
  • Edge TTS - For natural voice synthesis

Support

โญ Star this repository if you find it helpful!

For issues and questions, please open an issue.


Made with โค๏ธ for privacy-conscious AI enthusiasts

About

Mareen - A privacy-focused voice assistant with 3D orb UI, powered by Ollama LLM, featuring offline speech recognition and Hindi language support

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors