Skip to content

Automations 与 Goals

DotCraft 给 Agent 两种"不用你一轮轮盯着也能干活"的方式:

  • Automations — 让 Agent 定时或手动跑起来,报告、巡检、清理这类例行活儿自己就完成了。
  • Goals — 给一段对话钉一个长期目标,每当这段对话空下来,DotCraft 就接着往前推。

DotCraft Automations and Goals overview

DotCraft Goals

Automations

DotCraft 原生 Automations 仅覆盖本地任务。它从当前工作区的 .craft/tasks/ 读取任务文件,按计划或手动触发 Agent,支持线程绑定、模板、重试、活动展示和 CompleteLocalTask 完成路径。

创建本地任务

一个本地任务位于 .craft/tasks/<task-id>/

text
.craft/
  tasks/
    weekly-report/
      task.md
      workflow.md

task.md 描述任务标题、正文、调度和线程绑定;workflow.md 描述 Agent 要执行的工作流提示词。

常用能力

能力说明
手动运行Desktop Automations 面板或 AppServer automation/task/run
定时运行在任务文件中配置 schedule
线程绑定把任务绑定到已有线程,后续运行提交到该线程
模板.craft/automations/templates/ 保存可复用任务模板
完成工具Agent 调用 CompleteLocalTask 写入完成摘要
删除任务删除任务文件夹,可同时删除关联线程

Workflow 模板变量

变量说明
task.id任务 id
task.title任务标题
task.descriptiontask.md 正文
task.thread_id绑定线程 id

AppServer 方法和 Automations 配置字段见 Automations、Goals 与 Hooks

CompleteLocalTask 工具

参数说明
summary简短完成说明

Agent 完成工作后调用,任务记录完成摘要并进入完成路径。

目录结构

text
<workspace>/
  .craft/
    tasks/
      <task-id>/
        task.md
        workflow.md
    automations/
      templates/
        <template-id>/
          template.md

Goals

Goals 是挂在单个 Thread 上的长期目标。用户显式设置目标后,DotCraft 会把目标写入会话核心,后续 Turn 都能看到这个目标;当 Thread 空闲且自动继续开启时,系统可以继续推进目标,直到完成、暂停、清除或触达预算限制。

适合的任务

  • 需要多轮推进的重构、文档整理、迁移或排查任务。
  • 需要用户随时暂停、恢复、替换或清除目标的长期工作。
  • 需要把 token 用量、耗时和完成状态跟 Thread 一起持久化的工作。

生命周期

状态含义
active目标正在生效;Thread 空闲时可自动继续
paused目标保留但不自动继续
budgetLimited达到 token 预算,等待用户处理
completeAgent 审核后标记完成

常用入口

操作入口
设置 / 替换目标Desktop 输入框的 Goal 控件、支持 threadGoals 的客户端、AppServer thread/goal/set
暂停 / 恢复目标Desktop Goal 控件或 AppServer thread/goal/set 更新状态
清除目标Desktop Goal 控件或 AppServer thread/goal/clear
读取目标状态Thread 列表、Thread 详情、AppServer thread/goal/get

Goals 配置字段和 AppServer goal 方法见 Automations、Goals 与 Hooks

Goals × Automations

Automations 适合"按时间或手动触发一次任务",Goals 适合"让同一个 Thread 持续朝一个长期目标推进"。两者可以组合:Automation 负责定时唤醒或提交检查任务,Goal 负责保存这条 Thread 的长期方向和完成状态。

常见场景

场景推荐
周报、日报、定时巡检Automations 定时触发
自动跑测试套件并把摘要写入线程Automations + CompleteLocalTask
持续推进一项重构或文档整理Goals
让定时任务沿着同一长期目标推进Automations + Goals
文件写入后自动 lint/formatHooks AfterToolCall
阻止危险 Shell 命令Hooks BeforeToolCall

相关文档

Apache License 2.0