how we accidentally fixed anthropic's telegram plugin
We weren’t trying to fix the plugin. Anthropic’s official one is fine — a thin MCP server, pair a bot, get a reply tool. We use it.
It just assumes you’re at the keyboard.
5dive runs claude agents headless on a VM, paired to a telegram bot, human on a phone. Four things break when the laptop isn’t there. We shipped four hooks and a skill — all MIT, all auto-wired the moment you create a claude agent with --channels=telegram.
1. tmux pickers no one can see
AskUserQuestion and ExitPlanMode render numbered-option pickers in the local terminal. On telegram you wait forever — the agent looks alive in systemctl status, it’s just blocked on a UI that doesn’t exist. Our PreToolUse hook denies both and tells claude to ask in chat instead. Agents that used to deadlock on any decision now make decisions.
2. the transcript-vs-tool-call slip
Claude sometimes writes the answer into the transcript instead of calling reply. The transcript only exists on the server. A Stop hook catches the slip — relays the trailing text, blocks the stop, or sends a diagnostic. Including the nasty variant where claude calls reply with “on it”, does work, then writes the real answer at the end without another tool call.
3. the rate-limit deadlock
Pro and Max rate limits surface as a blocking tmux prompt: wait or switch model. A human picks one. An agent on telegram doesn’t see it. Our StopFailure hook parses the reset epoch, presses “1” for the agent, spawns a detached watcher that wakes the session and pings telegram when it’s back. No SSH.
4. group chats as the team room
5dive agents talk to each other through 5dive agent send and 5dive agent ask — invisible from a DM. If access.json lists a group, a PostToolUse hook mirrors every outbound send into that group. You sit in one room and watch your coder agent hand work to your reviewer. Reads like team Slack, except the team is on your server.
and the skill
Hooks fix what claude does wrong. The skill teaches what claude should do. notify-user lands in the agent’s home directory when channels=telegram — when to ack, when to edit a message vs send a fresh one (so the user’s phone actually buzzes), when to stay quiet.
Plus two things Anthropic forgot to teach claude for headless work: how to switch its own model or effort, and how to restart its own session cleanly. Both matter when nobody’s at the keyboard to do it for you.
None of this was the plan. Four shell hooks and a skill that fell out of running the stock plugin somewhere it wasn’t designed to run.
5dive is open source on github at 5dive-com/5dive — the whole CLI, MIT. Hooks live in hooks/; full breakdown in hooks/README.md.
If you’ve been running claude code paired to telegram from a laptop and wondered why it’s flaky from a phone — this is why, and these are the fixes.