dag-library
它能做什么
这个工具可以让你把一个任务“图”(也就是 DAG)的定义保存下来,之后反复使用。你不用每次都重新描述这个图,只要用一个名字保存它,然后通过这个名字来运行即可。
适用场景
- ✓当你想保存一个任务图以便重复使用时。
- ✓当你需要多次运行同一个任务图时。
- ✓当你想定时重复执行一个复杂的工作流程时。
技能链接
https://github.com/code-yeongyu/oh-my-openagent/blob/dev/packages/omo-senpi/skills/dag-library/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“把这个任务图保存为“monthly-audit”,然后运行它。”
每周 5 个新技能,1 分钟读完。
工作原理
你把任务图的定义保存在一个特定文件中。之后,你可以让 AI 用你取的名字来运行这个图。AI 会找到对应的文件,并按照定义好的顺序执行各个任务。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
dag-library
Use this skill when the user wants to KEEP a dag definition and run it again later — the graph is an asset, not a one-off. For authoring a brand-new graph, read mass-ulw first; this skill covers the storage-and-rerun half.
The shape
A stored definition is a plain dag definition JSON file named <name>.json in one of the library dirs. First hit wins:
$OMO_DAG_LIBRARY(multiple dirs, separated by:— or by;on Windows, so drive-letter paths survive)$PWD/.omo/dags$HOME/.omo/dags
{
"key": "nightly-audit",
"name": "Nightly audit",
"nodes": [
{ "id": "audit", "category": "unspecified-low", "prompt": "Audit docs/ for stale claims; write findings to /tmp/audit-{{key}}.md." },
{ "id": "verify", "category": "quick", "prompt": "Verify each finding in /tmp/audit-{{key}}.md against src/.", "dependsOn": ["audit"] }
]
}
String values may carry placeholders, filled at load time: {{key}} (the final rotated key — use it in file paths so reruns never clobber each other), {{date}} (UTC YYYYMMDD), {{datetime}} (UTC YYYYMMDD-HHmmss). Node prompts must still stand alone: dependsOn is ordering only, so pass data between nodes through files, exactly as in mass-ulw.
Running it — JS eval cell, two lines
The extension publishes library.js next to sdk.js at OMO_DAG_SDK_ROOT:
const lib = await import(`${env("OMO_DAG_SDK_ROOT")}/library.js`)
const run = await lib.start("nightly-audit")
const result = await run.done()
await lib.load(name) returns the filled definition without starting it; await lib.start(name) loads and starts in one call and returns the same handle shape as sdk.start (run_id, done(), cancel(reason)). Both are async — the kernel's read global is async, so never call them un-awaited.
Key rotation — the one rule that matters
The dag engine keys idempotency on key + graph fingerprint: re-starting the same key with the same graph REUSES the old run instead of running again. So the library treats the stored key as a BASE key and rotates it on every load:
lib.start("nightly-audit")→ key becomesnightly-audit-<UTC YYYYMMDD-HHmmss>: every call is a fresh run. This is the default because wanting a fresh run is the common case.lib.start("nightly-audit", { suffix: "20260818" })→ key becomesnightly-audit-20260818: explicit suffix, so re-running the same logical run reuses it (idempotent recovery), while a new day gets a new run. Recovering a FAILED node inside such a run isretry/amendon that run id, not a new suffix.lib.start("nightly-audit", { suffix: "" })→ key staysnightly-audit: full idempotency; only reach for this when reusing the previous result is exactly what you want.
Python cells
Python cannot import the ESM library. Reproduce the same semantics with plain dicts — read the file, rotate the key, fill placeholders, call tool.workflow:
import json
from datetime import datetime, timezone
defn = json.loads(read(f"{env('HOME')}/.omo/dags/nightly-audit.json"))
stamp = datetime.now(timezone.utc).strftime("%Y%m%d-%H%M%S")
defn["key"] = f"{defn['key']}-{stamp}"
text = json.dumps(defn).replace("{{key}}", defn["key"]).replace("{{date}}", stamp[:8]).replace("{{datetime}}", stamp)
run = tool.workflow({"action": "start", "definition": json.loads(text)})
result = tool.workflow({"action": "wait", "run_id": run["run_id"], "detach": False}) # detach=False keeps the cell-blocking wait; the bare tool action detaches against a live run
Saving a new definition
When the user asks to save the current graph: write it as <name>.json into $HOME/.omo/dags (user-level, survives cwd changes) or <repo>/.omo/dags (project-level, shareable through git if the team commits it), then confirm by running it once via lib.start. Names are letters, digits, dot, dash, underscore — the library rejects path-shaped names.
常见问题
任务图保存在哪里?
任务图保存在你电脑上的特定文件夹里,例如 '$HOME/.omo/dags',或者当前项目中的 '.omo/dags' 文件夹。
AI 怎么知道要运行哪个任务图?
你告诉它你保存时取的名字。AI 会在存放任务图的位置查找这个名字,然后执行其中定义的内容。
保存后的任务图可以修改吗?
这个技能主要用于保存和运行。如果要从零开始创建或修改任务图,你可能需要用到其他工具,比如 'mass-ulw'。
详情
作者的原始描述
Stores a DAG definition once and re-runs it by name, instead of pasting the definition into every run. Use when the user wants to save a DAG, run a saved one, or schedule the same multi-agent graph repeatedly.
热度
- GitHub 星标
- 70k
- 排名
- #3118
- 许可证
- NOASSERTION
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
comment-checker
70k帮你的智能体理解并回应自动代码检查工具的反馈。适用于处理自动化代码或内容审查的结果。
lcx-contribute-bug-fix
70k帮你的智能体为 LazyCodex 相关项目贡献错误修复。它会创建 issue 或 pull request,保障代码质量。
lcx-doctor
70k让你的智能体检查 LazyCodex 和 Codex CLI 安装的健康状况。当系统在更新或改动后表现异常时很有用。
lcx-report-bug
70k帮你的智能体为 LazyCodex 项目详细报告 bug。它会创建包含有用信息的 issue,方便开发者定位并修复问题。