English | 简体中文
agent-voice-input
Context-aware voice input for CLI coding agents—grounded in your live session, repo, and SSH hosts.
Supports macOS and Windows + WSL2. Built for Codex, Claude Code, and Antigravity CLI (agy), while working out of the box across desktop IDEs and everyday apps.
🎙️ What you say casually to your terminal:
"Uh check the default retry timeout in session router dot py, change it from
five seconds to ten seconds—actually wait, make it fifteen seconds—and run
the unit tests without piping to head"
❌ Generic OS dictation:
Uh check the default retry timeout in session router dot pie change it from 5 seconds to 10 seconds actually wait make it 15 seconds and run the unit tests without piping to head
✅ agent-voice-input (grounded in active Agent session & repo, pasted without Enter):
Check the default of retry_timeout_sec in session_router.py, change it to 15 seconds, and run the unit tests without piping to head.
Quick Start in 60 Seconds
Path A: Let Your AI Agent Set It Up (Recommended)
The CLI is 100% non-interactive (zero y/n prompts) with structured --json diagnostics. Paste this into Codex, Claude Code, or AGY:
Install and configure agent-voice-input following docs/agent-setup.md (https://github.com/xiaohuaxi/agent-voice-input/blob/main/docs/agent-setup.md):
1. Respect my local keyboard layout (auto-use RCommand on MacBook built-in keyboards; keep RControl on desktop Macs such as Mac mini with external keyboards and on Windows/WSL2).
2. Only run `agent-voice-input integrate` if my setup actually needs hooks (e.g., multiple non-tmux WSL2 windows in the same directory).
3. After `doctor --ping --json` and `start`, guide me through a quick live or `--dry-run` connectivity check.
Path B: Manual Setup in 3 Steps
Prerequisites: Python >= 3.10, ffmpeg (macOS: brew install ffmpeg + xcode-select --install; WSL2: sudo apt install ffmpeg).
Step 1: Install (Pick Either Option)
Option 1 — PyPI one-line install (installs into ~/.local/bin; ensure ~/.local/bin is in your PATH):
uv tool install agent-voice-input # or: pipx install agent-voice-input
Option 2 — Clone repo & run with zero dependencies (pure Python >= 3.10 standard library; no uv or pipx required):
git clone https://github.com/xiaohuaxi/agent-voice-input.git \
&& mkdir -p ~/.local/bin \
&& ln -s "$PWD/agent-voice-input/bin/agent-voice-input" ~/.local/bin/agent-voice-input
Step 2 & 3: Initialize, Add a Key & Start
# 2. Initialize ~/.agent-voice-input/ (0600 config.toml, .env, starter hotwords/personal.txt & default-ignore .gitignore)
agent-voice-input init
# 3. Verify connectivity & start daemon (first run compiles the native shim: ~5-15s on macOS, ~15-60s+ on WSL2 with Defender)
agent-voice-input doctor --ping && agent-voice-input start
- Keyboard-aware defaults (even without
init): Bothinitand zero-initruntime automatically default tokey = "RCommand"on MacBook built-in keyboards, and keepkey = "RControl"on desktop Macs (e.g., Mac mini with an external full-size keyboard) and Windows/WSL2; an explicitkeyinconfig.tomlor CLI--hotkeystrictly takes precedence. Pitfalls to avoid on macOS:ROptionconflicts with Doubao IME,Fnconflicts with the macOS 🌐 Globe key (to useFn, set System Settings → Keyboard → "Press 🌐 key to" to Do Nothing), andRShiftconflicts with third-party Chinese IME single-tap toggling. Tap hotkey<= 0.5sto start/stop; hold0.8sto cancel. - macOS permissions belong to the starting terminal: Grant Microphone (required), Accessibility (for
Cmd+Vauto-paste outside Ghostty/tmuxand window-title/session routing in third-party terminals/desktop apps), and Automation (for Ghostty /Terminal.app/iTerm2) to the GUI terminal that runsagent-voice-input start; if you restart from a different terminal app, grant permissions to that terminal too. - Unified app home (
~/.agent-voice-input/):config.toml,.env,hotwords/personal.txt, and opt-in archives (audio/&transcripts/) all live under~/.agent-voice-input/(override root viaAGENT_VOICE_INPUT_HOME).initcreates a default-ignore.gitignoretracking onlyhotwords/, andinit --forceoverwrites onlyconfig.tomlwhile always preserving existing.envcredentials,hotwords/personal.txt, and.gitignore. - Simplest 1-key setup (remember to uncomment
.envlines!):initauto-detects existing environment keys and localcodexCLI logins and tells you immediately if you are ready out of the box. If you need a Stage 1 key, add 1 key to~/.agent-voice-input/.env—be sure to remove the leading#comment character and replace the placeholder value:- Mainland China:
DASHSCOPE_API_KEYorDEEPSEEK_API_KEY - Global / Overseas:
OPENROUTER_API_KEY,OPENAI_API_KEY, orGEMINI_API_KEY
- Mainland China:
- Templates & full agent guide:
config.example.toml,config.example.env, anddocs/agent-setup.md.
Tip: Zero hooks required for ~80% of daily workflows: macOS Ghostty (
✅),Terminal.app(🧪), andiTerm2(🧪, falls back to PTY scan without Automation permission; grant Automation in System Settings for exacttty), local or remotetmuxon any platform (no~/.tmux.confedits), all desktop apps, and WSL2 single-window or distinct-directory windows route accurately out of the box. Only if you run multiple standalone non-tmuxwindows in the same directory (e.g., Windows Terminal on WSL2) do you ever need one optional command:agent-voice-input integrate(seeintegrations/README.md).
Core Technical Highlights
- Two-Stage & Single-Hop + 50K Block Prefix Caching: Pair fast Stage 1 STT with lightweight Stage 2 refinement, or run single-hop multimodal audio; session history is sealed into immutable 50K prefix blocks for high cache hits while back-to-back utterances refine concurrently and paste in strict FIFO order.
- Focus-Aware Terminal, IDE & SSH Routing: Automatically binds to the active session and
git statusfilenames in your focused terminal, Ghostty split, ortmuxpane; desktop IDEs mount only workspace context without leaking terminal sessions; chat/everyday apps switch to clean general dictation; SSH terminals block local leaks by default and support zero-install remote probing via a 1-line[remote] hostswhitelist. - Zero Third-Party Python Dependencies + Acoustic Silence Gating & Trimming: Pure Python
>= 3.10standard library plus hostffmpegand minimal native shims (no Electron); local silence gating, adaptive long-pause compression ([audio].silence_trim = "balanced" | "conservative" | "off"), and loudness normalization filter empty triggers and shorten long thinking pauses before API calls, recordings support up to 10 minutes (auto-splitting> 3 minclips at pauses), and failed or in-flight-cancelled clips stash (0600) forretry. - Zero-Clipboard Injection in macOS Ghostty/
tmux+ Never Auto-Presses Enter: Locks onto the origin window on record start and falls back to clipboard if focus drifts; injects directly in macOS Ghostty and macOStmuxwithout touching your clipboard (WSL2—including insidetmux—and other windows snapshot and restore clipboard contents); paste-only by default so misheard commands never auto-execute. - 100% Non-Interactive CLI for Human & Agent Workflows: Every command runs without
y/nprompts and supports--jsonoutput (status --json,doctor --ping --json,diagnose --json,integrate --status --json), so both humans and AI agents can install, verify, and troubleshoot cleanly.
Support & Verification Matrix
Status Legend:
✅Verified on hardware: Used daily or verified end-to-end by the author on real devices.🧪CI & unit-tested (seeking field reports): Dedicated adaptation implemented and covered by offline unit tests or automated CI checks (e.g., realtmux, realsshd,mac_shim/win_shimself-checks), not yet verified on that specific client or account on real hardware—feedback welcome to light up✅.⚪Generic fallback: Works out of the box under defaulthotkey.scope = "all"with refined paste and window-locked anti-crosstalk, without app-specific context or tone adaptation.
Platforms, Terminals, SSH & Key Desktop Apps
| Category | Target | Status | Scope, Delivery & Boundaries |
|---|---|---|---|
| Host OS | macOS (Apple Silicon / Intel) | ✅ |
Daily driver; native mac_shim HUD capsule + system microphone |
| Host OS | Windows + WSL2 | ✅ |
Daily driver; win_shim native WASAPI capture + Per-Monitor V2 HiDPI capsule |
| Host OS | SSH Remote Linux Host | ✅ |
Zero-install remote probe (Python >= 3.10 only) + local crosstalk blocking; verified via Ubuntu CI real sshd E2E |
| Host OS | Native Linux Desktop / Standalone Windows (No WSL2) | — |
Daemon, global hotkey & toggle not yet supported natively; native Linux currently supports offline file transcription (once --file <wav> --dry-run) and headless SSH remote targets |
| Terminal | macOS Ghostty | ✅ |
AppleScript zero-clipboard direct injection + same-split tmux pane anti-crosstalk + zero-hook full context (Codex / Claude Code / AGY CLI hardware-verified) |
| Terminal | Windows Terminal (WSL2) | ✅ |
win_shim transient clipboard + shortcut paste (preserves clipboard) + same-window tab anti-crosstalk + hook/tmux precision context (Codex / Claude Code / AGY CLI hardware-verified) |
| Terminal | Local & Remote tmux |
✅ |
macOS: zero-clipboard direct injection / WSL2: win_shim transient clipboard + paste (preserves clipboard); process tree isolated by focused pane; Linux & macOS CI real tmux E2E |
| Terminal | Other Built-in Terminals & Dedicated SSH Clients | 🧪 |
Built-in paste-chord routing, anti-crosstalk & client rules (see full list below); other CLI agents (OpenCode, Aider, etc.) fall back to workspace git/filenames without reading their conversation history yet; seeking real-hardware feedback |
| Desktop App | Antigravity / AGY Desktop | ✅ (macOS) / 🧪 (Windows) |
Hardware-verified on macOS for Antigravity 2.0 standalone desktop (read-only conversation_summaries.db + exact/truncated-prefix title matching, workspace git/filenames + brain/ incremental cache, and thread switching); legacy VS Code Fork also supported (Windows desktop pending field reports; WSL2 scans WSL paths only) |
| Desktop App | ChatGPT / Codex Unified Desktop | ✅ (macOS) / 🧪 (Windows) |
Hardware-verified on macOS: the unified desktop app (com.openai.codex) reads ~/.codex/sqlite/codex.db + ~/.codex/sessions/*.jsonl read-only to auto-promote local repo tasks to agent mode with project hotwords & incremental cache, keeps cloud ChatGPT chats in general mode (personal hotwords only, zero crosstalk), and re-verifies same-window thread switching before paste; Windows (ChatGPT.exe / Codex.exe) currently provides refined paste & window-locked anti-crosstalk (Windows/WSL2 cross-OS context binding is on the roadmap) |
| Desktop App | Claude Desktop | ✅ (macOS) / 🧪 (Windows) |
Hardware-verified on macOS (com.anthropic.claudefordesktop): Code & Cowork local session binding (bounded read-only AXWebArea route/title probe, joint Claude/Claude-3p metadata scan, 50K incremental cache, and pre-paste same-window thread verification) plus refined paste with clipboard restore, while cloud Chat stays in general mode (personal hotwords only, zero crosstalk) (WSL2 does not yet support Windows Claude Desktop context binding; Windows Claude.exe provides refined paste & window-locked anti-crosstalk) |
| Desktop App | Other Desktop IDEs | 🧪 |
IDEs (VS Code, Cursor, Windsurf, JetBrains, Zed, etc.) run as coding_gui with workspace git/filenames; running CLI agents inside an IDE's integrated terminal is also treated as coding_gui (skips CLI sync_session, does not read codex/claude/agy history inside the integrated terminal, and does not distinguish integrated terminal splits) |
| Desktop App | Any Other Desktop App (browsers, IM, chat, notes, email, etc.) | ⚪ |
Works out of the box under default hotkey.scope = "all" in general mode (personal hotwords only, refined paste + window-locked anti-crosstalk; no fragile non-agent app/browser title enumeration) |
Full List of Built-in Terminals & Dedicated SSH Clients (🧪)
- macOS Terminals (
🧪):Terminal.app,iTerm2,WezTerm,Kitty,Alacritty,Warp,Hyper,Rio,Tabby - Windows Terminals (
🧪):WezTerm,Alacritty,Ghostty,Tabby,Hyper,Rio,Warp,Mintty,PuTTY,KiTTY - Dedicated SSH Clients (
🧪):MobaXterm,Xshell,WindTerm,SecureCRT,Termius,Electerm,FinalShell,RoyalTS
Using a
🧪or⚪environment? If it works smoothly—or if you run into an edge case—please open an Issue with your OS + terminal/app + provider to help us light up more✅.
Model Selection Guide & Recommended Combinations
Mainstream Stage 1 (ASR) Providers
| Provider | Model | Hotwords / Context | Highlights & Best Fit |
|---|---|---|---|
Alibaba Bailian (dashscope) ✅ |
qwen3-asr-flash |
250 terms / 2,800 chars + recent dialogue | Top choice for Chinese & mixed CN/EN dictation; wide hotword capacity and low latency |
OpenRouter (openrouter) ✅ |
microsoft/mai-transcribe-2 |
Native keyterms (50 terms) |
~$0.10/hr base rate; rock-solid transcription + native keyterms; great global/aggregator default |
Doubao (doubao) ✅ |
bigmodel |
50 terms / 1,000 chars + dialogue | Fast Mainland China alternative; single-header DOUBAO_SPEECH_API_KEY (no APP_ID required) |
OpenAI (openai) ✅ |
gpt-transcribe (default; also gpt-4o-transcribe) |
Native keywords[] (50 terms on gpt-transcribe) |
Strong English & multilingual STT; pairs natively with gpt-6-luna refinement |
DeepSeek (deepseek) ✅ |
deepseek-asr |
None (rely on Stage 2 refiner) | Official /v1/tools/asr with 21-language auto-detect; ultra-low cost single-key two-stage |
Google Gemini (gemini) ✅ |
gemini-3.7-flash |
Stage 2-grade 200 items / 3,000 chars + 50K context | Native single-hop multimodal audio + context refinement (skips Stage 2) |
Stage 2 (Refiner) Quality Tiers — Prefer Quality First
- Tier 1 — Recommended (Best Refinement Quality):
codex(gpt-6-luna, reuses local Codex CLI login, never enables Fast mode),agy(gemini-3.8-flash, explicit opt-in via local AGY CLI),openrouter(google/gemini-3.8-flash, defaulteffort = "low"),openai(gpt-6-luna), andgemini(gemini-3.7-flash). These models handle mid-sentence self-corrections, mixed CN/EN technical terminology, and long-session grounding noticeably better than lightweight domestic models—prefer them whenever refinement quality matters most. - Tier 2 — Budget / Single-Key Convenience:
deepseek(deepseek-flash),dashscope(qwen3.8-flash), andvolcengine(doubao-seed-2-0-mini-260428). Fast and inexpensive for 1-key Mainland China setups, with slightly weaker complex edit accuracy than Tier 1.
Recommended Combinations by Scenario
| Scenario | Recommended Stage 1 (ASR) | Recommended Stage 2 (Refiner) | Keys / Setup Needed |
|---|---|---|---|
| Best Quality with Existing Codex / AGY Login | dashscope ✅, openrouter ✅, doubao ✅, openai ✅, or deepseek ✅ |
codex ✅ (auto-detected by auto; never enables Fast mode) or agy ✅ (explicit opt-in) |
1 Stage 1 speech key + local codex or agy CLI login |
| Mainland China Daily Driver (CN / Mixed CN–EN) | dashscope (qwen3-asr-flash ✅, 250-term hotwords) or doubao (bigmodel ✅, 50/1,000) |
Tier 1: codex ✅ / agy ✅ / openrouter ✅ (or Tier 2 budget: deepseek ✅ / dashscope ✅) |
DASHSCOPE_API_KEY or DOUBAO_SPEECH_API_KEY + preferred Stage 2 login/key |
| Global / Aggregator Single-Key (High Quality) | openrouter (microsoft/mai-transcribe-2 ✅, ~$0.10/hr, two-stage) or openai (gpt-transcribe ✅) |
openrouter (google/gemini-3.8-flash ✅) or openai (gpt-6-luna ✅) |
Just 1 key: OPENROUTER_API_KEY or OPENAI_API_KEY |
| Minimal 1-Key Budget or Single-Hop | deepseek ✅ (budget two-stage), dashscope ✅ (two-stage or qwen3.8-omni-flash single-hop), or gemini ✅ (native single-hop) |
Built-in default for two-stage, or skipped in single-hop | Just 1 key: DEEPSEEK_API_KEY, DASHSCOPE_API_KEY, or GEMINI_API_KEY |
Note on OpenRouter: Use OpenRouter in two-stage mode (
microsoft/mai-transcribe-2+google/gemini-3.8-flash). Single-hop multimodal chat-audio on OpenRouter is intentionally omitted from recommended recipes because skipping explicit cache writes on< 50Ksessions makes repeated single-hop audio calls pricier than two-stage.On local / self-hosted models: This release focuses on thoroughly tested mainstream cloud APIs and existing CLI logins (
codex/agy). While a genericopenai-compatiblecustombase_urlhook already exists under the hood (🧪), fully verified first-class support for local / private self-hosted models (compact local ASR + refiner) is planned forv1.1+.
Privacy & Data-Flow Commitments
- No Author Servers, Zero Middleman — 100% User-Controlled:
agent-voice-inputhas no author-hosted servers, relays, or hidden telemetry. All audio and context go directly from your machine to the model provider you explicitly configure; every model and credential stays strictly under your own control (Apache-2.0 open source). - No Audio or Transcripts Stored by Default: Status snapshots, logs, and the local diagnostic log (
diag.jsonl) redact secrets and never write user speech transcripts, session context, or hotword lists. Audio is only stashed (0600, 24h TTL, max 10 clips) infailed/when recognition/delivery fails or an in-flight job is cancelled soretrycan recover it (recording-time cancels drop immediately). Optional local history under[archive](save_transcripts→transcripts/YYYY-MM.jsonl,save_audio→audio/<id>.mp3) is off by default, uses0700/0600permissions, and is excluded by.gitignore. 0700/0600Isolation & No Invasive Scraping: Runtime/config files enforce private permissions. Context lookup only inspects the focused window title, macOSAXDocument, plain-text CLI agent logs, and read-only AGY/Codex session indexes—never VS Code/Cursor internal state DBs (state.vscdb) and never Accessibility/UIAutomation DOM trees in chat apps or browsers. Non-terminal windows hard-skip terminal CLI sessions, and SSH remote probing only queries explicitly whitelisted hosts with zero remote keys.- Scoped Context Only (Never Full Repo) & Transparent
autoDetection: Coding mode sends only recent dialogue from the active window plusgit status/shallow filenames—never your full repository source. Note that defaultprovider = "auto"checks your environment/.envkeys and existing localcodexCLI login (agyis explicit opt-in only and never auto-selected); set explicitprovidervalues orrefiner.provider = "off"if you want fixed routing.
FAQ, Daily Operations & Common Gotchas
- My MacBook doesn't have a Right Ctrl key—what should I use?
Bothagent-voice-input initand zero-initruntime automatically detect MacBook built-in keyboards and default tokey = "RCommand"(Right Command, recommended first), while desktop Macs (e.g., Mac mini) and external full-size keyboards keepkey = "RControl"; an explicitkeyinconfig.tomlor CLI--hotkeyalways takes precedence. Avoid common conflicts:ROptioncollides with Doubao IME,Fncollides with the macOS 🌐 Globe key (to useFn, set System Settings → Keyboard → "Press 🌐 key to" → Do Nothing), andRShiftcollides with third-party Chinese IME single-tap toggling. You can change[hotkey]in~/.agent-voice-input/config.tomlanytime, runagent-voice-input restart, or inspect keycodes withagent-voice-input key-test. - Why isn't bare
pip install agent-voice-inputrecommended in Quick Start?
Homebrew Python on macOS (and modern Debian/Ubuntu distros) enforces PEP 668 (externally-managed-environment), causing barepip installoutside a virtualenv to fail. Useuv tool install agent-voice-inputorpipx install agent-voice-inputfor isolated PyPI installs, or clone the repo and symlinkbin/agent-voice-inputdirectly with zero dependencies. - How do I auto-start, upgrade, or completely uninstall?
- Idempotent terminal auto-start (add 1 line to
~/.zshrcor~/.bashrc):[ -z "$SSH_CONNECTION" ] && command -v agent-voice-input >/dev/null 2>&1 && agent-voice-input start >/dev/null 2>&1
Warning (macOS): Never use
launchd(LaunchAgent) to launch the daemon in the background on macOS. Backgroundlaunchdagents lose the GUI terminal's Microphone & Automation TCC attribution and silently record all-zero audio; always start from your authorized GUI terminal. - Upgrade:
uv tool upgrade agent-voice-input && agent-voice-input restart(orpipx upgrade agent-voice-input && agent-voice-input restart; if running from a git clone,git pull && agent-voice-input restart). - Uninstall:
agent-voice-input stop agent-voice-input integrate --uninstall # optional: remove managed CLI hooks uv tool uninstall agent-voice-input # or pipx uninstall / rm ~/.local/bin/agent-voice-input # Optional: remove config, runtime & cache files listed below
- Where files live:
Path Purpose ~/.agent-voice-input/App home ( config.toml,.env,hotwords/personal.txt, opt-inaudio/&transcripts/; override viaAGENT_VOICE_INPUT_HOME)~/.cache/agent-voice-input/(or$XDG_RUNTIME_DIR/agent-voice-input)Runtime dir ( control.sock,daemon.lock,daemon.log,diag.jsonl,failed/,sessions/,integrate-backups/)~/Library/Caches/agent-voice-input/(macOS)Cached compiled mac_shimbinary
- Idempotent terminal auto-start (add 1 line to
- Why does macOS record pure silence when I start the daemon over SSH?
macOS binds Microphone TCC permission to the responsible GUI process; daemons launched undersshd(orlaunchd) receive silent all-zero audio frames. Always runagent-voice-input start/restartinside an authorized local GUI terminal (such as Ghostty orTerminal.app). - Why can't WSL2 auto-paste into Windows Administrator windows?
Windows UIPI (User Interface Privilege Isolation) blocks non-elevatedwin_shimfrom synthesizingCtrl+Vinto elevated Administrator windows. The refined text is safely copied to your clipboard—pressCtrl+Vmanually. - How do I route the background daemon through a proxy?
ExportHTTPS_PROXY(andNO_PROXY=127.0.0.1,localhostfor loopback endpoints) in your shell or set it in~/.agent-voice-input/.env(shell environment variables take precedence), then runagent-voice-input restart. Because the pure-stdlib HTTP client only speakshttp://proxies, if your proxy client only setsALL_PROXY=socks5://..., also set its HTTP/HTTPS mixed port (HTTPS_PROXY=http://127.0.0.1:<port>) and verify withagent-voice-input doctor --ping. - Why does it only paste and never auto-press Enter?
In terminals and SSH sessions, auto-executing a misheard command is dangerous. Paste-only lets you glance before hitting Enter, and if you switch windows mid-processing, output safely falls back to your clipboard instead of pasting into the wrong window. - Should I choose two-stage (STT + Refiner) or single-hop multimodal?
Two-stage gives the widest provider choice (including 1-keyopenrouteranddeepseektwo-stage), lets you reuse existing Codex/AGY logins for top-tier refinement, and handles long technical dictation most reliably. Single-hop (gemini, DashScopeqwen3.8-omni-flash, or OpenAIgpt-audio-1.5/gpt-audio-mini) is simpler with one request and one key, and sends audio plus session context directly to that single multimodal provider.
CLI Commands & Optional Integrations
agent-voice-input init [--asr P] [--refiner P] [--hotkey K] [--force] # Create ~/.agent-voice-input/ (0600 config.toml & .env + .gitignore)
agent-voice-input start | restart | stop # Manage background daemon (start is idempotent and warns on code/version drift)
agent-voice-input status [--history N] [--json] # Inspect daemon health, active pipeline, Archive: state, hotwords counts, and drift
agent-voice-input doctor [--ping] [--remote] [--json] # Check audio, native shim, credentials, hotwords, hooks, SSH readiness, and endpoint ping
agent-voice-input integrate [--status] [--dry-run] [--cli claude|codex|agy] [--uninstall] [--json] # Safe optional CLI hook setup
agent-voice-input diagnose [--last N] [--json] # Read-only diagnostics: latency p50, cache hits, failed/ count, redacted log tail
agent-voice-input retry [--list] [--print] # List or re-run stashed failed recordings
agent-voice-input hotwords list|add|remove|path # Manage flat personal.txt hotwords, !pinning & <- aliases (--pin, --alias, --json)
agent-voice-input once --duration 4 --dry-run # Record once and print without pasting (or `--file <wav> --dry-run` on Linux)
agent-voice-input toggle | cancel [--seq N] [--json] # Trigger start/stop or cancel active/in-flight jobs
agent-voice-input key-test # Inspect raw key scancodes / modifier events
- AI Agent setup & troubleshooting contract:
docs/agent-setup.md - Optional multi-window hooks & SSH remote Linux (
[remote]): Single-window terminals, Ghostty splits, andtmuxpanes work with zero hooks. For multiple standalone WSL2 windows in the same project directory (useagent-voice-input integrate), or to enable zero-install SSH remote context ([remote] hosts = ["devbox"], verified withagent-voice-input doctor --remote), seeintegrations/README.md(SSH section: SSH Remote Linux Hosts) anddocs/context-routing.md(in Chinese).
Hotwords & Agent-Assisted Vocabulary
Keep your personal names, project brands, and recurring ASR mishearings in a single flat plain-text file—and let Claude Code, Codex, or AGY bootstrap or tidy it for you:
- Unified flat file, starter vocabulary & dotfiles symlink:
~/.agent-voice-input/hotwords/personal.txt(locate viaagent-voice-input hotwords path; hot-reloads automatically; directory-fdflockleaves zero.lockfiles). On your firstagent-voice-input init, creatingpersonal.txtseeds ~18 common AI, Agent, and developer starter terms (visible, editable, and removable; never overwritten even byinit --force; active across bothagentandgeneralmodes). To sync across machines via a dotfiles repo, symlink thehotwords/directory rather thanpersonal.txtitself (single-file symlinks are rejected on read/write;.gitignoreunder~/.agent-voice-input/intentionally does not traverse a symlinkedhotwords/directory):- Before your first
init:mkdir -p ~/.agent-voice-input && ln -s ~/.dotfiles/avi-hotwords ~/.agent-voice-input/hotwords(thenagent-voice-input initkeeps the symlink and preserves any existingpersonal.txtinside it). - After
initalready created a localhotwords/directory: merge or back up~/.agent-voice-input/hotwords/personal.txtinto~/.dotfiles/avi-hotwords/first, remove the local~/.agent-voice-input/hotwordsdirectory, then runln -s ~/.dotfiles/avi-hotwords ~/.agent-voice-input/hotwords(runningln -sfnwhilehotwords/is still a real directory creates a nested link inside it instead of replacing it).
- Before your first
- Pinning (
!) & mishearing aliases (<-): Prefix critical terms with!(!Antigravityoragent-voice-input hotwords add Antigravity --pin) to pin them ahead of all other entries. Add mishearing aliases withCanonicalTerm <- mishearing1, mishearing2oragent-voice-input hotwords add Harness --alias 哈尼斯,哈尼思(max 5 aliases per entry; single-character aliases rejected; 2-character aliases warn; ambiguous aliases shared by multiple terms are hidden automatically while keeping both canonical terms). Stage 1 ASR receives canonical terms only; Stage 2 / single-hop uses aliases to fix stubborn mishearings. - Decoupled Stage 1 & Stage 2 budgets:
- Stage 1 ASR: Orders entries by tier (
!pinned→aliased→plain, preserving file line order within each tier so CJK names are never pushed out by ASCII order). Ingeneralmode, 100% of the provider quota goes to personal terms; inagentmode, at least 30% of slots are reserved for dynamic repo/session terms with unused space refilled from overflow (e.g., DashScope 250 terms / 2,800 chars, Doubao 50 / 1,000, OpenAIkeywords[]50, OpenRouterkeyterms50, Whisper 35 / 353;deepseek-asrrelies on Stage 2). - Stage 2 / Single-Hop Block 0 (
<vocabulary_hints>): Selects and renders up to 200 items / 3,000 chars in priority-tier order (!pinned→ effective<-aliased → plain entries, preserving file top-to-bottom order within each tier) across bothagentandgeneralmodes, so placing high-priority personal/project terms near the top ofpersonal.txtkeeps them inside the budget without A–Z reordering. Inspect live budgets & diagnostics anytime viaagent-voice-input hotwords list [--json].
- Stage 1 ASR: Orders entries by tier (
- Two rules for your Agent: always show the diff and wait for your confirmation before editing
personal.txt, and never guess mishearing aliases up front—only add<-aliases after observing a real ASR mistake.
Copy-paste prompts for your coding agent:
# 1. Bootstrap from scratch (canonical terms only)
Read my recent projects, READMEs, and specs to draft a clean flat list of proper nouns I actually speak aloud for ~/.agent-voice-input/hotwords/personal.txt (use `!` only for top-priority terms). Do not guess mishearing aliases; show me the diff first and write only after I confirm.
# 2. Fix a real mishearing on the spot
Voice input just misheard "Harness" as "哈尼斯". Add a mishearing alias with `agent-voice-input hotwords add Harness --alias 哈尼斯` (show me the change first).
# 3. Periodic cleanup & prioritization
Run `agent-voice-input hotwords list --json`, prune low-frequency or stale entries if we are near Stage 1/2 budgets, pin my highest-frequency cross-project terms with `!`, and show me the diff before applying.
Detailed Reference
Built-in Providers, Verification Matrix & Common config.toml Recipes
Configuration priority: CLI flags > ~/.agent-voice-input/config.toml > built-in defaults (root overridable via AGENT_VOICE_INPUT_HOME). Credentials live in ~/.agent-voice-input/.env (see config.example.env).
provider |
Stages | Verification | Built-in Default asr.model |
Built-in Default refiner.model |
Credential Source / Env |
|---|---|---|---|---|---|
codex |
refiner |
✅ |
— | gpt-6-luna (auto-falls back to gpt-5.4-mini / gpt-5-codex-mini if unavailable on the account) |
Local codex CLI login (stateless HTTP /responses + 30m safe refresh; never enables Fast mode) |
agy |
refiner |
✅ |
— | gemini-3.8-flash (default effort = "low"; explicit opt-in only, never chosen by auto) |
Local agy CLI login (zero-tool agy acp stdio JSON-RPC with incremental session resume) |
deepseek |
asr, refiner |
✅ (both stages) |
deepseek-asr (official POST /v1/tools/asr; asr.api = "auto" only; auto-detects 21 languages, no hotwords/language params) |
deepseek-flash |
DEEPSEEK_API_KEY (compat: API_KEY_DEEPSEEK; 1 key runs full two-stage) |
dashscope |
asr, refiner |
✅ (STT, single-hop & refiner) |
qwen3-asr-flash (or single-hop qwen3.8-omni-flash) |
qwen3.8-flash |
DASHSCOPE_API_KEY (compat: ALI_API_KEY) |
doubao |
asr |
✅ (1.0 & 2.0) |
bigmodel |
— | DOUBAO_SPEECH_API_KEY (single-header X-Api-Key, no APP_ID needed; compat: DOUBAO_ASR_API_KEY or legacy DOUBAO_ASR_APP_ID + DOUBAO_ASR_API_KEY; asr.doubao_resource_id = "auto" prefers sync volc.bigasr.auc_turbo with cached fallback to volc.seedasr.auc / volc.bigasr.auc) |
volcengine |
refiner |
✅ (doctor --ping & refiner) |
— | doubao-seed-2-0-mini-260428 |
ARK_API_KEY (compat: VOLCENGINE_API_KEY, HUOSHAN_API_KEY) |
openrouter |
asr, refiner |
✅ (STT & refiner) |
microsoft/mai-transcribe-2 (~$0.10/hr, native keyterms) |
google/gemini-3.8-flash (default effort = "low") |
OPENROUTER_API_KEY |
gemini |
asr, refiner |
✅ (single-hop & refiner) |
gemini-3.7-flash (single-hop) |
gemini-3.7-flash |
GEMINI_API_KEY |
openai |
asr, refiner |
✅ (STT, single-hop & refiner) |
gpt-transcribe (or single-hop gpt-audio-1.5 / gpt-audio-mini) |
gpt-6-luna |
OPENAI_API_KEY |
groq |
asr, refiner |
🧪 |
whisper-large-v3-turbo |
llama-3.3-70b-versatile |
GROQ_API_KEY |
siliconflow |
asr, refiner |
🧪 |
FunAudioLLM/SenseVoiceSmall |
Qwen/Qwen2.5-7B-Instruct |
SILICONFLOW_API_KEY |
openai-compatible |
asr, refiner |
🧪 |
gpt-4o-mini-transcribe (needs base_url) |
(needs explicit base_url + model) |
api_key_env or OPENAI_API_KEY (loopback URLs need no key) |
off |
refiner |
✅ |
— | (Stage 2 disabled; raw Stage 1 output) | None |
asr.provider = "auto"(default): picks the first configured credential in orderdashscope -> doubao -> deepseek -> openai -> gemini -> groq -> openrouter -> siliconflow.refiner.provider = "auto"(default): prefers localcodexCLI login when present, else picksopenrouter -> deepseek -> dashscope -> gemini -> volcengine -> openai -> groq -> siliconflow, or degrades cleanly to"off". (agyis explicit opt-in only.)
# Recipe 1: Reuse local Codex or AGY CLI login for Stage 2 + fast Stage 1 STT
[asr]
provider = "dashscope" # Or "openrouter" / "doubao" / "openai" / "deepseek"
[refiner]
provider = "codex" # Or "agy" for Antigravity CLI login
# Recipe 2: Single-key two-stage via OpenRouter or DeepSeek (uses built-in defaults)
[asr]
provider = "openrouter" # microsoft/mai-transcribe-2; or "deepseek" (deepseek-asr)
[refiner]
provider = "openrouter" # google/gemini-3.8-flash; or "deepseek" (deepseek-flash)
# Recipe 3: Single-hop multimodal audio + 50K cached session context (skips Stage 2)
[asr]
provider = "gemini" # Or "dashscope" + model = "qwen3.8-omni-flash", or "openai" + model = "gpt-audio-1.5" / "gpt-audio-mini"
Platform Details (WSL2 WASAPI / macOS TCC Permissions & Delivery)
Windows Terminal + WSL2 (Including Remote Desktop & tmux)
- Global Scope, Remote-Desktop Yielding & HiDPI Capsule: Isolated Right Ctrl tap toggles recording across terminals, IDEs, and desktop apps by default (
hotkey.scope = "all", or"coding"/"terminals"; chords likeRControl+Cpass through untouched) with an anti-aliased Per-Monitor V2 HiDPI capsule. Remote desktop / VM clients (mstsc,vmconnect, Parsec, RustDesk, etc.) automatically yield new triggers (yield_remote_desktop = true; baremsrdcstays unblocked for Win11 WSLg—non-WSLg AVD / Windows 365 users can addignore_apps = ["msrdc"]). Even insidetmux, WSL2 delivers viawin_shimtransient clipboard snapshots + per-process paste shortcuts (Ctrl+V,Ctrl+Shift+VforWezTerm/Alacritty/Ghostty/Tabby/Hyper/Rio/Warp/WindTerm/SecureCRT/Termius/Electerm, andShift+Insertformintty/PuTTY/KiTTY/MobaXterm/Xshell) without clobbering existing clipboard contents. - Native WASAPI Capture: Captures 16 kHz audio via Windows WASAPI in a resident
win_shim, avoiding WSLgRDPSourcezero-packet deadlocks; start/stop beeps default to off to avoid RDP audio wake-up lag. - Zero-Config
tmuxPane Resolution: Tracks the active pane of the attachedtmuxclient without editing~/.tmux.conf.
macOS (Ghostty, tmux & Other Terminals)
- Native Retina HUD & Context-Safe Delivery: Uses a cached native
mac_shimcompiled via/usr/bin/swiftcfor Right Ctrl /RCommand/ROption/Fntap orptthold, remote-desktop hotkey yielding (Windows App,Screen Sharing, Parsec, VMware/Parallels, etc.), and Retina capsule rendering. Injects directly in macOS Ghostty and macOStmuxwithout touching your system clipboard; other apps lock onto the origin window ID and paste via nativeCGEventCmd+Vwith clipboard snapshot/restore. - Zero-Hook Tab/Split &
tmuxBinding: Reads Ghostty splittty/cwd,Terminal.app(🧪) selected tabtty,iTerm2(🧪, Automation preflight with PTY fallback), or child PTY trees (plus activetmuxpane) to bindcodex,claude, oragysessions while skipping session lookup in non-terminal GUI apps (including IDE integrated terminals). Audio input defaults to system mic ([audio] macos_device = "default"). - Minimal macOS Permissions (TCC): All TCC permissions are attributed to the terminal app that starts the daemon (restarting from another terminal requires re-granting). Requires Microphone (for
ffmpeg) plus Automation → Ghostty (or Terminal / iTerm2 for exacttty). Input Monitoring is not required for default modifier hotkeys (RControl/RCommand/ROption/Fn). Accessibility is needed for nativeCmd+Vpaste into desktop GUI apps / non-Ghostty terminals outsidetmuxand for reading window titles/session bindings in third-party terminals and desktop apps (not needed inside Ghostty ortmux).
Advanced Configuration Mechanics (Protocols, Caching, Hotwords, Retries & Archiving)
- Provider-first defaults (
model) & HUD locale (ui.language): Leavemodel = ""to use each provider's built-in default; overridingprovidervia CLI without--*-modelresets to the new provider's default. Explicitmodelvalues are passed upstream verbatim.ui.languageaccepts"auto","zh","en", as well as standard BCP 47 tags such as"zh-CN"/"en-US". - Two-stage vs. single-hop (
asr.api,asr.doubao_resource_id):"auto"routes dedicated STT models (qwen3-asr-flash,doubao,deepseek-asr,whisper-*,*-transcribe,SenseVoiceSmall) to Stage 1 + Stage 2, and routes nativegemini, DashScopeqwen*-omni*, official OpenAIgpt-audio-1.5/gpt-audio-mini(or explicitasr.api = "chat-completions"), and multimodal chat-audio models on OpenRouter/OpenAI-compatible to single-hop (sharing the 50K sealed<session_reference_log>prefix blocks, in-memory64 kbpsMP3 compression for>= 3sclips, and610ssingle-chunk cap; skips Stage 2 unlessrefiner.force_on_single_hop = true). DeepSeek official ASR (POST https://api.deepseek.com/v1/tools/asr) supportsasr.api = "auto"only (21-language auto-detection, no hotword/language params). Doubao slot selection usesasr.doubao_resource_id = "auto"(or explicit slot ID) plusasr.doubao_mode. For uncataloged models onopenrouter, setasr.api = "audio-transcriptions"or"chat-completions"explicitly. - Stage 2 protocol & reasoning budget (
refiner.api,effort,session_max_turns):refiner.api = "auto"uses stateless HTTP/responses(store=false,stream=true) forcodexand officialopenai(api.openai.com), localagy acpstdio JSON-RPC foragy, native:generateContentforgemini, and/chat/completionsfor custom third-partyopenaibase_urls and other providers (explicit"responses"/"chat-completions"always overrides).asr.effortandrefiner.effortdefault to""(tool-recommended per-provider default:"low"forcodex/agy/openai/openrouterrefinement,"none"for Stage 1 single-hop audio and all other Stage 2 providers) and accept"default"(omit thinking parameters and defer to upstream defaults) or"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"("none"disables thinking where supported, clamps to the lowest valid level on mandatory-thinking models, and is ignored on non-thinking models). Foragy,refiner.session_max_turns = 0(default) imposes no fixed turn cap and rotates naturally on 200K eviction or vocabulary changes. - Extra instructions, prompt caching & cold-start fallback (
refiner.extra_instructions,include_git_status,context_max_chars,cold_start_fallback): Built-in adaptiveagent/generaldictation-editor prompts stay active by default; append custom preferences safely viarefiner.extra_instructions(list of strings, single string, or multiline string; max 20 items / 2,000 chars; applies to both two-stage and single-hop; empty keeps the default prompt byte-identical). Dialogue up tocontext_max_chars = 200000is evicted in50Ksealed prefix blocks ahead of<workspace_git_status>(falls back to core tracked filenames when clean) and<asr_draft_to_clean>. When a new coding session starts empty/short,cold_start_fallback = "auto"(or"hotwords"/"off") supplements Stage 1 hotwords and prepends one frozen<= 25K<prior_session_reference>block from recent exact-same-directory sessions. - Personal flat hotwords (
hotwords/personal.txt&hotwordsCLI): Edit~/.agent-voice-input/hotwords/personal.txt(seeded with ~18 editable developer starter terms on firstinit) or useagent-voice-input hotwords list|add [--pin] [--alias]|remove|path—hot-reloads automatically on the next dictation with directory-fd locking (zero.lockfiles). Stage 1 applies priority tiers (!pinned>aliased>plain, preserving file order within tiers) with 30% dynamic-term reservation & overflow refill inagentmode (100% personal quota ingeneralmode; DashScope250/2,800, Doubao50/1,000, OpenAI50, OpenRouter50, Whisper35/353), while Stage 2 / single-hop selects and renders up to200 items / 3,000 charsinto Block 0 in the same priority-tier order (!pinned> effective<-aliased > plain, preserving file order within each tier). - Same-provider retries & opt-in local archive (
max_retries,[archive]): Both stages default tomax_retries = 2(0..10) under stagetimeout_secwith a 9s connect/TLS handshake cap, separating429/QPS throttling from transient network/5xx errors. Under[archive](both off by default,0700dirs /0600files, excluded by.gitignore, surfaced as anArchive:row instatus/doctor/start),save_transcripts = trueappends 12-field JSONL records (ASR draft, final text, and flat metadata only—never context/hotwords/secrets) to~/.agent-voice-input/transcripts/YYYY-MM.jsonl, andsave_audio = truearchives voiced clips as16 kHz64 kbpsMP3s to~/.agent-voice-input/audio/<id>.mp3(audio_max_count = 1000,0= unlimited). Transcripts, audio files, anddiag.jsonlshare the same short utterance ID (YYYYMMDD-HHMMSS-<4hex>) for 1:1 correlation.
Runtime CLI Override Flags
| CLI Flag | Description |
|---|---|
--config PATH |
Path to config.toml or config.json (also supports AGENT_VOICE_INPUT_CONFIG and AGENT_VOICE_INPUT_HOME) |
--asr, --asr-provider |
Stage 1 provider (auto, dashscope, doubao, deepseek, openai, gemini, groq, openrouter, siliconflow, openai-compatible; aliases volcengine/volc → doubao, bailian → dashscope) |
--asr-model |
Stage 1 upstream model ID |
--asr-api |
Stage 1 protocol (auto, audio-transcriptions, chat-completions) |
--asr-effort |
Stage 1 thinking budget |
--refiner, --refiner-provider |
Stage 2 provider (auto, codex, agy, deepseek, dashscope, volcengine, openrouter, gemini, openai, groq, siliconflow, openai-compatible, off; aliases doubao/volc/ark → volcengine, bailian → dashscope) |
--refiner-model |
Stage 2 upstream model ID |
--refiner-api |
Stage 2 protocol (auto, chat-completions, responses) |
--refiner-effort, --effort |
Stage 2 thinking budget |
(Environment variables are reserved for API credentials, bootstrap paths AGENT_VOICE_INPUT_HOME / AGENT_VOICE_INPUT_CONFIG / AGENT_VOICE_INPUT_RUNTIME_DIR, and low-level runtime/diagnostic hooks; ordinary options live in config.toml.)
Development
git clone https://github.com/xiaohuaxi/agent-voice-input.git ~/repos/agent-voice-input
ln -sf ~/repos/agent-voice-input/bin/agent-voice-input ~/.local/bin/agent-voice-input
PYTHONPATH=src python3 -m unittest discover -s tests -v
Acknowledgments
Early exploration for this project was inspired by Einstellung/voice-asr, particularly around pairing Qwen3-ASR with technical terminology context for mixed Chinese–English speech, as well as pre-transcription silence gating and loudness normalization.
License
Metadata
Release files for agent-voice-input 0.18.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agent_voice_input-0.18.1.tar.gz | 1.5 MB | With provenance | Details for agent_voice_input-0.18.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agent_voice_input-0.18.1-py3-none-any.whl | Python 3 | none | any | Details for agent_voice_input-0.18.1-py3-none-any.whl |
Total release size: 2.2 MB
Release files / agent_voice_input-0.18.1.tar.gz
| Download URL | agent_voice_input-0.18.1.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b05cdc3e305a0b5268514dee58b373d17a49598ec83de0b162d9cc7e4a90fbd
|
|
BLAKE2b-256 checksum How to use checksums |
d48b023096d97c9233d25acfdc2920fb7132b6b2b90804de3e3f925215bdb155
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / agent_voice_input-0.18.1-py3-none-any.whl
| Download URL | agent_voice_input-0.18.1-py3-none-any.whl |
|---|---|
| Size | 629.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be22ae3a03572845f97557f8a98fbb35c8b8f02fe424ae7e48e60e6bb2e4c7fd
|
|
BLAKE2b-256 checksum How to use checksums |
e948ab2b77ae13460b9c80d5bcf24ec496ce03365b124d65067ba997684e3a9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for agent-voice-input 0.18.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for agent_voice_input-0.18.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.