jettypod 4.3.0 β†’ 4.4.1

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.
@@ -22,28 +22,15 @@ Guides Claude Code through speed mode implementation with autonomous analysis an
22
22
 
23
23
  ## Instructions
24
24
 
25
- When this skill is activated, you are helping implement a speed mode chore to make all success scenarios pass. Follow this structured approach:
26
-
27
- ## πŸ”‘ Critical Context
28
-
29
- **You are working in an isolated git worktree:**
30
- - `work start [chore-id]` created a dedicated worktree for this chore
31
- - All file operations must use **absolute paths** from the worktree (not relative paths)
32
- - The worktree has its own branch - changes are isolated from main
33
- - BDD tests and unit tests run in the worktree context
34
-
35
- **Worktree path is available in Step 0 output** - use it for all file operations.
36
-
37
- ---
25
+ When this skill is activated, you are helping implement a speed mode chore to make the happy path scenario pass. Follow this structured approach:
38
26
 
39
27
  ### Overview
40
28
 
41
- **Speed Mode Goal:** Make it work - implement ALL functionality (required + optional features) to make success scenarios pass, assuming everything works correctly.
29
+ **Speed Mode Goal:** Implement ALL scoped functionality to make the happy path BDD scenario pass, assuming everything works correctly.
42
30
 
43
31
  **Key Principles:**
44
- - **Implement ALL features/functions** defined in scenarios - both required and optional functionality
45
- - **All success paths** - every workflow that should work when inputs are valid
46
- - **Assume success** - assume inputs are valid, files upload successfully, types are correct
32
+ - **Implement ALL features/functions** defined in the scenario - do not skip functionality
33
+ - **Assume happy path** - assume inputs are valid, files upload successfully, types are correct
47
34
  - **No error handling** - no validation, no edge case handling, no error messages (that's for stable mode)
48
35
  - **Fast iteration** - single file when possible, inline code over abstraction
49
36
  - **Use real infrastructure** - use the actual database/storage from your tech stack, not mocks
@@ -53,136 +40,20 @@ When this skill is activated, you are helping implement a speed mode chore to ma
53
40
 
54
41
  ---
55
42
 
56
- ## πŸ§ͺ Unit Testing in Speed Mode - True TDD
57
-
58
- **Unit tests are written DURING the RED→GREEN loop, not after.**
59
-
60
- **The TDD workflow (each iteration):**
61
- 1. **Identify next failing BDD step** - Which scenario step needs to pass next?
62
- 2. **Write unit test for the function** - Test the specific function/logic needed
63
- 3. **Watch unit test fail (RED)** - Confirm test catches the missing implementation
64
- 4. **Write minimal code** - Just enough to make the unit test pass
65
- 5. **Run unit test (GREEN)** - Verify the function works in isolation
66
- 6. **Run BDD scenarios** - Check if this makes any BDD steps pass
67
- 7. **Next iteration** - Repeat for next failing step
68
-
69
- **What to unit test:**
70
- - New functions you're creating (not framework/library code)
71
- - Core logic and business rules
72
- - Success scenarios only (no error cases - that's stable mode)
73
-
74
- **Where to put unit tests:**
75
- - Follow project conventions: `test/`, `__tests__/`, or `*.test.js` alongside code
76
- - Check existing test files for patterns
77
-
78
- **Example of TDD iteration:**
79
- ```javascript
80
- // Iteration 1: BDD step "Given a user exists" is failing
81
-
82
- // 1. Write unit test first (RED)
83
- test('createUser creates user with valid data', () => {
84
- const user = createUser('John', 'john@example.com');
85
- expect(user.name).toBe('John');
86
- expect(user.email).toBe('john@example.com');
87
- });
88
- // Run: FAILS - createUser doesn't exist
89
-
90
- // 2. Write minimal implementation (GREEN)
91
- function createUser(name, email) {
92
- return { name, email };
93
- }
94
- // Run unit test: PASSES
95
- // Run BDD: "Given a user exists" now passes
96
-
97
- // Iteration 2: Next failing BDD step...
98
- ```
99
-
100
- **Unit test scope in speed mode:**
101
- ```javascript
102
- // βœ… Speed mode unit tests (success paths)
103
- test('createUser creates user with valid data', () => {
104
- const user = createUser('John', 'john@example.com');
105
- expect(user.name).toBe('John');
106
- expect(user.email).toBe('john@example.com');
107
- });
108
-
109
- // ❌ NOT in speed mode (stable mode adds these)
110
- test('createUser throws error for invalid email', () => {
111
- expect(() => createUser('John', 'invalid')).toThrow();
112
- });
113
- ```
114
-
115
- <details>
116
- <summary><strong>πŸ“‹ Speed Mode Constraints (click to expand)</strong></summary>
117
-
118
- **What to implement:**
119
- - ALL scoped functionality - required features AND optional features from all success scenarios
120
- - Multiple valid workflows if the feature supports them
121
- - Success variations (different outcomes that are all correct)
122
-
123
- **What NOT to implement:**
124
- - ❌ Error handling (try/catch, validation, edge cases)
125
- - ❌ Input validation (null checks, type checks, range validation)
126
- - ❌ Error messages for failures
127
- - ❌ Edge case handling (empty arrays, boundary values, race conditions)
128
-
129
- **Code organization:**
130
- - Single file when possible - keep it simple
131
- - Inline code over separate modules initially
132
- - Use real infrastructure (actual database/storage from your tech stack, not mocks)
133
- - Focus: Make. All. Features. Work. (all success paths)
134
-
135
- </details>
136
-
137
- ---
138
-
139
- ### Step 0: Initialize Speed Mode Context
140
-
141
- **You are now in speed mode,** implementing a chore to make success scenarios pass.
142
-
143
- **Get the current work context:**
144
-
145
- ```bash
146
- sqlite3 .jettypod/work.db "SELECT wi.id, wi.title, wi.parent_id, parent.title as parent_title, parent.scenario_file, wt.worktree_path, wt.branch_name FROM work_items wi LEFT JOIN work_items parent ON wi.parent_id = parent.id LEFT JOIN worktrees wt ON wi.id = wt.work_item_id WHERE wi.status = 'in_progress' AND wi.type = 'chore'"
147
- ```
148
-
149
- **Display to user:**
150
-
151
- ```
152
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
153
- πŸš€ SPEED MODE: Implementing Chore #[id]
154
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
155
-
156
- Chore: [title]
157
- Feature: #[parent-id] [parent-title]
158
- Worktree: [worktree_path]
159
- Branch: [branch_name]
160
-
161
- Analyzing BDD scenarios to determine implementation approach...
162
- ```
163
-
164
- **Then proceed to Step 1.**
165
-
166
- ---
167
-
168
43
  ## Quick Reference: Async Boundaries
169
44
 
170
45
  **Where Claude Code MUST wait for user confirmation:**
171
46
 
172
- | Phase | Location | Why | Condition |
173
- |-------|----------|-----|-----------|
174
- | Step 3A | Before implementing (conditional) | User confirms implementation approach | Only if approach is ambiguous or multiple valid paths |
175
- | Step 6 Phase 2 | Before creating stable chores | User confirms proposed stable mode chores | Always |
47
+ | Phase | Location | Why |
48
+ |-------|----------|-----|
49
+ | Step 3 Phase 1 | Before implementing | User confirms implementation approach |
50
+ | Step 4 Phase 2 | Before creating chores | User confirms proposed stable mode chores |
176
51
 
177
52
  **Where Claude Code executes autonomously:**
178
- - Step 0: Initialize context
179
- - Step 1: Scenario analysis and breadcrumb check
53
+ - Step 1: Scenario analysis
180
54
  - Step 2: Codebase analysis
181
- - Step 3: Decision to skip/ask for confirmation
182
- - Step 4: Establish RED baseline
183
- - Step 5: RED→GREEN→REFACTOR loop (true TDD)
184
- - Step 6 Phase 1: Generate stable mode scenarios/steps
185
- - Step 6 Phases 3-5: Create chores and invoke stable-mode skill
55
+ - Step 3 Phase 2: RED→GREEN→REFACTOR loop
56
+ - Step 4 Phases 3-4: Create chores and elevate
186
57
 
187
58
  ---
188
59
 
@@ -190,7 +61,7 @@ Analyzing BDD scenarios to determine implementation approach...
190
61
 
191
62
  **DO NOT mark features as complete after speed mode implementation.**
192
63
 
193
- Speed mode is ONLY a checkpoint to prove functionality works. Features are INCOMPLETE without stable mode chores that add:
64
+ Speed mode is ONLY a checkpoint to prove the happy path works. Features are INCOMPLETE without stable mode chores that add:
194
65
  - Error handling and validation
195
66
  - Edge case coverage
196
67
  - Comprehensive testing
@@ -198,7 +69,7 @@ Speed mode is ONLY a checkpoint to prove functionality works. Features are INCOM
198
69
 
199
70
  **Required workflow after speed mode implementation:**
200
71
 
201
- 1. βœ… **Complete ALL speed mode chores** - Implement all success scenarios (required + optional features)
72
+ 1. βœ… **Complete ALL speed mode chores** - Implement happy path functionality
202
73
  2. βœ… **Elevate to stable mode** - Use `node jettypod.js work set-mode <feature-id> stable` to auto-generate stable mode chores
203
74
  3. βœ… **Implement stable mode chores** - Add error handling and edge cases
204
75
  4. ❌ **NEVER mark feature complete in speed mode** - This bypasses critical quality gates
@@ -210,12 +81,17 @@ The validation will require you to:
210
81
  - This will automatically analyze the implementation and generate appropriate stable mode chores
211
82
  - Or explicitly skip (not recommended): `node jettypod.js work set-mode <feature-id> stable --force`
212
83
 
213
- **Remember:** Speed mode makes it work (all success scenarios). Stable mode makes it robust (handles failures).
84
+ **Remember:** Speed mode proves it works on the happy path. Stable mode makes it production-ready.
214
85
 
215
86
  ---
216
87
 
217
88
  ## Implementation Steps
218
89
 
90
+ <!-- ═══════════════════════════════════════════════════════════════════════════
91
+ PHASE 1: AUTONOMOUS ANALYSIS
92
+ No user input required - Claude Code executes independently
93
+ ═══════════════════════════════════════════════════════════════════════════ -->
94
+
219
95
  ### Step 1: Check for Breadcrumbs and Analyze Scenario
220
96
 
221
97
  **CRITICAL:** Claude Code executes this autonomously - no user permission needed.
@@ -230,8 +106,15 @@ The validation will require you to:
230
106
  **To get current work and check for breadcrumbs:**
231
107
 
232
108
  ```bash
233
- # Get current work item with description and parent feature's scenario_file
234
- sqlite3 .jettypod/work.db "SELECT wi.id, wi.title, wi.description, wi.parent_id, parent.title as parent_title, parent.scenario_file FROM work_items wi LEFT JOIN work_items parent ON wi.parent_id = parent.id WHERE wi.status = 'in_progress' AND wi.type = 'chore'"
109
+ # Get current work item with description
110
+ jettypod work current
111
+
112
+ # Get parent feature details including scenario_file
113
+ jettypod work show <parent-feature-id>
114
+
115
+ # Or query database directly
116
+ sqlite3 .jettypod/work.db "SELECT id, title, description, parent_id FROM work_items WHERE status = 'in_progress' AND type = 'chore'"
117
+ sqlite3 .jettypod/work.db "SELECT id, title, scenario_file FROM work_items WHERE id = <parent-feature-id>"
235
118
  ```
236
119
 
237
120
  **Check for breadcrumbs** by examining the chore's description for:
@@ -244,8 +127,8 @@ If all three sections exist, use them. Otherwise, fall back to autonomous analys
244
127
  **Then read the scenario file** using the Read tool on the path returned by `scenario_file`.
245
128
 
246
129
  **Parse Gherkin:**
247
- - Extract all `Scenario:` blocks (all success paths - required + optional features)
248
- - Parse Given/When/Then/And steps for each scenario
130
+ - Extract first `Scenario:` block (happy path)
131
+ - Parse Given/When/Then/And steps
249
132
  - Identify:
250
133
  - Initial state setup (Given)
251
134
  - User actions (When)
@@ -358,62 +241,65 @@ Integration Points:
358
241
  Now proposing implementation approach...
359
242
  ```
360
243
 
361
- ### Step 3: Decide if Confirmation Needed
362
-
363
- **Evaluate if you need user confirmation before implementing:**
244
+ **Move to Step 3 automatically.**
364
245
 
365
- **Skip confirmation (proceed directly to Step 4) if:**
366
- - Breadcrumbs are comprehensive (files, patterns, functions all specified)
367
- - Implementation approach is clear and unambiguous
368
- - Only one reasonable way to implement the scenario
369
- - Epic architectural decisions are clear and constraining
246
+ <!-- ═══════════════════════════════════════════════════════════════════════════
247
+ PHASE 2: USER CONFIRMATION REQUIRED
248
+ ⚑ ASYNC BOUNDARY - Must wait for user response before proceeding
249
+ ═══════════════════════════════════════════════════════════════════════════ -->
370
250
 
371
- **Ask for confirmation (Step 3A) if:**
372
- - Multiple valid implementation approaches exist
373
- - Breadcrumbs are vague or missing key details
374
- - Architectural choice impacts other features
375
- - You're uncertain about the right approach
251
+ ### Step 3: Propose and Execute Implementation
376
252
 
377
- ### Step 3A: Propose Implementation Approach (Conditional)
253
+ **Two phases: Propose (get user confirmation) β†’ Execute (autonomous)**
378
254
 
379
- **⚑ ASYNC BOUNDARY - Only execute this if confirmation needed**
255
+ #### Phase 1: Propose Implementation Approach
380
256
 
381
- **Present your analysis and proposal to the user:**
257
+ **Present your analysis and proposal:**
382
258
 
383
259
  ```
384
260
  πŸ’‘ Implementation Proposal
385
261
 
386
- I see multiple ways to approach this. Here's what I'm thinking:
262
+ Based on scenario analysis and codebase patterns, here's how I'll make the scenario pass:
387
263
 
388
- **Option I'm recommending:**
389
- β€’ Files to create/modify: [specific paths]
390
- β€’ Key approach: [what makes this the right choice]
391
- β€’ Why: [rationale - why this over alternatives]
264
+ **Files to create/modify:**
265
+ 1. [file path] - [what it will do]
266
+ 2. [file path] - [what it will do]
392
267
 
393
- **Alternative considered:**
394
- β€’ [Brief description] - not choosing because [reason]
268
+ **Key implementation points:**
269
+ β€’ [Point 1]: [specific approach]
270
+ β€’ [Point 2]: [specific approach]
271
+ β€’ [Point 3]: [specific approach]
395
272
 
396
- Sound good, or would you prefer a different approach?
273
+ **Why this approach:**
274
+ [Brief explanation of how this satisfies the scenario while following codebase patterns]
275
+
276
+ Sound good? I'll implement this autonomously once you confirm.
397
277
  ```
398
278
 
399
- **⚑ WAIT for user confirmation or adjustments.**
279
+ **WAIT for user confirmation or adjustments.**
400
280
 
401
- If user adjusts: revise proposal and confirm again before proceeding.
281
+ If user adjusts: revise proposal and confirm again.
402
282
 
403
- **If you skipped this step:** Proceed directly to Step 4.
283
+ <!-- ═══════════════════════════════════════════════════════════════════════════
284
+ PHASE 3: AUTONOMOUS EXECUTION
285
+ User has confirmed - Claude Code executes RED→GREEN loop independently
286
+ ═══════════════════════════════════════════════════════════════════════════ -->
404
287
 
405
- ---
288
+ #### Phase 2: Autonomous Execution
406
289
 
407
- ### Step 4: Establish RED Baseline
290
+ **CRITICAL:** After user confirms, Claude Code executes autonomously - no permission needed for individual code changes.
408
291
 
409
- **CRITICAL:** After user confirms, execute autonomously - no permission needed for code changes.
292
+ **Step 1: Establish RED Baseline**
410
293
 
411
294
  Before writing any implementation code, run tests to establish the RED state:
412
295
 
413
296
  ```bash
414
297
  # Get current work and parent feature's scenario file
415
- sqlite3 .jettypod/work.db "SELECT wi.id, wi.parent_id, parent.scenario_file FROM work_items wi LEFT JOIN work_items parent ON wi.parent_id = parent.id WHERE wi.status = 'in_progress'"
416
- # This gives you the chore ID, parent feature ID, and path to the .feature file
298
+ jettypod work current
299
+ # Note the parent_id from output
300
+
301
+ sqlite3 .jettypod/work.db "SELECT scenario_file FROM work_items WHERE id = <parent-feature-id>"
302
+ # This gives you the path to the .feature file
417
303
 
418
304
  # Run BDD tests to establish RED baseline
419
305
  npx cucumber-js <scenario-file-path> --format progress
@@ -448,360 +334,441 @@ First error:
448
334
  Now implementing...
449
335
  ```
450
336
 
451
- ---
337
+ **Step 2: RED→GREEN Iteration Loop**
452
338
 
453
- ### Step 5: RED→GREEN→REFACTOR Loop
339
+ Iterate until all tests pass or MAX_ITERATIONS reached:
454
340
 
455
- **Execute autonomously** - iterate until tests pass (max 10 iterations).
341
+ <!-- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
342
+ β”‚ πŸ”„ ITERATION LOOP: REDβ†’GREEN β”‚
343
+ β”‚ β”‚
344
+ β”‚ Progress Tracking: β”‚
345
+ β”‚ β€’ Display: "Iteration X/10" at start of each cycle β”‚
346
+ β”‚ β€’ Track: steps passing vs total, newly passing steps β”‚
347
+ β”‚ β€’ Goal: All steps pass (exit code 0) β”‚
348
+ β”‚ β”‚
349
+ β”‚ Return Points: β”‚
350
+ β”‚ β€’ CHECKPOINT_ITERATION: Resume at specific iteration number β”‚
351
+ β”‚ β€’ CHECKPOINT_PROGRESS: Resume with known passing step count β”‚
352
+ β”‚ β€’ If session interrupted, can resume from last known iteration β”‚
353
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -->
456
354
 
457
- **Each iteration (True TDD):**
355
+ ```javascript
356
+ // --- Imports and setup ---
357
+ const { runBddScenarioWithTimeout, parseTestProgress, findNewlyPassingSteps, extractErrors, MAX_ITERATIONS } = require('./.claude/skills/speed-mode/test-runner');
358
+
359
+ let previousResult = global.redBaseline; // From Step 1
360
+ let iteration = 0;
361
+
362
+ // --- Main iteration loop ---
363
+ // πŸ“Š PROGRESS: Iteration {iteration}/{MAX_ITERATIONS} | Steps: {passed}/{total}
364
+ while (iteration < MAX_ITERATIONS) {
365
+ iteration++;
366
+ console.log(`\n━━━ Iteration ${iteration}/${MAX_ITERATIONS} ━━━`);
367
+
368
+ // --- Make code changes ---
369
+ console.log(`\n✍️ Making code changes...`);
370
+ // [Claude Code writes implementation code here using Write/Edit tools]
371
+
372
+ // --- Run tests ---
373
+ console.log(`\nπŸ§ͺ Running tests...`);
374
+ const result = await runBddScenarioWithTimeout(feature.scenario_file, happyPathLine);
375
+
376
+ // --- Handle timeout ---
377
+ if (result.timedOut) {
378
+ console.log(`⚠️ Test execution timed out - tests may be hanging`);
379
+ console.log(`Stopping iteration loop`);
380
+ break;
381
+ }
458
382
 
459
- 1. **Identify next failing BDD step** - Which scenario step to tackle?
460
- 2. **Write unit test** - Test the function/logic needed for that step (watch it fail - RED)
461
- 3. **Write minimal implementation** - Just enough code to pass the unit test
462
- 4. **Run unit test** - Verify it passes (GREEN)
463
- 5. **Run BDD scenarios** - Check if BDD step now passes
464
- 6. **Display progress** - Show what's passing, what's next
465
- 7. **Continue or exit** - If all BDD scenarios pass β†’ REFACTOR. Otherwise, repeat.
383
+ // --- Parse results and track progress ---
384
+ const currentResult = parseTestProgress(result.stdout + result.stderr);
385
+ const errors = extractErrors(result.stdout + result.stderr);
386
+ const newlyPassing = findNewlyPassingSteps(previousResult, currentResult);
466
387
 
467
- **Show progress each iteration:**
468
- ```
469
- ━━━ Iteration 3/10 ━━━
470
- πŸ“ Unit test: test/dashboard.test.js - sortActivityByDate()
471
- RED: Test fails - function doesn't exist yet
472
- ✍️ Implementation: src/dashboard.js - added sortActivityByDate()
473
- GREEN: Unit test passes
474
- πŸ§ͺ Running BDD scenarios...
475
- πŸ“Š Progress: 7/8 BDD steps passing
476
- βœ… Newly passing: And activity should be sorted by date
477
- πŸ”§ Next failure: And activity should be filterable
478
- BDD step: When I filter by category "work"
479
- ```
388
+ // --- Display progress ---
389
+ console.log(`\nπŸ“Š Progress: ${currentResult.passed}/${currentResult.total} steps passing`);
480
390
 
481
- **When GREEN achieved:**
482
- ```
483
- πŸŽ‰ GREEN: All success scenarios passing!
484
- ```
391
+ if (newlyPassing.length > 0) {
392
+ console.log(`\nβœ… Newly passing:`);
393
+ newlyPassing.forEach(step => console.log(` β€’ ${step}`));
394
+ }
485
395
 
486
- **Then REFACTOR (quick pass, 5 min max):**
487
- - Extract duplicated code
488
- - Rename unclear variables
489
- - Simplify complex expressions
490
- - Remove dead code
396
+ // --- Check for GREEN state ---
397
+ if (currentResult.exitCode === 0 || currentResult.passed === currentResult.total) {
398
+ console.log(`\nπŸŽ‰ GREEN: All tests passing!`);
399
+ break;
400
+ }
491
401
 
492
- **Re-run tests after refactor** to ensure nothing broke.
402
+ // --- Display next failure ---
403
+ if (errors.errors.length > 0) {
404
+ const nextError = errors.errors[0];
405
+ console.log(`\nπŸ”§ Next failure to address:`);
406
+ console.log(` Step: ${nextError.step}`);
407
+ console.log(` Error: ${nextError.message}`);
408
+ if (nextError.stack) {
409
+ console.log(` Stack: ${nextError.stack.split('\n')[0]}`);
410
+ }
411
+ } else if (currentResult.failedSteps.length > 0) {
412
+ console.log(`\nπŸ”§ Still failing:`);
413
+ currentResult.failedSteps.slice(0, 3).forEach(step => console.log(` β€’ ${step}`));
414
+ if (currentResult.failedSteps.length > 3) {
415
+ console.log(` ... and ${currentResult.failedSteps.length - 3} more`);
416
+ }
417
+ }
493
418
 
494
- <details>
495
- <summary><strong>πŸ“‹ TDD Loop Guidelines (click to expand)</strong></summary>
419
+ previousResult = currentResult;
420
+ }
496
421
 
497
- **Iteration strategy:**
498
- - Start with first failing step
499
- - Make minimal change to pass that step
500
- - Run tests immediately
501
- - Move to next failure
422
+ // --- Handle max iterations reached ---
423
+ if (iteration >= MAX_ITERATIONS) {
424
+ console.log(`\n⚠️ Maximum iterations (${MAX_ITERATIONS}) reached without achieving GREEN`);
425
+ console.log(`Final progress: ${previousResult.passed}/${previousResult.total} steps passing`);
426
+ console.log(`\nConsider:`);
427
+ console.log(` β€’ Breaking down the chore into smaller pieces`);
428
+ console.log(` β€’ Reviewing the implementation approach`);
429
+ console.log(` β€’ Checking for incorrect assumptions`);
430
+ }
431
+ ```
502
432
 
503
- **If stuck after 5 iterations:**
504
- - Review approach - is there a simpler path?
505
- - Check assumptions - are you solving the right problem?
506
- - Break down the change - can you make smaller steps?
433
+ **Display example:**
434
+ ```
435
+ ━━━ Iteration 1/10 ━━━
507
436
 
508
- **Max 10 iterations:**
509
- - If you hit max without GREEN, stop
510
- - Display final progress and suggest next steps
511
- - Consider breaking chore into smaller pieces
437
+ ✍️ Making code changes...
438
+ Created src/login.js
439
+ Modified src/app.js
512
440
 
513
- </details>
441
+ πŸ§ͺ Running tests...
514
442
 
515
- ---
443
+ πŸ“Š Progress: 2/8 steps passing
516
444
 
517
- **CRITICAL: Check if ALL speed mode chores are complete. Stable mode transition happens ONLY after all speed chores are done.**
445
+ βœ… Newly passing:
446
+ β€’ Given a user is logged in
447
+ β€’ When they click the dashboard button
518
448
 
519
- <!-- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
520
- β”‚ πŸ” COMPLETION CHECK: Speed Chores β”‚
521
- β”‚ β”‚
522
- β”‚ Progress Tracking: β”‚
523
- β”‚ β€’ Query: Count incomplete speed chores for feature β”‚
524
- β”‚ β€’ Display: "X speed mode chores remaining" or "All complete" β”‚
525
- β”‚ β€’ Action: Generate stable scenarios/steps/chores if all complete β”‚
526
- β”‚ β”‚
527
- β”‚ Return Point: β”‚
528
- β”‚ β€’ CHECKPOINT_CHORE_COUNT: Known incomplete count from last check β”‚
529
- β”‚ β€’ If session interrupted, re-query to get current count β”‚
530
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -->
449
+ πŸ”§ Next failure to address:
450
+ Step: Then they should see their dashboard
451
+ Error: Cannot read property 'innerText' of null
452
+ Stack: at Dashboard.render (src/dashboard.js:12:15)
531
453
 
532
- **Check for incomplete speed chores:**
454
+ ━━━ Iteration 2/10 ━━━
533
455
 
534
- ```bash
535
- # Get current work to find parent feature ID
536
- sqlite3 .jettypod/work.db "SELECT wi.parent_id FROM work_items wi WHERE wi.status = 'in_progress'"
456
+ ✍️ Making code changes...
457
+ Created src/dashboard.js
458
+ Modified src/app.js
537
459
 
538
- # Get list of remaining speed chores (excluding current chore)
539
- sqlite3 .jettypod/work.db "SELECT id, title FROM work_items WHERE parent_id = <feature-id> AND type = 'chore' AND mode = 'speed' AND status != 'done' AND id != <current-chore-id> ORDER BY created_at LIMIT 1"
540
- ```
460
+ πŸ§ͺ Running tests...
541
461
 
542
- **If speed chores remain, display and start next chore:**
462
+ πŸ“Š Progress: 5/8 steps passing
543
463
 
544
- ```
545
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
546
- 🎯 Speed Mode Chore Complete
547
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
464
+ βœ… Newly passing:
465
+ β€’ Then they should see their dashboard
466
+ β€’ And the dashboard should show their username
467
+ β€’ And the dashboard should show their recent activity
548
468
 
549
- βœ… Success scenarios pass for this chore
469
+ πŸ”§ Next failure to address:
470
+ Step: And the activity should be sorted by date
471
+ Error: Expected ['Post 2', 'Post 1'] but got ['Post 1', 'Post 2']
550
472
 
551
- More speed mode chores remain. Starting next chore:
552
- #[next-chore-id]: [next-chore-title]
553
- ```
473
+ ━━━ Iteration 3/10 ━━━
554
474
 
555
- **Then immediately merge current chore and start next:**
475
+ ✍️ Making code changes...
476
+ Modified src/dashboard.js
556
477
 
557
- ```bash
558
- # Commit changes in the worktree
559
- git add . && git commit -m "feat: [brief description of what was implemented]"
478
+ πŸ§ͺ Running tests...
560
479
 
561
- # Merge current chore - this automatically marks it as done
562
- jettypod work merge
480
+ πŸ“Š Progress: 8/8 steps passing
563
481
 
564
- # Start next speed chore
565
- jettypod work start [next-chore-id]
566
- ```
482
+ βœ… Newly passing:
483
+ β€’ And the activity should be sorted by date
567
484
 
568
- **CRITICAL: Use ONLY `jettypod work merge` to complete chores.**
569
- - ❌ DO NOT use `jettypod work status <id> done`
570
- - ❌ DO NOT use `jettypod work complete <id>`
571
- - ❌ DO NOT use `jettypod work set-mode <id> done`
572
- - βœ… ONLY use `jettypod work merge`
485
+ πŸŽ‰ GREEN: All tests passing!
486
+ ```
573
487
 
574
- The merge command handles everything: pushes branch, merges to main, marks chore done, cleans up worktree.
488
+ **Speed mode constraints:**
489
+ - **Implement ALL scoped functionality** - if the scenario requires file upload, implement it (just assume it works)
490
+ - **Single file when possible** - keep it simple
491
+ - **NO error handling** - no try/catch, no validation, no edge cases
492
+ - **Assume everything works** - valid inputs, successful operations, correct types
493
+ - **Use real infrastructure** - actual database/storage from your tech stack
494
+ - **Inline code over separate modules** - keep it simple
495
+ - **Focus: Make. All. Features. Work.** (on the happy path)
575
496
 
576
- The speed-mode skill will automatically re-invoke for the next chore.
497
+ **Step 3: REFACTOR**
577
498
 
578
- **If all speed chores are done (count = 0), continue to Step 6 below.**
499
+ After GREEN is achieved, do a quick refactor pass:
579
500
 
580
- ---
501
+ 1. **Extract duplicated code** - DRY up any copy-pasted logic
502
+ 2. **Rename unclear variables** - make intent obvious
503
+ 3. **Simplify complex expressions** - break into readable steps
504
+ 4. **Remove dead code** - delete unused variables/functions
581
505
 
582
- ### Step 6: Transition to Stable Mode (After All Speed Chores Complete)
506
+ **Keep it fast** - 5 minutes max. Major refactoring happens in stable mode.
583
507
 
584
- **⚑ ASYNC BOUNDARY - Must wait for user to confirm proposed scenarios/chores**
508
+ **Re-run tests after refactoring** to ensure nothing broke:
585
509
 
586
- **CRITICAL:** This step ONLY runs after ALL speed chores are complete. This is the transition from speed mode to stable mode.
510
+ ```javascript
511
+ const result = await runBddScenarioWithTimeout(feature.scenario_file, scenarioLine);
512
+ if (result.exitCode !== 0) {
513
+ console.log('⚠️ Refactoring broke tests - revert and try again');
514
+ }
515
+ ```
587
516
 
588
- **Workflow: Merge last chore β†’ Generate scenarios β†’ Generate step definitions β†’ Propose chores β†’ Commit BDD files β†’ Create chores β†’ Set mode to stable β†’ Invoke stable-mode skill**
517
+ **Step 4: Final Verification and Completion**
589
518
 
590
- #### Phase 1: Merge Final Speed Chore
519
+ After GREEN + REFACTOR, run full feature file once to verify no regressions:
591
520
 
592
- **Complete the current (final) speed chore:**
521
+ ```javascript
522
+ // After iteration loop succeeds (GREEN achieved)
523
+ if (currentResult.exitCode === 0 || currentResult.passed === currentResult.total) {
524
+ console.log(`\nπŸŽ‰ GREEN: Happy path scenario passing!`);
525
+ console.log(`\nπŸ” Running full verification (all scenarios)...`);
526
+
527
+ // Run entire feature file once for regression detection
528
+ // Uses the already imported runBddScenarioWithTimeout with no line number to run all scenarios
529
+ const fullResult = await runBddScenarioWithTimeout(feature.scenario_file);
530
+
531
+ if (fullResult.timedOut) {
532
+ console.log(`⚠️ Full verification timed out`);
533
+ } else if (fullResult.exitCode !== 0) {
534
+ const fullProgress = parseTestProgress(fullResult.stdout + fullResult.stderr);
535
+ console.log(`⚠️ Full verification found regressions: ${fullProgress.total - fullProgress.passed} scenarios failing`);
536
+ console.log(`This is expected in speed mode - stable mode will address additional scenarios.`);
537
+ } else {
538
+ console.log(`βœ… Full verification passed - all scenarios passing!`);
539
+ }
540
+ }
541
+ ```
593
542
 
594
- ```bash
595
- # Commit changes in the worktree
596
- git add . && git commit -m "feat: [brief description of what was implemented]"
543
+ Display comprehensive results:
597
544
 
598
- # Merge to main with lock held for transition phase
599
- # This prevents race conditions when multiple instances generate BDD files simultaneously
600
- jettypod work merge --with-transition
601
- ```
545
+ **On SUCCESS (GREEN achieved):**
602
546
 
603
- <details>
604
- <summary>πŸ’‘ Why --with-transition? (click to expand)</summary>
547
+ ```javascript
548
+ // Track what files were created/modified during implementation
549
+ const filesCreated = [/* list of created files */];
550
+ const filesModified = [/* list of modified files */];
605
551
 
606
- The `--with-transition` flag holds the merge lock through the entire BDD generation phase (Phases 2-6).
552
+ console.log(`\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
553
+ console.log(`βœ… SPEED MODE COMPLETE - GREEN STATE ACHIEVED`);
554
+ console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
607
555
 
608
- **Without this flag:**
609
- - Instance A merges β†’ generates BDD β†’ appends to step_definitions/auth.steps.js
610
- - Instance B merges β†’ generates BDD β†’ appends to step_definitions/auth.steps.js (CONFLICT!)
611
- - Second write can overwrite first write, losing step definitions
556
+ console.log(`πŸŽ‰ Happy path scenario: ALL TESTS PASSING\n`);
612
557
 
613
- **With this flag:**
614
- - Instance A acquires lock β†’ merges β†’ generates BDD β†’ commits β†’ releases lock
615
- - Instance B waits β†’ acquires lock β†’ merges β†’ generates BDD β†’ commits β†’ releases lock
616
- - No conflicts, all step definitions preserved
558
+ console.log(`Implementation Summary:`);
559
+ console.log(` Iterations: ${iteration}/${MAX_ITERATIONS}`);
560
+ console.log(` Test steps: ${currentResult.passed}/${currentResult.total} passing\n`);
617
561
 
618
- You'll release the lock in Phase 6 after committing BDD files.
619
- </details>
562
+ if (filesCreated.length > 0) {
563
+ console.log(`Files created:`);
564
+ filesCreated.forEach(file => console.log(` βœ… ${file}`));
565
+ console.log();
566
+ }
620
567
 
621
- **CRITICAL: Use ONLY `jettypod work merge` to complete chores.**
622
- - ❌ DO NOT use `jettypod work status <id> done`
623
- - ❌ DO NOT use `jettypod work complete <id>`
624
- - ❌ DO NOT use `jettypod work set-mode <id> done`
625
- - βœ… ONLY use `jettypod work merge`
568
+ if (filesModified.length > 0) {
569
+ console.log(`Files modified:`);
570
+ filesModified.forEach(file => console.log(` ✏️ ${file}`));
571
+ console.log();
572
+ }
626
573
 
627
- After merge, you are now on main branch. Ready to generate stable mode scenarios.
574
+ // --- Create unit tests for new functions ---
575
+ // For each new function implemented, create a unit test file with happy path coverage
628
576
 
629
- #### Phase 2: Generate Stable Mode BDD Scenarios
577
+ // Unit test template for new functions:
578
+ // test/[filename].test.js or __tests__/[filename].test.js
579
+ /*
580
+ const { functionName } = require('../src/path/to/module');
630
581
 
631
- **Your task:** Create BDD scenarios for error handling, edge cases, and validation.
582
+ describe('functionName', () => {
583
+ it('should handle valid input successfully', () => {
584
+ // Arrange
585
+ const input = validTestData;
632
586
 
633
- **Read the feature's existing scenario file:**
587
+ // Act
588
+ const result = functionName(input);
634
589
 
635
- ```bash
636
- # Find the feature's scenario file
637
- sqlite3 .jettypod/work.db "SELECT id, title FROM work_items WHERE id = <feature-id>"
638
- # Look for: features/bdd/<epic-slug>/<feature-slug>.feature
639
- ```
590
+ // Assert
591
+ expect(result).toEqual(expectedOutput);
592
+ });
593
+ });
594
+ */
640
595
 
641
- **Analysis checklist for new scenarios:**
596
+ // Speed mode unit tests focus on:
597
+ // - Happy path with valid input
598
+ // - One successful operation per function
599
+ // - Basic return value verification
642
600
 
643
- 1. **Error scenarios** - What can go wrong?
644
- - Invalid user input (wrong types, out of range, malformed data)
645
- - Missing required parameters
646
- - System errors (file not found, network errors, database errors)
647
- - Permission/authorization failures
601
+ console.log(`Next step: Elevate to stable mode using 'jettypod work set-mode <feature-id> stable'\n`);
602
+ ```
648
603
 
649
- 2. **Edge case scenarios** - Boundary conditions
650
- - Empty inputs (empty strings, empty arrays, null values)
651
- - Maximum values (large numbers, long strings, many items)
652
- - Minimum values (zero, negative numbers)
653
- - Special characters and Unicode
604
+ **Display:**
605
+ ```
606
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
607
+ βœ… GREEN STATE ACHIEVED - Now Creating Stable Chores
608
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
654
609
 
655
- 3. **State consistency scenarios** - Data integrity
656
- - Concurrent operations (race conditions)
657
- - Partial failures (transaction rollbacks)
658
- - State transitions (invalid state changes)
610
+ πŸŽ‰ Happy path scenario: ALL TESTS PASSING
659
611
 
660
- **Generate stable scenarios and append to feature file:**
612
+ Implementation Summary:
613
+ Iterations: 3/10
614
+ Test steps: 8/8 passing
661
615
 
662
- ```gherkin
663
- Scenario: Handle missing required parameter
664
- Given the system is initialized
665
- When I call the function with missing "name" parameter
666
- Then it should throw a validation error
667
- And the error message should be "Parameter 'name' is required"
616
+ Files created:
617
+ βœ… src/login.js
618
+ βœ… src/dashboard.js
668
619
 
669
- Scenario: Handle empty input
670
- Given the system is initialized
671
- When I provide an empty string as input
672
- Then it should return an appropriate error
673
- And the error code should be "INVALID_INPUT"
620
+ Files modified:
621
+ ✏️ src/app.js
622
+ ✏️ src/index.html
674
623
 
675
- Scenario: Handle maximum boundary value
676
- Given the system is initialized
677
- When I provide the maximum allowed value
678
- Then it should process successfully
679
- And return the expected result
624
+ ⚠️ Speed mode is NOT complete until stable chores exist.
625
+ Proceeding to Step 4 to create stable mode chores...
680
626
  ```
681
627
 
682
- **Append scenarios to the feature file** (don't overwrite existing speed scenarios):
628
+ **On FAILURE (max iterations or timeout):**
683
629
 
684
- ```bash
685
- # Append to existing .feature file
686
- cat >> features/bdd/<epic-slug>/<feature-slug>.feature << 'EOF'
630
+ ```javascript
631
+ // --- Display failure header ---
632
+ console.log(`\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
633
+ console.log(`⚠️ SPEED MODE INCOMPLETE - STILL IN RED STATE`);
634
+ console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
635
+
636
+ // --- Handle timeout case ---
637
+ if (result.timedOut) {
638
+ console.log(`❌ Test execution timed out`);
639
+ console.log(`\nPossible causes:`);
640
+ console.log(` β€’ Infinite loop in implementation code`);
641
+ console.log(` β€’ Test is waiting for async operation that never completes`);
642
+ console.log(` β€’ Step definition has blocking code`);
643
+ } else {
644
+ // --- Handle max iterations case ---
645
+ console.log(`❌ Maximum iterations (${MAX_ITERATIONS}) reached\n`);
646
+ console.log(`Final Progress: ${previousResult.passed}/${previousResult.total} steps passing\n`);
647
+
648
+ // --- Display failing steps ---
649
+ if (previousResult.failedSteps.length > 0) {
650
+ console.log(`Still failing:`);
651
+ previousResult.failedSteps.forEach(step => console.log(` βœ– ${step}`));
652
+ console.log();
653
+ }
687
654
 
688
- # Stable Mode Scenarios - Error Handling and Edge Cases
655
+ // --- Display remaining errors ---
656
+ const errors = extractErrors(result.stdout + result.stderr);
657
+ if (errors.errors.length > 0) {
658
+ console.log(`Remaining errors:`);
659
+ errors.errors.slice(0, 3).forEach(err => {
660
+ console.log(` Step: ${err.step}`);
661
+ console.log(` Error: ${err.message}\n`);
662
+ });
663
+ }
664
+ }
689
665
 
690
- Scenario: [Title]
691
- Given [context]
692
- When [action]
693
- Then [expected behavior]
666
+ // --- Display next steps ---
667
+ console.log(`\nWhat to do:`);
668
+ console.log(` β€’ Review implementation approach - is it the right strategy?`);
669
+ console.log(` β€’ Check for incorrect assumptions about existing code`);
670
+ console.log(` β€’ Consider breaking this chore into smaller pieces`);
671
+ console.log(` β€’ Verify step definitions match what implementation provides`);
672
+ console.log(`\nDO NOT proceed to generate stable mode chores until GREEN is achieved.`);
673
+ ```
694
674
 
695
- Scenario: [Title]
696
- Given [context]
697
- When [action]
698
- Then [expected behavior]
699
- EOF
675
+ **Display (on failure):**
700
676
  ```
677
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
678
+ ⚠️ SPEED MODE INCOMPLETE - STILL IN RED STATE
679
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
701
680
 
702
- #### Phase 3: Generate Stable Mode Step Definitions
681
+ ❌ Maximum iterations (10) reached
703
682
 
704
- **Your task:** Create step definition files for the new stable scenarios.
683
+ Final Progress: 5/8 steps passing
705
684
 
706
- **Identify new step definitions needed:**
685
+ Still failing:
686
+ βœ– Then they should see their dashboard
687
+ βœ– And the dashboard should show their username
688
+ βœ– And the dashboard should show their recent activity
707
689
 
708
- 1. Read the stable scenarios you just created
709
- 2. Extract unique Given/When/Then steps
710
- 3. Check if step definitions already exist in `features/bdd/<epic-slug>/steps/`
711
- 4. Create new step definition files for missing steps
690
+ Remaining errors:
691
+ Step: Then they should see their dashboard
692
+ Error: Cannot read property 'innerText' of null
712
693
 
713
- **Generate step definition files:**
694
+ Step: And the dashboard should show their username
695
+ Error: Expected 'John Doe' but got undefined
714
696
 
715
- ```javascript
716
- // features/bdd/<epic-slug>/steps/<feature-slug>-stable.steps.js
717
-
718
- const { Given, When, Then } = require('@cucumber/cucumber');
719
- const { expect } = require('chai');
720
-
721
- // Error handling steps
722
- When('I call the function with missing {string} parameter', async function(paramName) {
723
- try {
724
- // Implementation that calls function without parameter
725
- this.error = null;
726
- } catch (err) {
727
- this.error = err;
728
- }
729
- });
697
+ What to do:
698
+ β€’ Review implementation approach - is it the right strategy?
699
+ β€’ Check for incorrect assumptions about existing code
700
+ β€’ Consider breaking this chore into smaller pieces
701
+ β€’ Verify step definitions match what implementation provides
730
702
 
731
- Then('it should throw a validation error', function() {
732
- expect(this.error).to.exist;
733
- expect(this.error.name).to.equal('ValidationError');
734
- });
703
+ DO NOT proceed to generate stable mode chores until GREEN is achieved.
704
+ ```
735
705
 
736
- Then('the error message should be {string}', function(expectedMessage) {
737
- expect(this.error.message).to.equal(expectedMessage);
738
- });
706
+ **Move to Step 4 IMMEDIATELY if GREEN achieved.**
739
707
 
740
- // Edge case steps
741
- When('I provide an empty string as input', async function() {
742
- this.result = await this.functionUnderTest('');
743
- });
708
+ **CRITICAL: GREEN is NOT completion - it's just a checkpoint. Speed mode is INCOMPLETE until stable mode chores are created. You MUST continue to Step 4.**
744
709
 
745
- When('I provide the maximum allowed value', async function() {
746
- this.result = await this.functionUnderTest(Number.MAX_SAFE_INTEGER);
747
- });
748
- ```
710
+ <!-- ═══════════════════════════════════════════════════════════════════════════
711
+ PHASE 4: STABLE CHORE GENERATION
712
+ ⚑ ASYNC BOUNDARY - Must wait for user to confirm proposed chores
713
+ ═══════════════════════════════════════════════════════════════════════════ -->
749
714
 
750
- **Create step definition files:**
715
+ ### Step 4: Generate Stable Mode Chores (REQUIRED - Do Not Skip)
751
716
 
752
- ```bash
753
- # Create the step definition file
754
- touch features/bdd/<epic-slug>/steps/<feature-slug>-stable.steps.js
755
- # Write the step definitions to the file
756
- ```
717
+ **CRITICAL:** This step is MANDATORY. Speed mode is NOT complete until stable mode chores exist. Without them, users cannot resume work on this feature.
718
+
719
+ **Two phases: Analyze and propose β†’ Get confirmation β†’ Create autonomously**
757
720
 
758
- #### Phase 4: Analyze Implementation and Propose Stable Mode Chores
721
+ #### Phase 1: Analyze Implementation
759
722
 
760
- **Your task:** Based on the stable scenarios and step definitions, identify what needs to be implemented.
723
+ **Your task:** Review what was built and identify what's needed for stable mode.
761
724
 
762
725
  **Analysis checklist:**
763
726
 
764
727
  1. **Error handling gaps**
765
- - What validation needs to be added?
766
- - What error types need to be thrown?
767
- - What error messages need to be user-friendly?
768
-
769
- 2. **Edge case handling**
770
- - What boundary checks are needed?
771
- - What null/undefined checks are missing?
772
- - What type validation is needed?
773
-
774
- 3. **Code that needs refactoring**
775
- - What needs better structure for error handling?
728
+ - What user errors are possible?
729
+ - What system errors could occur?
730
+ - What validation is missing?
731
+
732
+ 2. **Edge cases**
733
+ - Boundary conditions (empty inputs, max values, etc.)
734
+ - Race conditions
735
+ - State consistency issues
736
+
737
+ 3. **Non-happy-path scenarios**
738
+ - Read the full scenario file (not just happy path)
739
+ - Identify scenarios 2+ (error handling, edge cases)
740
+ - Check what additional behavior is needed
741
+
742
+ 4. **Code quality needs**
743
+ - What needs better structure/organization?
744
+ - What needs proper error messages?
776
745
  - What needs logging/debugging support?
777
- - What needs better separation of concerns?
746
+
747
+ #### Phase 2: Propose Stable Mode Chores
778
748
 
779
749
  **Present your analysis:**
780
750
 
781
751
  ```
782
752
  πŸ“‹ Stable Mode Chores Proposal
783
753
 
784
- I've generated [N] stable mode scenarios covering error handling and edge cases.
785
- I've created step definitions for these scenarios.
786
-
787
- Here are the chores needed to make these scenarios pass:
754
+ I've analyzed the implementation. Here are the chores needed for stable mode:
788
755
 
789
756
  **Chore 1: [Title]**
790
757
  - Why: [What gap this fills]
791
758
  - Scope: [What specifically needs to be done]
792
- - Scenarios: [Which BDD scenarios this addresses]
759
+ - Scenario: [Which BDD scenario this addresses, if applicable]
793
760
 
794
761
  **Chore 2: [Title]**
795
762
  - Why: [What gap this fills]
796
763
  - Scope: [What specifically needs to be done]
797
- - Scenarios: [Which BDD scenarios this addresses]
764
+ - Scenario: [Which BDD scenario this addresses, if applicable]
798
765
 
799
766
  **Chore 3: [Title]**
800
767
  - Why: [What gap this fills]
801
768
  - Scope: [What specifically needs to be done]
802
- - Scenarios: [Which BDD scenarios this addresses]
769
+ - Scenario: [Which BDD scenario this addresses, if applicable]
803
770
 
804
- These chores will make all stable mode scenarios pass with proper error handling and edge case coverage.
771
+ These chores will make all BDD scenarios pass with proper error handling and edge case coverage.
805
772
 
806
773
  Sound good? I'll create these chores once you confirm.
807
774
  ```
@@ -810,7 +777,12 @@ Sound good? I'll create these chores once you confirm.
810
777
 
811
778
  If user adjusts: revise chores and confirm again.
812
779
 
813
- #### Phase 5: Create Chores Autonomously
780
+ <!-- ═══════════════════════════════════════════════════════════════════════════
781
+ PHASE 5: AUTONOMOUS COMPLETION
782
+ User has confirmed chores - create them and finalize
783
+ ═══════════════════════════════════════════════════════════════════════════ -->
784
+
785
+ #### Phase 3: Create Chores Autonomously
814
786
 
815
787
  **CRITICAL:** After user confirms, create chores programmatically - no additional permission needed.
816
788
 
@@ -818,7 +790,7 @@ If user adjusts: revise chores and confirm again.
818
790
 
819
791
  ```javascript
820
792
  const { create } = require('./features/work-tracking');
821
- const { getCurrentWork } = require('./lib/current-work');
793
+ const { getCurrentWork } = require('../../lib/current-work');
822
794
 
823
795
  (async () => {
824
796
  const currentWork = await getCurrentWork();
@@ -840,47 +812,46 @@ Chores created:
840
812
  β€’ #[ID]: [Title]
841
813
  ```
842
814
 
843
- #### Phase 6: Commit Stable Mode Scenarios and Steps to Main
815
+ #### Phase 4: Auto-Elevate to Stable Mode (If All Speed Chores Done)
844
816
 
845
- **CRITICAL: Commit the BDD files to main BEFORE starting stable chores.**
817
+ **CRITICAL: Check if ALL speed mode chores are complete. If yes, auto-elevate to stable mode.**
846
818
 
847
- ```bash
848
- # You're currently on main after merging the last speed chore
849
- # Commit the stable mode scenarios and step definitions
850
- git add features/
851
- git commit -m "test: Add stable mode BDD scenarios and step definitions
852
-
853
- Added error handling and edge case scenarios for stable mode implementation.
819
+ <!-- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
820
+ β”‚ πŸ” COMPLETION CHECK: Speed Chores β”‚
821
+ β”‚ β”‚
822
+ β”‚ Progress Tracking: β”‚
823
+ β”‚ β€’ Query: Count incomplete speed chores for feature β”‚
824
+ β”‚ β€’ Display: "X speed mode chores remaining" or "All complete" β”‚
825
+ β”‚ β€’ Action: Auto-elevate if all complete β”‚
826
+ β”‚ β”‚
827
+ β”‚ Return Point: β”‚
828
+ β”‚ β€’ CHECKPOINT_CHORE_COUNT: Known incomplete count from last check β”‚
829
+ β”‚ β€’ If session interrupted, re-query to get current count β”‚
830
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -->
854
831
 
855
- - [N] new stable mode scenarios
856
- - Step definitions for validation, error handling, and edge cases"
832
+ **Check for incomplete speed chores:**
857
833
 
858
- # Push to remote
859
- git push
834
+ ```bash
835
+ # Get current work to find parent feature ID
836
+ jettypod work current
860
837
 
861
- # Release the merge lock (held since Phase 1)
862
- jettypod work merge --release-lock
838
+ # Count incomplete speed chores for the feature
839
+ sqlite3 .jettypod/work.db "SELECT COUNT(*) FROM work_items WHERE parent_id = <feature-id> AND type = 'chore' AND mode = 'speed' AND status != 'done'"
863
840
  ```
864
841
 
865
- This ensures stable mode BDD files are in main and will be present in stable chore worktrees.
866
-
867
- The merge lock is now released - other instances can proceed with their transitions.
868
-
869
- #### Phase 7: Set Feature Mode to Stable
870
-
871
- **Set the feature mode:**
842
+ **If all speed chores are done (count = 0), EXECUTE elevation:**
872
843
 
873
844
  ```bash
874
845
  jettypod work set-mode <feature-id> stable
875
846
  ```
876
847
 
877
- #### Phase 8: Invoke Stable Mode Skill
848
+ **DO NOT display this as example text. EXECUTE IT using the Bash tool.**
878
849
 
879
- **CRITICAL: Immediately transition to stable-mode skill to start implementing stable chores.**
850
+ After execution, display:
880
851
 
881
852
  ```
882
853
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
883
- 🎯 Speed Mode Complete! Transitioning to Stable Mode
854
+ 🎯 Speed Mode Complete! Feature Elevated to Stable Mode
884
855
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
885
856
 
886
857
  ⚠️ CRITICAL: Speed mode is ONLY a checkpoint to prove functionality works.
@@ -888,35 +859,56 @@ The feature is INCOMPLETE without stable mode - error handling, validation,
888
859
  edge cases, and comprehensive testing are ALL required.
889
860
 
890
861
  What we accomplished:
862
+ βœ… Happy path scenario passes
891
863
  βœ… All speed mode chores complete
892
- βœ… Generated [N] stable mode BDD scenarios
893
- βœ… Created step definitions for stable scenarios
894
- βœ… Created [N] stable mode chores
895
- βœ… Feature mode set to stable
864
+ βœ… Feature elevated to stable mode
865
+ βœ… Stable mode chores created and ready
896
866
 
897
- πŸš€ NEVER leave a feature in speed mode.
867
+ πŸš€ NEVER leave a feature in speed mode - it's not production-ready.
898
868
  Stable mode adds:
899
869
  β€’ Comprehensive error handling and user-friendly error messages
900
870
  β€’ Input validation (null checks, type checks, range validation)
901
871
  β€’ Edge case handling (empty arrays, boundary values, race conditions)
902
872
  β€’ State consistency and data integrity
903
- β€’ All BDD scenarios passing (success scenarios + error/edge cases)
873
+ β€’ All BDD scenarios passing (happy path + error/edge cases)
874
+
875
+ **Next step:** IMMEDIATELY start the first stable mode chore
876
+ jettypod work start [first-stable-chore-id]
877
+ ```
878
+
879
+ **If speed chores remain, display:**
904
880
 
905
- **Next step:** I'm now invoking the stable-mode skill to start implementing the first stable chore.
906
881
  ```
882
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
883
+ 🎯 Speed Mode Chore Done - Stable Chores Created
884
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
885
+
886
+ What we accomplished:
887
+ βœ… Happy path scenario passes for this chore
888
+ βœ… Stable mode chores created for when speed mode finishes
907
889
 
908
- **Invoke the stable-mode skill:**
890
+ Remaining speed mode chores: [count]
909
891
 
910
- Use the Skill tool to automatically transition to stable mode implementation:
892
+ ⚠️ Speed mode is NOT complete yet - [count] chores remain.
893
+ You can take a break here - stable mode chores exist and work can resume.
911
894
 
895
+ **Next step:** Continue with next speed mode chore
896
+ jettypod work start [next-speed-chore-id]
912
897
  ```
913
- Skill tool with skill="stable-mode"
898
+
899
+ **Mark current chore as done:**
900
+
901
+ Use Bash tool to commit and push:
902
+ ```bash
903
+ git add . && git commit -m "feat: [brief description of what was implemented]" && git push
904
+ ```
905
+
906
+ Then use the merge command to merge to main (which auto-marks chore as done via post-merge hook):
907
+ ```bash
908
+ jettypod work merge
914
909
  ```
915
910
 
916
- The stable-mode skill will:
917
- 1. Start the first stable chore automatically
918
- 2. Guide implementation to make stable scenarios pass
919
- 3. Continue with remaining stable chores
911
+ The post-merge hook will automatically mark the chore as done when merged to main.
920
912
 
921
- **End speed-mode skill.**
913
+ **End skill.**
922
914