22name : debugging
33description : Structured debugging session with team knowledge capture
44category : Development Tools
5- version : 0.4.3
5+ version : 0.4.4
66---
77
88# Debugging Command
@@ -17,18 +17,45 @@ Transform chaotic debugging into efficient investigation with:
1717- Hypothesis-driven testing
1818- Team knowledge documentation
1919
20- ** NEW in v0.4.3** : Support for worktree isolation with ` --worktree ` flag for debugging sessions requiring code modifications.
20+ ** NEW in v0.4.4** : Automatic context detection - run from Main OR from worktree directly!
21+ ** v0.4.3** : Support for worktree isolation with ` --worktree ` flag for debugging sessions requiring code modifications.
22+
23+ ## Context Detection (Auto)
24+
25+ The ` /debugging ` command ** automatically detects** where you run it from:
26+
27+ ### From Main Repository
28+ ``` bash
29+ # Working directory: ~/Documents/watchora
30+ $ /debugging " Check API timeout"
31+ → Behavior: Read-only investigation on Main (default)
32+ → Optional: Add --worktree for code modifications
33+ ```
34+
35+ ### From Debug Worktree
36+ ``` bash
37+ # Working directory: ~/Documents/watchora/worktrees/debug
38+ $ /debugging " Check API timeout"
39+ → Behavior: Automatically uses worktree (no --worktree needed! )
40+ → Syncs, locks, creates branch, works in current directory
41+ ```
42+
43+ ** Key Point** : If you have a dedicated Cursor window open on ` worktrees/debug/ ` , you can use ` /debugging ` directly from there!
2144
2245## Usage
2346
2447``` bash
25- # Default : Investigate on Main (read-only, quick)
48+ # From Main : Investigate on Main (read-only, quick)
2649/debugging " Check why API returns 500"
2750
28- # With worktree isolation (modifications needed)
51+ # From Main: With worktree isolation (modifications needed)
2952/debugging " Memory leak in WebSocket handler" --worktree
3053
31- # Manage active session
54+ # From Worktree: Auto-detects worktree context
55+ cd worktrees/debug/
56+ /debugging " Memory leak issue" # Automatically uses worktree!
57+
58+ # Manage active session (works from anywhere)
3259/debugging --resolve # Complete and document
3360/debugging --abort # Cancel session
3461/debugging --status # Show current status
@@ -135,7 +162,7 @@ Solution: Updated production config (no code changes)
135162Session closed.
136163` ` `
137164
138- # # Workflow: With Worktree
165+ # # Workflow: With Worktree (from Main)
139166
140167# ## Step 1: Start Session in Worktree
141168
@@ -209,6 +236,82 @@ Choose: 1
209236↩️ Returned to Main
210237` ` `
211238
239+ # # Workflow: From Worktree Directly (NEW in v0.4.4)
240+
241+ # ## Setup: Open Cursor Window on Worktree
242+
243+ ` ` ` bash
244+ # One-time setup: Open dedicated Cursor window
245+ cd ~ /Documents/watchora/worktrees/debug/
246+ code . # Opens Cursor in worktree directory
247+ ` ` `
248+
249+ # ## Step 1: Start Session (from Worktree)
250+
251+ ` ` ` bash
252+ # You're already in worktrees/debug/
253+ $ pwd
254+ ~ /Documents/watchora/worktrees/debug
255+
256+ # Run /debugging directly - no --worktree flag needed!
257+ $ /debugging " Memory leak in WebSocket handler"
258+
259+ 🔍 Detected: Running from worktree debug/
260+ 🎯 Auto-enabling worktree mode
261+
262+ # AUTO-SYNC (Intelligent)
263+ 🔄 Checking sync status...
264+ ✅ Synced with main (or auto-sync if needed)
265+
266+ # START SESSION
267+ ✅ Started in current directory
268+ 📝 Branch: debug/memory-leak-websocket
269+ 📄 Session: .prds/debug-sessions/2025-01-14-memory-leak-websocket.md
270+ 🔒 Locked worktree (one session at a time)
271+
272+ 💡 Working in worktree - full debugging power!
273+ ` ` `
274+
275+ # ## Step 2: Investigation (Same Directory)
276+
277+ You work in the ** same directory** where you launched ` /debugging` :
278+ - Already in ` worktrees/debug/`
279+ - Add debug logging
280+ - Reproduce bugs
281+ - Test hypotheses
282+ - All your tools work normally
283+
284+ # ## Step 3: Resolve (from Worktree)
285+
286+ ` ` ` bash
287+ # Still in worktrees/debug/
288+ $ /debugging --resolve
289+
290+ 💬 Resolution status?
291+ 1. Resolved with fix → Create PR
292+ 2. Resolved without fix → Document only
293+ 3. Workaround → Document + TODO
294+ 4. Not resolved → Save state
295+
296+ Choose: 1
297+
298+ # Fix found - create PR
299+ ✅ Committed fix
300+ 📤 PR # 237: fix: Memory leak in WebSocket close handler
301+ 📝 Updated session doc
302+
303+ # AUTO-CLEANUP
304+ 🔄 Returning to parking branch...
305+ 🧹 Deleted branch debug/memory-leak-websocket
306+ 🔄 Syncing with main...
307+ ✅ Worktree ready for next session
308+ 🔓 Unlocked worktree
309+
310+ 📍 Still in: worktrees/debug/ (ready for next session)
311+ ` ` `
312+
313+ ** Advantage** : You stay in the same Cursor window the entire time!
314+
212315# # Collision Handling
213316
214317** One session at a time** in debug worktree:
@@ -495,7 +598,7 @@ $ /debugging --resolve
495598# Documented, session closed
496599` ` `
497600
498- # ## Example 2: Investigation Needs Code Changes
601+ # ## Example 2: Investigation Needs Code Changes (from Main)
499602
500603` ` ` bash
501604$ /debugging " Performance degradation" --worktree
@@ -508,7 +611,21 @@ $ /debugging --resolve
508611# PR created, session documented
509612` ` `
510613
511- # ## Example 3: Migration to Worktree
614+ # ## Example 3: Investigation from Worktree - NEW!
615+
616+ ` ` ` bash
617+ # Cursor window open on worktrees/debug/
618+ $ pwd
619+ ~ /Documents/watchora/worktrees/debug
620+
621+ $ /debugging " Performance degradation"
622+
623+ # Auto-detects worktree context
624+ # No --worktree flag needed
625+ # Works in current directory
626+ ` ` `
627+
628+ # ## Example 4: Migration to Worktree
512629
513630` ` ` bash
514631$ /debugging " Bug in production"
@@ -522,7 +639,7 @@ $ /debugging --to-worktree
522639# Testing fix in isolation
523640` ` `
524641
525- # ## Example 4 : Long Investigation with Pause
642+ # ## Example 5 : Long Investigation with Pause
526643
527644` ` ` bash
528645$ /debugging " Complex race condition" --worktree
@@ -574,6 +691,8 @@ Works seamlessly with:
574691
575692---
576693
577- **Version**: 0.4.3
578- **Plugin**: claude-prd-workflow v0.4.3
579- **Changes**: Added worktree support, intelligent sync, session management, collision handling
694+ **Version**: 0.4.4
695+ **Plugin**: claude-prd-workflow v0.4.4
696+ **Changes**:
697+ - v0.4.4: Added automatic context detection - run from Main OR worktree directly
698+ - v0.4.3: Added worktree support, intelligent sync, session management, collision handling
0 commit comments