Claude任务调度工具

一个基于Claude Code和Telegram的容器化任务调度工具,支持定时任务执行和交互式会话管理。

  • by csabatini
  • Shell
  • 本地部署
  • 更新于
在 GitHub 查看 csabatini/claude-channel-task-scheduler

使用说明

克劳德信道任务调度器

使用交互式Claude Code频道插件(Telegram)与MCP服务器和计划任务的容器化应用程序。

运作原理

容器在配置了Telegram频道插件的情况下运行活动的Claude Code会话,并支持计划任务和MCP服务器。然后,计划任务和交互式频道输入的所有输出都会流回Telegram。

先决条件

  1. 克劳德代码 容器主机上应存在身份验证(~/.claude 和 ~/.claude.json 配置)。
  2. Telegram机器人令牌 从 @植物学家.复制 .env.example 到 .env 并填写 TELEGRAM_BOT_TOKEN.

用法

# Build the image
docker compose build

# Start the container 
# This runs Claude with Telegram channel plugin installed and Telegram bot token passed through
docker compose up -d

在正在运行的容器中附加到Claude Code会话

容器的主要进程是一个交互式的Claude Code会话。在Telegram上首次向机器人发送消息后,在Claude Code中确认配对请求。

# Attach to the running container session
docker compose attach cc-task-scheduler

# Confirm the pair request from Telegram in Claude Code - one time setup
/telegram:access pair <code>

重要提示: 要在不终止会话的情况下分离,请按 Ctrl-P 然后 Ctrl-Q.使用 Ctrl-C 将发送信号情报并终止活动的克劳德会话。

在Claude Code会话中安排任务

# Attach to the running container session 
docker compose attach cc-task-scheduler

# Schedule a task to be messaged over the Telegram channel
/schedule create \
  --cron "0 16 * * 1-5" \
  --prompt "Send an end-of-day market recap for NVDA, SPY, AAPL to Telegram."

建筑