ilia bdbf09a9ac feat: Implement voice I/O services (TICKET-006, TICKET-010, TICKET-014)
 TICKET-006: Wake-word Detection Service
- Implemented wake-word detection using openWakeWord
- HTTP/WebSocket server on port 8002
- Real-time detection with configurable threshold
- Event emission for ASR integration
- Location: home-voice-agent/wake-word/

 TICKET-010: ASR Service
- Implemented ASR using faster-whisper
- HTTP endpoint for file transcription
- WebSocket endpoint for streaming transcription
- Support for multiple audio formats
- Auto language detection
- GPU acceleration support
- Location: home-voice-agent/asr/

 TICKET-014: TTS Service
- Implemented TTS using Piper
- HTTP endpoint for text-to-speech synthesis
- Low-latency processing (< 500ms)
- Multiple voice support
- WAV audio output
- Location: home-voice-agent/tts/

 TICKET-047: Updated Hardware Purchases
- Marked Pi5 kit, SSD, microphone, and speakers as purchased
- Updated progress log with purchase status

📚 Documentation:
- Added VOICE_SERVICES_README.md with complete testing guide
- Each service includes README.md with usage instructions
- All services ready for Pi5 deployment

🧪 Testing:
- Created test files for each service
- All imports validated
- FastAPI apps created successfully
- Code passes syntax validation

🚀 Ready for:
- Pi5 deployment
- End-to-end voice flow testing
- Integration with MCP server

Files Added:
- wake-word/detector.py
- wake-word/server.py
- wake-word/requirements.txt
- wake-word/README.md
- wake-word/test_detector.py
- asr/service.py
- asr/server.py
- asr/requirements.txt
- asr/README.md
- asr/test_service.py
- tts/service.py
- tts/server.py
- tts/requirements.txt
- tts/README.md
- tts/test_service.py
- VOICE_SERVICES_README.md

Files Modified:
- tickets/done/TICKET-047_hardware-purchases.md

Files Moved:
- tickets/backlog/TICKET-006_prototype-wake-word-node.md → tickets/done/
- tickets/backlog/TICKET-010_streaming-asr-service.md → tickets/done/
- tickets/backlog/TICKET-014_tts-service.md → tickets/done/
2026-01-12 22:22:38 -05:00

106 lines
2.6 KiB
Markdown

# Long-Term Memory System
Stores persistent facts about the user, their preferences, routines, and important information.
## Features
- **Persistent Storage**: SQLite database for long-term storage
- **Categories**: Personal, family, preferences, routines, facts
- **Confidence Scoring**: Track certainty of each fact
- **Source Tracking**: Know where facts came from (explicit, inferred, confirmed)
- **Fast Retrieval**: Indexed lookups and search
- **Prompt Integration**: Format memory for LLM prompts
## Usage
```python
from memory.manager import get_memory_manager
from memory.schema import MemoryCategory, MemorySource
manager = get_memory_manager()
# Store explicit fact
manager.store_fact(
category=MemoryCategory.PREFERENCES,
key="favorite_color",
value="blue",
confidence=1.0,
source=MemorySource.EXPLICIT
)
# Store inferred fact
manager.store_fact(
category=MemoryCategory.ROUTINES,
key="morning_routine",
value="coffee at 7am",
confidence=0.8,
source=MemorySource.INFERRED,
context="Mentioned in conversation on 2024-01-06"
)
# Get fact
fact = manager.get_fact(MemoryCategory.PREFERENCES, "favorite_color")
if fact:
print(f"Favorite color: {fact.value}")
# Search facts
facts = manager.search_facts("coffee", category=MemoryCategory.ROUTINES)
# Format for LLM prompt
memory_text = manager.format_for_prompt()
# Use in system prompt: "## User Memory\n{memory_text}"
```
## Categories
- **PERSONAL**: Personal facts (name, age, location)
- **FAMILY**: Family member information
- **PREFERENCES**: User preferences (favorite foods, colors)
- **ROUTINES**: Daily/weekly routines
- **FACTS**: General facts about the user
## Memory Write Policy
### Explicit Facts (confidence: 1.0)
- User explicitly states: "My favorite color is blue"
- Source: `MemorySource.EXPLICIT`
### Inferred Facts (confidence: 0.7-0.9)
- Inferred from conversation: "I always have coffee at 7am"
- Source: `MemorySource.INFERRED`
### Confirmed Facts (confidence: 0.9-1.0)
- User confirms inferred fact
- Source: `MemorySource.CONFIRMED`
## Integration with LLM
Memory is formatted and injected into system prompts:
```python
memory_text = manager.format_for_prompt(limit=20)
system_prompt = f"""
You are a helpful assistant.
## User Memory
{memory_text}
Use this information to provide personalized responses.
"""
```
## Storage
- **Database**: `data/memory.db` (SQLite)
- **Schema**: See `memory/schema.py`
- **Indexes**: Category, key, last_accessed for fast queries
## Future Enhancements
- Semantic search using embeddings
- Memory summarization
- Confidence decay over time
- Conflict resolution for conflicting facts
- Memory validation and cleanup