planflow-ai 1.1.3 → 1.1.4

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 (110) hide show
  1. package/.claude/commands/brain.md +0 -3
  2. package/.claude/commands/create-contract.md +22 -68
  3. package/.claude/commands/create-plan.md +29 -141
  4. package/.claude/commands/discovery-plan.md +28 -183
  5. package/.claude/commands/execute-plan.md +3 -63
  6. package/.claude/commands/flow.md +43 -94
  7. package/.claude/commands/learn.md +0 -3
  8. package/.claude/commands/review-code.md +3 -106
  9. package/.claude/commands/review-pr.md +0 -50
  10. package/.claude/commands/setup.md +0 -5
  11. package/.claude/commands/write-tests.md +0 -7
  12. package/.claude/resources/core/_index.md +0 -37
  13. package/.claude/resources/core/autopilot-mode.md +44 -251
  14. package/.claude/resources/core/brain-capture.md +4 -92
  15. package/.claude/resources/core/complexity-scoring.md +1 -30
  16. package/.claude/resources/core/project-ledger.md +0 -57
  17. package/.claude/resources/languages/_index.md +13 -61
  18. package/.claude/resources/languages/python-patterns.md +0 -243
  19. package/.claude/resources/languages/typescript-patterns.md +0 -213
  20. package/.claude/resources/patterns/_index.md +0 -70
  21. package/.claude/resources/patterns/brain-patterns.md +0 -3
  22. package/.claude/resources/patterns/discovery-patterns.md +2 -58
  23. package/.claude/resources/patterns/discovery-templates.md +0 -12
  24. package/.claude/resources/patterns/plans-patterns.md +3 -22
  25. package/.claude/resources/patterns/plans-templates.md +9 -102
  26. package/.claude/resources/patterns/review-code-templates.md +4 -21
  27. package/.claude/resources/patterns/review-pr-patterns.md +0 -21
  28. package/.claude/resources/skills/brain-skill.md +18 -11
  29. package/.claude/resources/skills/create-contract-skill.md +30 -13
  30. package/.claude/resources/skills/create-plan-skill.md +33 -123
  31. package/.claude/resources/skills/discovery-skill.md +34 -158
  32. package/.claude/resources/skills/execute-plan-skill.md +18 -394
  33. package/.claude/resources/skills/learn-skill.md +17 -11
  34. package/.claude/resources/skills/review-code-skill.md +39 -125
  35. package/.claude/resources/skills/review-pr-skill.md +92 -80
  36. package/.claude/resources/skills/setup-skill.md +0 -93
  37. package/.claude/resources/skills/write-tests-skill.md +0 -22
  38. package/README.md +21 -113
  39. package/dist/cli/commands/init.d.ts.map +1 -1
  40. package/dist/cli/commands/init.js +3 -12
  41. package/dist/cli/commands/init.js.map +1 -1
  42. package/dist/cli/handlers/claude.d.ts +1 -1
  43. package/dist/cli/handlers/claude.d.ts.map +1 -1
  44. package/dist/cli/handlers/claude.js +2 -45
  45. package/dist/cli/handlers/claude.js.map +1 -1
  46. package/dist/cli/handlers/codex.d.ts.map +1 -1
  47. package/dist/cli/handlers/codex.js +0 -11
  48. package/dist/cli/handlers/codex.js.map +1 -1
  49. package/dist/cli/handlers/cursor.d.ts +1 -1
  50. package/dist/cli/handlers/cursor.d.ts.map +1 -1
  51. package/dist/cli/handlers/cursor.js +2 -28
  52. package/dist/cli/handlers/cursor.js.map +1 -1
  53. package/dist/cli/handlers/shared.d.ts +1 -2
  54. package/dist/cli/handlers/shared.d.ts.map +1 -1
  55. package/dist/cli/handlers/shared.js +9 -140
  56. package/dist/cli/handlers/shared.js.map +1 -1
  57. package/dist/cli/index.js +0 -72
  58. package/dist/cli/index.js.map +1 -1
  59. package/dist/cli/types.d.ts +0 -1
  60. package/dist/cli/types.d.ts.map +1 -1
  61. package/dist/cli/utils/files.d.ts.map +1 -1
  62. package/dist/cli/utils/files.js +1 -6
  63. package/dist/cli/utils/files.js.map +1 -1
  64. package/dist/cli/utils/prompts.d.ts +9 -0
  65. package/dist/cli/utils/prompts.d.ts.map +1 -1
  66. package/dist/cli/utils/prompts.js +23 -0
  67. package/dist/cli/utils/prompts.js.map +1 -1
  68. package/package.json +1 -2
  69. package/rules/core/_index.mdc +0 -30
  70. package/rules/core/autopilot-mode.mdc +88 -263
  71. package/rules/core/brain-capture.mdc +3 -14
  72. package/rules/patterns/_index.mdc +0 -70
  73. package/rules/patterns/brain-patterns.mdc +0 -2
  74. package/rules/patterns/discovery-patterns.mdc +6 -152
  75. package/rules/patterns/plans-patterns.mdc +9 -28
  76. package/rules/patterns/plans-templates.mdc +0 -57
  77. package/rules/skills/brain-skill.mdc +0 -8
  78. package/rules/skills/create-contract-skill.mdc +30 -12
  79. package/rules/skills/create-plan-skill.mdc +30 -112
  80. package/rules/skills/discovery-skill.mdc +34 -153
  81. package/rules/skills/execute-plan-skill.mdc +3 -254
  82. package/rules/skills/learn-skill.mdc +0 -8
  83. package/rules/skills/review-code-skill.mdc +39 -122
  84. package/rules/skills/review-pr-skill.mdc +93 -79
  85. package/rules/skills/setup-skill.mdc +0 -81
  86. package/rules/skills/write-tests-skill.mdc +0 -8
  87. package/skills/plan-flow/flow/SKILL.md +29 -54
  88. package/templates/shared/CLAUDE.md.template +0 -1
  89. package/.claude/resources/core/agent-profiles.md +0 -107
  90. package/.claude/resources/core/audit-trail.md +0 -180
  91. package/.claude/resources/core/orchestration-workflows.md +0 -187
  92. package/.claude/resources/core/tech-detection.md +0 -82
  93. package/.claude/resources/languages/go-patterns.md +0 -337
  94. package/.claude/resources/languages/rust-patterns.md +0 -363
  95. package/.claude/resources/patterns/autopilot-progress-patterns.md +0 -124
  96. package/.claude/resources/patterns/handoff-patterns.md +0 -160
  97. package/.claude/resources/patterns/parallel-review-patterns.md +0 -164
  98. package/.claude/resources/patterns/security-scan-patterns.md +0 -137
  99. package/rules/core/agent-profiles.mdc +0 -111
  100. package/rules/core/audit-trail.mdc +0 -114
  101. package/rules/core/orchestration-workflows.mdc +0 -149
  102. package/rules/patterns/autopilot-progress-patterns.mdc +0 -124
  103. package/rules/patterns/handoff-patterns.mdc +0 -164
  104. package/rules/patterns/parallel-review-patterns.mdc +0 -168
  105. package/rules/patterns/security-scan-patterns.mdc +0 -141
  106. package/scripts/hooks/pre-compact.cjs +0 -85
  107. package/scripts/hooks/session-end.cjs +0 -284
  108. package/scripts/hooks/session-start.cjs +0 -145
  109. package/templates/shared/hooks.json.example +0 -7
  110. package/templates/shared/session-hooks-instructions.md +0 -29
@@ -63,9 +63,6 @@ RELATED COMMANDS:
63
63
 
64
64
  ---
65
65
 
66
- > **AGENT_PROFILE: write-restricted**
67
- > See `.claude/resources/core/agent-profiles.md` for tool access rules.
68
-
69
66
  ## Critical Rules
70
67
 
71
68
  | Rule | Description |
@@ -55,18 +55,12 @@ RELATED COMMANDS:
55
55
 
56
56
  ---
57
57
 
58
- > **MODE: Research**
59
- > Explore before concluding. Read 3x more than you write. Prefer Read/Grep/Glob/WebSearch tools.
60
- > Ask clarifying questions when uncertain. Don't jump to implementation.
61
-
62
- > **AGENT_PROFILE: read-only**
63
- > See `.claude/resources/core/agent-profiles.md` for tool access rules.
64
-
65
58
  ## Critical Rules
66
59
 
67
60
  | Rule | Description |
68
61
  | ------------------------ | -------------------------------------------------------- |
69
62
  | **No Auto-Chaining** | NEVER auto-invoke /discovery-plan - user must invoke it |
63
+ | **File Only** | Save the `.md` file and report its path. Do NOT show full content in chat. |
70
64
  | **Complete and Stop** | After presenting results, STOP and wait for user |
71
65
 
72
66
  ---
@@ -122,27 +116,30 @@ See: `.claude/resources/skills/create-contract-skill.md`
122
116
 
123
117
  ---
124
118
 
125
- ### Step 4: Present Results
119
+ ### Step 4: Save File and Stop
126
120
 
127
- After the skill completes, confirm file creation:
121
+ After the skill completes:
128
122
 
129
- ```markdown
130
- Contract Created!
123
+ 1. **Save the contract document** to `flow/contracts/<service_name>_contract.md`
124
+ 2. **Report only the file path** — do NOT display the full contract content in chat
125
+ 3. **STOP** — do NOT auto-invoke `/discovery-plan`
131
126
 
132
- **Deliverable**: `flow/contracts/<service_name>_contract.md`
127
+ **Output to the user** (this is the ONLY thing to show):
133
128
 
134
- **Summary**:
135
- - X endpoints documented
136
- - Authentication: [method]
137
- - Error handling documented
129
+ ```markdown
130
+ Contract created.
138
131
 
139
- **Next Steps** (user must invoke manually):
140
- 1. Review the contract above
141
- 2. Request any refinements
142
- 3. When ready, invoke `/discovery-plan @flow/contracts/<service_name>_contract.md`
132
+ **Created**: `flow/contracts/<service_name>_contract.md`
133
+
134
+ Next: review the file, then run `/discovery-plan` when ready.
143
135
  ```
144
136
 
145
- **CRITICAL**: This command is now complete. Do NOT auto-invoke `/discovery-plan`. Wait for the user to explicitly invoke it.
137
+ ⚠️ **CRITICAL**: After saving the file, the command is DONE. Do NOT:
138
+ - Show the full contract content in chat
139
+ - Auto-invoke `/discovery-plan`
140
+ - Offer to start discovery or planning
141
+
142
+ The user will read the `.md` file themselves and decide when to proceed.
146
143
 
147
144
  ---
148
145
 
@@ -175,9 +172,10 @@ Contract Created!
175
172
  |
176
173
  v
177
174
  +------------------------------------------+
178
- | Step 4: Present Results |
179
- | - Show summary |
180
- | - Link to /discovery-plan command |
175
+ | Step 4: Save File and Stop |
176
+ | - Save .md file to flow/contracts/ |
177
+ | - Report file path only |
178
+ | - STOP (no discovery, no plan) |
181
179
  +------------------------------------------+
182
180
  ```
183
181
 
@@ -248,47 +246,3 @@ When executing this command:
248
246
  | `interactive-questions-tool.md` | Interactive Questions UI workflow |
249
247
  | `/discovery-plan` command | Create discovery from contract |
250
248
  | `/create-plan` command | Create plan from discovery |
251
-
252
- ---
253
-
254
- ## Compaction Suggestion
255
-
256
- After contract creation completes, suggest context cleanup if the contract was complex (> 5 endpoints):
257
-
258
- > Contract created. Consider running `/compact` to free context before the next task.
259
-
260
- Skip if autopilot is ON.
261
-
262
- ---
263
-
264
- ## Brain Capture
265
-
266
- After contract creation completes, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.
267
-
268
- **Capture the following**:
269
-
270
- ```
271
- <!-- brain-capture
272
- skill: create-contract
273
- feature: [service name]
274
- status: completed
275
- data:
276
- service_name: [API/service name]
277
- endpoints_documented: [count]
278
- auth_type: [detected auth type]
279
- contract_doc: [path to contract document]
280
- -->
281
- ```
282
-
283
- Update `flow/brain/features/[service-name].md` with contract context and update `flow/brain/index.md`.
284
-
285
- ---
286
-
287
- ## Resource Capture
288
-
289
- During this skill's execution, watch for valuable reference materials worth preserving. See `.claude/resources/core/resource-capture.md` for capture rules, file format, and naming conventions.
290
-
291
- At natural break points, if you encounter information that could be useful for future development (API specs, architecture notes, config references, domain knowledge, etc.), ask the user: "I found something that could be useful for future reference: _{brief description}_. Should I save it to `flow/resources/`?"
292
-
293
- Only save if the user approves. Do not re-ask if declined.
294
-
@@ -25,25 +25,18 @@ DESCRIPTION:
25
25
  and tasks based on a discovery document or user input.
26
26
 
27
27
  USAGE:
28
- /create-plan [flags] <discovery_document>
29
- /create-plan [flags] <feature_description>
28
+ /create-plan <discovery_document>
29
+ /create-plan <feature_description>
30
30
  /create-plan -help
31
31
 
32
32
  ARGUMENTS:
33
33
  discovery_document Path to discovery document (recommended)
34
34
  feature_description Direct description of feature to plan (if no discovery)
35
35
 
36
- WORKFLOW FLAGS (optional):
37
- -bugfix Skip the discovery gate requirement. The bug report and user
38
- description serve as plan input instead of a discovery document.
39
- Use when fixing a bug where formal discovery is unnecessary.
40
-
41
- Without a flag, a discovery document is required (standard behavior).
42
-
43
36
  EXAMPLES:
44
37
  /create-plan @flow/discovery/discovery_user_auth_v1.md
45
38
  /create-plan "Add dark mode toggle to settings page"
46
- /create-plan -bugfix "Fix login timeout after 30 seconds of inactivity"
39
+ /create-plan @flow/contracts/api_contract.md
47
40
 
48
41
  OUTPUT:
49
42
  Creates: flow/plans/plan_<feature_name>_v<version>.md
@@ -71,43 +64,19 @@ RELATED COMMANDS:
71
64
  > - **If YES**: Autopilot is ON. After creating the plan and getting user approval, **auto-proceed** to `/execute-plan` with the plan output. Do NOT wait for manual invocation.
72
65
  > - **If NO**: Follow the standard rules below (stop and wait for user).
73
66
 
74
- > **MODE: Research**
75
- > Explore before concluding. Read 3x more than you write. Prefer Read/Grep/Glob/WebSearch tools.
76
- > Ask clarifying questions when uncertain. Don't jump to implementation.
77
-
78
- > **AGENT_PROFILE: read-only**
79
- > See `.claude/resources/core/agent-profiles.md` for tool access rules.
80
-
81
67
  ## Critical Rules
82
68
 
83
69
  | Rule | Description |
84
70
  | ------------------------ | -------------------------------------------------------- |
85
- | **Discovery Required** | NEVER create a plan without a discovery document. If none exists, run `/discovery-plan` first. **Exception**: The `-bugfix` flag bypasses this requirement — the bug report serves as input. |
71
+ | **Discovery Required** | NEVER create a plan without a discovery document. If none exists, run `/discovery-plan` first. No exceptions. |
86
72
  | **No Auto-Chaining** | NEVER auto-invoke /execute-plan - user must invoke it (unless autopilot ON) |
73
+ | **File Only** | Save the `.md` file and report its path. Do NOT show full content in chat. |
87
74
  | **Complete and Stop** | After presenting results, STOP and wait for user (unless autopilot ON) |
88
75
 
89
76
  ---
90
77
 
91
78
  ## Instructions
92
79
 
93
- ### Step 0: Parse Workflow Flag
94
-
95
- Check if the user input starts with a workflow flag:
96
-
97
- | Flag | Behavior Change |
98
- |------|----------------|
99
- | `-bugfix` | **Skip the discovery gate** (Step 2). The user's bug description + any diagnostic review serve as plan input. No discovery document required. The plan should focus on: root cause fix, regression prevention, and verification steps. |
100
- | (none) | Standard behavior — discovery document required |
101
-
102
- If a flag is found:
103
- 1. Set the **workflow context** for this execution
104
- 2. Remove the flag from the input (the rest is the user's prompt/reference)
105
- 3. The `-bugfix` flag bypasses the discovery gate in Step 2
106
-
107
- If no flag is found: proceed with standard behavior (backward compatible).
108
-
109
- ---
110
-
111
80
  ### Step 1: Validate Inputs
112
81
 
113
82
  | Input | Required | Description |
@@ -119,13 +88,9 @@ If no flag is found: proceed with standard behavior (backward compatible).
119
88
 
120
89
  ---
121
90
 
122
- ### Step 2: Validate Discovery Phase Completion (CONDITIONAL BLOCK)
123
-
124
- **A discovery document is REQUIRED before creating any plan — unless the `-bugfix` flag is set.**
125
-
126
- **If `-bugfix` flag is present**: Skip this step entirely. The user's bug description and any diagnostic review findings serve as plan input. Proceed directly to Step 3.
91
+ ### Step 2: Validate Discovery Phase Completion (HARD BLOCK)
127
92
 
128
- **If no `-bugfix` flag**:
93
+ **A discovery document is REQUIRED before creating any plan. No exceptions.**
129
94
 
130
95
  1. Check user input for a discovery document reference (`@flow/discovery/...`)
131
96
  2. If no reference provided, search `flow/discovery/` for a matching discovery document
@@ -143,6 +108,7 @@ If no flag is found: proceed with standard behavior (backward compatible).
143
108
  4. If a discovery document IS found: Proceed with plan creation using that document
144
109
 
145
110
  **Important**: NEVER read or reference files in `flow/archive/` - these are outdated.
111
+ **Important**: NEVER create a plan without a discovery document. This rule has NO exceptions.
146
112
 
147
113
  ---
148
114
 
@@ -169,50 +135,31 @@ See: `.claude/resources/skills/create-plan-skill.md`
169
135
 
170
136
  ---
171
137
 
172
- ### Step 5: Present Results
138
+ ### Step 5: Save File and Stop
173
139
 
174
- After the skill completes, confirm file creation and summarize:
140
+ After the skill completes:
175
141
 
176
- ```markdown
177
- Plan Created!
142
+ 1. **Save the plan document** to `flow/plans/plan_<feature>_v<version>.md`
143
+ 2. **Report only the file path** — do NOT display the full plan content in chat
144
+ 3. **STOP** — do NOT execute the plan, do NOT offer to build
178
145
 
179
- **Deliverable**: `flow/plans/plan_<feature>_v<version>.md`
146
+ **Output to the user** (this is the ONLY thing to show):
180
147
 
181
- **Summary**:
182
- - X phases created
183
- - Total complexity: XX/XX
184
- - Highest complexity: Phase X at Y/10
185
- ```
148
+ ```markdown
149
+ Plan created.
186
150
 
187
- **CRITICAL — Check autopilot mode BEFORE presenting next steps:**
188
-
189
- 1. **Check if `flow/.autopilot` exists**
190
- 2. **If autopilot is ON**: Do NOT show "Next Steps" or "invoke manually". Instead, use `AskUserQuestion` to ask for plan approval, then **immediately auto-proceed** to `/execute-plan` with the plan file. Do NOT stop. Do NOT wait for the user to manually invoke `/execute-plan`.
191
-
192
- ```typescript
193
- // When autopilot is ON, ask for approval then auto-proceed:
194
- AskUserQuestion({
195
- questions: [{
196
- question: "Plan is ready. Approve to proceed with execution?",
197
- header: "Plan",
198
- options: [
199
- { label: "Approve and execute", description: "Start executing the plan now" },
200
- { label: "Refine first", description: "Let me suggest changes to the plan before executing" }
201
- ],
202
- multiSelect: false
203
- }]
204
- })
205
- // If approved → immediately invoke /execute-plan (do NOT stop)
151
+ **Created**: `flow/plans/plan_<feature>_v<version>.md`
152
+
153
+ Next: review the file, then run `/execute-plan` when ready.
206
154
  ```
207
155
 
208
- 3. **If autopilot is OFF**: Show next steps and stop:
156
+ ⚠️ **CRITICAL**: After saving the file, the command is DONE. Do NOT:
157
+ - Show the full plan content in chat
158
+ - Auto-invoke `/execute-plan`
159
+ - Offer to start building or implementing
160
+ - Show implementation steps or code
209
161
 
210
- ```markdown
211
- **Next Steps**:
212
- 1. Review the plan above
213
- 2. Request any refinements
214
- 3. When ready, invoke `/execute-plan @flow/plans/plan_<feature>_v<version>.md`
215
- ```
162
+ The user will read the `.md` file themselves and decide when to proceed.
216
163
 
217
164
  ---
218
165
 
@@ -252,9 +199,10 @@ AskUserQuestion({
252
199
  |
253
200
  v
254
201
  +------------------------------------------+
255
- | Step 5: Present Results |
256
- | - Show summary |
257
- | - Link to /execute-plan command |
202
+ | Step 5: Save File and Stop |
203
+ | - Save .md file to flow/plans/ |
204
+ | - Report file path only |
205
+ | - STOP (no execute, no build) |
258
206
  +------------------------------------------+
259
207
  ```
260
208
 
@@ -327,63 +275,3 @@ When executing this command:
327
275
  | `complexity-scoring.md` | Complexity scoring system |
328
276
  | `/discovery-plan` command | Run discovery first |
329
277
  | `/execute-plan` command | Execute the created plan |
330
-
331
- ---
332
-
333
- ## Compaction Suggestion
334
-
335
- After plan creation completes, suggest context cleanup:
336
-
337
- > Plan created. Consider running `/compact` before execution to maximize available context for the implementation phases.
338
-
339
- Only suggest if the plan has > 3 phases. Skip if autopilot is ON.
340
-
341
- ---
342
-
343
- ## Brain Capture
344
-
345
- After plan creation completes successfully, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.
346
-
347
- **Capture the following**:
348
-
349
- ```
350
- <!-- brain-capture
351
- skill: create-plan
352
- feature: [feature name]
353
- status: completed
354
- data:
355
- phase_count: [number of phases]
356
- total_complexity: [sum of complexity scores]
357
- highest_phase: [phase name with highest score]
358
- discovery_link: [[discovery-feature-name]]
359
- plan_doc: [path to plan document]
360
- -->
361
- ```
362
-
363
- Update `flow/brain/features/[feature-name].md` with plan details and link to discovery entry.
364
-
365
- ---
366
-
367
- ## Resource Capture
368
-
369
- During this skill's execution, watch for valuable reference materials worth preserving. See `.claude/resources/core/resource-capture.md` for capture rules, file format, and naming conventions.
370
-
371
- At natural break points, if you encounter information that could be useful for future development (API specs, architecture notes, config references, domain knowledge, etc.), ask the user: "I found something that could be useful for future reference: _{brief description}_. Should I save it to `flow/resources/`?"
372
-
373
- Only save if the user approves. Do not re-ask if declined.
374
-
375
- ---
376
-
377
- ## Handoff
378
-
379
- ### Consumption
380
-
381
- Before creating the plan, check for `flow/handoffs/handoff_<feature>_discovery_to_plan.md` (or `handoff_<feature>_review_to_plan.md` for bugfix workflow). If it exists, read it silently and use its focus guidance to inform plan structure. If it doesn't exist, proceed normally (backward compatible).
382
-
383
- ### Production
384
-
385
- After the plan is created, produce a handoff for the execution step.
386
-
387
- **Output**: `flow/handoffs/handoff_<feature>_plan_to_execute.md`
388
-
389
- Include: feature name, workflow type, phase count, total complexity, highest complexity phase, plan and discovery paths, and focus guidance for execution.
@@ -18,13 +18,6 @@ This command creates a discovery document for gathering and clarifying requireme
18
18
  > - **If YES**: Autopilot is ON. After completing discovery and user Q&A, **auto-proceed** to `/create-plan` with the discovery output. Do NOT ask "Would you like to proceed?" - just continue.
19
19
  > - **If NO**: Follow the standard rules below (stop and wait for user).
20
20
 
21
- > **MODE: Research**
22
- > Explore before concluding. Read 3x more than you write. Prefer Read/Grep/Glob/WebSearch tools.
23
- > Ask clarifying questions when uncertain. Don't jump to implementation.
24
-
25
- > **AGENT_PROFILE: read-only**
26
- > See `.claude/resources/core/agent-profiles.md` for tool access rules.
27
-
28
21
  > ⚠️ **IMPORTANT - DISCOVERY ONLY**
29
22
  >
30
23
  > This command ONLY creates a discovery document. It does NOT:
@@ -50,28 +43,18 @@ DESCRIPTION:
50
43
  before creating an implementation plan. This is the recommended first step.
51
44
 
52
45
  USAGE:
53
- /discovery-plan [flags] <reference_document>
54
- /discovery-plan [flags] <feature_description>
46
+ /discovery-plan <reference_document>
47
+ /discovery-plan <feature_description>
55
48
  /discovery-plan -help
56
49
 
57
50
  ARGUMENTS:
58
51
  reference_document Contract, spec, or any document to analyze
59
52
  feature_description Description of what you want to build
60
53
 
61
- WORKFLOW FLAGS (optional):
62
- -security Focus on threat model, attack surface, compliance needs,
63
- and security requirements gathering.
64
- -refactor Focus on refactoring scope, target patterns, success criteria,
65
- and what to preserve during restructuring.
66
-
67
- Without a flag, performs standard feature requirements gathering.
68
-
69
54
  EXAMPLES:
70
55
  /discovery-plan @flow/contracts/api_contract.md
71
56
  /discovery-plan "User authentication with OAuth2"
72
57
  /discovery-plan @docs/feature-spec.md "Focus on the payment flow"
73
- /discovery-plan -security "Review payment system security"
74
- /discovery-plan -refactor "Restructure the API layer"
75
58
 
76
59
  OUTPUT:
77
60
  Creates: flow/discovery/discovery_<feature_name>_v<version>.md
@@ -83,9 +66,8 @@ WORKFLOW:
83
66
  4. Documents requirements (FR, NFR, Constraints)
84
67
  5. Proposes high-level approach (no code)
85
68
  6. Creates discovery document for review
86
- 7. Asks user if they want to proceed, refine, or stop
87
- 8. Supports iterative refinement (max 3 rounds)
88
- 9. Waits for user confirmation before proceeding
69
+ 7. Asks user if they want to proceed to /create-plan
70
+ 8. Waits for user confirmation before proceeding
89
71
 
90
72
  RECOMMENDED MODEL:
91
73
  Claude Opus 4.6 or Sonnet 4.5 for best results
@@ -104,7 +86,7 @@ These rules are mandatory. For detailed patterns and guidelines, see `.claude/re
104
86
  | Rule | Description |
105
87
  | ------------------------ | -------------------------------------------------------- |
106
88
  | **No Code** | NEVER write, edit, or generate code during discovery |
107
- | **Only Markdown Output** | The ONLY deliverable is the discovery markdown file |
89
+ | **Only Markdown Output** | The ONLY deliverable is the discovery markdown file. Do NOT display it in chat. |
108
90
  | **Ask Questions** | When in doubt, ask - don't assume |
109
91
  | **Read First** | Read all referenced documents before asking questions |
110
92
  | **High-Level Only** | Technical considerations are conceptual, not code |
@@ -113,30 +95,12 @@ These rules are mandatory. For detailed patterns and guidelines, see `.claude/re
113
95
  | **No Auto-Execution** | Do NOT auto-invoke commands without user confirmation (unless autopilot ON) |
114
96
  | **NO PLANNING** | Do NOT create implementation plans during discovery |
115
97
  | **NO EXECUTION** | Do NOT execute any implementation steps |
98
+ | **File Only** | Save the `.md` file and report its path. Do NOT show full content in chat. |
116
99
 
117
100
  ---
118
101
 
119
102
  ## Instructions
120
103
 
121
- ### Step 0: Parse Workflow Flag
122
-
123
- Check if the user input starts with a workflow flag:
124
-
125
- | Flag | Discovery Focus |
126
- |------|----------------|
127
- | `-security` | **Threat model and security requirements**. Questions focus on: auth flows, data sensitivity, encryption needs, access control, vulnerability surface, compliance requirements (SOC2, GDPR, PCI), and trust boundaries. Discovery document includes a "Threat Model" section and "Security Requirements" subsection. |
128
- | `-refactor` | **Refactoring scope and target patterns**. Questions focus on: current pain points, desired patterns, migration strategy, backward compatibility, what to preserve, success criteria, and acceptable breakage. Discovery document includes a "Baseline Assessment" section and "Target Architecture" subsection. |
129
- | (none) | Standard feature requirements gathering |
130
-
131
- If a flag is found:
132
- 1. Set the **discovery focus** for this execution
133
- 2. Remove the flag from the input (the rest is the user's prompt/reference)
134
- 3. The focus affects the questions asked in Step 4 and the structure of the output document
135
-
136
- If no flag is found: proceed with standard discovery (backward compatible).
137
-
138
- ---
139
-
140
104
  ### Step 1: Validate Inputs
141
105
 
142
106
  | Input | Required | Description |
@@ -158,24 +122,6 @@ To start the discovery process, I need to understand:
158
122
 
159
123
  ---
160
124
 
161
- ### Step 1.5: Search for Existing Solutions
162
-
163
- **Before recommending implementation**, check if the problem is already solved:
164
-
165
- 1. **Project code**: Use Grep/Glob to search for existing implementations, similar patterns, or utilities that already address part of the requirement
166
- 2. **Package registries**: Use WebSearch to check npm (for JS/TS projects) or PyPI (for Python projects) for established libraries
167
- - Search: `"{problem description} npm package"` or `"{problem description} python library"`
168
- - Evaluate: maintenance status (last publish date), weekly downloads, compatibility with project stack
169
- 3. **Document findings** in an "Existing Solutions Analysis" section in the discovery document
170
-
171
- **Decision criteria**:
172
- - If an existing library covers **>80%** of the need → recommend using it instead of building from scratch
173
- - If **<80%** → note what it covers and what custom work remains
174
-
175
- **Graceful degradation**: If WebSearch is unavailable, skip registry search and note "Package registry search skipped — WebSearch unavailable" in the discovery document. Always perform the project code search.
176
-
177
- ---
178
-
179
125
  ### Step 2: Extract Feature Name
180
126
 
181
127
  From the user input, extract or derive a feature name for the discovery document.
@@ -209,81 +155,37 @@ The skill will:
209
155
  6. Identify technical considerations
210
156
  7. Propose high-level approach
211
157
  8. Document risks and unknowns
212
- 9. Generate discovery document
213
- 10. Support iterative refinement (max 3 rounds) if user requests it
214
- 11. Ask user if they want to proceed to /create-plan
215
- 12. Wait for user confirmation before proceeding
158
+ 9. Generate discovery document and save to `flow/discovery/`
216
159
 
217
160
  See: `.claude/resources/skills/discovery-skill.md`
218
161
 
219
162
  ---
220
163
 
221
- ### Step 5: Present Results
164
+ ### Step 5: Save File and Stop
222
165
 
223
- After the skill completes, present the discovery document to the user:
166
+ After the skill completes:
224
167
 
225
- ```markdown
226
- Discovery Complete!
168
+ 1. **Save the discovery document** to `flow/discovery/discovery_<feature>_v<version>.md`
169
+ 2. **Report only the file path** — do NOT display the full document content in chat
170
+ 3. **STOP** — do NOT create a plan, do NOT offer to build, do NOT show implementation steps
227
171
 
228
- **Summary**:
229
- - X functional requirements gathered
230
- - X non-functional requirements identified
231
- - X risks documented
232
- - X questions resolved
172
+ **Output to the user** (this is the ONLY thing to show):
233
173
 
234
- **Deliverable Created**: `flow/discovery/discovery_<feature>_v1.md`
174
+ ```markdown
175
+ Discovery complete.
235
176
 
236
- **Next Steps**:
237
- 1. Review the discovery document above
238
- 2. Request any refinements or additions (if needed)
239
- 3. Proceed to planning when ready
240
- ```
177
+ **Created**: `flow/discovery/discovery_<feature>_v1.md`
241
178
 
242
- **Now ask the user using the `AskUserQuestion` tool**:
243
-
244
- ```typescript
245
- AskUserQuestion({
246
- questions: [{
247
- question: "Would you like me to proceed with creating the implementation plan?",
248
- header: "Next step",
249
- options: [
250
- { label: "Yes, create plan", description: "I'll invoke /create-plan with the discovery document" },
251
- { label: "No, review first", description: "You can review the discovery and invoke /create-plan when ready" },
252
- { label: "Refine discovery", description: "Iteratively refine the discovery document (max 3 rounds)" }
253
- ],
254
- multiSelect: false
255
- }]
256
- })
179
+ Next: review the file, then run `/create-plan` when ready.
257
180
  ```
258
181
 
259
- ⚠️ **WAIT for user response before proceeding**
260
-
261
- Do NOT auto-invoke `/create-plan` without user confirmation.
262
-
263
- #### Refinement Loop (when "Refine discovery" is selected)
264
-
265
- When the user selects "Refine discovery", invoke the discovery skill's **Step 9: Refinement Loop**:
266
-
267
- 1. **Accept feedback**: Ask user what areas need adjustment (requirements, approach, scope, risks)
268
- 2. **Follow-up questions**: Ask 1-3 targeted questions about the refinement areas only
269
- 3. **Update document**: Modify the discovery document in-place, add/update Refinement History section
270
- 4. **Re-present**: Show the updated document and offer the same 3 options again
271
- 5. **Round tracking**: Track refinement round count (max 3). After 3 rounds, only offer "Yes, create plan" and "No, review first" — the "Refine discovery" option is removed
272
-
273
- ```typescript
274
- // After 3 refinement rounds, remove the refine option:
275
- AskUserQuestion({
276
- questions: [{
277
- question: "Discovery refined 3 times (maximum). Would you like to proceed?",
278
- header: "Next step",
279
- options: [
280
- { label: "Yes, create plan", description: "I'll invoke /create-plan with the discovery document" },
281
- { label: "No, stop here", description: "You can review and invoke /create-plan manually when ready" }
282
- ],
283
- multiSelect: false
284
- }]
285
- })
286
- ```
182
+ ⚠️ **CRITICAL**: After saving the file, the command is DONE. Do NOT:
183
+ - Show the full discovery document content in chat
184
+ - Create or suggest an implementation plan
185
+ - Offer to build or execute anything
186
+ - Auto-invoke `/create-plan`
187
+
188
+ The user will read the `.md` file themselves and decide when to proceed.
287
189
 
288
190
  ---
289
191
 
@@ -317,10 +219,10 @@ AskUserQuestion({
317
219
  |
318
220
  v
319
221
  +------------------------------------------+
320
- | Step 5: Present Results |
321
- | - Show summary to user |
322
- | - Allow refinement |
323
- | - Link to /create-plan command |
222
+ | Step 5: Save File and Stop |
223
+ | - Save .md file to flow/discovery/ |
224
+ | - Report file path only |
225
+ | - STOP (no plan, no build) |
324
226
  +------------------------------------------+
325
227
  ```
326
228
 
@@ -403,60 +305,3 @@ Read: resources/tools/interactive-questions-tool.md (lines from TLS-IQ-3)
403
305
  | `discovery-templates.md` | Document templates |
404
306
  | `interactive-questions-tool.md` | Interactive Questions UI workflow |
405
307
  | `/create-plan` command | Creates plan from discovery document |
406
-
407
- ---
408
-
409
- ## Compaction Suggestion
410
-
411
- After discovery completes, suggest context cleanup:
412
-
413
- > Discovery complete. Consider running `/compact` before creating a plan to free context for the planning phase.
414
-
415
- Only suggest if the discovery was substantial (> 5 requirements gathered). Skip if autopilot is ON (context will be managed automatically).
416
-
417
- ---
418
-
419
- ## Brain Capture
420
-
421
- After discovery completes successfully, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.
422
-
423
- **Capture the following**:
424
-
425
- ```
426
- <!-- brain-capture
427
- skill: discovery
428
- feature: [feature name from discovery]
429
- status: completed
430
- data:
431
- user_prompt: [original user request]
432
- questions_asked: [count]
433
- questions_answered: [count]
434
- requirements_fr: [count of functional requirements]
435
- requirements_nfr: [count of non-functional requirements]
436
- discovery_doc: [path to discovery document]
437
- -->
438
- ```
439
-
440
- Write/update `flow/brain/features/[feature-name].md` with discovery context and update `flow/brain/index.md`.
441
-
442
- ---
443
-
444
- ## Resource Capture
445
-
446
- During this skill's execution, watch for valuable reference materials worth preserving. See `.claude/resources/core/resource-capture.md` for capture rules, file format, and naming conventions.
447
-
448
- At natural break points, if you encounter information that could be useful for future development (API specs, architecture notes, config references, domain knowledge, etc.), ask the user: "I found something that could be useful for future reference: _{brief description}_. Should I save it to `flow/resources/`?"
449
-
450
- Only save if the user approves. Do not re-ask if declined.
451
-
452
- ---
453
-
454
- ## Handoff Production
455
-
456
- After discovery completes, produce a handoff document for the next step. See `.claude/resources/patterns/handoff-patterns.md` [PTN-HND-1] for the template.
457
-
458
- **Output**: `flow/handoffs/handoff_<feature>_discovery_to_plan.md`
459
-
460
- Include: feature name, workflow type, requirements summary (FR/NFR/C counts), key decisions from Q&A, top risks, discovery doc path, and focus guidance for planning.
461
-
462
- Create the `flow/handoffs/` directory if it doesn't exist.