Skip to main content

English | 简体中文

agent-voice-input

Context-aware voice input for CLI coding agents (such as Codex, Claude Code, and Antigravity CLI / agy).

Instead of treating terminal dictation like generic chat input, agent-voice-input pairs fast speech recognition with lightweight refinement grounded in your active coding session—fixing homophone identifiers, mixed Chinese–English technical terms, and spoken self-corrections before pasting safely into the terminal.

Early Release (v0.1.0): This project currently provides a foundational setup verified primarily on Windows Terminal + WSL2 (including Remote Desktop). Broader terminal support, deeper tmux integration, native macOS terminal polish, and more flexible Stage 2 model choices are actively in progress.


How It Works

  1. Active Session Context: Locates the foreground agent session (via optional terminal title tags or /proc root-session scanning while ignoring background subagents) and extracts recent dialogue plus git status filenames as context.
  2. Stage 1 — Speech Recognition: Applies a local silence gate (-50 dBFS) and RMS loudness normalization (-20 dBFS), then transcribes audio via cloud ASR (defaults to Alibaba Bailian qwen3-asr-flash; also supports Volcengine Doubao, Gemini, or OpenAI-compatible endpoints).
  3. Stage 2 — Lightweight Context Refinement: Cleans up technical terms and explicit spoken self-corrections against the extracted session context. For now, Stage 2 defaults to invoking a lightweight model through local Codex CLI (codex-luna), and can also be pointed to an OpenAI-compatible API or turned off (off).
  4. Focus-Safe Paste: Shows recording/recognition/refinement stages in a non-activating HUD pill on Windows, verifies terminal focus right before pasting (never auto-pressing Enter), and keeps text in the clipboard only if you switched to another window.
  5. Lightweight Setup: Currently relies only on the Python 3.10+ standard library plus host ffmpeg (and built-in powershell.exe on WSL2), requiring no extra Python packages.

Quick Start

1. Prerequisites

  • Python >= 3.10
  • ffmpeg (sudo apt install ffmpeg on Ubuntu/WSL2)

2. Install

uv tool install agent-voice-input
# Or with pipx / pip:
# pipx install agent-voice-input

For local development from source:

git clone https://github.com/xiaohuaxi/agent-voice-input.git ~/repos/agent-voice-input
mkdir -p ~/.local/bin
ln -s ~/repos/agent-voice-input/bin/agent-voice-input ~/.local/bin/agent-voice-input

3. Configure

Create ~/.config/agent-voice-input/agent-voice-input.env (or export variables in your shell) with at least one Stage 1 ASR key:

mkdir -p ~/.config/agent-voice-input && chmod 700 ~/.config/agent-voice-input
cat > ~/.config/agent-voice-input/agent-voice-input.env <<'EOF'
ALI_API_KEY="<your-dashscope-api-key>"
EOF
chmod 600 ~/.config/agent-voice-input/agent-voice-input.env

Other supported credentials include DOUBAO_ASR_APP_ID + DOUBAO_ASR_API_KEY (Doubao), GEMINI_API_KEY, and OPENAI_API_KEY. To customize hotkeys, ASR models, or Stage 2 refinement (such as running without Codex CLI via refiner.provider = "openai-compatible" or "off"), copy config.example.toml to ~/.config/agent-voice-input/config.toml (also see config.example.env).

4. Verify & Run

# Check audio bridge, credentials, and session detection
agent-voice-input doctor

# Start background daemon (defaults to isolated Right Ctrl tap on WSL2)
agent-voice-input start

# Other common commands
agent-voice-input status
agent-voice-input toggle
agent-voice-input once --duration 4 --dry-run
agent-voice-input stop

Optional: Multi-Window Session Title Hooks

If you run multiple agent windows side by side in the same directory, see integrations/ for optional terminal title hooks for Codex, Claude Code, and Antigravity CLI.


Development

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 biasing for mixed Chinese–English speech, as well as pre-transcription silence gating and loudness normalization.

License

Apache-2.0 License

Metadata

Release files for agent-voice-input 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-voice-input 0.1.0
File Size Uploaded Provenance Actions
agent_voice_input-0.1.0.tar.gz 132.7 kB With provenance Details for agent_voice_input-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-voice-input 0.1.0
File Interpreter ABI Platform Actions
agent_voice_input-0.1.0-py3-none-any.whl Python 3 none any Details for agent_voice_input-0.1.0-py3-none-any.whl

Total release size: 225.4 kB

Release files / agent_voice_input-0.1.0.tar.gz

Download URL agent_voice_input-0.1.0.tar.gz
Size 132.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2a44ea01de471b56338bddd95bcac3917a66e55819b70d84eca0194ebcf5d2d6
BLAKE2b-256 checksum
How to use checksums
e3a6d71c2922b1810597e9578679dc8933b0ec23bd9df528fb872346521407fc
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 14, 2026.

Transparency log

Release files / agent_voice_input-0.1.0-py3-none-any.whl

Download URL agent_voice_input-0.1.0-py3-none-any.whl
Size 92.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9de68d3fa632719e2a60de19d228e8e13be950f4310f0296ad86b7a487ae51d
BLAKE2b-256 checksum
How to use checksums
153528f7dbd006d3e0b35ad072d64af0fac21cb9317b872be8b6eab8c21e51a6
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 14, 2026.

Transparency log

Security for agent-voice-input 0.1.0

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.

Select from 2 files

Attestation for agent_voice_input-0.1.0.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 14, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page