jettypod 4.4.51 → 4.4.53

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.
@@ -17,6 +17,15 @@ const modeLabels: Record<string, { label: string; color: string }> = {
17
17
  production: { label: 'prod', color: 'bg-purple-100 text-purple-800 dark:bg-purple-900/50 dark:text-purple-300' },
18
18
  };
19
19
 
20
+ function getModeLabel(item: WorkItem): string {
21
+ if (!item.mode) return '';
22
+ const base = modeLabels[item.mode]?.label || item.mode;
23
+ if (item.current_step && item.total_steps) {
24
+ return `${base} ${item.current_step}/${item.total_steps}`;
25
+ }
26
+ return base;
27
+ }
28
+
20
29
  interface KanbanCardProps {
21
30
  item: WorkItem;
22
31
  epicTitle?: string | null;
@@ -40,7 +49,7 @@ function KanbanCard({ item, epicTitle, showEpic = false }: KanbanCardProps) {
40
49
  <span className="text-xs text-zinc-400 font-mono">#{item.id}</span>
41
50
  {item.mode && modeLabels[item.mode] && (
42
51
  <span className={`text-xs px-1.5 py-0.5 rounded ${modeLabels[item.mode].color}`}>
43
- {modeLabels[item.mode].label}
52
+ {getModeLabel(item)}
44
53
  </span>
45
54
  )}
46
55
  </div>
@@ -78,7 +87,7 @@ function KanbanCard({ item, epicTitle, showEpic = false }: KanbanCardProps) {
78
87
  <span className="text-zinc-400 font-mono">#{chore.id}</span>
79
88
  {chore.mode && modeLabels[chore.mode] && (
80
89
  <span className={`px-1 py-0.5 rounded text-[10px] ${modeLabels[chore.mode].color}`}>
81
- {modeLabels[chore.mode].label}
90
+ {getModeLabel(chore)}
82
91
  </span>
83
92
  )}
84
93
  <span className="text-zinc-700 dark:text-zinc-300 truncate">
@@ -21,6 +21,8 @@ export interface WorkItem {
21
21
  created_at: string;
22
22
  children?: WorkItem[];
23
23
  chores?: WorkItem[];
24
+ current_step?: number | null;
25
+ total_steps?: number | null;
24
26
  }
25
27
 
26
28
  export interface Decision {
@@ -207,9 +209,11 @@ export function getKanbanData(doneLimit: number = 50): KanbanData {
207
209
  // Get all chores that belong to features (for chore expansion)
208
210
  const featureChores = db.prepare(`
209
211
  SELECT c.id, c.type, c.title, c.description, c.status, c.parent_id, c.epic_id,
210
- c.branch_name, c.mode, c.phase, c.completed_at, c.created_at
212
+ c.branch_name, c.mode, c.phase, c.completed_at, c.created_at,
213
+ wc.current_step, wc.total_steps
211
214
  FROM work_items c
212
215
  INNER JOIN work_items f ON c.parent_id = f.id
216
+ LEFT JOIN workflow_checkpoints wc ON wc.work_item_id = c.id
213
217
  WHERE c.type = 'chore' AND f.type = 'feature'
214
218
  ORDER BY c.id
215
219
  `).all() as WorkItem[];
@@ -231,9 +235,11 @@ export function getKanbanData(doneLimit: number = 50): KanbanData {
231
235
  const allItems = db.prepare(`
232
236
  SELECT w.id, w.type, w.title, w.description, w.status, w.parent_id, w.epic_id,
233
237
  w.branch_name, w.mode, w.phase, w.completed_at, w.created_at,
234
- p.type as parent_type
238
+ p.type as parent_type,
239
+ wc.current_step, wc.total_steps
235
240
  FROM work_items w
236
241
  LEFT JOIN work_items p ON w.parent_id = p.id
242
+ LEFT JOIN workflow_checkpoints wc ON wc.work_item_id = w.id
237
243
  WHERE w.type IN ('feature', 'chore', 'bug')
238
244
  AND (w.parent_id IS NULL OR p.type = 'epic')
239
245
  ORDER BY w.id
@@ -0,0 +1,120 @@
1
+ # Command Whitelist Matrix: Feature Planning
2
+
3
+ This document defines what commands/actions are allowed at each step of the feature-planning skill. Hooks should enforce these rules and redirect the agent when violations occur.
4
+
5
+ ## Matrix
6
+
7
+ | Step | Description | Allowed Commands | Blocked Commands | Redirect Message |
8
+ |------|-------------|------------------|------------------|------------------|
9
+ | **1** | Get feature context | `work show`, `workflow start`, `backlog` | Any file writes, `work create`, `work start`, `work implement` | "You're in Step 1 - get context first with `work show <id>`" |
10
+ | **2** | Check epic decisions | `decisions --epic=X` | File writes, `work create`, `work start` | "Check for epic decisions before suggesting approaches" |
11
+ | **3** | Suggest 3 UX approaches | Read-only (Read, Glob, Grep) | File writes, `work create`, `work start` | "Wait for user to pick an approach - no changes yet" |
12
+ | **4** | Optional prototyping | Write to `prototypes/` only | Writes to `features/`, `src/`, `work create`, `work start` | "Prototypes go in prototypes/ - no production code yet" |
13
+ | **5** | Choose winner | `workflow checkpoint` | File writes, `work create`, `work start` | "Wait for user to confirm winner" |
14
+ | **6A** | Define integration contract | Read-only | File writes | "Define how users reach the feature first" |
15
+ | **6B** | Propose BDD scenarios | Read-only, `workflow checkpoint` | **Write to `features/`**, `work create`, `work start` | "**BDD files are written in Step 8D in a worktree, not now**" |
16
+ | **7** | Propose chores | Read-only (analyze codebase) | `work create`, `work start`, file writes | "Propose chores to user first - don't create yet" |
17
+ | **8B** | Create chores | `work create chore` | `work start`, writes to `features/` | "Create all chores before transitioning" |
18
+ | **8C** | Execute transition | `work implement`, `workflow checkpoint` | `work start` | "Transition the feature before starting chores" |
19
+ | **8D** | Write tests in worktree | `work tests start`, `work tests merge`, Write to **worktree path only**, `cucumber-js --dry-run` | Write to main repo paths, `work start` | "Write tests in the worktree, not main repo" |
20
+ | **8E** | Start first chore | `work start`, `workflow complete` | - | "Start the chore, then invoke speed-mode" |
21
+
22
+ ## Key Enforcement Points
23
+
24
+ ### 0. Allowlist-First Enforcement
25
+
26
+ **Principle:** Each step defines what IS allowed, not what's blocked. Anything not explicitly allowed is rejected.
27
+
28
+ This is simpler to reason about, safer by default, and guides the agent toward correct behavior rather than away from incorrect behavior.
29
+
30
+ **Enforcement logic:**
31
+ 1. Check if command/action is in the step's allowlist → allow
32
+ 2. Check if it matches a global bypass pattern (see below) → block with specific message
33
+ 3. Otherwise → block with generic "not allowed at this step" + list what IS allowed
34
+
35
+ ### 1. Common Bypass Patterns (Global Blocks)
36
+
37
+ Agents sometimes try shortcuts that bypass CLI commands entirely. Catch the common ones:
38
+
39
+ - **Direct SQL:** `sqlite3` commands, raw SQL (`INSERT`, `UPDATE`, `DELETE`) in bash
40
+ - **Inline Node execution:** `node -e` with database operations
41
+
42
+ **Redirect Message:** "Use CLI commands to modify work items, not direct SQL. Run `jettypod help` to see available commands."
43
+
44
+ We don't need to catch every possible bypass - these cover ~95% of cases. The redirect message does the real work.
45
+
46
+ ### 2. Step 6B is the Critical Trap
47
+
48
+ The agent often tries to write `.feature` files in Step 6B after proposing scenarios. This must be blocked.
49
+
50
+ **Rule:** Block all writes to `features/**` until Step 8D, and only then to the worktree path.
51
+
52
+ ### 3. Worktree Path Validation
53
+
54
+ In Step 8D, writes are only allowed to the active worktree path (`.jettypod-work/tests-*`), not anywhere in the main repo.
55
+
56
+ **Rule:** If a write targets a path that doesn't start with the active worktree path, block it.
57
+
58
+ ### 4. Order Enforcement
59
+
60
+ The following commands have strict ordering:
61
+ 1. `work create chore` - Only in Step 8B (after user confirms chores)
62
+ 2. `work implement` - Only in Step 8C (after chores created)
63
+ 3. `work tests start` - Only in Step 8D (after implement)
64
+ 4. `work tests merge` - Only in Step 8D (after tests written)
65
+ 5. `work start` - Only in Step 8E (after tests merged)
66
+
67
+ **Rule:** Each command should validate the previous step completed.
68
+
69
+ ## Context Required for Enforcement
70
+
71
+ Hooks need access to:
72
+ - **Current skill:** `feature-planning`
73
+ - **Current step:** 1-8E (from workflow checkpoint)
74
+ - **Feature ID:** The work item being planned
75
+ - **Worktree path:** For Step 8D validation (from `worktrees` table)
76
+
77
+ ## Example Hook Logic
78
+
79
+ ```javascript
80
+ // Pseudocode for pre-command hook
81
+ function validateCommand(command, context) {
82
+ const { skill, step, featureId, worktreePath } = context;
83
+
84
+ if (skill !== 'feature-planning') return { allowed: true };
85
+
86
+ // Step 6B: Block writes to features/
87
+ if (step === '6B' && command.type === 'write' && command.path.includes('features/')) {
88
+ return {
89
+ allowed: false,
90
+ message: "BDD files are written in Step 8D in a worktree, not now. You're proposing scenarios - wait for user confirmation."
91
+ };
92
+ }
93
+
94
+ // Step 8D: Only allow writes to worktree
95
+ if (step === '8D' && command.type === 'write') {
96
+ if (!command.path.startsWith(worktreePath)) {
97
+ return {
98
+ allowed: false,
99
+ message: `Write tests in the worktree (${worktreePath}), not the main repo.`
100
+ };
101
+ }
102
+ }
103
+
104
+ // Block work start until Step 8E
105
+ if (command.name === 'work start' && step !== '8E') {
106
+ return {
107
+ allowed: false,
108
+ message: `Cannot start chores yet. Complete steps through 8D first (tests must be merged to main).`
109
+ };
110
+ }
111
+
112
+ return { allowed: true };
113
+ }
114
+ ```
115
+
116
+ ## Open Questions
117
+
118
+ 1. **Step granularity:** Should we track sub-steps like 8B, 8C, 8D, 8E separately, or group them as "Step 8"?
119
+ 2. **Read operations:** Should we restrict what files can be read at certain steps, or only writes?
120
+ 3. **Skill transitions:** How do we handle the handoff to speed-mode at Step 8E?
package/jettypod.js CHANGED
@@ -257,11 +257,6 @@ Skills auto-activate and MUST complete their full workflow:
257
257
  ❌ DO NOT manually create chores when a skill should generate them
258
258
  ✅ ALWAYS let skills complete autonomously before taking manual actions
259
259
 
260
- ## 🔄 Session Start: Check for Interrupted Workflows
261
- On session start, run: \`jettypod workflow resume\`
262
- If an interrupted workflow is found, ASK the user if they want to resume it.
263
- Do not assume - the user may want to start fresh or work on something else.
264
-
265
260
  ## Basic Commands (for non-workflow operations)
266
261
  jettypod work create epic "<title>"
267
262
  jettypod work create feature "<title>" --parent=<id>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jettypod",
3
- "version": "4.4.51",
3
+ "version": "4.4.53",
4
4
  "description": "AI-powered development workflow manager with TDD, BDD, and automatic test generation",
5
5
  "main": "jettypod.js",
6
6
  "bin": {
@@ -45,6 +45,22 @@ When this skill is activated, you are executing a standalone chore. The chore-pl
45
45
 
46
46
  ---
47
47
 
48
+ ## 🚨 SHELL CWD RECOVERY
49
+
50
+ **If ALL bash commands start failing with "Error: Exit code 1" and no output:**
51
+
52
+ Your shell's working directory was likely inside a worktree that was deleted. The CWD no longer exists.
53
+
54
+ **Recovery steps:**
55
+ 1. Get the main repo path from your session context (look for the project path in earlier messages)
56
+ 2. Run: `cd <main-repo-path>`
57
+ 3. Verify: `pwd && ls .jettypod`
58
+ 4. Resume your work
59
+
60
+ **Why this happens:** When a worktree is merged, it gets deleted. If your shell was inside that worktree directory, all subsequent commands fail because the CWD doesn't exist.
61
+
62
+ ---
63
+
48
64
  ## Implementation Steps
49
65
 
50
66
  ### Step 1: Receive and Display Context
@@ -72,6 +88,16 @@ Implementation Plan:
72
88
  • Affected tests: [list from context]
73
89
  ```
74
90
 
91
+ **🔄 WORKFLOW INTEGRATION: Start workflow tracking**
92
+
93
+ After receiving context, register this skill execution:
94
+
95
+ ```bash
96
+ jettypod workflow start chore-mode <chore-id>
97
+ ```
98
+
99
+ This validates that `chore_planning_complete` gate is passed (if applicable) and creates an execution record for session resume.
100
+
75
101
  **Move to Step 2 automatically.**
76
102
 
77
103
  ### Step 2: Create Worktree
@@ -167,6 +193,12 @@ Baseline Result:
167
193
 
168
194
  **CRITICAL:** If baseline tests fail, STOP. Fix existing failures before proceeding with chore work.
169
195
 
196
+ **🔄 WORKFLOW CHECKPOINT: Test baseline established**
197
+
198
+ ```bash
199
+ jettypod workflow checkpoint <chore-id> --step=3
200
+ ```
201
+
170
202
  **Move to Step 4 automatically.**
171
203
 
172
204
  ### Step 4: Display Type-Specific Guidance
@@ -260,6 +292,12 @@ const guidance = getGuidance('[chore-type]');
260
292
  - ✅ All tests pass → Move to Step 6
261
293
  - ❌ Max iterations reached → Display failure, ask user for guidance
262
294
 
295
+ **🔄 WORKFLOW CHECKPOINT: Execution complete** (when all tests pass)
296
+
297
+ ```bash
298
+ jettypod workflow checkpoint <chore-id> --step=5
299
+ ```
300
+
263
301
  **On max iterations:**
264
302
 
265
303
  ```
@@ -333,12 +371,20 @@ Go back to Step 5 to fix issues.
333
371
  git add .
334
372
  git commit -m "chore: [brief description]"
335
373
  git push
374
+ ```
375
+
376
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
377
+
378
+ The merge will delete the worktree. Chain commands to ensure shell is in main repo BEFORE deletion.
336
379
 
337
- # Switch to main repo before merging (merge cannot run from inside worktree)
338
- cd $(git rev-parse --show-toplevel)/..
380
+ ```bash
381
+ # CRITICAL: cd to main repo AND merge in SAME command
382
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [chore-id]
383
+ ```
339
384
 
340
- # Merge to main (auto-marks chore done)
341
- jettypod work merge [chore-id]
385
+ ```bash
386
+ # MANDATORY: Verify shell is in main repo
387
+ pwd && ls .jettypod
342
388
  ```
343
389
 
344
390
  **Display:**
@@ -361,6 +407,14 @@ Verification:
361
407
  Merged to main. Chore #[id] marked done.
362
408
  ```
363
409
 
410
+ **🔄 WORKFLOW INTEGRATION: Complete workflow**
411
+
412
+ ```bash
413
+ jettypod workflow complete chore-mode <chore-id>
414
+ ```
415
+
416
+ This marks the `chore_mode_complete` gate as passed. The standalone chore is now complete.
417
+
364
418
  **End skill.**
365
419
 
366
420
  ---
@@ -31,6 +31,16 @@ Display:
31
31
  Analyzing chore type...
32
32
  ```
33
33
 
34
+ **🔄 WORKFLOW INTEGRATION: Start workflow tracking**
35
+
36
+ After understanding the chore context, register this skill execution:
37
+
38
+ ```bash
39
+ jettypod workflow start chore-planning <chore-id>
40
+ ```
41
+
42
+ This creates an execution record for session resume.
43
+
34
44
  ### Step 2: Classify Chore Type
35
45
 
36
46
  Classify the chore by matching keywords in the title and description against these patterns:
@@ -267,6 +277,16 @@ The chore-mode skill will:
267
277
  3. Run verification steps
268
278
  4. Merge when complete
269
279
 
280
+ **🔄 WORKFLOW INTEGRATION: Complete workflow**
281
+
282
+ Before invoking chore-mode:
283
+
284
+ ```bash
285
+ jettypod workflow complete chore-planning <chore-id>
286
+ ```
287
+
288
+ This marks the `chore_planning_complete` gate as passed, enabling chore-mode to start.
289
+
270
290
  **End chore-planning skill after invoking chore-mode.**
271
291
 
272
292
  ## Key Principles
@@ -24,7 +24,19 @@ Run this command to get epic context:
24
24
  jettypod work status ${EPIC_ID}
25
25
  ```
26
26
 
27
- Capture the title, description, and any existing context. Proceed to Step 2.
27
+ Capture the title, description, and any existing context.
28
+
29
+ **🔄 WORKFLOW INTEGRATION: Start workflow tracking**
30
+
31
+ After getting the epic context, register this skill execution:
32
+
33
+ ```bash
34
+ jettypod workflow start epic-planning <epic-id>
35
+ ```
36
+
37
+ This creates an execution record for session resume.
38
+
39
+ Proceed to Step 2.
28
40
 
29
41
  ---
30
42
 
@@ -57,7 +69,19 @@ Then synthesize into an epic title + description and create:
57
69
  jettypod work create epic "${EPIC_TITLE}" "${EPIC_DESCRIPTION}"
58
70
  ```
59
71
 
60
- Capture the new epic ID from output. Proceed to Step 3 (skip Step 2 since nothing exists yet).
72
+ Capture the new epic ID from output.
73
+
74
+ **🔄 WORKFLOW INTEGRATION: Start workflow tracking**
75
+
76
+ After creating the epic, register this skill execution:
77
+
78
+ ```bash
79
+ jettypod workflow start epic-planning <epic-id>
80
+ ```
81
+
82
+ This creates an execution record for session resume.
83
+
84
+ Proceed to Step 3 (skip Step 2 since nothing exists yet).
61
85
 
62
86
  ### Step 2: Check Existing State
63
87
 
@@ -388,6 +412,14 @@ Chores:
388
412
  Or run: jettypod backlog to see all items.
389
413
  ```
390
414
 
415
+ **🔄 WORKFLOW INTEGRATION: Complete workflow**
416
+
417
+ ```bash
418
+ jettypod workflow complete epic-planning <epic-id>
419
+ ```
420
+
421
+ This marks the `epic_planning_complete` gate as passed. Features created under this epic can now begin their own planning.
422
+
391
423
  **Do NOT invoke any skill. End epic-planning skill.**
392
424
 
393
425
  ## Key Principles
@@ -83,6 +83,16 @@ Ready to proceed? (yes/no)
83
83
 
84
84
  Wait for the user to respond with "yes" or similar affirmative response.
85
85
 
86
+ **🔄 WORKFLOW INTEGRATION: Start workflow tracking**
87
+
88
+ After receiving initial confirmation, register this skill execution:
89
+
90
+ ```bash
91
+ jettypod workflow start external-transition
92
+ ```
93
+
94
+ This creates an execution record for session resume (note: external-transition is project-level, not tied to a specific work item).
95
+
86
96
  If they say "no" or express hesitation, ask what concerns they have or what they need to clarify.
87
97
 
88
98
  ### Step 3: Production Standards Selection
@@ -320,6 +330,12 @@ Then confirm to user:
320
330
  These standards will guide all production mode work going forward.
321
331
  ```
322
332
 
333
+ **🔄 WORKFLOW CHECKPOINT: Standards saved**
334
+
335
+ ```bash
336
+ jettypod workflow checkpoint --step=7
337
+ ```
338
+
323
339
  ### Step 8: Final Confirmation for Transition
324
340
 
325
341
  Now confirm the actual state transition:
@@ -362,6 +378,14 @@ Your project is now in external state.
362
378
  **Want to start on infrastructure work now?**
363
379
  ```
364
380
 
381
+ **🔄 WORKFLOW INTEGRATION: Complete workflow**
382
+
383
+ ```bash
384
+ jettypod workflow complete external-transition
385
+ ```
386
+
387
+ This marks the `external_transition_complete` gate as passed. The project is now in external state with production standards configured.
388
+
365
389
  ### Step 11: Guide Next Actions
366
390
 
367
391
  If the user wants to start infrastructure work:
@@ -53,6 +53,16 @@ This returns: title, description, parent epic (if any), mode, phase, and any exi
53
53
 
54
54
  **If the feature is not found**, ask the user to verify the ID or run `jettypod backlog` to find it.
55
55
 
56
+ **🔄 WORKFLOW INTEGRATION: Start workflow tracking**
57
+
58
+ After getting the feature context, register this skill execution:
59
+
60
+ ```bash
61
+ jettypod workflow start feature-planning <feature-id>
62
+ ```
63
+
64
+ This creates an execution record for session resume.
65
+
56
66
  **Proceed to Step 2** (or Step 3 if this is a standalone feature with no parent epic).
57
67
 
58
68
  ### Step 2: Check Epic Architectural Decisions
@@ -184,6 +194,12 @@ Which approach works best?
184
194
 
185
195
  User picks winner. Note their choice - you'll record it formally in Step 8 when transitioning to implementation.
186
196
 
197
+ **🔄 WORKFLOW CHECKPOINT: Winner chosen**
198
+
199
+ ```bash
200
+ jettypod workflow checkpoint <feature-id> --step=5
201
+ ```
202
+
187
203
  **Proceed to Step 6.**
188
204
 
189
205
  ### Step 6: Define Integration Contract AND Generate BDD Scenarios
@@ -317,6 +333,12 @@ Does this capture the feature correctly? Any scenarios to add/change?
317
333
  - If user requests changes → Revise scenarios and display again
318
334
  - **Store the confirmed scenarios in memory** - you'll write them in Step 8D
319
335
 
336
+ **🔄 WORKFLOW CHECKPOINT: BDD scenarios confirmed**
337
+
338
+ ```bash
339
+ jettypod workflow checkpoint <feature-id> --step=6
340
+ ```
341
+
320
342
  **Proceed to Step 7.**
321
343
 
322
344
  **Template for speed mode (make it work):**
@@ -590,6 +612,12 @@ After successful transition, display:
590
612
  Now I'll write the BDD tests in an isolated worktree...
591
613
  ```
592
614
 
615
+ **🔄 WORKFLOW CHECKPOINT: Implementation transition complete**
616
+
617
+ ```bash
618
+ jettypod workflow checkpoint <feature-id> --step=8
619
+ ```
620
+
593
621
  **Proceed to Step 8D.**
594
622
 
595
623
  #### Step 8D: Write Tests in Isolated Worktree
@@ -743,6 +771,14 @@ This will:
743
771
  Start this one? [yes / pick different / done for now]
744
772
  ```
745
773
 
774
+ **🔄 WORKFLOW INTEGRATION: Complete workflow**
775
+
776
+ ```bash
777
+ jettypod workflow complete feature-planning <feature-id>
778
+ ```
779
+
780
+ This marks the `feature_planning_complete` gate as passed, enabling speed-mode to start.
781
+
746
782
  **Proceed to Step 8E.**
747
783
 
748
784
  #### Step 8E: Start First Chore
@@ -54,6 +54,16 @@ sqlite3 .jettypod/work.db "SELECT completed_at FROM work_items WHERE parent_id =
54
54
 
55
55
  Based on these checks, determine which scenario applies.
56
56
 
57
+ **🔄 WORKFLOW INTEGRATION: Start workflow tracking**
58
+
59
+ After detecting context, register this skill execution:
60
+
61
+ ```bash
62
+ jettypod workflow start production-mode <feature-id>
63
+ ```
64
+
65
+ This validates that `stable_mode_complete` gate is passed and creates an execution record for session resume.
66
+
57
67
  **Three Scenarios:**
58
68
 
59
69
  **Scenario A: Fresh from Stable (Hot Context)**
@@ -89,6 +99,12 @@ cat .jettypod/production-standards.json
89
99
 
90
100
  If the file doesn't exist, run external-transition first to generate production standards.
91
101
 
102
+ **🔄 WORKFLOW CHECKPOINT: Standards read**
103
+
104
+ ```bash
105
+ jettypod workflow checkpoint <feature-id> --step=1
106
+ ```
107
+
92
108
  ---
93
109
 
94
110
  ### Step 2A: Validate Scenarios (Scenario A - Hot Context)
@@ -221,6 +237,12 @@ This will:
221
237
  3. Append scenarios to the feature file
222
238
  4. Create production chores
223
239
 
240
+ **🔄 WORKFLOW CHECKPOINT: Scenarios validated/generated** (after any Step 2 variant)
241
+
242
+ ```bash
243
+ jettypod workflow checkpoint <feature-id> --step=2
244
+ ```
245
+
224
246
  ---
225
247
 
226
248
  ### Step 3: Implement Production Chore
@@ -243,6 +265,12 @@ Parse the chore description to find which scenario it addresses (look for "Scena
243
265
  npx cucumber-js <scenario-file> --name "<scenario-name>" --format progress
244
266
  ```
245
267
 
268
+ **🔄 WORKFLOW CHECKPOINT: RED baseline established**
269
+
270
+ ```bash
271
+ jettypod workflow checkpoint <feature-id> --step=3
272
+ ```
273
+
246
274
  2. **Iterate until scenario passes (max 10 iterations):**
247
275
  - Implement production hardening using Edit/Write tools
248
276
  - Run the target scenario to check progress
@@ -307,3 +335,13 @@ Once all production chores complete:
307
335
  1. Feature is production-ready
308
336
  2. Can be deployed to external environment
309
337
  3. Meets all standards for scale, security, compliance
338
+
339
+ **🔄 WORKFLOW INTEGRATION: Complete workflow**
340
+
341
+ When all production chores are complete:
342
+
343
+ ```bash
344
+ jettypod workflow complete production-mode <feature-id>
345
+ ```
346
+
347
+ This marks the `production_mode_complete` gate as passed. The feature is now production-ready.
@@ -48,6 +48,27 @@ When this skill is activated, you are helping implement a speed mode chore to ma
48
48
 
49
49
  ---
50
50
 
51
+ ## 🚨 SHELL CWD RECOVERY
52
+
53
+ **If ALL bash commands start failing with "Error: Exit code 1" and no output:**
54
+
55
+ Your shell's working directory was likely inside a worktree that was deleted. The CWD no longer exists.
56
+
57
+ **Recovery steps:**
58
+ 1. Get the main repo path from your session context (look for the project path in earlier messages)
59
+ 2. Run: `cd <main-repo-path>`
60
+ 3. Verify: `pwd && ls .jettypod`
61
+ 4. Resume your work
62
+
63
+ **Example:**
64
+ ```bash
65
+ cd /Users/erikspangenberg/personal-assistant && pwd
66
+ ```
67
+
68
+ **Why this happens:** When a worktree is merged, it gets deleted. If your shell was inside that worktree directory, all subsequent commands fail because the CWD doesn't exist.
69
+
70
+ ---
71
+
51
72
  ## 🛑 PRE-FLIGHT VALIDATION (REQUIRED)
52
73
 
53
74
  **Before proceeding with ANY implementation, you MUST validate the worktree exists.**
@@ -217,6 +238,16 @@ test('createUser throws error for invalid email', () => {
217
238
  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'"
218
239
  ```
219
240
 
241
+ **🔄 WORKFLOW INTEGRATION: Start workflow tracking**
242
+
243
+ After getting the work context, register this skill execution:
244
+
245
+ ```bash
246
+ jettypod workflow start speed-mode <feature-id>
247
+ ```
248
+
249
+ This validates that `feature_planning_complete` gate is passed and creates an execution record for session resume.
250
+
220
251
  **Display to user:**
221
252
 
222
253
  ```
@@ -377,6 +408,12 @@ Integration Points:
377
408
  Now proposing implementation approach...
378
409
  ```
379
410
 
411
+ **🔄 WORKFLOW CHECKPOINT: Codebase analysis complete**
412
+
413
+ ```bash
414
+ jettypod workflow checkpoint <feature-id> --step=2
415
+ ```
416
+
380
417
  ### Step 3: Decide if Confirmation Needed
381
418
 
382
419
  **Evaluate if you need user confirmation before implementing:**
@@ -467,6 +504,12 @@ First error:
467
504
  Now implementing...
468
505
  ```
469
506
 
507
+ **🔄 WORKFLOW CHECKPOINT: RED baseline established**
508
+
509
+ ```bash
510
+ jettypod workflow checkpoint <feature-id> --step=4
511
+ ```
512
+
470
513
  ---
471
514
 
472
515
  ### Step 5: RED→GREEN→REFACTOR Loop
@@ -502,6 +545,12 @@ Now implementing...
502
545
  🎉 GREEN: All success scenarios passing!
503
546
  ```
504
547
 
548
+ **🔄 WORKFLOW CHECKPOINT: GREEN achieved**
549
+
550
+ ```bash
551
+ jettypod workflow checkpoint <feature-id> --step=5
552
+ ```
553
+
505
554
  **Then REFACTOR (quick pass, 5 min max):**
506
555
  - Extract duplicated code
507
556
  - Rename unclear variables
@@ -564,16 +613,23 @@ More speed mode chores remain. Starting next chore:
564
613
 
565
614
  **Merge and start next:**
566
615
 
616
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
617
+
618
+ The merge will delete the worktree. Chain commands to ensure shell is in main repo BEFORE deletion.
619
+
567
620
  ```bash
568
621
  # Commit changes in the worktree
569
622
  git add . && git commit -m "feat: [brief description of what was implemented]"
623
+ ```
570
624
 
571
- # Return to main repo and merge (cannot merge from inside worktree)
572
- cd $(git rev-parse --show-toplevel)/.. # Exit worktree to main repo
573
- jettypod work merge [current-chore-id]
625
+ ```bash
626
+ # CRITICAL: cd to main repo AND merge in SAME command
627
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [current-chore-id]
628
+ ```
574
629
 
575
- # Start next speed chore
576
- jettypod work start [next-chore-id]
630
+ ```bash
631
+ # Verify shell is valid, then start next chore
632
+ pwd && jettypod work start [next-chore-id]
577
633
  ```
578
634
 
579
635
  The speed-mode skill will automatically re-invoke for the next chore.
@@ -612,15 +668,28 @@ npx cucumber-js <scenario-file-path> --name "User can reach" --format progress
612
668
 
613
669
  #### Step 7B: Merge Final Speed Chore
614
670
 
671
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
672
+
673
+ The merge will delete the worktree. Chain commands to ensure shell is in main repo BEFORE deletion.
674
+
615
675
  ```bash
616
676
  # Commit changes in the worktree
617
677
  git add . && git commit -m "feat: [brief description of what was implemented]"
678
+ ```
618
679
 
619
- # Return to main repo and merge (cannot merge from inside worktree)
620
- cd $(git rev-parse --show-toplevel)/.. # Exit worktree to main repo
621
- jettypod work merge [current-chore-id] --with-transition
680
+ ```bash
681
+ # CRITICAL: cd to main repo AND merge in SAME command
682
+ # Using $(git rev-parse --show-toplevel)/.. exits worktree to main repo
683
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [current-chore-id] --with-transition
622
684
  ```
623
685
 
686
+ ```bash
687
+ # MANDATORY: Verify shell is in main repo (run immediately after merge)
688
+ pwd && ls .jettypod
689
+ ```
690
+
691
+ **If you see "No such file or directory" errors:** Your shell CWD was corrupted. Get the main repo path from your session context and run `cd <main-repo-path>`.
692
+
624
693
  After merge, you are on main branch. Ready to generate stable mode scenarios.
625
694
 
626
695
  #### Step 7C: Generate and Propose Stable Mode Chores
@@ -680,19 +749,35 @@ Scenario: [Edge case title]
680
749
 
681
750
  **6. Commit and merge the test worktree:**
682
751
 
752
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
753
+
754
+ The merge will delete the test worktree. If your shell is inside that worktree, ALL subsequent commands will fail. You MUST:
755
+ 1. Chain the cd and merge in a SINGLE bash command
756
+ 2. Verify your shell is in main repo AFTER merge
757
+
683
758
  ```bash
684
- # Commit in the test worktree
685
- cd <worktree-path>
686
- git add features/
687
- git commit -m "test: Add stable mode BDD scenarios and step definitions
759
+ # First: Commit in the test worktree (separate command is OK here)
760
+ cd <worktree-path> && git add features/ && git commit -m "test: Add stable mode BDD scenarios and step definitions
688
761
 
689
762
  Added error handling and edge case scenarios for stable mode.
690
763
  - [N] new stable mode scenarios
691
764
  - Step definitions for validation and error handling"
765
+ ```
766
+
767
+ ```bash
768
+ # CRITICAL: cd to main repo AND merge in SAME command
769
+ # This ensures shell is in main repo BEFORE worktree deletion
770
+ cd <main-repo-path> && jettypod work tests merge <feature-id>
771
+ ```
772
+
773
+ ```bash
774
+ # MANDATORY: Verify shell is in main repo (run this immediately after merge)
775
+ pwd && ls .jettypod
776
+ ```
692
777
 
693
- # Return to main repo and merge
778
+ **If you see "No such file or directory" errors:** Your shell CWD was corrupted. Run:
779
+ ```bash
694
780
  cd <main-repo-path>
695
- jettypod work tests merge <feature-id>
696
781
  ```
697
782
 
698
783
  **7. Present proposal to user:**
@@ -745,6 +830,14 @@ Repeat for each confirmed chore. **Do NOT use `--mode` flag** - chores inherit m
745
830
  jettypod work merge --release-lock
746
831
  ```
747
832
 
833
+ **🔄 WORKFLOW COMPLETE: Speed mode finished**
834
+
835
+ Mark speed mode as complete (this passes the `speed_mode_complete` gate, enabling stable-mode):
836
+
837
+ ```bash
838
+ jettypod workflow complete speed-mode <feature-id>
839
+ ```
840
+
748
841
  #### Step 7E: Start First Stable Chore and Invoke Stable Mode Skill
749
842
 
750
843
  **🛑 CRITICAL HANDOFF - You MUST start the first chore BEFORE invoking stable-mode.**
@@ -52,6 +52,22 @@ When this skill is activated, you are helping implement a stable mode chore to a
52
52
 
53
53
  ---
54
54
 
55
+ ## 🚨 SHELL CWD RECOVERY
56
+
57
+ **If ALL bash commands start failing with "Error: Exit code 1" and no output:**
58
+
59
+ Your shell's working directory was likely inside a worktree that was deleted. The CWD no longer exists.
60
+
61
+ **Recovery steps:**
62
+ 1. Get the main repo path from your session context (look for the project path in earlier messages)
63
+ 2. Run: `cd <main-repo-path>`
64
+ 3. Verify: `pwd && ls .jettypod`
65
+ 4. Resume your work
66
+
67
+ **Why this happens:** When a worktree is merged, it gets deleted. If your shell was inside that worktree directory, all subsequent commands fail because the CWD doesn't exist.
68
+
69
+ ---
70
+
55
71
  ## 🛑 PRE-FLIGHT VALIDATION (REQUIRED)
56
72
 
57
73
  **Before proceeding with ANY implementation, you MUST validate the worktree exists.**
@@ -222,6 +238,16 @@ test('getUserById returns null for non-existent user', () => {
222
238
  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'"
223
239
  ```
224
240
 
241
+ **🔄 WORKFLOW INTEGRATION: Start workflow tracking**
242
+
243
+ After getting the work context, register this skill execution:
244
+
245
+ ```bash
246
+ jettypod workflow start stable-mode <feature-id>
247
+ ```
248
+
249
+ This validates that `speed_mode_complete` gate is passed and creates an execution record for session resume.
250
+
225
251
  **Display to user:**
226
252
 
227
253
  ```
@@ -346,6 +372,12 @@ To pass the target scenario, I need to:
346
372
  Now proposing comprehensive implementation...
347
373
  ```
348
374
 
375
+ **🔄 WORKFLOW CHECKPOINT: Code analysis complete**
376
+
377
+ ```bash
378
+ jettypod workflow checkpoint <feature-id> --step=2
379
+ ```
380
+
349
381
  ### Step 3: Decide if Confirmation Needed
350
382
 
351
383
  **Evaluate if you need user confirmation before implementing:**
@@ -431,6 +463,12 @@ First error:
431
463
  Now implementing...
432
464
  ```
433
465
 
466
+ **🔄 WORKFLOW CHECKPOINT: RED baseline established**
467
+
468
+ ```bash
469
+ jettypod workflow checkpoint <feature-id> --step=4
470
+ ```
471
+
434
472
  ---
435
473
 
436
474
  ### Step 5: RED→GREEN→REFACTOR Loop
@@ -466,6 +504,12 @@ Now implementing...
466
504
  🎉 GREEN: All stable mode scenarios passing!
467
505
  ```
468
506
 
507
+ **🔄 WORKFLOW CHECKPOINT: GREEN achieved**
508
+
509
+ ```bash
510
+ jettypod workflow checkpoint <feature-id> --step=5
511
+ ```
512
+
469
513
  **Then REFACTOR (quick pass, 5 min max):**
470
514
  - Extract duplicated validation logic
471
515
  - Rename unclear error variables
@@ -528,16 +572,23 @@ More stable mode chores remain. Starting next chore:
528
572
 
529
573
  **Merge and start next:**
530
574
 
575
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
576
+
577
+ The merge will delete the worktree. Chain commands to ensure shell is in main repo BEFORE deletion.
578
+
531
579
  ```bash
532
580
  # Commit changes in the worktree
533
581
  git add . && git commit -m "feat: [brief description of error handling added]"
582
+ ```
534
583
 
535
- # Return to main repo and merge (cannot merge from inside worktree)
536
- cd $(git rev-parse --show-toplevel)/.. # Exit worktree to main repo
537
- jettypod work merge [current-chore-id]
584
+ ```bash
585
+ # CRITICAL: cd to main repo AND merge in SAME command
586
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [current-chore-id]
587
+ ```
538
588
 
539
- # Start next stable chore
540
- jettypod work start [next-chore-id]
589
+ ```bash
590
+ # Verify shell is valid, then start next chore
591
+ pwd && jettypod work start [next-chore-id]
541
592
  ```
542
593
 
543
594
  The stable-mode skill will automatically re-invoke for the next chore.
@@ -556,10 +607,20 @@ If the query returns no remaining chores, proceed to Step 7.
556
607
 
557
608
  **First, merge the final stable chore:**
558
609
 
610
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
611
+
559
612
  ```bash
560
613
  git add . && git commit -m "feat: [brief description of error handling added]"
561
- cd $(git rev-parse --show-toplevel)/.. # Exit worktree to main repo
562
- jettypod work merge [current-chore-id]
614
+ ```
615
+
616
+ ```bash
617
+ # CRITICAL: cd to main repo AND merge in SAME command
618
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [current-chore-id]
619
+ ```
620
+
621
+ ```bash
622
+ # MANDATORY: Verify shell is in main repo
623
+ pwd && ls .jettypod
563
624
  ```
564
625
 
565
626
  **Then check project state:**
@@ -603,6 +664,14 @@ Note: If you later transition to external (accepting real users),
603
664
  run the external-transition skill to generate production chores.
604
665
  ```
605
666
 
667
+ **🔄 WORKFLOW INTEGRATION: Complete workflow (internal project)**
668
+
669
+ ```bash
670
+ jettypod workflow complete stable-mode <feature-id>
671
+ ```
672
+
673
+ This marks the `stable_mode_complete` gate as passed. For internal projects, this is the final workflow step.
674
+
606
675
  **End skill.** Feature is DONE.
607
676
 
608
677
  ---
@@ -637,6 +706,14 @@ What we accomplished:
637
706
  🚀 Now invoking production-mode skill...
638
707
  ```
639
708
 
709
+ **🔄 WORKFLOW INTEGRATION: Complete workflow (external project)**
710
+
711
+ ```bash
712
+ jettypod workflow complete stable-mode <feature-id>
713
+ ```
714
+
715
+ This marks the `stable_mode_complete` gate as passed, enabling production-mode to start.
716
+
640
717
  **Invoke production-mode:**
641
718
 
642
719
  ```