Luna is a professional AI desktop assistant that runs as a background service, awakens on command (hotword or hotkey), and executes tasks intelligently using Large Action Models (LAM).
- ποΈ Voice & Hotkey Activation - Wake Luna with "Luna" or
Ctrl+Shift+L - π€ LAM Integration - Powered by Claude (Anthropic) or GPT (OpenAI)
- π‘οΈ Security First - Permission system with risk levels and confirmations
- π¨ Beautiful UI - Smooth animations, dark/light themes
- π Extensible Actions - Web search, file operations, emails, system commands
- π Structured Logging - Full audit trail with
structlog - β‘ Low Resource Usage - <5% CPU when idle
- π§ͺ Well Tested - >85% test coverage
# Clone repository
git clone https://github.com/yourusername/Python-Project-Luna.git
cd Python-Project-Luna
# Install
pip install -e .
# Configure
cp .env.example .env
# Edit .env with your Anthropic API key
# Verify setup
luna doctor
# Run Luna
luna runSee QUICKSTART.md for detailed setup instructions.
graph TB
User((User))
Wake[Wake Detection<br/>Hotword/Hotkey]
Daemon[Background<br/>Daemon]
UI[Overlay UI<br/>Qt/PySide6]
LAM[LAM Client<br/>Anthropic/OpenAI]
Registry[Action<br/>Registry]
Actions[Actions<br/>Web/File/Email/OS]
User -->|"Luna" / Hotkey| Wake
Wake --> Daemon
Daemon --> UI
UI -->|User Command| LAM
LAM -->|Tool Calls| Registry
Registry --> Actions
Actions -->|Results| UI
UI --> User
style User fill:#4a9eff
style Wake fill:#f9a825
style LAM fill:#7e57c2
style Actions fill:#66bb6a
src/luna/
βββ app.py # Application orchestration
βββ cli.py # Command-line interface
βββ config.py # Configuration management
βββ logging.py # Structured logging
βββ actions/ # Pluggable actions (15 total)
β βββ registry.py # Action registration & execution
β βββ web_actions.py # Web search, YouTube, Wikipedia
β βββ file_actions.py # File operations
β βββ email_actions.py # Email sending
β βββ os_actions.py # System operations
βββ lam_client/ # LAM integration
β βββ client.py # Provider-agnostic LAM client
β βββ schema.py # Tool/action schemas
β βββ memory.py # Conversation memory
βββ service/ # Background service
β βββ daemon.py # Daemon process
β βββ permissions.py # Security & permissions
βββ ui/ # User interface
β βββ overlay.py # Main overlay window
β βββ theme.py # Theming system
βββ wake/ # Wake detection
βββ hotword.py # Hotword detection
βββ hotkey.py # Hotkey detection
# Run interactively (foreground with UI)
luna run
# Run as background daemon
luna daemon
# Summon overlay (if daemon running)
luna summon
# Test individual actions
luna test-action web_search query="Python tutorial"
luna test-action get_current_time
# List all available actions
luna test-action
# Check system health
luna doctor
# Show configuration
luna config --show| Action | Description | Permission | Risk |
|---|---|---|---|
web_search |
Search Google | Network | Safe |
search_youtube |
Search YouTube | Network | Safe |
play_youtube |
Play video/music | Network | Safe |
wikipedia_summary |
Get Wikipedia info | Network | Safe |
open_url |
Open URL in browser | Browser | Low |
get_current_time |
Get date/time | None | Safe |
text_to_speech |
Speak text aloud | None | Safe |
open_file_explorer |
Open file browser | File Read | Safe |
list_directory |
List directory | File Read | Safe |
read_file |
Read text file | File Read | Safe |
create_file |
Create file | File Write | Medium |
delete_file |
Delete file | File Delete | High |
send_email |
Send email | High | |
execute_command |
Run system command | System | Critical |
get_system_info |
Get system details | None | Safe |
Create .env file from template:
cp .env.example .envKey settings:
# LAM Provider (required for intelligent features)
LUNA_LAM_PROVIDER=anthropic
LUNA_LAM_API_KEY=sk-ant-your-api-key-here
# Wake Detection
LUNA_HOTKEY_COMBINATION=ctrl+shift+l
LUNA_HOTWORD_PHRASE=luna
LUNA_HOTWORD_ENABLED=true
# UI Settings
LUNA_UI_THEME=dark
LUNA_UI_ANIMATION_DURATION=300
# Permissions (adjust security level)
LUNA_ALLOW_FILE_WRITE=false
LUNA_ALLOW_FILE_DELETE=false
LUNA_ALLOW_SYSTEM_COMMANDS=false
LUNA_REQUIRE_CONFIRMATION_HIGH_RISK=true
# Email (optional)
LUNA_EMAIL_USERNAME=your-email@gmail.com
LUNA_EMAIL_PASSWORD=your-app-passwordLuna implements a comprehensive security model:
- Safe - No confirmation (e.g., web search)
- Low - Logged (e.g., open URL)
- Medium - May require confirmation (e.g., create file)
- High - Always confirm (e.g., delete file)
- Critical - Confirm + audit (e.g., system commands)
All actions require explicit permissions configurable in .env:
FILE_READ,FILE_WRITE,FILE_DELETENETWORK_REQUEST,SYSTEM_COMMANDEMAIL_SEND,BROWSER_CONTROL
All high-risk actions logged to ~/.luna/logs/audit.log
# Clone and install with dev dependencies
git clone https://github.com/yourusername/Python-Project-Luna.git
cd Python-Project-Luna
pip install -e ".[dev]"
# Set up pre-commit hooks
pre-commit install
# Run tests
pytest --cov=luna
# Run quality checks
black src/ tests/
ruff check src/ tests/
mypy src/luna --strict# src/luna/actions/my_actions.py
from luna.actions.registry import register_action
from luna.lam_client.schema import ToolParameter, ToolParameterType
from luna.service.permissions import Permission, RiskLevel
@register_action(
name="my_action",
description="Does something useful",
parameters=[
ToolParameter(
name="input",
type=ToolParameterType.STRING,
description="Input parameter",
required=True,
)
],
permission=Permission.NETWORK_REQUEST,
risk_level=RiskLevel.SAFE,
)
def my_action(input: str) -> str:
"""Execute my custom action."""
return f"Result: {input}"Then test it:
luna test-action my_action input="test"See CONTRIBUTING.md for full development guide.
| Metric | Target | Actual |
|---|---|---|
| Idle CPU | <5% | ~2-3% |
| Idle Memory | <100MB | ~80MB |
| Startup Time | <1s | ~800ms |
| Wake Response | <500ms | ~200ms |
| Overlay Render | <200ms | ~150ms |
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Quick checklist:
- Follow PEP 8 style guide
- Add type hints to all functions
- Write tests (maintain >85% coverage)
- Update documentation
- Run pre-commit checks
- QUICKSTART.md - 5-minute setup guide
- CONTRIBUTING.md - Development guide
- MIGRATION.md - Migration from v1.x details
- CHANGELOG.md - Version history
"Module not found" error:
pip install -e ."API key not configured":
# Set in .env file
LUNA_LAM_API_KEY=sk-ant-your-key-hereHotkey not working:
# May need elevated privileges on some systems
# Or use hotword instead by setting in .env:
LUNA_HOTKEY_ENABLED=false
LUNA_HOTWORD_ENABLED=trueCheck logs:
cat ~/.luna/logs/luna.logRun diagnostics:
luna doctor- System tray integration
- Voice responses (TTS for LAM)
- Custom action templates
- Plugin system
- Local LLM support (Ollama)
- Multi-language support
- Calendar integration
- Note-taking features
- Spotlight-style launcher
This project is licensed under the MIT License - see LICENSE for details.
- Anthropic for Claude API
- OpenAI for GPT API
- Qt/PySide6 for cross-platform UI
- Python community for amazing libraries
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with β€οΈ by the Luna Team
β Star us on GitHub if you find Luna useful!