Claude-B
Background Claude Code · Telegram bot · REST API · multi-host orchestration.
Run Claude Code as a daemon, talk to it from your phone, and let a four-stage multi-LLM voice pipeline turn rambling voice notes into structured prompts grounded in your live session context.
Install
curl -fsSL https://cb.danimoya.com | bash
Auto-detects npm or docker. Force with --method docker.
Configure
cb init
Interactive wizard — connects the Telegram bot, configures the voice pipeline, writes ~/.claude-b/.env.
The voice pipeline
Most Telegram-AI bots forward your voice note to one model and play the reply back. Claude-B chains four specialised models per round-trip. The differentiator is the middle stage — a prompt optimiser that reads your raw transcript and the last few turns of the target session, then rewrites the request as something Claude Code can actually execute.
- STT — speech to text Voice note arrives from Telegram (.ogg). Transcribed by your chosen STT provider into raw text. Picks up filler words, mishears domain terms, doesn't know what you're working on.
-
Context gathering
Reads the target session's transcript path (cached from the most recent
Stophook) and pulls the last 3 user + 3 assistant turns, plus the working directory and current status. No turn history? The next stage runs ungrounded. -
Optimiser — transcript to structured prompt
A fast model (default:
claude-haiku-4-5) gets the raw transcript and the session context, with a system prompt instructing it to fix STT errors, drop filler, add specificity from context, and preserve intent without inventing requirements. Output: an actionable prompt for Claude Code. You see it on Telegram with confirm / edit / cancel buttons before it runs. -
Claude Code — execution
The optimised prompt is routed to the right session: a long-running
Claude-B session via the daemon, or a live tmux pane via
tmux send-keys. Claude Code runs as it would in your terminal — tool calls, edits, the lot. - TTS — text to speech When Claude responds, the result is summarised and synthesised into a voice note that plays back in Telegram. You can listen on your commute instead of staring at a transcript.
Each stage's provider is independent — pick what you have keys for, mix and match, and swap any one without touching the others.
API requirements
The voice pipeline needs three things wired up: an STT provider, a prompt-optimiser provider, and a Telegram bot token. TTS reuses the STT provider's account where supported.
| Stage | Provider options | API key env / command | Notes |
|---|---|---|---|
| required Telegram bot | BotFather token | cb --telegram <TOKEN> |
No bot, no voice in/out. Free; create via @BotFather. |
| required STT (speech-in) | OpenAI Whisper · Speechmatics · Deepgram | cb --voice-setup <provider> <KEY> |
Same key handles TTS where the provider supports it (OpenAI, Speechmatics, Deepgram all do). |
| required Optimiser (LLM) | Anthropic direct · OpenRouter | cb --ai-provider anthropic <KEY>cb --ai-provider openrouter <KEY> |
Default model: claude-haiku-4-5 (fast, cheap, accurate enough for prompt rewriting). OpenRouter routes to any model. |
| optional Claude Code execution | Anthropic claude CLI |
ANTHROPIC_API_KEY |
Already configured if claude works in your terminal. Sonnet / Opus per your subscription. |
| optional ffmpeg | system package | apt install ffmpeg |
Required only for TTS (Telegram voice replies). STT-only flows work without it. |
Minimum to be voice-active
# 1. Bot
cb --telegram <BOT_TOKEN_FROM_BOTFATHER>
# 2. Speech-to-text + text-to-speech (one provider, one key)
cb --voice-setup openai sk-proj-...
# 3. Prompt optimiser (Anthropic direct — recommended)
cb --ai-provider anthropic sk-ant-...
# Verify
cb --voice-status
What you get
- Background Claude Code sessions with async, fire-and-forget prompts
- Telegram bot — text and voice in, voice out, inline confirm / edit / cancel
- REST API + WebSocket for programmatic access
- Live tmux pane integration via
send-keys - Multi-host orchestration across machines
Manual install
# npm
npm i -g claude-b
# Docker
docker run -d \
-v ~/.claude-b:/root/.claude-b \
--env-file ~/.claude-b/.env \
ghcr.io/danimoya/claude-b:latest
Pair with a dashboard
Claude-Dashboard is a self-hosted web GUI that surfaces Claude-B's inbox, session transcripts, and live tmux panes — same daemon, browser instead of phone. Both use the recommended single-database tier on HeliosDB-Nano.