@thiagodiogo/pscode 1.0.1 → 2.0.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.
Files changed (60) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +142 -142
  3. package/bin/pscode.js +4 -4
  4. package/dist/cli/index.js +0 -1
  5. package/dist/commands/feedback.js +4 -4
  6. package/dist/commands/schema.js +60 -60
  7. package/dist/core/collections/initiatives/templates.js +57 -57
  8. package/dist/core/command-generation/adapters/claude.js +8 -8
  9. package/dist/core/command-generation/adapters/codex.js +6 -6
  10. package/dist/core/command-generation/adapters/cursor.js +8 -8
  11. package/dist/core/command-generation/adapters/gemini.js +5 -5
  12. package/dist/core/command-generation/adapters/github-copilot.js +5 -5
  13. package/dist/core/complete.d.ts +0 -1
  14. package/dist/core/complete.js +35 -59
  15. package/dist/core/completions/command-registry.js +0 -4
  16. package/dist/core/completions/generators/bash-generator.js +41 -41
  17. package/dist/core/completions/generators/fish-generator.js +7 -7
  18. package/dist/core/completions/generators/powershell-generator.js +29 -29
  19. package/dist/core/completions/generators/zsh-generator.js +33 -33
  20. package/dist/core/completions/templates/bash-templates.js +24 -24
  21. package/dist/core/completions/templates/fish-templates.js +38 -38
  22. package/dist/core/completions/templates/powershell-templates.js +28 -28
  23. package/dist/core/completions/templates/zsh-templates.js +39 -39
  24. package/dist/core/init.js +0 -1
  25. package/dist/core/profile-sync-drift.js +0 -1
  26. package/dist/core/profiles.d.ts +3 -3
  27. package/dist/core/profiles.js +2 -3
  28. package/dist/core/shared/skill-generation.js +1 -3
  29. package/dist/core/shared/tool-detection.d.ts +2 -2
  30. package/dist/core/shared/tool-detection.js +0 -2
  31. package/dist/core/templates/skill-templates.d.ts +0 -1
  32. package/dist/core/templates/skill-templates.js +0 -1
  33. package/dist/core/templates/workflows/apply-change.js +264 -264
  34. package/dist/core/templates/workflows/archive-change.js +204 -204
  35. package/dist/core/templates/workflows/bulk-archive-change.js +472 -472
  36. package/dist/core/templates/workflows/continue-change.js +214 -214
  37. package/dist/core/templates/workflows/explore.js +735 -735
  38. package/dist/core/templates/workflows/feedback.js +97 -97
  39. package/dist/core/templates/workflows/ff-change.js +180 -180
  40. package/dist/core/templates/workflows/new-change.js +123 -123
  41. package/dist/core/templates/workflows/onboard.js +584 -584
  42. package/dist/core/templates/workflows/propose.js +324 -324
  43. package/dist/core/templates/workflows/trello-draft.js +194 -194
  44. package/dist/core/templates/workflows/trello-setup.js +292 -292
  45. package/dist/core/templates/workflows/verify-change.js +318 -318
  46. package/dist/core/workspace/open-surface.js +30 -30
  47. package/package.json +18 -20
  48. package/schemas/spec-driven/schema.yaml +153 -153
  49. package/schemas/spec-driven/templates/design.md +19 -19
  50. package/schemas/spec-driven/templates/proposal.md +23 -23
  51. package/schemas/spec-driven/templates/spec.md +8 -8
  52. package/schemas/spec-driven/templates/tasks.md +9 -9
  53. package/schemas/workspace-planning/schema.yaml +72 -72
  54. package/schemas/workspace-planning/templates/design.md +33 -33
  55. package/schemas/workspace-planning/templates/proposal.md +28 -28
  56. package/schemas/workspace-planning/templates/spec.md +9 -9
  57. package/schemas/workspace-planning/templates/tasks.md +15 -15
  58. package/scripts/postinstall.js +83 -83
  59. package/dist/core/templates/workflows/sync-specs.d.ts +0 -10
  60. package/dist/core/templates/workflows/sync-specs.js +0 -290
@@ -2,429 +2,429 @@ export function getExploreSkillTemplate() {
2
2
  return {
3
3
  name: 'pscode-explore',
4
4
  description: 'Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.',
5
- instructions: `Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
6
-
7
- **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create Pscode artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
8
-
9
- **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
10
-
11
- ---
12
-
13
- ## The Stance
14
-
15
- - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
16
- - **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
17
- - **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
18
- - **Adaptive** - Follow interesting threads, pivot when new information emerges
19
- - **Patient** - Don't rush to conclusions, let the shape of the problem emerge
20
- - **Grounded** - Explore the actual codebase when relevant, don't just theorize
21
-
22
- ---
23
-
24
- ## What You Might Do
25
-
26
- Depending on what the user brings, you might:
27
-
28
- **Explore the problem space**
29
- - Ask clarifying questions that emerge from what they said
30
- - Challenge assumptions
31
- - Reframe the problem
32
- - Find analogies
33
-
34
- **Investigate the codebase**
35
- - Map existing architecture relevant to the discussion
36
- - Find integration points
37
- - Identify patterns already in use
38
- - Surface hidden complexity
39
-
40
- **Compare options**
41
- - Brainstorm multiple approaches
42
- - Build comparison tables
43
- - Sketch tradeoffs
44
- - Recommend a path (if asked)
45
-
46
- **Visualize**
47
- \`\`\`
48
- ┌─────────────────────────────────────────┐
49
- │ Use ASCII diagrams liberally │
50
- ├─────────────────────────────────────────┤
51
- │ │
52
- │ ┌────────┐ ┌────────┐ │
53
- │ │ State │────────▶│ State │ │
54
- │ │ A │ │ B │ │
55
- │ └────────┘ └────────┘ │
56
- │ │
57
- │ System diagrams, state machines, │
58
- │ data flows, architecture sketches, │
59
- │ dependency graphs, comparison tables │
60
- │ │
61
- └─────────────────────────────────────────┘
62
- \`\`\`
63
-
64
- **Surface risks and unknowns**
65
- - Identify what could go wrong
66
- - Find gaps in understanding
67
- - Suggest spikes or investigations
68
-
69
- ---
70
-
71
- ## Pscode Awareness
72
-
73
- You have full context of the Pscode system. Use it naturally, don't force it.
74
-
75
- ### Check for context
76
-
77
- At the start, quickly check what exists:
78
- \`\`\`bash
79
- pscode list --json
80
- \`\`\`
81
-
82
- This tells you:
83
- - If there are active changes
84
- - Their names, schemas, and status
85
- - What the user might be working on
86
-
87
- ### When no change exists
88
-
89
- Think freely. When insights crystallize, you might offer:
90
-
91
- - "This feels solid enough to start a change. Want me to create a proposal?"
92
- - Or keep exploring - no pressure to formalize
93
-
94
- ### When a change exists
95
-
96
- If the user mentions a change or you detect one is relevant:
97
-
98
- 1. **Resolve and read existing artifacts for context**
99
- - Run \`pscode status --change "<name>" --json\`.
100
- - Use \`changeRoot\`, \`artifactPaths\`, and \`actionContext\` from the status JSON.
101
- - Read existing files from \`artifactPaths.<artifact>.existingOutputPaths\`.
102
-
103
- 2. **Reference them naturally in conversation**
104
- - "Your design mentions using Redis, but we just realized SQLite fits better..."
105
- - "The proposal scopes this to premium users, but we're now thinking everyone..."
106
-
107
- 3. **Offer to capture when decisions are made**
108
-
109
- | Insight Type | Where to Capture |
110
- |----------------------------|--------------------------------|
111
- | New requirement discovered | \`specs/<capability>/spec.md\` |
112
- | Requirement changed | \`specs/<capability>/spec.md\` |
113
- | Design decision made | \`design.md\` |
114
- | Scope changed | \`proposal.md\` |
115
- | New work identified | \`tasks.md\` |
116
- | Assumption invalidated | Relevant artifact |
117
-
118
- Example offers:
119
- - "That's a design decision. Capture it in design.md?"
120
- - "This is a new requirement. Add it to specs?"
121
- - "This changes scope. Update the proposal?"
122
-
123
- 4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
124
-
125
- ---
126
-
127
- ## What You Don't Have To Do
128
-
129
- - Follow a script
130
- - Ask the same questions every time
131
- - Produce a specific artifact
132
- - Reach a conclusion
133
- - Stay on topic if a tangent is valuable
134
- - Be brief (this is thinking time)
135
-
136
- ---
137
-
138
- ## Handling Different Entry Points
139
-
140
- **User brings a vague idea:**
141
- \`\`\`
142
- User: I'm thinking about adding real-time collaboration
143
-
144
- You: Real-time collab is a big space. Let me think about this...
145
-
146
- COLLABORATION SPECTRUM
147
- ════════════════════════════════════════════
148
-
149
- Awareness Coordination Sync
150
- │ │ │
151
- ▼ ▼ ▼
152
- ┌────────┐ ┌────────┐ ┌────────┐
153
- │Presence│ │Cursors │ │ CRDT │
154
- │ "3 │ │ Multi │ │Conflict│
155
- │online" │ │ select │ │ free │
156
- └────────┘ └────────┘ └────────┘
157
- │ │ │
158
- trivial moderate complex
159
-
160
- Where's your head at?
161
- \`\`\`
162
-
163
- **User brings a specific problem:**
164
- \`\`\`
165
- User: The auth system is a mess
166
-
167
- You: [reads codebase]
168
-
169
- ┌─────────────────────────────────────────────┐
170
- │ CURRENT AUTH FLOW │
171
- └─────────────────────────────────────────────┘
172
-
173
- ┌─────────────┼─────────────┐
174
- ▼ ▼ ▼
175
- ┌─────────┐ ┌─────────┐ ┌─────────┐
176
- │ Google │ │ GitHub │ │ Email │
177
- │ OAuth │ │ OAuth │ │ Magic │
178
- └────┬────┘ └────┬────┘ └────┬────┘
179
- │ │ │
180
- └─────────────┼─────────────┘
181
-
182
- ┌───────────┐
183
- │ Session │
184
- └─────┬─────┘
185
-
186
-
187
- ┌───────────┐
188
- │ Perms │
189
- └───────────┘
190
-
191
- I see three tangles. Which one's burning?
192
- \`\`\`
193
-
194
- **User is stuck mid-implementation:**
195
- \`\`\`
196
- User: /ps:explore add-auth-system
197
- The OAuth integration is more complex than expected
198
-
199
- You: [reads change artifacts]
200
-
201
- You're on task 4: "Implement OAuth flow"
202
-
203
- Let me trace what's involved...
204
-
205
- [draws diagram, explores options, suggests paths]
206
-
207
- Want to update the design to reflect this?
208
- Or add a spike task to investigate?
209
- \`\`\`
210
-
211
- **User wants to compare options:**
212
- \`\`\`
213
- User: Should we use Postgres or SQLite?
214
-
215
- You: Generic answer is boring. What's the context?
216
-
217
- User: A CLI tool that tracks local dev environments
218
-
219
- You: That changes everything.
220
-
221
- ┌─────────────────────────────────────────────────┐
222
- │ CLI TOOL DATA STORAGE │
223
- └─────────────────────────────────────────────────┘
224
-
225
- Key constraints:
226
- • No daemon running
227
- • Must work offline
228
- • Single user
229
-
230
- SQLite Postgres
231
- Deployment embedded ✓ needs server ✗
232
- Offline yes ✓ no ✗
233
- Single file yes ✓ no ✗
234
-
235
- SQLite. Not even close.
236
-
237
- Unless... is there a sync component?
238
- \`\`\`
239
-
240
- ---
241
-
242
- ## Ending Discovery
243
-
244
- There's no required ending. Discovery might:
245
-
246
- - **Flow into a proposal**: "Ready to start? I can create a change proposal."
247
- - **Result in artifact updates**: "Updated design.md with these decisions"
248
- - **Just provide clarity**: User has what they need, moves on
249
- - **Continue later**: "We can pick this up anytime"
250
-
251
- When it feels like things are crystallizing, you might summarize:
252
-
253
- \`\`\`
254
- ## What We Figured Out
255
-
256
- **The problem**: [crystallized understanding]
257
-
258
- **The approach**: [if one emerged]
259
-
260
- **Open questions**: [if any remain]
261
-
262
- **Next steps** (if ready):
263
- - Create a change proposal
264
- - Keep exploring: just keep talking
265
- \`\`\`
266
-
267
- But this summary is optional. Sometimes the thinking IS the value.
268
-
269
- ---
270
-
271
- ## After the First Propose — Refinement Validation Loop
272
-
273
- When exploration leads to a \`/ps:propose\` being executed (or when the user asks to formalize the idea into a proposal), the following **refinement validation loop** must run after all artifacts are generated. This is mandatory — do not skip it.
274
-
275
- ### Step RF1 — Show Refinement Summary
276
-
277
- After the proposal artifacts (proposal.md, design.md, tasks.md) are created, immediately present a structured refinement summary. Read the generated files to extract the content:
278
-
279
- \`\`\`markdown
280
- ## 🔍 Refinamento da Proposta — <change-name>
281
-
282
- **Objetivo:** <1-2 sentences from proposal.md>
283
-
284
- ### O que será implementado
285
- <3-5 bullet points from design.md / tasks.md>
286
-
287
- ### Escopo e decisões técnicas
288
- <2-3 key technical decisions from design.md>
289
-
290
- ### Tarefas geradas
291
- <numbered list from tasks.md>
292
-
293
- ---
294
- Para iniciar a implementação quando aprovado:
295
- \`\`\`
296
- /ps:apply <change-name>
297
- \`\`\`
298
- \`\`\`
299
-
300
- ---
301
-
302
- ### Step RF2 — Sync Trello (if configured)
303
-
304
- If \`pscode/trello.yaml\` exists and a Trello card was created or found during propose:
305
-
306
- **a. Update the card description** with the refined summary:
307
- \`\`\`tool
308
- mcp__claude_ai_Trello_Custom__update_card
309
- card_id: "<cardId>"
310
- desc: |
311
- **Objetivo:** <summary>
312
-
313
- **O que será implementado:**
314
- <bullet list>
315
-
316
- **Decisões técnicas:**
317
- <key decisions>
318
-
319
- **Artefatos:** pscode/changes/<name>/
320
- \`\`\`
321
-
322
- **b. Add a comment with the implementation command in Markdown:**
323
- \`\`\`tool
324
- mcp__claude_ai_Trello_Custom__add_comment
325
- card_id: "<cardId>"
326
- text: |
327
- ## Refinamento concluído via /ps:explore ✓
328
-
329
- **Change:** \`<name>\`
330
- **Artefatos:** proposal.md · design.md · tasks.md
331
-
332
- ### Resumo
333
- <2-3 line summary>
334
-
335
- ### Para iniciar a implementação
336
- \`\`\`
337
- /ps:apply <name>
338
- \`\`\`
339
-
340
- _Aguardando aprovação para mover para Ready to Dev._
341
- \`\`\`
342
-
343
- ---
344
-
345
- ### Step RF3 — Ask for Approval
346
-
347
- Use **AskUserQuestion** to ask:
348
-
349
- > "A implementação e o planejamento estão de acordo com o esperado?"
350
-
351
- Options:
352
- - ✅ Sim, mover para Ready to Dev
353
- - 🔄 Não, quero ajustar o plano
354
- - ❌ Cancelar (manter em refinamento)
355
-
356
- ---
357
-
358
- ### Step RF3a — If APPROVED
359
-
360
- 1. Move the Trello card to \`lists.ready\` (if configured):
361
- \`\`\`tool
362
- mcp__claude_ai_Trello_Custom__update_card
363
- card_id: "<cardId>"
364
- list_id: "<lists.ready.id>"
365
- \`\`\`
366
-
367
- 2. Add final comment:
368
- \`\`\`tool
369
- mcp__claude_ai_Trello_Custom__add_comment
370
- card_id: "<cardId>"
371
- text: |
372
- ## ✅ Aprovado para Ready to Dev
373
-
374
- O planejamento foi revisado e aprovado durante o /ps:explore.
375
-
376
- ### Próximo passo
377
- \`\`\`
378
- /ps:apply <name>
379
- \`\`\`
380
- \`\`\`
381
-
382
- 3. Show success:
383
- \`\`\`
384
- ## ✅ Pronto para desenvolvimento!
385
-
386
- Change: <name>
387
- Card movido para: <lists.ready.name>
388
-
389
- /ps:apply <name>
390
- \`\`\`
391
-
392
- ---
393
-
394
- ### Step RF3b — If NOT APPROVED (loop)
395
-
396
- 1. Ask what needs to change.
397
- 2. Update the relevant artifacts (proposal.md / design.md / tasks.md).
398
- 3. Update the Trello card description with the revised plan.
399
- 4. **Go back to Step RF1** — show the updated summary and ask again.
400
- 5. **Keep looping** until the user approves or cancels.
401
-
402
- ---
403
-
404
- ### Step RF3c — If CANCELLED
405
-
406
- Show:
407
- \`\`\`
408
- ⏸ Refinamento pausado.
409
- O card permanece em <current list>.
410
- Retome com /ps:explore <name> quando quiser.
411
- \`\`\`
412
-
413
- Do NOT move the card. End the loop.
414
-
415
- ---
416
-
417
- ## Guardrails
418
-
419
- - **Don't implement** - Never write code or implement features. Creating Pscode artifacts is fine, writing application code is not.
420
- - **Don't fake understanding** - If something is unclear, dig deeper
421
- - **Don't rush** - Discovery is thinking time, not task time
422
- - **Don't force structure** - Let patterns emerge naturally
423
- - **Don't auto-capture** - Offer to save insights, don't just do it
424
- - **Do visualize** - A good diagram is worth many paragraphs
425
- - **Do explore the codebase** - Ground discussions in reality
426
- - **Do question assumptions** - Including the user's and your own
427
- - **Always run the refinement loop after propose** - When exploration leads to a proposal, the refinement validation loop (Steps RF1–RF3) is mandatory, not optional
5
+ instructions: `Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
6
+
7
+ **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create Pscode artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
8
+
9
+ **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
10
+
11
+ ---
12
+
13
+ ## The Stance
14
+
15
+ - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
16
+ - **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
17
+ - **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
18
+ - **Adaptive** - Follow interesting threads, pivot when new information emerges
19
+ - **Patient** - Don't rush to conclusions, let the shape of the problem emerge
20
+ - **Grounded** - Explore the actual codebase when relevant, don't just theorize
21
+
22
+ ---
23
+
24
+ ## What You Might Do
25
+
26
+ Depending on what the user brings, you might:
27
+
28
+ **Explore the problem space**
29
+ - Ask clarifying questions that emerge from what they said
30
+ - Challenge assumptions
31
+ - Reframe the problem
32
+ - Find analogies
33
+
34
+ **Investigate the codebase**
35
+ - Map existing architecture relevant to the discussion
36
+ - Find integration points
37
+ - Identify patterns already in use
38
+ - Surface hidden complexity
39
+
40
+ **Compare options**
41
+ - Brainstorm multiple approaches
42
+ - Build comparison tables
43
+ - Sketch tradeoffs
44
+ - Recommend a path (if asked)
45
+
46
+ **Visualize**
47
+ \`\`\`
48
+ ┌─────────────────────────────────────────┐
49
+ │ Use ASCII diagrams liberally │
50
+ ├─────────────────────────────────────────┤
51
+ │ │
52
+ │ ┌────────┐ ┌────────┐ │
53
+ │ │ State │────────▶│ State │ │
54
+ │ │ A │ │ B │ │
55
+ │ └────────┘ └────────┘ │
56
+ │ │
57
+ │ System diagrams, state machines, │
58
+ │ data flows, architecture sketches, │
59
+ │ dependency graphs, comparison tables │
60
+ │ │
61
+ └─────────────────────────────────────────┘
62
+ \`\`\`
63
+
64
+ **Surface risks and unknowns**
65
+ - Identify what could go wrong
66
+ - Find gaps in understanding
67
+ - Suggest spikes or investigations
68
+
69
+ ---
70
+
71
+ ## Pscode Awareness
72
+
73
+ You have full context of the Pscode system. Use it naturally, don't force it.
74
+
75
+ ### Check for context
76
+
77
+ At the start, quickly check what exists:
78
+ \`\`\`bash
79
+ pscode list --json
80
+ \`\`\`
81
+
82
+ This tells you:
83
+ - If there are active changes
84
+ - Their names, schemas, and status
85
+ - What the user might be working on
86
+
87
+ ### When no change exists
88
+
89
+ Think freely. When insights crystallize, you might offer:
90
+
91
+ - "This feels solid enough to start a change. Want me to create a proposal?"
92
+ - Or keep exploring - no pressure to formalize
93
+
94
+ ### When a change exists
95
+
96
+ If the user mentions a change or you detect one is relevant:
97
+
98
+ 1. **Resolve and read existing artifacts for context**
99
+ - Run \`pscode status --change "<name>" --json\`.
100
+ - Use \`changeRoot\`, \`artifactPaths\`, and \`actionContext\` from the status JSON.
101
+ - Read existing files from \`artifactPaths.<artifact>.existingOutputPaths\`.
102
+
103
+ 2. **Reference them naturally in conversation**
104
+ - "Your design mentions using Redis, but we just realized SQLite fits better..."
105
+ - "The proposal scopes this to premium users, but we're now thinking everyone..."
106
+
107
+ 3. **Offer to capture when decisions are made**
108
+
109
+ | Insight Type | Where to Capture |
110
+ |----------------------------|--------------------------------|
111
+ | New requirement discovered | \`specs/<capability>/spec.md\` |
112
+ | Requirement changed | \`specs/<capability>/spec.md\` |
113
+ | Design decision made | \`design.md\` |
114
+ | Scope changed | \`proposal.md\` |
115
+ | New work identified | \`tasks.md\` |
116
+ | Assumption invalidated | Relevant artifact |
117
+
118
+ Example offers:
119
+ - "That's a design decision. Capture it in design.md?"
120
+ - "This is a new requirement. Add it to specs?"
121
+ - "This changes scope. Update the proposal?"
122
+
123
+ 4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
124
+
125
+ ---
126
+
127
+ ## What You Don't Have To Do
128
+
129
+ - Follow a script
130
+ - Ask the same questions every time
131
+ - Produce a specific artifact
132
+ - Reach a conclusion
133
+ - Stay on topic if a tangent is valuable
134
+ - Be brief (this is thinking time)
135
+
136
+ ---
137
+
138
+ ## Handling Different Entry Points
139
+
140
+ **User brings a vague idea:**
141
+ \`\`\`
142
+ User: I'm thinking about adding real-time collaboration
143
+
144
+ You: Real-time collab is a big space. Let me think about this...
145
+
146
+ COLLABORATION SPECTRUM
147
+ ════════════════════════════════════════════
148
+
149
+ Awareness Coordination Sync
150
+ │ │ │
151
+ ▼ ▼ ▼
152
+ ┌────────┐ ┌────────┐ ┌────────┐
153
+ │Presence│ │Cursors │ │ CRDT │
154
+ │ "3 │ │ Multi │ │Conflict│
155
+ │online" │ │ select │ │ free │
156
+ └────────┘ └────────┘ └────────┘
157
+ │ │ │
158
+ trivial moderate complex
159
+
160
+ Where's your head at?
161
+ \`\`\`
162
+
163
+ **User brings a specific problem:**
164
+ \`\`\`
165
+ User: The auth system is a mess
166
+
167
+ You: [reads codebase]
168
+
169
+ ┌─────────────────────────────────────────────┐
170
+ │ CURRENT AUTH FLOW │
171
+ └─────────────────────────────────────────────┘
172
+
173
+ ┌─────────────┼─────────────┐
174
+ ▼ ▼ ▼
175
+ ┌─────────┐ ┌─────────┐ ┌─────────┐
176
+ │ Google │ │ GitHub │ │ Email │
177
+ │ OAuth │ │ OAuth │ │ Magic │
178
+ └────┬────┘ └────┬────┘ └────┬────┘
179
+ │ │ │
180
+ └─────────────┼─────────────┘
181
+
182
+ ┌───────────┐
183
+ │ Session │
184
+ └─────┬─────┘
185
+
186
+
187
+ ┌───────────┐
188
+ │ Perms │
189
+ └───────────┘
190
+
191
+ I see three tangles. Which one's burning?
192
+ \`\`\`
193
+
194
+ **User is stuck mid-implementation:**
195
+ \`\`\`
196
+ User: /ps:explore add-auth-system
197
+ The OAuth integration is more complex than expected
198
+
199
+ You: [reads change artifacts]
200
+
201
+ You're on task 4: "Implement OAuth flow"
202
+
203
+ Let me trace what's involved...
204
+
205
+ [draws diagram, explores options, suggests paths]
206
+
207
+ Want to update the design to reflect this?
208
+ Or add a spike task to investigate?
209
+ \`\`\`
210
+
211
+ **User wants to compare options:**
212
+ \`\`\`
213
+ User: Should we use Postgres or SQLite?
214
+
215
+ You: Generic answer is boring. What's the context?
216
+
217
+ User: A CLI tool that tracks local dev environments
218
+
219
+ You: That changes everything.
220
+
221
+ ┌─────────────────────────────────────────────────┐
222
+ │ CLI TOOL DATA STORAGE │
223
+ └─────────────────────────────────────────────────┘
224
+
225
+ Key constraints:
226
+ • No daemon running
227
+ • Must work offline
228
+ • Single user
229
+
230
+ SQLite Postgres
231
+ Deployment embedded ✓ needs server ✗
232
+ Offline yes ✓ no ✗
233
+ Single file yes ✓ no ✗
234
+
235
+ SQLite. Not even close.
236
+
237
+ Unless... is there a sync component?
238
+ \`\`\`
239
+
240
+ ---
241
+
242
+ ## Ending Discovery
243
+
244
+ There's no required ending. Discovery might:
245
+
246
+ - **Flow into a proposal**: "Ready to start? I can create a change proposal."
247
+ - **Result in artifact updates**: "Updated design.md with these decisions"
248
+ - **Just provide clarity**: User has what they need, moves on
249
+ - **Continue later**: "We can pick this up anytime"
250
+
251
+ When it feels like things are crystallizing, you might summarize:
252
+
253
+ \`\`\`
254
+ ## What We Figured Out
255
+
256
+ **The problem**: [crystallized understanding]
257
+
258
+ **The approach**: [if one emerged]
259
+
260
+ **Open questions**: [if any remain]
261
+
262
+ **Next steps** (if ready):
263
+ - Create a change proposal
264
+ - Keep exploring: just keep talking
265
+ \`\`\`
266
+
267
+ But this summary is optional. Sometimes the thinking IS the value.
268
+
269
+ ---
270
+
271
+ ## After the First Propose — Refinement Validation Loop
272
+
273
+ When exploration leads to a \`/ps:propose\` being executed (or when the user asks to formalize the idea into a proposal), the following **refinement validation loop** must run after all artifacts are generated. This is mandatory — do not skip it.
274
+
275
+ ### Step RF1 — Show Refinement Summary
276
+
277
+ After the proposal artifacts (proposal.md, design.md, tasks.md) are created, immediately present a structured refinement summary. Read the generated files to extract the content:
278
+
279
+ \`\`\`markdown
280
+ ## 🔍 Refinamento da Proposta — <change-name>
281
+
282
+ **Objetivo:** <1-2 sentences from proposal.md>
283
+
284
+ ### O que será implementado
285
+ <3-5 bullet points from design.md / tasks.md>
286
+
287
+ ### Escopo e decisões técnicas
288
+ <2-3 key technical decisions from design.md>
289
+
290
+ ### Tarefas geradas
291
+ <numbered list from tasks.md>
292
+
293
+ ---
294
+ Para iniciar a implementação quando aprovado:
295
+ \`\`\`
296
+ /ps:apply <change-name>
297
+ \`\`\`
298
+ \`\`\`
299
+
300
+ ---
301
+
302
+ ### Step RF2 — Sync Trello (if configured)
303
+
304
+ If \`pscode/trello.yaml\` exists and a Trello card was created or found during propose:
305
+
306
+ **a. Update the card description** with the refined summary:
307
+ \`\`\`tool
308
+ mcp__claude_ai_Trello_Custom__update_card
309
+ card_id: "<cardId>"
310
+ desc: |
311
+ **Objetivo:** <summary>
312
+
313
+ **O que será implementado:**
314
+ <bullet list>
315
+
316
+ **Decisões técnicas:**
317
+ <key decisions>
318
+
319
+ **Artefatos:** pscode/changes/<name>/
320
+ \`\`\`
321
+
322
+ **b. Add a comment with the implementation command in Markdown:**
323
+ \`\`\`tool
324
+ mcp__claude_ai_Trello_Custom__add_comment
325
+ card_id: "<cardId>"
326
+ text: |
327
+ ## Refinamento concluído via /ps:explore ✓
328
+
329
+ **Change:** \`<name>\`
330
+ **Artefatos:** proposal.md · design.md · tasks.md
331
+
332
+ ### Resumo
333
+ <2-3 line summary>
334
+
335
+ ### Para iniciar a implementação
336
+ \`\`\`
337
+ /ps:apply <name>
338
+ \`\`\`
339
+
340
+ _Aguardando aprovação para mover para Ready to Dev._
341
+ \`\`\`
342
+
343
+ ---
344
+
345
+ ### Step RF3 — Ask for Approval
346
+
347
+ Use **AskUserQuestion** to ask:
348
+
349
+ > "A implementação e o planejamento estão de acordo com o esperado?"
350
+
351
+ Options:
352
+ - ✅ Sim, mover para Ready to Dev
353
+ - 🔄 Não, quero ajustar o plano
354
+ - ❌ Cancelar (manter em refinamento)
355
+
356
+ ---
357
+
358
+ ### Step RF3a — If APPROVED
359
+
360
+ 1. Move the Trello card to \`lists.ready\` (if configured):
361
+ \`\`\`tool
362
+ mcp__claude_ai_Trello_Custom__update_card
363
+ card_id: "<cardId>"
364
+ list_id: "<lists.ready.id>"
365
+ \`\`\`
366
+
367
+ 2. Add final comment:
368
+ \`\`\`tool
369
+ mcp__claude_ai_Trello_Custom__add_comment
370
+ card_id: "<cardId>"
371
+ text: |
372
+ ## ✅ Aprovado para Ready to Dev
373
+
374
+ O planejamento foi revisado e aprovado durante o /ps:explore.
375
+
376
+ ### Próximo passo
377
+ \`\`\`
378
+ /ps:apply <name>
379
+ \`\`\`
380
+ \`\`\`
381
+
382
+ 3. Show success:
383
+ \`\`\`
384
+ ## ✅ Pronto para desenvolvimento!
385
+
386
+ Change: <name>
387
+ Card movido para: <lists.ready.name>
388
+
389
+ /ps:apply <name>
390
+ \`\`\`
391
+
392
+ ---
393
+
394
+ ### Step RF3b — If NOT APPROVED (loop)
395
+
396
+ 1. Ask what needs to change.
397
+ 2. Update the relevant artifacts (proposal.md / design.md / tasks.md).
398
+ 3. Update the Trello card description with the revised plan.
399
+ 4. **Go back to Step RF1** — show the updated summary and ask again.
400
+ 5. **Keep looping** until the user approves or cancels.
401
+
402
+ ---
403
+
404
+ ### Step RF3c — If CANCELLED
405
+
406
+ Show:
407
+ \`\`\`
408
+ ⏸ Refinamento pausado.
409
+ O card permanece em <current list>.
410
+ Retome com /ps:explore <name> quando quiser.
411
+ \`\`\`
412
+
413
+ Do NOT move the card. End the loop.
414
+
415
+ ---
416
+
417
+ ## Guardrails
418
+
419
+ - **Don't implement** - Never write code or implement features. Creating Pscode artifacts is fine, writing application code is not.
420
+ - **Don't fake understanding** - If something is unclear, dig deeper
421
+ - **Don't rush** - Discovery is thinking time, not task time
422
+ - **Don't force structure** - Let patterns emerge naturally
423
+ - **Don't auto-capture** - Offer to save insights, don't just do it
424
+ - **Do visualize** - A good diagram is worth many paragraphs
425
+ - **Do explore the codebase** - Ground discussions in reality
426
+ - **Do question assumptions** - Including the user's and your own
427
+ - **Always run the refinement loop after propose** - When exploration leads to a proposal, the refinement validation loop (Steps RF1–RF3) is mandatory, not optional
428
428
  - **Preserve the loop** - Do not exit until the user explicitly approves or cancels`,
429
429
  license: 'MIT',
430
430
  compatibility: 'Requires pscode CLI.',
@@ -437,318 +437,318 @@ export function getPsExploreCommandTemplate() {
437
437
  description: 'Enter explore mode - think through ideas, investigate problems, clarify requirements',
438
438
  category: 'Workflow',
439
439
  tags: ['workflow', 'explore', 'experimental', 'thinking'],
440
- content: `Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
441
-
442
- **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create Pscode artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
443
-
444
- **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
445
-
446
- **Input**: The argument after \`/ps:explore\` is whatever the user wants to think about. Could be:
447
- - A vague idea: "real-time collaboration"
448
- - A specific problem: "the auth system is getting unwieldy"
449
- - A change name: "add-dark-mode" (to explore in context of that change)
450
- - A comparison: "postgres vs sqlite for this"
451
- - Nothing (just enter explore mode)
452
-
453
- ---
454
-
455
- ## The Stance
456
-
457
- - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
458
- - **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
459
- - **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
460
- - **Adaptive** - Follow interesting threads, pivot when new information emerges
461
- - **Patient** - Don't rush to conclusions, let the shape of the problem emerge
462
- - **Grounded** - Explore the actual codebase when relevant, don't just theorize
463
-
464
- ---
465
-
466
- ## What You Might Do
467
-
468
- Depending on what the user brings, you might:
469
-
470
- **Explore the problem space**
471
- - Ask clarifying questions that emerge from what they said
472
- - Challenge assumptions
473
- - Reframe the problem
474
- - Find analogies
475
-
476
- **Investigate the codebase**
477
- - Map existing architecture relevant to the discussion
478
- - Find integration points
479
- - Identify patterns already in use
480
- - Surface hidden complexity
481
-
482
- **Compare options**
483
- - Brainstorm multiple approaches
484
- - Build comparison tables
485
- - Sketch tradeoffs
486
- - Recommend a path (if asked)
487
-
488
- **Visualize**
489
- \`\`\`
490
- ┌─────────────────────────────────────────┐
491
- │ Use ASCII diagrams liberally │
492
- ├─────────────────────────────────────────┤
493
- │ │
494
- │ ┌────────┐ ┌────────┐ │
495
- │ │ State │────────▶│ State │ │
496
- │ │ A │ │ B │ │
497
- │ └────────┘ └────────┘ │
498
- │ │
499
- │ System diagrams, state machines, │
500
- │ data flows, architecture sketches, │
501
- │ dependency graphs, comparison tables │
502
- │ │
503
- └─────────────────────────────────────────┘
504
- \`\`\`
505
-
506
- **Surface risks and unknowns**
507
- - Identify what could go wrong
508
- - Find gaps in understanding
509
- - Suggest spikes or investigations
510
-
511
- ---
512
-
513
- ## Pscode Awareness
514
-
515
- You have full context of the Pscode system. Use it naturally, don't force it.
516
-
517
- ### Check for context
518
-
519
- At the start, quickly check what exists:
520
- \`\`\`bash
521
- pscode list --json
522
- \`\`\`
523
-
524
- This tells you:
525
- - If there are active changes
526
- - Their names, schemas, and status
527
- - What the user might be working on
528
-
529
- If the user mentioned a specific change name, read its artifacts for context.
530
-
531
- ### When no change exists
532
-
533
- Think freely. When insights crystallize, you might offer:
534
-
535
- - "This feels solid enough to start a change. Want me to create a proposal?"
536
- - Or keep exploring - no pressure to formalize
537
-
538
- ### When a change exists
539
-
540
- If the user mentions a change or you detect one is relevant:
541
-
542
- 1. **Resolve and read existing artifacts for context**
543
- - Run \`pscode status --change "<name>" --json\`.
544
- - Use \`changeRoot\`, \`artifactPaths\`, and \`actionContext\` from the status JSON.
545
- - Read existing files from \`artifactPaths.<artifact>.existingOutputPaths\`.
546
-
547
- 2. **Reference them naturally in conversation**
548
- - "Your design mentions using Redis, but we just realized SQLite fits better..."
549
- - "The proposal scopes this to premium users, but we're now thinking everyone..."
550
-
551
- 3. **Offer to capture when decisions are made**
552
-
553
- | Insight Type | Where to Capture |
554
- |----------------------------|--------------------------------|
555
- | New requirement discovered | \`specs/<capability>/spec.md\` |
556
- | Requirement changed | \`specs/<capability>/spec.md\` |
557
- | Design decision made | \`design.md\` |
558
- | Scope changed | \`proposal.md\` |
559
- | New work identified | \`tasks.md\` |
560
- | Assumption invalidated | Relevant artifact |
561
-
562
- Example offers:
563
- - "That's a design decision. Capture it in design.md?"
564
- - "This is a new requirement. Add it to specs?"
565
- - "This changes scope. Update the proposal?"
566
-
567
- 4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
568
-
569
- ---
570
-
571
- ## What You Don't Have To Do
572
-
573
- - Follow a script
574
- - Ask the same questions every time
575
- - Produce a specific artifact
576
- - Reach a conclusion
577
- - Stay on topic if a tangent is valuable
578
- - Be brief (this is thinking time)
579
-
580
- ---
581
-
582
- ## Ending Discovery
583
-
584
- There's no required ending. Discovery might:
585
-
586
- - **Flow into a proposal**: "Ready to start? I can create a change proposal."
587
- - **Result in artifact updates**: "Updated design.md with these decisions"
588
- - **Just provide clarity**: User has what they need, moves on
589
- - **Continue later**: "We can pick this up anytime"
590
-
591
- When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
592
-
593
- ---
594
-
595
- ## After the First Propose — Refinement Validation Loop
596
-
597
- When exploration leads to a \`/ps:propose\` being executed (or when the user asks to formalize the idea into a proposal), the following **refinement validation loop** must run after all artifacts are generated. This is mandatory — do not skip it.
598
-
599
- ### Step RF1 — Show Refinement Summary
600
-
601
- After the proposal artifacts (proposal.md, design.md, tasks.md) are created, immediately present a structured refinement summary. Read the generated files to extract the content:
602
-
603
- \`\`\`markdown
604
- ## 🔍 Refinamento da Proposta — <change-name>
605
-
606
- **Objetivo:** <1-2 sentences from proposal.md>
607
-
608
- ### O que será implementado
609
- <3-5 bullet points from design.md / tasks.md>
610
-
611
- ### Escopo e decisões técnicas
612
- <2-3 key technical decisions from design.md>
613
-
614
- ### Tarefas geradas
615
- <numbered list from tasks.md>
616
-
617
- ---
618
- Para iniciar a implementação quando aprovado:
619
- \`\`\`
620
- /ps:apply <change-name>
621
- \`\`\`
622
- \`\`\`
623
-
624
- ---
625
-
626
- ### Step RF2 — Sync Trello (if configured)
627
-
628
- If \`pscode/trello.yaml\` exists and a Trello card was created or found during propose:
629
-
630
- **a. Update the card description** with the refined summary:
631
- \`\`\`tool
632
- mcp__claude_ai_Trello_Custom__update_card
633
- card_id: "<cardId>"
634
- desc: |
635
- **Objetivo:** <summary>
636
-
637
- **O que será implementado:**
638
- <bullet list>
639
-
640
- **Decisões técnicas:**
641
- <key decisions>
642
-
643
- **Artefatos:** pscode/changes/<name>/
644
- \`\`\`
645
-
646
- **b. Add a comment with the implementation command in Markdown:**
647
- \`\`\`tool
648
- mcp__claude_ai_Trello_Custom__add_comment
649
- card_id: "<cardId>"
650
- text: |
651
- ## Refinamento concluído via /ps:explore ✓
652
-
653
- **Change:** \`<name>\`
654
- **Artefatos:** proposal.md · design.md · tasks.md
655
-
656
- ### Resumo
657
- <2-3 line summary>
658
-
659
- ### Para iniciar a implementação
660
- \`\`\`
661
- /ps:apply <name>
662
- \`\`\`
663
-
664
- _Aguardando aprovação para mover para Ready to Dev._
665
- \`\`\`
666
-
667
- ---
668
-
669
- ### Step RF3 — Ask for Approval
670
-
671
- Use **AskUserQuestion** to ask:
672
-
673
- > "A implementação e o planejamento estão de acordo com o esperado?"
674
-
675
- Options:
676
- - ✅ Sim, mover para Ready to Dev
677
- - 🔄 Não, quero ajustar o plano
678
- - ❌ Cancelar (manter em refinamento)
679
-
680
- ---
681
-
682
- ### Step RF3a — If APPROVED
683
-
684
- 1. Move the Trello card to \`lists.ready\` (if configured):
685
- \`\`\`tool
686
- mcp__claude_ai_Trello_Custom__update_card
687
- card_id: "<cardId>"
688
- list_id: "<lists.ready.id>"
689
- \`\`\`
690
-
691
- 2. Add final comment:
692
- \`\`\`tool
693
- mcp__claude_ai_Trello_Custom__add_comment
694
- card_id: "<cardId>"
695
- text: |
696
- ## ✅ Aprovado para Ready to Dev
697
-
698
- O planejamento foi revisado e aprovado durante o /ps:explore.
699
-
700
- ### Próximo passo
701
- \`\`\`
702
- /ps:apply <name>
703
- \`\`\`
704
- \`\`\`
705
-
706
- 3. Show success:
707
- \`\`\`
708
- ## ✅ Pronto para desenvolvimento!
709
-
710
- Change: <name>
711
- Card movido para: <lists.ready.name>
712
-
713
- /ps:apply <name>
714
- \`\`\`
715
-
716
- ---
717
-
718
- ### Step RF3b — If NOT APPROVED (loop)
719
-
720
- 1. Ask what needs to change.
721
- 2. Update the relevant artifacts (proposal.md / design.md / tasks.md).
722
- 3. Update the Trello card description with the revised plan.
723
- 4. **Go back to Step RF1** — show the updated summary and ask again.
724
- 5. **Keep looping** until the user approves or cancels.
725
-
726
- ---
727
-
728
- ### Step RF3c — If CANCELLED
729
-
730
- Show:
731
- \`\`\`
732
- ⏸ Refinamento pausado.
733
- O card permanece em <current list>.
734
- Retome com /ps:explore <name> quando quiser.
735
- \`\`\`
736
-
737
- Do NOT move the card. End the loop.
738
-
739
- ---
740
-
741
- ## Guardrails
742
-
743
- - **Don't implement** - Never write code or implement features. Creating Pscode artifacts is fine, writing application code is not.
744
- - **Don't fake understanding** - If something is unclear, dig deeper
745
- - **Don't rush** - Discovery is thinking time, not task time
746
- - **Don't force structure** - Let patterns emerge naturally
747
- - **Don't auto-capture** - Offer to save insights, don't just do it
748
- - **Do visualize** - A good diagram is worth many paragraphs
749
- - **Do explore the codebase** - Ground discussions in reality
750
- - **Do question assumptions** - Including the user's and your own
751
- - **Always run the refinement loop after propose** - When exploration leads to a proposal, the refinement validation loop (Steps RF1–RF3) is mandatory, not optional
440
+ content: `Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
441
+
442
+ **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create Pscode artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
443
+
444
+ **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
445
+
446
+ **Input**: The argument after \`/ps:explore\` is whatever the user wants to think about. Could be:
447
+ - A vague idea: "real-time collaboration"
448
+ - A specific problem: "the auth system is getting unwieldy"
449
+ - A change name: "add-dark-mode" (to explore in context of that change)
450
+ - A comparison: "postgres vs sqlite for this"
451
+ - Nothing (just enter explore mode)
452
+
453
+ ---
454
+
455
+ ## The Stance
456
+
457
+ - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
458
+ - **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
459
+ - **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
460
+ - **Adaptive** - Follow interesting threads, pivot when new information emerges
461
+ - **Patient** - Don't rush to conclusions, let the shape of the problem emerge
462
+ - **Grounded** - Explore the actual codebase when relevant, don't just theorize
463
+
464
+ ---
465
+
466
+ ## What You Might Do
467
+
468
+ Depending on what the user brings, you might:
469
+
470
+ **Explore the problem space**
471
+ - Ask clarifying questions that emerge from what they said
472
+ - Challenge assumptions
473
+ - Reframe the problem
474
+ - Find analogies
475
+
476
+ **Investigate the codebase**
477
+ - Map existing architecture relevant to the discussion
478
+ - Find integration points
479
+ - Identify patterns already in use
480
+ - Surface hidden complexity
481
+
482
+ **Compare options**
483
+ - Brainstorm multiple approaches
484
+ - Build comparison tables
485
+ - Sketch tradeoffs
486
+ - Recommend a path (if asked)
487
+
488
+ **Visualize**
489
+ \`\`\`
490
+ ┌─────────────────────────────────────────┐
491
+ │ Use ASCII diagrams liberally │
492
+ ├─────────────────────────────────────────┤
493
+ │ │
494
+ │ ┌────────┐ ┌────────┐ │
495
+ │ │ State │────────▶│ State │ │
496
+ │ │ A │ │ B │ │
497
+ │ └────────┘ └────────┘ │
498
+ │ │
499
+ │ System diagrams, state machines, │
500
+ │ data flows, architecture sketches, │
501
+ │ dependency graphs, comparison tables │
502
+ │ │
503
+ └─────────────────────────────────────────┘
504
+ \`\`\`
505
+
506
+ **Surface risks and unknowns**
507
+ - Identify what could go wrong
508
+ - Find gaps in understanding
509
+ - Suggest spikes or investigations
510
+
511
+ ---
512
+
513
+ ## Pscode Awareness
514
+
515
+ You have full context of the Pscode system. Use it naturally, don't force it.
516
+
517
+ ### Check for context
518
+
519
+ At the start, quickly check what exists:
520
+ \`\`\`bash
521
+ pscode list --json
522
+ \`\`\`
523
+
524
+ This tells you:
525
+ - If there are active changes
526
+ - Their names, schemas, and status
527
+ - What the user might be working on
528
+
529
+ If the user mentioned a specific change name, read its artifacts for context.
530
+
531
+ ### When no change exists
532
+
533
+ Think freely. When insights crystallize, you might offer:
534
+
535
+ - "This feels solid enough to start a change. Want me to create a proposal?"
536
+ - Or keep exploring - no pressure to formalize
537
+
538
+ ### When a change exists
539
+
540
+ If the user mentions a change or you detect one is relevant:
541
+
542
+ 1. **Resolve and read existing artifacts for context**
543
+ - Run \`pscode status --change "<name>" --json\`.
544
+ - Use \`changeRoot\`, \`artifactPaths\`, and \`actionContext\` from the status JSON.
545
+ - Read existing files from \`artifactPaths.<artifact>.existingOutputPaths\`.
546
+
547
+ 2. **Reference them naturally in conversation**
548
+ - "Your design mentions using Redis, but we just realized SQLite fits better..."
549
+ - "The proposal scopes this to premium users, but we're now thinking everyone..."
550
+
551
+ 3. **Offer to capture when decisions are made**
552
+
553
+ | Insight Type | Where to Capture |
554
+ |----------------------------|--------------------------------|
555
+ | New requirement discovered | \`specs/<capability>/spec.md\` |
556
+ | Requirement changed | \`specs/<capability>/spec.md\` |
557
+ | Design decision made | \`design.md\` |
558
+ | Scope changed | \`proposal.md\` |
559
+ | New work identified | \`tasks.md\` |
560
+ | Assumption invalidated | Relevant artifact |
561
+
562
+ Example offers:
563
+ - "That's a design decision. Capture it in design.md?"
564
+ - "This is a new requirement. Add it to specs?"
565
+ - "This changes scope. Update the proposal?"
566
+
567
+ 4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
568
+
569
+ ---
570
+
571
+ ## What You Don't Have To Do
572
+
573
+ - Follow a script
574
+ - Ask the same questions every time
575
+ - Produce a specific artifact
576
+ - Reach a conclusion
577
+ - Stay on topic if a tangent is valuable
578
+ - Be brief (this is thinking time)
579
+
580
+ ---
581
+
582
+ ## Ending Discovery
583
+
584
+ There's no required ending. Discovery might:
585
+
586
+ - **Flow into a proposal**: "Ready to start? I can create a change proposal."
587
+ - **Result in artifact updates**: "Updated design.md with these decisions"
588
+ - **Just provide clarity**: User has what they need, moves on
589
+ - **Continue later**: "We can pick this up anytime"
590
+
591
+ When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
592
+
593
+ ---
594
+
595
+ ## After the First Propose — Refinement Validation Loop
596
+
597
+ When exploration leads to a \`/ps:propose\` being executed (or when the user asks to formalize the idea into a proposal), the following **refinement validation loop** must run after all artifacts are generated. This is mandatory — do not skip it.
598
+
599
+ ### Step RF1 — Show Refinement Summary
600
+
601
+ After the proposal artifacts (proposal.md, design.md, tasks.md) are created, immediately present a structured refinement summary. Read the generated files to extract the content:
602
+
603
+ \`\`\`markdown
604
+ ## 🔍 Refinamento da Proposta — <change-name>
605
+
606
+ **Objetivo:** <1-2 sentences from proposal.md>
607
+
608
+ ### O que será implementado
609
+ <3-5 bullet points from design.md / tasks.md>
610
+
611
+ ### Escopo e decisões técnicas
612
+ <2-3 key technical decisions from design.md>
613
+
614
+ ### Tarefas geradas
615
+ <numbered list from tasks.md>
616
+
617
+ ---
618
+ Para iniciar a implementação quando aprovado:
619
+ \`\`\`
620
+ /ps:apply <change-name>
621
+ \`\`\`
622
+ \`\`\`
623
+
624
+ ---
625
+
626
+ ### Step RF2 — Sync Trello (if configured)
627
+
628
+ If \`pscode/trello.yaml\` exists and a Trello card was created or found during propose:
629
+
630
+ **a. Update the card description** with the refined summary:
631
+ \`\`\`tool
632
+ mcp__claude_ai_Trello_Custom__update_card
633
+ card_id: "<cardId>"
634
+ desc: |
635
+ **Objetivo:** <summary>
636
+
637
+ **O que será implementado:**
638
+ <bullet list>
639
+
640
+ **Decisões técnicas:**
641
+ <key decisions>
642
+
643
+ **Artefatos:** pscode/changes/<name>/
644
+ \`\`\`
645
+
646
+ **b. Add a comment with the implementation command in Markdown:**
647
+ \`\`\`tool
648
+ mcp__claude_ai_Trello_Custom__add_comment
649
+ card_id: "<cardId>"
650
+ text: |
651
+ ## Refinamento concluído via /ps:explore ✓
652
+
653
+ **Change:** \`<name>\`
654
+ **Artefatos:** proposal.md · design.md · tasks.md
655
+
656
+ ### Resumo
657
+ <2-3 line summary>
658
+
659
+ ### Para iniciar a implementação
660
+ \`\`\`
661
+ /ps:apply <name>
662
+ \`\`\`
663
+
664
+ _Aguardando aprovação para mover para Ready to Dev._
665
+ \`\`\`
666
+
667
+ ---
668
+
669
+ ### Step RF3 — Ask for Approval
670
+
671
+ Use **AskUserQuestion** to ask:
672
+
673
+ > "A implementação e o planejamento estão de acordo com o esperado?"
674
+
675
+ Options:
676
+ - ✅ Sim, mover para Ready to Dev
677
+ - 🔄 Não, quero ajustar o plano
678
+ - ❌ Cancelar (manter em refinamento)
679
+
680
+ ---
681
+
682
+ ### Step RF3a — If APPROVED
683
+
684
+ 1. Move the Trello card to \`lists.ready\` (if configured):
685
+ \`\`\`tool
686
+ mcp__claude_ai_Trello_Custom__update_card
687
+ card_id: "<cardId>"
688
+ list_id: "<lists.ready.id>"
689
+ \`\`\`
690
+
691
+ 2. Add final comment:
692
+ \`\`\`tool
693
+ mcp__claude_ai_Trello_Custom__add_comment
694
+ card_id: "<cardId>"
695
+ text: |
696
+ ## ✅ Aprovado para Ready to Dev
697
+
698
+ O planejamento foi revisado e aprovado durante o /ps:explore.
699
+
700
+ ### Próximo passo
701
+ \`\`\`
702
+ /ps:apply <name>
703
+ \`\`\`
704
+ \`\`\`
705
+
706
+ 3. Show success:
707
+ \`\`\`
708
+ ## ✅ Pronto para desenvolvimento!
709
+
710
+ Change: <name>
711
+ Card movido para: <lists.ready.name>
712
+
713
+ /ps:apply <name>
714
+ \`\`\`
715
+
716
+ ---
717
+
718
+ ### Step RF3b — If NOT APPROVED (loop)
719
+
720
+ 1. Ask what needs to change.
721
+ 2. Update the relevant artifacts (proposal.md / design.md / tasks.md).
722
+ 3. Update the Trello card description with the revised plan.
723
+ 4. **Go back to Step RF1** — show the updated summary and ask again.
724
+ 5. **Keep looping** until the user approves or cancels.
725
+
726
+ ---
727
+
728
+ ### Step RF3c — If CANCELLED
729
+
730
+ Show:
731
+ \`\`\`
732
+ ⏸ Refinamento pausado.
733
+ O card permanece em <current list>.
734
+ Retome com /ps:explore <name> quando quiser.
735
+ \`\`\`
736
+
737
+ Do NOT move the card. End the loop.
738
+
739
+ ---
740
+
741
+ ## Guardrails
742
+
743
+ - **Don't implement** - Never write code or implement features. Creating Pscode artifacts is fine, writing application code is not.
744
+ - **Don't fake understanding** - If something is unclear, dig deeper
745
+ - **Don't rush** - Discovery is thinking time, not task time
746
+ - **Don't force structure** - Let patterns emerge naturally
747
+ - **Don't auto-capture** - Offer to save insights, don't just do it
748
+ - **Do visualize** - A good diagram is worth many paragraphs
749
+ - **Do explore the codebase** - Ground discussions in reality
750
+ - **Do question assumptions** - Including the user's and your own
751
+ - **Always run the refinement loop after propose** - When exploration leads to a proposal, the refinement validation loop (Steps RF1–RF3) is mandatory, not optional
752
752
  - **Preserve the loop** - Do not exit until the user explicitly approves or cancels`
753
753
  };
754
754
  }