scheduler

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Scheduler Skill

调度器Skill

You can schedule tasks and manage periodic heartbeat checks.
你可以调度任务并管理定期心跳检查。

Cron Jobs (Scheduled Tasks)

Cron Jobs(定时任务)

Use the
alma cron
CLI to manage scheduled tasks.
bash
undefined
使用
alma cron
CLI工具管理定时任务。
bash
undefined

List all jobs

列出所有任务

alma cron list
alma cron list

Add a one-shot reminder (fires once then auto-deletes)

添加一次性提醒(执行后自动删除)

Format: alma cron add <name> <at|every|cron> <schedule> [--mode main|isolated] [--prompt "..."] [--deliver-to CHAT_ID]

格式:alma cron add <名称> <at|every|cron> <调度规则> [--mode main|isolated] [--prompt "..."] [--deliver-to CHAT_ID]

alma cron add "Meeting reminder" at "20m" --mode main --prompt "该开会了"
alma cron add "Meeting reminder" at "20m" --mode main --prompt "该开会了"

Add a recurring task with cron expression

使用cron表达式添加重复任务

alma cron add "AI news digest" cron "0 9 * * *" --mode isolated --prompt "搜索并总结今天最重要的 AI 新闻,用中文,简洁明了" --deliver-to CHAT_ID
alma cron add "AI news digest" cron "0 9 * * *" --mode isolated --prompt "搜索并总结今天最重要的 AI 新闻,用中文,简洁明了" --deliver-to CHAT_ID

Add an interval-based task

添加基于时间间隔的任务

alma cron add "Check emails" every "2h" --mode isolated --prompt "检查有没有重要邮件" --deliver-to CHAT_ID
alma cron add "Check emails" every "2h" --mode isolated --prompt "检查有没有重要邮件" --deliver-to CHAT_ID

Run a job immediately

立即执行某个任务

alma cron run <job-id>
alma cron run <job-id>

View run history

查看任务执行历史

alma cron history <job-id>
alma cron history <job-id>

Enable/disable

启用/禁用任务

alma cron enable <job-id> alma cron disable <job-id>
alma cron enable <job-id> alma cron disable <job-id>

Remove

删除任务

alma cron remove <job-id>
undefined
alma cron remove <job-id>
undefined

Command Format

命令格式

alma cron add <name> <type> <schedule> [options]
  • <type>
    :
    at
    (one-shot),
    every
    (interval),
    cron
    (cron expression)
  • <schedule>
    : depends on type — "20m"/"2026-02-11T09:00:00" for at, "30m"/"2h" for every, "0 9 * * *" for cron
  • --mode main|isolated
    : main injects into existing thread, isolated creates temp thread (default: isolated)
  • --prompt "..."
    : the message/task for the AI to execute
  • --deliver-to CHAT_ID
    : send result to Telegram (use user's chat ID from system context)
  • --thread-id ID
    : which thread to inject into (for main mode)
  • --model MODEL
    : model override for this job
alma cron add <name> <type> <schedule> [options]
  • <type>
    at
    (一次性任务)、
    every
    (间隔任务)、
    cron
    (cron表达式)
  • <schedule>
    :根据类型而定 —
    at
    类型可用"20m"/"2026-02-11T09:00:00",
    every
    类型可用"30m"/"2h",
    cron
    类型可用"0 9 * * *"
  • --mode main|isolated
    :main模式会注入到现有线程,isolated模式会创建临时线程(默认:isolated)
  • --prompt "..."
    :AI需要执行的消息/任务内容
  • --deliver-to CHAT_ID
    :将结果发送到Telegram(从系统上下文获取用户的聊天ID)
  • --thread-id ID
    :要注入的线程ID(仅main模式可用)
  • --model MODEL
    :为该任务指定自定义模型

Heartbeat (Periodic Awareness)

Heartbeat(定期状态感知)

Heartbeat is a periodic check-in where you "wake up" and look for things that need attention.
Heartbeat是一种定期检查机制,用于“唤醒”并查看需要关注的事项。

Managing Heartbeat Config

管理Heartbeat配置

bash
alma heartbeat status        # Check if enabled and current config
alma heartbeat enable        # Enable heartbeat
alma heartbeat disable       # Disable heartbeat
alma heartbeat config --interval 30 --start 8 --end 23 --chat-id CHAT_ID
bash
alma heartbeat status        # 检查是否启用及当前配置
alma heartbeat enable        # 启用Heartbeat
alma heartbeat disable       # 禁用Heartbeat
alma heartbeat config --interval 30 --start 8 --end 23 --chat-id CHAT_ID

Managing HEARTBEAT.md

管理HEARTBEAT.md

The heartbeat reads
HEARTBEAT.md
from the workspace as your checklist. Edit it to change what you check on each heartbeat.
File location:
HEARTBEAT.md
in the active workspace root.
Example:
markdown
undefined
Heartbeat会读取工作区中的
HEARTBEAT.md
作为检查清单。编辑该文件可修改每次心跳检查的内容。
文件位置: 活跃工作区根目录下的
HEARTBEAT.md
示例:
markdown
undefined

Heartbeat Checklist

Heartbeat检查清单

  • 检查有没有未处理的重要消息
  • 如果用户超过 4 小时没互动,打个招呼
  • 每天早上检查一次天气

If nothing needs attention, respond with `HEARTBEAT_OK` (this is suppressed, user won't see it).
  • 检查有没有未处理的重要消息
  • 如果用户超过 4 小时没互动,打个招呼
  • 每天早上检查一次天气

如果没有需要关注的事项,回复`HEARTBEAT_OK`(该回复会被隐藏,用户不会看到)。

When to Use What

场景对应操作

User saysAction
"提醒我20分钟后开会"
alma cron add "开会提醒" at "20m" --prompt "该开会了!" --deliver-to CHAT_ID
"每天早上9点给我总结AI新闻"
alma cron add "AI新闻" cron "0 1 * * *" --mode isolated --prompt "搜索总结今天AI新闻" --deliver-to CHAT_ID
(Note: cron uses UTC, 9am GMT+8 = 1am UTC)
"每小时检查一下邮件"
alma cron add "检查邮件" every "1h" --mode isolated --prompt "检查邮件" --deliver-to CHAT_ID
"别再给我发心跳了"
alma heartbeat disable
"心跳的时候顺便看看天气"Edit HEARTBEAT.md, add weather check item
"取消那个每日新闻任务"
alma cron list
alma cron remove <id>
用户需求执行操作
"提醒我20分钟后开会"
alma cron add "开会提醒" at "20m" --prompt "该开会了!" --deliver-to CHAT_ID
"每天早上9点给我总结AI新闻"
alma cron add "AI新闻" cron "0 1 * * *" --mode isolated --prompt "搜索总结今天AI新闻" --deliver-to CHAT_ID
(注意:cron使用UTC时区,GMT+8的上午9点等于UTC的凌晨1点)
"每小时检查一下邮件"
alma cron add "检查邮件" every "1h" --mode isolated --prompt "检查邮件" --deliver-to CHAT_ID
"别再给我发心跳了"
alma heartbeat disable
"心跳的时候顺便看看天气"编辑HEARTBEAT.md,添加天气检查项
"取消那个每日新闻任务"
alma cron list
alma cron remove <id>

Important

重要注意事项

  • Always get the user's Telegram chat ID from the system prompt context for
    --deliver-to
  • For isolated tasks that should send results to user, ALWAYS include
    --deliver-to
  • Cron expressions use UTC unless otherwise noted — adjust for user's timezone
  • One-shot
    --at
    jobs auto-delete after running
  • 务必从系统提示上下文获取用户的Telegram聊天ID用于
    --deliver-to
    参数
  • 对于需要向用户发送结果的isolated任务,务必添加
    --deliver-to
    参数
  • 除非另有说明,cron表达式使用UTC时区,请根据用户时区调整
  • 一次性的
    --at
    任务在执行后会自动删除