@rune-kit/rune 2.4.0 → 2.6.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.
- package/README.md +36 -17
- package/compiler/__tests__/pack-split.test.js +141 -1
- package/compiler/__tests__/parser.test.js +147 -55
- package/compiler/__tests__/scripts-bundling.test.js +10 -11
- package/compiler/__tests__/skill-index.test.js +218 -0
- package/compiler/adapters/antigravity.js +71 -57
- package/compiler/bin/rune.js +355 -355
- package/compiler/doctor.js +11 -1
- package/compiler/emitter.js +678 -466
- package/compiler/parser.js +267 -247
- package/hooks/hooks.json +12 -0
- package/hooks/intent-router/index.cjs +108 -0
- package/hooks/pre-tool-guard/index.cjs +177 -68
- package/package.json +63 -63
- package/skills/brainstorm/SKILL.md +2 -0
- package/skills/cook/SKILL.md +661 -648
- package/skills/debug/SKILL.md +394 -392
- package/skills/deploy/SKILL.md +2 -0
- package/skills/fix/SKILL.md +283 -281
- package/skills/onboard/SKILL.md +7 -0
- package/skills/plan/SKILL.md +344 -342
- package/skills/preflight/SKILL.md +362 -360
- package/skills/review/SKILL.md +491 -489
- package/skills/scout/SKILL.md +1 -0
- package/skills/sentinel/SKILL.md +319 -299
- package/skills/session-bridge/SKILL.md +1 -0
- package/skills/team/SKILL.md +1 -0
- package/skills/test/SKILL.md +587 -585
- package/skills/verification/SKILL.md +1 -0
- package/skills/watchdog/SKILL.md +2 -0
package/skills/cook/SKILL.md
CHANGED
|
@@ -1,648 +1,661 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: cook
|
|
3
|
-
description: "Feature implementation orchestrator. ALWAYS use this skill for ANY code change — implement, build, add feature, create, fix bug, or any task that modifies source code. This is the default route for 70% of all requests. Runs full TDD cycle: understand → plan → test → implement → quality → verify → commit."
|
|
4
|
-
context: fork
|
|
5
|
-
agent: general-purpose
|
|
6
|
-
metadata:
|
|
7
|
-
author: runedev
|
|
8
|
-
version: "1.7.0"
|
|
9
|
-
layer: L1
|
|
10
|
-
model: sonnet
|
|
11
|
-
group: orchestrator
|
|
12
|
-
tools: "Read, Write, Edit, Bash, Glob, Grep"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/rune cook
|
|
37
|
-
/rune cook
|
|
38
|
-
/rune cook
|
|
39
|
-
/rune cook
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- Contains "
|
|
46
|
-
- Contains "
|
|
47
|
-
- Contains "
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
|
74
|
-
|
|
75
|
-
| Files affected:
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
|
88
|
-
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
- No
|
|
140
|
-
|
|
141
|
-
-
|
|
142
|
-
|
|
143
|
-
- Skip Phase
|
|
144
|
-
- Skip Phase
|
|
145
|
-
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
**
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
**
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
**
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
**
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
##
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
**
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
###
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
|
554
|
-
|
|
555
|
-
|
|
|
556
|
-
|
|
|
557
|
-
|
|
|
558
|
-
|
|
|
559
|
-
|
|
|
560
|
-
|
|
|
561
|
-
|
|
|
562
|
-
|
|
|
563
|
-
|
|
|
564
|
-
|
|
|
565
|
-
|
|
|
566
|
-
|
|
|
567
|
-
|
|
|
568
|
-
|
|
|
569
|
-
|
|
|
570
|
-
|
|
|
571
|
-
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
##
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
|
615
|
-
|
|
616
|
-
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
1
|
+
---
|
|
2
|
+
name: cook
|
|
3
|
+
description: "Feature implementation orchestrator. ALWAYS use this skill for ANY code change — implement, build, add feature, create, fix bug, or any task that modifies source code. This is the default route for 70% of all requests. Runs full TDD cycle: understand → plan → test → implement → quality → verify → commit."
|
|
4
|
+
context: fork
|
|
5
|
+
agent: general-purpose
|
|
6
|
+
metadata:
|
|
7
|
+
author: runedev
|
|
8
|
+
version: "1.7.0"
|
|
9
|
+
layer: L1
|
|
10
|
+
model: sonnet
|
|
11
|
+
group: orchestrator
|
|
12
|
+
tools: "Read, Write, Edit, Bash, Glob, Grep"
|
|
13
|
+
emit: phase.complete
|
|
14
|
+
listen: plan.ready, review.complete
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# cook
|
|
18
|
+
|
|
19
|
+
## Purpose
|
|
20
|
+
|
|
21
|
+
The primary orchestrator for feature implementation. Coordinates the entire L2 mesh in a phased TDD workflow. Handles 70% of all user requests — any task that modifies source code routes through cook.
|
|
22
|
+
|
|
23
|
+
<HARD-GATE>
|
|
24
|
+
Before starting ANY implementation:
|
|
25
|
+
1. You MUST understand the codebase first (Phase 1)
|
|
26
|
+
2. You MUST have a plan before writing code (Phase 2)
|
|
27
|
+
3. You MUST write failing tests before implementation (Phase 3) — unless explicitly skipped
|
|
28
|
+
This applies to EVERY feature regardless of perceived simplicity.
|
|
29
|
+
</HARD-GATE>
|
|
30
|
+
|
|
31
|
+
## Workflow Chains (Predefined)
|
|
32
|
+
|
|
33
|
+
Cook supports predefined workflow chains for common task types. Use these as shortcuts instead of manually determining phases:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
/rune cook feature → Full TDD pipeline (all phases)
|
|
37
|
+
/rune cook bugfix → Diagnose → fix → verify (Phase 1 → 4 → 6 → 7)
|
|
38
|
+
/rune cook refactor → Understand → plan → implement → quality (Phase 1 → 2 → 4 → 5 → 6 → 7)
|
|
39
|
+
/rune cook security → Full pipeline + sentinel@opus + sast (all phases, security-escalated)
|
|
40
|
+
/rune cook hotfix → Minimal: fix → verify → commit (Phase 4 → 6 → 7, skip scout if user provides context)
|
|
41
|
+
/rune cook nano → Trivial: do → verify → done (no phases, ≤3 steps)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Chain selection**: If user invokes `/rune cook` without a chain type, auto-detect from the task description:
|
|
45
|
+
- Contains "bug", "fix", "broken", "error" → `bugfix`
|
|
46
|
+
- Contains "refactor", "clean", "restructure" → `refactor`
|
|
47
|
+
- Contains "security", "auth", "vulnerability", "CVE" → `security`
|
|
48
|
+
- Contains "urgent", "hotfix", "production" → `hotfix`
|
|
49
|
+
- Contains "quick", "just", "chỉ cần", "copy", "move", "rename", "bump" → `nano`
|
|
50
|
+
- Default → `feature`
|
|
51
|
+
|
|
52
|
+
## Phase Skip Rules
|
|
53
|
+
|
|
54
|
+
Not every task needs every phase:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Nano task: DO → VERIFY → DONE (no phases, auto-detected)
|
|
58
|
+
Simple bug fix: Phase 1 → 4 → 6 → 7
|
|
59
|
+
Small refactor: Phase 1 → 4 → 5 → 6 → 7
|
|
60
|
+
New feature: Phase 1 → 1.5 → 2 → 3 → 4 → 5 → 6 → 7 → 8
|
|
61
|
+
Complex feature: All phases + brainstorm in Phase 2
|
|
62
|
+
Security-sensitive: All phases + sentinel escalated to opus
|
|
63
|
+
Fast mode: Phase 1 → 4 → 6 → 7 (auto-detected, see below)
|
|
64
|
+
Multi-session: Phase 0 (resume) → 3 → 4 → 5 → 6 → 7 (one plan phase per session)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Determine complexity BEFORE starting using the Rigor Assessment below. Create TodoWrite with applicable phases.
|
|
68
|
+
|
|
69
|
+
### Rigor Assessment (Progressive Scaling)
|
|
70
|
+
|
|
71
|
+
Before selecting a workflow chain or phase set, compute the task's **rigor level** from risk signals. This prevents over-engineering trivial changes while ensuring full ceremony for critical ones.
|
|
72
|
+
|
|
73
|
+
| Risk Signal | Weight | Detection |
|
|
74
|
+
|-------------|--------|-----------|
|
|
75
|
+
| Files affected: 1 | 0 | Estimate from task description + scout |
|
|
76
|
+
| Files affected: 2-3 | +1 | |
|
|
77
|
+
| Files affected: 4+ | +3 | |
|
|
78
|
+
| Cross-module impact (changes span 2+ directories) | +2 | scout identifies touch points across boundaries |
|
|
79
|
+
| Security-sensitive code (auth, crypto, payments, secrets) | +3 | Keyword match in file paths or task description |
|
|
80
|
+
| Public API change (exports, routes, schema) | +2 | Task modifies interfaces consumed by external code |
|
|
81
|
+
| Database schema change | +2 | Task mentions migration, schema, ALTER, column |
|
|
82
|
+
| New dependency added | +1 | Task requires `npm install` or equivalent |
|
|
83
|
+
| Code will be imported by other modules | +1 | New exports or modifications to shared utilities |
|
|
84
|
+
|
|
85
|
+
**Rigor level mapping:**
|
|
86
|
+
|
|
87
|
+
| Score | Level | Maps To | Phases |
|
|
88
|
+
|-------|-------|---------|--------|
|
|
89
|
+
| 0 | Nano | `nano` chain | DO → VERIFY → DONE |
|
|
90
|
+
| 1-2 | Fast | `fast` mode | Phase 1 → 4 → 6 → 7 |
|
|
91
|
+
| 3-5 | Standard | `bugfix` / `refactor` | Phase 1 → 2 → 4 → 5 → 6 → 7 |
|
|
92
|
+
| 6-8 | Full | `feature` | Phase 1 → 1.5 → 2 → 3 → 4 → 5 → 6 → 7 → 8 |
|
|
93
|
+
| 9+ | Critical | `security` / full + adversary | All phases + sentinel@opus + adversary |
|
|
94
|
+
|
|
95
|
+
**Rules:**
|
|
96
|
+
- Security signal (+3) automatically floors rigor at Standard — NEVER nano/fast for security code
|
|
97
|
+
- User can override: "full pipeline" forces Full, "just do it" forces Nano
|
|
98
|
+
- If rigor upgrades mid-task (e.g., scout reveals cross-module impact not obvious from description), announce: "Rigor upgrade: [signal detected] — upgrading from Fast to Standard."
|
|
99
|
+
- Announce chosen level: "Rigor: Fast (score 2 — single file, no security)"
|
|
100
|
+
|
|
101
|
+
## Nano Mode (Auto-Detect)
|
|
102
|
+
|
|
103
|
+
For trivial tasks that don't need any pipeline at all:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
IF all of these are true:
|
|
107
|
+
- Task is ≤3 discrete steps (e.g., run command, edit 1 file, commit)
|
|
108
|
+
- Task description < 60 chars OR user prefixes with "quick:", "just", "chỉ cần"
|
|
109
|
+
- No code logic changes (copy files, config edits, version bumps, git ops, run scripts)
|
|
110
|
+
- No new functions/classes/components created
|
|
111
|
+
THEN: Nano Mode activated
|
|
112
|
+
- Execute directly: DO → VERIFY → DONE
|
|
113
|
+
- No phases. No plan. No test. No review.
|
|
114
|
+
- Still verify output (check exit codes, confirm file exists, etc.)
|
|
115
|
+
- Still use semantic commit message if committing
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Announce**: "Nano mode: trivial task, executing directly."
|
|
119
|
+
**Override**: User can say "full pipeline" or "cook feature" to force phases.
|
|
120
|
+
**Escape hatch**: If during execution the task turns out more complex than expected → announce upgrade: "Upgrading to Fast/Full mode — task is more complex than detected." Resume from Phase 1.
|
|
121
|
+
|
|
122
|
+
<HARD-GATE>
|
|
123
|
+
Nano mode MUST NOT be used for:
|
|
124
|
+
- Any code that will be imported/called by other code
|
|
125
|
+
- Security-relevant files (auth, crypto, payments, .env, secrets)
|
|
126
|
+
- Database schema changes
|
|
127
|
+
- Public API changes
|
|
128
|
+
If any of these are detected mid-task, STOP and upgrade to Fast/Full mode.
|
|
129
|
+
</HARD-GATE>
|
|
130
|
+
|
|
131
|
+
## Fast Mode (Auto-Detect)
|
|
132
|
+
|
|
133
|
+
Cook auto-detects small changes and streamlines the pipeline:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
IF all of these are true:
|
|
137
|
+
- Total estimated change < 30 LOC
|
|
138
|
+
- Single file affected
|
|
139
|
+
- No security-relevant code (auth, crypto, payments, .env)
|
|
140
|
+
- No public API changes
|
|
141
|
+
- No database schema changes
|
|
142
|
+
THEN: Fast Mode activated
|
|
143
|
+
- Skip Phase 2 (PLAN) — change is too small for a formal plan
|
|
144
|
+
- Skip Phase 3 (TEST) — unless existing tests cover the area
|
|
145
|
+
- Skip Phase 5b (SENTINEL) — non-security code
|
|
146
|
+
- Skip Phase 8 (BRIDGE) — not worth persisting
|
|
147
|
+
- KEEP Phase 5a (PREFLIGHT) and Phase 6 (VERIFY) — always run quality checks
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Announce fast mode**: "Fast mode: small change detected (<30 LOC, single file, non-security). Streamlined pipeline."
|
|
151
|
+
**Override**: User can say "full pipeline" to force all phases even on small changes.
|
|
152
|
+
|
|
153
|
+
## Phase 0.5: ENVIRONMENT CHECK (First Run Only)
|
|
154
|
+
|
|
155
|
+
**SUB-SKILL**: Use `rune:sentinel-env` — verify the environment can run the project before planning.
|
|
156
|
+
|
|
157
|
+
Auto-trigger: no `.rune/` dir (first run) OR build just failed with env-looking errors AND NOT fast mode. Skip silently on subsequent runs. Force with `/rune env-check`.
|
|
158
|
+
|
|
159
|
+
## Phase 1: UNDERSTAND
|
|
160
|
+
|
|
161
|
+
**Goal**: Know what exists before changing anything.
|
|
162
|
+
|
|
163
|
+
**REQUIRED SUB-SKILLS**: Use `rune:scout`. For non-trivial tasks, use `rune:ba`.
|
|
164
|
+
|
|
165
|
+
1. Create TodoWrite with all applicable phases for this task
|
|
166
|
+
2. Mark Phase 1 as `in_progress`
|
|
167
|
+
3. **BA gate**: Feature Request / Integration / Greenfield → invoke `rune:ba`. Task > 50 words or business terms (users, revenue, workflow) → invoke `rune:ba`. Bug Fix / simple Refactor → skip. BA produces `.rune/features/<name>/requirements.md` for Phase 2.
|
|
168
|
+
4. **Decision enforcement**: `Glob` for `.rune/decisions.md`; if exists, `Read` + extract constraints for Phase 2. Plan MUST NOT contradict active decisions without explicit user override.
|
|
169
|
+
4b. **Contract enforcement**: If `.rune/contract.md` was loaded in Phase 0.6, list applicable contract sections for this task (e.g., `contract.security` for auth work, `contract.data` for database changes). These rules constrain Phase 2 planning and Phase 4 implementation.
|
|
170
|
+
|
|
171
|
+
### Phase 1 Step 3.5 — Clarification Gate
|
|
172
|
+
|
|
173
|
+
Ask **2 questions** before planning: (1) "What does success look like?" (2) "What should NOT change?"
|
|
174
|
+
|
|
175
|
+
Skip if: bug fix with clear repro steps | user said "just do it" | fast mode + <10 LOC | hotfix chain active. Complexity revealed → escalate to `rune:ba`.
|
|
176
|
+
|
|
177
|
+
5. Invoke scout to scan the codebase (Glob + Grep + Read on relevant files)
|
|
178
|
+
6. Summarize: what exists, project conventions, files likely to change, active decision constraints
|
|
179
|
+
7. **Python async detection**: if Python project detected, `Grep` for async indicators (`async def`, `await`, `aiosqlite`, `aiohttp`, `asyncio.run`). If ≥3 matches → flag as **"async-first Python"** — new code defaults to `async def`
|
|
180
|
+
8. Mark Phase 1 as `completed`
|
|
181
|
+
|
|
182
|
+
**Gate**: If scout finds the feature already exists → STOP and inform user.
|
|
183
|
+
|
|
184
|
+
## Phase 1.5: DOMAIN CONTEXT (L4 Pack Detection)
|
|
185
|
+
|
|
186
|
+
**Goal**: Detect if domain-specific L4 extension packs apply to this task.
|
|
187
|
+
|
|
188
|
+
<MUST-READ path="references/pack-detection.md" trigger="Phase 1.5 — before checking L4 pack mapping"/>
|
|
189
|
+
|
|
190
|
+
After scout completes, check if the detected tech stack or task description matches any L4 extension pack. This phase is lightweight — a Read + pattern match. It does NOT replace Phase 1 (scout) or Phase 2 (plan). If 0 packs match: skip silently.
|
|
191
|
+
|
|
192
|
+
## Phase 1.7: WORKFLOW ORCHESTRATION (Multi-Skill Sequences)
|
|
193
|
+
|
|
194
|
+
**Goal**: If Phase 1.5 detected a pack AND the task maps to a named workflow, orchestrate the multi-skill sequence.
|
|
195
|
+
|
|
196
|
+
**Trigger**: Only runs if Phase 1.5 found a pack match AND the pack's Workflows table has a matching command.
|
|
197
|
+
|
|
198
|
+
<MUST-READ path="references/pack-detection.md" trigger="Phase 1.7 — workflow command detection section"/>
|
|
199
|
+
|
|
200
|
+
1. Read the matched PACK.md's Workflows section
|
|
201
|
+
2. Identify the workflow name and skill sequence
|
|
202
|
+
3. For each skill in sequence:
|
|
203
|
+
a. Load the skill file from the pack's `skills/` directory
|
|
204
|
+
b. Execute the skill's workflow steps
|
|
205
|
+
c. Write output artifact to `.rune/<domain>/` (e.g., `.rune/hr/jd-[role]-[date].md`)
|
|
206
|
+
d. The next skill reads the previous artifact as input context
|
|
207
|
+
4. After all skills complete: summarize the workflow results to the user
|
|
208
|
+
|
|
209
|
+
**Threading state**: Each skill in the sequence produces an artifact file. The next skill's Step 1 reads existing artifacts from `.rune/<domain>/`. This is already built into each skill — no new plumbing needed.
|
|
210
|
+
|
|
211
|
+
**Skip if**: No workflow match found in Phase 1.5. Single-skill tasks proceed directly to Phase 2 (PLAN) as normal.
|
|
212
|
+
|
|
213
|
+
## Phase 0: RESUME CHECK (Before Phase 1)
|
|
214
|
+
|
|
215
|
+
**Goal**: Detect if a master plan already exists for this task. If so, skip Phase 1-2 and resume from the current phase.
|
|
216
|
+
|
|
217
|
+
**Step 0.5 — Cross-Project Recall**: Call `neural-memory` (Recall Mode) with 3-5 topics relevant to the current task. Always prefix queries with the project name (e.g., `"ProjectName auth pattern"` not `"auth pattern"`).
|
|
218
|
+
|
|
219
|
+
1. Use `Glob` to check for `.rune/plan-*.md` files
|
|
220
|
+
2. If a master plan exists matching the current task: Read it → find first `⬚ Pending` or `🔄 Active` phase → load ONLY that phase file → announce "Resuming from Phase N" → skip to Phase 4
|
|
221
|
+
3. If no master plan exists → proceed to Phase 1 as normal
|
|
222
|
+
|
|
223
|
+
**Step 0.6 — Contract Load**: Use `Glob` to check for `.rune/contract.md`. If it exists:
|
|
224
|
+
1. `Read` the contract file and parse each `## section` as a named rule set
|
|
225
|
+
2. Hold contract rules in context — they apply as **hard gates** throughout all phases
|
|
226
|
+
3. Any code change that violates a contract rule → STOP and inform user before proceeding
|
|
227
|
+
4. If no contract exists → proceed normally (contract is optional)
|
|
228
|
+
|
|
229
|
+
<HARD-GATE>
|
|
230
|
+
Contract violations are NON-NEGOTIABLE. If `.rune/contract.md` exists and a planned or implemented change violates any rule, cook MUST stop and report the violation. The user must explicitly override ("ignore contract rule X") to proceed.
|
|
231
|
+
</HARD-GATE>
|
|
232
|
+
|
|
233
|
+
**This enables multi-session workflows**: Opus plans once → each session picks up the next phase.
|
|
234
|
+
|
|
235
|
+
## Phase 2: PLAN
|
|
236
|
+
|
|
237
|
+
**Goal**: Break the task into concrete implementation steps before writing code.
|
|
238
|
+
|
|
239
|
+
**REQUIRED SUB-SKILL**: Use `rune:plan`
|
|
240
|
+
|
|
241
|
+
1. Mark Phase 2 as `in_progress`
|
|
242
|
+
2. **Feature workspace** (opt-in) — for non-trivial features (3+ phases), suggest creating `.rune/features/<feature-name>/` with `spec.md`, `plan.md`, `decisions.md`, `status.md`. Skip for simple bug fixes, fast mode.
|
|
243
|
+
3. Create implementation plan: exact files to create/modify, change order, dependencies, active decision constraints
|
|
244
|
+
4. If multiple valid approaches exist → invoke `rune:brainstorm` for trade-off analysis
|
|
245
|
+
5. Present plan to user for approval
|
|
246
|
+
6. If feature workspace was created, write approved plan to `.rune/features/<name>/plan.md`
|
|
247
|
+
7. Mark Phase 2 as `completed`
|
|
248
|
+
|
|
249
|
+
**Gate**: User MUST approve the plan before proceeding. Do NOT skip this.
|
|
250
|
+
|
|
251
|
+
### Phase 2.5: RFC GATE (Breaking Changes Only)
|
|
252
|
+
|
|
253
|
+
**Goal**: Formal change management for breaking changes. Prevents unreviewed breaking changes from reaching production.
|
|
254
|
+
|
|
255
|
+
<MUST-READ path="references/rfc-template.md" trigger="Phase 2.5 — any time a breaking change is detected in the plan"/>
|
|
256
|
+
|
|
257
|
+
<HARD-GATE>
|
|
258
|
+
Breaking change without RFC = BLOCKED. No exceptions.
|
|
259
|
+
"It's just a small change" is the #1 excuse for production incidents from unreviewed breaking changes.
|
|
260
|
+
</HARD-GATE>
|
|
261
|
+
|
|
262
|
+
### Phase 2.5: ADVERSARY (Red-Team Challenge)
|
|
263
|
+
|
|
264
|
+
**Goal**: Stress-test the approved plan BEFORE writing code — catch flaws at plan time, not implementation time.
|
|
265
|
+
|
|
266
|
+
**REQUIRED SUB-SKILL**: Use `rune:adversary`
|
|
267
|
+
|
|
268
|
+
1. **Skip conditions**: bug fixes, hotfixes, simple refactors (< 3 files, no new logic), fast mode
|
|
269
|
+
2. **Run adversary** — Full Red-Team mode for new features/architectural changes; Quick Challenge mode for smaller plans
|
|
270
|
+
3. **Handle verdict**:
|
|
271
|
+
- **REVISE** → return to Phase 2 with adversary findings as constraints; user must re-approve
|
|
272
|
+
- **HARDEN** → present remediations, update plan inline, then proceed to Phase 3
|
|
273
|
+
- **PROCEED** → pass findings as implementation notes to Phase 3
|
|
274
|
+
4. **Max 1 REVISE loop** per cook session — if revised plan also gets REVISE, ask user to decide
|
|
275
|
+
|
|
276
|
+
### Phase-Aware Execution (Master Plan + Phase Files)
|
|
277
|
+
|
|
278
|
+
When `rune:plan` produces a **master plan + phase files** (non-trivial tasks):
|
|
279
|
+
|
|
280
|
+
1. After plan approval: load ONLY Phase 1's file — do NOT load all phase files
|
|
281
|
+
2. Execute through cook Phase 3-6 (test → implement → quality → verify)
|
|
282
|
+
3. After phase complete: mark tasks done, update master plan status `⬚ → ✅`, announce "Phase N complete. Phase N+1 ready for next session."
|
|
283
|
+
4. Next session: Phase 0 detects master plan → loads next phase → executes
|
|
284
|
+
|
|
285
|
+
<HARD-GATE>
|
|
286
|
+
NEVER load multiple phase files at once. One phase per session = small context = better code.
|
|
287
|
+
If the coder model needs info from other phases, it's in the Cross-Phase Context section of the current phase file.
|
|
288
|
+
</HARD-GATE>
|
|
289
|
+
|
|
290
|
+
## Phase 3: TEST (TDD Red)
|
|
291
|
+
|
|
292
|
+
**Goal**: Define expected behavior with failing tests BEFORE writing implementation.
|
|
293
|
+
|
|
294
|
+
**REQUIRED SUB-SKILL**: Use `rune:test`
|
|
295
|
+
|
|
296
|
+
1. Mark Phase 3 as `in_progress`
|
|
297
|
+
2. **Eval definitions** (Full/Critical rigor only): Before writing tests, define capability evals (pass@k) and regression evals (pass^k) in `.rune/evals/<feature>.md`. Capability evals test "can the system do this new thing?" — regression evals test "did we break existing behavior?" Skip for Fast/Standard rigor levels.
|
|
298
|
+
3. Write test files based on the plan — cover primary use case + edge cases; tests MUST be runnable
|
|
299
|
+
4. **Python async pre-check** (if async-first Python flagged in Phase 1): verify `pytest-asyncio` is installed and `asyncio_mode = "auto"` is in `pyproject.toml` — if missing, warn user before writing async tests
|
|
300
|
+
5. Run tests to verify they FAIL — expected: RED because implementation doesn't exist yet
|
|
301
|
+
6. Mark Phase 3 as `completed`
|
|
302
|
+
|
|
303
|
+
**Gate**: Tests MUST exist and MUST fail. If tests pass without implementation → tests are wrong, rewrite them.
|
|
304
|
+
|
|
305
|
+
## Phase 4: IMPLEMENT (TDD Green)
|
|
306
|
+
|
|
307
|
+
**Goal**: Write the minimum code to make tests pass.
|
|
308
|
+
|
|
309
|
+
**REQUIRED SUB-SKILL**: Use `rune:fix`
|
|
310
|
+
|
|
311
|
+
1. Mark Phase 4 as `in_progress`
|
|
312
|
+
2. **Phase-file execution** — if working from a master plan + phase file:
|
|
313
|
+
- Execute tasks from `## Tasks` section wave-by-wave
|
|
314
|
+
- Wave N only starts after ALL Wave N-1 tasks complete
|
|
315
|
+
- Follow Code Contracts, Rejection Criteria, Failure Scenarios from the phase file
|
|
316
|
+
- Mark each task `[x]` as completed
|
|
317
|
+
3. Implement the feature following the plan (Write for new files, Edit for existing)
|
|
318
|
+
4. Run tests after each significant change — if fail → debug and fix
|
|
319
|
+
- **Python async** (if async-first flagged): no blocking calls in async functions — `time.sleep` → `asyncio.sleep`, `requests` → `httpx.AsyncClient`, use `asyncio.gather()` for parallel I/O
|
|
320
|
+
5. If stuck → invoke `rune:debug` (max 3 debug↔fix loops). Fixes outside plan scope require user approval (R4).
|
|
321
|
+
6. **Re-plan check** — evaluate before Phase 5: max debug loops hit? out-of-scope files changed? new dep changes approach? user scope change? If any fire → invoke `rune:plan` with delta context, get user approval before resuming.
|
|
322
|
+
7. **Approach Pivot Gate** — if re-plan ALSO fails:
|
|
323
|
+
|
|
324
|
+
<HARD-GATE>
|
|
325
|
+
Do NOT surrender. Do NOT tell user "no solution exists."
|
|
326
|
+
Do NOT try a 4th variant of the same approach.
|
|
327
|
+
MUST invoke brainstorm(mode="rescue") before giving up.
|
|
328
|
+
</HARD-GATE>
|
|
329
|
+
|
|
330
|
+
Invoke `rune:brainstorm(mode="rescue")` with `failed_approach`, `failure_evidence[]`, `original_goal`. Returns 3-5 alternatives → user picks → **restart from Phase 2**.
|
|
331
|
+
|
|
332
|
+
8. All tests MUST pass before proceeding
|
|
333
|
+
9. Mark Phase 4 as `completed`
|
|
334
|
+
|
|
335
|
+
**Gate**: ALL tests from Phase 3 MUST pass. Do NOT proceed with failing tests.
|
|
336
|
+
|
|
337
|
+
## Phase 5: QUALITY (Staged)
|
|
338
|
+
|
|
339
|
+
**Goal**: Catch issues before they reach production.
|
|
340
|
+
|
|
341
|
+
Quality checks run in **two stages** — spec compliance gates code review. Reviewing code quality before verifying it matches the spec wastes effort on code that may need rewriting.
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
STAGE 1 (parallel):
|
|
345
|
+
Launch 5a (preflight) + 5b (sentinel) simultaneously.
|
|
346
|
+
Wait for BOTH to complete.
|
|
347
|
+
If 5a returns BLOCK → fix spec gaps, re-run 5a. Code review CANNOT start on non-compliant code.
|
|
348
|
+
If 5b returns BLOCK → fix security issue, re-run 5b.
|
|
349
|
+
|
|
350
|
+
STAGE 2 (after Stage 1 passes):
|
|
351
|
+
Launch 5c (review) + 5d (completion-gate) simultaneously.
|
|
352
|
+
If any returns BLOCK → fix findings, re-run the blocking check only.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### 5a. Preflight (Spec Compliance + Logic) — STAGE 1
|
|
356
|
+
**REQUIRED SUB-SKILL**: Use `rune:preflight`
|
|
357
|
+
- Spec compliance: compare approved plan vs actual diff
|
|
358
|
+
- Logic review, error handling, completeness
|
|
359
|
+
- **Must pass before 5c (review) can start** — no point reviewing code quality if it doesn't match the spec
|
|
360
|
+
|
|
361
|
+
### 5b. Security — STAGE 1
|
|
362
|
+
**REQUIRED SUB-SKILL**: Use `rune:sentinel`
|
|
363
|
+
- Secret scan, OWASP check (no injection/XSS/CSRF), dependency audit
|
|
364
|
+
|
|
365
|
+
### 5c. Code Review — STAGE 2
|
|
366
|
+
**REQUIRED SUB-SKILL**: Use `rune:review`
|
|
367
|
+
- Pattern compliance, code quality, performance bottlenecks
|
|
368
|
+
- Reviewer reads code independently — does NOT rely on implementer's claims
|
|
369
|
+
- **Reviewer isolation** (when invoked via `team`): The review agent MUST be a separate context window from the implementing agent. Author reasoning contaminates review — the reviewer should never have seen the implementation's reasoning chain. Sonnet implements, a fresh Sonnet reviews.
|
|
370
|
+
|
|
371
|
+
### 5d. Completion Gate — STAGE 2
|
|
372
|
+
**REQUIRED SUB-SKILL**: Use `rune:completion-gate`
|
|
373
|
+
- Validate agent claims match evidence trail (tests ran, files changed, build passed)
|
|
374
|
+
- No truncated code files (`// ...`, `// rest of code`, bare ellipsis) — agent MUST complete all output
|
|
375
|
+
- Any UNCONFIRMED claim → BLOCK
|
|
376
|
+
|
|
377
|
+
**Gate**: If sentinel finds CRITICAL security issue → STOP, fix it, re-run. Non-negotiable.
|
|
378
|
+
**Gate**: If completion-gate finds UNCONFIRMED claim → STOP, re-verify. Non-negotiable.
|
|
379
|
+
|
|
380
|
+
## Per-Phase Rules (Project-Specific)
|
|
381
|
+
|
|
382
|
+
Projects can define phase-specific rules in `.rune/phase-rules.md` that apply ONLY during specific cook phases. These are additive — they enhance skill guidance, not replace it.
|
|
383
|
+
|
|
384
|
+
```markdown
|
|
385
|
+
# .rune/phase-rules.md (example)
|
|
386
|
+
|
|
387
|
+
## Phase 2: PLAN
|
|
388
|
+
- All API endpoints must follow REST naming convention /api/v1/<resource>
|
|
389
|
+
- Database changes require a rollback migration
|
|
390
|
+
|
|
391
|
+
## Phase 3: TEST
|
|
392
|
+
- Enforce TDD format: describe → it → arrange → act → assert
|
|
393
|
+
- Minimum 3 edge cases per public function
|
|
394
|
+
|
|
395
|
+
## Phase 5: QUALITY
|
|
396
|
+
- Review must check for N+1 queries on any ORM code
|
|
397
|
+
- Sentinel must verify CORS configuration on new routes
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
**Loading**: Cook reads `.rune/phase-rules.md` during Phase 0 (resume check). Rules for each phase are injected into the sub-skill's context when that phase starts. If file doesn't exist → skip silently.
|
|
401
|
+
|
|
402
|
+
## Checkpoint Protocol (Opt-In)
|
|
403
|
+
|
|
404
|
+
Invoke `rune:session-bridge` after Phase 2, 4, and 5 to save intermediate state. OPT-IN — activate only if task spans 3+ phases, context-watch is ORANGE, or user explicitly requests checkpoints. Before spawning subagents, invoke `rune:context-pack` to create structured handoff briefings.
|
|
405
|
+
|
|
406
|
+
## Phase Transition Protocol (MANDATORY)
|
|
407
|
+
|
|
408
|
+
Before entering ANY Phase N+1, assert: Phase N `completed` in TodoWrite | gate condition met | no BLOCK from sub-skills | no unresolved CRITICAL findings. If any fails → STOP, log "BLOCKED at Phase N→N+1: [assertion]", fix, re-check.
|
|
409
|
+
|
|
410
|
+
**Key transitions:** 1→2: scout done | 2→3: plan approved | 3→4: failing tests exist | 4→5: all tests pass | 5→6: no CRITICAL findings | 6→7: lint+types+build green.
|
|
411
|
+
|
|
412
|
+
## Phase 6: VERIFY
|
|
413
|
+
|
|
414
|
+
**REQUIRED SUB-SKILL**: Use `rune:verification` — run lint, type check, full test suite, build. Then `rune:hallucination-guard` to verify imports and API signatures. ALL checks MUST pass before commit.
|
|
415
|
+
|
|
416
|
+
## Phase 7: COMMIT
|
|
417
|
+
|
|
418
|
+
**RECOMMENDED SUB-SKILL**: Use `rune:git` — stage specific files (`git add <files>`, NOT `git add .`), generate semantic commit message from diff. If working from master plan: update phase status `🔄 → ✅`, announce next phase or "All phases complete."
|
|
419
|
+
|
|
420
|
+
## Phase 8: BRIDGE
|
|
421
|
+
|
|
422
|
+
**Goal**: Save context for future sessions and record metrics for mesh analytics.
|
|
423
|
+
|
|
424
|
+
**REQUIRED SUB-SKILL**: Use `rune:session-bridge`
|
|
425
|
+
|
|
426
|
+
1. Mark Phase 8 as `in_progress`
|
|
427
|
+
2. Save to `.rune/decisions.md` (approach + trade-offs), `.rune/progress.md` (task complete), `.rune/conventions.md` (new patterns)
|
|
428
|
+
3. **Skill metrics** → `.rune/metrics/skills.json`: increment phase run/skip counts, quality gate results, debug loop counts under `cook` key
|
|
429
|
+
4. **Routing overrides** (H3): if Phase 4 hit max loops for an error pattern → write rule to `.rune/metrics/routing-overrides.json`. Max 10 active rules.
|
|
430
|
+
5. **Step 8.5 — Capture Learnings**: `neural-memory` (Capture Mode) — 2-5 memories: architecture decisions, patterns, error root-causes, trade-offs. Cognitive language (causal/decisional/comparative). Tags: `[project, tech, topic]`. Priority 5 routine / 7-8 decisions / 9-10 critical errors.
|
|
431
|
+
6. Mark Phase 8 as `completed`
|
|
432
|
+
|
|
433
|
+
## Autonomous Loop Patterns
|
|
434
|
+
|
|
435
|
+
When cook runs inside `team` (L1) or autonomous workflows, these patterns apply.
|
|
436
|
+
|
|
437
|
+
### De-Sloppify Pass
|
|
438
|
+
|
|
439
|
+
After Phase 4 completes (all tests green), run a **separate focused cleanup pass** on all modified files. Two focused passes outperform one constrained pass — let the implementer write freely in Phase 4, then clean up here.
|
|
440
|
+
|
|
441
|
+
**Trigger**: Implementation touched 3+ files OR 100+ LOC changed. Skip for nano/fast rigor.
|
|
442
|
+
|
|
443
|
+
**Slop targets** (check every modified file):
|
|
444
|
+
|
|
445
|
+
| Slop Type | Detection | Fix |
|
|
446
|
+
|-----------|-----------|-----|
|
|
447
|
+
| Leftover debug | `console.log`, `print()`, `debugger`, `TODO: remove` | Delete |
|
|
448
|
+
| Over-defensive checks | Null checks on values guaranteed non-null by TypeScript/framework | Remove redundant guard |
|
|
449
|
+
| Type-test slop | `typeof x === 'string'` when x is already typed as string | Remove — trust the type system |
|
|
450
|
+
| Duplicated logic | Same 3+ lines appear in multiple places | Extract utility |
|
|
451
|
+
| Framework-behavior tests | Tests asserting that React renders, that Express routes exist, that mocks work | Delete — test YOUR code, not the framework |
|
|
452
|
+
| Inconsistent naming | Mixed `camelCase`/`snake_case` in same file | Normalize to project convention |
|
|
453
|
+
| Dead imports | Imports no longer used after edits | Remove |
|
|
454
|
+
|
|
455
|
+
**Important**: This is NOT a quality gate — it's a cleanup pass. Don't block the pipeline for cosmetic issues. Fix what you find, move on.
|
|
456
|
+
|
|
457
|
+
### Continuous PR Loop (team orchestration only)
|
|
458
|
+
|
|
459
|
+
```
|
|
460
|
+
cook instance → commit → push → create PR → wait CI
|
|
461
|
+
IF CI passes → mark workstream complete
|
|
462
|
+
IF CI fails → read CI output → fix → push → wait CI (max 3 retries)
|
|
463
|
+
IF 3 retries fail → escalate to user with CI logs
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### Formal Pause/Resume (`.continue-here.md`)
|
|
467
|
+
|
|
468
|
+
<MUST-READ path="references/pause-resume-template.md" trigger="when cook must pause mid-phase (context limit, user break, session end)"/>
|
|
469
|
+
|
|
470
|
+
When cook must pause mid-phase, create `.rune/.continue-here.md` with structured handoff, then WIP commit. Phase 0 detects it on resume. More granular than plan-level resume — resumes within a phase.
|
|
471
|
+
|
|
472
|
+
### Mid-Run Signal Detection
|
|
473
|
+
|
|
474
|
+
<MUST-READ path="references/mid-run-signals.md" trigger="when user sends a message DURING cook execution"/>
|
|
475
|
+
|
|
476
|
+
Two-stage intent classification: keyword fast-path for short messages (<60 chars), context classification for longer ones. Never queue user messages — process immediately.
|
|
477
|
+
|
|
478
|
+
<HARD-GATE>
|
|
479
|
+
NEVER treat a Cancel/Pause signal as a Steer or NewTask. User safety signals take absolute priority.
|
|
480
|
+
If ambiguous between Cancel and Steer → ask user: "Did you mean stop, or change approach?"
|
|
481
|
+
</HARD-GATE>
|
|
482
|
+
|
|
483
|
+
### Exit Conditions (Mandatory for Autonomous Runs)
|
|
484
|
+
|
|
485
|
+
<MUST-READ path="references/exit-conditions.md" trigger="cook running inside team or any autonomous workflow"/>
|
|
486
|
+
|
|
487
|
+
Hard caps: MAX_DEBUG_LOOPS=3, MAX_QUALITY_LOOPS=2, MAX_REPLAN=1, MAX_PIVOT=1, MAX_FIXES=30, WTF_THRESHOLD=20%.
|
|
488
|
+
Escalation chain: debug-fix (3x) → re-plan (1x) → brainstorm rescue (1x) → THEN escalate to user.
|
|
489
|
+
|
|
490
|
+
### Subagent Status Protocol
|
|
491
|
+
|
|
492
|
+
<MUST-READ path="references/subagent-status.md" trigger="when cook or any sub-skill needs to return a status"/>
|
|
493
|
+
|
|
494
|
+
Cook and all sub-skills return: `DONE` | `DONE_WITH_CONCERNS` | `NEEDS_CONTEXT` | `BLOCKED`.
|
|
495
|
+
|
|
496
|
+
### Subagent Context Isolation
|
|
497
|
+
|
|
498
|
+
When invoking sub-skills (fix, debug, test, review, etc.), **craft exactly the context they need** — never pass the full orchestrator session context.
|
|
499
|
+
|
|
500
|
+
| Pass To Sub-Skill | DO NOT Pass |
|
|
501
|
+
|-------------------|-------------|
|
|
502
|
+
| Task description + specific goal | Full conversation history |
|
|
503
|
+
| Relevant file paths from scout | Unrelated files from other phases |
|
|
504
|
+
| Project conventions (naming, test framework) | Other sub-skill outputs |
|
|
505
|
+
| Plan excerpt for THIS phase only | Full master plan |
|
|
506
|
+
| Error/stack trace (for debug/fix) | Previous debug attempts from other bugs |
|
|
507
|
+
|
|
508
|
+
**Why**: Sub-skills that inherit orchestrator context get polluted — they chase false connections, reference stale data, and consume tokens on irrelevant context. A focused sub-skill with 500 tokens of curated context outperforms one with 5000 tokens of inherited noise.
|
|
509
|
+
|
|
510
|
+
## Deviation Rules
|
|
511
|
+
|
|
512
|
+
<MUST-READ path="references/deviation-rules.md" trigger="when implementation diverges from the approved plan"/>
|
|
513
|
+
|
|
514
|
+
R1-R3 (bug/security/blocking fix): auto-fix, continue. R4 (architectural change): ASK user first.
|
|
515
|
+
|
|
516
|
+
## Error Recovery
|
|
517
|
+
|
|
518
|
+
<MUST-READ path="references/error-recovery.md" trigger="when any phase fails or a task hits repeated errors"/>
|
|
519
|
+
|
|
520
|
+
Includes phase-by-phase failure handling and repair operators (RETRY → DECOMPOSE → PRUNE) with a 2-attempt budget before escalation.
|
|
521
|
+
|
|
522
|
+
## Analysis Paralysis Guard
|
|
523
|
+
|
|
524
|
+
<HARD-GATE>
|
|
525
|
+
5+ consecutive read-only tool calls (Read, Grep, Glob) without a single write action (Edit, Write, Bash) = STUCK.
|
|
526
|
+
|
|
527
|
+
You MUST either:
|
|
528
|
+
1. **Act** — write code, run a command, create a file
|
|
529
|
+
2. **Report BLOCKED** — state the specific missing piece: "Cannot proceed because [X]"
|
|
530
|
+
|
|
531
|
+
Stuck patterns (all banned):
|
|
532
|
+
- Reading 10+ files to "fully understand" before acting
|
|
533
|
+
- Grepping every variation of a string across the entire repo
|
|
534
|
+
- Reading the same file twice in one investigation
|
|
535
|
+
- "Let me check one more thing" — repeated after 5 reads
|
|
536
|
+
|
|
537
|
+
A wrong first attempt that produces feedback beats perfect understanding that never ships.
|
|
538
|
+
</HARD-GATE>
|
|
539
|
+
|
|
540
|
+
### Hash-Based Tool Loop Detection
|
|
541
|
+
|
|
542
|
+
<MUST-READ path="references/loop-detection.md" trigger="when same tool+args+result appears to be repeating"/>
|
|
543
|
+
|
|
544
|
+
Mentally track tool call fingerprints. 3 identical calls → WARN. 5 identical calls → FORCE STOP. Only same-input-AND-same-output counts as a loop.
|
|
545
|
+
|
|
546
|
+
## Called By (inbound)
|
|
547
|
+
|
|
548
|
+
- User: `/rune cook` direct invocation — primary entry point
|
|
549
|
+
- `team` (L1): parallel workstream execution (meta-orchestration)
|
|
550
|
+
|
|
551
|
+
## Calls (outbound)
|
|
552
|
+
|
|
553
|
+
| Phase | Sub-skill | Layer | Purpose |
|
|
554
|
+
|-------|-----------|-------|---------|
|
|
555
|
+
| 0 / 8 | `neural-memory` | ext | Recall context at start; capture learnings at end |
|
|
556
|
+
| 0.5 | `sentinel-env` | L3 | Environment pre-flight (first run only) |
|
|
557
|
+
| 1 | `scout` | L2 | Scan codebase before planning |
|
|
558
|
+
| 1 | `onboard` | L2 | Initialize project context if no CLAUDE.md |
|
|
559
|
+
| 1 | `ba` | L2 | Requirement elicitation for features |
|
|
560
|
+
| 2 | `plan` | L2 | Create implementation plan |
|
|
561
|
+
| 2 | `brainstorm` | L2 | Trade-off analysis / rescue mode |
|
|
562
|
+
| 2 | `design` | L2 | UI/design phase for frontend features |
|
|
563
|
+
| 2.5 | `adversary` | L2 | Red-team challenge on approved plan |
|
|
564
|
+
| 3 | `test` | L2 | Write failing tests (RED phase) |
|
|
565
|
+
| 4 | `fix` | L2 | Implement code changes (GREEN phase) |
|
|
566
|
+
| 4 | `debug` | L2 | Unexpected errors (max 3 loops) |
|
|
567
|
+
| 4 | `db` | L2 | Schema changes detected in diff |
|
|
568
|
+
| 4 | `worktree` | L3 | Worktree isolation for parallel implementation |
|
|
569
|
+
| 5a | `preflight` | L2 | Spec compliance + logic review |
|
|
570
|
+
| 5b | `sentinel` | L2 | Security scan |
|
|
571
|
+
| 5c | `review` | L2 | Code quality review |
|
|
572
|
+
| 5 | `perf` | L2 | Performance regression check (optional) |
|
|
573
|
+
| 5 | `audit` | L2 | Project health audit when scope warrants |
|
|
574
|
+
| 5 | `review-intake` | L2 | Structured review intake for complex PRs |
|
|
575
|
+
| 5 | `sast` | L3 | Static analysis security testing |
|
|
576
|
+
| 5d | `completion-gate` | L3 | Validate agent claims against evidence trail |
|
|
577
|
+
| 5 | `constraint-check` | L3 | Audit HARD-GATE compliance across workflow |
|
|
578
|
+
| 6 | `verification` | L3 | Lint + types + tests + build |
|
|
579
|
+
| 6 | `hallucination-guard` | L3 | Verify imports and API calls are real |
|
|
580
|
+
| 7 | `journal` | L3 | Record architectural decisions |
|
|
581
|
+
| 8 | `session-bridge` | L3 | Save context for future sessions |
|
|
582
|
+
| any | `context-pack` | L3 | create structured handoff briefings before spawning subagents |
|
|
583
|
+
| any | `skill-forge` | L2 | When new skill creation detected during cook |
|
|
584
|
+
| 1.5 | L4 extension packs | L4 | Domain-specific patterns when stack matches |
|
|
585
|
+
|
|
586
|
+
## Data Flow
|
|
587
|
+
|
|
588
|
+
**Feeds Into →** `journal` (decisions → ADRs) | `session-bridge` (context → .rune/ state) | `neural-memory` (learnings → cross-session)
|
|
589
|
+
|
|
590
|
+
**Fed By ←** `ba` (requirements → Phase 1) | `plan` (master plan → Phase 2-4) | `session-bridge` (.continue-here.md → Phase 0 resume) | `neural-memory` (past decisions → Phase 0 recall)
|
|
591
|
+
|
|
592
|
+
**Feedback Loops ↻** cook↔debug (Phase 4 bug → debug → fix → resume; if plan wrong → Approach Pivot) | cook↔test (RED → GREEN → failures loop back)
|
|
593
|
+
|
|
594
|
+
## Constraints
|
|
595
|
+
|
|
596
|
+
1. MUST run scout before planning
|
|
597
|
+
2. MUST get user plan approval before writing code
|
|
598
|
+
3. MUST write failing tests before implementation (TDD) unless explicitly skipped
|
|
599
|
+
4. MUST NOT commit with failing tests
|
|
600
|
+
5. MUST NOT modify files outside approved plan scope without user confirmation
|
|
601
|
+
6. MUST run verification (lint + type-check + tests + build) before commit
|
|
602
|
+
7. MUST NOT say "all tests pass" without showing actual test output
|
|
603
|
+
8. MUST NOT contradict `.rune/decisions.md` without explicit user override
|
|
604
|
+
|
|
605
|
+
## Mesh Gates
|
|
606
|
+
|
|
607
|
+
| Gate | Requires | If Missing |
|
|
608
|
+
|------|----------|------------|
|
|
609
|
+
| Resume Gate | Phase 0 checks for master plan before starting | Proceed to Phase 1 |
|
|
610
|
+
| Scout Gate | scout output before Phase 2 | Invoke rune:scout first |
|
|
611
|
+
| Plan Gate | User-approved plan before Phase 3 | Cannot proceed |
|
|
612
|
+
| Adversary Gate | adversary verdict before Phase 3 for features | Skip for bugfix/hotfix/refactor |
|
|
613
|
+
| Phase File Gate | Active phase file only (multi-session) | Load only active phase |
|
|
614
|
+
| Test-First Gate | Failing tests before Phase 4 | Write tests or get explicit skip |
|
|
615
|
+
| Quality Gate | preflight + sentinel + review before Phase 7 | Fix findings, re-run |
|
|
616
|
+
| Verification Gate | lint + types + tests + build green before commit | Fix, re-run |
|
|
617
|
+
|
|
618
|
+
## Output Format
|
|
619
|
+
|
|
620
|
+
<MUST-READ path="references/output-format.md" trigger="before emitting the Cook Report at end of any session"/>
|
|
621
|
+
|
|
622
|
+
Emit a Cook Report with: Status, Phases, Files Changed, Tests, Quality results, Commit hash.
|
|
623
|
+
When invoked by `team` with a NEXUS Handoff, include the Deliverables table — MANDATORY.
|
|
624
|
+
|
|
625
|
+
## Returns
|
|
626
|
+
|
|
627
|
+
| Artifact | Format | Location |
|
|
628
|
+
|----------|--------|----------|
|
|
629
|
+
| Plan files (master + phase) | Markdown | `.rune/plan-<feature>.md`, `.rune/plan-<feature>-phase<N>.md` |
|
|
630
|
+
| Implementation code | Source files | Per plan file paths |
|
|
631
|
+
| Test files | Source files | Co-located or `__tests__/` per project convention |
|
|
632
|
+
| Verification results | Inline stdout | Shown in Cook Report |
|
|
633
|
+
| Cook Report | Markdown (inline) | Emitted at end of session |
|
|
634
|
+
| Session state | Markdown | `.rune/decisions.md`, `.rune/progress.md`, `.rune/conventions.md` |
|
|
635
|
+
|
|
636
|
+
## Sharp Edges
|
|
637
|
+
|
|
638
|
+
<MUST-READ path="references/sharp-edges.md" trigger="before declaring done — review all 18 failure modes"/>
|
|
639
|
+
|
|
640
|
+
**CRITICAL failures** (always check): skipping scout | writing code without plan approval | "done" without evidence trail | surrendering without Approach Pivot Gate | breaking change without RFC | treating Cancel/Pause as scope change.
|
|
641
|
+
|
|
642
|
+
## Self-Validation
|
|
643
|
+
|
|
644
|
+
```
|
|
645
|
+
SELF-VALIDATION (run before emitting Cook Report):
|
|
646
|
+
- [ ] Every phase in Phase Skip Rules was either executed or explicitly skipped with reason
|
|
647
|
+
- [ ] Plan approval gate was not bypassed — user said "go" (check conversation history)
|
|
648
|
+
- [ ] No Phase 4 code was written before Phase 3 tests (TDD order preserved)
|
|
649
|
+
- [ ] All Phase 5 quality gates (preflight, sentinel, review) ran — not just claimed
|
|
650
|
+
- [ ] Cook Report contains actual commit hash, not placeholder
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
## Done When
|
|
654
|
+
|
|
655
|
+
All applicable phases complete + Self-Validation passed:
|
|
656
|
+
- User approved plan | All tests PASS (output shown) | preflight+sentinel+review PASS | build green
|
|
657
|
+
- Cook Report emitted with commit hash | Session state saved to .rune/ via session-bridge
|
|
658
|
+
|
|
659
|
+
## Cost Profile
|
|
660
|
+
|
|
661
|
+
~$0.05-0.15 per feature. Haiku for scanning (Phase 1), sonnet for coding (Phase 3-4), opus for complex planning (Phase 2 when needed).
|