Communitygithub.com

graph

确定性编排图运行时——声明式DAG管道,支持基于日志的崩溃恢复

graph 是什么?

Graph 技能提供了一种确定性编排图运行时,通过声明式 JSON 描述符定义有向无环图(DAG)管道,并利用独立操作系统进程(`omc graph run`)执行。它支持崩溃恢复:如果任务在运行中被杀死,重新执行相同的命令可以从日志(journal)中恢复,已完成的节点不会重复执行。该技能适用于可重复的多步骤管道、需要中断容忍的工作以及可审计的运行场景,但不适合探索性的一次性工作或需要中途自适应重规划的任务。它支持在 Claude Code 中使用 `/oh-my-claudecode:graph` 命令触发,并通过 Bash 工具或交互式会话运行,描述符中可包含命令节点、代理节点和人工审批节点。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Yeachan-Heo/oh-my-claudecode/tree/main/skills/graph

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Graph 技能

从声明式 JSON 描述符运行确定性编排图。 运行时使用 src/graph/* 中的 sealed-descriptor 和 pure-scheduler 合约, 通过独立的OS进程(omc graph run)执行, 因此崩溃恢复(中间杀死、重新运行、从日志恢复)是真实有效的。

使用方式

/oh-my-claudecode:graph <descriptor.json>
/oh-my-claudecode:graph "构建然后测试然后部署前问我"   (先编写描述符)

执行接口始终是 CLI 子命令:

omc graph run <descriptor.json> [--runs-root <dir>]

非交互式图通过 Bash 工具运行。进度行以 [run]、[node]、[ok]、[fail]、[join]、[done] 形式流式输出。

何时使用

  • 具有显式依赖关系的可重复多步骤管道(DAG)
  • 必须能够容忍中断的工作:杀死/重启可从日志恢复
  • 可审计的运行:.omc/graph-runs/<run_id>/ 下的 OCC 日志 + 投影快照

何时不使用:探索性的一次性工作(使用对话或 /team); 任何需要中途自适应重规划的工作(图是确定性的)。

工作流程

  1. 提供描述符 -> 转到步骤3。

  2. 描述管道 -> 编写描述符 JSON(架构如下), 将其写在项目旁边(建议 .omc/graphs/<name>.json)并在运行前展示给用户。run_id 在每个逻辑管道中必须唯一; 使用相同的 run_id 重新运行是恢复,而不是重新开始。

  3. 审批节点:如果描述符包含任何 "kind": "human-approval" 节点, 不要通过 Bash 工具运行(标准输入在那里不是交互式的; EOF 失败时视为拒绝)。告诉用户改为交互式运行:

    ! omc graph run <file>
    

    ! 前缀使其在该会话中运行,具有实时标准输入,因此 y/n 有效。

  4. 运行并传递进度。退出码(规范性): 0 成功 | 1 终端失败 | 19 另一个写入者拥有此运行(繁忙) 20 损坏/篡改的日志(失败关闭)| 21 恢复时描述符漂移 | 70 运行时崩溃(未映射的错误)

  5. 恢复:崩溃后重新运行相同命令会重放已提交的 转换并继续。已完成的节点永远不会重新执行。

描述符架构(最小化)

{ "descriptor_version": 1, "run_id": "unique-pipeline-id", "revision_id": "rev-1", "goal": "一行描述", "nodes": [ { "id": "n1", "kind": "command", "title": "...", "timeout_ms": 60000, "max_attempts": 2, "effect_policy": { "policy": "side_effect_free" }, "command": "npm test" }, { "id": "a1", "kind": "agent", "title": "...", "timeout_ms": 300000, "max_attempts": 1, "effect_policy": { "policy": "side_effect_free" }, "instructions": "..." }, { "id": "gate", "kind": "human-approval", "title": "...", "prompt": "继续?" } ], "edges": [ { "id": "e1", "kind": "fixed", "from": "n1", "to": "a1" } ], "entry_node_ids": ["n1"], "concurrency_limit": 2, "terminal_verification_node_id": "a1" }

边的种类:fixed | conditional | fan_out/join 对 | back_edge(通过 max_traversals 实现有限重试)。请参阅 src/graph/schema.ts 获取权威的 Zod 架构—— 并阅读上面的“能力边界”部分,了解内置执行器实际执行的内容。

能力边界与语义(编写前请阅读)

  • 边支持:内置的命令/代理执行器覆盖 fixed 边和 fan_out/join 对。conditional 和 back_edge 路由完全由运行时和调度器合约支持, 但需要自定义的 NodeExecutor 在其结果中发出 route——内置执行器从不产生路由, 因此依赖它们的图会快速失败并返回 route_required 而不是猜测。
  • 崩溃恢复保证对于命令节点是至少一次:在外部副作用 与其日志追加之间发生的崩溃会在恢复时重新执行该节点。对于 idempotent 命令, 在命令启动之前,解析的键可作为 GRAPH_IDEMPOTENCY_KEY 使用, 并记录下来用于下游去重。内置执行器拒绝 reconcile; 协调需要一个具有实际外部协调权威的自定义执行器。 外部副作用的精确一次语义超出 v1 范围。
  • 命令信任边界:命令节点是任意的 shell 行, 在当前工作目录中具有进程权限。仅运行您编写或信任的描述符。 命令子进程接收一个允许列表环境(PATH、HOME/USERPROFILE、TEMP/TMP、区域设置/时区、USER 身份、 GRAPH_* 和可选幂等键),而不是主机的全部机密。 命令不受文件系统/进程沙箱保护。
  • 代理权限边界:内置代理节点明确是只读的。 它们在当前工作目录中运行,没有额外目录, 仅支持 Read、Glob 和 Grep,permissionMode: dontAsk, 会话持久化已禁用,并具有特定于提供者的环境允许列表。代理超时终止并中断 SDK 查询。 任何需要变更或外部效果的代理,请使用自定义执行器。将 .omc/graph-runs/<run_id>/descriptor.json 视为可执行内容。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

agent-doc-discipline

Writing-time discipline for documents agents consume (the five surfaces, specs, tickets, .omc/skills/) — every rule checkable and carrying a why, steps before reference, one meaning in one home, no restating what the environment already says. Mandatory at drydock seed generation and the launch C5 sediment pass; opt-in for any other agent-facing doc edit. The companion of minimal-code-discipline: that one disciplines code, this one disciplines papers.

ai-slop-cleaner

Clean AI-generated code slop with a regression-safe, deletion-first workflow and optional reviewer-only mode

ask

Process-first advisor routing for Claude, Codex, Gemini, Antigravity, Grok, or Cursor via `omc ask`, with artifact capture and no raw CLI assembly

ask-navigator

Shipyard

autopilot

Full autonomous execution from idea to working code

autoresearch

Stateful single-mission improvement loop with strict evaluator contract, markdown decision logs, and max-runtime stop behavior

cancel

Cancel any active OMC mode (autopilot, ralph, ultragoal, swarm, ultrapilot, pipeline, team) and clean up retired legacy state

configure-notifications

Configure notification integrations (Telegram, Discord, Slack) via natural language

debug

Diagnose the current OMC session or repo state using logs, traces, state, and focused reproduction

deepinit

Deep codebase initialization with hierarchical AGENTS.md documentation

deep-interview

Socratic deep interview with mathematical ambiguity gating before explicit execution approval

drydock

Lay the keel of the shipyard harness in any repo — the 4-pillar shared environment (Context, Rules, Tools, Standards) across 5 surfaces (CLAUDE.md, skills, design-system, mcp/cli, shared context) so that every human and agent inherits the same design language and anyone can ship. Run once per repo; re-run with --check to audit drift.

execute

Carry an approved task through to working, verified code

external-context

Invoke parallel document-specialist agents for external web searches and documentation lookup

harbor

Harbor intake for external work — the captain only handles unresolved decisions. Sweeps incoming issues and PRs, verifies every claim before disposition, reuses every decision already made, and hands the maintainer a docket whose pending items each carry one question with options, recommendation, impact and evidence. Agent-autonomous for facts and for actions covered by standing authorization; signed for every new judgment. Never merges.

hud

Configure HUD display options (layout, presets, display elements)

launch

Shipyard

loft

Loft the shape before cutting steel — answer a design question that prose cannot settle by building a throwaway artifact: a pure logic module in a clickable shell, or structurally different UI variants behind one route. The captain reacts to the artifact; the answer folds into the decision; the artifact never docks. Use when a design question stalls in words, when a navigator map carries a loft ticket, or when a spec discussion reaches

minimal-code-discipline

YAGNI-ladder coding discipline for writing changes — existence-first, reuse before writing, dependency ladder, shortest correct diff, with non-negotiables that must never be minimized away

omc-doctor

Diagnose and fix oh-my-claudecode installation issues

相关技能