ralphflow-dsh 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +47 -21
  2. package/graphs/codewiki/format.md +362 -0
  3. package/graphs/codewiki/graph.yaml +39 -0
  4. package/graphs/codewiki/nodes/assemble.md +24 -0
  5. package/graphs/codewiki/nodes/core-pages.md +17 -0
  6. package/graphs/codewiki/nodes/module-pages.md +18 -0
  7. package/graphs/codewiki/nodes/operations-pages.md +18 -0
  8. package/graphs/codewiki/nodes/survey.md +22 -0
  9. package/lib/asset-path.d.ts +59 -0
  10. package/lib/asset-path.js +181 -0
  11. package/lib/assets.d.ts +42 -0
  12. package/lib/assets.js +86 -0
  13. package/lib/client/phase.d.ts +29 -0
  14. package/lib/client/phase.js +86 -0
  15. package/lib/client/selection.d.ts +28 -0
  16. package/lib/client/selection.js +9 -0
  17. package/lib/client/status-source.d.ts +3 -1
  18. package/lib/client/status-source.js +3 -2
  19. package/lib/client/status.js +49 -13
  20. package/lib/client/viewer.d.ts +18 -0
  21. package/lib/client/viewer.js +540 -0
  22. package/lib/client.js +1159 -64
  23. package/lib/engine.d.ts +111 -47
  24. package/lib/engine.js +473 -320
  25. package/lib/facade.d.ts +175 -0
  26. package/lib/facade.js +553 -0
  27. package/lib/graph/agent-registry.d.ts +4 -0
  28. package/lib/graph/agent-registry.js +20 -0
  29. package/lib/graph/asset.d.ts +47 -0
  30. package/lib/graph/asset.js +276 -0
  31. package/lib/graph/assets.d.ts +47 -0
  32. package/lib/graph/assets.js +224 -0
  33. package/lib/graph/branches.d.ts +9 -0
  34. package/lib/graph/branches.js +13 -0
  35. package/lib/graph/check.d.ts +23 -0
  36. package/lib/graph/check.js +46 -0
  37. package/lib/graph/engine.d.ts +55 -0
  38. package/lib/graph/engine.js +2002 -0
  39. package/lib/graph/report.d.ts +9 -0
  40. package/lib/graph/report.js +117 -0
  41. package/lib/graph/state.d.ts +244 -0
  42. package/lib/graph/state.js +358 -0
  43. package/lib/graph/workspace.d.ts +68 -0
  44. package/lib/graph/workspace.js +262 -0
  45. package/lib/index.js +150 -47
  46. package/lib/owner.d.ts +34 -0
  47. package/lib/owner.js +49 -0
  48. package/lib/paths.d.ts +12 -0
  49. package/lib/paths.js +44 -0
  50. package/lib/pause.d.ts +12 -0
  51. package/lib/pause.js +19 -0
  52. package/lib/skills.d.ts +17 -30
  53. package/lib/skills.js +85 -21
  54. package/lib/status-contract.d.ts +114 -1
  55. package/lib/status-contract.js +106 -4
  56. package/lib/status-service.d.ts +5 -1
  57. package/lib/status-service.js +8 -1
  58. package/lib/tools.d.ts +14 -6
  59. package/lib/tools.js +88 -60
  60. package/lib/unfinished.d.ts +11 -0
  61. package/lib/unfinished.js +18 -0
  62. package/lib/verifier-preset.d.ts +40 -0
  63. package/lib/verifier-preset.js +126 -0
  64. package/lib/verify.d.ts +63 -9
  65. package/lib/verify.js +282 -72
  66. package/package.json +50 -38
  67. package/skills/ralphflow-create/SKILL.md +32 -0
  68. package/skills/ralphflow-create/graph-authoring.md +85 -0
  69. package/skills/ralphflow-create/matt/LICENSE +21 -0
  70. package/skills/ralphflow-create/matt/SHA256SUMS +6 -0
  71. package/skills/ralphflow-create/matt/SKILL-MECHANICS.md +22 -0
  72. package/skills/ralphflow-create/matt/SOURCE.md +12 -0
  73. package/skills/ralphflow-create/matt/grilling.md +30 -0
  74. package/skills/ralphflow-create/matt/to-spec.md +75 -0
  75. package/skills/ralphflow-create/matt/to-tickets.md +105 -0
  76. package/skills/ralphflow-create/matt/writing-for-agents.md +81 -0
  77. package/skills/ralphflow-create/ralphflow-authoring.md +31 -0
  78. package/skills/ralphflow-create/testing-workflow.md +60 -0
  79. package/{references → skills/ralphflow-create}/workflow-authoring.md +25 -5
  80. package/workflows/create-graph/steps/graph.md +17 -0
  81. package/workflows/create-graph/workflow.yaml +77 -0
  82. package/workflows/loop/workflow.yaml +23 -0
  83. package/lib/create.d.ts +0 -2
  84. package/lib/create.js +0 -17
  85. package/workflows/loop.yaml +0 -45
  86. /package/workflows/{spec.yaml → spec/workflow.yaml} +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ralphflow-dsh",
3
- "version": "2.3.1",
4
- "description": "Ralph Flow for DeepSeek Harness — 执行者/验证者模式的具象化:主会话执行,独立验证者对抗检查,推进权在机械程序(v2 原生重做)",
3
+ "version": "2.4.0",
4
+ "description": "Ralph Flow for DeepSeek Harness — Flow 顺序状态机 + Graph DAG(统一插件/命令/工具/查看器):主会话执行,独立验证者取证,推进权在机械程序(v2 原生)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -23,9 +23,10 @@
23
23
  "files": [
24
24
  "lib",
25
25
  "workflows",
26
+ "graphs",
26
27
  "cordis.patch.yml",
27
28
  "README.md",
28
- "references"
29
+ "skills"
29
30
  ],
30
31
  "dsh": {
31
32
  "bundle": {
@@ -38,7 +39,8 @@
38
39
  "@deepseek-ai/dsh-client-ui-conversation",
39
40
  "@deepseek-ai/dsh-client-ui-renderer",
40
41
  "@deepseek-ai/dsh-api-gateway",
41
- "@deepseek-ai/dsh-client-ui-primitives"
42
+ "@deepseek-ai/dsh-client-ui-primitives",
43
+ "@deepseek-ai/dsh-client-ui-sidebar-right"
42
44
  ],
43
45
  "external": [
44
46
  "react",
@@ -61,22 +63,24 @@
61
63
  },
62
64
  "peerDependencies": {
63
65
  "@deepseek-ai/cordis": "^4.0.4 || ^4.0.5-alpha.1",
64
- "@deepseek-ai/dsh-agent": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
65
- "@deepseek-ai/dsh-llm": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
66
- "@deepseek-ai/dsh-tools": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
67
- "@deepseek-ai/dsh-subagent": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
68
- "@deepseek-ai/dsh-session": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
69
- "@deepseek-ai/dsh-compaction": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
70
- "@deepseek-ai/dsh-commands": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
71
- "@deepseek-ai/dsh-skill": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
72
- "@deepseek-ai/dsh-client-ui-chat": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
73
- "@deepseek-ai/dsh-client-ui-conversation": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
74
- "@deepseek-ai/dsh-client-ui-renderer": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
75
- "@deepseek-ai/dsh-typert-protocol": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
76
- "@deepseek-ai/dsh-typert-registry": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
77
- "@deepseek-ai/dsh-api-gateway": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
78
- "@deepseek-ai/dsh-session-query": "^0.2.0-rc.2 || ^0.2.1-alpha.1",
79
- "@deepseek-ai/dsh-client-ui-primitives": "^0.2.0-rc.2 || ^0.2.1-alpha.1"
66
+ "@deepseek-ai/dsh-agent": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
67
+ "@deepseek-ai/dsh-llm": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
68
+ "@deepseek-ai/dsh-tools": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
69
+ "@deepseek-ai/dsh-subagent": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
70
+ "@deepseek-ai/dsh-session": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
71
+ "@deepseek-ai/dsh-compaction": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
72
+ "@deepseek-ai/dsh-commands": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
73
+ "@deepseek-ai/dsh-skill": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
74
+ "@deepseek-ai/dsh-home-paths": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
75
+ "@deepseek-ai/dsh-client-ui-chat": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
76
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
77
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
78
+ "@deepseek-ai/dsh-typert-protocol": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
79
+ "@deepseek-ai/dsh-typert-registry": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
80
+ "@deepseek-ai/dsh-api-gateway": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
81
+ "@deepseek-ai/dsh-session-query": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
82
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2",
83
+ "@deepseek-ai/dsh-client-ui-sidebar-right": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-alpha.2"
80
84
  },
81
85
  "devDependencies": {
82
86
  "@types/js-yaml": "^4.0.9",
@@ -84,25 +88,27 @@
84
88
  "esbuild": "^0.28.2",
85
89
  "@types/react": "^18.3.1",
86
90
  "react": "^18.3.1",
87
- "@deepseek-ai/cordis": "4.0.4",
88
- "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
89
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
90
- "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
91
- "@deepseek-ai/dsh-subagent": "0.2.0-rc.2",
92
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
93
- "@deepseek-ai/dsh-compaction": "0.2.0-rc.2",
94
- "@deepseek-ai/dsh-commands": "0.2.0-rc.2",
95
- "@deepseek-ai/dsh-skill": "0.2.0-rc.2",
96
- "@deepseek-ai/dsh-client-ui-chat": "0.2.0-rc.2",
97
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.2",
98
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
99
- "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
100
- "@deepseek-ai/dsh-typert-registry": "0.2.0-rc.2",
101
- "@deepseek-ai/dsh-api-gateway": "0.2.0-rc.2",
102
- "@deepseek-ai/dsh-session-query": "0.2.0-rc.2",
103
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.2",
91
+ "@deepseek-ai/cordis": "4.0.5",
92
+ "@deepseek-ai/dsh-agent": "0.2.1-rc.5",
93
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.5",
94
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.5",
95
+ "@deepseek-ai/dsh-subagent": "0.2.1-rc.5",
96
+ "@deepseek-ai/dsh-session": "0.2.1-rc.5",
97
+ "@deepseek-ai/dsh-compaction": "0.2.1-rc.5",
98
+ "@deepseek-ai/dsh-commands": "0.2.1-rc.5",
99
+ "@deepseek-ai/dsh-skill": "0.2.1-rc.5",
100
+ "@deepseek-ai/dsh-home-paths": "0.2.1-rc.5",
101
+ "@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.5",
102
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.5",
103
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.5",
104
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.5",
105
+ "@deepseek-ai/dsh-typert-registry": "0.2.1-rc.5",
106
+ "@deepseek-ai/dsh-api-gateway": "0.2.1-rc.5",
107
+ "@deepseek-ai/dsh-session-query": "0.2.1-rc.5",
108
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.5",
104
109
  "typescript": "^5.9.3",
105
- "@deepseek-ai/dsh": "0.2.0-rc.2"
110
+ "@deepseek-ai/dsh": "0.2.1-rc.5",
111
+ "@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.1-rc.5"
106
112
  },
107
113
  "scripts": {
108
114
  "build": "tsc -p tsconfig.json && node scripts/build-client.mjs",
@@ -138,6 +144,9 @@
138
144
  "@deepseek-ai/dsh-skill": {
139
145
  "optional": true
140
146
  },
147
+ "@deepseek-ai/dsh-home-paths": {
148
+ "optional": true
149
+ },
141
150
  "@deepseek-ai/dsh-client-ui-chat": {
142
151
  "optional": true
143
152
  },
@@ -161,6 +170,9 @@
161
170
  },
162
171
  "@deepseek-ai/dsh-client-ui-primitives": {
163
172
  "optional": true
173
+ },
174
+ "@deepseek-ai/dsh-client-ui-sidebar-right": {
175
+ "optional": true
164
176
  }
165
177
  }
166
178
  }
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: ralphflow-create
3
+ description: 创建或修改 RalphFlow 工作流或 DAG:用户想把流程做成工作流、设计多 agent DAG,或修改现有 Flow/Graph 资产时使用。
4
+ ---
5
+
6
+ # RalphFlow 创建
7
+
8
+ 先判断产物是 Flow 还是 Graph,再走对应分支。两条分支都以「资产已保存、`ralphflow_doctor` 通过、没有启动实例」为完成条件。
9
+
10
+ ## Flow
11
+
12
+ Flow 是顺序状态机,不走 Matt 的 grill/spec/tickets。
13
+
14
+ 1. 问清目标、触发条件、输入、产出和结束条件;只问会改变步骤或验收的决定。
15
+ 2. 读 `workflow-authoring.md`,按它的字段与写法起草;写 DO/CHECK 前读 `matt/writing-for-agents.md`。它只管写法,不引入 Graph 的 grill/spec/tickets。
16
+ 3. 把资产写到项目根的 `.dsh/ralph-flow/workflows/<slug>/workflow.yaml`(项目根 = 从当前目录向上最近的含 `.git` 的祖先目录;没有就用当前目录)。资产目录里可以放 DO/CHECK 引用的契约、模板等资源,这些资源的相对路径按该目录解析;要写出的交付物按 `output` 与产出目录的落点。
17
+ 4. 用 `ralphflow_doctor` 校验,修到全部通过。
18
+ 5. 把路径和用法交给用户;生成的工作流只在用户明确要求时启动。
19
+
20
+ 完成条件:doctor 通过,文件存在,没有启动实例。
21
+
22
+ ## Graph / DAG
23
+
24
+ Graph 用 ticket DAG。启动内置 `create-graph` Flow,由它承载 grill → spec → tickets → graph,以及 spec/tickets 的独立 CHECK 和人工门:
25
+
26
+ `ralphflow_start({ workflow: "create-graph", task: "<用户想法>" })`
27
+
28
+ 然后按它返回的步骤执行;方法由 create-graph 的步骤从 `ralphflow-create` skill 的资源目录读取随包 Matt 参考。
29
+
30
+ 如果你已经在 `create-graph` 的某个步骤中,只执行当前步骤,不再启动新的 `create-graph`。
31
+
32
+ 完成条件:create-graph 完成并给出 Graph 资产路径;没有启动生成的 Graph。
@@ -0,0 +1,85 @@
1
+ # RalphFlow 工作流资产编写
2
+
3
+ 供编写和校验可交付 Graph 工作流资产时参考。结构和有效 CHECK(独立验收)内容,以 `ralphflow_doctor` 的检查为准。
4
+
5
+ - 写任何节点的 DO/CHECK 或其他面向 agent 的文本之前,先读同目录的 [`matt/writing-for-agents.md`](matt/writing-for-agents.md);它是随包唯一权威副本,本文件不复述原则。
6
+ - Flow 资产(`steps` / `on_pass` / `check_voting`)的字段见 [`workflow-authoring.md`](workflow-authoring.md);Graph 与 Flow 字段不混用。
7
+
8
+ ## 结构
9
+
10
+ Graph 资产用与 Flow 相同的 `steps` 数组,每个步骤有 `id`、`desc`、`do`;`output` 是交付文件路径(省略时默认 `<id>.md`),`depends_on` 是前驱步骤 id 数组。上游步骤的 `output` 会自动注入下游的只读材料,**不需要再写 `inputs` 映射**;只表达顺序时也写 `depends_on`。目录名就是启动名(入口固定是 `graph.yaml`),不要再写 `id` 或 `name`。
11
+
12
+ ## 资产目录
13
+
14
+ 资产是一个目录:`graphs/<name>/graph.yaml` 加它引用的资源。**参考根是入口文件所在目录**:DO/CHECK 引用的**资产资源**(契约、页面模板、校验清单)用相对路径按它解析,执行者与验证者的提示词里都会带上同一个目录。所以这些资源放在资产自己的目录里,用 `format.md`、`templates/page.md` 这样的相对路径指向;不要把它们复制进每一步的提示词。这个根只解析资产资源,工作区路径与节点产物仍按各自一节的路径规则。单文件形态 `graphs/<name>.yaml` 仍可加载,参考根是 `graphs/`(兼容形态,共享资源放那里)。
15
+
16
+ ## 入口是地图,做法在资源里
17
+
18
+ 资产入口(`graph.yaml`)先给人看:每一步只留「做什么、交付什么」一句话,让人一眼看懂整条流程。具体做法与验收判据放进资产目录的文件,入口用相对路径指向。
19
+
20
+ - 入口的 `do` 写这一步的目标与交付;动作序列、领域契约、字段表、校验清单放进 `nodes/<id>.md`(或共用的一份 `format.md`)。
21
+ - CHECK 同理:入口写「按 `<文件>` 的验收一节逐条核对并给出证据」,判据正文放文件。
22
+ - 判断该不该外置:把入口单独给人看,他能不能说清每一步在做什么;把入口单独给执行者,它能不能顺指针拿到全部做法。两条都成立就够。
23
+ - 只有一步就能说清的工作(例如内置 `loop`)不拆:入口本身就是全部。
24
+
25
+ 完成条件:入口的每一行都在描述「做什么」;同一份做法只在一个文件里出现。
26
+
27
+ 只有产物工作流中必须与用户讨论某个决定的步骤,才使用 `execution: "main"`;普通的自主工作使用 `background`。顶层 `manual_step` 标记在启用的 CHECK 通过后仍需用户明确审查的步骤。
28
+
29
+ Graph 始终使用 Git 隔离:每个步骤在自己的 worktree 与自己的分支上运行,交卷前把运行级集成分支合进来;引擎只做快进。没有 workspace 开关,也没有并发数字;就绪步骤全部放行,由 DSH 的 agent 并发限制排队。
30
+
31
+ ## 工作区与 Git
32
+
33
+ Graph 需要工作区是 Git 仓库、有 HEAD、且工作区干净。不满足时启动失败,错误提示会要求 AI 先问用户是否初始化;用户同意后由 AI 执行 `git init` / `git add -A` / `git commit -m baseline`,再重新启动。引擎不自动初始化。
34
+
35
+ 方案要写明最终结果在集成分支 `ralphflow/<实例>`(节点分支 `ralphflow-node/<实例>/<节点>`),而不是自动改源 checkout;跑完用 `git log` / `git ls-tree` / `git checkout` 查看。设计 CHECK 必须核对:每个 DO 需要的原生能力在 Git worktree 中真实存在;输出位置和最终可审查位置已经写明。
36
+
37
+ ## 可复用场景
38
+
39
+ 当请求设计的是要在多个项目或主题上运行的流程时,流程资产就是产品。一次性执行设计跳过本分支。
40
+
41
+ 1. 只向用户询问流程目标及其约束。完成条件:每个重要的设计决定都已得到回答或记录为待定选项,且完成设计不需要任何未来的项目、主题、材料或运行值。
42
+ 2. 把每个在不同运行之间会变化的值写进任务约定(DO 里说明这些值从任务文本读取),资产中不出现任何未来的值。完成条件:每个步骤动作都从任务文本读取其变化的值。
43
+ 3. 把流程目标到步骤交付物的映射写进交付产物的 `plan` 字段,在 `goalCoverage` 中重复这份映射。完成条件:每个请求的成果都指明一个已存在的步骤、它的产物、依赖理由和验收路径。
44
+ 4. 在交付边界检查资产的结构、步骤指引、依赖和目标覆盖。完成条件:`ralphflow_doctor` 校验有效,且 `assetAcceptance` 为每个维度记录了可观察的已通过检查。
45
+ 5. 把下一步作为两个明确选项提供:停止并保留资产,或运行一个真实实例。让 `nextStep.started` 和 `generatedWorkflowStarted` 保持 false。完成条件:产物说明只有用户的明确选择才会启动运行。
46
+
47
+ ## 用引用代替复制
48
+
49
+ 让资产只承载流程与验收;可复用的方法正文放在参考资料里。
50
+
51
+ - 当一条规则已经存在于共享参考资料中时,指明该参考资料及其触发条件,让执行者去读;步骤或判据只写依赖这条规则的结果。
52
+ - CHECK 判据保持为用户可查看的验收结果。细节属于方法时,指向共享参考资料;细节属于任务特定结果时,把判据明确写出来。
53
+ - 把多个节点共用的约定放进资产目录里的一份文件(例如 `format.md`),或放进一个上游产物(例如 `CONVENTIONS.md`),并让每个节点指向它。
54
+ - 只有拿不到资产目录的辅助者才需要内联正文;拿到参考根的辅助者按相对路径自己读。
55
+
56
+ 完成条件:每条可复用的规则只有一个归属;方案指明这个归属;没有节点复述它。
57
+
58
+ ## CHECK 的选择
59
+
60
+ Graph 不提供固定的默认 CHECK:每个步骤的独立验收都由资产作者按 writing-for-agents 写成显式判据。
61
+
62
+ - 需要独立验收:写 `check: |` 加可观察、穷尽的判据,每条一行编号(`1. ...`)。判据覆盖该步骤必须交付的所有内容;`ralphflow_doctor` 的「有效 CHECK」会逐条显示。
63
+ - 独立验收没有额外价值:写 `check: null`。报告与查看器会明确显示“CHECK 关闭”,不等于验证通过。
64
+ - 不要写 `check: {mode: default}` 或 `{mode: custom, criteria}`:Graph 的 `check` 是字符串或 `null`,没有默认判据模式。
65
+
66
+ ## 编写顺序
67
+
68
+ 1. 应用方案中的成果映射。完成条件:每个请求的成果都由一个节点交付物承载,并有一条验收路径。
69
+ 2. 先为每个节点写 `nodes/<id>.md`:`## 做什么` 写有序动作,每条带可核查的完成条件;`## 验收` 写这个节点的判据。完成条件:全新的执行者只读这一份就能判断节点何时完成、怎样算通过。
70
+ 3. 把 writing-for-agents 应用到每个 `nodes/<id>.md` 的两节和面向用户的指引。完成条件:指针写明触发条件,每条规则只有一个归属,指引以正面方式陈述目标行为。
71
+ 4. 再组装入口 `graph.yaml`:每个步骤的 `do` 写一句「做什么、交付什么」并指向 `nodes/<id>.md`,`check` 写一句指向该文件「验收」一节的指针;声明依赖、产物和 CHECK 选择。完成条件:入口的每一行都在描述「做什么」,每个指针都指向同目录存在的文件。
72
+ 5. 用 `ralphflow_doctor`(工作区资产路径) 校验该对象。修复每个报告的错误并重新校验。完成条件:`ralphflow_doctor` 报告全部 ✅ 且无告警,每个步骤的有效 CHECK 与方案一致。
73
+ 6. 把资产保存为 `.dsh/ralph-flow/graphs/<slug>/graph.yaml`,把 `nodes/<id>.md` 与 DO/CHECK 引用的契约、模板放在同一目录。完成条件:入口在该路径可读,目录名与启动名一致,每条相对路径都指向同目录里存在的文件。
74
+ 7. 用 `ralphflow_doctor({ "path": ".dsh/ralph-flow/graphs/<slug>/graph.yaml" })` 校验已保存的文件。完成条件:`valid` 为 true,且 doctor 无阻塞项。
75
+ 8. 用 `ralphflow_artifact_write` 写入交付产物:请求、`plan` 文本、`assetPath`、完整的资产、两次校验结果、每个步骤的有效 CHECK、针对保存资产的查看器指引、标记为 `choiceRequired` 且 `started: false` 的 `nextStep` 选项,以及 `generatedWorkflowStarted: false`。可复用场景的交付还要包含 `designKind`、`goalCoverage`、`assetAcceptance` 和 `realRun`。完成条件:产物指明方案文本、资产路径和已保存文件的校验结果,且可复用场景字段满足可复用场景分支;然后调用一次 `ralphflow_submit`。
76
+
77
+ ## 打开已交付的资产
78
+
79
+ 保存后资产会出现在 RalphFlow 只读查看器的 Graph 列表里;让用户打开右侧 RalphFlow 标签页并重新加载即可。编辑资产走常规路径:编辑、doctor 校验、保存、重新加载。
80
+
81
+ ## 交付边界
82
+
83
+ 设计运行以方案和资产收尾。在最终回复的结尾给出两个保存路径、打开工作图的指引,以及作为用户明确选择的下一步:审查工作图、在主会话中请求修改、停止并保留资产,或运行一个真实实例。对于可复用场景,在任务约定里说明真实运行需要随任务提供的值;v1 不提供隔离样例启动。生成的工作流只在那次明确请求之后启动;设计期间不创建任何生成工作流的运行实例。
84
+
85
+ v1 不提供隔离样例启动:用户明确要求运行后,用 `ralphflow_start` 以任务文本启动真实实例。
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matt Pocock
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ 0e7ac423bf2c6e223b7c5b156f8cf72da49d748e56a1641402c31f22ad07dbb5 LICENSE
2
+ c768e6307c7c10728c401c213f2c4ba71c542127eeb7ad2956aabd15a0fa0059 SKILL-MECHANICS.md
3
+ befdff1e27a1dfe2a294d5871169ac1afe16d983911daa4f32627514a48c1e15 grilling.md
4
+ 43ad9cf318e5e7d3d1fa360253a37021796dc87a0c2e595ad262661a10f85088 to-spec.md
5
+ 56ec23c5b2782785d4e65bff9e315b6d3aeb4ef977c174a219e99489fada1995 to-tickets.md
6
+ 551adca942227b44192edba88acd4e8db911f0121ce58ad16944ccf6a896a74a writing-for-agents.md
@@ -0,0 +1,22 @@
1
+ # Skill mechanics
2
+
3
+ The skill-specific branch of [`writing-for-agents`](SKILL.md): what changes when the document is a skill (frontmatter, the invocation choice, and router skills). Everything else about writing it is the universal reference in `SKILL.md`.
4
+
5
+ ## Invocation
6
+
7
+ Two choices, trading the two loads:
8
+
9
+ - A **model-invoked** skill keeps a `description`, so the agent can fire it autonomously, and other skills can reach it. You can still type its name: model-invocation always _includes_ user reach; a description only ever adds agent discovery, never removes the human's. The description is the skill's top-level context pointer, forced to stay loaded at all times: permanent context load in exchange for discoverability. A model-invoked skill whose content is all reference is also one home for shared reference: another skill can invoke it, so reference needed by several skills lives in one place. Mechanics: omit `disable-model-invocation`, and write a model-facing description carrying the trigger branches (the pointer-writing rules in `SKILL.md` apply in full).
10
+ - A **user-invoked** skill strips the description from the agent's reach: only the human typing its name can invoke it, and no other skill can. Zero context load, but it spends cognitive load: you are the index that must remember it exists. Mechanics: set `disable-model-invocation: true`; the `description` becomes human-facing: a one-line summary, trigger lists stripped.
11
+
12
+ Pick model-invocation only when the agent must reach the skill on its own, or another skill must. If it only ever fires by hand, make it user-invoked and pay no context load.
13
+
14
+ Shared reference that two user-invoked skills both need can live in neither: with no descriptions, neither can fire the other. Push it to a plain file outside the skill system: external reference any skill can point at.
15
+
16
+ ## Splitting by invocation
17
+
18
+ The invocation cut of splitting (the sequence cut lives in `SKILL.md`): split off a model-invoked skill when you have a distinct leading word that should trigger it on its own (a trigger word you actually use in your prompts), or another skill must reach it. You pay context load for the new always-loaded description, so that independent reach has to be worth it.
19
+
20
+ ## Router skills
21
+
22
+ When user-invoked skills multiply past what you can remember, that piled-up cognitive load is cured by a **router skill**: one user-invoked skill that names the others and when to reach for each, so the human has one skill to remember instead of many. It can only hint, never fire them: user-invoked skills have no description, so nothing but the human can reach them.
@@ -0,0 +1,12 @@
1
+ # Matt Pocock skills(随包副本)
2
+
3
+ - 来源:https://github.com/mattpocock/skills
4
+ - 版本:1.3.1
5
+ - commit:5beb35b040e3de97e54fa9e386d7e42d15c295c2
6
+ - 许可:MIT(见同目录 `LICENSE`)
7
+ - 随包文件:`grilling.md`、`to-spec.md`、`to-tickets.md`、`writing-for-agents.md`、`SKILL-MECHANICS.md`
8
+
9
+ 这些文件按原样随 RalphFlow 提供,便于 `ralphflow-create` skill 在用户没有安装 Matt 技能包时仍能读取同一套方法。
10
+
11
+ - 校验方法:在本目录运行 `sha256sum -c SHA256SUMS`。
12
+ - 这些文件必须保持与上游 commit `5beb35b` 逐字一致,只允许去掉 frontmatter。
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: grilling
3
+ description: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
4
+ ---
5
+
6
+ Interview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.
7
+
8
+ Work the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.
9
+
10
+ Format a round like so:
11
+
12
+ ```
13
+ ❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
14
+
15
+ ➡️ <your recommended answer>
16
+
17
+ ---
18
+
19
+ ❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
20
+
21
+ ➡️ <your recommended answer>
22
+ ```
23
+
24
+ Word each question so "yes" accepts your recommended answer.
25
+
26
+ Each round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.
27
+
28
+ Finding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.
29
+
30
+ The session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: to-spec
3
+ description: "Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed."
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ This skill takes the current conversation context and codebase understanding and produces a spec. Do NOT interview the user; just synthesize what you already know.
8
+
9
+ The issue tracker and triage label vocabulary should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
10
+
11
+ ## Process
12
+
13
+ 1. Explore the repo to understand the current state of the codebase, if you haven't already. Use the project's domain glossary vocabulary throughout the spec, and respect any ADRs in the area you're touching.
14
+
15
+ 2. Sketch out the seams at which you're going to test the feature. Existing seams should be preferred to new ones. Use the highest seam possible. If new seams are needed, propose them at the highest point you can. The fewer seams across the codebase, the better - the ideal number is one.
16
+
17
+ Check with the user that these seams match their expectations.
18
+
19
+ 3. Write the spec using the template below, then publish it to the project issue tracker. Apply the `ready-for-agent` triage label - no need for additional triage.
20
+
21
+ <spec-template>
22
+
23
+ ## Problem Statement
24
+
25
+ The problem that the user is facing, from the user's perspective.
26
+
27
+ ## Solution
28
+
29
+ The solution to the problem, from the user's perspective.
30
+
31
+ ## User Stories
32
+
33
+ A LONG, numbered list of user stories. Each user story should be in the format of:
34
+
35
+ 1. As an <actor>, I want a <feature>, so that <benefit>
36
+
37
+ <user-story-example>
38
+ 1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending
39
+ </user-story-example>
40
+
41
+ This list of user stories should be extremely extensive and cover all aspects of the feature.
42
+
43
+ ## Implementation Decisions
44
+
45
+ A list of implementation decisions that were made. This can include:
46
+
47
+ - The modules that will be built/modified
48
+ - The interfaces of those modules that will be modified
49
+ - Technical clarifications from the developer
50
+ - Architectural decisions
51
+ - Schema changes
52
+ - API contracts
53
+ - Specific interactions
54
+
55
+ Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
56
+
57
+ Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it within the relevant decision and note briefly that it came from a prototype. Trim to the decision-rich parts, not a working demo, just the important bits.
58
+
59
+ ## Testing Decisions
60
+
61
+ A list of testing decisions that were made. Include:
62
+
63
+ - A description of what makes a good test (only test external behavior, not implementation details)
64
+ - Which modules will be tested
65
+ - Prior art for the tests (i.e. similar types of tests in the codebase)
66
+
67
+ ## Out of Scope
68
+
69
+ A description of the things that are out of scope for this spec.
70
+
71
+ ## Further Notes
72
+
73
+ Any further notes about the feature.
74
+
75
+ </spec-template>
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: to-tickets
3
+ description: Break a plan, spec, or the current conversation into a set of tracer-bullet tickets, each declaring its blocking edges, published to the configured tracker (edges as text in one file per ticket locally, or native blocking links on a real tracker).
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # To Tickets
8
+
9
+ Break a plan, spec, or conversation into a set of **tickets**: tracer-bullet vertical slices, each declaring the tickets that **block** it.
10
+
11
+ The issue tracker and triage label vocabulary should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
12
+
13
+ ## Process
14
+
15
+ ### 1. Gather context
16
+
17
+ Work from whatever is already in the conversation context. If the user passes a reference (a spec path, an issue number or URL) as an argument, fetch it and read its full body and comments.
18
+
19
+ ### 2. Explore the codebase (optional)
20
+
21
+ If you have not already explored the codebase, do so to understand the current state of the code. Ticket titles and descriptions should use the project's domain glossary vocabulary, and respect ADRs in the area you're touching.
22
+
23
+ Look for opportunities to prefactor the code to make the implementation easier. "Make the change easy, then make the easy change."
24
+
25
+ ### 3. Draft vertical slices
26
+
27
+ Break the work into **tracer bullet** tickets.
28
+
29
+ <vertical-slice-rules>
30
+
31
+ - Each slice cuts a narrow but COMPLETE path through every layer (schema, API, UI, tests): vertical, NOT a horizontal slice of one layer
32
+ - A completed slice is demoable or verifiable on its own
33
+ - Each slice is sized to fit in a single fresh context window
34
+ - Any prefactoring should be done first
35
+
36
+ </vertical-slice-rules>
37
+
38
+ Give each ticket its **blocking edges**: the other tickets that must complete before it can start. A ticket with no blockers can start immediately.
39
+
40
+ **Wide refactors are the exception to vertical slicing.** A **wide refactor** is one mechanical change (rename a column, retype a shared symbol) whose **blast radius** fans across the whole codebase, so a single edit breaks thousands of call sites at once and no vertical slice can land green. Don't force it into a tracer bullet; sequence it as **expand–contract**. First expand: add the new form beside the old so nothing breaks. Then migrate the call sites over in batches sized by blast radius (per package, per directory), each batch its own ticket blocked by the expand, keeping CI green batch to batch because the old form still exists. Finally contract: delete the old form once no caller remains, in a ticket blocked by every migrate batch. When even the batches can't stay green alone, keep the sequence but let them share an integration branch that all block a final integrate-and-verify ticket; green is promised only there.
41
+
42
+ ### 4. Quiz the user
43
+
44
+ Present the proposed breakdown as a numbered list. For each ticket, show:
45
+
46
+ - **Title**: short descriptive name
47
+ - **Blocked by**: which other tickets (if any) must complete first
48
+ - **What it delivers**: the end-to-end behaviour this ticket makes work
49
+
50
+ Ask the user:
51
+
52
+ - Does the granularity feel right? (too coarse / too fine)
53
+ - Are the blocking edges correct: does each ticket only depend on tickets that genuinely gate it?
54
+ - Should any tickets be merged or split further?
55
+
56
+ Iterate until the user approves the breakdown.
57
+
58
+ ### 5. Publish the tickets to the configured tracker
59
+
60
+ Publish the approved tickets. **How** depends on the tracker `/setup-matt-pocock-skills` configured; the tickets are the same either way, only the shape of the blocking edges changes:
61
+
62
+ - **Local files** → write one file per ticket under `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01` in dependency order (blockers first). Each file's "Blocked by" lists the numbers/titles it depends on. Use the per-ticket file template below: one ticket per file, never a single combined file.
63
+ - **A real issue tracker (GitHub, Linear, …)** → publish one issue per ticket in dependency order (blockers first) so each ticket's blocking edges can reference real identifiers. Use the platform's native blocking relationship where it has one; otherwise set each ticket's "Blocked by" to the blocking issues. If the source was an existing issue, make each ticket its sub-issue (tracker doc's operation). Apply the `ready-for-agent` triage label unless instructed otherwise; the tickets are agent-grabbable by construction.
64
+
65
+ Work the **frontier**: any ticket whose blockers are all done. For a purely linear chain that means top to bottom.
66
+
67
+ Do NOT close or modify any parent issue.
68
+
69
+ <local-ticket-template>
70
+
71
+ # <NN>: <Ticket title>
72
+
73
+ **What to build:** the end-to-end behaviour this ticket makes work, from the user's perspective, not a layer-by-layer implementation list.
74
+
75
+ **Blocked by:** the numbers/titles of the tickets that gate this one, or "None (can start immediately)".
76
+
77
+ **Status:** ready-for-agent
78
+
79
+ - [ ] Acceptance criterion 1
80
+ - [ ] Acceptance criterion 2
81
+
82
+ </local-ticket-template>
83
+
84
+ <issue-template>
85
+
86
+ ## Parent
87
+
88
+ A reference to the parent issue on the tracker (if the source was an existing issue, otherwise omit this section).
89
+
90
+ ## What to build
91
+
92
+ The end-to-end behaviour this ticket makes work, from the user's perspective, not layer-by-layer implementation.
93
+
94
+ ## Acceptance criteria
95
+
96
+ - [ ] Criterion 1
97
+ - [ ] Criterion 2
98
+
99
+ ## Blocked by
100
+
101
+ - A reference to each blocking ticket, or "None (can start immediately)". Omit this section when blockers were set as native edges.
102
+
103
+ </issue-template>
104
+
105
+ In either form, avoid specific file paths or code snippets: they go stale fast. Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it and note briefly that it came from a prototype. Trim to the decision-rich parts, not a working demo, just the important bits.