VoiceCLI is a command-line tool that listens to your voice, transcribes it, uses a local Ollama LLM to convert the transcription into a safe shell command, and then executes it after confirmation.
- Records 5 seconds of audio.
- Transcribes it using whisper.cpp.
- Sends the transcription to a local Ollama model (like
llama3). - Returns a shell command (or
# unknown). - Asks for your confirmation.
- Executes the command.
- Go 1.20+
sox(macOS) orarecord(Linux)whisper.cppbuilt asmain- Whisper model (e.g.
ggml-base.en.bin) inmodels/ - Ollama running locally with a pulled model:
ollama pull llama3
go run ./cmd/voiceclivoicecli/
├── cmd/voicecli.go # CLI entry point
├── internal/
│ ├── audio/ # Records audio from mic
│ │ └── recorder.go
│ ├── whisper/ # Transcribes speech
│ │ └── transcriber.go
│ ├── ollama/ # Sends prompt to local Ollama LLM
│ │ └── client.go
│ └── shell/ # Confirms and executes commands
│ └── executor.go
- Uses a strict system prompt with Ollama to only return simple bash commands.
- Asks for user confirmation before running anything.
🎤 VoiceCLI is listening... (press Ctrl+C to exit)
🗣️ You said: list my files
💻 Generated command: ls -la
⚠️ Do you want to execute this command? [y/N]: y
✅ Done.
- Continuous listening mode
- Better error recovery and retries
- Add Windows audio support (e.g., WASAPI)
- Customizable system prompt
Made with ❤️ using Go, Whisper, and Ollama.