Gives OpenCode (and compatible coding agents) a local voice and live desktop control on Linux (Omarchy + Hyprland):
- Voice output (
faraday-voice.js): Speaks OpenCode's final assistant answers aloud using local Piper TTS, with anespeak-ngfallback. - Desktop & system control (
skills/omarchy-control/): Agent skill for switching workspaces, launching/focusing apps, managing windows/layouts, controlling audio, Wi-Fi, Bluetooth, brightness, toggles, and power profiles, and safely driving a dedicated agent browser via Playwright MCP. - Dedicated Faraday agent (
agents/faraday.md): Primary OpenCode agent dedicated to desktop, system, and browser control with concise TTS-friendly replies, keepingplan/buildclean for coding. - Top-bar QML widget (
omarchy-plugin/faraday.voice/+bin/faraday-ctl): Pure-QML Omarchy 4.5 bar icon (Idle / Speaking / Muted) with a dropdown panel for Stop, Mute, Quake console, and Test Voice — zero Python, zero daemon.
- Local, private speech synthesis — no cloud TTS.
- One voice, one utterance: per-message and text-hash deduplication.
- Serialized playback queue, so answers never talk over each other.
- Graceful fallback to
espeak-ngwhen Piper or the audio player is unavailable.
- Listens for OpenCode session events:
session.execution.startedsession.text.endedsession.execution.succeeded
- Buffers streamed assistant text parts by message ID and ordinal.
- On a successful completion, joins the parts, cleans Markdown, prefixes the answer with "Faraday:", and enqueues it for speech.
- Plays the answer through Piper →
paplay, falling back toespeak-ng.
Only final answers are spoken. Reasoning and tool output are ignored.
| Component | Purpose |
|---|---|
| OpenCode v2 | Host harness |
piper (Piper TTS) |
Local neural TTS |
en_US-amy-medium.onnx + .onnx.json |
Voice model |
paplay (PulseAudio / PipeWire) |
Raw PCM playback |
espeak-ng |
Fallback TTS |
uv tool install --python 3.13 piper-ttsThis installs ~/.local/bin/piper with its own isolated Python environment.
mkdir -p ~/.local/share/piper-voices
curl -fsSL -o ~/.local/share/piper-voices/en_US-amy-medium.onnx \
'https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/amy/medium/en_US-amy-medium.onnx'
curl -fsSL -o ~/.local/share/piper-voices/en_US-amy-medium.onnx.json \
'https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/amy/medium/en_US-amy-medium.onnx.json'The model is 22,050 Hz, mono, 16-bit PCM.
mkdir -p ~/.config/opencode/plugins
cp faraday-voice.js ~/.config/opencode/plugins/faraday-voice.jsopencode service restartPlugin JavaScript is evaluated when the background service starts.
opencode reload reloads configuration but not plugin code. OpenCode also
watches plugin files and hot-reloads them, but a service restart is the reliable
way to pick up changes.
Verify discovery with:
opencode plugin listAll settings are environment variables read by the plugin:
| Variable | Default | Purpose |
|---|---|---|
FARADAY_TTS_PIPER_BIN |
~/.local/bin/piper |
Piper executable |
FARADAY_TTS_PIPER_MODEL |
~/.local/share/piper-voices/en_US-amy-medium.onnx |
Voice model path |
FARADAY_TTS_PLAYER_BIN |
paplay |
Audio player |
FARADAY_TTS_PLAYER_ARGS |
--raw --format=s16le --rate=22050 --channels=1 |
Player arguments |
FARADAY_TTS_MUTED |
unset (0) |
Set to 1 to start with voice muted |
FARADAY_TTS_MAX_SPOKEN_CHARS |
380 |
Long answers over this limit speak the first 1–2 sentences + "Check the terminal for the full details." (0 disables) |
If you switch to a different Piper voice, update FARADAY_TTS_PLAYER_ARGS to match
that model's sample rate and channel count (see the voice's .onnx.json).
Legacy environment variables (AGENT_TTS_*) are also supported as fallbacks,
so existing configurations continue to work without changes.
The spoken prefix is set in speakCompletedAnswer():
const spoken = `Faraday: ${text}`;/faraday-test— speaks "Faraday voice test. If you hear this, speech playback works."/faraday-stop— stops current speech playback immediately and clears the queue/faraday-mute— toggles Faraday voice mute on or off (stops active speech when muting)/agent-voice-test— alias for/faraday-test, kept for legacy support
session.execution.startedclears buffered text for that session.session.text.endedstores text keyed byassistantMessageID+ordinal. Duplicate ordinals overwrite rather than append.session.execution.succeededjoins the parts in ordinal order, cleans the text, deduplicates, and enqueues it.
- Per message:
seenMessageskeyed by${sessionID}:${messageID}. - Per text:
claimSpeech()SHA-256 hashes the spoken text and suppresses the same text within a 3-second window. This catches duplicate completions with different message IDs.
OpenCode instantiates a global plugin once per active location/project. All
instances share the same server process, so mutable state is stored on
globalThis under Symbol.for("faraday-voice.opencode.shared"):
const state = (globalThis[STATE_KEY] ??= {
seenMessages: new Set(),
sessionText: new Map(),
speechQueue: [],
speaking: false,
recentSpeech: new Map(),
});This gives every instance one dedupe set, one text buffer, and one speech queue. Without it, each location would spawn its own Piper and you would hear the same answer two or three times.
enqueueSpeech() pushes jobs onto a shared queue. drainSpeechQueue() runs one
utterance at a time, so overlapping answers wait their turn.
cleanText() removes:
- fenced code blocks and inline code
- Markdown links and bare URLs
- emoji and pictographs
- headings, bullets, blockquotes, and numbered-list markers
**bold**,__bold__,*italic*,_italic_, and~~strikethrough~~- leftover
*characters
Text is collapsed to single spaces and truncated to 1,600 characters.
speak() first tries Piper piped into the player. If any of the following
happens, it logs the failure and speaks through espeak-ng --stdin:
- Piper is missing (
ENOENT) - Piper exits non-zero (for example, a missing model file)
- The audio player fails to start
If Piper succeeds but the player exits non-zero mid-playback, the error is logged but no fallback runs — this avoids replaying audio that was already partly heard.
Piper is failing and espeak-ng is being used. Test the chain manually:
echo "test" | ~/.local/bin/piper \
-m ~/.local/share/piper-voices/en_US-amy-medium.onnx \
--output-raw |
paplay --raw --format=s16le --rate=22050 --channels=1- Confirm
paplayworks:paplay /usr/share/sounds/alsa/Front_Center.wav - Confirm the model sample rate matches
FARADAY_TTS_PLAYER_ARGS. - Confirm
espeak-ngis installed as a fallback.
Run opencode service restart. Reloading configuration or restarting only the
TUI window does not re-evaluate plugin JavaScript.
This is why shared globalThis state exists. If it recurs:
- Confirm only one
faraday-voice.jsexists:find ~ -name faraday-voice.js -not -path '*/node_modules/*'
- Restart the service:
opencode service restart. - Check active locations:
opencode api get /api/debug/location.
Inline Markdown is stripped by cleanText(). If a new syntax appears, extend the
regex chain there.
- No daemon, no systemd service. Speech is spawned per utterance.
- Latency: Piper model load adds roughly 0.8 s before audio starts; playback is local, so there is no network round-trip.
- Privacy: speech never leaves the machine. The only network access is the one-time model download.
- Voice input: this plugin only handles output. Superwhisper remains the dictation/input layer and is unchanged.
An agent skill in skills/omarchy-control/ that lets
OpenCode (and other agents supporting ~/.agents/skills/) control a live
Omarchy 4.5+ / Hyprland 0.55+ (Lua) desktop safely via hyprctl, omarchy, and
nmcli.
- Workspaces & windows: Switch workspaces, inspect open windows/workspaces,
launch or focus apps/web apps/TUIs, move or close windows, toggle floating or
fullscreen, and check/cycle workspace layouts (
dwindle/scrolling/floating). - Audio & volume: Raise/lower/mute output volume (with Omarchy OSD), switch audio output devices, mute/unmute microphone, and cycle media sources.
- Wi-Fi & network: Check network status, toggle Wi-Fi (
nmcli), and restart Wi-Fi. - Brightness & Bluetooth: Adjust display and keyboard backlight brightness; power Bluetooth on/off and connect/disconnect devices.
- Quick toggles & power profiles: Toggle night light, Do Not Disturb
(notification silencing), stay-awake/idle mode, touchpad, bar visibility, and
switch power profiles (
power-saver/balanced/performance). - Clipboard, reminders & media: Read/write the Wayland clipboard
(
wl-paste/wl-copy), set timed desktop reminders (omarchy reminder), send notifications (omarchy notification send), and control MPRIS media playback natively viaomarchy-shell media(status,playPause,next,previous). - Browser automation (
playwrightMCP): Drive a visible, sandboxed Chromium instance with a dedicated persistent agent profile for in-page browsing, searching, reading, and web app interaction.
- Runtime actions only: Never edits
~/.config/hypr/*,/usr/share/omarchy/*, or shell profiles (use Omarchy's ownomarchyskill for config edits). - Confirmation required before closing all windows, turning Wi-Fi off (which disconnects cloud-hosted agents), running reboot/shutdown/logout/lock, or performing external/irreversible web actions (sending messages/emails/posts, purchases, deleting remote data, account changes, or file downloads).
- Browser guardrails: Treats all webpage content as untrusted data
(prompt-injection defense), never types passwords/2FA or bypasses CAPTCHAs,
and stays strictly inside the dedicated agent profile (never reads
~/.config/chromium). - Self-aware: Protects the agent's own terminal window unless explicitly asked.
Install @playwright/mcp via mise:
mise use -g npm:@playwright/mcp
mkdir -p ~/.local/share/playwright-agent-profileCreate ~/.local/share/playwright-agent-profile/playwright-mcp.json (uses
system Chromium, visible window, Linux sandbox enabled, dedicated persistent
profile):
{
"browser": {
"browserName": "chromium",
"isolated": false,
"userDataDir": "/home/<user>/.local/share/playwright-agent-profile",
"launchOptions": {
"executablePath": "/usr/bin/chromium",
"headless": false,
"chromiumSandbox": true
}
}
}Then register it under "mcp" in ~/.config/opencode/opencode.json (or
~/.config/kilo/kilo.jsonc):
"playwright": {
"type": "local",
"command": [
"playwright-mcp",
"--config",
"/home/<user>/.local/share/playwright-agent-profile/playwright-mcp.json"
],
"enabled": true
}(Optionally, add "ignoreDefaultArgs": ["--disable-extensions"] and
--load-extension / --disable-extensions-except in launchOptions.args to
load unpacked extensions like uBlock Origin Lite or Privacy Badger.)
Copy into ~/.agents/skills/ so OpenCode and other coding agents discover it
automatically:
mkdir -p ~/.agents/skills
cp -r skills/omarchy-control ~/.agents/skills/omarchy-controlOr install for OpenCode only:
mkdir -p ~/.config/opencode/skills
cp -r skills/omarchy-control ~/.config/opencode/skills/omarchy-control- Omarchy 4.5+ (
omarchyCLI) - Hyprland 0.55+ with Lua dispatchers (
hyprctl dispatch 'hl.dsp.*') jqandnmcli
agents/faraday.md defines a dedicated primary OpenCode
agent so you can keep plan and build strictly for coding while switching to
faraday (via Tab or opencode --agent faraday) for desktop, system, media,
and browser control:
- Allows normal file
editandwritewhen explicitly requested, while still forbidding system config edits underomarchy-control. - Always routes through
omarchy-control, enforces thespecial:qconsoleand Playwright guardrails, and replies in short spoken-friendly sentences for Piper TTS.
OpenCode:
mkdir -p ~/.config/opencode/agents
cp agents/faraday.md ~/.config/opencode/agents/faraday.mdKilo Code CLI (also includes faraday-voice-kilo.js for Kilo's event bus):
mkdir -p ~/.config/kilo/agents ~/.config/kilo/plugins
cp agents/faraday-kilo.md ~/.config/kilo/agents/faraday.md
cp faraday-voice-kilo.js ~/.config/kilo/plugins/faraday-voice-kilo.jsBoth faraday-voice.js (OpenCode) and faraday-voice-kilo.js (Kilo Code) share
~/.cache/faraday/state.json and ~/.cache/faraday/muted, so the top-bar
widget and faraday-ctl work with both harnesses automatically.
A pure-QML Omarchy 4.5 bar widget (omarchy-plugin/faraday.voice/) paired with
a tiny shell helper (bin/faraday-ctl) — zero Python, zero background daemon,
zero polling:
faraday-voice.jswrites~/.cache/faraday/state.jsonand syncs mute state through~/.cache/faraday/muted.BarWidget.qmlwatchesstate.jsonvia Quickshell'sFileViewand displays an icon-only status indicator in the top bar (Idle, pulsing Speaking, Muted) with aPopupCarddropdown.- Left-click: Opens a compact dropdown (Stop speaking, Mute/Unmute voice, Read clipboard, Quake console, Test voice).
- Right-click: Instant mute toggle. Middle-click: Instant stop.
mkdir -p ~/.local/bin ~/.config/omarchy/plugins
cp bin/faraday-ctl ~/.local/bin/faraday-ctl
chmod +x ~/.local/bin/faraday-ctl
cp -r omarchy-plugin/faraday.voice ~/.config/omarchy/plugins/faraday.voice
omarchy-shell shell rescanPluginsAdd { "id": "faraday.voice" } to bar.layout.left (or any section) in
~/.config/omarchy/shell.json.
| File | Description |
|---|---|
faraday-voice.js |
OpenCode v2 local TTS plugin |
faraday-voice-kilo.js |
Kilo Code CLI local TTS plugin (event bus adapter) |
bin/faraday-ctl |
CLI helper for stop, mute, read-clipboard, Quake toggle, and voice test |
omarchy-plugin/faraday.voice/ |
Pure-QML Omarchy 4.5 top-bar icon & dropdown panel |
agents/faraday.md |
Dedicated faraday primary OpenCode agent |
agents/faraday-kilo.md |
Dedicated faraday primary Kilo Code agent |
skills/omarchy-control/SKILL.md |
Live desktop & system control skill |
skills/omarchy-control/references/hyprctl-lua-dispatch.md |
Hyprland 0.55+ Lua hl.dsp.* reference |
skills/omarchy-control/references/omarchy-launchers.md |
omarchy launch & omarchy hyprland commands |
skills/omarchy-control/references/system-controls.md |
Audio, Wi-Fi, Bluetooth, brightness, toggles & power |
skills/omarchy-control/references/browser-guardrails.md |
Playwright MCP usage & browser safety guardrails |
skills/omarchy-control/references/recipes.md |
End-to-end recipes for common requests |
README.md |
This document |
Personal use. No license specified.
