agentleFS
tomc98tomc98/speak/CLAUDE.md

speak

CLAUDE.md1 starsChanged 4 months agoMITView on GitHub

ElevenLabs V3 TTS skill for Claude Code. Agents speak aloud via a shared audio queue backed by an HTTP daemon. Set in .env (copy from .env.example) or export in shell: Streaming engine: SPEAK_PORT, SPEAK_PREROLL_MS, SPEAK_RESUME_REWIND_MS and SPEAK_COLLECTOR_WORKERS are parsed with int() at import — an empty value (not an absent one) crashes the daemon at startup. unset them rather than setting them blank. V3 tags in brackets direct voice acting — they're stage directions, not sound effects. Works: emotions ([deadpan],…

  • Reads credentials
  • In this repositoryOne other file it gives its agents.

The file

We split this CLAUDE.md into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    No external deps in say.sh/speak.py — stdlib + curl/afplay/python3 only.

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

ElevenLabs V3 TTS skill for Claude Code. Agents speak aloud via a shared audio queue backed by an HTTP daemon.

Running

# Start the daemon (requires uv)
uv run daemon/server.py

# Speak (daemon must be running)
scripts/say.sh "Hello"
scripts/say.sh "Hello" --voice Adam --channel my-agent

# Standalone fallback (no daemon)
python3 scripts/speak.py "Hello" --voice VOICE_ID --sync

Environment

Set in .env (copy from .env.example) or export in shell:

  • ELEVENLABS_API_KEY — Required for TTS
  • ELEVENLABS_VOICE_ID — Default voice ID (optional)
  • SPEAK_PORT — HTTP port (default: 7865)
  • SPEAK_CACHE_DIR — Audio cache directory (default: ./cache)

Streaming engine:

  • SPEAK_STREAMING — 0 disables streaming entirely and restores the legacy fetch-then-play path (kill switch; default 1)
  • SPEAK_MODEL — boot-default ElevenLabs model id for single-voice synthesis (default: eleven_v3). Runtime precedence is config.json > SPEAK_MODEL > eleven_v3, and every source is validated so the advertised model is always one the hop chain routes; the UIs flip it through GET/POST /config, which persists to the gitignored config.json. Under SPEAK_STREAMING=0 the conversational model is refused with 409 — the legacy path can only synthesize eleven_v3.
  • SPEAK_PREROLL_MS — audio decoded before live playback starts (default: 500)
  • SPEAK_RESUME_REWIND_MS — rewind applied on resume so a pause replays rather than skips (default: 1000)
  • SPEAK_LIVE_PLAYER — auto | ffplay | audiotoolbox (default: auto, probed at startup)
  • SPEAK_COLLECTOR_WORKERS — concurrent streaming fetches (default: 8)

SPEAK_PORT, SPEAK_PREROLL_MS, SPEAK_RESUME_REWIND_MS and SPEAK_COLLECTOR_WORKERS are parsed with int() at import — an empty value (not an absent one) crashes the daemon at startup. unset them rather than setting them blank.

Architecture

  1. scripts/say.sh — Bash CLI. Parses args, POSTs to daemon. Falls back to speak.py if daemon is down.
  2. daemon/server.py — Starlette+Uvicorn HTTP server (PEP 723 inline deps). TTS via ElevenLabs API, audio queue with afplay, caching, SSE, dashboard. All queue logic lives here.
  3. scripts/speak.py — Standalone fallback. Calls API directly, plays via afplay, falls back to macOS say. No queue.
  4. dashboard/index.html — Single-file web app. Connects via SSE (/events). Portraits in dashboard/portraits/ have three frames per voice for lip-sync.
  5. voices.json — Voice name/ID/color mappings. Loaded by server and dashboard.
  6. cache/ — MP3s keyed by history ID for replay. Auto-cleaned after 24h.

Audio Tags

V3 tags in brackets direct voice acting — they're stage directions, not sound effects.

Works: emotions ([deadpan], [conspiratorial]), intensity shifts ([slowly, building intensity] → [suddenly shouting]), character voices ([old timey radio announcer]), singing ([singing softly]), theatrical asides, compound directions ([whispering, conspiratorial]).

Doesn't work: sound effects ([car driving by]), physical states ([out of breath]), volume control ([even quieter]).

Key Design Decisions

  • No external deps in say.sh/speak.py — stdlib + curl/afplay/python3 only. Daemon uses starlette+uvicorn via uv run.
  • macOS-only — afinfo for duration, ffmpeg for seeking. Playback has two modes: file mode plays a finished file with afplay; live mode pipes still-arriving audio to ffplay (fallback audiotoolbox, i.e. ffmpeg -f audiotoolbox) so speech starts before synthesis finishes. The worker picks per entry at the head of the queue.
  • Single shared queue — all agents enqueue to one AudioQueue. Channel-based filtering prevents overlap.
  • SSE, not WebSocket — simpler. Initial state on connect, then incremental events.
  • MP3 validation with auto-retry — _fetch_tts and _fetch_dialogue validate response headers and retry up to 2 times on invalid audio.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.