Skip to main content

Telegram

Mercury connects to Telegram via a bot token, providing a mobile-first interface with streaming, file uploads, inline approval keyboards, and real-time task progress.

Access Model​

Mercury uses an organization access model with admins and members. The first user becomes the admin by completing a pairing-code flow during setup. Additional users request access by sending /start, which admins can approve or reject.

First-time pairing

When no admins exist yet, sending /start creates a pairing code that must be entered in the CLI to complete setup. This ensures only the legitimate owner can gain initial access. Once an admin exists, new users send /start to create a pending request that admins can approve or reject.

Private chats only

Mercury only works in private (one-to-one) chats. Messages in groups or channels are always ignored.

Roles​

RoleDescriptionCan approve requests?
AdminFirst user to pair. Can approve/reject access requests, promote/demote users, and reset all access.Yes
MemberApproved by an admin. Can send messages and receive responses.No
PendingSent /start but not yet approved. Can only see their pending status.No

CLI Commands​

CommandDescription
mercury telegram listShow approved admins, members, and pending requests
mercury telegram approve <code|userId>Approve the first pairing code or a pending request by user ID
mercury telegram reject <userId>Reject a pending access request
mercury telegram remove <userId>Remove an approved admin or member
mercury telegram promote <userId>Promote a member to admin
mercury telegram demote <userId>Demote an admin to member (at least one admin must remain)
mercury telegram resetClear all Telegram access (admins, members, pending). Start fresh.

Bot Commands Menu​

Mercury registers 15 commands in Telegram's bot menu for quick access:

CommandDescription
/startRequest access to this Mercury instance
/helpShow Telegram-specific command reference
/statusConfig, budget, and uptime
/progressLive status for the current task
/stopStop all agents and clear queue
/budgetToken budget status and management
/streamToggle text streaming on/off
/memorySecond brain memory
/permissionsSwitch Ask Me / Allow All mode
/modelsList providers or switch AI model
/codeProgramming mode (plan / execute / off)
/agentsList and manage sub-agents
/bgBackground tasks
/spotifySpotify playback controls
/unpairReset all Telegram access (admin only)
Telegram-specific help

Running /help on Telegram shows a clean, Telegram-formatted command reference with only Telegram-relevant commands — no CLI-only features like workspace IDE or progress views.

Real-Time Task Progress​

During multi-step tasks, Mercury uses a single status card that updates in place. This keeps the chat clean — you see one message that shows what's happening, not a flood of separate updates.

How It Works​

  1. Step 1 begins — Mercury creates a status card: ⚙️ Mercury working (step 1)
  2. Steps progress — The same message is edited to show the latest steps with checkmarks
  3. Step 3+ (substantial task) — The status card is pinned to the top of the chat so you can always see progress without scrolling
  4. Notices — System messages like Mercury Autopilot warnings are folded into the status card instead of creating separate messages
  5. Task completes — The status card is unpinned and deleted. The AI response and completion banner appear as fresh messages

What the Status Card Looks Like​

⚙️ Mercury working (step 5)

✅ read_file · src/index.ts
✅ edit_file · src/utils.ts
✅ run_command · npm test
✅ read_file · package.json
⏳ write_file · src/config.ts…

Single-Message Design​

During an active task, no new messages are created in the chat. Everything is consolidated into the pinned status card:

  • Tool progress — edited in place with a rolling window of the last 5 completed steps
  • Autopilot warnings — shown as notice lines in the status card (last 3 notices)
  • AI responses — deferred until the task completes, then sent as a clean message
  • Permission prompts — shown as ephemeral inline keyboard messages, deleted after you respond

This means you never have to scroll up to find the progress indicator — it stays pinned at the top until the task is done.

Completion​

When a substantial task finishes (3+ steps and 30+ seconds), Mercury sends a completion banner:

✅ Task complete (8 steps · 45s)
☿ claude-sonnet via anthropic · 12.4k tokens
Budget: ██████████░░░░░ 67% (67.2k / 100.0k)

✓ read_file · src/index.ts
✓ edit_file · src/utils.ts
✓ run_command · npm test

Permission Mode​

At the start of each Telegram session, Mercury shows an inline keyboard to choose a permission mode:

  • 🔒 Ask Me — Mercury asks before file writes, shell commands, and scope changes. Prompts appear as inline keyboards with Allow / Always / Deny buttons.
  • ✅ Allow All — Auto-approve everything for this session. No interruptions.

Use /permissions at any time to switch modes. Choosing "Always" on any permission prompt flips to auto-approve for the rest of the session.

Ephemeral Messages​

Permission prompts, loop-continuation prompts, and mode-selection cards are ephemeral — they're deleted automatically after you respond (or after a 2-minute timeout). This keeps the chat clean.

Features​

FeatureDescription
Single status cardOne message edited in place during multi-step tasks — no message clutter
Pinned progressStatus card pinned to chat top for tasks with 3+ steps
Text streamingReal-time response editing with typing indicators (toggle with /stream)
File uploadsPhotos, audio, video, and documents auto-detected and sent with the right API
HTML formattingMarkdown automatically converted to Telegram-compatible HTML
Inline keyboardsPermission and mode prompts shown as tappable buttons
Ephemeral promptsPermission and mode cards auto-deleted after response
Completion bannersToken usage and budget stats for substantial tasks
Multi-user accessOrganization model with admins and members
Bot commands menu15 commands registered in Telegram's bot menu for quick access

Configuration​

Telegram is set up during mercury doctor or initial onboarding. You need a bot token from @BotFather.

VariableDescriptionDefault
TELEGRAM_BOT_TOKENBot token from @BotFather—
TELEGRAM_ENABLEDEnable/disable Telegram channelfalse
TELEGRAM_STREAMINGEnable real-time text streamingtrue

Type none as the bot token during mercury doctor to disable Telegram.