telegram-bot-skill
Your local CLI coding agent, reachable from your pocket: a zero-dependency bridge that turns any headless agent into a private Telegram bot.
What this is
A bridge, not an agent. Telegram messages go in, your local agent's answers come out, and every security decision on the way happens in deterministic code before any model sees a byte. It speaks the official Bot API directly over Node's built-in fetch: no framework, no wrapper, an empty dependency tree.
One repo, three surfaces: an installable skill (an open SKILL.md any CLI agent can follow), the npm toolkit behind it (the setup / users / daemon tooling the skill drives), and an MCP server, stdio or Streamable HTTP, that makes your live session the agent that answers. All of it is tested against a local LLM, not just cloud models.
It exists to fix the three things that make agent-over-chat setups painful:
- You never know if the bot is alive. Here the typing indicator stays lit while the agent works, one status message tracks progress ("🔧 Bash: npm test"), the answer arrives separately, and every run ends in an explicit ✅ / ⚠️ / ⏱.
- Strangers are all-or-nothing. Here unknown users land in a pending queue, you get Approve / Guest / Block buttons, and everyone lives in a tier: owner, trusted, guest, blocked.
- "The prompt says no" is not security. Tiers map to the agent harness's own config (permission rules, hooks), so a denied tool stays denied no matter what a chat user talks the model into. Adapters that cannot enforce this honestly declare it, and the bridge refuses to route non-owner traffic through them.
A pannable blueprint of the whole pipeline: every module, its in/out contract, its status, and a link into its source, on one screen.
Run it
Requires Node >= 22.18 and, for the default adapter, the claude CLI. There is no install step.
git clone https://github.com/hec-ovi/telegram-bot-skill
cd telegram-bot-skill
TELEGRAM_BOT_TOKEN=123456789:AAE... npm run setup # once: validates + writes ./.env (mode 600)
npm start # forever after: no arguments needed
Prefer not to have the token in your shell history either? cp .env.example .env, paste it into the file, and run npm run setup with no arguments; it validates and completes the file. npm start always reads ./.env on its own, so a configured checkout is plug and play after any reboot.
First start prints a one-time claim link (https://t.me/yourbot?start=...) plus a QR code of it, right in the terminal (our own zero-dep encoder). Scan it, tap Start, and you are the owner. Everyone else who messages the bot waits at the gate until you tap a button.
| Env var | Required | Default | What |
|---|
TELEGRAM_BOT_TOKEN | yes | | Bot token from @BotFather |
STATE_FILE | no | ./bot-state.json | Users, tiers, sessions, poll offset |
AGENT_CWD | no | current dir | Directory the agent works in |
AGENT_ADAPTER | no | claude-code | Which agent answers: claude-code or pi |
PI_MODEL | no | | Pi model ref, e.g. local/gemma-4-26b |
OWNER_ID | no | | Recover mode: comma-separated ids seeded as owner at boot (more than one means co-owners) |
TRUSTED_IDS / GUEST_IDS / BLOCKED_IDS | no | | Recover mode: comma-separated ids seeded into tiers |
BOT_NAME / BOT_DESCRIPTION / BOT_ABOUT | no | | Bot identity, applied by npm run setup (avatar stays BotFather-only) |