Use this skill to run long work with durable state and deliberate recovery, not like a goldfish.
Core stance
Act as the planner and verifier.
Do not rely on conversational memory for active long-running work.
Persist the working state to disk early and keep it updated.
Prefer this skill when any of these are true:
- - duration will likely exceed a few minutes
- the task has multiple milestones or checkpoints
- the user wants progress reporting without repeated permission prompts
- interruption or reset would be costly
- work may need pause / stop / steer controls
- verification matters before calling the task done
Do not use it for trivial one-shot tasks.
Required baseline
Before substantial execution:
- 1. create a task snapshot with INLINECODE0
- record milestones, done criteria, constraints, execution priority, and next step
- keep updates flowing through the helper scripts instead of hand-editing state where practical
Durable task files live under:
- - INLINECODE1
- INLINECODE2
- INLINECODE3
Required behavior
1. Plan first
Create the durable task before real work starts.
At minimum capture:
- - goal
- done criteria
- constraints
- desired state
- execution priority (
time or tokens) - phase
- milestones
- next step
- reporting cadence
2. Work in bounded slices
Prefer:
- - scan -> checkpoint
- extract -> checkpoint
- execute -> checkpoint
- verify -> checkpoint
Each meaningful slice should end with a progress/event update.
3. Report progress without permission theater
For active long work, send informational progress updates:
- - on milestone completion
- on phase change
- on blocker/retry/pause/stop/completion
- periodically for longer runs
Do not ask for permission to keep going unless the next action is risky, destructive, external, or ambiguous.
4. Respect control state
If the user pauses, stops, or steers the task:
- - record it in durable state/event history
- checkpoint safely
- resume only when the durable state says to
5. Resume deliberately
After interruption or reset:
- - prefer the explicit user-facing recovery move: "continue this"
- use
scripts/task_continue.py to select the most relevant durable task and resume it intelligently - review recent events and verify the last concrete step before any non-trivial follow-through
- use
scripts/task_resume_bootstrap.py for restart analysis when you need to inspect the decision surface directly - use
scripts/task_resume_apply.py only for clearly low-risk follow-through
The intended model is smart resume after reset, not endless ambient scheduler theater.
By default, bootstrap should prefer asking whether to continue after reset/interruption; explicit user intent like "continue this" is what should flip the task back into active execution.
6. Verify before completion
Before marking a task complete:
- - verify outputs or milestone results
- record a verification event
- then update INLINECODE9
Worker-lane model
Use worker lanes only when parallelism is worth the added control surface.
Default roles:
- - main agent = planner/verifier
- worker lanes = bounded workers
When using worker lanes:
- - keep each worker scope narrow
- avoid overlapping write targets unless coordination is explicit
- require structured worker returns
- run dropped-line checks before ending the turn
Read references/subagent-return-protocol.md when using worker lanes.
What to read next
Read only what the current task needs:
- -
references/quickstart.md — minimal end-to-end usage pattern - INLINECODE12 — snapshot/event structure
- INLINECODE13 — how much process the task earns
- INLINECODE14 — worker return rules
Key scripts
Use these directly:
- -
scripts/task_ctl.py — create/update/show/progress/event/control durable tasks - INLINECODE16 — smart user-facing "continue this" recovery after reset/interruption
- INLINECODE17 — analyze resumability after interruption
- INLINECODE18 — apply low-risk resume follow-through
- INLINECODE19 — reconcile pending/idempotent action state
- INLINECODE20 — manage worker-line state and structured returns
- INLINECODE21 — prepare a ready-to-use worker payload
- INLINECODE22 /
scripts/task_ticker.py — render compact status - INLINECODE24 — run optional due status delivery across eligible running tasks
- INLINECODE25 — optional helper to print/install a current-user cron entry for recurring ticks
Attribution discipline
Keep attribution explicit when ideas or adapted structures come from other skills.
If you borrow more than general inspiration, update ATTRIBUTION.md and note it near the relevant file.
技能名称: durable-task-runner
详细描述:
使用此技能运行具有持久状态和审慎恢复的长时间工作,而非像金鱼一样健忘。
核心立场
扮演规划者与验证者的角色。
不要依赖对话记忆来管理活跃的长时间运行任务。
尽早将工作状态持久化到磁盘并保持更新。
在以下任一情况成立时,优先使用此技能:
- - 任务持续时间可能超过几分钟
- 任务包含多个里程碑或检查点
- 用户希望获得进度报告,无需重复权限提示
- 中断或重置的成本较高
- 工作可能需要暂停/停止/引导控制
- 在宣布任务完成前需要进行验证
不要将其用于琐碎的一次性任务。
必要基线
在实质性执行之前:
- 1. 使用 scripts/task_ctl.py create 创建任务快照
- 记录里程碑、完成标准、约束条件、执行优先级和下一步操作
- 尽可能通过辅助脚本保持更新,而非手动编辑状态
持久化任务文件存放于:
- - state/tasks/.json
- state/tasks/.events.jsonl
- state/tasks/.progress.log
必要行为
1. 先规划
在实际工作开始前创建持久化任务。
至少包含:
- - 目标
- 完成标准
- 约束条件
- 期望状态
- 执行优先级(时间 或 令牌数)
- 阶段
- 里程碑
- 下一步操作
- 报告频率
2. 分块工作
优先采用:
- - 扫描 -> 检查点
- 提取 -> 检查点
- 执行 -> 检查点
- 验证 -> 检查点
每个有意义的块应以进度/事件更新结束。
3. 报告进度,无需权限表演
对于活跃的长时间工作,发送信息性进度更新:
- - 里程碑完成时
- 阶段变更时
- 遇到阻碍/重试/暂停/停止/完成时
- 长时间运行期间定期更新
除非下一步操作存在风险、破坏性、涉及外部或模糊不清,否则不要请求继续执行的许可。
4. 尊重控制状态
如果用户暂停、停止或引导任务:
- - 将其记录在持久化状态/事件历史中
- 安全地创建检查点
- 仅在持久化状态允许时恢复执行
5. 审慎恢复
在中断或重置后:
- - 优先采用面向用户的显式恢复操作:继续此任务
- 使用 scripts/taskcontinue.py 选择最相关的持久化任务并智能恢复
- 审查近期事件,并在任何非平凡的后续操作前验证最后一个具体步骤
- 当需要直接检查决策面时,使用 scripts/taskresumebootstrap.py 进行重启分析
- 仅对明确低风险的后续操作使用 scripts/taskresume_apply.py
预期模式是重置后的智能恢复,而非无休止的环境调度表演。
默认情况下,引导程序应优先在重置/中断后询问是否继续;像继续此任务这样的明确用户意图才应将任务切换回活跃执行状态。
6. 完成前验证
在标记任务完成前:
- - 验证输出或里程碑结果
- 记录验证事件
- 然后更新 desired_state=completed
工作通道模型
仅当并行性值得增加控制面时,才使用工作通道。
默认角色:
- - 主代理 = 规划者/验证者
- 工作通道 = 有界工作单元
使用工作通道时:
- - 保持每个工作单元范围狭窄
- 除非协调明确,否则避免重叠写入目标
- 要求结构化的工作单元返回
- 在结束轮次前执行断线检查
使用工作通道时,请阅读 references/subagent-return-protocol.md。
下一步阅读内容
仅阅读当前任务所需的内容:
- - references/quickstart.md — 最小化的端到端使用模式
- references/task-schema.md — 快照/事件结构
- references/control-levels.md — 任务应获得多少流程控制
- references/subagent-return-protocol.md — 工作单元返回规则
关键脚本
直接使用以下脚本:
- - scripts/taskctl.py — 创建/更新/显示/进度/事件/控制持久化任务
- scripts/taskcontinue.py — 面向用户的智能继续此任务恢复(重置/中断后)
- scripts/taskresumebootstrap.py — 分析中断后的可恢复性
- scripts/taskresumeapply.py — 应用低风险的恢复后续操作
- scripts/taskreconcile.py — 协调待处理/幂等操作状态
- scripts/tasksubagentctl.py — 管理工作通道状态和结构化返回
- scripts/tasksubagentrun.py — 准备一个即用型工作单元负载
- scripts/taskreport.py / scripts/taskticker.py — 渲染紧凑状态
- scripts/tasktickall.py — 对符合条件的运行中任务运行可选的状态交付
- scripts/taskinstalltickcron.sh — 可选辅助脚本,用于打印/安装当前用户的定时任务条目以进行定期状态更新
归属规范
当创意或改编结构来自其他技能时,保持明确的归属说明。
如果借用内容超出一般性灵感,请更新 ATTRIBUTION.md 并在相关文件附近注明。