Responsive Telegram personal assistant:
- fast chat replies
- background Claude Code tasks for heavier work
Prerequisites:
uvinstalledclaudeinstalled and authenticated in your shell- Telegram bot token from @BotFather
Run:
git clone https://github.com/emergentbase/cub.git
cd cub
cp .env.example .envEdit .env and set:
TELEGRAM_BOT_TOKEN=...
ALLOWED_USER_IDS=
FRONT_ASSISTANT_PROVIDER=claude_cli
FRONT_ASSISTANT_MODEL=haikuStart bot:
uv run cub-botThen open Telegram and send:
/helpwhat is 7+5?create a react todo app in workspace/
- Simple questions: quick direct reply.
- Work that needs tools/files/shell: queued task with progress + completion updates.
- You can keep chatting while tasks run.
You: what is 7+7?
Cub: 14
You: add 5 to it
Cub: 19
You: create a chat app like WhatsApp with seed data (full-stack)
Cub: Queued task b709652a (...). I will post progress updates and final result here.
Cub: Task b709652a in progress:
- Planning project structure
- Creating backend + frontend scaffolding
You: add 5 to the previous calc
Cub: 24
Cub: ✅ Task Completed
Summary:
- Full-stack chat app scaffold created
- Seed data setup included
Keep Claude Code for delegated tasks, but use OpenRouter for fast-path chat replies:
FRONT_ASSISTANT_PROVIDER=openrouter
FRONT_ASSISTANT_MODEL=anthropic/claude-3.5-haiku
OPENROUTER_API_KEY=...Notes:
- Delegated tasks still use
CLAUDE_COMMANDandCLAUDE_ARGS. - If fast-path OpenRouter call fails, Cub falls back to delegated execution.
- Keep this as optional mode;
claude_cliremains the default/recommended path.
| Command | Description |
|---|---|
/run <task> |
Queue a delegated Claude task |
/probe [id] [question] |
Probe/resume a task session |
/continue [id] <instruction> |
Continue a task using the same Claude session |
/list |
Show ongoing tasks |
/status [id] |
Show task status |
/tasks |
Show recent tasks |
/cancel [id] [--force] |
Cancel a task |
/killall [--graceful] |
Kill Claude Code processes on the machine |
/mute / /unmute |
Mute/unmute progress updates |
/newsession |
Reset fast assistant chat session |
/remind <task_id> <when> [note] |
Set reminder |
Natural language controls also work:
cancel task, kill task ab12cd34, mute updates, check task ab12cd34,
continue task ab12cd34 add e2e tests.
Use a different Telegram token and CUB_HOME per instance:
# bot A
TELEGRAM_BOT_TOKEN=... CUB_HOME=~/.cub-a uv run cub-bot
# bot B
TELEGRAM_BOT_TOKEN=... CUB_HOME=~/.cub-b uv run cub-botuv run cub-reset --yes- Default target:
CUB_HOME(or~/.cub) - Preview only:
uv run cub-reset --dry-run - Custom home:
uv run cub-reset --home ~/.cub-a --yes
If bot tasks get stuck, you can clean up Claude Code processes directly from shell:
uv run cub-killallGraceful only (TERM, no force kill):
uv run cub-killall --gracefulShutdown tip:
- Press
Ctrl+Cto exit immediately.
TELEGRAM_MAX_CONCURRENT_UPDATES: parallel inbound update handling (default8)CLAUDE_ARGS: defaults to--dangerously-skip-permissions --verbose --output-format stream-jsonWORKSPACE_DIR: where delegated tasks run (defaults to$CUB_HOME/work)FRONT_ASSISTANT_TOOL_MODE:read_only(default forclaude_cli) ornoneFRONT_ASSISTANT_MAX_TURNS: bounds fast assistant turns (default2in read-only mode)
~/.cub/
state/assistant.db
mind/
work/
make setup
make run
make lint
make testArchitecture and extension guide: DEVELOPER_GUIDE.md
MIT