# Command System Audit - 2026-05-01

**Agent:** Orion Vale (Lead Architect)  
**Date:** 2026-05-01T17:32:43Z  
**Scope:** AI-to-app command system architectural audit

## Key Findings

- **Command Documentation Gap**: Commands documented only in loop context (LoopController.cs:160-198), not globally discoverable
- **Parser Fragility**: ExtractSquadashPayload (PushNotificationService.cs) uses regex pattern matching instead of structured JSON parsing
- **No Registry**: Command system lacks centralized registry or metadata store for command definitions, scopes, and parameters
- **Single Command Limit**: Current implementation only extracts first matching command per response; multiple commands not supported
- **Implementation Locations**: stop_loop and start_loop commands embedded in MainWindow.xaml.cs (lines 3842, 3854)

## Recommendation

Implement unified CommandRegistry pattern with:
- CommandDefinition with metadata (name, parameters, documentation)
- CommandScope enumeration (loop-only, global, etc.)
- CommandContext for execution context awareness
- Structured JSON-based command extraction replacing regex pattern
