𝗖𝗼𝗱𝗶𝗻𝗴 𝗔𝗴𝗲𝗻𝘁𝘀 𝗼𝘃𝗲𝗿 𝗧𝗲𝗹𝗲𝗴𝗿𝗮𝗺: 𝗙𝗿𝗼𝗺 𝗭𝗲𝗿𝗼 𝘁𝗼 𝗔𝗻 𝗔𝗴𝗲𝗻𝘁 𝗧𝗵𝗮𝘁 𝗔𝗻𝘀𝘄𝗲𝗿𝘀

Stop reading and start doing.

By the end of this guide, you will have a Telegram topic where a coding agent answers your messages. This agent will drive a tmux pane on your own machine.

This is the core goal. You do not need memory, monitors, or tool servers yet. You only need to get the agent to answer you.

⏱️ Time Needed: 30–45 minutes.

🛠️ Prerequisites

Before you start, ensure you have these items ready:

  • A machine with tmux and shell access.
  • A working coding agent (like OpenCode or Claude Code) already running in a tmux pane.
  • The exact tmux target for your agent (example: mybox:1.1).
  • The exact command to launch your agent.
  • The OpenClaw runtime installed.
  • A Telegram account and the Telegram app.

📦 Required Versions

Do not skip these. Wrong versions cause silent failures.

• Node.js: 24.11.1 • Package Manager: pnpm 11.2.2 • OpenClaw: Pin to a specific commit.

🚀 Quick Setup Path

You can use these scripts to handle the local setup:

  1. Download the scripts: curl -fsSL "https://gist.githubusercontent.com/jerilkuriakose/cd0f8353aac74e47c591111b758943e9/raw/setup-openclaw.sh" -o setup-openclaw.sh curl -fsSL "https://gist.githubusercontent.com/jerilkuriakose/7cf94af3e96526f9f14d0c28b6c26b69/raw/ready-check.sh" -o ready-check.sh chmod +x setup-openclaw.sh ready-check.sh

  2. Run the setup with your bot token: OPENCLAW_BOT_TOKEN="" OPENCLAW_BOT_ACCOUNT="my-bot" ./setup-openclaw.sh

  3. Verify the setup: AGENT_ID=my-agent PANE=mybox:1.1 ./ready-check.sh

📱 Telegram Configuration

Follow these steps in your Telegram app:

  • Create a bot via @BotFather and save the token.
  • Create a new group and add your bot.
  • Make the bot an Administrator. This allows it to see your messages.
  • Enable "Topics" in the group settings.
  • Create a topic for your project.
  • Send one message in that topic to generate a Topic ID in your logs.

⚙️ Wiring it Together

The gateway uses a JSON config at ~/.openclaw/openclaw.json.

Use Phase 1 to find your Chat ID and Topic ID by sending a message and checking the gateway logs.

Use Phase 2 to lock the group down. Change the policy to "allowlist" and add only your numeric Telegram User ID. Map your Topic ID to your specific Agent ID.

📝 The Agent Contract

یک فایل AGENTS.md در فضای کاری عامل خود ایجاد کنید. این فایل به عامل می‌گوید که چگونه رفتار کند. شما باید موارد زیر را تعریف کنید:

  • نحوه خواندن پنل (tmux capture-pane).
  • نحوه نوشتن در پنل (tmux send-keys).
  • نحوه مدیریت دستورات خاص مانند "status"، "send" یا "restart".

✅ تست آمادگی

کار شما تنها زمانی تمام می‌شود که این پنج بررسی را پشت سر بگذارید:

  1. ربات در موضوع (topic) تلگرام شما پاسخ می‌دهد.
  2. پرامپت شما به پنل tmux می‌رسد.
  3. عامل کدنویسی کار روی پرامپت را شروع می‌کند.
  4. یک فایل لاگ ثابت می‌کند که عامل موضوع شما را مدیریت کرده است.
  5. گروه فقط برای شناسه کاربری (User ID) شما قفل شده است.

منبع: https://dev.to/jerilk/coding-agents-over-telegram-part-2-from-zero-to-an-agent-that-answers-2777

انجمن یادگیری اختیاری: https://t.me/GyaanSetuAi