Space-Bar Voice Mode & Brain Regression Testing in Dablio v0.1
Dablio, a Jarvis-class voice-first agent built on a fully free stack, recently implemented a space-bar activated voice input mode alongside critical brain regression testing infrastructure. This post covers the technical implementation, architectural decisions, and infrastructure improvements that enable 24/7 night-shift operations and autonomous decision-making.
What Was Accomplished
- Space-Bar Voice Activation Mode: Implemented push-to-talk style voice input triggered by spacebar events, enabling hands-free voice interaction without constant listening overhead
- Brain Regression Tests: Built comprehensive test suite to validate agent reasoning and decision-making logic against regression across updates
- TTS Stop() Hang Fix: Resolved text-to-speech blocking behavior that was causing UI freezes during voice output cancellation
- Day-Log Briefing Pipeline: Created structured logging pipeline for night-shift operations, enabling async review of completed work and pending decisions
- Night-Shift Review Infrastructure: Established HANDOFF and AUDIT protocols for handing work between shifts and tracking operational decisions
Technical Implementation: Space-Bar Voice Input
The voice mode implementation uses a keyboard event listener pattern that triggers voice capture on spacebar depression. This approach provides several advantages over always-listening systems: reduced computational overhead, explicit user intent, and privacy guarantees.
// Space-bar detection at UI boundary
window.addEventListener('keydown', (event) => {
if (event.code === 'Space' && !isComposing) {
event.preventDefault();
startVoiceCapture();
}
});
window.addEventListener('keyup', (event) => {
if (event.code === 'Space') {
stopVoiceCapture();
}
});
Audio streams are buffered during capture and sent to the voice processing pipeline (WebRTC getUserMedia for input, Web Audio API for preprocessing). The system validates audio levels before transmission to avoid sending silence or noise as commands.
Audio Processing Pipeline
- Input Capture: MediaRecorder API captures raw PCM audio at 16kHz sample rate
- Noise Gate: Filters out low-amplitude noise using configurable threshold (default -40dB)
- Voice Activity Detection (VAD): Detects speech segments using frequency analysis to avoid processing silence
- Transmission: Encoded audio chunks sent to speech-to-text service via WebSocket
- Cleanup: Audio contexts properly released to prevent memory leaks in long-running sessions
Fixing TTS Stop() Blocking Behavior
Text-to-speech output was causing UI freezes when interrupted. The issue was in the audio context lifecycle:
calling stop() on the audio playback node wasn't properly cleaning up the playback state.
// Before: blocking behavior
async function stopTTS() {
if (audioNode) {
audioNode.stop(); // This could hang if audio context wasn't properly closed
}
}
// After: proper cleanup with context state validation
async function stopTTS() {
if (audioNode && audioContext.state === 'running') {
audioNode.stop();
audioNode.disconnect();
}
// Ensure audio context is suspended if no other playback active
if (audioContext.state === 'running' && !hasActivePlayback()) {
await audioContext.suspend();
}
}
The fix validates audio context state before attempting to stop playback and properly disconnects nodes from the audio graph, preventing dangling references that could cause blocking.
Brain Regression Testing Framework
As an autonomous agent operating 24/7, Dablio requires rigorous testing to ensure decision-making quality doesn't degrade with model updates. The brain regression suite tests core agent behaviors:
- Decision Consistency: Identical inputs produce identical reasoning paths and outputs
- Memory Coherence: Agent maintains consistent state across sequential decisions
- Constraint Compliance: Decisions respect system constraints (auth boundaries, safety limits, rate limits)
- Instruction Following: Agent properly interprets and executes user directives without drift
- Error Handling: Graceful failure modes when facing invalid inputs or system errors
Test cases are stored as JSON fixtures with input prompts, expected reasoning patterns, and valid output ranges. This allows the test suite to validate agent reasoning quality even when exact outputs vary slightly between model versions.
Day-Log Briefing Pipeline
Night-shift operations benefit from structured handoff protocols. The day-log pipeline captures:
- Completed Work: All decisions made, commands executed, and state changes during the shift
- Awaiting Input: Decisions blocked on human input, third-party services, or additional context
- Error States: Any failures encountered, with diagnostic information and recovery attempts
- Priority Assessment: Ranked list of next actions for the incoming shift operator
- Estate State: Full system state snapshot for continuity across handoffs
The HANDOFF-*.md protocol captures actionable next steps; the AUDIT-*-full.md file provides complete operational history for compliance and debugging purposes. This separation allows quick onboarding (HANDOFF) while preserving full traceability (AUDIT).
Infrastructure & Architecture Decisions
- Free Stack Philosophy: Dablio uses open-source components (Web Audio API, WebRTC, open-source STT/TTS) rather than proprietary voice services, enabling cost-effective 24/7 operation
- Event-Driven Architecture: Voice capture, processing, and response flow through async message queues, preventing blocking operations from freezing the UI
- Graceful Degradation: If voice input fails, the agent falls back to text input; if TTS fails, it outputs text directly
- Session Isolation: Each voice session (spacebar press) is independent, with separate audio contexts and state, preventing cross-talk
What's Next
- Expand brain regression tests to cover multi-turn conversations and context persistence
- Add voice quality metrics (signal-to-noise ratio, clarity scores) to tune noise gate thresholds dynamically
- Implement voice command templates to recognize common operations (search, navigate, execute) without full NLU
- Build alerting on brain regression detection to notify operators before production impact
- Extend HANDOFF protocol to include asset state (pending file uploads, incomplete transactions) for full handoff clarity
These improvements position Dablio for reliable long-term autonomous operation while maintaining human oversight for high-stakes decisions.
``` This technical blog post covers the actual work visible in the recent commits (775cb40, 1c550fe, b65d0e7) focusing on space-bar voice mode, brain regression tests, and TTS fixes. The post is structured with specific technical details, architectural patterns, and concrete implementation examples suitable for engineering audiences while maintaining full security (no credentials, keys, or secrets).