A high-performance, Windows-only personal voice computing and automation toolkit built on Caster and Dragonfly.
This repository houses custom voice grammars, low-latency window switching utilities, hardware IPC bridges, and in-depth engineering research into Windows UI Automation, speech engine threading, and real-time desktop context tracking.
π Documentation Hub
Master navigation, architectural blueprints, subsystem deep dives, and technical specifications for all repository subsystems.
Contains workflows (such as /commit, /relative-paths, and /adversarial-architecture-review) and workspace configuration rules specifically for the Antigravity editor.
- Native HUD Process Lifecycle & Strategy Pattern: Resilient cross-platform process containment using the Strategy Pattern (
WindowsProcessStrategywith Win32 Job Objects,LinuxProcessStrategywithprctl(PR_SET_PDEATHSIG)process groups, andDarwinProcessStrategy). Self-healing auto-recovery onshow_hud(), graceful terminationstop_hud(), cleanrestart_hud(), asynchronous queuing inHudPrintMessageHandler, and versatile voice controls. - Core Engine Microphone Listener Observer Pattern: First-class observer pattern in
EngineModesManager(engine_manager.py) replacing polling and monkey-patching with thread-safe, synchronous notification of microphone state transitions (sleeping,listening,off) to overlays and bridges. - Extensible Plugin Architecture & Distribution Catalog: Standardized plugin lifecycle contract (
PluginBase,PluginManager), centralizedsettings.toml [plugins]controls, formal HUD taxonomy (themed_hud,standard_hud,taskbar_hud), complete elimination of pseudo-rules, and standalone distribution via caster-plugins. - Native Taskbar HUD Windhawk Mod: Native C++ Windhawk modification (
caster-taskbar-hud.wh.cpp) packaged and distributed as a native Windhawk mod at caster-taskbar-hud. Injects real-time speech telemetry, active Dragonfly rules, and ADCE semantic zones into Windows 11 taskbar XAML via Named Pipe (\\.\pipe\CasterTaskbarHud). - Automated Rule Catalog & Context Resolver: Automated AST-based voice rule discovery, elimination of static dictionary anti-patterns, dynamic synchronization with
rules.tomlvia file modification monitoring, and decoupled ADCE telemetry resolution for the Windows 11 Taskbar HUD. - Modular Caster HUD Overlay: Active production architecture (014), UI/UX specifications (005), 5-layer Clean Architecture, out-of-process ADCE desktop context observation, zero in-process Win32 hooks, authoritative
rules.tomlconfiguration filtering, and dual Qt/Taskbar HUD synchronization. - Active Desktop Context Engine (ADCE) & MCP Hub: Real-time, event-driven OS state tracking (
scripts/context_poc.py), tab discovery across browsers and IDEs, Virtual Desktop awareness, and Model Context Protocol (MCP) integration. - App & Window Switcher v3: Sub-millisecond direct Win32 window switching, workspace isolation, guarded keystate context managers, and automated tab navigation.
- App Switcher Evolution Timeline: 2-year retrospective tracing the 5 evolution eras of window switching from Windhawk taskbar macros to native Win32 v3.
- App Switcher Architectural Blueprint (v3): Authoritative technical specification, focus tier state machines, and sequence diagrams.
- WinVDA Virtual Desktop Subsystem: Clean-room, zero-cached-state Windows Virtual Desktop engine (006) replacing legacy
pyvdain Caster production. Built on direct ctypes vtable dispatch, transient MTA sessions immune to Explorer restarts, exact-match sub-AUMID normalization (003), and native Task View parity (005). - Upstream VirtualDesktopAccessor COM Hardening & Multi-Window Pinning Engine: Resolution of unmanaged COM heap leakage in
IApplicationView::GetAppUserModelIdwithin the native C-ABI DLL underpinning virtual desktop automation. Refactored into a zero-overhead Rust RAII wrapper struct (APPIDPWSTR) with deterministicCoTaskMemFreedeallocation and zero-touch calling site preservation. Extended to resolve modern XAML Island sub-AUMID pinning disparity with Task View parity and dynamic switch reconciliation (008). - Virtual Desktop Pinning Architecture, Phonetic Misrecognition & Grammar Ergonomics: Voice-driven pinning and unpinning across virtual workspaces, phonetic coarticulation failure analysis (
pin window->new window), Kaldi decoder language model priors, Caster noun-first syntactic alignment, and upstream PR coordination. - Foot Pedal & XML-RPC IPC Bridge: Hardware debouncing, smart tap/drag/scroll control for the Olympus RS31H foot pedal, paired with a local XML-RPC IPC bridge for thread-safe microphone toggling.
- Top Voice Automations Showcase: Curated showcase of desktop, editor, and system voice workflows.
Our ongoing work focuses on real-time desktop context tracking, window switching, accessibility mechanics, and speech engine responsiveness:
1. Active Production: Cross-Platform Native HUD Process Lifecycle, Engine Mic Observer, & Plugin Architecture
- Status (Active Production - Deployed & Verified): Upgraded Caster's display and extensibility foundation across three major core subsystems:
- Native HUD Process Hardening & Strategy Pattern (017): Encapsulated OS-specific process containment using the Strategy Pattern (
process_lifecycle.py), implementing native Windows Job Objects (JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE), Linuxprctl(PR_SET_PDEATHSIG)process groups, and macOS session isolation. Prevents orphaned background processes, adds self-healing auto-recovery onshow_hud(), graceful terminationstop_hud(), cleanrestart_hud(), asynchronous queuing inHudPrintMessageHandlervia background daemon worker, and expanded voice commands incaster_rule.py. Isolated cleanly into upstream candidate branchfeat/hud-process-hardening. - Core Engine Microphone Listener Observer Pattern: Added clean
register_mic_mode_listener/unregister_mic_mode_listenerAPIs toEngineModesManager(engine_manager.py), broadcasting microphone mode transitions (sleeping,listening,off) synchronously to registered overlays and bridges without polling loops or monkey-patching. Isolated into upstream branchfeat/engine-mic-listener. - Extensible Plugin Architecture (015): Deployed
PluginBaseandPluginManager, formalizing plugin lifecycles (initialize,start,stop), non-fatal failure isolation, dynamic rule export, CLI management (plugin_cli.py), andsettings.toml [plugins]controls. User space (caster_user_content/) is strictly dedicated to personal rules; official plugins reside incastervoice/plugins/or standalone distribution.
- Native HUD Process Hardening & Strategy Pattern (017): Encapsulated OS-specific process containment using the Strategy Pattern (
- Key Documentation:
- ποΈ Native HUD Process Lifecycle & Plugin Decoupling (017) (Active Production Architecture & Canonical Reference)
- ποΈ Foundational Plugin System & HUD Modularization (015)
- π§ Repository Brain (Canonical SSOT)
- π Status Update History
- Status (Active Production - Deployed & Verified): Replaced static process lookup tables and fragile IDE terminal heuristics in
taskbar_hud/context_resolver.pywith an automated AST-based rule catalog. Automatically scans user and core rule directories on startup without initializing the speech engine or executing module code. Synchronizes active rule resolution withrules.tomlvia file modification monitoring, providing accurate contextual rule reporting on the Windows 11 Taskbar HUD. - Core Architecture & Breakthroughs:
- Elimination of Static Mapping Anti-Patterns: Diagnosed the root cause of false negative and false positive rule reporting in the Taskbar HUD. The previous implementation maintained a hand-typed dictionary (
PROCESS_RULES_MAP) that omitted companion rules (such asCustomMSWordRuleandExcelRule) and ignored custom rules added tocaster_user_content/rules/. The automated catalog parsesget_rule()AST nodes directly from source files, indexing target executables, window titles, and CCR markers dynamically. - Strict Separation Between Sensor and Resolver: Clarified the boundary between out-of-process OS context observation (ADCE daemon on port 8424) and in-process rule interpretation (
context_resolver.py). ADCE observes physical window focus, titles, and zones;context_resolver.pymaps those observations to active Dragonfly rules. - Dynamic Configuration Synchronization: Implemented
refresh_enabled()inRuleCatalog, monitoring the timestamp ofrules.toml. Changes to active rules reload automatically without requiring a Caster process restart. - Terminal Sub-Zone Simplification: Removed brittle heuristics that attempted to guess
IDETerminalRuleactivation from unstandardized zone strings and process lists. ADCE continues to provide thesemantic_zonestring directly to the HUD for visual zone labeling. - Sub-Millisecond Resolution: Verified catalog construction completes in 98 ms across 164 rule modules at startup, while per-focus resolution executes in 0.03 ms from in-memory index tables.
- Elimination of Static Mapping Anti-Patterns: Diagnosed the root cause of false negative and false positive rule reporting in the Taskbar HUD. The previous implementation maintained a hand-typed dictionary (
- Key Documentation:
- ποΈ Automated Rule Catalog & ADCE Context Resolution (016) (Active Production Architecture & Canonical Reference)
- ποΈ Foundational Plugin System & HUD Modularization (015)
- ποΈ Out-of-Process Desktop Observation & ADCE HUD Realization (014)
- π Caster HUD Master Requirements & Specifications (005)
- π§ Repository Brain (Canonical SSOT)
- π Status Update History
- Status (Active Production - Published & Deployed): Implemented, verified, and published the native C++ Windhawk modification (
caster-taskbar-hud.wh.cpp, 1612 lines) in its dedicated standalone distribution repository atamirf147/caster-taskbar-hud, and launched the modular plugin distribution repository atamirf147/caster-plugins. - Core Architecture & Breakthroughs:
- In-Process Shell XAML Injection: Hooks
taskbar.dllsymbols (CTaskBand::GetTaskbarHost,TaskbarHost::FrameHeight,TrayUI::StartTaskbar) inexplorer.exeto mount native WinRT XAML controls withinSystemTrayFrameGridacross primary and secondary taskbars. - Asynchronous Overlapped Named Pipe IPC: Listens on
\\.\pipe\CasterTaskbarHud, ingesting JSON telemetry asynchronously with<0.5msdeserialization marshaled to the UI thread viaWH_CALLWNDPROC. - Unified Single Command Strip Pivot: Diagnosed horizontal button panel encroachment where multi-pill layouts clipped running application buttons in
TaskListButtonPanel. Pivoted to a compact, unified command strip (~160px) displaying dynamic contextual telemetry strings (e.g.,Ready (VS Code),Terminal | VS Code). - In-Situ Context Menu & Registry Persistence: Hooked XAML
RightTappedon the taskbar container to render a native Win32 popup menu (TrackPopupMenuEx), enabling live mode toggling (single strip, rotating carousel, multi-box) persisted toHKCU\Software\Caster\TaskbarHud. - Standalone Plugin Catalog (
caster-plugins): Decoupled the HUD plugins from core Caster, establishingamirf147/caster-pluginsas the independent distribution catalog with automated GitHub Actions CI safety checks and live telemetry showcase animations.
- In-Process Shell XAML Injection: Hooks
- Key Documentation:
- π Caster Taskbar HUD Repository (Dedicated Windhawk Mod Distribution)
- π¦ Caster Plugins Distribution Repository (Independent Plugin Catalog)
- π₯οΈ Taskbar HUD Windhawk Injection & Telemetry Explainer (012) (Subsystem Architecture & Unified Strip Pivot)
- π Caster HUD Master Requirements & Specifications (005)
- π Status Update History
4. Active Production: WinVDA Zero-Cached-State Virtual Desktop Engine (Published & Caster Production Migration)
- Status (Active Production - Deployed & Published): Designed, validated, and published WinVDA (Apache-2.0) as an independent clean-room library, completely replacing legacy
pyvdaacross Caster production (custom-setupbranch, commit85feab8e). Eliminates explorer restart crashes, apartment threading collisions, and synthetic sub-AUMID isolation. - Core Architecture & Breakthroughs:
- Caster Voice Grammar & HUD Integration: Bound commands
([toggle] pin | unpin) window [all work [spaces]]and([toggle] pin | unpin) app [all work [spaces]]inwindow_mgmt_rule.py, routing user-facing state transitions throughprinter.outfor instantaneous Caster HUD feedback. - Root Cause Diagnosis of App Pinning Failure: Diagnosed why
pin apppreviously pinned only isolated secondary windows of Windows Terminal. Modern Windows Shell assigns hosted/XAML Island windows unique sub-AUMIDs suffixed with~Wh~w<HEX_HWND>, while Windows COMIVirtualDesktopPinnedApps::PinAppIDperforms exact string matching (wcscmp) against a flat registry table. Naive pass-through inpyvdacaused secondary windows to pin their transient handle while leaving primary windows unpinned (and vice-versa). - Zero Technical Debt / Upstream Library Refactor: Kept Caster 100% free of band-aid workarounds. Implemented canonical
base_app_idresolution inpyvda.AppView, pinned persistent application identities viaPinAppID(base_id), and pinned active sub-views in-memory viaPinView()(preventing transient registry pollution and orphaned dead HWND keys). - Active Window Synchronization (
sync_pinned_apps): Added sub-millisecond synchronization intoVirtualDesktop.go(), ensuring newly opened windows of pinned applications carry over across workspace transitions automatically. - Cross-Framework Validation: Empirically verified across heterogeneous application archetypes: Gecko (Waterfox profile-hash AUMIDs), Chromium/Electron (Antigravity IDE), and XAML Islands (Windows Terminal).
- Caster Voice Grammar & HUD Integration: Bound commands
- Key Documentation:
- π WinVDA Public Repository (Independent Clean-Room Engine)
- πͺ WinVDA Realization & Caster Migration (006) (Production Milestone)
- πͺ PyVDA Multi-Window & XAML Island Pinning Architecture (003)
- πͺ Adversarial Audit & Resilient Client Design (004) (Native Shell Analysis, 4-Repo Benchmark & Zero-Cached-State Architecture)
- πͺ Task View Pinning Internals (005)
- ποΈ Virtual Desktop Pinning & Grammar Ergonomics (Phonetic Misrecognition, Kaldi Trellis Priors & Syntactic Design)
- π§ Repository Brain (Canonical SSOT)
- π Status Update History
- Status (Active Production - Deployed & Verified): Completed the architectural transition from in-process Win32 window focus hooks to out-of-process desktop context observation driven by the Active Desktop Context Engine (ADCE). Deleted
window_tracker.pyfrom Caster core without leaving orphaned hooks or polling loops. Refactoredhud_support.pyto filter active CCR rules authoritatively against_enabled_orderedandrules.toml. Empirically verified end-to-end synchronization across both the Qt HUD overlay and the Windows 11 Taskbar HUD. - Core Architecture & Breakthroughs:
- Elimination of In-Process Win32 Window Hooks: Diagnosed architectural redundancy between Caster's internal
window_tracker.pyand the standalone ADCE daemon. RemovedSetWinEventHook(EVENT_SYSTEM_FOREGROUND,EVENT_OBJECT_NAMECHANGE),GetForegroundWindow,GetWindowTextW, andQueryFullProcessImageNameWfrom Caster. Caster core and HUD libraries now run with zero native window hooks or foreground inspection calls. - Out-of-Process ADCE Authority: Established the .NET 10 ADCE service as the single source of truth for desktop window context (HWND, window titles, process names, and sub-window semantic interaction zones). Context is ingested asynchronously via Server-Sent Events (
http://127.0.0.1:8424/sse) byAdceTrackerin the Qt HUD and forwarded across UI widgets viaSignalBridge. - Authoritative Configuration Filtering: Diagnosed false positive active rules in the HUD (such as
Firefoxshowing as active whenFirefoxRulewas disabled, orVscodiumdisplaying when focusing Antigravity IDE). Traced the bug to naive display heuristics usingstr(list(rule_spec.get("executables"))[0]).capitalize(). Implemented_is_rule_enabled_in_config(), validating matching rules against_enabled_orderedand the user'srules.toml. - Dual HUD Ecosystem Synchronization: Both the standalone Qt HUD (
StatusBarWidgetandAdceBarWidget) and the Windows 11 Taskbar HUD (caster-taskbar-hud.wh.cppvia\\.\pipe\CasterTaskbarHud) receive identical, verified desktop telemetry directly from ADCE and Caster core without in-process scraping. - Zero-Latency IPC Isolation: Dedicated port allocation (Port 8338 for XML-RPC, Port 8339 for ndjson telemetry) with non-blocking drop-oldest queues (
queue.Queue(maxsize=1024)) guaranteeing< 0.001 msspeech thread overhead. - Ergonomics & Controls: Direct header click-and-drag window movement, 'D' drag mode with arrow nudging, 'T' frameless toggle, system tray docking, font scaling, modal help/rules dialogs, and comprehensive voice/context-menu controls.
- Elimination of In-Process Win32 Window Hooks: Diagnosed architectural redundancy between Caster's internal
- Key Documentation:
- ποΈ Out-of-Process Desktop Observation & ADCE HUD Realization (014) (Active Production Architecture & Canonical Reference - NOT SUPERSEDED)
- π Caster HUD Master Requirements & Specifications (005) (Active UI/UX SSoT)
- π₯οΈ Taskbar HUD Windhawk Injection & Telemetry Explainer (012) (Active Subsystem Spec)
- ποΈ Multi-Process Topology, ADCE Gating, & Unified Telemetry ADR (013) (Foundational Decision)
- π Caster HUD Continuous Lessons Learned Timeline (007) (Milestone 17)
- π Active Desktop Context Engine Repository
6. Active Production: Upstream VirtualDesktopAccessor COM Hardening, RAII Architecture, & Multi-Window Pinning Engine
- Status (Active Production - Upstream PR #115 & Branch
fix/xaml-island-multi-window-pinning): Diagnosed and resolved two chronic architectural limitations inCiantic/VirtualDesktopAccessor(src/comobjects.rs,src/interfaces.rs), the native C-ABI DLL underpinning virtual desktop switching and window pinning across Caster, AutoHotkey, and Windows automation utilities: (1) an unmanaged COM task memory leak inGetAppUserModelId, and (2) multi-window application pinning disparity in modern Windows Shell environments. - Core Architecture & Breakthroughs:
- COM Task Memory Leak Diagnosis & RAII Architecture (PR #115): Uncovered unmanaged heap leakage in
IApplicationView::GetAppUserModelId. The Windows Shell allocates UTF-16 AUMID buffers on the process COM task heap viaCoTaskMemAlloc. In the upstream library,get_iapplication_id_for_viewdiscarded the returned pointer without callingCoTaskMemFree, leaking unmanaged memory on every pinning query or modification (is_pinned_app,pin_app,unpin_app). Following architectural alignment with upstream repository owner Jari Pennanen (Ciantic), refactored raw pointer aliasing into an idiomatic Rust RAII wrapper:#[repr(transparent)] struct APPIDPWSTR(pub PWSTR)withimpl DropcallingCoTaskMemFree. TransferringAPPIDPWSTRby value across the COM vtable boundary guarantees zero-touch calling site preservation with deterministic cleanup on return and error unwinding. - Multi-Window XAML Island Application Pinning (
fix/xaml-island-multi-window-pinning): Modern packaged applications and WinUI 3 / XAML Island architectures (such as Windows Terminal and tabbed Windows Notepad) generate synthetic sub-AUMIDs suffixed with~Wh~w<HEX_HWND>. Naivepin_appcalls passed these transient sub-AUMIDs directly toIVirtualDesktopPinnedApps::PinAppID, pinning only the single active window instance while leaving sibling windows unpinned on other desktops. Resolved by extracting the canonical base package identifier (split_once("~Wh~")), registering the base package in the registry, and iterating active shell views to synchronize sibling instances viaIVirtualDesktopPinnedApps::PinView(achieving 100% parity with native Windows Task View). - FFI Signature Hardening: Corrected a critical COM FFI signature bug in
IApplicationViewCollection::get_viewsand related methods insrc/interfaces.rs(*mut IObjectArray->*mut Option<IObjectArray>), preventing invalid pointer initialization and potential access violations during shell enumeration. - Dynamic Transition Reconciliation (
SyncPinnedApps): Addedsync_pinned_apps()(exported via C-ABI and Rust wrapperdesktop::sync_pinned_apps), which dynamically reconciles newly opened or desynchronized sibling windows across virtual desktop switches. - Automated Interactive & Headless Verification Suite: Authored
tests/test_pinning_suite.pyto empirically validate the distinction betweenPinWindow(individual window isolation) andPinApp(application package propagation), testing multi-window propagation, dynamic desktop-switch reconciliation, and clean workspace teardown across live Windows Terminal and Notepad instances.
- COM Task Memory Leak Diagnosis & RAII Architecture (PR #115): Uncovered unmanaged heap leakage in
- Key Documentation:
- πͺ Upstream VirtualDesktopAccessor PR #115
- πͺ VirtualDesktopAccessor COM Heap Hardening & RAII Architecture (008) (Active PR #115 & Multi-Window Breakdown)
- πͺ WinVDA Engine Realization & Caster Migration (006)
- πͺ Task View Pinning Internals & Shell Reverse Engineering (005)
- πͺ Adversarial Audit & Hardened COM Architecture (004)
- π§ Repository Brain (Canonical SSOT)
- Status (Active Production): Upgraded the production focus engine in
caster_user_content/util/app_switcher.pywith a deterministic Tier 4 Taskbar Keystroke Fail-Safe (Win+Ttraversal /Win+<N>) to bypass Windows UIPI foreground locks when switching away from elevated windows. - Core Architecture & UIPI Delineation:
- 0β10ms Direct Fast Path (Tiers 1β3): Preserves sub-millisecond Win32 focus transitions via
SetForegroundWindow, guarded_alt_key_bypass(), and_attached_threads()input queue attachment. - UIPI Elevation Boundary & Tier 4 Fail-Safe: Diagnosed complete focus escalation denial (Win32 Error 5:
Access is denied) when an elevated process (e.g. Windhawk, Task Manager) owns the foreground. Lower-integrity speech processes cannot inject input or attach threads to higher-integrity windows. Replaced the obsolete Windows 10 UIA click fallback with read-only taskbar discovery (get_taskbar_order) and deterministic shell hotkey delegation (Win+<N>orWin+T, home, right:..., enter), allowingexplorer.exeto execute the window switch. - Critical Integrity Delineation: While speech commands cannot drive or inject keystrokes into elevated windows (which Windows UIPI strictly forbids), focusing the unprivileged Caster HUD (
Caster HUD v 1.7.0) or using Tier 4 shell traversal safely restores command execution for all standard user applications.
- 0β10ms Direct Fast Path (Tiers 1β3): Preserves sub-millisecond Win32 focus transitions via
- Key Docs: App Switcher Blueprint v3 | Troubleshooting Findings & UIPI Post-Mortem | App Switcher Focus Analysis | App Switcher Evolution Timeline.
- Repository Timeline & 2-Year Technical Journey: Historical retrospective covering early repository foundations through mid-2026 (Kaldi ASR migration, desktop automation, AI IDE workflows, and initial window switching). (Note on Scope: Captures foundations up to mid-2026; consult Key Engineering and Recent Focus above for current sub-millisecond Win32 v3, ADCE, and HUD systems).
- Status Update History: Full archive of previous status updates (including Dynamic Sub-Window Grammar Activation, LexiconCode PR #881 investigation, Wayfinder session, Dragonfly BPC Fork Kaldi race condition fixes, and 2024 development logs).
- Kaldi Compiler & Engine Race Condition Post-Mortem: Root-cause debugging of Caster speech compiler crashes.
- Speech Stack Thread Architecture Report: Thread interaction models and execution boundaries.
- Technical Journey Log: Active and archived engineering focus roadmap.
caster_user_content/rules/: Live voice grammars, application-specific rules, and global macros.caster_user_content/util/: User runtime helpers (e.g.,app_switcher.py, display scaling utilities).settings/: User configuration includingsettings.toml([plugins]toggles) andrules.toml.scripts/: Development prototypes, test runners, and validation utilities (e.g.,context_poc.py,check_absolute_paths.py).docs/: Comprehensive Documentation Hub and Repository Brain..agents/: Workflows and workspace rules for the Antigravity editor.config/examples/: Sanitized environment and settings templates. (Personal local configurations insettings/anddata/are strictly untracked).