@jaybeeuu/agent-cortex 1.42.0 → 2.0.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 (83) hide show
  1. package/.agents/skills/style-versioning/SKILL.md +78 -8
  2. package/.github/workflows/ci.yml +51 -38
  3. package/AGENTS.md +32 -17
  4. package/CHANGELOG.md +182 -0
  5. package/README.md +167 -126
  6. package/agents/README.md +26 -27
  7. package/agents/ralph/agent.md +7 -10
  8. package/agents/ralph/claude/polling.md +1 -1
  9. package/bin/agent-cortex.mjs +46 -44
  10. package/bin/installers/claude.mjs +2 -2
  11. package/bin/installers/pi.mjs +885 -237
  12. package/docs/claude-hooks.md +5 -4
  13. package/docs/commit-signing.md +231 -0
  14. package/docs/ideas/enable-signed-commit-enforcement-changesets-bot-commits-must-be-signed.md +10 -1
  15. package/docs/ideas/extension-manifests.md +5 -0
  16. package/docs/research/disable-model-invocation.md +82 -0
  17. package/docs/research/skill-design-research.md +2 -2
  18. package/docs/skills/skill-anatomy.md +5 -2
  19. package/docs/technical-direction/harness-config.md +30 -14
  20. package/docs/technical-direction/migration-execution-labels.md +17 -9
  21. package/docs/user-preferences.md +2 -2
  22. package/extensions/agent-modes/README.md +3 -3
  23. package/extensions/agent-modes/discover.test.ts +19 -0
  24. package/extensions/agent-modes/discover.ts +31 -9
  25. package/extensions/session-start/README.md +38 -0
  26. package/extensions/session-start/index.test.ts +122 -0
  27. package/extensions/session-start/index.ts +27 -0
  28. package/extensions/session-start/package.json +19 -0
  29. package/extensions/session-start/tsconfig.json +12 -0
  30. package/extensions/skill-stats/pnpm-lock.yaml +329 -0
  31. package/extensions/subagent/README.md +3 -3
  32. package/extensions/subagent/agents.test.ts +176 -0
  33. package/extensions/subagent/agents.ts +101 -11
  34. package/extensions/subagent/index.ts +2 -1
  35. package/extensions/subagent/package.json +1 -1
  36. package/lib/cli.mjs +40 -16
  37. package/package.json +8 -9
  38. package/pi/settings.json +1 -7
  39. package/pnpm-workspace.yaml +6 -0
  40. package/scripts/check-changeset.mjs +42 -0
  41. package/scripts/lib/compose-agent.mjs +10 -10
  42. package/scripts/lib/release-gates.mjs +61 -0
  43. package/scripts/lib/verify-worker-tree.mjs +107 -0
  44. package/scripts/resolve-publish-command.mjs +17 -0
  45. package/skills/planning/create-task/scripts/pnpm-lock.yaml +342 -0
  46. package/skills/productivity/validate-agent-dir/scripts/pnpm-lock.yaml +329 -0
  47. package/skills/workflow/git-workflow/SKILL.md +35 -1
  48. package/skills/workflow/ralph/REFERENCE.md +20 -4
  49. package/skills/workflow/ralph/SKILL.md +9 -6
  50. package/skills/workflow/run-pipeline-stage/SKILL.md +11 -4
  51. package/skills/workflow/run-pipeline-stage/playbooks/code.md +2 -0
  52. package/skills/workflow/run-pipeline-stage/playbooks/document.md +3 -0
  53. package/skills/workflow/run-pipeline-stage/playbooks/fix.md +2 -0
  54. package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +11 -0
  55. package/skills/workflow/run-pipeline-stage/scripts/pnpm-lock.yaml +342 -0
  56. package/test/cli.test.mjs +37 -39
  57. package/test/helpers/fake-pi.mjs +132 -0
  58. package/test/pi-installer.test.mjs +345 -286
  59. package/test/pi-register.test.mjs +342 -0
  60. package/test/pi-sweep.test.mjs +619 -0
  61. package/test/release-gates.test.mjs +190 -0
  62. package/test/verify-worker-tree.test.mjs +120 -0
  63. package/token-map.README.md +16 -18
  64. package/token-map.json +29 -33
  65. package/agents/plan/copilot/frontmatter.json +0 -6
  66. package/agents/plan.agent.md +0 -59
  67. package/agents/ralph/copilot/frontmatter.json +0 -6
  68. package/agents/ralph/copilot/polling.md +0 -62
  69. package/agents/ralph-plan/copilot/frontmatter.json +0 -6
  70. package/agents/ralph-plan.agent.md +0 -126
  71. package/agents/ralph.agent.md +0 -331
  72. package/agents/strategy/copilot/frontmatter.json +0 -6
  73. package/agents/strategy.agent.md +0 -112
  74. package/bin/installers/copilot.mjs +0 -124
  75. package/extensions/session-start.ts +0 -44
  76. package/hooks.json +0 -10
  77. package/lib/pi-packages.mjs +0 -169
  78. package/plugin.json +0 -35
  79. package/scripts/build-copilot-agents.mjs +0 -30
  80. package/scripts/install-instructions.sh +0 -82
  81. package/scripts/sync-plugin-version.sh +0 -17
  82. package/test/copilot-installer.test.mjs +0 -308
  83. package/test/pi-packages.test.mjs +0 -295
@@ -0,0 +1,329 @@
1
+ lockfileVersion: '9.0'
2
+
3
+ settings:
4
+ autoInstallPeers: true
5
+ excludeLinksFromLockfile: false
6
+
7
+ importers:
8
+
9
+ .:
10
+ devDependencies:
11
+ '@types/node':
12
+ specifier: ^22.20.1
13
+ version: 22.20.1
14
+ tsx:
15
+ specifier: ^4.23.0
16
+ version: 4.23.5
17
+ typescript:
18
+ specifier: ^5.0.0
19
+ version: 5.9.3
20
+
21
+ packages:
22
+
23
+ '@esbuild/aix-ppc64@0.28.1':
24
+ resolution: {integrity: sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==}
25
+ engines: {node: '>=18'}
26
+ cpu: [ppc64]
27
+ os: [aix]
28
+
29
+ '@esbuild/android-arm64@0.28.1':
30
+ resolution: {integrity: sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==}
31
+ engines: {node: '>=18'}
32
+ cpu: [arm64]
33
+ os: [android]
34
+
35
+ '@esbuild/android-arm@0.28.1':
36
+ resolution: {integrity: sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==}
37
+ engines: {node: '>=18'}
38
+ cpu: [arm]
39
+ os: [android]
40
+
41
+ '@esbuild/android-x64@0.28.1':
42
+ resolution: {integrity: sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==}
43
+ engines: {node: '>=18'}
44
+ cpu: [x64]
45
+ os: [android]
46
+
47
+ '@esbuild/darwin-arm64@0.28.1':
48
+ resolution: {integrity: sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==}
49
+ engines: {node: '>=18'}
50
+ cpu: [arm64]
51
+ os: [darwin]
52
+
53
+ '@esbuild/darwin-x64@0.28.1':
54
+ resolution: {integrity: sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==}
55
+ engines: {node: '>=18'}
56
+ cpu: [x64]
57
+ os: [darwin]
58
+
59
+ '@esbuild/freebsd-arm64@0.28.1':
60
+ resolution: {integrity: sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==}
61
+ engines: {node: '>=18'}
62
+ cpu: [arm64]
63
+ os: [freebsd]
64
+
65
+ '@esbuild/freebsd-x64@0.28.1':
66
+ resolution: {integrity: sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==}
67
+ engines: {node: '>=18'}
68
+ cpu: [x64]
69
+ os: [freebsd]
70
+
71
+ '@esbuild/linux-arm64@0.28.1':
72
+ resolution: {integrity: sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==}
73
+ engines: {node: '>=18'}
74
+ cpu: [arm64]
75
+ os: [linux]
76
+
77
+ '@esbuild/linux-arm@0.28.1':
78
+ resolution: {integrity: sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==}
79
+ engines: {node: '>=18'}
80
+ cpu: [arm]
81
+ os: [linux]
82
+
83
+ '@esbuild/linux-ia32@0.28.1':
84
+ resolution: {integrity: sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==}
85
+ engines: {node: '>=18'}
86
+ cpu: [ia32]
87
+ os: [linux]
88
+
89
+ '@esbuild/linux-loong64@0.28.1':
90
+ resolution: {integrity: sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==}
91
+ engines: {node: '>=18'}
92
+ cpu: [loong64]
93
+ os: [linux]
94
+
95
+ '@esbuild/linux-mips64el@0.28.1':
96
+ resolution: {integrity: sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==}
97
+ engines: {node: '>=18'}
98
+ cpu: [mips64el]
99
+ os: [linux]
100
+
101
+ '@esbuild/linux-ppc64@0.28.1':
102
+ resolution: {integrity: sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==}
103
+ engines: {node: '>=18'}
104
+ cpu: [ppc64]
105
+ os: [linux]
106
+
107
+ '@esbuild/linux-riscv64@0.28.1':
108
+ resolution: {integrity: sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==}
109
+ engines: {node: '>=18'}
110
+ cpu: [riscv64]
111
+ os: [linux]
112
+
113
+ '@esbuild/linux-s390x@0.28.1':
114
+ resolution: {integrity: sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==}
115
+ engines: {node: '>=18'}
116
+ cpu: [s390x]
117
+ os: [linux]
118
+
119
+ '@esbuild/linux-x64@0.28.1':
120
+ resolution: {integrity: sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==}
121
+ engines: {node: '>=18'}
122
+ cpu: [x64]
123
+ os: [linux]
124
+
125
+ '@esbuild/netbsd-arm64@0.28.1':
126
+ resolution: {integrity: sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==}
127
+ engines: {node: '>=18'}
128
+ cpu: [arm64]
129
+ os: [netbsd]
130
+
131
+ '@esbuild/netbsd-x64@0.28.1':
132
+ resolution: {integrity: sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==}
133
+ engines: {node: '>=18'}
134
+ cpu: [x64]
135
+ os: [netbsd]
136
+
137
+ '@esbuild/openbsd-arm64@0.28.1':
138
+ resolution: {integrity: sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==}
139
+ engines: {node: '>=18'}
140
+ cpu: [arm64]
141
+ os: [openbsd]
142
+
143
+ '@esbuild/openbsd-x64@0.28.1':
144
+ resolution: {integrity: sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==}
145
+ engines: {node: '>=18'}
146
+ cpu: [x64]
147
+ os: [openbsd]
148
+
149
+ '@esbuild/openharmony-arm64@0.28.1':
150
+ resolution: {integrity: sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==}
151
+ engines: {node: '>=18'}
152
+ cpu: [arm64]
153
+ os: [openharmony]
154
+
155
+ '@esbuild/sunos-x64@0.28.1':
156
+ resolution: {integrity: sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==}
157
+ engines: {node: '>=18'}
158
+ cpu: [x64]
159
+ os: [sunos]
160
+
161
+ '@esbuild/win32-arm64@0.28.1':
162
+ resolution: {integrity: sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==}
163
+ engines: {node: '>=18'}
164
+ cpu: [arm64]
165
+ os: [win32]
166
+
167
+ '@esbuild/win32-ia32@0.28.1':
168
+ resolution: {integrity: sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==}
169
+ engines: {node: '>=18'}
170
+ cpu: [ia32]
171
+ os: [win32]
172
+
173
+ '@esbuild/win32-x64@0.28.1':
174
+ resolution: {integrity: sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==}
175
+ engines: {node: '>=18'}
176
+ cpu: [x64]
177
+ os: [win32]
178
+
179
+ '@types/node@22.20.1':
180
+ resolution: {integrity: sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q==}
181
+
182
+ esbuild@0.28.1:
183
+ resolution: {integrity: sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==}
184
+ engines: {node: '>=18'}
185
+ hasBin: true
186
+
187
+ fsevents@2.3.3:
188
+ resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
189
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
190
+ os: [darwin]
191
+
192
+ tsx@4.23.5:
193
+ resolution: {integrity: sha512-rw55FUaqOoI7RvlQwLbhO4nSDApnQ4/CykPuiQ/EPvtrX3WA9Ig55jIt9VvbBJbzJuj12ueRu4PMZ2SxPVbihg==}
194
+ engines: {node: '>=18.0.0'}
195
+ hasBin: true
196
+
197
+ typescript@5.9.3:
198
+ resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
199
+ engines: {node: '>=14.17'}
200
+ hasBin: true
201
+
202
+ undici-types@6.21.0:
203
+ resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
204
+
205
+ snapshots:
206
+
207
+ '@esbuild/aix-ppc64@0.28.1':
208
+ optional: true
209
+
210
+ '@esbuild/android-arm64@0.28.1':
211
+ optional: true
212
+
213
+ '@esbuild/android-arm@0.28.1':
214
+ optional: true
215
+
216
+ '@esbuild/android-x64@0.28.1':
217
+ optional: true
218
+
219
+ '@esbuild/darwin-arm64@0.28.1':
220
+ optional: true
221
+
222
+ '@esbuild/darwin-x64@0.28.1':
223
+ optional: true
224
+
225
+ '@esbuild/freebsd-arm64@0.28.1':
226
+ optional: true
227
+
228
+ '@esbuild/freebsd-x64@0.28.1':
229
+ optional: true
230
+
231
+ '@esbuild/linux-arm64@0.28.1':
232
+ optional: true
233
+
234
+ '@esbuild/linux-arm@0.28.1':
235
+ optional: true
236
+
237
+ '@esbuild/linux-ia32@0.28.1':
238
+ optional: true
239
+
240
+ '@esbuild/linux-loong64@0.28.1':
241
+ optional: true
242
+
243
+ '@esbuild/linux-mips64el@0.28.1':
244
+ optional: true
245
+
246
+ '@esbuild/linux-ppc64@0.28.1':
247
+ optional: true
248
+
249
+ '@esbuild/linux-riscv64@0.28.1':
250
+ optional: true
251
+
252
+ '@esbuild/linux-s390x@0.28.1':
253
+ optional: true
254
+
255
+ '@esbuild/linux-x64@0.28.1':
256
+ optional: true
257
+
258
+ '@esbuild/netbsd-arm64@0.28.1':
259
+ optional: true
260
+
261
+ '@esbuild/netbsd-x64@0.28.1':
262
+ optional: true
263
+
264
+ '@esbuild/openbsd-arm64@0.28.1':
265
+ optional: true
266
+
267
+ '@esbuild/openbsd-x64@0.28.1':
268
+ optional: true
269
+
270
+ '@esbuild/openharmony-arm64@0.28.1':
271
+ optional: true
272
+
273
+ '@esbuild/sunos-x64@0.28.1':
274
+ optional: true
275
+
276
+ '@esbuild/win32-arm64@0.28.1':
277
+ optional: true
278
+
279
+ '@esbuild/win32-ia32@0.28.1':
280
+ optional: true
281
+
282
+ '@esbuild/win32-x64@0.28.1':
283
+ optional: true
284
+
285
+ '@types/node@22.20.1':
286
+ dependencies:
287
+ undici-types: 6.21.0
288
+
289
+ esbuild@0.28.1:
290
+ optionalDependencies:
291
+ '@esbuild/aix-ppc64': 0.28.1
292
+ '@esbuild/android-arm': 0.28.1
293
+ '@esbuild/android-arm64': 0.28.1
294
+ '@esbuild/android-x64': 0.28.1
295
+ '@esbuild/darwin-arm64': 0.28.1
296
+ '@esbuild/darwin-x64': 0.28.1
297
+ '@esbuild/freebsd-arm64': 0.28.1
298
+ '@esbuild/freebsd-x64': 0.28.1
299
+ '@esbuild/linux-arm': 0.28.1
300
+ '@esbuild/linux-arm64': 0.28.1
301
+ '@esbuild/linux-ia32': 0.28.1
302
+ '@esbuild/linux-loong64': 0.28.1
303
+ '@esbuild/linux-mips64el': 0.28.1
304
+ '@esbuild/linux-ppc64': 0.28.1
305
+ '@esbuild/linux-riscv64': 0.28.1
306
+ '@esbuild/linux-s390x': 0.28.1
307
+ '@esbuild/linux-x64': 0.28.1
308
+ '@esbuild/netbsd-arm64': 0.28.1
309
+ '@esbuild/netbsd-x64': 0.28.1
310
+ '@esbuild/openbsd-arm64': 0.28.1
311
+ '@esbuild/openbsd-x64': 0.28.1
312
+ '@esbuild/openharmony-arm64': 0.28.1
313
+ '@esbuild/sunos-x64': 0.28.1
314
+ '@esbuild/win32-arm64': 0.28.1
315
+ '@esbuild/win32-ia32': 0.28.1
316
+ '@esbuild/win32-x64': 0.28.1
317
+
318
+ fsevents@2.3.3:
319
+ optional: true
320
+
321
+ tsx@4.23.5:
322
+ dependencies:
323
+ esbuild: 0.28.1
324
+ optionalDependencies:
325
+ fsevents: 2.3.3
326
+
327
+ typescript@5.9.3: {}
328
+
329
+ undici-types@6.21.0: {}
@@ -66,7 +66,41 @@ git pull
66
66
 
67
67
  This avoids avoidable merge conflicts.
68
68
 
69
- ### 5. Worktree lifecycle
69
+ ### 5. Bring a behind branch up to date — merge, don't rebase
70
+
71
+ When the base branch moves and the PR reports `BEHIND` or `CONFLICTING`, update
72
+ the branch before anything else:
73
+
74
+ ```bash
75
+ git fetch origin
76
+ git merge origin/main
77
+ ```
78
+
79
+ **Never rebase a branch that contains a merge commit.** `git rebase` drops merge
80
+ commits and the patches they carry, so rebasing a branch that already merged the
81
+ base silently reverts what that merge resolved — the conflict resolutions, and
82
+ any fix from the base the merge brought in. The result usually looks like a
83
+ regression in your own change. `--rebase-merges` preserves the structure, but
84
+ it re-opens the same conflicts; only worth it when the branch's history is
85
+ itself the deliverable.
86
+
87
+ Rebase only a **linear branch that has not been reviewed yet**. Rewriting
88
+ commits under review discards the review context and invalidates approvals, and
89
+ it requires `git push --force-with-lease` — never `--force`, which overwrites
90
+ work you have not seen.
91
+
92
+ Which one you owe the repository depends on its landing method, not on taste:
93
+
94
+ - **Squash merge**: the branch is collapsed on landing, so its shape never
95
+ reaches the base branch. Merge the base in and move on — rebasing here is
96
+ cosmetic, and the risky kind of cosmetic.
97
+ - **Rebase-and-merge**: a linear branch is mandatory, so rebase *before* the
98
+ first review. Once a merge has landed on the branch, that option is gone.
99
+
100
+ After any update, re-run the checks. A merge that resolved conflicts by hand is
101
+ not verified by the base branch's green CI.
102
+
103
+ ### 6. Worktree lifecycle
70
104
 
71
105
  After the PR is merged or closed, clean up the worktree:
72
106
 
@@ -19,7 +19,23 @@ Detailed procedures for the ralph orchestration workflow. See [SKILL.md](./SKILL
19
19
  - For `verify`, `review`, `document` stages: `SUMMARY` and `FILES_CHANGED` from the preceding stage's report
20
20
  - Log file path `.agent-cortex/ralph/ralph-<parent-id>.log` — logs are keyed by **parent** bead ID, so every stage chore of a feature appends to the same file
21
21
  7. **Call the {{TOOL:task}} tool** with the filled prompt as `prompt` and the worktree path as `cwd`. Store the returned agentId — you need it for step 8 and for log polling.
22
- 8. **Map** the agent ID to the bead ID in memory for lookup on completion.
22
+
23
+ If this session has no subagent tool, **stop and say so**. Do not substitute a backgrounded CLI run (`pi -p … &`): that launch has no completion signal, so a finished worker and a killed one look identical, which is how stages came to be reported complete over uncommitted trees. Record the bead for the shutdown summary and tell the human the session needs restarting with the subagent extension loaded.
24
+ 8. **Record the base commit** before the worker starts — you verify delivery against it (_Verified Completion_ below):
25
+ ```bash
26
+ git -C .agent-cortex/worktrees/<parent-id> rev-parse HEAD
27
+ ```
28
+ 9. **Map** the agent ID to the bead ID in memory for lookup on completion.
29
+
30
+ ### Verified Completion
31
+
32
+ A worker's `---REPORT---` is a claim about the worktree, not evidence of it. Verify the delivery before advancing the parent:
33
+
34
+ ```bash
35
+ node scripts/lib/verify-worker-tree.mjs --worktree .agent-cortex/worktrees/<parent-id> --base <base>
36
+ ```
37
+
38
+ Exit code 0 means a clean tree with at least one commit ahead of the recorded base. A non-zero exit reports `worktree is dirty` or `no commit ahead of base`, and the stage did **not** deliver whatever its `OUTCOME` line says. Re-dispatch the same chore, or record the failure for the fix chain — never advance the parent, close the chore, or open a feature PR over uncommitted work.
23
39
 
24
40
  ---
25
41
 
@@ -100,7 +116,7 @@ When a verify or review stage fails:
100
116
 
101
117
  ## Log Polling
102
118
 
103
- Run whenever polling is triggered (timer or agent completion):
119
+ Run whenever completion handling is triggered (an agent completion):
104
120
 
105
121
  1. **Query in-flight beads**: `bd list --status=in_progress --type=chore`. Extract each bead's ID and title.
106
122
  2. For each in-flight bead, read new lines from its **parent's** log file — logs are keyed by **parent** bead ID, so all stages of a feature share one file. Track the next unread line number per parent in memory, starting at 1:
@@ -151,7 +167,7 @@ Proceed here when no chore beads are in-flight, no `stage:*` chore beads are rea
151
167
 
152
168
  When you've completed the above, prompt me to continue.
153
169
  ```
154
- 6. **Stop completely.** Do not restart the poll timer. Do not continue the event loop. Wait for the user to re-prompt before doing any further work.
170
+ 6. **Stop completely.** Do not continue the event loop. Wait for the user to re-prompt before doing any further work.
155
171
 
156
172
  ---
157
173
 
@@ -193,7 +209,7 @@ When `bd list --status=in_progress --type=chore` returns no results AND `bd read
193
209
  | File | Purpose |
194
210
  |------|---------|
195
211
  | `.agent-cortex/ralph/progress.md` | Human-readable snapshot. Regenerate: `workspace="/abs/path"; pnpm --prefix skills/workflow/run-pipeline-stage/scripts exec tsx generate-progress.ts --workspace "$workspace" > "$workspace/.agent-cortex/ralph/progress.md"`. `workspace` must be an **absolute** path — never `.` or `$(pwd)`. **Never hand-edit.** |
196
- | `.agent-cortex/ralph/state.json` | Runtime bookkeeping only: the poll-timer shellId (Copilot) and the in-flight agent-ID→bead mapping. Shape: `{ "timerShellId": null, "inflight": [ { "choreId": "...", "parentId": "...", "title": "...", "agentId": "...", "logLine": 1 } ] }`. Initialise at startup with `{ "timerShellId": null, "inflight": [] }`. Update after every dispatch and every agent completion. **Never hand-edit.** |
212
+ | `.agent-cortex/ralph/state.json` | Runtime bookkeeping only: the in-flight agent-ID→bead mapping. Shape: `{ "inflight": [ { "choreId": "...", "parentId": "...", "title": "...", "agentId": "...", "logLine": 1 } ] }`. Initialise at startup with `{ "inflight": [] }`. Update after every dispatch and every agent completion. **Never hand-edit.** |
197
213
  | `.agent-cortex/ralph/ralph-*.log` | Per-parent log files written by subagents — every stage chore of a feature appends to `.agent-cortex/ralph/ralph-<parent-id>.log` (e.g. `ralph-abc-123.log`). |
198
214
 
199
215
  All task state is derived from beads; `state.json` holds only runtime bookkeeping:
@@ -7,7 +7,7 @@ description: "Run all pending beads end-to-end with up to 5 concurrent pipeline-
7
7
 
8
8
  Ralph is a parallel orchestration loop. It advances AFK task beads through pipeline-stage chores (`code` → `verify` → `review` → `document`), dispatching each stage as a background subagent in the feature's worktree, then opens review-gated feature and epic PRs and pauses for human merges. Ralph never writes code itself — it dispatches, tracks, and reports.
9
9
 
10
- State model: task state lives in beads (ready/in_progress via `bd`); the only local file is `.agent-cortex/ralph/state.json`, holding the poll-timer shellId and the agent-ID→bead mapping. Pipeline configuration comes from `skills/planning/create-task/pipeline.json`, and stage execution belongs to the `run-pipeline-stage` skill.
10
+ State model: task state lives in beads (ready/in_progress via `bd`); the only local file is `.agent-cortex/ralph/state.json`, holding the agent-ID→bead mapping. Pipeline configuration comes from `skills/planning/create-task/pipeline.json`, and stage execution belongs to the `run-pipeline-stage` skill.
11
11
 
12
12
  ## When to use
13
13
 
@@ -28,14 +28,14 @@ State model: task state lives in beads (ready/in_progress via `bd`); the only lo
28
28
  1. Run `bd prime` and hold the output verbatim in memory.
29
29
  2. Ensure `.agent-cortex/` and `.agent-cortex/worktrees/` are in the project's `.gitignore` (append any that are missing).
30
30
  3. Create the workspace: `mkdir -p .agent-cortex/ralph`.
31
- 4. Initialize state: write `.agent-cortex/ralph/state.json` with `{ "timerShellId": null, "inflight": [] }`.
31
+ 4. Initialize state: write `.agent-cortex/ralph/state.json` with `{ "inflight": [] }`.
32
32
  5. Read `skills/planning/create-task/pipeline.json` and hold it in memory — you need its `maxFixRounds` for the fix loop.
33
33
  6. Run `bd ready` and classify each available bead:
34
34
  - **Chore with a `stage:*` label**: pipeline stage bead — eligible for dispatch.
35
35
  - **Task or other type without an `implementation-type:*` label**: unexpected here — classification happens at planning time via `create-task`. Do not invoke `classify-bead`; treat as needs-refinement and note it for the shutdown summary.
36
36
  - **Task labelled `implementation-type:hitl`**: skip — record the ID for the Pending Human Action summary at shutdown.
37
37
  7. For each ready chore bead (up to 5), dispatch it from its parent's feature worktree (see _Dispatching a chore bead_ in REFERENCE.md — create branches/worktrees first).
38
- 8. Hand over to your harness's completion-detection mechanism: Copilot keeps a `sleep 120` poll timer running in the background; PI keeps a {{TOOL:wait_for_agents}} call outstanding over every in-flight agent ID. If no chore was dispatched and HITL gate beads are pending (`bd list -l lifecycle:feature-pr -l implementation-type:hitl` or `bd list -l awaiting-epic-pr-merge`), go straight to HITL Pause (REFERENCE.md).
38
+ 8. Hand over to your harness's completion-detection mechanism: PI keeps a {{TOOL:wait_for_agents}} call outstanding over every in-flight agent ID. If no chore was dispatched and HITL gate beads are pending (`bd list -l lifecycle:feature-pr -l implementation-type:hitl` or `bd list -l awaiting-epic-pr-merge`), go straight to HITL Pause (REFERENCE.md).
39
39
  9. Regenerate `.agent-cortex/ralph/progress.md`:
40
40
  ```bash
41
41
  # workspace must be the absolute path you cd'd into — never . or $(pwd)
@@ -45,11 +45,11 @@ State model: task state lives in beads (ready/in_progress via `bd`); the only lo
45
45
 
46
46
  ### 2. Event loop
47
47
 
48
- On each completion notification (background agent finished, or the poll timer fired):
48
+ On each completion notification (a background agent finished):
49
49
 
50
50
  1. Poll that parent's log for new lines — `tail -n +<nextLine> .agent-cortex/ralph/ralph-<parent-id>.log` (logs are keyed by parent bead ID, so every stage of a feature shares one file) — and post only new key events (stage transitions, test/lint results), never empty updates.
51
51
  2. Read the completed agent's output with {{TOOL:read_agent}} and parse its `---REPORT---` block for `BEAD_ID`, `STAGE_COMPLETED`, and the outcome.
52
- 3. Close the chore bead: `bd close <bead-id>`.
52
+ 3. **Verify the delivery, then close the chore bead.** Run `node scripts/lib/verify-worker-tree.mjs --worktree .agent-cortex/worktrees/<parent-id> --base <base>` (REFERENCE.md, _Verified Completion_) and close only when it exits 0: `bd close <bead-id>`.
53
53
  4. Advance the parent per the dispatch table:
54
54
 
55
55
  | Stage completed | Condition | Next action |
@@ -82,6 +82,8 @@ On each completion notification (background agent finished, or the poll timer fi
82
82
 
83
83
  - Running as a background or delegated subagent instead of the interactive foreground agent.
84
84
  - Spawning a stage runner via {{TOOL:bash}} or running a stage inline instead of {{TOOL:task}}.
85
+ - Substituting a backgrounded CLI run for a missing subagent tool — stop and report instead; that launch has no completion signal.
86
+ - Advancing a parent on a worker's `OUTCOME: SUCCESS` without verifying the worktree — the report is a claim, not evidence.
85
87
  - Editing bead files directly instead of using `bd` commands.
86
88
  - Auto-merging a PR, or continuing past a feature/epic gate before a human merge.
87
89
 
@@ -95,7 +97,7 @@ On each completion notification (background agent finished, or the poll timer fi
95
97
 
96
98
  ## Philosophy / rationale
97
99
 
98
- - Orchestration state derives from beads so a crash loses nothing but an in-memory ID mapping: `state.json` holds only the poll-timer shellId and the agent-ID→bead mapping, never task state.
100
+ - Orchestration state derives from beads so a crash loses nothing but an in-memory ID mapping: `state.json` holds only the agent-ID→bead mapping, never task state.
99
101
  - Classification happens up-front at planning time (`create-task`), so the loop can trust `bd ready` instead of re-interpreting each bead's intent.
100
102
  - Human review gates are non-negotiable because agent-authored changes still need a person to merge them.
101
103
 
@@ -114,6 +116,7 @@ On each completion notification (background agent finished, or the poll timer fi
114
116
 
115
117
  - [ ] Init ran once with observable results: `state.json` exists, `bd ready` was parsed, and the first chore beads are claimed.
116
118
  - [ ] Every stage runner was spawned with {{TOOL:task}} from the parent's feature worktree, with the `---REPORT---` instruction in its prompt.
119
+ - [ ] Every stage delivery was confirmed with `scripts/lib/verify-worker-tree.mjs` before the parent advanced, and no stage was dispatched from a session with no subagent tool.
117
120
  - [ ] In-flight count never exceeded 5, and fix loops respect `maxFixRounds` from `pipeline.json`.
118
121
  - [ ] Feature and epic PRs were pushed and reported immediately at their gates, and nothing was auto-merged.
119
122
  - [ ] `bd dolt push` and a final `progress.md` regeneration ran before HITL Pause/Shutdown, and the chat received no empty poll updates.
@@ -36,10 +36,11 @@ workspace="/absolute/path/to/worktree"
36
36
  pnpm --prefix skills/workflow/run-pipeline-stage/scripts exec tsx generate-progress.ts --workspace "$workspace" > "$workspace/.agent-cortex/ralph/progress.md"
37
37
  ```
38
38
 
39
- 7. Dispatch one subagent per stage with the composed prompt — spawn it with {{TOOL:task}} and end the prompt with the REPORT contract below.
40
- 8. Route the REPORT through the Dispatch Rules: advance to the next stage, create a feedback bead, or close the parent.
39
+ 7. Dispatch one subagent per stage with the composed prompt — spawn it with {{TOOL:task}} and end the prompt with the REPORT contract below. A session with no subagent tool cannot dispatch: stop and say so rather than substituting a backgrounded CLI run, which has no completion signal.
40
+ 8. Verify the delivery against the worktree — `node scripts/lib/verify-worker-tree.mjs --worktree <abs-worktree> --base <base>` exits 0 only for a clean tree with a commit ahead of base. A worker whose REPORT claims `OUTCOME: SUCCESS` over a dirty tree has not delivered; re-dispatch it instead of advancing.
41
+ 9. Route the REPORT through the Dispatch Rules: advance to the next stage, create a feedback bead, or close the parent.
41
42
 
42
- Each step leaves observable state — a claimed bead, a `stage:` tag, a regenerated progress doc, and a REPORT that drives the next action.
43
+ Each step leaves observable state — a claimed bead, a `stage:` tag, a regenerated progress doc, a verified commit, and a REPORT that drives the next action.
43
44
 
44
45
  ## Dispatch Rules
45
46
 
@@ -114,13 +115,18 @@ Every subagent prompt must end with the REPORT instruction:
114
115
  > STAGE_COMPLETED: <code|verify|review|document>
115
116
  > SUMMARY: <2-3 sentence summary of what was done>
116
117
  > FILES_CHANGED: <comma-separated list, or "none">
118
+ > COMMIT: <sha of the stage commit, or "none">
119
+ > PUSHED: <yes|no>
120
+ > PR: <feature PR url, or "none">
117
121
  > OUTCOME: <SUCCESS|BLOCKED>
118
122
  > BLOCKING_ISSUES: ← only if OUTCOME is BLOCKED
119
123
  > - <specific blocking issue>
120
124
  > ---
121
125
  > ```
122
126
 
123
- Subagents report facts — do not ask them to suggest or predict the next step.
127
+ Subagents report facts — do not ask them to suggest or predict the next step. A REPORT claiming
128
+ `OUTCOME: SUCCESS` with `PUSHED: no`, or a `COMMIT` that is not on the branch, records a failed
129
+ stage: the commit is the evidence, the report is the claim.
124
130
 
125
131
  ## Red Flags
126
132
 
@@ -128,6 +134,7 @@ Subagents report facts — do not ask them to suggest or predict the next step.
128
134
  - Composing a subagent prompt without the REPORT contract — the output cannot be routed.
129
135
  - Creating a feedback bead and then dispatching anyway — bypasses the fix-round accounting and parent-child dependency graph.
130
136
  - Skipping the playbook "because the stage is simple" — playbooks carry the per-stage discipline the pipeline relies on.
137
+ - Advancing on `OUTCOME: SUCCESS` without verifying the worktree — the commit is the evidence, the report is the claim.
131
138
  - Leaving bead notes to the end of the stage — a session that dies mid-stage then loses the whole trail.
132
139
 
133
140
  ## Common Rationalizations
@@ -11,7 +11,9 @@
11
11
 
12
12
  ## Stage Outcome
13
13
 
14
+ - Commit and push the stage's work before reporting (see the stage-runner prompt, _Deliver before reporting_).
14
15
  - Set `OUTCOME: SUCCESS` when implementation passes all tests and meets requirements.
15
16
  - Set `OUTCOME: BLOCKED` if tests fail or requirements cannot be met.
16
17
  - If blocked, list issues under `BLOCKING_ISSUES`.
17
18
  - `FILES_CHANGED` lists all modified source/test files.
19
+ - Report `COMMIT`, `PUSHED`, and `PR` (`PR: none` outside the document stage).
@@ -12,7 +12,10 @@
12
12
 
13
13
  ## Stage Outcome
14
14
 
15
+ - Commit and push the docs before reporting (see the stage-runner prompt, _Deliver before reporting_).
16
+ - Open or update the feature PR (`gh pr create --base <base> --head <branch>` when none is open yet).
15
17
  - Set `OUTCOME: SUCCESS` when docs are updated as needed (or none needed).
16
18
  - Set `OUTCOME: BLOCKED` if unable to update or content guidance is unclear.
17
19
  - If blocked, list issues under `BLOCKING_ISSUES`.
18
20
  - `FILES_CHANGED` lists docs touched, or `none` if no doc change is needed.
21
+ - Report `COMMIT`, `PUSHED`, and the feature `PR` URL.
@@ -11,7 +11,9 @@
11
11
 
12
12
  ## Stage Outcome
13
13
 
14
+ - Commit and push the fix before reporting (see the stage-runner prompt, _Deliver before reporting_).
14
15
  - Set `OUTCOME: SUCCESS` when requested changes are successfully applied.
15
16
  - Set `OUTCOME: BLOCKED` if unable to apply changes or guidance is unclear.
16
17
  - If blocked, list issues under `BLOCKING_ISSUES`.
17
18
  - `FILES_CHANGED` lists files updated to address requested changes.
19
+ - Report `COMMIT`, `PUSHED`, and `PR` (`PR: none`).
@@ -26,6 +26,17 @@ Use `--append-notes` — plain `--notes` overwrites the trail. Record start, mil
26
26
  (with rejected options), blocks, and discoveries. One or two lines per entry: a checkpoint trail,
27
27
  not a transcript. The REPORT below remains the authoritative stage outcome.
28
28
 
29
+ ## Deliver before reporting
30
+
31
+ A stage is delivered when its work is committed and pushed — not when the REPORT says so. The
32
+ orchestrator opens the feature PR from this branch, so uncommitted work never reaches review, and a
33
+ dirty worktree counts as a failed stage whatever the outcome line claims.
34
+
35
+ 1. Commit on the current branch: `git add -A && git commit -m "<stage>(<parent-id>): <summary>"`.
36
+ 2. Push the branch: `git push -u origin HEAD`.
37
+ 3. Report `COMMIT`, `PUSHED`, and `PR`. The `document` stage also opens or updates the feature PR
38
+ and reports its URL; every earlier stage reports `PR: none`.
39
+
29
40
  ## Instructions
30
41
  1. Read and follow the playbook file listed above.
31
42
  2. Treat the bead as the source-of-truth specification (not a prompt script).