CLAUDE.md
Guides Claude Code on an offline voice assistant project for Raspberry Pi using Python orchestration with native STT/LLM/TTS binaries.
What this file does
Guides Claude Code on an offline voice assistant project for Raspberry Pi using Python orchestration with native STT/LLM/TTS binaries.
When to use it
- Setting up Claude Code for a new offline voice assistant project
- Defining contracts between Python orchestration and CLI inference engines
- Documenting environment variable overrides for binary and model paths
- Establishing platform-specific input handling for Windows vs Linux/Pi
Assumes this stack
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Offline voice field assistant for Raspberry Pi 5 (16GB RAM). Core loop: push-to-talk → WAV → STT → LLM → TTS → playback. Currently testing on Windows 11 before Pi deployment.
Architecture
Python orchestrates three CLI-based inference engines via subprocess:
- STT:
whisper.cpp(base.en model) →bin/whisper/Release/whisper-cli.exe - LLM:
llama.cpp(2B-3B GGUF Q4_K_M) →bin/llama/llama-cli.exe - TTS:
piper→bin/piper/piper/piper.exe
Python handles coordination only; all heavy compute runs in native binaries.
Key Files
app/main.py- Orchestrator with push-to-talk loop (SPACE key)app/config.py- All paths, settings, env var overridesapp/state.py- ConversationState class manages history + context
Backend Wrapper Contracts
Each wrapper returns a Result dataclass with success: bool, time_ms: float, and component-specific outputs:
# stt/whispercpp.py
STTResult(success, transcript, time_ms)
# llm/llamacpp.py
LLMResult(success, response, time_ms, tokens_per_sec)
# tts/piper.py
TTSResult(success, output_path, time_ms)
Development Commands
# Run the voice assistant
python app/main.py
# List audio devices
python app/main.py --list-devices
# Enable debug logging
python app/main.py --debug
# Debug: test imports and keyboard detection
python debug_imports.py
# Debug: step-by-step component testing
python debug_pipeline.py
Environment Overrides
All paths in config.py can be overridden via environment variables:
WHISPER_CPP_PATH,LLAMA_CPP_PATH,PIPER_PATH- binary pathsWHISPER_MODEL,LLM_MODEL,PIPER_MODEL,PIPER_CONFIG- model pathsLOG_LEVEL- logging verbosity (DEBUG/INFO/WARN/ERROR)
Key Constraints
- Fully offline - no network dependencies at runtime
- No ML frameworks - subprocess to CLI tools only
- Audio format: mono, 16 kHz, 16-bit PCM WAV
- LLM defaults: temp=0.3, max_tokens=180, context=2048, threads=4
- Model paths:
/mnt/nvme/models/with fallback to./models/
Platform Notes
- Windows: Uses
keyboardlibrary for key detection - Linux/Pi: Uses
pynput(or GPIO button on Pi) - Pi deployment: NVMe SSD preferred, 5V/5A power required
What's inside
8 sections: overview, architecture, key files, wrapper contracts, dev commands, env overrides, constraints, platform notes
Change this for your project
- Replace
finnfujimura/OICwith your own repository name - Replace paths like
bin/whisper/Release/whisper-cli.exewith your binary locations - Replace model paths
/mnt/nvme/models/and./models/with your model directory - Replace
app/main.pyandapp/config.pywith your own module names
Where it goes
Save as CLAUDE.md in your repository root. Claude Code reads it automatically at the start of every session.
Related Documents
Code indexing for AI agents: summarization strategies and evaluation systems
Synthesises 2024-2025 research on code indexing for AI agents, covering summarisation strategies, hybrid retrieval architectures, and evaluation benchmarks.
write-script
Guides an AI through writing a YouTube video script with strict structural, language, and quiz rules for a survival channel.
Claude AI Git Workflow Integration
Recommends using the git-ai-commit CLI tool for AI-generated commit messages instead of manual ones.
Missing Business Agents Research — FLUXION 2026
Identifies 12 missing business operations agents for an indie software company and ranks them by impact and effort with €0 implementation plans.