Skills 与 Tasks

Tasks

任务定义、调度与 CLI 操作

Tasks

任务定义存放在 .downcity/task/<taskId>/task.md

想看完整执行链路(状态机、校验规则、run 目录语义、排障):
参考 town taskAgent Plugins Docs / task

最小任务示例

---
title: 每日仓库巡检
when: "0 9 * * 1-5"
description: 运行测试并总结异常
sessionId: telegram-chat-123456
status: enabled
kind: agent
---

请执行任务并把最终输出正文写入 `output.md`,并在 `result.md` 写摘要。

执行结果通知

  • 任务完成后会写入 .downcity/task/<taskId>/<timestamp>/ 产物。
  • 默认会把最终结果正文发送回 sessionId 绑定的 chat。
  • sessionId 仅决定任务结果回到哪个会话,不代表认证身份。

目录结构

.downcity/task/
  <taskId>/
    task.md
    <timestamp>/
      run.json
      output.md
      result.md
      dialogue.md

常用命令

town task list
town task create --title "Daily check" --description "Run tests" --session-id telegram-chat-123 --when "0 9 * * 1-5" --activate
town task run daily-check
town task update daily-check --when "@manual"
town task disable daily-check

状态说明

  • enabled:参与调度
  • paused:保留定义,不调度
  • disabled:禁用

时间口径

  • cron 表达式按运行该 runtime 的本机时区解释。例如本机时区是 Asia/Shanghai 时,0 13 * * * 表示每天北京时间 13
  • time:<ISO8601> 一次性触发必须显式带时区,例如 time:2026-03-08T10:30:00+08:00
  • 代理只会影响基于 IP 的位置推断,不会改变本机时区;如果要改变 cron 口径,请调整运行环境的系统时区或 TZ

调度生效条件

任务调度依赖运行中的 runtime(建议 town agent start)。