每个工作日上午 9 点,给我发一个今日工作计划当有会话被标记为"紧急"时,帮我分析情况并总结需要关注的事项每个星期五下午 5 点,汇总本周完成的任务~/.anakin/workspaces/{workspaceId}/automations.json{
"version": 2,
"automations": {
"SchedulerTick": [...],
"LabelAdd": [...],
"SessionStatusChange": [...]
}
}| 事件 | 触发时机 |
|---|---|
SchedulerTick | 定时触发(通过 cron 表达式配置) |
LabelAdd | 给会话添加标签时 |
LabelRemove | 从会话移除标签时 |
FlagChange | 会话标记(星标)状态变更时 |
SessionStatusChange | 会话状态变更时(如从"进行中"改为"完成") |
PermissionModeChange | 权限模式切换时 |
LabelConfigChange | 标签配置变更时 |
| 事件 | 触发时机 |
|---|---|
PreToolUse | AI 调用工具之前 |
PostToolUse | AI 调用工具之后 |
PostToolUseFailure | AI 工具调用失败时 |
SessionStart | 会话开始时 |
SessionEnd | 会话结束时 |
UserPromptSubmit | 用户发送消息时 |
Notification | AI 发出通知时 |
{
"automations": {
"SchedulerTick": [
{
"cron": "0 9 * * 1-5",
"timezone": "Asia/Shanghai",
"labels": ["定时任务"],
"actions": [
{
"type": "prompt",
"prompt": "帮我生成今天的工作计划摘要"
}
]
}
]
}
}分钟 小时 日期 月份 星期| 示例 | 说明 |
|---|---|
0 9 * * 1-5 | 工作日每天上午 9 点 |
0 17 * * 5 | 每个星期五下午 5 点 |
0 8 * * * | 每天上午 8 点 |
0 0 1 * * | 每月 1 号零点 |
*/30 * * * * | 每 30 分钟 |
{
"automations": {
"LabelAdd": [
{
"matcher": "^紧急$",
"actions": [
{
"type": "prompt",
"prompt": "这个会话被标记为紧急。请分析情况,总结需要立即处理的事项。"
}
]
}
]
}
}matcher 是正则表达式,匹配被添加的标签名称。{
"automations": {
"SessionStatusChange": [
{
"matcher": "done",
"actions": [
{
"type": "prompt",
"prompt": "会话已完成,帮我写一个简短的总结备忘录"
}
]
}
]
}
}{
"type": "prompt",
"prompt": "你的提示内容,支持 @数据源 和 @技能 引用",
"llmConnection": "minimax-main",
"model": "MiniMax-M2.5",
"permissionMode": "ask"
}| 参数 | 说明 |
|---|---|
type | 动作类型,目前只支持 "prompt" |
prompt | 发送给 AI 的提示内容 |
llmConnection | 使用的 AI 连接(可选,默认使用工作区默认) |
model | 使用的模型 ID(可选) |
permissionMode | 会话的权限模式(safe、ask、allow-all) |
| 变量 | 值 |
|---|---|
$CRAFT_LABEL | 触发事件的标签名称 |
$CRAFT_SESSION_ID | 当前会话 ID |
enabled 字段,可以暂时禁用而不删除配 置:{
"automations": {
"SchedulerTick": [
{
"name": "每日报告",
"cron": "0 9 * * 1-5",
"enabled": false,
"actions": [...]
}
]
}
}@技能名 引用技能,让自动化任务遵循你的工作规范labels 字段为自动化创建的会话打上特定标签,方便筛选permissionMode: "safe" 更安全timezone,避免因服务器时区不同导致时间错误