viepilot 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +230 -0
  2. package/LICENSE +23 -0
  3. package/README.md +550 -0
  4. package/bin/viepilot.cjs +222 -0
  5. package/bin/vp-tools.cjs +912 -0
  6. package/dev-install.sh +109 -0
  7. package/docs/README.md +125 -0
  8. package/docs/advanced-usage.md +366 -0
  9. package/docs/api/README.md +12 -0
  10. package/docs/api/graphql-schema.md +5 -0
  11. package/docs/api/kafka-events.md +5 -0
  12. package/docs/api/rest-api.md +19 -0
  13. package/docs/api/websocket-api.md +5 -0
  14. package/docs/dev/architecture.md +226 -0
  15. package/docs/dev/cli-reference.md +324 -0
  16. package/docs/dev/contributing.md +195 -0
  17. package/docs/dev/deployment.md +204 -0
  18. package/docs/dev/getting-started.md +16 -0
  19. package/docs/dev/testing.md +171 -0
  20. package/docs/dev/ui-components-library.md +36 -0
  21. package/docs/getting-started.md +163 -0
  22. package/docs/skills-reference.md +399 -0
  23. package/docs/troubleshooting.md +297 -0
  24. package/docs/user/faq.md +117 -0
  25. package/docs/user/features/autonomous-mode.md +111 -0
  26. package/docs/user/features/checkpoint-recovery.md +76 -0
  27. package/docs/user/features/debug-mode.md +77 -0
  28. package/docs/user/features/ui-direction.md +29 -0
  29. package/docs/user/quick-start.md +157 -0
  30. package/docs/videos/01-installation.md +113 -0
  31. package/docs/videos/02-first-project.md +132 -0
  32. package/docs/videos/03-autonomous-mode.md +147 -0
  33. package/install.sh +144 -0
  34. package/lib/cli-shared.cjs +108 -0
  35. package/package.json +78 -0
  36. package/skills/vp-audit/SKILL.md +140 -0
  37. package/skills/vp-auto/SKILL.md +204 -0
  38. package/skills/vp-brainstorm/SKILL.md +75 -0
  39. package/skills/vp-crystallize/SKILL.md +175 -0
  40. package/skills/vp-debug/SKILL.md +96 -0
  41. package/skills/vp-docs/SKILL.md +258 -0
  42. package/skills/vp-evolve/SKILL.md +165 -0
  43. package/skills/vp-pause/SKILL.md +150 -0
  44. package/skills/vp-request/SKILL.md +250 -0
  45. package/skills/vp-resume/SKILL.md +141 -0
  46. package/skills/vp-rollback/SKILL.md +116 -0
  47. package/skills/vp-status/SKILL.md +137 -0
  48. package/skills/vp-task/SKILL.md +139 -0
  49. package/skills/vp-ui-components/SKILL.md +64 -0
  50. package/templates/phase/PHASE-STATE.md +35 -0
  51. package/templates/phase/SPEC.md +40 -0
  52. package/templates/phase/SUMMARY.md +67 -0
  53. package/templates/phase/TASK.md +101 -0
  54. package/templates/phase/VERIFICATION.md +49 -0
  55. package/templates/project/AI-GUIDE.md +114 -0
  56. package/templates/project/ARCHITECTURE.md +70 -0
  57. package/templates/project/CHANGELOG.md +36 -0
  58. package/templates/project/CONTRIBUTING.md +154 -0
  59. package/templates/project/CONTRIBUTORS.md +41 -0
  60. package/templates/project/PROJECT-CONTEXT.md +74 -0
  61. package/templates/project/PROJECT-META.md +133 -0
  62. package/templates/project/README.md +197 -0
  63. package/templates/project/ROADMAP.md +56 -0
  64. package/templates/project/SYSTEM-RULES.md +368 -0
  65. package/templates/project/TRACKER.md +50 -0
  66. package/ui-components/INDEX.md +9 -0
  67. package/ui-components/base/button/README.md +8 -0
  68. package/ui-components/base/button/metadata.json +8 -0
  69. package/ui-components/base/card/README.md +8 -0
  70. package/ui-components/base/card/metadata.json +8 -0
  71. package/ui-components/base/input/README.md +8 -0
  72. package/ui-components/base/input/metadata.json +8 -0
  73. package/workflows/audit.md +549 -0
  74. package/workflows/autonomous.md +425 -0
  75. package/workflows/brainstorm.md +257 -0
  76. package/workflows/crystallize.md +418 -0
  77. package/workflows/debug.md +241 -0
  78. package/workflows/documentation.md +587 -0
  79. package/workflows/evolve.md +258 -0
  80. package/workflows/pause-work.md +255 -0
  81. package/workflows/request.md +534 -0
  82. package/workflows/resume-work.md +226 -0
  83. package/workflows/rollback.md +202 -0
  84. package/workflows/ui-components.md +109 -0
@@ -0,0 +1,418 @@
1
+ <purpose>
2
+ Chuyển đổi brainstorm sessions thành structured artifacts để AI có thể autonomous execution.
3
+ </purpose>
4
+
5
+ <process>
6
+
7
+ <step name="collect_metadata">
8
+ ## Step 0: Collect Project Metadata
9
+
10
+ Hỏi user các thông tin dự án:
11
+
12
+ ### Basic Info
13
+ ```
14
+ 1. Tên dự án?
15
+ Default: (extract from brainstorm)
16
+
17
+ 2. Mô tả ngắn gọn (1-2 câu)?
18
+ ```
19
+
20
+ ### Organization Info
21
+ ```
22
+ 3. Tên công ty/tổ chức phát triển?
23
+
24
+ 4. Website công ty? (optional)
25
+ ```
26
+
27
+ ### Package Info
28
+ ```
29
+ 5. Package Base ID (Java package)?
30
+ Example: com.acme.smarttrack
31
+ Validation: ^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*$
32
+
33
+ 6. Maven Artifact ID?
34
+ Default: {project-name-kebab-case}
35
+
36
+ 7. Maven Group ID?
37
+ Default: {package_base_id}
38
+ ```
39
+
40
+ ### Developer Info
41
+ ```
42
+ 8. Tên người phát triển chính?
43
+
44
+ 9. Email người phát triển chính?
45
+
46
+ 10. GitHub username? (optional)
47
+ ```
48
+
49
+ ### Repository Info
50
+ ```
51
+ 11. Repository URL? (optional)
52
+
53
+ 12. Issue Tracker URL?
54
+ Default: {repository_url}/issues
55
+ ```
56
+
57
+ ### License & Year
58
+ ```
59
+ 13. License?
60
+ Options: MIT, Apache-2.0, GPL-3.0, BSD-3-Clause, Proprietary
61
+ Default: MIT
62
+
63
+ 14. Năm bắt đầu dự án?
64
+ Default: {current_year}
65
+ ```
66
+
67
+ Store all metadata for template generation.
68
+ </step>
69
+
70
+ <step name="analyze_brainstorm">
71
+ ## Step 1: Analyze Brainstorm
72
+
73
+ ```bash
74
+ ls docs/brainstorm/session-*.md
75
+ ```
76
+
77
+ For each session file:
78
+ 1. Extract decisions (look for "Decision:" patterns)
79
+ 2. Extract architecture info
80
+ 3. Extract database schemas
81
+ 4. Extract features/requirements
82
+ 5. Extract tech stack choices
83
+
84
+ Validate completeness:
85
+ - [ ] Tech stack defined
86
+ - [ ] Core features identified
87
+ - [ ] Database schema exists
88
+ - [ ] API requirements clear
89
+
90
+ If gaps found → ask user to clarify or return to brainstorm.
91
+ </step>
92
+
93
+ <step name="consume_ui_direction">
94
+ ## Step 1A: Consume UI Direction Artifacts (for UI/UX projects)
95
+
96
+ If brainstorm indicates frontend/UI scope, check for direction artifacts:
97
+
98
+ ```bash
99
+ ls -la .viepilot/ui-direction/ 2>/dev/null
100
+ ```
101
+
102
+ When available, for the selected/latest session:
103
+ - Read `.viepilot/ui-direction/{session-id}/notes.md` first (source of design decisions)
104
+ - Read `index.html` + `style.css` to extract:
105
+ - layout hierarchy
106
+ - component candidates
107
+ - interaction expectations
108
+ - Record how each UI direction item maps into target tech stack implementation plan.
109
+
110
+ If UI scope is present but artifacts are missing:
111
+ - Warn user and request either:
112
+ 1. generate UI direction via `/vp-brainstorm --ui`, or
113
+ 2. explicitly continue with assumptions.
114
+ </step>
115
+
116
+ <step name="research_stack_official">
117
+ ## Step 1B: Research Official Stack Guidance (mandatory)
118
+
119
+ For each selected stack extracted in Step 1:
120
+ 1. Use `WebSearch` to find official documentation and authoritative references.
121
+ 2. Use `WebFetch` to read and verify each selected source before summarizing.
122
+ 3. Prefer source priority in this order:
123
+ - Official framework docs/specification
124
+ - Official project GitHub org docs
125
+ - Maintainer-authored references
126
+ - Community articles (only as supplemental context)
127
+ 4. Reject weak sources (outdated, anonymous, unclear version, no technical detail).
128
+ 5. Build a concise implementation guide that can be reused by `vp-auto`.
129
+ 6. Capture "Do / Don't" rules and common anti-patterns.
130
+
131
+ Required output per stack:
132
+ - Quick summary (token-light)
133
+ - Best practices
134
+ - Anti-patterns
135
+ - Source links + checked date
136
+ - Version compatibility note (e.g. MyBatis 3.x, Spring Boot 3.x integration notes)
137
+
138
+ Recommended structure:
139
+ ```yaml
140
+ stack: mybatis
141
+ official_sources:
142
+ - https://mybatis.org/mybatis-3/
143
+ guideline:
144
+ do:
145
+ - Prefer XML mapper for complex SQL and reusable fragments
146
+ dont:
147
+ - Avoid large inline SQL annotations for complex queries
148
+ ```
149
+
150
+ If official sources cannot be verified, pause crystallize and ask user to confirm temporary assumptions.
151
+ </step>
152
+
153
+ <step name="write_stack_cache">
154
+ ## Step 1C: Write Global Stack Cache
155
+
156
+ Persist stack guidance globally for cross-project reuse:
157
+
158
+ ```bash
159
+ mkdir -p "$HOME/.viepilot/stacks/{stack}"
160
+ ```
161
+
162
+ Files per stack:
163
+ - `~/.viepilot/stacks/{stack}/SUMMARY.md` (short checklist for fast lookup)
164
+ - `~/.viepilot/stacks/{stack}/BEST-PRACTICES.md`
165
+ - `~/.viepilot/stacks/{stack}/ANTI-PATTERNS.md`
166
+ - `~/.viepilot/stacks/{stack}/SOURCES.md` (official docs + last validated date)
167
+
168
+ Also create project-local index for traceability:
169
+ - `.viepilot/STACKS.md` listing stacks used and cache paths.
170
+ </step>
171
+
172
+ <step name="generate_ai_guide">
173
+ ## Step 2: Generate AI-GUIDE.md
174
+
175
+ Create `.viepilot/AI-GUIDE.md` using template:
176
+ `@$HOME/.cursor/viepilot/templates/project/AI-GUIDE.md`
177
+
178
+ Customize with:
179
+ - Project-specific file references
180
+ - Context loading strategy based on project size
181
+ - Quick lookup for project-specific terms
182
+ - Fast stack lookup section:
183
+ - Read `.viepilot/STACKS.md`
184
+ - For each task stack, read cache `SUMMARY.md` first
185
+ - Expand to `BEST-PRACTICES.md` only if task complexity requires
186
+ </step>
187
+
188
+ <step name="generate_project_meta">
189
+ ## Step 3: Generate PROJECT-META.md
190
+
191
+ Create `.viepilot/PROJECT-META.md` using template:
192
+ `@$HOME/.cursor/viepilot/templates/project/PROJECT-META.md`
193
+
194
+ Fill with collected metadata:
195
+ - Project info
196
+ - Organization info
197
+ - Package structure (generate from base ID)
198
+ - Developer info
199
+ - File headers (generate from metadata)
200
+ </step>
201
+
202
+ <step name="generate_architecture">
203
+ ## Step 4: Generate ARCHITECTURE.md
204
+
205
+ Create `.viepilot/ARCHITECTURE.md` using template:
206
+ `@$HOME/.cursor/viepilot/templates/project/ARCHITECTURE.md`
207
+
208
+ Extract from brainstorm:
209
+ - System overview diagram
210
+ - Services definitions
211
+ - Data flow
212
+ - Technology decisions with rationale
213
+ - Integration points
214
+ </step>
215
+
216
+ <step name="generate_context">
217
+ ## Step 5: Generate PROJECT-CONTEXT.md
218
+
219
+ Create `.viepilot/PROJECT-CONTEXT.md` using template:
220
+ `@$HOME/.cursor/viepilot/templates/project/PROJECT-CONTEXT.md`
221
+
222
+ Extract:
223
+ - Domain knowledge
224
+ - Key concepts
225
+ - Business rules
226
+ - Naming conventions
227
+ - Constraints
228
+ </step>
229
+
230
+ <step name="generate_rules">
231
+ ## Step 6: Generate SYSTEM-RULES.md
232
+
233
+ Create `.viepilot/SYSTEM-RULES.md` using template:
234
+ `@$HOME/.cursor/viepilot/templates/project/SYSTEM-RULES.md`
235
+
236
+ Include:
237
+ - Architecture rules
238
+ - Coding rules (language-specific)
239
+ - Comment standards (good/bad examples)
240
+ - Versioning (SemVer)
241
+ - Git conventions (Conventional Commits)
242
+ - Changelog standards (Keep a Changelog)
243
+ - Contributor standards
244
+ - Quality gates
245
+ - Forbidden patterns
246
+ - Stack-specific enforcement:
247
+ - Must follow cached stack `Do/Don't` guidance
248
+ - Require official-source alignment for framework-specific implementation
249
+ </step>
250
+
251
+ <step name="generate_roadmap">
252
+ ## Step 7: Generate ROADMAP.md
253
+
254
+ Create `.viepilot/ROADMAP.md` using template:
255
+ `@$HOME/.cursor/viepilot/templates/project/ROADMAP.md`
256
+
257
+ From brainstorm features/MVP breakdown:
258
+ 1. Create phases
259
+ 2. For each phase:
260
+ - Define goal
261
+ - Break into tasks
262
+ - Set acceptance criteria
263
+ - Add verification checkpoints
264
+ - Estimate complexity (S/M/L/XL)
265
+ 3. Define dependencies between phases
266
+ </step>
267
+
268
+ <step name="generate_schemas">
269
+ ## Step 8: Generate schemas/
270
+
271
+ Create `.viepilot/schemas/`:
272
+
273
+ **database-schema.sql**
274
+ - Extract from brainstorm
275
+ - Add proper comments
276
+ - Include indexes, constraints
277
+
278
+ **kafka-topics.yaml**
279
+ - List all topics
280
+ - Define message schemas
281
+ - Include examples
282
+
283
+ **api-contracts.yaml** (OpenAPI stub)
284
+ - Endpoint definitions
285
+ - Request/Response schemas
286
+ - Auth requirements
287
+ </step>
288
+
289
+ <step name="generate_tracker">
290
+ ## Step 9: Initialize TRACKER.md
291
+
292
+ Create `.viepilot/TRACKER.md` using template:
293
+ `@$HOME/.cursor/viepilot/templates/project/TRACKER.md`
294
+
295
+ Initialize:
296
+ - Current state (all phases not_started)
297
+ - Progress overview (0%)
298
+ - Decision log (import from brainstorm)
299
+ - Version info (0.1.0-alpha)
300
+ - Next action
301
+
302
+ Create empty `.viepilot/HANDOFF.json`
303
+ </step>
304
+
305
+ <step name="generate_phase_dirs">
306
+ ## Step 10: Create Phase Directories
307
+
308
+ For each phase in ROADMAP.md:
309
+ ```bash
310
+ mkdir -p .viepilot/phases/{NN}-{phase-slug}/tasks/
311
+ ```
312
+
313
+ Create:
314
+ - `SPEC.md` - Phase specification
315
+ - `PHASE-STATE.md` - Initial state (not_started)
316
+ - `tasks/` directory with task files
317
+ </step>
318
+
319
+ <step name="generate_project_files">
320
+ ## Step 11: Generate Project Files
321
+
322
+ **CHANGELOG.md**
323
+ ```markdown
324
+ # Changelog
325
+
326
+ All notable changes to this project will be documented in this file.
327
+
328
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
329
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
330
+
331
+ ## [Unreleased]
332
+
333
+ ### Added
334
+ - Initial project setup
335
+
336
+ ## [0.1.0] - {date}
337
+
338
+ ### Added
339
+ - Project initialization via ViePilot
340
+ - Architecture documentation
341
+ - Development roadmap
342
+
343
+ [Unreleased]: {repo}/compare/v0.1.0...HEAD
344
+ [0.1.0]: {repo}/releases/tag/v0.1.0
345
+ ```
346
+
347
+ **CONTRIBUTING.md** - From template with org info
348
+ **CONTRIBUTORS.md** - With lead developer
349
+ **LICENSE** - Based on chosen license
350
+ **README.md** - Project overview with links to docs
351
+ </step>
352
+
353
+ <step name="commit_confirm">
354
+ ## Step 12: Commit & Confirm
355
+
356
+ ```bash
357
+ git add .viepilot/ CHANGELOG.md CONTRIBUTING.md CONTRIBUTORS.md LICENSE README.md
358
+ git commit -m "feat: initialize project with ViePilot
359
+
360
+ - Add project documentation (.viepilot/)
361
+ - Add architecture and coding standards
362
+ - Add development roadmap
363
+ - Add changelog and contributing guidelines"
364
+ git push
365
+ ```
366
+
367
+ Display summary:
368
+ ```
369
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
370
+ VIEPILOT ► CRYSTALLIZE COMPLETE ✓
371
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
372
+
373
+ Project: {project_name}
374
+ Package: {package_base_id}
375
+ License: {license}
376
+
377
+ Created:
378
+ ├── .viepilot/
379
+ │ ├── AI-GUIDE.md
380
+ │ ├── PROJECT-META.md
381
+ │ ├── ARCHITECTURE.md
382
+ │ ├── PROJECT-CONTEXT.md
383
+ │ ├── SYSTEM-RULES.md
384
+ │ ├── ROADMAP.md ({phase_count} phases)
385
+ │ ├── TRACKER.md
386
+ │ └── schemas/
387
+
388
+ ├── CHANGELOG.md
389
+ ├── CONTRIBUTING.md
390
+ ├── CONTRIBUTORS.md
391
+ ├── LICENSE
392
+ └── README.md
393
+
394
+ Phases: {phase_count}
395
+ Tasks: {total_task_count}
396
+
397
+ Next step: /vp-auto
398
+
399
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
400
+ ```
401
+
402
+ Note: global stack cache at `~/.viepilot/stacks/` is machine-level knowledge and is not committed to project git.
403
+ </step>
404
+
405
+ </process>
406
+
407
+ <success_criteria>
408
+ - [ ] All metadata collected
409
+ - [ ] Official research completed for each selected stack
410
+ - [ ] Global stack cache written under ~/.viepilot/stacks/{stack}/
411
+ - [ ] All artifacts created in .viepilot/
412
+ - [ ] PROJECT-META.md complete
413
+ - [ ] SYSTEM-RULES.md has all standards
414
+ - [ ] ROADMAP.md has phases with tasks
415
+ - [ ] Phase directories created
416
+ - [ ] Project files created
417
+ - [ ] Git committed
418
+ </success_criteria>
@@ -0,0 +1,241 @@
1
+ <purpose>
2
+ Systematic debugging workflow với persistent state tracking.
3
+ Giúp organize debugging process và track progress qua nhiều sessions.
4
+ </purpose>
5
+
6
+ <process>
7
+
8
+ <step name="initialize">
9
+ ## 1. Initialize Debug Environment
10
+
11
+ ```bash
12
+ mkdir -p .viepilot/debug
13
+ ```
14
+
15
+ Check for active session:
16
+ ```bash
17
+ cat .viepilot/debug/CURRENT.json 2>/dev/null
18
+ ```
19
+
20
+ Parse `{{VP_ARGS}}` for flags:
21
+ - `--new` : Force new session
22
+ - `--continue` : Continue current
23
+ - `--list` : List sessions
24
+ - `--close` : Close session
25
+ - `--id <id>` : Specific session
26
+ </step>
27
+
28
+ <step name="route_action">
29
+ ## 2. Route Action
30
+
31
+ **If --list:**
32
+ ```bash
33
+ ls -la .viepilot/debug/session-*.json
34
+ ```
35
+ Display sessions with status and dates.
36
+
37
+ **If --close:**
38
+ Go to step 7 (Close Session).
39
+
40
+ **If --continue or active session exists:**
41
+ Load session and go to step 4 (Continue Investigation).
42
+
43
+ **If --new or no active session:**
44
+ Go to step 3 (New Session).
45
+ </step>
46
+
47
+ <step name="new_session">
48
+ ## 3. New Debug Session
49
+
50
+ Ask user:
51
+ ```
52
+ Mô tả vấn đề bạn đang gặp:
53
+ 1. Vấn đề là gì?
54
+ 2. Triệu chứng? (error messages, behavior)
55
+ 3. Khi nào xảy ra? (điều kiện)
56
+ 4. Files liên quan?
57
+ ```
58
+
59
+ Create session:
60
+ ```json
61
+ {
62
+ "id": "debug-{YYYYMMDD-HHMMSS}",
63
+ "status": "active",
64
+ "created_at": "{ISO}",
65
+ "updated_at": "{ISO}",
66
+ "problem": {
67
+ "description": "{user input}",
68
+ "symptoms": [],
69
+ "error_messages": [],
70
+ "affected_files": []
71
+ },
72
+ "investigation": {
73
+ "hypotheses": [],
74
+ "tests_run": [],
75
+ "findings": []
76
+ },
77
+ "resolution": null
78
+ }
79
+ ```
80
+
81
+ Save to `.viepilot/debug/session-{id}.json`
82
+ Update `.viepilot/debug/CURRENT.json`:
83
+ ```json
84
+ {"active_session": "debug-{id}"}
85
+ ```
86
+ </step>
87
+
88
+ <step name="continue_investigation">
89
+ ## 4. Continue Investigation
90
+
91
+ Load current session state.
92
+
93
+ Display status:
94
+ ```
95
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96
+ DEBUG SESSION: {id}
97
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
98
+
99
+ Problem: {description}
100
+ Status: {status}
101
+
102
+ Hypotheses:
103
+ {list with status}
104
+
105
+ Findings:
106
+ {list}
107
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
108
+ ```
109
+
110
+ Offer actions:
111
+ 1. Add hypothesis
112
+ 2. Test hypothesis
113
+ 3. Add finding
114
+ 4. Mark hypothesis confirmed/rejected
115
+ 5. Resolve issue
116
+ 6. Close session
117
+ </step>
118
+
119
+ <step name="generate_hypotheses">
120
+ ## 5. Generate/Add Hypotheses
121
+
122
+ If user requests, AI generates hypotheses based on:
123
+ - Problem description
124
+ - Error messages
125
+ - Affected files content
126
+ - Common patterns
127
+
128
+ Add to session:
129
+ ```json
130
+ {
131
+ "id": {next_id},
132
+ "description": "Hypothesis description",
133
+ "status": "pending",
134
+ "created_at": "{ISO}"
135
+ }
136
+ ```
137
+
138
+ Display updated hypotheses list.
139
+ </step>
140
+
141
+ <step name="test_hypothesis">
142
+ ## 6. Test Hypothesis
143
+
144
+ For selected hypothesis:
145
+ 1. Suggest test approach
146
+ 2. Run test commands
147
+ 3. Log results:
148
+
149
+ ```json
150
+ {
151
+ "hypothesis_id": {id},
152
+ "command": "command run",
153
+ "output": "output captured",
154
+ "conclusion": "supports|contradicts|inconclusive",
155
+ "timestamp": "{ISO}"
156
+ }
157
+ ```
158
+
159
+ Update hypothesis status based on results.
160
+ </step>
161
+
162
+ <step name="close_session">
163
+ ## 7. Close Session
164
+
165
+ Ask for resolution type:
166
+ 1. **resolved** - Problem fixed
167
+ 2. **unresolved** - Giving up for now
168
+ 3. **wontfix** - Not going to fix
169
+
170
+ **If resolved:**
171
+ Ask for:
172
+ - Root cause
173
+ - Fix applied
174
+ - Files changed
175
+ - How verified
176
+
177
+ Update session:
178
+ ```json
179
+ {
180
+ "status": "resolved",
181
+ "resolution": {
182
+ "root_cause": "...",
183
+ "fix_applied": "...",
184
+ "files_changed": [...],
185
+ "verification": "..."
186
+ }
187
+ }
188
+ ```
189
+
190
+ **If unresolved/wontfix:**
191
+ ```json
192
+ {
193
+ "status": "unresolved|wontfix",
194
+ "resolution": {
195
+ "notes": "Why closing without fix"
196
+ }
197
+ }
198
+ ```
199
+
200
+ Remove CURRENT.json pointer.
201
+
202
+ Display summary:
203
+ ```
204
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
205
+ DEBUG SESSION CLOSED
206
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
207
+
208
+ Session: {id}
209
+ Status: {status}
210
+ Duration: {time}
211
+
212
+ Hypotheses tested: {count}
213
+ Findings: {count}
214
+
215
+ {Resolution summary if resolved}
216
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
217
+ ```
218
+ </step>
219
+
220
+ </process>
221
+
222
+ <commands>
223
+ User commands during debug session:
224
+
225
+ - `/hypothesis <description>` - Add new hypothesis
226
+ - `/test <hypothesis_id>` - Test specific hypothesis
227
+ - `/finding <description>` - Add finding
228
+ - `/confirm <hypothesis_id>` - Mark hypothesis confirmed
229
+ - `/reject <hypothesis_id>` - Mark hypothesis rejected
230
+ - `/resolve` - Start resolution process
231
+ - `/close` - Close session
232
+ - `/status` - Show current status
233
+ </commands>
234
+
235
+ <success_criteria>
236
+ - [ ] Session state persists across tool restarts
237
+ - [ ] Hypotheses tracked with status
238
+ - [ ] Tests logged with outputs
239
+ - [ ] Resolution documented
240
+ - [ ] Clean session lifecycle (create → investigate → close)
241
+ </success_criteria>