Skip to content

About

A privacy-first, fully local AI voice assistant for Android that connects to your own running services. No cloud dependencies, no telemetry, no data leaves your device

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

88 Commits

Folders and files

Repository files navigation

Local Assistant - On-Device AI Voice Assistant

A privacy-first, fully local AI voice assistant for Android that connects to your own running services. No cloud dependencies, no telemetry, no data leaves your device.

Features

Core Capabilities

  • On-Device Wake Word Detection - Matches your own recorded phrases against the microphone clip on-device (no built-in phrase, no cloud, no external runtime); detection never fires on silence or room noise
  • Voice Pipeline - Complete voice interaction: STT β†’ LLM β†’ TTS
  • Continuous Conversation - One wake word opens a conversation: after every reply the mic re-arms, so you keep talking to the assistant until there is real silence
  • Hands-Free Overlay Outside The App - The exchange is drawn over the home screen or whatever the device is showing, through a voice interaction session service - it stays visible while the app is minimized
  • Chat History - Timestamped conversation on the chat screen, with pinning and summarization

Privacy & Security

  • 100% local processing - all AI runs on your own hardware
  • No cloud services, no analytics, no telemetry
  • All data stays on your device
  • OpenAI-compatible endpoints for maximum flexibility

User Interface

  • Clean Material 3 design with the Gruvbox palette
  • A compact card that rises from the bottom edge, with the reply streaming into its bubble
  • A status dot and label that name the current phase (Ready / Listening… / Thinking… / Answering… / Speaking…)
  • Comprehensive settings for every configuration

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   UI Layer (Compose)                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ ChatScreenβ”‚ β”‚Settings β”‚  β”‚ VoiceControlsBar β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                ViewModel Layer                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
β”‚  β”‚ ChatViewModelβ”‚  β”‚SettingsViewModel β”‚            β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                 Service Layer                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ VoiceAssistantService (in-app pipeline)      β”‚  β”‚
β”‚  β”‚  audio capture β†’ VAD β†’ STT β†’ LLM β†’ TTS       β”‚  β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
β”‚  β”‚ WakeChatService (hands-free, a               β”‚  β”‚
β”‚  β”‚   VoiceInteractionService)                   β”‚  β”‚
β”‚  β”‚  wake match β†’ record β†’ STT β†’ LLM β†’ TTS       β”‚  β”‚
β”‚  β”‚        ↓ showSession()          ↑ re-arm mic β”‚  β”‚
β”‚  β”‚ WakeChatSessionService (draws the card)      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                  Data Layer                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
β”‚  β”‚ Room DB      β”‚  β”‚ SharedPreferencesβ”‚            β”‚
β”‚  β”‚ (Chat History)β”‚ β”‚ (Settings)       β”‚            β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚           External Services (Local)                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚ LLM      β”‚  β”‚ STT      β”‚  β”‚ TTS      β”‚          β”‚
β”‚  β”‚ (OpenAI- β”‚  β”‚ (OpenAI  β”‚  β”‚ (OpenAI  β”‚          β”‚
β”‚  β”‚  compat) β”‚  β”‚  audio)  β”‚  β”‚  audio)  β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Prerequisites

Android Device

  • Android 12 (API 35) or higher - minSdk and targetSdk are both 35
  • Microphone access
  • Network access to your local AI services
  • To use the hands-free overlay, the platform must host hands-free conversations: open the system's "Default digital assistant" page and select LocalAssistant. Without that selection the app still runs its own pipeline, but the system refuses to draw the card outside the app.

Local AI Services

You need to run these services on your local network. Any OpenAI-compatible server works; the app is tested against the ones named below.

1. LLM Service (OpenAI-compatible /v1/chat/completions)

Tested against llama.cpp server; Ollama and vLLM also work.

# llama.cpp
llama-server -m /models/Qwen3.5-4B-Q4_K_M.gguf --port 8086
# or Ollama
ollama pull llama3.1:8b && ollama serve

Reasoning models stream their chain of thought before the answer, so keep max_tokens generous (256 or more) or the response comes back with empty content.

2. STT Service (OpenAI-compatible /v1/audio/transcriptions)

Tested against whisper.cpp server; faster-whisper works too.

# whisper.cpp
./whisper-server -m ggml-medium.bin -t 8 --port 8088

3. TTS Service (OpenAI-compatible /v1/audio/speech)

Tested against a qwentts.cpp server; Piper and Coqui TTS work behind an OpenAI-compatible shim.

# Always send response_format - it names the container the client receives
curl -X POST http://192.168.1.100:8087/v1/audio/speech \
  -H 'Content-Type: application/json' \
  -d '{"model":"<model>","input":"Hello","response_format":"wav"}'

Never hardcode a voice name: read GET /v1/audio/voices and use what it advertises. A server that answers {"voices":[]} rejects every voice field, so omit it there.

Setup Instructions

1. Clone and Build

cd /path/to/LocalAssistant
./gradlew assembleDebug

2. Install on Device

adb install -r app/build/outputs/apk/debug/app-debug.apk

3. Configure Endpoints

Open the app β†’ Settings:

  • LLM Base URL: e.g. http://192.168.1.100:8086
  • STT Base URL: e.g. http://192.168.1.100:8088
  • TTS Base URL: e.g. http://192.168.1.100:8087

Base URLs may be given with or without the trailing route - the client strips a known suffix and appends the correct one.

4. Grant Permissions

The app will request:

  • Microphone access (for voice input)
  • The persistent notification required for always-listening mode
  • Battery optimization exemption (recommended for continuous operation)

Usage

Waking the Assistant

  1. Open the app β†’ Settings β†’ Wake Word and record one or more references of the phrase you want to say ("Record Reference"). Detection only matches those recordings; with none enrolled the wake service reports that and never fires.
  2. Start listening (mic button, or the home-screen widget). The service keeps running while the app is minimized.
  3. Say the phrase you enrolled. The card rises from the bottom edge and the chime confirms it heard you - the card is raised first, so it is already up when the chime sounds.
  4. Speak your request. The transcript appears in the user bubble, the reply streams into the answer bubble as it arrives, and TTS reads it aloud.
  5. Keep talking. After the reply the mic re-arms and the card still shows the previous turn, so you can ask a follow-up without saying the wake word again. The card closes once real silence reaches the configured timeout - listening, thinking and speaking never count down against it.

Settings

Configure all aspects of the assistant:

  • API endpoints, model names and voices
  • Wake word references (recorded on-device) and match sensitivity
  • Voice activity detection (minimum silence, energy floor)
  • System prompt for custom behavior
  • Wake chat windows: the first-turn request window and the close timeout
  • Generation controls: max_tokens, reasoning budget and chat_template_kwargs

Debugging From adb

Trigger an exchange without going through the menus or saying the phrase:

adb shell "am start -W -a com.localassistant.TRIGGER_WAKE_CHAT com.localassistant.app/.ui.MainActivity"

The service logs its own phase, so adb logcat filtered on the class name is the running trace:

adb logcat | grep WakeChat

Reading The Wake Path

The whole detection pipeline - microphone capture, the cut to the utterance, MFCC features, the band-limited DTW match against your own recorded references, the threshold and the idle listening loop - is documented in docs/wake-word-pipeline.md. It names every constant and why it has that value, the log tags to filter on, and what a healthy enrollment looks like when a wake word refuses to fire.

Project Structure

app/
β”œβ”€β”€ src/main/java/com/localassistant/app/
β”‚   β”œβ”€β”€ LocalAssistantApplication.kt    # Application class
β”‚   β”œβ”€β”€ domain/
β”‚   β”‚   └── model/                      # Data models
β”‚   β”‚       β”œβ”€β”€ ChatMessage.kt          # Message entity
β”‚   β”‚       └── AppSettings.kt          # Settings data class
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”œβ”€β”€ local/                      # Room database
β”‚   β”‚   β”‚   β”œβ”€β”€ LocalAssistantDatabase.kt
β”‚   β”‚   β”‚   └── ChatMessageDao.kt
β”‚   β”‚   β”œβ”€β”€ remote/                     # API clients
β”‚   β”‚   β”‚   └── ApiClient.kt            # HTTP client for LLM/STT/TTS
β”‚   β”‚   └── settings/                   # Settings repository
β”‚   β”‚       └── SettingsRepository.kt
β”‚   β”œβ”€β”€ service/                        # Foreground services
β”‚   β”‚   β”œβ”€β”€ VoiceAssistantService.kt    # Main in-app voice pipeline
β”‚   β”‚   β”œβ”€β”€ WakeChatService.kt          # Hands-free wake-word pipeline (a VoiceInteractionService)
β”‚   β”‚   β”œβ”€β”€ WakeChatSessionService.kt   # Draws the exchange over the system UI (a VoiceInteractionSessionService)
β”‚   β”‚   └── WakeChatRecognitionService.kt # Hollow RecognitionService stub required by the manifest resource
β”‚   β”œβ”€β”€ ui/                             # Compose UI
β”‚   β”‚   β”œβ”€β”€ MainActivity.kt             # Entry point & navigation graph
β”‚   β”‚   β”œβ”€β”€ chat/                       # Chat screen components
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatScreen.kt           # Main chat interface & VoiceControlsBar
β”‚   β”‚   β”‚   └── ChatViewModel.kt        # Chat state management
β”‚   β”‚   β”œβ”€β”€ wake/                       # Wake service plumbing (renderer only)
β”‚   β”‚   β”‚   └── WakeChatViewModel.kt    # Forwards the service's state & start/stop intents
β”‚   β”‚   β”œβ”€β”€ settings/                   # Settings screen components
β”‚   β”‚   β”‚   β”œβ”€β”€ SettingsScreen.kt       # Configuration UI
β”‚   β”‚   β”‚   └── SettingsViewModel.kt    # Settings state management
β”‚   β”‚   β”œβ”€β”€ common/                     # Audio helpers, VAD, wake-word matcher
β”‚   β”‚   β”‚   β”œβ”€β”€ CommonUtilities.kt
β”‚   β”‚   β”‚   β”œβ”€β”€ WakeWordDetector.kt
β”‚   β”‚   β”‚   └── DefaultAssistant.kt     # Assistant-role oracle & picker intents
β”‚   β”‚   └── theme/                      # Gruvbox Material3 colour schemes
β”‚   β”‚       └── Theme.kt
β”‚   β”œβ”€β”€ receiver/                       # Broadcast receivers
β”‚   β”‚   β”œβ”€β”€ AppBootReceiver.kt          # Boot completed handler
β”‚   β”‚   └── NetworkStateReceiver.kt     # Network connectivity monitor
β”‚   └── widget/                         # Home-screen widget
β”‚       └── VoiceAssistantWidget.kt
β”œβ”€β”€ src/main/res/
β”‚   β”œβ”€β”€ values/                         # Light string resources & themes
β”‚   β”‚   β”œβ”€β”€ strings.xml                 # All string resources
β”‚   β”‚   β”œβ”€β”€ colors.xml                  # Light palette (mirrors Theme.kt)
β”‚   β”‚   └── themes.xml                  # App theme configuration
β”‚   β”œβ”€β”€ values-night/                   # Dark variants of the same tokens
β”‚   β”‚   β”œβ”€β”€ colors.xml
β”‚   β”‚   └── themes.xml
β”‚   └── xml/
β”‚       β”œβ”€β”€ network_security_config.xml # Cleartext HTTP to local endpoints
β”‚       β”œβ”€β”€ voice_interaction.xml       # Names the voice service and its session half
β”‚       β”œβ”€β”€ widget_voice_assistant.xml  # Widget descriptor
β”‚       β”œβ”€β”€ backup_rules.xml
β”‚       └── data_extraction_rules.xml
β”œβ”€β”€ src/main/assets/
β”‚   └── voice_clone.wav                 # Bundled sample used by the TTS/STT tests
β”œβ”€β”€ build.gradle.kts                    # Module-level Gradle config
└── AndroidManifest.xml                 # App manifest with permissions

Troubleshooting

Service Not Starting

  • Check that all local services are running and accessible
  • Verify network connectivity between device and services
  • Ensure battery optimization is disabled for the app

The Card Only Renders Inside the App

The session window is drawn by the platform, so the app has to hold the assistant role. Open the system's "Default digital assistant" page and select LocalAssistant, then start the service again - adb install force-stops the running process. The service logs onReady: the system has bound this app as its voice interaction service once the platform has really bound it; if that line never appears, the selection is the problem, not the code.

Audio Issues

  • Grant microphone permission in Settings β†’ Permissions
  • Check that audio format matches your STT service requirements (16 kHz, mono, 16-bit PCM)
  • TTS sample rates are tried in a fallback loop - device support varies widely

Network Errors

  • Verify base URLs are correct and accessible from the device
  • Check network security config allows cleartext HTTP to local IPs
  • Ensure firewall rules allow incoming connections on service ports

Wake Word Never Fires

  • Enroll at least one reference first - the matcher has no built-in phrase
  • Use the Settings "Test Wake Word" action, which prints the measured DTW cost against the current threshold, then tune the sensitivity slider

Future Enhancements

  • Replace the built-in energy VAD with a model-based detector (silero-vad)
  • Add barge-in support: interrupt the assistant while it is speaking
  • Play TTS audio through Media3 ExoPlayer instead of AudioTrack
  • Add Hilt dependency injection for better testability
  • Implement encrypted storage for API keys
  • Support multiple wake phrases bound to different actions

License

MIT License - See LICENSE file for details

Acknowledgments

About

A privacy-first, fully local AI voice assistant for Android that connects to your own running services. No cloud dependencies, no telemetry, no data leaves your device

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages