A Telegram bot powered by the pi coding agent — any AI model (Claude, GPT, Gemini) with tools, streaming, and persistent sessions per chat.
- 🤖 Full pi agent (Claude) with all installed tools active
- 💬 One persistent session per Telegram chat (survives restarts)
- ⚡ Live streaming — bot message updates as Claude thinks
- 🗜️
/compactto compress long conversations - 🔄
/newto start fresh - 🛑
/abortto cancel a running task - 🔒 Optional allowlist via
ALLOWED_CHAT_IDS
- Message @BotFather on Telegram
- Send
/newbotand follow the prompts - Copy the token
cp .env.example .envEdit .env:
TELEGRAM_BOT_TOKEN=your_bot_token_here
ANTHROPIC_API_KEY=sk-ant-your-key-here
# Optional: restrict to specific chat IDs
# Get yours by messaging @userinfobot on Telegram
ALLOWED_CHAT_IDS=123456789npm install# Development (auto-restart on change)
npm run dev
# Production
npm start| Command | Description |
|---|---|
/start |
Introduction and help |
/new |
Start a fresh conversation |
/compact |
Compress the conversation history |
/abort |
Cancel the current task |
/status |
Show session info (model, message count) |
Each Telegram chat gets its own persistent pi session stored in:
~/pi-telegram-bot/sessions/<chat_id>/
Sessions survive bot restarts and pick up where they left off.
All tools are loaded from ~/.pi/agent/settings.json and activate automatically:
| Package | What it does |
|---|---|
pi-interactive-shell |
Control interactive CLIs in an overlay |
pi-design-deck |
Visual design deck with multi-slide previews |
pi-mcp-adapter |
Token-efficient MCP adapter |
pi-interview |
Interactive forms and user input |
pi-web-access |
Web search and content extraction |
pi-subagents |
Async subagent delegation |
pi-messenger |
Multi-agent communication |
pi-review-loop |
Automated code review loop |
pi-annotate |
Visual browser feedback |
pi-model-switch |
Agent-driven model switching |
pi-rewind-hook |
Rewind file changes |
pi-powerline-footer |
Powerline status bar |
pi-prompt-template-model |
Model frontmatter in prompt templates |
pi-skill-palette |
VS Code-style skill selector |
surf-cli |
Agent-controlled Chrome browser |
visual-explainer |
Rich HTML visual explanations |
pi-foreground-chains |
Multi-agent workflow orchestration |
npm install -g pm2
pm2 start "npm start" --name pi-bot
pm2 saveFROM node:22-alpine
WORKDIR /app
COPY package*.json .
RUN npm ci
COPY . .
CMD ["npm", "start"]docker build -t pi-telegram-bot .
docker run -d --env-file .env pi-telegram-bot