Three improvements to the cockpit, all about typing into the right window. Target labels: `target list` now reports what is actually running in each tmux target — pane_current_command and pane_current_path — so the header reads `app:claude.0 claude ~/dais` instead of a bare pane spec. One list-panes -a call (daemon/pane-details) serves every slot and doubles as the liveness answer, which is cheaper than the per-slot pane-exists? calls it replaces (those stay as the tmux-down fallback). Rows are indexed under both the window-NAME and window-INDEX spec forms, because a stored target may use either. A :focus target can't be introspected (no kdotool here), so it stays bare. dais-top elides the cwd middle-first and then drops it, and the command after it, as the header runs out of columns — the ear/armed/live block is never the part pushed off screen. Keyboard lock: dais-top is a single-key control surface, so typing into it by mistake flips real state. `k` ignores every key (each swallowed one is acknowledged in the footer); Ctrl-] or F12 always leaves a lock, and while locked any other key just shows the way out. `K` cycles an idle auto-lock (off -> 15 -> 30 -> 60s, persisted next to the theme file) — off by default, and it never fires while an overlay is open. Passthrough: `p` forwards keys to the active target instead of dropping them, so the window you typed into by accident behaves like the pane you meant. Printable runs go as text, the rest as chords (Enter, Tab, S-Tab, arrows, C-<letter>, M-<char>). It refuses a :focus target and falls back to keylock, re-checking per chunk since voice can move the active slot mid-pass: ydotool types into whatever has focus, which during passthrough is dais-top itself — every key would re-enter its own stdin. New `send` op carries it: raw delivery to the active target, router bypassed, exactly one of text or keys, chords still executor-validated so an unknown one is refused rather than typed. Honors dry-run like any other delivery. Deliberately NOT recorded — an event line per keystroke would turn events/*.jsonl into a keylogger transcript. Also exposed as `dais-ctl send [--keys]`, with zsh completion. executor: the bridge needs unbracketed paste (a single keystroke must look like typing, not a paste per character), so tmux-type-plan takes a bracketed? flag; dictation stays bracketed as one deliberate paste, and text still travels on stdin either way. And a latent bug it turned up: send-keys "S-Tab" exits 0 but delivers a PLAIN Tab — shift-tab is its own tmux key name, BTab. That silently broke shift-tab, which is how Claude Code cycles permission modes. ai/ records the tmux traps (BTab, per-pane info needs list-panes -a, the bracketing, the focus feedback loop); tools/README.md documents the keys.
14 KiB
dais tools
Thin clients for the daemon's control socket
($XDG_RUNTIME_DIR/dais/control.sock, override with $DAIS_SOCKET).
The daemon runs as a systemd --user unit (tools/dais.service, symlinked
into ~/.config/systemd/user/ and enabled): systemctl --user start dais,
logs via journalctl --user -u dais. Running clojure -M:daemon directly is
the foreground/dev path (add --dry-run to plan without executing, --no-ear
to skip the audio worker) — stop the unit first so they don't share a socket.
| Tool | Purpose |
|---|---|
dais-ctl |
Full verb set (node). Status, inject, send, targets, events, replay. |
dais-top |
Live TUI cockpit: mode, mic level meter, heard-list, counters, targets. |
dais-vad |
Toggle the VAD session. Bind to F9. |
dais-rec |
Toggle the manual record latch. Bind to F10. |
dais-esc |
Send Escape to the active target immediately. Bind to F11. |
The three dais-* toggles are plain sh + socat with no PATH/zsh
assumptions, so they work as KDE global shortcuts as-is. State lives in the
daemon — the scripts are stateless one-liners.
Examples
Pipeline smoke test without a microphone (inject feeds a fake transcript
into the router; with --dry-run nothing reaches tmux/ydotool):
tools/dais-ctl status
tools/dais-ctl inject press enter # whole-utterance command
tools/dais-ctl inject choose option two # grammar: fillers + ordinals
tools/dais-ctl inject please review PR 123 # dictation -> type-text, no submit
tools/dais-ctl inject voice off # voice control of the daemon itself
send is the other end of that: no router, no log, straight to the active
target. It exists for dais-top's passthrough lock (below), and is handy for
scripting a pane:
tools/dais-ctl send "npm test" # raw text, verbatim
tools/dais-ctl send --keys Enter # chords: C-c, S-Tab, M-Right, …
Brief a fresh agent session about voice input (delivers a pointer to
BRIEF.md into the target — the agent reads the file itself; --full pastes
the whole text for targets without file access). Then say "press enter":
tools/dais-ctl brief
Real dictation via the latch (speak between the two rec calls):
tools/dais-ctl rec # or press F10
# ... speak ...
tools/dais-ctl rec # stop -> transcribe -> route -> deliver
tools/dais-ctl events 3 # see what happened
Targets (slot 1/2/... are defined in config/dais.edn and adjustable live):
tools/dais-ctl target list
tools/dais-ctl target set 2 app:claude.0 # a tmux pane (window NAMES work too)
tools/dais-ctl target set 1 focus # the focused app (ydotool)
tools/dais-ctl target set 3 current # grab the active tmux pane
tools/dais-ctl target use 2 # switch; or say "target two"
tools/dais-ctl target release 3 # forget slot 3, freeing the digit
tools/dais-ctl target next # cycle to the next slot (= "next target")
tools/dais-ctl target prev # cycle to the previous slot
tools/dais-ctl target next-live # next deliverable slot (skips dead targets)
tools/dais-ctl target panes # all panes, agents ★, slots annotated
tools/dais-ctl target pick [slot] # fzf-pick a pane (default: active slot)
In dais-top, t opens the same picker as an overlay (↑/↓, Enter, then the
slot digit). Picked targets are durable: the daemon persists them to
~/.local/state/dais/targets.edn and they override the config/dais.edn
defaults on restart — delete that file to return to config defaults.
release is the complement: persistence means a slot you picked stays picked
even after its pane dies (which is what you want — dais-driven panes come and
go), so release is how you say you are done with one and hand the digit back
to the picker. In dais-top press x, then the slot digit. It takes a digit
rather than acting on the picker's highlighted row because the usual reason to
release a slot is that its pane is gone — and a gone pane has no row in the
picker. Releasing the active slot moves the active pointer to the next
surviving slot; releasing the last remaining slot is refused (there would
be nothing to deliver to).
Debugging a miss:
tools/dais-ctl events 20 # recent events across the log
tools/dais-ctl replay <trace_id> # full chain for one utterance
jq . "$XDG_RUNTIME_DIR/dais/state.json" # mode/target/last utterance
One-shot command arming (the next utterance must be a command; a miss does nothing instead of being typed):
tools/dais-ctl arm
tools/dais-ctl off # force voice off
tools/dais-ctl shutdown # stop the daemon (cleans up socket/markers)
dais-top
tools/dais-top
Full-screen status cockpit: mode badge (pulsing while recording), a live
mirrored waveform of the mic (green where the VAD heard speech, cyan ambient,
flat gray baseline when quiet) with a Silero speech-probability meter (VAD
mode only — the latch records to a file, so it shows a pulse animation
instead), the active target labelled with what is actually running in it
(app:claude.0 claude ~/dais, cwd middle-elided when the header is tight — a
focus target can't be introspected, so it stays bare), target slots with the
active one highlighted, the last utterances with their outcome — dictation quoted (“…” → typed), interpreted commands
marked » … → Enter in yellow, drops ✗ dropped: … — and today's
counters (listened time, utterances, words, drops, mean ASR latency) seeded
from the event log. A confidence-gated refusal (see :confidence-min-logprob
in config/dais.edn) flashes uncertain — say again? with the heard text in
the footer — repeating is cheaper than undoing garbage.
Control keys: v VAD toggle · r record latch · Esc send Escape ·
1–5 switch target · Tab next live target (skips dead ones) ·
t target picker (tmux panes plus a ⌖ focus row, so a slot can always
be pointed back at the focused app) · x release a slot, then 1–5
(frees the digit; any other key cancels) · a arm · m mute (warm pause) ·
d dry-run toggle · e cycle enter-mode · s cycle router strategy ·
w toggle airc, the Tesla terminal viewer (~/airc; an AIRC badge
shows while broadcasting — it is a public tunnel; DAIS_AIRC overrides
the tool path, absent tool hides it all) · k keylock · p passthrough ·
K idle auto-lock · ? help · q quit.
Keyboard lock — dais-top is a single-key control surface, so typing into it by
mistake flips real state. Two locks make that harmless: k keylock ignores
every key (the footer acknowledges each swallowed one), p passthrough
forwards them to the active target instead, so the window you accidentally
typed into behaves like the pane you meant. Ctrl-] or F12 leaves either
lock; while locked, any other key just shows the way out. Passthrough sends
printable runs as text and translates the rest into chords (Enter, Tab,
Shift-Tab, arrows, C-<letter>, M-<char>, …) over the send op above — no
router, no event log, deliberately not a keylogger. It refuses a focus
target and falls back to keylock: ydotool would type into whichever window has
focus, which is dais-top itself. K cycles an idle auto-lock (off → 15 →
30 → 60 s, persisted next to the theme in ~/.local/state/dais/) for leaving
dais-top up on a second screen; it is off by default and never fires while an
overlay is open.
The footer lists only the frequent keys; press ? for the full
key + voice-command reference — it also lists the unobtrusive cycle keys
(> next / < prev target) and your config commands, pulled live from the
daemon so the list never drifts from config/dais.edn. The e/s toggles
(also dais-ctl set enter-mode|strategy|language ...) are session-only —
a daemon restart returns to the config defaults; calibration knobs (VAD
tuning, idle timeout, confidence floor) stay config-file only on purpose.
Language switching has no dais-top key on purpose: it only makes sense
after swapping config to a multilingual model, so it stays a deliberate
dais-ctl set language act.
Entirely optional: when no dais-top is connected the daemon broadcasts
nothing and the ear skips level computation entirely (the daemon toggles the
meter via set_levels on subscriber transitions) — zero overhead.
Voice commands
Daemon controls — {:control kw} commands, recognized in every router strategy
(unprefixed/unarmed escape hatches). These are built-in default commands; bind
your own phrases to the same actions in config (see Configuring commands):
| Say | Effect |
|---|---|
| "voice off" / "dais off" | stop listening (in-flight latch recording is discarded) |
| "mute" / "unmute" | warm pause: mic stays on but every utterance is dropped until "unmute" |
| "toggle dry run" | flip dry-run: utterances still route and show in dais-top, but nothing reaches the target |
| "next target" | cycle target slot |
| "target two" (one–five, ordinals, digits) | switch slot |
Built-in whole-utterance commands:
| Say | Effect |
|---|---|
| "scratch that" | C-u — clear the input line |
| "cancel" / "stop" | Escape |
| "yes" / "no" | type yes/no + Enter |
Key presses: trigger verb (press/hit/push/choose/select/pick/answer) + keys; fillers (the/a/and/then/option/number/key/button) ignored; max 5 keys. Keys: enter, return, escape, esc, up, down, left, right, tab, backspace, one–nine / first–ninth / digits, control|ctrl + a c d k u w.
"press enter" -> Enter
"choose option two" -> 2
"select the third option" -> 3
"press down and enter" -> Down Enter
"press control a then control k" -> C-a C-k (clear the line)
Every non-filler word must map to a key, or the utterance is dictation —
"select the right abstraction for this" types as text. Everything that isn't
a command is dictation: typed as one line, never submitted (:no-enter; with
:enter-auto a trailing spoken "enter" submits).
Configuring commands
Add your own under config/dais.edn :router :commands — a phrase maps to:
:commands
{"clear" {:keys ["C-u"]} ; press a key / chord
"say hi" {:text "hello" :submit true} ; type text, then Enter
"new terminal" {:keys ["C-M-t"] ; ctrl-alt-t (focus target)
:description "open a terminal"} ; shown in dais-top ?
"shush" {:control :mute}} ; a daemon control (alias)
A {:control kw} entry runs a daemon control instead of delivering to the
target — :voice-off, :next-target, :mute, :unmute, :toggle-dry-run.
The built-in phrases above are just default :control commands, so this is how
you add your own aliases (e.g. "shush" → mute). Control commands are escape
hatches: they work in every strategy, unprefixed and unarmed.
Keypress chords are tmux-style: modifier prefixes C- ctrl, M- alt,
S- shift, s- super, then a base key — letters, digits, Enter Escape
Tab Space BSpace, arrows, Home End PgUp PgDn, F1–F12. The
same chord renders to a tmux send-keys token and to ydotool keycodes, so a
command works on either target (super and WM globals like C-M-t only do
anything on a :focus target). Config commands are trusted, so they may use
the full chord vocabulary; the narrow voice keypress grammar above is
unchanged — speech can never synthesize a M-/C-M- chord.
:description is a one-liner listed under configured in the dais-top ?
help overlay (without it, the overlay shows the synthesized effect).
A :macro runs an ordered list of steps against the active target — each step
is {:text … :submit …}, {:keys […]}, or {:delay ms} (a pause). Top-level
:delay paces between steps; a {:delay ms} step is an explicit wait. Steps
run synchronously and stop at the first failure.
"setup leanheat"
{:description "cd into leanheat-app, new window, launch claude"
:macro [{:text "cd ~/code/lh/leanheat-app" :submit true}
{:text "tn app" :submit true}
{:text "aclaude" :submit true}]
:delay 120} ; ms between steps
"new terminal"
{:description "open a terminal, then maximize (focus target)"
:macro [{:keys ["C-M-t"]}
{:delay 400} ; wait for the window
{:keys ["C-M-Right"]}]}
A macro fires like any command — say its phrase, or dais-ctl inject "<phrase>".
It runs entirely against whichever target is active, so point the right slot
first (tmux pane for typing, focus for window-manager chords).
Statusline integration
$XDG_RUNTIME_DIR/dais/ holds state.json plus marker files meant for
[ -f ... ] checks in a tmux powerline / Claude statusline segment:
[ -f "$XDG_RUNTIME_DIR/dais/mic-recording" ] && echo "🎤"
[ -f "$XDG_RUNTIME_DIR/dais/speech-detected" ] && echo "🗣"
[ -f "$XDG_RUNTIME_DIR/dais/muted" ] && echo "🔇"
[ -f "$XDG_RUNTIME_DIR/dais/dry-run" ] && echo "DRY"
zsh completion
tools/_dais-ctl completes every verb, the target/set sub-actions, and the
enter-mode/strategy/language value sets. Slots (target use|set|pick),
tmux panes (target set), and replay trace ids are read live — slots from the
durable overlay ($DAIS_STATE_DIR, default ~/.local/state/dais/targets.edn)
falling back to config/dais.edn, traces from the event log. Symlink it onto
your $fpath and restart zsh:
ln -s "$PWD/tools/_dais-ctl" ~/.zsh/completion/_dais-ctl # a dir on your $fpath
Keep it in sync with buildRequest() in dais-ctl when verbs change.