取消任务
SkillProductivityCancel and transfer a task that is no longer needed. Use when a task is no longer needed and should be removed from active work. This skill may only be invoked automatically when the conversation contains a resolvable task reference.
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; ahel provides instructions and does not run this skill.
Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
Then ask your AI: use the 取消任务 skill
What this skill tells your AI
The instructions your AI receives, as published by fitlab-ai/agent-infra in .agents/skills/cancel-task/SKILL.md and read by ahel’s review.
--agent取值见.agents/rules/task-management.md「合作者 token 规范」。
行为边界 / 关键规则
- 本命令用于终止一个不再需要继续执行的任务,并转移到
completed/ - 只有在确认该任务无需继续实现、审查或修复时才可取消
- 有效
platform_issue_identity存在时,Issue 同步属于必做项
版本戳规则:创建或更新 task.md frontmatter 时,先读取 .agents/rules/version-stamp.md,并写入或刷新 agent_infra_version。
任务上下文解析
入口可省略 task ref;显式 task scope 仅接受
--task <ref>或-t <ref>,不再解释位置 task ref。保留其余业务操作数后调用agent-infra-internal task-context resolve {task-scope};{task-scope}为空或 task flag 之一。只读取结构化结果的taskId,后续把{task-id}绑定为完整TASK-YYYYMMDD-HHMMSS。解析失败时透传非零退出码,不自行扫描任务。
解析任务引用,并确认任务位于本技能支持的状态或目录且存在
task.md;无法定位时按未找到任务处理并停止。
步骤开始:本地生命周期边界
确认前置条件后,由步骤 3 的单次 lifecycle intent 原子完成基础元数据、started/done 日志、目录转移和短号处理;不得提前手工写入局部状态。
执行步骤
1. 验证任务存在
依次检查以下目录:
.agents/workspace/active/{task-id}/.agents/workspace/blocked/{task-id}/.agents/workspace/completed/{task-id}/
处理规则:
- 如果在
active/或blocked/中找到:继续 - 如果只在
completed/中找到且cancelled_at与cancel_reason有效:复用已记录的取消原因,跳过步骤 3-5,继续步骤 6 补齐 Issue 关闭与评论;其他 completed 任务停止 - 如果都不存在:提示
Task {task-id} not found
2. 判断取消标签
从 completed 任务重试时,只使用 task.md 已记录的 cancel_reason,不得采用本次输入改写取消原因。
根据取消原因推断 Issue 关闭标签:
status: superseded:原因包含“重复”、“替代”、“合并到”、“已由 #123 / PR 替代”等语义status: invalid:原因包含“误报”、“不存在”、“无法复现”、“排查后无问题”等语义status: declined:原因包含“不做”、“暂不实现”、“优先级调整”、“方案否决”等语义- 以上都不匹配:回退到
status: declined
后续同步到 Issue 时,使用最终推断结果替换现有 status: labels。
3. 执行本地生命周期意图
agent-infra-internal task-lifecycle {task-id} cancel --agent {standard-agent-token} --reason "{一行取消原因}"
仅 status=applied|no-op 视为本地取消完成。status=failed 时展示结构化 error 与 recovery steps,并以同一 intent 重试;不得手工编辑 task.md、移动目录或释放短号。
4. 验证本地终态
确认 targetState=completed、终态字段与短号效果符合结构化结果。
5. 验证转移
ls .agents/workspace/completed/{task-id}/task.md
确认任务目录已成功移动。
6. 同步到 Issue
检查 task.md 中是否存在有效的 platform_issue_identity。如果没有,跳过此步骤。
如果存在有效的 platform_issue_identity,以下操作均须取得 applied / no-op 且无错误后才能宣称取消全部完成;失败时保留本地终态和待恢复记录,修复后以同一任务重试本技能:
- 调用
agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status {reason} --in-labels none --assignees none --milestone none --state closed --close-reason not_planned - 将取消正文写入临时文件,调用
agent-infra-internal platform-comment sync {task-id} --kind cancel --body-file {path} --agent {standard-agent-token} - 调用
agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}
取消评论至少包含:
- 取消原因
- 选定的
status:label
7. 完成校验
运行完成校验,确认任务转移和同步状态符合规范:
agent-infra-internal task-verify {task-id} cancel-task.completed --format text
处理结果:
- 退出码 0(全部通过)-> 继续到「告知用户」步骤
- 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
- 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
按 .agents/rules/validation-output.md 展示当次校验摘要;没有当次校验输出,不得声明完成。
8. 告知用户
仅在校验通过后执行本步骤。
渲染下一步前先读取
.agents/rules/next-step-output.md,仅为已选场景调用统一 helper,并将 stdout 填入{next-step-commands}。
可选沙箱清理提示(门控渲染):仅当同时满足 (1)
.agents/.airc.json存在sandbox字段、(2) task.md 的branch字段存在且不是main/master时,才渲染下方输出中「目标路径」之后、「下一步」之前的「可选:清理本任务的沙箱」块;任一不满足则整段省略。清理时使用完整{task-id},不要改用 branch 名。该块独立于「下一步」语义。
输出格式:
使用 agent-infra-internal agent-client next-steps --skill check-task --task-ref {task-ref} 生成本场景的 {next-step-commands}。
任务 {task-id} 已取消,任务目录已转移到 completed/。
取消原因:{reason}
状态标签:{status-label 或 skipped}
目标路径:.agents/workspace/completed/{task-id}/
可选:清理本任务的沙箱
(任务已完成并归档,沙箱容器和 per-branch 配置目录不会自动回收。如果不再需要可执行:)
ai sandbox rm {task-id}
下一步 - 查看已转移任务:
{next-step-commands}
完成检查清单
- 已记录取消原因并更新 task.md
- 已将任务目录移动到
.agents/workspace/completed/ - 已在存在 Issue 时完成 Issue 同步
- 已运行 gate 校验并通过
- 已通过统一 helper 渲染已选场景的下一步命令
注意事项
- 取消任务不会新增
cancelled状态值,而是复用completed - 必须通过
cancelled_at和cancel_reason区分“取消”与“正常完成” - 如果 Issue 关闭失败,不要宣称取消完成
错误处理
- 任务未找到:
Task {task-id} not found - 任务已转移:提示任务已在
completed/中 - Issue 同步失败:保留本地转移结果,并告知用户需要人工补齐平台操作
Advanced
- Item type
- skill
- Key
cancel-task- Source
- github.com/fitlab-ai/agent-infra
github.com/fitlab-ai/agent-infra
More in Productivity
Skill · larksuite
More in Productivitytwitter-automation
Skill · 101-skills
More in Productivitywriting-plans
Skill · obra
More in Productivityopentui
Skill · msmps
More in Productivityenergy-procurement
Skill · affaan-m
More in Productivityhomelab-pihole-dns
Skill · affaan-m
More in Productivity