This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CRITICAL: Always use specialized agents to handle requests for professional results:
python-pro agent for Python implementation taskspytorch-model-architect agent for ML model developmentpytorch-audio-vision-expert agent for audio processing and trainingmultimedia-preprocessing-expert agent for audio data preprocessingarchitect-reviewer agent after making architectural changescode-reviewer agent after writing significant codeTrixy is a professional voice assistant system built with Python and PyTorch. It implements a server/client/standalone architecture with custom wakeword detection, voice recognition, and a comprehensive plugin system.
./trixy_core/events/)CENTRAL COMPONENT - Everything operates through events:
@TrixyEvent(["event_name", "other_event"])
def event_handler_method(self, event_name, event_data):
# React to events
pass
./trixy_core/network/)./trixy_core/satellites/)satellite_manager[0] or satellite_manager["status=connected,room=kitchen"]say(), disconnect(), reconnect(), finder methods./trixy_core/plugins/)./plugins/*/main.py + config.jsonTrixyPlugin./trixy_core/config/)./trixy_core/assets/)./assets/{profile}/path → ./assets/default/path./trixy_core/scheduler/)./trixy_core/conversation/)./trixy_core/arbitration/)"satellite_connected" - When satellite establishes connection"satellite_disconnected" - When satellite loses connection"satellite_registered" - When new satellite is registered"wakeword_received" - When satellite detects wakeword
"raw_audio_input_received" - When audio recording completes
"text_received" - When STT converts audio to text
"intent_received" - When NLP extracts intent from text
"tts_received" - When TTS generates response audio
"system_startup" - System initialization complete"system_shutdown" - System shutting down"plugin_loaded" - Plugin successfully loaded"plugin_unloaded" - Plugin unloaded"training_started" - ML training begins"training_completed" - ML training finishes"schedule_triggered" - Scheduled event fires[4 bytes] Magic Number: "TRXI"
[4 bytes] Version Major (int)
[4 bytes] Version Minor (int)
[4 bytes] Version Revision (int)
[8 bytes] DateTime (binary)
[4 bytes] Options (32-bit flags)
[16 bytes] MD5 Checksum
[4 bytes] Class Name Length
[variable] Class Name
[4 bytes] Serialized Data Length
[variable] Serialized Class Instance
All start with "TRXI":
TRXINOOP - No-op/heartbeatTRXIPING - Ping commandTRXIPONG - Pong responseTRXIPRNT <string> - Print string (testing)TRXYHELO - Hello (debugging)All serializable command classes stored in: ./trixy_core/network/cmd/*.py
./ # Application root
├── main.py # Entry point: python3 main.py [server|client|standalone]
├── trixy_core/ # Core system modules
│ ├── events/ # Event handler system
│ ├── network/ # Network & protocol implementation
│ │ └── cmd/ # Command classes for serialization
│ ├── satellites/ # Satellite management
│ ├── plugins/ # Plugin system
│ ├── config/ # Configuration management
│ ├── assets/ # Asset management
│ ├── scheduler/ # Schedule manager
│ ├── conversation/ # Conversation management
│ ├── arbitration/ # Multi-satellite arbitration
│ └── [additional components]
├── plugins/ # Plugin directory
│ └── {plugin_name}/ # Individual plugin folders
│ ├── main.py # Plugin class (extends TrixyPlugin)
│ ├── config.json # Plugin configuration
│ └── config_view.py # Optional: custom TUI config
├── models/ # ML model storage
│ ├── wakeword/ # Wakeword model subdirectories
│ └── voice_recognition/ # Voice recognition model subdirectories
├── config/ # Configuration files
│ ├── server_config.json
│ ├── client_config.json
│ └── standalone_config.json
├── assets/ # Profile-based assets
│ ├── default/ # Default asset profile
│ └── {profile_id}/ # Custom profiles
└── trainer/ # ML training system
├── data/ # Training data
│ ├── wakeword/
│ │ └── raw/ # Raw audio files
│ └── voice_recognition/
│ └── raw/ # Speaker audio files
├── wakeword/ # Wakeword trainer
└── voice_recognition/ # Voice recognition trainer
# Server mode
python3 main.py server [--debug] [--config custom_config.json]
# Client/Satellite mode
python3 main.py client [--debug] [--config custom_config.json]
# Standalone mode
python3 main.py standalone [--debug] [--config custom_config.json]
--debug flag enables development modepprint(str) function that adapts based on mode.pth, .pt, .onnx (all supported).pth files: metafile.json in ZIP archive.pt files: torch.package metadata.onnx files: metadata_props"satellite_connected" or connection deniedWakeword Detection (satellite):
Server Processing:
Audio Recording (selected satellite):
Server Event Chain:
"raw_audio_input_received""text_received""intent_received""tts_received"Multi-turn Conversations:
Detailed views for satellites, plugins, schedules, ML trainers with F1-F5 sub-tabs each.
# ./plugins/my_plugin/main.py
class MyPlugin(TrixyPlugin):
# Auto-loaded properties:
# - self.application (application container)
# - self.config (loaded config.json)
# - self.enabled (getter/setter)
@TrixyEvent(["wakeword_received", "text_received"])
def handle_events(self, event_name, event_data):
# React to events
pass
def is_enabled(self):
return self.enabled
def reload_config(self):
# Reload config.json
pass
def save_config(self):
# Save config.json
pass
config.json: Auto-loaded into self.configconfig_view.py: Optional custom TUI configuration# Direct index access
satellite = satellite_manager[0]
# Query-based access (case insensitive)
satellites = satellite_manager["status=connected,room=kitchen"]
# Bulk operations on matching satellites
satellite_manager.disconnect_all("room=living_room")
# Asset resolution with fallback
asset_path = asset_manager.get_path("audio/success.wav")
# Tries: ./assets/{profile}/audio/success.wav
# Fallback: ./assets/default/audio/success.wav
# Returns: False if not found
# Access through application container
event_handler = application.get_event_handler()
plugin_system = application.get_plugin_system()
satellite_manager = application.get_satellite_manager()
⚠️ Project Phase: Planning/Design Complete - Implementation Required
Existing:
Required Implementation:
Next Steps: