@pi-unipi/workflow 0.1.7 → 0.1.9

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.
@@ -0,0 +1,224 @@
1
+ ---
2
+ name: debug
3
+ description: "Active bug investigation — reproduce, diagnose, root-cause analysis. Produces debug report for /unipi:fix."
4
+ ---
5
+
6
+ # Debugging
7
+
8
+ Active investigation to reproduce, diagnose, and root-cause bugs. Produces a structured debug report that `/unipi:fix` can consume.
9
+
10
+ ## Boundaries
11
+
12
+ **This skill MAY:** read codebase, run diagnostic commands, spawn subagents, write debug report to `.unipi/docs/debug/`.
13
+ **This skill MAY NOT:** edit code, fix issues, run tests that modify state, deploy.
14
+
15
+ **This is diagnosis only — not fixing.**
16
+
17
+ ## Command Format
18
+
19
+ ```
20
+ /unipi:debug <string(greedy)>
21
+ ```
22
+
23
+ - `string(greedy)` — bug description, error message, or reproduction steps
24
+ - Read-only sandbox + write to `.unipi/docs/debug/`
25
+ - Spawns subagents if `@unipi/subagents` extension is installed
26
+
27
+ ## Output Path
28
+
29
+ ```
30
+ .unipi/docs/debug/YYYY-MM-DD-<topic>-debug.md
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Process
36
+
37
+ ### Phase 1: Understand the Bug
38
+
39
+ 1. Read the bug description carefully
40
+ 2. If unclear, ask clarifying questions (one at a time):
41
+ - "What's the expected behavior?"
42
+ - "What's the actual behavior?"
43
+ - "Steps to reproduce?"
44
+ - "When did this start happening?"
45
+ 3. Identify the scope:
46
+ - Single function/module
47
+ - Integration issue
48
+ - System-wide problem
49
+
50
+ **Exit:** Bug understood, scope defined.
51
+
52
+ ### Phase 2: Reproduce
53
+
54
+ Attempt to reproduce the issue:
55
+
56
+ 1. **Find reproduction path:**
57
+ - Trace the code flow from entry point
58
+ - Identify the failing code path
59
+ - Look for error messages, stack traces
60
+
61
+ 2. **Run diagnostic commands:**
62
+ - `grep` for error messages in code
63
+ - `find` related files
64
+ - Check logs if available
65
+ - Run read-only test commands if safe
66
+
67
+ 3. **If subagents available:**
68
+ - Spawn explore agents to trace different code paths in parallel
69
+ - Each agent reports findings
70
+
71
+ **Exit:** Reproduction steps documented (or confirmed unreproducible).
72
+
73
+ ### Phase 3: Diagnose
74
+
75
+ Deep dive into root cause:
76
+
77
+ 1. **Trace the failure:**
78
+ - Start from the error/symptom
79
+ - Work backwards to find origin
80
+ - Document each step in the chain
81
+
82
+ 2. **Check common causes:**
83
+ - Null/undefined values
84
+ - Type mismatches
85
+ - Race conditions
86
+ - Missing error handling
87
+ - Incorrect assumptions
88
+ - Off-by-one errors
89
+ - State corruption
90
+
91
+ 3. **Analyze data flow:**
92
+ - Input validation
93
+ - Transformation steps
94
+ - Output format
95
+ - Edge cases
96
+
97
+ 4. **Check dependencies:**
98
+ - Recent changes to related code
99
+ - External service issues
100
+ - Configuration changes
101
+ - Version mismatches
102
+
103
+ **Exit:** Root cause identified (or hypotheses listed if uncertain).
104
+
105
+ ### Phase 4: Document Findings
106
+
107
+ Write debug report to `.unipi/docs/debug/YYYY-MM-DD-<topic>-debug.md`:
108
+
109
+ ```markdown
110
+ ---
111
+ title: "{Bug Title} — Debug Report"
112
+ type: debug
113
+ date: YYYY-MM-DD
114
+ severity: {critical|high|medium|low}
115
+ status: {root-caused|needs-investigation|unreproducible}
116
+ ---
117
+
118
+ # {Bug Title} — Debug Report
119
+
120
+ ## Summary
121
+ {One-line description of the bug}
122
+
123
+ ## Expected Behavior
124
+ {What should happen}
125
+
126
+ ## Actual Behavior
127
+ {What actually happens}
128
+
129
+ ## Reproduction Steps
130
+ 1. {Step 1}
131
+ 2. {Step 2}
132
+ 3. {Step 3}
133
+
134
+ ## Environment
135
+ - {Relevant context: OS, version, config}
136
+
137
+ ## Root Cause Analysis
138
+
139
+ ### Failure Chain
140
+ 1. {Entry point / trigger}
141
+ 2. {Intermediate step}
142
+ 3. {Failure point}
143
+
144
+ ### Root Cause
145
+ {Detailed explanation of why the bug occurs}
146
+
147
+ ### Evidence
148
+ - File: `{file}:{line}` — {what's wrong}
149
+ - File: `{file}:{line}` — {related code}
150
+
151
+ ## Affected Files
152
+ - `{file}` — {role in the bug}
153
+ - `{file}` — {role in the bug}
154
+
155
+ ## Suggested Fix
156
+ {High-level approach to fixing — NOT implementation}
157
+
158
+ ### Fix Strategy
159
+ 1. {Step 1}
160
+ 2. {Step 2}
161
+
162
+ ### Risk Assessment
163
+ - {Risk 1}: {mitigation}
164
+ - {Risk 2}: {mitigation}
165
+
166
+ ## Verification Plan
167
+ How to verify the fix works:
168
+ 1. {Test case 1}
169
+ 2. {Test case 2}
170
+
171
+ ## Related Issues
172
+ - {Link to related bugs, PRs, or discussions}
173
+
174
+ ## Notes
175
+ {Any additional context, gotchas, or observations}
176
+ ```
177
+
178
+ ### Phase 5: Present & Handoff
179
+
180
+ Present summary to user:
181
+
182
+ > "Debug report written to `.unipi/docs/debug/YYYY-MM-DD-<topic>-debug.md`"
183
+ >
184
+ > **Root Cause:** {brief summary}
185
+ > **Suggested Fix:** {brief summary}
186
+
187
+ Then suggest:
188
+
189
+ **If root cause found:**
190
+ ```
191
+ /unipi:fix debug:YYYY-MM-DD-<topic>-debug
192
+ ```
193
+
194
+ **If needs more investigation:**
195
+ > "Root cause unclear. Need to investigate {area} further."
196
+ ```
197
+ /unipi:gather-context {area}
198
+ ```
199
+
200
+ **If unreproducible:**
201
+ > "Cannot reproduce with current steps. Can you provide more details?"
202
+ - Wait for user input
203
+
204
+ ---
205
+
206
+ ## Differences from scan-issues
207
+
208
+ | Aspect | `/unipi:debug` | `/unipi:scan-issues` |
209
+ |--------|----------------|----------------------|
210
+ | Purpose | Investigate specific bug | Find potential issues |
211
+ | Input | Bug report / error message | Scope / category |
212
+ | Output | Debug report with root cause | Issue list with priorities |
213
+ | Depth | Deep single-issue analysis | Broad codebase scan |
214
+ | Handoff | `/unipi:fix` | `/unipi:quick-work` or `/unipi:brainstorm` |
215
+
216
+ ---
217
+
218
+ ## Notes
219
+
220
+ - Diagnosis only — fixes happen via `/unipi:fix`
221
+ - Debug reports are reusable — `/unipi:fix` can autocomplete them
222
+ - Subagent support enables parallel code path tracing
223
+ - Always document the failure chain — helps verify fixes
224
+ - If bug is complex, suggest `/unipi:consultant` for expert analysis
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: fix
3
+ description: "Fix bugs using debug reports. Autocomplete for debug files. Records fixes in docs/fix/."
4
+ ---
5
+
6
+ # Fixing Bugs
7
+
8
+ Implement fixes based on debug reports. Autocomplete available for debug file selection.
9
+
10
+ ## Boundaries
11
+
12
+ **This skill MAY:** read/write code, run tests, commit, write fix report to `.unipi/docs/fix/`.
13
+ **This skill MAY NOT:** create worktrees, merge branches, deploy.
14
+
15
+ ## Command Format
16
+
17
+ ```
18
+ /unipi:fix debug:<path>(optional) <string(greedy)>(optional)
19
+ ```
20
+
21
+ - `debug:<path>` — debug report to fix from (autocomplete available)
22
+ - `string(greedy)` — optional scope or additional context
23
+ - If no debug provided → agent lists available debug reports and asks
24
+ - Full read/write sandbox
25
+
26
+ ## Output Path
27
+
28
+ ```
29
+ .unipi/docs/fix/YYYY-MM-DD-<topic>-fix.md
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Process
35
+
36
+ ### Phase 1: Load Debug Report
37
+
38
+ **If `debug:` arg provided:**
39
+ 1. Read the debug report from `.unipi/docs/debug/`
40
+ 2. Understand: root cause, affected files, suggested fix, verification plan
41
+
42
+ **If no debug provided:**
43
+ 1. List available debug reports in `.unipi/docs/debug/`
44
+ 2. Present to user for selection (autocomplete-style)
45
+ 3. Or ask if fixing without debug report (→ suggest `/unipi:quick-fix`)
46
+
47
+ **Exit:** Debug report loaded, fix strategy clear.
48
+
49
+ ### Phase 2: Plan the Fix
50
+
51
+ Based on debug report:
52
+
53
+ 1. Review suggested fix strategy
54
+ 2. Identify all files that need changes
55
+ 3. Plan the order of changes
56
+ 4. Consider side effects
57
+
58
+ If debug report is unclear or incomplete:
59
+ > "Debug report suggests {approach}, but I need to verify {aspect}. Should I investigate further or proceed with the suggested fix?"
60
+
61
+ **Exit:** Fix plan ready.
62
+
63
+ ### Phase 3: Implement Fix
64
+
65
+ 1. Make the code changes as suggested in debug report
66
+ 2. Follow the fix strategy step by step
67
+ 3. If strategy doesn't work:
68
+ - Document what happened
69
+ - Try alternative approach
70
+ - Update debug report if root cause was wrong
71
+
72
+ 4. After each change:
73
+ - Verify it compiles/parses
74
+ - Check for immediate regressions
75
+
76
+ **Exit:** Code changes made.
77
+
78
+ ### Phase 4: Verify Fix
79
+
80
+ Run verification as specified in debug report:
81
+
82
+ 1. **Reproduce original bug** — confirm it no longer occurs
83
+ 2. **Run test cases** — from debug report's verification plan
84
+ 3. **Run project tests** — `npm test` or equivalent
85
+ 4. **Check for regressions** — related functionality still works
86
+
87
+ If verification fails:
88
+ - Go back to Phase 3
89
+ - Update debug report with new findings
90
+ - Try alternative fix approach
91
+
92
+ **Exit:** Fix verified.
93
+
94
+ ### Phase 5: Write Fix Report
95
+
96
+ Write to `.unipi/docs/fix/YYYY-MM-DD-<topic>-fix.md`:
97
+
98
+ ```markdown
99
+ ---
100
+ title: "{Bug Title} — Fix Report"
101
+ type: fix
102
+ date: YYYY-MM-DD
103
+ debug-report: {path-to-debug-report}
104
+ status: {fixed|partial-fix|could-not-fix}
105
+ ---
106
+
107
+ # {Bug Title} — Fix Report
108
+
109
+ ## Summary
110
+ {One-line description of what was fixed}
111
+
112
+ ## Debug Report Reference
113
+ - Report: `.unipi/docs/debug/{filename}`
114
+ - Root Cause: {brief summary}
115
+
116
+ ## Changes Made
117
+
118
+ ### Files Modified
119
+ - `{file}` — {what changed and why}
120
+ - `{file}` — {what changed and why}
121
+
122
+ ### Code Changes
123
+ {Key code changes, or "See git diff for details"}
124
+
125
+ ## Fix Strategy
126
+ {How the fix addresses the root cause}
127
+
128
+ 1. {Step 1}
129
+ 2. {Step 2}
130
+
131
+ ## Verification
132
+
133
+ ### Test Results
134
+ - ✓ Original bug no longer reproduces
135
+ - ✓ Test case 1: {description}
136
+ - ✓ Test case 2: {description}
137
+ - ✓ Project tests pass
138
+
139
+ ### Regression Check
140
+ - ✓ {Related feature 1} still works
141
+ - ✓ {Related feature 2} still works
142
+
143
+ ## Risks & Mitigations
144
+ - {Risk}: {mitigation}
145
+
146
+ ## Notes
147
+ {Any additional context, gotchas, or follow-ups}
148
+
149
+ ## Follow-up
150
+ - [ ] {Optional follow-up task}
151
+ ```
152
+
153
+ ### Phase 6: Commit & Report
154
+
155
+ 1. Commit changes with descriptive message
156
+ 2. Report to user:
157
+
158
+ > "Fixed. Changes committed."
159
+ >
160
+ > **Fix:** {brief summary}
161
+ > **Files:** {list of changed files}
162
+ > **Report:** `.unipi/docs/fix/YYYY-MM-DD-<topic>-fix.md`
163
+
164
+ Suggest next steps:
165
+
166
+ **If fix was straightforward:**
167
+ ```
168
+ /unipi:consolidate
169
+ ```
170
+
171
+ **If fix revealed deeper issues:**
172
+ > "The fix works, but I noticed {issue}. Consider:"
173
+ ```
174
+ /unipi:scan-issues focus on {area}
175
+ ```
176
+
177
+ **If fix was complex:**
178
+ > "This was a tricky fix. Consider documenting the pattern:"
179
+ ```
180
+ /unipi:document {area}
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Autocomplete Behavior
186
+
187
+ When user types `/unipi:fix debug:`, autocomplete shows:
188
+
189
+ ```
190
+ Available debug reports:
191
+ ┌─────────────────────────────────────────┬────────────┬──────────────┐
192
+ │ File │ Date │ Status │
193
+ ├─────────────────────────────────────────┼────────────┼──────────────┤
194
+ │ 2026-04-28-auth-timeout-debug.md │ 2026-04-28 │ root-caused │
195
+ │ 2026-04-27-login-crash-debug.md │ 2026-04-27 │ root-caused │
196
+ │ 2026-04-26-slow-query-debug.md │ 2026-04-26 │ needs-inv. │
197
+ └─────────────────────────────────────────┴────────────┴──────────────┘
198
+ ```
199
+
200
+ User selects one, or types path manually.
201
+
202
+ ---
203
+
204
+ ## Notes
205
+
206
+ - Debug reports are the primary input — they guide the fix
207
+ - Fixes without debug reports should use `/unipi:quick-fix` instead
208
+ - Always verify against the debug report's verification plan
209
+ - Fix reports provide audit trail for future reference
210
+ - If debug report's suggested fix doesn't work, document why and try alternatives
@@ -56,8 +56,20 @@ Committed to current branch.
56
56
  2. If concerns: raise with user before proceeding
57
57
  3. If `string(greedy)` provided: use it to scope planning (e.g., "focus on auth only")
58
58
  4. Ask clarifying questions if needed (one at a time)
59
+ 5. **Ask about work branch:**
59
60
 
60
- **Exit:** No blockers. Ready to plan.
61
+ > "Where should this work happen?"
62
+ >
63
+ > 1. **Main branch** — work directly on main (small/medium tasks, low risk)
64
+ > 2. **New branch** — isolated worktree (larger tasks, risky changes)
65
+ >
66
+ > If "New branch": "What branch name? (e.g., `feat/auth`, or press enter for auto-naming based on spec topic)"
67
+
68
+ Record the decision:
69
+ - Main branch → `workbranch:` will be empty in plan frontmatter
70
+ - New branch → `workbranch: {branch-name}` in plan frontmatter (auto-generate `feat/{topic}` if not provided)
71
+
72
+ **Exit:** No blockers. Branch strategy decided. Ready to plan.
61
73
 
62
74
  ---
63
75
 
@@ -70,7 +82,7 @@ Structure the plan with heart of gold style:
70
82
  title: "{Topic} — Implementation Plan"
71
83
  type: plan
72
84
  date: YYYY-MM-DD
73
- workbranch: {branch-name or empty if on main}
85
+ workbranch: {branch-name} # empty string = work on main branch
74
86
  specs:
75
87
  - path/to/spec.md
76
88
  ---
@@ -170,15 +182,19 @@ Do NOT re-read or re-edit the spec checkboxes — Phase 4 already wrote them.
170
182
  Present plan summary to user. Then ask:
171
183
 
172
184
  1. **Proceed to /unipi:work** — Start implementing in a worktree
173
- 2. **Revise plan** — Adjust tasks or scope
174
- 3. **Done for now** — Return later
185
+ 2. **Proceed to /unipi:auto** — Run full pipeline (work → review → merge)
186
+ 3. **Revise plan** — Adjust tasks or scope
187
+ 4. **Done for now** — Return later
175
188
 
176
- If user selects "Proceed to /unipi:work", suggest:
177
- ```
178
- /unipi:work worktree:feat/<branch-name> specs:YYYY-MM-DD-<topic>-plan
179
- ```
189
+ If user selects "Proceed to /unipi:work":
190
+ - **Worktree branch** → suggest: `/unipi:work worktree:<branch-name> specs:YYYY-MM-DD-<topic>-plan`
191
+ - **Main branch** → suggest: `/unipi:work specs:YYYY-MM-DD-<topic>-plan` (no worktree arg)
192
+
193
+ If user selects "Proceed to /unipi:auto":
194
+ - **Worktree branch** → suggest: `/unipi:auto plan:YYYY-MM-DD-<topic>-plan.md`
195
+ - **Main branch** → suggest: `/unipi:auto plan:YYYY-MM-DD-<topic>-plan.md` (same — auto reads workbranch from plan)
180
196
 
181
- Recommend starting a **new session** for work it will switch pi's internal worktree.
197
+ Recommend starting a **new session** for work if using a worktree.
182
198
 
183
199
  ---
184
200
 
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: quick-fix
3
+ description: "Fast bug fix without debug report. One-shot fix for clear, simple bugs. Records fixes in docs/fix/."
4
+ ---
5
+
6
+ # Quick Fix
7
+
8
+ Fix simple bugs directly without requiring a debug report. One-shot execution for clear issues.
9
+
10
+ ## Boundaries
11
+
12
+ **This skill MAY:** read/write code, run tests, commit, write fix report to `.unipi/docs/fix/`.
13
+ **This skill MAY NOT:** create worktrees, merge branches, deploy.
14
+
15
+ ## Command Format
16
+
17
+ ```
18
+ /unipi:quick-fix <string(greedy)>
19
+ ```
20
+
21
+ - `string(greedy)` — bug description or error message
22
+ - Full read/write sandbox
23
+ - One shot — complete the fix in this session
24
+
25
+ ## Output Path
26
+
27
+ ```
28
+ .unipi/docs/fix/YYYY-MM-DD-<topic>-fix.md
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Process
34
+
35
+ ### Phase 1: Understand the Bug
36
+
37
+ 1. Read the bug description
38
+ 2. If unclear, ask one clarifying question
39
+ 3. Assess scope — is this truly a quick fix?
40
+ - If complex → suggest `/unipi:debug` first
41
+ - If appropriate → proceed
42
+
43
+ **Exit:** Bug understood, scoped as quick fix.
44
+
45
+ ### Phase 2: Find and Fix
46
+
47
+ 1. **Locate the bug:**
48
+ - Search for error messages
49
+ - Trace the code path
50
+ - Find the problematic code
51
+
52
+ 2. **Apply fix:**
53
+ - Make the minimal correct change
54
+ - Don't refactor unless necessary
55
+ - Keep changes focused
56
+
57
+ 3. **Verify:**
58
+ - Confirm fix works
59
+ - Run tests if applicable
60
+ - Check for obvious regressions
61
+
62
+ **Exit:** Bug fixed.
63
+
64
+ ### Phase 3: Write Fix Report
65
+
66
+ Write to `.unipi/docs/fix/YYYY-MM-DD-<topic>-fix.md`:
67
+
68
+ ```markdown
69
+ ---
70
+ title: "{Bug Title} — Quick Fix"
71
+ type: quick-fix
72
+ date: YYYY-MM-DD
73
+ ---
74
+
75
+ # {Bug Title} — Quick Fix
76
+
77
+ ## Bug
78
+ {Description of the bug}
79
+
80
+ ## Root Cause
81
+ {Brief explanation of what was wrong}
82
+
83
+ ## Fix
84
+ {What was changed and why}
85
+
86
+ ### Files Modified
87
+ - `{file}` — {what changed}
88
+
89
+ ## Verification
90
+ {How it was tested}
91
+
92
+ ## Notes
93
+ {Anything worth noting}
94
+ ```
95
+
96
+ ### Phase 4: Commit & Report
97
+
98
+ 1. Commit with descriptive message
99
+ 2. Report to user:
100
+
101
+ > "Fixed. Changes committed. Report at `.unipi/docs/fix/YYYY-MM-DD-<topic>-fix.md`"
102
+
103
+ No further suggestions needed — this was a quick fix.
104
+
105
+ ---
106
+
107
+ ## When to Use quick-fix vs debug+fix
108
+
109
+ **Use quick-fix for:**
110
+ - Clear, obvious bugs
111
+ - Error messages that pinpoint the issue
112
+ - Simple logic errors
113
+ - Typos in code
114
+ - Missing null checks
115
+ - Wrong variable names
116
+
117
+ **Use debug+fix for:**
118
+ - Complex bugs with unclear root cause
119
+ - Intermittent issues
120
+ - Performance problems
121
+ - Bugs requiring deep investigation
122
+ - Issues affecting multiple systems
123
+
124
+ When in doubt, start with quick-fix. If it gets complex, suggest switching to debug.
125
+
126
+ ---
127
+
128
+ ## Notes
129
+
130
+ - No debug report required — direct fix
131
+ - Summary provides record of what was fixed
132
+ - For complex bugs, use `/unipi:debug` first
133
+ - Fix reports go to same `.unipi/docs/fix/` directory as regular fixes
@@ -9,7 +9,7 @@ Execute a single task directly. No brainstorm, no plan — just do it and record
9
9
 
10
10
  ## Boundaries
11
11
 
12
- **This skill MAY:** read/write code, run tests, commit, write summary to `.unipi/quick-work/`.
12
+ **This skill MAY:** read/write code, run tests, commit, write summary to `.unipi/docs/quick-work/`.
13
13
  **This skill MAY NOT:** create worktrees, merge branches, deploy.
14
14
 
15
15
  ## Command Format
@@ -49,7 +49,7 @@ Straightforward — no planning, no discussion, just work.
49
49
 
50
50
  ### Phase 3: Write Summary
51
51
 
52
- Write summary to `.unipi/quick-work/YYYY-MM-DD-<topic>.md`:
52
+ Write summary to `.unipi/docs/quick-work/YYYY-MM-DD-<topic>.md`:
53
53
 
54
54
  ```markdown
55
55
  ---
@@ -76,7 +76,7 @@ date: YYYY-MM-DD
76
76
 
77
77
  ### Phase 4: Report
78
78
 
79
- > "Done. Changes committed. Summary at `.unipi/quick-work/YYYY-MM-DD-<topic>.md`"
79
+ > "Done. Changes committed. Summary at `.unipi/docs/quick-work/YYYY-MM-DD-<topic>.md`"
80
80
 
81
81
  No further suggestions needed — this was a one-shot task.
82
82