agentleFS
xingtu1996xingtu1996/xingtu-skills/skills/automation-resurrection/SKILL.md

automation-resurrection

Skill0 starsChanged 2 months agoMITView on GitHub

从本地历史会话中全量回捞"消失的定时任务"并复现重建。当定时任务看似被删/失联、需要找回历史自动化配置、或迁移工作区后任务空转时使用。触发词:找回定时任务、定时任务回捞、历史自动化恢复、automation 重建、之前那些定时任务呢、定时任务不见了。

The file

Files
SKILL.md

定时任务回捞与复现

找回"消失"的 WorkBuddy 定时任务。核心认知:它们多半没被删,只是指错了路径。

铁律:会话是 SSoT,备份目录不可信

~/.workbuddy/automation-backups/*.json 只是删除瞬间的快照,且往往是早期版本。 只信它 → 复活一堆过时 prompt。最终版必须从会话记录里按 id 归并、取最后一次 update。

工作流

1. 摸底

automation_update list          # 当前在线的(通常只剩 1-2 个)
ls ~/.workbuddy/automation-backups/*.json   # 仅作线索,不当真相

2. 全量扫描历史会话

扫 ~/.workbuddy/projects/**/*.jsonl,抓 automation_update 调用。

⚠️ JSONL 结构不是常见 Anthropic 格式(按常规解析会得到 0 命中,误判"历史上没有"):

  • 文本块 type = output_text(不是 text)
  • 工具调用 type = function_call,参数在 arguments 字符串里 → 需二次 json.loads

3. 归并取最终态

按任务 id(create 时无 id,用 name 兜底)分组,取 _ts 最大的那条。 同一任务常被 update 多次(改名、改 rrule、改 prompt),只留最后一个版本。

4. 处置裁决(四类,不要无脑全建)

类型处置判据
常规周期任务新建依赖脚本存在
当前已在线不动list 里已有
一次性任务排除如"收纳批次""迁移批次",复活会反复搬文件
被升级取代合并旧任务被 update 改名+改频(如周巡检→日巡检),只建新的

5. 路径复测(关键,别跳过)

对每个任务 prompt 里的绝对路径做存在性检查。区分真缺失与模板占位符: YYYY-MM-DD / $(date) / *.jsonl / github/* 这类是占位符,不算故障。

同时验证数据资产规模(素材库卡数、仓数、快照份数),远低于基线 = 跑错目录。

6. 🔴 语境感知路径修正(最易翻车的一步)

把旧路径替换成新路径时,必须先判断语境:

原句「勿使用 /旧路径 等历史残留路径」 全局替换后 → 「勿使用 /新路径」= 禁令调转枪口指向唯一根

规则:匹配点前 45 字符内若出现 勿使用|禁用|禁止|不要使用|避免|残留|旧副本|历史路径 → 原样保留。

替换后必须跑反转校验(应为 0 命中):

re.findall(r'(?:勿使用|禁用|禁止)[^。\n]{0,30}/新根路径(?![\w/])', prompt)

7. 重建 + 复测收尾

  • automation_update create,cwds 统一锚唯一根。
  • 建完再验一遍:依赖脚本是否存活、数据资产规模是否正常。
  • 列出时间表,标注同时段撞车的任务,给错峰建议。

判断"任务为何消失"的三问

  1. cwd 是否指向废弃副本?(最常见——双目录事故,任务照跑但对空壳目录干活,不报错也不产出)
  2. 依赖脚本还在不在?(脚本被清理 = 任务必然空转)
  3. 是不是其实跑过,只是没留痕?(查 automation 的 memory.md 与 outputs 产出文件 mtime)

交付物

产出单文件 HTML 看板(行途蓝 #056DE8,白底离线可开),含: 扫描规模 / 处置决策表(含依据)/ 复测结果 / 24h 节拍表 / 踩坑记录 / 待拍板项。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.