afk-claude-telegram-bridge

Remote-control Claude Code from Telegram when AFK. Telegram Topics for session routing, message buffer, approve tool calls, no prefix needed.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "afk-claude-telegram-bridge" with this command: npx skills add gmotyl/afk-claude-telegram-bridge-skill/gmotyl-afk-claude-telegram-bridge-skill-afk-claude-telegram-bridge

AFK Claude Telegram Bridge

Remote-control Claude Code sessions from your phone via Telegram when AFK (away from keyboard).

When to Use

  • "set up telegram bridge" / "configure telegram AFK"
  • "enable remote control" / "activate AFK mode"
  • "I want to control Claude from my phone"
  • Installing this skill on a new machine

What This Skill Does

Installs a complete Telegram ↔ Claude Code bridge that allows you to:

  1. Approve/deny tool calls from Telegram inline keyboards
  2. Continue tasks by sending new instructions when Claude finishes
  3. Auto-approve read-only tools (Read, Glob, Grep, WebSearch, WebFetch)
  4. Multi-session support — up to 4 concurrent sessions (S1-S4)
  5. Zero native dependencies — uses Node.js built-in node:sqlite for session state and IPC (no native addons to compile)

Installation

Install via curl (recommended):

curl -fsSL https://raw.githubusercontent.com/gmotyl/afk-claude-telegram-bridge/main/install.sh | bash

Or from a local clone:

git clone https://github.com/gmotyl/afk-claude-telegram-bridge.git
cd afk-claude-telegram-bridge
npm install && npm run deploy

The installer downloads pre-built binaries from GitHub and handles everything:

  • Copies hook.js, bridge.js, cli.js, hook.sh to ~/.claude/hooks/telegram-bridge/
  • Installs /afk, /back, and /afk-reset commands to ~/.claude/commands/
  • Registers Stop, Notification, and PreToolUse hooks in ~/.claude/settings.json
  • Prompts for your bot token and auto-detects your Telegram group

Restart Claude Code after installation to load the new commands.

Prerequisites

Before running the installer, create a Telegram bot:

  1. Open Telegram -> search @BotFather -> send /newbot
  2. Name it "Claude Bridge" (or your preferred name)
  3. Copy the bot token
  4. Create a Telegram Group with Topics enabled
  5. Add the bot to the group as Administrator
  6. Send a message in the group (so the bot can detect it)

Usage

Activate AFK Mode

In any Claude Code session:

/afk

You'll see a confirmation on Telegram: "📡 S1 — AFK Activated"

Deactivate AFK Mode

/back

From Telegram

When Claude needs approval for a tool call, you'll see:

🔐 S1 — Permission Request
Tool: Bash
`npm install express`
[✅ Approve] [❌ Deny]

When Claude finishes a task:

✅ S1 — Task Complete
I've implemented the login form...
[🛑 Let it stop]

Reply with text to send Claude a new instruction!

Multi-Session

With multiple sessions, prefix instructions:

S1: now add unit tests
S2: push to remote

File Structure

After installation:

~/.claude/hooks/telegram-bridge/
  hook.sh        — Bash wrapper (Claude Code calls this)
  hook.js        — Compiled hook entry point (Node.js)
  bridge.js      — Compiled Telegram daemon (Node.js)
  config.json    — Bot token, group ID, settings
  bridge.db      — SQLite database (sessions, events, state)
  active_count   — Marker file for fast bash gate check
  daemon.log     — Daemon log

~/.claude/commands/
  afk.md         — /afk command
  back.md        — /back command
  afk-reset.md   — /afk-reset command

Commands Reference

CommandDescription
hook.sh --activate <session_id> [project]Activate AFK mode
hook.sh --deactivate <session_id>Deactivate AFK mode
hook.sh --resetNuclear reset (kill daemons, clear state)
hook.sh --statusShow active sessions
hook.sh --setupConfigure bot token/chat_id
hook.sh --helpShow help

Troubleshooting

  • Daemon log: cat ~/.claude/hooks/telegram-bridge/daemon.log
  • Status: ~/.claude/hooks/telegram-bridge/hook.sh --status
  • Manual start: node ~/.claude/hooks/telegram-bridge/bridge.js
  • Kill daemon: Check PID in state.json, then kill <pid>

Dependencies

  • Node.js 22.5+ (required for built-in node:sqlite)
  • bash
  • Telegram bot token

How SQLite is Used

The bridge uses SQLite (via Node.js built-in node:sqlite) as its persistence and IPC layer:

  • Session management — tracks active AFK sessions, slot assignments, and Claude Code session bindings
  • Event queue — daemon and hooks communicate through a shared events table (permission requests, stop events, instructions)
  • Permission batching — buffers rapid-fire tool approval requests into single Telegram messages
  • Concurrent access — WAL mode allows the daemon (writer) and hooks (readers) to operate simultaneously without conflicts
  • Crash recovery — daemon reconstructs state from the database on restart

Changelog

See CHANGELOG.md for release history.

Credits

Originally built by Greg Motyl (@gmotyl).

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated
Coding

ai-dating

This skill enables dating and matchmaking workflows. Use it when a user asks to make friends, find a partner, run matchmaking, or provide dating preferences/profile updates. The skill should execute `dating-cli` commands to complete profile setup, task creation/update, match checking, contact reveal, and review.

Archived SourceRecently Updated
Coding

clawhub-rate-limited-publisher

Queue and publish local skills to ClawHub with a strict 5-per-hour cap using the local clawhub CLI and host scheduler.

Archived SourceRecently Updated