with one click
task-graph
将 delivery-plan 的任务转为有向无环图 (DAG) — 拓扑排序确定执行顺序,识别并行组和关键路径。无循环依赖,无死锁。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
将 delivery-plan 的任务转为有向无环图 (DAG) — 拓扑排序确定执行顺序,识别并行组和关键路径。无循环依赖,无死锁。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
上下文园艺师 — 先读项目,再读 CLAUDE.md,逐层审计四层架构(CLAUDE.md → skills/ → hooks/ → memory/)。不做代码修改,只做审查、总结、归纳。生成建议报告,可视化花园输出。
将 repo-decompose 需求树 + mvp-approach 核心路径转化为分阶段可执行的交付计划。每个 Phase 有明确目标、任务清单、验收标准和依赖关系。
代码优化循环总控 — 12 阶段生命周期(2 前置门控 Detect+EnvReady,10 阶段优化闭环 Observe→Understand→Diagnose→Plan→Bound→Fix→Verify→SelfReview→Learn→Decide)。跨 Agent 自适应,环境自动就绪,任务驱动单流程。
基于 knowledge-graph 模块依赖 + mvp-approach 边界条件 + task-graph 任务清单,生成可修改文件白名单和禁止触碰红区。防止 Agent 无意中修改核心模块。
代码知识图谱 — 四层递进分析(符号表→调用链→数据流→模块依赖),产出完整结构化 Markdown 技术文档供 Loop Agent 和开发者阅读。每个文件有详细分析、每段关键代码有决策解释、模块间有影响矩阵。
循环日志管理 — 每个阶段产出结构化 markdown 日志,记录完整分析过程,可追溯、可检索。自动保存到 .loop-log/,支持按阶段/日期/关键词检索。
| name | task-graph |
| description | 将 delivery-plan 的任务转为有向无环图 (DAG) — 拓扑排序确定执行顺序,识别并行组和关键路径。无循环依赖,无死锁。 |
| argument-hint | build task graph | create task DAG | order the tasks |
| dependencies | {"upstream":["delivery-plan"],"downstream":["implementation-map","engineering-loop"]} |
不是列出任务——是计算执行顺序。 delivery-plan 已经拆出了任务和依赖,本 skill 做三件事:
输出写入 .repo-loop-state.json 的 plan.taskGraph 字段。
[1] .repo-loop-state.json 中 plan.deliveryPlan 非空?
NO → STOP. "❌ 需要先运行 delivery-plan"
从 delivery-plan 中提取全部任务:
输入: plan.deliveryPlan.phases[].tasks[]
输出: 节点列表
每个节点:
{ id, title, phase, deps[], estimatedLines, verification }
按依赖关系排序。算法:
1. 所有无依赖的节点 → 入队
2. 出队 → 标记为已排序
3. 依赖该节点的后续节点 → 检查依赖是否全部满足
4. 满足 → 入队
5. 循环直到队列空
6. 如果有未排序节点 → 存在循环依赖 ❌
将无相互依赖的节点归入同一批次:
批次规则:
Batch 1: 所有 deps=[] 的节点
Batch 2: 所有 deps 全部在 Batch 1 中的节点
Batch N: 所有 deps 全部在 Batch 1..N-1 中的节点
找到从入口到终点的最长依赖链:
关键路径算法:
对每个节点计算 earliestFinish = max(所有依赖节点的 earliestFinish) + 自身耗时
最长路径上的节点 = 关键路径
耗时估算:
S: ≤50 行 → 1 单位
M: 50-200 行 → 2 单位
L: >200 行 → 4 单位(建议拆分)
写入 .repo-loop-state.json → plan.taskGraph:
{
"taskGraph": {
"nodes": [
{ "id": "T-1-1", "title": "定义 User 模型", "deps": [], "batch": 1, "estimatedLines": 30, "criticalPath": true, "cost": 1 },
{ "id": "T-1-2", "title": "实现 JWT 工具函数", "deps": [], "batch": 1, "estimatedLines": 60, "criticalPath": true, "cost": 1 },
{ "id": "T-1-3", "title": "实现 POST /auth/login", "deps": ["T-1-1", "T-1-2"], "batch": 2, "estimatedLines": 80, "criticalPath": true, "cost": 2 },
{ "id": "T-2-1", "title": "实现 authMiddleware", "deps": ["T-1-2"], "batch": 2, "estimatedLines": 50, "criticalPath": false, "cost": 1 },
{ "id": "T-2-2", "title": "挂载中间件到路由", "deps": ["T-2-1", "T-1-3"], "batch": 3, "estimatedLines": 70, "criticalPath": true, "cost": 1 }
],
"batches": [
{ "batch": 1, "parallel": ["T-1-1", "T-1-2"], "canParallelize": true },
{ "batch": 2, "parallel": ["T-1-3", "T-2-1"], "canParallelize": true },
{ "batch": 3, "parallel": ["T-2-2"], "canParallelize": false }
],
"criticalPath": ["T-1-1", "T-1-2", "T-1-3", "T-2-2"],
"totalBatches": 3,
"totalCost": 5,
"estimatedDuration": "~5 个原子提交",
"hasCycle": false
}
}
图形表示:
Batch 1: [T-1-1] ──┐ [T-1-2] ──┐
│ │
Batch 2: [T-1-3] [T-2-1]
│ │
Batch 3: [T-2-2] ◄─────────┘
关键路径: T-1-1 → T-1-3 → T-2-2 (最长链)
并行机会: Batch 1 两个任务可并行,Batch 2 两个任务可并行
| # | Agent 借口 | 反驳 |
|---|---|---|
| 1 | "这几个任务看着没依赖,放一批就行" | 必须跑拓扑排序确认。视觉判断 → 遗漏隐式依赖(共享文件) |
| 2 | "关键路径算一下太费时间" | 5 个节点的手动拓扑 < 30 秒。不计算 → 无法评估工期 |
| 3 | "循环依赖?不可能,我拆的时候注意了" | 跑算法验证。不跑 → 运行时才发现死锁 |
| 4 | "并行批次太多,先串行做简单" | 并行批次 = 效率。串行化 → 把 3 批变成 5 批,工期翻倍 |
.repo-loop-state.json → plan.taskGraph